85 lines
6.6 KiB
JavaScript
85 lines
6.6 KiB
JavaScript
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerpolicy&&(o.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?o.credentials="include":r.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();function a(){}function N(e){return e()}function k(){return Object.create(null)}function _(e){e.forEach(N)}function O(e){return typeof e=="function"}function C(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let m;function F(e,t){return m||(m=document.createElement("a")),m.href=t,e===m.href}function I(e){return Object.keys(e).length===0}function R(e,t){e.appendChild(t)}function S(e,t,n){e.insertBefore(t,n||null)}function h(e){e.parentNode&&e.parentNode.removeChild(e)}function A(e){return document.createElement(e)}function q(e){return document.createTextNode(e)}function z(){return q(" ")}function B(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function T(e){return Array.from(e.childNodes)}let x;function d(e){x=e}const u=[],D=[],g=[],L=[],U=Promise.resolve();let v=!1;function G(){v||(v=!0,U.then(P))}function y(e){g.push(e)}const b=new Set;let p=0;function P(){const e=x;do{for(;p<u.length;){const t=u[p];p++,d(t),H(t.$$)}for(d(null),u.length=0,p=0;D.length;)D.pop()();for(let t=0;t<g.length;t+=1){const n=g[t];b.has(n)||(b.add(n),n())}g.length=0}while(u.length);for(;L.length;)L.pop()();v=!1,b.clear(),d(e)}function H(e){if(e.fragment!==null){e.update(),_(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(y)}}const J=new Set;function K(e,t){e&&e.i&&(J.delete(e),e.i(t))}function W(e,t,n,s){const{fragment:r,after_update:o}=e.$$;r&&r.m(t,n),s||y(()=>{const c=e.$$.on_mount.map(N).filter(O);e.$$.on_destroy?e.$$.on_destroy.push(...c):_(c),e.$$.on_mount=[]}),o.forEach(y)}function Y(e,t){const n=e.$$;n.fragment!==null&&(_(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Q(e,t){e.$$.dirty[0]===-1&&(u.push(e),G(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function V(e,t,n,s,r,o,c,j=[-1]){const f=x;d(e);const i=e.$$={fragment:null,ctx:[],props:o,update:a,not_equal:r,bound:k(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(f?f.$$.context:[])),callbacks:k(),dirty:j,skip_bound:!1,root:t.target||f.$$.root};c&&c(i.root);let $=!1;if(i.ctx=n?n(e,t.props||{},(l,w,...E)=>{const M=E.length?E[0]:w;return i.ctx&&r(i.ctx[l],i.ctx[l]=M)&&(!i.skip_bound&&i.bound[l]&&i.bound[l](M),$&&Q(e,l)),w}):[],i.update(),$=!0,_(i.before_update),i.fragment=s?s(i.ctx):!1,t.target){if(t.hydrate){const l=T(t.target);i.fragment&&i.fragment.l(l),l.forEach(h)}else i.fragment&&i.fragment.c();t.intro&&K(e.$$.fragment),W(e,t.target,t.anchor,t.customElement),P()}d(f)}class X{$destroy(){Y(this,1),this.$destroy=a}$on(t,n){if(!O(n))return a;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(n),()=>{const r=s.indexOf(n);r!==-1&&s.splice(r,1)}}$set(t){this.$$set&&!I(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function Z(e){let t,n,s,r;return{c(){t=A("script"),s=z(),r=A("main"),r.innerHTML=`<div class="window"><div class="title-bar"><div class="title-bar-text">Doom 95</div>
|
|
<div class="title-bar-controls"><button aria-label="Minimize"></button>
|
|
<button aria-label="Maximize"></button>
|
|
<button aria-label="Close"></button></div></div>
|
|
|
|
<div class="window-body" style="padding:0; margin:0;"><div id="container" class="noselect"><canvas class="frame" id="canvas" oncontextmenu="event.preventDefault()" tabindex="-1" style="cursor: default; margin: 0; padding: 0;"></canvas></div>
|
|
<script>var commonArgs = [
|
|
"-iwad",
|
|
"doom1.wad",
|
|
"-window",
|
|
"-nogui",
|
|
"-nomusic",
|
|
"-config",
|
|
"default.cfg",
|
|
"-servername",
|
|
"doomflare",
|
|
];
|
|
|
|
var Module = {
|
|
onRuntimeInitialized: () => {
|
|
callMain(commonArgs);
|
|
},
|
|
noInitialRun: true,
|
|
preRun: () => {
|
|
Module.FS.createPreloadedFile(
|
|
"",
|
|
"doom1.wad",
|
|
"doom1.wad",
|
|
true,
|
|
true
|
|
);
|
|
Module.FS.createPreloadedFile(
|
|
"",
|
|
"default.cfg",
|
|
"default.cfg",
|
|
true,
|
|
true
|
|
);
|
|
},
|
|
printErr: function (text) {
|
|
if (arguments.length > 1)
|
|
text = Array.prototype.slice.call(arguments).join(" ");
|
|
console.error(text);
|
|
},
|
|
canvas: (function () {
|
|
var canvas = document.getElementById("canvas");
|
|
canvas.addEventListener(
|
|
"webglcontextlost",
|
|
function (e) {
|
|
alert("WebGL context lost. You will need to reload the page.");
|
|
e.preventDefault();
|
|
},
|
|
false
|
|
);
|
|
return canvas;
|
|
})(),
|
|
print: function (text) {
|
|
console.log(text);
|
|
},
|
|
setStatus: function (text) {
|
|
console.log(text);
|
|
},
|
|
totalDependencies: 0,
|
|
monitorRunDependencies: function (left) {
|
|
this.totalDependencies = Math.max(this.totalDependencies, left);
|
|
Module.setStatus(
|
|
left
|
|
? "Preparing... (" +
|
|
(this.totalDependencies - left) +
|
|
"/" +
|
|
this.totalDependencies +
|
|
")"
|
|
: "All downloads complete."
|
|
);
|
|
},
|
|
};
|
|
|
|
window.onerror = function (event) {
|
|
Module.setStatus("Exception thrown, see JavaScript console");
|
|
Module.setStatus = function (text) {
|
|
if (text) Module.printErr("[post-exception status] " + text);
|
|
};
|
|
};<\/script></div>
|
|
<div class="status-bar"><p class="status-bar-field">CPU Usage: 666%</p></div></div>`,F(t.src,n="websockets-doom.js")||B(t,"src",n)},m(o,c){R(document.head,t),S(o,s,c),S(o,r,c)},p:a,i:a,o:a,d(o){h(t),o&&h(s),o&&h(r)}}}class ee extends X{constructor(t){super(),V(this,t,null,Z,C,{})}}new ee({target:document.getElementById("app")});
|