• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
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

Revisione03685647fc0b754ff2213a5b59d31e86d81b195 (tree)
Time2019-10-09 17:39:52
Authorneatunsou <sisiy4excite@gmai...>
Commiterneatunsou

Log Message

Afterimageのalphaの数値が範囲外になる場合があるのを修正
Afterimageをヒットポーズで停止しないように、ignorehitpause=0で停止できるようにした
ProjectileのAfterimageの初期値を修正
コンテニュー後にステージやパレットが変わらないようにした

Change Summary

Incremental Difference

--- a/script/select.lua
+++ b/script/select.lua
@@ -404,12 +404,15 @@ function select.f_assignMusic()
404404 end
405405
406406 function select.f_selectStage()
407- if main.t_selChars[t_p2Selected[1].cel + 1].stage ~= nil then
407+ if t_p2Selected[1].stageno ~= nil then
408+ stageNo = t_p2Selected[1].stageno
409+ elseif main.t_selChars[t_p2Selected[1].cel + 1].stage ~= nil then
408410 stageNo = math.random(1, #main.t_selChars[t_p2Selected[1].cel + 1].stage)
409411 stageNo = main.t_selChars[t_p2Selected[1].cel + 1].stage[stageNo]
410412 else
411413 stageNo = main.t_includeStage[math.random(1, #main.t_includeStage)]
412414 end
415+ t_p2Selected[1].stageno = stageNo
413416 setStage(stageNo)
414417 selectStage(stageNo)
415418 end
@@ -760,7 +763,9 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1)
760763 looseCnt = 0
761764 main.f_cmdInput()
762765 select.f_selectReset()
766+ t_p2Selected = {}
763767 stageEnd = true
768+ local t_enemySelected = {}
764769 while true do
765770 main.f_resetBG(motif.select_info, motif.selectbgdef, motif.music.select_bgm, motif.music.select_bgm_loop, motif.music.select_bgm_volume, motif.music.select_bgm_loopstart, motif.music.select_bgm_loopend)
766771 selectStart()
@@ -780,6 +785,7 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1)
780785 p1NumChars = 2
781786 setTeamMode(1, p1TeamMode, p1NumChars)
782787 t_p1Selected[2] = {cel = t_p2Selected[1].cel, pal = t_p2Selected[1].pal}
788+ t_p2Selected = t_enemySelected
783789 end
784790 --generate roster
785791 select.f_makeRoster()
@@ -824,6 +830,7 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1)
824830 select.f_selectVictory()
825831 end
826832 end
833+ t_p2Selected = {}
827834 --no more matches left
828835 if matchNo == lastMatch then
829836 --ending
@@ -931,28 +938,32 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1)
931938 p1NumChars = 2
932939 p2NumChars = numChars
933940 t_p1Selected[2] = {cel = t_p2Selected[1].cel, pal = t_p2Selected[1].pal}
941+ t_p2Selected = t_enemySelected
934942 end
935943 end
936944 --assign enemy team
937- t_p2Selected = {}
938- local shuffle = true
939- for i = 1, p2NumChars do
940- if i == 1 and (main.gameMode == 'arcade' or main.gameMode == 'teamcoop' or main.gameMode == 'netplayteamcoop') and main.t_selChars[t_p1Selected[1].cel + 1][matchNo] ~= nil then
941- p2Cell = main.t_charDef[main.t_selChars[t_p1Selected[1].cel + 1][matchNo]]
942- shuffle = false
943- else
944- p2Cell = t_roster[matchNo * p2NumChars - i + 1]
945- end
946- local updateAnim = true
947- for j = 1, #t_p2Selected do
948- if t_p2Selected[j].cel == p2Cell then
949- updateAnim = false
945+ --t_p2Selected = {}
946+ if #t_p2Selected == 0 then
947+ local shuffle = true
948+ for i = 1, p2NumChars do
949+ if i == 1 and (main.gameMode == 'arcade' or main.gameMode == 'teamcoop' or main.gameMode == 'netplayteamcoop') and main.t_selChars[t_p1Selected[1].cel + 1][matchNo] ~= nil then
950+ p2Cell = main.t_charDef[main.t_selChars[t_p1Selected[1].cel + 1][matchNo]]
951+ shuffle = false
952+ else
953+ p2Cell = t_roster[matchNo * p2NumChars - i + 1]
954+ end
955+ local updateAnim = true
956+ for j = 1, #t_p2Selected do
957+ if t_p2Selected[j].cel == p2Cell then
958+ updateAnim = false
959+ end
960+ end
961+ t_p2Selected[#t_p2Selected + 1] = {cel = p2Cell, pal = select.f_randomPal(p2Cell), up = updateAnim}
962+ if shuffle then
963+ main.f_shuffleTable(t_p2Selected)
950964 end
951965 end
952- t_p2Selected[#t_p2Selected + 1] = {cel = p2Cell, pal = select.f_randomPal(p2Cell), up = updateAnim}
953- if shuffle then
954- main.f_shuffleTable(t_p2Selected)
955- end
966+ t_enemySelected = t_p2Selected
956967 end
957968 --Team conversion to Single match if bonus paramvalue on any opponents is detected
958969 if p2NumChars > 1 then
--- a/src/bytecode.go
+++ b/src/bytecode.go
@@ -3062,6 +3062,7 @@ const (
30623062 afterImage_palpostbright
30633063 afterImage_paladd
30643064 afterImage_palmul
3065+ afterImage_ignorehitpause
30653066 afterImage_last = iota + palFX_last + 1 - 1
30663067 afterImage_redirectid
30673068 )
@@ -3070,7 +3071,7 @@ func (sc afterImage) runSub(c *Char, ai *AfterImage,
30703071 id byte, exp []BytecodeExp) {
30713072 switch id {
30723073 case afterImage_trans:
3073- ai.alpha = [...]int32{exp[0].evalI(c), exp[1].evalI(c)}
3074+ ai.alpha = [...]int32{Max(-256, Min(255, exp[0].evalI(c))), Max(-256, Min(255, exp[1].evalI(c)))}
30743075 case afterImage_time:
30753076 ai.time = exp[0].evalI(c)
30763077 case afterImage_length:
@@ -3123,6 +3124,8 @@ func (sc afterImage) runSub(c *Char, ai *AfterImage,
31233124 ai.mul[2] = exp[2].evalF(c)
31243125 }
31253126 }
3127+ case afterImage_ignorehitpause:
3128+ ai.ignorehitpause = exp[0].evalB(c)
31263129 }
31273130 }
31283131 func (sc afterImage) Run(c *Char, _ []int32) bool {
@@ -3771,6 +3774,7 @@ func (sc projectile) Run(c *Char, _ []int32) bool {
37713774 p.platformFence = exp[0].evalB(c)
37723775 default:
37733776 if !hitDef(sc).runSub(c, &p.hitdef, id, exp) {
3777+ p.aimg.clear()
37743778 afterImage(sc).runSub(c, &p.aimg, id, exp)
37753779 }
37763780 }
--- a/src/char.go
+++ b/src/char.go
@@ -663,19 +663,20 @@ type aimgImage struct {
663663 }
664664
665665 type AfterImage struct {
666- time int32
667- length int32
668- postbright [3]int32
669- add [3]int32
670- mul [3]float32
671- timegap int32
672- framegap int32
673- alpha [2]int32
674- palfx []PalFX
675- imgs [64]aimgImage
676- imgidx int32
677- restgap int32
678- reccount int32
666+ time int32
667+ length int32
668+ postbright [3]int32
669+ add [3]int32
670+ mul [3]float32
671+ timegap int32
672+ framegap int32
673+ alpha [2]int32
674+ palfx []PalFX
675+ imgs [64]aimgImage
676+ imgidx int32
677+ restgap int32
678+ reccount int32
679+ ignorehitpause bool
679680 }
680681
681682 func newAfterImage() *AfterImage {
@@ -700,11 +701,12 @@ func (ai *AfterImage) clear() {
700701 ai.add = [...]int32{10, 10, 25}
701702 ai.mul = [...]float32{0.65, 0.65, 0.75}
702703 ai.timegap = 1
703- ai.framegap = 6
704+ ai.framegap = 4
704705 ai.alpha = [...]int32{-1, 0}
705706 ai.imgidx = 0
706707 ai.restgap = 0
707708 ai.reccount = 0
709+ ai.ignorehitpause = true
708710 }
709711 func (ai *AfterImage) setPalColor(color int32) {
710712 if len(ai.palfx) > 0 {
@@ -758,12 +760,12 @@ func (ai *AfterImage) setupPalFX() {
758760 pb = [3]int32{}
759761 }
760762 }
761-func (ai *AfterImage) recAfterImg(sd *SprData) {
763+func (ai *AfterImage) recAfterImg(sd *SprData, hitpause bool) {
762764 if ai.time == 0 {
763765 ai.reccount, ai.timegap = 0, 0
764766 return
765767 }
766- if ai.time > 0 {
768+ if ai.time > 0 && !hitpause {
767769 ai.time--
768770 }
769771 if ai.restgap <= 0 {
@@ -791,7 +793,7 @@ func (ai *AfterImage) recAfterImg(sd *SprData) {
791793 }
792794 ai.restgap--
793795 }
794-func (ai *AfterImage) recAndCue(sd *SprData, rec bool) {
796+func (ai *AfterImage) recAndCue(sd *SprData, rec bool, hitpause bool) {
795797 if ai.time == 0 || ai.timegap < 1 || ai.timegap > 32767 ||
796798 ai.framegap < 1 || ai.framegap > 32767 {
797799 ai.time = 0
@@ -807,8 +809,8 @@ func (ai *AfterImage) recAndCue(sd *SprData, rec bool) {
807809 img.scl, ai.alpha, sd.priority - 2, img.angle, img.yangle, img.xangle, img.ascl,
808810 false, sd.bright, sd.oldVer, sd.facing, sd.posLocalscl}, 0, 0, 0, 0)
809811 }
810- if rec {
811- ai.recAfterImg(sd)
812+ if rec || hitpause && ai.ignorehitpause {
813+ ai.recAfterImg(sd, hitpause)
812814 }
813815 }
814816
@@ -1345,7 +1347,7 @@ func (p *Projectile) cueDraw(oldVer bool, playerNo int) {
13451347 [...]float32{p.facing * p.scale[0] * p.localscl, p.scale[1] * p.localscl}, [2]int32{-1},
13461348 p.sprpriority, p.facing * p.angle, 0, 0, [...]float32{1, 1}, false, playerNo == sys.superplayer,
13471349 sys.cgi[playerNo].ver[0] != 1, p.facing, 1}
1348- p.aimg.recAndCue(sd, sys.tickNextFrame() && notpause)
1350+ p.aimg.recAndCue(sd, sys.tickNextFrame() && notpause, false)
13491351 sys.sprites.add(sd,
13501352 p.shadow[0]<<16|p.shadow[1]&255<<8|p.shadow[2]&255, 256, 0, 0)
13511353 }
@@ -4768,7 +4770,7 @@ func (c *Char) cueDraw() {
47684770 }
47694771 if c.sf(CSF_invisible) || c.scf(SCF_standby) {
47704772 if rec {
4771- c.aimg.recAfterImg(sdf())
4773+ c.aimg.recAfterImg(sdf(), c.hitPause())
47724774 }
47734775 } else {
47744776 //if c.gi().ver[0] != 1 && c.sf(CSF_angledraw) && !c.sf(CSF_trans) {
@@ -4776,7 +4778,7 @@ func (c *Char) cueDraw() {
47764778 // c.alpha = [...]int32{255, 0}
47774779 //}
47784780 sd := sdf()
4779- c.aimg.recAndCue(sd, rec)
4781+ c.aimg.recAndCue(sd, rec, sys.tickNextFrame() && c.hitPause())
47804782 if c.ghv.hitshaketime > 0 && c.ss.time&1 != 0 {
47814783 sd.pos[0] -= c.facing
47824784 }
--- a/src/compiler.go
+++ b/src/compiler.go
@@ -3920,7 +3920,7 @@ func (c *Compiler) bgPalFX(is IniSection, sc *StateControllerBase,
39203920 return *ret, err
39213921 }
39223922 func (c *Compiler) afterImageSub(is IniSection,
3923- sc *StateControllerBase, prefix string) error {
3923+ sc *StateControllerBase, ihp int8, prefix string) error {
39243924 if err := c.paramValue(is, sc, "redirectid",
39253925 afterImage_redirectid, VT_Int, 1, false); err != nil {
39263926 return err
@@ -3973,12 +3973,15 @@ func (c *Compiler) afterImageSub(is IniSection,
39733973 afterImage_palmul, VT_Float, 3, false); err != nil {
39743974 return err
39753975 }
3976+ if ihp == 0 {
3977+ sc.add(afterImage_ignorehitpause, sc.iToExp(0))
3978+ }
39763979 return nil
39773980 }
39783981 func (c *Compiler) afterImage(is IniSection, sc *StateControllerBase,
3979- _ int8) (StateController, error) {
3982+ ihp int8) (StateController, error) {
39803983 ret, err := (*afterImage)(sc), c.stateSec(is, func() error {
3981- return c.afterImageSub(is, sc, "")
3984+ return c.afterImageSub(is, sc, ihp, "")
39823985 })
39833986 return *ret, err
39843987 }
@@ -4552,7 +4555,7 @@ func (c *Compiler) reversalDef(is IniSection, sc *StateControllerBase,
45524555 return *ret, err
45534556 }
45544557 func (c *Compiler) projectile(is IniSection, sc *StateControllerBase,
4555- _ int8) (StateController, error) {
4558+ ihp int8) (StateController, error) {
45564559 ret, err := (*projectile)(sc), c.stateSec(is, func() error {
45574560 if err := c.paramValue(is, sc, "redirectid",
45584561 projectile_redirectid, VT_Int, 1, false); err != nil {
@@ -4671,7 +4674,7 @@ func (c *Compiler) projectile(is IniSection, sc *StateControllerBase,
46714674 projectile_remappal, VT_Int, 2, false); err != nil {
46724675 return err
46734676 }
4674- if err := c.afterImageSub(is, sc, "afterimage."); err != nil {
4677+ if err := c.afterImageSub(is, sc, ihp, "afterimage."); err != nil {
46754678 return err
46764679 }
46774680 if err := c.paramValue(is, sc, "platform",