diff --git a/package.json b/package.json index 171615f1e..44db681eb 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "dependencies": { "audio-context": "^0.1.0", "bluebird": "^2.9.6", - "bms": "^0.2.0", + "bms": "^0.5.0", "bytes": "^1.0.0", "chance": "^0.7.3", "co": "^4.3.1", diff --git a/src/game/game-loader.js b/src/game/game-loader.js index c6ad7f83c..6f8ec8e37 100644 --- a/src/game/game-loader.js +++ b/src/game/game-loader.js @@ -2,6 +2,7 @@ import co from 'co' import bytes from 'bytes' import { basename } from 'path' +import BMS from 'bms' import { EventEmitter } from 'events' import TaskList from 'bemuse/task-list' @@ -30,7 +31,11 @@ export class GameLoader extends EventEmitter { }.bind(this)), song: co(function*() { let buffer = yield download(bms).as('arraybuffer', tasks.bms) - return buffer + let source = yield readBMS(buffer) + let compileResult = BMS.Compiler.compile(source) + let chart = compileResult.chart + let songInfo = BMS.SongInfo.fromBMSChart(chart) + void songInfo }.bind(this)), } yield Promise.all([promises.graphics, promises.song]) @@ -67,4 +72,9 @@ function loadEngine(task) { }) } +function readBMS(buffer) { + buffer = new Buffer(new Uint8Array(buffer)) + return Promise.promisify(BMS.Reader.readAsync)(buffer) +} + export default GameLoader diff --git a/src/game/index.js b/src/game/index.js index b66d060d2..b9b9f4959 100644 --- a/src/game/index.js +++ b/src/game/index.js @@ -6,11 +6,14 @@ import GameLoader from './game-loader' export function main() { let song = { title: 'オリヴィアの幻術', - subtitle: [ + subtitles: [ '[Tonalite]', ], artist: '葵', genre: 'Sexy Dance', + subartists: [ + 'mov:いとう まさき/obj:止ヒ糸', + ], } let loader = new GameLoader() let promise = loader.load('/music/aoi_olivia/olivia_SPpp.bml') diff --git a/src/game/loading-scene/style.scss b/src/game/loading-scene/style.scss index 2ca3e531e..00d1cf93b 100644 --- a/src/game/loading-scene/style.scss +++ b/src/game/loading-scene/style.scss @@ -80,6 +80,9 @@ font-size: 4vmin; margin-top: 0.8ex; } + &--subartist { + font-size: 2.5vmin; + } } diff --git a/src/game/loading-scene/view.jade b/src/game/loading-scene/view.jade index f0e184bad..c5cadd326 100644 --- a/src/game/loading-scene/view.jade +++ b/src/game/loading-scene/view.jade @@ -8,9 +8,11 @@ mixin section(name) .loading-scene-song-info .loading-scene-song-info--genre {{song.genre}} .loading-scene-song-info--title {{song.title}} - +section('song.subtitle') + +section('song.subtitles') .loading-scene-song-info--subtitle {{.}} .loading-scene-song-info--artist {{song.artist}} + +section('song.subartists') + .loading-scene-song-info--subartist {{.}} .loading-scene-progress +section('items') .loading-scene-progress--item