ばいそく機能を追加

This commit is contained in:
yuuki 2024-03-01 11:20:58 +00:00
parent 5cbc5732a7
commit dab0bef293
5 changed files with 36 additions and 17 deletions

View File

@ -1112,7 +1112,7 @@
ctx.fillStyle = "#7e7c76" ctx.fillStyle = "#7e7c76"
ctx.fill(this.optionsPath.shadow) ctx.fill(this.optionsPath.shadow)
ctx.translate(2, -2) ctx.translate(2, -2)
ctx.fillStyle = "#d9d6ce" ctx.fillStyle = "gold"
ctx.fill(this.optionsPath.main) ctx.fill(this.optionsPath.main)
} }

View File

@ -2,7 +2,7 @@ class Controller{
constructor(...args){ constructor(...args){
this.init(...args) this.init(...args)
} }
init(selectedSong, songData, autoPlayEnabled, multiplayer, touchEnabled){ init(selectedSong, songData, autoPlayEnabled, multiplayer, touchEnabled, baisoku = 1){
this.selectedSong = selectedSong this.selectedSong = selectedSong
this.songData = songData this.songData = songData
this.autoPlayEnabled = autoPlayEnabled this.autoPlayEnabled = autoPlayEnabled
@ -82,7 +82,10 @@ class Controller{
} }
this.game = new Game(this, this.selectedSong, this.parsedSongData) this.game = new Game(this, this.selectedSong, this.parsedSongData)
this.view = new View(this) this.view = new View(this, baisoku)
if (this.view.baisoku > 1) {
this.saveScore = false;
}
this.mekadon = new Mekadon(this, this.game) this.mekadon = new Mekadon(this, this.game)
this.keyboard = new GameInput(this) this.keyboard = new GameInput(this)
if(!autoPlayEnabled && this.multiplayer !== 2){ if(!autoPlayEnabled && this.multiplayer !== 2){

View File

@ -2,11 +2,12 @@ class LoadSong{
constructor(...args){ constructor(...args){
this.init(...args) this.init(...args)
} }
init(selectedSong, autoPlayEnabled, multiplayer, touchEnabled){ init(selectedSong, autoPlayEnabled, multiplayer, touchEnabled, baisoku = 1){
this.selectedSong = selectedSong this.selectedSong = selectedSong
this.autoPlayEnabled = autoPlayEnabled this.autoPlayEnabled = autoPlayEnabled
this.multiplayer = multiplayer this.multiplayer = multiplayer
this.touchEnabled = touchEnabled this.touchEnabled = touchEnabled
this.baisoku = baisoku
var resolution = settings.getItem("resolution") var resolution = settings.getItem("resolution")
this.imgScale = 1 this.imgScale = 1
if(resolution === "medium"){ if(resolution === "medium"){
@ -318,8 +319,8 @@ class LoadSong{
}else if(event.type === "gamestart"){ }else if(event.type === "gamestart"){
this.clean() this.clean()
p2.clearMessage("songsel") p2.clearMessage("songsel")
var taikoGame1 = new Controller(song, this.songData, false, 1, this.touchEnabled) var taikoGame1 = new Controller(song, this.songData, false, 1, this.touchEnabled, this.baisoku)
var taikoGame2 = new Controller(this.selectedSong2, this.song2Data, true, 2, this.touchEnabled) var taikoGame2 = new Controller(this.selectedSong2, this.song2Data, true, 2, this.touchEnabled, this.baisoku)
taikoGame1.run(taikoGame2) taikoGame1.run(taikoGame2)
pageEvents.send("load-song-player2", this.selectedSong2) pageEvents.send("load-song-player2", this.selectedSong2)
}else if(event.type === "left" || event.type === "gameend"){ }else if(event.type === "left" || event.type === "gameend"){
@ -335,7 +336,7 @@ class LoadSong{
}) })
}else{ }else{
this.clean() this.clean()
var taikoGame = new Controller(song, this.songData, this.autoPlayEnabled, false, this.touchEnabled) var taikoGame = new Controller(song, this.songData, this.autoPlayEnabled, false, this.touchEnabled, this.baisoku)
taikoGame.run() taikoGame.run()
} }
} }

View File

@ -254,7 +254,7 @@ class SongSelect{
iconFill: "#e7cbe1", iconFill: "#e7cbe1",
letterSpacing: 4 letterSpacing: 4
}] }]
this.optionsList = [strings.none, strings.auto, strings.netplay] this.optionsList = [strings.none, strings.auto, strings.netplay, "ばいそく", "さんばい", "よんばい", "ばいそく+オート", "さんばい+オート", "よんばい+オート"]
this.draw = new CanvasDraw(noSmoothing) this.draw = new CanvasDraw(noSmoothing)
this.songTitleCache = new CanvasCache(noSmoothing) this.songTitleCache = new CanvasCache(noSmoothing)
@ -347,7 +347,7 @@ class SongSelect{
waitPreview: 0 waitPreview: 0
} }
this.songSelecting = { this.songSelecting = {
speed: 400, speed: 200,
resize: 0.3, resize: 0.3,
scrollDelay: 0.1 scrollDelay: 0.1
} }
@ -898,7 +898,21 @@ class SongSelect{
} }
var autoplay = false var autoplay = false
var multiplayer = false var multiplayer = false
if(p2.session || this.state.options === 2){ var baisoku = 1;
if (this.state.options >= 3 || this.state.options <= 8) {
const mapping = {
3: 2,
4: 3,
5: 4,
6: 2,
7: 3,
8: 4
};
baisoku = mapping[this.state.options];
if (this.state.options >= 6) {
autoplay = true
}
}if(p2.session || this.state.options === 2){
multiplayer = true multiplayer = true
}else if(this.state.options === 1){ }else if(this.state.options === 1){
autoplay = true autoplay = true
@ -922,7 +936,7 @@ class SongSelect{
"stars": selectedSong.courses[diff].stars, "stars": selectedSong.courses[diff].stars,
"hash": selectedSong.hash, "hash": selectedSong.hash,
"lyrics": selectedSong.lyrics "lyrics": selectedSong.lyrics
}, autoplay, multiplayer, touch) }, autoplay, multiplayer, touch, baisoku)
} }
toOptions(moveBy){ toOptions(moveBy){
if(!p2.session){ if(!p2.session){

View File

@ -2,8 +2,9 @@
constructor(...args){ constructor(...args){
this.init(...args) this.init(...args)
} }
init(controller){ init(controller, baisoku = 1){
this.controller = controller this.controller = controller
this.baisoku = baisoku
this.canvas = document.getElementById("canvas") this.canvas = document.getElementById("canvas")
this.ctx = this.canvas.getContext("2d") this.ctx = this.canvas.getContext("2d")
@ -1487,11 +1488,11 @@
var measureH = 130 * mul var measureH = 130 * mul
measures.forEach(measure => { measures.forEach(measure => {
var timeForDistance = this.posToMs(distanceForCircle, measure.speed) var timeForDistance = this.posToMs(distanceForCircle, measure.speed * this.baisoku)
var startingTime = measure.ms - timeForDistance + this.controller.videoLatency var startingTime = measure.ms - timeForDistance + this.controller.videoLatency
var finishTime = measure.ms + this.posToMs(this.slotPos.x - this.slotPos.paddingLeft + 3, measure.speed) + this.controller.videoLatency var finishTime = measure.ms + this.posToMs(this.slotPos.x - this.slotPos.paddingLeft + 3, measure.speed * this.baisoku) + this.controller.videoLatency
if(measure.visible && (!measure.branch || measure.branch.active) && ms >= startingTime && ms <= finishTime){ if(measure.visible && (!measure.branch || measure.branch.active) && ms >= startingTime && ms <= finishTime){
var measureX = this.slotPos.x + this.msToPos(measure.ms - ms + this.controller.videoLatency, measure.speed) var measureX = this.slotPos.x + this.msToPos(measure.ms - ms + this.controller.videoLatency, measure.speed * this.baisoku)
this.ctx.strokeStyle = measure.branchFirst ? "#ff0" : "#bdbdbd" this.ctx.strokeStyle = measure.branchFirst ? "#ff0" : "#bdbdbd"
this.ctx.lineWidth = 3 this.ctx.lineWidth = 3
this.ctx.beginPath() this.ctx.beginPath()
@ -1537,7 +1538,7 @@
for(var i = circles.length; i--;){ for(var i = circles.length; i--;){
var circle = circles[i] var circle = circles[i]
var speed = circle.speed var speed = circle.speed * this.baisoku
var timeForDistance = this.posToMs(distanceForCircle + this.slotPos.size / 2, speed) var timeForDistance = this.posToMs(distanceForCircle + this.slotPos.size / 2, speed)
var startingTime = circle.ms - timeForDistance + this.controller.videoLatency var startingTime = circle.ms - timeForDistance + this.controller.videoLatency
@ -1626,7 +1627,7 @@
var circleMs = circle.ms var circleMs = circle.ms
var endTime = circle.endTime var endTime = circle.endTime
var animated = circle.animating var animated = circle.animating
var speed = circle.speed var speed = circle.speed * this.baisoku
var played = circle.isPlayed var played = circle.isPlayed
var drumroll = 0 var drumroll = 0
var endX = 0 var endX = 0