-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr-min.js
1 lines (1 loc) · 5.2 KB
/
r-min.js
1
"use strict";class JudgeLineEvent{constructor(e,t,s,n,o,i){this.startTime=o,this.endTime=i,this.start=e,this.end=t,this.start2=s,this.end2=n}}class Note{constructor(e,t,s,n,o){this.type=e,this.time=t,this.positionX=s,this.holdTime=n,this.speed=o,this.floorPosition=0}}class SpeedEvent{constructor(e,t,s){this.startTime=t,this.endTime=s,this.floorPosition=0,this.value=e}}class JudgeLine{constructor(){this.numOfNotes=0,this.numOfNotesAbove=0,this.numOfNotesBelow=0,this.bpm=120,this.speedEvents=[],this.notesAbove=[],this.notesBelow=[],this.judgeLineDisappearEvents=[],this.judgeLineMoveEvents=[],this.judgeLineRotateEvents=[]}updateSefp(){let e=0;this.speedEvents.sort((e,t)=>e.startTime-t.startTime);for(const t of this.speedEvents)t.startTime<0&&(t.startTime=0),t.floorPosition=e,e+=(t.endTime-t.startTime)*t.value/this.bpm*1.875;this.speedEvents[this.speedEvents.length-1].endTime=1e9;for(const e of this.notesAbove){let t=0,s=0,n=0;for(const o of this.speedEvents)if(!(e.time%1e9>o.endTime)){if(e.time%1e9<o.startTime)break;t=o.floorPosition,s=o.value,n=e.time%1e9-o.startTime}e.floorPosition=t+s*n/this.bpm*1.875}for(const e of this.notesBelow){let t=0,s=0,n=0;for(const o of this.speedEvents)if(!(e.time%1e9>o.endTime)){if(e.time%1e9<o.startTime)break;t=o.floorPosition,s=o.value,n=e.time%1e9-o.startTime}e.floorPosition=t+s*n/this.bpm*1.875}}updateDe(){this.judgeLineDisappearEvents.sort((e,t)=>e.startTime-t.startTime),this.judgeLineMoveEvents.sort((e,t)=>e.startTime-t.startTime),this.judgeLineRotateEvents.sort((e,t)=>e.startTime-t.startTime),this.judgeLineDisappearEvents=arrangeLineEvent(this.judgeLineDisappearEvents),this.judgeLineMoveEvents=arrangeLineEvent(this.judgeLineMoveEvents),this.judgeLineRotateEvents=arrangeLineEvent(this.judgeLineRotateEvents)}}class Chart{constructor(){this.formatVersion=3,this.offset=0,this.numOfNotes=0,this.judgeLineList=[]}}function reverseChart(e,t){const s=new Chart;s.offset=-e.offset;for(const n of e.judgeLineList){const e=new JudgeLine,o=t*n.bpm/1.875;e.bpm=n.bpm;for(const t of n.speedEvents)e.speedEvents.push(new SpeedEvent(t.value,o-t.endTime,o-t.startTime));for(const t of n.notesAbove)e.notesAbove.push(new Note(t.type,o-t.time-t.holdTime,t.positionX,t.holdTime,t.speed)),e.numOfNotesAbove++;for(const t of n.notesBelow)e.notesBelow.push(new Note(t.type,o-t.time-t.holdTime,t.positionX,t.holdTime,t.speed)),e.numOfNotesBelow++;e.numOfNotes+=e.numOfNotesAbove+e.numOfNotesBelow,s.numOfNotes+=e.numOfNotes,e.updateSefp();for(const t of arrangeLineEvent(n.judgeLineDisappearEvents))e.judgeLineDisappearEvents.push(new JudgeLineEvent(t.end,t.start,t.end2,t.start2,o-t.endTime,o-t.startTime));for(const t of arrangeLineEvent(n.judgeLineMoveEvents))e.judgeLineMoveEvents.push(new JudgeLineEvent(t.end,t.start,t.end2,t.start2,o-t.endTime,o-t.startTime));for(const t of arrangeLineEvent(n.judgeLineRotateEvents))e.judgeLineRotateEvents.push(new JudgeLineEvent(t.end,t.start,t.end2,t.start2,o-t.endTime,o-t.startTime));e.updateDe(),s.judgeLineList.push(e)}return JSON.parse(JSON.stringify(s))}!function(){const e=document.querySelector(".title");e.addEventListener("mousedown",i),e.addEventListener("touchstart",i);let t=120,s=0,n=0,o=0;function i(){const n=setInterval(()=>{qwq[1]||(e.style.cssText+=`;filter:hue-rotate(${3*(t+=t%120?1:-119)}deg)`),401*Math.random()<!qwq[1]&&(s=1),s&&(qwq[4]=!alert("Hyperer Mode is on..."),clearInterval(n),e.removeEventListener("mousedown",i),e.removeEventListener("touchstart",i),setInterval(()=>e.style.cssText+=`;filter:hue-rotate(${3*(t+=t%120?1:-119)}deg)`,20),e.removeEventListener("mouseup",o),e.removeEventListener("mouseleave",o),e.removeEventListener("touchend",o),e.removeEventListener("touchcancel",o))},20);function o(){e.removeEventListener("mouseup",o),e.removeEventListener("mouseleave",o),e.removeEventListener("touchend",o),e.removeEventListener("touchcancel",o),clearInterval(n),e.style.cssText+=";filter:hue-rotate(0deg);",s||(t=120)}e.addEventListener("mouseup",o),e.addEventListener("mouseleave",o),e.addEventListener("touchend",o),e.addEventListener("touchcancel",o)}function r(){if(qwqEnd.second<=0||stat.good+stat.bad)return;console.log("qwq");const e=setInterval(()=>{if(180==++o&&(n=1),!qwq[5]&&n){qwq[5]=!alert("Reverse Mode is on..."),btnPlay.classList.add("disabled");for(const e of document.querySelectorAll("*"))!e.children.length&&(e.innerText=e.innerText.split("").reverse().join(""));for(let e=0;e<Renderer.bgMusic.numberOfChannels;e++)Renderer.bgMusic.getChannelData(e).reverse();charts[selectchart.value]=reverseChart(Renderer.chart2,Renderer.bgMusic.duration),specialClick.func[1](),clearInterval(e),canvas.removeEventListener("mousedown",i),canvas.removeEventListener("mouseup",t),canvas.removeEventListener("mouseleave",t),canvas.removeEventListener("touchstart",i),canvas.removeEventListener("touchend",t),canvas.removeEventListener("touchcancel",t)}},20);function t(){canvas.removeEventListener("mouseup",t),canvas.removeEventListener("mouseleave",t),canvas.removeEventListener("touchend",t),canvas.removeEventListener("touchcancel",t),clearInterval(e)}canvas.addEventListener("mouseup",t),canvas.addEventListener("mouseleave",t),canvas.addEventListener("touchend",t),canvas.addEventListener("touchcancel",t)}canvas.addEventListener("mousedown",r),canvas.addEventListener("touchstart",r)}();