avm2: Replaced args.get((d+)).cloned().unwrap_or(Value::Undefined).coerce_to_boolean() with args.get_bool(\d)
This commit is contained in:
parent
7e3665d12c
commit
641162d4c7
|
@ -634,11 +634,7 @@ pub fn set_mouse_children<'gc>(
|
||||||
.and_then(|this| this.as_display_object())
|
.and_then(|this| this.as_display_object())
|
||||||
.and_then(|this| this.as_container())
|
.and_then(|this| this.as_container())
|
||||||
{
|
{
|
||||||
let mouse_children = args
|
let mouse_children = args.get_bool(0);
|
||||||
.get(0)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or(Value::Undefined)
|
|
||||||
.coerce_to_boolean();
|
|
||||||
|
|
||||||
dobj.raw_container_mut(activation.context.gc_context)
|
dobj.raw_container_mut(activation.context.gc_context)
|
||||||
.set_mouse_children(mouse_children);
|
.set_mouse_children(mouse_children);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use crate::avm2::activation::Activation;
|
use crate::avm2::activation::Activation;
|
||||||
use crate::avm2::object::{Object, TObject};
|
use crate::avm2::object::{Object, TObject};
|
||||||
|
use crate::avm2::parameters::ParametersExt;
|
||||||
use crate::avm2::value::Value;
|
use crate::avm2::value::Value;
|
||||||
use crate::avm2::Error;
|
use crate::avm2::Error;
|
||||||
use crate::avm2::Multiname;
|
use crate::avm2::Multiname;
|
||||||
|
@ -48,11 +49,7 @@ pub fn set_mouse_enabled<'gc>(
|
||||||
.and_then(|t| t.as_display_object())
|
.and_then(|t| t.as_display_object())
|
||||||
.and_then(|dobj| dobj.as_interactive())
|
.and_then(|dobj| dobj.as_interactive())
|
||||||
{
|
{
|
||||||
let value = args
|
let value = args.get_bool(0);
|
||||||
.get(0)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or(Value::Undefined)
|
|
||||||
.coerce_to_boolean();
|
|
||||||
int.set_mouse_enabled(activation.context.gc_context, value);
|
int.set_mouse_enabled(activation.context.gc_context, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,11 +82,7 @@ pub fn set_double_click_enabled<'gc>(
|
||||||
.and_then(|t| t.as_display_object())
|
.and_then(|t| t.as_display_object())
|
||||||
.and_then(|dobj| dobj.as_interactive())
|
.and_then(|dobj| dobj.as_interactive())
|
||||||
{
|
{
|
||||||
let value = args
|
let value = args.get_bool(0);
|
||||||
.get(0)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or(Value::Undefined)
|
|
||||||
.coerce_to_boolean();
|
|
||||||
int.set_double_click_enabled(activation.context.gc_context, value);
|
int.set_double_click_enabled(activation.context.gc_context, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ use swf::ButtonState;
|
||||||
pub use crate::avm2::globals::flash::media::soundmixer::{
|
pub use crate::avm2::globals::flash::media::soundmixer::{
|
||||||
get_sound_transform, set_sound_transform,
|
get_sound_transform, set_sound_transform,
|
||||||
};
|
};
|
||||||
|
use crate::avm2::parameters::ParametersExt;
|
||||||
|
|
||||||
/// Implements `flash.display.SimpleButton`'s 'init' method. which is called from the constructor
|
/// Implements `flash.display.SimpleButton`'s 'init' method. which is called from the constructor
|
||||||
pub fn init<'gc>(
|
pub fn init<'gc>(
|
||||||
|
@ -258,12 +259,7 @@ pub fn set_track_as_menu<'gc>(
|
||||||
.and_then(|this| this.as_display_object())
|
.and_then(|this| this.as_display_object())
|
||||||
.and_then(|this| this.as_avm2_button())
|
.and_then(|this| this.as_avm2_button())
|
||||||
{
|
{
|
||||||
match args
|
match args.get_bool(0) {
|
||||||
.get(0)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or(Value::Undefined)
|
|
||||||
.coerce_to_boolean()
|
|
||||||
{
|
|
||||||
true => btn.set_button_tracking(&mut activation.context, ButtonTracking::Menu),
|
true => btn.set_button_tracking(&mut activation.context, ButtonTracking::Menu),
|
||||||
false => btn.set_button_tracking(&mut activation.context, ButtonTracking::Push),
|
false => btn.set_button_tracking(&mut activation.context, ButtonTracking::Push),
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use crate::avm2::activation::Activation;
|
use crate::avm2::activation::Activation;
|
||||||
use crate::avm2::object::{Object, StageObject, TObject};
|
use crate::avm2::object::{Object, StageObject, TObject};
|
||||||
|
use crate::avm2::parameters::ParametersExt;
|
||||||
use crate::avm2::value::Value;
|
use crate::avm2::value::Value;
|
||||||
use crate::avm2::Error;
|
use crate::avm2::Error;
|
||||||
use crate::avm2::Multiname;
|
use crate::avm2::Multiname;
|
||||||
|
@ -151,11 +152,7 @@ pub fn set_button_mode<'gc>(
|
||||||
.and_then(|o| o.as_display_object())
|
.and_then(|o| o.as_display_object())
|
||||||
.and_then(|o| o.as_movie_clip())
|
.and_then(|o| o.as_movie_clip())
|
||||||
{
|
{
|
||||||
let forced_button_mode = args
|
let forced_button_mode = args.get_bool(0);
|
||||||
.get(0)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or(Value::Undefined)
|
|
||||||
.coerce_to_boolean();
|
|
||||||
|
|
||||||
mc.set_forced_button_mode(&mut activation.context, forced_button_mode);
|
mc.set_forced_button_mode(&mut activation.context, forced_button_mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use crate::avm2::activation::Activation;
|
use crate::avm2::activation::Activation;
|
||||||
use crate::avm2::object::{Object, TObject, TextFormatObject};
|
use crate::avm2::object::{Object, TObject, TextFormatObject};
|
||||||
|
use crate::avm2::parameters::ParametersExt;
|
||||||
use crate::avm2::value::Value;
|
use crate::avm2::value::Value;
|
||||||
use crate::avm2::Error;
|
use crate::avm2::Error;
|
||||||
use crate::display_object::{AutoSizeMode, EditText, TDisplayObject, TextSelection};
|
use crate::display_object::{AutoSizeMode, EditText, TDisplayObject, TextSelection};
|
||||||
|
@ -125,11 +126,7 @@ pub fn set_background<'gc>(
|
||||||
.and_then(|this| this.as_display_object())
|
.and_then(|this| this.as_display_object())
|
||||||
.and_then(|this| this.as_edit_text())
|
.and_then(|this| this.as_edit_text())
|
||||||
{
|
{
|
||||||
let has_background = args
|
let has_background = args.get_bool(0);
|
||||||
.get(0)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or(Value::Undefined)
|
|
||||||
.coerce_to_boolean();
|
|
||||||
this.set_has_background(activation.context.gc_context, has_background);
|
this.set_has_background(activation.context.gc_context, has_background);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,11 +192,7 @@ pub fn set_border<'gc>(
|
||||||
.and_then(|this| this.as_display_object())
|
.and_then(|this| this.as_display_object())
|
||||||
.and_then(|this| this.as_edit_text())
|
.and_then(|this| this.as_edit_text())
|
||||||
{
|
{
|
||||||
let border = args
|
let border = args.get_bool(0);
|
||||||
.get(0)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or(Value::Undefined)
|
|
||||||
.coerce_to_boolean();
|
|
||||||
this.set_has_border(activation.context.gc_context, border);
|
this.set_has_border(activation.context.gc_context, border);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,11 +312,7 @@ pub fn set_display_as_password<'gc>(
|
||||||
.and_then(|this| this.as_display_object())
|
.and_then(|this| this.as_display_object())
|
||||||
.and_then(|this| this.as_edit_text())
|
.and_then(|this| this.as_edit_text())
|
||||||
{
|
{
|
||||||
let is_password = args
|
let is_password = args.get_bool(0);
|
||||||
.get(0)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or(Value::Undefined)
|
|
||||||
.coerce_to_boolean();
|
|
||||||
|
|
||||||
this.set_password(is_password, &mut activation.context);
|
this.set_password(is_password, &mut activation.context);
|
||||||
}
|
}
|
||||||
|
@ -355,11 +344,7 @@ pub fn set_embed_fonts<'gc>(
|
||||||
.and_then(|this| this.as_display_object())
|
.and_then(|this| this.as_display_object())
|
||||||
.and_then(|this| this.as_edit_text())
|
.and_then(|this| this.as_edit_text())
|
||||||
{
|
{
|
||||||
let is_embed_fonts = args
|
let is_embed_fonts = args.get_bool(0);
|
||||||
.get(0)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or(Value::Undefined)
|
|
||||||
.coerce_to_boolean();
|
|
||||||
|
|
||||||
this.set_is_device_font(&mut activation.context, !is_embed_fonts);
|
this.set_is_device_font(&mut activation.context, !is_embed_fonts);
|
||||||
}
|
}
|
||||||
|
@ -442,11 +427,7 @@ pub fn set_multiline<'gc>(
|
||||||
.and_then(|this| this.as_display_object())
|
.and_then(|this| this.as_display_object())
|
||||||
.and_then(|this| this.as_edit_text())
|
.and_then(|this| this.as_edit_text())
|
||||||
{
|
{
|
||||||
let is_multiline = args
|
let is_multiline = args.get_bool(0);
|
||||||
.get(0)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or(Value::Undefined)
|
|
||||||
.coerce_to_boolean();
|
|
||||||
|
|
||||||
this.set_multiline(is_multiline, &mut activation.context);
|
this.set_multiline(is_multiline, &mut activation.context);
|
||||||
}
|
}
|
||||||
|
@ -478,11 +459,7 @@ pub fn set_selectable<'gc>(
|
||||||
.and_then(|this| this.as_display_object())
|
.and_then(|this| this.as_display_object())
|
||||||
.and_then(|this| this.as_edit_text())
|
.and_then(|this| this.as_edit_text())
|
||||||
{
|
{
|
||||||
let is_selectable = args
|
let is_selectable = args.get_bool(0);
|
||||||
.get(0)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or(Value::Undefined)
|
|
||||||
.coerce_to_boolean();
|
|
||||||
|
|
||||||
this.set_selectable(is_selectable, &mut activation.context);
|
this.set_selectable(is_selectable, &mut activation.context);
|
||||||
}
|
}
|
||||||
|
@ -677,11 +654,7 @@ pub fn set_word_wrap<'gc>(
|
||||||
.and_then(|this| this.as_display_object())
|
.and_then(|this| this.as_display_object())
|
||||||
.and_then(|this| this.as_edit_text())
|
.and_then(|this| this.as_edit_text())
|
||||||
{
|
{
|
||||||
let is_word_wrap = args
|
let is_word_wrap = args.get_bool(0);
|
||||||
.get(0)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or(Value::Undefined)
|
|
||||||
.coerce_to_boolean();
|
|
||||||
|
|
||||||
this.set_word_wrap(is_word_wrap, &mut activation.context);
|
this.set_word_wrap(is_word_wrap, &mut activation.context);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue