chore: Move MovieClipData::do_init_action to MovieClip::do_init_action
No functional changes, just replaces `self` with `self.0.read()` and removed `self_display_object` argument
This commit is contained in:
parent
c0d1dec7dd
commit
46d31548b0
|
@ -238,12 +238,7 @@ impl<'gc> MovieClip<'gc> {
|
|||
.0
|
||||
.write(context.gc_context)
|
||||
.define_text(context, reader, 2),
|
||||
TagCode::DoInitAction => self.0.write(context.gc_context).do_init_action(
|
||||
self.into(),
|
||||
context,
|
||||
reader,
|
||||
tag_len,
|
||||
),
|
||||
TagCode::DoInitAction => self.do_init_action(context, reader, tag_len),
|
||||
TagCode::ExportAssets => self
|
||||
.0
|
||||
.write(context.gc_context)
|
||||
|
@ -331,6 +326,38 @@ impl<'gc> MovieClip<'gc> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn do_init_action(
|
||||
self,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
reader: &mut SwfStream<&[u8]>,
|
||||
tag_len: usize,
|
||||
) -> DecodeResult {
|
||||
// Queue the init actions.
|
||||
|
||||
// TODO: Init actions are supposed to be executed once, and it gives a
|
||||
// sprite ID... how does that work?
|
||||
let sprite_id = reader.read_u16()?;
|
||||
log::info!("Init Action sprite ID {}", sprite_id);
|
||||
|
||||
let slice = self
|
||||
.0
|
||||
.read()
|
||||
.static_data
|
||||
.swf
|
||||
.resize_to_reader(reader, tag_len)
|
||||
.ok_or_else(|| {
|
||||
std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
"Invalid source or tag length when running init action",
|
||||
)
|
||||
})?;
|
||||
context
|
||||
.action_queue
|
||||
.queue_actions(self.into(), ActionType::Init { bytecode: slice }, true);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn playing(self) -> bool {
|
||||
self.0.read().playing()
|
||||
|
@ -1951,39 +1978,6 @@ impl<'gc, 'a> MovieClipData<'gc> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn do_init_action(
|
||||
&mut self,
|
||||
self_display_object: DisplayObject<'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
reader: &mut SwfStream<&'a [u8]>,
|
||||
tag_len: usize,
|
||||
) -> DecodeResult {
|
||||
// Queue the init actions.
|
||||
|
||||
// TODO: Init actions are supposed to be executed once, and it gives a
|
||||
// sprite ID... how does that work?
|
||||
let sprite_id = reader.read_u16()?;
|
||||
log::info!("Init Action sprite ID {}", sprite_id);
|
||||
|
||||
let slice = self
|
||||
.static_data
|
||||
.swf
|
||||
.resize_to_reader(reader, tag_len)
|
||||
.ok_or_else(|| {
|
||||
std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
"Invalid source or tag length when running init action",
|
||||
)
|
||||
})?;
|
||||
context.action_queue.queue_actions(
|
||||
self_display_object,
|
||||
ActionType::Init { bytecode: slice },
|
||||
true,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn place_object(
|
||||
&mut self,
|
||||
self_display_object: DisplayObject<'gc>,
|
||||
|
|
Loading…
Reference in New Issue