1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-12-25 19:46:50 -05:00

animation is played and last frame is completedFrame

This commit is contained in:
M. Sz 2020-12-16 19:06:12 +01:00
parent 08e590f3e4
commit 856138daca

View File

@ -374,6 +374,8 @@ func (s *QuestLog) makeQuestIconForAct(act, n int) (*d2ui.Sprite, error) {
case d2enum.QuestStatusCompleted: case d2enum.QuestStatusCompleted:
err = icon.SetCurrentFrame(completedFrame) err = icon.SetCurrentFrame(completedFrame)
case d2enum.QuestStatusCompleting: case d2enum.QuestStatusCompleting:
// animation will be played after quest-log panel is opened (see s.playQuestAnimation)
err = icon.SetCurrentFrame(0)
case d2enum.QuestStatusNotStarted: case d2enum.QuestStatusNotStarted:
err = icon.SetCurrentFrame(notStartedFrame) err = icon.SetCurrentFrame(notStartedFrame)
default: default:
@ -398,7 +400,6 @@ func (s *QuestLog) playQuestAnimations() {
i.SetPlayLength(3) i.SetPlayLength(3)
i.PlayForward() i.PlayForward()
i.SetPlayLoop(false) i.SetPlayLoop(false)
s.questStatus[questID] = d2enum.QuestStatusCompleted
} }
} }
} }
@ -521,10 +522,16 @@ func (s *QuestLog) Advance(elapsed float64) {
return return
} }
for _, i := range s.quests[s.selectedTab].icons { for j, i := range s.quests[s.selectedTab].icons {
questID := s.cordsToQuestID(s.selectedTab+1, j)
if s.questStatus[questID] == d2enum.QuestStatusCompleting {
if err := i.Advance(elapsed); err != nil { if err := i.Advance(elapsed); err != nil {
s.Error(err.Error()) s.Error(err.Error())
} }
if i.GetCurrentFrame() == completedFrame {
s.questStatus[questID] = d2enum.QuestStatusCompleted
}
}
} }
} }