1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-04 17:27:16 -05:00

Remove teminal time scaling (#649)

This commit is contained in:
AndrejMijic 2020-07-30 18:59:17 +02:00 committed by GitHub
parent 333b8610ac
commit c398c8f1ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -426,7 +426,7 @@ func (a *App) render(target d2interface.Surface) error {
return nil
}
func (a *App) advance(elapsed, current float64) error {
func (a *App) advance(elapsed, elapsedUnscaled, current float64) error {
elapsedLastScreenAdvance := (current - a.lastScreenAdvance) * a.timeScale
a.lastScreenAdvance = current
@ -445,7 +445,7 @@ func (a *App) advance(elapsed, current float64) error {
return err
}
if err := a.terminal.Advance(elapsed); err != nil {
if err := a.terminal.Advance(elapsedUnscaled); err != nil {
return err
}
@ -454,10 +454,11 @@ func (a *App) advance(elapsed, current float64) error {
func (a *App) update(target d2interface.Surface) error {
currentTime := d2common.Now()
elapsedTime := (currentTime - a.lastTime) * a.timeScale
elapsedTimeUnscaled := (currentTime - a.lastTime)
elapsedTime := elapsedTimeUnscaled * a.timeScale
a.lastTime = currentTime
if err := a.advance(elapsedTime, currentTime); err != nil {
if err := a.advance(elapsedTime, elapsedTimeUnscaled, currentTime); err != nil {
return err
}