Panel dummy: waktu rekaman tidak pernah negatif

This commit is contained in:
rizkyaz0 2026-10-05 14:57:35 +07:00
parent a5a75176e6
commit 8134df0b86
1 changed files with 2 additions and 2 deletions

View File

@ -138,7 +138,7 @@
function stopRec(why) {
if (R.state === 'armed') { R.state = 'idle'; if (R.keep) Object.assign(R, R.keep); R.keep = null; say(R.ev.length ? 'Perekaman dibatalkan; rekaman sebelumnya masih ada.' : 'Perekaman dibatalkan.', ''); return; }
if (R.state !== 'rec') return;
const rel = S.time - R.t0; for (const k of R.down) R.ev.push({ t: rel, k, d: 0 }); R.down.clear();
const rel = Math.max(0, S.time - R.t0); for (const k of R.down) R.ev.push({ t: rel, k, d: 0 }); R.down.clear();
R.dur = rel; R.ref = stats(); R.state = 'idle';
say(R.ev.length ? (why === 'batas' ? 'Batas 10 dtk tercapai. ' : '') + 'Rekaman siap. Tekan PUTAR.' : 'Tidak ada input terekam.', R.ev.length ? 'good' : 'bad');
}
@ -248,7 +248,7 @@
if (ai && S.beh !== 'cpu') S.beh = 'cpu'; else if (!ai && S.beh === 'cpu') S.beh = 'diam'; // Pengaturan mengubah Lawan aktif
const busy = R.state !== 'idle', st = g.stats?.() || { comboHits: 0, bestCombo: 0, totalDamage: 0, comboDamage: 0 };
if (st.comboHits > 0) { S.cmb.live = true; S.cmb.hits = st.comboHits; S.cmb.dmg = st.comboDamage || 0; } else if (S.cmb.live) { S.cmb.live = false; S.cmb.last = { hits: S.cmb.hits, dmg: S.cmb.dmg }; }
const relNow = R.state === 'rec' ? S.time - R.t0 : R.state === 'play' && R.p0 !== null ? S.time - R.p0 : 0;
const relNow = Math.max(0, R.state === 'rec' ? S.time - R.t0 : R.state === 'play' && R.p0 !== null ? S.time - R.p0 : 0);
const hb = hbOn();
const key = JSON.stringify([S.open, S.side, S.beh, S.inf, S.fd, hb, R.state, R.ev.length, Math.floor(relNow * 5), R.dur, R.msg, S.cmb.live, S.cmb.hits, S.cmb.dmg, S.cmb.last, st.bestCombo, st.totalDamage, S.fd ? S.fdn : 0]);
if (key === S.key) return; S.key = key;