./main_menu_load.lua

  1. Main_menu_load_doc = -1 
  2. local Meter_width, Meter_height 
  3. local Meter_h = -1 
  4. -- Initializes main menu loading... 
  5. -- 
  6. function main_menu_load_init() 
  7. 	--This doc is included as a dependency of main_menu_top, so the only thing we want to do is store a global reference to it... 
  8. 	Main_menu_load_doc = vint_document_find("main_menu_load") 
  9. 	Meter_h = vint_object_find("meter", 0, Main_menu_load_doc) 
  10. 	Meter_width, Meter_height = element_get_actual_size(Meter_h) 
  11. end 
  12.  
  13. function main_menu_load_cleanup() 
  14. end 
  15.  
  16. -- Starts the main menu load. 
  17. function main_menu_load_start() 
  18. 	--Play animations... 
  19. 	local intro_loading_anim_h = vint_object_find("intro_loading_anim", 0, Main_menu_load_doc)		--Fade in percent... 
  20. 	local loading_pulse_anim_h = vint_object_find("loading_pulse_anim", 0, Main_menu_load_doc)		-- 
  21. 	lua_play_anim(intro_loading_anim_h, 0, Main_menu_load_doc) 
  22. 	lua_play_anim(loading_pulse_anim_h, 0, Main_menu_load_doc) 
  23. end 
  24.  
  25. -- if percent < 1 then update the loading progress indicator 
  26. -- otherwise transition to "press start..." 
  27.  
  28. -- Update from game the percentage of the loading... 
  29. -- when it is done loading it should called 
  30. function main_menu_load_complete(percent) 
  31. 	if percent >= 1 then 
  32. 		--Main menu loaded.... 
  33. 		main_menu_load_finished() 
  34. 		percent = 1 
  35. 	end 
  36. 	 
  37. 	--Insert Percent into loading text 
  38. 	--local values = {[0] = "GAME_LOADING", [1] = floor(percent*100)} 
  39. 	--local str = vint_insert_values_in_string("{0} {1}%%%", values) 
  40. 	--vint_set_property(vint_object_find("mm_percent_complete", 0, Main_menu_load_doc), "text_tag", str) 
  41. 	vint_set_property(vint_object_find("mm_percent_complete", 0, Main_menu_load_doc), "text_tag", "GAME_LOADING") 
  42. 	--vint_set_property(vint_object_find("mm_percent_complete", 0, Main_menu_load_doc), "text_tag", var_to_string(floor(percent*100)) .. "%%") 
  43. 	 
  44. 	--set meter 
  45. 	 
  46. 	if percent == nil or percent < 0 then 
  47. 		percent = 0 
  48. 	end 
  49. 	 
  50. 	local new_meter_width = Meter_width * percent  
  51. 	 
  52. 	if percent ~= 1 then --if 1 then set it to full 
  53. 		local incriment = Meter_width/10 
  54. 		 
  55. 		for i = 0, Meter_width, incriment do 
  56. 			if new_meter_width >= i and new_meter_width < (i + incriment) then 
  57. 				new_meter_width = i 
  58. 			end 
  59. 		end 
  60. 	end 
  61. 	element_set_actual_size(Meter_h, new_meter_width, Meter_height) 
  62. 	 
  63. end 
  64.  
  65. function main_menu_load_finished() 
  66. 	-- Show press start... call to main_menu_top.lua 
  67. 	bg_saints_show(true) 
  68. 	main_menu_top_press_start_show() 
  69. 	 
  70. 	--Show Logo... 
  71. 	main_menu_logo_show() 
  72. 	 
  73. 	-- Force pause intro loading anim... 
  74. 	local intro_loading_anim_h = vint_object_find("intro_loading_anim", 0, Main_menu_load_doc)		--Fade in percent... 
  75. 	--vint_set_property(intro_loading_anim_h, "is_paused", true) 
  76. 	 
  77. 	-- Hide loading stuff... 
  78. 	local intro_loading_fadeout_anim_h = vint_object_find("intro_loading_fadeout_anim", 0, Main_menu_load_doc) 
  79. 	lua_play_anim(intro_loading_fadeout_anim_h, 0, Main_menu_load_doc) 
  80. end 
  81.  
  82. function main_menu_load_skip() 
  83. 	local screen_black_out_h = vint_object_find("screen_black_out", 0, Main_menu_load_doc) 
  84. 	vint_set_property(screen_black_out_h, "alpha", 0) 
  85. 	 
  86. 	local loading_grp_h = vint_object_find("loading_grp", 0, Main_menu_load_doc) 
  87. 	vint_set_property(loading_grp_h, "alpha", 0) 
  88. end