-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarioworld.sttf
1 lines (1 loc) · 60.7 KB
/
marioworld.sttf
1
{"links":[{"end":"RenderOutput","filter":"Linear","slot":0,"start":"Image","wrapMode":"Repeat"}],"metadata":{"Author":"knarkowicz","Description":"NES Super Mario Bros. World 1-1. My favorite game moment (just like for most kids in the early 90s). 20 years later implemented in a single shader.","Name":"[SIG15] Mario World 1-1","ShaderToyURL":"https://www.shadertoy.com/view/XtlSD7"},"nodes":[{"class":"RenderOutput","name":"RenderOutput"},{"class":"GLSLShader","name":"Image","source":"// Interesting findings from original NES Super Mario Bros.:\n// -Clouds and brushes of all sizes are drawn using the same small sprite (32x24)\n// -Hills, clouds and bushes weren't placed manually. Every background object type is repeated after 768 pixels.\n// -Overworld (main theme) drum sound uses only the APU noise generator\n\n#define SPRITE_DEC( x, i ) \tmod( floor( i / pow( 4.0, mod( x, 8.0 ) ) ), 4.0 )\n#define SPRITE_DEC2( x, i ) mod( floor( i / pow( 4.0, mod( x, 11.0 ) ) ), 4.0 )\n#define RGB( r, g, b ) vec3( float( r ) / 255.0, float( g ) / 255.0, float( b ) / 255.0 )\n\nconst float MARIO_SPEED\t = 89.0;\nconst float GOOMBA_SPEED = 32.0;\nconst float INTRO_LENGTH = 2.0;\n\nvoid SpriteBlock( inout vec3 color, float x, float y )\n{\n // black\n float idx = 1.0;\n \n // light orange\n idx = x < y ? 3.0 : idx;\n \n // dark orange\n idx = x > 3.0 && x < 12.0 && y > 3.0 && y < 12.0 ? 2.0 : idx;\n idx = x == 15.0 - y ? 2.0 : idx;\n \n color = RGB( 0, 0, 0 );\n\tcolor = idx == 2.0 ? RGB( 231, 90, 16 ) : color;\n\tcolor = idx == 3.0 ? RGB( 247, 214, 181 ) : color;\n}\n\nvoid SpriteHill( inout vec3 color, float x, float y )\n{\n float idx = 0.0;\n \n // dark green\n idx = ( x > y && 79.0 - x > y ) && y < 33.0 ? 2.0 : idx;\n idx = ( x >= 37.0 && x <= 42.0 ) && y == 33.0 ? 2.0 : idx;\n \n // black\n idx = ( x == y || 79.0 - x == y ) && y < 33.0 ? 1.0 : idx;\n idx = ( x == 33.0 || x == 46.0 ) && y == 32.0 ? 1.0 : idx;\n idx = ( x >= 34.0 && x <= 36.0 ) && y == 33.0 ? 1.0 : idx;\n idx = ( x >= 43.0 && x <= 45.0 ) && y == 33.0 ? 1.0 : idx;\n idx = ( x >= 37.0 && x <= 42.0 ) && y == 34.0 ? 1.0 : idx;\n idx = ( x >= 25.0 && x <= 26.0 ) && ( y >= 8.0 && y <= 11.0 ) ? 1.0 : idx;\n idx = ( x >= 41.0 && x <= 42.0 ) && ( y >= 24.0 && y <= 27.0 ) ? 1.0 : idx;\n idx = ( x >= 49.0 && x <= 50.0 ) && ( y >= 8.0 && y <= 11.0 ) ? 1.0 : idx;\n idx = ( x >= 28.0 && x <= 30.0 ) && ( y >= 11.0 && y <= 14.0 ) ? 1.0 : idx;\n idx = ( x >= 28.0 && x <= 30.0 ) && ( y >= 11.0 && y <= 14.0 ) ? 1.0 : idx;\n idx = ( x >= 44.0 && x <= 46.0 ) && ( y >= 27.0 && y <= 30.0 ) ? 1.0 : idx;\n idx = ( x >= 44.0 && x <= 46.0 ) && ( y >= 27.0 && y <= 30.0 ) ? 1.0 : idx;\n idx = ( x >= 52.0 && x <= 54.0 ) && ( y >= 11.0 && y <= 14.0 ) ? 1.0 : idx;\n idx = ( x == 29.0 || x == 53.0 ) && ( y >= 10.0 && y <= 15.0 ) ? 1.0 : idx;\n idx = x == 45.0 && ( y >= 26.0 && y <= 31.0 ) ? 1.0 : idx;\n \n\tcolor = idx == 1.0 ? RGB( 0, 0, 0 ) : color;\n\tcolor = idx == 2.0 ? RGB( 0, 173, 0 ) : color;\n}\n\nvoid SpritePipe( inout vec3 color, float x, float y, float h )\n{\n float offset = h * 16.0;\n\n // light green\n\tfloat idx = 3.0;\n \n // dark green\n idx = ( ( x > 5.0 && x < 8.0 ) || ( x == 13.0 ) || ( x > 15.0 && x < 23.0 ) ) && y < 17.0 + offset ? 2.0 : idx;\n idx = ( ( x > 4.0 && x < 7.0 ) || ( x == 12.0 ) || ( x > 14.0 && x < 24.0 ) ) && ( y > 17.0 + offset && y < 30.0 + offset ) ? 2.0 : idx; \n idx = ( x < 5.0 || x > 11.0 ) && y == 29.0 + offset ? 2.0 : idx;\n\tidx = fract( x * 0.5 + y * 0.5 ) == 0.5 && x > 22.0 && ( ( x < 26.0 && y < 17.0 + offset ) || ( x < 28.0 && y > 17.0 + offset && y < 30.0 + offset ) ) ? 2.0 : idx; \n \n // black\n idx = y == 31.0 + offset || x == 0.0 || x == 31.0 || y == 17.0 + offset ? 1.0 : idx;\n idx = ( x == 2.0 || x == 29.0 ) && y < 18.0 + offset ? 1.0 : idx;\n idx = ( x > 1.0 && x < 31.0 ) && y == 16.0 + offset ? 1.0 : idx; \n \n // transparent\n idx = ( x < 2.0 || x > 29.0 ) && y < 17.0 + offset ? 0.0 : idx;\n\n\tcolor = idx == 1.0 ? RGB( 0, 0, 0 ) : color;\n\tcolor = idx == 2.0 ? RGB( 0, 173, 0 ) : color;\n\tcolor = idx == 3.0 ? RGB( 189, 255, 24 ) : color;\n}\n\nvoid SpriteCloud( inout vec3 color, float x, float y, float isBush )\n{\n\tfloat idx = 0.0;\n \n\tidx = y == 23.0 ? ( x <= 10.0 ? 0.0 : ( x <= 21.0 ? 5440.0 : 0.0 ) ) : idx;\n\tidx = y == 22.0 ? ( x <= 10.0 ? 0.0 : ( x <= 21.0 ? 32720.0 : 0.0 ) ) : idx;\n\tidx = y == 21.0 ? ( x <= 10.0 ? 0.0 : ( x <= 21.0 ? 131061.0 : 0.0 ) ) : idx;\n\tidx = y == 20.0 ? ( x <= 10.0 ? 1048576.0 : ( x <= 21.0 ? 1179647.0 : 0.0 ) ) : idx;\n\tidx = y == 19.0 ? ( x <= 10.0 ? 1048576.0 : ( x <= 21.0 ? 3670015.0 : 1.0 ) ) : idx;\n\tidx = y == 18.0 ? ( x <= 10.0 ? 1048576.0 : ( x <= 21.0 ? 4190207.0 : 7.0 ) ) : idx;\n\tidx = y == 17.0 ? ( x <= 10.0 ? 3407872.0 : ( x <= 21.0 ? 4177839.0 : 7.0 ) ) : idx;\n\tidx = y == 16.0 ? ( x <= 10.0 ? 3997696.0 : ( x <= 21.0 ? 4194299.0 : 7.0 ) ) : idx;\n\tidx = y == 15.0 ? ( x <= 10.0 ? 4150272.0 : ( x <= 21.0 ? 4194303.0 : 1055.0 ) ) : idx;\n\tidx = y == 14.0 ? ( x <= 10.0 ? 4193536.0 : ( x <= 21.0 ? 4194303.0 : 7455.0 ) ) : idx;\n\tidx = y == 13.0 ? ( x <= 10.0 ? 4194112.0 : ( x <= 21.0 ? 4194303.0 : 8063.0 ) ) : idx;\n\tidx = y == 12.0 ? ( x <= 10.0 ? 4194240.0 : ( x <= 21.0 ? 4194303.0 : 73727.0 ) ) : idx;\n\tidx = y == 11.0 ? ( x <= 10.0 ? 4194260.0 : ( x <= 21.0 ? 4194303.0 : 491519.0 ) ) : idx;\n\tidx = y == 10.0 ? ( x <= 10.0 ? 4194301.0 : ( x <= 21.0 ? 4194303.0 : 524287.0 ) ) : idx;\n\tidx = y == 9.0 ? ( x <= 10.0 ? 4194301.0 : ( x <= 21.0 ? 4194303.0 : 524287.0 ) ) : idx;\n\tidx = y == 8.0 ? ( x <= 10.0 ? 4194292.0 : ( x <= 21.0 ? 4194303.0 : 131071.0 ) ) : idx;\n\tidx = y == 7.0 ? ( x <= 10.0 ? 4193232.0 : ( x <= 21.0 ? 4194303.0 : 32767.0 ) ) : idx;\n\tidx = y == 6.0 ? ( x <= 10.0 ? 3927872.0 : ( x <= 21.0 ? 4193279.0 : 131071.0 ) ) : idx;\n\tidx = y == 5.0 ? ( x <= 10.0 ? 2800896.0 : ( x <= 21.0 ? 4193983.0 : 524287.0 ) ) : idx;\n\tidx = y == 4.0 ? ( x <= 10.0 ? 3144960.0 : ( x <= 21.0 ? 3144362.0 : 262143.0 ) ) : idx;\n\tidx = y == 3.0 ? ( x <= 10.0 ? 4150272.0 : ( x <= 21.0 ? 3845099.0 : 98303.0 ) ) : idx;\n\tidx = y == 2.0 ? ( x <= 10.0 ? 3997696.0 : ( x <= 21.0 ? 4107775.0 : 6111.0 ) ) : idx;\n\tidx = y == 1.0 ? ( x <= 10.0 ? 1310720.0 : ( x <= 21.0 ? 4183167.0 : 325.0 ) ) : idx;\n\tidx = y == 0.0 ? ( x <= 10.0 ? 0.0 : ( x <= 21.0 ? 1392661.0 : 0.0 ) ) : idx;\n\n\tidx = SPRITE_DEC2( x, idx );\n\n\tvec3 colorB = isBush == 1.0 ? RGB( 0, 173, 0 ) : RGB( 57, 189, 255 );\n\tvec3 colorC = isBush == 1.0 ? RGB( 189, 255, 24 ) : RGB( 254, 254, 254 );\n\n\tcolor = idx == 1.0 ? RGB( 0, 0, 0 ) : color;\n\tcolor = idx == 2.0 ? colorB \t\t: color;\n\tcolor = idx == 3.0 ? colorC \t\t: color;\n}\n\nvoid SpriteFlag( inout vec3 color, float x, float y )\n{\n\tfloat idx = 0.0;\n\tidx = y == 15.0 ? 43690.0 : idx;\n\tidx = y == 14.0 ? ( x <= 7.0 ? 43688.0 : 42326.0 ) : idx;\n\tidx = y == 13.0 ? ( x <= 7.0 ? 43680.0 : 38501.0 ) : idx;\n\tidx = y == 12.0 ? ( x <= 7.0 ? 43648.0 : 39529.0 ) : idx;\n\tidx = y == 11.0 ? ( x <= 7.0 ? 43520.0 : 39257.0 ) : idx;\n\tidx = y == 10.0 ? ( x <= 7.0 ? 43008.0 : 38293.0 ) : idx;\n\tidx = y == 9.0 ? ( x <= 7.0 ? 40960.0 : 38229.0 ) : idx;\n\tidx = y == 8.0 ? ( x <= 7.0 ? 32768.0 : 43354.0 ) : idx;\n\tidx = y == 7.0 ? ( x <= 7.0 ? 0.0 : 43690.0 ) : idx;\n\tidx = y == 6.0 ? ( x <= 7.0 ? 0.0 : 43688.0 ) : idx;\n\tidx = y == 5.0 ? ( x <= 7.0 ? 0.0 : 43680.0 ) : idx;\n\tidx = y == 4.0 ? ( x <= 7.0 ? 0.0 : 43648.0 ) : idx;\n\tidx = y == 3.0 ? ( x <= 7.0 ? 0.0 : 43520.0 ) : idx;\n\tidx = y == 2.0 ? ( x <= 7.0 ? 0.0 : 43008.0 ) : idx;\n\tidx = y == 1.0 ? ( x <= 7.0 ? 0.0 : 40960.0 ) : idx;\n\tidx = y == 0.0 ? ( x <= 7.0 ? 0.0 : 32768.0 ) : idx;\n\n\tidx = SPRITE_DEC( x, idx );\n\n\tcolor = idx == 1.0 ? RGB( 0, 173, 0 ) : color;\n\tcolor = idx == 2.0 ? RGB( 255, 255, 255 ) : color;\n}\n\nvoid SpriteCastleFlag( inout vec3 color, float x, float y )\n{\n\tfloat idx = 0.0;\n\tidx = y == 13.0 ? ( x <= 10.0 ? 8.0 : 0.0 ) : idx;\n\tidx = y == 12.0 ? ( x <= 10.0 ? 42.0 : 0.0 ) : idx;\n\tidx = y == 11.0 ? ( x <= 10.0 ? 8.0 : 0.0 ) : idx;\n\tidx = y == 10.0 ? ( x <= 10.0 ? 4194292.0 : 15.0 ) : idx;\n\tidx = y == 9.0 ? ( x <= 10.0 ? 4161524.0 : 15.0 ) : idx;\n\tidx = y == 8.0 ? ( x <= 10.0 ? 4161524.0 : 15.0 ) : idx;\n\tidx = y == 7.0 ? ( x <= 10.0 ? 1398260.0 : 15.0 ) : idx;\n\tidx = y == 6.0 ? ( x <= 10.0 ? 3495924.0 : 15.0 ) : idx;\n\tidx = y == 5.0 ? ( x <= 10.0 ? 4022260.0 : 15.0 ) : idx;\n\tidx = y == 4.0 ? ( x <= 10.0 ? 3528692.0 : 15.0 ) : idx;\n\tidx = y == 3.0 ? ( x <= 10.0 ? 3667956.0 : 15.0 ) : idx;\n\tidx = y == 2.0 ? ( x <= 10.0 ? 4194292.0 : 15.0 ) : idx;\n\tidx = y == 1.0 ? ( x <= 10.0 ? 4.0 : 0.0 ) : idx;\n\tidx = y == 0.0 ? ( x <= 10.0 ? 4.0 : 0.0 ) : idx;\n\n\tidx = SPRITE_DEC2( x, idx );\n\n\tcolor = idx == 1.0 ? RGB( 181, 49, 33 ) : color;\n color = idx == 2.0 ? RGB( 230, 156, 33 ) : color;\n\tcolor = idx == 3.0 ? RGB( 255, 255, 255 ) : color;\n}\n\nvoid SpriteGoomba( inout vec3 color, float x, float y, float frame )\n{\n\tfloat idx = 0.0;\n\n // second frame is flipped first frame\n x = frame == 1.0 ? 15.0 - x : x;\n\n if ( frame <= 1.0 )\n {\n idx = y == 15.0 ? ( x <= 7.0 ? 40960.0 : 10.0 ) : idx;\n idx = y == 14.0 ? ( x <= 7.0 ? 43008.0 : 42.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 43520.0 : 170.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 43648.0 : 682.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 43360.0 : 2410.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 42920.0 : 10970.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 22440.0 : 10965.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 47018.0 : 43742.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 49066.0 : 43774.0 ) : idx;\n idx = y == 6.0 ? 43690.0 : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 65192.0 : 10943.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 65280.0 : 255.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 65280.0 : 1535.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 64832.0 : 5471.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 62784.0 : 5463.0 ) : idx;\n idx = y == 0.0 ? ( x <= 7.0 ? 5376.0 : 1364.0 ) : idx;\n }\n else\n {\n idx = y == 7.0 ? ( x <= 7.0 ? 40960.0 : 10.0 ) : idx;\n\t\tidx = y == 6.0 ? ( x <= 7.0 ? 43648.0 : 682.0 ) : idx;\n\t\tidx = y == 5.0 ? ( x <= 7.0 ? 42344.0 : 10586.0 ) : idx;\n\t\tidx = y == 4.0 ? ( x <= 7.0 ? 24570.0 : 45045.0 ) : idx;\n\t\tidx = y == 3.0 ? 43690.0 : idx;\n\t\tidx = y == 2.0 ? ( x <= 7.0 ? 65472.0 : 1023.0 ) : idx;\n\t\tidx = y == 1.0 ? ( x <= 7.0 ? 65280.0 : 255.0 ) : idx;\n\t\tidx = y == 0.0 ? ( x <= 7.0 ? 1364.0 : 5456.0 ) : idx; \n }\n \n idx = SPRITE_DEC( x, idx );\n \n\tcolor = idx == 1.0 ? RGB( 0, 0, 0 ) : color;\n\tcolor = idx == 2.0 ? RGB( 153, 75, 12 ) : color;\n\tcolor = idx == 3.0 ? RGB( 255, 200, 184 ) : color;\n}\n\nvoid SpriteKoopa( inout vec3 color, float x, float y, float frame )\n{ \n\tfloat idx = 0.0;\n\n\tif ( frame == 0.0 )\n {\n\t\tidx = y == 23.0 ? ( x <= 7.0 ? 768.0 : 0.0 ) : idx;\n\t\tidx = y == 22.0 ? ( x <= 7.0 ? 4032.0 : 0.0 ) : idx;\n\t\tidx = y == 21.0 ? ( x <= 7.0 ? 4064.0 : 0.0 ) : idx;\n\t\tidx = y == 20.0 ? ( x <= 7.0 ? 12128.0 : 0.0 ) : idx;\n\t\tidx = y == 19.0 ? ( x <= 7.0 ? 12136.0 : 0.0 ) : idx;\n idx = y == 18.0 ? ( x <= 7.0 ? 12136.0 : 0.0 ) : idx;\n idx = y == 17.0 ? ( x <= 7.0 ? 12264.0 : 0.0 ) : idx;\n\t\tidx = y == 16.0 ? ( x <= 7.0 ? 11174.0 : 0.0 ) : idx;\n\t\tidx = y == 15.0 ? ( x <= 7.0 ? 10922.0 : 0.0 ) : idx;\n\t\tidx = y == 14.0 ? ( x <= 7.0 ? 10282.0 : 341.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 30730.0 : 1622.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 31232.0 : 1433.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 24192.0 : 8037.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 24232.0 : 7577.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 28320.0 : 9814.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 40832.0 : 6485.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 26496.0 : 9814.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 23424.0 : 5529.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 22272.0 : 5477.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 24320.0 : 64921.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 65024.0 : 12246.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 59904.0 : 11007.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 43008.0 : 10752.0 ) : idx;\n idx = y == 0.0 ? ( x <= 7.0 ? 40960.0 : 2690.0 ) : idx;\n }\n\telse\n\t{\n idx = y == 22.0 ? ( x <= 7.0 ? 192.0 : 0.0 ) : idx;\n idx = y == 21.0 ? ( x <= 7.0 ? 1008.0 : 0.0 ) : idx;\n idx = y == 20.0 ? ( x <= 7.0 ? 3056.0 : 0.0 ) : idx;\n idx = y == 19.0 ? ( x <= 7.0 ? 11224.0 : 0.0 ) : idx;\n idx = y == 18.0 ? ( x <= 7.0 ? 11224.0 : 0.0 ) : idx;\n idx = y == 17.0 ? ( x <= 7.0 ? 11224.0 : 0.0 ) : idx;\n idx = y == 16.0 ? ( x <= 7.0 ? 11256.0 : 0.0 ) : idx;\n idx = y == 15.0 ? ( x <= 7.0 ? 10986.0 : 0.0 ) : idx;\n idx = y == 14.0 ? ( x <= 7.0 ? 10918.0 : 0.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 2730.0 : 341.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 18986.0 : 1622.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 18954.0 : 5529.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 24202.0 : 8037.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 24200.0 : 7577.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 28288.0 : 9814.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 40864.0 : 6485.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 26496.0 : 9814.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 23424.0 : 5529.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 22272.0 : 5477.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 24320.0 : 64921.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 65152.0 : 4054.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 60064.0 : 11007.0 ) : idx;\n idx = y == 0.0 ? ( x <= 7.0 ? 2728.0 : 43520.0 ) : idx;\n\t}\n\n\tidx = SPRITE_DEC( x, idx );\n\n\tcolor = idx == 1.0 ? RGB( 30, 132, 0 ) : color;\n\tcolor = idx == 2.0 ? RGB( 215, 141, 34 ) : color;\n\tcolor = idx == 3.0 ? RGB( 255, 255, 255 ) : color; \n}\n\nvoid SpriteQuestion( inout vec3 color, float x, float y, float t )\n{\n\tfloat idx = 0.0;\n\tidx = y == 15.0 ? ( x <= 7.0 ? 43688.0 : 10922.0 ) : idx;\n\tidx = y == 14.0 ? ( x <= 7.0 ? 65534.0 : 32767.0 ) : idx;\n\tidx = y == 13.0 ? ( x <= 7.0 ? 65502.0 : 30719.0 ) : idx;\n\tidx = y == 12.0 ? ( x <= 7.0 ? 44030.0 : 32762.0 ) : idx;\n\tidx = y == 11.0 ? ( x <= 7.0 ? 23294.0 : 32745.0 ) : idx;\n\tidx = y == 10.0 ? ( x <= 7.0 ? 56062.0 : 32619.0 ) : idx;\n\tidx = y == 9.0 ? ( x <= 7.0 ? 56062.0 : 32619.0 ) : idx;\n\tidx = y == 8.0 ? ( x <= 7.0 ? 55294.0 : 32618.0 ) : idx;\n\tidx = y == 7.0 ? ( x <= 7.0 ? 49150.0 : 32598.0 ) : idx;\n\tidx = y == 6.0 ? ( x <= 7.0 ? 49150.0 : 32758.0 ) : idx;\n\tidx = y == 5.0 ? ( x <= 7.0 ? 65534.0 : 32757.0 ) : idx;\n\tidx = y == 4.0 ? ( x <= 7.0 ? 49150.0 : 32766.0 ) : idx;\n\tidx = y == 3.0 ? ( x <= 7.0 ? 49150.0 : 32758.0 ) : idx;\n\tidx = y == 2.0 ? ( x <= 7.0 ? 65502.0 : 30709.0 ) : idx;\n\tidx = y == 1.0 ? ( x <= 7.0 ? 65534.0 : 32767.0 ) : idx;\n\tidx = y == 0.0 ? 21845.0 : idx;\n\n\tidx = SPRITE_DEC( x, idx );\n\n\tcolor = idx == 1.0 ? RGB( 0, 0, 0 ) : color;\n\tcolor = idx == 2.0 ? RGB( 231, 90, 16 ) : color;\n\tcolor = idx == 3.0 ? mix( RGB( 255, 165, 66 ), RGB( 231, 90, 16 ), t ) : color;\n}\n\nvoid SpriteMushroom( inout vec3 color, float x, float y )\n{\n\tfloat idx = 0.0;\n\tidx = y == 15.0 ? ( x <= 7.0 ? 40960.0 : 10.0 ) : idx;\n\tidx = y == 14.0 ? ( x <= 7.0 ? 43008.0 : 22.0 ) : idx;\n\tidx = y == 13.0 ? ( x <= 7.0 ? 43520.0 : 85.0 ) : idx;\n\tidx = y == 12.0 ? ( x <= 7.0 ? 43648.0 : 341.0 ) : idx;\n\tidx = y == 11.0 ? ( x <= 7.0 ? 43680.0 : 2646.0 ) : idx;\n\tidx = y == 10.0 ? ( x <= 7.0 ? 42344.0 : 10922.0 ) : idx;\n\tidx = y == 9.0 ? ( x <= 7.0 ? 38232.0 : 10922.0 ) : idx;\n\tidx = y == 8.0 ? ( x <= 7.0 ? 38234.0 : 42410.0 ) : idx;\n\tidx = y == 7.0 ? ( x <= 7.0 ? 38234.0 : 38314.0 ) : idx;\n\tidx = y == 6.0 ? ( x <= 7.0 ? 42346.0 : 38570.0 ) : idx;\n\tidx = y == 5.0 ? 43690.0 : idx;\n\tidx = y == 4.0 ? ( x <= 7.0 ? 64856.0 : 9599.0 ) : idx;\n\tidx = y == 3.0 ? ( x <= 7.0 ? 65280.0 : 255.0 ) : idx;\n\tidx = y == 2.0 ? ( x <= 7.0 ? 65280.0 : 239.0 ) : idx;\n\tidx = y == 1.0 ? ( x <= 7.0 ? 65280.0 : 239.0 ) : idx;\n\tidx = y == 0.0 ? ( x <= 7.0 ? 64512.0 : 59.0 ) : idx;\n\n\tidx = SPRITE_DEC( x, idx );\n\n\tcolor = idx == 1.0 ? RGB( 181, 49, 33 ) : color;\n\tcolor = idx == 2.0 ? RGB( 230, 156, 33 ) : color;\n\tcolor = idx == 3.0 ? RGB( 255, 255, 255 ) : color;\n}\n\nvoid SpriteGround( inout vec3 color, float x, float y )\n{ \n\tfloat idx = 0.0;\n\tidx = y == 15.0 ? ( x <= 7.0 ? 65534.0 : 49127.0 ) : idx;\n\tidx = y == 14.0 ? ( x <= 7.0 ? 43691.0 : 27318.0 ) : idx;\n\tidx = y == 13.0 ? ( x <= 7.0 ? 43691.0 : 27318.0 ) : idx;\n\tidx = y == 12.0 ? ( x <= 7.0 ? 43691.0 : 27318.0 ) : idx;\n\tidx = y == 11.0 ? ( x <= 7.0 ? 43691.0 : 27254.0 ) : idx;\n\tidx = y == 10.0 ? ( x <= 7.0 ? 43691.0 : 38246.0 ) : idx;\n\tidx = y == 9.0 ? ( x <= 7.0 ? 43691.0 : 32758.0 ) : idx;\n\tidx = y == 8.0 ? ( x <= 7.0 ? 43691.0 : 27318.0 ) : idx;\n\tidx = y == 7.0 ? ( x <= 7.0 ? 43691.0 : 27318.0 ) : idx;\n\tidx = y == 6.0 ? ( x <= 7.0 ? 43691.0 : 27318.0 ) : idx;\n\tidx = y == 5.0 ? ( x <= 7.0 ? 43685.0 : 27309.0 ) : idx;\n\tidx = y == 4.0 ? ( x <= 7.0 ? 43615.0 : 27309.0 ) : idx;\n\tidx = y == 3.0 ? ( x <= 7.0 ? 22011.0 : 27307.0 ) : idx;\n\tidx = y == 2.0 ? ( x <= 7.0 ? 32683.0 : 27307.0 ) : idx;\n\tidx = y == 1.0 ? ( x <= 7.0 ? 27307.0 : 23211.0 ) : idx;\n\tidx = y == 0.0 ? ( x <= 7.0 ? 38230.0 : 38231.0 ) : idx;\n\n\tidx = SPRITE_DEC( x, idx );\n\n\tcolor = RGB( 0, 0, 0 );\n\tcolor = idx == 2.0 ? RGB( 231, 90, 16 ) : color;\n\tcolor = idx == 3.0 ? RGB( 247, 214, 181 ) : color;\n}\n\nvoid SpriteFlagpoleEnd( inout vec3 color, float x, float y )\n{ \n\tfloat idx = 0.0;\n\n\tidx = y == 7.0 ? 1360.0 : idx;\n\tidx = y == 6.0 ? 6836.0 : idx;\n\tidx = y == 5.0 ? 27309.0 : idx;\n\tidx = y == 4.0 ? 27309.0 : idx;\n\tidx = y == 3.0 ? 27305.0 : idx;\n\tidx = y == 2.0 ? 27305.0 : idx;\n\tidx = y == 1.0 ? 6820.0 : idx;\n\tidx = y == 0.0 ? 1360.0 : idx;\n\n\tidx = SPRITE_DEC( x, idx );\n\n\tcolor = idx == 1.0 ? RGB( 0, 0, 0 ) : color;\n\tcolor = idx == 2.0 ? RGB( 0, 173, 0 ) : color;\n\tcolor = idx == 3.0 ? RGB( 189, 255, 24 ) : color;\n}\n\nvoid SpriteMario( inout vec3 color, float x, float y, float frame )\n{ \n float idx = 0.0;\n\n\tif ( frame == 0.0 )\n {\n idx = y == 14.0 ? ( x <= 7.0 ? 40960.0 : 42.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 43008.0 : 2730.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 21504.0 : 223.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 56576.0 : 4063.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 23808.0 : 16255.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 62720.0 : 1375.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 61440.0 : 1023.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 21504.0 : 793.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 22272.0 : 4053.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 23488.0 : 981.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 43328.0 : 170.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 43584.0 : 170.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 10832.0 : 42.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 16400.0 : 5.0 ) : idx;\n idx = y == 0.0 ? ( x <= 7.0 ? 16384.0 : 21.0 ) : idx;\n\t}\n else if ( frame == 1.0 ) \n {\n idx = y == 15.0 ? ( x <= 7.0 ? 43008.0 : 10.0 ) : idx;\n idx = y == 14.0 ? ( x <= 7.0 ? 43520.0 : 682.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 54528.0 : 55.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 63296.0 : 1015.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 55104.0 : 4063.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 64832.0 : 343.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 64512.0 : 255.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 25856.0 : 5.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 38208.0 : 22.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 42304.0 : 235.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 38208.0 : 170.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 62848.0 : 171.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 62976.0 : 42.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 43008.0 : 21.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 21504.0 : 85.0 ) : idx;\n idx = y == 0.0 ? ( x <= 7.0 ? 21504.0 : 1.0 ) : idx;\n }\n else if ( frame == 2.0 ) \n {\n idx = y == 15.0 ? ( x <= 7.0 ? 43008.0 : 10.0 ) : idx;\n idx = y == 14.0 ? ( x <= 7.0 ? 43520.0 : 682.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 54528.0 : 55.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 63296.0 : 1015.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 55104.0 : 4063.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 64832.0 : 343.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 64512.0 : 255.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 42320.0 : 5.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 42335.0 : 16214.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 58687.0 : 15722.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 43535.0 : 1066.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 43648.0 : 1450.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 43680.0 : 1450.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 2708.0 : 1448.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 84.0 : 0.0 ) : idx;\n idx = y == 0.0 ? ( x <= 7.0 ? 336.0 : 0.0 ) : idx;\n }\n else if ( frame == 3.0 )\n {\n idx = y == 15.0 ? ( x <= 7.0 ? 0.0 : 64512.0 ) : idx;\n idx = y == 14.0 ? ( x <= 7.0 ? 40960.0 : 64554.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 43008.0 : 64170.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 21504.0 : 21727.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 56576.0 : 22495.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 23808.0 : 32639.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 62720.0 : 5471.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 61440.0 : 2047.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 38224.0 : 405.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 21844.0 : 16982.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 21855.0 : 17066.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 39487.0 : 23470.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 43596.0 : 23210.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 43344.0 : 23210.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 43604.0 : 42.0 ) : idx;\n idx = y == 0.0 ? ( x <= 7.0 ? 43524.0 : 0.0 ) : idx;\n }\n else if ( frame == 4.0 )\n {\n idx = y == 29.0 ? ( x <= 7.0 ? 32768.0 : 170.0 ) : idx;\n idx = y == 28.0 ? ( x <= 7.0 ? 43008.0 : 234.0 ) : idx;\n idx = y == 27.0 ? ( x <= 7.0 ? 43520.0 : 250.0 ) : idx;\n idx = y == 26.0 ? ( x <= 7.0 ? 43520.0 : 10922.0 ) : idx;\n idx = y == 25.0 ? ( x <= 7.0 ? 54528.0 : 1015.0 ) : idx;\n idx = y == 24.0 ? ( x <= 7.0 ? 57152.0 : 16343.0 ) : idx;\n idx = y == 23.0 ? ( x <= 7.0 ? 24384.0 : 65535.0 ) : idx;\n idx = y == 22.0 ? ( x <= 7.0 ? 24400.0 : 65407.0 ) : idx;\n idx = y == 21.0 ? ( x <= 7.0 ? 65360.0 : 5463.0 ) : idx;\n idx = y == 20.0 ? ( x <= 7.0 ? 64832.0 : 5471.0 ) : idx;\n idx = y == 19.0 ? ( x <= 7.0 ? 62464.0 : 4095.0 ) : idx;\n idx = y == 18.0 ? ( x <= 7.0 ? 43264.0 : 63.0 ) : idx;\n idx = y == 17.0 ? ( x <= 7.0 ? 22080.0 : 6.0 ) : idx;\n idx = y == 16.0 ? ( x <= 7.0 ? 22080.0 : 25.0 ) : idx;\n idx = y == 15.0 ? ( x <= 7.0 ? 22096.0 : 4005.0 ) : idx;\n idx = y == 14.0 ? ( x <= 7.0 ? 22160.0 : 65365.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 23184.0 : 65365.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 23168.0 : 64853.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 27264.0 : 64853.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 43648.0 : 598.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 43648.0 : 682.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 43648.0 : 426.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 43605.0 : 2666.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 43605.0 : 2710.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 43605.0 : 681.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 10837.0 : 680.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 85.0 : 340.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 5.0 : 340.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 1.0 : 5460.0 ) : idx;\n idx = y == 0.0 ? ( x <= 7.0 ? 0.0 : 5460.0 ) : idx;\n }\n else if ( frame == 5.0 )\n {\n idx = y == 30.0 ? ( x <= 7.0 ? 40960.0 : 42.0 ) : idx;\n idx = y == 29.0 ? ( x <= 7.0 ? 43520.0 : 58.0 ) : idx;\n idx = y == 28.0 ? ( x <= 7.0 ? 43648.0 : 62.0 ) : idx;\n idx = y == 27.0 ? ( x <= 7.0 ? 43648.0 : 2730.0 ) : idx;\n idx = y == 26.0 ? ( x <= 7.0 ? 62784.0 : 253.0 ) : idx;\n idx = y == 25.0 ? ( x <= 7.0 ? 63440.0 : 4085.0 ) : idx;\n idx = y == 24.0 ? ( x <= 7.0 ? 55248.0 : 16383.0 ) : idx;\n idx = y == 23.0 ? ( x <= 7.0 ? 55252.0 : 16351.0 ) : idx;\n idx = y == 22.0 ? ( x <= 7.0 ? 65492.0 : 1365.0 ) : idx;\n idx = y == 21.0 ? ( x <= 7.0 ? 65360.0 : 1367.0 ) : idx;\n idx = y == 20.0 ? ( x <= 7.0 ? 64832.0 : 1023.0 ) : idx;\n idx = y == 19.0 ? ( x <= 7.0 ? 43520.0 : 15.0 ) : idx;\n idx = y == 18.0 ? ( x <= 7.0 ? 38464.0 : 22.0 ) : idx;\n idx = y == 17.0 ? ( x <= 7.0 ? 21904.0 : 26.0 ) : idx;\n idx = y == 16.0 ? ( x <= 7.0 ? 21904.0 : 90.0 ) : idx;\n idx = y == 15.0 ? ( x <= 7.0 ? 21904.0 : 106.0 ) : idx;\n idx = y == 14.0 ? ( x <= 7.0 ? 21904.0 : 125.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 21904.0 : 255.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 21920.0 : 767.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 22176.0 : 2815.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 23200.0 : 2751.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 43680.0 : 2725.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 43648.0 : 661.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 27136.0 : 341.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 23040.0 : 85.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 26624.0 : 21.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 41984.0 : 86.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 21504.0 : 81.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 21760.0 : 1.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 21760.0 : 21.0 ) : idx;\n idx = y == 0.0 ? ( x <= 7.0 ? 20480.0 : 21.0 ) : idx;\n }\n else if ( frame == 6.0 )\n {\n idx = y == 31.0 ? ( x <= 7.0 ? 40960.0 : 42.0 ) : idx;\n idx = y == 30.0 ? ( x <= 7.0 ? 43520.0 : 58.0 ) : idx;\n idx = y == 29.0 ? ( x <= 7.0 ? 43648.0 : 62.0 ) : idx;\n idx = y == 28.0 ? ( x <= 7.0 ? 43648.0 : 2730.0 ) : idx;\n idx = y == 27.0 ? ( x <= 7.0 ? 62784.0 : 253.0 ) : idx;\n idx = y == 26.0 ? ( x <= 7.0 ? 63440.0 : 4085.0 ) : idx;\n idx = y == 25.0 ? ( x <= 7.0 ? 55248.0 : 16383.0 ) : idx;\n idx = y == 24.0 ? ( x <= 7.0 ? 55252.0 : 16351.0 ) : idx;\n idx = y == 23.0 ? ( x <= 7.0 ? 65492.0 : 1365.0 ) : idx;\n idx = y == 22.0 ? ( x <= 7.0 ? 65364.0 : 1367.0 ) : idx;\n idx = y == 21.0 ? ( x <= 7.0 ? 64832.0 : 1023.0 ) : idx;\n idx = y == 20.0 ? ( x <= 7.0 ? 21504.0 : 15.0 ) : idx;\n idx = y == 19.0 ? ( x <= 7.0 ? 43520.0 : 12325.0 ) : idx;\n idx = y == 18.0 ? ( x <= 7.0 ? 38208.0 : 64662.0 ) : idx;\n idx = y == 17.0 ? ( x <= 7.0 ? 21840.0 : 64922.0 ) : idx;\n idx = y == 16.0 ? ( x <= 7.0 ? 21844.0 : 65114.0 ) : idx;\n idx = y == 15.0 ? ( x <= 7.0 ? 21844.0 : 30298.0 ) : idx;\n idx = y == 14.0 ? ( x <= 7.0 ? 38228.0 : 5722.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 42325.0 : 1902.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 43605.0 : 682.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 44031.0 : 682.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 44031.0 : 17066.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 43775.0 : 21162.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 43772.0 : 21866.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 43392.0 : 21866.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 42640.0 : 21866.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 23189.0 : 21866.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 43605.0 : 21824.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 2389.0 : 0.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 84.0 : 0.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 84.0 : 0.0 ) : idx;\n idx = y == 0.0 ? ( x <= 7.0 ? 336.0 : 0.0 ) : idx;\n }\n else\n {\n idx = y == 31.0 ? ( x <= 7.0 ? 0.0 : 16128.0 ) : idx;\n idx = y == 30.0 ? ( x <= 7.0 ? 0.0 : 63424.0 ) : idx;\n idx = y == 29.0 ? ( x <= 7.0 ? 40960.0 : 55274.0 ) : idx;\n idx = y == 28.0 ? ( x <= 7.0 ? 43520.0 : 65514.0 ) : idx;\n idx = y == 27.0 ? ( x <= 7.0 ? 43648.0 : 21866.0 ) : idx;\n idx = y == 26.0 ? ( x <= 7.0 ? 43648.0 : 23210.0 ) : idx;\n idx = y == 25.0 ? ( x <= 7.0 ? 62784.0 : 22013.0 ) : idx;\n idx = y == 24.0 ? ( x <= 7.0 ? 63440.0 : 24573.0 ) : idx;\n idx = y == 23.0 ? ( x <= 7.0 ? 55248.0 : 32767.0 ) : idx;\n idx = y == 22.0 ? ( x <= 7.0 ? 55248.0 : 32735.0 ) : idx;\n idx = y == 21.0 ? ( x <= 7.0 ? 65492.0 : 5461.0 ) : idx;\n idx = y == 20.0 ? ( x <= 7.0 ? 64852.0 : 7511.0 ) : idx;\n idx = y == 19.0 ? ( x <= 7.0 ? 64832.0 : 6143.0 ) : idx;\n idx = y == 18.0 ? ( x <= 7.0 ? 43520.0 : 5477.0 ) : idx;\n idx = y == 17.0 ? ( x <= 7.0 ? 38228.0 : 1382.0 ) : idx;\n idx = y == 16.0 ? ( x <= 7.0 ? 21845.0 : 1430.0 ) : idx;\n idx = y == 15.0 ? ( x <= 7.0 ? 21845.0 : 410.0 ) : idx;\n idx = y == 14.0 ? ( x <= 7.0 ? 22005.0 : 602.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 38909.0 : 874.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 43007.0 : 686.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 44031.0 : 682.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 43763.0 : 17066.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 43708.0 : 21162.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 43648.0 : 21930.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 43584.0 : 21930.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 42389.0 : 21930.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 23189.0 : 21930.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 43669.0 : 21920.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 43669.0 : 0.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 10901.0 : 0.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 5.0 : 0.0 ) : idx;\n }\n \n idx = SPRITE_DEC( x, idx );\n \n\tcolor = idx == 1.0 ? RGB( 106, 107, 4 ) : color;\n\tcolor = idx == 2.0 ? RGB( 177, 52, 37 ) : color;\n\tcolor = idx == 3.0 ? RGB( 227, 157, 37 ) : color; \n}\n\nvoid SpriteCoin( inout vec3 color, float x, float y, float frame )\n{ \n float idx = 0.0;\n\tif ( frame == 0.0 )\n {\n idx = y == 14.0 ? ( x <= 7.0 ? 32768.0 : 1.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 32768.0 : 1.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 24576.0 : 5.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 24576.0 : 5.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 24576.0 : 5.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 24576.0 : 5.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 28672.0 : 5.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 28672.0 : 5.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 24576.0 : 5.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 24576.0 : 5.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 24576.0 : 5.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 24576.0 : 5.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 32768.0 : 1.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 32768.0 : 1.0 ) : idx;\n\t}\n else if ( frame == 1.0 ) \n {\n idx = y == 14.0 ? ( x <= 7.0 ? 32768.0 : 2.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 40960.0 : 10.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 43008.0 : 42.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 59392.0 : 41.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 47616.0 : 166.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 47616.0 : 166.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 47616.0 : 166.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 47616.0 : 166.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 47616.0 : 166.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 47616.0 : 166.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 59392.0 : 41.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 43008.0 : 42.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 40960.0 : 10.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 32768.0 : 2.0 ) : idx;;\n }\n else if ( frame == 2.0 ) \n {\n idx = y == 14.0 ? ( x <= 7.0 ? 49152.0 : 1.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 49152.0 : 1.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 61440.0 : 7.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 61440.0 : 7.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 61440.0 : 7.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 61440.0 : 7.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 61440.0 : 7.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 61440.0 : 7.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 61440.0 : 7.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 61440.0 : 7.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 61440.0 : 7.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 61440.0 : 7.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 49152.0 : 1.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 49152.0 : 1.0 ) : idx;\n }\n else\n {\n idx = y == 14.0 ? ( x <= 7.0 ? 0.0 : 2.0 ) : idx;\n idx = y == 13.0 ? ( x <= 7.0 ? 0.0 : 2.0 ) : idx;\n idx = y == 12.0 ? ( x <= 7.0 ? 0.0 : 2.0 ) : idx;\n idx = y == 11.0 ? ( x <= 7.0 ? 0.0 : 2.0 ) : idx;\n idx = y == 10.0 ? ( x <= 7.0 ? 0.0 : 2.0 ) : idx;\n idx = y == 9.0 ? ( x <= 7.0 ? 0.0 : 2.0 ) : idx;\n idx = y == 8.0 ? ( x <= 7.0 ? 0.0 : 3.0 ) : idx;\n idx = y == 7.0 ? ( x <= 7.0 ? 0.0 : 3.0 ) : idx;\n idx = y == 6.0 ? ( x <= 7.0 ? 0.0 : 2.0 ) : idx;\n idx = y == 5.0 ? ( x <= 7.0 ? 0.0 : 2.0 ) : idx;\n idx = y == 4.0 ? ( x <= 7.0 ? 0.0 : 2.0 ) : idx;\n idx = y == 3.0 ? ( x <= 7.0 ? 0.0 : 2.0 ) : idx;\n idx = y == 2.0 ? ( x <= 7.0 ? 0.0 : 2.0 ) : idx;\n idx = y == 1.0 ? ( x <= 7.0 ? 0.0 : 2.0 ) : idx;\n }\n \n\tidx = SPRITE_DEC( x, idx );\n\n\tcolor = idx == 1.0 ? RGB( 181, 49, 33 ) : color;\n\tcolor = idx == 2.0 ? RGB( 230, 156, 33 ) : color;\n\tcolor = idx == 3.0 ? RGB( 255, 255, 255 ) : color; \n}\n\nvoid SpriteBrick( inout vec3 color, float x, float y )\n{ \n\tfloat ymod4 = floor( mod( y, 4.0 ) ); \n float xmod8 = floor( mod( x, 8.0 ) );\n float ymod8 = floor( mod( y, 8.0 ) );\n \n // dark orange\n float idx = 2.0;\n \n // black\n idx = ymod4 == 0.0 ? 1.0 : idx;\n idx = xmod8 == ( ymod8 < 4.0 ? 3.0 : 7.0 ) ? 1.0 : idx;\n\n // light orange\n idx = y == 15.0 ? 3.0 : idx;\n\n color = idx == 1.0 ? RGB( 0, 0, 0 ) : color;\n\tcolor = idx == 2.0 ? RGB( 231, 90, 16 ) : color;\n\tcolor = idx == 3.0 ? RGB( 247, 214, 181 ) : color;\n}\n\nvoid DrawCastle( inout vec3 color, float x, float y )\n{\n\tif ( x >= 0.0 && x < 80.0 && y >= 0.0 && y < 80.0 )\n\t{\n\t\tfloat ymod4 = mod( y, 4.0 );\n\t\tfloat xmod8 = mod( x, 8.0 );\n\t\tfloat xmod16_4 = mod( x + 4.0, 16.0 );\n\t\tfloat xmod16_3 = mod( x + 5.0, 16.0 );\n\t\tfloat ymod8 = mod( y, 8.0 );\n\n\t\t// dark orange\n\t\tfloat idx = 2.0;\n\n\t\t// black\n\t\tidx = ymod4 == 0.0 && y <= 72.0 && ( y != 44.0 || xmod16_3 > 8.0 ) ? 1.0 : idx;\n\t\tidx = x >= 24.0 && x <= 32.0 && y >= 48.0 && y <= 64.0 ? 1.0 : idx;\n\t\tidx = x >= 48.0 && x <= 56.0 && y >= 48.0 && y <= 64.0 ? 1.0 : idx;\n\t\tidx = x >= 32.0 && x <= 47.0 && y <= 25.0 ? 1.0 : idx;\n\t\tidx = xmod8 == ( ymod8 < 4.0 ? 3.0 : 7.0 ) && y <= 72.0 && ( xmod16_3 > 8.0 || y <= 40.0 || y >= 48.0 ) ? 1.0 : idx; \n\n\t\t// white\n\t\tidx = y == ( xmod16_4 < 8.0 ? 47.0 : 40.0 ) ? 3.0 : idx;\n\t\tidx = y == ( xmod16_4 < 8.0 ? 79.0 : 72.0 ) ? 3.0 : idx;\n\t\tidx = xmod8 == 3.0 && y >= 40.0 && y <= 47.0 ? 3.0 : idx;\n\t\tidx = xmod8 == 3.0 && y >= 72.0 ? 3.0 : idx;\n\n\t\t// transparent\n\t\tidx = ( x < 16.0 || x >= 64.0 ) && y >= 48.0 ? 0.0 : idx;\n\t\tidx = x >= 4.0 && x <= 10.0 && y >= 41.0 && y <= 47.0 ? 0.0 : idx;\n\t\tidx = x >= 68.0 && x <= 74.0 && y >= 41.0 && y <= 47.0 ? 0.0 : idx; \n\t\tidx = y >= 73.0 && xmod16_3 > 8.0 ? 0.0 : idx;\n\n\t\tcolor = idx == 1.0 ? RGB( 0, 0, 0 ) : color;\n\t\tcolor = idx == 2.0 ? RGB( 231, 90, 16 ) : color;\n\t\tcolor = idx == 3.0 ? RGB( 247, 214, 181 ) : color;\n\t}\n}\n\nvoid DrawKoopa( inout vec3 color, float x, float y, float frame )\n{\n if ( x >= 0.0 && x <= 15.0 )\n {\n SpriteKoopa( color, x, y, frame );\n }\n}\n\nvoid KoopaWalk( inout vec3 color, float worldX, float worldY, float time, float frame, float startX )\n{\n float x = worldX - startX + floor( time * GOOMBA_SPEED );\n DrawKoopa( color, x, worldY - 16.0, frame ); \n}\n\nvoid DrawHitQuestion( inout vec3 color, float questionX, float questionY, float time, float questionT, float questionHitTime )\n{\n\tfloat t = clamp( ( time - questionHitTime ) / 0.25, 0.0, 1.0 );\n t = 1.0 - abs( 2.0 * t - 1.0 );\n\n questionY -= floor( t * 8.0 );\n if ( questionX >= 0.0 && questionX <= 15.0 )\n { \n \tif ( time >= questionHitTime )\n { \n \tSpriteQuestion( color, questionX, questionY, 1.0 );\n if ( questionX >= 3.0 && questionX <= 12.0 && questionY >= 1.0 && questionY <= 15.0 )\n {\n color = RGB( 231, 90, 16 );\n }\n }\n else\n {\n \tSpriteQuestion( color, questionX, questionY, questionT );\n }\n }\n}\n\nvoid DrawW( inout vec3 color, float x, float y )\n{\n if ( x >= 0.0 && x < 14.0 && y >= 0.0 && y < 14.0 )\n {\n if ( ( x <= 3.0 || x >= 10.0 ) \n || ( x >= 4.0 && x <= 5.0 && y >= 2.0 && y <= 7.0 )\n || ( x >= 8.0 && x <= 9.0 && y >= 2.0 && y <= 7.0 )\n || ( x >= 6.0 && x <= 7.0 && y >= 4.0 && y <= 9.0 )\n )\n {\n color = RGB( 255, 255, 255 );\n }\n }\n}\n\nvoid DrawO( inout vec3 color, float x, float y )\n{\n if ( x >= 0.0 && x < 14.0 && y >= 0.0 && y < 14.0 )\n {\n if ( ( x <= 1.0 || x >= 12.0 ) && ( y >= 2.0 && y <= 11.0 )\n || ( x >= 2.0 && x <= 4.0 )\n || ( x >= 9.0 && x <= 11.0 )\n || ( y <= 1.0 || y >= 11.0 ) && ( x >= 2.0 && x <= 11.0 )\n )\n {\n color = RGB( 255, 255, 255 );\n }\n }\n}\n\nvoid DrawR( inout vec3 color, float x, float y )\n{\n if ( x >= 0.0 && x < 14.0 && y >= 0.0 && y < 14.0 )\n {\n if ( ( x <= 3.0 )\n\t\t\t || ( y >= 12.0 && x <= 11.0 )\n || ( x >= 10.0 && y >= 6.0 && y <= 11.0 )\n || ( x >= 8.0 && x <= 9.0 && y <= 7.0 )\n || ( x <= 9.0 && y >= 4.0 && y <= 5.0 )\n || ( x >= 8.0 && y <= 1.0 )\n || ( x >= 6.0 && x <= 11.0 && y >= 2.0 && y <= 3.0 )\n )\n {\n color = RGB( 255, 255, 255 );\n }\n }\n}\n\nvoid DrawL( inout vec3 color, float x, float y )\n{\n if ( x >= 0.0 && x < 14.0 && y >= 0.0 && y < 14.0 )\n {\n if ( x <= 3.0 || y <= 1.0 )\n {\n color = RGB( 255, 255, 255 );\n }\n }\n}\n\nvoid DrawD( inout vec3 color, float x, float y )\n{ \n if ( x >= 0.0 && x < 14.0 && y >= 0.0 && y < 14.0 )\n {\n \tcolor = RGB( 255, 255, 255 ); \n \n if ( ( x >= 4.0 && x <= 7.0 && y >= 2.0 && y <= 11.0 ) \n \t || ( x >= 8.0 && x <= 9.0 && y >= 4.0 && y <= 9.0 ) \n || ( x >= 12.0 && ( y <= 3.0 || y >= 10.0 ) )\n || ( x >= 10.0 && ( y <= 1.0 || y >= 12.0 ) )\n )\n {\n color = RGB( 0, 0, 0 );\n }\n }\n}\n\nvoid Draw1( inout vec3 color, float x, float y )\n{ \n if ( x >= 0.0 && x < 14.0 && y >= 0.0 && y < 14.0 )\n {\n if ( ( y <= 1.0 )\n || ( x >= 5.0 && x <= 8.0 )\n || ( x >= 3.0 && x <= 4.0 && y >= 10.0 && y <= 11.0 )\n )\n {\n color = RGB( 255, 255, 255 );\n }\n }\n}\n\nvoid DrawM( inout vec3 color, float x, float y )\n{ \n if ( x >= 0.0 && x < 14.0 && y >= 0.0 && y < 14.0 )\n {\n if ( y >= 4.0 && y <= 7.0 )\n {\n color = RGB( 255, 255, 255 );\n }\n }\n}\n\nvoid DrawIntro( inout vec3 color, float x, float y, float screenWidth, float screenHeight )\n{\n color = RGB( 0, 0, 0 );\n \n float offset \t= 18.0; \n float textX \t= floor( x - ( screenWidth - offset * 8.0 - 7.0 ) / 2.0 );\n float textY \t= floor( y - ( screenHeight - 7.0 ) / 2.0 - 16.0 * 2.0 );\n float marioX\t= textX - offset * 4.0;\n float marioY\t= textY + 16.0 * 3.0;\n\t\n DrawW( color, textX - offset * 0.0, textY );\n DrawO( color, textX - offset * 1.0, textY );\n DrawR( color, textX - offset * 2.0, textY );\n DrawL( color, textX - offset * 3.0, textY );\n DrawD( color, textX - offset * 4.0, textY );\n Draw1( color, textX - offset * 6.0, textY );\n DrawM( color, textX - offset * 7.0, textY );\n Draw1( color, textX - offset * 8.0, textY );\n \n if ( marioX >= 0.0 && marioX <= 15.0 )\n {\n \tSpriteMario( color, marioX, marioY, 4.0 );\n }\n}\n\nfloat CoinAnimY( float worldY, float time, float coinTime )\n{\n\treturn worldY - 4.0 * 16.0 - floor( 64.0 * ( 1.0 - abs( 2.0 * ( clamp( ( time - coinTime ) / 0.8, 0.0, 1.0 ) ) - 1.0 ) ) );\n}\n\nfloat QuestionAnimY( float worldY, float time, float questionHitTime )\n{\n return worldY - 4.0 * 16.0 - floor( 8.0 * ( 1.0 - abs( 2.0 * clamp( ( time - questionHitTime ) / 0.25, 0.0, 1.0 ) - 1.0 ) ) );\n}\n\nfloat GoombaSWalkX( float worldX, float startX, float time, float goombaLifeTime )\n{\n return worldX + floor( min( time, goombaLifeTime ) * GOOMBA_SPEED ) - startX;\n}\n\nvoid DrawGame( inout vec3 color, float time, float pixelX, float pixelY, float screenWidth, float screenHeight )\n{\n float mushroomPauseStart \t= 16.25; \n float mushroomPauseLength \t= 2.0; \n float flagPauseStart\t\t= 38.95;\n float flagPauseLength\t\t= 1.5;\n\n float cameraP1\t\t= clamp( time - mushroomPauseStart, 0.0, mushroomPauseLength );\n float cameraP2\t\t= clamp( time - flagPauseStart, 0.0, flagPauseLength );\n float cameraX \t\t= floor( min( ( time - cameraP1 - cameraP2 ) * MARIO_SPEED - 240.0, 3152.0 ) );\n float worldX \t\t= pixelX + cameraX;\n float worldY \t\t= pixelY - 8.0;\n float tileX\t\t\t= floor( worldX / 16.0 );\n float tileY\t\t\t= floor( worldY / 16.0 );\n float tile2X\t\t= floor( worldX / 32.0 );\n float tile2Y\t\t= floor( worldY / 32.0 ); \n float worldXMod16\t= mod( worldX, 16.0 );\n float worldYMod16 \t= mod( worldY, 16.0 );\n\n\n // default background color\n color = RGB( 92, 148, 252 );\n\n \n // draw hills\n float bigHillX \t = mod( worldX, 768.0 );\n float smallHillX = mod( worldX - 240.0, 768.0 );\n float hillX \t = min( bigHillX, smallHillX );\n float hillY = worldY - ( smallHillX < bigHillX ? 0.0 : 16.0 );\n SpriteHill( color, hillX, hillY );\n\n\n // draw clouds and bushes\n\tfloat sc1CloudX = mod( worldX - 296.0, 768.0 );\n float sc2CloudX = mod( worldX - 904.0, 768.0 );\n float mcCloudX = mod( worldX - 584.0, 768.0 );\n float lcCloudX = mod( worldX - 440.0, 768.0 ); \n float scCloudX = min( sc1CloudX, sc2CloudX );\n float sbCloudX \t= mod( worldX - 376.0, 768.0 );\n float mbCloudX = mod( worldX - 664.0, 768.0 ); \n\tfloat lbCloudX = mod( worldX - 184.0, 768.0 );\n float cCloudX\t= min( min( scCloudX, mcCloudX ), lcCloudX );\n float bCloudX\t= min( min( sbCloudX, mbCloudX ), lbCloudX );\n float sCloudX\t= min( scCloudX, sbCloudX );\n float mCloudX\t= min( mcCloudX, mbCloudX );\n float lCloudX\t= min( lcCloudX, lbCloudX );\n float cloudX\t= min( cCloudX, bCloudX );\n float isBush\t= bCloudX < cCloudX ? 1.0 : 0.0;\n float cloudSeg\t= cloudX == sCloudX ? 0.0 : ( cloudX == mCloudX ? 1.0 : 2.0 );\n float cloudY\t= worldY - ( isBush == 1.0 ? 8.0 : ( ( cloudSeg == 0.0 && sc1CloudX < sc2CloudX ) || cloudSeg == 1.0 ? 168.0 : 152.0 ) );\n\tif ( cloudX >= 0.0 && cloudX < 32.0 + 16.0 * cloudSeg )\n {\n if ( cloudSeg == 1.0 )\n {\n \tcloudX = cloudX < 24.0 ? cloudX : cloudX - 16.0;\n }\n if ( cloudSeg == 2.0 )\n {\n \tcloudX = cloudX < 24.0 ? cloudX : ( cloudX < 40.0 ? cloudX - 16.0 : cloudX - 32.0 );\n }\n \n \tSpriteCloud( color, cloudX, cloudY, isBush );\n }\n\n \n \n // draw flag pole\n if ( worldX >= 3175.0 && worldX <= 3176.0 && worldY <= 176.0 ) \n {\n color = RGB( 189, 255, 24 );\n }\n \n // draw flag\n float flagX = worldX - 3160.0;\n float flagY = worldY - 159.0 + floor( 122.0 * clamp( ( time - 39.0 ) / 1.0, 0.0, 1.0 ) );\n if ( flagX >= 0.0 && flagX <= 15.0 )\n {\n \tSpriteFlag( color, flagX, flagY );\n } \n \n // draw flagpole end\n float flagpoleEndX = worldX - 3172.0;\n float flagpoleEndY = worldY - 176.0;\n if ( flagpoleEndX >= 0.0 && flagpoleEndX <= 7.0 )\n {\n \tSpriteFlagpoleEnd( color, flagpoleEndX, flagpoleEndY );\n }\n \n \n\n // draw blocks\n \tif ( ( tileX >= 134.0 && tileX < 138.0 && tileX - 132.0 > tileY )\n || ( tileX >= 140.0 && tileX < 144.0 && 145.0 - tileX > tileY )\n || ( tileX >= 148.0 && tileX < 153.0 && tileX - 146.0 > tileY && tileY < 5.0 )\n || ( tileX >= 155.0 && tileX < 159.0 && 160.0 - tileX > tileY ) \n || ( tileX >= 181.0 && tileX < 190.0 && tileX - 179.0 > tileY && tileY < 9.0 )\n || ( tileX == 198.0 && tileY == 1.0 )\n )\n {\n SpriteBlock( color, worldXMod16, worldYMod16 );\n }\n \n \n // draw pipes\n float pipeY = worldY - 16.0; \n float pipeH\t= 0.0; \n float pipeX = worldX - 179.0 * 16.0;\n if ( pipeX < 0.0 )\n {\n pipeX = worldX - 163.0 * 16.0;\n pipeH = 0.0;\n }\n if ( pipeX < 0.0 )\n {\n pipeX = worldX - 57.0 * 16.0;\n pipeH = 2.0;\n }\n if ( pipeX < 0.0 )\n {\n pipeX = worldX - 46.0 * 16.0;\n pipeH = 2.0;\n } \n if ( pipeX < 0.0 )\n {\n pipeX = worldX - 38.0 * 16.0;\n pipeH = 1.0;\n } \n if ( pipeX < 0.0 )\n {\n pipeX = worldX - 28.0 * 16.0;\n pipeH = 0.0;\n }\n if ( pipeX >= 0.0 && pipeX <= 31.0 && pipeY >= 0.0 && pipeY <= 31.0 + pipeH * 16.0 )\n\t{\n\t\tSpritePipe( color, pipeX, pipeY, pipeH );\n\t}\n \n \n // draw mushroom\n float mushroomStart = 15.7; \n if ( time >= mushroomStart && time <= 17.0 )\n {\n float jumpTime = 0.5;\n \n float mushroomX = worldX - 1248.0;\n float mushroomY = worldY - 4.0 * 16.0;\n if ( time >= mushroomStart )\n {\n mushroomY = worldY - 4.0 * 16.0 - floor( 16.0 * clamp( ( time - mushroomStart ) / 0.5, 0.0, 1.0 ) );\n }\n if ( time >= mushroomStart + 0.5 )\n {\n mushroomX -= floor( MARIO_SPEED * ( time - mushroomStart - 0.5 ) );\n }\n if ( time >= mushroomStart + 0.5 + 0.4 )\n {\n mushroomY = mushroomY + floor( sin( ( ( time - mushroomStart - 0.5 - 0.4 ) ) * 3.14 ) * 4.0 * 16.0 );\n }\n \n if ( mushroomX >= 0.0 && mushroomX <= 15.0 )\n {\n \tSpriteMushroom( color, mushroomX, mushroomY );\n }\n }\n\n \n // draw coins\n float coinFrame = floor( mod( time * 12.0, 4.0 ) );\n float coinX \t= worldX - 2720.0;\n float coinTime \t= 33.9; \n float coinY \t= CoinAnimY( worldY, time, coinTime );\n if ( coinX < 0.0 )\n {\n \tcoinX \t\t= worldX - 1696.0;\n \tcoinTime \t= 22.4; \n \tcoinY \t\t= CoinAnimY( worldY, time, coinTime ); \n }\n if ( coinX < 0.0 )\n {\n \tcoinX \t\t= worldX - 352.0;\n \tcoinTime \t= 5.4; \n \tcoinY \t\t= CoinAnimY( worldY, time, coinTime );\n } \n \n if ( coinX >= 0.0 && coinX <= 15.0 && time >= coinTime + 0.1 )\n { \n SpriteCoin( color, coinX, coinY, coinFrame );\n }\n\n \n // draw questions\n\tfloat questionT = clamp( sin( time * 6.0 ), 0.0, 1.0 ); \n if ( ( tileY == 4.0 && ( tileX == 16.0 || tileX == 20.0 || tileX == 109.0 || tileX == 112.0 ) )\n || ( tileY == 8.0 && ( tileX == 21.0 || tileX == 94.0 || tileX == 109.0 ) )\n || ( tileY == 8.0 && ( tileX >= 129.0 && tileX <= 130.0 ) )\n )\n {\n SpriteQuestion( color, worldXMod16, worldYMod16, questionT );\n }\n \n \n // draw hitted questions\n float questionHitTime \t= 33.9;\n float questionX \t\t= worldX - 2720.0;\n if ( questionX < 0.0 )\n {\n questionHitTime = 22.4;\n questionX\t\t= worldX - 1696.0;\n }\n if ( questionX < 0.0 )\n {\n questionHitTime = 15.4;\n questionX\t\t= worldX - 1248.0;\n }\n if ( questionX < 0.0 )\n {\n questionHitTime = 5.3;\n questionX\t\t= worldX - 352.0;\n } \n questionT\t\t= time >= questionHitTime ? 1.0 : questionT; \n float questionY = QuestionAnimY( worldY, time, questionHitTime );\n if ( questionX >= 0.0 && questionX <= 15.0 )\n {\n \tSpriteQuestion( color, questionX, questionY, questionT );\n }\n if ( time >= questionHitTime && questionX >= 3.0 && questionX <= 12.0 && questionY >= 1.0 && questionY <= 15.0 )\n {\n color = RGB( 231, 90, 16 );\n } \n\n \n // draw bricks\n \tif ( ( tileY == 4.0 && ( tileX == 19.0 || tileX == 21.0 || tileX == 23.0 || tileX == 77.0 || tileX == 79.0 || tileX == 94.0 || tileX == 118.0 || tileX == 168.0 || tileX == 169.0 || tileX == 171.0 ) )\n || ( tileY == 8.0 && ( tileX == 128.0 || tileX == 131.0 ) )\n || ( tileY == 8.0 && ( tileX >= 80.0 && tileX <= 87.0 ) )\n || ( tileY == 8.0 && ( tileX >= 91.0 && tileX <= 93.0 ) )\n || ( tileY == 4.0 && ( tileX >= 100.0 && tileX <= 101.0 ) )\n || ( tileY == 8.0 && ( tileX >= 121.0 && tileX <= 123.0 ) )\n || ( tileY == 4.0 && ( tileX >= 129.0 && tileX <= 130.0 ) )\n )\n {\n SpriteBrick( color, worldXMod16, worldYMod16 );\n } \n \n \n // draw castle flag\n float castleFlagX = worldX - 3264.0;\n float castleFlagY = worldY - 64.0 - floor( 32.0 * clamp( ( time - 44.6 ) / 1.0, 0.0, 1.0 ) );\n if ( castleFlagX > 0.0 && castleFlagX < 14.0 )\n {\n \tSpriteCastleFlag( color, castleFlagX, castleFlagY );\n\t}\n \n DrawCastle( color, worldX - 3232.0, worldY - 16.0 );\n\n // draw ground\n if ( tileY <= 0.0\n && !( tileX >= 69.0 && tileX < 71.0 )\n && !( tileX >= 86.0 && tileX < 89.0 ) \n && !( tileX >= 153.0 && tileX < 155.0 ) \n )\n {\n SpriteGround( color, worldXMod16, worldYMod16 );\n } \n \n\n // draw Koopa\n float goombaFrame = floor( mod( time * 5.0, 2.0 ) );\n KoopaWalk( color, worldX, worldY, time, goombaFrame, 2370.0 );\n \n \n // draw stomped walking Goombas\n float goombaY \t\t\t= worldY - 16.0; \n float goombaLifeTime \t= 26.3;\n float goombaX \t\t\t= GoombaSWalkX( worldX, 2850.0 + 24.0, time, goombaLifeTime );\n if ( goombaX < 0.0 )\n {\n goombaLifeTime \t= 25.3;\n goombaX \t\t= GoombaSWalkX( worldX, 2760.0, time, goombaLifeTime );\n }\n if ( goombaX < 0.0 ) \n {\n\t\tgoombaLifeTime \t= 23.5;\n goombaX \t\t= GoombaSWalkX( worldX, 2540.0, time, goombaLifeTime );\n }\n if ( goombaX < 0.0 ) \n {\n goombaLifeTime \t= 20.29;\n goombaX \t\t= GoombaSWalkX( worldX, 2150.0, time, goombaLifeTime );\n }\n if ( goombaX < 0.0 )\n {\n goombaLifeTime \t= 10.3;\n\t\tgoombaX \t\t= worldX - 790.0 - floor( abs( mod( ( min( time, goombaLifeTime ) + 6.3 ) * GOOMBA_SPEED, 2.0 * 108.0 ) - 108.0 ) );\n }\n\tgoombaFrame = time > goombaLifeTime ? 2.0 : goombaFrame;\n if ( goombaX >= 0.0 && goombaX <= 15.0 )\n {\n SpriteGoomba( color, goombaX, goombaY, goombaFrame );\n } \n \n // draw walking Goombas\n goombaFrame \t\t= floor( mod( time * 5.0, 2.0 ) );\n float goombaWalkX \t= worldX + floor( time * GOOMBA_SPEED );\n goombaX \t\t\t= goombaWalkX - 3850.0 - 24.0;\n if ( goombaX < 0.0 ) goombaX = goombaWalkX - 3850.0;\n if ( goombaX < 0.0 ) goombaX = goombaWalkX - 2850.0;\n if ( goombaX < 0.0 ) goombaX = goombaWalkX - 2760.0 - 24.0;\n if ( goombaX < 0.0 ) goombaX = goombaWalkX - 2540.0 - 24.0;\n if ( goombaX < 0.0 ) goombaX = goombaWalkX - 2150.0 - 24.0;\n if ( goombaX < 0.0 ) goombaX = worldX - 766.0 - floor( abs( mod( ( time + 6.3 ) * GOOMBA_SPEED, 2.0 * 108.0 ) - 108.0 ) );\n if ( goombaX < 0.0 ) goombaX = worldX - 638.0 - floor( abs( mod( ( time + 6.6 ) * GOOMBA_SPEED, 2.0 * 84.0 ) - 84.0 ) );\n if ( goombaX < 0.0 ) goombaX = goombaWalkX - 435.0;\n if ( goombaX >= 0.0 && goombaX <= 15.0 )\n {\n SpriteGoomba( color, goombaX, goombaY, goombaFrame );\n }\n \n\n \n // Mario jump\n float marioBigJump1 \t= 27.1;\n float marioBigJump2 \t= 29.75;\n float marioBigJump3 \t= 35.05; \n float marioJumpTime \t= 0.0;\n float marioJumpScale\t= 0.0;\n \n if ( time >= 4.2 ) { marioJumpTime = 4.2; marioJumpScale = 0.45; }\n if ( time >= 5.0 ) { marioJumpTime = 5.0; marioJumpScale = 0.5; }\n if ( time >= 6.05 ) { marioJumpTime = 6.05; marioJumpScale = 0.7; }\n if ( time >= 7.8 ) { marioJumpTime = 7.8; marioJumpScale = 0.8; }\n if ( time >= 9.0 ) { marioJumpTime = 9.0; marioJumpScale = 1.0; }\n if ( time >= 10.3 ) { marioJumpTime = 10.3; marioJumpScale = 0.3; }\n if ( time >= 11.05 ) { marioJumpTime = 11.05; marioJumpScale = 1.0; }\n if ( time >= 13.62 ) { marioJumpTime = 13.62; marioJumpScale = 0.45; }\n if ( time >= 15.1 ) { marioJumpTime = 15.1; marioJumpScale = 0.5; }\n if ( time >= 18.7 ) { marioJumpTime = 18.7; marioJumpScale = 0.6; }\n if ( time >= 19.65 ) { marioJumpTime = 19.65; marioJumpScale = 0.45; }\n if ( time >= 20.29 ) { marioJumpTime = 20.29; marioJumpScale = 0.3; }\n if ( time >= 21.8 ) { marioJumpTime = 21.8; marioJumpScale = 0.35; }\n if ( time >= 22.3 ) { marioJumpTime = 22.3; marioJumpScale = 0.35; }\n if ( time >= 23.0 ) { marioJumpTime = 23.0; marioJumpScale = 0.40; }\n if ( time >= 23.5 ) { marioJumpTime = 23.5; marioJumpScale = 0.3; }\n if ( time >= 24.7 ) { marioJumpTime = 24.7; marioJumpScale = 0.45; }\n if ( time >= 25.3 ) { marioJumpTime = 25.3; marioJumpScale = 0.3; }\n if ( time >= 25.75 ) { marioJumpTime = 25.75; marioJumpScale = 0.4; }\n if ( time >= 26.3 ) { marioJumpTime = 26.3; marioJumpScale = 0.25; }\n if ( time >= marioBigJump1 ) \t\t{ marioJumpTime = marioBigJump1; \t\tmarioJumpScale = 1.0; }\n if ( time >= marioBigJump1 + 1.0 ) \t{ marioJumpTime = marioBigJump1 + 1.0; \tmarioJumpScale = 0.6; }\n if ( time >= marioBigJump2 ) \t\t{ marioJumpTime = marioBigJump2; \t\tmarioJumpScale = 1.0; }\n if ( time >= marioBigJump2 + 1.0 ) \t{ marioJumpTime = marioBigJump2 + 1.0;\tmarioJumpScale = 0.6; } \n if ( time >= 32.3 ) { marioJumpTime = 32.3; marioJumpScale = 0.7; }\n if ( time >= 33.7 ) { marioJumpTime = 33.7; marioJumpScale = 0.3; }\n if ( time >= 34.15 ) { marioJumpTime = 34.15; marioJumpScale = 0.45; }\n if ( time >= marioBigJump3 ) \t\t\t\t{ marioJumpTime = marioBigJump3; \t\t\t\tmarioJumpScale = 1.0; }\n if ( time >= marioBigJump3 + 1.2 ) \t\t\t{ marioJumpTime = marioBigJump3 + 1.2; \t\t\tmarioJumpScale = 0.89; }\n if ( time >= marioBigJump3 + 1.2 + 0.75 ) \t{ marioJumpTime = marioBigJump3 + 1.2 + 0.75; \tmarioJumpScale = 0.5; }\n \n float marioJumpOffset \t\t= 0.0;\n float marioJumpLength \t\t= 1.5 * marioJumpScale;\n float marioJumpAmplitude\t= 76.0 * marioJumpScale;\n if ( time >= marioJumpTime && time <= marioJumpTime + marioJumpLength )\n {\n float t = ( time - marioJumpTime ) / marioJumpLength;\n marioJumpOffset = floor( sin( t * 3.14 ) * marioJumpAmplitude );\n }\n \n \n // Mario land\n float marioLandTime \t= 0.0;\n float marioLandAplitude = 0.0;\n if ( time >= marioBigJump1 + 1.0 + 0.45 ) \t\t\t{ marioLandTime = marioBigJump1 + 1.0 + 0.45; \t\t\tmarioLandAplitude = 109.0; }\n if ( time >= marioBigJump2 + 1.0 + 0.45 ) \t\t\t{ marioLandTime = marioBigJump2 + 1.0 + 0.45; \t\t\tmarioLandAplitude = 109.0; }\n\tif ( time >= marioBigJump3 + 1.2 + 0.75 + 0.375 ) \t{ marioLandTime = marioBigJump3 + 1.2 + 0.75 + 0.375; \tmarioLandAplitude = 150.0; }\n \n float marioLandLength = marioLandAplitude / 120.0;\n\tif ( time >= marioLandTime && time <= marioLandTime + marioLandLength )\n {\n float t = 0.5 * ( time - marioLandTime ) / marioLandLength + 0.5;\n \tmarioJumpOffset = floor( sin( t * 3.14 ) * marioLandAplitude );\n }\n \n \n // Mario flag jump\n marioJumpTime \t\t= flagPauseStart - 0.3;\n marioJumpLength \t= 1.5 * 0.45;\n marioJumpAmplitude\t= 76.0 * 0.45;\n if ( time >= marioJumpTime && time <= marioJumpTime + marioJumpLength + flagPauseLength ) \n {\n float time2 = time;\n if ( time >= flagPauseStart && time <= flagPauseStart + flagPauseLength ) \n {\n time2 = flagPauseStart;\n }\n else if ( time >= flagPauseStart )\n {\n time2 = time - flagPauseLength;\n }\n\t\tfloat t = ( time2 - marioJumpTime ) / marioJumpLength;\n marioJumpOffset = floor( sin( t * 3.14 ) * marioJumpAmplitude );\n }\n \n\n // Mario base (ground offset)\n float marioBase = 0.0;\n if ( time >= marioBigJump1 + 1.0 && time < marioBigJump1 + 1.0 + 0.45 )\n {\n marioBase = 16.0 * 4.0;\n }\n if ( time >= marioBigJump2 + 1.0 && time < marioBigJump2 + 1.0 + 0.45 )\n {\n marioBase = 16.0 * 4.0;\n } \n if ( time >= marioBigJump3 + 1.2 && time < marioBigJump3 + 1.2 + 0.75 )\n {\n marioBase = 16.0 * 3.0;\n } \n if ( time >= marioBigJump3 + 1.2 + 0.75 && time < marioBigJump3 + 1.2 + 0.75 + 0.375 )\n {\n marioBase = 16.0 * 7.0;\n }\n\n float marioX\t\t= pixelX - 112.0;\n float marioY\t\t= pixelY - 16.0 - 8.0 - marioBase - marioJumpOffset; \n float marioFrame \t= marioJumpOffset == 0.0 ? floor( mod( time * 10.0, 3.0 ) ) : 3.0;\n if ( time >= mushroomPauseStart && time <= mushroomPauseStart + mushroomPauseLength )\n {\n \tmarioFrame = 1.0;\n } \n if ( time > mushroomPauseStart + 0.7 )\n {\n float t = time - mushroomPauseStart - 0.7;\n \tif ( mod( t, 0.2 ) <= mix( 0.0, 0.2, clamp( t / 1.3, 0.0, 1.0 ) ) )\n {\n // super mario offset\n marioFrame += 4.0;\n }\n } \n if ( marioX >= 0.0 && marioX <= 15.0 && cameraX < 3152.0 )\n {\n SpriteMario( color, marioX, marioY, marioFrame );\n }\n}\n\nvec2 CRTCurveUV( vec2 uv )\n{\n uv = uv * 2.0 - 1.0;\n vec2 offset = abs( uv.yx ) / vec2( 6.0, 4.0 );\n uv = uv + uv * offset * offset;\n uv = uv * 0.5 + 0.5;\n return uv;\n}\n\nvoid DrawVignette( inout vec3 color, vec2 uv )\n{ \n float vignette = uv.x * uv.y * ( 1.0 - uv.x ) * ( 1.0 - uv.y );\n vignette = clamp( pow( 16.0 * vignette, 0.3 ), 0.0, 1.0 );\n color *= vignette;\n}\n\nvoid DrawScanline( inout vec3 color, vec2 uv )\n{\n float scanline \t= clamp( 0.95 + 0.05 * cos( 3.14 * ( uv.y + 0.008 * iTime ) * 240.0 * 1.0 ), 0.0, 1.0 );\n float grille \t= 0.85 + 0.15 * clamp( 1.5 * cos( 3.14 * uv.x * 640.0 * 1.0 ), 0.0, 1.0 ); \n color *= scanline * grille * 1.2;\n}\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n // we want to see at least 224x192 (overscan) and we want multiples of pixel size\n float resMultX = floor( iResolution.x / 224.0 );\n float resMultY = floor( iResolution.y / 192.0 );\n float resRcp\t= 1.0 / max( min( resMultX, resMultY ), 1.0 );\n \n float time\t\t\t= iTime;\n float screenWidth\t= floor( iResolution.x * resRcp );\n float screenHeight\t= floor( iResolution.y * resRcp );\n float pixelX \t\t= floor( fragCoord.x * resRcp );\n float pixelY \t\t= floor( fragCoord.y * resRcp );\n\n vec3 color = RGB( 92, 148, 252 );\n \tDrawGame( color, time, pixelX, pixelY, screenWidth, screenHeight );\n if ( time < INTRO_LENGTH )\n {\n DrawIntro( color, pixelX, pixelY, screenWidth, screenHeight );\n } \n\n \n // CRT effects (curvature, vignette, scanlines and CRT grille)\n vec2 uv = fragCoord.xy / iResolution.xy;\n vec2 crtUV = CRTCurveUV( uv );\n if ( crtUV.x < 0.0 || crtUV.x > 1.0 || crtUV.y < 0.0 || crtUV.y > 1.0 )\n {\n color = vec3( 0.0, 0.0, 0.0 );\n }\n DrawVignette( color, crtUV );\n DrawScanline( color, uv );\n \n\tfragColor.xyz \t= color;\n fragColor.w\t\t= 1.0;\n}\n","type":"Image"}]}