Go で書き直した Ikemen
Revision | f5d07ae083fa263693bf0e6887e3d09585eefed9 (tree) |
---|---|
Time | 2019-10-26 20:07:03 |
Author | neatunsou <sisiy4excite@gmai...> |
Commiter | neatunsou |
Afterimagetimeが働いてないミスを修正
Afterimageのtime周りのミスを修正
Helperのownpal=0のパレットを修正
@@ -2540,9 +2540,12 @@ local txt_credits = main.f_createTextImg( | ||
2540 | 2540 | ) |
2541 | 2541 | |
2542 | 2542 | 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) | |
2543 | 2546 | continue = false |
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]) | |
2547 | + local text = main.f_extractText(motif.continue_screen.credits_text, main.credits) | |
2548 | + textImgSetText(txt_credits, text[1]) | |
2546 | 2549 | main.f_cmdInput() |
2547 | 2550 | while true do |
2548 | 2551 | --draw clearcolor (disabled to not cover area) |
@@ -3182,6 +3182,7 @@ func (sc afterImageTime) Run(c *Char, _ []int32) bool { | ||
3182 | 3182 | switch id { |
3183 | 3183 | case afterImageTime_time: |
3184 | 3184 | crun.aimg.time = exp[0].evalI(c) |
3185 | + crun.aimg.timecount = 0 | |
3185 | 3186 | } |
3186 | 3187 | return true |
3187 | 3188 | }) |
@@ -676,6 +676,7 @@ type AfterImage struct { | ||
676 | 676 | imgidx int32 |
677 | 677 | restgap int32 |
678 | 678 | reccount int32 |
679 | + timecount int32 | |
679 | 680 | ignorehitpause bool |
680 | 681 | } |
681 | 682 |
@@ -705,6 +706,7 @@ func (ai *AfterImage) clear() { | ||
705 | 706 | ai.imgidx = 0 |
706 | 707 | ai.restgap = 0 |
707 | 708 | ai.reccount = 0 |
709 | + ai.timecount = 0 | |
708 | 710 | ai.ignorehitpause = true |
709 | 711 | } |
710 | 712 | func (ai *AfterImage) setPalColor(color int32) { |
@@ -786,20 +788,21 @@ func (ai *AfterImage) recAfterImg(sd *SprData, hitpause bool) { | ||
786 | 788 | ai.restgap = ai.timegap |
787 | 789 | } |
788 | 790 | ai.restgap-- |
791 | + ai.timecount++ | |
789 | 792 | } |
790 | 793 | func (ai *AfterImage) recAndCue(sd *SprData, rec bool, hitpause bool) { |
791 | - if ai.time == 0 || (ai.reccount*ai.timegap >= ai.timegap*ai.length+ai.time && ai.time > 0) || | |
794 | + if ai.time == 0 || (ai.timecount >= ai.timegap*ai.length+ai.time-1 && ai.time > 0) || | |
792 | 795 | ai.timegap < 1 || ai.timegap > 32767 || |
793 | 796 | ai.framegap < 1 || ai.framegap > 32767 { |
794 | 797 | ai.time = 0 |
795 | - ai.reccount, ai.timegap = 0, 0 | |
798 | + ai.reccount, ai.timecount, ai.timegap = 0, 0, 0 | |
796 | 799 | return |
797 | 800 | } |
798 | 801 | end := Min(sys.afterImageMax, |
799 | 802 | (Min(Min(ai.reccount, int32(len(ai.imgs))), ai.length)/ai.framegap)*ai.framegap) |
800 | 803 | for i := ai.framegap; i <= end; i += ai.framegap { |
801 | 804 | img := &ai.imgs[(ai.imgidx-i)&63] |
802 | - if ai.time < 0 || (ai.reccount-i) < ai.time/ai.timegap { | |
805 | + if ai.time < 0 || (ai.timecount/ai.timegap-i) < (ai.time-2)/ai.timegap+1 { | |
803 | 806 | ai.palfx[i/ai.framegap-1].remap = sd.fx.remap |
804 | 807 | sys.sprites.add(&SprData{&img.anim, &ai.palfx[i/ai.framegap-1], img.pos, |
805 | 808 | img.scl, ai.alpha, sd.priority - 2, img.angle, img.yangle, img.xangle, img.ascl, |
@@ -1103,7 +1106,7 @@ type Projectile struct { | ||
1103 | 1106 | hits int32 |
1104 | 1107 | misstime int32 |
1105 | 1108 | priority int32 |
1106 | - priorityPoints int32 | |
1109 | + priorityPoints int32 | |
1107 | 1110 | sprpriority int32 |
1108 | 1111 | edgebound int32 |
1109 | 1112 | stagebound int32 |
@@ -1261,11 +1264,11 @@ func (p *Projectile) clsn(playerNo int) { | ||
1261 | 1264 | [...]float32{pr.pos[0] * pr.localscl, pr.pos[1] * pr.localscl}, pr.facing, |
1262 | 1265 | clsn2, [...]float32{p.clsnScale[0] * p.localscl, p.clsnScale[1] * p.localscl}, |
1263 | 1266 | [...]float32{p.pos[0] * p.localscl, p.pos[1] * p.localscl}, p.facing) { |
1264 | - | |
1267 | + | |
1265 | 1268 | opp, pp := &sys.projs[i][j], p.priorityPoints |
1266 | 1269 | cancel(&p.priorityPoints, &p.hits, opp.priorityPoints) |
1267 | 1270 | cancel(&opp.priorityPoints, &opp.hits, pp) |
1268 | - | |
1271 | + | |
1269 | 1272 | if p.hits < 0 { |
1270 | 1273 | break |
1271 | 1274 | } |
@@ -2942,11 +2945,13 @@ func (c *Char) helperInit(h *Char, st int32, pt PosType, x, y float32, | ||
2942 | 2945 | h.vel = [2]float32{} |
2943 | 2946 | if ownpal { |
2944 | 2947 | h.palfx = newPalFX() |
2945 | - tmp := c.getPalfx().remap | |
2946 | - h.palfx.remap = make([]int, len(tmp)) | |
2947 | - copy(h.palfx.remap, tmp) | |
2948 | - c.forceRemapPal(h.palfx, rp) | |
2948 | + } else { | |
2949 | + h.palfx = c.palfx | |
2949 | 2950 | } |
2951 | + tmp := c.getPalfx().remap | |
2952 | + h.palfx.remap = make([]int, len(tmp)) | |
2953 | + copy(h.palfx.remap, tmp) | |
2954 | + c.forceRemapPal(h.palfx, rp) | |
2950 | 2955 | if extmap { |
2951 | 2956 | for key, value := range c.mapArray { |
2952 | 2957 | h.mapArray[key] = value |