AGS: Fixup character's view loop in update, prevent having no frame

From upstream 2ac1b258db203b62ba0613c979d7a092b51e441f
This commit is contained in:
Paul Gilbert
2021-07-27 22:03:34 -07:00
parent 10dfe6cdcc
commit 7a1ee192e2
@@ -76,10 +76,15 @@ void CharacterInfo::UpdateMoveAndAnim(int &char_index, CharacterExtras *chex, in
return; // must be careful not to screw things up
}
// Make sure it doesn't flash up a blue cup
if (view < 0);
else if (loop >= _G(views)[view].numLoops)
loop = 0;
// Fixup character's view when possible
if (view >= 0 &&
(loop >= _G(views)[view].numLoops || frame >= _G(views)[view].loops[loop].numFrames)) {
for (loop = 0;
(loop < _G(views)[view].numLoops) && (_G(views)[view].loops[loop].numFrames == 0); ++loop) {
}
if (loop == _G(views)[view].numLoops)
quitprintf("!Character %s is assigned view %d that has no frames!", name, view);
}
int doing_nothing = 1;