./pause_map.lua

  1. --TODO invert all items. 
  2. -- highlight_grp 
  3.  
  4. -- Uninvert the folllowing 
  5. -- icon 
  6. -- icon_highlight 
  7. -- line_1_txt 
  8. -- line_2_txt 
  9. -- line_3_txt 
  10. -- line_4_txt 
  11. -- hint_bar_highlight 
  12. ---- Need to add functionality to invert this one.. 
  13.  
  14. local Entered_with_gamepad = false 
  15.  
  16. local PAUSE_MAP_COLOR_ZOOM_SELECTED 		= {R = 220/255, 	G = 220/255, 		B = 220/255} 
  17. local PAUSE_MAP_COLOR_ZOOM_UNSELECTED 		= {R = 170/255, 	G = 170/255,		B = 170/255} 
  18.  
  19. -- Info is on left side of icon... 
  20. local PAUSE_MAP_HIGHLIGHT_TEXT_X_OFFSET_LEFT = 8 
  21. local PAUSE_MAP_HIGHLIGHT_HINTS_X_OFFSET_LEFT = 17 
  22.  
  23. -- Info is on right side of icon... 
  24. local PAUSE_MAP_HIGHLIGHT_TEXT_X_OFFSET_RIGHT = 27 
  25. local PAUSE_MAP_HIGHLIGHT_HINTS_X_OFFSET_RIGHT = 35 
  26.  
  27. --Invert scale for std definition... this needs to match the scale of the screen set in cell_forground.lua for standard definition. 
  28. -- it is used because coordinates are sent to pause_map.lua in screen space and not translated scale. 
  29. local PAUSE_MAP_CURSOR_STD_RES_SCALE = 1.67 
  30.  
  31. local X_FUNC_NO_OP					= 0 
  32. local X_FUNC_PLACE_BOOKMARK		= 1 
  33. local X_FUNC_REMOVE_BOOKMARK		= 2 
  34. local X_FUNC_TAXI						= 3 
  35.  
  36. local INTERFACE_EVENT_ADD_GPS				= 0 
  37. local INTERFACE_EVENT_REMOVE_GPS			= 1 
  38. local INTERFACE_EVENT_ADD_BOOKMARK		= 2 
  39. local INTERFACE_EVENT_REMOVE_BOOKMARK	= 3 
  40.  
  41. --Icons that are oriented horizontally. 
  42. Pause_map_icons_rectangle = { 
  43. 	["map_other_bookmark_a_1"]	 		= true, 
  44. 	["map_other_bookmark_a_2"] 		= true, 
  45. 	["map_other_bookmark_a_3"] 		= true, 
  46. 	["map_other_bookmark_a_4"] 		= true, 
  47. 	["map_other_bookmark_a_5"] 		= true, 
  48. 	["map_other_bookmark_b_1"] 		= true, 
  49. 	["map_other_bookmark_b_2"] 		= true, 
  50. 	["map_other_bookmark_b_3"] 		= true, 
  51. 	["map_other_bookmark_b_4"] 		= true, 
  52. 	["map_other_bookmark_b_5"]			= true, 
  53. 	["map_other_crib"]               = true, 
  54. 	["map_other_crib_4sale"]         = true, 
  55. 	["map_other_crib_purchase"]      = true, 
  56. 	["map_other_train"]              = true, 
  57. 	["map_start_mission_3ss"]        = true, 
  58. 	["map_start_mission_bh"]         = true, 
  59. 	["map_start_mission_rn"] 			= true, 
  60.    ["map_start_mission_ss"] 			= true, 
  61. 	["map_start_mission_ul"] 			= true, 
  62. 	["map_other_hidden_mission"] 		= true, 
  63. 	["map_store_property"] 				= true, 
  64. 	["map_store_property_owned"] 		= true, 
  65. 	["map_other_collect_drug"]			= true, 
  66. 	["map_other_collect_money"]		= true, 
  67. 	["map_other_collect_photoop"]		= true, 
  68. 	["map_other_collect_sexdoll"]		= true, 
  69. } 
  70.  
  71. local PAUSE_MAP_GREEN = 	{R = 136/255, 	G = 211/255,	B = 24/255} 
  72. local PAUSE_MAP_BLUE =  	{R = 25/255, 	G = 159/255, 	B = 229/255} 
  73. local PAUSE_MAP_YELLOW =  	{R = 245/255,	G = 228/255, 	B = 68/255} 
  74. local PAUSE_MAP_GREY =  	{R = 170/255,	G = 170/255, 	B = 170/255} 
  75. local PAUSE_MAP_PINK =  	{R = 204/255,	G =  73/255, 	B = 143/255} 
  76. local PAUSE_MAP_BROWN =  	{R = 153/255,	G =  69/255, 	B = 011/255} 
  77.  
  78. PAUSE_MAP_ICON_COLORS = {	 
  79. 	--Activities 
  80. 	["map_start_bonusderby"] 		= PAUSE_MAP_BLUE, 
  81. 	["map_start_chopshop"] 			= PAUSE_MAP_BLUE, 
  82. 	["map_start_cleansweep"] 		= PAUSE_MAP_BLUE,  
  83. 	["map_start_crowdcontrol"] 	= PAUSE_MAP_BLUE, 
  84. 	["map_start_demoderby"] 		= PAUSE_MAP_BLUE, 
  85. 	["map_start_drugtrafficking"] = PAUSE_MAP_BLUE, 
  86. 	["map_start_escort"] 			= PAUSE_MAP_BLUE, 
  87. 	["map_start_fightclub"] 		= PAUSE_MAP_BLUE, 
  88. 	["map_start_fuzz"] 				= PAUSE_MAP_BLUE,  
  89. 	["map_start_guardianangel"] 	= PAUSE_MAP_BLUE, 
  90. 	["map_start_heliassault"] 		= PAUSE_MAP_BLUE, 
  91. 	["map_start_hitman"] 			= PAUSE_MAP_BLUE, 
  92. 	["map_start_humantorch"] 		= PAUSE_MAP_BLUE, 
  93. 	["map_start_insfraud"] 			= PAUSE_MAP_BLUE,  
  94. 	["map_start_mayhem"] 			= PAUSE_MAP_BLUE,  
  95. 	["map_start_piracy"] 			= PAUSE_MAP_BLUE, 
  96. 	["map_start_racing"] 			= PAUSE_MAP_BLUE, 
  97. 	["map_start_snatch"] 			= PAUSE_MAP_BLUE, 
  98. 	["map_start_taxi"] 				= PAUSE_MAP_BLUE, 
  99. 	 
  100. 	["map_start_flashpoint"] 		= PAUSE_MAP_PINK, 
  101.  
  102. 	--Stores 
  103. 	["map_store_cardealer_high"] 	= PAUSE_MAP_GREEN, 
  104. 	["map_store_cardealer_low"]	= PAUSE_MAP_GREEN, 
  105. 	["map_store_clothing"]			= PAUSE_MAP_GREEN,	 
  106. 	["map_store_food"]				= PAUSE_MAP_GREEN, 
  107. 	["map_store_forgive"]			= PAUSE_MAP_GREEN, 
  108. 	["map_store_gun"]					= PAUSE_MAP_GREEN, 
  109. 	["map_store_jewelry"]			= PAUSE_MAP_GREEN, 
  110. 	["map_store_liqour"]				= PAUSE_MAP_GREEN, 
  111. 	["map_store_mechanic"]			= PAUSE_MAP_GREEN, 
  112. 	["map_store_music"]				= PAUSE_MAP_GREEN, 
  113. 	["map_store_surgeon"]			= PAUSE_MAP_GREEN, 
  114. 	["map_store_tattoo"] 			= PAUSE_MAP_GREEN, 
  115. 	["map_store_property"] 			= PAUSE_MAP_BROWN,	 
  116. 	-- 
  117. 	["map_store_cardealer_high_4sale"] 	= PAUSE_MAP_GREEN, 
  118. 	["map_store_cardealer_low_4sale"]	= PAUSE_MAP_GREEN, 
  119. 	["map_store_clothing_4sale"]			= PAUSE_MAP_GREEN,	 
  120. 	["map_store_food_4sale"]				= PAUSE_MAP_GREEN, 
  121. 	["map_store_forgive_4sale"]			= PAUSE_MAP_GREEN, 
  122. 	["map_store_gun_4sale"]					= PAUSE_MAP_GREEN, 
  123. 	["map_store_jewelry_4sale"]			= PAUSE_MAP_GREEN, 
  124. 	["map_store_liqour_4sale"]				= PAUSE_MAP_GREEN, 
  125. 	["map_store_mechanic_4sale"]			= PAUSE_MAP_GREEN, 
  126. 	["map_store_music_4sale"]				= PAUSE_MAP_GREEN, 
  127. 	["map_store_surgeon_4sale"]			= PAUSE_MAP_GREEN, 
  128. 	["map_store_tattoo_4sale"] 			= PAUSE_MAP_GREEN, 
  129. 	["map_store_property_4sale"] 			= PAUSE_MAP_BROWN,	 
  130. 	--Other 
  131. 	--Bookmarks 
  132. 	["map_other_bookmark_a_1"]			= PAUSE_MAP_GREY, 
  133. 	["map_other_bookmark_a_2"]			= PAUSE_MAP_GREY, 
  134. 	["map_other_bookmark_a_3"]			= PAUSE_MAP_GREY, 
  135. 	["map_other_bookmark_a_4"]			= PAUSE_MAP_GREY, 
  136. 	["map_other_bookmark_a_5"]			= PAUSE_MAP_GREY, 
  137. 	["map_other_bookmark_b_1"]			= PAUSE_MAP_GREY, 
  138. 	["map_other_bookmark_b_2"]			= PAUSE_MAP_GREY, 
  139. 	["map_other_bookmark_b_3"]			= PAUSE_MAP_GREY, 
  140. 	["map_other_bookmark_b_4"]			= PAUSE_MAP_GREY, 
  141. 	["map_other_bookmark_b_5"]			= PAUSE_MAP_GREY, 
  142.  
  143. 	--Collectables 
  144. 	["map_other_collect_drug"]			= PAUSE_MAP_GREY, 
  145. 	["map_other_collect_money"]		= PAUSE_MAP_GREY, 
  146. 	["map_other_collect_photoop"]		= PAUSE_MAP_GREY, 
  147. 	["map_other_collect_sexdoll"]		= PAUSE_MAP_GREY, 
  148. 	 
  149. 	--Randoms 
  150. 	["map_other_crib"]						= PAUSE_MAP_YELLOW, 
  151. 	["map_other_crib_4sale"]				= PAUSE_MAP_YELLOW,	 
  152. 	["map_other_crib_purchase"]			= PAUSE_MAP_YELLOW, 
  153. 	["map_other_hidden_act"]				= PAUSE_MAP_BLUE, 
  154. 	["map_other_hidden_crib"]				= PAUSE_MAP_YELLOW, 
  155. 	["map_other_hidden_mission"]			= PAUSE_MAP_GREY, 
  156. 	["map_other_hidden_property"]			= PAUSE_MAP_BROWN, 
  157. 	["map_other_hidden_store"]				= PAUSE_MAP_GREEN, 
  158. 	["map_other_property"]					= PAUSE_MAP_GREEN,			 
  159. 	["map_other_property_owned"]			= PAUSE_MAP_GREEN, 
  160. 		--[[ 
  161. 	map_start_mission_3ss 
  162. 	map_start_mission_bh 
  163. 	map_start_mission_rn 
  164. 	map_start_mission_ss 
  165. 	map_start_mission_ul 
  166. ]] 
  167. } 
  168. PAUSE_MAP_ICON_SMALL = { 
  169. 	["map_other_hidden_act"]				= true, 
  170. 	["map_other_hidden_crib"]				= true, 
  171. 	["map_other_hidden_mission"]			= true, 
  172. 	["map_other_hidden_store"]				= true, 
  173. 	["map_other_hidden_property"]			= true, 
  174. } 
  175.  
  176. Pause_map_elements = { 
  177. 	base = { 
  178. 		map_grp_h = -1, 
  179. 		map_h = -1, 
  180. 		cursor_h = -1, 
  181. 		info_h = -1 
  182. 	}, 
  183. 	filters = { 
  184. 		activities_h = -1, 
  185. 		all_h = -1, 
  186. 		collectibles = -1, 
  187. 		cribs_h = -1, 
  188. 		flashpoints = -1, 
  189. 		missions_h = -1, 
  190. 		none_h = -1, 
  191. 		stores_h = -1, 
  192. 		strongholds_h = -1, 
  193. 		text_h = -1, 
  194. 	}, 
  195. }		 
  196.  
  197. Pause_map_anims = {} 
  198.  
  199. Pause_map = { done = false, } 
  200.  
  201. Map_mask_handle = 0 
  202. Filter_list_handle = 0 
  203. Hint_bar_bg = 0 
  204. Cursor_tool_handle = 0 
  205. Pause_map_gamepad_monitor_thread_handle = 0 
  206.  
  207. Pause_map_cursor_status = { 
  208. 	x = -1, 
  209. 	y = -1, 
  210. 	gps_active = false, 
  211. 	x_func = -1, 
  212. 	fade_mode = "in" 
  213. } 
  214.  
  215. Pause_map_filter = -1 
  216. Pause_map_filter_locked = false 
  217.  
  218. Pause_map_highlight_status = { } 
  219. Pause_map_stag_popup = {}		--Popup for stag mode... 
  220. Pause_map_stag_popup_x = 0 
  221. Pause_map_stag_popup_y = 0 
  222.  
  223. Yes_no_choices = { 
  224. 	[1] = { 
  225. 		type = TYPE_BUTTON, 
  226. 		label = "PAUSE_MENU_ACCEPT", 
  227. 		id = 1, 
  228. 	}, 
  229. 	[2] = { 
  230. 		type = TYPE_BUTTON, 
  231. 		label = "CONTROL_CANCEL", 
  232. 		id = 2, 
  233. 	}, 
  234. } 
  235.  
  236. --Default all special modes to false. 
  237. Pause_map_tutorial_mode = false 
  238. Pause_map_taxi_mode = false 
  239. Pause_map_stag_mode = false 
  240. Pause_map_underground = false 
  241.  
  242. Pause_map_swapping = false 
  243.  
  244. Pause_map_exit_phone = false 
  245.  
  246. --Local globals... 
  247. local Input_tracker				--Keeps track on input mapping... 
  248. local Mouse_input_tracker = 0 
  249. local Filter_mouse_input_tracker = 0 
  250. local Hint_bar 					--Hintbar for main screen. 
  251.  
  252. local PC_hint_bar 
  253. local PC_zoom_in 
  254. local PC_zoom_out 
  255.  
  256. local Pause_map_control_meter 						--Control meter 
  257. local Pause_map_district_overlays = {}				--Table for the district overlays on the map.(LUCHADORES, 25%) 
  258. local Pause_map_district_overlays_count = 0		 
  259.  
  260. local Main_hint_data_set_gps 				= {CTRL_MENU_BUTTON_A, 	"MENU_SET_GPS"} 
  261. local Main_hint_data_back 					= {CTRL_MENU_BUTTON_B, 	"MENU_BACK"} 
  262. local Main_hint_data_back_map 			= {CTRL_MENU_BUTTON_BACK, "MENU_RESUME_GAME"} 
  263. local Main_hint_data_add_bookmark 		= {CTRL_BUTTON_X, 	"ADD_BOOKMARK", "B"}  
  264. local Main_hint_data_remove_gps 			= {CTRL_MENU_BUTTON_A, 	"MENU_REMOVE_GPS"} 
  265. local Main_hint_data_remove_bookmark 	= {CTRL_BUTTON_X, 	"REMOVE_BOOKMARK", "B"}  
  266. local Main_hint_data_taxi 					= {CTRL_BUTTON_X, 	"CELL_TAXI_CAB" } 
  267. local Main_hint_data_set_gps_rmb 		= {HINT_BUTTON_RMB_OVERRIDE, 	"MENU_SET_GPS"} 
  268. local Main_hint_data_remove_gps_rmb 	= {HINT_BUTTON_RMB_OVERRIDE, 	"MENU_REMOVE_GPS"} 
  269.  
  270. -- Only used for initialization 
  271. local Main_hint_data_waypoint_off = { 
  272. 		Main_hint_data_set_gps, 
  273. 		Main_hint_data_back_map, 
  274. 		Main_hint_data_back, 
  275. 		Main_hint_data_add_bookmark,		 
  276. } 
  277.  
  278. -- Only used for initialization 
  279. local Main_hint_data_waypoint_off_pc = { 
  280. 		Main_hint_data_set_gps_rmb, 
  281. 		Main_hint_data_add_bookmark,		 
  282. } 
  283.  
  284. local Pause_map_hints_stag 				= {{CTRL_MENU_BUTTON_A, 	"PAUSE_MAP_STAG_TAKEOVER_HINT"}} 
  285.  
  286.  
  287. function pause_map_init() 
  288.  
  289. 	Entered_with_gamepad = game_is_active_input_gamepad() 
  290. 	 
  291. 	local pause_map_doc_h = vint_document_find("pause_map") 
  292. 	Map_mask_handle = vint_object_find("map_mask", 0, pause_map_doc_h) 
  293. 	Filter_list_handle = vint_object_find("filter_list", 0, pause_map_doc_h) 
  294. 	Hint_bar_bg = vint_object_find("hint_bar_bg", 0, pause_map_doc_h) 
  295. 	Cursor_tool_handle = vint_object_find("cursor_tool", 0, pause_map_doc_h) 
  296.  
  297. 	Pause_map_filter = Vdo_cell_filter:new("filter_list") 
  298. 	Pause_map_filter:set_use_icons(true) 
  299. 	 
  300. 	Pause_map_control_meter = Vdo_city_control:new("control_meter") 
  301. 	 
  302. 	--Set callback for filter changing, the function that is passed here  
  303. 	--tells the game to change the map filter. 
  304. 	Pause_map_filter:filter_callback_set(game_pause_map_filter) 
  305. 	 
  306. 	vint_set_property(vint_object_find("pause_map"), "map_mode", "pause_map") 
  307. 		 
  308. 	--Set transition in and out events after into/extros 
  309. 	local h = vint_object_find("root_animation") 
  310.  
  311. 	-- Check if we come from phone or open the map cold 
  312. 	-- Pause_map_from_menu is initialized in cell_foreground 
  313. 	-- and set in cell_menu_main 
  314. 	 
  315. 	local map_alpha_out_twn_h = vint_object_find("map_alpha_out_twn") 
  316. 	vint_set_property(map_alpha_out_twn_h, "end_event", "pause_map_hide_c_map") 
  317. 	 
  318. 	--Transition elements from our screen in... 
  319. 	--lua_play_anim(map_open_phone_anim_h, 0) 
  320.  
  321. 	--Make sure our cellphone frame is in view, sometimes we could come straight into this menu... 
  322. 	cell_show_frame() 
  323. 	 
  324. 	--Transition screen in... 
  325. 	if Cell_rewards_to_map then 
  326. 		cell_transition_screen(CELL_STATE_LANDSCAPE, CELL_SCREEN_MAP, CELL_SCREEN_NONE, pause_map_trans_in_complete) 
  327. 	elseif Pause_map_from_menu then	 
  328. 		cell_transition_screen(CELL_STATE_LANDSCAPE, CELL_SCREEN_MAP, CELL_SCREEN_MAIN, pause_map_trans_in_complete) 
  329. 	else 
  330. 		--fade out header from the foreground... 
  331. 		cell_foreground_fade_out_header() 
  332. 		 
  333. 		cell_transition_screen(CELL_STATE_LANDSCAPE, CELL_SCREEN_MAP, CELL_SCREEN_NONE, pause_map_trans_in_complete) 
  334. 	end 
  335. 	 
  336.  
  337. 	--hintbar...	 
  338. 	local hint_bar_element_name = "hint_bar" 
  339. 	if game_get_platform() == "PC" then 
  340. 		hint_bar_element_name = "pc_hint_bar" 
  341. 	end 
  342. 	Hint_bar = Vdo_hint_bar:new(hint_bar_element_name) 
  343. 	Hint_bar:enable_mini_mode(true) 
  344. 	 
  345. 	--Setup button hints	 
  346. 	if game_get_platform() == "PC" then 
  347. 		pause_map_update_button_hints(Main_hint_data_waypoint_off_pc) 
  348. 	else 
  349. 		pause_map_update_button_hints(Main_hint_data_waypoint_off) 
  350. 	end 
  351.  
  352. 	--Setup Cursor to data_item 
  353. 	vint_dataitem_add_subscription("PAUSE_MAP_CURSOR", "update", "pause_map_cursor_update")	 
  354. 	 
  355. 	--TODO: Cleanup the following 
  356. 	--Map Elements 
  357. 	local h = vint_object_find("map_grp") 
  358. 	Pause_map_elements.base.cursor_h = vint_object_find("cursor", h) 
  359. 	 
  360. 	h = vint_object_find("highlight_grp") 
  361. 	vint_set_property(h, "visible", false) 
  362. 	 
  363. 	h = vint_object_find("map_frame") 
  364. 	 
  365. 	--Hide info 
  366. 	vint_set_property(vint_object_find("info"), "visible", false) 
  367. 	--Hide original filter 
  368. 	vint_set_property(vint_object_find("filter_type_grp"), "visible", false) 
  369. 	 
  370. 	--hide map overlays 
  371. 	vint_set_property(vint_object_find("hood_overlay_grp"), "visible", false) 
  372.  
  373. 	--Animation find and pause 
  374. 	h = vint_object_find("root_animation") 
  375. 	Pause_map_anims.cursor_fade_anim_h 		= vint_object_find("cursor_fade_anim", h) 
  376. 	Pause_map_anims.cursor_fade_twn_h 		= vint_object_find("cursor_fade_twn", Pause_map_anims.cursor_fade_anim_h) 
  377. 	Pause_map_anims.highlight_anim_in_h		= vint_object_find("highlight_anim_in", h) 
  378. 	Pause_map_anims.highlight_anim_out_h	= vint_object_find("highlight_anim_out", h) 
  379. 	Pause_map_anims.icon_highlight_anim_h	= vint_object_find("icon_highlight_anim", h) 
  380. 	 
  381. 	--Subscribe to data items 
  382. 	vint_dataitem_add_subscription("PAUSE_MAP_HIGHLIGHT1", "update", "pause_map_highlight_update") 
  383. 	vint_dataitem_add_subscription("PAUSE_MAP_HIGHLIGHT2", "update", "pause_map_highlight_update") 
  384. 	vint_datagroup_add_subscription("map_filter", "update", "pause_map_filters_populate") 
  385. 	vint_datagroup_add_subscription("map_district_names", "update", "pause_map_district_overlay_update") 
  386.  
  387. 	--Set cash on interface 
  388. 	local cash_txt_h = vint_object_find("cash_value_txt") 
  389. 	vint_set_property(cash_txt_h, "text_tag", "$" .. format_cash(Hud_player_status.cash) .. "\n") 
  390.  
  391. 	--Set income per day 
  392. 	local income_per_day = get_world_income_dollars() 
  393. 	local income_value_txt_h = vint_object_find("income_value_txt") 
  394. 	vint_set_property(income_value_txt_h, "text_tag", "$" .. format_cash(income_per_day) .. "\n") 
  395.  
  396. 	Pause_map_stag_mode = pause_map_is_stag_mode() 
  397. 	local stag_grp_h = vint_object_find("stag_grp") 
  398. 	local stag_filter_h = vint_object_find("stag_filter") 
  399. 	 
  400. 	Pause_map_tutorial_mode = pause_map_is_tutorial_mode() 
  401.  
  402. 	local stag_popup_overlay_grp_h = vint_object_find("stag_popup_overlay_grp") 
  403. 	vint_set_property(stag_popup_overlay_grp_h, "visible", false) 
  404. 	 
  405. 	if Pause_map_stag_mode == true then 
  406. 		--update help 
  407. 		local stag_grp_h = vint_object_find("stag_grp") 
  408. 		vint_set_property(stag_grp_h, "visible", true) 
  409. 		vint_set_property(stag_filter_h, "visible", true) 
  410. 		 
  411. 		-- Move normal map group down to make room for stag group... 
  412. 		local map_info_grp_h = vint_object_find("map_info_grp") 
  413. 		local x, y = vint_get_property(map_info_grp_h, "anchor") 
  414. 		y = 110	--positions the other stuff right below the stag block... 
  415. 		vint_set_property(map_info_grp_h, "anchor", x, y ) 
  416. 		 
  417. 		--Align instructions for localized text, this spaces our text out properly. 
  418. 		local stag_title_txt_h = vint_object_find("stag_title_txt") 
  419. 		local stag_instructions_txt_h = vint_object_find("stag_instructions_txt") 
  420. 		local align_text_table = { 
  421. 			{h = stag_title_txt_h, type = VINT_OBJECT_TEXT, space = 0}, 
  422. 			{h = stag_instructions_txt_h, type = VINT_OBJECT_TEXT, space = 2} 
  423. 		} 
  424. 		local width, height = vint_align_elements(align_text_table) 
  425. 	 
  426. 		-- now align group to center, text is center aligned in the document. 
  427. 		-- so current y position minus half the height of our text. Aligns perfectly with the stag logo. 
  428. 		local stag_text_grp_h = vint_object_find("stag_text_grp") 
  429. 		local x, y = vint_get_property(stag_text_grp_h, "anchor") 
  430. 		y = y - (height * .5) 
  431. 		vint_set_property(stag_text_grp_h, "anchor", x, y ) 
  432. 		 
  433. 		--setup popup... 
  434. 		Pause_map_stag_popup = Vdo_store_popup:new("stag_popup") 
  435. 		Pause_map_stag_popup:set_color({R = 204/255, G = 89/255, B = 10/255}) -- Stag color referenced from our document... 
  436. 		Pause_map_stag_popup:set_size(840, 400) 
  437. 		Pause_map_stag_popup:set_menu_option_text_scale(.9) 
  438. 		Pause_map_stag_popup:populate_list(Yes_no_choices, 2, 840, 2) 
  439. 		Pause_map_stag_popup:set_title("PAUSE_MAP_STAG_POPUP_TITLE") 
  440. 		 
  441. 		Pause_map_stag_popup_x, Pause_map_stag_popup_y = Pause_map_stag_popup:get_anchor() 
  442. 	else 
  443. 		--hide any stag related stuff... 
  444. 		vint_set_property(stag_grp_h, "visible", false) 
  445. 		vint_set_property(stag_filter_h, "visible", false) 
  446. 	end 
  447. 	 
  448. 	--Lock tutorials 
  449. 	if Pause_map_tutorial_mode == true then 
  450. 		pause_map_tutorial_mode_enable(true) 
  451. 		pause_map_filter_lock(true) 
  452. 	else 
  453. 		pause_map_tutorial_mode_enable(false) 
  454. 	end 
  455. 	 
  456. 	-- PC-specific elements 
  457. 	if game_get_platform() == "PC" then 
  458. 		PC_hint_bar = Vdo_hint_bar:new("hint_bar") 
  459. 	else 
  460. 		PC_hint_bar = Vdo_hint_bar:new("pc_hint_bar") 
  461. 	end 
  462.  
  463. 	PC_zoom_in = Vdo_base_object:new("zoom_in_bmp", 0, pause_map_doc_h) 
  464. 	PC_zoom_out = Vdo_base_object:new("zoom_out_bmp", 0, pause_map_doc_h) 
  465. 	if game_get_platform() == "PC" then 
  466.  
  467. 		if Pause_map_stag_mode == false then 
  468. 			local hint_data = { Main_hint_data_back, Main_hint_data_back_map } 
  469. 			PC_hint_bar:enable_mini_mode(true) 
  470. 			PC_hint_bar:enable_text_shadow(true) 
  471. 			PC_hint_bar:set_hints(hint_data, false, false) --Entered_with_gamepad, not Entered_with_gamepad) 
  472. 			 
  473. 			local width, height = PC_hint_bar:get_size() 
  474. 			width = floor(width) 
  475. 			height = floor(height) 
  476. 			local bg_width, bg_height = element_get_actual_size(Hint_bar_bg, width, height) 
  477. 			local hint_background_padding = 35 -- Additional padding needed for background height 
  478. 			element_set_actual_size(Hint_bar_bg, width + 35, bg_height) 
  479. 		else 
  480. 			PC_hint_bar:set_visible(false) 
  481. 			vint_set_property(Hint_bar_bg, "visible", false) 
  482. 		end 
  483. 		 
  484. 		Pause_map_gamepad_monitor_thread_handle = thread_new("pause_map_gamepad_monitor_thread") 
  485. 	else 
  486. 		-- Hide the elements on console 
  487. 		PC_hint_bar:set_visible(false) 
  488. 		PC_zoom_in:set_visible(false) 
  489. 		PC_zoom_out:set_visible(false) 
  490. 	end 
  491. end 
  492.  
  493. function pause_map_cleanup() 
  494. 	--Event Tracking(Exit Menu) 
  495. 	game_event_tracking_interface_exit() 
  496. 	 
  497. 	if Pause_map_gamepad_monitor_thread_handle ~= 0 then 
  498. 		thread_kill(Pause_map_gamepad_monitor_thread_handle) 
  499. 	end 
  500. 	vint_set_mouse_cursor("") 
  501. end 
  502.  
  503. function pause_map_is_taxi_mode(tm) 
  504. 	Pause_map_taxi_mode = (tm == true) 
  505. 	--pause_map_btn_tips_format()   -- Can cause a crash if called during finish init 
  506. end 
  507.  
  508. --This gets called after diaglog confirming takeover of hood 
  509. function pause_map_stag_exit() 
  510. 	--close cell phone 
  511. 	Pause_map_exit_phone = true 
  512. 	pause_map_close() 
  513. 	vint_dataresponder_post("cell_menu_state_dr", "Set", ID_MAIN) --Load cell phone next time 
  514.  
  515. 	--set up delayed reward screen (cash and respect only) 
  516. 	if Pause_map_stag_mode then 
  517. 		pause_map_stag_takeover_do_reward() 
  518. 	end		 
  519. end 
  520.  
  521. -- This gets called from code when the 'A' button is pressed in STAG takeover mode 
  522. -- and the cursor is over a valid hood 
  523. function pause_map_stag_completion() 
  524. 	--A button is pressed bring up poopup... 
  525. 	local stag_popup_overlay_grp_h = vint_object_find("stag_popup_overlay_grp") 
  526. 	vint_set_property(stag_popup_overlay_grp_h, "visible", true) 
  527. 	 
  528. 	local insert_string = "PAUSE_MAP_STAG_POPUP_BODY" 
  529. 	if Completion_is_client() then 
  530. 		insert_string = "PAUSE_MAP_STAG_POPUP_BODY_CLIENT" 
  531. 	end 
  532. 	 
  533. 	local percent_hood_owned = {[0] = floor(100 * pause_map_stag_current_district_control())} 
  534. 	local percent_string = vint_insert_values_in_string(insert_string, percent_hood_owned) 
  535. 	Pause_map_stag_popup:set_text(percent_string) 
  536. 		 
  537. 	--Reset Position because of new text... 
  538. 	local width, height = Pause_map_stag_popup:get_size() 
  539. 	Pause_map_stag_popup:set_anchor(Pause_map_stag_popup_x, Pause_map_stag_popup_y- height) 
  540. 	 
  541. 	Pause_map_stag_popup:nav_enable(true, "pause_map_stag_popup_select", "pause_map_stag_popup_nav") 
  542. 	if Mouse_input_tracker ~= 0 then 
  543. 		Mouse_input_tracker:subscribe(false) 
  544. 	end 
  545. 	 
  546. 	if Filter_mouse_input_tracker ~= 0 then 
  547. 		Filter_mouse_input_tracker:subscribe(false) 
  548. 	end 
  549. 	vint_set_mouse_cursor("") 
  550. 	 
  551. 	game_UI_audio_play("UI_Main_Menu_Select")	 
  552. end 
  553.  
  554. ----------------------------------------------- 
  555. -- Closes pause map 
  556. ----------------------------------------------- 
  557. function pause_map_close() 
  558.  
  559. 	Input_tracker:subscribe(false) 
  560. 	 
  561. 	if Mouse_input_tracker ~= 0 then 
  562. 		Mouse_input_tracker:subscribe(false) 
  563. 	end 
  564. 	 
  565. 	if Filter_mouse_input_tracker ~= 0 then 
  566. 		Filter_mouse_input_tracker:subscribe(false) 
  567. 	end 
  568.  
  569. 	if Pause_map_exit_phone then 
  570. 	--	game_UI_audio_play("UI_Cell_Close") 
  571. 		cell_transition_screen(CELL_STATE_OUT, CELL_SCREEN_NONE, CELL_SCREEN_MAP, pause_map_trans_out_complete) 
  572. 	else 
  573. 		cell_transition_screen(CELL_STATE_PORTRAIT, CELL_SCREEN_MAIN, CELL_SCREEN_MAP, pause_map_trans_out_complete) 
  574. 		game_UI_audio_play("UI_Cell_Nav_Back") 
  575. 	end 
  576. end 
  577.  
  578. ----------------------------------------------- 
  579. -- After all the map slides in, this sets up   
  580. -- subscrptions and shit 
  581. ----------------------------------------------- 
  582. function pause_map_trans_in_complete() 
  583. 	-- Track Input 
  584. 	Input_tracker = Vdo_input_tracker:new() 
  585. 	 
  586. 	Input_tracker:add_input("dpad_up", "pause_map_filter_nav", 50) 
  587. 	Input_tracker:add_input("dpad_down", "pause_map_filter_nav", 50)  
  588. 	 
  589. 	Input_tracker:add_input("map", "pause_map_input", 50) 
  590. 	Input_tracker:add_input("back", "pause_map_input", 50) 
  591. 	 
  592. 	Input_tracker:add_input("select", "pause_map_input_button_a", 50) 
  593. 	 
  594. 	if game_get_platform() == "PC" then 
  595. 		Input_tracker:add_input("scancode", "pause_map_filter_nav", 50, false, 59) -- F1 key 
  596. 		 
  597. 		Input_tracker:add_input("scancode", "pause_map_input_button_x", 50, false, 48) 
  598. 		Input_tracker:add_input("gamepad_x", "pause_map_input_button_x", 50) 
  599. 	else 
  600. 		Input_tracker:add_input("alt_select", "pause_map_input_button_x", 50) 
  601. 	end 
  602.  
  603. 	Input_tracker:subscribe(true) 
  604. 	 
  605. 	if game_get_platform() == "PC" then 
  606. 	 
  607. 		local filter_list_visible = vint_get_property(Filter_list_handle, "visible") 
  608. 		if Pause_map_stag_mode == false or filter_list_visible then 
  609. 			Filter_mouse_input_tracker = Vdo_input_tracker:new() 
  610. 			Pause_map_filter:add_mouse_inputs("pause_map", Filter_mouse_input_tracker) 
  611. 			Filter_mouse_input_tracker:subscribe(true) 
  612. 		end 
  613.  
  614. 		Mouse_input_tracker = Vdo_input_tracker:new() 
  615. 		if Pause_map_stag_mode == false or filter_list_visible then 
  616. 			Mouse_input_tracker:add_mouse_input("mouse_click", "pause_map_mouse_move", 50, Filter_list_handle) 
  617. 			Mouse_input_tracker:add_mouse_input("mouse_move", "pause_map_mouse_move", 50, Filter_list_handle) 
  618. 			vint_set_property(Filter_list_handle, "mouse_depth", -4000) 
  619. 		end 
  620. 		Mouse_input_tracker:add_mouse_input("mouse_right_click", "pause_map_mouse_right_click", 50, Map_mask_handle) 
  621. 		Mouse_input_tracker:add_mouse_input("mouse_middle_click", "pause_map_mouse_middle_click", 50, Map_mask_handle) 
  622. 		Mouse_input_tracker:add_mouse_input("mouse_move", "pause_map_mouse_move", 50, Map_mask_handle) 
  623. 		Mouse_input_tracker:add_mouse_input("mouse_click", "pause_map_mouse_move", 50, Map_mask_handle) 
  624. 		Mouse_input_tracker:add_mouse_input("mouse_drag", "pause_map_mouse_drag", 50, Map_mask_handle) 
  625. 		Mouse_input_tracker:add_mouse_input("mouse_drag_release", "pause_map_mouse_drag_release", 50, Map_mask_handle) 
  626. 		-- Zoom buttons 
  627. 		Mouse_input_tracker:add_mouse_input("mouse_move", "pause_map_mouse_move", 50, PC_zoom_in.handle) 
  628. 		Mouse_input_tracker:add_mouse_input("mouse_click", "pause_map_mouse_click", 50, PC_zoom_in.handle) 
  629. 		Mouse_input_tracker:add_mouse_input("mouse_move", "pause_map_mouse_move", 50, PC_zoom_out.handle) 
  630. 		Mouse_input_tracker:add_mouse_input("mouse_click", "pause_map_mouse_click", 50, PC_zoom_out.handle) 
  631. 		 
  632. 		--Mouse_input_tracker:add_mouse_input("mouse_click", "pause_map_mouse_click", 50, Hint_bar_bg) 
  633. 		--vint_set_property(Hint_bar_bg, "mouse_depth", -4004) 
  634. 		PC_hint_bar:add_mouse_inputs("pause_map", Mouse_input_tracker) 
  635. 		--vint_set_property(PC_hint_bar.handle, "mouse_depth", -4003) 
  636.  
  637. 		Mouse_input_tracker:subscribe(true) 
  638. 	end 
  639. end 
  640.  
  641. function pause_map_trans_out_complete() 
  642. 	pop_screen(); 
  643. 	if Pause_map_exit_phone == true then 
  644. 		pop_screen(); -- exit the phone completely 
  645. 		pop_screen(); -- pop off the cell phone fore/background 
  646. 	end	 
  647. end 
  648.  
  649. function pause_map_input(event, accelleration) 
  650.  
  651. 	if Pause_map_stag_mode then 
  652. 		--cannot exit during stag mode... 
  653. 		return 
  654. 	end 
  655.  
  656. 	if event == "map" then 
  657. 		--Close the interface 
  658. 		Pause_map_exit_phone = true 
  659. 		pause_map_close() 
  660. 		vint_dataresponder_post("cell_menu_state_dr", "Set", ID_MAP) --come back to the map next time 
  661. 	elseif event == "back" then 
  662. 		Pause_map_exit_phone = false 
  663. 		pause_map_close() 
  664. 		vint_dataresponder_post("cell_menu_state_dr", "Set", ID_MAIN) --Load cell phone next time 
  665. 	end 
  666. end 
  667.  
  668. ------------------------------------------------------------------------------- 
  669. -- Adds a filter to the list. Should be called via data responder. 
  670. -- 
  671. -- @param	filter_type		String indicating filter type 
  672. -- @param	filter_name		String of actual filter name 
  673. -- @param	x					X# of icons for the filter left to complete 
  674. -- @param	y					Y# of icons total for the filter 
  675. ------------------------------------------------------------------------------- 
  676. function pause_map_filters_populate(di_h) 
  677. 	local filter_type, filter_name, x, y = vint_dataitem_get(di_h) 
  678.  
  679. 	-- If we get PFT_ALL (always the first item), then we need to rebuild the list 
  680. 	if filter_type == "PFT_ALL" then 
  681. 		if Filter_mouse_input_tracker ~= 0 then 
  682. 			Filter_mouse_input_tracker:subscribe(false) 
  683. 			Filter_mouse_input_tracker:remove_all() 
  684. 		end 
  685. 		Pause_map_filter:clear() 
  686. 	end 
  687.  
  688. 	-- Add item to list... 
  689. 	Pause_map_filter:add(filter_type, filter_name, x, y) 
  690. 	 
  691. 	if filter_type == "PFT_NONE" then 
  692. 		--Last Item in list... now update... 
  693. 		local current_mode = game_pause_map_filter() 
  694. 		 
  695. 		if current_mode == "PFT_FILTER_LOCKED" then 
  696. 			pause_map_filter_lock(true) 
  697. 			--Hide the filters... 
  698. 			Pause_map_filter:set_visible(false) 
  699. 			 
  700. 			--Hide player info... 
  701. 			vint_set_property(vint_object_find("player_info_grp"), "visible", false) 
  702. 			return 
  703. 		end 
  704. 		 
  705. 		if Pause_map_stag_mode then 
  706. 			--Stag filter change 
  707. 			Pause_map_filter:change_filter_by_type("PFT_ALL", false) 
  708. 			pause_map_filter_lock(true) 
  709. 			Pause_map_filter:set_visible(false) 
  710. 			 
  711. 			--Hide player info... 
  712. 			vint_set_property(vint_object_find("player_info_grp"), "visible", false) 
  713. 		else		 
  714. 			--Change filter 
  715. 			Pause_map_filter:change_filter_by_type(current_mode, false) 
  716. 		end 
  717.  
  718. 		--List is completed... 
  719. 		pause_map_adjust_layout() 
  720. 		if Filter_mouse_input_tracker ~= 0 then 
  721. 			Pause_map_filter:add_mouse_inputs("pause_map", Filter_mouse_input_tracker) 
  722. 			Filter_mouse_input_tracker:subscribe(true) 
  723. 		end 
  724. 	end	 
  725.  
  726. end 
  727.  
  728. ------------------------------------------------------------------------------- 
  729. -- Navigating for filters 
  730. -- This is a callback setup via input tracker for changing filters. 
  731. ------------------------------------------------------------------------------- 
  732. function pause_map_filter_nav(event, accelleration) 
  733. 	if Pause_map_filter_locked == true then 
  734. 		--do not nav the filters... 
  735. 		return 
  736. 	end 
  737. 	--Check event type and move cursor... 
  738. 	if event == "dpad_up" then 
  739. 		Pause_map_filter:move_cursor(-1) 
  740. 	elseif event == "dpad_down" or event == "scancode" then 
  741. 		Pause_map_filter:move_cursor(1) 
  742. 	end 
  743. 	game_UI_audio_play("UI_Cell_Nav") 
  744. end 
  745.  
  746. function pause_map_input_button_a() 
  747.  
  748. 	pause_map_set_gps() 
  749.  
  750. end 
  751.  
  752. function pause_map_input_button_x() 
  753. 	pause_map_add_bookmark() 
  754. end 
  755.  
  756. ------------------------------------------------------------------------------- 
  757. -- Turns screen into a locked mode where the user can't interact with filters  
  758. -- at all. 
  759. -- @param	is_locked			(Bool) Determines if the screen should be locked or not 
  760. ------------------------------------------------------------------------------- 
  761. function pause_map_filter_lock(is_locked) 
  762. 	Pause_map_filter_locked  = is_locked 
  763. 	--Hide the filters... 
  764. 	Pause_map_filter:set_visible(is_locked) 
  765. end 
  766.  
  767. function pause_map_adjust_layout() 
  768.  
  769. 	--Hood width 
  770. 	local district_name_txt_h = vint_object_find("district_name_txt") 
  771. 	local hood_name_txt_h = vint_object_find("hood_name_txt") 
  772.  
  773. 	local data = { 
  774. 		district_name_txt_h, 
  775. 		hood_name_txt_h, 
  776. 	} 
  777. 	local widest_element_h, hood_width = find_widest_text_element(data) 
  778. 	local widest_element_x, widest_element_y = 0, 0 
  779.  
  780. 	if widest_element_h ~= 0 then 
  781. 		widest_element_x, widest_element_y = vint_get_property(widest_element_h, "anchor") 
  782. 	end 
  783. 	 
  784. 	hood_width = hood_width + widest_element_x 
  785. 	 
  786. 	--Cash Width 
  787. 	local cash_label_txt_h 		= vint_object_find("cash_label_txt") 
  788. 	local income_label_txt_h 	= vint_object_find("income_label_txt") 
  789.  
  790. 	local data = { 
  791. 		cash_label_txt_h, 
  792. 		income_label_txt_h, 
  793. 	} 
  794. 	local widest_element_h, cash_width = find_widest_text_element(data) 
  795. 	 
  796. 	local income_value_txt_h 	= vint_object_find("income_value_txt") 
  797. 	local cash_value_txt_h 		= vint_object_find("cash_value_txt") 
  798. 	local data = { 
  799. 		income_value_txt_h, 
  800. 		cash_value_txt_h, 
  801. 	} 
  802. 	 
  803. 	local widest_element_h, cash_value_width = find_widest_text_element(data) 
  804. 	local cash_label_x, cash_label_y = vint_get_property(cash_label_txt_h, "anchor") 
  805. 	local income_x, income_y 			= vint_get_property(income_value_txt_h, "anchor") 
  806. 	local cash_x, cash_y  				= vint_get_property(cash_value_txt_h, "anchor") 
  807. 	local player_cash_width = cash_label_x + cash_width + cash_value_width + 10 
  808. 	 
  809. 	--Get Filter Width... 
  810. 	local filter_element_width = Pause_map_filter:adjust_layout() 
  811. 	 
  812. 	local bg_width = 290 
  813. 	 
  814. 	--Hood Info 
  815. 	bg_width = max(bg_width, hood_width)  
  816. 	 
  817. 	if Pause_map_stag_mode then 
  818. 		bg_width = max(bg_width, 300) 	--Stag bg width hardcode. 
  819. 	end 
  820.  
  821. 	if not Pause_map_stag_mode then 
  822. 		--Filter width... 
  823. 		bg_width = max(bg_width, filter_element_width) 
  824. 		 
  825. 		--Player Cash width 
  826. 		bg_width = max(bg_width, player_cash_width)  
  827. 	end 
  828. 	 
  829. 	--Reset Width of filters... 
  830. 	Pause_map_filter:adjust_layout(bg_width) 
  831. 	 
  832. 	--Reset width of cash values. 
  833. 	local player_info_bg_h = vint_object_find("player_info_bg") 
  834. 	vint_set_property(income_value_txt_h, "anchor", bg_width, income_y) 
  835. 	vint_set_property(cash_value_txt_h, "anchor", bg_width, cash_y) 
  836. 	 
  837. 	--pad out the width for our backgrounds 
  838. 	bg_width = bg_width + 10 
  839. 	 
  840. 	--filter padding... 
  841. 	local filter_bg_h = vint_object_find("filter_bg") 
  842. 	local hood_info_bg_h = vint_object_find("hood_info_bg") 
  843. 	local width, height = element_get_actual_size(filter_bg_h) 
  844. 	element_set_actual_size(filter_bg_h, bg_width, height) 
  845.  
  846. 	width, height = element_get_actual_size(hood_info_bg_h) 
  847. 	element_set_actual_size(hood_info_bg_h, bg_width, height) 
  848.  
  849. 	local stag_bg_h = vint_object_find("stag_bg") 
  850. 	width, height = element_get_actual_size(stag_bg_h) 
  851. 	element_set_actual_size(stag_bg_h, bg_width, height) 
  852. 	 
  853. 	local player_info_bg_width, player_info_bg_height = element_get_actual_size(player_info_bg_h) 
  854. 	element_set_actual_size(player_info_bg_h, bg_width, player_info_bg_height) 
  855. end 
  856.  
  857. -------------------------------------------------- 
  858. --Highlight Update 
  859. -------------------------------------------------- 
  860. function anim_out_complete(tween_h) 
  861. 	for idx, val in pairs(Pause_map_highlight_status) do  
  862. 		if val.last_tween_out == tween_h then 
  863. 		 
  864. 			local status = Pause_map_highlight_status[idx] 
  865. 			vint_object_destroy(status.info_h) 
  866. 			vint_object_destroy(status.in_anim_h) 
  867. 			vint_object_destroy(status.out_anim_h) 
  868. 			vint_object_destroy(status.icon_highlight_anim_h) 
  869.  
  870. 			Pause_map_highlight_status[idx] = nil 
  871. 			break 
  872. 		end 
  873. 	end 
  874. end 
  875.  
  876. function anim_in_complete() 
  877. 	debug_print("vint", "anim_in_complete \n") 
  878. 	Pause_map.done = true 
  879. end 
  880.  
  881.  
  882. ------------------------------------------------------------------------------- 
  883. -- Updates the highlight on the pause map... this is done via 2 dataitems that 
  884. -- Swap 
  885. -- DATAITEM: PAUSE_MAP_HIGHLIGHT1, PAUSE_MAP_HIGHLIGHT2 
  886. -- @param	icon_bmp_name,  
  887. -- @param	text_line_1				-- First line 
  888. -- @param	text_line_2				-- Second Line 
  889. -- @param	text_line_3				-- Third Line (Left) 
  890. -- @param	text_line_4				-- Fourth Line (Right) 
  891. -- @param	is_highlighted			-- Is Highlighted? (Are we over the icon or off) 
  892. -- @param 	is_gps_target			--	Is the thing a gps target? 
  893. -- @param	is_mad_icon				-- Is the thing a mad icon? 
  894. -- @param	is_store_icon			-- Is the thing a store icon? 
  895. -- @param 	is_crib_icon			-- Is the thing a crib icon? 
  896. -- @param 	taxi_available			-- Is there a taxi available? 
  897. ------------------------------------------------------------------------------- 
  898. function pause_map_highlight_update(di_h) 
  899.  
  900. 	-- Get dataitem... 
  901. 	local icon_bmp_name, overlay_bmp_name, text_line_1, text_line_2, text_line_3, text_line_4, is_highlighted, is_gps_target, is_mad_icon, is_store_icon, is_crib_icon, taxi_available = vint_dataitem_get(di_h) 
  902. 	 
  903. 	--dataitem_to_debug(di_h, "icon_bmp_name", "text_line_1", "text_line_2", "text_line_3", "text_line_4", "is_highlighted", "is_gps_target", "taxi_available") 
  904.  
  905. 	--Exit if there is no icon 
  906. 	if icon_bmp_name == nil then 
  907. 		return 
  908. 	end 
  909. 	 
  910. 	 
  911. 	local status = Pause_map_highlight_status[di_h] 
  912.  
  913. 	--Check to see if the highlight/info element has been created then initalize the element if it hasn't. 
  914. 	if status == nil then 
  915. 		 
  916. 		--Clone the object and find targets. 
  917. 		local info_h = vint_object_clone(vint_object_find("highlight_grp")) 
  918. 		local icon_h = vint_object_find("icon", info_h) 
  919. 		local icon_highlight_h = vint_object_find("icon_highlight", info_h) 
  920. 		local icon_overlay_h = vint_object_find("icon_overlay", info_h) 
  921. 		local lock_h = vint_object_find("lock", info_h) 
  922. 		local text_grp_h = vint_object_find("text_grp", info_h) 
  923.  
  924. 		local text_line_1_h = vint_object_find("line_1_txt", info_h) 
  925. 		local text_line_2_h = vint_object_find("line_2_txt", info_h) 
  926. 		local text_line_3_h = vint_object_find("line_3_txt", info_h) 
  927. 		local text_line_4_h = vint_object_find("line_4_txt", info_h) 
  928. 		 
  929. 		--Clone, Retarget, and Pause Animations 
  930. 		local in_anim_h = vint_object_clone(Pause_map_anims.highlight_anim_in_h) 
  931. 		local out_anim_h = vint_object_clone(Pause_map_anims.highlight_anim_out_h) 
  932. 		local icon_highlight_anim_h = vint_object_clone(Pause_map_anims.icon_highlight_anim_h) 
  933. 		vint_set_property(in_anim_h, "is_paused", true) 
  934. 		vint_set_property(out_anim_h, "is_paused", true) 
  935.  
  936. 		vint_set_property(icon_highlight_anim_h, "is_paused", true) 
  937. 		vint_set_property(in_anim_h, "target_handle", info_h) 
  938. 		vint_set_property(out_anim_h, "target_handle", info_h) 
  939. 		vint_set_property(icon_highlight_anim_h, "target_handle", info_h) 
  940. 		 
  941. 		 
  942. 		local hint_bar = Vdo_hint_bar:new("hint_bar_highlight", info_h) 
  943. 		hint_bar:enable_mini_mode(true)			--Make hintbar mini! 
  944. 		 
  945. 		Pause_map_highlight_status[di_h] = { 
  946. 			info_h = info_h, 
  947. 			in_anim_h = in_anim_h, 
  948. 			out_anim_h = out_anim_h, 
  949. 			 
  950. 			hint_bar = hint_bar, 
  951.  
  952. 			icon_highlight_anim_h = icon_highlight_anim_h, 
  953. 			icon_h = icon_h, 
  954. 			icon_highlight_h = icon_highlight_h, 
  955. 			icon_overlay_h = icon_overlay_h, 
  956. 			lock_h = lock_h, 
  957. 			text_grp_h = text_grp_h, 
  958. 			text_line_1_h = text_line_1_h, 
  959. 			text_line_2_h = text_line_2_h, 
  960. 			text_line_3_h = text_line_3_h, 
  961. 			text_line_4_h = text_line_4_h, 
  962. 			icon_bmp_name = -1, 
  963. 			overlay_bmp_name = -1, 
  964. 			text_line_1 = -1, 
  965. 			text_line_2 = -1, 
  966. 			text_line_3 = -1, 
  967. 			text_line_4 = -1, 
  968. 			text_width = -1, 
  969. 			text_height = -1, 
  970. 			alignment = "left", 
  971. 			is_highlighted = -1, 
  972. 			is_gps_target = -1, 
  973. 		} 
  974. 		 
  975. 		status = Pause_map_highlight_status[di_h] 
  976. 	end 
  977. 	 
  978. 	--Create locals from the status table 
  979. 	local info_h = status.info_h 
  980. 	local icon_h = status.icon_h 
  981. 	local icon_highlight_h = status.icon_highlight_h 
  982. 	local icon_overlay_h = status.icon_overlay_h 
  983. 	local text_grp_h = status.text_grp_h 
  984. 	local lock_h = status.lock_h 
  985. 	local text_line_1_h = status.text_line_1_h 
  986. 	local text_line_2_h = status.text_line_2_h 
  987. 	local text_line_3_h = status.text_line_3_h 
  988. 	local text_line_4_h = status.text_line_4_h 
  989. 	 
  990. 	--Set Icon bitmap 
  991. 	if icon_bmp_name ~= status.icon_bmp_name or overlay_bmp_name ~= status.overlay_bmp_name then 
  992. 		vint_set_property(icon_h, "image", icon_bmp_name) 
  993. 		vint_set_property(icon_h, "alpha", 0) 
  994. 		vint_set_property(icon_highlight_h, "image", icon_bmp_name) 
  995. 		vint_set_property(icon_highlight_h, "alpha", 0) 
  996. 		 
  997. 		--Set overlay image (e.g. 4sale) 
  998. 		vint_set_property(icon_overlay_h, "image", overlay_bmp_name) 
  999. 		vint_set_property(icon_overlay_h, "alpha", 0) 
  1000. 		status.icon_bmp_name = icon_bmp_name 
  1001. 		status.overlay_bmp_name = overlay_bmp_name 
  1002. 	end 
  1003. 	 
  1004. 	--Determine if we are going to show the overlay image... 
  1005. 	if status.overlay_bmp_name ~= "" then 
  1006. 		vint_set_property(icon_overlay_h, "visible", true) 
  1007. 	else 
  1008. 		vint_set_property(icon_overlay_h, "visible", false) 
  1009. 	end 
  1010. 	 
  1011. 	--vint_set_property(info_h, "anchor", position_x, position_y)			--Set screen coordinate positions 
  1012. 	vint_set_property(info_h, "visible", true)								--show item 
  1013. 	 
  1014. 	--Adjust angle of the lock on graphic based on the icon name 
  1015. 	if Pause_map_icons_rectangle[icon_bmp_name] == true then 
  1016. 		vint_set_property(lock_h, "rotation", 0) 
  1017. 	else 
  1018. 		vint_set_property(lock_h, "rotation", .78) 
  1019. 	end 
  1020. 	 
  1021. 	-- Re-Scale the lock icon that goes around the icon in the tween... 
  1022. 	local in_twn_h = vint_object_find("lock_scale_twn", status.in_anim_h) 
  1023. 	local out_twn_h = vint_object_find("lock_scale_twn", status.out_anim_h) 
  1024. 	if PAUSE_MAP_ICON_SMALL[icon_bmp_name] == true then 
  1025. 		vint_set_property(in_twn_h, "end_value", .75, .75) 
  1026. 		vint_set_property(out_twn_h, "start_value", .75, .75) 
  1027. 	else 
  1028. 		vint_set_property(in_twn_h, "end_value", 1.0, 1.0) 
  1029. 		vint_set_property(out_twn_h, "start_value", 1.0, 1.0) 
  1030. 	end 
  1031. 	 
  1032. 	--Set color of highlight bar 
  1033. 	local cursor_line_h = vint_object_find("cursor_line_bg", info_h) 
  1034. 	local color = PAUSE_MAP_ICON_COLORS[icon_bmp_name] 
  1035. 	if color then 
  1036. 		vint_set_property(cursor_line_h, "tint", color.R, color.G, color.B) 
  1037. 	else 
  1038. 		vint_set_property(cursor_line_h, "tint", PAUSE_MAP_GREY.R, PAUSE_MAP_GREY.G, PAUSE_MAP_GREY.B) 
  1039. 	end 
  1040. 	 
  1041. 		 
  1042. 	-- Hintbar 
  1043. 	local hint_data 
  1044. 	if taxi_available then 
  1045. 		hint_data = { 
  1046. 			{CTRL_MENU_BUTTON_A, "MENU_GPS"}, 
  1047. 			{CTRL_BUTTON_X, "CELL_TAXI_CAB"} 
  1048. 		} 
  1049. 	else 
  1050. 		if game_get_platform() == "PC" then	 
  1051. 			hint_data = { 
  1052. 				{HINT_BUTTON_RMB_OVERRIDE, "MENU_GPS"} 
  1053. 			} 
  1054. 		else 
  1055. 			hint_data = { 
  1056. 				{CTRL_MENU_BUTTON_A, "MENU_GPS"} 
  1057. 			} 
  1058. 		end 
  1059. 	end 
  1060.  
  1061. 	if Pause_map_stag_mode then 
  1062. 		hint_data = nil 
  1063. 		local hint_bar_highlight_bg_h = vint_object_find("hint_bar_highlight_bg", info_h) 
  1064. 		vint_set_property(hint_bar_highlight_bg_h, "visible", false) 
  1065. 	end 
  1066. 	 
  1067. 	status.hint_bar:set_hints(hint_data, false, false)--Entered_with_gamepad, not Entered_with_gamepad) 
  1068. 	 
  1069. 	--Set text tags 
  1070. 	vint_set_property(text_line_1_h, "text_tag", text_line_1) 
  1071. 	vint_set_property(text_line_2_h, "text_tag", text_line_2) 
  1072. 	vint_set_property(text_line_3_h, "text_tag", text_line_3) 
  1073. 	vint_set_property(text_line_4_h, "text_tag", text_line_4) 
  1074.  
  1075. 	--Now update boxes... We will calculate vertical size first for each box... 
  1076. 	 
  1077. 	local box_height_new = 55	--Fullsize 
  1078. 	local hint_y_offset = 15 
  1079. 	--If text tags equal nil then we need to set the string to "" 
  1080. 	if text_line_4 == nil or text_line_4 == "" then 
  1081. 		text_line_4 = "" 
  1082. 	end 
  1083. 	 
  1084. 	if text_line_3 == nil or text_line_3 == "" then 
  1085. 		text_line_3 = "" 
  1086. 		box_height_new = 30 
  1087. 	end 
  1088.  
  1089. 	if text_line_2 == nil or text_line_2 == "" then 
  1090. 		text_line_2 = "" 
  1091. 		box_height_new = 1 
  1092. 		box_height_new = 1 
  1093. 		hint_y_offset = 15 
  1094. 	end 
  1095. 	 
  1096. 	if text_line_1 == nil or text_line_1 == "" then 
  1097. 		text_line_1 = ""	 
  1098. 		box_height_new = 1 
  1099. 		hint_y_offset = 0 
  1100. 	end 
  1101. 	 
  1102. 	 
  1103.  
  1104. 	--Get the largets width of the text... so we know what to do... 
  1105. 	if text_line_1 ~= status.text_line_1 or text_line_2 ~= status.text_line_2 or text_line_3 ~= status.text_line_3 or text_line_4 ~= status.text_line_4 then 
  1106. 					 
  1107. 		--Get Largest text width and height 
  1108. 		local text_width = 0 
  1109. 		local text_height = 0 
  1110. 		local temp1_width, temp1_height = element_get_actual_size(text_line_1_h) 
  1111. 		local temp2_width, temp2_height = element_get_actual_size(text_line_2_h) 
  1112. 		local temp3_width, temp3_height = element_get_actual_size(text_line_3_h) 
  1113. 		local temp4_width, temp4_height = element_get_actual_size(text_line_4_h) 
  1114. 		local temp3_x, temp3_y = vint_get_property(text_line_1_h, "anchor") 
  1115. 		local temp4_x, temp4_y = vint_get_property(text_line_4_h, "anchor") 
  1116. 		local temp4_width = temp4_width + temp4_x - temp3_x 
  1117. 		local hintbar_width, hintbar_height = status.hint_bar:get_size() 
  1118. 		 
  1119. 		text_width = max(temp1_width, text_width) 
  1120. 		text_width = max(temp2_width, text_width) 
  1121. 		text_width = max(temp3_width, text_width) 
  1122. 		text_width = max(temp4_width, text_width) 
  1123. 		text_width = max(hintbar_width, text_width) 
  1124.  
  1125. 		text_width = text_width + 40 
  1126. 		 
  1127. 		--Resize boxes... 
  1128. 		local box_h = vint_object_find("cursor_bg", info_h) 
  1129. 		local hint_bar_highlight_bg_h = vint_object_find("hint_bar_highlight_bg", info_h) 
  1130. 		local hint_bar_bg_width, hint_bar_bg_height = element_get_actual_size(hint_bar_highlight_bg_h) 
  1131. 		local box_width, box_height = element_get_actual_size(box_h) 
  1132. 		local cursor_line_width, cursor_line_height = element_get_actual_size(cursor_line_h) 
  1133. 		 
  1134. 		-- Colored box (No that is not racist) 
  1135. 		element_set_actual_size(cursor_line_h, text_width, cursor_line_height) 
  1136. 		 
  1137. 		-- Backgorund for descripton text... 
  1138. 		element_set_actual_size(box_h, text_width, box_height_new) 
  1139. 		 
  1140. 		--Hintbar... 
  1141. 		local hint_grp_h = vint_object_find("highlight_hint_grp", info_h) 
  1142. 		local x, y = vint_get_property(hint_grp_h, "anchor") 
  1143. 		 
  1144. 		vint_set_property(hint_grp_h, "anchor", x, box_height_new + hint_y_offset) 
  1145. 		 
  1146. 		element_set_actual_size(hint_bar_highlight_bg_h, text_width, hint_bar_bg_height ) 
  1147. 		 
  1148. 		--Invert highlight or not?' 
  1149. 		local invert = false 
  1150. 		 
  1151. 		local right_side_of_box = Pause_map_cursor_status.x + text_width 
  1152. 		if right_side_of_box > 900 then 
  1153. 			invert = true 
  1154. 		end 
  1155. 		 
  1156. 		if invert then 
  1157. 			--Move group elements... (Boxes) 
  1158. 			local x, y = vint_get_property(hint_grp_h, "anchor") 
  1159. 			vint_set_property(hint_grp_h, "anchor", -text_width, y) 
  1160. 			local x, y = vint_get_property(text_grp_h, "anchor") 
  1161. 			vint_set_property(text_grp_h, "anchor", -text_width, y) 
  1162. 			 
  1163. 			--Move insides of boxes 
  1164. 			local hint_bar_highlight_h = vint_object_find("hint_bar_highlight", hint_grp_h) 
  1165. 			local x, y = vint_get_property(hint_bar_highlight_h, "anchor") 
  1166. 			vint_set_property(hint_bar_highlight_h, "anchor", PAUSE_MAP_HIGHLIGHT_HINTS_X_OFFSET_LEFT, y) 
  1167. 		 
  1168. 			local text_items_grp_h = vint_object_find("text_items_grp", text_grp_h) 
  1169. 			local x, y = vint_get_property(text_items_grp_h, "anchor") 
  1170. 			vint_set_property(text_items_grp_h, "anchor", PAUSE_MAP_HIGHLIGHT_TEXT_X_OFFSET_LEFT, y) 
  1171. 		else 
  1172. 			 
  1173. 			--Move group elements... (Boxes) 
  1174. 			local x, y = vint_get_property(hint_grp_h, "anchor") 
  1175. 			vint_set_property(hint_grp_h, "anchor", 0, y) 
  1176. 			local x, y = vint_get_property(text_grp_h, "anchor") 
  1177. 			vint_set_property(text_grp_h, "anchor", 0, y) 
  1178. 		 
  1179. 			--Move insides of boxes 
  1180. 			local hint_bar_highlight_h = vint_object_find("hint_bar_highlight", hint_grp_h) 
  1181. 			local x, y = vint_get_property(hint_bar_highlight_h, "anchor") 
  1182. 			vint_set_property(hint_bar_highlight_h, "anchor", PAUSE_MAP_HIGHLIGHT_HINTS_X_OFFSET_RIGHT, y) 
  1183. 		 
  1184. 			local text_items_grp_h = vint_object_find("text_items_grp", text_grp_h) 
  1185. 			local x, y = vint_get_property(text_items_grp_h, "anchor") 
  1186. 			vint_set_property(text_items_grp_h, "anchor", PAUSE_MAP_HIGHLIGHT_TEXT_X_OFFSET_RIGHT, y) 
  1187. 		end 
  1188. 		 
  1189. 		--Store values 
  1190. 		status.text_width = text_width 
  1191. 		status.text_height = text_height 
  1192. 		status.text_line_1 = text_line_1 
  1193. 		status.text_line_2 = text_line_2 
  1194. 		status.text_line_3 = text_line_3 
  1195. 		status.text_line_4 = text_line_4 
  1196. 	end 
  1197.  
  1198. 	 
  1199. 	 
  1200. 	--If the highlighted item changes state the we need to change how it is displayed 
  1201. 	if is_highlighted ~= status.is_highlighted then 
  1202. 		 
  1203. 		--1. Check if we need to fade in or fade out the info box 
  1204. 		if is_highlighted == true then 
  1205. 			--Reset elements 
  1206. 			vint_set_property(vint_object_find("bg_wrapper",info_h), "alpha", 0) 
  1207. 			vint_set_property(status.text_grp_h, "alpha", 0) 
  1208. 			vint_set_property(status.out_anim_h, "is_paused", true)	--Pause the out animation 
  1209. 			lua_play_anim(status.in_anim_h, 0)								--Play in animation 
  1210. 			lua_play_anim(status.icon_highlight_anim_h, 0) 
  1211. 			Pause_map.done = false 
  1212. 		elseif is_highlighted == false then 
  1213. 			--if the fade in tweens are done, then its ok to fade them out 
  1214. 			if Pause_map.done == true then 
  1215. 				vint_set_property(status.in_anim_h, "is_paused", true)	--Pause the in animation 
  1216. 				local alpha = vint_get_property(status.text_grp_h, "alpha") 
  1217. 				vint_set_property(vint_object_find("txt_grp_alpha_twn_1",status.out_anim_h), "start_value", alpha) 
  1218. 				lua_play_anim(status.out_anim_h, 0)	 
  1219. 			else 
  1220. 				--if fade in tweens arent finished, just destroy them 
  1221. 				vint_object_destroy(status.info_h) 
  1222. 				vint_object_destroy(status.in_anim_h) 
  1223. 				vint_object_destroy(status.out_anim_h) 
  1224. 				vint_object_destroy(status.icon_highlight_anim_h) 
  1225.  
  1226. 				Pause_map_highlight_status[di_h] = nil				 
  1227. 			end			 
  1228. 		end 
  1229.  
  1230. 		status.is_highlighted = is_highlighted 
  1231. 		 
  1232. 		--2. Fade the cursor if highlight and cursor state have changed 
  1233. 		local is_active = false 
  1234. 		for idx, val in pairs(Pause_map_highlight_status) do  
  1235. 			if val.is_highlighted == true then 
  1236. 				is_active = true 
  1237. 				break 
  1238. 			end 
  1239. 		end 
  1240. 		 
  1241. 		if is_active == true then 
  1242. 			if Pause_map_cursor_status.fade_mode == "in" then 
  1243. 				--Fade out Cursor 
  1244. 				local current_alpha = vint_get_property(Pause_map_elements.base.cursor_h, "alpha") 
  1245. 				vint_set_property(Pause_map_anims.cursor_fade_twn_h, "start_value", current_alpha)  
  1246. 				vint_set_property(Pause_map_anims.cursor_fade_twn_h, "end_value", 0)  
  1247. 				lua_play_anim(Pause_map_anims.cursor_fade_anim_h, 0) 
  1248. 				Pause_map_cursor_status.fade_mode = "out" 
  1249. 			end 
  1250. 		else 
  1251. 			if Pause_map_cursor_status.fade_mode == "out" then 
  1252. 				--Fade In Cursor 
  1253. 				local current_alpha = vint_get_property(Pause_map_elements.base.cursor_h, "alpha") 
  1254. 				vint_set_property(Pause_map_anims.cursor_fade_twn_h, "start_value", current_alpha)  
  1255. 				vint_set_property(Pause_map_anims.cursor_fade_twn_h, "end_value", 1)  
  1256. 				lua_play_anim(Pause_map_anims.cursor_fade_anim_h, 0) 
  1257. 				Pause_map_cursor_status.fade_mode = "in" 
  1258. 			end 
  1259. 		end 
  1260. 	end 
  1261. 	 
  1262. --	This functionality causes inconsistant results... taking it out (JMH 7/29/2011) 
  1263. --	if is_gps_target == true then 
  1264. --		vint_set_property(lock_h, "tint", 0,1,0) 
  1265. --	else 
  1266. --		vint_set_property(lock_h, "tint", 1,1,1) 
  1267. --	end 
  1268. 	 
  1269. 	if is_highlighted == true and is_mad_icon == true then 
  1270. 		game_UI_audio_play("UI_Cell_Hover_MAD") 
  1271. 	elseif is_highlighted == true and is_store_icon == true then 
  1272. 		game_UI_audio_play("UI_Cell_Hover_Store") 
  1273. 	elseif is_highlighted == true and is_crib_icon == true then 
  1274. 		game_UI_audio_play("UI_Cell_Hover_MAD") 
  1275. 	end 
  1276. 	 
  1277. end 
  1278.  
  1279.  
  1280. ------------------------------------------------------------------------------- 
  1281. -- Updates the pause map cursor and other navigational style elements via Dataitem. 
  1282. -- 
  1283. -- DATAITEM: 
  1284. -- @param 	cursor_x				Position of the cursor, relative to the upper left of the pause_map object. 
  1285. -- @param 	cursor_y				Position of the cursor, relative to the upper left of the pause_map object. 
  1286. -- @param 	highlight_icon_x	Position of the highlighted icon, relative to the upper left of the pause_map object. 
  1287. -- @param 	highlight_icon_y	Position of the highlighted icon, relative to the upper left of the pause_map object. 
  1288. -- @param 	gps_active			Is the GPS Active? 
  1289. -- @param 	district_str		--District name 
  1290. -- @param 	hood_str				--Hood Name 
  1291. -- @param 	control_pct   		--control percentage for the district 
  1292. ------------------------------------------------------------------------------- 
  1293. function pause_map_cursor_update(di_h) 
  1294. 	--Get data from dataitem... 
  1295. 	local cursor_x, cursor_y, highlight_icon_x, highlight_icon_y, gps_active, x_func, district_str, hood_str, control_pct = vint_dataitem_get(di_h) 
  1296. 	 
  1297. 	--Translate cursor position... 
  1298.  
  1299. 	if vint_is_std_res() then 
  1300. 		cursor_x = cursor_x * PAUSE_MAP_CURSOR_STD_RES_SCALE 
  1301. 		cursor_y = cursor_y * PAUSE_MAP_CURSOR_STD_RES_SCALE 
  1302. 		highlight_icon_x = highlight_icon_x * PAUSE_MAP_CURSOR_STD_RES_SCALE 
  1303. 		highlight_icon_y = highlight_icon_y * PAUSE_MAP_CURSOR_STD_RES_SCALE 
  1304. 	end 
  1305. 	 
  1306. 	-- NOTE: when no icon is highlighted, highlight_icon_x, highlight_icon_y is 0,0 
  1307.  
  1308. 	--Update the cursor position on the screen... 
  1309. 	local cursor_h = vint_object_find("cursor") 
  1310. 	vint_set_property(cursor_h, "anchor", cursor_x, cursor_y) 
  1311.  
  1312. 	Pause_map_cursor_status.x = cursor_x 
  1313. 	Pause_map_cursor_status.y = cursor_y 
  1314. 	 
  1315. 	--Offset icon from the cursor, because the location could be at a different spot. 
  1316. 	if highlight_icon_x ~= 0 or highlight_icon_y ~=0 then 
  1317. 		for idx, val in pairs(Pause_map_highlight_status) do 
  1318. 			if val.info_h ~= nil then 
  1319. 				local x = highlight_icon_x - cursor_x 
  1320. 				local y = highlight_icon_y - cursor_y 
  1321. 				vint_set_property(val.info_h, "anchor", x, y) 
  1322. 			end 
  1323. 		end 
  1324. 	end 
  1325.  
  1326. 	--Update button tips depending on if the GPS is active or not... 
  1327. 	if gps_active ~= Pause_map_cursor_status.gps_active or x_func ~= Pause_map_cursor_status.x_func then 
  1328.  
  1329. 		local main_hint_bar = { } 
  1330. 		if game_get_platform() == "PC" then 
  1331. 			if gps_active == true then 
  1332. 				main_hint_bar[#main_hint_bar + 1] = Main_hint_data_remove_gps_rmb 
  1333. 			else 
  1334. 				main_hint_bar[#main_hint_bar + 1] = Main_hint_data_set_gps_rmb 
  1335. 			end 
  1336. 		else 
  1337. 			if gps_active == true then 
  1338. 				main_hint_bar[#main_hint_bar + 1] = Main_hint_data_remove_gps 
  1339. 			else 
  1340. 				main_hint_bar[#main_hint_bar + 1] = Main_hint_data_set_gps 
  1341. 			end 
  1342. 		end 
  1343. 		 
  1344. 		if game_get_platform() ~= "PC" then 
  1345. 			main_hint_bar[#main_hint_bar + 1] = Main_hint_data_back 
  1346. 			main_hint_bar[#main_hint_bar + 1] = Main_hint_data_back_map 
  1347. 		end 
  1348. 		 
  1349. 		 
  1350. 		if Pause_map_tutorial_mode == false then 
  1351. 			--book mark only available in normal mode... 
  1352. 			if x_func == X_FUNC_PLACE_BOOKMARK then 
  1353. 				main_hint_bar[#main_hint_bar + 1] = Main_hint_data_add_bookmark 
  1354. 			elseif x_func == X_FUNC_TAXI then 
  1355. 				main_hint_bar[#main_hint_bar + 1] = Main_hint_data_taxi 
  1356. 			elseif x_func == X_FUNC_REMOVE_BOOKMARK then 
  1357. 				main_hint_bar[#main_hint_bar + 1] = Main_hint_data_remove_bookmark 
  1358. 			end 
  1359. 		end 
  1360. 		 
  1361. 		if Pause_map_stag_mode == true then 
  1362. 			pause_map_update_button_hints(Pause_map_hints_stag) 
  1363. 		else 
  1364. 			pause_map_update_button_hints(main_hint_bar)   
  1365. 		end 
  1366. 		 
  1367. 		Pause_map_cursor_status.gps_active = gps_active 
  1368. 		Pause_map_cursor_status.x_func = x_func 
  1369.  
  1370. 	end 
  1371. 	 
  1372. 	--Update Contact information... 
  1373. 	local district_name_txt_h 	= vint_object_find("district_name_txt") 
  1374. 	local hood_name_txt_h 		= vint_object_find("hood_name_txt") 
  1375. 	local hood_info_grp_h 		= vint_object_find("hood_info_grp") 
  1376. 	 
  1377. 	--Set District Name 
  1378. 	vint_set_property(district_name_txt_h, "text_tag", district_str) 
  1379. 	 
  1380. 	--Set hood name... 
  1381. 	vint_set_property(hood_name_txt_h, "text_tag", hood_str) 
  1382. 	 
  1383. 	--Update control pct... 
  1384. 	if district_str == "" then 
  1385. 		Pause_map_control_meter:set_visible(false) 
  1386. 	else 
  1387. 		Pause_map_control_meter:set_visible(true) 
  1388. 		Pause_map_control_meter:update(control_pct, false) 
  1389. 	end 
  1390. 	 
  1391.  
  1392.  
  1393. 	pause_map_adjust_layout() 
  1394. end 
  1395.  
  1396. ------------------------------------------------------------------------------- 
  1397. -- Updates the pause map cursor and other navigational style elements via Datagroup. 
  1398. -- 
  1399. -- DATAGROUP: 
  1400. -- @param 	district_str		String of the district name. 
  1401. -- @param 	district_pct		This is the percentage the player has control of the district... 
  1402. -- @param 	position_x			Position of the item, relative to the upper left of the pause_map object. 
  1403. -- @param 	position_y			Position of the item, relative to the upper left of the pause_map object. 
  1404. -- @param 	scale					Scale of the item in relation to the map... 
  1405. -- @param 	is_visible			Is the overlay visible, this is flagged to false if the overlay should be hidden... 
  1406. ------------------------------------------------------------------------------- 
  1407. function pause_map_district_overlay_update(di_h) 
  1408.  
  1409. 	--Check to see if we havn't updated this item before... if we havn't we need to clone a group for it... 
  1410. 	if Pause_map_district_overlays[di_h] == nil then 
  1411. 		--Clone overlay item... 
  1412. 		local grp_h = vint_object_find("hood_overlay_grp") 
  1413. 		grp_h = vint_object_clone(grp_h) 
  1414. 		vint_set_property(grp_h, "visible", true) 
  1415. 		vint_set_property(grp_h, "alpha", 0) 
  1416. 		 
  1417. 		local anim_h = vint_object_find("hood_overlay_fade_anim") 
  1418. 		anim_h = vint_object_clone(anim_h) 
  1419. 		vint_set_property(anim_h, "target_handle", grp_h) 
  1420. 		 
  1421. 		--Store it to a table... 
  1422. 		Pause_map_district_overlays[di_h] = { 
  1423. 			grp_h = grp_h, 
  1424. 			anim_h = anim_h, 
  1425. 			is_visible = -1 
  1426. 		} 
  1427. 		Pause_map_district_overlays_count = Pause_map_district_overlays_count + 1 
  1428. 	end 
  1429. 	 
  1430. 	--Update the overlay... 
  1431. 	 
  1432. 	--Find overlay we stored in the table... 
  1433. 	local grp_h = Pause_map_district_overlays[di_h].grp_h 
  1434. 	 
  1435. 	--Get data out of dataitem 
  1436. 	local district_str, district_pct, position_x, position_y, scale, is_visible = vint_dataitem_get(di_h) 
  1437.  
  1438. 	--Update visibility... 
  1439. 	if is_visible ~= Pause_map_district_overlays[di_h].is_visible then 
  1440. 		local target_alpha = 1.0 
  1441. 		if is_visible == false then 
  1442. 			--Going to fade out... 
  1443. 			target_alpha = 0 
  1444. 		end 
  1445. 		 
  1446. 		--Find animation to fade in or out... 
  1447. 		local anim_h = Pause_map_district_overlays[di_h].anim_h 
  1448. 	 
  1449. 		--Set properties for tween to current alpha of the object and the target value... 
  1450. 		local hood_overlay_fade_twn_h = vint_object_find("hood_overlay_fade_twn", anim_h) 
  1451. 		local current_alpha = vint_get_property(grp_h, "alpha") 
  1452. 		vint_set_property(hood_overlay_fade_twn_h, "start_value", current_alpha) 
  1453. 		vint_set_property(hood_overlay_fade_twn_h, "end_value", target_alpha) 
  1454. 		 
  1455. 		--Play the animation... 
  1456. 		lua_play_anim(anim_h) 
  1457. 		 
  1458. 		--Store to global... 
  1459. 		Pause_map_district_overlays[di_h].is_visible = is_visible 
  1460. 	end 
  1461. 	 
  1462. 	--Update text... 
  1463. 	local hood_overlay_district_txt_h = vint_object_find("hood_overlay_district_txt", grp_h) 
  1464. 	local hood_overlay_pct_txt_h = vint_object_find("hood_overlay_pct_txt", grp_h) 
  1465. 	vint_set_property(hood_overlay_district_txt_h, "text_tag", district_str) 
  1466. 	 
  1467. 	local district_pct_string = floor((district_pct * 100) + .5) .. "%%" 
  1468. 	vint_set_property(hood_overlay_pct_txt_h, "text_tag", district_pct_string) 
  1469. 	 
  1470. 	if vint_is_std_res() then 
  1471. 		position_x = position_x * PAUSE_MAP_CURSOR_STD_RES_SCALE 
  1472. 		position_y = position_y * PAUSE_MAP_CURSOR_STD_RES_SCALE 
  1473. 	end 
  1474. 	 
  1475. 	--Update position 
  1476. 	vint_set_property(grp_h, "anchor", position_x, position_y) 
  1477.  
  1478. 	local target_scale = 3.5 * scale 
  1479. 	 
  1480. 	--Update the scale 
  1481. 	vint_set_property(grp_h, "scale", target_scale, target_scale) 
  1482. 	 
  1483. end 
  1484.  
  1485. ------------------------------------------------------------------------------- 
  1486. -- Updates main button hints. This is essentially a wrapper for our button hints 
  1487. -- It allows us to draw a nifty little background behind the hints that is 
  1488. -- Custom to the phone. 
  1489. -- 
  1490. -- @param	hint_data	Table representing button hints.. 
  1491. ------------------------------------------------------------------------------- 
  1492. function pause_map_update_button_hints(hint_data) 
  1493. 	Hint_bar:set_hints(hint_data, false, false) --Entered_with_gamepad, not Entered_with_gamepad) 
  1494. 	 
  1495. 	if game_get_platform() ~= "PC" then 
  1496. 		local width, height = Hint_bar:get_size() 
  1497. 		width = floor(width) 
  1498. 		height = floor(height) 
  1499. 		local bg_width, bg_height = element_get_actual_size(Hint_bar_bg, width, height) 
  1500. 		local hint_background_padding = 35 -- Additional padding needed for background height 
  1501. 		element_set_actual_size(Hint_bar_bg, width + 35, bg_height) 
  1502. 	end 
  1503. end 
  1504.  
  1505.  
  1506. ------------------------------------------------------------------------------- 
  1507. -- Flips an element in the horizontal direction... 
  1508.  
  1509. -- @param	h				handle to element 
  1510. -- @param	x_flip 		(bool)Do we flip the item or not? horizontal 
  1511. -- @param	y_flip 		(bool)Do we flip the item or not? vertical 
  1512. -- @param	override		(bool)true if we don't care if the item was flipped initially. 
  1513. ------------------------------------------------------------------------------- 
  1514. function pause_map_flip_element(h, x_flip, y_flip, override) 
  1515. 	local scale_x, scale_y = vint_get_property(h, "scale") 
  1516. 	if override == true then 
  1517. 		scale_x = abs(scale_x) 
  1518. 		scale_y = abs(scale_y) 
  1519. 	end 
  1520. 	local x_direction = 1 
  1521. 	local y_direction = 1 
  1522. 	 
  1523. 	if x_flip == true then 
  1524. 		x_direction = -1 
  1525. 	end 
  1526. 	if y_flip == true then 
  1527. 		y_direction = -1 
  1528. 	end 
  1529. 	 
  1530. 	scale_x = scale_x * x_direction 
  1531. 	scale_y = scale_y * y_direction 
  1532. 	vint_set_property(h, "scale", scale_x, scale_y)  
  1533. end 
  1534.  
  1535. function pause_map_hide_c_map() 
  1536. 	local h = vint_object_find("pause_map") 
  1537. 	vint_set_property(h, "visible", false) 
  1538. 	vint_object_destroy(h) 
  1539. end 
  1540.  
  1541. function pause_map_interface_event(event) 
  1542. 	--supported events: 
  1543. 	--INTERFACE_EVENT_ADD_GPS	 
  1544. 	--INTERFACE_EVENT_REMOVE_GPS 
  1545. 	--INTERFACE_EVENT_ADD_BOOKMARK 
  1546. 	--INTERFACE_EVENT_REMOVE_BOOKMARK 
  1547. 	--for now just use the same sound for all 
  1548. 	 
  1549. 	if event == INTERFACE_EVENT_ADD_GPS then 
  1550. 		if Pause_map_tutorial_mode == true then 
  1551. 			pause_map_tutorial_mode_change_text("M03_OBJ_GO_TO_WEAPON_STORE") 
  1552. 		end 
  1553. 	elseif event == INTERFACE_EVENT_REMOVE_GPS then 
  1554. 		if Pause_map_tutorial_mode == true then 
  1555. 			pause_map_tutorial_mode_change_text("M03_OBJ_SET_GPS") 
  1556. 		end 
  1557. 	end 
  1558. 	 
  1559. 	game_UI_audio_play("UI_Cell_Nav") 
  1560. end 
  1561.  
  1562.  
  1563. function pause_map_stag_popup_select(event, target_handle) 
  1564.  
  1565. 	--User wanted to go back... 
  1566. 	if event == "back" or Pause_map_stag_popup:get_selected_data() == 2 then 
  1567. 		-- The user hit the B button and cancelled the change 
  1568. 		 
  1569. 		Pause_map_stag_popup:nav_enable(false, nil, nil) 
  1570. 		game_UI_audio_play("UI_Main_Menu_Nav_Back") 
  1571. 		 
  1572. 		local stag_popup_overlay_grp_h = vint_object_find("stag_popup_overlay_grp") 
  1573. 		vint_set_property(stag_popup_overlay_grp_h, "visible", false) 
  1574. 		 
  1575. 		if Mouse_input_tracker ~= 0 then 
  1576. 			Mouse_input_tracker:subscribe(true) 
  1577. 		end 
  1578. 	 
  1579. 		if Filter_mouse_input_tracker ~= 0 then 
  1580. 			Filter_mouse_input_tracker:subscribe(true) 
  1581. 		end 
  1582. 		 
  1583. 		return 
  1584. 	end 
  1585. 	 
  1586. 	-- Did we select yes?  Now exit to via stag exit... 
  1587. 	if Pause_map_stag_popup:get_selected_data() == 1 then 
  1588. 		Pause_map_stag_popup:nav_enable(false, nil, nil) 
  1589. 		game_UI_audio_play("UI_Main_Menu_Select")	 
  1590. 		pause_map_stag_exit() 
  1591. 		return 
  1592. 	end 
  1593. end 
  1594.  
  1595. function pause_map_stag_popup_nav(event, value) 
  1596. 	 
  1597. 	if event == "nav_up" then	 
  1598. 		Pause_map_stag_popup.list:move_cursor(-1)	 
  1599. 	elseif event == "nav_down" then 
  1600. 		Pause_map_stag_popup.list:move_cursor(1) 
  1601. 	elseif event == "mouse_move" then 
  1602. 		-- value contains the target_handle in this case 
  1603. 		local new_index = Pause_map_stag_popup.list:get_button_index(value) 
  1604. 		if new_index ~= 0 then 
  1605. 			Pause_map_stag_popup.list:set_selection(new_index) 
  1606. 			Pause_map_stag_popup.list:move_cursor(0, true) 
  1607. 		end 
  1608. 	else 
  1609. 		--do nothing 
  1610. 	end 
  1611. end 
  1612.  
  1613. ------------------------------------------------------------------------------- 
  1614. -- Enables or disables tutorial mode dialog. 
  1615. -- 
  1616. function pause_map_tutorial_mode_enable(enabled) 
  1617.  
  1618. 	local tutorial_overlay_grp_h = vint_object_find("tutorial_overlay_grp") 
  1619. 	vint_set_property(tutorial_overlay_grp_h, "visible", enabled) 
  1620.  
  1621. 	if enabled then 
  1622. 		pause_map_tutorial_mode_change_text("M03_OBJ_SET_GPS") 
  1623. 		local map_info_grp_h = vint_object_find("map_info_grp") 
  1624. 		vint_set_property(map_info_grp_h, "visible", false) 
  1625. 	end 
  1626. end 
  1627.  
  1628. ------------------------------------------------------------------------------- 
  1629. -- Modifies the text field in the fake map GSI 
  1630. -- 
  1631. function pause_map_tutorial_mode_change_text(text_tag) 
  1632. 	local doc_h = vint_document_find("pause_map") 
  1633. 	local tutorial_overlay_grp_h = vint_object_find("tutorial_overlay_grp", 0, doc_h) 
  1634. 	local obj_txt_h = vint_object_find("obj_txt", tutorial_overlay_grp_h, doc_h) 
  1635. 	vint_set_property(obj_txt_h, "text_tag", text_tag) 
  1636. 	 
  1637. 		--resize bg to account for localized strings... 
  1638. 	local gsi_bg_h 	= vint_object_find("gsi_bg", tutorial_overlay_grp_h, doc_h) 
  1639. 	local obj_img_h 	= vint_object_find("obj_img", tutorial_overlay_grp_h, doc_h) 
  1640. 	local obj_txt_h	= vint_object_find("obj_txt", tutorial_overlay_grp_h, doc_h) 
  1641. 	 
  1642. 	local x, y = vint_get_property(obj_txt_h, "anchor") 
  1643. 	local bg_width, bg_height = element_get_actual_size(gsi_bg_h) 
  1644. 	local text_width, text_height = element_get_actual_size(obj_txt_h) 
  1645. 	 
  1646. 	local width = text_width + x + 10 
  1647. 	element_set_actual_size(gsi_bg_h, width, bg_height) 
  1648. end 
  1649.  
  1650. function pause_map_mouse_move(event, target_handle, x, y, lines_to_scroll, current_target_handle) 
  1651.  
  1652. 	if target_handle == Map_mask_handle then 
  1653. 		vint_set_mouse_cursor("Ui_cursor_hand_open") 
  1654. 	else 
  1655. 		vint_set_mouse_cursor("") 
  1656. 	end 
  1657. 	 
  1658. 	local hint_index = PC_hint_bar:get_hint_index(target_handle) 
  1659. 	if hint_index ~= 0 then 
  1660. 		PC_hint_bar:set_highlight(hint_index) 
  1661. 	else 
  1662. 		PC_hint_bar:set_highlight(0) 
  1663. 	end 
  1664. 	 
  1665. 	-- Zoom in/out highlighting 
  1666. 	vint_set_property(PC_zoom_in.handle, "tint", PAUSE_MAP_COLOR_ZOOM_UNSELECTED.R, PAUSE_MAP_COLOR_ZOOM_UNSELECTED.G, PAUSE_MAP_COLOR_ZOOM_UNSELECTED.B) 
  1667. 	vint_set_property(PC_zoom_out.handle, "tint", PAUSE_MAP_COLOR_ZOOM_UNSELECTED.R, PAUSE_MAP_COLOR_ZOOM_UNSELECTED.G, PAUSE_MAP_COLOR_ZOOM_UNSELECTED.B) 
  1668. 	if target_handle == PC_zoom_in.handle then 
  1669. 		vint_set_property(PC_zoom_in.handle, "tint", PAUSE_MAP_COLOR_ZOOM_SELECTED.R, PAUSE_MAP_COLOR_ZOOM_SELECTED.G, PAUSE_MAP_COLOR_ZOOM_SELECTED.B) 
  1670. 	end 
  1671. 	if target_handle == PC_zoom_out.handle then 
  1672. 		vint_set_property(PC_zoom_out.handle, "tint", PAUSE_MAP_COLOR_ZOOM_SELECTED.R, PAUSE_MAP_COLOR_ZOOM_SELECTED.G, PAUSE_MAP_COLOR_ZOOM_SELECTED.B) 
  1673. 	end 
  1674. end 
  1675.  
  1676. function pause_map_mouse_click(event, target_handle, x, y, lines_to_scroll, current_target_handle) 
  1677.  
  1678. 	local hint_index = PC_hint_bar:get_hint_index(target_handle) 
  1679. 	if hint_index == 1 then 
  1680. 		pause_map_input("back") 
  1681. 	elseif hint_index == 2 then 
  1682. 		pause_map_input("map") 
  1683. 	end 
  1684.  
  1685. 	local filter_target_idx = Pause_map_filter:get_filter_index(current_target_handle) 
  1686. 	if filter_target_idx >= 0 then 
  1687. 		Pause_map_filter:change_filter(filter_target_idx, true) 
  1688. 	end 
  1689.  
  1690. 	if target_handle == PC_zoom_in.handle then 
  1691. 		pause_map_zoom(true) 
  1692. 	end 
  1693. 	if target_handle == PC_zoom_out.handle then 
  1694. 		pause_map_zoom(false) 
  1695. 	end 
  1696. end 
  1697.  
  1698. function pause_map_mouse_right_click(event, target_handle, x, y, lines_to_scroll, current_target_handle) 
  1699.  
  1700. 	if target_handle == Map_mask_handle then 
  1701. 		pause_map_set_gps() 
  1702. 	end 
  1703. 	 
  1704. end 
  1705.  
  1706. function pause_map_mouse_middle_click(event, target_handle, x, y, lines_to_scroll, current_target_handle) 
  1707.  
  1708. 	if target_handle == Map_mask_handle then 
  1709. 		pause_map_add_bookmark() 
  1710. 	end 
  1711. 	 
  1712. end 
  1713.  
  1714. function pause_map_mouse_drag(event, target_handle, x, y, lines_to_scroll, current_target_handle) 
  1715.  
  1716. 	if target_handle == Map_mask_handle then 
  1717. 		vint_set_mouse_cursor("Ui_cursor_hand_closed") 
  1718. 		pause_map_drag_map() 
  1719. 		--vint_set_property(Cursor_tool_handle, "visible", false) 
  1720. 	end 
  1721.  
  1722. end 
  1723.  
  1724. function pause_map_mouse_drag_release(event, target_handle, x, y, lines_to_scroll, current_target_handle) 
  1725.  
  1726. 	if current_target_handle ~= Map_mask_handle then 
  1727. 		vint_set_mouse_cursor("") 
  1728. 	elseif target_handle == Map_mask_handle then 
  1729. 		vint_set_mouse_cursor("Ui_cursor_hand_open") 
  1730. 	end 
  1731. 	 
  1732. 	--vint_set_property(Cursor_tool_handle, "visible", true) 
  1733. end 
  1734.  
  1735. function pause_map_gamepad_monitor_thread() 
  1736.  
  1737. 	while true do 
  1738. 		vint_set_property(Cursor_tool_handle, "visible", game_is_active_input_gamepad()) 
  1739. 		delay(0.5) 
  1740. 	end 
  1741.  
  1742. end 
  1743.  
  1744. -- This is required because we're using Vdo_store_popup 
  1745. -- 
  1746. function store_common_do_nothing() 
  1747.  
  1748. end