Go で書き直した Ikemen
Revision | e03685647fc0b754ff2213a5b59d31e86d81b195 (tree) |
---|---|
Time | 2019-10-09 17:39:52 |
Author | neatunsou <sisiy4excite@gmai...> |
Commiter | neatunsou |
Afterimageのalphaの数値が範囲外になる場合があるのを修正
Afterimageをヒットポーズで停止しないように、ignorehitpause=0で停止できるようにした
ProjectileのAfterimageの初期値を修正
コンテニュー後にステージやパレットが変わらないようにした
@@ -404,12 +404,15 @@ function select.f_assignMusic() | ||
404 | 404 | end |
405 | 405 | |
406 | 406 | 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 | |
408 | 410 | stageNo = math.random(1, #main.t_selChars[t_p2Selected[1].cel + 1].stage) |
409 | 411 | stageNo = main.t_selChars[t_p2Selected[1].cel + 1].stage[stageNo] |
410 | 412 | else |
411 | 413 | stageNo = main.t_includeStage[math.random(1, #main.t_includeStage)] |
412 | 414 | end |
415 | + t_p2Selected[1].stageno = stageNo | |
413 | 416 | setStage(stageNo) |
414 | 417 | selectStage(stageNo) |
415 | 418 | end |
@@ -760,7 +763,9 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1) | ||
760 | 763 | looseCnt = 0 |
761 | 764 | main.f_cmdInput() |
762 | 765 | select.f_selectReset() |
766 | + t_p2Selected = {} | |
763 | 767 | stageEnd = true |
768 | + local t_enemySelected = {} | |
764 | 769 | while true do |
765 | 770 | 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) |
766 | 771 | selectStart() |
@@ -780,6 +785,7 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1) | ||
780 | 785 | p1NumChars = 2 |
781 | 786 | setTeamMode(1, p1TeamMode, p1NumChars) |
782 | 787 | t_p1Selected[2] = {cel = t_p2Selected[1].cel, pal = t_p2Selected[1].pal} |
788 | + t_p2Selected = t_enemySelected | |
783 | 789 | end |
784 | 790 | --generate roster |
785 | 791 | select.f_makeRoster() |
@@ -824,6 +830,7 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1) | ||
824 | 830 | select.f_selectVictory() |
825 | 831 | end |
826 | 832 | end |
833 | + t_p2Selected = {} | |
827 | 834 | --no more matches left |
828 | 835 | if matchNo == lastMatch then |
829 | 836 | --ending |
@@ -931,28 +938,32 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1) | ||
931 | 938 | p1NumChars = 2 |
932 | 939 | p2NumChars = numChars |
933 | 940 | t_p1Selected[2] = {cel = t_p2Selected[1].cel, pal = t_p2Selected[1].pal} |
941 | + t_p2Selected = t_enemySelected | |
934 | 942 | end |
935 | 943 | end |
936 | 944 | --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) | |
950 | 964 | end |
951 | 965 | 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 | |
956 | 967 | end |
957 | 968 | --Team conversion to Single match if bonus paramvalue on any opponents is detected |
958 | 969 | if p2NumChars > 1 then |
@@ -3062,6 +3062,7 @@ const ( | ||
3062 | 3062 | afterImage_palpostbright |
3063 | 3063 | afterImage_paladd |
3064 | 3064 | afterImage_palmul |
3065 | + afterImage_ignorehitpause | |
3065 | 3066 | afterImage_last = iota + palFX_last + 1 - 1 |
3066 | 3067 | afterImage_redirectid |
3067 | 3068 | ) |
@@ -3070,7 +3071,7 @@ func (sc afterImage) runSub(c *Char, ai *AfterImage, | ||
3070 | 3071 | id byte, exp []BytecodeExp) { |
3071 | 3072 | switch id { |
3072 | 3073 | 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)))} | |
3074 | 3075 | case afterImage_time: |
3075 | 3076 | ai.time = exp[0].evalI(c) |
3076 | 3077 | case afterImage_length: |
@@ -3123,6 +3124,8 @@ func (sc afterImage) runSub(c *Char, ai *AfterImage, | ||
3123 | 3124 | ai.mul[2] = exp[2].evalF(c) |
3124 | 3125 | } |
3125 | 3126 | } |
3127 | + case afterImage_ignorehitpause: | |
3128 | + ai.ignorehitpause = exp[0].evalB(c) | |
3126 | 3129 | } |
3127 | 3130 | } |
3128 | 3131 | func (sc afterImage) Run(c *Char, _ []int32) bool { |
@@ -3771,6 +3774,7 @@ func (sc projectile) Run(c *Char, _ []int32) bool { | ||
3771 | 3774 | p.platformFence = exp[0].evalB(c) |
3772 | 3775 | default: |
3773 | 3776 | if !hitDef(sc).runSub(c, &p.hitdef, id, exp) { |
3777 | + p.aimg.clear() | |
3774 | 3778 | afterImage(sc).runSub(c, &p.aimg, id, exp) |
3775 | 3779 | } |
3776 | 3780 | } |
@@ -663,19 +663,20 @@ type aimgImage struct { | ||
663 | 663 | } |
664 | 664 | |
665 | 665 | 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 | |
679 | 680 | } |
680 | 681 | |
681 | 682 | func newAfterImage() *AfterImage { |
@@ -700,11 +701,12 @@ func (ai *AfterImage) clear() { | ||
700 | 701 | ai.add = [...]int32{10, 10, 25} |
701 | 702 | ai.mul = [...]float32{0.65, 0.65, 0.75} |
702 | 703 | ai.timegap = 1 |
703 | - ai.framegap = 6 | |
704 | + ai.framegap = 4 | |
704 | 705 | ai.alpha = [...]int32{-1, 0} |
705 | 706 | ai.imgidx = 0 |
706 | 707 | ai.restgap = 0 |
707 | 708 | ai.reccount = 0 |
709 | + ai.ignorehitpause = true | |
708 | 710 | } |
709 | 711 | func (ai *AfterImage) setPalColor(color int32) { |
710 | 712 | if len(ai.palfx) > 0 { |
@@ -758,12 +760,12 @@ func (ai *AfterImage) setupPalFX() { | ||
758 | 760 | pb = [3]int32{} |
759 | 761 | } |
760 | 762 | } |
761 | -func (ai *AfterImage) recAfterImg(sd *SprData) { | |
763 | +func (ai *AfterImage) recAfterImg(sd *SprData, hitpause bool) { | |
762 | 764 | if ai.time == 0 { |
763 | 765 | ai.reccount, ai.timegap = 0, 0 |
764 | 766 | return |
765 | 767 | } |
766 | - if ai.time > 0 { | |
768 | + if ai.time > 0 && !hitpause { | |
767 | 769 | ai.time-- |
768 | 770 | } |
769 | 771 | if ai.restgap <= 0 { |
@@ -791,7 +793,7 @@ func (ai *AfterImage) recAfterImg(sd *SprData) { | ||
791 | 793 | } |
792 | 794 | ai.restgap-- |
793 | 795 | } |
794 | -func (ai *AfterImage) recAndCue(sd *SprData, rec bool) { | |
796 | +func (ai *AfterImage) recAndCue(sd *SprData, rec bool, hitpause bool) { | |
795 | 797 | if ai.time == 0 || ai.timegap < 1 || ai.timegap > 32767 || |
796 | 798 | ai.framegap < 1 || ai.framegap > 32767 { |
797 | 799 | ai.time = 0 |
@@ -807,8 +809,8 @@ func (ai *AfterImage) recAndCue(sd *SprData, rec bool) { | ||
807 | 809 | img.scl, ai.alpha, sd.priority - 2, img.angle, img.yangle, img.xangle, img.ascl, |
808 | 810 | false, sd.bright, sd.oldVer, sd.facing, sd.posLocalscl}, 0, 0, 0, 0) |
809 | 811 | } |
810 | - if rec { | |
811 | - ai.recAfterImg(sd) | |
812 | + if rec || hitpause && ai.ignorehitpause { | |
813 | + ai.recAfterImg(sd, hitpause) | |
812 | 814 | } |
813 | 815 | } |
814 | 816 |
@@ -1345,7 +1347,7 @@ func (p *Projectile) cueDraw(oldVer bool, playerNo int) { | ||
1345 | 1347 | [...]float32{p.facing * p.scale[0] * p.localscl, p.scale[1] * p.localscl}, [2]int32{-1}, |
1346 | 1348 | p.sprpriority, p.facing * p.angle, 0, 0, [...]float32{1, 1}, false, playerNo == sys.superplayer, |
1347 | 1349 | 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) | |
1349 | 1351 | sys.sprites.add(sd, |
1350 | 1352 | p.shadow[0]<<16|p.shadow[1]&255<<8|p.shadow[2]&255, 256, 0, 0) |
1351 | 1353 | } |
@@ -4768,7 +4770,7 @@ func (c *Char) cueDraw() { | ||
4768 | 4770 | } |
4769 | 4771 | if c.sf(CSF_invisible) || c.scf(SCF_standby) { |
4770 | 4772 | if rec { |
4771 | - c.aimg.recAfterImg(sdf()) | |
4773 | + c.aimg.recAfterImg(sdf(), c.hitPause()) | |
4772 | 4774 | } |
4773 | 4775 | } else { |
4774 | 4776 | //if c.gi().ver[0] != 1 && c.sf(CSF_angledraw) && !c.sf(CSF_trans) { |
@@ -4776,7 +4778,7 @@ func (c *Char) cueDraw() { | ||
4776 | 4778 | // c.alpha = [...]int32{255, 0} |
4777 | 4779 | //} |
4778 | 4780 | sd := sdf() |
4779 | - c.aimg.recAndCue(sd, rec) | |
4781 | + c.aimg.recAndCue(sd, rec, sys.tickNextFrame() && c.hitPause()) | |
4780 | 4782 | if c.ghv.hitshaketime > 0 && c.ss.time&1 != 0 { |
4781 | 4783 | sd.pos[0] -= c.facing |
4782 | 4784 | } |
@@ -3920,7 +3920,7 @@ func (c *Compiler) bgPalFX(is IniSection, sc *StateControllerBase, | ||
3920 | 3920 | return *ret, err |
3921 | 3921 | } |
3922 | 3922 | func (c *Compiler) afterImageSub(is IniSection, |
3923 | - sc *StateControllerBase, prefix string) error { | |
3923 | + sc *StateControllerBase, ihp int8, prefix string) error { | |
3924 | 3924 | if err := c.paramValue(is, sc, "redirectid", |
3925 | 3925 | afterImage_redirectid, VT_Int, 1, false); err != nil { |
3926 | 3926 | return err |
@@ -3973,12 +3973,15 @@ func (c *Compiler) afterImageSub(is IniSection, | ||
3973 | 3973 | afterImage_palmul, VT_Float, 3, false); err != nil { |
3974 | 3974 | return err |
3975 | 3975 | } |
3976 | + if ihp == 0 { | |
3977 | + sc.add(afterImage_ignorehitpause, sc.iToExp(0)) | |
3978 | + } | |
3976 | 3979 | return nil |
3977 | 3980 | } |
3978 | 3981 | func (c *Compiler) afterImage(is IniSection, sc *StateControllerBase, |
3979 | - _ int8) (StateController, error) { | |
3982 | + ihp int8) (StateController, error) { | |
3980 | 3983 | ret, err := (*afterImage)(sc), c.stateSec(is, func() error { |
3981 | - return c.afterImageSub(is, sc, "") | |
3984 | + return c.afterImageSub(is, sc, ihp, "") | |
3982 | 3985 | }) |
3983 | 3986 | return *ret, err |
3984 | 3987 | } |
@@ -4552,7 +4555,7 @@ func (c *Compiler) reversalDef(is IniSection, sc *StateControllerBase, | ||
4552 | 4555 | return *ret, err |
4553 | 4556 | } |
4554 | 4557 | func (c *Compiler) projectile(is IniSection, sc *StateControllerBase, |
4555 | - _ int8) (StateController, error) { | |
4558 | + ihp int8) (StateController, error) { | |
4556 | 4559 | ret, err := (*projectile)(sc), c.stateSec(is, func() error { |
4557 | 4560 | if err := c.paramValue(is, sc, "redirectid", |
4558 | 4561 | projectile_redirectid, VT_Int, 1, false); err != nil { |
@@ -4671,7 +4674,7 @@ func (c *Compiler) projectile(is IniSection, sc *StateControllerBase, | ||
4671 | 4674 | projectile_remappal, VT_Int, 2, false); err != nil { |
4672 | 4675 | return err |
4673 | 4676 | } |
4674 | - if err := c.afterImageSub(is, sc, "afterimage."); err != nil { | |
4677 | + if err := c.afterImageSub(is, sc, ihp, "afterimage."); err != nil { | |
4675 | 4678 | return err |
4676 | 4679 | } |
4677 | 4680 | if err := c.paramValue(is, sc, "platform", |