avm1: Clamp `WaitForFrame` ops to the total frame count of the movie clip being tested.
This commit is contained in:
parent
1954f6162f
commit
aca1c0fb50
|
@ -22,6 +22,7 @@ use ruffle_render::bounding_box::BoundingBox;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cell::{Ref, RefMut};
|
use std::cell::{Ref, RefMut};
|
||||||
|
use std::cmp::min;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use swf::avm1::read::Reader;
|
use swf::avm1::read::Reader;
|
||||||
use swf::avm1::types::*;
|
use swf::avm1::types::*;
|
||||||
|
@ -2183,7 +2184,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
||||||
let loaded = self
|
let loaded = self
|
||||||
.target_clip()
|
.target_clip()
|
||||||
.and_then(|dobj| dobj.as_movie_clip())
|
.and_then(|dobj| dobj.as_movie_clip())
|
||||||
.map(|mc| mc.frames_loaded() > action.frame)
|
.map(|mc| mc.frames_loaded() > min(action.frame, mc.frames_loaded() - 1))
|
||||||
.unwrap_or(true);
|
.unwrap_or(true);
|
||||||
if !loaded {
|
if !loaded {
|
||||||
// Note that the offset is given in # of actions, NOT in bytes.
|
// Note that the offset is given in # of actions, NOT in bytes.
|
||||||
|
@ -2202,7 +2203,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
||||||
let loaded = self
|
let loaded = self
|
||||||
.target_clip()
|
.target_clip()
|
||||||
.and_then(|dobj| dobj.as_movie_clip())
|
.and_then(|dobj| dobj.as_movie_clip())
|
||||||
.map(|mc| mc.frames_loaded() > frame_num)
|
.map(|mc| mc.frames_loaded() > min(frame_num, mc.frames_loaded() - 1))
|
||||||
.unwrap_or(true);
|
.unwrap_or(true);
|
||||||
if !loaded {
|
if !loaded {
|
||||||
// Note that the offset is given in # of actions, NOT in bytes.
|
// Note that the offset is given in # of actions, NOT in bytes.
|
||||||
|
|
Loading…
Reference in New Issue