-
Notifications
You must be signed in to change notification settings - Fork 5
/
fnaw.js
8 lines (8 loc) · 51.1 KB
/
fnaw.js
1
2
3
4
5
6
7
8
/*
* Copyright (C) 2018 Calder Young. All Rights Reserved.
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to Creative
* Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
const DEBUG=!1,width=1280,height=720,aspect=16/9,updateRate=30,frameTime=1e3/30;DEBUG&&window.addEventListener("error",function(e){return alert("ERROR: "+e.message+"\n"+e.filename+":"+e.lineno+"e.colno"),!1}),window.addEventListener("load",async function(){const e=document.getElementById("webglcanvas"),t=document.getElementById("2dcanvas"),a=e.getContext("webgl"),i=t.getContext("2d");var n;i.imageSmoothingEnabled=!1;try{var r=window.AudioContext||window.webkitAudioContext;n=new r}catch(e){return void alert("your browser does not support AudioContexts so yoo bad you can't play")}const o=n.destination;if(!(a&&a instanceof WebGLRenderingContext))return void alert("your browser does not support webgl so too bad you can't play");var s=1,c=1,l=0,m=0,f=0,u=0,d=!1,p=1,w=1,g=!1,h=!1,T=!1,E=!0,b=!1,x=!1,v=!0,R=[],y=[],_=[];function D(){var n=window.innerWidth,r=n/aspect;r>window.innerHeight&&window.innerHeight/r<.87&&(n=(r=window.innerHeight)*aspect);var o=Math.min(n,window.innerWidth),f=Math.min(r,window.innerHeight);E=!(window.screen.width-o<20&&window.screen.height-f<20),document.fullscreenElement&&(E=!1),e.width=o,e.height=f,t.width=o,t.height=f,s=o/width,c=f/height,i.setTransform(s,0,0,c,0,0),a.viewport(0,0,o,f),l=(window.innerWidth-o)/2,m=(window.innerHeight-f)/2,l>0||m>0?(!0,H()):!1,e.style.top=m+"px",e.style.left=l+"px",t.style.top=m+"px",t.style.left=l+"px"}function U(e){f=Math.floor((e.clientX-l)/s),u=Math.floor((e.clientY-m)/c),f<0&&(f=0),u<0&&(u=0),f>width&&(f=width),u>height&&(u=height)}function A(){try{document.body.requestFullscreen()}catch(e){try{document.body.webkitRequestFullscreen()}catch(e){try{document.body.mozRequestFullscreen()}catch(e){}}}}async function X(e){return new Promise((t,i)=>{const n=new Image;n.onload=function(){const e=a.createTexture();a.bindTexture(a.TEXTURE_2D,e),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,n),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),t(e)},n.onerror=i,n.src=e})}async function k(e){let t={buf:e,sync:0,retry:0};return new Promise((e,a)=>{!function e(t,a,i){n.decodeAudioData(t.buf,a,function(n){!function(e){var t=new Uint8Array(e.buf);t.indexOf=Array.prototype.indexOf;for(var a=e.sync,i=t;e.retry++,!(-1==(a=i.indexOf(255,a))||!0&i[a+1]);)a++;if(-1!=a){var n=e.buf.slice(a);return delete e.buf,e.buf=null,e.buf=n,e.sync=a,!0}return!1}(t)?i(n):e(t,a,i)})}(t,function(t){t.buffer=I,e(t)},function(e){a(e)})})}window.addEventListener("resize",D),window.addEventListener("mousemove",U),window.addEventListener("mousedown",function(){!0,g=!0,h=!0,T=!0,DEBUG&&console.log("[x: "+f+", y: "+u+"]")}),window.addEventListener("mouseup",function(){g=!1||d}),window.addEventListener("keydown",function(e){R[e.keyCode]=!0,y[e.keyCode]=!0,_[e.keyCode]=!0}),window.addEventListener("keyup",function(e){R[e.keyCode]=!1}),window.addEventListener("touchmove",function(e){v||(U(e.touches[0]),p=e.touches[0].radiusX,p=e.touches[0].radiusY,e.preventDefault())}),window.addEventListener("touchstart",function(e){v||(U(e.touches[0]),p=e.touches[0].radiusX,p=e.touches[0].radiusY,d=!0,g=!0,h=!0,T=!0,e.preventDefault())}),window.addEventListener("touchend",function(e){v||(d=!1,g=!1,e.preventDefault())}),window.addEventListener("touchcancel",function(e){v||(d=!1,g=!1,e.preventDefault())}),window.addEventListener("contextmenu",function(e){return e.preventDefault(),e.cancelBubble=!0,!1}),document.addEventListener("selectstart",function(e){return e.preventDefault(),!1});var F=[];function I(){const e=n.createBufferSource();return F.push(e),e.addEventListener("ended",function(){var t=F.indexOf(e);-1!=t&&F.splice(t,1)}),e.buffer=this,e}function L(){for(var e=0;e<F.length;e++)F[e].stop();F=[]}function j(e,t,a){const i=e.buffer();a&&(i.loop=!0),i.connect(t),i.start()}function S(){const e=J.scream.buffer();e.connect(K.main),e.start(0,.05)}function M(e,t,a,i){const r=e.buffer();i&&(r.loop=!0);const o=n.createGain();r.connect(o),oa(o,t),o.connect(a),r.start()}function C(){a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST)}function B(){a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR)}const N=await X("smile.jpg");function G(e,t){i.fillText(e,(1280-i.measureText(e).width)/2,t)}function O(e,t,a){i.fillText(e,1280-i.measureText(e).width-t,a)}function P(e,t,a){i.fillText(t,(1280-i.measureText(e).width)/2,a)}function H(){return Date.now()}H();function V(e,t){const i=a.createShader(e);return a.shaderSource(i,t),a.compileShader(i),a.getShaderParameter(i,a.COMPILE_STATUS)?i:(console.log("shader error: "+a.getShaderInfoLog(i)),a.deleteShader(i),null)}function z(e,t){const i=a.createProgram();return a.attachShader(i,e),a.attachShader(i,t),a.linkProgram(i),a.getProgramParameter(i,a.LINK_STATUS)?new Y(i):(console.log("program error: "+a.getProgramInfoLog(i)),a.deleteProgram(i),null)}function Y(e){this.id=e,this.attributes={},this.uniforms={}}Y.prototype.attribute=function(e){this.attributes[e]=a.getAttribLocation(this.id,e)},Y.prototype.uniform=function(e){this.uniforms[e]=a.getUniformLocation(this.id,e)},Y.prototype.bind=function(){a.useProgram(this.id)};var q={},W={},J={},K={},Q=a.createBuffer();function Z(e){a.bindBuffer(a.ARRAY_BUFFER,Q),e.bind(),Ee.exportTo(e);var t=e.attributes.vert;a.vertexAttribPointer(t,2,a.FLOAT,!1,0,0),a.enableVertexAttribArray(t),a.drawArrays(a.TRIANGLES,0,6),a.disableVertexAttribArray(t)}function $(e){a.bindBuffer(a.ARRAY_BUFFER,Q),le.bind(),a.uniform1f(le.uniforms.alpha,e),Ee.exportTo(le);var t=le.attributes.vert;a.vertexAttribPointer(t,2,a.FLOAT,!1,0,0),a.enableVertexAttribArray(t),a.drawArrays(a.TRIANGLES,0,6),a.disableVertexAttribArray(t)}function ee(e){a.bindBuffer(a.ARRAY_BUFFER,Q),me.bind(),a.uniform4fv(me.uniforms.color,e),Ee.exportTo(me);var t=me.attributes.vert;a.vertexAttribPointer(t,2,a.FLOAT,!1,0,0),a.enableVertexAttribArray(t),a.drawArrays(a.TRIANGLES,0,6),a.disableVertexAttribArray(t)}a.bindBuffer(a.ARRAY_BUFFER,Q),a.bufferData(a.ARRAY_BUFFER,new Float32Array([0,0,1,0,1,1,0,0,1,1,0,1]),a.STATIC_DRAW);const te="#define multimatrix(mat1,mat2,vec) vec2(mat1.x*vec.x + mat1.y*vec.y + mat1.z, mat2.x*vec.x + mat2.y*vec.y + mat2.z)",ae=V(a.VERTEX_SHADER,"#version 100\n "+te+"\n precision mediump float; attribute vec2 vert; varying vec2 uv; uniform vec3 matrixr1; uniform vec3 matrixr2; void main(){ uv = vert; gl_Position = vec4(vec2(-1,1) + multimatrix(matrixr1,matrixr2,vert) / vec2(640,360), 0, 1.0); }"),ie=V(a.FRAGMENT_SHADER,"#version 100\n precision mediump float; varying vec2 uv; uniform sampler2D tex; void main(){ gl_FragColor = texture2D(tex, uv); }"),ne=V(a.FRAGMENT_SHADER,"#version 100\n precision mediump float; varying vec2 uv; uniform vec4 color; void main(){ gl_FragColor = color; }"),re=V(a.FRAGMENT_SHADER,"#version 100\n precision mediump float; varying vec2 uv; uniform float alpha; uniform sampler2D tex; void main(){ gl_FragColor = texture2D(tex, uv); gl_FragColor *= alpha; }"),oe=V(a.VERTEX_SHADER,"#version 100\n "+te+"\n precision mediump float; attribute vec2 vert; varying vec2 xy; varying vec2 uv; uniform vec3 matrixr1; uniform vec3 matrixr2; void main(){ vec2 eagler = vec2(-1,1) + multimatrix(matrixr1,matrixr2,vert) / vec2(640,360); xy = eagler; uv = vert; gl_Position = vec4(eagler, 0, 1.0); }"),se=V(a.FRAGMENT_SHADER,"#version 100\n precision mediump float; varying vec2 xy; varying vec2 uv; uniform sampler2D tex; uniform float warp; uniform float heightfac; void main(){ float CurrentSinStep = xy.x / (2.0/3.1415) + 3.1415/2.0; float v = ((uv.y * heightfac) - xy.y * (((sin(CurrentSinStep) / (3.1415/2.0)) - 0.5) * warp - (warp/2.0/3.1415)))/heightfac; gl_FragColor = texture2D(tex, vec2(uv.x, v)); }"),ce=z(ae,ie);ce.attribute("vert"),ce.uniform("matrixr1"),ce.uniform("matrixr2"),ce.uniform("tex");const le=z(ae,re);le.attribute("vert"),le.uniform("matrixr1"),le.uniform("matrixr2"),le.uniform("tex"),le.uniform("alpha");const me=z(ae,ne);me.attribute("vert"),me.uniform("matrixr1"),me.uniform("matrixr2"),me.uniform("color");const fe=z(oe,se);fe.attribute("vert"),fe.uniform("matrixr1"),fe.uniform("matrixr2"),fe.uniform("tex"),fe.uniform("warp"),fe.uniform("heightfac");var ue=.3,de=1;function pe(e,t){e==ue&&t==de||(e!=ue&&(a.uniform1f(fe.uniforms.warp,e),DEBUG&&console.log("setting warp: "+e)),t!=de&&(a.uniform1f(fe.uniforms.heightfac,t),DEBUG&&console.log("setting heightfac: "+t)),ue=e,de=t)}fe.bind(),a.uniform1f(fe.uniforms.warp,.3),a.uniform1f(fe.uniforms.heightfac,1),a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA);var we=0,ge=0,he=new XMLHttpRequest;he.responseType="arraybuffer",he.addEventListener("progress",function(e){we=e.loaded/e.total}),he.addEventListener("load",function(e){we=1,untar(he.response).progress(function(e){q[e.name]={buffer:e.buffer,url:e.getBlobUrl()}}).then(async function(e){W.sstatic={},W.sstatic.norm=[],W.sstatic.scan=[],W.sstatic.heavyscan=[];for(var t=0;t<6;t++)W.sstatic.norm[t]=await X(q["img/ui/static/norm/"+t+".jpg"].url);for(t=0;t<7;t++)W.sstatic.scan[t]=await X(q["img/ui/static/scan/"+t+".png"].url);for(t=0;t<5;t++)W.sstatic.heavyscan[t]=await X(q["img/ui/static/heavyscan/"+t+".png"].url);W.title=await X(q["img/ui/title.jpg"].url),W.titletext=await X(q["img/ui/titletext.png"].url),W.titletext2=await X(q["img/ui/titletext2.png"].url),W.titlenight=[];for(t=1;t<=5;t++)W.titlenight[t]=await X(q["img/ui/night"+t+".png"].url);W.title6th=await X(q["img/ui/6thnight.png"].url),W.title7th=await X(q["img/ui/7thnight.png"].url),W.titlebottom=await X(q["img/ui/bottom.png"].url),W.titletop=await X(q["img/ui/top.png"].url),W.titlestar=await X(q["img/ui/winston.png"].url),W.titleselector=await X(q["img/ui/selector.png"].url),W.sticky1=await X(q["img/ui/sticky1.jpg"].url),W.sticky2=await X(q["img/ui/sticky2.jpg"].url),W.sticky3=await X(q["img/ui/sticky3.jpg"].url),W.sticky4=await X(q["img/ui/sticky4.jpg"].url),W.sticky4=await X(q["img/ui/sticky4.jpg"].url),W.foundsticky=await X(q["img/ui/foundsticky.png"].url),W.skipcall=await X(q["img/ui/skipcall.png"].url),W.mutecall=await X(q["img/ui/mutecall.png"].url),W.customnight=await X(q["img/ui/custom.jpg"].url),W.x=await X(q["img/ui/x.png"].url),W.check1=await X(q["img/ui/check1.jpg"].url),W.check2=await X(q["img/ui/check2.jpg"].url),W.check3=await X(q["img/ui/check3.jpg"].url),W.death=await X(q["img/ui/death.jpg"].url),W.office={},W.office.normal=await X(q["img/office/normal.jpg"].url),W.office.dark1=await X(q["img/office/dark1.jpg"].url),W.office.dark2=await X(q["img/office/dark2.jpg"].url),W.office.llight=await X(q["img/office/llight.jpg"].url),W.office.llightl=await X(q["img/office/llightl.jpg"].url),W.office.llights=await X(q["img/office/llights.jpg"].url),W.office.rlight=await X(q["img/office/rlight.jpg"].url),W.office.rlightw=await X(q["img/office/rlightw.jpg"].url),W.office.rlights=await X(q["img/office/rlights.jpg"].url),W.office.tablewinston=await X(q["img/office/winston.jpg"].url),W.office.ldoor=[];for(t=0;t<8;t++)W.office.ldoor[t]=await X(q["img/office/dl"+t+".jpg"].url);W.office.rdoor=[];for(t=0;t<8;t++)W.office.rdoor[t]=await X(q["img/office/dr"+t+".jpg"].url);W.office.ldoor.d=await X(q["img/office/dld.jpg"].url),W.office.ldoor.l=await X(q["img/office/dll.jpg"].url),W.office.rdoor.d=await X(q["img/office/drd.jpg"].url),W.office.rdoor.l=await X(q["img/office/drl.jpg"].url),W.office.camzone=await X(q["img/ui/camflip.png"].url),W.office.cammap=await X(q["img/ui/map.png"].url),W.office.overlay=await X(q["img/ui/overlay.png"].url),W.office.rec=await X(q["img/ui/rec.png"].url),W.office.cam_anim=[];for(t=0;t<10;t++)W.office.cam_anim[t]=await X(q["img/ui/cam"+t+".png"].url);W.office.js={},W.office.js.longarms=[];for(t=0;t<25;t++)W.office.js.longarms[t]=await X(q["img/office/jscares/l"+t+".jpg"].url);W.office.js.wierdclimber=[];for(t=0;t<10;t++)W.office.js.wierdclimber[t]=await X(q["img/office/jscares/w"+t+".jpg"].url);W.office.js.charles=[];for(t=0;t<20;t++)W.office.js.charles[t]=await X(q["img/office/jscares/c"+t+".jpg"].url);W.office.js.lax=[];for(t=0;t<18;t++)W.office.js.lax[t]=await X(q["img/office/jscares/d"+t+".jpg"].url);W.office.js.winston=[];for(t=0;t<15;t++)W.office.js.winston[t]=await X(q["img/office/jscares/s"+t+".jpg"].url);W.office.js.winstondark=[];for(t=0;t<16;t++)W.office.js.winstondark[t]=await X(q["img/office/jscares/s2"+t+".jpg"].url);W.laxhall=[];for(t=0;t<21;t++)W.laxhall[t]=await X(q["img/cams/laxdude/"+t+".jpg"].url);async function a(e,t){return X(q["img/cams/cam"+e+t+".jpg"].url)}async function i(e,t,a){W.cams[e]["n"+a]=await X(q["img/cams/cam"+t+a+".jpg"].url)}W.winstedcam=await X(q["img/cams/winston.png"].url),W.cams=[],W.cams[0]={},i(0,"00",""),i(0,"00","c0"),i(0,"00","c1"),i(0,"00","l1"),i(0,"00","l1c0"),i(0,"00","l1c1"),W.cams[1]={},i(1,"01",""),i(1,"01","c2"),i(1,"01","c2d2"),i(1,"01","c2d3"),i(1,"01","c2d4"),i(1,"01","d2"),i(1,"01","d3"),i(1,"01","d4"),i(1,"01","l3"),i(1,"01","l3c2"),i(1,"01","l3c2d2"),i(1,"01","l3c2d3"),i(1,"01","l3c2d4"),i(1,"01","l3d2"),i(1,"01","l3d3"),i(1,"01","l3d4"),i(1,"01","l3w3"),i(1,"01","w3d3"),W.cams[2]={},i(2,"02",""),i(2,"02","d1"),i(2,"02","d2"),i(2,"02","d3"),i(2,"02","d4"),i(2,"02","l3"),i(2,"02","l3d1"),i(2,"02","l3d2"),i(2,"02","l3d3"),i(2,"02","l3d4"),i(2,"02","l3w3"),i(2,"02","l3w3d1"),i(2,"02","l3w3d3"),i(2,"02","w3"),i(2,"02","w3d1"),i(2,"02","w3d2"),i(2,"02","w3d3"),W.cams[3]={},i(3,"03",""),i(3,"03","c4"),i(3,"03","l4"),i(3,"03","l4c4"),i(3,"03","w4"),W.cams[4]={},i(4,"04",""),i(4,"04","c6"),i(4,"04","l5"),i(4,"04","l6"),W.cams[5]={},i(5,"05",""),W.cams[6]={},i(6,"06",""),i(6,"06","c11"),i(6,"06","l11"),i(6,"06","l11w11"),i(6,"06","l21"),i(6,"06","w11"),i(6,"06","w12"),i(6,"06","w21"),W.cams[7]={},i(7,"07",""),i(7,"07","c10"),i(7,"07","l10"),W.cams[8]={},i(8,"08",""),W.cams[9]={},i(9,"09",""),i(9,"09","w24"),W.cams[10]={},i(10,"10",""),i(10,"10","w20"),W.cams[11]={},i(11,"11",""),W.cams[12]={},i(12,"12",""),W.cams[13]={},i(13,"13",""),i(13,"13","c13"),i(13,"13","w13"),i(13,"13","w16"),W.cams[14]={},i(14,"14",""),i(14,"14","c14"),i(14,"14","w14"),W.cams[15]={},i(15,"15",""),i(15,"15","w15"),W.cams[16]={},W.cams[16].d={},W.cams[16].l={},W.cams[16].r={},W.cams[16].n=await a("16",""),W.cams[16].d.l4=await a("16","dl4"),W.cams[16].d.l4c4=await a("16","dl4c4"),W.cams[16].d.w4=await a("16","dw4"),W.cams[16].l.l7=await a("16","ll7"),W.cams[16].l.lt=await a("16","llt"),W.cams[16].l.lf=await a("16","llf"),W.cams[16].l.w7=await a("16","lw7"),W.cams[16].l.wt=await a("16","lwt"),W.cams[16].l.wf=await a("16","lwf"),W.cams[16].r.l18=await a("16","rl18"),W.cams[16].r.lt=await a("16","rlt"),W.cams[16].r.lf=await a("16","rlf"),W.cams[17]={},i(17,"17",""),J.amb=[],J.amb[0]=await k(q["sounds/amb1.mp3"].buffer),J.amb[1]=await k(q["sounds/amb2.mp3"].buffer),J.amb[2]=await k(q["sounds/amb3.mp3"].buffer),J.title=await k(q["sounds/title.mp3"].buffer),J.nightend=await k(q["sounds/nightend.mp3"].buffer),J.static1=await k(q["sounds/static1.mp3"].buffer),J.static2=await k(q["sounds/static2.mp3"].buffer),J.camopen=await k(q["sounds/camopen.mp3"].buffer),J.camclose=await k(q["sounds/camclose.mp3"].buffer),J.camswitch=await k(q["sounds/camswitch.mp3"].buffer),J.lights=await k(q["sounds/lights.wav"].buffer),J.office=await k(q["sounds/office.wav"].buffer),J.staticloop=await k(q["sounds/staticloop.wav"].buffer),J.door=await k(q["sounds/door.mp3"].buffer),J.deee=await k(q["sounds/deee.mp3"].buffer),J.toilet=await k(q["sounds/toilet.mp3"].buffer),J.doorerr=await k(q["sounds/yee2.mp3"].buffer),J.powerloss=await k(q["sounds/powerloss.mp3"].buffer),J.sticknya=await k(q["sounds/stick_n_ya2.mp3"].buffer),J.footsteps=[];for(t=0;t<6;t++)J.footsteps[t]=await k(q["sounds/moving"+(t+1)+".mp3"].buffer);J.boilerroom=[];for(t=0;t<7;t++)J.boilerroom[t]=await k(q["sounds/boiler"+(t+1)+".mp3"].buffer);J.random=[];for(t=0;t<2;t++)J.random[t]=await k(q["sounds/random"+(t+1)+".mp3"].buffer);J.loud=[];for(t=0;t<5;t++)J.loud[t]=await k(q["sounds/loud"+(t+1)+".mp3"].buffer);J.atdoor=[];for(t=0;t<3;t++)J.atdoor[t]=await k(q["sounds/atdoor"+(t+1)+".mp3"].buffer);J.scream=await k(q["sounds/scream.mp3"].buffer),J.call=[];for(t=0;t<7;t++)J.call[t]=await k(q["sounds/phonecall"+(t+1)+".mp3"].buffer);J.longarms=await k(q["sounds/heyDude.mp3"].buffer),J.weirdclimber=await k(q["sounds/eagler.mp3"].buffer),J.winston=await k(q["sounds/yee3.mp3"].buffer),J.laxdudecart=await k(q["sounds/cart.mp3"].buffer),J.laxdudecrash=await k(q["sounds/crash.mp3"].buffer),J.winstonsong=await k(q["sounds/winstonsong.mp3"].buffer),J.stickyopen=await k(q["sounds/stickyopen.mp3"].buffer),J.glitch=[];for(t=0;t<4;t++)J.glitch[t]=await k(q["sounds/glitch"+(t+1)+".mp3"].buffer);function r(){!function e(){var t=J.glitch[xe(0,3)],a=n.createBufferSource();a.buffer=t,a.connect(K.camglitch),setTimeout(e,Math.floor(1e3*t.duration)),a.start()}(),K.ambience=n.createGain(),oa(K.ambience,.2),K.ambience.connect(o),K.lights=n.createGain(),oa(K.lights,0),K.lights.connect(o);var e=n.createBufferSource();e.buffer=J.lights,e.loop=!0,e.connect(K.lights),e.start(),K.office=n.createGain(),oa(K.office,0),K.office.connect(o);var t=n.createBufferSource();t.buffer=J.office,t.loop=!0,t.connect(K.office),t.start(),K.sstatic=n.createGain(),oa(K.sstatic,0),K.sstatic.connect(o);var a=n.createBufferSource();a.buffer=J.staticloop,a.loop=!0,a.connect(K.sstatic),a.start()}K.main=o,K.mute=n.createGain(),oa(K.mute,0),K.mute.connect(o),K.half=n.createGain(),oa(K.half,.5),K.half.connect(o),K.camglitch=n.createGain(),oa(K.camglitch,0),K.camglitch.connect(o),K.call=n.createGain(),oa(K.call,1),K.call.connect(o);var s,c,l='<svg xmlns="http://www.w3.org/2000/svg" width="700" height="500"><foreignObject width="100%" height="100%"><body xmlns="http://www.w3.org/1999/xhtml" style="font-size:14px;color:white;"><div style="font-family:monospace;">'+decodeURIComponent(escape(String.fromCharCode.apply(null,new Uint8Array(q["copydisclaimermarkup.txt"].buffer))))+"</div></body></foreignObject></svg>";W.copyinfo=await async function(e){return new Promise((t,a)=>{let i=new Image;i.onload=(()=>t(i)),i.onerror=a,i.src=e})}("data:image/svg+xml,"+encodeURIComponent(l)),c=!1,s=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(s)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(s.substr(0,4)))&&(c=!0),c?(alert("five nights at winston's works on mobile but is near impossible to play on most devices"),x=!0,v=!0,document.getElementById("mobilebutton").style.display="block",document.getElementById("allowsound").addEventListener("click",function(){A(),j(J.camopen,K.main),r(),document.getElementById("mobilebutton").style.display="none",setTimeout(function(){v=!1,ge=1},1e3),zt()}),document.getElementById("enterfull").addEventListener("click",function(){setTimeout(function(){v=!1},1e3),A(),document.getElementById("fullscreen").style.display="none"}),document.getElementById("hidefull").addEventListener("click",function(){setTimeout(function(){v=!1},1e3),document.getElementById("fullscreen").style.display="none"})):(r(),ge=1,setTimeout(function(){v=!1},1e3),zt())})}),he.open("GET","assets.tar",!0),he.send(),D();var Te=100,Ee={state:[1,0,0,0,1,0],stack:[],push:function(){Ee.stack.push(Ee.state)},pop:function(){Ee.state=Ee.stack.pop(),Ee.state||Ee.loadIdentity()},reset:function(){Ee.loadIdentity(),Ee.stack=[]},loadIdentity:function(){Ee.state=[1,0,0,0,1,0]},multiplyVec2:function(e){return[Ee.state[0]*e[0]+Ee.state[1]*e[1]+Ee.state[2],Ee.state[3]*e[0]+Ee.state[4]*e[1]+Ee.state[5]]},multiplyMat2:function(e){return[Ee.state[0]*e[0]+Ee.state[1]*e[3],Ee.state[0]*e[1]+Ee.state[1]*e[4],Ee.state[0]*e[2]+Ee.state[1]*e[5]+Ee.state[2],Ee.state[3]*e[0]+Ee.state[4]*e[3],Ee.state[3]*e[1]+Ee.state[4]*e[4],Ee.state[3]*e[2]+Ee.state[4]*e[5]+Ee.state[5]]},translate:function(e){Ee.state=Ee.multiplyMat2([1,0,e[0],0,1,e[1]])},rotate:function(e){var t=.0174533*e;Ee.state=Ee.multiplyMat2([Math.cos(t),Math.sin(t),0,-Math.sin(t),Math.cos(t),0])},scale:function(e){Ee.state=Ee.multiplyMat2([e[0],0,0,0,e[1],0])},exportTo:function(e){a.uniform3f(e.uniforms.matrixr1,Ee.state[0],Ee.state[1],Ee.state[2]),a.uniform3f(e.uniforms.matrixr2,Ee.state[3],Ee.state[4],Ee.state[5])}};function be(e,t,a,i){return d?f>=e-p&&f<=a+p&&u>=t-w&&u<=i+w:f>=e&&f<=a&&u>=t&&u<=i}function xe(e,t){return Math.floor(Math.random()*(t-e+1))+e}var ve=1,Re=ve,ye=0,_e=H(),De=!1,Ue=!1,Ae=0,Xe=0,ke=!1,Fe=!1,Ie=0,Le=!1,je=0,Se=0,Me=0,Ce=17,Be=17,Ne=17,Ge=0,Oe=-1,Pe=0,He=0,Ve=0,ze=0,Ye=3,qe=2,We=0,Je=0,Ke=0,Qe=!1,Ze=!1,$e=!1,et=!1,tt=0,at=H(),it=Re,nt=0,rt=0,ot=0,st=0,ct=0,lt=H()+5e3,mt=2,ft=0,ut=H(),dt=!1,pt=0,wt=0,gt=H(),ht=0,Tt=0,Et=0,bt=0,xt=0,vt=999,Rt=!1,yt=H(),_t=H(),Dt=H(),Ut=H(),At=H(),Xt=0,kt=0,Ft=H(),It=0,Lt=!1,jt=1,St=!0,Mt=H(),Ct=0,Bt=!1,Nt=!1,Gt=!1,Ot=-1,Pt=[{name:"3rd star",longarms:20,wierdclimber:20,laxdude:20,charles:20,winston:20,infinitepower:!1,reducedstatic:!1,noaggression:!1},{name:"deevile",longarms:15,wierdclimber:15,laxdude:15,charles:15,winston:15,infinitepower:!1,reducedstatic:!0,noaggression:!1},{name:"darvy's mode",longarms:20,wierdclimber:20,laxdude:20,charles:20,winston:20,infinitepower:!0,reducedstatic:!0,noaggression:!0},{name:"classic fnaw",longarms:8,wierdclimber:8,laxdude:15,charles:0,winston:0,infinitepower:!1,reducedstatic:!0,noaggression:!1},{name:"yee challenge",longarms:5,wierdclimber:5,laxdude:5,charles:5,winston:5,infinitepower:!1,reducedstatic:!0,noaggression:!1},{name:"eee challenge",longarms:10,wierdclimber:10,laxdude:10,charles:10,winston:10,infinitepower:!1,reducedstatic:!1,noaggression:!1},{name:"69420 mode",longarms:6,wierdclimber:9,laxdude:4,charles:2,winston:0,infinitepower:!0,reducedstatic:!0,noaggression:!1},{name:"darvy's other mode",longarms:20,wierdclimber:20,laxdude:20,charles:20,winston:20,infinitepower:!0,reducedstatic:!0,noaggression:!1},{name:"yeet",longarms:0,wierdclimber:5,laxdude:20,charles:0,winston:0,infinitepower:!1,reducedstatic:!1,noaggression:!0}],Ht={name:"you eagler",longarms:6,wierdclimber:9,laxdude:4,charles:2,winston:0,infinitepower:!1,reducedstatic:!0,noaggression:!1};function Vt(){clearTimeout(Me),L(),oa(K.lights,0),oa(K.office,0),oa(K.sstatic,0),oa(K.camglitch,0)}function zt(){j(J.title,K.main,!0),M(J.static2,.8,K.main)}function Yt(){var e=J.amb[xe(0,2)];j(e,K.ambience),Me=setTimeout(Yt,Math.floor(1e3*e.duration))}var qt=.6,Wt=.3,Jt=69;function Kt(){Ee.push(),Ee.scale([1280,720]),a.bindTexture(a.TEXTURE_2D,W.sstatic.norm[Jt%6]),Z(ce),Ee.pop()}function Qt(){Ee.push(),Ee.scale([1280,720]),a.bindTexture(a.TEXTURE_2D,W.sstatic.heavyscan[Jt%5]),C(),Z(ce),Ee.pop()}function Zt(){Math.random()<.03&&(Ee.push(),Ee.scale([1280,720]),a.bindTexture(a.TEXTURE_2D,W.sstatic.scan[Jt%7]),C(),$(.5),Ee.pop()),(qt+=.1*Math.random()-.05)>.5&&(qt-=.01),qt>.7&&(qt=.7),qt<.2&&(qt=.2),Ee.push(),Ee.scale([1280,720]),a.bindTexture(a.TEXTURE_2D,W.sstatic.norm[Jt%6]),$(qt),Ee.pop()}var $t=!1;const ea=[[363,236],[266,246],[224,228],[170,210],[141,255],[5,228],[231,136],[117,133],[4,125],[231,54],[181,35],[136,15],[5,38],[351,175],[308,98],[342,61],[106,218],[98,38]],ta=["A Hall - Camera 1","Main Enterance - Camera 1","Main Enterance - Camera 2","A Hall - Camera 4","Pasillo 2 - Camera 1","A Hall - Camera 7","Main Hall - Camera 3","B Hall - Camera 2","B Hall - Camera 3","C Hall - Camera 1","C Hall - Camera 2","Pasillo 2 - Camera 2","C Hall - Camera 5","Lower Gym - Camera 1","Upper Gym - Camera 1","Fitness Center - Camera 1","A Hall - Camera 6","C Hall - Camera 4"];var aa=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ia=[[0],[0],[1],[2,1],[3,16],[4],[4],[16],[16],[16],[7],[6],[6],[13],[14],[15],[13],[6],[16],[16],[10],[6],[],[],[],[],[9]];function na(e){if(ke&&!dt)for(var t=ia[e],a=H(),i=0;i<t.length;i++){var n=t[i];a-aa[n]>0&&Se==n?aa[t[i]]=Nt?a+xe(100,200):a+xe(5e3,9e3):aa[t[i]]=Nt?a+xe(50,100):a+xe(1e3,2e3)}}for(var ra=0;ra<ea.length;ra++)ea[ra][0]*=1.25,ea[ra][1]*=1.25;function oa(e,t){e.gain.setValueAtTime(t,n.currentTime)}const sa="fnaw1_";var ca,la=.5,ma=0,fa=0,ua=!1,da=!1,pa=!1;function wa(e){window.localStorage.setItem(sa+"night",e),ve=e}function ga(e){window.localStorage.setItem(sa+"6th",e?"1":"0"),ua=e}function ha(e){window.localStorage.setItem(sa+"7th",e?"1":"0"),da=e}function Ta(e){window.localStorage.setItem(sa+"20mode",e?"1":"0"),pa=e}function Ea(e){var t,a,i=ia[e];t=0==i.length?[364,191]:ea[i[0]],a=ke?ea[Se]:[366,212];var n=t[0]-a[0],r=t[1]-a[1],o=(280-Math.sqrt(n*n+r*r))/280;return(isNaN(o)||o<.05)&&(o=.05),o>1&&(o=1),.5*o}(!(ca=parseInt(window.localStorage.getItem(sa+"night")))||ca<1||ca>5||isNaN(ca))&&(ca<1&&(ca=1),ca>5&&(ca=5),isNaN(ca)&&(ca=1),window.localStorage.setItem(sa+"night",ca)),ve=ca,ga(ua="1"==window.localStorage.getItem(sa+"6th")),ha(da="1"==window.localStorage.getItem(sa+"7th")),Ta(pa="1"==window.localStorage.getItem(sa+"20mode")),setInterval(function(){!v&&b!=!E&&x&&(b=!E,E&&(document.getElementById("fullscreen").style.display="block",v=!0)),e.style.filter=ke?"brightness(1.5)":"none";var t,n=H();++Te%2==0&&(Jt+=1),h=g||T;for(var r=0;r<255;r++)y[r]=R[r]||y[r];if(i.fillRect(0,0,1280,720),i.clearRect(0,0,1280,720),i.font="30px VT323",i.fillStyle="#000000",a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT),Ee.reset(),Ee.scale([1,-1]),0==ge){Ee.push(),Ee.scale([1280,720]),a.bindTexture(a.TEXTURE_2D,N),Z(ce),Ee.pop();var o=Math.floor(n/300)%4;if(we<1){var s=Math.floor(19*we);P("Downloading Assets..","Downloading Assets"+".".repeat(o),660),G("["+"#".repeat(s)+" ".repeat(19-s)+"]",700)}else we<2?P("Extracting..","Extracting"+".".repeat(o),680):3==we&&G("you eagler",700)}else if(1==ge){be(138,391,369,441)&&0!=ma&&(ma=0,j(J.camswitch,K.main)),be(137,458,367,510)&&1!=ma&&(ma=1,j(J.camswitch,K.main)),be(135,526,394,586)&&2!=ma&&ua&&(ma=2,j(J.camswitch,K.main)),be(129,597,474,661)&&3!=ma&&da&&(ma=3,j(J.camswitch,K.main)),_[38]&&ma>0&&(ma--,j(J.camswitch,K.main)),_[40]&&ma<(ua?da?3:2:1)&&(ma++,j(J.camswitch,K.main)),Ee.push(),Ee.scale([1280,720]),a.bindTexture(a.TEXTURE_2D,W.title),Z(ce),Ee.pop(),Zt();var c=0;for(ua&&(Ee.push(),Ee.translate([136,534]),Ee.scale([255,51]),a.bindTexture(a.TEXTURE_2D,W.title6th),Z(ce),Ee.pop(),c+=1),da&&(Ee.push(),Ee.translate([134,604]),Ee.scale([340,50]),a.bindTexture(a.TEXTURE_2D,W.title7th),Z(ce),Ee.pop(),c+=1),pa&&(c+=1),Ee.push(),Ee.translate([134,55]),Ee.scale([295,457]),a.bindTexture(a.TEXTURE_2D,c<2?W.titletext:W.titletext2),Z(ce),Ee.pop(),1==ma&&(Ee.push(),Ee.translate([152,505]),Ee.scale([72,18]),a.bindTexture(a.TEXTURE_2D,W.titlenight[ve]),Z(ce),Ee.pop()),Ee.push(),1==ma?Ee.translate([80,467]):2==ma?Ee.translate([80,540]):3==ma?Ee.translate([80,611]):Ee.translate([80,403]),Ee.scale([46,27]),a.bindTexture(a.TEXTURE_2D,W.titleselector),Z(ce),Ee.pop(),Ee.push(),Ee.translate([0,685]),Ee.scale([1280,35]),a.bindTexture(a.TEXTURE_2D,W.titlebottom),Z(ce),Ee.pop(),Ee.push(),Ee.translate([980,0]),Ee.scale([300,70]),a.bindTexture(a.TEXTURE_2D,W.titletop),Z(ce),Ee.pop(),Ee.push(),a.bindTexture(a.TEXTURE_2D,W.titlestar),Ee.translate([148,278]),Ee.scale([80,80]),r=0;r<c;r++)Z(ce),Ee.translate([1.1,0]);Ee.pop(),$t&&(T&&!be(200,50,1080,670)||_[27]?$t=!1:(i.fillStyle="#000000",i.fillRect(200,50,880,620),i.lineWidth=5,i.lineJoin="bevel",i.strokeStyle="#FFFFFF",i.strokeRect(200,50,880,620),i.fillStyle="#FFFFFF",i.font="40px VT323",G("Copyright Disclaimer",100),i.drawImage(W.copyinfo,290,110,700,530))),T?0==ma&&be(138,391,369,441)?(wa(1),Re=1,L(),j(J.camswitch,K.main),fa=Te,ge=2):1==ma&&be(137,458,367,510)?(Re=ve,L(),j(J.camswitch,K.main),fa=Te,ge=2):2==ma&&be(135,526,394,586)?(Re=6,L(),j(J.camswitch,K.main),fa=Te,ge=2):3==ma&&be(129,597,474,661)?ge=7:be(460,686,704,719)?$t=!0:be(1010,0,1280,70)&&window.open("https://g.eags.us/fnaw/explanation.html","_blank"):y[13]&&(0==ma?(L(),j(J.camswitch,K.main),fa=Te,ge=2):1==ma?(L(),j(J.camswitch,K.main),fa=Te,ge=2):2==ma?(L(),j(J.camswitch,K.main),fa=Te,ge=2):3==ma&&(L(),j(J.camswitch,K.main),fa=Te,ge=2)),y[54]&&y[57]&&(Re=8,L(),j(J.camswitch,K.main),fa=Te,ge=2),DEBUG&&_[32]&&(L(),it=7,nt=n,ge=6,j(J.sticknya,K.main))}else if(2==ge)i.font="100px font",i.fillStyle="#FFFFFF",G("Night "+Re,300),i.font="60px font",i.fillStyle="#FFFFFF",G("12:00 AM",380),Te-fa<10&&Qt(),Te-fa>70&&(ye=0,_e=H(),De=!1,Ue=!1,Ae=0,Xe=0,ke=!1,Fe=!1,Ie=0,Le=!1,je=0,Se=0,Me=setTimeout(Yt,5e3),Ce=17,Be=17,Ne=17,Ge=0,Oe=-1,Pe=0,He=0,Ve=0,ze=0,Bt=!1,Nt=!1,Gt=!1,1==Re?(Ye=3,qe=2,We=0,Je=0,Ke=0):2==Re?(Ye=6,qe=6,We=0,Je=6,Ke=0):3==Re?(Ye=9,qe=11,We=5,Je=9,Ke=0):4==Re?(Ye=14,qe=8,We=8,Je=11,Ke=5):5==Re?(Ye=13,qe=14,We=13,Je=13,Ke=8):6==Re?(Ye=16,qe=16,We=16,Je=16,Ke=12):7==Re?(Ye=Ht.longarms,qe=Ht.wierdclimber,We=Ht.charles,Je=Ht.laxdude,Ke=Ht.winston,Bt=Ht.infinitepower,Nt=Ht.reducedstatic,Gt=Ht.noaggression):8==Re&&(Ye=20,qe=20,We=20,Je=20,Ke=20,Bt=!0,Nt=!0,Gt=!0),Qe=!1,0,Ze=!1,$e=!1,et=!1,tt=0,at=H(),it=Re,nt=0,rt=0,ot=0,st=0,ct=0,lt=H()+5e3,mt=2,ft=0,ut=H(),dt=!1,pt=0,0,0,wt=0,gt=H(),ht=0,Tt=0,Et=0,bt=0,xt=0,vt=999,Rt=!1,yt=H(),_t=H(),Dt=H(),Ut=H(),At=H(),Xt=0,kt=0,Ft=H(),oa(K.ambience,.2),It=0,Lt=!1,St=!0,Mt=H(),Ct=0,1!=jt&&jt==it||(jt=it,St=!1,setTimeout(function(){oa(K.call,1),j(J.call[it-1],K.call)},5e3)),ge=3);else if(3==ge){var l=!1,m=!1;if(ke||Fe?l=be(0,620,700,720)||be(0,710,1280,720):Lt||(l=be(0,620,0!=It&&69!=It?930:1280,720)),!ke&&Te-Ie>=10&&Fe&&(ke=!0,m=!0,je=Te),!Le&&l&&0==Tt&&!Rt&&Te-Ie>20?(Le=!0,Ie=Te,ke?(j(J.camclose,K.main),ke=!1,24==Ce?(Tt=1,Et=Te,S()):24==Be?(Tt=2,Et=Te,S()):24==Oe?(Tt=5,Et=Te,S()):25==Oe&&(Oe=24)):j(J.camopen,K.main),Fe=!Fe):Le&&!be(0,620,1280,720)&&(Le=!1),6==Ge&&0==Tt&&(De||Gt?(j(J.laxdudecrash,K.main),Bt||(vt-=10*mt),mt+=5,Ge=xe(0,1),na(3),gt=n,ft=0):(Tt=4,Et=Te,S(),ke&&(j(J.camclose,K.main),ke=!1,Fe=!1,Le=!0,Ie=Te))),24==Ne&&0==Tt&&(Tt=3,Et=Te,S(),ke&&(j(J.camclose,K.main),ke=!1,Fe=!1,Le=!0,Ie=Te)),n-at>7e4&&(at=n,2!=(tt+=1)&&3!=tt&&4!=tt||7==it||(Ye+=1,qe+=1,We+=1,Je+=1,Ke+=1),tt>=6&&(0==Tt||7==Tt)))return nt=n,Vt(),j(J.nightend,K.main),void(ge=5);if(n-Dt>6e4&&0==xe(0,600)){Dt=n;var f=J.random[xe(0,1)],u=xe(3,6),d=0;for(r=0;r<u;r++)setTimeout(function(){j(f,K.half)},d),0==xe(0,1)?d+=xe(600,1e3):d+=xe(1500,5e3)}var p=Ce,w=Be,D=Ne,U=Ge,X=Oe;if(0==Tt){if(n-rt>4959&&0==xe(0,5)&&(rt=n,xe(3,20)<Ye||0!=Pe&&tt>3&&1==xe(0,3))){var k=0==Pe&&tt>(1==it?3:2)||1==xe(0,2);if(17==Ce&&11!=Ne)Ce=11,21==Be&&(Be=15),1==it&&0==It&&(It=1);else if(11==Ce||21==Ce)(1==(F=xe(1,5))||2==F||k)&&(Ce=3),3!=F&&4!=F||10==Ne||(Ce=10),5==F&&(Ce=21);else if(3==Ce){var F=xe(1,3);(n-Pe>=6e3*(25-Ye)||1==F||3==F||k)&&(Ce=1),2==F&&4!=Be&&(Ce=4)}else 1==Ce?((2==(F=xe(1,5))||3==F||1==it&&0!=Pe)&&(Ce=3),(n-Pe>=4e3*(25-Ye)||1==F||4==F||5==F)&&(Ce=0)):0==Ce?De||Gt?(Pe=n,Ce=0==xe(0,2)?3:1):Ce=24:4==Ce?((1==(F=xe(1,5))||2==F||5==F||k)&&(Ce=3),3==F&&6!=Ne&&(Ce=5),4==F&&6!=Ne&&(Ce=6)):5==Ce||6==Ce?(1!=(F=xe(1,8))&&2!=F&&3!=F&&4!=F&&!k||4==Be||(Ce=4),5!=F&&6!=F||10==Ne||k||(Ce=10),7!=F||Ze||k||(Ce=18),8!=F||$e||et||7==Be||8==Be||k||(Ce=7)):18==Ce?Ce=9:9==Ce?(Ze=!0,1==(F=xe(1,2))&&(Ce=5),2==F&&(Ce=6),6==Ne&&(Ne=10)):10==Ce?(1!=(F=xe(1,7))&&2!=F&&3!=F&&4!=F&&5!=F||(Ce=6),6!=F&&7!=F||11==Be||21==Be||11==Ne||(Ce=21)):7==Ce?Ce=19:19==Ce&&(et=!0,1==(F=xe(1,2))&&(Ce=5),2==F&&(Ce=6),6==Ne&&(Ne=10))}n-ot>4933&&0==xe(0,5)&&(ot=n,xe(3,20)<qe)&&(k=0==Pe&&tt>(1==it?3:2)||1==xe(0,2),17==Be&&11!=Ne?(Be=11,21==Ce&&(Ce=11)):11==Be||21==Be?(1!=(F=xe(1,7))&&2!=F||(Be=14,14==Ne&&(Ne=13)),(3==F||4==F||k||n-He>=5e3*(25-qe))&&(Be=13,13==Ne&&(Ne=14)),5==F&&(Be=15),6==F&&(Be=26),7==F&&(Be=3)):14==Be?((1==(F=xe(1,5))||3==F||k||n-He>=5e3*(25-qe))&&(Be=13,13==Ne&&(Ne=14)),2!=F&&4!=F||(Be=15),5==F&&11!=Ne&&11!=Ce&&21!=Ce&&(Be=21)):13==Be?(F=xe(1,8),(0==He||n-He>=4e3*(25-qe)||1==F||3==F||7==F||8==F||k)&&(Be=16),2!=F&&4!=F||(Be=14,14==Ne&&(Ne=13)),5==F&&11!=Ne&&11!=Ce&&21!=Ce&&(Be=21),6==F&&2!=Ne&&(Be=3)):16==Be?Be=22:22==Be?Be=23:23==Be?Ue||Gt?(He=n,Be=13):Be=24:15==Be?((1==(F=xe(1,3))||k||n-He>=7e3*(25-qe))&&(Be=14,14==Ne&&(Ne=13)),2==F&&11!=Ne&&11!=Ce&&21!=Ce&&(Be=21),3==F&&(Be=26)):26==Be?(1!=(F=xe(1,3))&&2!=F||(Be=15),3==F&&(Be=20)):20==Be?Be=26:3==Be?((2==(F=xe(1,2))||k)&&(Be=13,13==Ne&&(Ne=14)),1==F&&4!=Ce&&(Be=4)):4==Be?(1!=(F=xe(1,2))&&!k||2==Ne||(Be=3),2!=F||$e||et||7==Ce||19==Ce||(Be=7)):7==Be?Be=8:8==Be&&4!=Ce&&($e=!0,Be=4)),n-st>4926&&0==xe(0,5)&&(st=n,xe(3,20)<We)&&(k=0==Ve&&tt>(1==it?3:2)||1==xe(0,2),17==Ne&&11!=Ce&&11!=Be&&21!=Ce&&21!=Be?(Ne=11,3==it&&0==It&&(It=3)):11==Ne?(1!=(F=xe(1,6))&&2!=F&&3!=F&&!k||3==Be||(Ne=2),4!=F&&5!=F||10==Ce||(Ne=10),6==F&&(14!=Be?Ne=14:13!=Be&&16!=Be&&(Ne=13))):10==Ne&&6!=Ce&&5!=Ce?Ne=6:2==Ne?((1==(F=xe(1,4))||2==F||k)&&(Ne=1),3==F&&(Ne=4),4==F&&13!=Be&&16!=Be&&(Ne=13)):4==Ne&&5!=Ce&&6!=Ce?Ne=!k&&1!=xe(1,3)||3==Be?6:2:6==Ne?((1==(F=xe(1,3))||2==F||k||n-Ve>=9e3*(25-We))&&(Ne=4),3==F&&10!=Ce&&(Ne=10)):10==Ne?(1!=(F=xe(1,3))&&2!=F||5==Ce||6==Ce||(Ne=6),3==F&&11!=Ce&&11!=Be&&21!=Ce&&21!=Be&&(Ne=11)):13==Ne?((2==(F=xe(1,3))||3==F||k||n-Ve>=6e3*(25-We))&&3!=Oe&&(Ne=2),1==F&&14!=Be&&(Ne=14)):14==Ne?((2==(F=xe(1,3))||3==F||k||n-Ve>=6e3*(25-We))&&11!=Ce&&11!=Be&&21!=Ce&&21!=Be&&(Ne=11),1==F&&13!=Be&&(Ne=13)):1==Ne?((1==(F=xe(1,2))||0==Ve||n-Ve>=7e3*(25-We))&&(Ne=0),2==F&&(Ne=3!=Be?2:0)):0==Ne&&1==xe(0,7)&&(Ne=0==xe(0,1)&&3!=Be?2:1,Ve=n)),n-pt>4757&&0==xe(0,5)&&(pt=n,xe(3,20)<Ke)&&(-1==Oe?(Oe=6,6==it&&0==It&&(It=4)):0==Oe?De||Gt?n-ht>15e3&&(1==(F=xe(1,2))&&(Oe=2),2==F&&(Oe=1),ze=n):Oe=25:1==Oe||2==Oe?n-ze>=3e3*(25-Ke)||0==xe(0,3)?(1==(F=xe(1,2))&&(Oe=0),2==F&&(Oe=13)):Oe=3:3==Oe?Oe=n-ze>=4e3*(25-Ke)||0==xe(0,3)?2:4:4==Oe?Oe=n-ze>=4e3*(25-Ke)||0==xe(0,1)?2:7:6==Oe?(1!=(F=xe(1,11))&&7!=F&&9!=F||(Oe=1),2!=F&&8!=F&&10!=F||(Oe=2),3!=F&&11!=F||(Oe=7),4==F&&(Oe=15),5==F&&(Oe=14),6==F&&(Oe=13)):7==Oe?(1==(F=xe(1,2))&&(Oe=4),2==F&&(Oe=6)):15==Oe?Oe=14:14==Oe?Oe=13:13==Oe?Oe=n-ze>=3500*(25-Ke)||0==xe(0,3)?22:2:22==Oe?Oe=23:23==Oe&&(Ue||Gt?n-ht>15e3&&(Oe=13,ze=n):Oe=25)),n-ct>6579&&0==xe(0,20)&&(ct=n,xe(3,20)<Je&&Ge<4&&(n-lt>2e3+200*(20-Je)?(Ge+=1,gt=n,ke&&4==Ge&&0==Se&&(aa[0]=n+200,j(J.laxdudecart,K.main),Ge=5,gt=n,je=Te,dt=!0),1==Ge&&0==xe(0,2)&&j(J.toilet,K.main),2==Ge&&(j(J.deee,K.main),2==it&&0==It&&(It=2)),na(3),DEBUG&&console.log("lax + 1 > "+Ge)):ft>2e4+1e3*(25-Je)&&(Ge=4,gt=n,na(3),ke&&0==Se&&(aa[0]=n+200,j(J.laxdudecart,K.main),Ge=5,gt=n,je=Te,dt=!0))));var I=[];for(Ge!=U&&I.push(3),(!ke||1!=Se&&2!=Se)&&n-lt>xe(1e3,1e4)&&(ft=0),!ke||1!=Se&&2!=Se||(lt=n),4==Ge&&n-gt>2e4&&(Ge=5,DEBUG&&console.log("lax is here"),gt=n),5==Ge&&n-gt>3e3&&(Ge=6,DEBUG&&console.log("ur fucked"),gt=n),Ce!=p&&(I.push(Ce),n,na(Ce),na(p),DEBUG&&console.log("longarms: "+p+" > "+Ce)),Be!=w&&(I.push(Be),n,na(Be),na(w),DEBUG&&console.log("wierdclimber: "+w+" > "+Be)),Ne!=D&&(I.push(Ne),wt=n,na(Ne),na(D),DEBUG&&console.log("charles: "+D+" > "+Ne)),Oe!=X&&(I.push(Oe),ht=n,aa[Oe]=Nt?n+xe(100,200):n+xe(3e3,4e3),-1!=X&&(aa[X]=Nt?n+xe(1e3,2e3):n+xe(15e3,3e4)),DEBUG&&console.log("winston: "+X+" > "+Oe)),r=0;r<I.length;r++){const e=I[r];setTimeout(function(){M(J.footsteps[xe(0,5)],Ea(e),K.main)},xe(1e3*r,1500*r+2e3))}if(I.length>0&&n-Ut>xe(75e3,2e5)&&(Ut=n,j(J.loud[xe(0,4)],K.half)),n-Ut>xe(15e4,3e5)&&(Ut=n,2==Ne||0!=xe(0,2)?j(J.loud[xe(3,4)],K.main):j(J.loud[xe(0,2)],K.half)),((0==Ce||0==Oe)&&De||(23==Be||23==Oe)&&Ue)&&n-Ft>5e3&&0==xe(0,60)&&(Ft=n,j(J.atdoor[xe(0,2)],K.main)),(22==Be||22==Oe)&&n-At>0){var V=J.boilerroom[xe(0,6)];At=n+xe(500,1500),j(V,K.half)}25==Ne&&n-wt>xe(2e4,35e3)-600*We&&(Ne=24,wt=n)}if(ke&&0==Tt){var z=!1;if(1!=Se&&2!=Se||(ft+=n-ut),!De&&!Gt&&0==Ne&&n-wt>xe(15e3,3e4)-600*We&&(Ne=25,wt=n,na(0),DEBUG&&console.log("charles is in")),oa(K.office,.03),oa(K.sstatic,Math.max(.07*(Wt-.17),0)),T)for(r=0;r<18;r++){var Y=760+ea[r][0],q=325+ea[r][1];be(Y,q,Y+37,q+25)&&Se!=r&&(j(J.camswitch,K.main),je=Te,Se=r,z=!0)}if((z||m)&&(4==Ge&&0==Se?(j(J.laxdudecart,K.main),Ge=5,gt=n,dt=!0):dt=!1),n-aa[Se]>0){if(oa(K.camglitch,0),17==Se){a.bindTexture(a.TEXTURE_2D,W.cams[17].n);var Q=360+(te=640);(ae=Math.abs((3*Te+5464)%(2*Q)-Q)-180)<0&&(ae=0),ae>te&&(ae=te),Ee.push(),Ee.translate([-ae,0]),Ee.scale([1920,720]),fe.bind(),pe(.3,1),Z(fe),Ee.pop()}else if(16==Se){var te,ae;a.bindTexture(a.TEXTURE_2D,W.cams[16].n),Q=360+(te=1280),(ae=Math.abs((3*Te+43234)%(2*Q)-Q)-180)<0&&(ae=0),ae>te&&(ae=te),fe.bind(),pe(.4,1),Ee.push(),Ee.translate([-ae,0]),Ee.scale([2560,720]),Z(fe),Ee.pop(),Ee.push(),Ee.translate([1350-ae,0]),Ee.scale([1210,720]),18==Ce?(a.bindTexture(a.TEXTURE_2D,W.cams[16].r.l18),Z(fe)):9==Ce?(a.bindTexture(a.TEXTURE_2D,W.cams[16].r.lt),Z(fe)):Ze&&(a.bindTexture(a.TEXTURE_2D,W.cams[16].r.lf),Z(fe)),Ee.pop(),Ee.push(),Ee.translate([-ae,0]),Ee.scale([1250,720]),7==Ce?(a.bindTexture(a.TEXTURE_2D,W.cams[16].l.l7),Z(fe)):19==Ce?(a.bindTexture(a.TEXTURE_2D,W.cams[16].l.lt),Z(fe)):et?(a.bindTexture(a.TEXTURE_2D,W.cams[16].l.wf),Z(fe)):7==Be?(a.bindTexture(a.TEXTURE_2D,W.cams[16].l.w7),Z(fe)):8==Be?(a.bindTexture(a.TEXTURE_2D,W.cams[16].l.lt),Z(fe)):$e&&(a.bindTexture(a.TEXTURE_2D,W.cams[16].l.wf),Z(fe)),Ee.pop(),Ee.push(),Ee.translate([1645-ae,0]),Ee.scale([280,370]),fe.bind(),pe(.4,280/720),4==Ce&&4==Ne?(a.bindTexture(a.TEXTURE_2D,W.cams[16].d.l4c4),Z(fe)):4==Ce?(a.bindTexture(a.TEXTURE_2D,W.cams[16].d.l4),Z(fe)):4==Be&&(a.bindTexture(a.TEXTURE_2D,W.cams[16].d.w4),Z(fe)),Ee.pop()}else if(0==Se&&dt){var ie=Te-je;ie<=50&&(ie<=10?a.bindTexture(a.TEXTURE_2D,W.laxhall[0]):a.bindTexture(a.TEXTURE_2D,W.laxhall[Math.floor((ie-10)/2)]),Ee.push(),Ee.scale([1280,720]),Z(ce),Ee.pop(),ie>=50&&(aa[0]=Nt?n+100:n+5e3,dt=!1))}else Ee.push(),a.bindTexture(a.TEXTURE_2D,0==Se?1==Ce&&0==Ne?W.cams[0].nl1c1:1==Ce&&1==Ne?W.cams[0].nl1c0:0==Ne?W.cams[0].nc0:1==Ne?W.cams[0].nc1:1==Ce?W.cams[0].nl1:W.cams[0].n:1==Se?2==Ge?3==Ce&&2==Ne?W.cams[1].nl3c2d2:3==Ce?W.cams[1].nl3d2:2==Ne?W.cams[1].nc2d2:W.cams[1].nd2:3==Ge?3==Ce&&2==Ne?W.cams[1].nl3c2d3:3==Ce?W.cams[1].nl3d3:2==Ne?W.cams[1].nc2d3:3==Be?W.cams[1].nw3d3:W.cams[1].nd3:Ge>=4?3==Ce&&2==Ne?W.cams[1].nl3c2d4:3==Ce?W.cams[1].nl3d4:2==Ne?W.cams[1].nc2d4:W.cams[1].nd4:3==Ce&&3==Be?W.cams[1].nl3w3:3==Ce&&2==Ne?W.cams[1].nl3c2:2==Ne?W.cams[1].nc2:3==Ce?W.cams[1].nl3:W.cams[1].n:2==Se?1==Ge?3==Ce&&3==Be?W.cams[2].nl3w3d1:3==Ce?W.cams[2].nl3d1:3==Be?W.cams[2].nw3d1:W.cams[2].nd1:2==Ge?3==Ce?W.cams[2].nl3d2:3==Be?W.cams[2].nw3d2:W.cams[2].nd2:3==Ge?3==Ce&&3==Be?W.cams[2].nl3w3d3:3==Ce?W.cams[2].nl3d3:3==Be?W.cams[2].nw3d3:W.cams[2].nd3:Ge>=4?3==Ce?W.cams[2].nl3d4:W.cams[2].nd4:3==Ce&&3==Be?W.cams[2].nl3w3:3==Ce?W.cams[2].nl3:3==Be?W.cams[2].nw3:W.cams[2].n:3==Se?4==Ne&&4==Ce?W.cams[3].nl4c4:4==Be?W.cams[3].nw4:4==Ne?W.cams[3].nc4:4==Ce?W.cams[3].nl4:W.cams[3].n:4==Se?6==Ne?W.cams[4].nc6:5==Ce?W.cams[4].nl5:6==Ce?W.cams[4].nl6:W.cams[4].n:5==Se?W.cams[5].n:6==Se?11==Ce&&11==Be?W.cams[6].nl11w11:11==Ce?W.cams[6].nl11:11==Ne?W.cams[6].nc11:21==Ce?W.cams[6].nl21:11==Be?W.cams[6].nw11:12==Be?W.cams[6].nw12:21==Be?W.cams[6].nw21:W.cams[6].n:7==Se?10==Ne?W.cams[7].nc10:10==Ce?W.cams[7].nl10:W.cams[7].n:8==Se?W.cams[8].n:9==Se?26==Be?W.cams[9].nw24:W.cams[9].n:10==Se?20==Be?W.cams[10].nw20:W.cams[10].n:11==Se?W.cams[11].n:12==Se?W.cams[12].n:13==Se?16==Be?W.cams[13].nw16:13==Be?W.cams[13].nw13:13==Ne?W.cams[13].nc13:W.cams[13].n:14==Se?14==Be?W.cams[14].nw14:14==Ne?W.cams[14].nc14:W.cams[14].n:15==Se?15==Be?W.cams[15].nw15:W.cams[15].n:void 0),Ee.scale([1280,720]),Z(ce),Ee.pop();Oe==Se&&(0==Se?aa[0]=n+1e3:(Ee.push(),a.bindTexture(a.TEXTURE_2D,W.winstedcam),Ee.scale([1280,720]),Z(ce),Ee.pop())),(Wt+=.07*Math.random()-.035)>.3&&(Wt-=.01),Wt>.5&&(Wt=.5),Wt<.15&&(Wt=.15),Ee.push(),Ee.scale([1280,720]),a.bindTexture(a.TEXTURE_2D,W.sstatic.norm[Jt%6]),$(Wt),Ee.pop()}else oa(K.camglitch,1),Kt();if(Ee.push(),Ee.scale([1280,720]),a.bindTexture(a.TEXTURE_2D,W.office.overlay),Z(ce),Ee.pop(),Math.floor(Te/20)%2==0&&(Ee.push(),Ee.translate([578,30]),Ee.scale([103,28]),a.bindTexture(a.TEXTURE_2D,W.office.rec),Z(ce),Ee.pop()),Qe&&(be(900,0,1280,720)||be(0,600,1280,720))&&(Qe=!1),Qe||be(730,0,1280,720)||be(0,500,1280,720)||(Qe=!0),Qe){for(Ee.push(),Ee.translate([1040,530]),r=0;r<18;r++){Ee.push();var ne=ea[r];ne=[.4*ne[0],.4*ne[1]],Ee.translate(ne),Ee.scale([15,10]),r==Se&&Math.floor(Te/15)%2==0?ee([.551/1.5,.68/1.5,0,1]):ee([.258/1.5,.258/1.5,.258/1.5,1]),Ee.pop()}Ee.push(),Ee.scale([200,150]),a.bindTexture(a.TEXTURE_2D,W.office.cammap),B(),Z(ce),Ee.pop(),Ee.pop()}else{Ee.push(),Ee.translate([760,325]);for(var r=0;r<18;r++)Ee.push(),Ee.translate(ea[r]),Ee.scale([37,25]),r==Se&&Math.floor(Te/15)%2==0?ee([.551/1.5,.68/1.5,0,1]):ee([.258/1.5,.258/1.5,.258/1.5,1]),Ee.pop();i.font="20px font",i.fillStyle="#FFFFFF",i.fillText(ta[Se],770,332),Ee.push(),Ee.scale([500,375]),a.bindTexture(a.TEXTURE_2D,W.office.cammap),C(),Z(ce),Ee.pop(),Ee.pop()}Te-je<10&&Qt()}else{oa(K.office,Rt?0:.1),oa(K.sstatic,0),oa(K.camglitch,0),Rt&&oa(K.ambience,0),be(0,0,200,720)&&(ye-=10),be(0,0,400,720)&&(ye-=5),be(880,0,1280,720)&&(ye+=5),be(1080,0,1280,720)&&(ye+=10),T&&!Rt&&0==Tt&&(be(64,492,118,566)?24==Ce||24==Oe||25==Oe?j(J.doorerr,K.main):(j(J.door,K.main),De=!De,Ae=Te):be(1176,486,1217,572)&&(24==Be||24==Oe||25==Oe?j(J.doorerr,K.main):(j(J.door,K.main),Ue=!Ue,Xe=Te)),!be(61,320,90,370)||24!=Ce&&24!=Oe&&25!=Oe||j(J.doorerr,K.main),!be(1205,318,1231,369)||24!=Be&&24!=Oe&&25!=Oe||j(J.doorerr,K.main)),h&&!Rt&&0==Tt?(be(61,320,90,370)&&24!=Ce&&24!=Oe&&25!=Oe?0==bt&&(0==Oe?(De||j(J.winston,K.main),bt=W.office.llights):0==Ce?(De||j(J.longarms,K.main),bt=W.office.llightl):bt=W.office.llight):bt=0,be(1205,318,1231,369)&&24!=Be&&24!=Oe&&25!=Oe?0==xt&&(23==Oe?(Ue||j(J.winston,K.main),xt=W.office.rlights):23==Be?(Ue||j(J.weirdclimber,K.main),xt=W.office.rlightw):xt=W.office.rlight):xt=0):(xt=0,bt=0),4==Tt&&(ye-=50),ye<0&&(ye=0),ye>384&&(ye=384);var re=0;if(fe.bind(),pe(.3,1),0==Tt)Ee.push(),Ee.translate([-ye,0]),Ee.scale([1664,720]),a.bindTexture(a.TEXTURE_2D,W.office.normal),Z(fe),Ee.pop(),24==Oe&&(pe(.3,235/720),a.bindTexture(a.TEXTURE_2D,W.office.tablewinston),Ee.push(),Ee.translate([730-ye,205]),Ee.scale([245,235]),Z(fe),Ee.pop()),Te-Ae<8?(De?a.bindTexture(a.TEXTURE_2D,W.office.ldoor[Te-Ae]):a.bindTexture(a.TEXTURE_2D,W.office.ldoor[7-(Te-Ae)]),Ee.push(),Ee.translate([-ye,0]),Ee.scale([375,720]),Z(fe),Ee.pop()):De?(0!=bt?(re=1,a.bindTexture(a.TEXTURE_2D,W.office.ldoor.l)):a.bindTexture(a.TEXTURE_2D,W.office.ldoor.d),Ee.push(),Ee.translate([-ye,0]),Ee.scale([375,720]),Z(fe),Ee.pop()):0!=bt&&(re=1,Ee.push(),Ee.translate([-ye,0]),Ee.scale([525,720]),a.bindTexture(a.TEXTURE_2D,bt),Z(fe),Ee.pop()),Te-Xe<8?(Ue?a.bindTexture(a.TEXTURE_2D,W.office.rdoor[Te-Xe]):a.bindTexture(a.TEXTURE_2D,W.office.rdoor[7-(Te-Xe)]),Ee.push(),Ee.translate([1664-ye-375,0]),Ee.scale([375,720]),Z(fe),Ee.pop()):Ue?(0!=xt?(re=1,a.bindTexture(a.TEXTURE_2D,W.office.rdoor.l)):a.bindTexture(a.TEXTURE_2D,W.office.rdoor.d),Ee.push(),Ee.translate([1664-ye-375,0]),Ee.scale([375,720]),Z(fe),Ee.pop()):0!=xt&&(re=1,Ee.push(),Ee.translate([1664-ye-525,0]),Ee.scale([525,720]),a.bindTexture(a.TEXTURE_2D,xt),Z(fe),Ee.pop());else{var oe=!1,se=Te-Et;if(1==Tt)a.bindTexture(a.TEXTURE_2D,W.office.js.longarms[se]),Ee.push(),Ee.scale([1280,720]),Z(fe),Ee.pop(),se>=24&&(oe=!0);else if(2==Tt){var le=se>9?9:se;a.bindTexture(a.TEXTURE_2D,W.office.js.wierdclimber[le]),Ee.push(),Ee.scale([1280,720]),Z(fe),Ee.pop(),se>=19&&(oe=!0)}else if(3==Tt)Ee.push(),Ee.translate([-ye,0]),Ee.scale([1664,720]),a.bindTexture(a.TEXTURE_2D,W.office.js.charles[se]),Z(fe),Ee.pop(),se>=19&&(oe=!0),se<17&&(Ue&&(a.bindTexture(a.TEXTURE_2D,W.office.rdoor.d),Ee.push(),Ee.translate([1664-ye-375,0]),Ee.scale([375,720]),Z(fe),Ee.pop()),De&&(a.bindTexture(a.TEXTURE_2D,W.office.ldoor.d),Ee.push(),Ee.translate([-ye,0]),Ee.scale([375,720]),Z(fe),Ee.pop()));else if(4==Tt)Ee.push(),Ee.translate([-ye,0]),Ee.scale([1664,720]),a.bindTexture(a.TEXTURE_2D,W.office.js.lax[se]),Z(fe),Ee.pop(),se>=17&&(oe=!0),Ue&&(a.bindTexture(a.TEXTURE_2D,W.office.rdoor.d),Ee.push(),Ee.translate([1664-ye-375,0]),Ee.scale([375,720]),Z(fe),Ee.pop());else if(5==Tt)a.bindTexture(a.TEXTURE_2D,W.office.js.winston[se]),Ee.push(),Ee.scale([1280,720]),Z(fe),Ee.pop(),se>=14&&(oe=!0);else if(6==Tt)a.bindTexture(a.TEXTURE_2D,W.office.js.winstondark[se]),Ee.push(),Ee.scale([1280,720]),Z(ce),Ee.pop(),se>=15&&(oe=!0);else if(7==Tt){0==kt&&n-nt>5e3&&(kt=1,Xt=ye,j(J.winstonsong,K.main));var me=Xt-ye;me<0&&(me=-me);var ue=50*me;ue>2e4&&(ue=2e4),1==kt&&n-nt>39e3-ue&&(kt=2,nt=n,Xt=ye,L()),2==kt&&n-nt>xe(300,1e3)&&(kt=3),3==kt&&n-nt>2e4-ue-10*me&&(Tt=6,Et=Te,L(),S());var de=!(2==kt&&0!=xe(0,2));kt<3&&de&&(a.bindTexture(a.TEXTURE_2D,W.office.dark1),Ee.push(),Ee.translate([-ye,0]),Ee.scale([1664,720]),Z(fe),Ee.pop()),oa(K.office,2==kt&&de?.05:0),1==kt&&(Te/2^3566)%3!=0&&(pe(.3,150/720),a.bindTexture(a.TEXTURE_2D,W.office.dark2),Ee.push(),Ee.translate([173-ye,100]),Ee.scale([110,150]),Z(fe),Ee.pop())}if(oe)return Vt(),j(J.static1,K.main),ge=4,void(nt=n)}oa(K.lights,re),E&&n-_e<1e4&&(i.font="20px VT323",i.fillStyle="#FFFFFF",G("press F to enter fullscreen and hide this message",50));var he=0==Tt?Te-Ie:2*(Te-Ie)+3;he<10?(Fe?a.bindTexture(a.TEXTURE_2D,W.office.cam_anim[he]):a.bindTexture(a.TEXTURE_2D,W.office.cam_anim[9-he]),Ee.push(),Ee.scale([1280,720]),Z(ce),Ee.pop()):Rt||0!=Tt||(Le||(a.bindTexture(a.TEXTURE_2D,W.office.camzone),Ee.push(),Ee.translate([320,650]),Ee.scale([600,60]),Z(ce),Ee.pop()),!St&&n-Mt>6e3&&n-Mt<15e3&&(1==it?(a.bindTexture(a.TEXTURE_2D,W.skipcall),T&&be(10,10,110,45)&&(tt=2,Ye+=1,qe+=1,Ct=n+1e3,vt-=200,oa(K.call,0),j(J.staticloop,K.main),St=!0)):(a.bindTexture(a.TEXTURE_2D,W.mutecall),T&&be(10,10,110,45)&&(oa(K.call,0),St=!0)),Ee.push(),Ee.translate([10,10]),Ee.scale([100,35]),Z(ce),Ee.pop()),0!=It&&69!=It&&(Lt?(a.bindTexture(a.TEXTURE_2D,1==It?W.sticky1:2==It?W.sticky2:3==It?W.sticky3:W.sticky4),Ee.push(),Ee.translate([490,200]),Ee.scale([300,300]),Z(ce),Ee.pop(),(_[27]||T&&!be(490,200,790,500)&&!be(1070,585,1280,720))&&(Lt=!1,It=69)):(a.bindTexture(a.TEXTURE_2D,W.foundsticky),C(),Ee.push(),Ee.translate([1070,585]),Ee.scale([200,125]),$(Math.sin(Te/5)/13+.6),Ee.pop(),B(),T&&be(1070,585,1280,720)&&(j(J.stickyopen,K.main),Lt=!0))),n-Ct<0&&Kt()),la+=.1*Math.random()-.06,Math.random()<.001&&(la+=.7*Math.random()-.35),la<0&&(la=0),la>.3&&(la-=.2),la>1&&(la=1),Ee.push(),Ee.scale([1280,720]),ee([0,0,0,.3*la]),Ee.pop()}var qt=1;if(0==bt&&0==xt||(qt+=1),Ue&&(qt+=1),De&&(qt+=1),ke&&(qt+=1),(2==it&&n-_t>6e3||3==it&&n-_t>5e3||4==it&&n-_t>4e3||it>=5&&n-_t>3e3&&!Bt)&&(_t=n,vt-=1),n-yt>=1e3&&!Bt&&(yt=n,(vt-=qt)<=5&&!Rt&&(De&&(De=!1,Ae=Te,j(J.door,K.main)),Ue&&(Ue=!1,Xe=Te,j(J.door,K.main)),ke&&(Ie=Te,Fe=!1,ke=!1),Rt=!0)),0==Tt&&(vt<=0&&(Tt=7,oa(K.office,0),oa(K.sstatic,0),oa(K.camglitch,0),oa(K.ambience,0),nt=n,j(J.powerloss,K.main)),!Lt&&n-Ct>100)){var ia=Math.floor(vt/10);i.font="40px font",i.fillStyle="#FFFFFF",O(0==tt?"12 AM":tt+" AM",40,65),i.font="20px font",O("Night "+it,40,95),i.fillText("Power Left: %",40,650),i.font="26.5px font",i.fillText(ia<10?" "+ia:ia,177,650),i.font="20px font",i.fillText("Usage: "+"#".repeat(qt),40,680)}ut=n}else if(4==ge)n-nt<1e4?Kt():n-nt<15e3?(a.bindTexture(a.TEXTURE_2D,W.death),Ee.push(),Ee.scale([1280,720]),Z(ce),Ee.pop()):(ge=1,zt());else if(5==ge){var ra=(n-nt-2e3)/1e3;ra<0&&(ra=0),ra>1&&(ra=1),ra*=150,i.fillStyle="#FFFFFF",i.font="150px font",G("5 ",410-ra),G("6 ",560-ra),G(" AM",410),i.fillStyle="#000000",i.fillRect(350,0,500,280),i.fillRect(350,410,500,305),n-nt>1e4&&(5==it?(ga(!0),nt=n,ge=6,j(J.sticknya,K.main)):6==it?(ha(!0),nt=n,ge=6,j(J.sticknya,K.main)):7==it?(20!=We||20!=Ye||20!=qe||20!=Je||20!=Ke||Bt||Nt||Gt||Ta(!0),nt=n,ge=6,j(J.sticknya,K.main)):8==it?(ge=1,zt()):(wa(it+1),Re=it+1,j(J.camswitch,K.main),fa=Te,ge=2))}else if(6==ge)5==it&&a.bindTexture(a.TEXTURE_2D,W.check1),6==it&&a.bindTexture(a.TEXTURE_2D,W.check2),7==it&&a.bindTexture(a.TEXTURE_2D,W.check3),Ee.push(),Ee.scale([1280,720]),Z(ce),Ee.pop(),n-nt>24500&&(L(),ge=1,zt());else if(7==ge){if(a.bindTexture(a.TEXTURE_2D,W.customnight),Ee.push(),Ee.scale([1280,720]),Z(ce),Ee.pop(),Ee.push(),Ee.translate([30,30]),Ee.scale([50,50]),a.bindTexture(a.TEXTURE_2D,W.x),Z(ce),Ee.pop(),T){var sa=!0;be(48,419,97,483)?Ht.longarms>0&&(Ht.longarms-=1):be(204,419,253,483)?Ht.longarms<20&&(Ht.longarms+=1):be(297,419,346,483)?Ht.wierdclimber>0&&(Ht.wierdclimber-=1):be(453,419,502,483)?Ht.wierdclimber<20&&(Ht.wierdclimber+=1):be(549,419,598,483)?Ht.laxdude>0&&(Ht.laxdude-=1):be(705,419,754,483)?Ht.laxdude<20&&(Ht.laxdude+=1):be(797,419,846,483)?Ht.charles>0&&(Ht.charles-=1):be(953,419,1002,483)?Ht.charles<20&&(Ht.charles+=1):be(1042,419,1091,483)?Ht.winston>0&&(Ht.winston-=1):be(1198,419,1247,483)?Ht.winston<20&&(Ht.winston+=1):be(702,517,755,542)?Ht.infinitepower=!Ht.infinitepower:be(702,550,755,575)?Ht.reducedstatic=!Ht.reducedstatic:be(702,583,755,608)?Ht.noaggression=!Ht.noaggression:be(360,634,409,698)?((Ot-=1)<0&&(Ot=Pt.length-1),Ht=JSON.parse(JSON.stringify(Pt[Ot]))):be(1199,634,1248,698)?((Ot+=1)>Pt.length-1&&(Ot=0),Ht=JSON.parse(JSON.stringify(Pt[Ot]))):be(867,517,1249,620)?(sa=!1,Re=7,L(),j(J.camswitch,K.main),fa=Te,ge=2):be(30,30,80,80)?(sa=!1,ge=1):sa=!1,sa&&j(J.doorerr,K.main)}_[27]&&(ge=1),i.fillStyle="#FFFFFF",i.font="60px font",i.fillText(Ht.longarms<10?" "+Ht.longarms:Ht.longarms,116,477),i.fillText(Ht.wierdclimber<10?" "+Ht.wierdclimber:Ht.wierdclimber,364,477),i.fillText(Ht.laxdude<10?" "+Ht.laxdude:Ht.laxdude,612,477),i.fillText(Ht.charles<10?" "+Ht.charles:Ht.charles,863,477),i.fillText(Ht.winston<10?" "+Ht.winston:Ht.winston,1108,477),function(e,t,a,n){i.fillText(e,a+(t-i.measureText(e).width)/2,n)}(Ht.name,780,409,684),i.font="30px font",Ht.infinitepower&&i.fillText("X",720,543),Ht.reducedstatic&&i.fillText("X",720,575),Ht.noaggression&&i.fillText("X",720,608)}for(_[70]&&A(),h=!1,T=!1,r=0;r<255;r++)_[r]=!1,y[r]=!1;for(;(t=a.getError())!=a.NO_ERROR;)t==a.INVALID_ENUM?console.log("GL ERROR: INVALID_ENUM"):t==a.INVALID_VALUE?console.log("GL ERROR: INVALID_VALUE"):t==a.INVALID_OPERATION?console.log("GL ERROR: INVALID_OPERATION"):t==a.INVALID_FRAMEBUFFER_OPERATION?console.log("GL ERROR: INVALID_FRAMEBUFFER_OPERATION"):t==a.OUT_OF_MEMORY?console.log("GL ERROR: OUT_OF_MEMORY"):t==a.CONTEXT_LOST_WEBGL&&console.log("GL ERROR: CONTEXT_LOST_WEBGL")},1e3/30)});