./cte_nemo_chair.lua

  1. Cte_nemo_chair_doc_handle = -1 
  2.  
  3. local Cte_nemo_chair_update_thread_handle = -1 
  4. local Screen_grp_h = -1 
  5. local Screen_in_anim_h = -1 
  6. Right_side_twns = {} 
  7.  
  8. function cte_nemo_chair_init() 
  9. 	if vint_is_std_res() then 
  10. 		--dim out parts that will flicker in standard def 
  11. 		local right_side_boxes_h = vint_object_find("right_side_boxes") 
  12. 		local right_side_elements_h = vint_object_find("right_side_elements") 
  13. 		vint_set_property(right_side_boxes_h, "alpha", .33) 
  14. 		vint_set_property(right_side_elements_h, "alpha", .33) 
  15. 	end 
  16. 	 
  17. 	Cte_nemo_chair_doc_handle = vint_document_find("cte_nemo_chair") 
  18. 	Screen_grp_h = vint_object_find("screen_grp", 0, Cte_nemo_chair_doc_handle)  
  19. 	Screen_in_anim_h = vint_object_find("screen_in_anim", 0, Cte_nemo_chair_doc_handle)  
  20.  
  21. 	--Figure out stuff for bottom line graph animation... 
  22. 	local anim_h = vint_object_find("bottom_graph_line_anim") 
  23. 	local bottom_graph_line_h = vint_object_find("bottom_graph_line") 
  24. 	local bottom_graph_cap_twn_h = vint_object_find("bottom_graph_cap_twn") 
  25. 	local bottom_graph_line_twn_h = vint_object_find("bottom_graph_line_twn") 
  26. 	local line_grp_h = bottom_graph_line_h 
  27. 	local cap_twn_h = bottom_graph_cap_twn_h  
  28. 	local line_twn_h = bottom_graph_line_twn_h  
  29. 	 
  30. 	local total_loops = 40 
  31. 	for i = 0, total_loops do 
  32. 		if i > 0 then 
  33. 			line_grp_h = vint_object_clone(bottom_graph_line_h) 
  34. 			cap_twn_h = vint_object_clone(bottom_graph_cap_twn_h) 
  35. 			line_twn_h = vint_object_clone(bottom_graph_line_twn_h) 
  36. 		end 
  37. 		local x, y = vint_get_property(line_grp_h, "anchor") 
  38. 		x = i * 4 
  39. 		vint_set_property(line_grp_h, "anchor", x, y) 
  40. 		local line_h = vint_object_find("bottom_vert_line", line_grp_h) 
  41. 		local cap_h = vint_object_find("bottom_vert_line_cap", line_grp_h) 
  42. 	 
  43. 		local rand_time = rand_float(.01,.2) 
  44. 		vint_set_property(cap_twn_h, "start_time", i * (.1 + rand_time)) 
  45. 		 
  46. 		vint_set_property(line_twn_h, "start_time", i * (.1 + rand_time)) 
  47. 		vint_set_property(line_twn_h, "duration", .5 + rand_time ) 
  48. 		vint_set_property(cap_twn_h, "duration", .5+ rand_time ) 
  49. 		vint_set_property(cap_twn_h, "target_handle", cap_h) 
  50. 		vint_set_property(line_twn_h, "target_handle", line_h)	 
  51. 	end 
  52. 	 
  53. 	--Play Bottom line graph animation.. 
  54. 	lua_play_anim(anim_h, -5) 
  55. 	 
  56. 	 
  57. 	--Figure out stuff for right line graph animation... 
  58. 	anim_h = vint_object_find("right_graph_line_anim") 
  59. 	 
  60. 	local right_graph_bar_h = vint_object_find("right_graph_bar") 
  61. 	local right_line_cap_h = vint_object_find("right_line_cap_anchor_twn") 
  62. 	local right_line_fill_h = vint_object_find("right_line_fill_scale_twn") 
  63.  
  64. 	local line_grp_h = right_graph_bar_h 
  65. 	local cap_twn_h = right_line_cap_h  
  66. 	local line_twn_h = right_line_fill_h  
  67.  
  68. 	--Figure out stuff for bottom line graph animation... 
  69. 	local total_loops = 8 
  70. 	for i = 0, total_loops do 
  71. 		if i > 0 then 
  72. 			line_grp_h = vint_object_clone(right_graph_bar_h) 
  73. 			cap_twn_h = vint_object_clone(right_line_cap_h) 
  74. 			line_twn_h = vint_object_clone(right_line_fill_h) 
  75. 		end 
  76. 		local x, y = vint_get_property(line_grp_h, "anchor") 
  77. 		y = i * 12 
  78. 		 
  79. 		vint_set_property(line_grp_h, "anchor", x, y) 
  80. 		 
  81. 		local line_h = vint_object_find("right_line_fill", line_grp_h) 
  82. 		local cap_h = vint_object_find("right_line_cap", line_grp_h) 
  83. 	 
  84. 		local rand_time = rand_float(.01,.2) 
  85. 		vint_set_property(cap_twn_h, "start_time", i * (.1 + rand_time)) 
  86. 		 
  87. 		local start_time = i * (.1 + rand_time) 
  88. 		if start_time < .1 then 
  89. 			start_time = .1 
  90. 		end 
  91. 		vint_set_property(line_twn_h, "start_time", start_time) 
  92. 		vint_set_property(line_twn_h, "duration", .1 + rand_time ) 
  93. 		 
  94. 		local max_scale = 25.4 
  95. 		local min_scale = 0.1 
  96. 		local y_scale = 0.625 
  97. 		local min_x = 9 
  98. 		local max_x = 413 
  99. 		 
  100. 		local rand_min = rand_float(.1,1) 
  101. 		local rand_max = rand_float(.1,1) 
  102.  
  103. 		local target_min_scale = min_scale + (max_scale - min_scale) * rand_min 
  104. 		local target_max_scale = min_scale + (max_scale - min_scale) * rand_max 
  105. 		 
  106. 		local target_min_x = min_x + (max_x - min_x) * rand_min 
  107. 		local target_max_x = min_x + (max_x - min_x) * rand_max 
  108. 		 
  109. 		vint_set_property(line_twn_h, "start_value", target_min_scale, y_scale) 
  110. 		vint_set_property(line_twn_h, "end_value", target_max_scale, y_scale) 
  111. 		 
  112. 		vint_set_property(cap_twn_h, "start_value", target_min_x, 0 ) 
  113. 		vint_set_property(cap_twn_h, "end_value", target_max_x, 0 ) 
  114. 		 
  115. 		vint_set_property(cap_twn_h, "duration", 2 + rand_time ) 
  116. 		vint_set_property(line_twn_h, "duration", 2 + rand_time ) 
  117. 		 
  118. 		vint_set_property(cap_twn_h, "target_handle", cap_h) 
  119. 		vint_set_property(line_twn_h, "target_handle", line_h)	 
  120. 		 
  121. 		Right_side_twns[line_twn_h] = {cap_twn_h = cap_twn_h, cap_h = cap_h, line_h = line_h} 
  122. 		vint_set_property(line_twn_h, "end_event", "cte_nemo_chair_right_side_cb")	 
  123. 	end 
  124. 	 
  125. 	--Play Right line graph animation..	 
  126. 	lua_play_anim(anim_h) 
  127. 	 
  128. 	local Cte_nemo_chair_update_thread_handle = thread_new("cte_nemo_chair_update_txt") 
  129. 		 
  130. end 
  131.  
  132. function cte_nemo_chair_16in_play() 
  133. 	 vint_set_property(Screen_grp_h, "visible", true) 
  134. 	 lua_play_anim(Screen_in_anim_h) 
  135. end 
  136.  
  137. function cte_nemo_chair_16in_show() 
  138. 	 vint_set_property(Screen_grp_h, "visible", true) 
  139. end 
  140.  
  141. function cte_nemo_chair_16in_hide() 
  142. 	 vint_set_property(Screen_grp_h, "visible", false) 
  143. end 
  144.  
  145. function cte_nemo_chair_cleanup() 
  146. 	if Cte_nemo_chair_update_thread_handle ~= -1 then 
  147. 		thread_kill(Cte_nemo_chair_update_thread_handle) 
  148. 	end 
  149. end 
  150.  
  151. function cte_nemo_chair_right_side_cb(tween_h) 
  152. 		local line_twn_h = tween_h 
  153. 		local	cap_twn_h = Right_side_twns[tween_h].cap_twn_h 
  154. 		local	cap_h = Right_side_twns[tween_h].cap_h 
  155. 		local	line_h = Right_side_twns[tween_h].line_h 
  156. 	 
  157. 		local max_scale = 25.4 
  158. 		local min_scale = 0.1 
  159. 		local y_scale = 0.625 
  160. 		local min_x = 9 
  161. 		local max_x = 413 
  162. 		 
  163. 		local rand_min = rand_float(.1,1) 
  164. 		local rand_max = rand_float(.1,1) 
  165. 		local target_max_scale = min_scale + (max_scale - min_scale) * rand_max 
  166. 		local target_max_x = min_x + (max_x - min_x) * rand_max 
  167. 		 
  168. 		local start_scale_x, start_scale_y = vint_get_property(line_h, "scale") 
  169. 		local start_x, start_y = vint_get_property(cap_h, "anchor") 
  170. 		 
  171. 		local should_i_wait = rand_int(1,3) 
  172. 		if should_i_wait == 1 then 
  173. 			target_max_scale = start_scale_x 
  174. 			target_max_x = start_x 
  175. 		end 
  176. 		 
  177. 		vint_set_property(line_twn_h, "start_value", 	start_scale_x, 	y_scale) 
  178. 		vint_set_property(line_twn_h, "end_value",		target_max_scale, y_scale) 
  179. 		 
  180. 		vint_set_property(cap_twn_h, "start_value", 	start_x, 		0) 
  181. 		vint_set_property(cap_twn_h, "end_value",		target_max_x, 	0) 
  182. 		 
  183. 		local rand_time = rand_float(1.01,2.2) 
  184. 		vint_set_property(cap_twn_h, "duration", 		rand_time) 
  185. 		vint_set_property(line_twn_h, "duration", 	rand_time) 
  186. 		 
  187. 		 
  188. 		--algorithm... 
  189. 		local algorithms = {"ease_in_out_quad", "ease_in_out_exp"} 
  190. 		local algorithm = algorithms[rand_int(1, #algorithms-1)] 
  191. 		 
  192. 		vint_set_property(cap_twn_h, "algorithm", 	algorithm) 
  193. 		vint_set_property(line_twn_h, "algorithm",	algorithm) 
  194. 		 
  195. 		local time_index = vint_get_time_index(0) 
  196.  
  197. 		vint_set_property(cap_twn_h, "start_time", time_index) 
  198. 		vint_set_property(line_twn_h, "start_time", time_index) 
  199. end 
  200.  
  201. function cte_nemo_chair_update_txt() 
  202.  
  203. 	-- Left side text elements... 
  204. 	local core_temp_txt_h = vint_object_find("core_temp_txt") 
  205. 	local initialized_txt_h = vint_object_find("initialized_txt") 
  206. 	local processes_txt_h = vint_object_find("processes_txt") 
  207. 	local processing_txt_h = vint_object_find("processing_txt") 
  208. 	 
  209. 	-- Right side text elements... 
  210. 	local speed_txt_h = vint_object_find("speed_txt") 
  211. 	local core_anal_1_txt_h = vint_object_find("core_anal_1_txt") 
  212. 	local core_anal_2_txt_h = vint_object_find("core_anal_2_txt") 
  213. 	 
  214. 	-- SYSTEM STATUS... 
  215. 	local initialized_txt = "SYSTEM STATUS\nREADY"  
  216. 	vint_set_property(initialized_txt_h, "text_tag", initialized_txt) 
  217. 	 
  218. 	-- Set CPU PCT... 
  219. 	local cpu_pct = rand_float(.1,1)			 
  220. 			 
  221. 	-- List of file names... 
  222. 	local process_list = { 
  223. 		"AEVEMENTS.XTBL", 
  224. 		"AON_NODES.XTBL", 
  225. 		"AON_NODE_NPCS.XTBL", 
  226. 		"A_ACTIONS.XTBL", 
  227. 		"A_AUTO.XTBL", 
  228. 		"A_AUTO_APC.XTBL", 
  229. 		"A_AUTO_MONSTER.XTBL", 
  230. 		"A_BIPLANE.XTBL", 
  231. 		"A_BLEND_TREES.XTBL", 
  232. 		"A_BOATS.XTBL", 
  233. 		"A_BOATS_CRAFT.XTBL", 
  234. 		"A_BOATS_SPED1.XTBL", 
  235. 		"A_BROTHERHOOD.XTBL", 
  236. 		"A_ENVIRONMENT.XTBL", 
  237. 		"A_FACE.XTBL", 
  238. 		"A_FILES.XTBL", 
  239. 		"A_FILES_FLAGS.XTBL", 
  240. 		"A_FLINCHES.XTBL", 
  241. 		"A_HELI.XTBL", 
  242. 		"A_HELIFIGHTER.XTBL", 
  243. 		"A_IK_LOCATION.XTBL", 
  244. 		"A_IK_SITUATION.XTBL", 
  245. 		"A_JET.XTBL", 
  246. 		"A_MOTO.XTBL", 
  247. 		"A_MOTO_ATV.XTBL", 
  248. 		"A_MOTO_CRUISER.XTBL", 
  249. 		"A_MOTO_DIRT.XTBL", 
  250. 		"A_MOTO_MOPED.XTBL", 
  251. 		"A_MOTO_ROCKET.XTBL", 
  252. 		"A_PLANES.XTBL", 
  253. 		"A_PLANE_STANDARD.XTBL", 
  254. 		"A_POLICE_4D.XTBL", 
  255. 		"A_PROP_SETS.XTBL", 
  256. 		"A_REACTIONS.XTBL", 
  257. 		"A_SET_FILENAMES.XTBL", 
  258. 		"A_SET_PROPERTIES.XTBL", 
  259. 		"A_STATES.XTBL", 
  260. 		"A_SYNCED.XTBL", 
  261. 		"A_TAGS.XML", 
  262. 		"A_TRANSITIONS.XTBL", 
  263. 		"A_TRIGGERS.XTBL", 
  264. 		"A_VEHICLES.XTBL", 
  265. 		"AO_CONSTANTS.XTBL", 
  266. 		"AO_EVENTS.XTBL", 
  267. 		"AO_LINE_TAGS.XTBL", 
  268. 		"AO_MARKERS.XTBL", 
  269. 		"AO_PERSONAS.XTBL", 
  270. 		"AO_SETTINGS.XTBL", 
  271. 		"AO_SYNCS.XTBL", 
  272. 		"BAP_MATERIALS.XTBL", 
  273. 		"BES.XTBL", 
  274. 		"BE.XTBL", 
  275. 		"BE_BRUISER.XTBL", 
  276. 		"BE_ZOMBIE.XTBL", 
  277. 		"CRA_FREE.XTBL", 
  278. 		"CRA_SHAKE.XTBL", 
  279. 		"CORAMP.XTBL", 
  280. 		"CDEALERSHIPS.XTBL", 
  281. 		"C_PHONE.XTBL", 
  282. 		"CACTER.XTBL", 
  283. 		"CTS.XTBL", 
  284. 		"CLIFE.XTBL", 
  285. 		"CSWT1.XTBL", 
  286. 		"CERCIALS.XTBL", 
  287. 		"MC_STORE.XTBL", 
  288. 		"NRIETY.XTBL", 
  289. 		"NRIETY_LEVELS.XTBL", 
  290. 		"NRIETY_SPAWN.XTBL", 
  291. 		"NCOLOR_PALETTE.XTBL", 
  292. 		"PCHUTE.XTBL", 
  293. 		"P.XTBL", 
  294. 		"P_LIFE.XTBL", 
  295. 		"PE_TABLE.XTBL", 
  296. 		"P.XTBL", 
  297. 		"P.XTBL", 
  298. 		"P_ZOMBIE.XTBL", 
  299. 		"PSTREAKER.XTBL", 
  300. 		"PON_YACHT.XTBL", 
  301. 		"RO_ACTIVITIES.XTBL", 
  302. 		"RO_EVENTS.XTBL", 
  303. 		"S_NAMES.XTBL", 
  304. 		"S_COLOR_POOL.XTBL", 
  305. 		"SOX_EFFECTS.XTBL", 
  306. 		"SEDOOR.XTBL", 
  307. 		"SE_WEAPONS.XTBL", 
  308. 		"SFE_ANGLES.XTBL", 
  309. 		"S_ROPE.XTBL", 
  310. 		"TOO_COLOR_POOL.XTBL", 
  311. 		"TS.XTBL", 
  312. 		"TR.XTBL", 
  313. 		"T_OF_DAY.XTBL", 
  314. 		"T_OF_DAY_OBJECTS.XTBL", 
  315. 		"TFIC_LANES.XTBL", 
  316. 		"TFIC_TYPES.XTBL", 
  317. 		"TGERS.XTBL", 
  318. 		"TK_TABLE.XTBL", 
  319. 		"UCKABLES.XTBL", 
  320. 		"U_INTERFACE.XTBL", 
  321. 		"VCLES.XTBL", 
  322. 		"VBLACKHAWK.XTBL", 
  323. 		"VHELI_MAD03.XTBL", 
  324. 		"VPONY.XTBL", 
  325. 		"VRIOT.XTBL", 
  326. 		"VTANK.XTBL", 
  327. 		"VVTOL.XTBL", 
  328. 		"VVTOL2.XTBL", 
  329. 		"VGAT_LS.XTBL", 
  330. 		"VJOSH_LS.XTBL", 
  331. 		"VKIA_LS.XTBL", 
  332. 		"VKILLBANE_LS.XTBL", 
  333. 		"VKINZIE_LS.XTBL", 
  334. 		"VMATT_LS.XTBL", 
  335. 		"01_LS.XTBL", 
  336. 		"02_LS.XTBL", 
  337. 		"03_LS.XTBL", 
  338. 		"VOLEG_LS.XTBL", 
  339. 		"VPHILLIPE_LS.XTBL", 
  340. 		"VPIERCE_LS.XTBL", 
  341. 		"VPLAYER_BF_LS.XTBL", 
  342. 		"VPLAYER_BM_LS.XTBL", 
  343. 		"VPLAYER_HF_LS.XTBL", 
  344. 		"VPLAYER_HM_LS.XTBL", 
  345. 		"VPLAYER_WFA_LS.XTBL", 
  346. 		"VPLAYER_WF_LS.XTBL", 
  347. 		"VPLAYER_WMA_LS.XTBL", 
  348. 		"VPLAYER_WM_LS.XTBL", 
  349. 		"VPLAYER_Z_LS.XTBL",		 
  350. 	} 
  351. 	 
  352. 	local current_frame = 0  
  353. 	while true do 
  354. 		--Update stuff only every some amount of items... fill in with random shit... 
  355. 		if current_frame % 20 == 0 then 
  356. 			local core_temp = rand_float(90,100) 
  357. 			core_temp = (floor(core_temp * 100)) * .01 + 1 
  358. 			local core_tmp_txt = "CORE TEMP\n" .. core_temp 
  359. 			vint_set_property(core_temp_txt_h, "text_tag", core_tmp_txt) 
  360. 		end 
  361.  
  362. 		if current_frame % 4 == 0 then 
  363. 			local processing_txt = "PROCESSING...\n" ..  process_list[rand_int(1, #process_list - 1)] 
  364. 			vint_set_property(processing_txt_h, "text_tag", processing_txt) 
  365. 		end 
  366. 		 
  367. 		if current_frame % 27 == 0 then 
  368. 			local process_count = rand_int(89, 120) 
  369. 			local processes_txt = "PROCESSES\n" .. process_count 
  370. 			vint_set_property(processes_txt_h, "text_tag", processes_txt) 
  371. 		end 
  372. 	 
  373. 		if current_frame % 27 == 0 then 
  374. 			local cpu_pct = rand_float(.1,1)	 
  375. 			local text = 12 * cpu_pct 
  376. 			local text = floor(text*1000) * .001 
  377. 			vint_set_property(speed_txt_h, "text_tag", text) 
  378. 		end 
  379. 		 
  380. 		if current_frame % 10 == 0 then 
  381. 			local right_large_fill_h = vint_object_find("right_large_fill") 
  382. 			local right_large_cap_h = vint_object_find("right_large_cap") 
  383. 			 
  384. 			local width, height = element_get_actual_size(right_large_fill_h) 
  385. 			local x, y = vint_get_property(right_large_cap_h, "anchor") 
  386. 			width = rand_int(20, 380 * cpu_pct) -- floor(current_frame*.1) 
  387. 			element_set_actual_size(right_large_fill_h, width, height) 
  388. 			vint_set_property(right_large_cap_h, "anchor", width+7, y) 
  389. 			 
  390. 			local width, height =element_get_actual_size(right_large_cap_h) 
  391. 			width = rand_int(2, max(3,floor(current_frame*.1))) 
  392. 			element_set_actual_size(right_large_cap_h, width, height) 
  393. 		end 
  394. 		 
  395. 		if current_frame % 30 == 0 then 
  396. 			local text = rand_int(0, 99) 
  397. 			vint_set_property(core_anal_1_txt_h, "text_tag", text) 
  398. 		end 
  399. 		 
  400. 		if current_frame % 60 == 0 then 
  401. 			local text = rand_int(0, 325) 
  402. 			vint_set_property(core_anal_2_txt_h, "text_tag", text) 
  403. 		end 
  404. 		 
  405. 		current_frame = current_frame + 1 
  406. 		if current_frame == 1000 then 
  407. 			current_frame = 0 
  408. 		end 
  409. 		thread_yield() 
  410. 	end 
  411. 	 
  412. end 
  413.  
  414.