Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions e63334287a3deaa3/ironveil/es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 18 additions & 5 deletions e63334287a3deaa3/ironveil/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@
.h-ammo .pips{display:flex;justify-content:flex-end;gap:2px;margin-top:5px}.h-ammo .pips i{width:3px;height:9px;background:var(--ink)}.h-ammo .pips i.off{background:var(--faint)}
.h-ammo small{display:block;font-family:var(--f-type);font-size:10px;letter-spacing:.2em;color:var(--dim);margin-top:5px}
.h-mark{position:absolute;left:0;top:0;display:flex;flex-direction:column;align-items:center;gap:2px;font-family:var(--f-type);font-size:10px;letter-spacing:.1em;color:var(--brass);will-change:transform}
.h-mark.ping{color:#9fd3ff}.h-mark.ping i{border-color:#9fd3ff;border-radius:50%;transform:none}
#h-status{position:absolute;right:var(--gr);top:50%;transform:translateY(-50%);width:min(280px,70vw);background:var(--solid);border:1px solid var(--line);border-left:3px solid var(--brass);padding:14px 18px;opacity:0;transition:opacity .12s}#h-status.on{opacity:1}
#h-status h3{font-family:var(--f-stencil);font-weight:800;font-size:20px;letter-spacing:.06em;margin:0 0 8px;text-transform:uppercase}#h-status dl{display:grid;grid-template-columns:1fr auto;gap:5px 14px;margin:0;font-family:var(--f-type);font-size:13px}#h-status dt{color:var(--dim)}#h-status dd{margin:0;text-align:right}
#h-map{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:none;background:rgba(222,212,186,.95);padding:10px;box-shadow:0 10px 40px rgba(0,0,0,.6)}#h-map.on{display:block}#h-map canvas{display:block;width:min(70vh,82vw);height:min(70vh,82vw)}#h-map p{margin:6px 0 0;font-family:var(--f-type);font-size:12px;color:#3a3326;text-align:center;text-shadow:none}
.h-ammo #h-nd{color:var(--ink)}
.h-mark i{width:11px;height:11px;border:1.5px solid var(--brass);transform:rotate(45deg);margin:3px}.h-mark.exit i{background:var(--brass)}.h-mark.opt{color:var(--dim)}.h-mark.opt i{border-style:dashed;border-color:var(--dim)}.h-mark b{font-family:var(--f-stencil);font-size:13px}
#radio{position:absolute;left:50%;bottom:calc(var(--gb) + 74px);transform:translateX(-50%);width:min(640px,76vw);text-align:center;opacity:0;transition:opacity .3s;text-shadow:var(--shadow);pointer-events:none}
#radio.on{opacity:1}#radio b{font-family:var(--f-ui);font-weight:700;font-size:13px;letter-spacing:.2em;color:var(--brass);text-transform:uppercase;margin-right:8px}
Expand All @@ -126,6 +131,7 @@
#t-crouch{right:calc(var(--gr) + 178px);bottom:calc(var(--gb) + 22px)}
#t-use{left:50%;margin-left:-44px;width:88px;top:calc(62% + 44px);border-radius:8px;height:44px;display:none;border-color:var(--brass);color:var(--brass)}
#t-use.show{display:block}
#t-nade{right:calc(var(--gr) + 178px);bottom:calc(var(--gb) + 100px)}
#t-pause{right:var(--gr);top:var(--gt);width:42px;height:42px;border-radius:6px;font-size:16px}
body.touch .h-ammo{bottom:auto;top:calc(var(--gt) + 50px)}body.touch .h-ammo b{font-size:34px}body.touch .h-ammo .pips{display:none}
body.touch .h-hp{bottom:auto;top:calc(var(--gt) + 64px)}body.touch #radio{bottom:auto;top:calc(var(--gt) + 110px)}
Expand All @@ -144,7 +150,7 @@
.btn{font-family:var(--f-ui);font-weight:700;font-size:17px;letter-spacing:.22em;text-transform:uppercase;padding:13px 26px 12px;border:1.5px solid var(--line);background:var(--plate);color:var(--ink);min-height:48px;transition:background .15s,border-color .15s,color .15s}
.btn:hover{border-color:var(--ink)}.btn.go{background:var(--brass);border-color:var(--brass);color:#14110a}.btn.go:hover{background:var(--brass-hot)}
.t-foot{font-family:var(--f-type);font-size:11px;letter-spacing:.06em;color:var(--dim);margin-top:18px;max-width:34em;line-height:1.5}
.t-keys{position:absolute;right:var(--gr);bottom:calc(var(--gb) + 26px);display:grid;grid-template-columns:repeat(2,auto);gap:5px 22px;font-family:var(--f-type);font-size:11px;letter-spacing:.12em;color:var(--dim);text-transform:uppercase}
.t-keys{position:absolute;right:var(--gr);bottom:calc(var(--gb) + 26px);display:grid;grid-template-columns:repeat(3,auto);gap:5px 22px;font-family:var(--f-type);font-size:11px;letter-spacing:.12em;color:var(--dim);text-transform:uppercase}
.t-keys kbd,.ctl kbd{font-family:var(--f-type);font-size:10px;border:1px solid var(--line);padding:1px 5px 0;margin-right:6px;color:var(--ink)}
body.touch .t-keys{display:none}
.card-wrap{align-items:center;justify-content:center;background:rgba(9,11,13,.72);padding:20px}
Expand Down Expand Up @@ -182,6 +188,7 @@
.h-clock{left:auto;right:var(--gr);top:calc(var(--gt) + 134px);font-size:15px;text-align:right}
}
@media (max-height:460px){
#t-nade{right:calc(var(--gr) + 250px);bottom:calc(var(--gb) + 70px);width:50px;height:50px}
.h-obj{max-width:calc(28vw - 20px)}.h-obj b{font-size:15px}.h-clock{top:calc(var(--gt) + 84px);font-size:16px}
.t-logo{font-size:clamp(40px,15vh,90px)}.t-rule{margin:8px 0}.t-btns{margin-top:10px}.t-foot{display:none}.t-line{font-size:13px}
#t-jump{bottom:calc(var(--gb) + 14px);right:calc(var(--gr) + 112px)}#t-fire{bottom:calc(var(--gb) + 60px)}#t-aim{right:calc(var(--gr) + 112px);bottom:calc(var(--gb) + 82px)}#t-reload{right:calc(var(--gr) + 186px);bottom:calc(var(--gb) + 46px)}#t-crouch{right:calc(var(--gr) + 250px);bottom:calc(var(--gb) + 6px);width:50px;height:50px}
Expand Down Expand Up @@ -209,8 +216,11 @@
<div class="h-prompt" id="h-prompt"><span><kbd>E</kbd><em id="h-pt" style="font-style:normal"></em></span><u><s id="h-pb"></s></u></div>
<div class="h-msg" id="h-msg"></div>
<div class="h-hp" id="h-hp"><small id="h-hpl"></small><u><s id="h-hpb"></s></u></div>
<div class="h-ammo"><b id="h-am">30</b><em id="h-ar">/ 150</em><div class="pips" id="h-pips"></div><small id="h-wn"></small></div>
<div class="h-ammo"><b id="h-am">30</b><em id="h-ar">/ 150</em><div class="pips" id="h-pips"></div><small id="h-wn"></small><small id="h-nd"></small></div>
<div id="marks"></div>
<div class="h-mark ping" id="h-ping" style="display:none"><b>V</b><i></i><span></span></div>
<div id="h-status"><h3 id="hs-t"></h3><dl id="hs-l"></dl></div>
<div id="h-map"><canvas id="h-mapc"></canvas><p id="h-mapk"></p></div>
</div>
<div id="radio" data-noi18n><b id="r-who"></b><span id="r-txt"></span></div>

Expand All @@ -222,6 +232,7 @@
<button class="tb" id="t-reload" data-no-ad-refresh>Load</button>
<button class="tb" id="t-crouch" data-no-ad-refresh>Duck</button>
<button class="tb" id="t-use" data-no-ad-refresh>Hold</button>
<button class="tb" id="t-nade" data-no-ad-refresh>Nade</button>
<button class="tb" id="t-pause" data-no-ad-refresh aria-label="Pause">II</button>
</div>

Expand All @@ -234,7 +245,7 @@ <h1 class="t-logo" id="logo">Midnight Ops</h1>
<p class="t-line" id="t-line"></p>
<div class="t-btns"><button class="btn go" id="b-deploy">Deploy</button><button class="btn" id="b-missions">Missions</button><button class="btn" id="b-settings">Settings</button><button class="btn" id="b-controls">Controls</button><a class="btn" href="/e63334287a3deaa3/" style="text-decoration:none;display:inline-flex;align-items:center">Back</a></div>
<p class="t-foot">Every stone, weapon and sound is made in your browser as the game starts. More missions are on the way.</p>
<div class="t-keys"><span><kbd>W A S D</kbd>Move</span><span><kbd>Mouse</kbd>Look</span><span><kbd>Left</kbd>Fire</span><span><kbd>Right</kbd>Aim</span><span><kbd>R</kbd>Reload</span><span><kbd>E</kbd>Plant charge</span><span><kbd>Shift</kbd>Sprint</span><span><kbd>C</kbd>Crouch</span><span><kbd>Space</kbd>Jump</span><span><kbd>Esc</kbd>Pause</span></div>
<div class="t-keys" id="t-keys"></div>
</div>

<div class="screen card-wrap" id="missions"><div class="card wide">
Expand Down Expand Up @@ -274,14 +285,16 @@ <h2>Settings</h2>
<label class="row"><span>Volume</span><input type="range" id="s-vol" min="0" max="1" step="0.05"></label>
<label class="row"><span>Invert look up and down</span><input type="checkbox" id="s-inv"></label>
<label class="row"><span>Blood effects</span><input type="checkbox" id="s-blood"></label>
<label class="row"><span>Keys</span><select id="s-keys"><option value="mac">Mac: Shift aims, Control sprints</option><option value="classic">Classic: Shift sprints, right click aims</option></select></label>
<label class="row"><span>Automatic reload</span><input type="checkbox" id="s-auto"></label>
<div class="row"><span>Language</span><span data-lang-toggle></span></div>
<p style="margin-top:12px">A change to Graphics takes effect when the page is opened again.</p>
<div class="t-btns"><button class="btn go" id="b-sclose">Done</button></div>
</div></div>

<div class="screen card-wrap" id="controls"><div class="card">
<h2>Controls</h2>
<div class="ctl"><b><kbd>W A S D</kbd></b><span>Move</span><b><kbd>Mouse</kbd></b><span>Look (arrow keys also work)</span><b><kbd>Left click</kbd></b><span>Fire</span><b><kbd>Right click</kbd></b><span>Aim down the sights</span><b><kbd>R</kbd></b><span>Reload</span><b><kbd>E</kbd></b><span>Hold to plant a charge on a gun</span><b><kbd>Shift</kbd></b><span>Sprint</span><b><kbd>C</kbd></b><span>Crouch (harder to see and to hit)</span><b><kbd>Space</kbd></b><span>Jump</span><b><kbd>Esc</kbd></b><span>Pause</span></div>
<div class="ctl" id="ctl-list"></div>
<p>On a phone or tablet: drag the left side of the screen to move, drag the right side to look, and use the buttons on the right. Push the move stick far forward to sprint.</p>
<div class="t-btns"><button class="btn go" id="b-cclose">Done</button></div>
</div></div>
Expand All @@ -295,7 +308,7 @@ <h2>Controls</h2>
<script>
if (window.IV_LOCKED) { document.getElementById('app').remove(); document.getElementById('locked').style.display = 'flex'; }
else {
var files = ['/lib/three/r187/three.min.js', '../autores.js', 'js/core.js', 'js/geo.js', 'js/tex.js', 'js/render.js', 'js/sky.js', 'js/ground.js', 'js/phys.js', 'js/props.js', 'js/missions.js', 'js/maps/hamlet.js', 'js/maps/compound.js', 'js/level.js', 'js/fx.js', 'js/audio.js', 'js/input.js', 'js/player.js', 'js/gunmodel.js', 'js/weapon.js', 'js/enemy.js', 'js/hud.js', 'js/mission.js', 'js/main.js'];
var files = ['/lib/three/r187/three.min.js', '../autores.js', 'js/core.js', 'js/geo.js', 'js/tex.js', 'js/render.js', 'js/sky.js', 'js/ground.js', 'js/phys.js', 'js/props.js', 'js/missions.js', 'js/maps/hamlet.js', 'js/maps/compound.js', 'js/level.js', 'js/fx.js', 'js/actions.js', 'js/audio.js', 'js/input.js', 'js/player.js', 'js/gunmodel.js', 'js/weapon.js', 'js/enemy.js', 'js/hud.js', 'js/mission.js', 'js/main.js'];
for (var i = 0; i < files.length; i++) document.write('<script src="' + files[i] + '"><\/script>');
}
</script>
Expand Down
67 changes: 67 additions & 0 deletions e63334287a3deaa3/ironveil/js/actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/* Midnight Ops: grenades (G) and pings (V).
A grenade is thrown along the view, bounces off walls and the ground (ray cast each step, the velocity reflected
and damped), and goes off 3.2 s after the throw: it kills or wounds soldiers within 7 m that it can "see", hurts
you within 6 m, and the bang brings everyone nearby. Two per life; ammunition pouches sometimes hold one more.
A ping marks whatever you are looking at for 10 seconds. */
(function () {
'use strict';
const MO = window.MO, AC = MO.actions = { live: [], ping: null };
const FUSE = 3.2, MAX = 4, hit = {}, v = new THREE.Vector3();
let pool = [];

AC.init = () => {
const S = MO.R.scene;
for (let i = 0; i < MAX; i++) { // the grenade: a ridged olive body, a fuse top and its lever
const b = new MO.Builder();
b.add(MO.lathe([[0, -0.055], [0.022, -0.052], [0.03, -0.04], [0.031, 0.02], [0.026, 0.04], [0.014, 0.05], [0, 0.05]], 12), 'paint_olive');
for (let k = 0; k < 4; k++) b.add(new THREE.TorusGeometry(0.031, 0.004, 4, 12), 'paint_olive', MO.xf(0, -0.035 + k * 0.018, 0, Math.PI / 2, 0, 0), 0.8);
b.cyl('steel_dark', 0.009, 0.009, 0.025, 0, 0.06, 0, { seg: 8 }); b.box('steel_dark', 0.012, 0.06, 0.006, 0.016, 0.045, 0, { rz: -0.25, ch: 0 });
const g = new THREE.Group(); b.build(g, { ao: false, dynamic: true }); g.visible = false; S.add(g);
pool.push({ g: g, on: false, p: new THREE.Vector3(), v: new THREE.Vector3(), w: new THREE.Vector3(), t: 0, bounces: 0 });
}
};
AC.reset = () => { for (const n of pool) { n.on = false; n.g.visible = false; } AC.ping = null; MO.hud && MO.hud.ping(null); };

AC.throwNade = () => {
const W = MO.weapon, P = MO.player, A = MO.audio;
if (W.nades <= 0) { MO.hud.msg(MO.T('No grenades left')); return; }
const n = pool.find((q) => !q.on); if (!n) return;
W.nades--; W.throwKick(); A && A.play('cloth', { vol: 0.9 }); A && A.play('bolt', { vol: 0.4, pitch: 1.6 });
const cam = MO.R.camera; cam.getWorldDirection(v);
n.on = true; n.t = FUSE; n.bounces = 0; n.p.copy(cam.position).addScaledVector(v, 0.5); n.p.y -= 0.12;
const up = MO.clamp(0.25 - v.y * 0.3, 0.05, 0.35);
n.v.copy(v).multiplyScalar(13).add(P.vel); n.v.y += 13 * up; n.w.set(Math.random() * 12 - 6, Math.random() * 12 - 6, Math.random() * 12 - 6);
n.g.position.copy(n.p); n.g.visible = true;
};
function blast(n) {
const P = MO.player, x = n.p.x, y = Math.max(0.15, n.p.y), z = n.p.z;
MO.fx.explosion(x, y - 0.3, z, 0.8); MO.audio && MO.audio.play('explosion', { x: x, y: y, z: z, vol: 1 });
for (const s of MO.enemies.list) { if (!s.alive) continue; const d = Math.hypot(s.x - x, s.z - z); if (d > 7) continue;
if (!MO.phys.los(x, y + 0.3, z, s.x, 1.0, s.z)) continue; s.hit(Math.round(260 * Math.pow(1 - d / 7, 1.2)) + 10, false, s.x - x, s.z - z); }
const dp = Math.hypot(P.pos.x - x, P.pos.z - z); if (dp < 6 && MO.phys.los(x, y + 0.3, z, P.pos.x, P.pos.y + 1, P.pos.z)) P.damage(Math.round(95 * (1 - dp / 6)), x, z);
MO.emit('shot', x, z); MO.enemies.shout(x, z, 35, P.pos.x, P.pos.z);
}
AC.update = (dt) => {
const I = MO.input, P = MO.player;
if (I.nadeP && P.alive && !MO.R.hideWeapon && !MO.weapon.reloading && (MO.mission.state === 'play')) AC.throwNade();
if (I.pingP && P.alive) { const cam = MO.R.camera; cam.getWorldDirection(v);
const d = MO.phys.ray(cam.position.x, cam.position.y, cam.position.z, v.x, v.y, v.z, 160, hit, true) ? hit.t : 70; // nothing in the way: mark a spot in the distance
AC.ping = { x: cam.position.x + v.x * d, y: Math.max(0.3, cam.position.y + v.y * d + 0.3), z: cam.position.z + v.z * d, t: 10 }; MO.hud.ping(AC.ping); MO.audio && MO.audio.play('ui_click', { vol: 0.5 }); }
if (AC.ping) { AC.ping.t -= dt; if (AC.ping.t <= 0) { AC.ping = null; MO.hud.ping(null); } }
for (const n of pool) { if (!n.on) continue;
n.t -= dt;
const steps = 3, h = dt / steps;
for (let s = 0; s < steps; s++) {
n.v.y -= 9.8 * h; const sp = n.v.length(), d = sp * h;
if (d > 1e-5 && MO.phys.ray(n.p.x, n.p.y, n.p.z, n.v.x / sp, n.v.y / sp, n.v.z / sp, d + 0.04, hit, true)) {
n.p.set(hit.x + hit.nx * 0.045, Math.max(0.045, hit.y + hit.ny * 0.045), hit.z + hit.nz * 0.045);
const vn = n.v.x * hit.nx + n.v.y * hit.ny + n.v.z * hit.nz; n.v.x -= 1.4 * vn * hit.nx; n.v.y -= 1.4 * vn * hit.ny; n.v.z -= 1.4 * vn * hit.nz; n.v.multiplyScalar(0.62); n.w.multiplyScalar(0.6); if (hit.ny > 0.7) { n.v.x *= 0.45; n.v.z *= 0.45; } // the ground grips: it doesn't skid far
if (n.bounces++ < 3 && sp > 2) MO.audio && MO.audio.play('shell', { x: n.p.x, y: n.p.y, z: n.p.z, vol: 0.9, pitch: 0.55 });
} else n.p.addScaledVector(n.v, h);
if (n.p.y < 0.05) { n.p.y = 0.045; if (n.v.y < 0) n.v.y *= -0.3; n.v.x *= 0.82; n.v.z *= 0.82; }
}
n.g.position.copy(n.p); n.g.rotation.x += n.w.x * dt; n.g.rotation.y += n.w.y * dt; n.g.rotation.z += n.w.z * dt;
if (n.t <= 0) { n.on = false; n.g.visible = false; blast(n); }
}
};
})();
2 changes: 1 addition & 1 deletion e63334287a3deaa3/ironveil/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

// ---- settings and save. localStorage 'ironveil:save' = {v: 2, settings, missions: {id: {done, grade, best}}}
const KEY = 'ironveil:save';
const DEF = { quality: 'auto', sens: 1, invertY: false, vol: 0.8, fov: 74, blood: true };
const DEF = { quality: 'auto', sens: 1, invertY: false, vol: 0.8, fov: 74, blood: true, keys: /Mac/i.test(navigator.platform || navigator.userAgent) ? 'mac' : 'classic', autoReload: true };
const S = MO.save = { v: 2, settings: Object.assign({}, DEF), missions: {} };
try {
const j = JSON.parse(localStorage.getItem(KEY) || 'null');
Expand Down
Loading
Loading