sr2lua/credits.lua

  1. ------------- 
  2. -- CREDITS -- 
  3. ------------- 
  4. Credits = {} 
  5. Credits.data = { } 
  6. --[[	[0] = {type = 0, str1="Volition"}, 
  7. 	[1] = {type = 1, str1="Leads"}, 
  8. 	[2] = {type = 3, str2="Producer", str1="Gred Donovan"}, 
  9. 	[3] = {type = 3, str2="Product Technical Director", str1="Nick Lee"}, 
  10. 	[4] = {type = 3, str1="David Absug", str2="Programmer"}, 
  11. 	[5] = {type = 3, str1="Jim Brennan", str2="Programmer"}, 
  12. 	[6] = {type = 3, str1="John Buckley", str2="Programmer"}, 
  13. 	[7] = {type = 3, str1="Aaron Canary", str2="Programmer"}, 
  14. 	[8] = {type = 3, str1="Justin Christofoli", str2="Programmer"}, 
  15. 	[9] = {type = 3, 	str1="Mike Hawkins", str2="Professor"}, 
  16. 	[10] = {type = 1, str1="General"}, 
  17. 	[11] = {type = 3, str1="Jeffrey Harris", str2="The master mind"}, 
  18. 	[12] = {type = 3, str1="", str2="Programmer"}, 
  19. 	[13] = {type = 3, str1="", str2="Programmer", }, 
  20. 	[14] = {type = 3, str1="", str2="Programmer", }, 
  21. 	[15] = {type = 3, str1="Darryl Davis", str2="Programmer"}, 
  22. 	[16] = {type = 3, str1="Darryl Davis", str2="Title 1"}, 
  23. 	[17] = {type = 3, str1="Darryl Davis", str2="Title 1"}, 
  24. 	[18] = {type = 3, str1="Eric Braun", str2="Programmer"}, 
  25. 	[19] = {type = 3, str1="Jon Breuer", str2="Title 1"}, 
  26. 	[20] = {type = 0, str1="Volition"}, 
  27. 	[21] = {type = 1, str1="Leads"}, 
  28. 	[22] = {type = 3, str2="Producer", str1="Gred Donovan"}, 
  29. 	[23] = {type = 3, str2="Product Technical Director", str1="Nick Lee"}, 
  30. 	[24] = {type = 3, str1="David Absug", str2="Programmer"}, 
  31. 	[25] = {type = 3, str1="Jim Brennan", str2="Programmer"}, 
  32. 	[26] = {type = 3, str1="John Buckley", str2="Programmer"}, 
  33. 	[27] = {type = 3, str1="Aaron Canary", str2="Programmer"}, 
  34. 	[28] = {type = 3, str1="Justin Christofoli", str2="Programmer"}, 
  35. 	[29] = {type = 3, str1="Mike Hawkins", str2="Professor"}, 
  36. 	[30] = {type = 1, str1="Music"}, 
  37. 	[31] = {type = 2, str1="This is how we do it - Jesus Christ Superstar", str2="This covers any SR2 specific technical details that need to be documented. Things pertaining to how parts of the"}, 
  38. 	[32] = {type = 2, str1="Dear Maria, Count Me In - All Time Low", str2="Concerts, album reviews, pop, jazz and classical music news from the Los Angeles Times."}, 
  39. 	[33] = {type = 2, str1="Sorry - Buck Cherry", str2="Check out new bands and artists on MySpace Music: Watch music videos, check out concerts and tour dates, music, news and more.", }, 
  40. 	[34] = {type = 2, str1="Stick it in Slowly - DEGC", str2="New This Week: Ashlee Simpson;Plus new ... Alan Light gets Keith Urban's candid take on success, sobriety and music ...", }, 
  41. 	[35] = {type = 2, str1="Doin it from the back - Lucky Pierre", str2="Music is an art form in which the medium is sound. Elements of music are pitch (which governs melody and harmony), rhythm (and its associated concepts tempo ..."}, 
  42. 	[36] = {type = 2, str1="Darryl Davis", str2="Title 1"}, 
  43. 	[37] = {type = 2, str1="Darryl Davis", str2="Title 1"}, 
  44. 	[38] = {type = 2, str1="Eric Braun", str2="Programmer"}, 
  45. 	[39] = {type = 2, str1="Jon Breuer", str2="Title 1"}, 
  46. } ]]-- 
  47. --[[ 
  48. 0 = Flag (1 -  Section Title, 2 – Header (i.e., programming), 3 – Role – Name, 4 – Music) 
  49. 1 = Section Title text, Header Text, or Name Text, or Song Title 
  50. 2 = Null, Null, Role, Music Description 
  51. ]] 
  52.  
  53.  
  54.  
  55.  
  56. --General Constants 
  57. CREDITS_HALF_SCREEN_HEIGHT = 360 
  58. CREDITS_SCREEN_LEEWAY = 250 
  59.  
  60.  
  61. --Spacing/Size constants 
  62. if get_language() == "JP" then 
  63. 	CREDITS_SPACING_STANDARD = 4 
  64. 	CREDITS_TITLE_GAP = 30 
  65. 	CREDITS_EMPTY_GAP = 0 
  66. elseif get_language() == "SK" then 
  67. 	CREDITS_SPACING_STANDARD = 10		 
  68. 	CREDITS_TITLE_GAP = 25			 
  69. 	CREDITS_EMPTY_GAP = 4			 
  70. else	 
  71. 	CREDITS_SPACING_STANDARD = 7		--Spacing between credits 
  72. 	CREDITS_TITLE_GAP = 15				--Title gap 
  73. 	CREDITS_EMPTY_GAP = 18				--Gap for things like role-name 
  74. end	 
  75. CREDITS_HEADER_GAP = 15					--Header gap 
  76. 				 
  77.  
  78. --init text size globals 
  79. Credits_header_text_height = -1 
  80. Credits_role_text_height = -1 
  81. Credits_name_text_height = -1 
  82.  
  83. 	 
  84. --Movement Constants 
  85. CREDITS_PIXELS_PER_SEC_MAX = 200 --2200 
  86. CREDITS_PIXELS_PER_SEC_NORMAL = 50 --50 
  87. CREDITS_PIXELS_PER_SEC_MIN = 5 --5 
  88.  
  89. --Movement Constants 
  90.  
  91. Credits_thread = -1 
  92.  
  93. function credits_init() 
  94. 	Credits.handles = {} 
  95. 	 
  96. 	--Template Elements 
  97. 	Credits.handles.credits_base = vint_object_find("credits_base_grp") 
  98. 	Credits.handles.credits_slide = vint_object_find("credits_slide") 
  99. 	Credits.handles.header = vint_object_find("credit_header") 
  100. 	 
  101. 	--header text 
  102. 	Credits.handles.header_text = vint_object_find("header", Credits.handles.header) 
  103.  
  104. 	--music grp 
  105. 	Credits.handles.music = vint_object_find("credit_music") 
  106. 	 
  107. 	--role name 
  108. 	Credits.handles.role_name = vint_object_find("credit_role_name") 
  109. 	Credits.handles.role_text = vint_object_find("role", Credits.handles.name_text) 
  110. 	Credits.handles.name_text = vint_object_find("name", Credits.handles.name_text) 
  111. 	 
  112. 	--Text size globals 
  113. 	local w, h = element_get_actual_size(Credits.handles.header_text) 
  114. 	Credits_header_text_height = h 
  115.  
  116. 	w, h = element_get_actual_size(Credits.handles.role_text) 
  117. 	Credits_role_text_height = h 
  118. 		 
  119. 	w, h = element_get_actual_size(Credits.handles.name_text) 
  120. 	Credits_name_text_height = h 
  121. 	 
  122. 	--logo img placeholder 
  123. 	Credits.handles.logo = vint_object_find("credit_logo") 
  124. 	 
  125. 	vint_set_property(Credits.handles.role_name, "visible", false) 
  126. 	vint_set_property(Credits.handles.music, "visible", false) 
  127. 	vint_set_property(Credits.handles.header, "visible", false) 
  128. 	vint_set_property(Credits.handles.logo, "visible", false) 
  129. 	 
  130. --	vint_set_property(Credits.handles.credits_base, "alpha", 0) 
  131. 	Credits.handles.bg = vint_object_find("bg", Credits.handles.credits_base) 
  132. 	Credits.handles.lower_bitmap = vint_object_find("lower_bitmap", Credits.handles.credits_base) 
  133. 	Credits.handles.upper_bitmap = vint_object_find("upper_bitmap", Credits.handles.credits_base) 
  134. 	vint_set_property(Credits.handles.bg, "alpha", 0) 
  135. 	vint_set_property(Credits.handles.lower_bitmap, "alpha", 0) 
  136. 	vint_set_property(Credits.handles.upper_bitmap, "alpha", 0) 
  137. 	 
  138.  
  139. 	vint_set_property(Credits.handles.credits_slide, "alpha", 0) 
  140. 	 
  141. 	--Animations 
  142. 	Credits.anims = {} 
  143. 	Credits.anims.fade_in = vint_object_find("fade_in_anim") 
  144. 	Credits.anims.fade_in_bg = vint_object_find("fade_in_bg_anim") 
  145. 	Credits.anims.fade_out = vint_object_find("fade_out_anim") 
  146. 	Credits.anims.fade_out_twn = vint_object_find("fade_out_twn", Credits.anims.fade_out) 
  147. 	 
  148. 	vint_set_property(Credits.anims.fade_in, "is_paused", true) 
  149. 	vint_set_property(Credits.anims.fade_in_bg, "is_paused", true) 
  150. 	vint_set_property(Credits.anims.fade_out, "is_paused", true) 
  151. 	 
  152. 	Credits.cur_idx = -1				--initialize current idx 
  153. 	Credits.oldest_idx = 0 
  154. 	Credits.cur_slide_pos = 365	 
  155. 	Credits.num_items = 0 
  156. 	Credits.scroll_speed = CREDITS_PIXELS_PER_SEC_NORMAL 
  157. 	Credits.skip_available  = true 
  158. 	 
  159. 	--Load peg 
  160. 	Credits.peg_data = "ui_credits" 
  161. 	peg_load(Credits.peg_data) 
  162. 	 
  163. 	--Download all credits 
  164. 	vint_dataresponder_request("credits_grab_credits", "credits_populate", 0) 
  165. 	credits_populate_logos() 
  166. 	Credits_thread = thread_new("credits_process") 
  167. 	 
  168. 	--Fade in animation 
  169. 	lua_play_anim(Credits.anims.fade_in, 0) 
  170. 	 
  171. 	--Is the main menu loaded? if so do not delay background fade in. 
  172. 	if vint_document_find("main_menu") == 0 then 
  173. 		lua_play_anim(Credits.anims.fade_in_bg, 9) 
  174. 	else 
  175. 		--We are in main menu, do not delay bg fade in and speed up animation 
  176. 		lua_play_anim(Credits.anims.fade_in_bg, 0) 
  177. 		vint_set_property(vint_object_find("bg_alpha_twn_1", Credits.anims.fade_in_bg), "duration", .9) 
  178. 		vint_set_property(vint_object_find("lower_bitmap_alpha_twn_1", Credits.anims.fade_in_bg), "duration", .9) 
  179. 		vint_set_property(vint_object_find("upper_bitmap_alpha_twn_1", Credits.anims.fade_in_bg), "duration", .9) 
  180. 		 
  181. 	end 
  182. 	 
  183. 	 
  184. 	credits_input_subscribe() 
  185. end 
  186.  
  187. function credits_cleanup() 
  188. 	if Credits.peg_data ~= nil then 
  189. 		peg_unload(Credits.peg_data) 
  190. 	end 
  191. 	credits_input_unsubscribe() 
  192. end 
  193.  
  194.  
  195. function credits_populate(item_type, str1, str2) 
  196. 	Credits.data[Credits.num_items] = { type = item_type, str1 = str1, str2 = str2, y = -1} 
  197. 	Credits.num_items = Credits.num_items + 1 
  198. end 
  199.  
  200. function credits_populate_logos() 
  201. 	--Add logos to end of credits 
  202. 	Credits.data[Credits.num_items] = { type = 4, logo_bmp = "ui_credits_chris_allen", y = -1} 
  203. 	Credits.num_items = Credits.num_items + 1 
  204. 	Credits.data[Credits.num_items] = { type = 4, logo_bmp = "ui_credits_logo_volition", y = -1} 
  205. 	Credits.num_items = Credits.num_items + 1 
  206. 	Credits.data[Credits.num_items] = { type = 4, logo_bmp = "ui_credits_logo_thq", y = -1} 
  207. 	Credits.num_items = Credits.num_items + 1 
  208. end 
  209.  
  210. function credits_process() 
  211. 	 
  212. 	local move_amount = 0 
  213. 	 
  214. 	local prev_item, new_item, credit_h, credit_height, h, item_width, item_height, prev_item_height, prev_item_y, item_y 
  215. 	local create_new_item 
  216. 	local credits_play = true 
  217. 	while credits_play do 
  218.  
  219. 			 
  220. 		--move credits 
  221. 		move_amount = Credits.scroll_speed * get_frame_time_real() 
  222. 		 
  223. 		--Slide Credits up 
  224. 		Credits.cur_slide_pos = Credits.cur_slide_pos - move_amount 
  225. 		vint_set_property(Credits.handles.credits_slide, "anchor", 0, Credits.cur_slide_pos) 
  226. 	 
  227. 		--Is the first top item off the screen?	 
  228. 		if Credits.cur_idx < 0 then 
  229. 			--Initialize 
  230. 			create_new_item = true 
  231. 		else 
  232. 			--Remove first item? 
  233. 			local actual_slide_pos = Credits.cur_slide_pos + CREDITS_HALF_SCREEN_HEIGHT  
  234. 			 
  235. 			if Credits.data[Credits.oldest_idx] ~= nil then 
  236. 							 
  237. 				if actual_slide_pos <  (Credits.data[Credits.oldest_idx].y + CREDITS_SCREEN_LEEWAY) * -1 then 
  238. 				 
  239. 					--Lets kill it 
  240. 					if Credits.data[Credits.oldest_idx].credit_h ~= nil then 
  241. 						vint_object_destroy(Credits.data[Credits.oldest_idx].credit_h) 
  242. 					end 
  243. 					 
  244. 					Credits.data[Credits.oldest_idx] = nil 
  245. 					Credits.oldest_idx = Credits.oldest_idx + 1 
  246. 					 
  247. 					--Are credits complete? 
  248. 					if Credits.num_items == Credits.oldest_idx then 
  249. 						--Credits complete 
  250. 						credits_complete() 
  251. 						credits_play = false 
  252. 					end 
  253. 				end 
  254. 			end	 
  255. 			if Credits.data[Credits.cur_idx] ~= nil then		 
  256. 				--Build next item 
  257. 				local next_item_build_at = (Credits.data[Credits.cur_idx].y + Credits.data[Credits.cur_idx].height) * -1 
  258. 				actual_slide_pos = Credits.cur_slide_pos - CREDITS_HALF_SCREEN_HEIGHT  
  259. 				if actual_slide_pos < next_item_build_at + CREDITS_SCREEN_LEEWAY then 
  260. 					create_new_item = true  
  261. 				end 
  262. 			end 
  263. 		end 
  264. 	 
  265. 		--Should I create an item on the bottom? 
  266. 		if create_new_item == true then 
  267. 			--What is the new item going to be? 
  268. 			Credits.cur_idx = Credits.cur_idx + 1 
  269. 			new_item = Credits.data[Credits.cur_idx] 
  270. 			 
  271. 			if new_item ~= nil and Credits.cur_idx < Credits.num_items then 
  272. 				--Ok so there is another item to physically build, lets build it... 
  273. 				 
  274. 				--What type is it, do special processing and build item 
  275. 				if new_item.type == 0 then 
  276. 					--Header 
  277. 					credit_h = vint_object_clone(Credits.handles.header) 
  278. 					h = vint_object_find("header", credit_h) 
  279. 					vint_set_property(h, "text_tag", new_item.str1) 
  280. 					vint_set_property(h, "tint", .89, .74, .05)  
  281. 					local text_x, text_y = vint_get_property(h, "anchor") 
  282. 					local text_width, text_height = element_get_actual_size(h) 
  283. 					vint_set_property(h, "anchor", 0, text_y + 40) 
  284. 					vint_set_property(h, "text_scale", .65, .65) 
  285. 					credit_height = text_height + CREDITS_HEADER_GAP + 40 
  286. 				elseif new_item.type == 1 then 
  287. 					--Title 
  288. 					credit_h = vint_object_clone(Credits.handles.header) 
  289. 					h = vint_object_find("header", credit_h) 
  290. 					vint_set_property(h, "text_tag", new_item.str1) 
  291. 					local text_x, text_y = vint_get_property(h, "anchor") 
  292. 					local text_width, text_height = element_get_actual_size(h) 
  293. 					vint_set_property(h, "anchor", 0, text_y + 10) 
  294. 					credit_height = text_height + CREDITS_TITLE_GAP + 10 
  295. 					 
  296. 				elseif new_item.type == 3 then 
  297. 					--Music 
  298. 					credit_h = vint_object_clone(Credits.handles.music) 
  299. 					--first text 
  300. 					h = vint_object_find("song_name", credit_h) 
  301. 					 
  302. 					vint_set_property(h, "text_tag", new_item.str1) 
  303. 					 
  304. 					local text_x, text_y = vint_get_property(h, "anchor") 
  305. 					local text_width_a, text_height_a = element_get_actual_size(h) 
  306. 					vint_set_property(h, "anchor", 0, text_y ) 
  307. 					 
  308. 					--second text 
  309. 					h = vint_object_find("description", credit_h) 
  310. 					vint_set_property(h, "text_tag", new_item.str2) 
  311. 					 
  312. 					local text_x, text_y = vint_get_property(h, "anchor") 
  313. 					local text_width_b, text_height_b = element_get_actual_size(h) 
  314. 					vint_set_property(h, "anchor", 0, text_y) 
  315.  
  316. 					if get_language() == "JP" then 
  317. 						if new_item.str2 ~= "" then 
  318. 							text_height_b = text_height_b + 10 
  319. 						end 
  320. 					elseif get_language() == "SK" then 
  321. 						if new_item.str2 ~= "" then 
  322. 							text_height_b = text_height_b + 12 
  323. 						end 
  324. 					else 
  325. 						if new_item.str2 ~= "" then 
  326. 							text_height_b = text_height_b + 14 
  327. 						end					 
  328. 					end 
  329. 					 
  330. 					--Special height calculation for wrapping text 
  331. 					item_width, item_height = element_get_actual_size(h) 
  332. 					credit_height = text_height_a + text_height_b 
  333.  
  334. 				elseif new_item.type == 2 then 
  335. 					--Role\Name 
  336. 					credit_h = vint_object_clone(Credits.handles.role_name) 
  337. 					 
  338. 					--Find names 
  339. 					local name_h = vint_object_find("name", credit_h) 
  340. 					local role_h = vint_object_find("role", credit_h) 
  341. 					 
  342. 					--Change Tags 
  343. 					vint_set_property(name_h, "text_tag", new_item.str1) 
  344. 					vint_set_property(role_h, "text_tag", new_item.str2) 
  345. 					 
  346. 					--Get Sizes 
  347. 					local text_width1, name_height = element_get_actual_size(name_h)		 
  348. 					local role_width, role_height = element_get_actual_size(role_h) 
  349. 					 
  350. 					local text_height = Credits_name_text_height + 3 
  351. 					 
  352. 					--init the text orientation 
  353. 					vint_set_property(name_h, "auto_offset", "nw") 
  354. 					vint_set_property(role_h, "auto_offset", "ne") 
  355. 					vint_set_property(name_h, "anchor", 5, 3) 
  356. 					vint_set_property(role_h, "anchor", role_width - 10, 6) 
  357.  
  358. 					if get_language() == "JP" then 
  359. 						--adjust the roles for JP 
  360. 						if role_height > Credits_role_text_height then 
  361. 							vint_set_property(name_h, "auto_offset", "w") 
  362. 							vint_set_property(role_h, "auto_offset", "e") 
  363. 							vint_set_property(name_h, "anchor", 5, 29) 
  364. 							vint_set_property(role_h, "anchor", role_width - 10, 29) 
  365. 							text_height = role_height + 12 
  366. 						else 
  367. 							text_height = name_height 
  368. 						end 
  369. 						--is the name 2 lines tall? 
  370. 						if name_height > Credits_name_text_height then 
  371. 							text_height = name_height * 2 
  372. 						end	 
  373. 					elseif get_language() == "SK" then 
  374. 						--adjust the roles for SK 
  375. 						if role_height > Credits_role_text_height then 
  376. 							vint_set_property(name_h, "auto_offset", "w") 
  377. 							vint_set_property(role_h, "auto_offset", "e") 
  378. 							vint_set_property(name_h, "anchor", 5, 27) 
  379. 							vint_set_property(role_h, "anchor", role_width - 10, 27) 
  380. 							text_height = role_height + 10 
  381. 						else 
  382. 							text_height = name_height 
  383. 						end 
  384. 						--is the name 2 lines tall? 
  385. 						if name_height > Credits_name_text_height then 
  386. 							text_height = name_height * 2 
  387. 						end	 
  388. 					else 
  389. 				 
  390. 						--adjust the roles for US 
  391. 						if role_height > Credits_role_text_height then 
  392. 							vint_set_property(name_h, "auto_offset", "w") 
  393. 							vint_set_property(role_h, "auto_offset", "e") 
  394. 							vint_set_property(name_h, "anchor", 5, 29) 
  395. 							vint_set_property(role_h, "anchor", role_width - 10, 29) 
  396. 							text_height = role_height + 6 
  397. 						else 
  398. 							text_height = name_height 
  399. 						end 
  400. 						--is the name 2 lines tall? 
  401. 						if name_height > Credits_name_text_height then 
  402. 							text_height = name_height * 2 
  403. 						end 
  404. 					end 
  405. 					credit_height = text_height 
  406. 				elseif new_item.type == 4 then 
  407. 					--Logo 
  408. 					credit_h = vint_object_clone(Credits.handles.logo) 
  409. 					h = vint_object_find("logo_bmp", credit_h) 
  410. 					vint_set_property(h, "image", new_item.logo_bmp) 
  411. 					local logo_width, logo_height = element_get_actual_size(h) 
  412. 					credit_height = logo_height + 40 
  413. 				end 
  414. 				 
  415. 				--Reassign parent 
  416. 				vint_object_set_parent(credit_h, Credits.handles.credits_slide) 
  417. 				vint_set_property(credit_h, "visible", true) 
  418. 				 
  419. 				--Calculate y from previous item data 
  420. 				prev_item = Credits.data[Credits.cur_idx - 1] 
  421. 				 
  422. 				if prev_item == nil then 
  423. 					item_y = 0 
  424. 				else 
  425. 					if new_item.str1 == "" then 
  426. 						credit_height = CREDITS_EMPTY_GAP 
  427. 					end 
  428. 					item_y = prev_item.y + prev_item.height + CREDITS_SPACING_STANDARD 
  429. 					 
  430. 					--but if this is japanese, we need more space 
  431. 					if get_language() == "JP" then 
  432. 						item_y = item_y + 10  
  433. 					end 
  434. 				end 
  435. 				 
  436.  
  437. 				 
  438. 				--Move object 
  439. 				vint_set_property(credit_h,"anchor", 0, item_y) 
  440. 				 
  441. 				--Store data 
  442. 				new_item.credit_h = credit_h 
  443. 				new_item.height = credit_height  
  444. 				new_item.y = item_y  
  445. 				 
  446. 			end 
  447. 			 
  448. 			--Do not create the next item automatically 
  449. 			create_new_item = false 
  450. 		end 
  451. 		thread_yield() 
  452. 	end 
  453. end 
  454.  
  455. function credits_complete() 
  456. 	--Unsubscribe from controls 
  457. 	credits_input_unsubscribe() 
  458. 	 
  459. 	--Tell game that credits are done rolling 
  460. 	credits_are_finished() 
  461. end 
  462.  
  463. function credits_input_subscribe() 
  464. 		--	Subscribe to the input 
  465. 	Credits.input_subs = {	 
  466. 		y = vint_subscribe_to_raw_input("left_joy_y",			"credits_input_stick", -100), 
  467. 		up = vint_subscribe_to_raw_input("inventory_up",		"credits_input_stick", -100), 
  468. 		down = vint_subscribe_to_raw_input("inventory_down",		"credits_input_stick", -100), 
  469. 		select = vint_subscribe_to_input_event(nil, "select",		"credits_input_btn", -100), 
  470. 		back = vint_subscribe_to_input_event(nil, "back",		"credits_input_btn", -100), 
  471. 		skip = vint_subscribe_to_input_event(nil, "exit",		"credits_input_btn", -100), 
  472. 		all = vint_subscribe_to_input_event(nil, "all_unassigned",	"credits_input_btn", -100), 
  473. 	} 
  474. end 
  475.  
  476. function credits_input_unsubscribe() 
  477. 	vint_unsubscribe_to_raw_input(Credits.input_subs.y) 
  478. 	vint_unsubscribe_to_raw_input(Credits.input_subs.up) 
  479. 	vint_unsubscribe_to_raw_input(Credits.input_subs.down) 
  480. 	vint_unsubscribe_to_input_event(Credits.input_subs.select) 
  481. 	vint_unsubscribe_to_input_event(Credits.input_subs.back) 
  482. 	vint_unsubscribe_to_input_event(Credits.input_subs.skip) 
  483. 	vint_unsubscribe_to_input_event(Credits.input_subs.all) 
  484. end 
  485.  
  486. function credits_input_stick(event, value) 
  487. 	if event == "left_joy_y" or event == "inventory_up" or event == "inventory_down" then 
  488. 		--Adjust credit speed 
  489. 		if  event == "inventory_up" and value ~= 0 then value = 1 end 
  490. 		if  event == "inventory_down" and value ~= 0 then value = -1 end 
  491. 		if value < 0 then 
  492. 			Credits.scroll_speed = CREDITS_PIXELS_PER_SEC_NORMAL + (CREDITS_PIXELS_PER_SEC_MIN - CREDITS_PIXELS_PER_SEC_NORMAL ) * value * -1  
  493. 			 
  494. 		elseif value > 0 then 
  495. 		 
  496. 			Credits.scroll_speed = 	CREDITS_PIXELS_PER_SEC_NORMAL + (CREDITS_PIXELS_PER_SEC_MAX - CREDITS_PIXELS_PER_SEC_NORMAL) * value  
  497. 		else 
  498. 			Credits.scroll_speed = CREDITS_PIXELS_PER_SEC_NORMAL  
  499. 		end 
  500. 	end 
  501. end 
  502.  
  503. function credits_input_btn(target, event, accelleration) 
  504. 	 
  505. 	if Credits.skip_available == true then 
  506. 		if event == "exit" then 
  507. 			credits_were_skipped() 
  508. 		elseif credits_in_cutscene() == false then 
  509. 			credits_complete() 
  510. 		end 
  511. 	end 
  512. end 
  513.  
  514. function credits_force_closed() 
  515. 	if credits_in_cutscene() == true then		 
  516. 		credits_were_skipped() 
  517. 	else 	 
  518. 		credits_complete() 
  519. 	end 
  520. end 
  521.