1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-12-24 19:18:12 -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:
err = icon.SetCurrentFrame(completedFrame)
case d2enum.QuestStatusCompleting:
// animation will be played after quest-log panel is opened (see s.playQuestAnimation)
err = icon.SetCurrentFrame(0)
case d2enum.QuestStatusNotStarted:
err = icon.SetCurrentFrame(notStartedFrame)
default:
@ -398,7 +400,6 @@ func (s *QuestLog) playQuestAnimations() {
i.SetPlayLength(3)
i.PlayForward()
i.SetPlayLoop(false)
s.questStatus[questID] = d2enum.QuestStatusCompleted
}
}
}
@ -521,9 +522,15 @@ func (s *QuestLog) Advance(elapsed float64) {
return
}
for _, i := range s.quests[s.selectedTab].icons {
if err := i.Advance(elapsed); err != nil {
s.Error(err.Error())
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 {
s.Error(err.Error())
}
if i.GetCurrentFrame() == completedFrame {
s.questStatus[questID] = d2enum.QuestStatusCompleted
}
}
}
}