Guest User

Untitled

a guest
Feb 2nd, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.82 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. // Updated 9/08/2016 by omegaman
  3. // Attract-Mode "Robospin" layout. Thanks to verion for cleaning cab skins and to malfacine's for glogos
  4. // Notes: Lots of changes...
  5. // When game marquee is turned off, console marquees will be turned on.
  6. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7.  
  8. class UserConfig {
  9. </ label="Select BG art", help="Blur enables art for all consoles; otherwise choose blue, retro, black or flyer for bg", options="blur,blue,retro,black,flyer", order=1 /> enable_bg="blur";
  10. </ label="Select cab skin", help="Select a cab skin image", options="robo,moon", order=2 /> enable_cab="robo";
  11. </ label="Select spinwheel art", help="The artwork to spin", options="marquee, wheel", order=3 /> orbit_art="wheel";
  12. </ label="Transition Time", help="Time in milliseconds for wheel spin.", order=4 /> transition_ms="35";
  13. </ label="Select listbox, wheel, vert_wheel", help="Select wheel type or listbox", options="listbox, wheel, vert_wheel", order=5 /> enable_list_type="wheel";
  14. </ label="Enable snap bloom shader effect", help="Bloom effect uses shader", options="Yes,No", order=6 /> enable_bloom="No";
  15. </ label="Enable crt shader effect", help="CRT effect uses shader", options="Yes,No", order=7 /> enable_crt="No";
  16. </ label="Enable random text colors", help=" Select random text colors.", options="yes,no", order=8 /> enable_colors="yes";
  17. </ label="Enable system logos", help="Select system logos", options="Yes,No", order=9 /> enable_slogos="Yes";
  18. </ label="Enable MFR game logos", help="Select game logos", options="Yes,No", order=10 /> enable_mlogos="Yes";
  19. </ label="Enable game marquees", help="Show game marquees", options="Yes,No", order=11 /> enable_marquee="Yes";
  20. </ label="Enable lighted marquee effect", help="show lighted Marquee", options="Yes,No", order=12 /> enable_Lmarquee="No";
  21. </ label="Select pointer", help="Select animated pointer", options="rocket,hand,none", order=13 /> enable_pointer="rocket";
  22. </ label="Enable text frame", help="Show text frame", options="yes,no", order=14 /> enable_frame="yes";
  23. </ label="Enble background overlay", help="Select overlay effect; options are masking, scanlines, aperture", options="mask,scanlines,aperture,none", order=15 /> enable_overlay="mask";
  24. </ label="Monitor static effect", help="Show static effect when snap is null", options="yes,no", order=16 /> enable_static="yes";
  25. }
  26.  
  27. local my_config = fe.get_config();
  28. local flx = fe.layout.width=640;
  29. local fly = fe.layout.height=480;
  30. local flw = fe.layout.width;
  31. local flh = fe.layout.height;
  32. //fe.layout.font="Roboto";
  33.  
  34. fe.layout.orient=RotateScreen.Right;
  35.  
  36. // modules
  37.  
  38. fe.load_module("fade");
  39. fe.load_module( "animate" );
  40.  
  41. // Background Art
  42. if ( my_config["enable_bg"] == "blur")
  43. {
  44. local b_art = fe.add_image("bg/[Emulator]", 0, 0, flw, flh );
  45. b_art.alpha=255;
  46. }
  47.  
  48. if ( my_config["enable_bg"] == "blue")
  49. {
  50. local b_art = fe.add_image("bg1.png", 0, 0, flw, flh );
  51. b_art.alpha=255;
  52. }
  53.  
  54. if ( my_config["enable_bg"] == "retro")
  55. {
  56. local b_art = fe.add_image("bg2.png", 0, 0, flw, flh );
  57. b_art.alpha=255;
  58. }
  59.  
  60. if ( my_config["enable_bg"] == "black")
  61. {
  62. local b_art = fe.add_image("bg4.png", 0, 0, flw, flh );
  63. b_art.alpha=255;
  64. }
  65.  
  66. if ( my_config["enable_bg"] == "flyer")
  67. {
  68. local surface_flyer = fe.add_surface( 640, 480 );
  69. local b_art = FadeArt( "flyer", 0, 0, 640, 480, surface_flyer );
  70. b_art.trigger = Transition.EndNavigation;
  71. b_art.preserve_aspect_ratio = false;
  72. b_art.alpha=127;
  73.  
  74. //now position and rotate surface for flyer
  75. surface_flyer.set_pos(flx*0.4, 0, flw*0.6, flh);
  76. surface_flyer.rotation = 0;
  77. }
  78.  
  79. //masking effect overlay for bg art
  80.  
  81. if ( my_config["enable_overlay"] == "mask" )
  82. {
  83. local overlay = fe.add_image( "mask.png", 0, 0, flw, flh );
  84. overlay.preserve_aspect_ratio = false;
  85. overlay.alpha = 200;
  86. }
  87.  
  88. if ( my_config["enable_overlay"] == "scanlines" )
  89. {
  90. local overlay = fe.add_image( "scanlines.png", 0, 0, flw, flh );
  91. overlay.preserve_aspect_ratio = false;
  92. overlay.alpha = 200;
  93. }
  94.  
  95. if ( my_config["enable_overlay"] == "aperture" )
  96. {
  97. local overlay = fe.add_image( "aperture.png", 0, 0, flw, flh );
  98. overlay.preserve_aspect_ratio = false;
  99. overlay.alpha = 200;
  100. }
  101.  
  102. if ( my_config["enable_overlay"] == "none" )
  103. {
  104. local overlay = fe.add_image( "none.png", 0, 0, 0, 0 );
  105. overlay.preserve_aspect_ratio = false;
  106. overlay.alpha = 0;
  107. }
  108.  
  109. if ( my_config["enable_static"] == "yes" )
  110. {
  111. const SNAPBG_ALPHA = 200;
  112. local snapbg=null;
  113. snapbg = fe.add_image( "static.mp4", flx*0.162, fly*0.19, flw*0.665, flh*0.662 );
  114. snapbg.trigger = Transition.EndNavigation;
  115. snapbg.skew_y = -fly*0.000;
  116. snapbg.skew_x = flx*0.000;
  117. snapbg.pinch_y = 0;
  118. snapbg.pinch_x = 0;
  119. snapbg.rotation = 0;
  120. snapbg.set_rgb( 155, 155, 155 );
  121. snapbg.alpha = SNAPBG_ALPHA;
  122. }
  123. else
  124. {
  125. local temp = fe.add_text("", flx*0.162, fly*0.08, flw*0.565, flh*0.667 );
  126. temp.bg_alpha = SNAPBG_ALPHA;
  127. }
  128.  
  129. //create surface for snap
  130. local surface_snap = fe.add_surface( 640, 480 );
  131. local snap = FadeArt("snap", 0, 0, 640, 480, surface_snap);
  132. snap.trigger = Transition.EndNavigation;
  133. snap.preserve_aspect_ratio = false;
  134.  
  135. //now position and pinch surface of snap
  136. surface_snap.set_pos(flx*0.162, fly*0.19, flw*0.670, flh*0.667);
  137. surface_snap.skew_y = fly*0.0;
  138. surface_snap.skew_x = flx*0.0;
  139. surface_snap.pinch_y = 0.1;
  140. surface_snap.pinch_x = 0;
  141. surface_snap.rotation = 0;
  142.  
  143. // add shader support because I can
  144. if ( my_config["enable_bloom"] == "Yes" )
  145. {
  146. local sh = fe.add_shader( Shader.Fragment, "bloom_shader.frag" );
  147. sh.set_texture_param("bgl_RenderedTexture");
  148. surface_snap.shader = sh;
  149. }
  150.  
  151. if ( my_config["enable_crt"] == "Yes" )
  152. {
  153. local sh = fe.add_shader( Shader.VertexAndFragment, "crt.vert", "crt.frag" );
  154. sh.set_param( "rubyInputSize", 640, 480 );
  155. sh.set_param( "rubyOutputSize", ScreenWidth, ScreenHeight );
  156. sh.set_param( "rubyTextureSize", 640, 480 );
  157. sh.set_texture_param("rubyTexture");
  158. surface_snap.shader = sh;
  159. }
  160.  
  161. if ( my_config["enable_marquee"] == "Yes" )
  162. {
  163. local marquee = fe.add_artwork("marquee", flx*0.117, fly*0.086, flw*0.35, flh*0.14 );
  164. marquee.trigger = Transition.EndNavigation;
  165. marquee.skew_x = 11;
  166. marquee.pinch_x = -2;
  167. marquee.pinch_y = 3;
  168. marquee.rotation = -1.5;
  169. if ( my_config["enable_Lmarquee"] == "Yes" )
  170. {
  171. local shader = fe.add_shader( Shader.Fragment "bloom_shader.frag" );
  172. shader.set_texture_param("bgl_RenderedTexture");
  173. marquee.shader = shader;
  174. }
  175.  
  176. }
  177. else
  178. {
  179. local clogos = fe.add_image("clogos/[Emulator]", flx*0.117, fly*0.086, flw*0.35, flh*0.14 );
  180. clogos.trigger = Transition.EndNavigation;
  181. clogos.skew_x = 11;
  182. clogos.pinch_x = -2;
  183. clogos.pinch_y = 3;
  184. clogos.rotation = -1.5;
  185. }
  186.  
  187. //cabinet image
  188. if ( my_config["enable_cab"] == "robo" )
  189. {
  190. local cab = fe.add_image( "robo.png", 0, 0, flw, flh );
  191. }
  192.  
  193. if ( my_config["enable_cab"] == "moon" )
  194. {
  195. local cab = fe.add_image( "moon.png", 0, 0, flw, flh );
  196. }
  197.  
  198. //add frame to make text standout
  199. if ( my_config["enable_frame"] == "yes" )
  200. {
  201. local frame = fe.add_image( "frame.png", 0, fly*0.945, flw, flh*0.3 );
  202. frame.alpha = 255;
  203. }
  204.  
  205.  
  206. //Game text info
  207. local textt = fe.add_text( "[Title] - [Year] - [Manufacturer]", flx*0.05, fly*0.949, flw*0.6, flh*0.04 );
  208. textt.set_rgb( 211, 211, 211 );
  209. textt.style = Style.Bold;
  210. //textt.align = Align.Left;
  211. textt.rotation = 0;
  212. textt.word_wrap = true;
  213.  
  214. //Display filter info
  215. local filter = fe.add_text( "[ListFilterName]: [ListEntry]-[ListSize]", flx*0.06, fly*0.890, flw*0.25, flh*0.04 );
  216. filter.set_rgb( 80, 80, 80 );
  217. filter.style = Style.Bold;
  218. //filter.align = Align.Left;
  219. filter.rotation = 0;
  220.  
  221.  
  222. //Listbox
  223. if ( my_config["enable_list_type"] == "listbox" )
  224. {
  225. local listbox = fe.add_listbox( flx*0.53, fly*0.09, flw*0.95, flh*0.86 );
  226. listbox.rows = 39;
  227. listbox.charsize = 24;
  228. listbox.set_rgb( 211, 211, 211 );
  229. listbox.bg_alpha = 0;
  230. //listbox.align = Align.Right;
  231. listbox.selbg_alpha = 90;
  232. listbox.sel_red = 255;
  233. listbox.sel_green = 255;
  234. listbox.sel_blue = 0;
  235. }
  236.  
  237. //This enables vertical art instead of default wheel
  238. if ( my_config["enable_list_type"] == "vert_wheel" )
  239. {
  240. fe.load_module( "conveyor" );
  241. local wheel_x = [ flx*0.71, flx*0.71, flx*0.71, flx*0.71, flx*0.71, flx*0.71, flx*0.68, flx*0.71, flx*0.71, flx*0.71, flx*0.71, flx*0.71, ];
  242. local wheel_y = [ -fly*0.22, -fly*0.105, fly*0.0, fly*0.105, fly*0.215, fly*0.325, fly*0.436, fly*0.61, fly*0.72 fly*0.83, fly*0.935, fly*0.99, ];
  243. local wheel_w = [ flw*0.18, flw*0.18, flw*0.18, flw*0.18, flw*0.18, flw*0.18, flw*0.24, flw*0.18, flw*0.18, flw*0.18, flw*0.18, flw*0.18, ];
  244. local wheel_a = [ 80, 80, 80, 80, 80, 80, 255, 80, 80, 80, 80, 80, ];
  245. local wheel_h = [ flh*0.11, flh*0.11, flh*0.11, flh*0.11, flh*0.11, flh*0.11, flh*0.168, flh*0.11, flh*0.11, flh*0.11, flh*0.11, flh*0.11, ];
  246. local wheel_r = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ];
  247. local num_arts = 6;
  248.  
  249. class WheelEntry extends ConveyorSlot
  250. {
  251. constructor()
  252. {
  253. base.constructor( ::fe.add_artwork( my_config["orbit_art"] ) );
  254. }
  255.  
  256. function on_progress( progress, var )
  257. {
  258. local p = progress / 0.1;
  259. local slot = p.tointeger();
  260. p -= slot;
  261.  
  262. slot++;
  263.  
  264. if ( slot < 0 ) slot=0;
  265. if ( slot >=10 ) slot=10;
  266.  
  267. m_obj.x = wheel_x[slot] + p * ( wheel_x[slot+1] - wheel_x[slot] );
  268. m_obj.y = wheel_y[slot] + p * ( wheel_y[slot+1] - wheel_y[slot] );
  269. m_obj.width = wheel_w[slot] + p * ( wheel_w[slot+1] - wheel_w[slot] );
  270. m_obj.height = wheel_h[slot] + p * ( wheel_h[slot+1] - wheel_h[slot] );
  271. m_obj.rotation = wheel_r[slot] + p * ( wheel_r[slot+1] - wheel_r[slot] );
  272. m_obj.alpha = wheel_a[slot] + p * ( wheel_a[slot+1] - wheel_a[slot] );
  273. }
  274. };
  275.  
  276. local wheel_entries = [];
  277. for ( local i=0; i<num_arts/2; i++ )
  278. wheel_entries.push( WheelEntry() );
  279.  
  280. local remaining = num_arts - wheel_entries.len();
  281.  
  282. // we do it this way so that the last wheelentry created is the middle one showing the current
  283. // selection (putting it at the top of the draw order)
  284. for ( local i=0; i<remaining; i++ )
  285. wheel_entries.insert( num_arts/2, WheelEntry() );
  286.  
  287. local conveyor = Conveyor();
  288. conveyor.set_slots( wheel_entries );
  289. conveyor.transition_ms = 50;
  290. try { conveyor.transition_ms = my_config["transition_ms"].tointeger(); } catch ( e ) { }
  291. }
  292.  
  293. if ( my_config["enable_list_type"] == "wheel" )
  294. {
  295. fe.load_module( "conveyor" );
  296. local wheel_x = [ flx*0.77, flx*0.715, flx*0.676, flx*0.605, flx*0.54, flx*0.50, flx*0.44, flx*0.50, flx*0.58, flx*0.645, flx*0.706, flx*0.77, ];
  297. local wheel_y = [ -fly*0.22, -fly*0.105, fly*0.0, fly*0.105, fly*0.215, fly*0.325, fly*0.436, fly*0.61, fly*0.72 fly*0.83, fly*0.935, fly*0.99, ];
  298. local wheel_w = [ flw*0.38, flw*0.38, flw*0.38, flw*0.38, flw*0.38, flw*0.38, flw*0.44, flw*0.38, flw*0.38, flw*0.38, flw*0.38, flw*0.38, ];
  299. local wheel_a = [ 80, 80, 80, 80, 80, 80, 255, 80, 80, 80, 80, 80, ];
  300. local wheel_h = [ flh*0.05, flh*0.05, flh*0.05, flh*0.05, flh*0.05, flh*0.05, flh*0.11, flh*0.05, flh*0.05, flh*0.05, flh*0.05, flh*0.05, ];
  301. local wheel_r = [ 20, 16, 12, 7, 5, 3, 0, -5, -7, -12, -16, -20, ];
  302. local num_arts = 6;
  303.  
  304. class WheelEntry extends ConveyorSlot
  305. {
  306. constructor()
  307. {
  308. base.constructor( ::fe.add_artwork( my_config["orbit_art"] ) );
  309. }
  310.  
  311. function on_progress( progress, var )
  312. {
  313. local p = progress / 0.1;
  314. local slot = p.tointeger();
  315. p -= slot;
  316.  
  317. slot++;
  318.  
  319. if ( slot < 0 ) slot=0;
  320. if ( slot >=10 ) slot=10;
  321.  
  322. m_obj.x = wheel_x[slot] + p * ( wheel_x[slot+1] - wheel_x[slot] );
  323. m_obj.y = wheel_y[slot] + p * ( wheel_y[slot+1] - wheel_y[slot] );
  324. m_obj.width = wheel_w[slot] + p * ( wheel_w[slot+1] - wheel_w[slot] );
  325. m_obj.height = wheel_h[slot] + p * ( wheel_h[slot+1] - wheel_h[slot] );
  326. m_obj.rotation = wheel_r[slot] + p * ( wheel_r[slot+1] - wheel_r[slot] );
  327. m_obj.alpha = wheel_a[slot] + p * ( wheel_a[slot+1] - wheel_a[slot] );
  328. }
  329. };
  330.  
  331. local wheel_entries = [];
  332. for ( local i=0; i<num_arts/2; i++ )
  333. wheel_entries.push( WheelEntry() );
  334.  
  335. local remaining = num_arts - wheel_entries.len();
  336.  
  337. // we do it this way so that the last wheelentry created is the middle one showing the current
  338. // selection (putting it at the top of the draw order)
  339. for ( local i=0; i<remaining; i++ )
  340. wheel_entries.insert( num_arts/2, WheelEntry() );
  341.  
  342. local conveyor = Conveyor();
  343. conveyor.set_slots( wheel_entries );
  344. conveyor.transition_ms = 50;
  345. try { conveyor.transition_ms = my_config["transition_ms"].tointeger(); } catch ( e ) { }
  346. }
  347.  
  348. //property animation - wheel pointers
  349. if ( my_config["enable_pointer"] == "rocket")
  350. {
  351. local point = fe.add_image("pointers/pointer.png", flx*0.88, fly*0.32, flw*0.2, flh*0.35);
  352.  
  353. local alpha_cfg = {
  354. when = Transition.ToNewSelection,
  355. property = "alpha",
  356. start = 110,
  357. end = 255,
  358. time = 300
  359. }
  360. animation.add( PropertyAnimation( point, alpha_cfg ) );
  361.  
  362. local movey_cfg = {
  363. when = Transition.ToNewSelection,
  364. property = "y",
  365. start = point.y,
  366. end = point.y,
  367. time = 200
  368. }
  369. animation.add( PropertyAnimation( point, movey_cfg ) );
  370.  
  371. local movex_cfg = {
  372. when = Transition.ToNewSelection,
  373. property = "x",
  374. start = flx*0.83,
  375. end = point.x,
  376. time = 200
  377. }
  378. animation.add( PropertyAnimation( point, movex_cfg ) );
  379. }
  380.  
  381. if ( my_config["enable_pointer"] == "hand")
  382.  
  383. {
  384. local point = fe.add_image("pointers/pointer2.png", flx*0.88, fly*0.34, flw*0.2, flh*0.35);
  385. local alpha_cfg = {
  386. when = Transition.ToNewSelection,
  387. property = "alpha",
  388. start = 110,
  389. end = 255,
  390. time = 300
  391. }
  392. animation.add( PropertyAnimation( point, alpha_cfg ) );
  393.  
  394. local movey_cfg = {
  395. when = Transition.ToNewSelection,
  396. property = "y",
  397. start = point.y,
  398. end = point.y,
  399. time = 200
  400. }
  401. animation.add( PropertyAnimation( point, movey_cfg ) );
  402.  
  403. local movex_cfg = {
  404. when = Transition.ToNewSelection,
  405. property = "x",
  406. start = flx*0.83,
  407. end = point.x,
  408. time = 200
  409. }
  410. animation.add( PropertyAnimation( point, movex_cfg ) );
  411. }
  412.  
  413. if ( my_config["enable_pointer"] == "none")
  414. {
  415. local point = fe.add_image( "", 0, 0, 0, 0 );
  416. }
  417.  
  418. // random number for the RGB levels
  419. if ( my_config["enable_colors"] == "yes" )
  420. {
  421. function brightrand() {
  422. return 255-(rand()/255);
  423. }
  424.  
  425. local red = brightrand();
  426. local green = brightrand();
  427. local blue = brightrand();
  428.  
  429. // Color Transitions
  430. fe.add_transition_callback( "color_transitions" );
  431. function color_transitions( ttype, var, ttime ) {
  432. switch ( ttype )
  433. {
  434. case Transition.StartLayout:
  435. case Transition.ToNewSelection:
  436. red = brightrand();
  437. green = brightrand();
  438. blue = brightrand();
  439. //listbox.set_rgb(red,green,blue);
  440. texty.set_rgb (red,green,blue);
  441. textt.set_rgb (red,green,blue);
  442. break;
  443. }
  444. return false;
  445. }
  446. }
  447.  
Add Comment
Please, Sign In to add comment