Go で書き直した Ikemen
Révision | 69944c7414994b41b670671299fa689e338d81eb (tree) |
---|---|
l'heure | 2018-10-18 20:14:33 |
Auteur | neatunsou <sisiy4excite@gmai...> |
Commiter | neatunsou |
AIRの透過処理が影に反映されるようにした(MUGEN1.1の仕様)
影に反映される透過の基準をデスティネーションアルファにした
maskwindowの幅が1ドットズレてるのを修正した
windowの縁がズームアウトすると正確でなくなるのを修正した
winmugen仕様キャラと判定するとangledrawでAIRの透過が外れる処理を無くした
(新MUGENでの動作を前提としながらmugenversionをwinmugenのままにしているキャラで不具合が起きるため)
@@ -591,7 +591,7 @@ func (a *Animation) alpha() int32 { | ||
591 | 591 | if a.srcAlpha >= 0 { |
592 | 592 | sa = byte(a.srcAlpha) |
593 | 593 | if a.dstAlpha < 0 { |
594 | - da = byte((^a.dstAlpha + int16(a.frames[a.drawidx].DstAlpha)) >> 1) | |
594 | + da = byte((^a.dstAlpha + int16(a.interpolate_blend_dstalpha)) >> 1) | |
595 | 595 | if sa == 1 && da == 255 { |
596 | 596 | sa = 0 |
597 | 597 | } |
@@ -885,6 +885,9 @@ func (sl ShadowList) draw(x, y, scl float32) { | ||
885 | 885 | for _, s := range sl { |
886 | 886 | intensity := sys.stage.sdw.intensity |
887 | 887 | color, alpha := s.shadowColor, s.shadowAlpha |
888 | + if alpha >= 255 { | |
889 | + alpha = int32(255 - s.anim.interpolate_blend_dstalpha) | |
890 | + } | |
888 | 891 | fend := float32(sys.stage.sdw.fadeend) * sys.stage.localscl |
889 | 892 | fbgn := float32(sys.stage.sdw.fadebgn) * sys.stage.localscl |
890 | 893 | if fbgn <= fend { |
@@ -962,7 +962,7 @@ func (e *Explod) update(oldVer bool, playerNo int) { | ||
962 | 962 | if (e.facing < 0) != (e.vfacing < 0) { |
963 | 963 | agl *= -1 |
964 | 964 | } |
965 | - sdwalp := alp[0] | |
965 | + sdwalp := 255 - alp[1] | |
966 | 966 | if sdwalp < 0 { |
967 | 967 | sdwalp = 256 |
968 | 968 | } |
@@ -4378,10 +4378,10 @@ func (c *Char) cueDraw() { | ||
4378 | 4378 | c.aimg.recAfterImg(sdf()) |
4379 | 4379 | } |
4380 | 4380 | } else { |
4381 | - if c.gi().ver[0] != 1 && c.sf(CSF_angledraw) && !c.sf(CSF_trans) { | |
4382 | - c.setSF(CSF_trans) | |
4383 | - c.alpha = [...]int32{255, 0} | |
4384 | - } | |
4381 | + //if c.gi().ver[0] != 1 && c.sf(CSF_angledraw) && !c.sf(CSF_trans) { | |
4382 | + // c.setSF(CSF_trans) | |
4383 | + // c.alpha = [...]int32{255, 0} | |
4384 | + //} | |
4385 | 4385 | sd := sdf() |
4386 | 4386 | c.aimg.recAndCue(sd, rec) |
4387 | 4387 | if c.ghv.hitshaketime > 0 && c.ss.time&1 != 0 { |
@@ -4392,7 +4392,7 @@ func (c *Char) cueDraw() { | ||
4392 | 4392 | sc = 0 |
4393 | 4393 | } |
4394 | 4394 | if c.sf(CSF_trans) { |
4395 | - sa = c.alpha[0] | |
4395 | + sa = 255 - c.alpha[1] | |
4396 | 4396 | } |
4397 | 4397 | sys.sprites.add(sd, sc, sa, float32(c.size.shadowoffset), c.offsetY()) |
4398 | 4398 | } |
@@ -1,9 +1,10 @@ | ||
1 | 1 | package main |
2 | 2 | |
3 | 3 | import ( |
4 | - "github.com/go-gl/gl/v2.1/gl" | |
5 | 4 | "math" |
6 | 5 | "unsafe" |
6 | + | |
7 | + "github.com/go-gl/gl/v2.1/gl" | |
7 | 8 | ) |
8 | 9 | |
9 | 10 | var notiling = [4]int32{0, 0, 0, 0} |
@@ -266,8 +266,8 @@ func readBackGround(is IniSection, link *backGround, | ||
266 | 266 | } |
267 | 267 | if is.readI32ForStage("maskwindow", &bg.startrect[0], &bg.startrect[1], |
268 | 268 | &bg.startrect[2], &bg.startrect[3]) { |
269 | - bg.startrect[2] = Max(0, bg.startrect[2]+1-bg.startrect[0]) | |
270 | - bg.startrect[3] = Max(0, bg.startrect[3]+1-bg.startrect[1]) | |
269 | + bg.startrect[2] = Max(0, bg.startrect[2]-bg.startrect[0]) | |
270 | + bg.startrect[3] = Max(0, bg.startrect[3]-bg.startrect[1]) | |
271 | 271 | bg.notmaskwindow = 0 |
272 | 272 | } |
273 | 273 | is.readF32ForStage("windowdelta", &bg.windowdelta[0], &bg.windowdelta[1]) |
@@ -370,15 +370,12 @@ func (bg backGround) draw(pos [2]float32, scl, bgscl, lclscl float32, | ||
370 | 370 | bgscl * lscl[i] |
371 | 371 | } |
372 | 372 | } |
373 | - rect[0] = int32(math.Floor(float64((float32(rect[0]) - | |
374 | - (pos[0]+bg.camstartx)*bg.windowdelta[0] + (float32(sys.gameWidth)/2/sclx - float32(bg.notmaskwindow)*160*(1/lscl[0]))) * sys.widthScale * wscl[0]))) | |
375 | - rect[1] = int32(math.Floor(float64(((float32(rect[1])- | |
376 | - pos[1]*bg.windowdelta[1]+(float32(sys.gameHeight)/scly-240))*wscl[1] - shakeY) * | |
377 | - sys.heightScale))) | |
378 | - rect[2] = int32(math.Ceil(float64(float32(rect[2]) * sys.widthScale * | |
379 | - wscl[0]))) | |
380 | - rect[3] = int32(math.Ceil(float64(float32(rect[3]) * sys.heightScale * | |
381 | - wscl[1]))) | |
373 | + startrect0 := (float32(rect[0]) - (pos[0]+bg.camstartx)*bg.windowdelta[0] + (float32(sys.gameWidth)/2/sclx - float32(bg.notmaskwindow)*160*(1/lscl[0]))) * sys.widthScale * wscl[0] | |
374 | + startrect1 := ((float32(rect[1])-pos[1]*bg.windowdelta[1]+(float32(sys.gameHeight)/scly-240))*wscl[1] - shakeY) * sys.heightScale | |
375 | + rect[0] = int32(math.Floor(float64(startrect0))) | |
376 | + rect[1] = int32(math.Floor(float64(startrect1))) | |
377 | + rect[2] = int32(math.Floor(float64(startrect0 + (float32(rect[2]) * sys.widthScale * wscl[0]) - float32(rect[0])))) | |
378 | + rect[3] = int32(math.Floor(float64(startrect1 + (float32(rect[3]) * sys.heightScale * wscl[1]) - float32(rect[1])))) | |
382 | 379 | bg.anim.Draw(&rect, x, y, sclx, scly, bg.xscale[0]*bgscl*(bg.scalestart[0]+xs)*xs3, xbs*bgscl*(bg.scalestart[0]+xs)*xs3, ys*(bg.scalestart[1]+ys2)*ys3, |
383 | 380 | xras*x/(AbsF(ys*ys3)*lscl[1]*float32(bg.anim.spr.Size[1]))*sclx_recip, |
384 | 381 | 0, float32(sys.gameWidth)/2, &sys.bgPalFX, true) |