• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Go で書き直した Ikemen


Commit MetaInfo

Revisiond3d8ea78a34d1f81f4c434cae1fd0952f47ef3ff (tree)
Zeit2018-10-03 19:19:43
Autorneatunsou <sisiy4excite@gmai...>
Commiterneatunsou

Log Message

Zoomdeltaに対応。
Maskwindowに対応。
Windowのズームアウト時の挙動をMUGEN1.1に合わせた。
ステージdefに新パラメータを追加した。

Ändern Zusammenfassung

Diff

--- a/src/stage.go
+++ b/src/stage.go
@@ -83,36 +83,41 @@ func (bga *bgAction) action() {
8383 }
8484
8585 type backGround struct {
86- anim Animation
87- bga bgAction
88- id int32
89- start [2]float32
90- xofs float32
91- camstartx float32
92- delta [2]float32
93- xscale [2]float32
94- rasterx [2]float32
95- yscalestart float32
96- yscaledelta float32
97- actionno int32
98- startv [2]float32
99- startrad [2]float32
100- startsint [2]int32
101- startsinlt [2]int32
102- visible bool
103- active bool
104- positionlink bool
105- toplayer bool
106- startrect [4]int32
107- windowdelta [2]float32
108- scalestart [2]float32
109- scaledelta [2]float32
86+ anim Animation
87+ bga bgAction
88+ id int32
89+ start [2]float32
90+ xofs float32
91+ camstartx float32
92+ delta [2]float32
93+ xscale [2]float32
94+ rasterx [2]float32
95+ yscalestart float32
96+ yscaledelta float32
97+ actionno int32
98+ startv [2]float32
99+ startrad [2]float32
100+ startsint [2]int32
101+ startsinlt [2]int32
102+ visible bool
103+ active bool
104+ positionlink bool
105+ toplayer bool
106+ autoresizeparallax bool
107+ notmaskwindow int32
108+ startrect [4]int32
109+ windowdelta [2]float32
110+ scalestart [2]float32
111+ scaledelta [2]float32
112+ zoomdelta [2]float32
113+ zoomscaledelta [2]float32
114+ xbottomzoomdelta float32
110115 }
111116
112117 func newBackGround(sff *Sff) *backGround {
113- return &backGround{anim: *newAnimation(sff), delta: [...]float32{1, 1},
114- xscale: [...]float32{1, 1}, rasterx: [...]float32{1, 1}, yscalestart: 100, scalestart: [...]float32{1, 1},
115- actionno: -1, visible: true, active: true,
118+ return &backGround{anim: *newAnimation(sff), delta: [...]float32{1, 1}, zoomdelta: [...]float32{math.MaxFloat32, math.MaxFloat32},
119+ xscale: [...]float32{1, 1}, rasterx: [...]float32{1, 1}, yscalestart: 100, scalestart: [...]float32{1, 1}, xbottomzoomdelta: math.MaxFloat32,
120+ zoomscaledelta: [...]float32{1, 1}, actionno: -1, visible: true, active: true, autoresizeparallax: true,
116121 startrect: [...]int32{-32768, -32768, 65535, 65535}}
117122 }
118123 func readBackGround(is IniSection, link *backGround,
@@ -161,10 +166,17 @@ func readBackGround(is IniSection, link *backGround,
161166 bg.startv = link.startv
162167 bg.delta = link.delta
163168 }
169+ is.ReadBool("autoresizeparallax", &bg.autoresizeparallax)
164170 is.readF32ForStage("start", &bg.start[0], &bg.start[1])
165171 is.readF32ForStage("delta", &bg.delta[0], &bg.delta[1])
166172 is.readF32ForStage("scalestart", &bg.scalestart[0], &bg.scalestart[1])
167173 is.readF32ForStage("scaledelta", &bg.scaledelta[0], &bg.scaledelta[1])
174+ is.readF32ForStage("xbottomzoomdelta", &bg.xbottomzoomdelta)
175+ is.readF32ForStage("zoomscaledelta", &bg.zoomscaledelta[0], &bg.zoomscaledelta[1])
176+ is.readF32ForStage("zoomdelta", &bg.zoomdelta[0], &bg.zoomdelta[1])
177+ if bg.zoomdelta[0] != math.MaxFloat32 && bg.zoomdelta[1] == math.MaxFloat32 {
178+ bg.zoomdelta[1] = bg.zoomdelta[0]
179+ }
168180 if t != 1 {
169181 if is.ReadI32("mask", &tmp) {
170182 if tmp != 0 {
@@ -250,6 +262,13 @@ func readBackGround(is IniSection, link *backGround,
250262 &bg.startrect[2], &bg.startrect[3]) {
251263 bg.startrect[2] = Max(0, bg.startrect[2]+1-bg.startrect[0])
252264 bg.startrect[3] = Max(0, bg.startrect[3]+1-bg.startrect[1])
265+ bg.notmaskwindow = 1
266+ }
267+ if is.readI32ForStage("maskwindow", &bg.startrect[0], &bg.startrect[1],
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])
271+ bg.notmaskwindow = 0
253272 }
254273 is.readF32ForStage("windowdelta", &bg.windowdelta[0], &bg.windowdelta[1])
255274 is.ReadI32("id", &bg.id)
@@ -296,16 +315,30 @@ func (bg backGround) draw(pos [2]float32, scl, bgscl, lclscl float32,
296315 xras := (bg.rasterx[1] - bg.rasterx[0]) / bg.rasterx[0]
297316 xbs, dx := bg.xscale[1], MaxF(0, bg.delta[0]*bgscl)
298317 sclx := MaxF(0, scl+(1-scl)*(1-dx))
318+ scly := MaxF(0, scl+(1-scl)*(1-MaxF(0, bg.delta[1]*bgscl)))
319+ var sclx_recip float32 = 1
299320 lscl := [...]float32{lclscl * stgscl[0], lclscl * stgscl[1]}
300- if sclx != 0 {
321+ if sclx != 0 && bg.autoresizeparallax == true {
301322 tmp := 1 / sclx
302- xbs *= MaxF(0, scl+(1-scl)*(1-dx*(xbs/bg.xscale[0]))) * tmp
323+ if bg.xbottomzoomdelta != math.MaxFloat32 {
324+ xbs *= MaxF(0, scl+(1-scl)*(1-bg.xbottomzoomdelta*(xbs/bg.xscale[0]))) * tmp
325+ } else {
326+ xbs *= MaxF(0, scl+(1-scl)*(1-dx*(xbs/bg.xscale[0]))) * tmp
327+ }
303328 tmp *= MaxF(0, scl+(1-scl)*(1-dx*(xras+1)))
304329 xras -= tmp - 1
305330 xbs *= tmp
306331 }
332+ if bg.zoomdelta[0] != math.MaxFloat32 {
333+ sclx = scl + (1-scl)*(1-bg.zoomdelta[0])
334+ scly = scl + (1-scl)*(1-bg.zoomdelta[1])
335+ if bg.autoresizeparallax == false {
336+ sclx_recip = (1 + bg.zoomdelta[0]*((1/(sclx*lscl[0])*lscl[0])-1))
337+ }
338+ }
339+
340+ scly *= lclscl
307341 sclx *= lscl[0]
308- scly := MaxF(0, scl+(1-scl)*(1-MaxF(0, bg.delta[1]*bgscl))) * lclscl
309342 x := bg.start[0] + bg.xofs - (pos[0]/stgscl[0]+bg.camstartx)*bg.delta[0] +
310343 bg.bga.offset[0]
311344 y := bg.start[1] - (pos[1]/stgscl[1])*bg.delta[1] + bg.bga.offset[1]
@@ -320,27 +353,34 @@ func (bg backGround) draw(pos [2]float32, scl, bgscl, lclscl float32,
320353 }
321354 ys := (100 - pos[1]*bg.yscaledelta) * bgscl / bg.yscalestart
322355 ys2 := bg.scaledelta[1] * pos[1] * bg.delta[1] * bgscl
323- xs := bg.scaledelta[0] * pos[0] * dx
356+ xs := bg.scaledelta[0] * pos[0] * bg.delta[0] * bgscl
357+ xs3 := 1 + (1-scl)*(1-bg.zoomscaledelta[0])
358+ ys3 := 1 + (1-scl)*(1-bg.zoomscaledelta[1])
324359 x *= bgscl
325360 y = y*bgscl + ((float32(sys.gameHeight)-shakeY)/scly-240)/stgscl[1]
326361 scly *= stgscl[1]
327362 rect := bg.startrect
328363 var wscl [2]float32
329364 for i := range wscl {
330- wscl[i] = MaxF(0, scl+(1-scl)*(1-MaxF(0, bg.windowdelta[i]*bgscl))) *
331- bgscl * lscl[i]
365+ if bg.zoomdelta[i] != math.MaxFloat32 {
366+ wscl[i] = MaxF(0, scl+(1-scl)*(1-MaxF(0, bg.zoomdelta[i]))) *
367+ bgscl * lscl[i]
368+ } else {
369+ wscl[i] = MaxF(0, scl+(1-scl)*(1-MaxF(0, bg.windowdelta[i]*bgscl))) *
370+ bgscl * lscl[i]
371+ }
332372 }
333373 rect[0] = int32(math.Floor(float64((float32(rect[0]) -
334- (pos[0]+bg.camstartx)*bg.windowdelta[0]) * sys.widthScale * wscl[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])))
335375 rect[1] = int32(math.Floor(float64(((float32(rect[1])-
336- pos[1]*bg.windowdelta[1])*wscl[1] - shakeY + float32(sys.gameHeight-240)) *
376+ pos[1]*bg.windowdelta[1]+(float32(sys.gameHeight)/scly-240))*wscl[1] - shakeY) *
337377 sys.heightScale)))
338378 rect[2] = int32(math.Ceil(float64(float32(rect[2]) * sys.widthScale *
339379 wscl[0])))
340380 rect[3] = int32(math.Ceil(float64(float32(rect[3]) * sys.heightScale *
341381 wscl[1])))
342- bg.anim.Draw(&rect, x, y, sclx, scly, bg.xscale[0]*bgscl*(bg.scalestart[0]+xs), xbs*bgscl*(bg.scalestart[0]+xs), ys*(bg.scalestart[1]+ys2),
343- xras*x/(AbsF(ys)*lscl[1]*float32(bg.anim.spr.Size[1])),
382+ 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+ xras*x/(AbsF(ys*ys3)*lscl[1]*float32(bg.anim.spr.Size[1]))*sclx_recip,
344384 0, float32(sys.gameWidth)/2, &sys.bgPalFX, true)
345385 }
346386