avm1: Implement `ActionWaitForFrame` and `ActionWaitForFrame2`.
This commit is contained in:
parent
aa9e24fb9d
commit
3c0b9b9f62
|
@ -2180,8 +2180,11 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
||||||
action: WaitForFrame,
|
action: WaitForFrame,
|
||||||
r: &mut Reader<'_>,
|
r: &mut Reader<'_>,
|
||||||
) -> Result<FrameControl<'gc>, Error<'gc>> {
|
) -> Result<FrameControl<'gc>, Error<'gc>> {
|
||||||
// TODO(Herschel): Always true for now.
|
let loaded = self
|
||||||
let loaded = true;
|
.target_clip()
|
||||||
|
.and_then(|dobj| dobj.as_movie_clip())
|
||||||
|
.map(|mc| mc.frames_loaded() > action.frame)
|
||||||
|
.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.
|
||||||
// Read the actions and toss them away.
|
// Read the actions and toss them away.
|
||||||
|
@ -2195,9 +2198,12 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
||||||
action: WaitForFrame2,
|
action: WaitForFrame2,
|
||||||
r: &mut Reader<'_>,
|
r: &mut Reader<'_>,
|
||||||
) -> Result<FrameControl<'gc>, Error<'gc>> {
|
) -> Result<FrameControl<'gc>, Error<'gc>> {
|
||||||
// TODO(Herschel): Always true for now.
|
let frame_num = self.context.avm1.pop().coerce_to_f64(self)? as u16;
|
||||||
let _frame_num = self.context.avm1.pop().coerce_to_f64(self)? as u16;
|
let loaded = self
|
||||||
let loaded = true;
|
.target_clip()
|
||||||
|
.and_then(|dobj| dobj.as_movie_clip())
|
||||||
|
.map(|mc| mc.frames_loaded() > frame_num)
|
||||||
|
.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.
|
||||||
// Read the actions and toss them away.
|
// Read the actions and toss them away.
|
||||||
|
|
Loading…
Reference in New Issue