Skip to content

Commit

Permalink
fix a boundary case of Tail extra time
Browse files Browse the repository at this point in the history
Case: when Tail's position becomes smaller than Head's
  • Loading branch information
hndada committed Nov 7, 2022
1 parent 98350da commit fc2358c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
7 changes: 0 additions & 7 deletions game.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ type Scene interface {
Draw(screen *ebiten.Image)
}

// func init() {
// if runtime.GOOS == "windows" {
// os.Setenv("EBITEN_GRAPHICS_LIBRARY", "opengl")
// fmt.Println("OpenGL mode has enabled.")
// }
// }

var (
modeProps []ModeProp
sceneSelect *SceneSelect
Expand Down
4 changes: 2 additions & 2 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ func LoadHandlers(props []ModeProp) {

tailExtraTimeHandler = ctrl.FloatHandler{
Value: props[ModePiano4].Settings["TailExtraTime"],
Min: -250,
Max: 250,
Min: -200,
Max: 200,
Unit: 10,
}
TailExtraTimeKeyHandler = ctrl.KeyHandler{
Expand Down
5 changes: 5 additions & 0 deletions mode/piano/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ func NewChart(cpath string) (c *Chart, err error) {
n.Position = tp.Position + float64(n.Time-tp.Time)*tp.Speed
if n.Type == Tail {
n.Position += float64(TailExtraTime) * tp.Speed
// It is guaranteed that Tail's Prev (which is Head)
// has already proceeded, since c.Notes is sorted by Time.
if n.Position < n.Prev.Position {
n.Position = n.Prev.Position
}
}
}
tp = c.TransPoints[0]
Expand Down
6 changes: 0 additions & 6 deletions mode/piano/drawer.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,6 @@ func (d NoteDrawer) Draw(screen *ebiten.Image) {
}
sprite := d.Frame(d.Sprites[n.Type])
pos := n.Position - d.Cursor
// if n.Type == Tail {
// pos += BodyGain * SpeedScale
// if headPos := n.Prev.Position - d.Cursor; pos < headPos {
// pos = headPos
// }
// }
sprite.Move(0, -pos)
op := ebiten.DrawImageOptions{}
if n.Marked {
Expand Down

0 comments on commit fc2358c

Please sign in to comment.