Merge pull request #38 from LoveEevee/parsesong-drumroll-timing

Parsesong: Fix drumroll timing
This commit is contained in:
Bui 2018-09-27 17:22:48 +01:00 committed by GitHub
commit dc01102a72
5 changed files with 20 additions and 8 deletions

View File

@ -5,7 +5,7 @@
background-size: cover; background-size: cover;
} }
#game.default-bg{ #game.default-bg{
background-size: contain; background-size: calc(100vh / 720 * 512);
} }
#canvas{ #canvas{
position: relative; position: relative;

View File

@ -190,17 +190,18 @@ kbd{
} }
@keyframes bgscroll{ @keyframes bgscroll{
from{ from{
background-position: 0 0; background-position: 0 center;
} }
to{ to{
background-position: calc(-100vh / 720 * 512) 0; background-position: calc(-100vh / 720 * 512) center;
} }
} }
#song-select{ #song-select{
width: 100%; width: 100%;
height: 100%; height: 100%;
background-image: url("/assets/img/bg_genre_0.png"); 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; animation: bgscroll 16s infinite linear;
white-space: nowrap; white-space: nowrap;
transition: background-image 0.5s; transition: background-image 0.5s;

View File

@ -8,7 +8,7 @@ class Mekadon{
play(circle){ play(circle){
var type = circle.getType() var type = circle.getType()
if((type === "balloon" || type === "drumroll" || type === "daiDrumroll") && this.getMS() > circle.getEndTime()){ if((type === "balloon" || type === "drumroll" || type === "daiDrumroll") && this.getMS() > circle.getEndTime()){
circle.played(0, false) circle.played(-1, false)
this.game.updateCurrentCircle() this.game.updateCurrentCircle()
} }
type = circle.getType() type = circle.getType()

View File

@ -122,7 +122,8 @@ class ParseSong{
start: start, start: start,
sliderMultiplier: sliderMultiplier, sliderMultiplier: sliderMultiplier,
measure: parseInt(values[this.osu.METER]), measure: parseInt(values[this.osu.METER]),
gogoTime: parseInt(values[this.osu.KIAIMODE]) gogoTime: parseInt(values[this.osu.KIAIMODE]),
beatLength: msOrPercent
}) })
} }
return timingPoints return timingPoints
@ -233,12 +234,14 @@ class ParseSong{
var gogoTime = false var gogoTime = false
var osuType = parseInt(values[this.osu.TYPE]) var osuType = parseInt(values[this.osu.TYPE])
var hitSound = parseInt(values[this.osu.HITSOUND]) var hitSound = parseInt(values[this.osu.HITSOUND])
var beatLength = speed
for(var j = 0; j < this.timingPoints.length; j++){ for(var j = 0; j < this.timingPoints.length; j++){
if(this.timingPoints[j].start > start){ if(this.timingPoints[j].start > start){
break break
} }
speed = this.timingPoints[j].sliderMultiplier speed = this.timingPoints[j].sliderMultiplier
beatLength = this.timingPoints[j].beatLength
gogoTime = this.timingPoints[j].gogoTime gogoTime = this.timingPoints[j].gogoTime
} }
@ -261,8 +264,14 @@ class ParseSong{
}else if(osuType & this.osu.SLIDER){ }else if(osuType & this.osu.SLIDER){
var extras = values.slice(this.osu.EXTRAS) var extras = values.slice(this.osu.EXTRAS)
var pixelLength = parseFloat(extras[this.osu.PIXELLENGTH]) var distance = parseFloat(extras[this.osu.PIXELLENGTH])
var endTime = start + pixelLength / (speed * 100) * this.beatInfo.beatInterval
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){ if(hitSound & this.osu.FINISH){
type = "daiDrumroll" type = "daiDrumroll"
txt = "連打(大)ーっ!!" txt = "連打(大)ーっ!!"

View File

@ -121,6 +121,7 @@ class Scoresheet{
selected.click() selected.click()
}else if(code == 37 || code == 39 || code == 67 || code == 78){ }else if(code == 37 || code == 39 || code == 67 || code == 78){
// Left, Right, C, N // Left, Right, C, N
assets.sounds["ka"].play()
selected.classList.remove("selected") selected.classList.remove("selected")
var next = selected.nextElementSibling var next = selected.nextElementSibling
if(!next){ if(!next){
@ -130,6 +131,7 @@ class Scoresheet{
} }
} }
clean(){ clean(){
this.gamepad.clean()
assets.sounds["bgm_result"].stop() assets.sounds["bgm_result"].stop()
pageEvents.keyRemove(this, "all") pageEvents.keyRemove(this, "all")
pageEvents.remove(window, "resize") pageEvents.remove(window, "resize")