From 92d31657443334a1409f599f805c76eb3e78f510 Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Thu, 27 Sep 2018 18:31:57 +0300 Subject: [PATCH] Parsesong: Fix drumroll timing --- public/src/css/game.css | 2 +- public/src/css/main.css | 7 ++++--- public/src/js/mekadon.js | 2 +- public/src/js/parsesong.js | 15 ++++++++++++--- public/src/js/scoresheet.js | 2 ++ 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/public/src/css/game.css b/public/src/css/game.css index 5708555..8416bbe 100644 --- a/public/src/css/game.css +++ b/public/src/css/game.css @@ -5,7 +5,7 @@ background-size: cover; } #game.default-bg{ - background-size: contain; + background-size: calc(100vh / 720 * 512); } #canvas{ position: relative; diff --git a/public/src/css/main.css b/public/src/css/main.css index 032f7c4..3ee4261 100644 --- a/public/src/css/main.css +++ b/public/src/css/main.css @@ -190,17 +190,18 @@ kbd{ } @keyframes bgscroll{ from{ - background-position: 0 0; + background-position: 0 center; } to{ - background-position: calc(-100vh / 720 * 512) 0; + background-position: calc(-100vh / 720 * 512) center; } } #song-select{ width: 100%; height: 100%; background-image: url("/assets/img/bg_genre_0.png"); - background-size: contain; + background-size: calc(100vh / 720 * 512); + background-repeat: repeat no-repeat; animation: bgscroll 16s infinite linear; white-space: nowrap; transition: background-image 0.5s; diff --git a/public/src/js/mekadon.js b/public/src/js/mekadon.js index 2864a82..2de0163 100644 --- a/public/src/js/mekadon.js +++ b/public/src/js/mekadon.js @@ -8,7 +8,7 @@ class Mekadon{ play(circle){ var type = circle.getType() if((type === "balloon" || type === "drumroll" || type === "daiDrumroll") && this.getMS() > circle.getEndTime()){ - circle.played(0, false) + circle.played(-1, false) this.game.updateCurrentCircle() } type = circle.getType() diff --git a/public/src/js/parsesong.js b/public/src/js/parsesong.js index 1b44ff2..5f9ad12 100644 --- a/public/src/js/parsesong.js +++ b/public/src/js/parsesong.js @@ -122,7 +122,8 @@ class ParseSong{ start: start, sliderMultiplier: sliderMultiplier, measure: parseInt(values[this.osu.METER]), - gogoTime: parseInt(values[this.osu.KIAIMODE]) + gogoTime: parseInt(values[this.osu.KIAIMODE]), + beatLength: msOrPercent }) } return timingPoints @@ -233,12 +234,14 @@ class ParseSong{ var gogoTime = false var osuType = parseInt(values[this.osu.TYPE]) var hitSound = parseInt(values[this.osu.HITSOUND]) + var beatLength = speed for(var j = 0; j < this.timingPoints.length; j++){ if(this.timingPoints[j].start > start){ break } speed = this.timingPoints[j].sliderMultiplier + beatLength = this.timingPoints[j].beatLength gogoTime = this.timingPoints[j].gogoTime } @@ -261,8 +264,14 @@ class ParseSong{ }else if(osuType & this.osu.SLIDER){ var extras = values.slice(this.osu.EXTRAS) - var pixelLength = parseFloat(extras[this.osu.PIXELLENGTH]) - var endTime = start + pixelLength / (speed * 100) * this.beatInfo.beatInterval + var distance = parseFloat(extras[this.osu.PIXELLENGTH]) + + var speedMultiplier = beatLength < 0 ? 100.0 / -beatLength : 1 + var speedAdjustedBeatLength = this.beatInfo.beatInterval / speedMultiplier + var taikoVelocity = 100 * this.difficulty.sliderMultiplier / speedAdjustedBeatLength + var taikoDuration = distance / taikoVelocity + var endTime = start + taikoDuration + if(hitSound & this.osu.FINISH){ type = "daiDrumroll" txt = "連打(大)ーっ!!" diff --git a/public/src/js/scoresheet.js b/public/src/js/scoresheet.js index 2393077..02a89cf 100644 --- a/public/src/js/scoresheet.js +++ b/public/src/js/scoresheet.js @@ -121,6 +121,7 @@ class Scoresheet{ selected.click() }else if(code == 37 || code == 39 || code == 67 || code == 78){ // Left, Right, C, N + assets.sounds["ka"].play() selected.classList.remove("selected") var next = selected.nextElementSibling if(!next){ @@ -130,6 +131,7 @@ class Scoresheet{ } } clean(){ + this.gamepad.clean() assets.sounds["bgm_result"].stop() pageEvents.keyRemove(this, "all") pageEvents.remove(window, "resize")