Go で書き直した Ikemen
Revisión | d20c9853a03b3c0a088e7d03b119d8761835d523 (tree) |
---|---|
Tiempo | 2019-01-26 09:28:26 |
Autor | suehiro <supersuehiro@user...> |
Commiter | suehiro |
さっきの修正では全く直っていなかった
@@ -82,9 +82,14 @@ func (c *Camera) Update(scl, x, y float32) { | ||
82 | 82 | c.Pos[0] = x |
83 | 83 | c.Pos[1] = y |
84 | 84 | } |
85 | -func (c *Camera) ScaleBound(scl float32) float32 { | |
85 | +func (c *Camera) ScaleBound(scl, sclmul float32) float32 { | |
86 | 86 | if c.ZoomEnable { |
87 | - return MaxF(c.MinScale, MinF(c.ZoomMax, scl)) | |
87 | + if sys.debugPaused() { | |
88 | + sclmul = 1 | |
89 | + } else if sys.turbo < 1 { | |
90 | + sclmul = Pow(sclmul, sys.turbo) | |
91 | + } | |
92 | + return MaxF(c.MinScale, MinF(c.ZoomMax, scl*sclmul)) | |
88 | 93 | } |
89 | 94 | return 1 |
90 | 95 | } |
@@ -128,7 +133,9 @@ func (c *Camera) action(x, y *float32, leftest, rightest, lowest, highest, | ||
128 | 133 | vx += vel |
129 | 134 | } |
130 | 135 | } |
131 | - if !sys.debugPaused() { | |
136 | + if sys.debugPaused() { | |
137 | + vx = 0 | |
138 | + } else { | |
132 | 139 | vx *= MinF(1, sys.turbo) |
133 | 140 | } |
134 | 141 | if vx < 0 { |
@@ -1530,10 +1530,7 @@ func (s *System) fight() (reload bool) { | ||
1530 | 1530 | break |
1531 | 1531 | } |
1532 | 1532 | } |
1533 | - if s.turbo < 1 && !s.debugPaused() { | |
1534 | - sclmul = Pow(sclmul, s.turbo) | |
1535 | - } | |
1536 | - scl = s.cam.ScaleBound(scl * sclmul) | |
1533 | + scl = s.cam.ScaleBound(scl, sclmul) | |
1537 | 1534 | tmp := (float32(s.gameWidth) / 2) / scl |
1538 | 1535 | if AbsF((l+r)-(newx-x)*2) >= tmp/2 { |
1539 | 1536 | tmp = MaxF(0, MinF(tmp, MaxF((newx-x)-l, r-(newx-x)))) |