• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamepythonphpguiwindowsc翻訳omegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

Go で書き直した Ikemen


Commit MetaInfo

Revision9b298e045c1717a8cba795ddf97182ef12c08b44 (tree)
Time2019-05-18 01:14:32
Authorneatunsou <sisiy4excite@gmai...>
Commiterneatunsou

Log Message

volumeとvolumescaleをバージョン関係なく読み込むようにした
QuickLaunchの仕様を少し変更して更に起動が早いモードを追加

Change Summary

Incremental Difference

--- a/src/bytecode.go
+++ b/src/bytecode.go
@@ -1929,6 +1929,7 @@ const (
19291929 playSnd_pan
19301930 playSnd_abspan
19311931 playSnd_volume
1932+ playSnd_volumescale
19321933 playSnd_freqmul
19331934 playSnd_loop
19341935 playSnd_redirectid
@@ -1937,10 +1938,7 @@ const (
19371938 func (sc playSnd) Run(c *Char, _ []int32) bool {
19381939 crun := c
19391940 f, lw, lp := false, false, false
1940- var g, n, ch, vo int32 = -1, 0, -1, 0
1941- if c.gi().ver[0] == 1 {
1942- vo = 100
1943- }
1941+ var g, n, ch, vo int32 = -1, 0, -1, 100
19441942 var p, fr float32 = 0, 1
19451943 x := &c.pos[0]
19461944 StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
@@ -1961,6 +1959,8 @@ func (sc playSnd) Run(c *Char, _ []int32) bool {
19611959 x = nil
19621960 p = exp[0].evalF(c)
19631961 case playSnd_volume:
1962+ vo = vo + exp[0].evalI(c)*(25/64)
1963+ case playSnd_volumescale:
19641964 vo = exp[0].evalI(c)
19651965 case playSnd_freqmul:
19661966 fr = exp[0].evalF(c)
@@ -4660,10 +4660,7 @@ func (sc superPause) Run(c *Char, _ []int32) bool {
46604660 if len(exp) > 2 {
46614661 n = exp[2].evalI(c)
46624662 }
4663- vo := int32(0)
4664- if c.gi().ver[0] == 1 {
4665- vo = 100
4666- }
4663+ vo := int32(100)
46674664 crun.playSound(exp[0].evalB(c), false, false, exp[1].evalI(c), n, -1,
46684665 vo, 0, 1, &crun.pos[0])
46694666 case superPause_redirectid:
--- a/src/char.go
+++ b/src/char.go
@@ -1808,12 +1808,11 @@ func (c *Char) load(def string) error {
18081808 gi.data.guard.sparkno = ^IErr
18091809 }
18101810 is.ReadI32("ko.echo", &gi.data.ko.echo)
1811- if gi.ver[0] == 1 {
1812- if is.ReadI32("volumescale", &i32) {
1813- gi.data.volume = i32 * 64 / 25
1814- }
1815- } else if is.ReadI32("volume", &i32) {
1816- gi.data.volume = i32 + 256
1811+ if is.ReadI32("volume", &i32) {
1812+ gi.data.volume = i32/2 + 256
1813+ }
1814+ if is.ReadI32("volumescale", &i32) {
1815+ gi.data.volume = i32 * 64 / 25
18171816 }
18181817 is.ReadI32("intpersistindex", &gi.data.intpersistindex)
18191818 is.ReadI32("floatpersistindex", &gi.data.floatpersistindex)
@@ -2654,19 +2653,19 @@ func (c *Char) playSound(f, lowpriority, loop bool, g, n, chNo, vol int32,
26542653 if ch := c.newChannel(chNo, lowpriority); ch != nil {
26552654 ch.sound, ch.loop, ch.freqmul = w, loop, freqmul
26562655 vol = Max(-25600, Min(25600, vol))
2657- if c.gi().ver[0] == 1 {
2658- if f {
2659- ch.SetVolume(256)
2660- } else {
2661- ch.SetVolume(c.gi().data.volume * vol / 100)
2662- }
2656+ //if c.gi().ver[0] == 1 {
2657+ if f {
2658+ ch.SetVolume(256)
26632659 } else {
2664- if f {
2665- ch.SetVolume(vol + 256)
2666- } else {
2667- ch.SetVolume(c.gi().data.volume + vol)
2668- }
2660+ ch.SetVolume(c.gi().data.volume * vol / 100)
26692661 }
2662+ //} else {
2663+ // if f {
2664+ // ch.SetVolume(vol + 256)
2665+ // } else {
2666+ // ch.SetVolume(c.gi().data.volume + vol)
2667+ // }
2668+ //}
26702669 }
26712670 }
26722671
@@ -4624,10 +4623,7 @@ func (c *Char) tick() {
46244623 if !c.hitPause() {
46254624 if c.life <= 0 && !sys.sf(GSF_noko) {
46264625 if !sys.sf(GSF_nokosnd) && c.alive() {
4627- vo := int32(0)
4628- if c.gi().ver[0] == 1 {
4629- vo = 100
4630- }
4626+ vo := int32(100)
46314627 c.playSound(false, false, false, 11, 0, -1, vo, 0, 1, &c.pos[0])
46324628 }
46334629 c.setSCF(SCF_ko)
@@ -5184,10 +5180,7 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
51845180 if f {
51855181 sg ^= -1
51865182 }
5187- vo := int32(0)
5188- if c.gi().ver[0] == 1 {
5189- vo = 100
5190- }
5183+ vo := int32(100)
51915184 c.playSound(f, false, false, sg, hd.hitsound[1],
51925185 -1, vo, 0, 1, &getter.pos[0])
51935186 }
@@ -5211,10 +5204,7 @@ func (cl *CharList) clsn(getter *Char, proj bool) {
52115204 if f {
52125205 sg ^= -1
52135206 }
5214- vo := int32(0)
5215- if c.gi().ver[0] == 1 {
5216- vo = 100
5217- }
5207+ vo := int32(100)
52185208 c.playSound(f, false, false, sg, hd.guardsound[1],
52195209 -1, vo, 0, 1, &getter.pos[0])
52205210 }
--- a/src/compiler.go
+++ b/src/compiler.go
@@ -3226,16 +3226,14 @@ func (c *Compiler) playSnd(is IniSection, sc *StateControllerBase,
32263226 playSnd_abspan, VT_Float, 1, false); err != nil {
32273227 return err
32283228 }
3229- var volname string
3230- if sys.cgi[c.playerNo].ver[0] == 1 {
3231- volname = "volumescale"
3232- } else {
3233- volname = "volume"
3234- }
3235- if err := c.paramValue(is, sc, volname,
3229+ if err := c.paramValue(is, sc, "volume",
32363230 playSnd_volume, VT_Int, 1, false); err != nil {
32373231 return err
32383232 }
3233+ if err := c.paramValue(is, sc, "volumescale",
3234+ playSnd_volumescale, VT_Int, 1, false); err != nil {
3235+ return err
3236+ }
32393237 if err := c.paramValue(is, sc, "freqmul",
32403238 playSnd_freqmul, VT_Float, 1, false); err != nil {
32413239 return err
--- a/src/main.go
+++ b/src/main.go
@@ -79,9 +79,9 @@ func main() {
7979 "PlayerProjectileMax":256,
8080 "ExplodMax":512,
8181 "AfterImageMax":128,
82- "MasterVolume":100,
83- "WavVolume":100,
84- "BgmVolume":100,
82+ "MasterVolume":80,
83+ "WavVolume":80,
84+ "BgmVolume":80,
8585 "Attack.LifeToPowerMul":0.7,
8686 "GetHit.LifeToPowerMul":0.6,
8787 "Width":640,
@@ -129,7 +129,8 @@ func main() {
129129 "TeamPowerShare":false,
130130 "TeamLifeShare":false,
131131 "Fullscreen":false,
132- "AudioDucking":false,
132+ "AudioDucking":false,
133+ "QuickLaunch":0,
133134 "AllowDebugKeys":true,
134135 "PostProcessingShader":0,
135136 "IP":{
@@ -168,7 +169,7 @@ func main() {
168169 PostProcessingShader int32
169170 CommonAir string
170171 CommonCmd string
171- QuickLaunch bool
172+ QuickLaunch int
172173 }{}
173174 chk(json.Unmarshal(defcfg, &tmp))
174175 const configFile = "data/config.json"
--- a/src/script.go
+++ b/src/script.go
@@ -679,6 +679,20 @@ func systemScriptInit(l *lua.LState) {
679679 }
680680 c.lportrait.Draw(x/float32(sys.luaSpriteScale)+float32(sys.luaSpriteOffsetX), y/float32(sys.luaSpriteScale), xscl/sys.luaBigPortraitScale, yscl/sys.luaBigPortraitScale, c.lportrait.Pal, nil)
681681 }
682+ //QuickLaunch用キャラセレポートレイト読み込み
683+ if c.sportrait == nil {
684+ LoadFile(&c.sprite, c.def, func(file string) error {
685+ var err error
686+ c.sportrait, err = loadFromSff(file, sys.sel.sportrait[0], sys.sel.sportrait[1])
687+ if err != nil {
688+ return nil
689+ }
690+ if len(c.pal) == 0 {
691+ c.pal, _ = selectablePalettes(file)
692+ }
693+ return nil
694+ })
695+ }
682696 }
683697 return 0
684698 })
@@ -1069,6 +1083,26 @@ func systemScriptInit(l *lua.LState) {
10691083 }
10701084 c.vsportrait.Draw(x/float32(sys.luaSpriteScale)+float32(sys.luaSpriteOffsetX), y/float32(sys.luaSpriteScale), xscl/sys.luaBigPortraitScale, yscl/sys.luaBigPortraitScale, c.vsportrait.Pal, nil)
10711085 }
1086+ //QuickLaunch用キャラセレポートレイト読み込み
1087+ if c.lportrait == nil {
1088+ LoadFile(&c.sprite, c.def, func(file string) error {
1089+ var err error
1090+ c.lportrait, err = loadFromSff(file, sys.sel.lportrait[0], sys.sel.lportrait[1])
1091+ c.vsportrait, err = loadFromSff(file, sys.sel.vsportrait[0], sys.sel.vsportrait[1])
1092+ if err != nil {
1093+ c.vsportrait = c.lportrait
1094+ }
1095+ c.vportrait, err = loadFromSff(file, sys.sel.vportrait[0], sys.sel.vportrait[1])
1096+ if err != nil {
1097+ c.vportrait = c.lportrait
1098+ }
1099+ if len(c.pal) == 0 {
1100+ c.pal, _ = selectablePalettes(file)
1101+ }
1102+ return nil
1103+ })
1104+
1105+ }
10721106 }
10731107 return 0
10741108 })
@@ -1090,6 +1124,29 @@ func systemScriptInit(l *lua.LState) {
10901124 }
10911125 c.vportrait.Draw(x/float32(sys.luaSpriteScale)+float32(sys.luaSpriteOffsetX), y/float32(sys.luaSpriteScale), xscl/float32(sys.luaSpriteScale), yscl/float32(sys.luaSpriteScale), c.vportrait.Pal, nil)
10921126 }
1127+ if c.vportrait == nil {
1128+ LoadFile(&c.sprite, c.def, func(file string) error {
1129+ var err error
1130+ if c.lportrait == nil {
1131+ c.lportrait, err = loadFromSff(file, sys.sel.lportrait[0], sys.sel.lportrait[1])
1132+ }
1133+ if c.vsportrait == nil && c.lportrait != nil {
1134+ c.vsportrait, err = loadFromSff(file, sys.sel.vsportrait[0], sys.sel.vsportrait[1])
1135+ if err != nil {
1136+ c.vsportrait = c.lportrait
1137+ }
1138+ }
1139+ c.vportrait, err = loadFromSff(file, sys.sel.vportrait[0], sys.sel.vportrait[1])
1140+ if err != nil && c.lportrait != nil {
1141+ c.vportrait = c.lportrait
1142+ }
1143+ if len(c.pal) == 0 {
1144+ c.pal, _ = selectablePalettes(file)
1145+ }
1146+ return nil
1147+ })
1148+
1149+ }
10931150 }
10941151 return 0
10951152 })
--- a/src/sound.go
+++ b/src/sound.go
@@ -308,7 +308,7 @@ func (bgm *Bgm) ReadVorbis() {
308308
309309 func (bgm *Bgm) ReadFormat(s beep.StreamSeekCloser, format beep.Format) {
310310 streamer := beep.Loop(-1, s)
311- volume := -5 + float64(sys.bgmVolume)*0.05*(float64(sys.masterVolume)/100)
311+ volume := -5 + float64(sys.bgmVolume)*0.06*(float64(sys.masterVolume)/100)
312312 streamer = &effects.Volume{Streamer: streamer, Base: 2, Volume: volume, Silent: volume <= -5}
313313 resample := beep.Resample(int(3), format.SampleRate, beep.SampleRate(Mp3SampleRate), streamer)
314314 bgm.ctrl = &beep.Ctrl{Streamer: resample}
--- a/src/system.go
+++ b/src/system.go
@@ -239,7 +239,7 @@ type System struct {
239239 keyString string
240240 timerCount []int32
241241 cmdFlags map[string]string
242- quickLaunch bool
242+ quickLaunch int
243243 masterVolume int
244244 wavVolume int
245245 bgmVolume int
@@ -1878,28 +1878,30 @@ func (s *Select) addCahr(def string) {
18781878 }
18791879 }
18801880 sc.sprite = sprite
1881- LoadFile(&sprite, def, func(file string) error {
1882- var err error
1883- sc.sportrait, err = loadFromSff(file, sys.sel.sportrait[0], sys.sel.sportrait[1])
1884- if sys.quickLaunch {
1885- sc.lportrait = sc.sportrait
1886- sc.vsportrait, sc.vportrait = sc.lportrait, sc.lportrait
1887- } else {
1888- sc.lportrait, err = loadFromSff(file, sys.sel.lportrait[0], sys.sel.lportrait[1])
1889- sc.vsportrait, err = loadFromSff(file, sys.sel.vsportrait[0], sys.sel.vsportrait[1])
1890- if err != nil {
1891- sc.vsportrait = sc.lportrait
1881+ if sys.quickLaunch < 2 {
1882+ LoadFile(&sprite, def, func(file string) error {
1883+ var err error
1884+ sc.sportrait, err = loadFromSff(file, sys.sel.sportrait[0], sys.sel.sportrait[1])
1885+ if sys.quickLaunch == 1 {
1886+ //sc.lportrait = sc.sportrait
1887+ //sc.vsportrait, sc.vportrait = sc.lportrait, sc.lportrait
1888+ } else {
1889+ sc.lportrait, err = loadFromSff(file, sys.sel.lportrait[0], sys.sel.lportrait[1])
1890+ sc.vsportrait, err = loadFromSff(file, sys.sel.vsportrait[0], sys.sel.vsportrait[1])
1891+ if err != nil {
1892+ sc.vsportrait = sc.lportrait
1893+ }
1894+ sc.vportrait, err = loadFromSff(file, sys.sel.vportrait[0], sys.sel.vportrait[1])
1895+ if err != nil {
1896+ sc.vportrait = sc.lportrait
1897+ }
18921898 }
1893- sc.vportrait, err = loadFromSff(file, sys.sel.vportrait[0], sys.sel.vportrait[1])
1894- if err != nil {
1895- sc.vportrait = sc.lportrait
1899+ if len(sc.pal) == 0 {
1900+ sc.pal, _ = selectablePalettes(file)
18961901 }
1897- }
1898- if len(sc.pal) == 0 {
1899- sc.pal, _ = selectablePalettes(file)
1900- }
1901- return nil
1902- })
1902+ return nil
1903+ })
1904+ }
19031905 }
19041906 func (s *Select) AddStage(def string) error {
19051907 var lines []string