• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Go で書き直した Ikemen


Commit MetaInfo

修订版9e140f37a85e2800a17cccde72623e3d4d53dc28 (tree)
时间2019-10-26 18:58:56
作者neatunsou <sisiy4excite@gmai...>
Commiterneatunsou

Log Message

Windblade氏の更新に対応

更改概述

差异

--- a/script/options.lua
+++ b/script/options.lua
@@ -397,9 +397,9 @@ function options.f_mainCfg()
397397 elseif t[item].itemname == 'defaultvalues' then
398398 sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2])
399399 config.HelperMax = 56
400- config.PlayerProjectileMax = 50
401- config.ExplodMax = 256
402- config.AfterImageMax = 8
400+ config.PlayerProjectileMax = 256
401+ config.ExplodMax = 512
402+ config.AfterImageMax = 128
403403 config['Attack.LifeToPowerMul'] = 0.7
404404 config['GetHit.LifeToPowerMul'] = 0.6
405405 config.Width = 640
--- a/script/select.lua
+++ b/script/select.lua
@@ -827,7 +827,7 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1)
827827 end
828828 --victory screen
829829 if main.gameMode == 'arcade' or main.gameMode == 'teamcoop' or main.gameMode == 'netplayteamcoop' then
830- if main.t_selChars[t_p2Selected[1].cel + 1].winscreen == nil or main.t_selChars[t_p2Selected[1].cel + 1].winscreen == 1 then
830+ if motif.victory_screen.enabled == 1 and (main.t_selChars[t_p2Selected[1].cel + 1].winscreen == nil or main.t_selChars[t_p2Selected[1].cel + 1].winscreen == 1) then
831831 select.f_selectVictory()
832832 end
833833 end
@@ -869,7 +869,7 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1)
869869 looseCnt = looseCnt + 1
870870 --victory screen
871871 if main.gameMode == 'arcade' or main.gameMode == 'teamcoop' or main.gameMode == 'netplayteamcoop' then
872- if winner >= 1 and (main.t_selChars[t_p2Selected[1].cel + 1].winscreen == nil or main.t_selChars[t_p2Selected[1].cel + 1].winscreen == 1) then
872+ if motif.victory_screen.enabled == 1 and winner >= 1 and (main.t_selChars[t_p2Selected[1].cel + 1].winscreen == nil or main.t_selChars[t_p2Selected[1].cel + 1].winscreen == 1) then
873873 select.f_selectVictory()
874874 end
875875 end
@@ -890,7 +890,7 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1)
890890 --counter
891891 looseCnt = looseCnt + 1
892892 --victory screen
893- if winner >= 1 and (main.t_selChars[t_p2Selected[1].cel + 1].winscreen == nil or main.t_selChars[t_p2Selected[1].cel + 1].winscreen == 1) then
893+ if motif.victory_screen.enabled == 1 and winner >= 1 and (main.t_selChars[t_p2Selected[1].cel + 1].winscreen == nil or main.t_selChars[t_p2Selected[1].cel + 1].winscreen == 1) then
894894 select.f_selectVictory()
895895 end
896896 --continue screen
@@ -2540,12 +2540,9 @@ local txt_credits = main.f_createTextImg(
25402540 )
25412541
25422542 function select.f_continue()
2543- main.f_resetBG(motif.continue_screen, motif.continuebgdef, motif.music.continue_bgm, motif.music.continue_bgm_loop, motif.music.continue_bgm_volume, motif.music.continue_bgm_loopstart, motif.music.continue_bgm_loopend)
2544- animReset(motif.continue_screen.continue_anim_data)
2545- animUpdate(motif.continue_screen.continue_anim_data)
25462543 continue = false
2547- local text = main.f_extractText(motif.continue_screen.credits_text, main.credits)
2548- textImgSetText(txt_credits, text[1])
2544+ playBGM(motif.music.continue_bgm, true, motif.music.continue_bgm_loop, motif.music.continue_bgm_volume, motif.music.continue_bgm_loopstart or "0", motif.music.continue_bgm_loopend or "0")
2545+ --textImgSetText(txt_credits, text[1])
25492546 main.f_cmdInput()
25502547 while true do
25512548 --draw clearcolor (disabled to not cover area)
--- a/src/bytecode.go
+++ b/src/bytecode.go
@@ -3704,6 +3704,7 @@ func (sc projectile) Run(c *Char, _ []int32) bool {
37043704 p.hits = exp[0].evalI(c)
37053705 case projectile_projpriority:
37063706 p.priority = exp[0].evalI(c)
3707+ p.priorityPoints = p.priority
37073708 case projectile_projhitanim:
37083709 p.hitanim = exp[0].evalI(c)
37093710 case projectile_projremanim:
--- a/src/char.go
+++ b/src/char.go
@@ -1103,7 +1103,7 @@ type Projectile struct {
11031103 hits int32
11041104 misstime int32
11051105 priority int32
1106- prioritypoint int32
1106+ priorityPoints int32
11071107 sprpriority int32
11081108 edgebound int32
11091109 stagebound int32
@@ -1138,7 +1138,7 @@ func (p *Projectile) clear() {
11381138 *p = Projectile{id: IErr, hitanim: -1, remanim: IErr, cancelanim: IErr,
11391139 scale: [...]float32{1, 1}, clsnScale: [...]float32{1, 1}, remove: true, localscl: 1,
11401140 removetime: -1, velmul: [...]float32{1, 1}, hits: 1, priority: 1,
1141- prioritypoint: 1, sprpriority: 3, edgebound: 40, stagebound: 40,
1141+ priorityPoints: 1, sprpriority: 3, edgebound: 40, stagebound: 40,
11421142 heightbound: [...]int32{-240, 1}, facing: 1, aimg: *newAfterImage(), platformFence: true}
11431143 p.hitdef.clear()
11441144 }
@@ -1235,27 +1235,19 @@ func (p *Projectile) clsn(playerNo int) {
12351235 if p.ani == nil || len(p.ani.frames) == 0 {
12361236 return
12371237 }
1238- cancel := func(prioritypoint *int32, priority int32, hits *int32,
1239- oppprioritypoint int32) {
1240- if oppprioritypoint > *prioritypoint || *hits <= 0 {
1241- *hits = -2
1242- return
1243- }
1244- if oppprioritypoint == *prioritypoint {
1245- if *hits <= 1 {
1246- *hits = -2
1247- } else {
1248- *hits = int32(int64(*hits)*3/4 - 1)
1249- if *hits <= 0 {
1250- (*prioritypoint)--
1251- } else {
1252- *prioritypoint = priority
1253- }
1254- }
1238+
1239+ cancel := func(priorityPoints *int32, hits *int32, oppPriorityPoints int32) {
1240+ if *priorityPoints > oppPriorityPoints {
1241+ (*priorityPoints)--
12551242 } else {
1256- (*prioritypoint)--
1243+ (*hits)--
1244+ }
1245+
1246+ if *hits <= 0 {
1247+ *hits = -2
12571248 }
12581249 }
1250+
12591251 for i := 0; i < playerNo && p.hits >= 0; i++ {
12601252 for j, pr := range sys.projs[i] {
12611253 if pr.hits < 0 || pr.id < 0 || (pr.hitdef.affectteam != 0 &&
@@ -1269,9 +1261,11 @@ func (p *Projectile) clsn(playerNo int) {
12691261 [...]float32{pr.pos[0] * pr.localscl, pr.pos[1] * pr.localscl}, pr.facing,
12701262 clsn2, [...]float32{p.clsnScale[0] * p.localscl, p.clsnScale[1] * p.localscl},
12711263 [...]float32{p.pos[0] * p.localscl, p.pos[1] * p.localscl}, p.facing) {
1272- opp, pp := &sys.projs[i][j], p.prioritypoint
1273- cancel(&p.prioritypoint, p.priority, &p.hits, opp.prioritypoint)
1274- cancel(&opp.prioritypoint, opp.priority, &opp.hits, pp)
1264+
1265+ opp, pp := &sys.projs[i][j], p.priorityPoints
1266+ cancel(&p.priorityPoints, &p.hits, opp.priorityPoints)
1267+ cancel(&opp.priorityPoints, &opp.hits, pp)
1268+
12751269 if p.hits < 0 {
12761270 break
12771271 }
--- a/src/compiler.go
+++ b/src/compiler.go
@@ -306,7 +306,9 @@ func (c *Compiler) operator(in *string) error {
306306 if opp < 0 || ((!c.usiroOp || c.token[0] != '(') &&
307307 (c.token[0] < 'A' || c.token[0] > 'Z') &&
308308 (c.token[0] < 'a' || c.token[0] > 'z')) {
309- return Error(c.maeOp + "が不正です")
309+ return Error(c.maeOp + "が不正です" +
310+ " / " +
311+ c.maeOp + " is invalid")
310312 }
311313 *in = c.token + " " + *in
312314 c.token = c.maeOp
@@ -326,7 +328,9 @@ func (c *Compiler) integer2(in *string) (int32, error) {
326328 }
327329 for _, c := range istr {
328330 if c < '0' || c > '9' {
329- return 0, Error(istr + "が整数でありません")
331+ return 0, Error(istr + "が整数でありません" +
332+ " / " +
333+ istr + " is not an integer")
330334 }
331335 }
332336 i := Atoi(istr)
@@ -384,7 +388,9 @@ func (c *Compiler) attr(text string, hitdef bool) (int32, error) {
384388 (a < 'a' || a > 'z') {
385389 return flg, nil
386390 }
387- return 0, Error(string(a) + "が無効な値です")
391+ return 0, Error(string(a) + "が無効な値です" +
392+ " / " +
393+ string(a) + " is an invalid value")
388394 }
389395 }
390396 hitdefflg := flg
@@ -431,7 +437,9 @@ func (c *Compiler) attr(text string, hitdef bool) (int32, error) {
431437 }
432438 return flg, nil
433439 }
434- return 0, Error(a + "が無効な値です")
440+ return 0, Error(a + "が無効な値です" +
441+ " / " +
442+ a + " is an invalid value")
435443 }
436444 if i == 0 {
437445 hitdefflg = flg
@@ -466,7 +474,9 @@ func (c *Compiler) trgAttr(in *string) (int32, error) {
466474 case 'A', 'a':
467475 flg |= int32(ST_A)
468476 default:
469- return 0, Error(att + "が不正な属性値です")
477+ return 0, Error(att + "が不正な属性値です" +
478+ " / " +
479+ att + " is an invalid attribute value")
470480 }
471481 }
472482 for len(*in) > 0 && (*in)[0] == ',' {
@@ -521,7 +531,9 @@ func (c *Compiler) trgAttr(in *string) (int32, error) {
521531 }
522532 func (c *Compiler) kakkohiraku(in *string) error {
523533 if c.tokenizer(in) != "(" {
524- return Error(c.token + "の次に'('がありません")
534+ return Error(c.token + "の次に'('がありません" +
535+ " / " +
536+ "Missing '(' after " + c.token)
525537 }
526538 c.token = c.tokenizer(in)
527539 return nil
@@ -529,7 +541,9 @@ func (c *Compiler) kakkohiraku(in *string) error {
529541 func (c *Compiler) kakkotojiru() error {
530542 c.usiroOp = true
531543 if c.token != ")" {
532- return Error(c.token + "の前に')'がありません")
544+ return Error(c.token + "の前に')'がありません" +
545+ " / " +
546+ "There is no ')' before " + c.token)
533547 }
534548 return nil
535549 }
@@ -549,7 +563,9 @@ func (c *Compiler) kyuushiki(in *string) (not bool, err error) {
549563 continue
550564 }
551565 }
552- return false, Error("'='か'!='がありません")
566+ return false, Error("'='か'!='がありません" +
567+ " / " +
568+ "Missing '=' or '! ='")
553569 }
554570 c.token = c.tokenizer(in)
555571 return
@@ -562,7 +578,9 @@ func (c *Compiler) intRange(in *string) (minop OpCode, maxop OpCode,
562578 case "[":
563579 minop = OC_ge
564580 default:
565- err = Error("'['か'('がありません")
581+ err = Error("'['か'('がありません" +
582+ " / " +
583+ "Missing '[' or '('")
566584 return
567585 }
568586 var intf func(in *string) (int32, error)
@@ -575,7 +593,9 @@ func (c *Compiler) intRange(in *string) (minop OpCode, maxop OpCode,
575593 c.token = c.tokenizer(in)
576594 }
577595 if len(c.token) == 0 || c.token[0] < '0' || c.token[0] > '9' {
578- return 0, Error("数字の読み込みエラーです")
596+ return 0, Error("数字の読み込みエラーです" +
597+ " / " +
598+ "Error reading number")
579599 }
580600 i := Atoi(c.token)
581601 if minus {
@@ -598,7 +618,9 @@ func (c *Compiler) intRange(in *string) (minop OpCode, maxop OpCode,
598618 c.token = c.tokenizer(in)
599619 }
600620 if c.token != "," {
601- err = Error("','がありません")
621+ err = Error("','がありません" +
622+ " / " +
623+ "There is not ','")
602624 return
603625 }
604626 if max, err = intf(in); err != nil {
@@ -618,7 +640,9 @@ func (c *Compiler) intRange(in *string) (minop OpCode, maxop OpCode,
618640 case "]":
619641 maxop = OC_le
620642 default:
621- err = Error("']'か')'がありません")
643+ err = Error("']'か')'がありません" +
644+ " / " +
645+ "Missing ']' or ')'")
622646 return
623647 }
624648 c.token = c.tokenizer(in)
@@ -666,7 +690,9 @@ func (c *Compiler) kyuushikiSuperDX(out *BytecodeExp, in *string,
666690 case "=":
667691 default:
668692 if hissu && !comma {
669- return Error("比較演算子がありません")
693+ return Error("比較演算子がありません" +
694+ " / " +
695+ "No comparison operator")
670696 }
671697 hikaku = false
672698 }
@@ -709,7 +735,9 @@ func (c *Compiler) kyuushikiSuperDX(out *BytecodeExp, in *string,
709735 n, err := c.integer2(in)
710736 if err != nil {
711737 if hissu && !hikaku {
712- return Error("比較演算子がありません")
738+ return Error("比較演算子がありません"+
739+ " / " +
740+ "No comparison operator")
713741 }
714742 if hikaku {
715743 return err
@@ -728,7 +756,9 @@ func (c *Compiler) oneArg(out *BytecodeExp, in *string,
728756 mae := c.token
729757 if c.token = c.tokenizer(in); c.token != "(" {
730758 if len(defval) == 0 || defval[0].IsNone() {
731- return bvNone(), Error(mae + "の次に'('がありません")
759+ return bvNone(), Error(mae + "の次に'('がありません" +
760+ " / " +
761+ "Missing '(' after " + mae)
732762 }
733763 *in = c.token + " " + *in
734764 bv = defval[0]
@@ -853,7 +883,9 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string,
853883 text := func() error {
854884 i := strings.Index(*in, "\"")
855885 if c.token != "\"" || i < 0 {
856- return Error("\"で囲まれていません")
886+ return Error("\"で囲まれていません" +
887+ " / " +
888+ "Not enclosed in \"")
857889 }
858890 c.token = (*in)[:i]
859891 *in = (*in)[i+1:]
@@ -901,7 +933,9 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string,
901933 var err error
902934 switch c.token {
903935 case "":
904- return bvNone(), Error("空です")
936+ return bvNone(), Error("空です" +
937+ " / " +
938+ "Empty")
905939 case "root", "parent", "helper", "target", "partner",
906940 "enemy", "enemynear", "playerid":
907941 switch c.token {
@@ -944,7 +978,9 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string,
944978 case OC_partner, OC_enemy, OC_enemynear:
945979 be1.appendValue(BytecodeInt(0))
946980 case OC_playerid:
947- return bvNone(), Error("playeridの次に'('がありません")
981+ return bvNone(), Error("playeridの次に'('がありません" +
982+ " / " +
983+ "There is no '(' after playerid")
948984 }
949985 }
950986 if rd {
@@ -953,7 +989,9 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string,
953989 out.append(be1...)
954990 }
955991 if c.token != "," {
956- return bvNone(), Error(",がありません")
992+ return bvNone(), Error(",がありません" +
993+ " / " +
994+ "Missing ','" )
957995 }
958996 c.token = c.tokenizer(in)
959997 if bv2, err = c.expValue(&be2, in, true); err != nil {
@@ -969,7 +1007,9 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string,
9691007 c.token += c.tokenizer(in)
9701008 bv = c.number(c.token)
9711009 if bv.IsNone() {
972- return bvNone(), Error(c.token + "が不正です")
1010+ return bvNone(), Error(c.token + "が不正です" +
1011+ " / " +
1012+ c.token + " is invalid")
9731013 }
9741014 } else {
9751015 c.token = c.tokenizer(in)
@@ -2111,11 +2151,11 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string,
21112151 } else if len(c.token) >= 2 && c.token[0] == '$' && c.token != "$_" {
21122152 vi, ok := c.vars[c.token[1:]]
21132153 if !ok {
2114- return bvNone(), Error(c.token + "は定義されていません")
2154+ return bvNone(), Error(c.token + "は定義されていません" + " / " + c.token + "Is not defined")
21152155 }
21162156 out.append(OC_localvar, OpCode(vi))
21172157 } else {
2118- return bvNone(), Error(c.token + "が不正です")
2158+ return bvNone(), Error(c.token + "が不正です" + " / " + c.token + "It is illegal")
21192159 }
21202160 }
21212161 c.token = c.tokenizer(in)
--- a/src/input.go
+++ b/src/input.go
@@ -628,11 +628,17 @@ func JoystickState(joy, button int) bool {
628628 if (button == 8 || button == 10) && glfw.GetJoystickName(joystick[joy]) == "Xbox 360 Controller" { //Xbox360コントローラーのLRトリガー判定
629629 return axes[button/2] > 0
630630 }
631+
632+ // Ignore trigger axis on PS4 (We already have buttons)
633+ if (button >= 6 && button <= 9) && glfw.GetJoystickName(joystick[joy]) == "Wireless Controller" {
634+ return false
635+ }
636+
631637 switch button & 1 {
632- case 0:
633- return axes[button/2] < -0.2
634- case 1:
635- return axes[button/2] > 0.2
638+ case 0:
639+ return axes[button/2] < -0.2
640+ case 1:
641+ return axes[button/2] > 0.2
636642 }
637643 }
638644 if len(btns) <= button {
--- a/src/script.go
+++ b/src/script.go
@@ -1227,10 +1227,13 @@ func systemScriptInit(l *lua.LState) {
12271227 s = strconv.Itoa(-i*2 - 1)
12281228 }
12291229 } else {
1230- if axes[i] < -0.2 {
1231- s = strconv.Itoa(-i*2 - 1)
1232- } else if axes[i] > 0.2 {
1233- s = strconv.Itoa(-i*2 - 2)
1230+ // PS4 Controller support
1231+ if glfw.GetJoystickName(joystick[j]) != "Wireless Controller" || !(i == 3 || i == 4) {
1232+ if axes[i] < -0.2 {
1233+ s = strconv.Itoa(-i*2 - 1)
1234+ } else if axes[i] > 0.2 {
1235+ s = strconv.Itoa(-i*2 - 2)
1236+ }
12341237 }
12351238 }
12361239 }
--- a/src/sound.go
+++ b/src/sound.go
@@ -3,6 +3,7 @@ package main
33 import (
44 "encoding/binary"
55 "fmt"
6+ "io"
67 "math"
78 "os"
89 "path/filepath"
@@ -15,6 +16,7 @@ import (
1516 "github.com/faiface/beep/mp3"
1617 "github.com/faiface/beep/speaker"
1718 "github.com/faiface/beep/vorbis"
19+ "github.com/faiface/beep/wav"
1820 )
1921
2022 const (
@@ -237,17 +239,21 @@ func (n *NormalizerLR) process(bai float64, sam *float32) float64 {
237239
238240 type Bgm struct {
239241 filename string
242+ bgmVolume int
240243 bgmLoopStart int
241244 bgmLoopEnd int
242245 defaultFilename string
243246 defaultBgmVolume int
244247 defaultbgmLoopStart int
245248 defaultbgmLoopEnd int
249+ loop int
246250 sampleRate beep.SampleRate
247251 streamer beep.StreamSeekCloser
248252 ctrl *beep.Ctrl
249253 resampler *beep.Resampler
250254 volume *effects.Volume
255+ format string
256+ tempfile io.ReadCloser
251257 }
252258
253259 func newBgm() *Bgm {
@@ -266,6 +272,10 @@ func (bgm *Bgm) IsFLAC() bool {
266272 return bgm.IsFormat(".flac")
267273 }
268274
275+func (bgm *Bgm) IsWAVE() bool {
276+ return bgm.IsFormat(".wav")
277+}
278+
269279 func (bgm *Bgm) IsFormat(extension string) bool {
270280 return filepath.Ext(bgm.filename) == extension
271281 }
@@ -275,6 +285,8 @@ func (bgm *Bgm) Open(filename string, isDefaultBGM bool, loop, bgmVolume, bgmLoo
275285 return
276286 }
277287 bgm.filename = filename
288+ bgm.loop = loop
289+ bgm.bgmVolume = bgmVolume
278290 bgm.bgmLoopStart = bgmLoopStart
279291 bgm.bgmLoopEnd = bgmLoopEnd
280292 if isDefaultBGM {
@@ -290,7 +302,9 @@ func (bgm *Bgm) Open(filename string, isDefaultBGM bool, loop, bgmVolume, bgmLoo
290302 } else if bgm.IsMp3() {
291303 bgm.ReadMp3(loop, bgmVolume)
292304 } else if bgm.IsFLAC() {
293- bgm.ReadFLAC(loop, bgmVolume)
305+ bgm.ConvertFLAC(loop, bgmVolume)
306+ } else if bgm.IsWAVE() {
307+ bgm.ReadWav(loop, bgmVolume)
294308 }
295309
296310 }
@@ -299,6 +313,7 @@ func (bgm *Bgm) ReadMp3(loop int, bgmVolume int) {
299313 f, _ := os.Open(bgm.filename)
300314 s, format, err := mp3.Decode(f)
301315 bgm.streamer = s
316+ bgm.format = "mp3"
302317 if err != nil {
303318 return
304319 }
@@ -309,6 +324,42 @@ func (bgm *Bgm) ReadFLAC(loop int, bgmVolume int) {
309324 f, _ := os.Open(bgm.filename)
310325 s, format, err := flac.Decode(f)
311326 bgm.streamer = s
327+ bgm.format = "flac"
328+
329+ if err != nil {
330+ return
331+ }
332+ bgm.ReadFormat(format, loop, bgmVolume)
333+}
334+
335+// SCREW THE FLAC.SEEK FUNCTION, IT DOES NOT WORK SO WE ARE GOING TO CONVERT THIS TO WAV
336+func (bgm *Bgm) ConvertFLAC(loop int, bgmVolume int) {
337+ // We open the flac
338+ f1, _ := os.Open(bgm.filename)
339+ // And create a temp one
340+ f2, _ := os.Create("save/tempaudio.wav")
341+
342+ // Open decode and convert
343+ s, format, err := flac.Decode(f1)
344+ wav.Encode(f2, s, format)
345+
346+ bgm.filename = "save/tempaudio.wav"
347+ //bgm.tempfile = f2
348+ bgm.format = "flac"
349+
350+ s.Close()
351+
352+ if err != nil {
353+ return
354+ }
355+
356+ sys.FLAC_FrameWait = 120
357+}
358+
359+func (bgm *Bgm) PlayMemAudio(loop int, bgmVolume int) {
360+ f, _ := os.Open(bgm.filename)
361+ s, format, err := wav.Decode(f)
362+ bgm.streamer = s
312363 if err != nil {
313364 return
314365 }
@@ -319,6 +370,18 @@ func (bgm *Bgm) ReadVorbis(loop int, bgmVolume int) {
319370 f, _ := os.Open(bgm.filename)
320371 s, format, err := vorbis.Decode(f)
321372 bgm.streamer = s
373+ bgm.format = "ogg"
374+ if err != nil {
375+ return
376+ }
377+ bgm.ReadFormat(format, loop, bgmVolume)
378+}
379+
380+func (bgm *Bgm) ReadWav(loop int, bgmVolume int) {
381+ f, _ := os.Open(bgm.filename)
382+ s, format, err := wav.Decode(f)
383+ bgm.streamer = s
384+ bgm.format = "wav"
322385 if err != nil {
323386 return
324387 }
--- a/src/system.go
+++ b/src/system.go
@@ -64,6 +64,7 @@ var sys = System{
6464 keyInput: glfw.KeyUnknown,
6565 keyString: "",
6666 comboExtraFrameWindow: 1,
67+ FLAC_FrameWait: -1,
6768 // Localcoord sceenpack
6869 luaSpriteScale: 1,
6970 luaSmallPortraitScale: 1,
@@ -248,6 +249,7 @@ type System struct {
248249 wavVolume int
249250 bgmVolume int
250251 AudioDucking bool
252+ FLAC_FrameWait int
251253 // Localcoord sceenpack
252254 luaSpriteScale float64
253255 luaSmallPortraitScale float32
@@ -433,7 +435,7 @@ func (s *System) soundWrite() {
433435 processed = true
434436 }
435437 if !s.nomusic {
436- if s.bgm.ctrl != nil {
438+ if s.bgm.ctrl != nil && s.bgm.streamer != nil {
437439 s.bgm.ctrl.Paused = false
438440 if s.bgm.bgmLoopEnd > 0 && s.bgm.streamer.Position() >= s.bgm.bgmLoopEnd {
439441 s.bgm.streamer.Seek(s.bgm.bgmLoopStart)
@@ -445,6 +447,12 @@ func (s *System) soundWrite() {
445447 }
446448 }
447449
450+ if s.FLAC_FrameWait >= 0 {
451+ if s.FLAC_FrameWait == 0 {
452+ s.bgm.PlayMemAudio(s.bgm.loop, s.bgm.bgmVolume)
453+ }
454+ s.FLAC_FrameWait--
455+ }
448456 }
449457 src.Delete()
450458 openal.NullContext.Activate()
@@ -1379,7 +1387,20 @@ func (s *System) fight() (reload bool) {
13791387 }
13801388 put(&y, s.stage.def)
13811389 if s.debugWC != nil {
1382- put(&y, fmt.Sprintf("<P%v:%v>", s.debugWC.playerNo+1, s.debugWC.name))
1390+ //put(&y, fmt.Sprintf("<P%v:%v>", s.debugWC.playerNo+1, s.debugWC.name))
1391+ if s.bgm.streamer != nil {
1392+ put(&y, fmt.Sprintf("BgmPos: %v", s.bgm.streamer.Position()))
1393+ put(&y, fmt.Sprintf("BgmLen: %v", s.bgm.streamer.Len()))
1394+ if s.nomusic == false {
1395+ put(&y, fmt.Sprintf("BgmPlayback: enabled"))
1396+ } else {
1397+ put(&y, fmt.Sprintf("BgmPlayback: disabled"))
1398+ }
1399+ put(&y, fmt.Sprintf("BgmLoopEnd: %v", s.bgm.bgmLoopEnd))
1400+ put(&y, fmt.Sprintf("BgmLoopStart: %v", s.bgm.bgmLoopStart))
1401+ } else {
1402+ put(&y, fmt.Sprintf("BgmPlayback: disabled"))
1403+ }
13831404 }
13841405 for i, p := range s.chars {
13851406 if len(p) > 0 {