Skip to content

Commit

Permalink
Zoomステコンにtimeを追加
Browse files Browse the repository at this point in the history
Zoomステコンにtimeを追加
  • Loading branch information
NeatUnsou committed Jan 12, 2023
1 parent fcdc168 commit 99235c1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
22 changes: 14 additions & 8 deletions src/bytecode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
}

Expand Down
4 changes: 4 additions & 0 deletions src/compiler_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions src/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ type System struct {
zoomScale float32
zoomPosXLag float32
zoomPosYLag float32
enableZoomstate bool
enableZoomtime int32
zoomCameraBound bool
zoomPos [2]float32
debugWC *Char
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 99235c1

Please sign in to comment.