diff --git a/src/bytecode.go b/src/bytecode.go index d3ccd1552..b426cba01 100644 --- a/src/bytecode.go +++ b/src/bytecode.go @@ -2194,14 +2194,16 @@ func (StateControllerBase) beToExp(be ...BytecodeExp) []BytecodeExp { return be } -/*func (StateControllerBase) fToExp(f ...float32) (exp []BytecodeExp) { - for _, v := range f { - var be BytecodeExp - be.appendValue(BytecodeFloat(v)) - exp = append(exp, be) +/* + func (StateControllerBase) fToExp(f ...float32) (exp []BytecodeExp) { + for _, v := range f { + var be BytecodeExp + be.appendValue(BytecodeFloat(v)) + exp = append(exp, be) + } + return } - return -}*/ +*/ func (StateControllerBase) iToExp(i ...int32) (exp []BytecodeExp) { for _, v := range i { var be BytecodeExp @@ -6587,11 +6589,13 @@ const ( zoom_lag zoom_redirectid zoom_camerabound + zoom_time ) func (sc zoom) Run(c *Char, _ []int32) bool { crun := c zoompos := [2]float32{0, 0} + t := int32(1) StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool { switch id { case zoom_pos: @@ -6601,11 +6605,12 @@ func (sc zoom) Run(c *Char, _ []int32) bool { } case zoom_scale: sys.zoomScale = exp[0].evalF(c) - sys.enableZoomstate = true case zoom_camerabound: sys.zoomCameraBound = exp[0].evalB(c) case zoom_lag: sys.zoomlag = exp[0].evalF(c) + case zoom_time: + t = exp[0].evalI(c) case zoom_redirectid: if rid := sys.playerID(exp[0].evalI(c)); rid != nil { crun = rid @@ -6617,6 +6622,7 @@ func (sc zoom) Run(c *Char, _ []int32) bool { }) sys.zoomPos[0] = sys.zoomScale * zoompos[0] sys.zoomPos[1] = zoompos[1] + sys.enableZoomtime = t return false } diff --git a/src/compiler_functions.go b/src/compiler_functions.go index bb5d48fda..b662a4554 100644 --- a/src/compiler_functions.go +++ b/src/compiler_functions.go @@ -3454,6 +3454,10 @@ func (c *Compiler) zoom(is IniSection, sc *StateControllerBase, _ int8) (StateCo zoom_camerabound, VT_Bool, 1, false); err != nil { return err } + if err := c.paramValue(is, sc, "time", + zoom_time, VT_Int, 1, false); err != nil { + return err + } return nil }) return *ret, err diff --git a/src/system.go b/src/system.go index 4f733a73d..a2bebc92a 100644 --- a/src/system.go +++ b/src/system.go @@ -216,7 +216,7 @@ type System struct { zoomScale float32 zoomPosXLag float32 zoomPosYLag float32 - enableZoomstate bool + enableZoomtime int32 zoomCameraBound bool zoomPos [2]float32 debugWC *Char @@ -1023,8 +1023,11 @@ func (s *System) action() { if s.envcol_time > 0 { s.envcol_time-- } - s.enableZoomstate = false - s.zoomCameraBound = true + if s.enableZoomtime > 0 { + s.enableZoomtime-- + } else { + s.zoomCameraBound = true + } if s.super > 0 { s.super-- } else if s.pause > 0 { @@ -2025,7 +2028,7 @@ func (s *System) fight() (reload bool) { if !s.frameSkip { x, y, scl := s.cam.Pos[0], s.cam.Pos[1], s.cam.Scale/s.cam.BaseScale() dx, dy, dscl := x, y, scl - if s.enableZoomstate { + if s.enableZoomtime > 0 { if !s.debugPaused() { s.zoomPosXLag += ((s.zoomPos[0] - s.zoomPosXLag) * (1 - s.zoomlag)) s.zoomPosYLag += ((s.zoomPos[1] - s.zoomPosYLag) * (1 - s.zoomlag))