AGS: Fix potentially invalid frame during Character turning

From upstream 84faeccb049883f6d55c0ba34c6a9f02f6bbdbe8
This commit is contained in:
Paul Gilbert 2022-03-19 17:13:12 -07:00
parent 19e7035ded
commit 02a6600080

View File

@ -149,6 +149,8 @@ int CharacterInfo::update_character_walking(CharacterExtras *chex) {
} else break;
}
loop = turnlooporder[wantloop];
if (frame >= _GP(views)[view].loops[loop].numFrames)
frame = 0; // AVD: make sure the loop always has a valid frame
walking -= TURNING_AROUND;
// if still turning, wait for next frame
if (walking % TURNING_BACKWARDS >= TURNING_AROUND)