• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签

Frequently used words (click to add to your profile)

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

Go で書き直した Ikemen


Commit MetaInfo

修订版64217da22f9d544da260847fb1ed83b9548299cf (tree)
时间2018-09-03 18:56:20
作者suehiro <supersuehiro@user...>
Commitersuehiro

Log Message

プルリクエストのマージ

683e7efc622e824be9defcece2785b592a6d394f
Fixed addalpha trans on stages

6e8a56e97979722e1a9ed91e1c7a64ccc4c0f9c4
Scalestartに対応。trans = addだとaddalphaを読み込まないのを修正。

更改概述

差异

--- a/src/stage.go
+++ b/src/stage.go
@@ -105,11 +105,12 @@ type backGround struct {
105105 toplayer bool
106106 startrect [4]int32
107107 windowdelta [2]float32
108+ scalestart [2]float32
108109 }
109110
110111 func newBackGround(sff *Sff) *backGround {
111112 return &backGround{anim: *newAnimation(sff), delta: [...]float32{1, 1},
112- xscale: [...]float32{1, 1}, rasterx: [...]float32{1, 1}, yscalestart: 100,
113+ xscale: [...]float32{1, 1}, rasterx: [...]float32{1, 1}, yscalestart: 100, scalestart: [...]float32{1, 1},
113114 actionno: -1, visible: true, active: true,
114115 startrect: [...]int32{-32768, -32768, 65535, 65535}}
115116 }
@@ -161,6 +162,7 @@ func readBackGround(is IniSection, link *backGround,
161162 }
162163 is.readF32ForStage("start", &bg.start[0], &bg.start[1])
163164 is.readF32ForStage("delta", &bg.delta[0], &bg.delta[1])
165+ is.readF32ForStage("scalestart", &bg.scalestart[0], &bg.scalestart[1])
164166 if t != 1 {
165167 if is.ReadI32("mask", &tmp) {
166168 if tmp != 0 {
@@ -174,6 +176,14 @@ func readBackGround(is IniSection, link *backGround,
174176 bg.anim.mask = 0
175177 bg.anim.srcAlpha = 255
176178 bg.anim.dstAlpha = 255
179+ s, d := int32(bg.anim.srcAlpha), int32(bg.anim.dstAlpha)
180+ if is.readI32ForStage("alpha", &s, &d) {
181+ bg.anim.srcAlpha = int16(Max(0, Min(255, s)))
182+ bg.anim.dstAlpha = int16(Max(0, Min(255, d)))
183+ if bg.anim.srcAlpha == 1 && bg.anim.dstAlpha == 255 {
184+ bg.anim.srcAlpha = 0
185+ }
186+ }
177187 case "add1":
178188 bg.anim.mask = 0
179189 bg.anim.srcAlpha = 255
@@ -181,14 +191,14 @@ func readBackGround(is IniSection, link *backGround,
181191 var s, d int32 = 255, 255
182192 if is.readI32ForStage("alpha", &s, &d) {
183193 bg.anim.srcAlpha = int16(Min(255, s))
184- bg.anim.dstAlpha = ^int16(Max(0, Min(255, s)))
194+ bg.anim.dstAlpha = ^int16(Max(0, Min(255, d)))
185195 }
186196 case "addalpha":
187197 bg.anim.mask = 0
188198 s, d := int32(bg.anim.srcAlpha), int32(bg.anim.dstAlpha)
189199 if is.readI32ForStage("alpha", &s, &d) {
190- bg.anim.srcAlpha = int16(Min(255, s))
191- bg.anim.dstAlpha = int16(Max(0, Min(255, s)))
200+ bg.anim.srcAlpha = int16(Max(0, Min(255, s)))
201+ bg.anim.dstAlpha = int16(Max(0, Min(255, d)))
192202 if bg.anim.srcAlpha == 1 && bg.anim.dstAlpha == 255 {
193203 bg.anim.srcAlpha = 0
194204 }
@@ -325,7 +335,7 @@ func (bg backGround) draw(pos [2]float32, scl, bgscl, lclscl float32,
325335 wscl[0])))
326336 rect[3] = int32(math.Ceil(float64(float32(rect[3]) * sys.heightScale *
327337 wscl[1])))
328- bg.anim.Draw(&rect, x, y, sclx, scly, bg.xscale[0]*bgscl, xbs*bgscl, ys,
338+ bg.anim.Draw(&rect, x, y, sclx, scly, bg.xscale[0]*bgscl*bg.scalestart[0], xbs*bgscl*bg.scalestart[0], ys*bg.scalestart[1],
329339 xras*x/(AbsF(ys)*lscl[1]*float32(bg.anim.spr.Size[1])),
330340 0, float32(sys.gameWidth)/2, &sys.bgPalFX, true)
331341 }