Section 1
//ag_intro_mc_105 (Bombers_armor_fla.ag_intro_mc_105)
package Bombers_armor_fla {
import flash.display.*;
public dynamic class ag_intro_mc_105 extends MovieClip {
public function ag_intro_mc_105(){
addFrameScript(0, frame1, 217, frame218);
}
function frame1(){
if ((parent is MovieClip)){
(parent as MovieClip).stop();
};
gotoAndPlay(2);
}
function frame218(){
if ((parent is MovieClip)){
(parent as MovieClip).play();
};
}
}
}//package Bombers_armor_fla
Section 2
//btMuteMusicContainer_122 (Bombers_armor_fla.btMuteMusicContainer_122)
package Bombers_armor_fla {
import flash.display.*;
import flash.events.*;
public dynamic class btMuteMusicContainer_122 extends MovieClip {
public var hint:MovieClip;
public var bt:MovieClip;
public function btMuteMusicContainer_122(){
addFrameScript(0, frame1);
}
public function mouseOverHandler(_arg1:MouseEvent):void{
hint.visible = true;
}
public function mouseOutHandler(_arg1:MouseEvent):void{
hint.visible = false;
}
function frame1(){
hint.visible = false;
bt.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
bt.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
}
}
}//package Bombers_armor_fla
Section 3
//btMuteSoundContainer_157 (Bombers_armor_fla.btMuteSoundContainer_157)
package Bombers_armor_fla {
import flash.display.*;
import flash.events.*;
public dynamic class btMuteSoundContainer_157 extends MovieClip {
public var hint:MovieClip;
public var bt:MovieClip;
public function btMuteSoundContainer_157(){
addFrameScript(0, frame1);
}
public function mouseOverHandler(_arg1:MouseEvent):void{
hint.visible = true;
}
public function mouseOutHandler(_arg1:MouseEvent):void{
hint.visible = false;
}
function frame1(){
hint.visible = false;
bt.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
bt.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
}
}
}//package Bombers_armor_fla
Section 4
//candlecopy_36 (Bombers_armor_fla.candlecopy_36)
package Bombers_armor_fla {
import flash.display.*;
public dynamic class candlecopy_36 extends MovieClip {
public function candlecopy_36(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package Bombers_armor_fla
Section 5
//cannon_22 (Bombers_armor_fla.cannon_22)
package Bombers_armor_fla {
import flash.display.*;
public dynamic class cannon_22 extends MovieClip {
public function cannon_22(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Bombers_armor_fla
Section 6
//creditspanel_125 (Bombers_armor_fla.creditspanel_125)
package Bombers_armor_fla {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import com.greensock.*;
import flash.net.*;
public dynamic class creditspanel_125 extends MovieClip {
public var devBy:TextField;
public var musicBy:TextField;
public var txtCredits:TextField;
public var btnDG:SimpleButton;
public var btnBack:SimpleButton;
public function creditspanel_125(){
addFrameScript(0, frame1);
}
public function dgClick(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://www.dg-company.com");
navigateToURL(_local2, "_blank");
}
public function back(_arg1:MouseEvent):void{
TweenMax.to(this, 0.5, {autoAlpha:0});
}
function frame1(){
btnDG.addEventListener(MouseEvent.CLICK, dgClick);
btnBack.addEventListener(MouseEvent.CLICK, back);
}
}
}//package Bombers_armor_fla
Section 7
//newBomb_172 (Bombers_armor_fla.newBomb_172)
package Bombers_armor_fla {
import flash.display.*;
public dynamic class newBomb_172 extends MovieClip {
public var fuse:MovieClip;
public function newBomb_172(){
addFrameScript(29, frame30, 35, frame36, 43, frame44);
}
function frame30(){
gotoAndPlay("walk_and_jump");
}
function frame36(){
gotoAndPlay("burn_idle");
}
function frame44(){
gotoAndPlay("burn_run");
}
}
}//package Bombers_armor_fla
Section 8
//scoresmenu_163 (Bombers_armor_fla.scoresmenu_163)
package Bombers_armor_fla {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.net.*;
public dynamic class scoresmenu_163 extends MovieClip {
public var txtScore:TextField;
public var btNextLevel:SimpleButton;
public var txtTotalScore:TextField;
public var btMG2:SimpleButton;
public var txtPowerBonus:TextField;
public function scoresmenu_163(){
addFrameScript(0, frame1);
}
public function MoreGamesClick2(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://armorgames.com/"), "_blank");
}
function frame1(){
btMG2.addEventListener(MouseEvent.CLICK, MoreGamesClick2);
}
}
}//package Bombers_armor_fla
Section 9
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2CircleShape extends b2Shape {
b2internal var m_p:b2Vec2;
public function b2CircleShape(_arg1:Number=0){
m_p = new b2Vec2();
super();
m_type = e_circleShape;
m_radius = _arg1;
}
override public function Copy():b2Shape{
var _local1:b2Shape = new b2CircleShape();
_local1.Set(this);
return (_local1);
}
override public function Set(_arg1:b2Shape):void{
var _local2:b2CircleShape;
super.Set(_arg1);
if ((_arg1 is b2CircleShape)){
_local2 = (_arg1 as b2CircleShape);
m_p.SetV(_local2.m_p);
};
}
override public function TestPoint(_arg1:b2Transform, _arg2:b2Vec2):Boolean{
var _local3:b2Mat22 = _arg1.R;
var _local4:Number = (_arg1.position.x + ((_local3.col1.x * m_p.x) + (_local3.col2.x * m_p.y)));
var _local5:Number = (_arg1.position.y + ((_local3.col1.y * m_p.x) + (_local3.col2.y * m_p.y)));
_local4 = (_arg2.x - _local4);
_local5 = (_arg2.y - _local5);
return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius)));
}
override public function RayCast(_arg1:b2RayCastOutput, _arg2:b2RayCastInput, _arg3:b2Transform):Boolean{
var _local8:Number;
var _local4:b2Mat22 = _arg3.R;
var _local5:Number = (_arg3.position.x + ((_local4.col1.x * m_p.x) + (_local4.col2.x * m_p.y)));
var _local6:Number = (_arg3.position.y + ((_local4.col1.y * m_p.x) + (_local4.col2.y * m_p.y)));
var _local7:Number = (_arg2.p1.x - _local5);
_local8 = (_arg2.p1.y - _local6);
var _local9:Number = (((_local7 * _local7) + (_local8 * _local8)) - (m_radius * m_radius));
var _local10:Number = (_arg2.p2.x - _arg2.p1.x);
var _local11:Number = (_arg2.p2.y - _arg2.p1.y);
var _local12:Number = ((_local7 * _local10) + (_local8 * _local11));
var _local13:Number = ((_local10 * _local10) + (_local11 * _local11));
var _local14:Number = ((_local12 * _local12) - (_local13 * _local9));
if ((((_local14 < 0)) || ((_local13 < Number.MIN_VALUE)))){
return (false);
};
var _local15:Number = -((_local12 + Math.sqrt(_local14)));
if ((((0 <= _local15)) && ((_local15 <= (_arg2.maxFraction * _local13))))){
_local15 = (_local15 / _local13);
_arg1.fraction = _local15;
_arg1.normal.x = (_local7 + (_local15 * _local10));
_arg1.normal.y = (_local8 + (_local15 * _local11));
_arg1.normal.Normalize();
return (true);
};
return (false);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2Transform):void{
var _local3:b2Mat22 = _arg2.R;
var _local4:Number = (_arg2.position.x + ((_local3.col1.x * m_p.x) + (_local3.col2.x * m_p.y)));
var _local5:Number = (_arg2.position.y + ((_local3.col1.y * m_p.x) + (_local3.col2.y * m_p.y)));
_arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius));
_arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius));
}
override public function ComputeMass(_arg1:b2MassData, _arg2:Number):void{
_arg1.mass = (((_arg2 * b2Settings.b2_pi) * m_radius) * m_radius);
_arg1.center.SetV(m_p);
_arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_p.x * m_p.x) + (m_p.y * m_p.y))));
}
override public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2Transform, _arg4:b2Vec2):Number{
var _local9:Number;
var _local5:b2Vec2 = b2Math.MulX(_arg3, m_p);
var _local6:Number = -((b2Math.Dot(_arg1, _local5) - _arg2));
if (_local6 < (-(m_radius) + Number.MIN_VALUE)){
return (0);
};
if (_local6 > m_radius){
_arg4.SetV(_local5);
return (((Math.PI * m_radius) * m_radius));
};
var _local7:Number = (m_radius * m_radius);
var _local8:Number = (_local6 * _local6);
_local9 = ((_local7 * (Math.asin((_local6 / m_radius)) + (Math.PI / 2))) + (_local6 * Math.sqrt((_local7 - _local8))));
var _local10:Number = (((-2 / 3) * Math.pow((_local7 - _local8), 1.5)) / _local9);
_arg4.x = (_local5.x + (_arg1.x * _local10));
_arg4.y = (_local5.y + (_arg1.y * _local10));
return (_local9);
}
public function GetLocalPosition():b2Vec2{
return (m_p);
}
public function SetLocalPosition(_arg1:b2Vec2):void{
m_p.SetV(_arg1);
}
public function GetRadius():Number{
return (m_radius);
}
public function SetRadius(_arg1:Number):void{
m_radius = _arg1;
}
}
}//package Box2D.Collision.Shapes
Section 10
//b2EdgeShape (Box2D.Collision.Shapes.b2EdgeShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2EdgeShape extends b2Shape {
private var s_supportVec:b2Vec2;
b2internal var m_v1:b2Vec2;
b2internal var m_v2:b2Vec2;
b2internal var m_coreV1:b2Vec2;
b2internal var m_coreV2:b2Vec2;
b2internal var m_length:Number;
b2internal var m_normal:b2Vec2;
b2internal var m_direction:b2Vec2;
b2internal var m_cornerDir1:b2Vec2;
b2internal var m_cornerDir2:b2Vec2;
b2internal var m_cornerConvex1:Boolean;
b2internal var m_cornerConvex2:Boolean;
b2internal var m_nextEdge:b2EdgeShape;
b2internal var m_prevEdge:b2EdgeShape;
public function b2EdgeShape(_arg1:b2Vec2, _arg2:b2Vec2){
s_supportVec = new b2Vec2();
m_v1 = new b2Vec2();
m_v2 = new b2Vec2();
m_coreV1 = new b2Vec2();
m_coreV2 = new b2Vec2();
m_normal = new b2Vec2();
m_direction = new b2Vec2();
m_cornerDir1 = new b2Vec2();
m_cornerDir2 = new b2Vec2();
super();
m_type = e_edgeShape;
m_prevEdge = null;
m_nextEdge = null;
m_v1 = _arg1;
m_v2 = _arg2;
m_direction.Set((m_v2.x - m_v1.x), (m_v2.y - m_v1.y));
m_length = m_direction.Normalize();
m_normal.Set(m_direction.y, -(m_direction.x));
m_coreV1.Set(((-(b2Settings.b2_toiSlop) * (m_normal.x - m_direction.x)) + m_v1.x), ((-(b2Settings.b2_toiSlop) * (m_normal.y - m_direction.y)) + m_v1.y));
m_coreV2.Set(((-(b2Settings.b2_toiSlop) * (m_normal.x + m_direction.x)) + m_v2.x), ((-(b2Settings.b2_toiSlop) * (m_normal.y + m_direction.y)) + m_v2.y));
m_cornerDir1 = m_normal;
m_cornerDir2.Set(-(m_normal.x), -(m_normal.y));
}
override public function TestPoint(_arg1:b2Transform, _arg2:b2Vec2):Boolean{
return (false);
}
override public function RayCast(_arg1:b2RayCastOutput, _arg2:b2RayCastInput, _arg3:b2Transform):Boolean{
var _local4:b2Mat22;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local5:Number = (_arg2.p2.x - _arg2.p1.x);
var _local6:Number = (_arg2.p2.y - _arg2.p1.y);
_local4 = _arg3.R;
var _local7:Number = (_arg3.position.x + ((_local4.col1.x * m_v1.x) + (_local4.col2.x * m_v1.y)));
var _local8:Number = (_arg3.position.y + ((_local4.col1.y * m_v1.x) + (_local4.col2.y * m_v1.y)));
var _local9:Number = ((_arg3.position.y + ((_local4.col1.y * m_v2.x) + (_local4.col2.y * m_v2.y))) - _local8);
var _local10:Number = -(((_arg3.position.x + ((_local4.col1.x * m_v2.x) + (_local4.col2.x * m_v2.y))) - _local7));
var _local11:Number = (100 * Number.MIN_VALUE);
var _local12:Number = -(((_local5 * _local9) + (_local6 * _local10)));
if (_local12 > _local11){
_local13 = (_arg2.p1.x - _local7);
_local14 = (_arg2.p1.y - _local8);
_local15 = ((_local13 * _local9) + (_local14 * _local10));
if ((((0 <= _local15)) && ((_local15 <= (_arg2.maxFraction * _local12))))){
_local16 = ((-(_local5) * _local14) + (_local6 * _local13));
if (((((-(_local11) * _local12) <= _local16)) && ((_local16 <= (_local12 * (1 + _local11)))))){
_local15 = (_local15 / _local12);
_arg1.fraction = _local15;
_local17 = Math.sqrt(((_local9 * _local9) + (_local10 * _local10)));
_arg1.normal.x = (_local9 / _local17);
_arg1.normal.y = (_local10 / _local17);
return (true);
};
};
};
return (false);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2Transform):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local3:b2Mat22 = _arg2.R;
_local4 = (_arg2.position.x + ((_local3.col1.x * m_v1.x) + (_local3.col2.x * m_v1.y)));
_local5 = (_arg2.position.y + ((_local3.col1.y * m_v1.x) + (_local3.col2.y * m_v1.y)));
_local6 = (_arg2.position.x + ((_local3.col1.x * m_v2.x) + (_local3.col2.x * m_v2.y)));
_local7 = (_arg2.position.y + ((_local3.col1.y * m_v2.x) + (_local3.col2.y * m_v2.y)));
if (_local4 < _local6){
_arg1.lowerBound.x = _local4;
_arg1.upperBound.x = _local6;
} else {
_arg1.lowerBound.x = _local6;
_arg1.upperBound.x = _local4;
};
if (_local5 < _local7){
_arg1.lowerBound.y = _local5;
_arg1.upperBound.y = _local7;
} else {
_arg1.lowerBound.y = _local7;
_arg1.upperBound.y = _local5;
};
}
override public function ComputeMass(_arg1:b2MassData, _arg2:Number):void{
_arg1.mass = 0;
_arg1.center.SetV(m_v1);
_arg1.I = 0;
}
override public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2Transform, _arg4:b2Vec2):Number{
var _local5:b2Vec2 = new b2Vec2((_arg1.x * _arg2), (_arg1.y * _arg2));
var _local6:b2Vec2 = b2Math.MulX(_arg3, m_v1);
var _local7:b2Vec2 = b2Math.MulX(_arg3, m_v2);
var _local8:Number = (b2Math.Dot(_arg1, _local6) - _arg2);
var _local9:Number = (b2Math.Dot(_arg1, _local7) - _arg2);
if (_local8 > 0){
if (_local9 > 0){
return (0);
};
_local6.x = (((-(_local9) / (_local8 - _local9)) * _local6.x) + ((_local8 / (_local8 - _local9)) * _local7.x));
_local6.y = (((-(_local9) / (_local8 - _local9)) * _local6.y) + ((_local8 / (_local8 - _local9)) * _local7.y));
} else {
if (_local9 > 0){
_local7.x = (((-(_local9) / (_local8 - _local9)) * _local6.x) + ((_local8 / (_local8 - _local9)) * _local7.x));
_local7.y = (((-(_local9) / (_local8 - _local9)) * _local6.y) + ((_local8 / (_local8 - _local9)) * _local7.y));
};
};
_arg4.x = (((_local5.x + _local6.x) + _local7.x) / 3);
_arg4.y = (((_local5.y + _local6.y) + _local7.y) / 3);
return ((0.5 * (((_local6.x - _local5.x) * (_local7.y - _local5.y)) - ((_local6.y - _local5.y) * (_local7.x - _local5.x)))));
}
public function GetLength():Number{
return (m_length);
}
public function GetVertex1():b2Vec2{
return (m_v1);
}
public function GetVertex2():b2Vec2{
return (m_v2);
}
public function GetCoreVertex1():b2Vec2{
return (m_coreV1);
}
public function GetCoreVertex2():b2Vec2{
return (m_coreV2);
}
public function GetNormalVector():b2Vec2{
return (m_normal);
}
public function GetDirectionVector():b2Vec2{
return (m_direction);
}
public function GetCorner1Vector():b2Vec2{
return (m_cornerDir1);
}
public function GetCorner2Vector():b2Vec2{
return (m_cornerDir2);
}
public function Corner1IsConvex():Boolean{
return (m_cornerConvex1);
}
public function Corner2IsConvex():Boolean{
return (m_cornerConvex2);
}
public function GetFirstVertex(_arg1:b2Transform):b2Vec2{
var _local2:b2Mat22 = _arg1.R;
return (new b2Vec2((_arg1.position.x + ((_local2.col1.x * m_coreV1.x) + (_local2.col2.x * m_coreV1.y))), (_arg1.position.y + ((_local2.col1.y * m_coreV1.x) + (_local2.col2.y * m_coreV1.y)))));
}
public function GetNextEdge():b2EdgeShape{
return (m_nextEdge);
}
public function GetPrevEdge():b2EdgeShape{
return (m_prevEdge);
}
public function Support(_arg1:b2Transform, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:b2Mat22 = _arg1.R;
var _local5:Number = (_arg1.position.x + ((_local4.col1.x * m_coreV1.x) + (_local4.col2.x * m_coreV1.y)));
var _local6:Number = (_arg1.position.y + ((_local4.col1.y * m_coreV1.x) + (_local4.col2.y * m_coreV1.y)));
var _local7:Number = (_arg1.position.x + ((_local4.col1.x * m_coreV2.x) + (_local4.col2.x * m_coreV2.y)));
var _local8:Number = (_arg1.position.y + ((_local4.col1.y * m_coreV2.x) + (_local4.col2.y * m_coreV2.y)));
if (((_local5 * _arg2) + (_local6 * _arg3)) > ((_local7 * _arg2) + (_local8 * _arg3))){
s_supportVec.x = _local5;
s_supportVec.y = _local6;
} else {
s_supportVec.x = _local7;
s_supportVec.y = _local8;
};
return (s_supportVec);
}
b2internal function SetPrevEdge(_arg1:b2EdgeShape, _arg2:b2Vec2, _arg3:b2Vec2, _arg4:Boolean):void{
m_prevEdge = _arg1;
m_coreV1 = _arg2;
m_cornerDir1 = _arg3;
m_cornerConvex1 = _arg4;
}
b2internal function SetNextEdge(_arg1:b2EdgeShape, _arg2:b2Vec2, _arg3:b2Vec2, _arg4:Boolean):void{
m_nextEdge = _arg1;
m_coreV2 = _arg2;
m_cornerDir2 = _arg3;
m_cornerConvex2 = _arg4;
}
}
}//package Box2D.Collision.Shapes
Section 11
//b2MassData (Box2D.Collision.Shapes.b2MassData)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2MassData {
public var mass:Number;// = 0
public var center:b2Vec2;
public var I:Number;// = 0
public function b2MassData(){
center = new b2Vec2(0, 0);
super();
}
}
}//package Box2D.Collision.Shapes
Section 12
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape)
package Box2D.Collision.Shapes {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolygonShape extends b2Shape {
b2internal var m_centroid:b2Vec2;
b2internal var m_vertices:Array;
b2internal var m_normals:Array;
b2internal var m_vertexCount:int;
private static var s_mat:b2Mat22 = new b2Mat22();
public function b2PolygonShape(){
m_type = e_polygonShape;
m_centroid = new b2Vec2();
m_vertices = new Array();
m_normals = new Array();
}
override public function Copy():b2Shape{
var _local1:b2PolygonShape = new b2PolygonShape();
_local1.Set(this);
return (_local1);
}
override public function Set(_arg1:b2Shape):void{
var _local2:b2PolygonShape;
var _local3:int;
super.Set(_arg1);
if ((_arg1 is b2PolygonShape)){
_local2 = (_arg1 as b2PolygonShape);
m_centroid.SetV(_local2.m_centroid);
m_vertexCount = _local2.m_vertexCount;
Reserve(m_vertexCount);
_local3 = 0;
while (_local3 < m_vertexCount) {
m_vertices[_local3].SetV(_local2.m_vertices[_local3]);
m_normals[_local3].SetV(_local2.m_normals[_local3]);
_local3++;
};
};
}
public function SetAsArray(_arg1:Array, _arg2:Number=0):void{
var _local4:b2Vec2;
var _local3:Array = new Array();
for each (_local4 in _arg1) {
_local3.push(_local4);
};
SetAsVector(_local3, _arg2);
}
public function SetAsVector(_arg1:Array, _arg2:Number=0):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:b2Vec2;
if (_arg2 == 0){
_arg2 = _arg1.length;
};
b2Settings.b2Assert((2 <= _arg2));
m_vertexCount = _arg2;
Reserve(_arg2);
_local3 = 0;
while (_local3 < m_vertexCount) {
m_vertices[_local3].SetV(_arg1[_local3]);
_local3++;
};
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = _local3;
_local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0;
_local6 = b2Math.SubtractVV(m_vertices[_local5], m_vertices[_local4]);
b2Settings.b2Assert((_local6.LengthSquared() > Number.MIN_VALUE));
m_normals[_local3].SetV(b2Math.CrossVF(_local6, 1));
m_normals[_local3].Normalize();
_local3++;
};
m_centroid = ComputeCentroid(m_vertices, m_vertexCount);
}
public function SetAsBox(_arg1:Number, _arg2:Number):void{
m_vertexCount = 4;
Reserve(4);
m_vertices[0].Set(-(_arg1), -(_arg2));
m_vertices[1].Set(_arg1, -(_arg2));
m_vertices[2].Set(_arg1, _arg2);
m_vertices[3].Set(-(_arg1), _arg2);
m_normals[0].Set(0, -1);
m_normals[1].Set(1, 0);
m_normals[2].Set(0, 1);
m_normals[3].Set(-1, 0);
m_centroid.SetZero();
}
public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{
m_vertexCount = 4;
Reserve(4);
m_vertices[0].Set(-(_arg1), -(_arg2));
m_vertices[1].Set(_arg1, -(_arg2));
m_vertices[2].Set(_arg1, _arg2);
m_vertices[3].Set(-(_arg1), _arg2);
m_normals[0].Set(0, -1);
m_normals[1].Set(1, 0);
m_normals[2].Set(0, 1);
m_normals[3].Set(-1, 0);
m_centroid = _arg3;
var _local5:b2Transform = new b2Transform();
_local5.position = _arg3;
_local5.R.Set(_arg4);
var _local6:int;
while (_local6 < m_vertexCount) {
m_vertices[_local6] = b2Math.MulX(_local5, m_vertices[_local6]);
m_normals[_local6] = b2Math.MulMV(_local5.R, m_normals[_local6]);
_local6++;
};
}
public function SetAsEdge(_arg1:b2Vec2, _arg2:b2Vec2):void{
m_vertexCount = 2;
Reserve(2);
m_vertices[0].SetV(_arg1);
m_vertices[1].SetV(_arg2);
m_centroid.x = (0.5 * (_arg1.x + _arg2.x));
m_centroid.y = (0.5 * (_arg1.y + _arg2.y));
m_normals[0] = b2Math.CrossVF(b2Math.SubtractVV(_arg2, _arg1), 1);
m_normals[0].Normalize();
m_normals[1].x = -(m_normals[0].x);
m_normals[1].y = -(m_normals[0].y);
}
override public function TestPoint(_arg1:b2Transform, _arg2:b2Vec2):Boolean{
var _local3:b2Vec2;
var _local10:Number;
var _local4:b2Mat22 = _arg1.R;
var _local5:Number = (_arg2.x - _arg1.position.x);
var _local6:Number = (_arg2.y - _arg1.position.y);
var _local7:Number = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y));
var _local8:Number = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y));
var _local9:int;
while (_local9 < m_vertexCount) {
_local3 = m_vertices[_local9];
_local5 = (_local7 - _local3.x);
_local6 = (_local8 - _local3.y);
_local3 = m_normals[_local9];
_local10 = ((_local3.x * _local5) + (_local3.y * _local6));
if (_local10 > 0){
return (false);
};
_local9++;
};
return (true);
}
override public function RayCast(_arg1:b2RayCastOutput, _arg2:b2RayCastInput, _arg3:b2Transform):Boolean{
var _local6:Number;
var _local7:Number;
var _local8:b2Mat22;
var _local9:b2Vec2;
var _local18:Number;
var _local19:Number;
var _local4:Number = 0;
var _local5:Number = _arg2.maxFraction;
_local6 = (_arg2.p1.x - _arg3.position.x);
_local7 = (_arg2.p1.y - _arg3.position.y);
_local8 = _arg3.R;
var _local10:Number = ((_local6 * _local8.col1.x) + (_local7 * _local8.col1.y));
var _local11:Number = ((_local6 * _local8.col2.x) + (_local7 * _local8.col2.y));
_local6 = (_arg2.p2.x - _arg3.position.x);
_local7 = (_arg2.p2.y - _arg3.position.y);
_local8 = _arg3.R;
var _local12:Number = ((_local6 * _local8.col1.x) + (_local7 * _local8.col1.y));
var _local13:Number = ((_local6 * _local8.col2.x) + (_local7 * _local8.col2.y));
var _local14:Number = (_local12 - _local10);
var _local15:Number = (_local13 - _local11);
var _local16 = -1;
var _local17:int;
while (_local17 < m_vertexCount) {
_local9 = m_vertices[_local17];
_local6 = (_local9.x - _local10);
_local7 = (_local9.y - _local11);
_local9 = m_normals[_local17];
_local18 = ((_local9.x * _local6) + (_local9.y * _local7));
_local19 = ((_local9.x * _local14) + (_local9.y * _local15));
if (_local19 == 0){
if (_local18 < 0){
return (false);
};
} else {
if ((((_local19 < 0)) && ((_local18 < (_local4 * _local19))))){
_local4 = (_local18 / _local19);
_local16 = _local17;
} else {
if ((((_local19 > 0)) && ((_local18 < (_local5 * _local19))))){
_local5 = (_local18 / _local19);
};
};
};
if (_local5 < (_local4 - Number.MIN_VALUE)){
return (false);
};
_local17++;
};
if (_local16 >= 0){
_arg1.fraction = _local4;
_local8 = _arg3.R;
_local9 = m_normals[_local16];
_arg1.normal.x = ((_local8.col1.x * _local9.x) + (_local8.col2.x * _local9.y));
_arg1.normal.y = ((_local8.col1.y * _local9.x) + (_local8.col2.y * _local9.y));
return (true);
};
return (false);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2Transform):void{
var _local10:Number;
var _local11:Number;
var _local3:b2Mat22 = _arg2.R;
var _local4:b2Vec2 = m_vertices[0];
var _local5:Number = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)));
var _local6:Number = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)));
var _local7:Number = _local5;
var _local8:Number = _local6;
var _local9 = 1;
while (_local9 < m_vertexCount) {
_local4 = m_vertices[_local9];
_local10 = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)));
_local11 = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)));
_local5 = ((_local5 < _local10)) ? _local5 : _local10;
_local6 = ((_local6 < _local11)) ? _local6 : _local11;
_local7 = ((_local7 > _local10)) ? _local7 : _local10;
_local8 = ((_local8 > _local11)) ? _local8 : _local11;
_local9++;
};
_arg1.lowerBound.x = (_local5 - m_radius);
_arg1.lowerBound.y = (_local6 - m_radius);
_arg1.upperBound.x = (_local7 + m_radius);
_arg1.upperBound.y = (_local8 + m_radius);
}
override public function ComputeMass(_arg1:b2MassData, _arg2:Number):void{
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
if (m_vertexCount == 2){
_arg1.center.x = (0.5 * (m_vertices[0].x + m_vertices[1].x));
_arg1.center.y = (0.5 * (m_vertices[0].y + m_vertices[1].y));
_arg1.mass = 0;
_arg1.I = 0;
return;
};
var _local3:Number = 0;
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
var _local7:Number = 0;
var _local8:Number = 0;
var _local9:Number = (1 / 3);
var _local10:int;
while (_local10 < m_vertexCount) {
_local11 = m_vertices[_local10];
_local12 = (((_local10 + 1) < m_vertexCount)) ? m_vertices[int((_local10 + 1))] : m_vertices[0];
_local13 = (_local11.x - _local7);
_local14 = (_local11.y - _local8);
_local15 = (_local12.x - _local7);
_local16 = (_local12.y - _local8);
_local17 = ((_local13 * _local16) - (_local14 * _local15));
_local18 = (0.5 * _local17);
_local5 = (_local5 + _local18);
_local3 = (_local3 + ((_local18 * _local9) * ((_local7 + _local11.x) + _local12.x)));
_local4 = (_local4 + ((_local18 * _local9) * ((_local8 + _local11.y) + _local12.y)));
_local19 = _local7;
_local20 = _local8;
_local21 = _local13;
_local22 = _local14;
_local23 = _local15;
_local24 = _local16;
_local25 = ((_local9 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19));
_local26 = ((_local9 * ((0.25 * (((_local22 * _local22) + (_local24 * _local22)) + (_local24 * _local24))) + ((_local20 * _local22) + (_local20 * _local24)))) + ((0.5 * _local20) * _local20));
_local6 = (_local6 + (_local17 * (_local25 + _local26)));
_local10++;
};
_arg1.mass = (_arg2 * _local5);
_local3 = (_local3 * (1 / _local5));
_local4 = (_local4 * (1 / _local5));
_arg1.center.Set(_local3, _local4);
_arg1.I = (_arg2 * _local6);
}
override public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2Transform, _arg4:b2Vec2):Number{
var _local12:int;
var _local22:b2Vec2;
var _local23:Boolean;
var _local24:b2MassData;
var _local25:Number;
var _local5:b2Vec2 = b2Math.MulTMV(_arg3.R, _arg1);
var _local6:Number = (_arg2 - b2Math.Dot(_arg1, _arg3.position));
var _local7:Array = new Array();
var _local8:int;
var _local9 = -1;
var _local10 = -1;
var _local11:Boolean;
_local12 = 0;
while (_local12 < m_vertexCount) {
_local7[_local12] = (b2Math.Dot(_local5, m_vertices[_local12]) - _local6);
_local23 = (_local7[_local12] < -(Number.MIN_VALUE));
if (_local12 > 0){
if (_local23){
if (!_local11){
_local9 = (_local12 - 1);
_local8++;
};
} else {
if (_local11){
_local10 = (_local12 - 1);
_local8++;
};
};
};
_local11 = _local23;
_local12++;
};
switch (_local8){
case 0:
if (_local11){
_local24 = new b2MassData();
ComputeMass(_local24, 1);
_arg4.SetV(b2Math.MulX(_arg3, _local24.center));
return (_local24.mass);
};
return (0);
case 1:
if (_local9 == -1){
_local9 = (m_vertexCount - 1);
} else {
_local10 = (m_vertexCount - 1);
};
break;
};
var _local13:int = ((_local9 + 1) % m_vertexCount);
var _local14:int = ((_local10 + 1) % m_vertexCount);
var _local15:Number = ((0 - _local7[_local9]) / (_local7[_local13] - _local7[_local9]));
var _local16:Number = ((0 - _local7[_local10]) / (_local7[_local14] - _local7[_local10]));
var _local17:b2Vec2 = new b2Vec2(((m_vertices[_local9].x * (1 - _local15)) + (m_vertices[_local13].x * _local15)), ((m_vertices[_local9].y * (1 - _local15)) + (m_vertices[_local13].y * _local15)));
var _local18:b2Vec2 = new b2Vec2(((m_vertices[_local10].x * (1 - _local16)) + (m_vertices[_local14].x * _local16)), ((m_vertices[_local10].y * (1 - _local16)) + (m_vertices[_local14].y * _local16)));
var _local19:Number = 0;
var _local20:b2Vec2 = new b2Vec2();
var _local21:b2Vec2 = m_vertices[_local13];
_local12 = _local13;
while (_local12 != _local14) {
_local12 = ((_local12 + 1) % m_vertexCount);
if (_local12 == _local14){
_local22 = _local18;
} else {
_local22 = m_vertices[_local12];
};
_local25 = (0.5 * (((_local21.x - _local17.x) * (_local22.y - _local17.y)) - ((_local21.y - _local17.y) * (_local22.x - _local17.x))));
_local19 = (_local19 + _local25);
_local20.x = (_local20.x + ((_local25 * ((_local17.x + _local21.x) + _local22.x)) / 3));
_local20.y = (_local20.y + ((_local25 * ((_local17.y + _local21.y) + _local22.y)) / 3));
_local21 = _local22;
};
_local20.Multiply((1 / _local19));
_arg4.SetV(b2Math.MulX(_arg3, _local20));
return (_local19);
}
public function GetVertexCount():int{
return (m_vertexCount);
}
public function GetVertices():Array{
return (m_vertices);
}
public function GetNormals():Array{
return (m_normals);
}
public function GetSupport(_arg1:b2Vec2):int{
var _local5:Number;
var _local2:int;
var _local3:Number = ((m_vertices[0].x * _arg1.x) + (m_vertices[0].y * _arg1.y));
var _local4 = 1;
while (_local4 < m_vertexCount) {
_local5 = ((m_vertices[_local4].x * _arg1.x) + (m_vertices[_local4].y * _arg1.y));
if (_local5 > _local3){
_local2 = _local4;
_local3 = _local5;
};
_local4++;
};
return (_local2);
}
public function GetSupportVertex(_arg1:b2Vec2):b2Vec2{
var _local5:Number;
var _local2:int;
var _local3:Number = ((m_vertices[0].x * _arg1.x) + (m_vertices[0].y * _arg1.y));
var _local4 = 1;
while (_local4 < m_vertexCount) {
_local5 = ((m_vertices[_local4].x * _arg1.x) + (m_vertices[_local4].y * _arg1.y));
if (_local5 > _local3){
_local2 = _local4;
_local3 = _local5;
};
_local4++;
};
return (m_vertices[_local2]);
}
private function Validate():Boolean{
return (false);
}
private function Reserve(_arg1:int):void{
var _local2:int = m_vertices.length;
while (_local2 < _arg1) {
m_vertices[_local2] = new b2Vec2();
m_normals[_local2] = new b2Vec2();
_local2++;
};
}
public static function AsArray(_arg1:Array, _arg2:Number):b2PolygonShape{
var _local3:b2PolygonShape = new (b2PolygonShape);
_local3.SetAsArray(_arg1, _arg2);
return (_local3);
}
public static function AsVector(_arg1:Array, _arg2:Number):b2PolygonShape{
var _local3:b2PolygonShape = new (b2PolygonShape);
_local3.SetAsVector(_arg1, _arg2);
return (_local3);
}
public static function AsBox(_arg1:Number, _arg2:Number):b2PolygonShape{
var _local3:b2PolygonShape = new (b2PolygonShape);
_local3.SetAsBox(_arg1, _arg2);
return (_local3);
}
public static function AsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):b2PolygonShape{
var _local5:b2PolygonShape = new (b2PolygonShape);
_local5.SetAsOrientedBox(_arg1, _arg2, _arg3, _arg4);
return (_local5);
}
public static function AsEdge(_arg1:b2Vec2, _arg2:b2Vec2):b2PolygonShape{
var _local3:b2PolygonShape = new (b2PolygonShape);
_local3.SetAsEdge(_arg1, _arg2);
return (_local3);
}
public static function ComputeCentroid(_arg1:Array, _arg2:uint):b2Vec2{
var _local3:b2Vec2;
var _local7:Number;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local3 = new b2Vec2();
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
_local7 = (1 / 3);
var _local8:int;
while (_local8 < _arg2) {
_local9 = _arg1[_local8];
_local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0];
_local11 = (_local9.x - _local5);
_local12 = (_local9.y - _local6);
_local13 = (_local10.x - _local5);
_local14 = (_local10.y - _local6);
_local15 = ((_local11 * _local14) - (_local12 * _local13));
_local16 = (0.5 * _local15);
_local4 = (_local4 + _local16);
_local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x)));
_local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y)));
_local8++;
};
_local3.x = (_local3.x * (1 / _local4));
_local3.y = (_local3.y * (1 / _local4));
return (_local3);
}
b2internal static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{
var _local4:int;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:b2Mat22;
var _local5:Array = new Array((_arg3 + 1));
_local4 = 0;
while (_local4 < _arg3) {
_local5[_local4] = _arg2[_local4];
_local4++;
};
_local5[_arg3] = _local5[0];
var _local6:Number = Number.MAX_VALUE;
_local4 = 1;
while (_local4 <= _arg3) {
_local7 = _local5[int((_local4 - 1))];
_local8 = (_local5[_local4].x - _local7.x);
_local9 = (_local5[_local4].y - _local7.y);
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local8 = (_local8 / _local10);
_local9 = (_local9 / _local10);
_local11 = -(_local9);
_local12 = _local8;
_local13 = Number.MAX_VALUE;
_local14 = Number.MAX_VALUE;
_local15 = -(Number.MAX_VALUE);
_local16 = -(Number.MAX_VALUE);
_local17 = 0;
while (_local17 < _arg3) {
_local19 = (_local5[_local17].x - _local7.x);
_local20 = (_local5[_local17].y - _local7.y);
_local21 = ((_local8 * _local19) + (_local9 * _local20));
_local22 = ((_local11 * _local19) + (_local12 * _local20));
if (_local21 < _local13){
_local13 = _local21;
};
if (_local22 < _local14){
_local14 = _local22;
};
if (_local21 > _local15){
_local15 = _local21;
};
if (_local22 > _local16){
_local16 = _local22;
};
_local17++;
};
_local18 = ((_local15 - _local13) * (_local16 - _local14));
if (_local18 < (0.95 * _local6)){
_local6 = _local18;
_arg1.R.col1.x = _local8;
_arg1.R.col1.y = _local9;
_arg1.R.col2.x = _local11;
_arg1.R.col2.y = _local12;
_local23 = (0.5 * (_local13 + _local15));
_local24 = (0.5 * (_local14 + _local16));
_local25 = _arg1.R;
_arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24)));
_arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24)));
_arg1.extents.x = (0.5 * (_local15 - _local13));
_arg1.extents.y = (0.5 * (_local16 - _local14));
};
_local4++;
};
}
}
}//package Box2D.Collision.Shapes
Section 13
//b2Shape (Box2D.Collision.Shapes.b2Shape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2Shape {
b2internal var m_type:int;
b2internal var m_radius:Number;
b2internal static const e_unknownShape:int = -1;
b2internal static const e_circleShape:int = 0;
b2internal static const e_polygonShape:int = 1;
b2internal static const e_edgeShape:int = 2;
b2internal static const e_shapeTypeCount:int = 3;
public static const e_hitCollide:int = 1;
public static const e_missCollide:int = 0;
public static const e_startsInsideCollide:int = -1;
public function b2Shape(){
m_type = e_unknownShape;
m_radius = b2Settings.b2_linearSlop;
}
public function Copy():b2Shape{
return (null);
}
public function Set(_arg1:b2Shape):void{
m_radius = _arg1.m_radius;
}
public function GetType():int{
return (m_type);
}
public function TestPoint(_arg1:b2Transform, _arg2:b2Vec2):Boolean{
return (false);
}
public function RayCast(_arg1:b2RayCastOutput, _arg2:b2RayCastInput, _arg3:b2Transform):Boolean{
return (false);
}
public function ComputeAABB(_arg1:b2AABB, _arg2:b2Transform):void{
}
public function ComputeMass(_arg1:b2MassData, _arg2:Number):void{
}
public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2Transform, _arg4:b2Vec2):Number{
return (0);
}
public static function TestOverlap(_arg1:b2Shape, _arg2:b2Transform, _arg3:b2Shape, _arg4:b2Transform):Boolean{
var _local5:b2DistanceInput = new b2DistanceInput();
_local5.proxyA = new b2DistanceProxy();
_local5.proxyA.Set(_arg1);
_local5.proxyB = new b2DistanceProxy();
_local5.proxyB.Set(_arg3);
_local5.transformA = _arg2;
_local5.transformB = _arg4;
_local5.useRadii = true;
var _local6:b2SimplexCache = new b2SimplexCache();
_local6.count = 0;
var _local7:b2DistanceOutput = new b2DistanceOutput();
b2Distance.Distance(_local7, _local6, _local5);
return ((_local7.distance < (10 * Number.MIN_VALUE)));
}
}
}//package Box2D.Collision.Shapes
Section 14
//b2AABB (Box2D.Collision.b2AABB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2AABB {
public var lowerBound:b2Vec2;
public var upperBound:b2Vec2;
public function b2AABB(){
lowerBound = new b2Vec2();
upperBound = new b2Vec2();
super();
}
public function IsValid():Boolean{
var _local1:Number = (upperBound.x - lowerBound.x);
var _local2:Number = (upperBound.y - lowerBound.y);
var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid()));
return (_local3);
}
public function GetCenter():b2Vec2{
return (new b2Vec2(((lowerBound.x + upperBound.x) / 2), ((lowerBound.y + upperBound.y) / 2)));
}
public function GetExtents():b2Vec2{
return (new b2Vec2(((upperBound.x - lowerBound.x) / 2), ((upperBound.y - lowerBound.y) / 2)));
}
public function Contains(_arg1:b2AABB):Boolean{
var _local2:Boolean;
_local2 = ((_local2) && ((lowerBound.x <= _arg1.lowerBound.x)));
_local2 = ((_local2) && ((lowerBound.y <= _arg1.lowerBound.y)));
_local2 = ((_local2) && ((_arg1.upperBound.x <= upperBound.x)));
_local2 = ((_local2) && ((_arg1.upperBound.y <= upperBound.y)));
return (_local2);
}
public function RayCast(_arg1:b2RayCastOutput, _arg2:b2RayCastInput):Boolean{
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local3:Number = -(Number.MAX_VALUE);
var _local4:Number = Number.MAX_VALUE;
var _local5:Number = _arg2.p1.x;
var _local6:Number = _arg2.p1.y;
var _local7:Number = (_arg2.p2.x - _arg2.p1.x);
var _local8:Number = (_arg2.p2.y - _arg2.p1.y);
var _local9:Number = Math.abs(_local7);
var _local10:Number = Math.abs(_local8);
_local11 = _arg1.normal;
if (_local9 < Number.MIN_VALUE){
if ((((_local5 < lowerBound.x)) || ((upperBound.x < _local5)))){
return (false);
};
} else {
_local12 = (1 / _local7);
_local13 = ((lowerBound.x - _local5) * _local12);
_local14 = ((upperBound.x - _local5) * _local12);
_local16 = -1;
if (_local13 > _local14){
_local15 = _local13;
_local13 = _local14;
_local14 = _local15;
_local16 = 1;
};
if (_local13 > _local3){
_local11.x = _local16;
_local11.y = 0;
_local3 = _local13;
};
_local4 = Math.min(_local4, _local14);
if (_local3 > _local4){
return (false);
};
};
if (_local10 < Number.MIN_VALUE){
if ((((_local6 < lowerBound.y)) || ((upperBound.y < _local6)))){
return (false);
};
} else {
_local12 = (1 / _local8);
_local13 = ((lowerBound.y - _local6) * _local12);
_local14 = ((upperBound.y - _local6) * _local12);
_local16 = -1;
if (_local13 > _local14){
_local15 = _local13;
_local13 = _local14;
_local14 = _local15;
_local16 = 1;
};
if (_local13 > _local3){
_local11.y = _local16;
_local11.x = 0;
_local3 = _local13;
};
_local4 = Math.min(_local4, _local14);
if (_local3 > _local4){
return (false);
};
};
_arg1.fraction = _local3;
return (true);
}
public function TestOverlap(_arg1:b2AABB):Boolean{
var _local2:Number = (_arg1.lowerBound.x - upperBound.x);
var _local3:Number = (_arg1.lowerBound.y - upperBound.y);
var _local4:Number = (lowerBound.x - _arg1.upperBound.x);
var _local5:Number = (lowerBound.y - _arg1.upperBound.y);
if ((((_local2 > 0)) || ((_local3 > 0)))){
return (false);
};
if ((((_local4 > 0)) || ((_local5 > 0)))){
return (false);
};
return (true);
}
public function Combine(_arg1:b2AABB, _arg2:b2AABB):void{
lowerBound.x = Math.min(_arg1.lowerBound.x, _arg2.lowerBound.x);
lowerBound.y = Math.min(_arg1.lowerBound.y, _arg2.lowerBound.y);
upperBound.x = Math.max(_arg1.upperBound.x, _arg2.upperBound.x);
upperBound.y = Math.max(_arg1.upperBound.y, _arg2.upperBound.y);
}
public static function Combine(_arg1:b2AABB, _arg2:b2AABB):b2AABB{
var _local3:b2AABB = new (b2AABB);
_local3.Combine(_arg1, _arg2);
return (_local3);
}
}
}//package Box2D.Collision
Section 15
//b2Collision (Box2D.Collision.b2Collision)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Collision {
public static const b2_nullFeature:uint = 0xFF;
private static var s_incidentEdge:Array = MakeClipPointVector();
private static var s_clipPoints1:Array = MakeClipPointVector();
private static var s_clipPoints2:Array = MakeClipPointVector();
private static var s_edgeAO:Array = new Array(1);
private static var s_edgeBO:Array = new Array(1);
private static var s_localTangent:b2Vec2 = new b2Vec2();
private static var s_localNormal:b2Vec2 = new b2Vec2();
private static var s_planePoint:b2Vec2 = new b2Vec2();
private static var s_normal:b2Vec2 = new b2Vec2();
private static var s_tangent:b2Vec2 = new b2Vec2();
private static var s_tangent2:b2Vec2 = new b2Vec2();
private static var s_v11:b2Vec2 = new b2Vec2();
private static var s_v12:b2Vec2 = new b2Vec2();
private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2();
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:ClipVertex;
var _local6:int;
var _local7:b2Vec2;
var _local9:Number;
var _local11:Number;
var _local12:b2Vec2;
var _local13:ClipVertex;
_local6 = 0;
_local5 = _arg2[0];
_local7 = _local5.v;
_local5 = _arg2[1];
var _local8:b2Vec2 = _local5.v;
_local9 = (((_arg3.x * _local7.x) + (_arg3.y * _local7.y)) - _arg4);
var _local10:Number = (((_arg3.x * _local8.x) + (_arg3.y * _local8.y)) - _arg4);
if (_local9 <= 0){
var _temp1 = _local6;
_local6 = (_local6 + 1);
_arg1[_temp1].Set(_arg2[0]);
};
if (_local10 <= 0){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_arg1[_temp2].Set(_arg2[1]);
};
if ((_local9 * _local10) < 0){
_local11 = (_local9 / (_local9 - _local10));
_local5 = _arg1[_local6];
_local12 = _local5.v;
_local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x)));
_local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y)));
_local5 = _arg1[_local6];
if (_local9 > 0){
_local13 = _arg2[0];
_local5.id = _local13.id;
} else {
_local13 = _arg2[1];
_local5.id = _local13.id;
};
_local6++;
};
return (_local6);
}
public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2Transform, _arg3:int, _arg4:b2PolygonShape, _arg5:b2Transform):Number{
var _local11:b2Mat22;
var _local12:b2Vec2;
var _local25:Number;
var _local6:int = _arg1.m_vertexCount;
var _local7:Array = _arg1.m_vertices;
var _local8:Array = _arg1.m_normals;
var _local9:int = _arg4.m_vertexCount;
var _local10:Array = _arg4.m_vertices;
_local11 = _arg2.R;
_local12 = _local8[_arg3];
var _local13:Number = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y));
var _local14:Number = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y));
_local11 = _arg5.R;
var _local15:Number = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14));
var _local16:Number = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14));
var _local17:int;
var _local18:Number = Number.MAX_VALUE;
var _local19:int;
while (_local19 < _local9) {
_local12 = _local10[_local19];
_local25 = ((_local12.x * _local15) + (_local12.y * _local16));
if (_local25 < _local18){
_local18 = _local25;
_local17 = _local19;
};
_local19++;
};
_local12 = _local7[_arg3];
_local11 = _arg2.R;
var _local20:Number = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
var _local21:Number = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local12 = _local10[_local17];
_local11 = _arg5.R;
var _local22:Number = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
var _local23:Number = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local22 = (_local22 - _local20);
_local23 = (_local23 - _local21);
var _local24:Number = ((_local22 * _local13) + (_local23 * _local14));
return (_local24);
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2Transform, _arg4:b2PolygonShape, _arg5:b2Transform):Number{
var _local8:b2Vec2;
var _local9:b2Mat22;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:Number;
var _local6:int = _arg2.m_vertexCount;
var _local7:Array = _arg2.m_normals;
_local9 = _arg5.R;
_local8 = _arg4.m_centroid;
var _local10:Number = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)));
var _local11:Number = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)));
_local9 = _arg3.R;
_local8 = _arg2.m_centroid;
_local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))));
_local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))));
var _local12:Number = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y));
var _local13:Number = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y));
var _local14:int;
var _local15:Number = -(Number.MAX_VALUE);
var _local16:int;
while (_local16 < _local6) {
_local8 = _local7[_local16];
_local25 = ((_local8.x * _local12) + (_local8.y * _local13));
if (_local25 > _local15){
_local15 = _local25;
_local14 = _local16;
};
_local16++;
};
var _local17:Number = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
var _local18:int = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1);
var _local19:Number = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5);
var _local20:int = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0;
var _local21:Number = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5);
if ((((_local19 > _local17)) && ((_local19 > _local21)))){
_local24 = -1;
_local22 = _local18;
_local23 = _local19;
} else {
if (_local21 > _local17){
_local24 = 1;
_local22 = _local20;
_local23 = _local21;
} else {
_arg1[0] = _local14;
return (_local17);
};
};
while (true) {
if (_local24 == -1){
_local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1);
} else {
_local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > _local23){
_local22 = _local14;
_local23 = _local17;
} else {
break;
};
};
_arg1[0] = _local22;
return (_local23);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2Transform, _arg4:int, _arg5:b2PolygonShape, _arg6:b2Transform):void{
var _local12:b2Mat22;
var _local13:b2Vec2;
var _local20:ClipVertex;
var _local23:Number;
var _local7:int = _arg2.m_vertexCount;
var _local8:Array = _arg2.m_normals;
var _local9:int = _arg5.m_vertexCount;
var _local10:Array = _arg5.m_vertices;
var _local11:Array = _arg5.m_normals;
_local12 = _arg3.R;
_local13 = _local8[_arg4];
var _local14:Number = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y));
var _local15:Number = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y));
_local12 = _arg6.R;
var _local16:Number = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15));
_local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15));
_local14 = _local16;
var _local17:int;
var _local18:Number = Number.MAX_VALUE;
var _local19:int;
while (_local19 < _local9) {
_local13 = _local11[_local19];
_local23 = ((_local14 * _local13.x) + (_local15 * _local13.y));
if (_local23 < _local18){
_local18 = _local23;
_local17 = _local19;
};
_local19++;
};
var _local21:int = _local17;
var _local22:int = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0;
_local20 = _arg1[0];
_local13 = _local10[_local21];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local21;
_local20.id.features.incidentVertex = 0;
_local20 = _arg1[1];
_local13 = _local10[_local22];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local22;
_local20.id.features.incidentVertex = 1;
}
private static function MakeClipPointVector():Array{
var _local1:Array = new Array(2);
_local1[0] = new ClipVertex();
_local1[1] = new ClipVertex();
return (_local1);
}
public static function CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2Transform, _arg4:b2PolygonShape, _arg5:b2Transform):void{
var _local6:ClipVertex;
var _local12:b2PolygonShape;
var _local13:b2PolygonShape;
var _local14:b2Transform;
var _local15:b2Transform;
var _local16:int;
var _local17:uint;
var _local20:b2Mat22;
var _local25:b2Vec2;
var _local39:int;
var _local42:Number;
var _local43:b2ManifoldPoint;
var _local44:Number;
var _local45:Number;
_arg1.m_pointCount = 0;
var _local7:Number = (_arg2.m_radius + _arg4.m_radius);
var _local8:int;
s_edgeAO[0] = _local8;
var _local9:Number = FindMaxSeparation(s_edgeAO, _arg2, _arg3, _arg4, _arg5);
_local8 = s_edgeAO[0];
if (_local9 > _local7){
return;
};
var _local10:int;
s_edgeBO[0] = _local10;
var _local11:Number = FindMaxSeparation(s_edgeBO, _arg4, _arg5, _arg2, _arg3);
_local10 = s_edgeBO[0];
if (_local11 > _local7){
return;
};
var _local18:Number = 0.98;
var _local19:Number = 0.001;
if (_local11 > ((_local18 * _local9) + _local19)){
_local12 = _arg4;
_local13 = _arg2;
_local14 = _arg5;
_local15 = _arg3;
_local16 = _local10;
_arg1.m_type = b2Manifold.e_faceB;
_local17 = 1;
} else {
_local12 = _arg2;
_local13 = _arg4;
_local14 = _arg3;
_local15 = _arg5;
_local16 = _local8;
_arg1.m_type = b2Manifold.e_faceA;
_local17 = 0;
};
var _local21:Array = s_incidentEdge;
FindIncidentEdge(_local21, _local12, _local14, _local16, _local13, _local15);
var _local22:int = _local12.m_vertexCount;
var _local23:Array = _local12.m_vertices;
var _local24:b2Vec2 = _local23[_local16];
if ((_local16 + 1) < _local22){
_local25 = _local23[int((_local16 + 1))];
} else {
_local25 = _local23[0];
};
var _local26:b2Vec2 = s_localTangent;
_local26.Set((_local25.x - _local24.x), (_local25.y - _local24.y));
_local26.Normalize();
var _local27:b2Vec2 = s_localNormal;
_local27.x = _local26.y;
_local27.y = -(_local26.x);
var _local28:b2Vec2 = s_planePoint;
_local28.Set((0.5 * (_local24.x + _local25.x)), (0.5 * (_local24.y + _local25.y)));
var _local29:b2Vec2 = s_tangent;
_local20 = _local14.R;
_local29.x = ((_local20.col1.x * _local26.x) + (_local20.col2.x * _local26.y));
_local29.y = ((_local20.col1.y * _local26.x) + (_local20.col2.y * _local26.y));
var _local30:b2Vec2 = s_tangent2;
_local30.x = -(_local29.x);
_local30.y = -(_local29.y);
var _local31:b2Vec2 = s_normal;
_local31.x = _local29.y;
_local31.y = -(_local29.x);
var _local32:b2Vec2 = s_v11;
var _local33:b2Vec2 = s_v12;
_local32.x = (_local14.position.x + ((_local20.col1.x * _local24.x) + (_local20.col2.x * _local24.y)));
_local32.y = (_local14.position.y + ((_local20.col1.y * _local24.x) + (_local20.col2.y * _local24.y)));
_local33.x = (_local14.position.x + ((_local20.col1.x * _local25.x) + (_local20.col2.x * _local25.y)));
_local33.y = (_local14.position.y + ((_local20.col1.y * _local25.x) + (_local20.col2.y * _local25.y)));
var _local34:Number = ((_local31.x * _local32.x) + (_local31.y * _local32.y));
var _local35:Number = (((-(_local29.x) * _local32.x) - (_local29.y * _local32.y)) + _local7);
var _local36:Number = (((_local29.x * _local33.x) + (_local29.y * _local33.y)) + _local7);
var _local37:Array = s_clipPoints1;
var _local38:Array = s_clipPoints2;
_local39 = ClipSegmentToLine(_local37, _local21, _local30, _local35);
if (_local39 < 2){
return;
};
_local39 = ClipSegmentToLine(_local38, _local37, _local29, _local36);
if (_local39 < 2){
return;
};
_arg1.m_localPlaneNormal.SetV(_local27);
_arg1.m_localPoint.SetV(_local28);
var _local40:int;
var _local41:int;
while (_local41 < b2Settings.b2_maxManifoldPoints) {
_local6 = _local38[_local41];
_local42 = (((_local31.x * _local6.v.x) + (_local31.y * _local6.v.y)) - _local34);
if (_local42 <= _local7){
_local43 = _arg1.m_points[_local40];
_local20 = _local15.R;
_local44 = (_local6.v.x - _local15.position.x);
_local45 = (_local6.v.y - _local15.position.y);
_local43.m_localPoint.x = ((_local44 * _local20.col1.x) + (_local45 * _local20.col1.y));
_local43.m_localPoint.y = ((_local44 * _local20.col2.x) + (_local45 * _local20.col2.y));
_local43.m_id.Set(_local6.id);
_local43.m_id.features.flip = _local17;
_local40++;
};
_local41++;
};
_arg1.m_pointCount = _local40;
}
public static function CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2Transform, _arg4:b2CircleShape, _arg5:b2Transform):void{
var _local6:b2Mat22;
var _local7:b2Vec2;
_arg1.m_pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_p;
var _local8:Number = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local9:Number = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_p;
var _local10:Number = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local11:Number = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
var _local12:Number = (_local10 - _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = ((_local12 * _local12) + (_local13 * _local13));
var _local15:Number = (_arg2.m_radius + _arg4.m_radius);
if (_local14 > (_local15 * _local15)){
return;
};
_arg1.m_type = b2Manifold.e_circles;
_arg1.m_localPoint.SetV(_arg2.m_p);
_arg1.m_localPlaneNormal.SetZero();
_arg1.m_pointCount = 1;
_arg1.m_points[0].m_localPoint.SetV(_arg4.m_p);
_arg1.m_points[0].m_id.key = 0;
}
public static function CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2Transform, _arg4:b2CircleShape, _arg5:b2Transform):void{
var _local6:b2ManifoldPoint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local12:b2Mat22;
var _local17:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
_arg1.m_pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_p;
var _local13:Number = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
var _local14:Number = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)));
_local7 = (_local13 - _arg3.position.x);
_local8 = (_local14 - _arg3.position.y);
_local12 = _arg3.R;
var _local15:Number = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
var _local16:Number = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
var _local18:int;
var _local19:Number = -(Number.MAX_VALUE);
var _local20:Number = (_arg2.m_radius + _arg4.m_radius);
var _local21:int = _arg2.m_vertexCount;
var _local22:Array = _arg2.m_vertices;
var _local23:Array = _arg2.m_normals;
var _local24:int;
while (_local24 < _local21) {
_local11 = _local22[_local24];
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local11 = _local23[_local24];
_local31 = ((_local11.x * _local7) + (_local11.y * _local8));
if (_local31 > _local20){
return;
};
if (_local31 > _local19){
_local19 = _local31;
_local18 = _local24;
};
_local24++;
};
var _local25:int = _local18;
var _local26:int = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
var _local27:b2Vec2 = _local22[_local25];
var _local28:b2Vec2 = _local22[_local26];
if (_local19 < Number.MIN_VALUE){
_arg1.m_pointCount = 1;
_arg1.m_type = b2Manifold.e_faceA;
_arg1.m_localPlaneNormal.SetV(_local23[_local18]);
_arg1.m_localPoint.x = (0.5 * (_local27.x + _local28.x));
_arg1.m_localPoint.y = (0.5 * (_local27.y + _local28.y));
_arg1.m_points[0].m_localPoint.SetV(_arg4.m_p);
_arg1.m_points[0].m_id.key = 0;
return;
};
var _local29:Number = (((_local15 - _local27.x) * (_local28.x - _local27.x)) + ((_local16 - _local27.y) * (_local28.y - _local27.y)));
var _local30:Number = (((_local15 - _local28.x) * (_local27.x - _local28.x)) + ((_local16 - _local28.y) * (_local27.y - _local28.y)));
if (_local29 <= 0){
if ((((_local15 - _local27.x) * (_local15 - _local27.x)) + ((_local16 - _local27.y) * (_local16 - _local27.y))) > (_local20 * _local20)){
return;
};
_arg1.m_pointCount = 1;
_arg1.m_type = b2Manifold.e_faceA;
_arg1.m_localPlaneNormal.x = (_local15 - _local27.x);
_arg1.m_localPlaneNormal.y = (_local16 - _local27.y);
_arg1.m_localPlaneNormal.Normalize();
_arg1.m_localPoint.SetV(_local27);
_arg1.m_points[0].m_localPoint.SetV(_arg4.m_p);
_arg1.m_points[0].m_id.key = 0;
} else {
if (_local30 <= 0){
if ((((_local15 - _local28.x) * (_local15 - _local28.x)) + ((_local16 - _local28.y) * (_local16 - _local28.y))) > (_local20 * _local20)){
return;
};
_arg1.m_pointCount = 1;
_arg1.m_type = b2Manifold.e_faceA;
_arg1.m_localPlaneNormal.x = (_local15 - _local28.x);
_arg1.m_localPlaneNormal.y = (_local16 - _local28.y);
_arg1.m_localPlaneNormal.Normalize();
_arg1.m_localPoint.SetV(_local28);
_arg1.m_points[0].m_localPoint.SetV(_arg4.m_p);
_arg1.m_points[0].m_id.key = 0;
} else {
_local32 = (0.5 * (_local27.x + _local28.x));
_local33 = (0.5 * (_local27.y + _local28.y));
_local19 = (((_local15 - _local32) * _local23[_local25].x) + ((_local16 - _local33) * _local23[_local25].y));
if (_local19 > _local20){
return;
};
_arg1.m_pointCount = 1;
_arg1.m_type = b2Manifold.e_faceA;
_arg1.m_localPlaneNormal.x = _local23[_local25].x;
_arg1.m_localPlaneNormal.y = _local23[_local25].y;
_arg1.m_localPlaneNormal.Normalize();
_arg1.m_localPoint.Set(_local32, _local33);
_arg1.m_points[0].m_localPoint.SetV(_arg4.m_p);
_arg1.m_points[0].m_id.key = 0;
};
};
}
public static function TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2 = _arg2.lowerBound;
var _local4:b2Vec2 = _arg1.upperBound;
var _local5:Number = (_local3.x - _local4.x);
var _local6:Number = (_local3.y - _local4.y);
_local3 = _arg1.lowerBound;
_local4 = _arg2.upperBound;
var _local7:Number = (_local3.x - _local4.x);
var _local8:Number = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
}
}//package Box2D.Collision
Section 16
//b2ContactID (Box2D.Collision.b2ContactID)
package Box2D.Collision {
import Box2D.Common.*;
public class b2ContactID {
public var features:Features;
b2internal var _key:uint;
public function b2ContactID(){
features = new Features();
super();
features._m_id = this;
}
public function Set(_arg1:b2ContactID):void{
key = _arg1._key;
}
public function Copy():b2ContactID{
var _local1:b2ContactID = new b2ContactID();
_local1.key = key;
return (_local1);
}
public function get key():uint{
return (_key);
}
public function set key(_arg1:uint):void{
_key = _arg1;
features._referenceEdge = (_key & 0xFF);
features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF);
features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF);
features._flip = (((_key & 4278190080) >> 24) & 0xFF);
}
}
}//package Box2D.Collision
Section 17
//b2ContactPoint (Box2D.Collision.b2ContactPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2ContactPoint {
public var shape1:b2Shape;
public var shape2:b2Shape;
public var position:b2Vec2;
public var velocity:b2Vec2;
public var normal:b2Vec2;
public var separation:Number;
public var friction:Number;
public var restitution:Number;
public var id:b2ContactID;
public function b2ContactPoint(){
position = new b2Vec2();
velocity = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 18
//b2Distance (Box2D.Collision.b2Distance)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Distance {
private static var b2_gjkCalls:int;
private static var b2_gjkIters:int;
private static var b2_gjkMaxIters:int;
private static var s_simplex:b2Simplex = new b2Simplex();
private static var s_saveA:Array = new Array(3);
private static var s_saveB:Array = new Array(3);
public static function Distance(_arg1:b2DistanceOutput, _arg2:b2SimplexCache, _arg3:b2DistanceInput):void{
var _local17:int;
var _local18:b2Vec2;
var _local20:b2Vec2;
var _local21:b2SimplexVertex;
var _local22:Boolean;
var _local23:Number;
var _local24:Number;
var _local25:b2Vec2;
b2_gjkCalls++;
var _local4:b2DistanceProxy = _arg3.proxyA;
var _local5:b2DistanceProxy = _arg3.proxyB;
var _local6:b2Transform = _arg3.transformA;
var _local7:b2Transform = _arg3.transformB;
var _local8:b2Simplex = s_simplex;
_local8.ReadCache(_arg2, _local4, _local6, _local5, _local7);
var _local9:Array = _local8.m_vertices;
var _local10 = 20;
var _local11:Array = s_saveA;
var _local12:Array = s_saveB;
var _local13:int;
var _local14:b2Vec2 = _local8.GetClosestPoint();
var _local15:Number = _local14.LengthSquared();
var _local16:Number = _local15;
var _local19:int;
while (_local19 < _local10) {
_local13 = _local8.m_count;
_local17 = 0;
while (_local17 < _local13) {
_local11[_local17] = _local9[_local17].indexA;
_local12[_local17] = _local9[_local17].indexB;
_local17++;
};
switch (_local8.m_count){
case 1:
break;
case 2:
_local8.Solve2();
break;
case 3:
_local8.Solve3();
break;
default:
b2Settings.b2Assert(false);
};
if (_local8.m_count == 3){
break;
};
_local18 = _local8.GetClosestPoint();
_local16 = _local18.LengthSquared();
if (_local16 > _local15){
};
_local15 = _local16;
_local20 = _local8.GetSearchDirection();
if (_local20.LengthSquared() < (Number.MIN_VALUE * Number.MIN_VALUE)){
break;
};
_local21 = _local9[_local8.m_count];
_local21.indexA = _local4.GetSupport(b2Math.MulTMV(_local6.R, _local20.GetNegative()));
_local21.wA = b2Math.MulX(_local6, _local4.GetVertex(_local21.indexA));
_local21.indexB = _local5.GetSupport(b2Math.MulTMV(_local7.R, _local20));
_local21.wB = b2Math.MulX(_local7, _local5.GetVertex(_local21.indexB));
_local21.w = b2Math.SubtractVV(_local21.wB, _local21.wA);
_local19++;
b2_gjkIters++;
_local22 = false;
_local17 = 0;
while (_local17 < _local13) {
if ((((_local21.indexA == _local11[_local17])) && ((_local21.indexB == _local12[_local17])))){
_local22 = true;
break;
};
_local17++;
};
if (_local22){
break;
};
_local8.m_count++;
};
b2_gjkMaxIters = b2Math.Max(b2_gjkMaxIters, _local19);
_local8.GetWitnessPoints(_arg1.pointA, _arg1.pointB);
_arg1.distance = b2Math.SubtractVV(_arg1.pointA, _arg1.pointB).Length();
_arg1.iterations = _local19;
_local8.WriteCache(_arg2);
if (_arg3.useRadii){
_local23 = _local4.m_radius;
_local24 = _local5.m_radius;
if ((((_arg1.distance > (_local23 + _local24))) && ((_arg1.distance > Number.MIN_VALUE)))){
_arg1.distance = (_arg1.distance - (_local23 + _local24));
_local25 = b2Math.SubtractVV(_arg1.pointB, _arg1.pointA);
_local25.Normalize();
_arg1.pointA.x = (_arg1.pointA.x + (_local23 * _local25.x));
_arg1.pointA.y = (_arg1.pointA.y + (_local23 * _local25.y));
_arg1.pointB.x = (_arg1.pointB.x - (_local24 * _local25.x));
_arg1.pointB.y = (_arg1.pointB.y - (_local24 * _local25.y));
} else {
_local18 = new b2Vec2();
_local18.x = (0.5 * (_arg1.pointA.x + _arg1.pointB.x));
_local18.y = (0.5 * (_arg1.pointA.y + _arg1.pointB.y));
_arg1.pointA.x = (_arg1.pointB.x = _local18.x);
_arg1.pointA.y = (_arg1.pointB.y = _local18.y);
_arg1.distance = 0;
};
};
}
}
}//package Box2D.Collision
Section 19
//b2DistanceInput (Box2D.Collision.b2DistanceInput)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2DistanceInput {
public var proxyA:b2DistanceProxy;
public var proxyB:b2DistanceProxy;
public var transformA:b2Transform;
public var transformB:b2Transform;
public var useRadii:Boolean;
}
}//package Box2D.Collision
Section 20
//b2DistanceOutput (Box2D.Collision.b2DistanceOutput)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2DistanceOutput {
public var pointA:b2Vec2;
public var pointB:b2Vec2;
public var distance:Number;
public var iterations:int;
public function b2DistanceOutput(){
pointA = new b2Vec2();
pointB = new b2Vec2();
super();
}
}
}//package Box2D.Collision
Section 21
//b2DistanceProxy (Box2D.Collision.b2DistanceProxy)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2DistanceProxy {
public var m_vertices:Array;
public var m_count:int;
public var m_radius:Number;
public function Set(_arg1:b2Shape):void{
var _local2:b2CircleShape;
var _local3:b2PolygonShape;
switch (_arg1.GetType()){
case b2Shape.e_circleShape:
_local2 = (_arg1 as b2CircleShape);
m_vertices = new Array(1, true);
m_vertices[0] = _local2.m_p;
m_count = 1;
m_radius = _local2.m_radius;
break;
case b2Shape.e_polygonShape:
_local3 = (_arg1 as b2PolygonShape);
m_vertices = _local3.m_vertices;
m_count = _local3.m_vertexCount;
m_radius = _local3.m_radius;
break;
default:
b2Settings.b2Assert(false);
};
}
public function GetSupport(_arg1:b2Vec2):Number{
var _local5:Number;
var _local2:int;
var _local3:Number = ((m_vertices[0].x * _arg1.x) + (m_vertices[0].y * _arg1.y));
var _local4 = 1;
while (_local4 < m_count) {
_local5 = ((m_vertices[_local4].x * _arg1.x) + (m_vertices[_local4].y * _arg1.y));
if (_local5 > _local3){
_local2 = _local4;
_local3 = _local5;
};
_local4++;
};
return (_local2);
}
public function GetSupportVertex(_arg1:b2Vec2):b2Vec2{
var _local5:Number;
var _local2:int;
var _local3:Number = ((m_vertices[0].x * _arg1.x) + (m_vertices[0].y * _arg1.y));
var _local4 = 1;
while (_local4 < m_count) {
_local5 = ((m_vertices[_local4].x * _arg1.x) + (m_vertices[_local4].y * _arg1.y));
if (_local5 > _local3){
_local2 = _local4;
_local3 = _local5;
};
_local4++;
};
return (m_vertices[_local2]);
}
public function GetVertexCount():int{
return (m_count);
}
public function GetVertex(_arg1:int):b2Vec2{
b2Settings.b2Assert((((0 <= _arg1)) && ((_arg1 < m_count))));
return (m_vertices[_arg1]);
}
}
}//package Box2D.Collision
Section 22
//b2DynamicTree (Box2D.Collision.b2DynamicTree)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2DynamicTree {
private var m_root:b2DynamicTreeNode;
private var m_freeList:b2DynamicTreeNode;
private var m_path:uint;
private var m_insertionCount:int;
public function b2DynamicTree(){
m_root = null;
m_freeList = null;
m_path = 0;
m_insertionCount = 0;
}
public function CreateProxy(_arg1:b2AABB, _arg2):b2DynamicTreeNode{
var _local3:b2DynamicTreeNode;
var _local4:Number;
var _local5:Number;
_local3 = AllocateNode();
_local4 = b2Settings.b2_aabbExtension;
_local5 = b2Settings.b2_aabbExtension;
_local3.aabb.lowerBound.x = (_arg1.lowerBound.x - _local4);
_local3.aabb.lowerBound.y = (_arg1.lowerBound.y - _local5);
_local3.aabb.upperBound.x = (_arg1.upperBound.x + _local4);
_local3.aabb.upperBound.y = (_arg1.upperBound.y + _local5);
_local3.userData = _arg2;
InsertLeaf(_local3);
return (_local3);
}
public function DestroyProxy(_arg1:b2DynamicTreeNode):void{
RemoveLeaf(_arg1);
FreeNode(_arg1);
}
public function MoveProxy(_arg1:b2DynamicTreeNode, _arg2:b2AABB, _arg3:b2Vec2):Boolean{
var _local4:Number;
var _local5:Number;
b2Settings.b2Assert(_arg1.IsLeaf());
if (_arg1.aabb.Contains(_arg2)){
return (false);
};
RemoveLeaf(_arg1);
_local4 = (b2Settings.b2_aabbExtension + (b2Settings.b2_aabbMultiplier * ((_arg3.x > 0)) ? _arg3.x : -(_arg3.x)));
_local5 = (b2Settings.b2_aabbExtension + (b2Settings.b2_aabbMultiplier * ((_arg3.y > 0)) ? _arg3.y : -(_arg3.y)));
_arg1.aabb.lowerBound.x = (_arg2.lowerBound.x - _local4);
_arg1.aabb.lowerBound.y = (_arg2.lowerBound.y - _local5);
_arg1.aabb.upperBound.x = (_arg2.upperBound.x + _local4);
_arg1.aabb.upperBound.y = (_arg2.upperBound.y + _local5);
InsertLeaf(_arg1);
return (true);
}
public function Rebalance(_arg1:int):void{
var _local3:b2DynamicTreeNode;
var _local4:uint;
if (m_root == null){
return;
};
var _local2:int;
while (_local2 < _arg1) {
_local3 = m_root;
_local4 = 0;
while (_local3.IsLeaf() == false) {
_local3 = (((m_path >> _local4) & 1)) ? _local3.child2 : _local3.child1;
_local4 = ((_local4 + 1) & 31);
};
m_path++;
RemoveLeaf(_local3);
InsertLeaf(_local3);
_local2++;
};
}
public function GetFatAABB(_arg1:b2DynamicTreeNode):b2AABB{
return (_arg1.aabb);
}
public function GetUserData(_arg1:b2DynamicTreeNode){
return (_arg1.userData);
}
public function Query(_arg1:Function, _arg2:b2AABB):void{
var _local5:b2DynamicTreeNode;
var _local6:Boolean;
if (m_root == null){
return;
};
var _local3:Array = new Array();
var _local4:int;
var _temp1 = _local4;
_local4 = (_local4 + 1);
var _local7 = _temp1;
_local3[_local7] = m_root;
while (_local4 > 0) {
--_local4;
_local5 = _local3[_local4];
if (_local5.aabb.TestOverlap(_arg2)){
if (_local5.IsLeaf()){
_local6 = _arg1(_local5);
if (!_local6){
return;
};
} else {
var _temp2 = _local4;
_local4 = (_local4 + 1);
var _local8 = _temp2;
_local3[_local8] = _local5.child1;
var _temp3 = _local4;
_local4 = (_local4 + 1);
var _local9 = _temp3;
_local3[_local9] = _local5.child2;
};
};
};
}
public function RayCast(_arg1:Function, _arg2:b2RayCastInput):void{
var _local3:b2Vec2;
var _local9:b2AABB;
var _local10:Number;
var _local11:Number;
var _local14:b2DynamicTreeNode;
var _local15:b2Vec2;
var _local16:b2Vec2;
var _local17:Number;
var _local18:b2RayCastInput;
if (m_root == null){
return;
};
_local3 = _arg2.p1;
var _local4:b2Vec2 = _arg2.p2;
var _local5:b2Vec2 = b2Math.SubtractVV(_local3, _local4);
_local5.Normalize();
var _local6:b2Vec2 = b2Math.CrossFV(1, _local5);
var _local7:b2Vec2 = b2Math.AbsV(_local6);
var _local8:Number = _arg2.maxFraction;
_local9 = new b2AABB();
_local10 = (_local3.x + (_local8 * (_local4.x - _local3.x)));
_local11 = (_local3.y + (_local8 * (_local4.y - _local3.y)));
_local9.lowerBound.x = Math.min(_local3.x, _local10);
_local9.lowerBound.y = Math.min(_local3.y, _local11);
_local9.upperBound.x = Math.max(_local3.x, _local10);
_local9.upperBound.y = Math.max(_local3.y, _local11);
var _local12:Array = new Array();
var _local13:int;
var _temp1 = _local13;
_local13 = (_local13 + 1);
var _local19 = _temp1;
_local12[_local19] = m_root;
while (_local13 > 0) {
--_local13;
_local14 = _local12[_local13];
if (_local14.aabb.TestOverlap(_local9) == false){
} else {
_local15 = _local14.aabb.GetCenter();
_local16 = _local14.aabb.GetExtents();
_local17 = ((Math.abs(((_local6.x * (_local3.x - _local15.x)) + (_local6.y * (_local3.y - _local15.y)))) - (_local7.x * _local16.x)) - (_local7.y * _local16.y));
if (_local17 > 0){
} else {
if (_local14.IsLeaf()){
_local18 = new b2RayCastInput();
_local18.p1 = _arg2.p1;
_local18.p2 = _arg2.p2;
_local18.maxFraction = _arg2.maxFraction;
_local8 = _arg1(_local18, _local14);
if (_local8 == 0){
return;
};
_local10 = (_local3.x + (_local8 * (_local4.x - _local3.x)));
_local11 = (_local3.y + (_local8 * (_local4.y - _local3.y)));
_local9.lowerBound.x = Math.min(_local3.x, _local10);
_local9.lowerBound.y = Math.min(_local3.y, _local11);
_local9.upperBound.x = Math.max(_local3.x, _local10);
_local9.upperBound.y = Math.max(_local3.y, _local11);
} else {
var _temp2 = _local13;
_local13 = (_local13 + 1);
var _local20 = _temp2;
_local12[_local20] = _local14.child1;
var _temp3 = _local13;
_local13 = (_local13 + 1);
var _local21 = _temp3;
_local12[_local21] = _local14.child2;
};
};
};
};
}
private function AllocateNode():b2DynamicTreeNode{
var _local1:b2DynamicTreeNode;
if (m_freeList){
_local1 = m_freeList;
m_freeList = _local1.parent;
_local1.parent = null;
_local1.child1 = null;
_local1.child2 = null;
return (_local1);
};
return (new b2DynamicTreeNode());
}
private function FreeNode(_arg1:b2DynamicTreeNode):void{
_arg1.parent = m_freeList;
m_freeList = _arg1;
}
private function InsertLeaf(_arg1:b2DynamicTreeNode):void{
var _local6:b2DynamicTreeNode;
var _local7:b2DynamicTreeNode;
var _local8:Number;
var _local9:Number;
m_insertionCount++;
if (m_root == null){
m_root = _arg1;
m_root.parent = null;
return;
};
var _local2:b2Vec2 = _arg1.aabb.GetCenter();
var _local3:b2DynamicTreeNode = m_root;
if (_local3.IsLeaf() == false){
do {
_local6 = _local3.child1;
_local7 = _local3.child2;
_local8 = (Math.abs((((_local6.aabb.lowerBound.x + _local6.aabb.upperBound.x) / 2) - _local2.x)) + Math.abs((((_local6.aabb.lowerBound.y + _local6.aabb.upperBound.y) / 2) - _local2.y)));
_local9 = (Math.abs((((_local7.aabb.lowerBound.x + _local7.aabb.upperBound.x) / 2) - _local2.x)) + Math.abs((((_local7.aabb.lowerBound.y + _local7.aabb.upperBound.y) / 2) - _local2.y)));
if (_local8 < _local9){
_local3 = _local6;
} else {
_local3 = _local7;
};
} while (_local3.IsLeaf() == false);
};
var _local4:b2DynamicTreeNode = _local3.parent;
var _local5:b2DynamicTreeNode = AllocateNode();
_local5.parent = _local4;
_local5.userData = null;
_local5.aabb.Combine(_arg1.aabb, _local3.aabb);
if (_local4){
if (_local3.parent.child1 == _local3){
_local4.child1 = _local5;
} else {
_local4.child2 = _local5;
};
_local5.child1 = _local3;
_local5.child2 = _arg1;
_local3.parent = _local5;
_arg1.parent = _local5;
do {
} while (!(_local4.aabb.Contains(_local5.aabb)));
} else {
_local5.child1 = _local3;
_local5.child2 = _arg1;
_local3.parent = _local5;
_arg1.parent = _local5;
m_root = _local5;
};
}
private function RemoveLeaf(_arg1:b2DynamicTreeNode):void{
var _local4:b2DynamicTreeNode;
var _local5:b2AABB;
if (_arg1 == m_root){
m_root = null;
return;
};
var _local2:b2DynamicTreeNode = _arg1.parent;
var _local3:b2DynamicTreeNode = _local2.parent;
if (_local2.child1 == _arg1){
_local4 = _local2.child2;
} else {
_local4 = _local2.child1;
};
if (_local3){
if (_local3.child1 == _local2){
_local3.child1 = _local4;
} else {
_local3.child2 = _local4;
};
_local4.parent = _local3;
FreeNode(_local2);
while (_local3) {
_local5 = _local3.aabb;
_local3.aabb = b2AABB.Combine(_local3.child1.aabb, _local3.child2.aabb);
if (_local5.Contains(_local3.aabb)){
break;
};
_local3 = _local3.parent;
};
} else {
m_root = _local4;
_local4.parent = null;
FreeNode(_local2);
};
}
}
}//package Box2D.Collision
Section 23
//b2DynamicTreeBroadPhase (Box2D.Collision.b2DynamicTreeBroadPhase)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2DynamicTreeBroadPhase implements IBroadPhase {
private var m_tree:b2DynamicTree;
private var m_proxyCount:int;
private var m_moveBuffer:Array;
private var m_pairBuffer:Array;
private var m_pairCount:int;// = 0
public function b2DynamicTreeBroadPhase(){
m_tree = new b2DynamicTree();
m_moveBuffer = new Array();
m_pairBuffer = new Array();
super();
}
public function CreateProxy(_arg1:b2AABB, _arg2){
var _local3:b2DynamicTreeNode = m_tree.CreateProxy(_arg1, _arg2);
m_proxyCount++;
BufferMove(_local3);
return (_local3);
}
public function DestroyProxy(_arg1):void{
UnBufferMove(_arg1);
m_proxyCount--;
m_tree.DestroyProxy(_arg1);
}
public function MoveProxy(_arg1, _arg2:b2AABB, _arg3:b2Vec2):void{
var _local4:Boolean = m_tree.MoveProxy(_arg1, _arg2, _arg3);
if (_local4){
BufferMove(_arg1);
};
}
public function TestOverlap(_arg1, _arg2):Boolean{
var _local3:b2AABB = m_tree.GetFatAABB(_arg1);
var _local4:b2AABB = m_tree.GetFatAABB(_arg2);
return (_local3.TestOverlap(_local4));
}
public function GetUserData(_arg1){
return (m_tree.GetUserData(_arg1));
}
public function GetFatAABB(_arg1):b2AABB{
return (m_tree.GetFatAABB(_arg1));
}
public function GetProxyCount():int{
return (m_proxyCount);
}
public function UpdatePairs(_arg1:Function):void{
var queryProxy:b2DynamicTreeNode;
var i:int;
var fatAABB:b2AABB;
var primaryPair:b2DynamicTreePair;
var userDataA:*;
var userDataB:*;
var pair:b2DynamicTreePair;
var callback = _arg1;
m_pairCount = 0;
for each (queryProxy in m_moveBuffer) {
var QueryCallback:Function = function (_arg1:b2DynamicTreeNode):Boolean{
if (_arg1 == queryProxy){
return (true);
};
if (m_pairCount == m_pairBuffer.length){
m_pairBuffer[m_pairCount] = new b2DynamicTreePair();
};
var _local2:b2DynamicTreePair = m_pairBuffer[m_pairCount];
_local2.proxyA = ((_arg1 < queryProxy)) ? _arg1 : queryProxy;
_local2.proxyB = ((_arg1 >= queryProxy)) ? _arg1 : queryProxy;
m_pairCount++;
return (true);
};
fatAABB = m_tree.GetFatAABB(queryProxy);
m_tree.Query(QueryCallback, fatAABB);
};
m_moveBuffer.length = 0;
i = 0;
while (i < m_pairCount) {
primaryPair = m_pairBuffer[i];
userDataA = m_tree.GetUserData(primaryPair.proxyA);
userDataB = m_tree.GetUserData(primaryPair.proxyB);
callback(userDataA, userDataB);
i = (i + 1);
while (i < m_pairCount) {
pair = m_pairBuffer[i];
if (((!((pair.proxyA == primaryPair.proxyA))) || (!((pair.proxyB == primaryPair.proxyB))))){
break;
};
i = (i + 1);
};
};
}
public function Query(_arg1:Function, _arg2:b2AABB):void{
m_tree.Query(_arg1, _arg2);
}
public function RayCast(_arg1:Function, _arg2:b2RayCastInput):void{
m_tree.RayCast(_arg1, _arg2);
}
public function Validate():void{
}
public function Rebalance(_arg1:int):void{
m_tree.Rebalance(_arg1);
}
private function BufferMove(_arg1:b2DynamicTreeNode):void{
m_moveBuffer[m_moveBuffer.length] = _arg1;
}
private function UnBufferMove(_arg1:b2DynamicTreeNode):void{
var _local2:int = m_moveBuffer.indexOf(_arg1);
m_moveBuffer.splice(_local2, 1);
}
private function ComparePairs(_arg1:b2DynamicTreePair, _arg2:b2DynamicTreePair):int{
return (0);
}
}
}//package Box2D.Collision
Section 24
//b2DynamicTreeNode (Box2D.Collision.b2DynamicTreeNode)
package Box2D.Collision {
public class b2DynamicTreeNode {
public var userData;
public var aabb:b2AABB;
public var parent:b2DynamicTreeNode;
public var child1:b2DynamicTreeNode;
public var child2:b2DynamicTreeNode;
public function b2DynamicTreeNode(){
aabb = new b2AABB();
super();
}
public function IsLeaf():Boolean{
return ((child1 == null));
}
}
}//package Box2D.Collision
Section 25
//b2DynamicTreePair (Box2D.Collision.b2DynamicTreePair)
package Box2D.Collision {
public class b2DynamicTreePair {
public var proxyA:b2DynamicTreeNode;
public var proxyB:b2DynamicTreeNode;
}
}//package Box2D.Collision
Section 26
//b2Manifold (Box2D.Collision.b2Manifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Manifold {
public var m_points:Array;
public var m_localPlaneNormal:b2Vec2;
public var m_localPoint:b2Vec2;
public var m_type:int;
public var m_pointCount:int;// = 0
public static const e_circles:int = 1;
public static const e_faceA:int = 2;
public static const e_faceB:int = 4;
public function b2Manifold(){
m_points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
m_points[_local1] = new b2ManifoldPoint();
_local1++;
};
m_localPlaneNormal = new b2Vec2();
m_localPoint = new b2Vec2();
}
public function Reset():void{
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(m_points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
m_localPlaneNormal.SetZero();
m_localPoint.SetZero();
m_type = 0;
m_pointCount = 0;
}
public function Set(_arg1:b2Manifold):void{
m_pointCount = _arg1.m_pointCount;
var _local2:int;
while (_local2 < b2Settings.b2_maxManifoldPoints) {
(m_points[_local2] as b2ManifoldPoint).Set(_arg1.m_points[_local2]);
_local2++;
};
m_localPlaneNormal.SetV(_arg1.m_localPlaneNormal);
m_localPoint.SetV(_arg1.m_localPoint);
m_type = _arg1.m_type;
}
public function Copy():b2Manifold{
var _local1:b2Manifold = new b2Manifold();
_local1.Set(this);
return (_local1);
}
}
}//package Box2D.Collision
Section 27
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2ManifoldPoint {
public var m_localPoint:b2Vec2;
public var m_normalImpulse:Number;
public var m_tangentImpulse:Number;
public var m_id:b2ContactID;
public function b2ManifoldPoint(){
m_localPoint = new b2Vec2();
m_id = new b2ContactID();
super();
Reset();
}
public function Reset():void{
m_localPoint.SetZero();
m_normalImpulse = 0;
m_tangentImpulse = 0;
m_id.key = 0;
}
public function Set(_arg1:b2ManifoldPoint):void{
m_localPoint.SetV(_arg1.m_localPoint);
m_normalImpulse = _arg1.m_normalImpulse;
m_tangentImpulse = _arg1.m_tangentImpulse;
m_id.Set(_arg1.m_id);
}
}
}//package Box2D.Collision
Section 28
//b2OBB (Box2D.Collision.b2OBB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2OBB {
public var R:b2Mat22;
public var center:b2Vec2;
public var extents:b2Vec2;
public function b2OBB(){
R = new b2Mat22();
center = new b2Vec2();
extents = new b2Vec2();
super();
}
}
}//package Box2D.Collision
Section 29
//b2RayCastInput (Box2D.Collision.b2RayCastInput)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2RayCastInput {
public var p1:b2Vec2;
public var p2:b2Vec2;
public var maxFraction:Number;
public function b2RayCastInput(_arg1:b2Vec2=null, _arg2:b2Vec2=null, _arg3:Number=1){
p1 = new b2Vec2();
p2 = new b2Vec2();
super();
if (_arg1){
this.p1.SetV(_arg1);
};
if (_arg2){
this.p2.SetV(_arg2);
};
this.maxFraction = _arg3;
}
}
}//package Box2D.Collision
Section 30
//b2RayCastOutput (Box2D.Collision.b2RayCastOutput)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2RayCastOutput {
public var normal:b2Vec2;
public var fraction:Number;
public function b2RayCastOutput(){
normal = new b2Vec2();
super();
}
}
}//package Box2D.Collision
Section 31
//b2SeparationFunction (Box2D.Collision.b2SeparationFunction)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
class b2SeparationFunction {
public var m_proxyA:b2DistanceProxy;
public var m_proxyB:b2DistanceProxy;
public var m_type:int;
public var m_localPoint:b2Vec2;
public var m_axis:b2Vec2;
public static const e_points:int = 1;
public static const e_faceA:int = 2;
public static const e_faceB:int = 4;
function b2SeparationFunction(){
m_localPoint = new b2Vec2();
m_axis = new b2Vec2();
super();
}
public function Initialize(_arg1:b2SimplexCache, _arg2:b2DistanceProxy, _arg3:b2Transform, _arg4:b2DistanceProxy, _arg5:b2Transform):void{
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:b2Mat22;
var _local20:b2Vec2;
var _local21:Number;
var _local22:Number;
var _local23:b2Vec2;
var _local24:b2Vec2;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:Number;
var _local28:Number;
var _local29:b2Vec2;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
m_proxyA = _arg2;
m_proxyB = _arg4;
var _local6:int = _arg1.count;
b2Settings.b2Assert((((0 < _local6)) && ((_local6 < 3))));
if (_local6 == 1){
m_type = e_points;
_local7 = m_proxyA.GetVertex(_arg1.indexA[0]);
_local10 = m_proxyB.GetVertex(_arg1.indexB[0]);
_local20 = _local7;
_local19 = _arg3.R;
_local13 = (_arg3.position.x + ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y)));
_local14 = (_arg3.position.y + ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y)));
_local20 = _local10;
_local19 = _arg5.R;
_local15 = (_arg5.position.x + ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y)));
_local16 = (_arg5.position.y + ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y)));
m_axis.x = (_local15 - _local13);
m_axis.y = (_local16 - _local14);
m_axis.Normalize();
} else {
if (_arg1.indexB[0] == _arg1.indexB[1]){
m_type = e_faceA;
_local8 = m_proxyA.GetVertex(_arg1.indexA[0]);
_local9 = m_proxyA.GetVertex(_arg1.indexA[1]);
_local10 = m_proxyB.GetVertex(_arg1.indexB[0]);
m_localPoint.x = (0.5 * (_local8.x + _local9.x));
m_localPoint.y = (0.5 * (_local8.y + _local9.y));
m_axis = b2Math.CrossVF(b2Math.SubtractVV(_local9, _local8), 1);
m_axis.Normalize();
_local20 = m_axis;
_local19 = _arg3.R;
_local17 = ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y));
_local18 = ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y));
_local20 = m_localPoint;
_local19 = _arg3.R;
_local13 = (_arg3.position.x + ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y)));
_local14 = (_arg3.position.y + ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y)));
_local20 = _local10;
_local19 = _arg5.R;
_local15 = (_arg5.position.x + ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y)));
_local16 = (_arg5.position.y + ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y)));
_local21 = (((_local15 - _local13) * _local17) + ((_local16 - _local14) * _local18));
if (_local21 < 0){
m_axis.NegativeSelf();
};
} else {
if (_arg1.indexA[0] == _arg1.indexA[0]){
m_type = e_faceB;
_local11 = m_proxyB.GetVertex(_arg1.indexB[0]);
_local12 = m_proxyB.GetVertex(_arg1.indexB[1]);
_local7 = m_proxyA.GetVertex(_arg1.indexA[0]);
m_localPoint.x = (0.5 * (_local11.x + _local12.x));
m_localPoint.y = (0.5 * (_local11.y + _local12.y));
m_axis = b2Math.CrossVF(b2Math.SubtractVV(_local12, _local11), 1);
m_axis.Normalize();
_local20 = m_axis;
_local19 = _arg5.R;
_local17 = ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y));
_local18 = ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y));
_local20 = m_localPoint;
_local19 = _arg5.R;
_local15 = (_arg5.position.x + ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y)));
_local16 = (_arg5.position.y + ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y)));
_local20 = _local7;
_local19 = _arg3.R;
_local13 = (_arg3.position.x + ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y)));
_local14 = (_arg3.position.y + ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y)));
_local21 = (((_local13 - _local15) * _local17) + ((_local14 - _local16) * _local18));
if (_local21 < 0){
m_axis.NegativeSelf();
};
} else {
_local8 = m_proxyA.GetVertex(_arg1.indexA[0]);
_local9 = m_proxyA.GetVertex(_arg1.indexA[1]);
_local11 = m_proxyB.GetVertex(_arg1.indexB[0]);
_local12 = m_proxyB.GetVertex(_arg1.indexB[1]);
_local23 = b2Math.MulX(_arg3, _local7);
_local24 = b2Math.MulMV(_arg3.R, b2Math.SubtractVV(_local9, _local8));
_local25 = b2Math.MulX(_arg5, _local10);
_local26 = b2Math.MulMV(_arg5.R, b2Math.SubtractVV(_local12, _local11));
_local27 = ((_local24.x * _local24.x) + (_local24.y * _local24.y));
_local28 = ((_local26.x * _local26.x) + (_local26.y * _local26.y));
_local29 = b2Math.SubtractVV(_local26, _local24);
_local30 = ((_local24.x * _local29.x) + (_local24.y * _local29.y));
_local31 = ((_local26.x * _local29.x) + (_local26.y * _local29.y));
_local32 = ((_local24.x * _local26.x) + (_local24.y * _local26.y));
_local33 = ((_local27 * _local28) - (_local32 * _local32));
_local21 = 0;
if (_local33 != 0){
_local21 = b2Math.Clamp((((_local32 * _local31) - (_local30 * _local28)) / _local33), 0, 1);
};
_local34 = (((_local32 * _local21) + _local31) / _local28);
if (_local34 < 0){
_local34 = 0;
_local21 = b2Math.Clamp(((_local32 - _local30) / _local27), 0, 1);
};
_local7 = new b2Vec2();
_local7.x = (_local8.x + (_local21 * (_local9.x - _local8.x)));
_local7.y = (_local8.y + (_local21 * (_local9.y - _local8.y)));
_local10 = new b2Vec2();
_local10.x = (_local11.x + (_local21 * (_local12.x - _local11.x)));
_local10.y = (_local11.y + (_local21 * (_local12.y - _local11.y)));
if ((((_local21 == 0)) || ((_local21 == 1)))){
m_type = e_faceB;
m_axis = b2Math.CrossVF(b2Math.SubtractVV(_local12, _local11), 1);
m_axis.Normalize();
m_localPoint = _local10;
_local20 = m_axis;
_local19 = _arg5.R;
_local17 = ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y));
_local18 = ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y));
_local20 = m_localPoint;
_local19 = _arg5.R;
_local15 = (_arg5.position.x + ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y)));
_local16 = (_arg5.position.y + ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y)));
_local20 = _local7;
_local19 = _arg3.R;
_local13 = (_arg3.position.x + ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y)));
_local14 = (_arg3.position.y + ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y)));
_local22 = (((_local13 - _local15) * _local17) + ((_local14 - _local16) * _local18));
if (_local21 < 0){
m_axis.NegativeSelf();
};
} else {
m_type = e_faceA;
m_axis = b2Math.CrossVF(b2Math.SubtractVV(_local9, _local8), 1);
m_localPoint = _local7;
_local20 = m_axis;
_local19 = _arg3.R;
_local17 = ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y));
_local18 = ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y));
_local20 = m_localPoint;
_local19 = _arg3.R;
_local13 = (_arg3.position.x + ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y)));
_local14 = (_arg3.position.y + ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y)));
_local20 = _local10;
_local19 = _arg5.R;
_local15 = (_arg5.position.x + ((_local19.col1.x * _local20.x) + (_local19.col2.x * _local20.y)));
_local16 = (_arg5.position.y + ((_local19.col1.y * _local20.x) + (_local19.col2.y * _local20.y)));
_local22 = (((_local15 - _local13) * _local17) + ((_local16 - _local14) * _local18));
if (_local21 < 0){
m_axis.NegativeSelf();
};
};
};
};
};
}
public function Evaluate(_arg1:b2Transform, _arg2:b2Transform):Number{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2Vec2;
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:Number;
var _local10:b2Vec2;
switch (m_type){
case e_points:
_local3 = b2Math.MulTMV(_arg1.R, m_axis);
_local4 = b2Math.MulTMV(_arg2.R, m_axis.GetNegative());
_local5 = m_proxyA.GetSupportVertex(_local3);
_local6 = m_proxyB.GetSupportVertex(_local4);
_local7 = b2Math.MulX(_arg1, _local5);
_local8 = b2Math.MulX(_arg2, _local6);
_local9 = (((_local8.x - _local7.x) * m_axis.x) + ((_local8.y - _local7.y) * m_axis.y));
return (_local9);
case e_faceA:
_local10 = b2Math.MulMV(_arg1.R, m_axis);
_local7 = b2Math.MulX(_arg1, m_localPoint);
_local4 = b2Math.MulTMV(_arg2.R, _local10.GetNegative());
_local6 = m_proxyB.GetSupportVertex(_local4);
_local8 = b2Math.MulX(_arg2, _local6);
_local9 = (((_local8.x - _local7.x) * _local10.x) + ((_local8.y - _local7.y) * _local10.y));
return (_local9);
case e_faceB:
_local10 = b2Math.MulMV(_arg2.R, m_axis);
_local8 = b2Math.MulX(_arg2, m_localPoint);
_local3 = b2Math.MulTMV(_arg1.R, _local10.GetNegative());
_local5 = m_proxyA.GetSupportVertex(_local3);
_local7 = b2Math.MulX(_arg1, _local5);
_local9 = (((_local7.x - _local8.x) * _local10.x) + ((_local7.y - _local8.y) * _local10.y));
return (_local9);
default:
b2Settings.b2Assert(false);
return (0);
};
}
}
}//package Box2D.Collision
Section 32
//b2Simplex (Box2D.Collision.b2Simplex)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
class b2Simplex {
public var m_v1:b2SimplexVertex;
public var m_v2:b2SimplexVertex;
public var m_v3:b2SimplexVertex;
public var m_vertices:Array;
public var m_count:int;
function b2Simplex(){
m_v1 = new b2SimplexVertex();
m_v2 = new b2SimplexVertex();
m_v3 = new b2SimplexVertex();
m_vertices = new Array(3);
super();
m_vertices[0] = m_v1;
m_vertices[1] = m_v2;
m_vertices[2] = m_v3;
}
public function ReadCache(_arg1:b2SimplexCache, _arg2:b2DistanceProxy, _arg3:b2Transform, _arg4:b2DistanceProxy, _arg5:b2Transform):void{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local10:b2SimplexVertex;
var _local11:Number;
var _local12:Number;
b2Settings.b2Assert((((0 <= _arg1.count)) && ((_arg1.count <= 3))));
m_count = _arg1.count;
var _local8:Array = m_vertices;
var _local9:int;
while (_local9 < m_count) {
_local10 = _local8[_local9];
_local10.indexA = _arg1.indexA[_local9];
_local10.indexB = _arg1.indexB[_local9];
_local6 = _arg2.GetVertex(_local10.indexA);
_local7 = _arg4.GetVertex(_local10.indexB);
_local10.wA = b2Math.MulX(_arg3, _local6);
_local10.wB = b2Math.MulX(_arg5, _local7);
_local10.w = b2Math.SubtractVV(_local10.wB, _local10.wA);
_local10.a = 0;
_local9++;
};
if (m_count > 1){
_local11 = _arg1.metric;
_local12 = GetMetric();
if ((((((_local12 < (0.5 * _local11))) || (((2 * _local11) < _local12)))) || ((_local12 < Number.MIN_VALUE)))){
m_count = 0;
};
};
if (m_count == 0){
_local10 = _local8[0];
_local10.indexA = 0;
_local10.indexB = 0;
_local6 = _arg2.GetVertex(0);
_local7 = _arg4.GetVertex(0);
_local10.wA = b2Math.MulX(_arg3, _local6);
_local10.wB = b2Math.MulX(_arg5, _local7);
_local10.w = b2Math.SubtractVV(_local10.wB, _local10.wA);
m_count = 1;
};
}
public function WriteCache(_arg1:b2SimplexCache):void{
_arg1.metric = GetMetric();
_arg1.count = uint(m_count);
var _local2:Array = m_vertices;
var _local3:int;
while (_local3 < m_count) {
_arg1.indexA[_local3] = uint(_local2[_local3].indexA);
_arg1.indexB[_local3] = uint(_local2[_local3].indexB);
_local3++;
};
}
public function GetSearchDirection():b2Vec2{
var _local1:b2Vec2;
var _local2:Number;
switch (m_count){
case 1:
return (m_v1.w.GetNegative());
case 2:
_local1 = b2Math.SubtractVV(m_v2.w, m_v1.w);
_local2 = b2Math.CrossVV(_local1, m_v1.w.GetNegative());
if (_local2 > 0){
return (b2Math.CrossFV(1, _local1));
};
return (b2Math.CrossVF(_local1, 1));
default:
b2Settings.b2Assert(false);
return (new b2Vec2());
};
}
public function GetClosestPoint():b2Vec2{
switch (m_count){
case 0:
b2Settings.b2Assert(false);
return (new b2Vec2());
case 1:
return (m_v1.w);
case 2:
return (new b2Vec2(((m_v1.a * m_v1.w.x) + (m_v2.a * m_v2.w.x)), ((m_v1.a * m_v1.w.y) + (m_v2.a * m_v2.w.y))));
default:
b2Settings.b2Assert(false);
return (new b2Vec2());
};
}
public function GetWitnessPoints(_arg1:b2Vec2, _arg2:b2Vec2):void{
switch (m_count){
case 0:
b2Settings.b2Assert(false);
break;
case 1:
_arg1.SetV(m_v1.wA);
_arg2.SetV(m_v1.wB);
break;
case 2:
_arg1.x = ((m_v1.a * m_v1.wA.x) + (m_v2.a * m_v2.wA.x));
_arg1.y = ((m_v1.a * m_v1.wA.y) + (m_v2.a * m_v2.wA.y));
_arg2.x = ((m_v1.a * m_v1.wB.x) + (m_v2.a * m_v2.wB.x));
_arg2.y = ((m_v1.a * m_v1.wB.y) + (m_v2.a * m_v2.wB.y));
break;
case 3:
_arg2.x = (_arg1.x = (((m_v1.a * m_v1.wA.x) + (m_v2.a * m_v2.wA.x)) + (m_v3.a * m_v3.wA.x)));
_arg2.y = (_arg1.y = (((m_v1.a * m_v1.wA.y) + (m_v2.a * m_v2.wA.y)) + (m_v3.a * m_v3.wA.y)));
break;
default:
b2Settings.b2Assert(false);
break;
};
}
public function GetMetric():Number{
switch (m_count){
case 0:
b2Settings.b2Assert(false);
return (0);
case 1:
return (0);
case 2:
return (b2Math.SubtractVV(m_v1.w, m_v2.w).Length());
case 3:
return (b2Math.CrossVV(b2Math.SubtractVV(m_v2.w, m_v1.w), b2Math.SubtractVV(m_v3.w, m_v1.w)));
default:
b2Settings.b2Assert(false);
return (0);
};
}
public function Solve2():void{
var _local1:b2Vec2 = m_v1.w;
var _local2:b2Vec2 = m_v2.w;
var _local3:b2Vec2 = b2Math.SubtractVV(_local2, _local1);
var _local4:Number = -(((_local1.x * _local3.x) + (_local1.y * _local3.y)));
if (_local4 <= 0){
m_v1.a = 1;
m_count = 1;
return;
};
var _local5:Number = ((_local2.x * _local3.x) + (_local2.y * _local3.y));
if (_local5 <= 0){
m_v2.a = 1;
m_count = 1;
m_v1.Set(m_v2);
return;
};
var _local6:Number = (1 / (_local5 + _local4));
m_v1.a = (_local5 * _local6);
m_v2.a = (_local4 * _local6);
m_count = 2;
}
public function Solve3():void{
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local1:b2Vec2 = m_v1.w;
var _local2:b2Vec2 = m_v2.w;
var _local3:b2Vec2 = m_v3.w;
var _local4:b2Vec2 = b2Math.SubtractVV(_local2, _local1);
var _local5:Number = b2Math.Dot(_local1, _local4);
var _local6:Number = b2Math.Dot(_local2, _local4);
var _local7:Number = _local6;
var _local8:Number = -(_local5);
var _local9:b2Vec2 = b2Math.SubtractVV(_local3, _local1);
var _local10:Number = b2Math.Dot(_local1, _local9);
var _local11:Number = b2Math.Dot(_local3, _local9);
var _local12:Number = _local11;
var _local13:Number = -(_local10);
var _local14:b2Vec2 = b2Math.SubtractVV(_local3, _local2);
var _local15:Number = b2Math.Dot(_local2, _local14);
var _local16:Number = b2Math.Dot(_local3, _local14);
var _local17:Number = _local16;
var _local18:Number = -(_local15);
var _local19:Number = b2Math.CrossVV(_local4, _local9);
var _local20:Number = (_local19 * b2Math.CrossVV(_local2, _local3));
var _local21:Number = (_local19 * b2Math.CrossVV(_local3, _local1));
var _local22:Number = (_local19 * b2Math.CrossVV(_local1, _local2));
if ((((_local8 <= 0)) && ((_local13 <= 0)))){
m_v1.a = 1;
m_count = 1;
return;
};
if ((((((_local7 > 0)) && ((_local8 > 0)))) && ((_local22 <= 0)))){
_local24 = (1 / (_local7 + _local8));
m_v1.a = (_local7 * _local24);
m_v2.a = (_local8 * _local24);
m_count = 2;
return;
};
if ((((((_local12 > 0)) && ((_local13 > 0)))) && ((_local21 <= 0)))){
_local25 = (1 / (_local12 + _local13));
m_v1.a = (_local12 * _local25);
m_v3.a = (_local13 * _local25);
m_count = 2;
m_v2.Set(m_v3);
return;
};
if ((((_local7 <= 0)) && ((_local18 <= 0)))){
m_v2.a = 1;
m_count = 1;
m_v1.Set(m_v2);
return;
};
if ((((_local12 <= 0)) && ((_local17 <= 0)))){
m_v3.a = 1;
m_count = 1;
m_v1.Set(m_v3);
return;
};
if ((((((_local17 > 0)) && ((_local18 > 0)))) && ((_local20 <= 0)))){
_local26 = (1 / (_local17 + _local18));
m_v2.a = (_local17 * _local26);
m_v3.a = (_local18 * _local26);
m_count = 2;
m_v1.Set(m_v3);
return;
};
var _local23:Number = (1 / ((_local20 + _local21) + _local22));
m_v1.a = (_local20 * _local23);
m_v2.a = (_local21 * _local23);
m_v3.a = (_local22 * _local23);
m_count = 3;
}
}
}//package Box2D.Collision
Section 33
//b2SimplexCache (Box2D.Collision.b2SimplexCache)
package Box2D.Collision {
public class b2SimplexCache {
public var metric:Number;
public var count:uint;
public var indexA:Array;
public var indexB:Array;
public function b2SimplexCache(){
indexA = new Array(3);
indexB = new Array(3);
super();
}
}
}//package Box2D.Collision
Section 34
//b2SimplexVertex (Box2D.Collision.b2SimplexVertex)
package Box2D.Collision {
import Box2D.Common.Math.*;
class b2SimplexVertex {
public var wA:b2Vec2;
public var wB:b2Vec2;
public var w:b2Vec2;
public var a:Number;
public var indexA:int;
public var indexB:int;
public function Set(_arg1:b2SimplexVertex):void{
wA.SetV(_arg1.wA);
wB.SetV(_arg1.wB);
w.SetV(_arg1.w);
a = _arg1.a;
indexA = _arg1.indexA;
indexB = _arg1.indexB;
}
}
}//package Box2D.Collision
Section 35
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2TimeOfImpact {
private static var b2_toiCalls:int = 0;
private static var b2_toiIters:int = 0;
private static var b2_toiMaxIters:int = 0;
private static var b2_toiRootIters:int = 0;
private static var b2_toiMaxRootIters:int = 0;
private static var s_cache:b2SimplexCache = new b2SimplexCache();
private static var s_distanceInput:b2DistanceInput = new b2DistanceInput();
private static var s_xfA:b2Transform = new b2Transform();
private static var s_xfB:b2Transform = new b2Transform();
private static var s_fcn:b2SeparationFunction = new b2SeparationFunction();
private static var s_distanceOutput:b2DistanceOutput = new b2DistanceOutput();
public static function TimeOfImpact(_arg1:b2TOIInput):Number{
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:Number;
b2_toiCalls++;
var _local2:b2DistanceProxy = _arg1.proxyA;
var _local3:b2DistanceProxy = _arg1.proxyB;
var _local4:b2Sweep = _arg1.sweepA;
var _local5:b2Sweep = _arg1.sweepB;
b2Settings.b2Assert((_local4.t0 == _local5.t0));
b2Settings.b2Assert(((1 - _local4.t0) > Number.MIN_VALUE));
var _local6:Number = (_local2.m_radius + _local3.m_radius);
var _local7:Number = _arg1.tolerance;
var _local8:Number = 0;
var _local9 = 1000;
var _local10:int;
var _local11:Number = 0;
s_cache.count = 0;
s_distanceInput.useRadii = false;
while (true) {
_local4.GetTransform(s_xfA, _local8);
_local5.GetTransform(s_xfB, _local8);
s_distanceInput.proxyA = _local2;
s_distanceInput.proxyB = _local3;
s_distanceInput.transformA = s_xfA;
s_distanceInput.transformB = s_xfB;
b2Distance.Distance(s_distanceOutput, s_cache, s_distanceInput);
if (s_distanceOutput.distance <= 0){
_local8 = 1;
break;
};
s_fcn.Initialize(s_cache, _local2, s_xfA, _local3, s_xfB);
_local12 = s_fcn.Evaluate(s_xfA, s_xfB);
if (_local12 <= 0){
_local8 = 1;
break;
};
if (_local10 == 0){
if (_local12 > _local6){
_local11 = b2Math.Max((_local6 - _local7), (0.75 * _local6));
} else {
_local11 = b2Math.Max((_local12 - _local7), (0.02 * _local6));
};
};
if ((_local12 - _local11) < (0.5 * _local7)){
if (_local10 == 0){
_local8 = 1;
break;
};
break;
};
_local13 = _local8;
_local14 = _local8;
_local15 = 1;
_local16 = _local12;
_local4.GetTransform(s_xfA, _local15);
_local5.GetTransform(s_xfB, _local15);
_local17 = s_fcn.Evaluate(s_xfA, s_xfB);
if (_local17 >= _local11){
_local8 = 1;
break;
};
_local18 = 0;
while (true) {
if ((_local18 & 1)){
_local19 = (_local14 + (((_local11 - _local16) * (_local15 - _local14)) / (_local17 - _local16)));
} else {
_local19 = (0.5 * (_local14 + _local15));
};
_local4.GetTransform(s_xfA, _local19);
_local5.GetTransform(s_xfB, _local19);
_local20 = s_fcn.Evaluate(s_xfA, s_xfB);
if (b2Math.Abs((_local20 - _local11)) < (0.025 * _local7)){
_local13 = _local19;
break;
};
if (_local20 > _local11){
_local14 = _local19;
_local16 = _local20;
} else {
_local15 = _local19;
_local17 = _local20;
};
_local18++;
b2_toiRootIters++;
if (_local18 == 50){
break;
};
};
b2_toiMaxRootIters = b2Math.Max(b2_toiMaxRootIters, _local18);
if (_local13 < ((1 + (100 * Number.MIN_VALUE)) * _local8)){
break;
};
_local8 = _local13;
_local10++;
b2_toiIters++;
if (_local10 == _local9){
break;
};
};
b2_toiMaxIters = b2Math.Max(b2_toiMaxIters, _local10);
return (_local8);
}
}
}//package Box2D.Collision
Section 36
//b2TOIInput (Box2D.Collision.b2TOIInput)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2TOIInput {
public var proxyA:b2DistanceProxy;
public var proxyB:b2DistanceProxy;
public var sweepA:b2Sweep;
public var sweepB:b2Sweep;
public var tolerance:Number;
public function b2TOIInput(){
proxyA = new b2DistanceProxy();
proxyB = new b2DistanceProxy();
sweepA = new b2Sweep();
sweepB = new b2Sweep();
super();
}
}
}//package Box2D.Collision
Section 37
//b2WorldManifold (Box2D.Collision.b2WorldManifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2WorldManifold {
public var m_normal:b2Vec2;
public var m_points:Array;
public function b2WorldManifold(){
m_normal = new b2Vec2();
super();
m_points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
m_points[_local1] = new b2Vec2();
_local1++;
};
}
public function Initialize(_arg1:b2Manifold, _arg2:b2Transform, _arg3:Number, _arg4:b2Transform, _arg5:Number):void{
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
if (_arg1.m_pointCount == 0){
return;
};
switch (_arg1.m_type){
case b2Manifold.e_circles:
_local8 = _arg2.R;
_local7 = _arg1.m_localPoint;
_local15 = ((_arg2.position.x + (_local8.col1.x * _local7.x)) + (_local8.col2.x * _local7.y));
_local16 = ((_arg2.position.y + (_local8.col1.y * _local7.x)) + (_local8.col2.y * _local7.y));
_local8 = _arg4.R;
_local7 = _arg1.m_points[0].m_localPoint;
_local17 = ((_arg4.position.x + (_local8.col1.x * _local7.x)) + (_local8.col2.x * _local7.y));
_local18 = ((_arg4.position.y + (_local8.col1.y * _local7.x)) + (_local8.col2.y * _local7.y));
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local21 = ((_local19 * _local19) + (_local20 * _local20));
if (_local21 > (Number.MIN_VALUE * Number.MIN_VALUE)){
_local26 = Math.sqrt(_local21);
m_normal.x = (_local19 / _local26);
m_normal.y = (_local20 / _local26);
} else {
m_normal.x = 1;
m_normal.y = 0;
};
_local22 = (_local15 + (_arg3 * m_normal.x));
_local23 = (_local16 + (_arg3 * m_normal.y));
_local24 = (_local17 - (_arg5 * m_normal.x));
_local25 = (_local18 - (_arg5 * m_normal.y));
m_points[0].x = (0.5 * (_local22 + _local24));
m_points[0].y = (0.5 * (_local23 + _local25));
break;
case b2Manifold.e_faceA:
_local8 = _arg2.R;
_local7 = _arg1.m_localPlaneNormal;
_local9 = ((_local8.col1.x * _local7.x) + (_local8.col2.x * _local7.y));
_local10 = ((_local8.col1.y * _local7.x) + (_local8.col2.y * _local7.y));
_local8 = _arg2.R;
_local7 = _arg1.m_localPoint;
_local11 = ((_arg2.position.x + (_local8.col1.x * _local7.x)) + (_local8.col2.x * _local7.y));
_local12 = ((_arg2.position.y + (_local8.col1.y * _local7.x)) + (_local8.col2.y * _local7.y));
m_normal.x = _local9;
m_normal.y = _local10;
_local6 = 0;
while (_local6 < _arg1.m_pointCount) {
_local8 = _arg4.R;
_local7 = _arg1.m_points[_local6].m_localPoint;
_local13 = ((_arg4.position.x + (_local8.col1.x * _local7.x)) + (_local8.col2.x * _local7.y));
_local14 = ((_arg4.position.y + (_local8.col1.y * _local7.x)) + (_local8.col2.y * _local7.y));
m_points[_local6].x = (_local13 + ((0.5 * (((_arg3 - ((_local13 - _local11) * _local9)) - ((_local14 - _local12) * _local10)) - _arg5)) * _local9));
m_points[_local6].y = (_local14 + ((0.5 * (((_arg3 - ((_local13 - _local11) * _local9)) - ((_local14 - _local12) * _local10)) - _arg5)) * _local10));
_local6++;
};
break;
case b2Manifold.e_faceB:
_local8 = _arg4.R;
_local7 = _arg1.m_localPlaneNormal;
_local9 = ((_local8.col1.x * _local7.x) + (_local8.col2.x * _local7.y));
_local10 = ((_local8.col1.y * _local7.x) + (_local8.col2.y * _local7.y));
_local8 = _arg4.R;
_local7 = _arg1.m_localPoint;
_local11 = ((_arg4.position.x + (_local8.col1.x * _local7.x)) + (_local8.col2.x * _local7.y));
_local12 = ((_arg4.position.y + (_local8.col1.y * _local7.x)) + (_local8.col2.y * _local7.y));
m_normal.x = -(_local9);
m_normal.y = -(_local10);
_local6 = 0;
while (_local6 < _arg1.m_pointCount) {
_local8 = _arg2.R;
_local7 = _arg1.m_points[_local6].m_localPoint;
_local13 = ((_arg2.position.x + (_local8.col1.x * _local7.x)) + (_local8.col2.x * _local7.y));
_local14 = ((_arg2.position.y + (_local8.col1.y * _local7.x)) + (_local8.col2.y * _local7.y));
m_points[_local6].x = (_local13 + ((0.5 * (((_arg5 - ((_local13 - _local11) * _local9)) - ((_local14 - _local12) * _local10)) - _arg3)) * _local9));
m_points[_local6].y = (_local14 + ((0.5 * (((_arg5 - ((_local13 - _local11) * _local9)) - ((_local14 - _local12) * _local10)) - _arg3)) * _local10));
_local6++;
};
break;
};
}
}
}//package Box2D.Collision
Section 38
//ClipVertex (Box2D.Collision.ClipVertex)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class ClipVertex {
public var v:b2Vec2;
public var id:b2ContactID;
public function ClipVertex(){
v = new b2Vec2();
id = new b2ContactID();
super();
}
public function Set(_arg1:ClipVertex):void{
v.SetV(_arg1.v);
id.Set(_arg1.id);
}
}
}//package Box2D.Collision
Section 39
//Features (Box2D.Collision.Features)
package Box2D.Collision {
import Box2D.Common.*;
public class Features {
b2internal var _referenceEdge:int;
b2internal var _incidentEdge:int;
b2internal var _incidentVertex:int;
b2internal var _flip:int;
b2internal var _m_id:b2ContactID;
public function get referenceEdge():int{
return (_referenceEdge);
}
public function set referenceEdge(_arg1:int):void{
_referenceEdge = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF));
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
public function get flip():int{
return (_flip);
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
}
}//package Box2D.Collision
Section 40
//IBroadPhase (Box2D.Collision.IBroadPhase)
package Box2D.Collision {
import Box2D.Common.Math.*;
public interface IBroadPhase {
function CreateProxy(_arg1:b2AABB, _arg2);
function DestroyProxy(_arg1):void;
function MoveProxy(_arg1, _arg2:b2AABB, _arg3:b2Vec2):void;
function TestOverlap(_arg1, _arg2):Boolean;
function GetUserData(_arg1);
function GetFatAABB(_arg1):b2AABB;
function GetProxyCount():int;
function UpdatePairs(_arg1:Function):void;
function Query(_arg1:Function, _arg2:b2AABB):void;
function RayCast(_arg1:Function, _arg2:b2RayCastInput):void;
function Validate():void;
function Rebalance(_arg1:int):void;
}
}//package Box2D.Collision
Section 41
//b2Mat22 (Box2D.Common.Math.b2Mat22)
package Box2D.Common.Math {
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(){
col1 = new b2Vec2();
col2 = new b2Vec2();
super();
col1.x = (col2.y = 1);
}
public function Set(_arg1:Number):void{
var _local2:Number;
_local2 = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function Copy():b2Mat22{
var _local1:b2Mat22 = new b2Mat22();
_local1.SetM(this);
return (_local1);
}
public function SetM(_arg1:b2Mat22):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function GetAngle():Number{
return (Math.atan2(col1.y, col1.x));
}
public function GetInverse(_arg1:b2Mat22):b2Mat22{
var _local3:Number;
var _local6:Number;
var _local2:Number = col1.x;
_local3 = col2.x;
var _local4:Number = col1.y;
var _local5:Number = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
if (_local6 != 0){
_local6 = (1 / _local6);
};
_arg1.col1.x = (_local6 * _local5);
_arg1.col2.x = (-(_local6) * _local3);
_arg1.col1.y = (-(_local6) * _local4);
_arg1.col2.y = (_local6 * _local2);
return (_arg1);
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number = col1.x;
var _local5:Number = col2.x;
var _local6:Number = col1.y;
var _local7:Number = col2.y;
var _local8:Number = ((_local4 * _local7) - (_local5 * _local6));
if (_local8 != 0){
_local8 = (1 / _local8);
};
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
public static function FromAngle(_arg1:Number):b2Mat22{
var _local2:b2Mat22 = new (b2Mat22);
_local2.Set(_arg1);
return (_local2);
}
public static function FromVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Mat22{
var _local3:b2Mat22 = new (b2Mat22);
_local3.SetVV(_arg1, _arg2);
return (_local3);
}
}
}//package Box2D.Common.Math
Section 42
//b2Mat33 (Box2D.Common.Math.b2Mat33)
package Box2D.Common.Math {
public class b2Mat33 {
public var col1:b2Vec3;
public var col2:b2Vec3;
public var col3:b2Vec3;
public function b2Mat33(_arg1:b2Vec3=null, _arg2:b2Vec3=null, _arg3:b2Vec3=null){
col1 = new b2Vec3();
col2 = new b2Vec3();
col3 = new b2Vec3();
super();
if (((((!(_arg1)) && (!(_arg2)))) && (!(_arg3)))){
col1.SetZero();
col2.SetZero();
col3.SetZero();
} else {
col1.SetV(_arg1);
col2.SetV(_arg2);
col3.SetV(_arg3);
};
}
public function SetVVV(_arg1:b2Vec3, _arg2:b2Vec3, _arg3:b2Vec3):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
col3.SetV(_arg3);
}
public function Copy():b2Mat33{
return (new b2Mat33(col1, col2, col3));
}
public function SetM(_arg1:b2Mat33):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
col3.SetV(_arg1.col3);
}
public function AddM(_arg1:b2Mat33):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col1.z = (col1.z + _arg1.col1.z);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
col2.z = (col2.z + _arg1.col2.z);
col3.x = (col3.x + _arg1.col3.x);
col3.y = (col3.y + _arg1.col3.y);
col3.z = (col3.z + _arg1.col3.z);
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col3.x = 0;
col1.y = 0;
col2.y = 1;
col3.y = 0;
col1.z = 0;
col2.z = 0;
col3.z = 1;
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col3.x = 0;
col1.y = 0;
col2.y = 0;
col3.y = 0;
col1.z = 0;
col2.z = 0;
col3.z = 0;
}
public function Solve22(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number;
var _local6:Number;
_local4 = col1.x;
var _local5:Number = col2.x;
_local6 = col1.y;
var _local7:Number = col2.y;
var _local8:Number = ((_local4 * _local7) - (_local5 * _local6));
if (_local8 != 0){
_local8 = (1 / _local8);
};
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
public function Solve33(_arg1:b2Vec3, _arg2:Number, _arg3:Number, _arg4:Number):b2Vec3{
var _local5:Number = col1.x;
var _local6:Number = col1.y;
var _local7:Number = col1.z;
var _local8:Number = col2.x;
var _local9:Number = col2.y;
var _local10:Number = col2.z;
var _local11:Number = col3.x;
var _local12:Number = col3.y;
var _local13:Number = col3.z;
var _local14:Number = (((_local5 * ((_local9 * _local13) - (_local10 * _local12))) + (_local6 * ((_local10 * _local11) - (_local8 * _local13)))) + (_local7 * ((_local8 * _local12) - (_local9 * _local11))));
if (_local14 != 0){
_local14 = (1 / _local14);
};
_arg1.x = (_local14 * (((_arg2 * ((_local9 * _local13) - (_local10 * _local12))) + (_arg3 * ((_local10 * _local11) - (_local8 * _local13)))) + (_arg4 * ((_local8 * _local12) - (_local9 * _local11)))));
_arg1.y = (_local14 * (((_local5 * ((_arg3 * _local13) - (_arg4 * _local12))) + (_local6 * ((_arg4 * _local11) - (_arg2 * _local13)))) + (_local7 * ((_arg2 * _local12) - (_arg3 * _local11)))));
_arg1.z = (_local14 * (((_local5 * ((_local9 * _arg4) - (_local10 * _arg3))) + (_local6 * ((_local10 * _arg2) - (_local8 * _arg4)))) + (_local7 * ((_local8 * _arg3) - (_local9 * _arg2)))));
return (_arg1);
}
}
}//package Box2D.Common.Math
Section 43
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0);
public static const b2Mat22_identity:b2Mat22 = b2Mat22.FromVV(new b2Vec2(1, 0), new b2Vec2(0, 1));
public static const b2Transform_identity:b2Transform = new b2Transform(b2Vec2_zero, b2Mat22_identity);
public static function IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
public static function MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(Dot(_arg2, _arg1.col1), Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function MulX(_arg1:b2Transform, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = MulMV(_arg1.R, _arg2);
_local3.x = (_local3.x + _arg1.position.x);
_local3.y = (_local3.y + _arg1.position.y);
return (_local3);
}
public static function MulXT(_arg1:b2Transform, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
_local3 = SubtractVV(_arg2, _arg1.position);
_local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y));
_local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y));
_local3.x = _local4;
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number = (_arg1.x - _arg2.x);
var _local4:Number = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number = (_arg1.x - _arg2.x);
var _local4:Number = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22 = b2Mat22.FromVV(AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22 = b2Mat22.FromVV(MulMV(_arg1, _arg2.col1), MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2 = new b2Vec2(Dot(_arg1.col1, _arg2.col1), Dot(_arg1.col2, _arg2.col1));
var _local4:b2Vec2 = new b2Vec2(Dot(_arg1.col1, _arg2.col2), Dot(_arg1.col2, _arg2.col2));
var _local5:b2Mat22 = b2Mat22.FromVV(_local3, _local4);
return (_local5);
}
public static function Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2 = new b2Vec2(Abs(_arg1.x), Abs(_arg1.y));
return (_local2);
}
public static function AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22 = b2Mat22.FromVV(AbsV(_arg1.col1), AbsV(_arg1.col2));
return (_local2);
}
public static function Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(Min(_arg1.x, _arg2.x), Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(Max(_arg1.x, _arg2.x), Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (((_arg1 < _arg2)) ? _arg2 : ((_arg1 > _arg3)) ? _arg3 : _arg1);
}
public static function ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (MaxV(_arg2, MinV(_arg1, _arg3)));
}
public static function Swap(_arg1:Array, _arg2:Array):void{
var _local3:* = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function Random():Number{
return (((Math.random() * 2) - 1));
}
public static function RandomRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
return (_local3);
}
public static function NextPowerOfTwo(_arg1:uint):uint{
_arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647));
_arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823));
_arg1 = (_arg1 | ((_arg1 >> 4) & 268435455));
_arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF));
_arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF));
return ((_arg1 + 1));
}
public static function IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
}
}//package Box2D.Common.Math
Section 44
//b2Sweep (Box2D.Common.Math.b2Sweep)
package Box2D.Common.Math {
public class b2Sweep {
public var localCenter:b2Vec2;
public var c0:b2Vec2;
public var c:b2Vec2;
public var a0:Number;
public var a:Number;
public var t0:Number;
public function b2Sweep(){
localCenter = new b2Vec2();
c0 = new b2Vec2();
c = new b2Vec2();
super();
}
public function Set(_arg1:b2Sweep):void{
localCenter.SetV(_arg1.localCenter);
c0.SetV(_arg1.c0);
c.SetV(_arg1.c);
a0 = _arg1.a0;
a = _arg1.a;
t0 = _arg1.t0;
}
public function Copy():b2Sweep{
var _local1:b2Sweep = new b2Sweep();
_local1.localCenter.SetV(localCenter);
_local1.c0.SetV(c0);
_local1.c.SetV(c);
_local1.a0 = a0;
_local1.a = a;
_local1.t0 = t0;
return (_local1);
}
public function GetTransform(_arg1:b2Transform, _arg2:Number):void{
_arg1.position.x = (((1 - _arg2) * c0.x) + (_arg2 * c.x));
_arg1.position.y = (((1 - _arg2) * c0.y) + (_arg2 * c.y));
var _local3:Number = (((1 - _arg2) * a0) + (_arg2 * a));
_arg1.R.Set(_local3);
var _local4:b2Mat22 = _arg1.R;
_arg1.position.x = (_arg1.position.x - ((_local4.col1.x * localCenter.x) + (_local4.col2.x * localCenter.y)));
_arg1.position.y = (_arg1.position.y - ((_local4.col1.y * localCenter.x) + (_local4.col2.y * localCenter.y)));
}
public function Advance(_arg1:Number):void{
var _local2:Number;
if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){
_local2 = ((_arg1 - t0) / (1 - t0));
c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x));
c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y));
a0 = (((1 - _local2) * a0) + (_local2 * a));
t0 = _arg1;
};
}
}
}//package Box2D.Common.Math
Section 45
//b2Transform (Box2D.Common.Math.b2Transform)
package Box2D.Common.Math {
public class b2Transform {
public var position:b2Vec2;
public var R:b2Mat22;
public function b2Transform(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{
position = new b2Vec2();
R = new b2Mat22();
super();
if (_arg1){
position.SetV(_arg1);
R.SetM(_arg2);
};
}
public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{
position.SetV(_arg1);
R.SetM(_arg2);
}
public function SetIdentity():void{
position.SetZero();
R.SetIdentity();
}
public function Set(_arg1:b2Transform):void{
position.SetV(_arg1.position);
R.SetM(_arg1.R);
}
public function GetAngle():Number{
return (Math.atan2(R.col1.y, R.col1.x));
}
}
}//package Box2D.Common.Math
Section 46
//b2Vec2 (Box2D.Common.Math.b2Vec2)
package Box2D.Common.Math {
public class b2Vec2 {
public var x:Number;
public var y:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function SetZero():void{
x = 0;
y = 0;
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function GetNegative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function NegativeSelf():void{
x = -(x);
y = -(y);
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number = b2Math.Dot(this, _arg1.col1);
y = b2Math.Dot(this, _arg1.col2);
x = _local2;
}
public function CrossVF(_arg1:Number):void{
var _local2:Number = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function LengthSquared():Number{
return (((x * x) + (y * y)));
}
public function Normalize():Number{
var _local1:Number = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
var _local2:Number = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function IsValid():Boolean{
return (((b2Math.IsValid(x)) && (b2Math.IsValid(y))));
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 47
//b2Vec3 (Box2D.Common.Math.b2Vec3)
package Box2D.Common.Math {
public class b2Vec3 {
public var x:Number;
public var y:Number;
public var z:Number;
public function b2Vec3(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
}
public function SetZero():void{
x = (y = (z = 0));
}
public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
}
public function SetV(_arg1:b2Vec3):void{
x = _arg1.x;
y = _arg1.y;
z = _arg1.z;
}
public function GetNegative():b2Vec3{
return (new b2Vec3(-(x), -(y), -(z)));
}
public function NegativeSelf():void{
x = -(x);
y = -(y);
z = -(z);
}
public function Copy():b2Vec3{
return (new b2Vec3(x, y, z));
}
public function Add(_arg1:b2Vec3):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
z = (z + _arg1.z);
}
public function Subtract(_arg1:b2Vec3):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
z = (z - _arg1.z);
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
z = (z * _arg1);
}
}
}//package Box2D.Common.Math
Section 48
//b2Color (Box2D.Common.b2Color)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Color {
private var _r:uint;// = 0
private var _g:uint;// = 0
private var _b:uint;// = 0
public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){
_r = uint((0xFF * b2Math.Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.Clamp(_arg3, 0, 1)));
}
public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{
_r = uint((0xFF * b2Math.Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.Clamp(_arg3, 0, 1)));
}
public function set r(_arg1:Number):void{
_r = uint((0xFF * b2Math.Clamp(_arg1, 0, 1)));
}
public function set g(_arg1:Number):void{
_g = uint((0xFF * b2Math.Clamp(_arg1, 0, 1)));
}
public function set b(_arg1:Number):void{
_b = uint((0xFF * b2Math.Clamp(_arg1, 0, 1)));
}
public function get color():uint{
return ((((_r << 16) | (_g << 8)) | _b));
}
}
}//package Box2D.Common
Section 49
//b2internal (Box2D.Common.b2internal)
package Box2D.Common {
public namespace b2internal = "http://www.box2d.org/ns/b2internal";
}//package Box2D.Common
Section 50
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
public class b2Settings {
public static const VERSION:String = "2.1alpha";
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_aabbExtension:Number = 0.1;
public static const b2_aabbMultiplier:Number = 2;
public static const b2_polygonRadius:Number = (2 * b2_linearSlop);
public static const b2_linearSlop:Number = 0.005;
public static const b2_angularSlop:Number = 0.0349065850398866;
public static const b2_toiSlop:Number = 0.04;
public static const b2_maxTOIContactsPerIsland:int = 32;
public static const b2_maxTOIJointsPerIsland:int = 32;
public static const b2_velocityThreshold:Number = 1;
public static const b2_maxLinearCorrection:Number = 0.2;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
public static const b2_maxTranslation:Number = 2;
public static const b2_maxTranslationSquared:Number = 4;
public static const b2_maxRotation:Number = 1.5707963267949;
public static const b2_maxRotationSquared:Number = 2.46740110027234;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_linearSleepTolerance:Number = 0.01;
public static const b2_angularSleepTolerance:Number = 0.0349065850398866;
public static function b2MixFriction(_arg1:Number, _arg2:Number):Number{
return (Math.sqrt((_arg1 * _arg2)));
}
public static function b2MixRestitution(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2Assert(_arg1:Boolean):void{
if (!_arg1){
throw ("Assertion Failed");
};
}
}
}//package Box2D.Common
Section 51
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2CircleContact extends b2Contact {
public function Reset(_arg1:b2Fixture, _arg2:b2Fixture):void{
super.Reset(_arg1, _arg2);
}
override b2internal function Evaluate():void{
var _local1:b2Body = m_fixtureA.GetBody();
var _local2:b2Body = m_fixtureB.GetBody();
b2Collision.CollideCircles(m_manifold, (m_fixtureA.GetShape() as b2CircleShape), _local1.m_xf, (m_fixtureB.GetShape() as b2CircleShape), _local2.m_xf);
}
public static function Create(_arg1):b2Contact{
return (new (b2CircleContact));
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 52
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Contact {
b2internal var m_flags:uint;
b2internal var m_prev:b2Contact;
b2internal var m_next:b2Contact;
b2internal var m_nodeA:b2ContactEdge;
b2internal var m_nodeB:b2ContactEdge;
b2internal var m_fixtureA:b2Fixture;
b2internal var m_fixtureB:b2Fixture;
b2internal var m_manifold:b2Manifold;
b2internal var m_oldManifold:b2Manifold;
b2internal var m_toi:Number;
b2internal static var e_sensorFlag:uint = 1;
b2internal static var e_continuousFlag:uint = 2;
b2internal static var e_islandFlag:uint = 4;
b2internal static var e_toiFlag:uint = 8;
b2internal static var e_touchingFlag:uint = 16;
b2internal static var e_enabledFlag:uint = 32;
b2internal static var e_filterFlag:uint = 64;
private static var s_input:b2TOIInput = new b2TOIInput();
public function b2Contact(){
m_nodeA = new b2ContactEdge();
m_nodeB = new b2ContactEdge();
m_manifold = new b2Manifold();
m_oldManifold = new b2Manifold();
super();
}
public function GetManifold():b2Manifold{
return (m_manifold);
}
public function GetWorldManifold(_arg1:b2WorldManifold):void{
var _local2:b2Body = m_fixtureA.GetBody();
var _local3:b2Body = m_fixtureB.GetBody();
var _local4:b2Shape = m_fixtureA.GetShape();
var _local5:b2Shape = m_fixtureB.GetShape();
_arg1.Initialize(m_manifold, _local2.GetTransform(), _local4.m_radius, _local3.GetTransform(), _local5.m_radius);
}
public function IsTouching():Boolean{
return (((m_flags & e_touchingFlag) == e_touchingFlag));
}
public function IsContinuous():Boolean{
return (((m_flags & e_continuousFlag) == e_continuousFlag));
}
public function SetSensor(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_sensorFlag);
} else {
m_flags = (m_flags & ~(e_sensorFlag));
};
}
public function IsSensor():Boolean{
return (((m_flags & e_sensorFlag) == e_sensorFlag));
}
public function SetEnabled(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_enabledFlag);
} else {
m_flags = (m_flags & ~(e_enabledFlag));
};
}
public function IsEnabled():Boolean{
return (((m_flags & e_enabledFlag) == e_enabledFlag));
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetFixtureA():b2Fixture{
return (m_fixtureA);
}
public function GetFixtureB():b2Fixture{
return (m_fixtureB);
}
public function FlagForFiltering():void{
m_flags = (m_flags | e_filterFlag);
}
b2internal function Reset(_arg1:b2Fixture=null, _arg2:b2Fixture=null):void{
m_flags = e_enabledFlag;
if (((!(_arg1)) || (!(_arg2)))){
m_fixtureA = null;
m_fixtureB = null;
return;
};
if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){
m_flags = (m_flags | e_sensorFlag);
};
var _local3:b2Body = _arg1.GetBody();
var _local4:b2Body = _arg2.GetBody();
if (((((((!((_local3.GetType() == b2Body.b2_dynamicBody))) || (_local3.IsBullet()))) || (!((_local4.GetType() == b2Body.b2_dynamicBody))))) || (_local4.IsBullet()))){
m_flags = (m_flags | e_continuousFlag);
};
m_fixtureA = _arg1;
m_fixtureB = _arg2;
m_manifold.m_pointCount = 0;
m_prev = null;
m_next = null;
m_nodeA.contact = null;
m_nodeA.prev = null;
m_nodeA.next = null;
m_nodeA.other = null;
m_nodeB.contact = null;
m_nodeB.prev = null;
m_nodeB.next = null;
m_nodeB.other = null;
}
b2internal function Update(_arg1:b2ContactListener):void{
var _local8:b2Shape;
var _local9:b2Shape;
var _local10:b2Transform;
var _local11:b2Transform;
var _local12:int;
var _local13:b2ManifoldPoint;
var _local14:b2ContactID;
var _local15:int;
var _local16:b2ManifoldPoint;
var _local2:b2Manifold = m_oldManifold;
m_oldManifold = m_manifold;
m_manifold = _local2;
m_flags = (m_flags | e_enabledFlag);
var _local3:Boolean;
var _local4 = ((m_flags & e_touchingFlag) == e_touchingFlag);
var _local5:b2Body = m_fixtureA.m_body;
var _local6:b2Body = m_fixtureB.m_body;
var _local7:Boolean = m_fixtureA.m_aabb.TestOverlap(m_fixtureB.m_aabb);
if ((m_flags & e_sensorFlag)){
if (_local7){
_local8 = m_fixtureA.GetShape();
_local9 = m_fixtureB.GetShape();
_local10 = _local5.GetTransform();
_local11 = _local6.GetTransform();
_local3 = b2Shape.TestOverlap(_local8, _local10, _local9, _local11);
};
m_manifold.m_pointCount = 0;
} else {
if (((((((!((_local5.GetType() == b2Body.b2_dynamicBody))) || (_local5.IsBullet()))) || (!((_local6.GetType() == b2Body.b2_dynamicBody))))) || (_local6.IsBullet()))){
m_flags = (m_flags | e_continuousFlag);
} else {
m_flags = (m_flags & ~(e_continuousFlag));
};
if (_local7){
Evaluate();
_local3 = (m_manifold.m_pointCount > 0);
_local12 = 0;
while (_local12 < m_manifold.m_pointCount) {
_local13 = m_manifold.m_points[_local12];
_local13.m_normalImpulse = 0;
_local13.m_tangentImpulse = 0;
_local14 = _local13.m_id;
_local15 = 0;
while (_local15 < m_oldManifold.m_pointCount) {
_local16 = m_oldManifold.m_points[_local15];
if (_local16.m_id.key == _local14.key){
_local13.m_normalImpulse = _local16.m_normalImpulse;
_local13.m_tangentImpulse = _local16.m_tangentImpulse;
break;
};
_local15++;
};
_local12++;
};
} else {
m_manifold.m_pointCount = 0;
};
if (_local3 != _local4){
_local5.SetAwake(true);
_local6.SetAwake(true);
};
};
if (_local3){
m_flags = (m_flags | e_touchingFlag);
} else {
m_flags = (m_flags & ~(e_touchingFlag));
};
if ((((_local4 == false)) && ((_local3 == true)))){
_arg1.BeginContact(this);
};
if ((((_local4 == true)) && ((_local3 == false)))){
_arg1.EndContact(this);
};
if ((m_flags & e_sensorFlag) == 0){
_arg1.PreSolve(this, m_oldManifold);
};
}
b2internal function Evaluate():void{
}
b2internal function ComputeTOI(_arg1:b2Sweep, _arg2:b2Sweep):Number{
s_input.proxyA.Set(m_fixtureA.GetShape());
s_input.proxyB.Set(m_fixtureB.GetShape());
s_input.sweepA = _arg1;
s_input.sweepB = _arg2;
s_input.tolerance = b2Settings.b2_linearSlop;
return (b2TimeOfImpact.TimeOfImpact(s_input));
}
}
}//package Box2D.Dynamics.Contacts
Section 53
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var localPlaneNormal:b2Vec2;
public var localPoint:b2Vec2;
public var normal:b2Vec2;
public var normalMass:b2Mat22;
public var K:b2Mat22;
public var bodyA:b2Body;
public var bodyB:b2Body;
public var type:int;
public var radius:Number;
public var friction:Number;
public var restitution:Number;
public var pointCount:int;
public var manifold:b2Manifold;
public function b2ContactConstraint(){
localPlaneNormal = new b2Vec2();
localPoint = new b2Vec2();
normal = new b2Vec2();
normalMass = new b2Mat22();
K = new b2Mat22();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 54
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var localPoint:b2Vec2;
public var rA:b2Vec2;
public var rB:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var normalMass:Number;
public var tangentMass:Number;
public var equalizedMass:Number;
public var velocityBias:Number;
public function b2ContactConstraintPoint(){
localPoint = new b2Vec2();
rA = new b2Vec2();
rB = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 55
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2ContactEdge {
public var other:b2Body;
public var contact:b2Contact;
public var prev:b2ContactEdge;
public var next:b2ContactEdge;
}
}//package Box2D.Dynamics.Contacts
Section 56
//b2ContactFactory (Box2D.Dynamics.Contacts.b2ContactFactory)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2ContactFactory {
private var m_registers:Array;
private var m_allocator;
public function b2ContactFactory(_arg1){
m_allocator = _arg1;
InitializeRegisters();
}
b2internal function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{
m_registers[_arg3][_arg4].createFcn = _arg1;
m_registers[_arg3][_arg4].destroyFcn = _arg2;
m_registers[_arg3][_arg4].primary = true;
if (_arg3 != _arg4){
m_registers[_arg4][_arg3].createFcn = _arg1;
m_registers[_arg4][_arg3].destroyFcn = _arg2;
m_registers[_arg4][_arg3].primary = false;
};
}
b2internal function InitializeRegisters():void{
var _local2:int;
m_registers = new Array(b2Shape.e_shapeTypeCount);
var _local1:int;
while (_local1 < b2Shape.e_shapeTypeCount) {
m_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
m_registers[_local1][_local2] = new b2ContactRegister();
_local2++;
};
_local1++;
};
AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape);
AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape);
AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape);
AddType(b2EdgeAndCircleContact.Create, b2EdgeAndCircleContact.Destroy, b2Shape.e_edgeShape, b2Shape.e_circleShape);
AddType(b2PolyAndEdgeContact.Create, b2PolyAndEdgeContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_edgeShape);
}
public function Create(_arg1:b2Fixture, _arg2:b2Fixture):b2Contact{
var _local6:b2Contact;
var _local3:int = _arg1.GetType();
var _local4:int = _arg2.GetType();
var _local5:b2ContactRegister = m_registers[_local3][_local4];
if (_local5.pool){
_local6 = _local5.pool;
_local5.pool = _local6.m_next;
_local5.poolCount--;
_local6.Reset(_arg1, _arg2);
return (_local6);
};
var _local7:Function = _local5.createFcn;
if (_local7 != null){
if (_local5.primary){
_local6 = _local7(m_allocator);
_local6.Reset(_arg1, _arg2);
return (_local6);
};
_local6 = _local7(m_allocator);
_local6.Reset(_arg2, _arg1);
return (_local6);
//unresolved jump
};
return (null);
}
public function Destroy(_arg1:b2Contact):void{
if (_arg1.m_manifold.m_pointCount > 0){
_arg1.m_fixtureA.m_body.SetAwake(true);
_arg1.m_fixtureB.m_body.SetAwake(true);
};
var _local2:int = _arg1.m_fixtureA.GetType();
var _local3:int = _arg1.m_fixtureB.GetType();
var _local4:b2ContactRegister = m_registers[_local2][_local3];
_local4.poolCount++;
_arg1.m_next = _local4.pool;
_local4.pool = _arg1;
var _local5:Function = _local4.destroyFcn;
_local5(_arg1, m_allocator);
}
}
}//package Box2D.Dynamics.Contacts
Section 57
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var createFcn:Function;
public var destroyFcn:Function;
public var primary:Boolean;
public var pool:b2Contact;
public var poolCount:int;
}
}//package Box2D.Dynamics.Contacts
Section 58
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2ContactSolver {
private var m_step:b2TimeStep;
private var m_allocator;
b2internal var m_constraints:Array;
private var m_constraintCount:int;
private static var s_worldManifold:b2WorldManifold = new b2WorldManifold();
private static var s_psm:b2PositionSolverManifold = new b2PositionSolverManifold();
public function b2ContactSolver(){
m_step = new b2TimeStep();
m_constraints = new Array();
super();
}
public function Initialize(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4):void{
var _local5:b2Contact;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _local9:b2Fixture;
var _local10:b2Fixture;
var _local11:b2Shape;
var _local12:b2Shape;
var _local13:Number;
var _local14:Number;
var _local15:b2Body;
var _local16:b2Body;
var _local17:b2Manifold;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:b2ContactConstraint;
var _local29:uint;
var _local30:b2ManifoldPoint;
var _local31:b2ContactConstraintPoint;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:Number;
var _local44:Number;
var _local45:Number;
var _local46:Number;
var _local47:Number;
var _local48:b2ContactConstraintPoint;
var _local49:b2ContactConstraintPoint;
var _local50:Number;
var _local51:Number;
var _local52:Number;
var _local53:Number;
var _local54:Number;
var _local55:Number;
var _local56:Number;
var _local57:Number;
var _local58:Number;
var _local59:Number;
var _local60:Number;
var _local61:Number;
m_step.Set(_arg1);
m_allocator = _arg4;
m_constraintCount = _arg3;
while (m_constraints.length < m_constraintCount) {
m_constraints[m_constraints.length] = new b2ContactConstraint();
};
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
_local9 = _local5.m_fixtureA;
_local10 = _local5.m_fixtureB;
_local11 = _local9.m_shape;
_local12 = _local10.m_shape;
_local13 = _local11.m_radius;
_local14 = _local12.m_radius;
_local15 = _local9.m_body;
_local16 = _local10.m_body;
_local17 = _local5.GetManifold();
_local18 = b2Settings.b2MixFriction(_local9.GetFriction(), _local10.GetFriction());
_local19 = b2Settings.b2MixRestitution(_local9.GetRestitution(), _local10.GetRestitution());
_local20 = _local15.m_linearVelocity.x;
_local21 = _local15.m_linearVelocity.y;
_local22 = _local16.m_linearVelocity.x;
_local23 = _local16.m_linearVelocity.y;
_local24 = _local15.m_angularVelocity;
_local25 = _local16.m_angularVelocity;
b2Settings.b2Assert((_local17.m_pointCount > 0));
s_worldManifold.Initialize(_local17, _local15.m_xf, _local13, _local16.m_xf, _local14);
_local26 = s_worldManifold.m_normal.x;
_local27 = s_worldManifold.m_normal.y;
_local28 = m_constraints[_local6];
_local28.bodyA = _local15;
_local28.bodyB = _local16;
_local28.manifold = _local17;
_local28.normal.x = _local26;
_local28.normal.y = _local27;
_local28.pointCount = _local17.m_pointCount;
_local28.friction = _local18;
_local28.restitution = _local19;
_local28.localPlaneNormal.x = _local17.m_localPlaneNormal.x;
_local28.localPlaneNormal.y = _local17.m_localPlaneNormal.y;
_local28.localPoint.x = _local17.m_localPoint.x;
_local28.localPoint.y = _local17.m_localPoint.y;
_local28.radius = (_local13 + _local14);
_local28.type = _local17.m_type;
_local29 = 0;
while (_local29 < _local28.pointCount) {
_local30 = _local17.m_points[_local29];
_local31 = _local28.points[_local29];
_local31.normalImpulse = _local30.m_normalImpulse;
_local31.tangentImpulse = _local30.m_tangentImpulse;
_local31.localPoint.SetV(_local30.m_localPoint);
_local32 = (_local31.rA.x = (s_worldManifold.m_points[_local29].x - _local15.m_sweep.c.x));
_local33 = (_local31.rA.y = (s_worldManifold.m_points[_local29].y - _local15.m_sweep.c.y));
_local34 = (_local31.rB.x = (s_worldManifold.m_points[_local29].x - _local16.m_sweep.c.x));
_local35 = (_local31.rB.y = (s_worldManifold.m_points[_local29].y - _local16.m_sweep.c.y));
_local36 = ((_local32 * _local27) - (_local33 * _local26));
_local37 = ((_local34 * _local27) - (_local35 * _local26));
_local36 = (_local36 * _local36);
_local37 = (_local37 * _local37);
_local38 = (((_local15.m_invMass + _local16.m_invMass) + (_local15.m_invI * _local36)) + (_local16.m_invI * _local37));
_local31.normalMass = (1 / _local38);
_local39 = ((_local15.m_mass * _local15.m_invMass) + (_local16.m_mass * _local16.m_invMass));
_local39 = (_local39 + (((_local15.m_mass * _local15.m_invI) * _local36) + ((_local16.m_mass * _local16.m_invI) * _local37)));
_local31.equalizedMass = (1 / _local39);
_local40 = _local27;
_local41 = -(_local26);
_local42 = ((_local32 * _local41) - (_local33 * _local40));
_local43 = ((_local34 * _local41) - (_local35 * _local40));
_local42 = (_local42 * _local42);
_local43 = (_local43 * _local43);
_local44 = (((_local15.m_invMass + _local16.m_invMass) + (_local15.m_invI * _local42)) + (_local16.m_invI * _local43));
_local31.tangentMass = (1 / _local44);
_local31.velocityBias = 0;
_local45 = (((_local22 + (-(_local25) * _local35)) - _local20) - (-(_local24) * _local33));
_local46 = (((_local23 + (_local25 * _local34)) - _local21) - (_local24 * _local32));
_local47 = ((_local28.normal.x * _local45) + (_local28.normal.y * _local46));
if (_local47 < -(b2Settings.b2_velocityThreshold)){
_local31.velocityBias = (_local31.velocityBias + (-(_local28.restitution) * _local47));
};
_local29++;
};
if (_local28.pointCount == 2){
_local48 = _local28.points[0];
_local49 = _local28.points[1];
_local50 = _local15.m_invMass;
_local51 = _local15.m_invI;
_local52 = _local16.m_invMass;
_local53 = _local16.m_invI;
_local54 = ((_local48.rA.x * _local27) - (_local48.rA.y * _local26));
_local55 = ((_local48.rB.x * _local27) - (_local48.rB.y * _local26));
_local56 = ((_local49.rA.x * _local27) - (_local49.rA.y * _local26));
_local57 = ((_local49.rB.x * _local27) - (_local49.rB.y * _local26));
_local58 = (((_local50 + _local52) + ((_local51 * _local54) * _local54)) + ((_local53 * _local55) * _local55));
_local59 = (((_local50 + _local52) + ((_local51 * _local56) * _local56)) + ((_local53 * _local57) * _local57));
_local60 = (((_local50 + _local52) + ((_local51 * _local54) * _local56)) + ((_local53 * _local55) * _local57));
_local61 = 100;
if ((_local58 * _local58) < (_local61 * ((_local58 * _local59) - (_local60 * _local60)))){
_local28.K.col1.Set(_local58, _local60);
_local28.K.col2.Set(_local60, _local59);
_local28.K.GetInverse(_local28.normalMass);
} else {
_local28.pointCount = 1;
};
};
_local6++;
};
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:b2ContactConstraintPoint;
var _local21:Number;
var _local22:Number;
var _local23:b2ContactConstraintPoint;
var _local5:int;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.bodyA;
_local8 = _local6.bodyB;
_local9 = _local7.m_invMass;
_local10 = _local7.m_invI;
_local11 = _local8.m_invMass;
_local12 = _local8.m_invI;
_local13 = _local6.normal.x;
_local14 = _local6.normal.y;
_local15 = _local14;
_local16 = -(_local13);
if (_arg1.warmStarting){
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local20 = _local6.points[_local18];
_local6.points[_local18].normalImpulse = (_local20.normalImpulse * _arg1.dtRatio);
_local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio);
_local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15));
_local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16));
_local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.rA.x * _local22) - (_local20.rA.y * _local21))));
_local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21));
_local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22));
_local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.rB.x * _local22) - (_local20.rB.y * _local21))));
_local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21));
_local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22));
_local18++;
};
} else {
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local23 = _local6.points[_local18];
_local23.normalImpulse = 0;
_local23.tangentImpulse = 0;
_local18++;
};
};
_local5++;
};
}
public function SolveVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraintPoint;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:b2Mat22;
var _local23:b2Vec2;
var _local25:b2ContactConstraint;
var _local26:b2Body;
var _local27:b2Body;
var _local28:Number;
var _local29:Number;
var _local30:b2Vec2;
var _local31:b2Vec2;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
var _local42:int;
var _local43:b2ContactConstraintPoint;
var _local44:b2ContactConstraintPoint;
var _local45:Number;
var _local46:Number;
var _local47:Number;
var _local48:Number;
var _local49:Number;
var _local50:Number;
var _local51:Number;
var _local52:Number;
var _local53:Number;
var _local54:Number;
var _local55:Number;
var _local56:Number;
var _local57:Number;
var _local24:int;
while (_local24 < m_constraintCount) {
_local25 = m_constraints[_local24];
_local26 = _local25.bodyA;
_local27 = _local25.bodyB;
_local28 = _local26.m_angularVelocity;
_local29 = _local27.m_angularVelocity;
_local30 = _local26.m_linearVelocity;
_local31 = _local27.m_linearVelocity;
_local32 = _local26.m_invMass;
_local33 = _local26.m_invI;
_local34 = _local27.m_invMass;
_local35 = _local27.m_invI;
_local36 = _local25.normal.x;
_local37 = _local25.normal.y;
_local38 = _local37;
_local39 = -(_local36);
_local40 = _local25.friction;
_local1 = 0;
while (_local1 < _local25.pointCount) {
_local2 = _local25.points[_local1];
_local7 = (((_local31.x - (_local29 * _local2.rB.y)) - _local30.x) + (_local28 * _local2.rA.y));
_local8 = (((_local31.y + (_local29 * _local2.rB.x)) - _local30.y) - (_local28 * _local2.rA.x));
_local10 = ((_local7 * _local38) + (_local8 * _local39));
_local11 = (_local2.tangentMass * -(_local10));
_local12 = (_local40 * _local2.normalImpulse);
_local13 = b2Math.Clamp((_local2.tangentImpulse + _local11), -(_local12), _local12);
_local11 = (_local13 - _local2.tangentImpulse);
_local14 = (_local11 * _local38);
_local15 = (_local11 * _local39);
_local30.x = (_local30.x - (_local32 * _local14));
_local30.y = (_local30.y - (_local32 * _local15));
_local28 = (_local28 - (_local33 * ((_local2.rA.x * _local15) - (_local2.rA.y * _local14))));
_local31.x = (_local31.x + (_local34 * _local14));
_local31.y = (_local31.y + (_local34 * _local15));
_local29 = (_local29 + (_local35 * ((_local2.rB.x * _local15) - (_local2.rB.y * _local14))));
_local2.tangentImpulse = _local13;
_local1++;
};
_local42 = _local25.pointCount;
if (_local25.pointCount == 1){
_local2 = _local25.points[0];
_local7 = (((_local31.x + (-(_local29) * _local2.rB.y)) - _local30.x) - (-(_local28) * _local2.rA.y));
_local8 = (((_local31.y + (_local29 * _local2.rB.x)) - _local30.y) - (_local28 * _local2.rA.x));
_local9 = ((_local7 * _local36) + (_local8 * _local37));
_local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias));
_local13 = (_local2.normalImpulse + _local11);
_local13 = ((_local13 > 0)) ? _local13 : 0;
_local11 = (_local13 - _local2.normalImpulse);
_local14 = (_local11 * _local36);
_local15 = (_local11 * _local37);
_local30.x = (_local30.x - (_local32 * _local14));
_local30.y = (_local30.y - (_local32 * _local15));
_local28 = (_local28 - (_local33 * ((_local2.rA.x * _local15) - (_local2.rA.y * _local14))));
_local31.x = (_local31.x + (_local34 * _local14));
_local31.y = (_local31.y + (_local34 * _local15));
_local29 = (_local29 + (_local35 * ((_local2.rB.x * _local15) - (_local2.rB.y * _local14))));
_local2.normalImpulse = _local13;
} else {
_local43 = _local25.points[0];
_local44 = _local25.points[1];
_local45 = _local43.normalImpulse;
_local46 = _local44.normalImpulse;
_local47 = (((_local31.x - (_local29 * _local43.rB.y)) - _local30.x) + (_local28 * _local43.rA.y));
_local48 = (((_local31.y + (_local29 * _local43.rB.x)) - _local30.y) - (_local28 * _local43.rA.x));
_local49 = (((_local31.x - (_local29 * _local44.rB.y)) - _local30.x) + (_local28 * _local44.rA.y));
_local50 = (((_local31.y + (_local29 * _local44.rB.x)) - _local30.y) - (_local28 * _local44.rA.x));
_local51 = ((_local47 * _local36) + (_local48 * _local37));
_local52 = ((_local49 * _local36) + (_local50 * _local37));
_local53 = (_local51 - _local43.velocityBias);
_local54 = (_local52 - _local44.velocityBias);
_local22 = _local25.K;
_local53 = (_local53 - ((_local22.col1.x * _local45) + (_local22.col2.x * _local46)));
_local54 = (_local54 - ((_local22.col1.y * _local45) + (_local22.col2.y * _local46)));
_local55 = 0.001;
while (true) {
_local22 = _local25.normalMass;
_local56 = -(((_local22.col1.x * _local53) + (_local22.col2.x * _local54)));
_local57 = -(((_local22.col1.y * _local53) + (_local22.col2.y * _local54)));
if ((((_local56 >= 0)) && ((_local57 >= 0)))){
_local16 = (_local56 - _local45);
_local17 = (_local57 - _local46);
_local18 = (_local16 * _local36);
_local19 = (_local16 * _local37);
_local20 = (_local17 * _local36);
_local21 = (_local17 * _local37);
_local30.x = (_local30.x - (_local32 * (_local18 + _local20)));
_local30.y = (_local30.y - (_local32 * (_local19 + _local21)));
_local28 = (_local28 - (_local33 * ((((_local43.rA.x * _local19) - (_local43.rA.y * _local18)) + (_local44.rA.x * _local21)) - (_local44.rA.y * _local20))));
_local31.x = (_local31.x + (_local34 * (_local18 + _local20)));
_local31.y = (_local31.y + (_local34 * (_local19 + _local21)));
_local29 = (_local29 + (_local35 * ((((_local43.rB.x * _local19) - (_local43.rB.y * _local18)) + (_local44.rB.x * _local21)) - (_local44.rB.y * _local20))));
_local43.normalImpulse = _local56;
_local44.normalImpulse = _local57;
break;
};
_local56 = (-(_local43.normalMass) * _local53);
_local57 = 0;
_local51 = 0;
_local52 = ((_local25.K.col1.y * _local56) + _local54);
if ((((_local56 >= 0)) && ((_local52 >= 0)))){
_local16 = (_local56 - _local45);
_local17 = (_local57 - _local46);
_local18 = (_local16 * _local36);
_local19 = (_local16 * _local37);
_local20 = (_local17 * _local36);
_local21 = (_local17 * _local37);
_local30.x = (_local30.x - (_local32 * (_local18 + _local20)));
_local30.y = (_local30.y - (_local32 * (_local19 + _local21)));
_local28 = (_local28 - (_local33 * ((((_local43.rA.x * _local19) - (_local43.rA.y * _local18)) + (_local44.rA.x * _local21)) - (_local44.rA.y * _local20))));
_local31.x = (_local31.x + (_local34 * (_local18 + _local20)));
_local31.y = (_local31.y + (_local34 * (_local19 + _local21)));
_local29 = (_local29 + (_local35 * ((((_local43.rB.x * _local19) - (_local43.rB.y * _local18)) + (_local44.rB.x * _local21)) - (_local44.rB.y * _local20))));
_local43.normalImpulse = _local56;
_local44.normalImpulse = _local57;
break;
};
_local56 = 0;
_local57 = (-(_local44.normalMass) * _local54);
_local51 = ((_local25.K.col2.x * _local57) + _local53);
_local52 = 0;
if ((((_local57 >= 0)) && ((_local51 >= 0)))){
_local16 = (_local56 - _local45);
_local17 = (_local57 - _local46);
_local18 = (_local16 * _local36);
_local19 = (_local16 * _local37);
_local20 = (_local17 * _local36);
_local21 = (_local17 * _local37);
_local30.x = (_local30.x - (_local32 * (_local18 + _local20)));
_local30.y = (_local30.y - (_local32 * (_local19 + _local21)));
_local28 = (_local28 - (_local33 * ((((_local43.rA.x * _local19) - (_local43.rA.y * _local18)) + (_local44.rA.x * _local21)) - (_local44.rA.y * _local20))));
_local31.x = (_local31.x + (_local34 * (_local18 + _local20)));
_local31.y = (_local31.y + (_local34 * (_local19 + _local21)));
_local29 = (_local29 + (_local35 * ((((_local43.rB.x * _local19) - (_local43.rB.y * _local18)) + (_local44.rB.x * _local21)) - (_local44.rB.y * _local20))));
_local43.normalImpulse = _local56;
_local44.normalImpulse = _local57;
break;
};
_local56 = 0;
_local57 = 0;
_local51 = _local53;
_local52 = _local54;
if ((((_local51 >= 0)) && ((_local52 >= 0)))){
_local16 = (_local56 - _local45);
_local17 = (_local57 - _local46);
_local18 = (_local16 * _local36);
_local19 = (_local16 * _local37);
_local20 = (_local17 * _local36);
_local21 = (_local17 * _local37);
_local30.x = (_local30.x - (_local32 * (_local18 + _local20)));
_local30.y = (_local30.y - (_local32 * (_local19 + _local21)));
_local28 = (_local28 - (_local33 * ((((_local43.rA.x * _local19) - (_local43.rA.y * _local18)) + (_local44.rA.x * _local21)) - (_local44.rA.y * _local20))));
_local31.x = (_local31.x + (_local34 * (_local18 + _local20)));
_local31.y = (_local31.y + (_local34 * (_local19 + _local21)));
_local29 = (_local29 + (_local35 * ((((_local43.rB.x * _local19) - (_local43.rB.y * _local18)) + (_local44.rB.x * _local21)) - (_local44.rB.y * _local20))));
_local43.normalImpulse = _local56;
_local44.normalImpulse = _local57;
break;
};
break;
};
};
_local26.m_angularVelocity = _local28;
_local27.m_angularVelocity = _local29;
_local24++;
};
}
public function FinalizeVelocityConstraints():void{
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
var _local1:int;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.m_points[_local4];
_local6 = _local2.points[_local4];
_local5.m_normalImpulse = _local6.normalImpulse;
_local5.m_tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
public function SolvePositionConstraints(_arg1:Number):Boolean{
var _local4:b2ContactConstraint;
var _local5:b2Body;
var _local6:b2Body;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local12:int;
var _local13:b2ContactConstraintPoint;
var _local14:b2Vec2;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local2:Number = 0;
var _local3:int;
while (_local3 < m_constraintCount) {
_local4 = m_constraints[_local3];
_local5 = _local4.bodyA;
_local6 = _local4.bodyB;
_local7 = (_local5.m_mass * _local5.m_invMass);
_local8 = (_local5.m_mass * _local5.m_invI);
_local9 = (_local6.m_mass * _local6.m_invMass);
_local10 = (_local6.m_mass * _local6.m_invI);
s_psm.Initialize(_local4);
_local11 = s_psm.m_normal;
_local12 = 0;
while (_local12 < _local4.pointCount) {
_local13 = _local4.points[_local12];
_local14 = s_psm.m_points[_local12];
_local15 = s_psm.m_separations[_local12];
_local16 = (_local14.x - _local5.m_sweep.c.x);
_local17 = (_local14.y - _local5.m_sweep.c.y);
_local18 = (_local14.x - _local6.m_sweep.c.x);
_local19 = (_local14.y - _local6.m_sweep.c.y);
_local2 = ((_local2 < _local15)) ? _local2 : _local15;
_local20 = b2Math.Clamp((_arg1 * (_local15 + b2Settings.b2_linearSlop)), -(b2Settings.b2_maxLinearCorrection), 0);
_local21 = (-(_local13.equalizedMass) * _local20);
_local22 = (_local21 * _local11.x);
_local23 = (_local21 * _local11.y);
_local5.m_sweep.c.x = (_local5.m_sweep.c.x - (_local7 * _local22));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y - (_local7 * _local23));
_local5.m_sweep.a = (_local5.m_sweep.a - (_local8 * ((_local16 * _local23) - (_local17 * _local22))));
_local5.SynchronizeTransform();
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_local9 * _local22));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_local9 * _local23));
_local6.m_sweep.a = (_local6.m_sweep.a + (_local10 * ((_local18 * _local23) - (_local19 * _local22))));
_local6.SynchronizeTransform();
_local12++;
};
_local3++;
};
return ((_local2 > (-1.5 * b2Settings.b2_linearSlop)));
}
}
}//package Box2D.Dynamics.Contacts
Section 59
//b2EdgeAndCircleContact (Box2D.Dynamics.Contacts.b2EdgeAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2EdgeAndCircleContact extends b2Contact {
public function Reset(_arg1:b2Fixture, _arg2:b2Fixture):void{
super.Reset(_arg1, _arg2);
}
override b2internal function Evaluate():void{
var _local1:b2Body = m_fixtureA.GetBody();
var _local2:b2Body = m_fixtureB.GetBody();
b2CollideEdgeAndCircle(m_manifold, (m_fixtureA.GetShape() as b2EdgeShape), _local1.m_xf, (m_fixtureB.GetShape() as b2CircleShape), _local2.m_xf);
}
private function b2CollideEdgeAndCircle(_arg1:b2Manifold, _arg2:b2EdgeShape, _arg3:b2Transform, _arg4:b2CircleShape, _arg5:b2Transform):void{
}
public static function Create(_arg1):b2Contact{
return (new (b2EdgeAndCircleContact));
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 60
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2PolyAndCircleContact extends b2Contact {
public function Reset(_arg1:b2Fixture, _arg2:b2Fixture):void{
super.Reset(_arg1, _arg2);
b2Settings.b2Assert((_arg1.GetType() == b2Shape.e_polygonShape));
b2Settings.b2Assert((_arg2.GetType() == b2Shape.e_circleShape));
}
override b2internal function Evaluate():void{
var _local1:b2Body = m_fixtureA.m_body;
var _local2:b2Body = m_fixtureB.m_body;
b2Collision.CollidePolygonAndCircle(m_manifold, (m_fixtureA.GetShape() as b2PolygonShape), _local1.m_xf, (m_fixtureB.GetShape() as b2CircleShape), _local2.m_xf);
}
public static function Create(_arg1):b2Contact{
return (new (b2PolyAndCircleContact));
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 61
//b2PolyAndEdgeContact (Box2D.Dynamics.Contacts.b2PolyAndEdgeContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2PolyAndEdgeContact extends b2Contact {
public function Reset(_arg1:b2Fixture, _arg2:b2Fixture):void{
super.Reset(_arg1, _arg2);
b2Settings.b2Assert((_arg1.GetType() == b2Shape.e_polygonShape));
b2Settings.b2Assert((_arg2.GetType() == b2Shape.e_edgeShape));
}
override b2internal function Evaluate():void{
var _local1:b2Body = m_fixtureA.GetBody();
var _local2:b2Body = m_fixtureB.GetBody();
b2CollidePolyAndEdge(m_manifold, (m_fixtureA.GetShape() as b2PolygonShape), _local1.m_xf, (m_fixtureB.GetShape() as b2EdgeShape), _local2.m_xf);
}
private function b2CollidePolyAndEdge(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2Transform, _arg4:b2EdgeShape, _arg5:b2Transform):void{
}
public static function Create(_arg1):b2Contact{
return (new (b2PolyAndEdgeContact));
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 62
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2PolygonContact extends b2Contact {
public function Reset(_arg1:b2Fixture, _arg2:b2Fixture):void{
super.Reset(_arg1, _arg2);
}
override b2internal function Evaluate():void{
var _local1:b2Body = m_fixtureA.GetBody();
var _local2:b2Body = m_fixtureB.GetBody();
b2Collision.CollidePolygons(m_manifold, (m_fixtureA.GetShape() as b2PolygonShape), _local1.m_xf, (m_fixtureB.GetShape() as b2PolygonShape), _local2.m_xf);
}
public static function Create(_arg1):b2Contact{
return (new (b2PolygonContact));
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 63
//b2PositionSolverManifold (Box2D.Dynamics.Contacts.b2PositionSolverManifold)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.*;
class b2PositionSolverManifold {
public var m_normal:b2Vec2;
public var m_points:Array;
public var m_separations:Array;
private static var circlePointA:b2Vec2 = new b2Vec2();
private static var circlePointB:b2Vec2 = new b2Vec2();
function b2PositionSolverManifold(){
m_normal = new b2Vec2();
m_separations = new Array(b2Settings.b2_maxManifoldPoints);
m_points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
m_points[_local1] = new b2Vec2();
_local1++;
};
}
public function Initialize(_arg1:b2ContactConstraint):void{
var _local2:int;
var _local3:Number;
var _local4:Number;
var _local5:b2Mat22;
var _local6:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
b2Settings.b2Assert((_arg1.pointCount > 0));
switch (_arg1.type){
case b2Manifold.e_circles:
_local5 = _arg1.bodyA.m_xf.R;
_local6 = _arg1.localPoint;
_local9 = (_arg1.bodyA.m_xf.position.x + ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)));
_local10 = (_arg1.bodyA.m_xf.position.y + ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)));
_local5 = _arg1.bodyB.m_xf.R;
_local6 = _arg1.points[0].localPoint;
_local11 = (_arg1.bodyB.m_xf.position.x + ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)));
_local12 = (_arg1.bodyB.m_xf.position.y + ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)));
_local13 = (_local11 - _local9);
_local14 = (_local12 - _local10);
_local15 = ((_local13 * _local13) + (_local14 * _local14));
if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){
_local16 = Math.sqrt(_local15);
m_normal.x = (_local13 / _local16);
m_normal.y = (_local14 / _local16);
} else {
m_normal.x = 1;
m_normal.y = 0;
};
m_points[0].x = (0.5 * (_local9 + _local11));
m_points[0].y = (0.5 * (_local10 + _local12));
m_separations[0] = (((_local13 * m_normal.x) + (_local14 * m_normal.y)) - _arg1.radius);
break;
case b2Manifold.e_faceA:
_local5 = _arg1.bodyA.m_xf.R;
_local6 = _arg1.localPlaneNormal;
m_normal.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
m_normal.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y));
_local5 = _arg1.bodyA.m_xf.R;
_local6 = _arg1.localPoint;
_local7 = (_arg1.bodyA.m_xf.position.x + ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)));
_local8 = (_arg1.bodyA.m_xf.position.y + ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)));
_local5 = _arg1.bodyB.m_xf.R;
_local2 = 0;
while (_local2 < _arg1.pointCount) {
_local6 = _arg1.points[_local2].localPoint;
_local3 = (_arg1.bodyB.m_xf.position.x + ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)));
_local4 = (_arg1.bodyB.m_xf.position.y + ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)));
m_separations[_local2] = ((((_local3 - _local7) * m_normal.x) + ((_local4 - _local8) * m_normal.y)) - _arg1.radius);
m_points[_local2].x = _local3;
m_points[_local2].y = _local4;
_local2++;
};
break;
case b2Manifold.e_faceB:
_local5 = _arg1.bodyB.m_xf.R;
_local6 = _arg1.localPlaneNormal;
m_normal.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
m_normal.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y));
_local5 = _arg1.bodyB.m_xf.R;
_local6 = _arg1.localPoint;
_local7 = (_arg1.bodyB.m_xf.position.x + ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)));
_local8 = (_arg1.bodyB.m_xf.position.y + ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)));
_local5 = _arg1.bodyA.m_xf.R;
_local2 = 0;
while (_local2 < _arg1.pointCount) {
_local6 = _arg1.points[_local2].localPoint;
_local3 = (_arg1.bodyA.m_xf.position.x + ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)));
_local4 = (_arg1.bodyA.m_xf.position.y + ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)));
m_separations[_local2] = ((((_local3 - _local7) * m_normal.x) + ((_local4 - _local8) * m_normal.y)) - _arg1.radius);
m_points[_local2].Set(_local3, _local4);
_local2++;
};
m_normal.x = (m_normal.x * -1);
m_normal.y = (m_normal.y * -1);
break;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 64
//b2Controller (Box2D.Dynamics.Controllers.b2Controller)
package Box2D.Dynamics.Controllers {
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2Controller {
b2internal var m_next:b2Controller;
b2internal var m_prev:b2Controller;
protected var m_bodyList:b2ControllerEdge;
protected var m_bodyCount:int;
b2internal var m_world:b2World;
public function Step(_arg1:b2TimeStep):void{
}
public function Draw(_arg1:b2DebugDraw):void{
}
public function AddBody(_arg1:b2Body):void{
var _local2:b2ControllerEdge = new b2ControllerEdge();
_local2.controller = this;
_local2.body = _arg1;
_local2.nextBody = m_bodyList;
_local2.prevBody = null;
m_bodyList = _local2;
if (_local2.nextBody){
_local2.nextBody.prevBody = _local2;
};
m_bodyCount++;
_local2.nextController = _arg1.m_controllerList;
_local2.prevController = null;
_arg1.m_controllerList = _local2;
if (_local2.nextController){
_local2.nextController.prevController = _local2;
};
_arg1.m_controllerCount++;
}
public function RemoveBody(_arg1:b2Body):void{
var _local2:b2ControllerEdge = _arg1.m_controllerList;
while (((_local2) && (!((_local2.controller == this))))) {
_local2 = _local2.nextController;
};
if (_local2.prevBody){
_local2.prevBody.nextBody = _local2.nextBody;
};
if (_local2.nextBody){
_local2.nextBody.prevBody = _local2.prevBody;
};
if (_local2.nextController){
_local2.nextController.prevController = _local2.prevController;
};
if (_local2.prevController){
_local2.prevController.nextController = _local2.nextController;
};
if (m_bodyList == _local2){
m_bodyList = _local2.nextBody;
};
if (_arg1.m_controllerList == _local2){
_arg1.m_controllerList = _local2.nextController;
};
_arg1.m_controllerCount--;
m_bodyCount--;
}
public function Clear():void{
while (m_bodyList) {
RemoveBody(m_bodyList.body);
};
}
public function GetNext():b2Controller{
return (m_next);
}
public function GetWorld():b2World{
return (m_world);
}
public function GetBodyList():b2ControllerEdge{
return (m_bodyList);
}
}
}//package Box2D.Dynamics.Controllers
Section 65
//b2ControllerEdge (Box2D.Dynamics.Controllers.b2ControllerEdge)
package Box2D.Dynamics.Controllers {
import Box2D.Dynamics.*;
public class b2ControllerEdge {
public var controller:b2Controller;
public var body:b2Body;
public var prevBody:b2ControllerEdge;
public var nextBody:b2ControllerEdge;
public var prevController:b2ControllerEdge;
public var nextController:b2ControllerEdge;
}
}//package Box2D.Dynamics.Controllers
Section 66
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2DistanceJoint extends b2Joint {
private var m_localAnchor1:b2Vec2;
private var m_localAnchor2:b2Vec2;
private var m_u:b2Vec2;
private var m_frequencyHz:Number;
private var m_dampingRatio:Number;
private var m_gamma:Number;
private var m_bias:Number;
private var m_impulse:Number;
private var m_mass:Number;
private var m_length:Number;
public function b2DistanceJoint(_arg1:b2DistanceJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u = new b2Vec2();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchorA);
m_localAnchor2.SetV(_arg1.localAnchorB);
m_length = _arg1.length;
m_frequencyHz = _arg1.frequencyHz;
m_dampingRatio = _arg1.dampingRatio;
m_impulse = 0;
m_gamma = 0;
m_bias = 0;
}
override public function GetAnchorA():b2Vec2{
return (m_bodyA.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchorB():b2Vec2{
return (m_bodyB.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2(((_arg1 * m_impulse) * m_u.x), ((_arg1 * m_impulse) * m_u.y)));
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function GetLength():Number{
return (m_length);
}
public function SetLength(_arg1:Number):void{
m_length = _arg1;
}
public function GetFrequency():Number{
return (m_frequencyHz);
}
public function SetFrequency(_arg1:Number):void{
m_frequencyHz = _arg1;
}
public function GetDampingRatio():Number{
return (m_dampingRatio);
}
public function SetDampingRatio(_arg1:Number):void{
m_dampingRatio = _arg1;
}
override b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local7:Number;
var _local9:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
_local4 = m_bodyA;
_local5 = m_bodyB;
_local2 = _local4.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7));
_local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7));
_local6 = _local3;
_local2 = _local5.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6);
m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7);
var _local10:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y)));
if (_local10 > b2Settings.b2_linearSlop){
m_u.Multiply((1 / _local10));
} else {
m_u.SetZero();
};
var _local11:Number = ((_local6 * m_u.y) - (_local7 * m_u.x));
var _local12:Number = ((_local8 * m_u.y) - (_local9 * m_u.x));
var _local13:Number = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12));
m_mass = ((_local13)!=0) ? (1 / _local13) : 0;
if (m_frequencyHz > 0){
_local14 = (_local10 - m_length);
_local15 = ((2 * Math.PI) * m_frequencyHz);
_local16 = (((2 * m_mass) * m_dampingRatio) * _local15);
_local17 = ((m_mass * _local15) * _local15);
m_gamma = (_arg1.dt * (_local16 + (_arg1.dt * _local17)));
m_gamma = ((m_gamma)!=0) ? (1 / m_gamma) : 0;
m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma);
m_mass = (_local13 + m_gamma);
m_mass = ((m_mass)!=0) ? (1 / m_mass) : 0;
};
if (_arg1.warmStarting){
m_impulse = (m_impulse * _arg1.dtRatio);
_local18 = (m_impulse * m_u.x);
_local19 = (m_impulse * m_u.y);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19));
_local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18))));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19));
_local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18))));
} else {
m_impulse = 0;
};
}
override b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:b2Body = m_bodyA;
var _local4:b2Body = m_bodyB;
_local2 = _local3.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
var _local7:Number = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6));
_local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6));
_local5 = _local7;
_local2 = _local4.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6));
var _local11:Number = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5));
var _local12:Number = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9));
var _local13:Number = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8));
var _local14:Number = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11)));
var _local15:Number = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse)));
m_impulse = (m_impulse + _local15);
var _local16:Number = (_local15 * m_u.x);
var _local17:Number = (_local15 * m_u.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16))));
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17));
_local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
}
override b2internal function SolvePositionConstraints(_arg1:Number):Boolean{
var _local2:b2Mat22;
if (m_frequencyHz > 0){
return (true);
};
var _local3:b2Body = m_bodyA;
var _local4:b2Body = m_bodyB;
_local2 = _local3.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
var _local7:Number = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6));
_local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6));
_local5 = _local7;
_local2 = _local4.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (((_local4.m_sweep.c.x + _local8) - _local3.m_sweep.c.x) - _local5);
var _local11:Number = (((_local4.m_sweep.c.y + _local9) - _local3.m_sweep.c.y) - _local6);
var _local12:Number = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
_local10 = (_local10 / _local12);
_local11 = (_local11 / _local12);
var _local13:Number = (_local12 - m_length);
_local13 = b2Math.Clamp(_local13, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local14:Number = (-(m_mass) * _local13);
m_u.Set(_local10, _local11);
var _local15:Number = (_local14 * m_u.x);
var _local16:Number = (_local14 * m_u.y);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local15));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local16));
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local5 * _local16) - (_local6 * _local15))));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local15));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local16));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local8 * _local16) - (_local9 * _local15))));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
return ((b2Math.Abs(_local13) < b2Settings.b2_linearSlop));
}
}
}//package Box2D.Dynamics.Joints
Section 67
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2DistanceJointDef extends b2JointDef {
public var localAnchorA:b2Vec2;
public var localAnchorB:b2Vec2;
public var length:Number;
public var frequencyHz:Number;
public var dampingRatio:Number;
public function b2DistanceJointDef(){
localAnchorA = new b2Vec2();
localAnchorB = new b2Vec2();
super();
type = b2Joint.e_distanceJoint;
length = 1;
frequencyHz = 0;
dampingRatio = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
bodyA = _arg1;
bodyB = _arg2;
localAnchorA.SetV(bodyA.GetLocalPoint(_arg3));
localAnchorB.SetV(bodyB.GetLocalPoint(_arg4));
var _local5:Number = (_arg4.x - _arg3.x);
var _local6:Number = (_arg4.y - _arg3.y);
length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
frequencyHz = 0;
dampingRatio = 0;
}
}
}//package Box2D.Dynamics.Joints
Section 68
//b2FrictionJoint (Box2D.Dynamics.Joints.b2FrictionJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2FrictionJoint extends b2Joint {
private var m_localAnchorA:b2Vec2;
private var m_localAnchorB:b2Vec2;
public var m_linearMass:b2Mat22;
public var m_angularMass:Number;
private var m_linearImpulse:b2Vec2;
private var m_angularImpulse:Number;
private var m_maxForce:Number;
private var m_maxTorque:Number;
public function b2FrictionJoint(_arg1:b2FrictionJointDef){
m_localAnchorA = new b2Vec2();
m_localAnchorB = new b2Vec2();
m_linearMass = new b2Mat22();
m_linearImpulse = new b2Vec2();
super(_arg1);
m_localAnchorA.SetV(_arg1.localAnchorA);
m_localAnchorB.SetV(_arg1.localAnchorB);
m_linearMass.SetZero();
m_angularMass = 0;
m_linearImpulse.SetZero();
m_angularImpulse = 0;
m_maxForce = _arg1.maxForce;
m_maxTorque = _arg1.maxTorque;
}
override public function GetAnchorA():b2Vec2{
return (m_bodyA.GetWorldPoint(m_localAnchorA));
}
override public function GetAnchorB():b2Vec2{
return (m_bodyB.GetWorldPoint(m_localAnchorB));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2((_arg1 * m_linearImpulse.x), (_arg1 * m_linearImpulse.y)));
}
override public function GetReactionTorque(_arg1:Number):Number{
return ((_arg1 * m_angularImpulse));
}
public function SetMaxForce(_arg1:Number):void{
m_maxForce = _arg1;
}
public function GetMaxForce():Number{
return (m_maxForce);
}
public function SetMaxTorque(_arg1:Number):void{
m_maxTorque = _arg1;
}
public function GetMaxTorque():Number{
return (m_maxTorque);
}
override b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local8:Number;
var _local10:Number;
var _local12:Number;
var _local13:Number;
var _local14:b2Mat22;
var _local15:b2Vec2;
_local4 = m_bodyA;
_local5 = m_bodyB;
_local2 = _local4.m_xf.R;
_local6 = (m_localAnchorA.x - _local4.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchorA.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7));
_local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7));
_local6 = _local3;
_local2 = _local5.m_xf.R;
_local8 = (m_localAnchorB.x - _local5.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchorB.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
_local10 = _local4.m_invMass;
var _local11:Number = _local5.m_invMass;
_local12 = _local4.m_invI;
_local13 = _local5.m_invI;
_local14 = new b2Mat22();
_local14.col1.x = (_local10 + _local11);
_local14.col2.x = 0;
_local14.col1.y = 0;
_local14.col2.y = (_local10 + _local11);
_local14.col1.x = (_local14.col1.x + ((_local12 * _local7) * _local7));
_local14.col2.x = (_local14.col2.x + ((-(_local12) * _local6) * _local7));
_local14.col1.y = (_local14.col1.y + ((-(_local12) * _local6) * _local7));
_local14.col2.y = (_local14.col2.y + ((_local12 * _local6) * _local6));
_local14.col1.x = (_local14.col1.x + ((_local13 * _local9) * _local9));
_local14.col2.x = (_local14.col2.x + ((-(_local13) * _local8) * _local9));
_local14.col1.y = (_local14.col1.y + ((-(_local13) * _local8) * _local9));
_local14.col2.y = (_local14.col2.y + ((_local13 * _local8) * _local8));
_local14.GetInverse(m_linearMass);
m_angularMass = (_local12 + _local13);
if (m_angularMass > 0){
m_angularMass = (1 / m_angularMass);
};
if (_arg1.warmStarting){
m_linearImpulse.x = (m_linearImpulse.x * _arg1.dtRatio);
m_linearImpulse.y = (m_linearImpulse.y * _arg1.dtRatio);
m_angularImpulse = (m_angularImpulse * _arg1.dtRatio);
_local15 = m_linearImpulse;
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local10 * _local15.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local10 * _local15.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity - (_local12 * (((_local6 * _local15.y) - (_local7 * _local15.x)) + m_angularImpulse)));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local11 * _local15.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local11 * _local15.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + (_local13 * (((_local8 * _local15.y) - (_local9 * _local15.x)) + m_angularImpulse)));
} else {
m_linearImpulse.SetZero();
m_angularImpulse = 0;
};
}
override b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local18:Number;
var _local4:b2Body = m_bodyA;
var _local5:b2Body = m_bodyB;
var _local6:b2Vec2 = _local4.m_linearVelocity;
var _local7:Number = _local4.m_angularVelocity;
var _local8:b2Vec2 = _local5.m_linearVelocity;
var _local9:Number = _local5.m_angularVelocity;
var _local10:Number = _local4.m_invMass;
var _local11:Number = _local5.m_invMass;
var _local12:Number = _local4.m_invI;
var _local13:Number = _local5.m_invI;
_local2 = _local4.m_xf.R;
var _local14:Number = (m_localAnchorA.x - _local4.m_sweep.localCenter.x);
var _local15:Number = (m_localAnchorA.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local14) + (_local2.col2.x * _local15));
_local15 = ((_local2.col1.y * _local14) + (_local2.col2.y * _local15));
_local14 = _local3;
_local2 = _local5.m_xf.R;
var _local16:Number = (m_localAnchorB.x - _local5.m_sweep.localCenter.x);
var _local17:Number = (m_localAnchorB.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local16) + (_local2.col2.x * _local17));
_local17 = ((_local2.col1.y * _local16) + (_local2.col2.y * _local17));
_local16 = _local3;
var _local19:Number = (_local9 - _local7);
var _local20:Number = (-(m_angularMass) * _local19);
var _local21:Number = m_angularImpulse;
_local18 = (_arg1.dt * m_maxTorque);
m_angularImpulse = b2Math.Clamp((m_angularImpulse + _local20), -(_local18), _local18);
_local20 = (m_angularImpulse - _local21);
_local7 = (_local7 - (_local12 * _local20));
_local9 = (_local9 + (_local13 * _local20));
var _local22:Number = (((_local8.x - (_local9 * _local17)) - _local6.x) + (_local7 * _local15));
var _local23:Number = (((_local8.y + (_local9 * _local16)) - _local6.y) - (_local7 * _local14));
var _local24:b2Vec2 = b2Math.MulMV(m_linearMass, new b2Vec2(-(_local22), -(_local23)));
var _local25:b2Vec2 = m_linearImpulse.Copy();
m_linearImpulse.Add(_local24);
_local18 = (_arg1.dt * m_maxForce);
if (m_linearImpulse.LengthSquared() > (_local18 * _local18)){
m_linearImpulse.Normalize();
m_linearImpulse.Multiply(_local18);
};
_local24 = b2Math.SubtractVV(m_linearImpulse, _local25);
_local6.x = (_local6.x - (_local10 * _local24.x));
_local6.y = (_local6.y - (_local10 * _local24.y));
_local7 = (_local7 - (_local12 * ((_local14 * _local24.y) - (_local15 * _local24.x))));
_local8.x = (_local8.x + (_local11 * _local24.x));
_local8.y = (_local8.y + (_local11 * _local24.y));
_local9 = (_local9 + (_local13 * ((_local16 * _local24.y) - (_local17 * _local24.x))));
_local4.m_angularVelocity = _local7;
_local5.m_angularVelocity = _local9;
}
override b2internal function SolvePositionConstraints(_arg1:Number):Boolean{
return (true);
}
}
}//package Box2D.Dynamics.Joints
Section 69
//b2FrictionJointDef (Box2D.Dynamics.Joints.b2FrictionJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2FrictionJointDef extends b2JointDef {
public var localAnchorA:b2Vec2;
public var localAnchorB:b2Vec2;
public var maxForce:Number;
public var maxTorque:Number;
public function b2FrictionJointDef(){
localAnchorA = new b2Vec2();
localAnchorB = new b2Vec2();
super();
type = b2Joint.e_frictionJoint;
maxForce = 0;
maxTorque = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{
bodyA = _arg1;
bodyB = _arg2;
localAnchorA.SetV(bodyA.GetLocalPoint(_arg3));
localAnchorB.SetV(bodyB.GetLocalPoint(_arg3));
}
}
}//package Box2D.Dynamics.Joints
Section 70
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2GearJoint extends b2Joint {
private var m_ground1:b2Body;
private var m_ground2:b2Body;
private var m_revolute1:b2RevoluteJoint;
private var m_prismatic1:b2PrismaticJoint;
private var m_revolute2:b2RevoluteJoint;
private var m_prismatic2:b2PrismaticJoint;
private var m_groundAnchor1:b2Vec2;
private var m_groundAnchor2:b2Vec2;
private var m_localAnchor1:b2Vec2;
private var m_localAnchor2:b2Vec2;
private var m_J:b2Jacobian;
private var m_constant:Number;
private var m_ratio:Number;
private var m_mass:Number;
private var m_impulse:Number;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local4:Number;
var _local5:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_J = new b2Jacobian();
super(_arg1);
var _local2:int = _arg1.joint1.m_type;
var _local3:int = _arg1.joint2.m_type;
m_revolute1 = null;
m_prismatic1 = null;
m_revolute2 = null;
m_prismatic2 = null;
m_ground1 = _arg1.joint1.GetBodyA();
m_bodyA = _arg1.joint1.GetBodyB();
if (_local2 == b2Joint.e_revoluteJoint){
m_revolute1 = (_arg1.joint1 as b2RevoluteJoint);
m_groundAnchor1.SetV(m_revolute1.m_localAnchor1);
m_localAnchor1.SetV(m_revolute1.m_localAnchor2);
_local4 = m_revolute1.GetJointAngle();
} else {
m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint);
m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1);
m_localAnchor1.SetV(m_prismatic1.m_localAnchor2);
_local4 = m_prismatic1.GetJointTranslation();
};
m_ground2 = _arg1.joint2.GetBodyA();
m_bodyB = _arg1.joint2.GetBodyB();
if (_local3 == b2Joint.e_revoluteJoint){
m_revolute2 = (_arg1.joint2 as b2RevoluteJoint);
m_groundAnchor2.SetV(m_revolute2.m_localAnchor1);
m_localAnchor2.SetV(m_revolute2.m_localAnchor2);
_local5 = m_revolute2.GetJointAngle();
} else {
m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint);
m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1);
m_localAnchor2.SetV(m_prismatic2.m_localAnchor2);
_local5 = m_prismatic2.GetJointTranslation();
};
m_ratio = _arg1.ratio;
m_constant = (_local4 + (m_ratio * _local5));
m_impulse = 0;
}
override public function GetAnchorA():b2Vec2{
return (m_bodyA.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchorB():b2Vec2{
return (m_bodyB.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2(((_arg1 * m_impulse) * m_J.linearB.x), ((_arg1 * m_impulse) * m_J.linearB.y)));
}
override public function GetReactionTorque(_arg1:Number):Number{
var _local2:b2Mat22 = m_bodyB.m_xf.R;
var _local3:Number = (m_localAnchor1.x - m_bodyB.m_sweep.localCenter.x);
var _local4:Number = (m_localAnchor1.y - m_bodyB.m_sweep.localCenter.y);
var _local5:Number = ((_local2.col1.x * _local3) + (_local2.col2.x * _local4));
_local4 = ((_local2.col1.y * _local3) + (_local2.col2.y * _local4));
_local3 = _local5;
var _local6:Number = (m_impulse * m_J.linearB.x);
var _local7:Number = (m_impulse * m_J.linearB.y);
return ((_arg1 * (((m_impulse * m_J.angularB) - (_local3 * _local7)) + (_local4 * _local6))));
}
public function GetRatio():Number{
return (m_ratio);
}
public function SetRatio(_arg1:Number):void{
m_ratio = _arg1;
}
override b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Body;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local2:b2Body = m_ground1;
var _local3:b2Body = m_ground2;
_local4 = m_bodyA;
var _local5:b2Body = m_bodyB;
var _local14:Number = 0;
m_J.SetZero();
if (m_revolute1){
m_J.angularA = -1;
_local14 = (_local14 + _local4.m_invI);
} else {
_local10 = _local2.m_xf.R;
_local11 = m_prismatic1.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local4.m_xf.R;
_local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linearA.Set(-(_local6), -(_local7));
m_J.angularA = -(_local12);
_local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12)));
};
if (m_revolute2){
m_J.angularB = -(m_ratio);
_local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI));
} else {
_local10 = _local3.m_xf.R;
_local11 = m_prismatic2.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linearB.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7));
m_J.angularB = (-(m_ratio) * _local12);
_local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12))));
};
m_mass = ((_local14 > 0)) ? (1 / _local14) : 0;
if (_arg1.warmStarting){
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * m_impulse) * m_J.linearA.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * m_impulse) * m_J.linearA.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * m_impulse) * m_J.angularA));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * m_impulse) * m_J.linearB.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * m_impulse) * m_J.linearB.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * m_impulse) * m_J.angularB));
} else {
m_impulse = 0;
};
}
override b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body = m_bodyA;
var _local3:b2Body = m_bodyB;
var _local4:Number = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local5:Number = (-(m_mass) * _local4);
m_impulse = (m_impulse + _local5);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local5) * m_J.linearA.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local5) * m_J.linearA.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local5) * m_J.angularA));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local5) * m_J.linearB.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local5) * m_J.linearB.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local5) * m_J.angularB));
}
override b2internal function SolvePositionConstraints(_arg1:Number):Boolean{
var _local5:Number;
var _local6:Number;
var _local2:Number = 0;
var _local3:b2Body = m_bodyA;
var _local4:b2Body = m_bodyB;
if (m_revolute1){
_local5 = m_revolute1.GetJointAngle();
} else {
_local5 = m_prismatic1.GetJointTranslation();
};
if (m_revolute2){
_local6 = m_revolute2.GetJointAngle();
} else {
_local6 = m_prismatic2.GetJointTranslation();
};
var _local7:Number = (m_constant - (_local5 + (m_ratio * _local6)));
var _local8:Number = (-(m_mass) * _local7);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local8) * m_J.linearA.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local8) * m_J.linearA.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local8) * m_J.angularA));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local4.m_invMass * _local8) * m_J.linearB.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local4.m_invMass * _local8) * m_J.linearB.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local4.m_invI * _local8) * m_J.angularB));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
return ((_local2 < b2Settings.b2_linearSlop));
}
}
}//package Box2D.Dynamics.Joints
Section 71
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef)
package Box2D.Dynamics.Joints {
public class b2GearJointDef extends b2JointDef {
public var joint1:b2Joint;
public var joint2:b2Joint;
public var ratio:Number;
public function b2GearJointDef(){
type = b2Joint.e_gearJoint;
joint1 = null;
joint2 = null;
ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 72
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2Jacobian {
public var linearA:b2Vec2;
public var angularA:Number;
public var linearB:b2Vec2;
public var angularB:Number;
public function b2Jacobian(){
linearA = new b2Vec2();
linearB = new b2Vec2();
super();
}
public function SetZero():void{
linearA.SetZero();
angularA = 0;
linearB.SetZero();
angularB = 0;
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linearA.SetV(_arg1);
angularA = _arg2;
linearB.SetV(_arg3);
angularB = _arg4;
}
public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{
return ((((((linearA.x * _arg1.x) + (linearA.y * _arg1.y)) + (angularA * _arg2)) + ((linearB.x * _arg3.x) + (linearB.y * _arg3.y))) + (angularB * _arg4)));
}
}
}//package Box2D.Dynamics.Joints
Section 73
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Joint {
b2internal var m_type:int;
b2internal var m_prev:b2Joint;
b2internal var m_next:b2Joint;
b2internal var m_edgeA:b2JointEdge;
b2internal var m_edgeB:b2JointEdge;
b2internal var m_bodyA:b2Body;
b2internal var m_bodyB:b2Body;
b2internal var m_islandFlag:Boolean;
b2internal var m_collideConnected:Boolean;
private var m_userData;
b2internal var m_localCenterA:b2Vec2;
b2internal var m_localCenterB:b2Vec2;
b2internal var m_invMassA:Number;
b2internal var m_invMassB:Number;
b2internal var m_invIA:Number;
b2internal var m_invIB:Number;
b2internal static const e_unknownJoint:int = 0;
b2internal static const e_revoluteJoint:int = 1;
b2internal static const e_prismaticJoint:int = 2;
b2internal static const e_distanceJoint:int = 3;
b2internal static const e_pulleyJoint:int = 4;
b2internal static const e_mouseJoint:int = 5;
b2internal static const e_gearJoint:int = 6;
b2internal static const e_lineJoint:int = 7;
b2internal static const e_weldJoint:int = 8;
b2internal static const e_frictionJoint:int = 9;
b2internal static const e_ropeJoint:int = 15;
b2internal static const e_inactiveLimit:int = 0;
b2internal static const e_atLowerLimit:int = 1;
b2internal static const e_atUpperLimit:int = 2;
b2internal static const e_equalLimits:int = 3;
public function b2Joint(_arg1:b2JointDef){
m_edgeA = new b2JointEdge();
m_edgeB = new b2JointEdge();
m_localCenterA = new b2Vec2();
m_localCenterB = new b2Vec2();
super();
b2Settings.b2Assert(!((_arg1.bodyA == _arg1.bodyB)));
m_type = _arg1.type;
m_prev = null;
m_next = null;
m_bodyA = _arg1.bodyA;
m_bodyB = _arg1.bodyB;
m_collideConnected = _arg1.collideConnected;
m_islandFlag = false;
m_userData = _arg1.userData;
}
public function GetType():int{
return (m_type);
}
public function GetAnchorA():b2Vec2{
return (null);
}
public function GetAnchorB():b2Vec2{
return (null);
}
public function GetReactionForce(_arg1:Number):b2Vec2{
return (null);
}
public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function GetBodyA():b2Body{
return (m_bodyA);
}
public function GetBodyB():b2Body{
return (m_bodyB);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetUserData(){
return (m_userData);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function IsActive():Boolean{
return (((m_bodyA.IsActive()) && (m_bodyB.IsActive())));
}
b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
}
b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
b2internal function FinalizeVelocityConstraints():void{
}
b2internal function SolvePositionConstraints(_arg1:Number):Boolean{
return (false);
}
b2internal static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
switch (_arg1.type){
case e_distanceJoint:
_local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef));
break;
case e_mouseJoint:
_local3 = new b2MouseJoint((_arg1 as b2MouseJointDef));
break;
case e_prismaticJoint:
_local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef));
break;
case e_revoluteJoint:
_local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef));
break;
case e_pulleyJoint:
_local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef));
break;
case e_gearJoint:
_local3 = new b2GearJoint((_arg1 as b2GearJointDef));
break;
case e_lineJoint:
_local3 = new b2LineJoint((_arg1 as b2LineJointDef));
break;
case e_weldJoint:
_local3 = new b2WeldJoint((_arg1 as b2WeldJointDef));
break;
case e_frictionJoint:
_local3 = new b2FrictionJoint((_arg1 as b2FrictionJointDef));
break;
default:
break;
};
return (_local3);
}
b2internal static function Destroy(_arg1:b2Joint, _arg2):void{
}
}
}//package Box2D.Dynamics.Joints
Section 74
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointDef {
public var type:int;
public var userData;
public var bodyA:b2Body;
public var bodyB:b2Body;
public var collideConnected:Boolean;
public function b2JointDef(){
type = b2Joint.e_unknownJoint;
userData = null;
bodyA = null;
bodyB = null;
collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 75
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointEdge {
public var other:b2Body;
public var joint:b2Joint;
public var prev:b2JointEdge;
public var next:b2JointEdge;
}
}//package Box2D.Dynamics.Joints
Section 76
//b2LineJoint (Box2D.Dynamics.Joints.b2LineJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2LineJoint extends b2Joint {
b2internal var m_localAnchor1:b2Vec2;
b2internal var m_localAnchor2:b2Vec2;
b2internal var m_localXAxis1:b2Vec2;
private var m_localYAxis1:b2Vec2;
private var m_axis:b2Vec2;
private var m_perp:b2Vec2;
private var m_s1:Number;
private var m_s2:Number;
private var m_a1:Number;
private var m_a2:Number;
private var m_K:b2Mat22;
private var m_impulse:b2Vec2;
private var m_motorMass:Number;
private var m_motorImpulse:Number;
private var m_lowerTranslation:Number;
private var m_upperTranslation:Number;
private var m_maxMotorForce:Number;
private var m_motorSpeed:Number;
private var m_enableLimit:Boolean;
private var m_enableMotor:Boolean;
private var m_limitState:int;
public function b2LineJoint(_arg1:b2LineJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_localXAxis1 = new b2Vec2();
m_localYAxis1 = new b2Vec2();
m_axis = new b2Vec2();
m_perp = new b2Vec2();
m_K = new b2Mat22();
m_impulse = new b2Vec2();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchorA);
m_localAnchor2.SetV(_arg1.localAnchorB);
m_localXAxis1.SetV(_arg1.localAxisA);
m_localYAxis1.x = -(m_localXAxis1.y);
m_localYAxis1.y = m_localXAxis1.x;
m_impulse.SetZero();
m_motorMass = 0;
m_motorImpulse = 0;
m_lowerTranslation = _arg1.lowerTranslation;
m_upperTranslation = _arg1.upperTranslation;
m_maxMotorForce = _arg1.maxMotorForce;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
m_limitState = e_inactiveLimit;
m_axis.SetZero();
m_perp.SetZero();
}
override public function GetAnchorA():b2Vec2{
return (m_bodyA.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchorB():b2Vec2{
return (m_bodyB.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2((_arg1 * ((m_impulse.x * m_perp.x) + ((m_motorImpulse + m_impulse.y) * m_axis.x))), (_arg1 * ((m_impulse.x * m_perp.y) + ((m_motorImpulse + m_impulse.y) * m_axis.y)))));
}
override public function GetReactionTorque(_arg1:Number):Number{
return ((_arg1 * m_impulse.y));
}
public function GetJointTranslation():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_bodyA;
var _local2:b2Body = m_bodyB;
var _local4:b2Vec2 = _local1.GetWorldPoint(m_localAnchor1);
var _local5:b2Vec2 = _local2.GetWorldPoint(m_localAnchor2);
var _local6:Number = (_local5.x - _local4.x);
var _local7:Number = (_local5.y - _local4.y);
var _local8:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local9:Number = ((_local8.x * _local6) + (_local8.y * _local7));
return (_local9);
}
public function GetJointSpeed():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_bodyA;
var _local2:b2Body = m_bodyB;
_local3 = _local1.m_xf.R;
var _local4:Number = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
var _local5:Number = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local3 = _local2.m_xf.R;
var _local7:Number = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8));
_local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8));
_local7 = _local6;
var _local9:Number = (_local1.m_sweep.c.x + _local4);
var _local10:Number = (_local1.m_sweep.c.y + _local5);
var _local11:Number = (_local2.m_sweep.c.x + _local7);
var _local12:Number = (_local2.m_sweep.c.y + _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = (_local12 - _local10);
var _local15:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local16:b2Vec2 = _local1.m_linearVelocity;
var _local17:b2Vec2 = _local2.m_linearVelocity;
var _local18:Number = _local1.m_angularVelocity;
var _local19:Number = _local2.m_angularVelocity;
var _local20:Number = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4)))));
return (_local20);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function EnableLimit(_arg1:Boolean):void{
m_bodyA.SetAwake(true);
m_bodyB.SetAwake(true);
m_enableLimit = _arg1;
}
public function GetLowerLimit():Number{
return (m_lowerTranslation);
}
public function GetUpperLimit():Number{
return (m_upperTranslation);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_bodyA.SetAwake(true);
m_bodyB.SetAwake(true);
m_lowerTranslation = _arg1;
m_upperTranslation = _arg2;
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
public function EnableMotor(_arg1:Boolean):void{
m_bodyA.SetAwake(true);
m_bodyB.SetAwake(true);
m_enableMotor = _arg1;
}
public function SetMotorSpeed(_arg1:Number):void{
m_bodyA.SetAwake(true);
m_bodyB.SetAwake(true);
m_motorSpeed = _arg1;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
public function SetMaxMotorForce(_arg1:Number):void{
m_bodyA.SetAwake(true);
m_bodyB.SetAwake(true);
m_maxMotorForce = _arg1;
}
public function GetMaxMotorForce():Number{
return (m_maxMotorForce);
}
public function GetMotorForce():Number{
return (m_motorImpulse);
}
override b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local2:b2Body = m_bodyA;
var _local3:b2Body = m_bodyB;
m_localCenterA.SetV(_local2.GetLocalCenter());
m_localCenterB.SetV(_local3.GetLocalCenter());
var _local6:b2Transform = _local2.GetTransform();
var _local7:b2Transform = _local3.GetTransform();
_local4 = _local2.m_xf.R;
var _local8:Number = (m_localAnchor1.x - m_localCenterA.x);
var _local9:Number = (m_localAnchor1.y - m_localCenterA.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
_local4 = _local3.m_xf.R;
var _local10:Number = (m_localAnchor2.x - m_localCenterB.x);
var _local11:Number = (m_localAnchor2.y - m_localCenterB.y);
_local5 = ((_local4.col1.x * _local10) + (_local4.col2.x * _local11));
_local11 = ((_local4.col1.y * _local10) + (_local4.col2.y * _local11));
_local10 = _local5;
var _local12:Number = (((_local3.m_sweep.c.x + _local10) - _local2.m_sweep.c.x) - _local8);
var _local13:Number = (((_local3.m_sweep.c.y + _local11) - _local2.m_sweep.c.y) - _local9);
m_invMassA = _local2.m_invMass;
m_invMassB = _local3.m_invMass;
m_invIA = _local2.m_invI;
m_invIB = _local3.m_invI;
m_axis.SetV(b2Math.MulMV(_local6.R, m_localXAxis1));
m_a1 = (((_local12 + _local8) * m_axis.y) - ((_local13 + _local9) * m_axis.x));
m_a2 = ((_local10 * m_axis.y) - (_local11 * m_axis.x));
m_motorMass = (((m_invMassA + m_invMassB) + ((m_invIA * m_a1) * m_a1)) + ((m_invIB * m_a2) * m_a2));
m_motorMass = ((m_motorMass > Number.MIN_VALUE)) ? (1 / m_motorMass) : 0;
m_perp.SetV(b2Math.MulMV(_local6.R, m_localYAxis1));
m_s1 = (((_local12 + _local8) * m_perp.y) - ((_local13 + _local9) * m_perp.x));
m_s2 = ((_local10 * m_perp.y) - (_local11 * m_perp.x));
var _local14:Number = m_invMassA;
var _local15:Number = m_invMassB;
var _local16:Number = m_invIA;
var _local17:Number = m_invIB;
m_K.col1.x = (((_local14 + _local15) + ((_local16 * m_s1) * m_s1)) + ((_local17 * m_s2) * m_s2));
m_K.col1.y = (((_local16 * m_s1) * m_a1) + ((_local17 * m_s2) * m_a2));
m_K.col2.x = m_K.col1.y;
m_K.col2.y = (((_local14 + _local15) + ((_local16 * m_a1) * m_a1)) + ((_local17 * m_a2) * m_a2));
if (m_enableLimit){
_local18 = ((m_axis.x * _local12) + (m_axis.y * _local13));
if (b2Math.Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local18 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitState = e_atLowerLimit;
m_impulse.y = 0;
};
} else {
if (_local18 >= m_upperTranslation){
if (m_limitState != e_atUpperLimit){
m_limitState = e_atUpperLimit;
m_impulse.y = 0;
};
} else {
m_limitState = e_inactiveLimit;
m_impulse.y = 0;
};
};
};
} else {
m_limitState = e_inactiveLimit;
};
if (m_enableMotor == false){
m_motorImpulse = 0;
};
if (_arg1.warmStarting){
m_impulse.x = (m_impulse.x * _arg1.dtRatio);
m_impulse.y = (m_impulse.y * _arg1.dtRatio);
m_motorImpulse = (m_motorImpulse * _arg1.dtRatio);
_local19 = ((m_impulse.x * m_perp.x) + ((m_motorImpulse + m_impulse.y) * m_axis.x));
_local20 = ((m_impulse.x * m_perp.y) + ((m_motorImpulse + m_impulse.y) * m_axis.y));
_local21 = ((m_impulse.x * m_s1) + ((m_motorImpulse + m_impulse.y) * m_a1));
_local22 = ((m_impulse.x * m_s2) + ((m_motorImpulse + m_impulse.y) * m_a2));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (m_invMassA * _local19));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (m_invMassA * _local20));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (m_invIA * _local21));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (m_invMassB * _local19));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (m_invMassB * _local20));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (m_invIB * _local22));
} else {
m_impulse.SetZero();
m_motorImpulse = 0;
};
}
override b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:b2Vec2;
var _local19:b2Vec2;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local2:b2Body = m_bodyA;
var _local3:b2Body = m_bodyB;
var _local4:b2Vec2 = _local2.m_linearVelocity;
var _local5:Number = _local2.m_angularVelocity;
var _local6:b2Vec2 = _local3.m_linearVelocity;
var _local7:Number = _local3.m_angularVelocity;
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local13 = ((((m_axis.x * (_local6.x - _local4.x)) + (m_axis.y * (_local6.y - _local4.y))) + (m_a2 * _local7)) - (m_a1 * _local5));
_local14 = (m_motorMass * (m_motorSpeed - _local13));
_local15 = m_motorImpulse;
_local16 = (_arg1.dt * m_maxMotorForce);
m_motorImpulse = b2Math.Clamp((m_motorImpulse + _local14), -(_local16), _local16);
_local14 = (m_motorImpulse - _local15);
_local8 = (_local14 * m_axis.x);
_local9 = (_local14 * m_axis.y);
_local10 = (_local14 * m_a1);
_local11 = (_local14 * m_a2);
_local4.x = (_local4.x - (m_invMassA * _local8));
_local4.y = (_local4.y - (m_invMassA * _local9));
_local5 = (_local5 - (m_invIA * _local10));
_local6.x = (_local6.x + (m_invMassB * _local8));
_local6.y = (_local6.y + (m_invMassB * _local9));
_local7 = (_local7 + (m_invIB * _local11));
};
var _local12:Number = ((((m_perp.x * (_local6.x - _local4.x)) + (m_perp.y * (_local6.y - _local4.y))) + (m_s2 * _local7)) - (m_s1 * _local5));
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local17 = ((((m_axis.x * (_local6.x - _local4.x)) + (m_axis.y * (_local6.y - _local4.y))) + (m_a2 * _local7)) - (m_a1 * _local5));
_local18 = m_impulse.Copy();
_local19 = m_K.Solve(new b2Vec2(), -(_local12), -(_local17));
m_impulse.Add(_local19);
if (m_limitState == e_atLowerLimit){
m_impulse.y = b2Math.Max(m_impulse.y, 0);
} else {
if (m_limitState == e_atUpperLimit){
m_impulse.y = b2Math.Min(m_impulse.y, 0);
};
};
_local20 = (-(_local12) - ((m_impulse.y - _local18.y) * m_K.col2.x));
if (m_K.col1.x != 0){
_local21 = ((_local20 / m_K.col1.x) + _local18.x);
} else {
_local21 = _local18.x;
};
m_impulse.x = _local21;
_local19.x = (m_impulse.x - _local18.x);
_local19.y = (m_impulse.y - _local18.y);
_local8 = ((_local19.x * m_perp.x) + (_local19.y * m_axis.x));
_local9 = ((_local19.x * m_perp.y) + (_local19.y * m_axis.y));
_local10 = ((_local19.x * m_s1) + (_local19.y * m_a1));
_local11 = ((_local19.x * m_s2) + (_local19.y * m_a2));
_local4.x = (_local4.x - (m_invMassA * _local8));
_local4.y = (_local4.y - (m_invMassA * _local9));
_local5 = (_local5 - (m_invIA * _local10));
_local6.x = (_local6.x + (m_invMassB * _local8));
_local6.y = (_local6.y + (m_invMassB * _local9));
_local7 = (_local7 + (m_invIB * _local11));
} else {
if (m_K.col1.x != 0){
_local22 = (-(_local12) / m_K.col1.x);
} else {
_local22 = 0;
};
m_impulse.x = (m_impulse.x + _local22);
_local8 = (_local22 * m_perp.x);
_local9 = (_local22 * m_perp.y);
_local10 = (_local22 * m_s1);
_local11 = (_local22 * m_s2);
_local4.x = (_local4.x - (m_invMassA * _local8));
_local4.y = (_local4.y - (m_invMassA * _local9));
_local5 = (_local5 - (m_invIA * _local10));
_local6.x = (_local6.x + (m_invMassB * _local8));
_local6.y = (_local6.y + (m_invMassB * _local9));
_local7 = (_local7 + (m_invIB * _local11));
};
_local2.m_linearVelocity.SetV(_local4);
_local2.m_angularVelocity = _local5;
_local3.m_linearVelocity.SetV(_local6);
_local3.m_angularVelocity = _local7;
}
override b2internal function SolvePositionConstraints(_arg1:Number):Boolean{
var _local2:Number;
var _local3:Number;
var _local10:b2Mat22;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local4:b2Body = m_bodyA;
var _local5:b2Body = m_bodyB;
var _local6:b2Vec2 = _local4.m_sweep.c;
var _local7:Number = _local4.m_sweep.a;
var _local8:b2Vec2 = _local5.m_sweep.c;
var _local9:Number = _local5.m_sweep.a;
var _local16:Number = 0;
var _local17:Number = 0;
var _local18:Boolean;
var _local19:Number = 0;
var _local20:b2Mat22 = b2Mat22.FromAngle(_local7);
var _local21:b2Mat22 = b2Mat22.FromAngle(_local9);
_local10 = _local20;
var _local22:Number = (m_localAnchor1.x - m_localCenterA.x);
var _local23:Number = (m_localAnchor1.y - m_localCenterA.y);
_local11 = ((_local10.col1.x * _local22) + (_local10.col2.x * _local23));
_local23 = ((_local10.col1.y * _local22) + (_local10.col2.y * _local23));
_local22 = _local11;
_local10 = _local21;
var _local24:Number = (m_localAnchor2.x - m_localCenterB.x);
var _local25:Number = (m_localAnchor2.y - m_localCenterB.y);
_local11 = ((_local10.col1.x * _local24) + (_local10.col2.x * _local25));
_local25 = ((_local10.col1.y * _local24) + (_local10.col2.y * _local25));
_local24 = _local11;
var _local26:Number = (((_local8.x + _local24) - _local6.x) - _local22);
var _local27:Number = (((_local8.y + _local25) - _local6.y) - _local23);
if (m_enableLimit){
m_axis = b2Math.MulMV(_local20, m_localXAxis1);
m_a1 = (((_local26 + _local22) * m_axis.y) - ((_local27 + _local23) * m_axis.x));
m_a2 = ((_local24 * m_axis.y) - (_local25 * m_axis.x));
_local34 = ((m_axis.x * _local26) + (m_axis.y * _local27));
if (b2Math.Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
_local19 = b2Math.Clamp(_local34, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local16 = b2Math.Abs(_local34);
_local18 = true;
} else {
if (_local34 <= m_lowerTranslation){
_local19 = b2Math.Clamp(((_local34 - m_lowerTranslation) + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local16 = (m_lowerTranslation - _local34);
_local18 = true;
} else {
if (_local34 >= m_upperTranslation){
_local19 = b2Math.Clamp(((_local34 - m_upperTranslation) + b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local16 = (_local34 - m_upperTranslation);
_local18 = true;
};
};
};
};
m_perp = b2Math.MulMV(_local20, m_localYAxis1);
m_s1 = (((_local26 + _local22) * m_perp.y) - ((_local27 + _local23) * m_perp.x));
m_s2 = ((_local24 * m_perp.y) - (_local25 * m_perp.x));
var _local28:b2Vec2 = new b2Vec2();
var _local29:Number = ((m_perp.x * _local26) + (m_perp.y * _local27));
_local16 = b2Math.Max(_local16, b2Math.Abs(_local29));
_local17 = 0;
if (_local18){
_local12 = m_invMassA;
_local13 = m_invMassB;
_local14 = m_invIA;
_local15 = m_invIB;
m_K.col1.x = (((_local12 + _local13) + ((_local14 * m_s1) * m_s1)) + ((_local15 * m_s2) * m_s2));
m_K.col1.y = (((_local14 * m_s1) * m_a1) + ((_local15 * m_s2) * m_a2));
m_K.col2.x = m_K.col1.y;
m_K.col2.y = (((_local12 + _local13) + ((_local14 * m_a1) * m_a1)) + ((_local15 * m_a2) * m_a2));
m_K.Solve(_local28, -(_local29), -(_local19));
} else {
_local12 = m_invMassA;
_local13 = m_invMassB;
_local14 = m_invIA;
_local15 = m_invIB;
_local35 = (((_local12 + _local13) + ((_local14 * m_s1) * m_s1)) + ((_local15 * m_s2) * m_s2));
if (_local35 != 0){
_local36 = (-(_local29) / _local35);
} else {
_local36 = 0;
};
_local28.x = _local36;
_local28.y = 0;
};
var _local30:Number = ((_local28.x * m_perp.x) + (_local28.y * m_axis.x));
var _local31:Number = ((_local28.x * m_perp.y) + (_local28.y * m_axis.y));
var _local32:Number = ((_local28.x * m_s1) + (_local28.y * m_a1));
var _local33:Number = ((_local28.x * m_s2) + (_local28.y * m_a2));
_local6.x = (_local6.x - (m_invMassA * _local30));
_local6.y = (_local6.y - (m_invMassA * _local31));
_local7 = (_local7 - (m_invIA * _local32));
_local8.x = (_local8.x + (m_invMassB * _local30));
_local8.y = (_local8.y + (m_invMassB * _local31));
_local9 = (_local9 + (m_invIB * _local33));
_local4.m_sweep.a = _local7;
_local5.m_sweep.a = _local9;
_local4.SynchronizeTransform();
_local5.SynchronizeTransform();
return ((((_local16 <= b2Settings.b2_linearSlop)) && ((_local17 <= b2Settings.b2_angularSlop))));
}
}
}//package Box2D.Dynamics.Joints
Section 77
//b2LineJointDef (Box2D.Dynamics.Joints.b2LineJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2LineJointDef extends b2JointDef {
public var localAnchorA:b2Vec2;
public var localAnchorB:b2Vec2;
public var localAxisA:b2Vec2;
public var enableLimit:Boolean;
public var lowerTranslation:Number;
public var upperTranslation:Number;
public var enableMotor:Boolean;
public var maxMotorForce:Number;
public var motorSpeed:Number;
public function b2LineJointDef(){
localAnchorA = new b2Vec2();
localAnchorB = new b2Vec2();
localAxisA = new b2Vec2();
super();
type = b2Joint.e_lineJoint;
localAxisA.Set(1, 0);
enableLimit = false;
lowerTranslation = 0;
upperTranslation = 0;
enableMotor = false;
maxMotorForce = 0;
motorSpeed = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
bodyA = _arg1;
bodyB = _arg2;
localAnchorA = bodyA.GetLocalPoint(_arg3);
localAnchorB = bodyB.GetLocalPoint(_arg3);
localAxisA = bodyA.GetLocalVector(_arg4);
}
}
}//package Box2D.Dynamics.Joints
Section 78
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2MouseJoint extends b2Joint {
private var K:b2Mat22;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var m_localAnchor:b2Vec2;
private var m_target:b2Vec2;
private var m_impulse:b2Vec2;
private var m_mass:b2Mat22;
private var m_C:b2Vec2;
private var m_maxForce:Number;
private var m_frequencyHz:Number;
private var m_dampingRatio:Number;
private var m_beta:Number;
private var m_gamma:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
var _local2:Number;
var _local4:b2Mat22;
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
m_localAnchor = new b2Vec2();
m_target = new b2Vec2();
m_impulse = new b2Vec2();
m_mass = new b2Mat22();
m_C = new b2Vec2();
super(_arg1);
m_target.SetV(_arg1.target);
_local2 = (m_target.x - m_bodyB.m_xf.position.x);
var _local3:Number = (m_target.y - m_bodyB.m_xf.position.y);
_local4 = m_bodyB.m_xf.R;
m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y));
m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y));
m_maxForce = _arg1.maxForce;
m_impulse.SetZero();
m_frequencyHz = _arg1.frequencyHz;
m_dampingRatio = _arg1.dampingRatio;
m_beta = 0;
m_gamma = 0;
}
override public function GetAnchorA():b2Vec2{
return (m_target);
}
override public function GetAnchorB():b2Vec2{
return (m_bodyB.GetWorldPoint(m_localAnchor));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2((_arg1 * m_impulse.x), (_arg1 * m_impulse.y)));
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function GetTarget():b2Vec2{
return (m_target);
}
public function SetTarget(_arg1:b2Vec2):void{
if (m_bodyB.IsAwake() == false){
m_bodyB.SetAwake(true);
};
m_target = _arg1;
}
public function GetMaxForce():Number{
return (m_maxForce);
}
public function SetMaxForce(_arg1:Number):void{
m_maxForce = _arg1;
}
public function GetFrequency():Number{
return (m_frequencyHz);
}
public function SetFrequency(_arg1:Number):void{
m_frequencyHz = _arg1;
}
public function GetDampingRatio():Number{
return (m_dampingRatio);
}
public function SetDampingRatio(_arg1:Number):void{
m_dampingRatio = _arg1;
}
override b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local7:b2Mat22;
var _local11:Number;
var _local12:Number;
var _local2:b2Body = m_bodyB;
var _local3:Number = _local2.GetMass();
var _local4:Number = ((2 * Math.PI) * m_frequencyHz);
var _local5:Number = (((2 * _local3) * m_dampingRatio) * _local4);
var _local6:Number = ((_local3 * _local4) * _local4);
m_gamma = (_arg1.dt * (_local5 + (_arg1.dt * _local6)));
m_gamma = ((m_gamma)!=0) ? (1 / m_gamma) : 0;
m_beta = ((_arg1.dt * _local6) * m_gamma);
_local7 = _local2.m_xf.R;
var _local8:Number = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
var _local10:Number = ((_local7.col1.x * _local8) + (_local7.col2.x * _local9));
_local9 = ((_local7.col1.y * _local8) + (_local7.col2.y * _local9));
_local8 = _local10;
_local11 = _local2.m_invMass;
_local12 = _local2.m_invI;
K1.col1.x = _local11;
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = _local11;
K2.col1.x = ((_local12 * _local9) * _local9);
K2.col2.x = ((-(_local12) * _local8) * _local9);
K2.col1.y = ((-(_local12) * _local8) * _local9);
K2.col2.y = ((_local12 * _local8) * _local8);
K.SetM(K1);
K.AddM(K2);
K.col1.x = (K.col1.x + m_gamma);
K.col2.y = (K.col2.y + m_gamma);
K.GetInverse(m_mass);
m_C.x = ((_local2.m_sweep.c.x + _local8) - m_target.x);
m_C.y = ((_local2.m_sweep.c.y + _local9) - m_target.y);
_local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98);
m_impulse.x = (m_impulse.x * _arg1.dtRatio);
m_impulse.y = (m_impulse.y * _arg1.dtRatio);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local11 * m_impulse.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local11 * m_impulse.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * ((_local8 * m_impulse.y) - (_local9 * m_impulse.x))));
}
override b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local2:b2Body = m_bodyB;
_local3 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7));
_local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7));
_local6 = _local4;
var _local8:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7));
var _local9:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6));
_local3 = m_mass;
_local4 = ((_local8 + (m_beta * m_C.x)) + (m_gamma * m_impulse.x));
_local5 = ((_local9 + (m_beta * m_C.y)) + (m_gamma * m_impulse.y));
var _local10:Number = -(((_local3.col1.x * _local4) + (_local3.col2.x * _local5)));
var _local11:Number = -(((_local3.col1.y * _local4) + (_local3.col2.y * _local5)));
var _local12:Number = m_impulse.x;
var _local13:Number = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
var _local14:Number = (_arg1.dt * m_maxForce);
if (m_impulse.LengthSquared() > (_local14 * _local14)){
m_impulse.Multiply((_local14 / m_impulse.Length()));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local10));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local11));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local11) - (_local7 * _local10))));
}
override b2internal function SolvePositionConstraints(_arg1:Number):Boolean{
return (true);
}
}
}//package Box2D.Dynamics.Joints
Section 79
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2MouseJointDef extends b2JointDef {
public var target:b2Vec2;
public var maxForce:Number;
public var frequencyHz:Number;
public var dampingRatio:Number;
public function b2MouseJointDef(){
target = new b2Vec2();
super();
type = b2Joint.e_mouseJoint;
maxForce = 0;
frequencyHz = 5;
dampingRatio = 0.7;
}
}
}//package Box2D.Dynamics.Joints
Section 80
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PrismaticJoint extends b2Joint {
b2internal var m_localAnchor1:b2Vec2;
b2internal var m_localAnchor2:b2Vec2;
b2internal var m_localXAxis1:b2Vec2;
private var m_localYAxis1:b2Vec2;
private var m_refAngle:Number;
private var m_axis:b2Vec2;
private var m_perp:b2Vec2;
private var m_s1:Number;
private var m_s2:Number;
private var m_a1:Number;
private var m_a2:Number;
private var m_K:b2Mat33;
private var m_impulse:b2Vec3;
private var m_motorMass:Number;
private var m_motorImpulse:Number;
private var m_lowerTranslation:Number;
private var m_upperTranslation:Number;
private var m_maxMotorForce:Number;
private var m_motorSpeed:Number;
private var m_enableLimit:Boolean;
private var m_enableMotor:Boolean;
private var m_limitState:int;
public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_localXAxis1 = new b2Vec2();
m_localYAxis1 = new b2Vec2();
m_axis = new b2Vec2();
m_perp = new b2Vec2();
m_K = new b2Mat33();
m_impulse = new b2Vec3();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchorA);
m_localAnchor2.SetV(_arg1.localAnchorB);
m_localXAxis1.SetV(_arg1.localAxisA);
m_localYAxis1.x = -(m_localXAxis1.y);
m_localYAxis1.y = m_localXAxis1.x;
m_refAngle = _arg1.referenceAngle;
m_impulse.SetZero();
m_motorMass = 0;
m_motorImpulse = 0;
m_lowerTranslation = _arg1.lowerTranslation;
m_upperTranslation = _arg1.upperTranslation;
m_maxMotorForce = _arg1.maxMotorForce;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
m_limitState = e_inactiveLimit;
m_axis.SetZero();
m_perp.SetZero();
}
override public function GetAnchorA():b2Vec2{
return (m_bodyA.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchorB():b2Vec2{
return (m_bodyB.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2((_arg1 * ((m_impulse.x * m_perp.x) + ((m_motorImpulse + m_impulse.z) * m_axis.x))), (_arg1 * ((m_impulse.x * m_perp.y) + ((m_motorImpulse + m_impulse.z) * m_axis.y)))));
}
override public function GetReactionTorque(_arg1:Number):Number{
return ((_arg1 * m_impulse.y));
}
public function GetJointTranslation():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_bodyA;
var _local2:b2Body = m_bodyB;
var _local4:b2Vec2 = _local1.GetWorldPoint(m_localAnchor1);
var _local5:b2Vec2 = _local2.GetWorldPoint(m_localAnchor2);
var _local6:Number = (_local5.x - _local4.x);
var _local7:Number = (_local5.y - _local4.y);
var _local8:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local9:Number = ((_local8.x * _local6) + (_local8.y * _local7));
return (_local9);
}
public function GetJointSpeed():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_bodyA;
var _local2:b2Body = m_bodyB;
_local3 = _local1.m_xf.R;
var _local4:Number = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
var _local5:Number = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local3 = _local2.m_xf.R;
var _local7:Number = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8));
_local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8));
_local7 = _local6;
var _local9:Number = (_local1.m_sweep.c.x + _local4);
var _local10:Number = (_local1.m_sweep.c.y + _local5);
var _local11:Number = (_local2.m_sweep.c.x + _local7);
var _local12:Number = (_local2.m_sweep.c.y + _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = (_local12 - _local10);
var _local15:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local16:b2Vec2 = _local1.m_linearVelocity;
var _local17:b2Vec2 = _local2.m_linearVelocity;
var _local18:Number = _local1.m_angularVelocity;
var _local19:Number = _local2.m_angularVelocity;
var _local20:Number = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4)))));
return (_local20);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function EnableLimit(_arg1:Boolean):void{
m_bodyA.SetAwake(true);
m_bodyB.SetAwake(true);
m_enableLimit = _arg1;
}
public function GetLowerLimit():Number{
return (m_lowerTranslation);
}
public function GetUpperLimit():Number{
return (m_upperTranslation);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_bodyA.SetAwake(true);
m_bodyB.SetAwake(true);
m_lowerTranslation = _arg1;
m_upperTranslation = _arg2;
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
public function EnableMotor(_arg1:Boolean):void{
m_bodyA.SetAwake(true);
m_bodyB.SetAwake(true);
m_enableMotor = _arg1;
}
public function SetMotorSpeed(_arg1:Number):void{
m_bodyA.SetAwake(true);
m_bodyB.SetAwake(true);
m_motorSpeed = _arg1;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
public function SetMaxMotorForce(_arg1:Number):void{
m_bodyA.SetAwake(true);
m_bodyB.SetAwake(true);
m_maxMotorForce = _arg1;
}
public function GetMotorForce():Number{
return (m_motorImpulse);
}
override b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local2:b2Body = m_bodyA;
var _local3:b2Body = m_bodyB;
m_localCenterA.SetV(_local2.GetLocalCenter());
m_localCenterB.SetV(_local3.GetLocalCenter());
var _local6:b2Transform = _local2.GetTransform();
var _local7:b2Transform = _local3.GetTransform();
_local4 = _local2.m_xf.R;
var _local8:Number = (m_localAnchor1.x - m_localCenterA.x);
var _local9:Number = (m_localAnchor1.y - m_localCenterA.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
_local4 = _local3.m_xf.R;
var _local10:Number = (m_localAnchor2.x - m_localCenterB.x);
var _local11:Number = (m_localAnchor2.y - m_localCenterB.y);
_local5 = ((_local4.col1.x * _local10) + (_local4.col2.x * _local11));
_local11 = ((_local4.col1.y * _local10) + (_local4.col2.y * _local11));
_local10 = _local5;
var _local12:Number = (((_local3.m_sweep.c.x + _local10) - _local2.m_sweep.c.x) - _local8);
var _local13:Number = (((_local3.m_sweep.c.y + _local11) - _local2.m_sweep.c.y) - _local9);
m_invMassA = _local2.m_invMass;
m_invMassB = _local3.m_invMass;
m_invIA = _local2.m_invI;
m_invIB = _local3.m_invI;
m_axis.SetV(b2Math.MulMV(_local6.R, m_localXAxis1));
m_a1 = (((_local12 + _local8) * m_axis.y) - ((_local13 + _local9) * m_axis.x));
m_a2 = ((_local10 * m_axis.y) - (_local11 * m_axis.x));
m_motorMass = (((m_invMassA + m_invMassB) + ((m_invIA * m_a1) * m_a1)) + ((m_invIB * m_a2) * m_a2));
if (m_motorMass > Number.MIN_VALUE){
m_motorMass = (1 / m_motorMass);
};
m_perp.SetV(b2Math.MulMV(_local6.R, m_localYAxis1));
m_s1 = (((_local12 + _local8) * m_perp.y) - ((_local13 + _local9) * m_perp.x));
m_s2 = ((_local10 * m_perp.y) - (_local11 * m_perp.x));
var _local14:Number = m_invMassA;
var _local15:Number = m_invMassB;
var _local16:Number = m_invIA;
var _local17:Number = m_invIB;
m_K.col1.x = (((_local14 + _local15) + ((_local16 * m_s1) * m_s1)) + ((_local17 * m_s2) * m_s2));
m_K.col1.y = ((_local16 * m_s1) + (_local17 * m_s2));
m_K.col1.z = (((_local16 * m_s1) * m_a1) + ((_local17 * m_s2) * m_a2));
m_K.col2.x = m_K.col1.y;
m_K.col2.y = (_local16 + _local17);
m_K.col2.z = ((_local16 * m_a1) + (_local17 * m_a2));
m_K.col3.x = m_K.col1.z;
m_K.col3.y = m_K.col2.z;
m_K.col3.z = (((_local14 + _local15) + ((_local16 * m_a1) * m_a1)) + ((_local17 * m_a2) * m_a2));
if (m_enableLimit){
_local18 = ((m_axis.x * _local12) + (m_axis.y * _local13));
if (b2Math.Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local18 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitState = e_atLowerLimit;
m_impulse.z = 0;
};
} else {
if (_local18 >= m_upperTranslation){
if (m_limitState != e_atUpperLimit){
m_limitState = e_atUpperLimit;
m_impulse.z = 0;
};
} else {
m_limitState = e_inactiveLimit;
m_impulse.z = 0;
};
};
};
} else {
m_limitState = e_inactiveLimit;
};
if (m_enableMotor == false){
m_motorImpulse = 0;
};
if (_arg1.warmStarting){
m_impulse.x = (m_impulse.x * _arg1.dtRatio);
m_impulse.y = (m_impulse.y * _arg1.dtRatio);
m_motorImpulse = (m_motorImpulse * _arg1.dtRatio);
_local19 = ((m_impulse.x * m_perp.x) + ((m_motorImpulse + m_impulse.z) * m_axis.x));
_local20 = ((m_impulse.x * m_perp.y) + ((m_motorImpulse + m_impulse.z) * m_axis.y));
_local21 = (((m_impulse.x * m_s1) + m_impulse.y) + ((m_motorImpulse + m_impulse.z) * m_a1));
_local22 = (((m_impulse.x * m_s2) + m_impulse.y) + ((m_motorImpulse + m_impulse.z) * m_a2));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (m_invMassA * _local19));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (m_invMassA * _local20));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (m_invIA * _local21));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (m_invMassB * _local19));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (m_invMassB * _local20));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (m_invIB * _local22));
} else {
m_impulse.SetZero();
m_motorImpulse = 0;
};
}
override b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:b2Vec3;
var _local20:b2Vec3;
var _local21:Number;
var _local22:Number;
var _local23:b2Vec2;
var _local24:b2Vec2;
var _local2:b2Body = m_bodyA;
var _local3:b2Body = m_bodyB;
var _local4:b2Vec2 = _local2.m_linearVelocity;
var _local5:Number = _local2.m_angularVelocity;
var _local6:b2Vec2 = _local3.m_linearVelocity;
var _local7:Number = _local3.m_angularVelocity;
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local14 = ((((m_axis.x * (_local6.x - _local4.x)) + (m_axis.y * (_local6.y - _local4.y))) + (m_a2 * _local7)) - (m_a1 * _local5));
_local15 = (m_motorMass * (m_motorSpeed - _local14));
_local16 = m_motorImpulse;
_local17 = (_arg1.dt * m_maxMotorForce);
m_motorImpulse = b2Math.Clamp((m_motorImpulse + _local15), -(_local17), _local17);
_local15 = (m_motorImpulse - _local16);
_local8 = (_local15 * m_axis.x);
_local9 = (_local15 * m_axis.y);
_local10 = (_local15 * m_a1);
_local11 = (_local15 * m_a2);
_local4.x = (_local4.x - (m_invMassA * _local8));
_local4.y = (_local4.y - (m_invMassA * _local9));
_local5 = (_local5 - (m_invIA * _local10));
_local6.x = (_local6.x + (m_invMassB * _local8));
_local6.y = (_local6.y + (m_invMassB * _local9));
_local7 = (_local7 + (m_invIB * _local11));
};
var _local12:Number = ((((m_perp.x * (_local6.x - _local4.x)) + (m_perp.y * (_local6.y - _local4.y))) + (m_s2 * _local7)) - (m_s1 * _local5));
var _local13:Number = (_local7 - _local5);
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local18 = ((((m_axis.x * (_local6.x - _local4.x)) + (m_axis.y * (_local6.y - _local4.y))) + (m_a2 * _local7)) - (m_a1 * _local5));
_local19 = m_impulse.Copy();
_local20 = m_K.Solve33(new b2Vec3(), -(_local12), -(_local13), -(_local18));
m_impulse.Add(_local20);
if (m_limitState == e_atLowerLimit){
m_impulse.z = b2Math.Max(m_impulse.z, 0);
} else {
if (m_limitState == e_atUpperLimit){
m_impulse.z = b2Math.Min(m_impulse.z, 0);
};
};
_local21 = (-(_local12) - ((m_impulse.z - _local19.z) * m_K.col3.x));
_local22 = (-(_local13) - ((m_impulse.z - _local19.z) * m_K.col3.y));
_local23 = m_K.Solve22(new b2Vec2(), _local21, _local22);
m_K.Solve22(new b2Vec2(), _local21, _local22).x = (_local23.x + _local19.x);
_local23.y = (_local23.y + _local19.y);
m_impulse.x = _local23.x;
m_impulse.y = _local23.y;
_local20.x = (m_impulse.x - _local19.x);
_local20.y = (m_impulse.y - _local19.y);
_local20.z = (m_impulse.z - _local19.z);
_local8 = ((_local20.x * m_perp.x) + (_local20.z * m_axis.x));
_local9 = ((_local20.x * m_perp.y) + (_local20.z * m_axis.y));
_local10 = (((_local20.x * m_s1) + _local20.y) + (_local20.z * m_a1));
_local11 = (((_local20.x * m_s2) + _local20.y) + (_local20.z * m_a2));
_local4.x = (_local4.x - (m_invMassA * _local8));
_local4.y = (_local4.y - (m_invMassA * _local9));
_local5 = (_local5 - (m_invIA * _local10));
_local6.x = (_local6.x + (m_invMassB * _local8));
_local6.y = (_local6.y + (m_invMassB * _local9));
_local7 = (_local7 + (m_invIB * _local11));
} else {
_local24 = m_K.Solve22(new b2Vec2(), -(_local12), -(_local13));
m_impulse.x = (m_impulse.x + _local24.x);
m_impulse.y = (m_impulse.y + _local24.y);
_local8 = (_local24.x * m_perp.x);
_local9 = (_local24.x * m_perp.y);
_local10 = ((_local24.x * m_s1) + _local24.y);
_local11 = ((_local24.x * m_s2) + _local24.y);
_local4.x = (_local4.x - (m_invMassA * _local8));
_local4.y = (_local4.y - (m_invMassA * _local9));
_local5 = (_local5 - (m_invIA * _local10));
_local6.x = (_local6.x + (m_invMassB * _local8));
_local6.y = (_local6.y + (m_invMassB * _local9));
_local7 = (_local7 + (m_invIB * _local11));
};
_local2.m_linearVelocity.SetV(_local4);
_local2.m_angularVelocity = _local5;
_local3.m_linearVelocity.SetV(_local6);
_local3.m_angularVelocity = _local7;
}
override b2internal function SolvePositionConstraints(_arg1:Number):Boolean{
var _local2:Number;
var _local3:Number;
var _local10:b2Mat22;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:b2Vec2;
var _local4:b2Body = m_bodyA;
var _local5:b2Body = m_bodyB;
var _local6:b2Vec2 = _local4.m_sweep.c;
var _local7:Number = _local4.m_sweep.a;
var _local8:b2Vec2 = _local5.m_sweep.c;
var _local9:Number = _local5.m_sweep.a;
var _local16:Number = 0;
var _local17:Number = 0;
var _local18:Boolean;
var _local19:Number = 0;
var _local20:b2Mat22 = b2Mat22.FromAngle(_local7);
var _local21:b2Mat22 = b2Mat22.FromAngle(_local9);
_local10 = _local20;
var _local22:Number = (m_localAnchor1.x - m_localCenterA.x);
var _local23:Number = (m_localAnchor1.y - m_localCenterA.y);
_local11 = ((_local10.col1.x * _local22) + (_local10.col2.x * _local23));
_local23 = ((_local10.col1.y * _local22) + (_local10.col2.y * _local23));
_local22 = _local11;
_local10 = _local21;
var _local24:Number = (m_localAnchor2.x - m_localCenterB.x);
var _local25:Number = (m_localAnchor2.y - m_localCenterB.y);
_local11 = ((_local10.col1.x * _local24) + (_local10.col2.x * _local25));
_local25 = ((_local10.col1.y * _local24) + (_local10.col2.y * _local25));
_local24 = _local11;
var _local26:Number = (((_local8.x + _local24) - _local6.x) - _local22);
var _local27:Number = (((_local8.y + _local25) - _local6.y) - _local23);
if (m_enableLimit){
m_axis = b2Math.MulMV(_local20, m_localXAxis1);
m_a1 = (((_local26 + _local22) * m_axis.y) - ((_local27 + _local23) * m_axis.x));
m_a2 = ((_local24 * m_axis.y) - (_local25 * m_axis.x));
_local35 = ((m_axis.x * _local26) + (m_axis.y * _local27));
if (b2Math.Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
_local19 = b2Math.Clamp(_local35, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local16 = b2Math.Abs(_local35);
_local18 = true;
} else {
if (_local35 <= m_lowerTranslation){
_local19 = b2Math.Clamp(((_local35 - m_lowerTranslation) + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local16 = (m_lowerTranslation - _local35);
_local18 = true;
} else {
if (_local35 >= m_upperTranslation){
_local19 = b2Math.Clamp(((_local35 - m_upperTranslation) + b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local16 = (_local35 - m_upperTranslation);
_local18 = true;
};
};
};
};
m_perp = b2Math.MulMV(_local20, m_localYAxis1);
m_s1 = (((_local26 + _local22) * m_perp.y) - ((_local27 + _local23) * m_perp.x));
m_s2 = ((_local24 * m_perp.y) - (_local25 * m_perp.x));
var _local28:b2Vec3 = new b2Vec3();
var _local29:Number = ((m_perp.x * _local26) + (m_perp.y * _local27));
var _local30:Number = ((_local9 - _local7) - m_refAngle);
_local16 = b2Math.Max(_local16, b2Math.Abs(_local29));
_local17 = b2Math.Abs(_local30);
if (_local18){
_local12 = m_invMassA;
_local13 = m_invMassB;
_local14 = m_invIA;
_local15 = m_invIB;
m_K.col1.x = (((_local12 + _local13) + ((_local14 * m_s1) * m_s1)) + ((_local15 * m_s2) * m_s2));
m_K.col1.y = ((_local14 * m_s1) + (_local15 * m_s2));
m_K.col1.z = (((_local14 * m_s1) * m_a1) + ((_local15 * m_s2) * m_a2));
m_K.col2.x = m_K.col1.y;
m_K.col2.y = (_local14 + _local15);
m_K.col2.z = ((_local14 * m_a1) + (_local15 * m_a2));
m_K.col3.x = m_K.col1.z;
m_K.col3.y = m_K.col2.z;
m_K.col3.z = (((_local12 + _local13) + ((_local14 * m_a1) * m_a1)) + ((_local15 * m_a2) * m_a2));
m_K.Solve33(_local28, -(_local29), -(_local30), -(_local19));
} else {
_local12 = m_invMassA;
_local13 = m_invMassB;
_local14 = m_invIA;
_local15 = m_invIB;
_local36 = (((_local12 + _local13) + ((_local14 * m_s1) * m_s1)) + ((_local15 * m_s2) * m_s2));
_local37 = ((_local14 * m_s1) + (_local15 * m_s2));
_local38 = (_local14 + _local15);
m_K.col1.Set(_local36, _local37, 0);
m_K.col2.Set(_local37, _local38, 0);
_local39 = m_K.Solve22(new b2Vec2(), -(_local29), -(_local30));
_local28.x = _local39.x;
_local28.y = _local39.y;
_local28.z = 0;
};
var _local31:Number = ((_local28.x * m_perp.x) + (_local28.z * m_axis.x));
var _local32:Number = ((_local28.x * m_perp.y) + (_local28.z * m_axis.y));
var _local33:Number = (((_local28.x * m_s1) + _local28.y) + (_local28.z * m_a1));
var _local34:Number = (((_local28.x * m_s2) + _local28.y) + (_local28.z * m_a2));
_local6.x = (_local6.x - (m_invMassA * _local31));
_local6.y = (_local6.y - (m_invMassA * _local32));
_local7 = (_local7 - (m_invIA * _local33));
_local8.x = (_local8.x + (m_invMassB * _local31));
_local8.y = (_local8.y + (m_invMassB * _local32));
_local9 = (_local9 + (m_invIB * _local34));
_local4.m_sweep.a = _local7;
_local5.m_sweep.a = _local9;
_local4.SynchronizeTransform();
_local5.SynchronizeTransform();
return ((((_local16 <= b2Settings.b2_linearSlop)) && ((_local17 <= b2Settings.b2_angularSlop))));
}
}
}//package Box2D.Dynamics.Joints
Section 81
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2PrismaticJointDef extends b2JointDef {
public var localAnchorA:b2Vec2;
public var localAnchorB:b2Vec2;
public var localAxisA:b2Vec2;
public var referenceAngle:Number;
public var enableLimit:Boolean;
public var lowerTranslation:Number;
public var upperTranslation:Number;
public var enableMotor:Boolean;
public var maxMotorForce:Number;
public var motorSpeed:Number;
public function b2PrismaticJointDef(){
localAnchorA = new b2Vec2();
localAnchorB = new b2Vec2();
localAxisA = new b2Vec2();
super();
type = b2Joint.e_prismaticJoint;
localAxisA.Set(1, 0);
referenceAngle = 0;
enableLimit = false;
lowerTranslation = 0;
upperTranslation = 0;
enableMotor = false;
maxMotorForce = 0;
motorSpeed = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
bodyA = _arg1;
bodyB = _arg2;
localAnchorA = bodyA.GetLocalPoint(_arg3);
localAnchorB = bodyB.GetLocalPoint(_arg3);
localAxisA = bodyA.GetLocalVector(_arg4);
referenceAngle = (bodyB.GetAngle() - bodyA.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 82
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PulleyJoint extends b2Joint {
private var m_ground:b2Body;
private var m_groundAnchor1:b2Vec2;
private var m_groundAnchor2:b2Vec2;
private var m_localAnchor1:b2Vec2;
private var m_localAnchor2:b2Vec2;
private var m_u1:b2Vec2;
private var m_u2:b2Vec2;
private var m_constant:Number;
private var m_ratio:Number;
private var m_maxLength1:Number;
private var m_maxLength2:Number;
private var m_pulleyMass:Number;
private var m_limitMass1:Number;
private var m_limitMass2:Number;
private var m_impulse:Number;
private var m_limitImpulse1:Number;
private var m_limitImpulse2:Number;
private var m_state:int;
private var m_limitState1:int;
private var m_limitState2:int;
b2internal static const b2_minPulleyLength:Number = 2;
public function b2PulleyJoint(_arg1:b2PulleyJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u1 = new b2Vec2();
m_u2 = new b2Vec2();
super(_arg1);
m_ground = m_bodyA.m_world.m_groundBody;
m_groundAnchor1.x = (_arg1.groundAnchorA.x - m_ground.m_xf.position.x);
m_groundAnchor1.y = (_arg1.groundAnchorA.y - m_ground.m_xf.position.y);
m_groundAnchor2.x = (_arg1.groundAnchorB.x - m_ground.m_xf.position.x);
m_groundAnchor2.y = (_arg1.groundAnchorB.y - m_ground.m_xf.position.y);
m_localAnchor1.SetV(_arg1.localAnchorA);
m_localAnchor2.SetV(_arg1.localAnchorB);
m_ratio = _arg1.ratio;
m_constant = (_arg1.lengthA + (m_ratio * _arg1.lengthB));
m_maxLength1 = b2Math.Min(_arg1.maxLengthA, (m_constant - (m_ratio * b2_minPulleyLength)));
m_maxLength2 = b2Math.Min(_arg1.maxLengthB, ((m_constant - b2_minPulleyLength) / m_ratio));
m_impulse = 0;
m_limitImpulse1 = 0;
m_limitImpulse2 = 0;
}
override public function GetAnchorA():b2Vec2{
return (m_bodyA.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchorB():b2Vec2{
return (m_bodyB.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2(((_arg1 * m_impulse) * m_u2.x), ((_arg1 * m_impulse) * m_u2.y)));
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function GetGroundAnchorA():b2Vec2{
var _local1:b2Vec2 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor1);
return (_local1);
}
public function GetGroundAnchorB():b2Vec2{
var _local1:b2Vec2 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor2);
return (_local1);
}
public function GetLength1():Number{
var _local1:b2Vec2 = m_bodyA.GetWorldPoint(m_localAnchor1);
var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local4:Number = (_local1.x - _local2);
var _local5:Number = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetLength2():Number{
var _local1:b2Vec2 = m_bodyB.GetWorldPoint(m_localAnchor2);
var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
var _local4:Number = (_local1.x - _local2);
var _local5:Number = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetRatio():Number{
return (m_ratio);
}
override b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local6:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local2 = m_bodyA;
_local3 = m_bodyB;
_local4 = _local2.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (_local2.m_sweep.c.x + _local5);
var _local11:Number = (_local2.m_sweep.c.y + _local6);
var _local12:Number = (_local3.m_sweep.c.x + _local8);
var _local13:Number = (_local3.m_sweep.c.y + _local9);
var _local14:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local15:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local16:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local17:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
m_u1.Set((_local10 - _local14), (_local11 - _local15));
m_u2.Set((_local12 - _local16), (_local13 - _local17));
var _local18:Number = m_u1.Length();
var _local19:Number = m_u2.Length();
if (_local18 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local18));
} else {
m_u1.SetZero();
};
if (_local19 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local19));
} else {
m_u2.SetZero();
};
var _local20:Number = ((m_constant - _local18) - (m_ratio * _local19));
if (_local20 > 0){
m_state = e_inactiveLimit;
m_impulse = 0;
} else {
m_state = e_atUpperLimit;
};
if (_local18 < m_maxLength1){
m_limitState1 = e_inactiveLimit;
m_limitImpulse1 = 0;
} else {
m_limitState1 = e_atUpperLimit;
};
if (_local19 < m_maxLength2){
m_limitState2 = e_inactiveLimit;
m_limitImpulse2 = 0;
} else {
m_limitState2 = e_atUpperLimit;
};
var _local21:Number = ((_local5 * m_u1.y) - (_local6 * m_u1.x));
var _local22:Number = ((_local8 * m_u2.y) - (_local9 * m_u2.x));
m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21));
m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22));
m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2));
m_limitMass1 = (1 / m_limitMass1);
m_limitMass2 = (1 / m_limitMass2);
m_pulleyMass = (1 / m_pulleyMass);
if (_arg1.warmStarting){
m_impulse = (m_impulse * _arg1.dtRatio);
m_limitImpulse1 = (m_limitImpulse1 * _arg1.dtRatio);
m_limitImpulse2 = (m_limitImpulse2 * _arg1.dtRatio);
_local23 = ((-(m_impulse) - m_limitImpulse1) * m_u1.x);
_local24 = ((-(m_impulse) - m_limitImpulse1) * m_u1.y);
_local25 = (((-(m_ratio) * m_impulse) - m_limitImpulse2) * m_u2.x);
_local26 = (((-(m_ratio) * m_impulse) - m_limitImpulse2) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25))));
} else {
m_impulse = 0;
m_limitImpulse1 = 0;
m_limitImpulse2 = 0;
};
}
override b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local2:b2Body = m_bodyA;
var _local3:b2Body = m_bodyB;
_local4 = _local2.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
if (m_state == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13))));
_local19 = (m_pulleyMass * -(_local18));
_local20 = m_impulse;
m_impulse = b2Math.Max(0, (m_impulse + _local19));
_local19 = (m_impulse - _local20);
_local14 = (-(_local19) * m_u1.x);
_local15 = (-(_local19) * m_u1.y);
_local16 = ((-(m_ratio) * _local19) * m_u2.x);
_local17 = ((-(m_ratio) * _local19) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
if (m_limitState1 == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11)));
_local19 = (-(m_limitMass1) * _local18);
_local20 = m_limitImpulse1;
m_limitImpulse1 = b2Math.Max(0, (m_limitImpulse1 + _local19));
_local19 = (m_limitImpulse1 - _local20);
_local14 = (-(_local19) * m_u1.x);
_local15 = (-(_local19) * m_u1.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
};
if (m_limitState2 == e_atUpperLimit){
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13)));
_local19 = (-(m_limitMass2) * _local18);
_local20 = m_limitImpulse2;
m_limitImpulse2 = b2Math.Max(0, (m_limitImpulse2 + _local19));
_local19 = (m_limitImpulse2 - _local20);
_local16 = (-(_local19) * m_u2.x);
_local17 = (-(_local19) * m_u2.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
}
override b2internal function SolvePositionConstraints(_arg1:Number):Boolean{
var _local4:b2Mat22;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local2:b2Body = m_bodyA;
var _local3:b2Body = m_bodyB;
var _local5:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local6:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local7:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local8:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
var _local24:Number = 0;
if (m_state == e_atUpperLimit){
_local4 = _local2.m_xf.R;
_local9 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local10 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local23 = ((_local4.col1.x * _local9) + (_local4.col2.x * _local10));
_local10 = ((_local4.col1.y * _local9) + (_local4.col2.y * _local10));
_local9 = _local23;
_local4 = _local3.m_xf.R;
_local11 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local23 = ((_local4.col1.x * _local11) + (_local4.col2.x * _local12));
_local12 = ((_local4.col1.y * _local11) + (_local4.col2.y * _local12));
_local11 = _local23;
_local13 = (_local2.m_sweep.c.x + _local9);
_local14 = (_local2.m_sweep.c.y + _local10);
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
m_u1.Set((_local13 - _local5), (_local14 - _local6));
m_u2.Set((_local15 - _local7), (_local16 - _local8));
_local17 = m_u1.Length();
_local18 = m_u2.Length();
if (_local17 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local17));
} else {
m_u1.SetZero();
};
if (_local18 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local18));
} else {
m_u2.SetZero();
};
_local19 = ((m_constant - _local17) - (m_ratio * _local18));
_local24 = b2Math.Max(_local24, -(_local19));
_local19 = b2Math.Clamp((_local19 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local20 = (-(m_pulleyMass) * _local19);
_local13 = (-(_local20) * m_u1.x);
_local14 = (-(_local20) * m_u1.y);
_local15 = ((-(m_ratio) * _local20) * m_u2.x);
_local16 = ((-(m_ratio) * _local20) * m_u2.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local13));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local14));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local9 * _local14) - (_local10 * _local13))));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local15));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local16));
_local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local11 * _local16) - (_local12 * _local15))));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
};
if (m_limitState1 == e_atUpperLimit){
_local4 = _local2.m_xf.R;
_local9 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local10 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local23 = ((_local4.col1.x * _local9) + (_local4.col2.x * _local10));
_local10 = ((_local4.col1.y * _local9) + (_local4.col2.y * _local10));
_local9 = _local23;
_local13 = (_local2.m_sweep.c.x + _local9);
_local14 = (_local2.m_sweep.c.y + _local10);
m_u1.Set((_local13 - _local5), (_local14 - _local6));
_local17 = m_u1.Length();
if (_local17 > b2Settings.b2_linearSlop){
m_u1.x = (m_u1.x * (1 / _local17));
m_u1.y = (m_u1.y * (1 / _local17));
} else {
m_u1.SetZero();
};
_local19 = (m_maxLength1 - _local17);
_local24 = b2Math.Max(_local24, -(_local19));
_local19 = b2Math.Clamp((_local19 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local20 = (-(m_limitMass1) * _local19);
_local13 = (-(_local20) * m_u1.x);
_local14 = (-(_local20) * m_u1.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local13));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local14));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local9 * _local14) - (_local10 * _local13))));
_local2.SynchronizeTransform();
};
if (m_limitState2 == e_atUpperLimit){
_local4 = _local3.m_xf.R;
_local11 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local23 = ((_local4.col1.x * _local11) + (_local4.col2.x * _local12));
_local12 = ((_local4.col1.y * _local11) + (_local4.col2.y * _local12));
_local11 = _local23;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
m_u2.Set((_local15 - _local7), (_local16 - _local8));
_local18 = m_u2.Length();
if (_local18 > b2Settings.b2_linearSlop){
m_u2.x = (m_u2.x * (1 / _local18));
m_u2.y = (m_u2.y * (1 / _local18));
} else {
m_u2.SetZero();
};
_local19 = (m_maxLength2 - _local18);
_local24 = b2Math.Max(_local24, -(_local19));
_local19 = b2Math.Clamp((_local19 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local20 = (-(m_limitMass2) * _local19);
_local15 = (-(_local20) * m_u2.x);
_local16 = (-(_local20) * m_u2.y);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local15));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local16));
_local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local11 * _local16) - (_local12 * _local15))));
_local3.SynchronizeTransform();
};
return ((_local24 < b2Settings.b2_linearSlop));
}
}
}//package Box2D.Dynamics.Joints
Section 83
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2PulleyJointDef extends b2JointDef {
public var groundAnchorA:b2Vec2;
public var groundAnchorB:b2Vec2;
public var localAnchorA:b2Vec2;
public var localAnchorB:b2Vec2;
public var lengthA:Number;
public var maxLengthA:Number;
public var lengthB:Number;
public var maxLengthB:Number;
public var ratio:Number;
public function b2PulleyJointDef(){
groundAnchorA = new b2Vec2();
groundAnchorB = new b2Vec2();
localAnchorA = new b2Vec2();
localAnchorB = new b2Vec2();
super();
type = b2Joint.e_pulleyJoint;
groundAnchorA.Set(-1, 1);
groundAnchorB.Set(1, 1);
localAnchorA.Set(-1, 0);
localAnchorB.Set(1, 0);
lengthA = 0;
maxLengthA = 0;
lengthB = 0;
maxLengthB = 0;
ratio = 1;
collideConnected = true;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{
bodyA = _arg1;
bodyB = _arg2;
groundAnchorA.SetV(_arg3);
groundAnchorB.SetV(_arg4);
localAnchorA = bodyA.GetLocalPoint(_arg5);
localAnchorB = bodyB.GetLocalPoint(_arg6);
var _local8:Number = (_arg5.x - _arg3.x);
var _local9:Number = (_arg5.y - _arg3.y);
lengthA = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
var _local10:Number = (_arg6.x - _arg4.x);
var _local11:Number = (_arg6.y - _arg4.y);
lengthB = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
ratio = _arg7;
var _local12:Number = (lengthA + (ratio * lengthB));
maxLengthA = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength));
maxLengthB = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio);
}
}
}//package Box2D.Dynamics.Joints
Section 84
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2RevoluteJoint extends b2Joint {
private var K:b2Mat22;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K3:b2Mat22;
private var impulse3:b2Vec3;
private var impulse2:b2Vec2;
private var reduced:b2Vec2;
b2internal var m_localAnchor1:b2Vec2;
b2internal var m_localAnchor2:b2Vec2;
private var m_impulse:b2Vec3;
private var m_motorImpulse:Number;
private var m_mass:b2Mat33;
private var m_motorMass:Number;
private var m_enableMotor:Boolean;
private var m_maxMotorTorque:Number;
private var m_motorSpeed:Number;
private var m_enableLimit:Boolean;
private var m_referenceAngle:Number;
private var m_lowerAngle:Number;
private var m_upperAngle:Number;
private var m_limitState:int;
private static var tImpulse:b2Vec2 = new b2Vec2();
public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
K3 = new b2Mat22();
impulse3 = new b2Vec3();
impulse2 = new b2Vec2();
reduced = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_impulse = new b2Vec3();
m_mass = new b2Mat33();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchorA);
m_localAnchor2.SetV(_arg1.localAnchorB);
m_referenceAngle = _arg1.referenceAngle;
m_impulse.SetZero();
m_motorImpulse = 0;
m_lowerAngle = _arg1.lowerAngle;
m_upperAngle = _arg1.upperAngle;
m_maxMotorTorque = _arg1.maxMotorTorque;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
m_limitState = e_inactiveLimit;
}
override public function GetAnchorA():b2Vec2{
return (m_bodyA.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchorB():b2Vec2{
return (m_bodyB.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2((_arg1 * m_impulse.x), (_arg1 * m_impulse.y)));
}
override public function GetReactionTorque(_arg1:Number):Number{
return ((_arg1 * m_impulse.z));
}
public function GetJointAngle():Number{
return (((m_bodyB.m_sweep.a - m_bodyA.m_sweep.a) - m_referenceAngle));
}
public function GetJointSpeed():Number{
return ((m_bodyB.m_angularVelocity - m_bodyA.m_angularVelocity));
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
public function GetLowerLimit():Number{
return (m_lowerAngle);
}
public function GetUpperLimit():Number{
return (m_upperAngle);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerAngle = _arg1;
m_upperAngle = _arg2;
}
public function IsMotorEnabled():Boolean{
m_bodyA.SetAwake(true);
m_bodyB.SetAwake(true);
return (m_enableMotor);
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function SetMotorSpeed(_arg1:Number):void{
m_bodyA.SetAwake(true);
m_bodyB.SetAwake(true);
m_motorSpeed = _arg1;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
public function SetMaxMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
public function GetMotorTorque():Number{
return (m_maxMotorTorque);
}
override b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local7:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local2 = m_bodyA;
_local3 = m_bodyB;
if (((m_enableMotor) || (m_enableLimit))){
};
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local10:Number = _local2.m_invMass;
var _local11:Number = _local3.m_invMass;
var _local12:Number = _local2.m_invI;
var _local13:Number = _local3.m_invI;
m_mass.col1.x = (((_local10 + _local11) + ((_local7 * _local7) * _local12)) + ((_local9 * _local9) * _local13));
m_mass.col2.x = (((-(_local7) * _local6) * _local12) - ((_local9 * _local8) * _local13));
m_mass.col3.x = ((-(_local7) * _local12) - (_local9 * _local13));
m_mass.col1.y = m_mass.col2.x;
m_mass.col2.y = (((_local10 + _local11) + ((_local6 * _local6) * _local12)) + ((_local8 * _local8) * _local13));
m_mass.col3.y = ((_local6 * _local12) + (_local8 * _local13));
m_mass.col1.z = m_mass.col3.x;
m_mass.col2.z = m_mass.col3.y;
m_mass.col3.z = (_local12 + _local13);
m_motorMass = (1 / (_local12 + _local13));
if (m_enableMotor == false){
m_motorImpulse = 0;
};
if (m_enableLimit){
_local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle);
if (b2Math.Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
m_limitState = e_equalLimits;
} else {
if (_local14 <= m_lowerAngle){
if (m_limitState != e_atLowerLimit){
m_impulse.z = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local14 >= m_upperAngle){
if (m_limitState != e_atUpperLimit){
m_impulse.z = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_impulse.z = 0;
};
};
};
} else {
m_limitState = e_inactiveLimit;
};
if (_arg1.warmStarting){
m_impulse.x = (m_impulse.x * _arg1.dtRatio);
m_impulse.y = (m_impulse.y * _arg1.dtRatio);
m_motorImpulse = (m_motorImpulse * _arg1.dtRatio);
_local15 = m_impulse.x;
_local16 = m_impulse.y;
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local10 * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local10 * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local12 * ((((_local6 * _local16) - (_local7 * _local15)) + m_motorImpulse) + m_impulse.z)));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * ((((_local8 * _local16) - (_local9 * _local15)) + m_motorImpulse) + m_impulse.z)));
} else {
m_impulse.SetZero();
m_motorImpulse = 0;
};
}
override b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local2:b2Body = m_bodyA;
var _local3:b2Body = m_bodyB;
var _local11:b2Vec2 = _local2.m_linearVelocity;
var _local12:Number = _local2.m_angularVelocity;
var _local13:b2Vec2 = _local3.m_linearVelocity;
var _local14:Number = _local3.m_angularVelocity;
var _local15:Number = _local2.m_invMass;
var _local16:Number = _local3.m_invMass;
var _local17:Number = _local2.m_invI;
var _local18:Number = _local3.m_invI;
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local19 = ((_local14 - _local12) - m_motorSpeed);
_local20 = (m_motorMass * -(_local19));
_local21 = m_motorImpulse;
_local22 = (_arg1.dt * m_maxMotorTorque);
m_motorImpulse = b2Math.Clamp((m_motorImpulse + _local20), -(_local22), _local22);
_local20 = (m_motorImpulse - _local21);
_local12 = (_local12 - (_local17 * _local20));
_local14 = (_local14 + (_local18 * _local20));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local4 = _local2.m_xf.R;
_local7 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local8 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local7) + (_local4.col2.x * _local8));
_local8 = ((_local4.col1.y * _local7) + (_local4.col2.y * _local8));
_local7 = _local5;
_local4 = _local3.m_xf.R;
_local9 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local10 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local9) + (_local4.col2.x * _local10));
_local10 = ((_local4.col1.y * _local9) + (_local4.col2.y * _local10));
_local9 = _local5;
_local23 = (((_local13.x + (-(_local14) * _local10)) - _local11.x) - (-(_local12) * _local8));
_local24 = (((_local13.y + (_local14 * _local9)) - _local11.y) - (_local12 * _local7));
_local25 = (_local14 - _local12);
m_mass.Solve33(impulse3, -(_local23), -(_local24), -(_local25));
if (m_limitState == e_equalLimits){
m_impulse.Add(impulse3);
} else {
if (m_limitState == e_atLowerLimit){
_local6 = (m_impulse.z + impulse3.z);
if (_local6 < 0){
m_mass.Solve22(reduced, -(_local23), -(_local24));
impulse3.x = reduced.x;
impulse3.y = reduced.y;
impulse3.z = -(m_impulse.z);
m_impulse.x = (m_impulse.x + reduced.x);
m_impulse.y = (m_impulse.y + reduced.y);
m_impulse.z = 0;
};
} else {
if (m_limitState == e_atUpperLimit){
_local6 = (m_impulse.z + impulse3.z);
if (_local6 > 0){
m_mass.Solve22(reduced, -(_local23), -(_local24));
impulse3.x = reduced.x;
impulse3.y = reduced.y;
impulse3.z = -(m_impulse.z);
m_impulse.x = (m_impulse.x + reduced.x);
m_impulse.y = (m_impulse.y + reduced.y);
m_impulse.z = 0;
};
};
};
};
_local11.x = (_local11.x - (_local15 * impulse3.x));
_local11.y = (_local11.y - (_local15 * impulse3.y));
_local12 = (_local12 - (_local17 * (((_local7 * impulse3.y) - (_local8 * impulse3.x)) + impulse3.z)));
_local13.x = (_local13.x + (_local16 * impulse3.x));
_local13.y = (_local13.y + (_local16 * impulse3.y));
_local14 = (_local14 + (_local18 * (((_local9 * impulse3.y) - (_local10 * impulse3.x)) + impulse3.z)));
} else {
_local4 = _local2.m_xf.R;
_local7 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local8 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local7) + (_local4.col2.x * _local8));
_local8 = ((_local4.col1.y * _local7) + (_local4.col2.y * _local8));
_local7 = _local5;
_local4 = _local3.m_xf.R;
_local9 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local10 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local9) + (_local4.col2.x * _local10));
_local10 = ((_local4.col1.y * _local9) + (_local4.col2.y * _local10));
_local9 = _local5;
_local26 = (((_local13.x + (-(_local14) * _local10)) - _local11.x) - (-(_local12) * _local8));
_local27 = (((_local13.y + (_local14 * _local9)) - _local11.y) - (_local12 * _local7));
m_mass.Solve22(impulse2, -(_local26), -(_local27));
m_impulse.x = (m_impulse.x + impulse2.x);
m_impulse.y = (m_impulse.y + impulse2.y);
_local11.x = (_local11.x - (_local15 * impulse2.x));
_local11.y = (_local11.y - (_local15 * impulse2.y));
_local12 = (_local12 - (_local17 * ((_local7 * impulse2.y) - (_local8 * impulse2.x))));
_local13.x = (_local13.x + (_local16 * impulse2.x));
_local13.y = (_local13.y + (_local16 * impulse2.y));
_local14 = (_local14 + (_local18 * ((_local9 * impulse2.y) - (_local10 * impulse2.x))));
};
_local2.m_linearVelocity.SetV(_local11);
_local2.m_angularVelocity = _local12;
_local3.m_linearVelocity.SetV(_local13);
_local3.m_angularVelocity = _local14;
}
override b2internal function SolvePositionConstraints(_arg1:Number):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:b2Mat22;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local5:b2Body = m_bodyA;
var _local6:b2Body = m_bodyB;
var _local7:Number = 0;
var _local8:Number = 0;
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local25 = ((_local6.m_sweep.a - _local5.m_sweep.a) - m_referenceAngle);
_local26 = 0;
if (m_limitState == e_equalLimits){
_local3 = b2Math.Clamp((_local25 - m_lowerAngle), -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local3);
_local7 = b2Math.Abs(_local3);
} else {
if (m_limitState == e_atLowerLimit){
_local3 = (_local25 - m_lowerAngle);
_local7 = -(_local3);
_local3 = b2Math.Clamp((_local3 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local26 = (-(m_motorMass) * _local3);
} else {
if (m_limitState == e_atUpperLimit){
_local3 = (_local25 - m_upperAngle);
_local7 = _local3;
_local3 = b2Math.Clamp((_local3 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local3);
};
};
};
_local5.m_sweep.a = (_local5.m_sweep.a - (_local5.m_invI * _local26));
_local6.m_sweep.a = (_local6.m_sweep.a + (_local6.m_invI * _local26));
_local5.SynchronizeTransform();
_local6.SynchronizeTransform();
};
_local4 = _local5.m_xf.R;
var _local12:Number = (m_localAnchor1.x - _local5.m_sweep.localCenter.x);
var _local13:Number = (m_localAnchor1.y - _local5.m_sweep.localCenter.y);
_local9 = ((_local4.col1.x * _local12) + (_local4.col2.x * _local13));
_local13 = ((_local4.col1.y * _local12) + (_local4.col2.y * _local13));
_local12 = _local9;
_local4 = _local6.m_xf.R;
var _local14:Number = (m_localAnchor2.x - _local6.m_sweep.localCenter.x);
var _local15:Number = (m_localAnchor2.y - _local6.m_sweep.localCenter.y);
_local9 = ((_local4.col1.x * _local14) + (_local4.col2.x * _local15));
_local15 = ((_local4.col1.y * _local14) + (_local4.col2.y * _local15));
_local14 = _local9;
var _local16:Number = (((_local6.m_sweep.c.x + _local14) - _local5.m_sweep.c.x) - _local12);
var _local17:Number = (((_local6.m_sweep.c.y + _local15) - _local5.m_sweep.c.y) - _local13);
var _local18:Number = ((_local16 * _local16) + (_local17 * _local17));
var _local19:Number = Math.sqrt(_local18);
_local8 = _local19;
var _local20:Number = _local5.m_invMass;
var _local21:Number = _local6.m_invMass;
var _local22:Number = _local5.m_invI;
var _local23:Number = _local6.m_invI;
var _local24:Number = (10 * b2Settings.b2_linearSlop);
if (_local18 > (_local24 * _local24)){
_local27 = (_local16 / _local19);
_local28 = (_local17 / _local19);
_local29 = (_local20 + _local21);
_local30 = (1 / _local29);
_local10 = (_local30 * -(_local16));
_local11 = (_local30 * -(_local17));
_local31 = 0.5;
_local5.m_sweep.c.x = (_local5.m_sweep.c.x - ((_local31 * _local20) * _local10));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y - ((_local31 * _local20) * _local11));
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + ((_local31 * _local21) * _local10));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + ((_local31 * _local21) * _local11));
_local16 = (((_local6.m_sweep.c.x + _local14) - _local5.m_sweep.c.x) - _local12);
_local17 = (((_local6.m_sweep.c.y + _local15) - _local5.m_sweep.c.y) - _local13);
};
K1.col1.x = (_local20 + _local21);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local20 + _local21);
K2.col1.x = ((_local22 * _local13) * _local13);
K2.col2.x = ((-(_local22) * _local12) * _local13);
K2.col1.y = ((-(_local22) * _local12) * _local13);
K2.col2.y = ((_local22 * _local12) * _local12);
K3.col1.x = ((_local23 * _local15) * _local15);
K3.col2.x = ((-(_local23) * _local14) * _local15);
K3.col1.y = ((-(_local23) * _local14) * _local15);
K3.col2.y = ((_local23 * _local14) * _local14);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Solve(tImpulse, -(_local16), -(_local17));
_local10 = tImpulse.x;
_local11 = tImpulse.y;
_local5.m_sweep.c.x = (_local5.m_sweep.c.x - (_local5.m_invMass * _local10));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y - (_local5.m_invMass * _local11));
_local5.m_sweep.a = (_local5.m_sweep.a - (_local5.m_invI * ((_local12 * _local11) - (_local13 * _local10))));
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_local6.m_invMass * _local10));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_local6.m_invMass * _local11));
_local6.m_sweep.a = (_local6.m_sweep.a + (_local6.m_invI * ((_local14 * _local11) - (_local15 * _local10))));
_local5.SynchronizeTransform();
_local6.SynchronizeTransform();
return ((((_local8 <= b2Settings.b2_linearSlop)) && ((_local7 <= b2Settings.b2_angularSlop))));
}
}
}//package Box2D.Dynamics.Joints
Section 85
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2RevoluteJointDef extends b2JointDef {
public var localAnchorA:b2Vec2;
public var localAnchorB:b2Vec2;
public var referenceAngle:Number;
public var enableLimit:Boolean;
public var lowerAngle:Number;
public var upperAngle:Number;
public var enableMotor:Boolean;
public var motorSpeed:Number;
public var maxMotorTorque:Number;
public function b2RevoluteJointDef(){
localAnchorA = new b2Vec2();
localAnchorB = new b2Vec2();
super();
type = b2Joint.e_revoluteJoint;
localAnchorA.Set(0, 0);
localAnchorB.Set(0, 0);
referenceAngle = 0;
lowerAngle = 0;
upperAngle = 0;
maxMotorTorque = 0;
motorSpeed = 0;
enableLimit = false;
enableMotor = false;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{
bodyA = _arg1;
bodyB = _arg2;
localAnchorA = bodyA.GetLocalPoint(_arg3);
localAnchorB = bodyB.GetLocalPoint(_arg3);
referenceAngle = (bodyB.GetAngle() - bodyA.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 86
//b2WeldJoint (Box2D.Dynamics.Joints.b2WeldJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2WeldJoint extends b2Joint {
private var m_localAnchorA:b2Vec2;
private var m_localAnchorB:b2Vec2;
private var m_referenceAngle:Number;
private var m_impulse:b2Vec3;
private var m_mass:b2Mat33;
public function b2WeldJoint(_arg1:b2WeldJointDef){
m_localAnchorA = new b2Vec2();
m_localAnchorB = new b2Vec2();
m_impulse = new b2Vec3();
m_mass = new b2Mat33();
super(_arg1);
m_localAnchorA.SetV(_arg1.localAnchorA);
m_localAnchorB.SetV(_arg1.localAnchorB);
m_referenceAngle = _arg1.referenceAngle;
m_impulse.SetZero();
m_mass = new b2Mat33();
}
override public function GetAnchorA():b2Vec2{
return (m_bodyA.GetWorldPoint(m_localAnchorA));
}
override public function GetAnchorB():b2Vec2{
return (m_bodyB.GetWorldPoint(m_localAnchorB));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2((_arg1 * m_impulse.x), (_arg1 * m_impulse.y)));
}
override public function GetReactionTorque(_arg1:Number):Number{
return ((_arg1 * m_impulse.z));
}
override b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local4 = m_bodyA;
_local5 = m_bodyB;
_local2 = _local4.m_xf.R;
_local6 = (m_localAnchorA.x - _local4.m_sweep.localCenter.x);
_local7 = (m_localAnchorA.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7));
_local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7));
_local6 = _local3;
_local2 = _local5.m_xf.R;
_local8 = (m_localAnchorB.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchorB.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
_local10 = _local4.m_invMass;
_local11 = _local5.m_invMass;
_local12 = _local4.m_invI;
_local13 = _local5.m_invI;
m_mass.col1.x = (((_local10 + _local11) + ((_local7 * _local7) * _local12)) + ((_local9 * _local9) * _local13));
m_mass.col2.x = (((-(_local7) * _local6) * _local12) - ((_local9 * _local8) * _local13));
m_mass.col3.x = ((-(_local7) * _local12) - (_local9 * _local13));
m_mass.col1.y = m_mass.col2.x;
m_mass.col2.y = (((_local10 + _local11) + ((_local6 * _local6) * _local12)) + ((_local8 * _local8) * _local13));
m_mass.col3.y = ((_local6 * _local12) + (_local8 * _local13));
m_mass.col1.z = m_mass.col3.x;
m_mass.col2.z = m_mass.col3.y;
m_mass.col3.z = (_local12 + _local13);
if (_arg1.warmStarting){
m_impulse.x = (m_impulse.x * _arg1.dtRatio);
m_impulse.y = (m_impulse.y * _arg1.dtRatio);
m_impulse.z = (m_impulse.z * _arg1.dtRatio);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local10 * m_impulse.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local10 * m_impulse.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity - (_local12 * (((_local6 * m_impulse.y) - (_local7 * m_impulse.x)) + m_impulse.z)));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local11 * m_impulse.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local11 * m_impulse.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + (_local13 * (((_local8 * m_impulse.y) - (_local9 * m_impulse.x)) + m_impulse.z)));
} else {
m_impulse.SetZero();
};
}
override b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body = m_bodyA;
var _local5:b2Body = m_bodyB;
var _local6:b2Vec2 = _local4.m_linearVelocity;
var _local7:Number = _local4.m_angularVelocity;
var _local8:b2Vec2 = _local5.m_linearVelocity;
var _local9:Number = _local5.m_angularVelocity;
var _local10:Number = _local4.m_invMass;
var _local11:Number = _local5.m_invMass;
var _local12:Number = _local4.m_invI;
var _local13:Number = _local5.m_invI;
_local2 = _local4.m_xf.R;
var _local14:Number = (m_localAnchorA.x - _local4.m_sweep.localCenter.x);
var _local15:Number = (m_localAnchorA.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local14) + (_local2.col2.x * _local15));
_local15 = ((_local2.col1.y * _local14) + (_local2.col2.y * _local15));
_local14 = _local3;
_local2 = _local5.m_xf.R;
var _local16:Number = (m_localAnchorB.x - _local5.m_sweep.localCenter.x);
var _local17:Number = (m_localAnchorB.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local16) + (_local2.col2.x * _local17));
_local17 = ((_local2.col1.y * _local16) + (_local2.col2.y * _local17));
_local16 = _local3;
var _local18:Number = (((_local8.x - (_local9 * _local17)) - _local6.x) + (_local7 * _local15));
var _local19:Number = (((_local8.y + (_local9 * _local16)) - _local6.y) - (_local7 * _local14));
var _local20:Number = (_local9 - _local7);
var _local21:b2Vec3 = new b2Vec3();
m_mass.Solve33(_local21, -(_local18), -(_local19), -(_local20));
m_impulse.Add(_local21);
_local6.x = (_local6.x - (_local10 * _local21.x));
_local6.y = (_local6.y - (_local10 * _local21.y));
_local7 = (_local7 - (_local12 * (((_local14 * _local21.y) - (_local15 * _local21.x)) + _local21.z)));
_local8.x = (_local8.x + (_local11 * _local21.x));
_local8.y = (_local8.y + (_local11 * _local21.y));
_local9 = (_local9 + (_local13 * (((_local16 * _local21.y) - (_local17 * _local21.x)) + _local21.z)));
_local4.m_angularVelocity = _local7;
_local5.m_angularVelocity = _local9;
}
override b2internal function SolvePositionConstraints(_arg1:Number):Boolean{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body = m_bodyA;
var _local5:b2Body = m_bodyB;
_local2 = _local4.m_xf.R;
var _local6:Number = (m_localAnchorA.x - _local4.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchorA.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7));
_local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7));
_local6 = _local3;
_local2 = _local5.m_xf.R;
var _local8:Number = (m_localAnchorB.x - _local5.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchorB.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
var _local10:Number = _local4.m_invMass;
var _local11:Number = _local5.m_invMass;
var _local12:Number = _local4.m_invI;
var _local13:Number = _local5.m_invI;
var _local14:Number = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6);
var _local15:Number = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7);
var _local16:Number = ((_local5.m_sweep.a - _local4.m_sweep.a) - m_referenceAngle);
var _local17:Number = (10 * b2Settings.b2_linearSlop);
var _local18:Number = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
var _local19:Number = b2Math.Abs(_local16);
if (_local18 > _local17){
_local12 = (_local12 * 1);
_local13 = (_local13 * 1);
};
m_mass.col1.x = (((_local10 + _local11) + ((_local7 * _local7) * _local12)) + ((_local9 * _local9) * _local13));
m_mass.col2.x = (((-(_local7) * _local6) * _local12) - ((_local9 * _local8) * _local13));
m_mass.col3.x = ((-(_local7) * _local12) - (_local9 * _local13));
m_mass.col1.y = m_mass.col2.x;
m_mass.col2.y = (((_local10 + _local11) + ((_local6 * _local6) * _local12)) + ((_local8 * _local8) * _local13));
m_mass.col3.y = ((_local6 * _local12) + (_local8 * _local13));
m_mass.col1.z = m_mass.col3.x;
m_mass.col2.z = m_mass.col3.y;
m_mass.col3.z = (_local12 + _local13);
var _local20:b2Vec3 = new b2Vec3();
m_mass.Solve33(_local20, -(_local14), -(_local15), -(_local16));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x - (_local10 * _local20.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y - (_local10 * _local20.y));
_local4.m_sweep.a = (_local4.m_sweep.a - (_local12 * (((_local6 * _local20.y) - (_local7 * _local20.x)) + _local20.z)));
_local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_local11 * _local20.x));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_local11 * _local20.y));
_local5.m_sweep.a = (_local5.m_sweep.a + (_local13 * (((_local8 * _local20.y) - (_local9 * _local20.x)) + _local20.z)));
_local4.SynchronizeTransform();
_local5.SynchronizeTransform();
return ((((_local18 <= b2Settings.b2_linearSlop)) && ((_local19 <= b2Settings.b2_angularSlop))));
}
}
}//package Box2D.Dynamics.Joints
Section 87
//b2WeldJointDef (Box2D.Dynamics.Joints.b2WeldJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2WeldJointDef extends b2JointDef {
public var localAnchorA:b2Vec2;
public var localAnchorB:b2Vec2;
public var referenceAngle:Number;
public function b2WeldJointDef(){
localAnchorA = new b2Vec2();
localAnchorB = new b2Vec2();
super();
type = b2Joint.e_weldJoint;
referenceAngle = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{
bodyA = _arg1;
bodyB = _arg2;
localAnchorA.SetV(bodyA.GetLocalPoint(_arg3));
localAnchorB.SetV(bodyB.GetLocalPoint(_arg3));
referenceAngle = (bodyB.GetAngle() - bodyA.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 88
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Controllers.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.*;
public class b2Body {
b2internal var m_flags:uint;
b2internal var m_type:int;
b2internal var m_islandIndex:int;
b2internal var m_xf:b2Transform;
b2internal var m_sweep:b2Sweep;
b2internal var m_linearVelocity:b2Vec2;
b2internal var m_angularVelocity:Number;
b2internal var m_force:b2Vec2;
b2internal var m_torque:Number;
b2internal var m_world:b2World;
b2internal var m_prev:b2Body;
b2internal var m_next:b2Body;
b2internal var m_fixtureList:b2Fixture;
b2internal var m_fixtureCount:int;
b2internal var m_controllerList:b2ControllerEdge;
b2internal var m_controllerCount:int;
b2internal var m_jointList:b2JointEdge;
b2internal var m_contactList:b2ContactEdge;
b2internal var m_mass:Number;
b2internal var m_invMass:Number;
b2internal var m_I:Number;
b2internal var m_invI:Number;
b2internal var m_inertiaScale:Number;
b2internal var m_linearDamping:Number;
b2internal var m_angularDamping:Number;
b2internal var m_sleepTime:Number;
private var m_userData;
private static var s_xf1:b2Transform = new b2Transform();
b2internal static var e_islandFlag:uint = 1;
b2internal static var e_awakeFlag:uint = 2;
b2internal static var e_allowSleepFlag:uint = 4;
b2internal static var e_bulletFlag:uint = 8;
b2internal static var e_fixedRotationFlag:uint = 16;
b2internal static var e_activeFlag:uint = 32;
public static var b2_staticBody:uint = 0;
public static var b2_kinematicBody:uint = 1;
public static var b2_dynamicBody:uint = 2;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
m_xf = new b2Transform();
m_sweep = new b2Sweep();
m_linearVelocity = new b2Vec2();
m_force = new b2Vec2();
super();
m_flags = 0;
if (_arg1.bullet){
m_flags = (m_flags | e_bulletFlag);
};
if (_arg1.fixedRotation){
m_flags = (m_flags | e_fixedRotationFlag);
};
if (_arg1.allowSleep){
m_flags = (m_flags | e_allowSleepFlag);
};
if (_arg1.awake){
m_flags = (m_flags | e_awakeFlag);
};
if (_arg1.active){
m_flags = (m_flags | e_activeFlag);
};
m_world = _arg2;
m_xf.position.SetV(_arg1.position);
m_xf.R.Set(_arg1.angle);
m_sweep.localCenter.SetZero();
m_sweep.t0 = 1;
m_sweep.a0 = (m_sweep.a = _arg1.angle);
var _local3:b2Mat22 = m_xf.R;
var _local4:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_jointList = null;
m_controllerList = null;
m_contactList = null;
m_controllerCount = 0;
m_prev = null;
m_next = null;
m_linearVelocity.SetV(_arg1.linearVelocity);
m_angularVelocity = _arg1.angularVelocity;
m_linearDamping = _arg1.linearDamping;
m_angularDamping = _arg1.angularDamping;
m_force.Set(0, 0);
m_torque = 0;
m_sleepTime = 0;
m_type = _arg1.type;
if (m_type == b2_dynamicBody){
m_mass = 1;
m_invMass = 1;
} else {
m_mass = 0;
m_invMass = 0;
};
m_I = 0;
m_invI = 0;
m_inertiaScale = _arg1.inertiaScale;
m_userData = _arg1.userData;
m_fixtureList = null;
m_fixtureCount = 0;
}
private function connectEdges(_arg1:b2EdgeShape, _arg2:b2EdgeShape, _arg3:Number):Number{
var _local4:Number = Math.atan2(_arg2.GetDirectionVector().y, _arg2.GetDirectionVector().x);
var _local5:Number = Math.tan(((_local4 - _arg3) * 0.5));
var _local6:b2Vec2 = b2Math.MulFV(_local5, _arg2.GetDirectionVector());
_local6 = b2Math.SubtractVV(_local6, _arg2.GetNormalVector());
_local6 = b2Math.MulFV(b2Settings.b2_toiSlop, _local6);
_local6 = b2Math.AddVV(_local6, _arg2.GetVertex1());
var _local7:b2Vec2 = b2Math.AddVV(_arg1.GetDirectionVector(), _arg2.GetDirectionVector());
_local7.Normalize();
var _local8 = (b2Math.Dot(_arg1.GetDirectionVector(), _arg2.GetNormalVector()) > 0);
_arg1.SetNextEdge(_arg2, _local6, _local7, _local8);
_arg2.SetPrevEdge(_arg1, _local6, _local7, _local8);
return (_local4);
}
public function CreateFixture(_arg1:b2FixtureDef):b2Fixture{
var _local3:IBroadPhase;
if (m_world.IsLocked() == true){
return (null);
};
var _local2:b2Fixture = new b2Fixture();
_local2.Create(this, m_xf, _arg1);
if ((m_flags & e_activeFlag)){
_local3 = m_world.m_contactManager.m_broadPhase;
_local2.CreateProxy(_local3, m_xf);
};
_local2.m_next = m_fixtureList;
m_fixtureList = _local2;
m_fixtureCount++;
_local2.m_body = this;
if (_local2.m_density > 0){
ResetMassData();
};
m_world.m_flags = (m_world.m_flags | b2World.e_newFixture);
return (_local2);
}
public function CreateFixture2(_arg1:b2Shape, _arg2:Number=0):b2Fixture{
var _local3:b2FixtureDef = new b2FixtureDef();
_local3.shape = _arg1;
_local3.density = _arg2;
return (CreateFixture(_local3));
}
public function DestroyFixture(_arg1:b2Fixture):void{
var _local6:b2Contact;
var _local7:b2Fixture;
var _local8:b2Fixture;
var _local9:IBroadPhase;
if (m_world.IsLocked() == true){
return;
};
var _local2:b2Fixture = m_fixtureList;
var _local3:b2Fixture;
var _local4:Boolean;
while (_local2 != null) {
if (_local2 == _arg1){
if (_local3){
_local3.m_next = _arg1.m_next;
} else {
m_fixtureList = _arg1.m_next;
};
_local4 = true;
break;
};
_local3 = _local2;
_local2 = _local2.m_next;
};
var _local5:b2ContactEdge = m_contactList;
while (_local5) {
_local6 = _local5.contact;
_local5 = _local5.next;
_local7 = _local6.GetFixtureA();
_local8 = _local6.GetFixtureB();
if ((((_arg1 == _local7)) || ((_arg1 == _local8)))){
m_world.m_contactManager.Destroy(_local6);
};
};
if ((m_flags & e_activeFlag)){
_local9 = m_world.m_contactManager.m_broadPhase;
_arg1.DestroyProxy(_local9);
};
_arg1.Destroy();
_arg1.m_body = null;
_arg1.m_next = null;
m_fixtureCount--;
ResetMassData();
}
public function SetPositionAndAngle(_arg1:b2Vec2, _arg2:Number):void{
var _local3:b2Fixture;
if (m_world.IsLocked() == true){
return;
};
m_xf.R.Set(_arg2);
m_xf.position.SetV(_arg1);
var _local4:b2Mat22 = m_xf.R;
var _local5:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y));
m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_sweep.a0 = (m_sweep.a = _arg2);
var _local6:IBroadPhase = m_world.m_contactManager.m_broadPhase;
_local3 = m_fixtureList;
while (_local3) {
_local3.Synchronize(_local6, m_xf, m_xf);
_local3 = _local3.m_next;
};
m_world.m_contactManager.FindNewContacts();
}
public function SetTransform(_arg1:b2Transform):void{
SetPositionAndAngle(_arg1.position, _arg1.GetAngle());
}
public function GetTransform():b2Transform{
return (m_xf);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
public function SetPosition(_arg1:b2Vec2):void{
SetPositionAndAngle(_arg1, GetAngle());
}
public function GetAngle():Number{
return (m_sweep.a);
}
public function SetAngle(_arg1:Number):void{
SetPositionAndAngle(GetPosition(), _arg1);
}
public function GetWorldCenter():b2Vec2{
return (m_sweep.c);
}
public function GetLocalCenter():b2Vec2{
return (m_sweep.localCenter);
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
if (m_type == b2_staticBody){
return;
};
m_linearVelocity.SetV(_arg1);
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
if (m_type == b2_staticBody){
return;
};
m_angularVelocity = _arg1;
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function GetDefinition():b2BodyDef{
var _local1:b2BodyDef = new b2BodyDef();
_local1.type = GetType();
_local1.allowSleep = ((m_flags & e_allowSleepFlag) == e_allowSleepFlag);
_local1.angle = GetAngle();
_local1.angularDamping = m_angularDamping;
_local1.angularVelocity = m_angularVelocity;
_local1.fixedRotation = ((m_flags & e_fixedRotationFlag) == e_fixedRotationFlag);
_local1.bullet = ((m_flags & e_bulletFlag) == e_bulletFlag);
_local1.awake = ((m_flags & e_awakeFlag) == e_awakeFlag);
_local1.linearDamping = m_linearDamping;
_local1.linearVelocity.SetV(GetLinearVelocity());
_local1.position = GetPosition();
_local1.userData = GetUserData();
return (_local1);
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (m_type != b2_dynamicBody){
return;
};
if (IsAwake() == false){
SetAwake(true);
};
m_force.x = (m_force.x + _arg1.x);
m_force.y = (m_force.y + _arg1.y);
m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)));
}
public function ApplyTorque(_arg1:Number):void{
if (m_type != b2_dynamicBody){
return;
};
if (IsAwake() == false){
SetAwake(true);
};
m_torque = (m_torque + _arg1);
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (m_type != b2_dynamicBody){
return;
};
if (IsAwake() == false){
SetAwake(true);
};
m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x));
m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y));
m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))));
}
public function Split(_arg1:Function):b2Body{
var _local7:b2Fixture;
var _local13:b2Fixture;
var _local2:b2Vec2 = GetLinearVelocity().Copy();
var _local3:Number = GetAngularVelocity();
var _local4:b2Vec2 = GetWorldCenter();
var _local5:b2Body = this;
var _local6:b2Body = m_world.CreateBody(GetDefinition());
var _local8:b2Fixture = _local5.m_fixtureList;
while (_local8) {
if (_arg1(_local8)){
_local13 = _local8.m_next;
if (_local7){
_local7.m_next = _local13;
} else {
_local5.m_fixtureList = _local13;
};
_local5.m_fixtureCount--;
_local8.m_next = _local6.m_fixtureList;
_local6.m_fixtureList = _local8;
_local6.m_fixtureCount++;
_local8.m_body = _local6;
_local8 = _local13;
} else {
_local7 = _local8;
_local8 = _local8.m_next;
};
};
_local5.ResetMassData();
_local6.ResetMassData();
var _local9:b2Vec2 = _local5.GetWorldCenter();
var _local10:b2Vec2 = _local6.GetWorldCenter();
var _local11:b2Vec2 = b2Math.AddVV(_local2, b2Math.CrossFV(_local3, b2Math.SubtractVV(_local9, _local4)));
var _local12:b2Vec2 = b2Math.AddVV(_local2, b2Math.CrossFV(_local3, b2Math.SubtractVV(_local10, _local4)));
_local5.SetLinearVelocity(_local11);
_local6.SetLinearVelocity(_local12);
_local5.SetAngularVelocity(_local3);
_local6.SetAngularVelocity(_local3);
_local5.SynchronizeFixtures();
_local6.SynchronizeFixtures();
return (_local6);
}
public function Merge(_arg1:b2Body):void{
var _local2:b2Fixture;
var _local4:b2Body;
var _local11:b2Fixture;
_local2 = _arg1.m_fixtureList;
while (_local2) {
_local11 = _local2.m_next;
_arg1.m_fixtureCount--;
_local2.m_next = m_fixtureList;
m_fixtureList = _local2;
m_fixtureCount++;
_local2.m_body = _local4;
_local2 = _local11;
};
var _local3:b2Body = this;
_local4 = _arg1;
var _local5:b2Vec2 = _local3.GetWorldCenter();
var _local6:b2Vec2 = _local4.GetWorldCenter();
var _local7:b2Vec2 = _local3.GetLinearVelocity().Copy();
var _local8:b2Vec2 = _local4.GetLinearVelocity().Copy();
var _local9:Number = _local3.GetAngularVelocity();
var _local10:Number = _local4.GetAngularVelocity();
_local3.ResetMassData();
SynchronizeFixtures();
}
public function GetMass():Number{
return (m_mass);
}
public function GetInertia():Number{
return (m_I);
}
public function GetMassData(_arg1:b2MassData):void{
_arg1.mass = m_mass;
_arg1.I = m_I;
_arg1.center.SetV(m_sweep.localCenter);
}
public function SetMassData(_arg1:b2MassData):void{
b2Settings.b2Assert((m_world.IsLocked() == false));
if (m_world.IsLocked() == true){
return;
};
if (m_type != b2_dynamicBody){
return;
};
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.mass;
if (m_mass <= 0){
m_mass = 1;
};
m_invMass = (1 / m_mass);
if ((((_arg1.I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){
m_I = (_arg1.I - (m_mass * ((_arg1.center.x * _arg1.center.x) + (_arg1.center.y * _arg1.center.y))));
m_invI = (1 / m_I);
};
var _local2:b2Vec2 = m_sweep.c.Copy();
m_sweep.localCenter.SetV(_arg1.center);
m_sweep.c0.SetV(b2Math.MulX(m_xf, m_sweep.localCenter));
m_sweep.c.SetV(m_sweep.c0);
m_linearVelocity.x = (m_linearVelocity.x + (m_angularVelocity * -((m_sweep.c.y - _local2.y))));
m_linearVelocity.y = (m_linearVelocity.y + (m_angularVelocity * (m_sweep.c.x - _local2.x)));
}
public function ResetMassData():void{
var _local4:b2MassData;
m_mass = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_sweep.localCenter.SetZero();
if ((((m_type == b2_staticBody)) || ((m_type == b2_kinematicBody)))){
return;
};
var _local1:b2Vec2 = b2Vec2.Make(0, 0);
var _local2:b2Fixture = m_fixtureList;
while (_local2) {
if (_local2.m_density == 0){
} else {
_local4 = _local2.GetMassData();
m_mass = (m_mass + _local4.mass);
_local1.x = (_local1.x + (_local4.center.x * _local4.mass));
_local1.y = (_local1.y + (_local4.center.y * _local4.mass));
m_I = (m_I + _local4.I);
};
_local2 = _local2.m_next;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
_local1.x = (_local1.x * m_invMass);
_local1.y = (_local1.y * m_invMass);
} else {
m_mass = 1;
m_invMass = 1;
};
if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){
m_I = (m_I - (m_mass * ((_local1.x * _local1.x) + (_local1.y * _local1.y))));
m_I = (m_I * m_inertiaScale);
b2Settings.b2Assert((m_I > 0));
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
var _local3:b2Vec2 = m_sweep.c.Copy();
m_sweep.localCenter.SetV(_local1);
m_sweep.c0.SetV(b2Math.MulX(m_xf, m_sweep.localCenter));
m_sweep.c.SetV(m_sweep.c0);
m_linearVelocity.x = (m_linearVelocity.x + (m_angularVelocity * -((m_sweep.c.y - _local3.y))));
m_linearVelocity.y = (m_linearVelocity.y + (m_angularVelocity * (m_sweep.c.x - _local3.x)));
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = m_xf.R;
var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (_local3);
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.MulMV(m_xf.R, _arg1));
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.MulXT(m_xf, _arg1));
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.MulTMV(m_xf.R, _arg1));
}
public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{
return (new b2Vec2((m_linearVelocity.x - (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.y + (m_angularVelocity * (_arg1.x - m_sweep.c.x)))));
}
public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = m_xf.R;
var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (new b2Vec2((m_linearVelocity.x - (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.y + (m_angularVelocity * (_local3.x - m_sweep.c.x)))));
}
public function GetLinearDamping():Number{
return (m_linearDamping);
}
public function SetLinearDamping(_arg1:Number):void{
m_linearDamping = _arg1;
}
public function GetAngularDamping():Number{
return (m_angularDamping);
}
public function SetAngularDamping(_arg1:Number):void{
m_angularDamping = _arg1;
}
public function SetType(_arg1:uint):void{
if (m_type == _arg1){
return;
};
m_type = _arg1;
ResetMassData();
if (m_type == b2_staticBody){
m_linearVelocity.SetZero();
m_angularVelocity = 0;
};
SetAwake(true);
m_force.SetZero();
m_torque = 0;
var _local2:b2ContactEdge = m_contactList;
while (_local2) {
_local2.contact.FlagForFiltering();
_local2 = _local2.next;
};
}
public function GetType():uint{
return (m_type);
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_bulletFlag);
} else {
m_flags = (m_flags & ~(e_bulletFlag));
};
}
public function IsBullet():Boolean{
return (((m_flags & e_bulletFlag) == e_bulletFlag));
}
public function SetSleepingAllowed(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
SetAwake(true);
};
}
public function SetAwake(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_awakeFlag);
m_sleepTime = 0;
} else {
m_flags = (m_flags & ~(e_awakeFlag));
m_sleepTime = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_force.SetZero();
m_torque = 0;
};
}
public function IsAwake():Boolean{
return (((m_flags & e_awakeFlag) == e_awakeFlag));
}
public function SetFixedRotation(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_fixedRotationFlag);
} else {
m_flags = (m_flags & ~(e_fixedRotationFlag));
};
ResetMassData();
}
public function IsFixedRotation():Boolean{
return (((m_flags & e_fixedRotationFlag) == e_fixedRotationFlag));
}
public function SetActive(_arg1:Boolean):void{
var _local2:IBroadPhase;
var _local3:b2Fixture;
var _local4:b2ContactEdge;
var _local5:b2ContactEdge;
if (_arg1 == IsActive()){
return;
};
if (_arg1){
m_flags = (m_flags | e_activeFlag);
_local2 = m_world.m_contactManager.m_broadPhase;
_local3 = m_fixtureList;
while (_local3) {
_local3.CreateProxy(_local2, m_xf);
_local3 = _local3.m_next;
};
} else {
m_flags = (m_flags & ~(e_activeFlag));
_local2 = m_world.m_contactManager.m_broadPhase;
_local3 = m_fixtureList;
while (_local3) {
_local3.DestroyProxy(_local2);
_local3 = _local3.m_next;
};
_local4 = m_contactList;
while (_local4) {
_local5 = _local4;
_local4 = _local4.next;
m_world.m_contactManager.Destroy(_local5.contact);
};
m_contactList = null;
};
}
public function IsActive():Boolean{
return (((m_flags & e_activeFlag) == e_activeFlag));
}
public function IsSleepingAllowed():Boolean{
return (((m_flags & e_allowSleepFlag) == e_allowSleepFlag));
}
public function GetFixtureList():b2Fixture{
return (m_fixtureList);
}
public function GetJointList():b2JointEdge{
return (m_jointList);
}
public function GetControllerList():b2ControllerEdge{
return (m_controllerList);
}
public function GetContactList():b2ContactEdge{
return (m_contactList);
}
public function GetNext():b2Body{
return (m_next);
}
public function GetUserData(){
return (m_userData);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetWorld():b2World{
return (m_world);
}
b2internal function SynchronizeFixtures():void{
var _local4:b2Fixture;
var _local1:b2Transform = s_xf1;
_local1.R.Set(m_sweep.a0);
var _local2:b2Mat22 = _local1.R;
var _local3:b2Vec2 = m_sweep.localCenter;
_local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y)));
_local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y)));
var _local5:IBroadPhase = m_world.m_contactManager.m_broadPhase;
_local4 = m_fixtureList;
while (_local4) {
_local4.Synchronize(_local5, _local1, m_xf);
_local4 = _local4.m_next;
};
}
b2internal function SynchronizeTransform():void{
m_xf.R.Set(m_sweep.a);
var _local1:b2Mat22 = m_xf.R;
var _local2:b2Vec2 = m_sweep.localCenter;
m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y)));
m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y)));
}
b2internal function ShouldCollide(_arg1:b2Body):Boolean{
if (((!((m_type == b2_dynamicBody))) && (!((_arg1.m_type == b2_dynamicBody))))){
return (false);
};
var _local2:b2JointEdge = m_jointList;
while (_local2) {
if (_local2.other == _arg1){
if (_local2.joint.m_collideConnected == false){
return (false);
};
};
_local2 = _local2.next;
};
return (true);
}
b2internal function Advance(_arg1:Number):void{
m_sweep.Advance(_arg1);
m_sweep.c.SetV(m_sweep.c0);
m_sweep.a = m_sweep.a0;
SynchronizeTransform();
}
}
}//package Box2D.Dynamics
Section 89
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
public class b2BodyDef {
public var type:uint;
public var position:b2Vec2;
public var angle:Number;
public var linearVelocity:b2Vec2;
public var angularVelocity:Number;
public var linearDamping:Number;
public var angularDamping:Number;
public var allowSleep:Boolean;
public var awake:Boolean;
public var fixedRotation:Boolean;
public var bullet:Boolean;
public var active:Boolean;
public var userData;
public var inertiaScale:Number;
public function b2BodyDef(){
position = new b2Vec2();
linearVelocity = new b2Vec2();
super();
userData = null;
position.Set(0, 0);
angle = 0;
linearVelocity.Set(0, 0);
angularVelocity = 0;
linearDamping = 0;
angularDamping = 0;
allowSleep = true;
awake = true;
fixedRotation = false;
bullet = false;
type = b2Body.b2_staticBody;
active = true;
inertiaScale = 1;
}
}
}//package Box2D.Dynamics
Section 90
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter)
package Box2D.Dynamics {
import Box2D.Common.*;
public class b2ContactFilter {
b2internal static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter);
;
public function ShouldCollide(_arg1:b2Fixture, _arg2:b2Fixture):Boolean{
var _local3:b2FilterData = _arg1.GetFilterData();
var _local4:b2FilterData = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
var _local5:Boolean = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
public function RayCollide(_arg1, _arg2:b2Fixture):Boolean{
if (!_arg1){
return (true);
};
return (ShouldCollide((_arg1 as b2Fixture), _arg2));
}
}
}//package Box2D.Dynamics
Section 91
//b2ContactImpulse (Box2D.Dynamics.b2ContactImpulse)
package Box2D.Dynamics {
import Box2D.Common.*;
public class b2ContactImpulse {
public var normalImpulses:Array;
public var tangentImpulses:Array;
public function b2ContactImpulse(){
normalImpulses = new Array(b2Settings.b2_maxManifoldPoints);
tangentImpulses = new Array(b2Settings.b2_maxManifoldPoints);
super();
}
}
}//package Box2D.Dynamics
Section 92
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.*;
public class b2ContactListener {
b2internal static var b2_defaultListener:b2ContactListener = new (b2ContactListener);
;
public function BeginContact(_arg1:b2Contact):void{
}
public function EndContact(_arg1:b2Contact):void{
}
public function PreSolve(_arg1:b2Contact, _arg2:b2Manifold):void{
}
public function PostSolve(_arg1:b2Contact, _arg2:b2ContactImpulse):void{
}
}
}//package Box2D.Dynamics
Section 93
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.*;
public class b2ContactManager {
b2internal var m_world:b2World;
b2internal var m_broadPhase:IBroadPhase;
b2internal var m_contactList:b2Contact;
b2internal var m_contactCount:int;
b2internal var m_contactFilter:b2ContactFilter;
b2internal var m_contactListener:b2ContactListener;
b2internal var m_contactFactory:b2ContactFactory;
b2internal var m_allocator;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2ContactManager(){
m_world = null;
m_contactCount = 0;
m_contactFilter = b2ContactFilter.b2_defaultFilter;
m_contactListener = b2ContactListener.b2_defaultListener;
m_contactFactory = new b2ContactFactory(m_allocator);
m_broadPhase = new b2DynamicTreeBroadPhase();
}
public function AddPair(_arg1, _arg2):void{
var _local9:b2Fixture;
var _local10:b2Fixture;
var _local3:b2Fixture = (_arg1 as b2Fixture);
var _local4:b2Fixture = (_arg2 as b2Fixture);
var _local5:b2Body = _local3.GetBody();
var _local6:b2Body = _local4.GetBody();
if (_local5 == _local6){
return;
};
var _local7:b2ContactEdge = _local6.GetContactList();
while (_local7) {
if (_local7.other == _local5){
_local9 = _local7.contact.GetFixtureA();
_local10 = _local7.contact.GetFixtureB();
if ((((_local9 == _local3)) && ((_local10 == _local4)))){
return;
};
if ((((_local9 == _local4)) && ((_local10 == _local3)))){
return;
};
};
_local7 = _local7.next;
};
if (_local6.ShouldCollide(_local5) == false){
return;
};
if (m_contactFilter.ShouldCollide(_local3, _local4) == false){
return;
};
var _local8:b2Contact = m_contactFactory.Create(_local3, _local4);
_local3 = _local8.GetFixtureA();
_local4 = _local8.GetFixtureB();
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local8.m_prev = null;
_local8.m_next = m_world.m_contactList;
if (m_world.m_contactList != null){
m_world.m_contactList.m_prev = _local8;
};
m_world.m_contactList = _local8;
_local8.m_nodeA.contact = _local8;
_local8.m_nodeA.other = _local6;
_local8.m_nodeA.prev = null;
_local8.m_nodeA.next = _local5.m_contactList;
if (_local5.m_contactList != null){
_local5.m_contactList.prev = _local8.m_nodeA;
};
_local5.m_contactList = _local8.m_nodeA;
_local8.m_nodeB.contact = _local8;
_local8.m_nodeB.other = _local5;
_local8.m_nodeB.prev = null;
_local8.m_nodeB.next = _local6.m_contactList;
if (_local6.m_contactList != null){
_local6.m_contactList.prev = _local8.m_nodeB;
};
_local6.m_contactList = _local8.m_nodeB;
m_world.m_contactCount++;
}
public function FindNewContacts():void{
m_broadPhase.UpdatePairs(AddPair);
}
public function Destroy(_arg1:b2Contact):void{
var _local2:b2Fixture = _arg1.GetFixtureA();
var _local3:b2Fixture = _arg1.GetFixtureB();
var _local4:b2Body = _local2.GetBody();
var _local5:b2Body = _local3.GetBody();
if (_arg1.IsTouching()){
m_contactListener.EndContact(_arg1);
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_world.m_contactList){
m_world.m_contactList = _arg1.m_next;
};
if (_arg1.m_nodeA.prev){
_arg1.m_nodeA.prev.next = _arg1.m_nodeA.next;
};
if (_arg1.m_nodeA.next){
_arg1.m_nodeA.next.prev = _arg1.m_nodeA.prev;
};
if (_arg1.m_nodeA == _local4.m_contactList){
_local4.m_contactList = _arg1.m_nodeA.next;
};
if (_arg1.m_nodeB.prev){
_arg1.m_nodeB.prev.next = _arg1.m_nodeB.next;
};
if (_arg1.m_nodeB.next){
_arg1.m_nodeB.next.prev = _arg1.m_nodeB.prev;
};
if (_arg1.m_nodeB == _local5.m_contactList){
_local5.m_contactList = _arg1.m_nodeB.next;
};
m_contactFactory.Destroy(_arg1);
m_contactCount--;
}
public function Collide():void{
var _local2:b2Fixture;
var _local3:b2Fixture;
var _local4:b2Body;
var _local5:b2Body;
var _local6:*;
var _local7:*;
var _local8:Boolean;
var _local9:b2Contact;
var _local1:b2Contact = m_world.m_contactList;
while (_local1) {
_local2 = _local1.GetFixtureA();
_local3 = _local1.GetFixtureB();
_local4 = _local2.GetBody();
_local5 = _local3.GetBody();
if ((((_local4.IsAwake() == false)) && ((_local5.IsAwake() == false)))){
_local1 = _local1.GetNext();
} else {
if ((_local1.m_flags & b2Contact.e_filterFlag)){
if (_local5.ShouldCollide(_local4) == false){
_local9 = _local1;
_local1 = _local9.GetNext();
Destroy(_local9);
continue;
};
if (m_contactFilter.ShouldCollide(_local2, _local3) == false){
_local9 = _local1;
_local1 = _local9.GetNext();
Destroy(_local9);
continue;
};
_local1.m_flags = (_local1.m_flags & ~(b2Contact.e_filterFlag));
};
_local6 = _local2.m_proxy;
_local7 = _local3.m_proxy;
_local8 = m_broadPhase.TestOverlap(_local6, _local7);
if (_local8 == false){
_local9 = _local1;
_local1 = _local9.GetNext();
Destroy(_local9);
} else {
_local1.Update(m_contactListener);
_local1 = _local1.GetNext();
};
};
};
}
}
}//package Box2D.Dynamics
Section 94
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.*;
public class b2DebugDraw {
private var m_drawFlags:uint;
b2internal var m_sprite:Sprite;
private var m_drawScale:Number;// = 1
private var m_lineThickness:Number;// = 1
private var m_alpha:Number;// = 1
private var m_fillAlpha:Number;// = 1
private var m_xformScale:Number;// = 1
public static var e_shapeBit:uint = 1;
public static var e_jointBit:uint = 2;
public static var e_aabbBit:uint = 4;
public static var e_pairBit:uint = 8;
public static var e_centerOfMassBit:uint = 16;
public static var e_controllerBit:uint = 32;
public function b2DebugDraw(){
m_drawFlags = 0;
}
public function SetFlags(_arg1:uint):void{
m_drawFlags = _arg1;
}
public function GetFlags():uint{
return (m_drawFlags);
}
public function AppendFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags | _arg1);
}
public function ClearFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags & ~(_arg1));
}
public function SetSprite(_arg1:Sprite):void{
m_sprite = _arg1;
}
public function GetSprite():Sprite{
return (m_sprite);
}
public function SetDrawScale(_arg1:Number):void{
m_drawScale = _arg1;
}
public function GetDrawScale():Number{
return (m_drawScale);
}
public function SetLineThickness(_arg1:Number):void{
m_lineThickness = _arg1;
}
public function GetLineThickness():Number{
return (m_lineThickness);
}
public function SetAlpha(_arg1:Number):void{
m_alpha = _arg1;
}
public function GetAlpha():Number{
return (m_alpha);
}
public function SetFillAlpha(_arg1:Number):void{
m_fillAlpha = _arg1;
}
public function GetFillAlpha():Number{
return (m_fillAlpha);
}
public function SetXFormScale(_arg1:Number):void{
m_xformScale = _arg1;
}
public function GetXFormScale():Number{
return (m_xformScale);
}
public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
var _local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
}
public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha);
var _local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.endFill();
}
public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
}
public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha);
m_sprite.graphics.moveTo(0, 0);
m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
m_sprite.graphics.endFill();
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale));
}
public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale));
}
public function DrawTransform(_arg1:b2Transform):void{
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale));
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale));
}
}
}//package Box2D.Dynamics
Section 95
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener)
package Box2D.Dynamics {
import Box2D.Dynamics.Joints.*;
public class b2DestructionListener {
public function SayGoodbyeJoint(_arg1:b2Joint):void{
}
public function SayGoodbyeFixture(_arg1:b2Fixture):void{
}
}
}//package Box2D.Dynamics
Section 96
//b2FilterData (Box2D.Dynamics.b2FilterData)
package Box2D.Dynamics {
public class b2FilterData {
public var categoryBits:uint;// = 1
public var maskBits:uint;// = 0xFFFF
public var groupIndex:int;// = 0
public function Copy():b2FilterData{
var _local1:b2FilterData = new b2FilterData();
_local1.categoryBits = categoryBits;
_local1.maskBits = maskBits;
_local1.groupIndex = groupIndex;
return (_local1);
}
}
}//package Box2D.Dynamics
Section 97
//b2Fixture (Box2D.Dynamics.b2Fixture)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.*;
public class b2Fixture {
private var m_massData:b2MassData;
b2internal var m_aabb:b2AABB;
b2internal var m_density:Number;
b2internal var m_next:b2Fixture;
b2internal var m_body:b2Body;
b2internal var m_shape:b2Shape;
b2internal var m_friction:Number;
b2internal var m_restitution:Number;
b2internal var m_proxy;
b2internal var m_filter:b2FilterData;
b2internal var m_isSensor:Boolean;
b2internal var m_userData;
public function b2Fixture(){
m_filter = new b2FilterData();
super();
m_aabb = new b2AABB();
m_userData = null;
m_body = null;
m_next = null;
m_shape = null;
m_density = 0;
m_friction = 0;
m_restitution = 0;
}
public function GetType():int{
return (m_shape.GetType());
}
public function GetShape():b2Shape{
return (m_shape);
}
public function SetSensor(_arg1:Boolean):void{
var _local3:b2Contact;
var _local4:b2Fixture;
var _local5:b2Fixture;
if (m_isSensor == _arg1){
return;
};
m_isSensor = _arg1;
if (m_body == null){
return;
};
var _local2:b2ContactEdge = m_body.GetContactList();
while (_local2) {
_local3 = _local2.contact;
_local4 = _local3.GetFixtureA();
_local5 = _local3.GetFixtureB();
if ((((_local4 == this)) || ((_local5 == this)))){
_local3.SetSensor(((_local4.IsSensor()) || (_local5.IsSensor())));
};
_local2 = _local2.next;
};
}
public function IsSensor():Boolean{
return (m_isSensor);
}
public function SetFilterData(_arg1:b2FilterData):void{
var _local3:b2Contact;
var _local4:b2Fixture;
var _local5:b2Fixture;
m_filter = _arg1.Copy();
if (m_body){
return;
};
var _local2:b2ContactEdge = m_body.GetContactList();
while (_local2) {
_local3 = _local2.contact;
_local4 = _local3.GetFixtureA();
_local5 = _local3.GetFixtureB();
if ((((_local4 == this)) || ((_local5 == this)))){
_local3.FlagForFiltering();
};
_local2 = _local2.next;
};
}
public function GetFilterData():b2FilterData{
return (m_filter.Copy());
}
public function GetBody():b2Body{
return (m_body);
}
public function GetNext():b2Fixture{
return (m_next);
}
public function GetUserData(){
return (m_userData);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function TestPoint(_arg1:b2Vec2):Boolean{
return (m_shape.TestPoint(m_body.GetTransform(), _arg1));
}
public function RayCast(_arg1:b2RayCastOutput, _arg2:b2RayCastInput):Boolean{
return (m_shape.RayCast(_arg1, _arg2, m_body.GetTransform()));
}
public function GetMassData(_arg1:b2MassData=null):b2MassData{
if (_arg1 == null){
_arg1 = new b2MassData();
};
m_shape.ComputeMass(_arg1, m_density);
return (_arg1);
}
public function SetDensity(_arg1:Number):void{
m_density = _arg1;
}
public function GetDensity():Number{
return (m_density);
}
public function GetFriction():Number{
return (m_friction);
}
public function SetFriction(_arg1:Number):void{
m_friction = _arg1;
}
public function GetRestitution():Number{
return (m_restitution);
}
public function SetRestitution(_arg1:Number):void{
m_restitution = _arg1;
}
public function GetAABB():b2AABB{
return (m_aabb);
}
b2internal function Create(_arg1:b2Body, _arg2:b2Transform, _arg3:b2FixtureDef):void{
m_userData = _arg3.userData;
m_friction = _arg3.friction;
m_restitution = _arg3.restitution;
m_body = _arg1;
m_next = null;
m_filter = _arg3.filter.Copy();
m_isSensor = _arg3.isSensor;
m_shape = _arg3.shape.Copy();
m_density = _arg3.density;
}
b2internal function Destroy():void{
m_shape = null;
}
b2internal function CreateProxy(_arg1:IBroadPhase, _arg2:b2Transform):void{
m_shape.ComputeAABB(m_aabb, _arg2);
m_proxy = _arg1.CreateProxy(m_aabb, this);
}
b2internal function DestroyProxy(_arg1:IBroadPhase):void{
if (m_proxy == null){
return;
};
_arg1.DestroyProxy(m_proxy);
m_proxy = null;
}
b2internal function Synchronize(_arg1:IBroadPhase, _arg2:b2Transform, _arg3:b2Transform):void{
if (!m_proxy){
return;
};
var _local4:b2AABB = new b2AABB();
var _local5:b2AABB = new b2AABB();
m_shape.ComputeAABB(_local4, _arg2);
m_shape.ComputeAABB(_local5, _arg3);
m_aabb.Combine(_local4, _local5);
var _local6:b2Vec2 = b2Math.SubtractVV(_arg3.position, _arg2.position);
_arg1.MoveProxy(m_proxy, m_aabb, _local6);
}
}
}//package Box2D.Dynamics
Section 98
//b2FixtureDef (Box2D.Dynamics.b2FixtureDef)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
public class b2FixtureDef {
public var shape:b2Shape;
public var userData;
public var friction:Number;
public var restitution:Number;
public var density:Number;
public var isSensor:Boolean;
public var filter:b2FilterData;
public function b2FixtureDef(){
filter = new b2FilterData();
super();
shape = null;
userData = null;
friction = 0.2;
restitution = 0;
density = 0;
filter.categoryBits = 1;
filter.maskBits = 0xFFFF;
filter.groupIndex = 0;
isSensor = false;
}
}
}//package Box2D.Dynamics
Section 99
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.*;
public class b2Island {
private var m_allocator;
private var m_listener:b2ContactListener;
private var m_contactSolver:b2ContactSolver;
b2internal var m_bodies:Array;
b2internal var m_contacts:Array;
b2internal var m_joints:Array;
b2internal var m_bodyCount:int;
b2internal var m_jointCount:int;
b2internal var m_contactCount:int;
private var m_bodyCapacity:int;
b2internal var m_contactCapacity:int;
b2internal var m_jointCapacity:int;
private static var s_impulse:b2ContactImpulse = new b2ContactImpulse();
public function b2Island(){
m_bodies = new Array();
m_contacts = new Array();
m_joints = new Array();
}
public function Initialize(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener, _arg6:b2ContactSolver):void{
var _local7:int;
m_bodyCapacity = _arg1;
m_contactCapacity = _arg2;
m_jointCapacity = _arg3;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_allocator = _arg4;
m_listener = _arg5;
m_contactSolver = _arg6;
_local7 = m_bodies.length;
while (_local7 < _arg1) {
m_bodies[_local7] = null;
_local7++;
};
_local7 = m_contacts.length;
while (_local7 < _arg2) {
m_contacts[_local7] = null;
_local7++;
};
_local7 = m_joints.length;
while (_local7 < _arg3) {
m_joints[_local7] = null;
_local7++;
};
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean):void{
var _local4:int;
var _local5:int;
var _local6:b2Body;
var _local7:b2Joint;
var _local8:b2Vec2;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Boolean;
var _local14:Boolean;
var _local15:Boolean;
var _local16:Number;
var _local17:Number;
var _local18:Number;
_local4 = 0;
while (_local4 < m_bodyCount) {
_local6 = m_bodies[_local4];
if (_local6.GetType() != b2Body.b2_dynamicBody){
} else {
_local8 = _arg2;
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_local8.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_local8.y + (_local6.m_invMass * _local6.m_force.y))));
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_linearVelocity.Multiply(b2Math.Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
};
_local4++;
};
m_contactSolver.Initialize(_arg1, m_contacts, m_contactCount, m_allocator);
var _local9:b2ContactSolver = m_contactSolver;
_local9.InitVelocityConstraints(_arg1);
_local4 = 0;
while (_local4 < m_jointCount) {
_local7 = m_joints[_local4];
_local7.InitVelocityConstraints(_arg1);
_local4++;
};
_local4 = 0;
while (_local4 < _arg1.velocityIterations) {
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.SolveVelocityConstraints(_arg1);
_local5++;
};
_local9.SolveVelocityConstraints();
_local4++;
};
_local4 = 0;
while (_local4 < m_jointCount) {
_local7 = m_joints[_local4];
_local7.FinalizeVelocityConstraints();
_local4++;
};
_local9.FinalizeVelocityConstraints();
_local4 = 0;
while (_local4 < m_bodyCount) {
_local6 = m_bodies[_local4];
if (_local6.GetType() == b2Body.b2_staticBody){
} else {
_local10 = (_arg1.dt * _local6.m_linearVelocity.x);
_local11 = (_arg1.dt * _local6.m_linearVelocity.y);
if (((_local10 * _local10) + (_local11 * _local11)) > b2Settings.b2_maxTranslationSquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * (b2Settings.b2_maxTranslation * _arg1.inv_dt));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * (b2Settings.b2_maxTranslation * _arg1.inv_dt));
};
_local12 = (_arg1.dt * _local6.m_angularVelocity);
if (((_arg1.dt * _local6.m_angularVelocity) * _local12) > b2Settings.b2_maxRotationSquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = (-(b2Settings.b2_maxRotation) * _arg1.inv_dt);
} else {
_local6.m_angularVelocity = (b2Settings.b2_maxRotation * _arg1.inv_dt);
};
};
_local6.m_sweep.c0.SetV(_local6.m_sweep.c);
_local6.m_sweep.a0 = _local6.m_sweep.a;
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y));
_local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity));
_local6.SynchronizeTransform();
};
_local4++;
};
_local4 = 0;
while (_local4 < _arg1.positionIterations) {
_local13 = _local9.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local14 = true;
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local15 = _local7.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local14 = ((_local14) && (_local15));
_local5++;
};
if (((_local13) && (_local14))){
break;
};
_local4++;
};
Report(_local9.m_constraints);
if (_arg3){
_local16 = Number.MAX_VALUE;
_local17 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local18 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local4 = 0;
while (_local4 < m_bodyCount) {
_local6 = m_bodies[_local4];
if (_local6.GetType() == b2Body.b2_staticBody){
} else {
if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){
_local6.m_sleepTime = 0;
_local16 = 0;
};
if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local18)))) || ((b2Math.Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local17)))){
_local6.m_sleepTime = 0;
_local16 = 0;
} else {
_local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt);
_local16 = b2Math.Min(_local16, _local6.m_sleepTime);
};
};
_local4++;
};
if (_local16 >= b2Settings.b2_timeToSleep){
_local4 = 0;
while (_local4 < m_bodyCount) {
_local6 = m_bodies[_local4];
_local6.SetAwake(false);
_local4++;
};
};
};
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:int;
var _local3:int;
var _local6:b2Body;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
m_contactSolver.Initialize(_arg1, m_contacts, m_contactCount, m_allocator);
var _local4:b2ContactSolver = m_contactSolver;
_local2 = 0;
while (_local2 < m_jointCount) {
m_joints[_local2].InitVelocityConstraints(_arg1);
_local2++;
};
_local2 = 0;
while (_local2 < _arg1.velocityIterations) {
_local4.SolveVelocityConstraints();
_local3 = 0;
while (_local3 < m_jointCount) {
m_joints[_local3].SolveVelocityConstraints(_arg1);
_local3++;
};
_local2++;
};
_local2 = 0;
while (_local2 < m_bodyCount) {
_local6 = m_bodies[_local2];
if (_local6.GetType() == b2Body.b2_staticBody){
} else {
_local7 = (_arg1.dt * _local6.m_linearVelocity.x);
_local8 = (_arg1.dt * _local6.m_linearVelocity.y);
if (((_local7 * _local7) + (_local8 * _local8)) > b2Settings.b2_maxTranslationSquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * (b2Settings.b2_maxTranslation * _arg1.inv_dt));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * (b2Settings.b2_maxTranslation * _arg1.inv_dt));
};
_local9 = (_arg1.dt * _local6.m_angularVelocity);
if (((_arg1.dt * _local6.m_angularVelocity) * _local9) > b2Settings.b2_maxRotationSquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = (-(b2Settings.b2_maxRotation) * _arg1.inv_dt);
} else {
_local6.m_angularVelocity = (b2Settings.b2_maxRotation * _arg1.inv_dt);
};
};
_local6.m_sweep.c0.SetV(_local6.m_sweep.c);
_local6.m_sweep.a0 = _local6.m_sweep.a;
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y));
_local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity));
_local6.SynchronizeTransform();
};
_local2++;
};
var _local5:Number = 0.75;
_local2 = 0;
while (_local2 < _arg1.positionIterations) {
_local10 = _local4.SolvePositionConstraints(_local5);
_local11 = true;
_local3 = 0;
while (_local3 < m_jointCount) {
_local12 = m_joints[_local3].SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local11 = ((_local11) && (_local12));
_local3++;
};
if (((_local10) && (_local11))){
break;
};
_local2++;
};
Report(_local4.m_constraints);
}
public function Report(_arg1:Array):void{
var _local3:b2Contact;
var _local4:b2ContactConstraint;
var _local5:int;
if (m_listener == null){
return;
};
var _local2:int;
while (_local2 < m_contactCount) {
_local3 = m_contacts[_local2];
_local4 = _arg1[_local2];
_local5 = 0;
while (_local5 < _local4.pointCount) {
s_impulse.normalImpulses[_local5] = _local4.points[_local5].normalImpulse;
s_impulse.tangentImpulses[_local5] = _local4.points[_local5].tangentImpulse;
_local5++;
};
m_listener.PostSolve(_local3, s_impulse);
_local2++;
};
}
public function AddBody(_arg1:b2Body):void{
_arg1.m_islandIndex = m_bodyCount;
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
}
}//package Box2D.Dynamics
Section 100
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var dt:Number;
public var inv_dt:Number;
public var dtRatio:Number;
public var velocityIterations:int;
public var positionIterations:int;
public var warmStarting:Boolean;
public function Set(_arg1:b2TimeStep):void{
dt = _arg1.dt;
inv_dt = _arg1.inv_dt;
positionIterations = _arg1.positionIterations;
velocityIterations = _arg1.velocityIterations;
warmStarting = _arg1.warmStarting;
}
}
}//package Box2D.Dynamics
Section 101
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Controllers.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.*;
public class b2World {
private var s_stack:Array;
b2internal var m_flags:int;
b2internal var m_contactManager:b2ContactManager;
private var m_contactSolver:b2ContactSolver;
private var m_island:b2Island;
b2internal var m_bodyList:b2Body;
private var m_jointList:b2Joint;
b2internal var m_contactList:b2Contact;
private var m_bodyCount:int;
b2internal var m_contactCount:int;
private var m_jointCount:int;
private var m_controllerList:b2Controller;
private var m_controllerCount:int;
private var m_gravity:b2Vec2;
private var m_allowSleep:Boolean;
b2internal var m_groundBody:b2Body;
private var m_destructionListener:b2DestructionListener;
private var m_debugDraw:b2DebugDraw;
private var m_inv_dt0:Number;
public static const e_newFixture:int = 1;
public static const e_locked:int = 2;
private static var s_timestep2:b2TimeStep = new b2TimeStep();
private static var s_xf:b2Transform = new b2Transform();
private static var s_backupA:b2Sweep = new b2Sweep();
private static var s_backupB:b2Sweep = new b2Sweep();
private static var s_timestep:b2TimeStep = new b2TimeStep();
private static var s_queue:Array = new Array();
private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8);
private static var m_warmStarting:Boolean;
private static var m_continuousPhysics:Boolean;
public function b2World(_arg1:b2Vec2, _arg2:Boolean){
s_stack = new Array();
m_contactManager = new b2ContactManager();
m_contactSolver = new b2ContactSolver();
m_island = new b2Island();
super();
m_destructionListener = null;
m_debugDraw = null;
m_bodyList = null;
m_contactList = null;
m_jointList = null;
m_controllerList = null;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_controllerCount = 0;
m_warmStarting = true;
m_continuousPhysics = true;
m_allowSleep = _arg2;
m_gravity = _arg1;
m_inv_dt0 = 0;
m_contactManager.m_world = this;
var _local3:b2BodyDef = new b2BodyDef();
m_groundBody = CreateBody(_local3);
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function SetContactFilter(_arg1:b2ContactFilter):void{
m_contactManager.m_contactFilter = _arg1;
}
public function SetContactListener(_arg1:b2ContactListener):void{
m_contactManager.m_contactListener = _arg1;
}
public function SetDebugDraw(_arg1:b2DebugDraw):void{
m_debugDraw = _arg1;
}
public function SetBroadPhase(_arg1:IBroadPhase):void{
var _local4:b2Fixture;
var _local2:IBroadPhase = m_contactManager.m_broadPhase;
m_contactManager.m_broadPhase = _arg1;
var _local3:b2Body = m_bodyList;
while (_local3) {
_local4 = _local3.m_fixtureList;
while (_local4) {
_local4.m_proxy = _arg1.CreateProxy(_local2.GetFatAABB(_local4.m_proxy), _local4);
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
}
public function Validate():void{
m_contactManager.m_broadPhase.Validate();
}
public function GetProxyCount():int{
return (m_contactManager.m_broadPhase.GetProxyCount());
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
if (IsLocked() == true){
return (null);
};
var _local2:b2Body = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
public function DestroyBody(_arg1:b2Body):void{
var _local6:b2JointEdge;
var _local7:b2ControllerEdge;
var _local8:b2ContactEdge;
var _local9:b2Fixture;
if (IsLocked() == true){
return;
};
var _local2:b2JointEdge = _arg1.m_jointList;
while (_local2) {
_local6 = _local2;
_local2 = _local2.next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeJoint(_local6.joint);
};
DestroyJoint(_local6.joint);
};
var _local3:b2ControllerEdge = _arg1.m_controllerList;
while (_local3) {
_local7 = _local3;
_local3 = _local3.nextController;
_local7.controller.RemoveBody(_arg1);
};
var _local4:b2ContactEdge = _arg1.m_contactList;
while (_local4) {
_local8 = _local4;
_local4 = _local4.next;
m_contactManager.Destroy(_local8.contact);
};
_arg1.m_contactList = null;
var _local5:b2Fixture = _arg1.m_fixtureList;
while (_local5) {
_local9 = _local5;
_local5 = _local5.m_next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeFixture(_local9);
};
_local9.DestroyProxy(m_contactManager.m_broadPhase);
_local9.Destroy();
};
_arg1.m_fixtureList = null;
_arg1.m_fixtureCount = 0;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_bodyList){
m_bodyList = _arg1.m_next;
};
m_bodyCount--;
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local5:b2ContactEdge;
var _local2:b2Joint = b2Joint.Create(_arg1, null);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_edgeA.joint = _local2;
_local2.m_edgeA.other = _local2.m_bodyB;
_local2.m_edgeA.prev = null;
_local2.m_edgeA.next = _local2.m_bodyA.m_jointList;
if (_local2.m_bodyA.m_jointList){
_local2.m_bodyA.m_jointList.prev = _local2.m_edgeA;
};
_local2.m_bodyA.m_jointList = _local2.m_edgeA;
_local2.m_edgeB.joint = _local2;
_local2.m_edgeB.other = _local2.m_bodyA;
_local2.m_edgeB.prev = null;
_local2.m_edgeB.next = _local2.m_bodyB.m_jointList;
if (_local2.m_bodyB.m_jointList){
_local2.m_bodyB.m_jointList.prev = _local2.m_edgeB;
};
_local2.m_bodyB.m_jointList = _local2.m_edgeB;
var _local3:b2Body = _arg1.bodyA;
var _local4:b2Body = _arg1.bodyB;
if (_arg1.collideConnected == false){
_local5 = _local4.GetContactList();
while (_local5) {
if (_local5.other == _local3){
_local5.contact.FlagForFiltering();
};
_local5 = _local5.next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local5:b2ContactEdge;
var _local2:Boolean = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_jointList){
m_jointList = _arg1.m_next;
};
var _local3:b2Body = _arg1.m_bodyA;
var _local4:b2Body = _arg1.m_bodyB;
_local3.SetAwake(true);
_local4.SetAwake(true);
if (_arg1.m_edgeA.prev){
_arg1.m_edgeA.prev.next = _arg1.m_edgeA.next;
};
if (_arg1.m_edgeA.next){
_arg1.m_edgeA.next.prev = _arg1.m_edgeA.prev;
};
if (_arg1.m_edgeA == _local3.m_jointList){
_local3.m_jointList = _arg1.m_edgeA.next;
};
_arg1.m_edgeA.prev = null;
_arg1.m_edgeA.next = null;
if (_arg1.m_edgeB.prev){
_arg1.m_edgeB.prev.next = _arg1.m_edgeB.next;
};
if (_arg1.m_edgeB.next){
_arg1.m_edgeB.next.prev = _arg1.m_edgeB.prev;
};
if (_arg1.m_edgeB == _local4.m_jointList){
_local4.m_jointList = _arg1.m_edgeB.next;
};
_arg1.m_edgeB.prev = null;
_arg1.m_edgeB.next = null;
b2Joint.Destroy(_arg1, null);
m_jointCount--;
if (_local2 == false){
_local5 = _local4.GetContactList();
while (_local5) {
if (_local5.other == _local3){
_local5.contact.FlagForFiltering();
};
_local5 = _local5.next;
};
};
}
public function AddController(_arg1:b2Controller):b2Controller{
_arg1.m_next = m_controllerList;
_arg1.m_prev = null;
m_controllerList = _arg1;
_arg1.m_world = this;
m_controllerCount++;
return (_arg1);
}
public function RemoveController(_arg1:b2Controller):void{
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (m_controllerList == _arg1){
m_controllerList = _arg1.m_next;
};
m_controllerCount--;
}
public function CreateController(_arg1:b2Controller):b2Controller{
if (_arg1.m_world != this){
throw (new Error("Controller can only be a member of one world"));
};
_arg1.m_next = m_controllerList;
_arg1.m_prev = null;
if (m_controllerList){
m_controllerList.m_prev = _arg1;
};
m_controllerList = _arg1;
m_controllerCount++;
_arg1.m_world = this;
return (_arg1);
}
public function DestroyController(_arg1:b2Controller):void{
_arg1.Clear();
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1 == m_controllerList){
m_controllerList = _arg1.m_next;
};
m_controllerCount--;
}
public function SetWarmStarting(_arg1:Boolean):void{
m_warmStarting = _arg1;
}
public function SetContinuousPhysics(_arg1:Boolean):void{
m_continuousPhysics = _arg1;
}
public function GetBodyCount():int{
return (m_bodyCount);
}
public function GetJointCount():int{
return (m_jointCount);
}
public function GetContactCount():int{
return (m_contactCount);
}
public function SetGravity(_arg1:b2Vec2):void{
m_gravity = _arg1;
}
public function GetGravity():b2Vec2{
return (m_gravity);
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
public function Step(_arg1:Number, _arg2:int, _arg3:int):void{
if ((m_flags & e_newFixture)){
m_contactManager.FindNewContacts();
m_flags = (m_flags & ~(e_newFixture));
};
m_flags = (m_flags | e_locked);
var _local4:b2TimeStep = s_timestep2;
_local4.dt = _arg1;
_local4.velocityIterations = _arg2;
_local4.positionIterations = _arg3;
if (_arg1 > 0){
_local4.inv_dt = (1 / _arg1);
} else {
_local4.inv_dt = 0;
};
_local4.dtRatio = (m_inv_dt0 * _arg1);
_local4.warmStarting = m_warmStarting;
m_contactManager.Collide();
if (_local4.dt > 0){
Solve(_local4);
};
if (((m_continuousPhysics) && ((_local4.dt > 0)))){
SolveTOI(_local4);
};
if (_local4.dt > 0){
m_inv_dt0 = _local4.inv_dt;
};
m_flags = (m_flags & ~(e_locked));
}
public function ClearForces():void{
var _local1:b2Body = m_bodyList;
while (_local1) {
_local1.m_force.SetZero();
_local1.m_torque = 0;
_local1 = _local1.m_next;
};
}
public function DrawDebugData():void{
var _local2:int;
var _local3:b2Body;
var _local4:b2Fixture;
var _local5:b2Shape;
var _local6:b2Joint;
var _local7:IBroadPhase;
var _local11:b2Transform;
var _local16:b2Controller;
var _local17:b2Contact;
var _local18:b2Fixture;
var _local19:b2Fixture;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:b2AABB;
if (m_debugDraw == null){
return;
};
m_debugDraw.m_sprite.graphics.clear();
var _local1:uint = m_debugDraw.GetFlags();
var _local8:b2Vec2 = new b2Vec2();
var _local9:b2Vec2 = new b2Vec2();
var _local10:b2Vec2 = new b2Vec2();
var _local12:b2AABB = new b2AABB();
var _local13:b2AABB = new b2AABB();
var _local14:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
var _local15:b2Color = new b2Color(0, 0, 0);
if ((_local1 & b2DebugDraw.e_shapeBit)){
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetFixtureList();
while (_local4) {
_local5 = _local4.GetShape();
if (_local3.IsActive() == false){
_local15.Set(0.5, 0.5, 0.3);
DrawShape(_local5, _local11, _local15);
} else {
if (_local3.GetType() == b2Body.b2_staticBody){
_local15.Set(0.5, 0.9, 0.5);
DrawShape(_local5, _local11, _local15);
} else {
if (_local3.GetType() == b2Body.b2_kinematicBody){
_local15.Set(0.5, 0.5, 0.9);
DrawShape(_local5, _local11, _local15);
} else {
if (_local3.IsAwake() == false){
_local15.Set(0.6, 0.6, 0.6);
DrawShape(_local5, _local11, _local15);
} else {
_local15.Set(0.9, 0.7, 0.7);
DrawShape(_local5, _local11, _local15);
};
};
};
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_jointBit)){
_local6 = m_jointList;
while (_local6) {
DrawJoint(_local6);
_local6 = _local6.m_next;
};
};
if ((_local1 & b2DebugDraw.e_controllerBit)){
_local16 = m_controllerList;
while (_local16) {
_local16.Draw(m_debugDraw);
_local16 = _local16.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local15.Set(0.3, 0.9, 0.9);
_local17 = m_contactManager.m_contactList;
while (_local17) {
_local18 = _local17.GetFixtureA();
_local19 = _local17.GetFixtureB();
_local20 = _local18.GetAABB().GetCenter();
_local21 = _local19.GetAABB().GetCenter();
m_debugDraw.DrawSegment(_local20, _local21, _local15);
_local17 = _local17.GetNext();
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local7 = m_contactManager.m_broadPhase;
_local14 = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
_local3 = m_bodyList;
while (_local3) {
if (_local3.IsActive() == false){
} else {
_local4 = _local3.GetFixtureList();
while (_local4) {
_local22 = _local7.GetFatAABB(_local4.m_proxy);
_local14[0].Set(_local22.lowerBound.x, _local22.lowerBound.y);
_local14[1].Set(_local22.upperBound.x, _local22.lowerBound.y);
_local14[2].Set(_local22.upperBound.x, _local22.upperBound.y);
_local14[3].Set(_local22.lowerBound.x, _local22.upperBound.y);
m_debugDraw.DrawPolygon(_local14, 4, _local15);
_local4 = _local4.GetNext();
};
};
_local3 = _local3.GetNext();
};
};
if ((_local1 & b2DebugDraw.e_centerOfMassBit)){
_local3 = m_bodyList;
while (_local3) {
_local11 = s_xf;
_local11.R = _local3.m_xf.R;
_local11.position = _local3.GetWorldCenter();
m_debugDraw.DrawTransform(_local11);
_local3 = _local3.m_next;
};
};
}
public function QueryAABB(_arg1:Function, _arg2:b2AABB):void{
var broadPhase:IBroadPhase;
var WorldQueryWrapper:Function;
var callback = _arg1;
var aabb = _arg2;
WorldQueryWrapper = function (_arg1):Boolean{
return (callback(broadPhase.GetUserData(_arg1)));
};
broadPhase = m_contactManager.m_broadPhase;
broadPhase.Query(WorldQueryWrapper, aabb);
}
public function QueryShape(_arg1:Function, _arg2:b2Shape, _arg3:b2Transform=null):void{
var broadPhase:IBroadPhase;
var WorldQueryWrapper:Function;
var callback = _arg1;
var shape = _arg2;
var transform = _arg3;
WorldQueryWrapper = function (_arg1):Boolean{
var _local2:b2Fixture = (broadPhase.GetUserData(_arg1) as b2Fixture);
if (b2Shape.TestOverlap(shape, transform, _local2.GetShape(), _local2.GetBody().GetTransform())){
return (callback(_local2));
};
return (true);
};
if (transform == null){
transform = new b2Transform();
transform.SetIdentity();
};
broadPhase = m_contactManager.m_broadPhase;
var aabb:b2AABB = new b2AABB();
shape.ComputeAABB(aabb, transform);
broadPhase.Query(WorldQueryWrapper, aabb);
}
public function QueryPoint(_arg1:Function, _arg2:b2Vec2):void{
var broadPhase:IBroadPhase;
var WorldQueryWrapper:Function;
var callback = _arg1;
var p = _arg2;
WorldQueryWrapper = function (_arg1):Boolean{
var _local2:b2Fixture = (broadPhase.GetUserData(_arg1) as b2Fixture);
if (_local2.TestPoint(p)){
return (callback(_local2));
};
return (true);
};
broadPhase = m_contactManager.m_broadPhase;
var aabb:b2AABB = new b2AABB();
aabb.lowerBound.Set((p.x - b2Settings.b2_linearSlop), (p.y - b2Settings.b2_linearSlop));
aabb.upperBound.Set((p.x + b2Settings.b2_linearSlop), (p.y + b2Settings.b2_linearSlop));
broadPhase.Query(WorldQueryWrapper, aabb);
}
public function RayCast(_arg1:Function, _arg2:b2Vec2, _arg3:b2Vec2):void{
var broadPhase:IBroadPhase;
var output:b2RayCastOutput;
var RayCastWrapper:Function;
var callback = _arg1;
var point1 = _arg2;
var point2 = _arg3;
RayCastWrapper = function (_arg1:b2RayCastInput, _arg2):Number{
var _local6:Number;
var _local7:b2Vec2;
var _local3:* = broadPhase.GetUserData(_arg2);
var _local4:b2Fixture = (_local3 as b2Fixture);
var _local5:Boolean = _local4.RayCast(output, _arg1);
if (_local5){
_local6 = output.fraction;
_local7 = new b2Vec2((((1 - _local6) * point1.x) + (_local6 * point2.x)), (((1 - _local6) * point1.y) + (_local6 * point2.y)));
return (callback(_local4, _local7, output.normal, _local6));
};
return (_arg1.maxFraction);
};
broadPhase = m_contactManager.m_broadPhase;
output = new b2RayCastOutput();
var input:b2RayCastInput = new b2RayCastInput(point1, point2);
broadPhase.RayCast(RayCastWrapper, input);
}
public function RayCastOne(_arg1:b2Vec2, _arg2:b2Vec2):b2Fixture{
var result:b2Fixture;
var RayCastOneWrapper:Function;
var point1 = _arg1;
var point2 = _arg2;
RayCastOneWrapper = function (_arg1:b2Fixture, _arg2:b2Vec2, _arg3:b2Vec2, _arg4:Number):Number{
result = _arg1;
return (_arg4);
};
RayCast(RayCastOneWrapper, point1, point2);
return (result);
}
public function RayCastAll(_arg1:b2Vec2, _arg2:b2Vec2):Array{
var result:Array;
var RayCastAllWrapper:Function;
var point1 = _arg1;
var point2 = _arg2;
RayCastAllWrapper = function (_arg1:b2Fixture, _arg2:b2Vec2, _arg3:b2Vec2, _arg4:Number):Number{
result[result.length] = _arg1;
return (1);
};
result = new Array();
RayCast(RayCastAllWrapper, point1, point2);
return (result);
}
public function GetBodyList():b2Body{
return (m_bodyList);
}
public function GetJointList():b2Joint{
return (m_jointList);
}
public function GetContactList():b2Contact{
return (m_contactList);
}
public function IsLocked():Boolean{
return (((m_flags & e_locked) > 0));
}
b2internal function Solve(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local10:int;
var _local11:int;
var _local12:b2Body;
var _local13:b2ContactEdge;
var _local14:b2JointEdge;
var _local3:b2Controller = m_controllerList;
while (_local3) {
_local3.Step(_arg1);
_local3 = _local3.m_next;
};
var _local4:b2Island = m_island;
_local4.Initialize(m_bodyCount, m_contactCount, m_jointCount, null, m_contactManager.m_contactListener, m_contactSolver);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2 = _local2.m_next;
};
var _local5:b2Contact = m_contactList;
while (_local5) {
_local5.m_flags = (_local5.m_flags & ~(b2Contact.e_islandFlag));
_local5 = _local5.m_next;
};
var _local6:b2Joint = m_jointList;
while (_local6) {
_local6.m_islandFlag = false;
_local6 = _local6.m_next;
};
var _local7:int = m_bodyCount;
var _local8:Array = s_stack;
var _local9:b2Body = m_bodyList;
while (_local9) {
if ((_local9.m_flags & b2Body.e_islandFlag)){
} else {
if ((((_local9.IsAwake() == false)) || ((_local9.IsActive() == false)))){
} else {
if (_local9.GetType() == b2Body.b2_staticBody){
} else {
_local4.Clear();
_local10 = 0;
var _temp1 = _local10;
_local10 = (_local10 + 1);
var _local15 = _temp1;
_local8[_local15] = _local9;
_local9.m_flags = (_local9.m_flags | b2Body.e_islandFlag);
while (_local10 > 0) {
--_local10;
_local2 = _local8[_local10];
_local4.AddBody(_local2);
if (_local2.IsAwake() == false){
_local2.SetAwake(true);
};
if (_local2.GetType() == b2Body.b2_staticBody){
} else {
_local13 = _local2.m_contactList;
while (_local13) {
if ((_local13.contact.m_flags & b2Contact.e_islandFlag)){
} else {
if ((((((_local13.contact.IsSensor() == true)) || ((_local13.contact.IsEnabled() == false)))) || ((_local13.contact.IsTouching() == false)))){
} else {
_local4.AddContact(_local13.contact);
_local13.contact.m_flags = (_local13.contact.m_flags | b2Contact.e_islandFlag);
_local12 = _local13.other;
if ((_local12.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local10;
_local10 = (_local10 + 1);
var _local16 = _temp2;
_local8[_local16] = _local12;
_local12.m_flags = (_local12.m_flags | b2Body.e_islandFlag);
};
};
};
_local13 = _local13.next;
};
_local14 = _local2.m_jointList;
while (_local14) {
if (_local14.joint.m_islandFlag == true){
} else {
_local12 = _local14.other;
if (_local12.IsActive() == false){
} else {
_local4.AddJoint(_local14.joint);
_local14.joint.m_islandFlag = true;
if ((_local12.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local10;
_local10 = (_local10 + 1);
_local16 = _temp3;
_local8[_local16] = _local12;
_local12.m_flags = (_local12.m_flags | b2Body.e_islandFlag);
};
};
};
_local14 = _local14.next;
};
};
};
_local4.Solve(_arg1, m_gravity, m_allowSleep);
_local11 = 0;
while (_local11 < _local4.m_bodyCount) {
_local2 = _local4.m_bodies[_local11];
if (_local2.GetType() == b2Body.b2_staticBody){
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
};
_local11++;
};
};
};
};
_local9 = _local9.m_next;
};
_local11 = 0;
while (_local11 < _local8.length) {
if (!_local8[_local11]){
break;
};
_local8[_local11] = null;
_local11++;
};
_local2 = m_bodyList;
while (_local2) {
if ((((_local2.IsAwake() == false)) || ((_local2.IsActive() == false)))){
} else {
if (_local2.GetType() == b2Body.b2_staticBody){
} else {
_local2.SynchronizeFixtures();
};
};
_local2 = _local2.m_next;
};
m_contactManager.FindNewContacts();
}
b2internal function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Fixture;
var _local4:b2Fixture;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local8:b2Joint;
var _local11:b2Contact;
var _local12:b2Contact;
var _local13:Number;
var _local14:b2Body;
var _local15:int;
var _local16:int;
var _local17:b2TimeStep;
var _local18:int;
var _local19:Number;
var _local20:Number;
var _local21:b2JointEdge;
var _local22:b2Body;
var _local9:b2Island = m_island;
_local9.Initialize(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, b2Settings.b2_maxTOIJointsPerIsland, null, m_contactManager.m_contactListener, m_contactSolver);
var _local10:Array = s_queue;
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2.m_sweep.t0 = 0;
_local2 = _local2.m_next;
};
_local11 = m_contactList;
while (_local11) {
_local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local11 = _local11.m_next;
};
_local8 = m_jointList;
while (_local8) {
_local8.m_islandFlag = false;
_local8 = _local8.m_next;
};
while (true) {
_local12 = null;
_local13 = 1;
_local11 = m_contactList;
for (;_local11;(_local11 = _local11.m_next)) {
if ((((((_local11.IsSensor() == true)) || ((_local11.IsEnabled() == false)))) || ((_local11.IsContinuous() == false)))){
} else {
_local19 = 1;
if ((_local11.m_flags & b2Contact.e_toiFlag)){
_local19 = _local11.m_toi;
} else {
_local3 = _local11.m_fixtureA;
_local4 = _local11.m_fixtureB;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((!((_local5.GetType() == b2Body.b2_dynamicBody))) || ((_local5.IsAwake() == false)))) && (((!((_local6.GetType() == b2Body.b2_dynamicBody))) || ((_local6.IsAwake() == false)))))){
continue;
};
_local20 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local20 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local20);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local20 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local20);
};
};
_local19 = _local11.ComputeTOI(_local5.m_sweep, _local6.m_sweep);
b2Settings.b2Assert((((0 <= _local19)) && ((_local19 <= 1))));
if ((((_local19 > 0)) && ((_local19 < 1)))){
_local19 = (((1 - _local19) * _local20) + _local19);
if (_local19 > 1){
_local19 = 1;
};
};
_local11.m_toi = _local19;
_local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local19)) && ((_local19 < _local13)))){
_local12 = _local11;
_local13 = _local19;
};
};
};
if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){
break;
};
_local3 = _local12.m_fixtureA;
_local4 = _local12.m_fixtureB;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
s_backupA.Set(_local5.m_sweep);
s_backupB.Set(_local6.m_sweep);
_local5.Advance(_local13);
_local6.Advance(_local13);
_local12.Update(m_contactManager.m_contactListener);
_local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag));
if ((((_local12.IsSensor() == true)) || ((_local12.IsEnabled() == false)))){
_local5.m_sweep.Set(s_backupA);
_local6.m_sweep.Set(s_backupB);
_local5.SynchronizeTransform();
_local6.SynchronizeTransform();
} else {
if (_local12.IsTouching() == false){
} else {
_local14 = _local5;
if (_local14.GetType() != b2Body.b2_dynamicBody){
_local14 = _local6;
};
_local9.Clear();
_local15 = 0;
_local16 = 0;
var _temp1 = _local16;
_local16 = (_local16 + 1);
_local10[(_local15 + _temp1)] = _local14;
_local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag);
while (_local16 > 0) {
var _temp2 = _local15;
_local15 = (_local15 + 1);
_local2 = _local10[_temp2];
_local16--;
_local9.AddBody(_local2);
if (_local2.IsAwake() == false){
_local2.SetAwake(true);
};
if (_local2.GetType() != b2Body.b2_dynamicBody){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local9.m_contactCount == _local9.m_contactCapacity){
break;
};
if ((_local7.contact.m_flags & b2Contact.e_islandFlag)){
} else {
if ((((((_local7.contact.IsSensor() == true)) || ((_local7.contact.IsEnabled() == false)))) || ((_local7.contact.IsTouching() == false)))){
} else {
_local9.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local22 = _local7.other;
if ((_local22.m_flags & b2Body.e_islandFlag)){
} else {
if (_local22.GetType() != b2Body.b2_staticBody){
_local22.Advance(_local13);
_local22.SetAwake(true);
};
_local10[(_local15 + _local16)] = _local22;
_local16++;
_local22.m_flags = (_local22.m_flags | b2Body.e_islandFlag);
};
};
};
_local7 = _local7.next;
};
_local21 = _local2.m_jointList;
while (_local21) {
if (_local9.m_jointCount == _local9.m_jointCapacity){
} else {
if (_local21.joint.m_islandFlag == true){
} else {
_local22 = _local21.other;
if (_local22.IsActive() == false){
} else {
_local9.AddJoint(_local21.joint);
_local21.joint.m_islandFlag = true;
if ((_local22.m_flags & b2Body.e_islandFlag)){
} else {
if (_local22.GetType() != b2Body.b2_staticBody){
_local22.Advance(_local13);
_local22.SetAwake(true);
};
_local10[(_local15 + _local16)] = _local22;
_local16++;
_local22.m_flags = (_local22.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local21 = _local21.next;
};
};
};
_local17 = s_timestep;
_local17.warmStarting = false;
_local17.dt = ((1 - _local13) * _arg1.dt);
_local17.inv_dt = (1 / _local17.dt);
_local17.dtRatio = 0;
_local17.velocityIterations = _arg1.velocityIterations;
_local17.positionIterations = _arg1.positionIterations;
_local9.SolveTOI(_local17);
_local18 = 0;
while (_local18 < _local9.m_bodyCount) {
_local2 = _local9.m_bodies[_local18];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if (_local2.IsAwake() == false){
} else {
if (_local2.GetType() != b2Body.b2_dynamicBody){
} else {
_local2.SynchronizeFixtures();
_local7 = _local2.m_contactList;
while (_local7) {
_local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag));
_local7 = _local7.next;
};
};
};
_local18++;
};
_local18 = 0;
while (_local18 < _local9.m_contactCount) {
_local11 = _local9.m_contacts[_local18];
_local9.m_contacts[_local18].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local18++;
};
_local18 = 0;
while (_local18 < _local9.m_jointCount) {
_local8 = _local9.m_joints[_local18];
_local8.m_islandFlag = false;
_local18++;
};
m_contactManager.FindNewContacts();
};
};
};
}
b2internal function DrawJoint(_arg1:b2Joint):void{
var _local11:b2PulleyJoint;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local2:b2Body = _arg1.GetBodyA();
var _local3:b2Body = _arg1.GetBodyB();
var _local4:b2Transform = _local2.m_xf;
var _local5:b2Transform = _local3.m_xf;
var _local6:b2Vec2 = _local4.position;
var _local7:b2Vec2 = _local5.position;
var _local8:b2Vec2 = _arg1.GetAnchorA();
var _local9:b2Vec2 = _arg1.GetAnchorB();
var _local10:b2Color = s_jointColor;
switch (_arg1.m_type){
case b2Joint.e_distanceJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
case b2Joint.e_pulleyJoint:
_local11 = (_arg1 as b2PulleyJoint);
_local12 = _local11.GetGroundAnchorA();
_local13 = _local11.GetGroundAnchorB();
m_debugDraw.DrawSegment(_local12, _local8, _local10);
m_debugDraw.DrawSegment(_local13, _local9, _local10);
m_debugDraw.DrawSegment(_local12, _local13, _local10);
break;
case b2Joint.e_mouseJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
default:
if (_local2 != m_groundBody){
m_debugDraw.DrawSegment(_local6, _local8, _local10);
};
m_debugDraw.DrawSegment(_local8, _local9, _local10);
if (_local3 != m_groundBody){
m_debugDraw.DrawSegment(_local7, _local9, _local10);
};
};
}
b2internal function DrawShape(_arg1:b2Shape, _arg2:b2Transform, _arg3:b2Color):void{
var _local4:b2CircleShape;
var _local5:b2Vec2;
var _local6:Number;
var _local7:b2Vec2;
var _local8:int;
var _local9:b2PolygonShape;
var _local10:int;
var _local11:Array;
var _local12:Array;
var _local13:b2EdgeShape;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local4 = (_arg1 as b2CircleShape);
_local5 = b2Math.MulX(_arg2, _local4.m_p);
_local6 = _local4.m_radius;
_local7 = _arg2.R.col1;
m_debugDraw.DrawSolidCircle(_local5, _local6, _local7, _arg3);
break;
case b2Shape.e_polygonShape:
_local9 = (_arg1 as b2PolygonShape);
_local10 = _local9.GetVertexCount();
_local11 = _local9.GetVertices();
_local12 = new Array(_local10);
_local8 = 0;
while (_local8 < _local10) {
_local12[_local8] = b2Math.MulX(_arg2, _local11[_local8]);
_local8++;
};
m_debugDraw.DrawSolidPolygon(_local12, _local10, _arg3);
break;
case b2Shape.e_edgeShape:
_local13 = (_arg1 as b2EdgeShape);
m_debugDraw.DrawSegment(b2Math.MulX(_arg2, _local13.GetVertex1()), b2Math.MulX(_arg2, _local13.GetVertex2()), _arg3);
break;
};
}
}
}//package Box2D.Dynamics
Section 102
//PropTween (com.greensock.core.PropTween)
package com.greensock.core {
public class PropTween {
public var target:Object;
public var property:String;
public var start:Number;
public var change:Number;
public var name:String;
public var priority:int;
public var isPlugin:Boolean;
public var nextNode:PropTween;
public var prevNode:PropTween;
public function PropTween(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Boolean, _arg7:PropTween=null, _arg8:int=0){
this.target = _arg1;
this.property = _arg2;
this.start = _arg3;
this.change = _arg4;
this.name = _arg5;
this.isPlugin = _arg6;
if (_arg7){
_arg7.prevNode = this;
this.nextNode = _arg7;
};
this.priority = _arg8;
}
}
}//package com.greensock.core
Section 103
//SimpleTimeline (com.greensock.core.SimpleTimeline)
package com.greensock.core {
public class SimpleTimeline extends TweenCore {
protected var _firstChild:TweenCore;
protected var _lastChild:TweenCore;
public var autoRemoveChildren:Boolean;
public function SimpleTimeline(_arg1:Object=null){
super(0, _arg1);
}
public function addChild(_arg1:TweenCore):void{
if (((!(_arg1.cachedOrphan)) && (_arg1.timeline))){
_arg1.timeline.remove(_arg1, true);
};
_arg1.timeline = this;
if (_arg1.gc){
_arg1.setEnabled(true, true);
};
if (_firstChild){
_firstChild.prevNode = _arg1;
};
_arg1.nextNode = _firstChild;
_firstChild = _arg1;
_arg1.prevNode = null;
_arg1.cachedOrphan = false;
}
public function remove(_arg1:TweenCore, _arg2:Boolean=false):void{
if (_arg1.cachedOrphan){
return;
};
if (!_arg2){
_arg1.setEnabled(false, true);
};
if (_arg1.nextNode){
_arg1.nextNode.prevNode = _arg1.prevNode;
} else {
if (_lastChild == _arg1){
_lastChild = _arg1.prevNode;
};
};
if (_arg1.prevNode){
_arg1.prevNode.nextNode = _arg1.nextNode;
} else {
if (_firstChild == _arg1){
_firstChild = _arg1.nextNode;
};
};
_arg1.cachedOrphan = true;
}
override public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
var _local5:Number;
var _local6:TweenCore;
var _local4:TweenCore = _firstChild;
this.cachedTotalTime = _arg1;
this.cachedTime = _arg1;
while (_local4) {
_local6 = _local4.nextNode;
if (((_local4.active) || ((((((_arg1 >= _local4.cachedStartTime)) && (!(_local4.cachedPaused)))) && (!(_local4.gc)))))){
if (!_local4.cachedReversed){
_local4.renderTime(((_arg1 - _local4.cachedStartTime) * _local4.cachedTimeScale), _arg2, false);
} else {
_local5 = (_local4.cacheIsDirty) ? _local4.totalDuration : _local4.cachedTotalDuration;
_local4.renderTime((_local5 - ((_arg1 - _local4.cachedStartTime) * _local4.cachedTimeScale)), _arg2, false);
};
};
_local4 = _local6;
};
}
public function get rawTime():Number{
return (this.cachedTotalTime);
}
}
}//package com.greensock.core
Section 104
//TweenCore (com.greensock.core.TweenCore)
package com.greensock.core {
import com.greensock.*;
public class TweenCore {
protected var _delay:Number;
protected var _hasUpdate:Boolean;
protected var _rawPrevTime:Number;// = -1
protected var _pauseTime:Number;
public var vars:Object;
public var active:Boolean;
public var gc:Boolean;
public var initted:Boolean;
public var timeline:SimpleTimeline;
public var cachedStartTime:Number;
public var cachedTime:Number;
public var cachedTotalTime:Number;
public var cachedDuration:Number;
public var cachedTotalDuration:Number;
public var cachedTimeScale:Number;
public var cachedReversed:Boolean;
public var nextNode:TweenCore;
public var prevNode:TweenCore;
public var cachedOrphan:Boolean;
public var cacheIsDirty:Boolean;
public var cachedPaused:Boolean;
public var data;
public static const version:Number = 1.382;
protected static var _classInitted:Boolean;
public function TweenCore(_arg1:Number=0, _arg2:Object=null){
this.vars = ((_arg2)!=null) ? _arg2 : {};
this.cachedDuration = (this.cachedTotalDuration = _arg1);
_delay = (this.vars.delay) ? Number(this.vars.delay) : 0;
this.cachedTimeScale = (this.vars.timeScale) ? Number(this.vars.timeScale) : 1;
this.active = Boolean((((((_arg1 == 0)) && ((_delay == 0)))) && (!((this.vars.immediateRender == false)))));
this.cachedTotalTime = (this.cachedTime = 0);
this.data = this.vars.data;
if (!_classInitted){
if (isNaN(TweenLite.rootFrame)){
TweenLite.initClass();
_classInitted = true;
} else {
return;
};
};
var _local3:SimpleTimeline = ((this.vars.timeline is SimpleTimeline)) ? this.vars.timeline : (this.vars.useFrames) ? TweenLite.rootFramesTimeline : TweenLite.rootTimeline;
this.cachedStartTime = (_local3.cachedTotalTime + _delay);
_local3.addChild(this);
if (this.vars.reversed){
this.cachedReversed = true;
};
if (this.vars.paused){
this.paused = true;
};
}
public function play():void{
this.reversed = false;
this.paused = false;
}
public function pause():void{
this.paused = true;
}
public function resume():void{
this.paused = false;
}
public function restart(_arg1:Boolean=false, _arg2:Boolean=true):void{
this.reversed = false;
this.paused = false;
this.setTotalTime((_arg1) ? -(_delay) : 0, _arg2);
}
public function reverse(_arg1:Boolean=true):void{
this.reversed = true;
if (_arg1){
this.paused = false;
} else {
if (this.gc){
this.setEnabled(true, false);
};
};
}
public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
}
public function complete(_arg1:Boolean=false, _arg2:Boolean=false):void{
if (!_arg1){
renderTime(this.totalDuration, _arg2, false);
return;
};
if (this.timeline.autoRemoveChildren){
this.setEnabled(false, false);
} else {
this.active = false;
};
if (!_arg2){
if (((((this.vars.onComplete) && ((this.cachedTotalTime == this.cachedTotalDuration)))) && (!(this.cachedReversed)))){
this.vars.onComplete.apply(null, this.vars.onCompleteParams);
} else {
if (((((this.cachedReversed) && ((this.cachedTotalTime == 0)))) && (this.vars.onReverseComplete))){
this.vars.onReverseComplete.apply(null, this.vars.onReverseCompleteParams);
};
};
};
}
public function invalidate():void{
}
public function setEnabled(_arg1:Boolean, _arg2:Boolean=false):Boolean{
this.gc = !(_arg1);
if (_arg1){
this.active = Boolean(((((!(this.cachedPaused)) && ((this.cachedTotalTime > 0)))) && ((this.cachedTotalTime < this.cachedTotalDuration))));
if (((!(_arg2)) && (this.cachedOrphan))){
this.timeline.addChild(this);
};
} else {
this.active = false;
if (((!(_arg2)) && (!(this.cachedOrphan)))){
this.timeline.remove(this, true);
};
};
return (false);
}
public function kill():void{
setEnabled(false, false);
}
protected function setDirtyCache(_arg1:Boolean=true):void{
var _local2:TweenCore = (_arg1) ? this : this.timeline;
while (_local2) {
_local2.cacheIsDirty = true;
_local2 = _local2.timeline;
};
}
protected function setTotalTime(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
var _local4:Number;
if (this.timeline){
_local3 = (((_pauseTime) || ((_pauseTime == 0)))) ? _pauseTime : this.timeline.cachedTotalTime;
if (this.cachedReversed){
_local4 = (this.cacheIsDirty) ? this.totalDuration : this.cachedTotalDuration;
this.cachedStartTime = (_local3 - ((_local4 - _arg1) / this.cachedTimeScale));
} else {
this.cachedStartTime = (_local3 - (_arg1 / this.cachedTimeScale));
};
if (!this.timeline.cacheIsDirty){
setDirtyCache(false);
};
if (this.cachedTotalTime != _arg1){
renderTime(_arg1, _arg2, false);
};
};
}
public function get delay():Number{
return (_delay);
}
public function set delay(_arg1:Number):void{
this.startTime = (this.startTime + (_arg1 - _delay));
_delay = _arg1;
}
public function get duration():Number{
return (this.cachedDuration);
}
public function set duration(_arg1:Number):void{
this.cachedDuration = (this.cachedTotalDuration = _arg1);
setDirtyCache(false);
}
public function get totalDuration():Number{
return (this.cachedTotalDuration);
}
public function set totalDuration(_arg1:Number):void{
this.duration = _arg1;
}
public function get currentTime():Number{
return (this.cachedTime);
}
public function set currentTime(_arg1:Number):void{
setTotalTime(_arg1, false);
}
public function get totalTime():Number{
return (this.cachedTotalTime);
}
public function set totalTime(_arg1:Number):void{
setTotalTime(_arg1, false);
}
public function get startTime():Number{
return (this.cachedStartTime);
}
public function set startTime(_arg1:Number):void{
var _local2:Boolean = Boolean(((!((this.timeline == null))) && (((!((_arg1 == this.cachedStartTime))) || (this.gc)))));
this.cachedStartTime = _arg1;
if (_local2){
this.timeline.addChild(this);
};
}
public function get reversed():Boolean{
return (this.cachedReversed);
}
public function set reversed(_arg1:Boolean):void{
if (_arg1 != this.cachedReversed){
this.cachedReversed = _arg1;
setTotalTime(this.cachedTotalTime, true);
};
}
public function get paused():Boolean{
return (this.cachedPaused);
}
public function set paused(_arg1:Boolean):void{
if (((!((_arg1 == this.cachedPaused))) && (this.timeline))){
if (_arg1){
_pauseTime = this.timeline.rawTime;
} else {
this.cachedStartTime = (this.cachedStartTime + (this.timeline.rawTime - _pauseTime));
_pauseTime = NaN;
setDirtyCache(false);
};
this.cachedPaused = _arg1;
this.active = Boolean(((((!(this.cachedPaused)) && ((this.cachedTotalTime > 0)))) && ((this.cachedTotalTime < this.cachedTotalDuration))));
};
if (((!(_arg1)) && (this.gc))){
this.setTotalTime(this.cachedTotalTime, false);
this.setEnabled(true, false);
};
}
}
}//package com.greensock.core
Section 105
//TweenEvent (com.greensock.events.TweenEvent)
package com.greensock.events {
import flash.events.*;
public class TweenEvent extends Event {
public static const VERSION:Number = 1.1;
public static const START:String = "start";
public static const UPDATE:String = "change";
public static const COMPLETE:String = "complete";
public static const REVERSE_COMPLETE:String = "reverseComplete";
public static const REPEAT:String = "repeat";
public static const INIT:String = "init";
public function TweenEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function clone():Event{
return (new TweenEvent(this.type, this.bubbles, this.cancelable));
}
}
}//package com.greensock.events
Section 106
//AutoAlphaPlugin (com.greensock.plugins.AutoAlphaPlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
public class AutoAlphaPlugin extends TweenPlugin {
protected var _target:Object;
protected var _ignoreVisible:Boolean;
public static const API:Number = 1;
public function AutoAlphaPlugin(){
this.propName = "autoAlpha";
this.overwriteProps = ["alpha", "visible"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
addTween(_arg1, "alpha", _arg1.alpha, _arg2, "alpha");
return (true);
}
override public function killProps(_arg1:Object):void{
super.killProps(_arg1);
_ignoreVisible = Boolean(("visible" in _arg1));
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
if (!_ignoreVisible){
_target.visible = Boolean(!((_target.alpha == 0)));
};
}
}
}//package com.greensock.plugins
Section 107
//BevelFilterPlugin (com.greensock.plugins.BevelFilterPlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
import flash.filters.*;
public class BevelFilterPlugin extends FilterPlugin {
public static const API:Number = 1;
private static var _propNames:Array = ["distance", "angle", "highlightColor", "highlightAlpha", "shadowColor", "shadowAlpha", "blurX", "blurY", "strength", "quality"];
public function BevelFilterPlugin(){
this.propName = "bevelFilter";
this.overwriteProps = ["bevelFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = BevelFilter;
initFilter(_arg2, new BevelFilter(0, 0, 0xFFFFFF, 0.5, 0, 0.5, 2, 2, 0, ((_arg2.quality) || (2))), _propNames);
return (true);
}
}
}//package com.greensock.plugins
Section 108
//BezierPlugin (com.greensock.plugins.BezierPlugin)
package com.greensock.plugins {
import com.greensock.*;
public class BezierPlugin extends TweenPlugin {
protected var _target:Object;
protected var _orientData:Array;
protected var _orient:Boolean;
protected var _future:Object;
protected var _beziers:Object;
public static const API:Number = 1;
protected static const _RAD2DEG:Number = 57.2957795130823;
public function BezierPlugin(){
_future = {};
super();
this.propName = "bezier";
this.overwriteProps = [];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (!(_arg2 is Array)){
return (false);
};
init(_arg3, (_arg2 as Array), false);
return (true);
}
protected function init(_arg1:TweenLite, _arg2:Array, _arg3:Boolean):void{
var _local6:int;
var _local7:String;
var _local8:Object;
_target = _arg1.target;
var _local4:Object = ((_arg1.vars.isTV)==true) ? _arg1.vars.exposedVars : _arg1.vars;
if (_local4.orientToBezier == true){
_orientData = [["x", "y", "rotation", 0, 0.01]];
_orient = true;
} else {
if ((_local4.orientToBezier is Array)){
_orientData = _local4.orientToBezier;
_orient = true;
};
};
var _local5:Object = {};
_local6 = 0;
while (_local6 < _arg2.length) {
for (_local7 in _arg2[_local6]) {
if (_local5[_local7] == undefined){
_local5[_local7] = [_arg1.target[_local7]];
};
if (typeof(_arg2[_local6][_local7]) == "number"){
_local5[_local7].push(_arg2[_local6][_local7]);
} else {
_local5[_local7].push((_arg1.target[_local7] + Number(_arg2[_local6][_local7])));
};
};
_local6++;
};
for (_local7 in _local5) {
this.overwriteProps[this.overwriteProps.length] = _local7;
if (_local4[_local7] != undefined){
if (typeof(_local4[_local7]) == "number"){
_local5[_local7].push(_local4[_local7]);
} else {
_local5[_local7].push((_arg1.target[_local7] + Number(_local4[_local7])));
};
_local8 = {};
_local8[_local7] = true;
_arg1.killVars(_local8, false);
delete _local4[_local7];
};
};
_beziers = parseBeziers(_local5, _arg3);
}
override public function killProps(_arg1:Object):void{
var _local2:String;
for (_local2 in _beziers) {
if ((_local2 in _arg1)){
delete _beziers[_local2];
};
};
super.killProps(_arg1);
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:String;
var _local4:Object;
var _local5:Number;
var _local6:uint;
var _local7:Number;
var _local8:Object;
var _local9:Number;
var _local10:Number;
var _local11:Array;
var _local12:Number;
var _local13:Object;
var _local14:Boolean;
_changeFactor = _arg1;
if (_arg1 == 1){
for (_local3 in _beziers) {
_local2 = (_beziers[_local3].length - 1);
_target[_local3] = _beziers[_local3][_local2][2];
};
} else {
for (_local3 in _beziers) {
_local6 = _beziers[_local3].length;
if (_arg1 < 0){
_local2 = 0;
} else {
if (_arg1 >= 1){
_local2 = (_local6 - 1);
} else {
_local2 = int((_local6 * _arg1));
};
};
_local5 = ((_arg1 - (_local2 * (1 / _local6))) * _local6);
_local4 = _beziers[_local3][_local2];
if (this.round){
_local7 = (_local4[0] + (_local5 * (((2 * (1 - _local5)) * (_local4[1] - _local4[0])) + (_local5 * (_local4[2] - _local4[0])))));
_target[_local3] = ((_local7)>0) ? int((_local7 + 0.5)) : int((_local7 - 0.5));
} else {
_target[_local3] = (_local4[0] + (_local5 * (((2 * (1 - _local5)) * (_local4[1] - _local4[0])) + (_local5 * (_local4[2] - _local4[0])))));
};
};
};
if (_orient){
_local2 = _orientData.length;
_local8 = {};
while (_local2--) {
_local11 = _orientData[_local2];
_local8[_local11[0]] = _target[_local11[0]];
_local8[_local11[1]] = _target[_local11[1]];
};
_local13 = _target;
_local14 = this.round;
_target = _future;
this.round = false;
_orient = false;
_local2 = _orientData.length;
while (_local2--) {
_local11 = _orientData[_local2];
this.changeFactor = (_arg1 + ((_local11[4]) || (0.01)));
_local12 = ((_local11[3]) || (0));
_local9 = (_future[_local11[0]] - _local8[_local11[0]]);
_local10 = (_future[_local11[1]] - _local8[_local11[1]]);
_local13[_local11[2]] = ((Math.atan2(_local10, _local9) * _RAD2DEG) + _local12);
};
_target = _local13;
this.round = _local14;
_orient = true;
};
}
public static function parseBeziers(_arg1:Object, _arg2:Boolean=false):Object{
var _local3:int;
var _local4:Array;
var _local5:Object;
var _local6:String;
var _local7:Object = {};
if (_arg2){
for (_local6 in _arg1) {
_local4 = _arg1[_local6];
_local5 = [];
_local7[_local6] = _local5;
if (_local4.length > 2){
_local5[_local5.length] = [_local4[0], (_local4[1] - ((_local4[2] - _local4[0]) / 4)), _local4[1]];
_local3 = 1;
while (_local3 < (_local4.length - 1)) {
_local5[_local5.length] = [_local4[_local3], (_local4[_local3] + (_local4[_local3] - _local5[(_local3 - 1)][1])), _local4[(_local3 + 1)]];
_local3++;
};
} else {
_local5[_local5.length] = [_local4[0], ((_local4[0] + _local4[1]) / 2), _local4[1]];
};
};
} else {
for (_local6 in _arg1) {
_local4 = _arg1[_local6];
_local5 = [];
_local7[_local6] = _local5;
if (_local4.length > 3){
_local5[_local5.length] = [_local4[0], _local4[1], ((_local4[1] + _local4[2]) / 2)];
_local3 = 2;
while (_local3 < (_local4.length - 2)) {
_local5[_local5.length] = [_local5[(_local3 - 2)][2], _local4[_local3], ((_local4[_local3] + _local4[(_local3 + 1)]) / 2)];
_local3++;
};
_local5[_local5.length] = [_local5[(_local5.length - 1)][2], _local4[(_local4.length - 2)], _local4[(_local4.length - 1)]];
} else {
if (_local4.length == 3){
_local5[_local5.length] = [_local4[0], _local4[1], _local4[2]];
} else {
if (_local4.length == 2){
_local5[_local5.length] = [_local4[0], ((_local4[0] + _local4[1]) / 2), _local4[1]];
};
};
};
};
};
return (_local7);
}
}
}//package com.greensock.plugins
Section 109
//BezierThroughPlugin (com.greensock.plugins.BezierThroughPlugin)
package com.greensock.plugins {
import com.greensock.*;
public class BezierThroughPlugin extends BezierPlugin {
public static const API:Number = 1;
public function BezierThroughPlugin(){
this.propName = "bezierThrough";
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (!(_arg2 is Array)){
return (false);
};
init(_arg3, (_arg2 as Array), true);
return (true);
}
}
}//package com.greensock.plugins
Section 110
//BlurFilterPlugin (com.greensock.plugins.BlurFilterPlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
import flash.filters.*;
public class BlurFilterPlugin extends FilterPlugin {
public static const API:Number = 1;
private static var _propNames:Array = ["blurX", "blurY", "quality"];
public function BlurFilterPlugin(){
this.propName = "blurFilter";
this.overwriteProps = ["blurFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = BlurFilter;
initFilter(_arg2, new BlurFilter(0, 0, ((_arg2.quality) || (2))), _propNames);
return (true);
}
}
}//package com.greensock.plugins
Section 111
//ColorMatrixFilterPlugin (com.greensock.plugins.ColorMatrixFilterPlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
import flash.filters.*;
public class ColorMatrixFilterPlugin extends FilterPlugin {
protected var _matrix:Array;
protected var _matrixTween:EndArrayPlugin;
public static const API:Number = 1;
private static var _propNames:Array = [];
protected static var _idMatrix:Array = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0];
protected static var _lumR:Number = 0.212671;
protected static var _lumG:Number = 0.71516;
protected static var _lumB:Number = 0.072169;
public function ColorMatrixFilterPlugin(){
this.propName = "colorMatrixFilter";
this.overwriteProps = ["colorMatrixFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = ColorMatrixFilter;
var _local4:Object = _arg2;
initFilter({remove:_arg2.remove, index:_arg2.index, addFilter:_arg2.addFilter}, new ColorMatrixFilter(_idMatrix.slice()), _propNames);
_matrix = ColorMatrixFilter(_filter).matrix;
var _local5:Array = [];
if (((!((_local4.matrix == null))) && ((_local4.matrix is Array)))){
_local5 = _local4.matrix;
} else {
if (_local4.relative == true){
_local5 = _matrix.slice();
} else {
_local5 = _idMatrix.slice();
};
_local5 = setBrightness(_local5, _local4.brightness);
_local5 = setContrast(_local5, _local4.contrast);
_local5 = setHue(_local5, _local4.hue);
_local5 = setSaturation(_local5, _local4.saturation);
_local5 = setThreshold(_local5, _local4.threshold);
if (!isNaN(_local4.colorize)){
_local5 = colorize(_local5, _local4.colorize, _local4.amount);
};
};
_matrixTween = new EndArrayPlugin();
_matrixTween.init(_matrix, _local5);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
_matrixTween.changeFactor = _arg1;
ColorMatrixFilter(_filter).matrix = _matrix;
super.changeFactor = _arg1;
}
public static function colorize(_arg1:Array, _arg2:Number, _arg3:Number=1):Array{
if (isNaN(_arg2)){
return (_arg1);
};
if (isNaN(_arg3)){
_arg3 = 1;
};
var _local4:Number = (((_arg2 >> 16) & 0xFF) / 0xFF);
var _local5:Number = (((_arg2 >> 8) & 0xFF) / 0xFF);
var _local6:Number = ((_arg2 & 0xFF) / 0xFF);
var _local7:Number = (1 - _arg3);
var _local8:Array = [(_local7 + ((_arg3 * _local4) * _lumR)), ((_arg3 * _local4) * _lumG), ((_arg3 * _local4) * _lumB), 0, 0, ((_arg3 * _local5) * _lumR), (_local7 + ((_arg3 * _local5) * _lumG)), ((_arg3 * _local5) * _lumB), 0, 0, ((_arg3 * _local6) * _lumR), ((_arg3 * _local6) * _lumG), (_local7 + ((_arg3 * _local6) * _lumB)), 0, 0, 0, 0, 0, 1, 0];
return (applyMatrix(_local8, _arg1));
}
public static function setThreshold(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
var _local3:Array = [(_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), (_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), (_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), 0, 0, 0, 1, 0];
return (applyMatrix(_local3, _arg1));
}
public static function setHue(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = (_arg2 * (Math.PI / 180));
var _local3:Number = Math.cos(_arg2);
var _local4:Number = Math.sin(_arg2);
var _local5:Array = [((_lumR + (_local3 * (1 - _lumR))) + (_local4 * -(_lumR))), ((_lumG + (_local3 * -(_lumG))) + (_local4 * -(_lumG))), ((_lumB + (_local3 * -(_lumB))) + (_local4 * (1 - _lumB))), 0, 0, ((_lumR + (_local3 * -(_lumR))) + (_local4 * 0.143)), ((_lumG + (_local3 * (1 - _lumG))) + (_local4 * 0.14)), ((_lumB + (_local3 * -(_lumB))) + (_local4 * -0.283)), 0, 0, ((_lumR + (_local3 * -(_lumR))) + (_local4 * -((1 - _lumR)))), ((_lumG + (_local3 * -(_lumG))) + (_local4 * _lumG)), ((_lumB + (_local3 * (1 - _lumB))) + (_local4 * _lumB)), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];
return (applyMatrix(_local5, _arg1));
}
public static function setBrightness(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = ((_arg2 * 100) - 100);
return (applyMatrix([1, 0, 0, 0, _arg2, 0, 1, 0, 0, _arg2, 0, 0, 1, 0, _arg2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], _arg1));
}
public static function setSaturation(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
var _local3:Number = (1 - _arg2);
var _local4:Number = (_local3 * _lumR);
var _local5:Number = (_local3 * _lumG);
var _local6:Number = (_local3 * _lumB);
var _local7:Array = [(_local4 + _arg2), _local5, _local6, 0, 0, _local4, (_local5 + _arg2), _local6, 0, 0, _local4, _local5, (_local6 + _arg2), 0, 0, 0, 0, 0, 1, 0];
return (applyMatrix(_local7, _arg1));
}
public static function setContrast(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = (_arg2 + 0.01);
var _local3:Array = [_arg2, 0, 0, 0, (128 * (1 - _arg2)), 0, _arg2, 0, 0, (128 * (1 - _arg2)), 0, 0, _arg2, 0, (128 * (1 - _arg2)), 0, 0, 0, 1, 0];
return (applyMatrix(_local3, _arg1));
}
public static function applyMatrix(_arg1:Array, _arg2:Array):Array{
var _local6:int;
var _local7:int;
if (((!((_arg1 is Array))) || (!((_arg2 is Array))))){
return (_arg2);
};
var _local3:Array = [];
var _local4:int;
var _local5:int;
_local6 = 0;
while (_local6 < 4) {
_local7 = 0;
while (_local7 < 5) {
if (_local7 == 4){
_local5 = _arg1[(_local4 + 4)];
} else {
_local5 = 0;
};
_local3[(_local4 + _local7)] = (((((_arg1[_local4] * _arg2[_local7]) + (_arg1[(_local4 + 1)] * _arg2[(_local7 + 5)])) + (_arg1[(_local4 + 2)] * _arg2[(_local7 + 10)])) + (_arg1[(_local4 + 3)] * _arg2[(_local7 + 15)])) + _local5);
_local7++;
};
_local4 = (_local4 + 5);
_local6++;
};
return (_local3);
}
}
}//package com.greensock.plugins
Section 112
//ColorTransformPlugin (com.greensock.plugins.ColorTransformPlugin)
package com.greensock.plugins {
import flash.display.*;
import flash.geom.*;
import com.greensock.*;
public class ColorTransformPlugin extends TintPlugin {
public static const API:Number = 1;
public function ColorTransformPlugin(){
this.propName = "colorTransform";
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
var _local5:String;
var _local6:Number;
if (!(_arg1 is DisplayObject)){
return (false);
};
var _local4:ColorTransform = _arg1.transform.colorTransform;
for (_local5 in _arg2) {
if ((((_local5 == "tint")) || ((_local5 == "color")))){
if (_arg2[_local5] != null){
_local4.color = int(_arg2[_local5]);
};
} else {
if ((((((_local5 == "tintAmount")) || ((_local5 == "exposure")))) || ((_local5 == "brightness")))){
} else {
_local4[_local5] = _arg2[_local5];
};
};
};
if (!isNaN(_arg2.tintAmount)){
_local6 = (_arg2.tintAmount / (1 - (((_local4.redMultiplier + _local4.greenMultiplier) + _local4.blueMultiplier) / 3)));
_local4.redOffset = (_local4.redOffset * _local6);
_local4.greenOffset = (_local4.greenOffset * _local6);
_local4.blueOffset = (_local4.blueOffset * _local6);
_local4.redMultiplier = (_local4.greenMultiplier = (_local4.blueMultiplier = (1 - _arg2.tintAmount)));
} else {
if (!isNaN(_arg2.exposure)){
_local4.redOffset = (_local4.greenOffset = (_local4.blueOffset = (0xFF * (_arg2.exposure - 1))));
_local4.redMultiplier = (_local4.greenMultiplier = (_local4.blueMultiplier = 1));
} else {
if (!isNaN(_arg2.brightness)){
_local4.redOffset = (_local4.greenOffset = (_local4.blueOffset = Math.max(0, ((_arg2.brightness - 1) * 0xFF))));
_local4.redMultiplier = (_local4.greenMultiplier = (_local4.blueMultiplier = (1 - Math.abs((_arg2.brightness - 1)))));
};
};
};
_ignoreAlpha = Boolean(((!((_arg3.vars.alpha == undefined))) && ((_arg2.alphaMultiplier == undefined))));
init((_arg1 as DisplayObject), _local4);
return (true);
}
}
}//package com.greensock.plugins
Section 113
//DropShadowFilterPlugin (com.greensock.plugins.DropShadowFilterPlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
import flash.filters.*;
public class DropShadowFilterPlugin extends FilterPlugin {
public static const API:Number = 1;
private static var _propNames:Array = ["distance", "angle", "color", "alpha", "blurX", "blurY", "strength", "quality", "inner", "knockout", "hideObject"];
public function DropShadowFilterPlugin(){
this.propName = "dropShadowFilter";
this.overwriteProps = ["dropShadowFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = DropShadowFilter;
initFilter(_arg2, new DropShadowFilter(0, 45, 0, 0, 0, 0, 1, ((_arg2.quality) || (2)), _arg2.inner, _arg2.knockout, _arg2.hideObject), _propNames);
return (true);
}
}
}//package com.greensock.plugins
Section 114
//EndArrayPlugin (com.greensock.plugins.EndArrayPlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
public class EndArrayPlugin extends TweenPlugin {
protected var _a:Array;
protected var _info:Array;
public static const API:Number = 1;
public function EndArrayPlugin(){
_info = [];
super();
this.propName = "endArray";
this.overwriteProps = ["endArray"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((!((_arg1 is Array))) || (!((_arg2 is Array))))){
return (false);
};
init((_arg1 as Array), _arg2);
return (true);
}
public function init(_arg1:Array, _arg2:Array):void{
_a = _arg1;
var _local3:int = _arg2.length;
while (_local3--) {
if (((!((_arg1[_local3] == _arg2[_local3]))) && (!((_arg1[_local3] == null))))){
_info[_info.length] = new ArrayTweenInfo(_local3, _a[_local3], (_arg2[_local3] - _a[_local3]));
};
};
}
override public function set changeFactor(_arg1:Number):void{
var _local3:ArrayTweenInfo;
var _local4:Number;
var _local2:int = _info.length;
if (this.round){
while (_local2--) {
_local3 = _info[_local2];
_local4 = (_local3.start + (_local3.change * _arg1));
_a[_local3.index] = ((_local4)>0) ? int((_local4 + 0.5)) : int((_local4 - 0.5));
};
} else {
while (_local2--) {
_local3 = _info[_local2];
_a[_local3.index] = (_local3.start + (_local3.change * _arg1));
};
};
}
}
}//package com.greensock.plugins
class ArrayTweenInfo {
public var index:uint;
public var start:Number;
public var change:Number;
private function ArrayTweenInfo(_arg1:uint, _arg2:Number, _arg3:Number){
this.index = _arg1;
this.start = _arg2;
this.change = _arg3;
}
}
Section 115
//FilterPlugin (com.greensock.plugins.FilterPlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.core.*;
import com.greensock.*;
import flash.filters.*;
public class FilterPlugin extends TweenPlugin {
protected var _target:Object;
protected var _type:Class;
protected var _filter:BitmapFilter;
protected var _index:int;
protected var _remove:Boolean;
public static const VERSION:Number = 2.03;
public static const API:Number = 1;
protected function initFilter(_arg1:Object, _arg2:BitmapFilter, _arg3:Array):void{
var _local5:String;
var _local6:int;
var _local7:HexColorsPlugin;
var _local4:Array = _target.filters;
var _local8:Object = ((_arg1 is BitmapFilter)) ? {} : _arg1;
_index = -1;
if (_local8.index != null){
_index = _local8.index;
} else {
_local6 = _local4.length;
while (_local6--) {
if ((_local4[_local6] is _type)){
_index = _local6;
break;
};
};
};
if ((((((_index == -1)) || ((_local4[_index] == null)))) || ((_local8.addFilter == true)))){
_index = ((_local8.index)!=null) ? _local8.index : _local4.length;
_local4[_index] = _arg2;
_target.filters = _local4;
};
_filter = _local4[_index];
if (_local8.remove == true){
_remove = true;
this.onComplete = onCompleteTween;
};
_local6 = _arg3.length;
while (_local6--) {
_local5 = _arg3[_local6];
if ((((_local5 in _arg1)) && (!((_filter[_local5] == _arg1[_local5]))))){
if ((((((_local5 == "color")) || ((_local5 == "highlightColor")))) || ((_local5 == "shadowColor")))){
_local7 = new HexColorsPlugin();
_local7.initColor(_filter, _local5, _filter[_local5], _arg1[_local5]);
_tweens[_tweens.length] = new PropTween(_local7, "changeFactor", 0, 1, _local5, false);
} else {
if ((((((((_local5 == "quality")) || ((_local5 == "inner")))) || ((_local5 == "knockout")))) || ((_local5 == "hideObject")))){
_filter[_local5] = _arg1[_local5];
} else {
addTween(_filter, _local5, _filter[_local5], _arg1[_local5], _local5);
};
};
};
};
}
public function onCompleteTween():void{
var _local1:Array;
var _local2:int;
if (_remove){
_local1 = _target.filters;
if (!(_local1[_index] is _type)){
_local2 = _local1.length;
while (_local2--) {
if ((_local1[_local2] is _type)){
_local1.splice(_local2, 1);
break;
};
};
} else {
_local1.splice(_index, 1);
};
_target.filters = _local1;
};
}
override public function set changeFactor(_arg1:Number):void{
var _local3:PropTween;
var _local2:int = _tweens.length;
var _local4:Array = _target.filters;
while (_local2--) {
_local3 = _tweens[_local2];
_local3.target[_local3.property] = (_local3.start + (_local3.change * _arg1));
};
if (!(_local4[_index] is _type)){
_local2 = (_index = _local4.length);
while (_local2--) {
if ((_local4[_local2] is _type)){
_index = _local2;
break;
};
};
};
_local4[_index] = _filter;
_target.filters = _local4;
}
}
}//package com.greensock.plugins
Section 116
//FrameLabelPlugin (com.greensock.plugins.FrameLabelPlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
public class FrameLabelPlugin extends FramePlugin {
public static const API:Number = 1;
public function FrameLabelPlugin(){
this.propName = "frameLabel";
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if ((!(_arg3.target) is MovieClip)){
return (false);
};
_target = (_arg1 as MovieClip);
this.frame = _target.currentFrame;
var _local4:Array = _target.currentLabels;
var _local5:String = _arg2;
var _local6:int = _target.currentFrame;
var _local7:int = _local4.length;
while (_local7--) {
if (_local4[_local7].name == _local5){
_local6 = _local4[_local7].frame;
break;
};
};
if (this.frame != _local6){
addTween(this, "frame", this.frame, _local6, "frame");
};
return (true);
}
}
}//package com.greensock.plugins
Section 117
//FramePlugin (com.greensock.plugins.FramePlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
public class FramePlugin extends TweenPlugin {
public var frame:int;
protected var _target:MovieClip;
public static const API:Number = 1;
public function FramePlugin(){
this.propName = "frame";
this.overwriteProps = ["frame", "frameLabel"];
this.round = true;
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((!((_arg1 is MovieClip))) || (isNaN(_arg2)))){
return (false);
};
_target = (_arg1 as MovieClip);
this.frame = _target.currentFrame;
addTween(this, "frame", this.frame, _arg2, "frame");
return (true);
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_target.gotoAndStop(this.frame);
}
}
}//package com.greensock.plugins
Section 118
//GlowFilterPlugin (com.greensock.plugins.GlowFilterPlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
import flash.filters.*;
public class GlowFilterPlugin extends FilterPlugin {
public static const API:Number = 1;
private static var _propNames:Array = ["color", "alpha", "blurX", "blurY", "strength", "quality", "inner", "knockout"];
public function GlowFilterPlugin(){
this.propName = "glowFilter";
this.overwriteProps = ["glowFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = GlowFilter;
initFilter(_arg2, new GlowFilter(0xFFFFFF, 0, 0, 0, ((_arg2.strength) || (1)), ((_arg2.quality) || (2)), _arg2.inner, _arg2.knockout), _propNames);
return (true);
}
}
}//package com.greensock.plugins
Section 119
//HexColorsPlugin (com.greensock.plugins.HexColorsPlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
public class HexColorsPlugin extends TweenPlugin {
protected var _colors:Array;
public static const API:Number = 1;
public function HexColorsPlugin(){
this.propName = "hexColors";
this.overwriteProps = [];
_colors = [];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
var _local4:String;
for (_local4 in _arg2) {
initColor(_arg1, _local4, uint(_arg1[_local4]), uint(_arg2[_local4]));
};
return (true);
}
public function initColor(_arg1:Object, _arg2:String, _arg3:uint, _arg4:uint):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (_arg3 != _arg4){
_local5 = (_arg3 >> 16);
_local6 = ((_arg3 >> 8) & 0xFF);
_local7 = (_arg3 & 0xFF);
_colors[_colors.length] = [_arg1, _arg2, _local5, ((_arg4 >> 16) - _local5), _local6, (((_arg4 >> 8) & 0xFF) - _local6), _local7, ((_arg4 & 0xFF) - _local7)];
this.overwriteProps[this.overwriteProps.length] = _arg2;
};
}
override public function killProps(_arg1:Object):void{
var _local2:int = (_colors.length - 1);
while (_local2 > -1) {
if (_arg1[_colors[_local2][1]] != undefined){
_colors.splice(_local2, 1);
};
_local2--;
};
super.killProps(_arg1);
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:Array;
_local2 = (_colors.length - 1);
while (_local2 > -1) {
_local3 = _colors[_local2];
_local3[0][_local3[1]] = ((((_local3[2] + (_arg1 * _local3[3])) << 16) | ((_local3[4] + (_arg1 * _local3[5])) << 8)) | (_local3[6] + (_arg1 * _local3[7])));
_local2--;
};
}
}
}//package com.greensock.plugins
Section 120
//RemoveTintPlugin (com.greensock.plugins.RemoveTintPlugin)
package com.greensock.plugins {
public class RemoveTintPlugin extends TintPlugin {
public static const API:Number = 1;
public function RemoveTintPlugin(){
this.propName = "removeTint";
}
}
}//package com.greensock.plugins
Section 121
//RoundPropsPlugin (com.greensock.plugins.RoundPropsPlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
public class RoundPropsPlugin extends TweenPlugin {
public static const API:Number = 1;
public function RoundPropsPlugin(){
this.propName = "roundProps";
this.overwriteProps = [];
this.round = true;
}
public function add(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number):void{
addTween(_arg1, _arg2, _arg3, (_arg3 + _arg4), _arg2);
this.overwriteProps[this.overwriteProps.length] = _arg2;
}
}
}//package com.greensock.plugins
Section 122
//ShortRotationPlugin (com.greensock.plugins.ShortRotationPlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
public class ShortRotationPlugin extends TweenPlugin {
public static const API:Number = 1;
public function ShortRotationPlugin(){
this.propName = "shortRotation";
this.overwriteProps = [];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
var _local4:String;
if (typeof(_arg2) == "number"){
return (false);
};
for (_local4 in _arg2) {
initRotation(_arg1, _local4, _arg1[_local4], ((typeof(_arg2[_local4]))=="number") ? Number(_arg2[_local4]) : (_arg1[_local4] + Number(_arg2[_local4])));
};
return (true);
}
public function initRotation(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number):void{
var _local5:Number = ((_arg4 - _arg3) % 360);
if (((_arg4 - _arg3) % 360) != (_local5 % 180)){
_local5 = ((_local5)<0) ? (_local5 + 360) : (_local5 - 360);
};
addTween(_arg1, _arg2, _arg3, (_arg3 + _local5), _arg2);
this.overwriteProps[this.overwriteProps.length] = _arg2;
}
}
}//package com.greensock.plugins
Section 123
//TintPlugin (com.greensock.plugins.TintPlugin)
package com.greensock.plugins {
import flash.display.*;
import flash.geom.*;
import com.greensock.core.*;
import com.greensock.*;
public class TintPlugin extends TweenPlugin {
protected var _transform:Transform;
protected var _ct:ColorTransform;
protected var _ignoreAlpha:Boolean;
public static const API:Number = 1;
protected static var _props:Array = ["redMultiplier", "greenMultiplier", "blueMultiplier", "alphaMultiplier", "redOffset", "greenOffset", "blueOffset", "alphaOffset"];
public function TintPlugin(){
this.propName = "tint";
this.overwriteProps = ["tint"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (!(_arg1 is DisplayObject)){
return (false);
};
var _local4:ColorTransform = new ColorTransform();
if (((!((_arg2 == null))) && (!((_arg3.vars.removeTint == true))))){
_local4.color = uint(_arg2);
};
_ignoreAlpha = true;
init((_arg1 as DisplayObject), _local4);
return (true);
}
public function init(_arg1:DisplayObject, _arg2:ColorTransform):void{
var _local4:String;
_transform = _arg1.transform;
_ct = _transform.colorTransform;
var _local3:int = _props.length;
while (_local3--) {
_local4 = _props[_local3];
if (_ct[_local4] != _arg2[_local4]){
_tweens[_tweens.length] = new PropTween(_ct, _local4, _ct[_local4], (_arg2[_local4] - _ct[_local4]), "tint", false);
};
};
}
override public function set changeFactor(_arg1:Number):void{
var _local2:ColorTransform;
updateTweens(_arg1);
if (_ignoreAlpha){
_local2 = _transform.colorTransform;
_ct.alphaMultiplier = _local2.alphaMultiplier;
_ct.alphaOffset = _local2.alphaOffset;
};
_transform.colorTransform = _ct;
}
}
}//package com.greensock.plugins
Section 124
//TweenPlugin (com.greensock.plugins.TweenPlugin)
package com.greensock.plugins {
import com.greensock.core.*;
import com.greensock.*;
public class TweenPlugin {
public var propName:String;
public var overwriteProps:Array;
public var round:Boolean;
public var priority:int;// = 0
public var activeDisable:Boolean;
public var onComplete:Function;
public var onEnable:Function;
public var onDisable:Function;
protected var _tweens:Array;
protected var _changeFactor:Number;// = 0
public static const VERSION:Number = 1.31;
public static const API:Number = 1;
public function TweenPlugin(){
_tweens = [];
super();
}
public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
addTween(_arg1, this.propName, _arg1[this.propName], _arg2, this.propName);
return (true);
}
protected function addTween(_arg1:Object, _arg2:String, _arg3:Number, _arg4, _arg5:String=null):void{
var _local6:Number;
if (_arg4 != null){
_local6 = ((typeof(_arg4))=="number") ? (Number(_arg4) - _arg3) : Number(_arg4);
if (_local6 != 0){
_tweens[_tweens.length] = new PropTween(_arg1, _arg2, _arg3, _local6, ((_arg5) || (_arg2)), false);
};
};
}
protected function updateTweens(_arg1:Number):void{
var _local3:PropTween;
var _local4:Number;
var _local2:int = _tweens.length;
if (this.round){
while (_local2--) {
_local3 = _tweens[_local2];
_local4 = (_local3.start + (_local3.change * _arg1));
_local3.target[_local3.property] = ((_local4)>0) ? int((_local4 + 0.5)) : int((_local4 - 0.5));
};
} else {
while (_local2--) {
_local3 = _tweens[_local2];
_local3.target[_local3.property] = (_local3.start + (_local3.change * _arg1));
};
};
}
public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_changeFactor = _arg1;
}
public function get changeFactor():Number{
return (_changeFactor);
}
public function killProps(_arg1:Object):void{
var _local2:int = this.overwriteProps.length;
while (_local2--) {
if ((this.overwriteProps[_local2] in _arg1)){
this.overwriteProps.splice(_local2, 1);
};
};
_local2 = _tweens.length;
while (_local2--) {
if ((PropTween(_tweens[_local2]).name in _arg1)){
_tweens.splice(_local2, 1);
};
};
}
private static function onTweenEvent(_arg1:String, _arg2:TweenLite):Boolean{
var _local4:Boolean;
var _local5:Array;
var _local6:int;
var _local3:PropTween = _arg2.cachedPT1;
if (_arg1 == "onInit"){
_local5 = [];
while (_local3) {
_local5[_local5.length] = _local3;
_local3 = _local3.nextNode;
};
_local5.sortOn("priority", (Array.NUMERIC | Array.DESCENDING));
_local6 = _local5.length;
while (_local6--) {
PropTween(_local5[_local6]).nextNode = _local5[(_local6 + 1)];
PropTween(_local5[_local6]).prevNode = _local5[(_local6 - 1)];
};
_arg2.cachedPT1 = _local5[0];
} else {
while (_local3) {
if (((_local3.isPlugin) && (_local3.target[_arg1]))){
if (_local3.target.activeDisable){
_local4 = true;
};
var _local7 = _local3.target;
_local7[_arg1]();
};
_local3 = _local3.nextNode;
};
};
return (_local4);
}
public static function activate(_arg1:Array):Boolean{
var _local3:Object;
TweenLite.onPluginEvent = TweenPlugin.onTweenEvent;
var _local2:int = _arg1.length;
while (_local2--) {
if (_arg1[_local2].hasOwnProperty("API")){
_local3 = new ((_arg1[_local2] as Class));
TweenLite.plugins[_local3.propName] = _arg1[_local2];
};
};
return (true);
}
}
}//package com.greensock.plugins
Section 125
//VisiblePlugin (com.greensock.plugins.VisiblePlugin)
package com.greensock.plugins {
import flash.display.*;
import com.greensock.*;
public class VisiblePlugin extends TweenPlugin {
protected var _target:Object;
protected var _tween:TweenLite;
protected var _visible:Boolean;
protected var _initVal:Boolean;
public static const API:Number = 1;
public function VisiblePlugin(){
this.propName = "visible";
this.overwriteProps = ["visible"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_tween = _arg3;
_initVal = _target.visible;
_visible = Boolean(_arg2);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
if ((((_arg1 == 1)) && ((((_tween.cachedDuration == _tween.cachedTime)) || ((_tween.cachedTime == 0)))))){
_target.visible = _visible;
} else {
_target.visible = _initVal;
};
}
}
}//package com.greensock.plugins
Section 126
//VolumePlugin (com.greensock.plugins.VolumePlugin)
package com.greensock.plugins {
import flash.display.*;
import flash.media.*;
import com.greensock.*;
public class VolumePlugin extends TweenPlugin {
protected var _target:Object;
protected var _st:SoundTransform;
public static const API:Number = 1;
public function VolumePlugin(){
this.propName = "volume";
this.overwriteProps = ["volume"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((isNaN(_arg2)) || (!(_arg1.hasOwnProperty("soundTransform"))))){
return (false);
};
_target = _arg1;
_st = _target.soundTransform;
addTween(_st, "volume", _st.volume, _arg2, "volume");
return (true);
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_target.soundTransform = _st;
}
}
}//package com.greensock.plugins
Section 127
//OverwriteManager (com.greensock.OverwriteManager)
package com.greensock {
import com.greensock.core.*;
public class OverwriteManager {
public static const version:Number = 6.03;
public static const NONE:int = 0;
public static const ALL_IMMEDIATE:int = 1;
public static const AUTO:int = 2;
public static const CONCURRENT:int = 3;
public static const ALL_ONSTART:int = 4;
public static const PREEXISTING:int = 5;
public static var mode:int;
public static var enabled:Boolean;
public static function init(_arg1:int=2):int{
if (TweenLite.version < 11.1){
throw (new Error("Warning: Your TweenLite class needs to be updated to work with OverwriteManager (or you may need to clear your ASO files). Please download and install the latest version from http://www.tweenlite.com."));
};
TweenLite.overwriteManager = OverwriteManager;
mode = _arg1;
enabled = true;
return (mode);
}
public static function manageOverwrites(_arg1:TweenLite, _arg2:Object, _arg3:Array, _arg4:uint):Boolean{
var _local5:int;
var _local6:Boolean;
var _local7:TweenLite;
var _local13:uint;
var _local14:Number;
var _local15:Number;
var _local16:TweenCore;
var _local17:Number;
var _local18:SimpleTimeline;
if (_arg4 >= 4){
_local13 = _arg3.length;
_local5 = 0;
while (_local5 < _local13) {
_local7 = _arg3[_local5];
if (_local7 != _arg1){
if (_local7.setEnabled(false, false)){
_local6 = true;
};
} else {
if (_arg4 == 5){
break;
};
};
_local5++;
};
return (_local6);
};
var _local8:Number = (_arg1.cachedStartTime + 1E-10);
var _local9:Array = [];
var _local10:Array = [];
var _local11:uint;
var _local12:uint;
_local5 = _arg3.length;
while (--_local5 > -1) {
_local7 = _arg3[_local5];
if ((((_local7 == _arg1)) || (_local7.gc))){
} else {
if (_local7.timeline != _arg1.timeline){
if (!getGlobalPaused(_local7)){
var _temp1 = _local11;
_local11 = (_local11 + 1);
var _local19 = _temp1;
_local10[_local19] = _local7;
};
} else {
if ((((((_local7.cachedStartTime <= _local8)) && ((((_local7.cachedStartTime + _local7.totalDuration) + 1E-10) > _local8)))) && (!(getGlobalPaused(_local7))))){
var _temp2 = _local12;
_local12 = (_local12 + 1);
_local19 = _temp2;
_local9[_local19] = _local7;
};
};
};
};
if (_local11 != 0){
_local14 = _arg1.cachedTimeScale;
_local15 = _local8;
_local18 = _arg1.timeline;
while (_local18) {
_local14 = (_local14 * _local18.cachedTimeScale);
_local15 = (_local15 + _local18.cachedStartTime);
_local18 = _local18.timeline;
};
_local8 = (_local14 * _local15);
_local5 = _local11;
while (--_local5 > -1) {
_local16 = _local10[_local5];
_local14 = _local16.cachedTimeScale;
_local15 = _local16.cachedStartTime;
_local18 = _local16.timeline;
while (_local18) {
_local14 = (_local14 * _local18.cachedTimeScale);
_local15 = (_local15 + _local18.cachedStartTime);
_local18 = _local18.timeline;
};
_local17 = (_local14 * _local15);
if ((((_local17 <= _local8)) && ((((((_local17 + (_local16.totalDuration * _local14)) + 1E-10) > _local8)) || ((_local16.cachedDuration == 0)))))){
var _temp3 = _local12;
_local12 = (_local12 + 1);
_local19 = _temp3;
_local9[_local19] = _local16;
};
};
};
if (_local12 == 0){
return (_local6);
};
_local5 = _local12;
if (_arg4 == 2){
while (--_local5 > -1) {
_local7 = _local9[_local5];
if (_local7.killVars(_arg2)){
_local6 = true;
};
if ((((_local7.cachedPT1 == null)) && (_local7.initted))){
_local7.setEnabled(false, false);
};
};
} else {
while (--_local5 > -1) {
if (TweenLite(_local9[_local5]).setEnabled(false, false)){
_local6 = true;
};
};
};
return (_local6);
}
public static function getGlobalPaused(_arg1:TweenCore):Boolean{
var _local2:Boolean;
while (_arg1) {
if (_arg1.cachedPaused){
_local2 = true;
break;
};
_arg1 = _arg1.timeline;
};
return (_local2);
}
}
}//package com.greensock
Section 128
//TweenLite (com.greensock.TweenLite)
package com.greensock {
import flash.display.*;
import flash.events.*;
import com.greensock.core.*;
import com.greensock.plugins.*;
import flash.utils.*;
public class TweenLite extends TweenCore {
public var target:Object;
public var propTweenLookup:Object;
public var ratio:Number;// = 0
public var cachedPT1:PropTween;
protected var _ease:Function;
protected var _overwrite:uint;
protected var _overwrittenProps:Object;
protected var _hasPlugins:Boolean;
protected var _notifyPluginsOfEnabled:Boolean;
public static const version:Number = 11.36;
public static var plugins:Object = {};
public static var fastEaseLookup:Dictionary = new Dictionary(false);
public static var onPluginEvent:Function;
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
public static var defaultEase:Function = TweenLite.easeOut;
public static var overwriteManager:Object;
public static var rootFrame:Number;
public static var rootTimeline:SimpleTimeline;
public static var rootFramesTimeline:SimpleTimeline;
public static var masterList:Dictionary = new Dictionary(false);
private static var _shape:Shape = new Shape();
protected static var _reservedProps:Object = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, roundProps:1, onStart:1, onStartParams:1, onInit:1, onInitParams:1, onReverseComplete:1, onReverseCompleteParams:1, onRepeat:1, onRepeatParams:1, proxiedEase:1, easeParams:1, yoyo:1, onCompleteListener:1, onUpdateListener:1, onStartListener:1, onReverseCompleteListener:1, onRepeatListener:1, orientToBezier:1, timeScale:1, immediateRender:1, repeat:1, repeatDelay:1, timeline:1, data:1, paused:1};
public function TweenLite(_arg1:Object, _arg2:Number, _arg3:Object){
var _local5:TweenLite;
super(_arg2, _arg3);
this.target = _arg1;
if ((((this.target is TweenCore)) && (this.vars.timeScale))){
this.cachedTimeScale = 1;
};
propTweenLookup = {};
_ease = defaultEase;
_overwrite = (((!((Number(_arg3.overwrite) > -1))) || (((!(overwriteManager.enabled)) && ((_arg3.overwrite > 1)))))) ? overwriteManager.mode : int(_arg3.overwrite);
var _local4:Array = masterList[_arg1];
if (!_local4){
masterList[_arg1] = [this];
} else {
if (_overwrite == 1){
for each (_local5 in _local4) {
if (!_local5.gc){
_local5.setEnabled(false, false);
};
};
masterList[_arg1] = [this];
} else {
_local4[_local4.length] = this;
};
};
if (((this.active) || (this.vars.immediateRender))){
renderTime(0, false, true);
};
}
protected function init():void{
var _local1:String;
var _local2:int;
var _local3:*;
var _local4:Boolean;
var _local5:Array;
var _local6:PropTween;
if (this.vars.onInit){
this.vars.onInit.apply(null, this.vars.onInitParams);
};
if (typeof(this.vars.ease) == "function"){
_ease = this.vars.ease;
};
if (this.vars.easeParams){
this.vars.proxiedEase = _ease;
_ease = easeProxy;
};
this.cachedPT1 = null;
this.propTweenLookup = {};
for (_local1 in this.vars) {
if ((((_local1 in _reservedProps)) && (!((((_local1 == "timeScale")) && ((this.target is TweenCore))))))){
} else {
if ((((_local1 in plugins)) && (new ((plugins[_local1] as Class)).onInitTween(this.target, this.vars[_local1], this)))){
this.cachedPT1 = new PropTween(_local3, "changeFactor", 0, 1, ((_local3.overwriteProps.length)==1) ? _local3.overwriteProps[0] : "_MULTIPLE_", true, this.cachedPT1);
if (this.cachedPT1.name == "_MULTIPLE_"){
_local2 = _local3.overwriteProps.length;
while (--_local2 > -1) {
this.propTweenLookup[_local3.overwriteProps[_local2]] = this.cachedPT1;
};
} else {
this.propTweenLookup[this.cachedPT1.name] = this.cachedPT1;
};
if (_local3.priority){
this.cachedPT1.priority = _local3.priority;
_local4 = true;
};
if (((_local3.onDisable) || (_local3.onEnable))){
_notifyPluginsOfEnabled = true;
};
_hasPlugins = true;
} else {
this.cachedPT1 = new PropTween(this.target, _local1, Number(this.target[_local1]), ((typeof(this.vars[_local1]))=="number") ? (Number(this.vars[_local1]) - this.target[_local1]) : Number(this.vars[_local1]), _local1, false, this.cachedPT1);
this.propTweenLookup[_local1] = this.cachedPT1;
};
};
};
if (_local4){
onPluginEvent("onInit", this);
};
if (this.vars.runBackwards){
_local6 = this.cachedPT1;
while (_local6) {
_local6.start = (_local6.start + _local6.change);
_local6.change = -(_local6.change);
_local6 = _local6.nextNode;
};
};
_hasUpdate = Boolean(!((this.vars.onUpdate == null)));
if (_overwrittenProps){
killVars(_overwrittenProps);
if (this.cachedPT1 == null){
this.setEnabled(false, false);
};
};
if ((((((((_overwrite > 1)) && (this.cachedPT1))) && (masterList[this.target]))) && ((_local5.length > 1)))){
if (overwriteManager.manageOverwrites(this, this.propTweenLookup, _local5, _overwrite)){
init();
};
};
this.initted = true;
}
override public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
var _local4:Boolean;
var _local5:Number = this.cachedTime;
if (_arg1 >= this.cachedDuration){
this.cachedTotalTime = (this.cachedTime = this.cachedDuration);
this.ratio = 1;
_local4 = true;
if (this.cachedDuration == 0){
if ((((((_arg1 == 0)) || ((_rawPrevTime < 0)))) && (!((_rawPrevTime == _arg1))))){
_arg3 = true;
};
_rawPrevTime = _arg1;
};
} else {
if (_arg1 <= 0){
this.cachedTotalTime = (this.cachedTime = (this.ratio = 0));
if (_arg1 < 0){
this.active = false;
if (this.cachedDuration == 0){
if (_rawPrevTime > 0){
_arg3 = true;
_local4 = true;
};
_rawPrevTime = _arg1;
};
};
if (((this.cachedReversed) && (!((_local5 == 0))))){
_local4 = true;
};
} else {
this.cachedTotalTime = (this.cachedTime = _arg1);
this.ratio = _ease(_arg1, 0, 1, this.cachedDuration);
};
};
if ((((this.cachedTime == _local5)) && (!(_arg3)))){
return;
};
if (!this.initted){
init();
if (((!(_local4)) && (this.cachedTime))){
this.ratio = _ease(this.cachedTime, 0, 1, this.cachedDuration);
};
};
if (((!(this.active)) && (!(this.cachedPaused)))){
this.active = true;
};
if ((((((((_local5 == 0)) && (this.vars.onStart))) && (!((this.cachedTime == 0))))) && (!(_arg2)))){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
var _local6:PropTween = this.cachedPT1;
while (_local6) {
_local6.target[_local6.property] = (_local6.start + (this.ratio * _local6.change));
_local6 = _local6.nextNode;
};
if (((_hasUpdate) && (!(_arg2)))){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local4){
if (((_hasPlugins) && (this.cachedPT1))){
onPluginEvent("onComplete", this);
};
complete(true, _arg2);
};
}
public function killVars(_arg1:Object, _arg2:Boolean=true):Boolean{
var _local3:String;
var _local4:PropTween;
var _local5:Boolean;
if (_overwrittenProps == null){
_overwrittenProps = {};
};
for (_local3 in _arg1) {
if ((_local3 in propTweenLookup)){
_local4 = propTweenLookup[_local3];
if (((_local4.isPlugin) && ((_local4.name == "_MULTIPLE_")))){
_local4.target.killProps(_arg1);
if (_local4.target.overwriteProps.length == 0){
_local4.name = "";
};
};
if (_local4.name != "_MULTIPLE_"){
if (_local4.nextNode){
_local4.nextNode.prevNode = _local4.prevNode;
};
if (_local4.prevNode){
_local4.prevNode.nextNode = _local4.nextNode;
} else {
if (this.cachedPT1 == _local4){
this.cachedPT1 = _local4.nextNode;
};
};
if (((_local4.isPlugin) && (_local4.target.onDisable))){
_local4.target.onDisable();
if (_local4.target.activeDisable){
_local5 = true;
};
};
delete propTweenLookup[_local3];
};
};
if (((_arg2) && (!((_arg1 == _overwrittenProps))))){
_overwrittenProps[_local3] = 1;
};
};
return (_local5);
}
override public function invalidate():void{
if (((_notifyPluginsOfEnabled) && (this.cachedPT1))){
onPluginEvent("onDisable", this);
};
this.cachedPT1 = null;
_overwrittenProps = null;
_hasUpdate = (this.initted = (this.active = (_notifyPluginsOfEnabled = false)));
this.propTweenLookup = {};
}
override public function setEnabled(_arg1:Boolean, _arg2:Boolean=false):Boolean{
var _local3:Array;
if (_arg1){
_local3 = TweenLite.masterList[this.target];
if (!_local3){
TweenLite.masterList[this.target] = [this];
} else {
_local3[_local3.length] = this;
};
};
super.setEnabled(_arg1, _arg2);
if (((_notifyPluginsOfEnabled) && (this.cachedPT1))){
return (onPluginEvent((_arg1) ? "onEnable" : "onDisable", this));
};
return (false);
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams)));
}
public static function initClass():void{
rootFrame = 0;
rootTimeline = new SimpleTimeline(null);
rootFramesTimeline = new SimpleTimeline(null);
rootTimeline.cachedStartTime = (getTimer() * 0.001);
rootFramesTimeline.cachedStartTime = rootFrame;
rootTimeline.autoRemoveChildren = true;
rootFramesTimeline.autoRemoveChildren = true;
_shape.addEventListener(Event.ENTER_FRAME, updateAll, false, 0, true);
if (overwriteManager == null){
overwriteManager = {mode:1, enabled:false};
};
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
return (new TweenLite(_arg1, _arg2, _arg3));
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
_arg3.runBackwards = true;
if (!("immediateRender" in _arg3)){
_arg3.immediateRender = true;
};
return (new TweenLite(_arg1, _arg2, _arg3));
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null, _arg4:Boolean=false):TweenLite{
return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, immediateRender:false, useFrames:_arg4, overwrite:0}));
}
protected static function updateAll(_arg1:Event=null):void{
var _local2:Dictionary;
var _local3:Object;
var _local4:Array;
var _local5:int;
rootTimeline.renderTime((((getTimer() * 0.001) - rootTimeline.cachedStartTime) * rootTimeline.cachedTimeScale), false, false);
rootFrame++;
rootFramesTimeline.renderTime(((rootFrame - rootFramesTimeline.cachedStartTime) * rootFramesTimeline.cachedTimeScale), false, false);
if (!(rootFrame % 60)){
_local2 = masterList;
for (_local3 in _local2) {
_local4 = _local2[_local3];
_local5 = _local4.length;
while (--_local5 > -1) {
if (TweenLite(_local4[_local5]).gc){
_local4.splice(_local5, 1);
};
};
if (_local4.length == 0){
delete _local2[_local3];
};
};
};
}
public static function killTweensOf(_arg1:Object, _arg2:Boolean=false, _arg3:Object=null):void{
var _local4:Array;
var _local5:int;
var _local6:TweenLite;
if ((_arg1 in masterList)){
_local4 = masterList[_arg1];
_local5 = _local4.length;
while (--_local5 > -1) {
_local6 = _local4[_local5];
if (!_local6.gc){
if (_arg2){
_local6.complete(false, false);
};
if (_arg3 != null){
_local6.killVars(_arg3);
};
if ((((_arg3 == null)) || ((((_local6.cachedPT1 == null)) && (_local6.initted))))){
_local6.setEnabled(false, false);
};
};
};
if (_arg3 == null){
delete masterList[_arg1];
};
};
}
protected static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (1 - (_arg1 / _arg4));
return ((1 - (_arg1 * _arg1)));
}
}
}//package com.greensock
Section 129
//TweenMax (com.greensock.TweenMax)
package com.greensock {
import flash.display.*;
import flash.events.*;
import com.greensock.core.*;
import com.greensock.plugins.*;
import com.greensock.events.*;
import flash.utils.*;
public class TweenMax extends TweenLite implements IEventDispatcher {
protected var _dispatcher:EventDispatcher;
protected var _hasUpdateListener:Boolean;
protected var _repeat:int;// = 0
protected var _repeatDelay:Number;// = 0
protected var _cyclesComplete:uint;// = 0
protected var _easePower:uint;
protected var _easeType:uint;
public var yoyo:Boolean;
public static const version:Number = 11.37;
private static var _overwriteMode:int = (OverwriteManager.enabled) ? OverwriteManager.mode : OverwriteManager.init(2);
;
public static var killTweensOf:Function = TweenLite.killTweensOf;
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
public function TweenMax(_arg1:Object, _arg2:Number, _arg3:Object){
super(_arg1, _arg2, _arg3);
if (TweenLite.version < 11.2){
throw (new Error("TweenMax error! Please update your TweenLite class or try deleting your ASO files. TweenMax requires a more recent version. Download updates at http://www.TweenMax.com."));
};
this.yoyo = Boolean(this.vars.yoyo);
_repeat = (this.vars.repeat) ? int(this.vars.repeat) : 0;
_repeatDelay = (this.vars.repeatDelay) ? Number(this.vars.repeatDelay) : 0;
this.cacheIsDirty = true;
if (((((((((((this.vars.onCompleteListener) || (this.vars.onInitListener))) || (this.vars.onUpdateListener))) || (this.vars.onStartListener))) || (this.vars.onRepeatListener))) || (this.vars.onReverseCompleteListener))){
initDispatcher();
if ((((_arg2 == 0)) && ((_delay == 0)))){
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.UPDATE));
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
};
};
if (((this.vars.timeScale) && (!((this.target is TweenCore))))){
this.cachedTimeScale = this.vars.timeScale;
};
}
override protected function init():void{
var _local1:TweenMax;
var _local2:int;
var _local3:String;
var _local4:String;
var _local5:Array;
var _local6:Object;
var _local7:PropTween;
var _local8:PropTween;
var _local9:int;
if (this.vars.startAt){
this.vars.startAt.overwrite = 0;
this.vars.startAt.immediateRender = true;
_local1 = new TweenMax(this.target, 0, this.vars.startAt);
};
if (_dispatcher){
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.INIT));
};
super.init();
if ((_ease in fastEaseLookup)){
_easeType = fastEaseLookup[_ease][0];
_easePower = fastEaseLookup[_ease][1];
};
if (((!((this.vars.roundProps == null))) && (("roundProps" in TweenLite.plugins)))){
_local5 = this.vars.roundProps;
_local9 = _local5.length;
while (--_local9 > -1) {
_local3 = _local5[_local9];
_local8 = this.cachedPT1;
while (_local8) {
if (_local8.name == _local3){
if (_local8.isPlugin){
_local8.target.round = true;
} else {
if (_local6 == null){
_local6 = new TweenLite.plugins.roundProps();
_local6.add(_local8.target, _local3, _local8.start, _local8.change);
_hasPlugins = true;
_local7 = insertPropTween(_local6, "changeFactor", 0, 1, "_MULTIPLE_", true, this.cachedPT1);
this.cachedPT1 = _local7;
} else {
_local6.add(_local8.target, _local3, _local8.start, _local8.change);
};
this.removePropTween(_local8);
this.propTweenLookup[_local3] = _local7;
};
} else {
if (((((_local8.isPlugin) && ((_local8.name == "_MULTIPLE_")))) && (!(_local8.target.round)))){
_local4 = ((" " + _local8.target.overwriteProps.join(" ")) + " ");
if (_local4.indexOf(((" " + _local3) + " ")) != -1){
_local8.target.round = true;
};
};
};
_local8 = _local8.nextNode;
};
};
};
}
protected function insertPropTween(_arg1:Object, _arg2:String, _arg3:Number, _arg4, _arg5:String, _arg6:Boolean, _arg7:PropTween):PropTween{
var _local9:Array;
var _local10:int;
var _local8:PropTween = new PropTween(_arg1, _arg2, _arg3, ((typeof(_arg4))=="number") ? (_arg4 - _arg3) : Number(_arg4), _arg5, _arg6, _arg7);
if (((_arg6) && ((_arg5 == "_MULTIPLE_")))){
_local9 = _arg1.overwriteProps;
_local10 = _local9.length;
while (--_local10 > -1) {
this.propTweenLookup[_local9[_local10]] = _local8;
};
} else {
this.propTweenLookup[_arg5] = _local8;
};
return (_local8);
}
protected function removePropTween(_arg1:PropTween):Boolean{
if (_arg1.nextNode){
_arg1.nextNode.prevNode = _arg1.prevNode;
};
if (_arg1.prevNode){
_arg1.prevNode.nextNode = _arg1.nextNode;
} else {
if (this.cachedPT1 == _arg1){
this.cachedPT1 = _arg1.nextNode;
};
};
if (((_arg1.isPlugin) && (_arg1.target.onDisable))){
_arg1.target.onDisable();
if (_arg1.target.activeDisable){
return (true);
};
};
return (false);
}
override public function invalidate():void{
this.yoyo = Boolean((this.vars.yoyo == true));
_repeat = (this.vars.repeat) ? Number(this.vars.repeat) : 0;
_repeatDelay = (this.vars.repeatDelay) ? Number(this.vars.repeatDelay) : 0;
_hasUpdateListener = false;
if (((((!((this.vars.onCompleteListener == null))) || (!((this.vars.onUpdateListener == null))))) || (!((this.vars.onStartListener == null))))){
initDispatcher();
};
setDirtyCache(true);
super.invalidate();
}
public function updateTo(_arg1:Object, _arg2:Boolean=false):void{
var _local4:String;
var _local5:Number;
var _local6:PropTween;
var _local7:Number;
var _local3:Number = this.ratio;
if (((((_arg2) && (!((this.timeline == null))))) && ((this.cachedStartTime < this.timeline.cachedTime)))){
this.cachedStartTime = this.timeline.cachedTime;
this.setDirtyCache(false);
if (this.gc){
this.setEnabled(true, false);
} else {
this.timeline.addChild(this);
};
};
for (_local4 in _arg1) {
this.vars[_local4] = _arg1[_local4];
};
if (this.initted){
this.initted = false;
if (!_arg2){
init();
if (((((!(_arg2)) && ((this.cachedTime > 0)))) && ((this.cachedTime < this.cachedDuration)))){
_local5 = (1 / (1 - _local3));
_local6 = this.cachedPT1;
while (_local6) {
_local7 = (_local6.start + _local6.change);
_local6.change = (_local6.change * _local5);
_local6.start = (_local7 - _local6.change);
_local6 = _local6.nextNode;
};
};
};
};
}
public function setDestination(_arg1:String, _arg2, _arg3:Boolean=true):void{
var _local4:Object = {};
_local4[_arg1] = _arg2;
updateTo(_local4, !(_arg3));
}
public function killProperties(_arg1:Array):void{
var _local2:Object = {};
var _local3:int = _arg1.length;
while (--_local3 > -1) {
_local2[_arg1[_local3]] = true;
};
killVars(_local2);
}
override public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
var _local6:Boolean;
var _local7:Boolean;
var _local8:Boolean;
var _local10:Number;
var _local11:int;
var _local12:int;
var _local13:Number;
var _local4:Number = (this.cacheIsDirty) ? this.totalDuration : this.cachedTotalDuration;
var _local5:Number = this.cachedTime;
if (_arg1 >= _local4){
this.cachedTotalTime = _local4;
this.cachedTime = this.cachedDuration;
this.ratio = 1;
_local6 = true;
if (this.cachedDuration == 0){
if ((((((_arg1 == 0)) || ((_rawPrevTime < 0)))) && (!((_rawPrevTime == _arg1))))){
_arg3 = true;
};
_rawPrevTime = _arg1;
};
} else {
if (_arg1 <= 0){
if (_arg1 < 0){
this.active = false;
if (this.cachedDuration == 0){
if (_rawPrevTime > 0){
_arg3 = true;
_local6 = true;
};
_rawPrevTime = _arg1;
};
};
this.cachedTotalTime = (this.cachedTime = (this.ratio = 0));
if (((this.cachedReversed) && (!((_local5 == 0))))){
_local6 = true;
};
} else {
this.cachedTotalTime = (this.cachedTime = _arg1);
_local8 = true;
};
};
if (_repeat != 0){
_local10 = (this.cachedDuration + _repeatDelay);
if (_local6){
if (((this.yoyo) && ((_repeat % 2)))){
this.cachedTime = (this.ratio = 0);
};
} else {
if (_arg1 > 0){
_local11 = _cyclesComplete;
_cyclesComplete = int((this.cachedTotalTime / _local10));
if (_cyclesComplete == (this.cachedTotalTime / _local10)){
_cyclesComplete--;
};
if (_local11 != _cyclesComplete){
_local7 = true;
};
this.cachedTime = (((this.cachedTotalTime / _local10) - _cyclesComplete) * _local10);
if (((this.yoyo) && ((_cyclesComplete % 2)))){
this.cachedTime = (this.cachedDuration - this.cachedTime);
} else {
if (this.cachedTime >= this.cachedDuration){
this.cachedTime = this.cachedDuration;
this.ratio = 1;
_local8 = false;
};
};
if (this.cachedTime <= 0){
this.cachedTime = (this.ratio = 0);
_local8 = false;
};
};
};
};
if ((((_local5 == this.cachedTime)) && (!(_arg3)))){
return;
};
if (!this.initted){
init();
};
if (((!(this.active)) && (!(this.cachedPaused)))){
this.active = true;
};
if (_local8){
if (_easeType){
_local12 = _easePower;
_local13 = (this.cachedTime / this.cachedDuration);
if (_easeType == 2){
_local13 = (1 - _local13);
this.ratio = _local13;
while (--_local12 > -1) {
this.ratio = (_local13 * this.ratio);
};
this.ratio = (1 - this.ratio);
} else {
if (_easeType == 1){
this.ratio = _local13;
while (--_local12 > -1) {
this.ratio = (_local13 * this.ratio);
};
} else {
if (_local13 < 0.5){
_local13 = (_local13 * 2);
this.ratio = _local13;
while (--_local12 > -1) {
this.ratio = (_local13 * this.ratio);
};
this.ratio = (this.ratio * 0.5);
} else {
_local13 = ((1 - _local13) * 2);
this.ratio = _local13;
while (--_local12 > -1) {
this.ratio = (_local13 * this.ratio);
};
this.ratio = (1 - (0.5 * this.ratio));
};
};
};
} else {
this.ratio = _ease(this.cachedTime, 0, 1, this.cachedDuration);
};
};
if ((((((_local5 == 0)) && (!((this.cachedTotalTime == 0))))) && (!(_arg2)))){
if (this.vars.onStart){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
if (_dispatcher){
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.START));
};
};
var _local9:PropTween = this.cachedPT1;
while (_local9) {
_local9.target[_local9.property] = (_local9.start + (this.ratio * _local9.change));
_local9 = _local9.nextNode;
};
if (((_hasUpdate) && (!(_arg2)))){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (((_hasUpdateListener) && (!(_arg2)))){
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.UPDATE));
};
if (_local6){
if (((_hasPlugins) && (this.cachedPT1))){
onPluginEvent("onComplete", this);
};
complete(true, _arg2);
} else {
if (((_local7) && (!(_arg2)))){
if (this.vars.onRepeat){
this.vars.onRepeat.apply(null, this.vars.onRepeatParams);
};
if (_dispatcher){
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.REPEAT));
};
};
};
}
override public function complete(_arg1:Boolean=false, _arg2:Boolean=false):void{
super.complete(_arg1, _arg2);
if (((!(_arg2)) && (_dispatcher))){
if ((((this.cachedTotalTime == this.cachedTotalDuration)) && (!(this.cachedReversed)))){
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
} else {
if (((this.cachedReversed) && ((this.cachedTotalTime == 0)))){
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.REVERSE_COMPLETE));
};
};
};
}
protected function initDispatcher():void{
if (_dispatcher == null){
_dispatcher = new EventDispatcher(this);
};
if ((this.vars.onInitListener is Function)){
_dispatcher.addEventListener(TweenEvent.INIT, this.vars.onInitListener, false, 0, true);
};
if ((this.vars.onStartListener is Function)){
_dispatcher.addEventListener(TweenEvent.START, this.vars.onStartListener, false, 0, true);
};
if ((this.vars.onUpdateListener is Function)){
_dispatcher.addEventListener(TweenEvent.UPDATE, this.vars.onUpdateListener, false, 0, true);
_hasUpdateListener = true;
};
if ((this.vars.onCompleteListener is Function)){
_dispatcher.addEventListener(TweenEvent.COMPLETE, this.vars.onCompleteListener, false, 0, true);
};
if ((this.vars.onRepeatListener is Function)){
_dispatcher.addEventListener(TweenEvent.REPEAT, this.vars.onRepeatListener, false, 0, true);
};
if ((this.vars.onReverseCompleteListener is Function)){
_dispatcher.addEventListener(TweenEvent.REVERSE_COMPLETE, this.vars.onReverseCompleteListener, false, 0, true);
};
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
if (_dispatcher == null){
initDispatcher();
};
if (_arg1 == TweenEvent.UPDATE){
_hasUpdateListener = true;
};
_dispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
if (_dispatcher){
_dispatcher.removeEventListener(_arg1, _arg2, _arg3);
};
}
public function hasEventListener(_arg1:String):Boolean{
return (((_dispatcher)==null) ? false : _dispatcher.hasEventListener(_arg1));
}
public function willTrigger(_arg1:String):Boolean{
return (((_dispatcher)==null) ? false : _dispatcher.willTrigger(_arg1));
}
public function dispatchEvent(_arg1:Event):Boolean{
return (((_dispatcher)==null) ? false : _dispatcher.dispatchEvent(_arg1));
}
public function get currentProgress():Number{
return ((this.cachedTime / this.duration));
}
public function set currentProgress(_arg1:Number):void{
if (_cyclesComplete == 0){
setTotalTime((this.duration * _arg1), false);
} else {
setTotalTime(((this.duration * _arg1) + (_cyclesComplete * this.cachedDuration)), false);
};
}
public function get totalProgress():Number{
return ((this.cachedTotalTime / this.totalDuration));
}
public function set totalProgress(_arg1:Number):void{
setTotalTime((this.totalDuration * _arg1), false);
}
override public function set currentTime(_arg1:Number):void{
if (_cyclesComplete == 0){
} else {
if (((this.yoyo) && (((_cyclesComplete % 2) == 1)))){
_arg1 = ((this.duration - _arg1) + (_cyclesComplete * (this.cachedDuration + _repeatDelay)));
} else {
_arg1 = (_arg1 + (_cyclesComplete * (this.duration + _repeatDelay)));
};
};
setTotalTime(_arg1, false);
}
override public function get totalDuration():Number{
if (this.cacheIsDirty){
this.cachedTotalDuration = ((_repeat)==-1) ? 999999999999 : ((this.cachedDuration * (_repeat + 1)) + (_repeatDelay * _repeat));
this.cacheIsDirty = false;
};
return (this.cachedTotalDuration);
}
override public function set totalDuration(_arg1:Number):void{
if (_repeat == -1){
return;
};
this.duration = ((_arg1 - (_repeat * _repeatDelay)) / (_repeat + 1));
}
public function get timeScale():Number{
return (this.cachedTimeScale);
}
public function set timeScale(_arg1:Number):void{
if (_arg1 == 0){
_arg1 = 0.0001;
};
var _local2:Number = (((_pauseTime) || ((_pauseTime == 0)))) ? _pauseTime : this.timeline.cachedTotalTime;
this.cachedStartTime = (_local2 - (((_local2 - this.cachedStartTime) * this.cachedTimeScale) / _arg1));
this.cachedTimeScale = _arg1;
setDirtyCache(false);
}
public function get repeat():int{
return (_repeat);
}
public function set repeat(_arg1:int):void{
_repeat = _arg1;
setDirtyCache(true);
}
public function get repeatDelay():Number{
return (_repeatDelay);
}
public function set repeatDelay(_arg1:Number):void{
_repeatDelay = _arg1;
setDirtyCache(true);
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenMax{
return (new TweenMax(_arg1, _arg2, _arg3));
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenMax{
_arg3.runBackwards = true;
if (!("immediateRender" in _arg3)){
_arg3.immediateRender = true;
};
return (new TweenMax(_arg1, _arg2, _arg3));
}
public static function fromTo(_arg1:Object, _arg2:Number, _arg3:Object, _arg4:Object):TweenMax{
_arg4.startAt = _arg3;
if (_arg3.immediateRender){
_arg4.immediateRender = true;
};
return (new TweenMax(_arg1, _arg2, _arg4));
}
public static function allTo(_arg1:Array, _arg2:Number, _arg3:Object, _arg4:Number=0, _arg5:Function=null, _arg6:Array=null):Array{
var i:int;
var varsDup:Object;
var p:String;
var onCompleteProxy:Function;
var onCompleteParamsProxy:Array;
var targets = _arg1;
var duration = _arg2;
var vars = _arg3;
var stagger = _arg4;
var onCompleteAll = _arg5;
var onCompleteAllParams = _arg6;
var l:uint = targets.length;
var a:Array = [];
var curDelay:Number = (("delay" in vars)) ? Number(vars.delay) : 0;
onCompleteProxy = vars.onComplete;
onCompleteParamsProxy = vars.onCompleteParams;
var lastIndex:int = ((stagger)<=0) ? 0 : (l - 1);
i = 0;
while (i < l) {
varsDup = {};
for (p in vars) {
varsDup[p] = vars[p];
};
varsDup.delay = curDelay;
if ((((i == lastIndex)) && (!((onCompleteAll == null))))){
varsDup.onComplete = function ():void{
if (onCompleteProxy != null){
onCompleteProxy.apply(null, onCompleteParamsProxy);
};
onCompleteAll.apply(null, onCompleteAllParams);
};
};
a[a.length] = new TweenMax(targets[i], duration, varsDup);
curDelay = (curDelay + stagger);
i = (i + 1);
};
return (a);
}
public static function allFrom(_arg1:Array, _arg2:Number, _arg3:Object, _arg4:Number=0, _arg5:Function=null, _arg6:Array=null):Array{
_arg3.runBackwards = true;
if (!("immediateRender" in _arg3)){
_arg3.immediateRender = true;
};
return (allTo(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6));
}
public static function allFromTo(_arg1:Array, _arg2:Number, _arg3:Object, _arg4:Object, _arg5:Number=0, _arg6:Function=null, _arg7:Array=null):Array{
_arg4.startAt = _arg3;
if (_arg3.immediateRender){
_arg4.immediateRender = true;
};
return (allTo(_arg1, _arg2, _arg4, _arg5, _arg6, _arg7));
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null, _arg4:Boolean=false):TweenMax{
return (new TweenMax(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, immediateRender:false, useFrames:_arg4, overwrite:0}));
}
public static function getTweensOf(_arg1:Object):Array{
var _local4:int;
var _local5:uint;
var _local2:Array = masterList[_arg1];
var _local3:Array = [];
if (_local2){
_local4 = _local2.length;
_local5 = 0;
while (--_local4 > -1) {
if (!_local2[_local4].gc){
var _temp1 = _local5;
_local5 = (_local5 + 1);
var _local6 = _temp1;
_local3[_local6] = _local2[_local4];
};
};
};
return (_local3);
}
public static function isTweening(_arg1:Object):Boolean{
var _local4:TweenLite;
var _local2:Array = getTweensOf(_arg1);
var _local3:int = _local2.length;
while (--_local3 > -1) {
_local4 = _local2[_local3];
if (((_local4.active) || ((((_local4.cachedStartTime == _local4.timeline.cachedTime)) && (_local4.timeline.active))))){
return (true);
};
};
return (false);
}
public static function getAllTweens():Array{
var _local4:Array;
var _local5:int;
var _local1:Dictionary = masterList;
var _local2:uint;
var _local3:Array = [];
for each (_local4 in _local1) {
_local5 = _local4.length;
while (--_local5 > -1) {
if (!TweenLite(_local4[_local5]).gc){
var _temp1 = _local2;
_local2 = (_local2 + 1);
var _local8 = _temp1;
_local3[_local8] = _local4[_local5];
};
};
};
return (_local3);
}
public static function killAll(_arg1:Boolean=false, _arg2:Boolean=true, _arg3:Boolean=true):void{
var _local5:Boolean;
var _local4:Array = getAllTweens();
var _local6:int = _local4.length;
while (--_local6 > -1) {
_local5 = (_local4[_local6].target == _local4[_local6].vars.onComplete);
if ((((_local5 == _arg3)) || (!((_local5 == _arg2))))){
if (_arg1){
_local4[_local6].complete(false);
} else {
_local4[_local6].setEnabled(false, false);
};
};
};
}
public static function killChildTweensOf(_arg1:DisplayObjectContainer, _arg2:Boolean=false):void{
var _local4:Object;
var _local5:DisplayObjectContainer;
var _local3:Array = getAllTweens();
var _local6:int = _local3.length;
while (--_local6 > -1) {
_local4 = _local3[_local6].target;
if ((_local4 is DisplayObject)){
_local5 = _local4.parent;
while (_local5) {
if (_local5 == _arg1){
if (_arg2){
_local3[_local6].complete(false);
} else {
_local3[_local6].setEnabled(false, false);
};
};
_local5 = _local5.parent;
};
};
};
}
public static function pauseAll(_arg1:Boolean=true, _arg2:Boolean=true):void{
changePause(true, _arg1, _arg2);
}
public static function resumeAll(_arg1:Boolean=true, _arg2:Boolean=true):void{
changePause(false, _arg1, _arg2);
}
private static function changePause(_arg1:Boolean, _arg2:Boolean=true, _arg3:Boolean=false):void{
var _local5:Boolean;
var _local4:Array = getAllTweens();
var _local6:int = _local4.length;
while (--_local6 > -1) {
_local5 = (TweenLite(_local4[_local6]).target == TweenLite(_local4[_local6]).vars.onComplete);
if ((((_local5 == _arg3)) || (!((_local5 == _arg2))))){
TweenCore(_local4[_local6]).paused = _arg1;
};
};
}
public static function get globalTimeScale():Number{
return (((TweenLite.rootTimeline)==null) ? 1 : TweenLite.rootTimeline.cachedTimeScale);
}
public static function set globalTimeScale(_arg1:Number):void{
if (_arg1 == 0){
_arg1 = 0.0001;
};
if (TweenLite.rootTimeline == null){
TweenLite.to({}, 0, {});
};
var _local2:SimpleTimeline = TweenLite.rootTimeline;
var _local3:Number = (getTimer() * 0.001);
_local2.cachedStartTime = (_local3 - (((_local3 - _local2.cachedStartTime) * _local2.cachedTimeScale) / _arg1));
_local2 = TweenLite.rootFramesTimeline;
_local3 = TweenLite.rootFrame;
_local2.cachedStartTime = (_local3 - (((_local3 - _local2.cachedStartTime) * _local2.cachedTimeScale) / _arg1));
TweenLite.rootFramesTimeline.cachedTimeScale = (TweenLite.rootTimeline.cachedTimeScale = _arg1);
}
TweenPlugin.activate([AutoAlphaPlugin, EndArrayPlugin, FramePlugin, RemoveTintPlugin, TintPlugin, VisiblePlugin, VolumePlugin, BevelFilterPlugin, BezierPlugin, BezierThroughPlugin, BlurFilterPlugin, ColorMatrixFilterPlugin, ColorTransformPlugin, DropShadowFilterPlugin, FrameLabelPlugin, GlowFilterPlugin, HexColorsPlugin, RoundPropsPlugin, ShortRotationPlugin, {}]);
}
}//package com.greensock
Section 130
//BitmapLayer (dgparticles.BitmapLayer)
package dgparticles {
import flash.display.*;
import flash.geom.*;
public class BitmapLayer extends Bitmap {
var refreshRect:Rectangle;
public var refreshX1;
public var refreshY1;
public var refreshX2;
public var refreshY2:Number;
public var bgColor:uint;
public function BitmapLayer(_arg1, _arg2:int, _arg3:uint=0, _arg4:String="auto", _arg5:Boolean=false){
refreshRect = new Rectangle();
super(new BitmapData(_arg1, _arg2, true, _arg3), _arg4, _arg5);
bgColor = _arg3;
}
public function get bounds():Rectangle{
return (bitmapData.rect);
}
public function clear():void{
if ((((refreshX2 == 0)) || ((refreshY2 == 0)))){
return;
};
refreshRect.x = refreshX1;
refreshRect.y = refreshY1;
refreshRect.width = (refreshX2 - refreshX1);
refreshRect.height = (refreshY2 - refreshY1);
bitmapData.fillRect(refreshRect, bgColor);
}
}
}//package dgparticles
Section 131
//Color4 (dgparticles.Color4)
package dgparticles {
public class Color4 {
public var a;
public var r;
public var g;
public var b:int;
public function Color4(_arg1, _arg2, _arg3, _arg4:int){
this.a = _arg1;
this.r = _arg2;
this.g = _arg3;
this.b = _arg4;
}
public function toHex():uint{
return (Color4.ARGBToHex(a, r, g, b));
}
public function toString():String{
return (((((((("a = " + a) + "; r = ") + r) + "; g = ") + g) + "; b = ") + b));
}
public function clone():Color4{
return (new Color4(a, r, g, b));
}
public static function substructColors(_arg1, _arg2:Color4):Color4{
var _local3:int = (_arg1.a - _arg2.a);
var _local4:int = (_arg1.r - _arg2.r);
var _local5:int = (_arg1.g - _arg2.g);
var _local6:int = (_arg1.b - _arg2.b);
return (new Color4(_local3, _local4, _local5, _local6));
}
public static function ARGBToHex(_arg1, _arg2, _arg3, _arg4:uint):uint{
return (((((_arg1 << 24) | (_arg2 << 16)) | (_arg3 << 8)) | _arg4));
}
public static function RGBToHex(_arg1, _arg2, _arg3:uint):uint{
return ((((_arg1 << 16) | (_arg2 << 8)) | _arg3));
}
public static function HexToARGB(_arg1:uint):Color4{
var _local2:uint = ((_arg1 >> 24) & 0xFF);
var _local3:uint = ((_arg1 >> 16) & 0xFF);
var _local4:uint = ((_arg1 >> 8) & 0xFF);
var _local5:uint = (_arg1 & 0xFF);
return (new Color4(_local2, _local3, _local4, _local5));
}
}
}//package dgparticles
Section 132
//Emitter (dgparticles.Emitter)
package dgparticles {
import flash.geom.*;
public class Emitter {
public var settings:EmitterSettings;
private var timeSinceStart:Number;// = 0
private var particleSystem:ParticleSystem;
public var pos:Point;
private var newParticlesCount:Number;// = 0
private var lastPos:Point;
public var deltaMove:Point;
public function Emitter(_arg1:ParticleSystem){
deltaMove = new Point();
super();
this.particleSystem = _arg1;
}
public function get position():Point{
return (pos);
}
public function set position(_arg1:Point):void{
pos = _arg1;
if (((settings.moveWithEmmiter) && ((lastPos == null)))){
lastPos = new Point(_arg1.x, _arg1.y);
};
}
public function update(_arg1:Number):Boolean{
var _local2:int;
var _local3:int;
if (((settings.moveWithEmmiter) && ((timeSinceStart > 0)))){
if (!lastPos){
lastPos = new Point(pos.x, pos.y);
};
deltaMove.x = (lastPos.x - pos.x);
deltaMove.y = (lastPos.y - pos.y);
lastPos.x = pos.x;
lastPos.y = pos.y;
};
timeSinceStart = (timeSinceStart + _arg1);
if (timeSinceStart >= settings.lifeTime){
return (true);
};
newParticlesCount = (newParticlesCount + ((settings.emissionRate / 1000) * _arg1));
if (newParticlesCount >= 1){
_local2 = Math.floor(newParticlesCount);
newParticlesCount = (newParticlesCount - _local2);
_local3 = 0;
while (_local3 < _local2) {
if (particleSystem.parcticlesCount >= particleSystem.capacity){
break;
};
emitParticle();
_local3++;
};
};
return (false);
}
private function emitParticle():void{
var _local1:Particle = particleSystem.createParticle();
settings.initParticle(_local1, position);
_local1.initialize(this);
}
}
}//package dgparticles
Section 133
//EmitterSettings (dgparticles.EmitterSettings)
package dgparticles {
import flash.display.*;
import flash.geom.*;
public class EmitterSettings {
public var name:String;
public var capacity:Number;
public var direction:Number;
public var angle:Number;
public var minParticleLife;
public var maxParticleLife:Number;
public var minAcceleration;
public var maxAcceleration:Number;
public var minTangAcceleration;
public var maxTangAcceleration:Number;
public var minVelocity;
public var maxVelocity:Number;
public var minGravityY;
public var maxGravityY:Number;
public var minSpin;
public var maxSpin:Number;
public var blendMode:String;// = "add"
public var lifeTime:Number;// = 100000000
public var emissionRate:Number;
public var startColor;
public var midColor;
public var endColor:Color4;
public var startScaleX;
public var midScaleX;
public var endScaleX:Number;
public var startScaleY;
public var midScaleY;
public var endScaleY:Number;
public var moveWithEmmiter:Boolean;// = false
public var radius:Number;// = 0
public var middle:int;// = 50
private var imgName:String;
private var particleBitmapData:BitmapData;
public function get imageName():String{
return (imgName);
}
public function set imageName(_arg1:String):void{
imgName = _arg1;
particleBitmapData = Utilites.getParticleByName(_arg1);
}
public function initParticle(_arg1:Particle, _arg2:Point):void{
_arg1.position.x = (_arg2.x + Utils.randomNumber(-(radius), radius));
_arg1.position.y = (_arg2.y + Utils.randomNumber(-(radius), radius));
_arg1.lifeTime = Utils.randomNumber(minParticleLife, maxParticleLife);
_arg1.spin = Utils.randomNumber(minSpin, maxSpin);
_arg1.gravityY = Utils.randomNumber(minGravityY, maxGravityY);
_arg1.acceleration = Utils.randomNumber(minAcceleration, maxAcceleration);
_arg1.tangAcceleration = Utils.randomNumber(minTangAcceleration, maxTangAcceleration);
_arg1.startColor = startColor;
_arg1.midColor = midColor;
_arg1.endColor = endColor;
_arg1.startScaleX = startScaleX;
_arg1.startScaleY = startScaleY;
_arg1.midScaleX = midScaleX;
_arg1.midScaleY = midScaleY;
_arg1.endScaleX = endScaleX;
_arg1.endScaleY = endScaleY;
_arg1.bitmapData = particleBitmapData;
var _local3:Number = (direction + Utils.randomNumber((-(angle) / 2), (angle / 2)));
_local3 = (_local3 * Utils.DEG_TO_RAD);
var _local4:Number = Utils.randomNumber(minVelocity, maxVelocity);
_arg1.velocity.x = (Math.sin(_local3) * _local4);
_arg1.velocity.y = (Math.cos(_local3) * _local4);
}
public function loadFromObject(_arg1:Object):void{
var _local2:String;
for (_local2 in _arg1) {
if ((((((_local2 == "startColor")) || ((_local2 == "midColor")))) || ((_local2 == "endColor")))){
this[_local2] = Color4.HexToARGB(_arg1[_local2]);
} else {
this[_local2] = _arg1[_local2];
};
};
}
public function clone():EmitterSettings{
var _local1:EmitterSettings = new EmitterSettings();
_local1.name = name;
_local1.capacity = capacity;
_local1.direction = direction;
_local1.angle = angle;
_local1.emissionRate = emissionRate;
_local1.blendMode = blendMode;
_local1.lifeTime = lifeTime;
_local1.imageName = imgName;
_local1.radius = radius;
_local1.moveWithEmmiter = moveWithEmmiter;
_local1.middle = middle;
_local1.minAcceleration = minAcceleration;
_local1.maxAcceleration = maxAcceleration;
_local1.minGravityY = minGravityY;
_local1.maxGravityY = maxGravityY;
_local1.minParticleLife = minParticleLife;
_local1.maxParticleLife = maxParticleLife;
_local1.minVelocity = minVelocity;
_local1.maxVelocity = maxVelocity;
_local1.minTangAcceleration = minTangAcceleration;
_local1.maxTangAcceleration = maxTangAcceleration;
_local1.minSpin = minSpin;
_local1.maxSpin = maxSpin;
_local1.startColor = startColor.clone();
_local1.midColor = midColor.clone();
_local1.endColor = endColor.clone();
_local1.startScaleX = startScaleX;
_local1.startScaleY = startScaleY;
_local1.midScaleX = midScaleX;
_local1.midScaleY = midScaleY;
_local1.endScaleX = endScaleX;
_local1.endScaleY = endScaleY;
return (_local1);
}
public function toString():String{
var _local1 = "{ ";
_local1 = (_local1 + (("name: \"" + name) + "\""));
_local1 = (_local1 + (", emissionRate: " + emissionRate));
_local1 = (_local1 + (", capacity: " + capacity));
_local1 = (_local1 + (", lifeTime: " + lifeTime));
_local1 = (_local1 + (", angle: " + angle));
_local1 = (_local1 + (", direction: " + direction));
_local1 = (_local1 + ((", imageName: \"" + imgName) + "\""));
_local1 = (_local1 + ((", blendMode: \"" + blendMode) + "\""));
_local1 = (_local1 + (", radius: " + radius));
_local1 = (_local1 + (", moveWithEmmiter: " + int(moveWithEmmiter)));
_local1 = (_local1 + (", middle: " + middle));
_local1 = (_local1 + (", minParticleLife: " + minParticleLife));
_local1 = (_local1 + (", maxParticleLife: " + maxParticleLife));
_local1 = (_local1 + (", minSpin: " + minSpin));
_local1 = (_local1 + (", maxSpin: " + maxSpin));
_local1 = (_local1 + (", minVelocity: " + minVelocity));
_local1 = (_local1 + (", maxVelocity: " + maxVelocity));
_local1 = (_local1 + (", minGravityY: " + minGravityY));
_local1 = (_local1 + (", maxGravityY: " + maxGravityY));
_local1 = (_local1 + (", minAcceleration: " + minAcceleration));
_local1 = (_local1 + (", maxAcceleration: " + maxAcceleration));
_local1 = (_local1 + (", minTangAcceleration: " + minTangAcceleration));
_local1 = (_local1 + (", maxTangAcceleration: " + maxTangAcceleration));
_local1 = (_local1 + (", startScaleX: " + startScaleX));
_local1 = (_local1 + (", startScaleY: " + startScaleY));
_local1 = (_local1 + (", midScaleX: " + midScaleX));
_local1 = (_local1 + (", midScaleY: " + midScaleY));
_local1 = (_local1 + (", endScaleX: " + endScaleX));
_local1 = (_local1 + (", endScaleY: " + endScaleY));
_local1 = (_local1 + (", startColor: " + startColor.toHex()));
_local1 = (_local1 + (", midColor: " + midColor.toHex()));
_local1 = (_local1 + (", endColor: " + endColor.toHex()));
_local1 = (_local1 + " }");
return (_local1);
}
}
}//package dgparticles
Section 134
//Particle (dgparticles.Particle)
package dgparticles {
import flash.display.*;
import flash.geom.*;
import fl.motion.*;
public class Particle {
private var smoothing:Boolean;
public var emitter:Emitter;
public var position:Point;
public var velocity:Point;
public var gravityY:int;
public var acceleration:int;
public var tangAcceleration:int;
public var spin:int;
public var lifeTime:Number;
public var bitmapData:BitmapData;
public var bounds:Rectangle;
public var startColor;
public var midColor;
public var endColor:Color4;
public var startScaleX;
public var midScaleX;
public var endScaleX:Number;
public var startScaleY;
public var midScaleY;
public var endScaleY:Number;
private var dColorA;
private var dColorR;
private var dColorG;
private var dColorB:Number;
private var dScaleX:Number;
private var dScaleY:Number;
private var scaleX:Number;
private var scaleY:Number;
private var timeSinceStart:uint;
private var matrix:Matrix;
private var colorTransform:ColorTransform;
private var middleTime:Number;
private var afterMiddleTime:Boolean;
private var colorAlpha:Number;
private var centerPoint:Point;
public var destRect:Rectangle;
private var accelVec:Point;
private var accelVec2:Point;
private var rct:Rectangle;
public function Particle(){
position = new Point();
velocity = new Point();
bounds = new Rectangle();
matrix = new Matrix();
colorTransform = new ColorTransform(0, 0, 0, 1);
centerPoint = new Point();
destRect = new Rectangle();
accelVec = new Point();
accelVec2 = new Point();
rct = new Rectangle();
super();
}
public function initialize(_arg1:Emitter):void{
smoothing = ParticleSystem.smoothing;
this.emitter = _arg1;
centerPoint.x = (bitmapData.width / 2);
centerPoint.y = (bitmapData.height / 2);
timeSinceStart = 0;
middleTime = ((lifeTime * _arg1.settings.middle) / 100);
afterMiddleTime = false;
calcDeltaParameters();
scaleX = startScaleX;
scaleY = startScaleY;
colorAlpha = startColor.a;
colorTransform.redOffset = startColor.r;
colorTransform.greenOffset = startColor.g;
colorTransform.blueOffset = startColor.b;
}
public function update(_arg1:Number):Boolean{
timeSinceStart = (timeSinceStart + _arg1);
if (timeSinceStart > lifeTime){
return (true);
};
if (emitter.settings.moveWithEmmiter){
position.x = (position.x - emitter.deltaMove.x);
position.y = (position.y - emitter.deltaMove.y);
};
if (((!(afterMiddleTime)) && ((timeSinceStart >= middleTime)))){
afterMiddleTime = true;
calcDeltaParameters();
};
var _local2:Number = (_arg1 / 1000);
accelVec.x = (position.x - emitter.position.x);
accelVec.y = (position.y - emitter.position.y);
accelVec.normalize(1);
accelVec2.x = -(accelVec.y);
accelVec2.y = accelVec.x;
accelVec.x = (accelVec.x * acceleration);
accelVec.y = (accelVec.y * acceleration);
accelVec2.x = (accelVec2.x * tangAcceleration);
accelVec2.y = (accelVec2.y * tangAcceleration);
velocity.x = (velocity.x + ((accelVec.x + accelVec2.x) * _local2));
velocity.y = (velocity.y + (((accelVec.y + accelVec2.y) + gravityY) * _local2));
position.x = (position.x + (velocity.x * _local2));
position.y = (position.y + (velocity.y * _local2));
scaleX = (scaleX + (dScaleX * _arg1));
scaleY = (scaleY + (dScaleY * _arg1));
matrix.identity();
matrix.scale(scaleX, scaleY);
matrix.translate((position.x - (centerPoint.x * scaleX)), (position.y - (centerPoint.y * scaleY)));
bounds.x = matrix.tx;
bounds.y = matrix.ty;
bounds.width = (bitmapData.width * scaleX);
bounds.height = (bitmapData.height * scaleY);
MatrixTransformer.rotateAroundInternalPoint(matrix, centerPoint.x, centerPoint.y, ((spin * timeSinceStart) / 1000));
colorAlpha = (colorAlpha + (dColorA * _arg1));
colorTransform.alphaMultiplier = (colorAlpha / 0xFF);
colorTransform.redOffset = (colorTransform.redOffset + (dColorR * _arg1));
colorTransform.greenOffset = (colorTransform.greenOffset + (dColorG * _arg1));
colorTransform.blueOffset = (colorTransform.blueOffset + (dColorB * _arg1));
destRect.x = (bounds.x + 1);
destRect.y = (bounds.y + 1);
destRect.width = (bounds.width - 2);
destRect.height = (bounds.height - 2);
return (false);
}
private function calcDeltaParameters():void{
var _local1:Number = (afterMiddleTime) ? (lifeTime - middleTime) : middleTime;
dScaleX = (afterMiddleTime) ? (endScaleX - midScaleX) : (midScaleX - startScaleX);
dScaleY = (afterMiddleTime) ? (endScaleY - midScaleY) : (midScaleY - startScaleY);
dScaleX = (dScaleX / _local1);
dScaleY = (dScaleY / _local1);
var _local2:Color4 = (afterMiddleTime) ? Color4.substructColors(endColor, midColor) : Color4.substructColors(midColor, startColor);
dColorA = (_local2.a / _local1);
dColorR = (_local2.r / _local1);
dColorG = (_local2.g / _local1);
dColorB = (_local2.b / _local1);
}
public function draw(_arg1:BitmapData):void{
if (spin != 0){
_arg1.draw(bitmapData, matrix, colorTransform, emitter.settings.blendMode, null, smoothing);
} else {
_arg1.draw(bitmapData, matrix, colorTransform, emitter.settings.blendMode, destRect, smoothing);
};
}
}
}//package dgparticles
Section 135
//ParticleSystem (dgparticles.ParticleSystem)
package dgparticles {
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
public class ParticleSystem {
public var capacity:int;// = 2000
private var bitmapLayer:BitmapLayer;
private var freeParticles:Array;
private var activeParticles:Array;
private var emitters:Array;
private var emSettings:Array;
public var enabled:Boolean;// = true
private var lastTime:Number;
public static var smoothing:Boolean = true;
public function ParticleSystem(_arg1:BitmapLayer){
freeParticles = new Array();
activeParticles = new Array();
emitters = new Array();
emSettings = new Array();
lastTime = getTimer();
super();
this.bitmapLayer = _arg1;
_arg1.addEventListener(Event.ENTER_FRAME, updateAndDraw);
}
public function get parcticlesCount():int{
return (activeParticles.length);
}
public function get emittersCount():int{
return (emitters.length);
}
public function addSettings(_arg1:EmitterSettings):void{
emSettings.push(_arg1);
}
public function addSettingsByObject(_arg1:Object):void{
var _local2:EmitterSettings = new EmitterSettings();
_local2.loadFromObject(_arg1);
emSettings.push(_local2);
}
public function createEmmiter(_arg1:String, _arg2:Point):Emitter{
var _local3:Emitter = new Emitter(this);
_local3.settings = getSettingsByName(_arg1).clone();
_local3.position = _arg2;
emitters.push(_local3);
return (_local3);
}
public function killEmmiter(_arg1:Emitter):void{
var _local2:int;
while (_local2 < emitters.length) {
if (emitters[_local2] == _arg1){
emitters.splice(_local2, 1);
return;
};
_local2++;
};
}
public function killAllEmmiters():void{
emitters.splice(0, emitters.length);
}
public function getSettingsByName(_arg1:String):EmitterSettings{
var _local2:int;
while (_local2 < emSettings.length) {
if ((emSettings[_local2] as EmitterSettings).name == _arg1){
return ((emSettings[_local2] as EmitterSettings));
};
_local2++;
};
return (null);
}
public function createParticle():Particle{
var _local1:Particle;
if (freeParticles.length > 0){
_local1 = (freeParticles.pop() as Particle);
} else {
_local1 = new Particle();
};
activeParticles.push(_local1);
return (_local1);
}
private function updateAndDraw(_arg1:Event):void{
var _local2:Number = getTimer();
var _local3:Number = (_local2 - lastTime);
lastTime = _local2;
if (!enabled){
return;
};
update(_local3);
draw();
}
private function update(_arg1:Number):void{
var _local3:Particle;
var _local2:int = (emitters.length - 1);
while (_local2 >= 0) {
if (emitters[_local2].update(_arg1)){
emitters.splice(_local2, 1);
};
_local2--;
};
bitmapLayer.refreshX1 = bitmapLayer.width;
bitmapLayer.refreshY1 = bitmapLayer.height;
bitmapLayer.refreshX2 = 0;
bitmapLayer.refreshY2 = 0;
_local2 = (activeParticles.length - 1);
while (_local2 >= 0) {
_local3 = (activeParticles[_local2] as Particle);
if (_local3.destRect.x < bitmapLayer.refreshX1){
bitmapLayer.refreshX1 = _local3.destRect.x;
};
if (_local3.destRect.y < bitmapLayer.refreshY1){
bitmapLayer.refreshY1 = _local3.destRect.y;
};
if (_local3.destRect.right > bitmapLayer.refreshX2){
bitmapLayer.refreshX2 = _local3.destRect.right;
};
if (_local3.destRect.bottom > bitmapLayer.refreshY2){
bitmapLayer.refreshY2 = _local3.destRect.bottom;
};
if (((_local3.update(_arg1)) || (!(bitmapLayer.bounds.intersects(_local3.bounds))))){
activeParticles.splice(_local2, 1);
freeParticles.push(_local3);
};
_local2--;
};
}
private function draw():void{
bitmapLayer.clear();
var _local1:int;
while (_local1 < activeParticles.length) {
activeParticles[_local1].draw(bitmapLayer.bitmapData);
_local1++;
};
}
public function dispose():void{
bitmapLayer.removeEventListener(Event.ENTER_FRAME, updateAndDraw);
}
}
}//package dgparticles
Section 136
//Utils (dgparticles.Utils)
package dgparticles {
public class Utils {
public static const DEG_TO_RAD = 0.0174532925199433;
public static function randomInt(_arg1, _arg2:int):int{
return ((_arg1 + int((Math.random() * (_arg2 - _arg1)))));
}
public static function randomNumber(_arg1, _arg2:Number):Number{
return ((_arg1 + (Math.random() * (_arg2 - _arg1))));
}
}
}//package dgparticles
Section 137
//MatrixTransformer (fl.motion.MatrixTransformer)
package fl.motion {
import flash.geom.*;
public class MatrixTransformer {
public static function getScaleX(_arg1:Matrix):Number{
return (Math.sqrt(((_arg1.a * _arg1.a) + (_arg1.b * _arg1.b))));
}
public static function setScaleX(_arg1:Matrix, _arg2:Number):void{
var _local4:Number;
var _local5:Number;
var _local3:Number = getScaleX(_arg1);
if (_local3){
_local4 = (_arg2 / _local3);
_arg1.a = (_arg1.a * _local4);
_arg1.b = (_arg1.b * _local4);
} else {
_local5 = getSkewYRadians(_arg1);
_arg1.a = (Math.cos(_local5) * _arg2);
_arg1.b = (Math.sin(_local5) * _arg2);
};
}
public static function getScaleY(_arg1:Matrix):Number{
return (Math.sqrt(((_arg1.c * _arg1.c) + (_arg1.d * _arg1.d))));
}
public static function setScaleY(_arg1:Matrix, _arg2:Number):void{
var _local4:Number;
var _local5:Number;
var _local3:Number = getScaleY(_arg1);
if (_local3){
_local4 = (_arg2 / _local3);
_arg1.c = (_arg1.c * _local4);
_arg1.d = (_arg1.d * _local4);
} else {
_local5 = getSkewXRadians(_arg1);
_arg1.c = (-(Math.sin(_local5)) * _arg2);
_arg1.d = (Math.cos(_local5) * _arg2);
};
}
public static function getSkewXRadians(_arg1:Matrix):Number{
return (Math.atan2(-(_arg1.c), _arg1.d));
}
public static function setSkewXRadians(_arg1:Matrix, _arg2:Number):void{
var _local3:Number = getScaleY(_arg1);
_arg1.c = (-(_local3) * Math.sin(_arg2));
_arg1.d = (_local3 * Math.cos(_arg2));
}
public static function getSkewYRadians(_arg1:Matrix):Number{
return (Math.atan2(_arg1.b, _arg1.a));
}
public static function setSkewYRadians(_arg1:Matrix, _arg2:Number):void{
var _local3:Number = getScaleX(_arg1);
_arg1.a = (_local3 * Math.cos(_arg2));
_arg1.b = (_local3 * Math.sin(_arg2));
}
public static function getSkewX(_arg1:Matrix):Number{
return ((Math.atan2(-(_arg1.c), _arg1.d) * (180 / Math.PI)));
}
public static function setSkewX(_arg1:Matrix, _arg2:Number):void{
setSkewXRadians(_arg1, (_arg2 * (Math.PI / 180)));
}
public static function getSkewY(_arg1:Matrix):Number{
return ((Math.atan2(_arg1.b, _arg1.a) * (180 / Math.PI)));
}
public static function setSkewY(_arg1:Matrix, _arg2:Number):void{
setSkewYRadians(_arg1, (_arg2 * (Math.PI / 180)));
}
public static function getRotationRadians(_arg1:Matrix):Number{
return (getSkewYRadians(_arg1));
}
public static function setRotationRadians(_arg1:Matrix, _arg2:Number):void{
var _local3:Number = getRotationRadians(_arg1);
var _local4:Number = getSkewXRadians(_arg1);
setSkewXRadians(_arg1, ((_local4 + _arg2) - _local3));
setSkewYRadians(_arg1, _arg2);
}
public static function getRotation(_arg1:Matrix):Number{
return ((getRotationRadians(_arg1) * (180 / Math.PI)));
}
public static function setRotation(_arg1:Matrix, _arg2:Number):void{
setRotationRadians(_arg1, (_arg2 * (Math.PI / 180)));
}
public static function rotateAroundInternalPoint(_arg1:Matrix, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Point = new Point(_arg2, _arg3);
_local5 = _arg1.transformPoint(_local5);
_arg1.tx = (_arg1.tx - _local5.x);
_arg1.ty = (_arg1.ty - _local5.y);
_arg1.rotate((_arg4 * (Math.PI / 180)));
_arg1.tx = (_arg1.tx + _local5.x);
_arg1.ty = (_arg1.ty + _local5.y);
}
public static function rotateAroundExternalPoint(_arg1:Matrix, _arg2:Number, _arg3:Number, _arg4:Number):void{
_arg1.tx = (_arg1.tx - _arg2);
_arg1.ty = (_arg1.ty - _arg3);
_arg1.rotate((_arg4 * (Math.PI / 180)));
_arg1.tx = (_arg1.tx + _arg2);
_arg1.ty = (_arg1.ty + _arg3);
}
public static function matchInternalPointWithExternal(_arg1:Matrix, _arg2:Point, _arg3:Point):void{
var _local4:Point = _arg1.transformPoint(_arg2);
var _local5:Number = (_arg3.x - _local4.x);
var _local6:Number = (_arg3.y - _local4.y);
_arg1.tx = (_arg1.tx + _local5);
_arg1.ty = (_arg1.ty + _local6);
}
}
}//package fl.motion
Section 138
//Log (Playtomic.Log)
package Playtomic {
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.external.*;
public final class Log {
private static const PingF:Timer = new Timer(60000);
private static const PingR:Timer = new Timer(30000);
public static var Enabled:Boolean = false;
public static var Queue:Boolean = true;
public static var SWFID:int = 0;
public static var GUID:String = "";
public static var SourceUrl:String;
public static var BaseUrl:String;
public static var Cookie:SharedObject;
public static var Request:LogRequest;
private static var FirstPing:Boolean = true;
private static var Pings:int = 0;
private static var Plays:int = 0;
private static var HighestGoal:int = 0;
private static var Frozen:Boolean = false;
private static var FrozenQueue:Array = new Array();
private static var Customs:Array = new Array();
private static var LevelCounters:Array = new Array();
private static var LevelAverages:Array = new Array();
private static var LevelRangeds:Array = new Array();
public static function View(_arg1:int=0, _arg2:String="", _arg3:String=""):void{
if (SWFID > 0){
return;
};
SWFID = _arg1;
GUID = _arg2;
Enabled = true;
if ((((SWFID == 0)) || ((GUID == "")))){
Enabled = false;
return;
};
if (((((!((_arg3.indexOf("http://") == 0))) && (!((Security.sandboxType == "localWithNetwork"))))) && (!((Security.sandboxType == "localTrusted"))))){
Enabled = false;
return;
};
SourceUrl = GetUrl(_arg3);
if ((((((SourceUrl == null)) || ((SourceUrl == "")))) || ((SourceUrl.indexOf("https://") == 0)))){
Enabled = false;
return;
};
Security.allowDomain((("http://g" + Log.GUID) + ".api.playtomic.com/"));
Security.allowInsecureDomain((("http://g" + Log.GUID) + ".api.playtomic.com/"));
Security.loadPolicyFile((("http://g" + Log.GUID) + ".api.playtomic.com/crossdomain.xml"));
Request = LogRequest.Create();
Cookie = SharedObject.getLocal("playtomic");
var _local4:int = GetCookie("views");
Send(("v/" + (_local4 + 1)), true);
PingF.addEventListener(TimerEvent.TIMER, PingServer);
PingF.start();
}
public static function IncreaseViews():void{
var _local1:int = GetCookie("views");
_local1++;
SaveCookie("views", _local1);
}
public static function IncreasePlays():void{
Plays++;
}
public static function Play():void{
if (!Enabled){
return;
};
LevelCounters = new Array();
LevelAverages = new Array();
LevelRangeds = new Array();
Send(("p/" + (Plays + 1)), true);
}
private static function PingServer(... _args):void{
if (!Enabled){
return;
};
Pings++;
Send(((("t/" + (FirstPing) ? "y" : "n") + "/") + Pings), true);
if (FirstPing){
PingF.stop();
PingR.addEventListener(TimerEvent.TIMER, PingServer);
PingR.start();
FirstPing = false;
};
}
public static function CustomMetric(_arg1:String, _arg2:String=null, _arg3:Boolean=false):void{
if (!Enabled){
return;
};
if (_arg2 == null){
_arg2 = "";
};
if (_arg3){
if (Customs.indexOf(_arg1) > -1){
return;
};
Customs.push(_arg1);
};
Send(((("c/" + Clean(_arg1)) + "/") + Clean(_arg2)));
}
public static function LevelCounterMetric(_arg1:String, _arg2, _arg3:Boolean=false):void{
if (!Enabled){
return;
};
if (_arg3){
if (LevelCounters.indexOf(_arg1) > -1){
return;
};
LevelCounters.push(_arg1);
};
Send(((("lc/" + Clean(_arg1)) + "/") + Clean(_arg2)));
}
public static function LevelRangedMetric(_arg1:String, _arg2, _arg3:int, _arg4:Boolean=false):void{
if (!Enabled){
return;
};
if (_arg4){
if (LevelRangeds.indexOf(_arg1) > -1){
return;
};
LevelRangeds.push(_arg1);
};
Send(((((("lr/" + Clean(_arg1)) + "/") + Clean(_arg2)) + "/") + _arg3));
}
public static function LevelAverageMetric(_arg1:String, _arg2, _arg3:int, _arg4:Boolean=false):void{
if (!Enabled){
return;
};
if (_arg4){
if (LevelAverages.indexOf(_arg1) > -1){
return;
};
LevelAverages.push(_arg1);
};
Send(((((("la/" + Clean(_arg1)) + "/") + Clean(_arg2)) + "/") + _arg3));
}
public static function Link(_arg1:String, _arg2:String, _arg3:String, _arg4:int, _arg5:int, _arg6:int):void{
if (!Enabled){
return;
};
Send(((((((((((("l/" + Clean(_arg2)) + "/") + Clean(_arg3)) + "/") + Clean(_arg1)) + "/") + _arg4) + "/") + _arg5) + "/") + _arg6));
}
public static function Freeze():void{
Frozen = true;
}
public static function UnFreeze():void{
Frozen = false;
Request.MassQueue(FrozenQueue);
}
public static function ForceSend():void{
if (!Enabled){
return;
};
Request.Send();
Request = LogRequest.Create();
if (FrozenQueue.length > 0){
Request.MassQueue(FrozenQueue);
};
}
private static function Send(_arg1:String, _arg2:Boolean=false):void{
if (Frozen){
FrozenQueue.push(_arg1);
return;
};
Request.Queue(_arg1);
if (((((Request.Ready) || (_arg2))) || (!(Queue)))){
Request.Send();
Request = LogRequest.Create();
};
}
private static function Clean(_arg1:String):String{
while (_arg1.indexOf("/") > -1) {
_arg1 = _arg1.replace("/", "\\");
};
while (_arg1.indexOf("~") > -1) {
_arg1 = _arg1.replace("~", "-");
};
return (escape(_arg1));
}
private static function GetCookie(_arg1:String):int{
if (Cookie.data[_arg1] == undefined){
return (0);
};
return (int(Cookie.data[_arg1]));
}
private static function SaveCookie(_arg1:String, _arg2:int):void{
var _local3:SharedObject = SharedObject.getLocal("swfstats");
_local3.data[_arg1] = _arg2.toString();
_local3.flush();
}
private static function GetUrl(_arg1:String):String{
var url:String;
var defaulturl = _arg1;
if (ExternalInterface.available){
try {
url = String(ExternalInterface.call("window.location.href.toString"));
} catch(s:Error) {
url = defaulturl;
};
} else {
if ((((defaulturl.indexOf("http://") == 0)) || ((defaulturl.indexOf("https://") == 0)))){
url = defaulturl;
};
};
if ((((((url == null)) || ((url == "")))) || ((url == "null")))){
if ((((Security.sandboxType == "localWithNetwork")) || ((Security.sandboxType == "localTrusted")))){
url = "http://local-testing/";
} else {
url = null;
};
};
return (escape(url));
}
}
}//package Playtomic
Section 139
//LogRequest (Playtomic.LogRequest)
package Playtomic {
import flash.events.*;
import flash.net.*;
public final class LogRequest {
private var Sender:URLLoader;
private var Target:URLRequest;
private var Data:String;// = ""
private var BaseUrl:String;
public var Ready:Boolean;// = false
private static var Failed:int = 0;
private static var Pool:Array = new Array();
public function LogRequest(){
this.Sender = new URLLoader();
this.Sender.addEventListener(Event.COMPLETE, this.Complete, false, 1, false);
this.Sender.addEventListener(IOErrorEvent.IO_ERROR, this.IOErrorHandler, false, 0, true);
this.Sender.addEventListener(HTTPStatusEvent.HTTP_STATUS, this.StatusChange, false, 0, true);
this.Sender.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.SecurityErrorHandler, false, 0, true);
this.Target = new URLRequest();
this.BaseUrl = ((("http://g" + Log.GUID) + ".api.playtomic.com/tracker/q.aspx?swfid=") + Log.SWFID);
}
public function MassQueue(_arg1:Array):void{
var _local3:LogRequest;
if (Failed > 3){
return;
};
var _local2:int = (_arg1.length - 1);
while (_local2 > -1) {
this.Data = (this.Data + (((this.Data == "")) ? "" : "~" + _arg1[_local2]));
_arg1.splice(_local2, 1);
if (this.Data.length > 300){
_local3 = Create();
_local3.MassQueue(_arg1);
this.Ready = true;
this.Send();
return;
};
_local2--;
};
Log.Request = this;
}
public function Queue(_arg1:String):void{
if (Failed > 3){
return;
};
this.Data = (this.Data + (((this.Data == "")) ? "" : "~" + _arg1));
if (this.Data.length > 300){
this.Ready = true;
};
}
public function Send():void{
this.Target.url = (((((((this.BaseUrl + "&q=") + this.Data) + "&url=") + Log.SourceUrl) + "&") + Math.random()) + "z");
this.Sender.load(this.Target);
}
private function Complete(_arg1:Event=null):void{
if ((((this.Data.indexOf("v/") == 0)) || ((this.Data.indexOf("~v/") > -1)))){
Log.IncreaseViews();
};
if ((((this.Data.indexOf("p/") == 0)) || ((this.Data.indexOf("~p/") > -1)))){
Log.IncreasePlays();
};
Pool.push(this);
}
private function IOErrorHandler(_arg1:IOErrorEvent):void{
Failed++;
}
private function SecurityErrorHandler(_arg1:SecurityErrorEvent):void{
}
private function StatusChange(_arg1:HTTPStatusEvent):void{
}
public static function Create():LogRequest{
var _local1:LogRequest = ((Pool.length > 0)) ? (Pool.pop() as LogRequest) : new (LogRequest);
_local1.Data = "";
_local1.Ready = false;
return (_local1);
}
}
}//package Playtomic
Section 140
//Aaaa2wav (Aaaa2wav)
package {
import flash.media.*;
public dynamic class Aaaa2wav extends Sound {
}
}//package
Section 141
//Acceleration (Acceleration)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import Box2D.Common.Math.*;
public class Acceleration extends BasePhysicsObject {
private var speedUpVel:Number;// = 10
private var collisionObjects:Array;
public function Acceleration(){
collisionObjects = new Array();
super();
}
public function addObj(_arg1:BasePhysicsObject):void{
if (collisionObjects.indexOf(_arg1) == -1){
collisionObjects.push(_arg1);
};
}
public function removeObj(_arg1:BasePhysicsObject):void{
collisionObjects.splice(collisionObjects.indexOf(_arg1), 1);
}
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
super.initialize(_arg1, _arg2, _arg3);
_arg2.GetFixtureList().SetSensor(true);
if (_arg3.name.indexOf("left") > -1){
speedUpVel = (speedUpVel * -1);
};
_arg3.getChildByName("roll1").rotation = Utilites.randomNumber(0, 360);
_arg3.getChildByName("roll2").rotation = Utilites.randomNumber(0, 360);
_arg3.getChildByName("roll3").rotation = Utilites.randomNumber(0, 360);
_arg3.getChildByName("roll4").rotation = Utilites.randomNumber(0, 360);
}
override public function update():void{
var _local3:b2Body;
var _local4:b2Vec2;
var _local1:int;
while (_local1 < collisionObjects.length) {
_local3 = collisionObjects[_local1].body;
_local4 = _local3.GetLinearVelocity();
_local4.x = speedUpVel;
_local3.SetLinearVelocity(_local4);
_local1++;
};
var _local2:Number = 20;
if (speedUpVel < 0){
_local2 = (_local2 * -1);
};
costume.getChildByName("roll1").rotation = (costume.getChildByName("roll1").rotation + _local2);
costume.getChildByName("roll2").rotation = (costume.getChildByName("roll2").rotation + _local2);
costume.getChildByName("roll3").rotation = (costume.getChildByName("roll3").rotation + _local2);
costume.getChildByName("roll4").rotation = (costume.getChildByName("roll4").rotation + _local2);
}
}
}//package
Section 142
//AutoRemoveObject (AutoRemoveObject)
package {
import Box2D.Dynamics.*;
import flash.display.*;
public class AutoRemoveObject extends BasePhysicsObject {
public var lifeTime:Number;
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
super.initialize(_arg1, _arg2, _arg3);
}
override public function update():void{
super.update();
lifeTime--;
if (lifeTime < 0){
costume.alpha = (costume.alpha - 0.05);
};
if (costume.alpha <= 0){
level.safeRemovePhysObject(this);
};
}
}
}//package
Section 143
//BasePhysicsObject (BasePhysicsObject)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import flash.geom.*;
import Box2D.Common.Math.*;
public class BasePhysicsObject {
public var body:b2Body;
public var costume:Sprite;
protected var level:Level;
public var name:String;// = ""
public var prevVel:b2Vec2;
public var isCostumeMain:Boolean;// = false
public var posInMovieClip:Point;
protected var isRresumeAnimation:Boolean;// = false
public function BasePhysicsObject(){
prevVel = new b2Vec2();
posInMovieClip = Utilites.ZERO_POINT;
super();
}
public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
this.level = _arg1;
this.body = _arg2;
this.costume = _arg3;
_arg2.SetUserData(this);
}
public function stopAnimation():void{
}
public function resumeAnimation():void{
}
public function setFilter(_arg1:b2FilterData):void{
var _local2:b2Fixture = body.GetFixtureList();
while (_local2) {
_local2.SetFilterData(_arg1);
_local2 = _local2.GetNext();
};
}
public function update():void{
var _local1:b2Vec2;
var _local2:Number;
var _local3:Point;
if (!body){
return;
};
prevVel.x = body.GetLinearVelocity().x;
prevVel.y = body.GetLinearVelocity().y;
if (!isCostumeMain){
_local1 = body.GetPosition();
costume.x = (_local1.x * Level.RATIO);
costume.y = (_local1.y * Level.RATIO);
_local2 = body.GetAngle();
if ((((_local2 < (-(Math.PI) * 2))) || ((_local2 > (Math.PI * 2))))){
_local2 = (_local2 % (Math.PI * 2));
};
costume.rotation = (_local2 / Level.RAD_TO_DEG);
} else {
_local3 = costume.localToGlobal(posInMovieClip);
_local1 = new b2Vec2((_local3.x / Level.RATIO), (_local3.y / Level.RATIO));
_local2 = Box2DParser.getSpriteRot(costume);
body.SetAngle(_local2);
body.SetPosition(_local1);
};
}
public function dispose():void{
if (((costume) && (costume.parent))){
costume.parent.removeChild(costume);
};
if (body){
body.GetWorld().DestroyBody(body);
};
}
public function destroyBody():void{
if (body){
body.GetWorld().DestroyBody(body);
body = null;
};
}
}
}//package
Section 144
//Bomb (Bomb)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import flash.text.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
public class Bomb extends BasePhysicsObject {
private const burnSec:int = 4;
private const expRad:Number;
private const expForce:Number = 100;
private var state:int;// = 1
private var animState:int;// = 0
private var prevAnimState:int;// = 0
private var fromCannon:Boolean;// = true
private var upDown:Boolean;
private var bottomFix:b2Fixture;
private var fuseFix:b2Fixture;
private var fusePos:b2Vec2;
private var flyPower:Number;// = 1
private var isFuseBurning;// = false
private var fuseTimer:int;
private var w:Number;
private var h:Number;
private var dy:Number;
private var tmp:b2Vec2;
private var cost:MovieClip;
private var txtTimer:TextField;
private var curSound:DGSound;
private var silentTime:int;// = 0
public function Bomb(){
expRad = (100 / Level.RATIO);
dy = (5 / Level.RATIO);
tmp = new b2Vec2();
super();
}
private function get normalCost():MovieClip{
return ((cost.getChildByName("cost_normal") as MovieClip));
}
private function get burnCostRun():MovieClip{
return ((cost.getChildByName("cost_burn_run") as MovieClip));
}
private function get burnCostIdle():MovieClip{
return ((cost.getChildByName("cost_burn_idle") as MovieClip));
}
private function get burnCostJump():MovieClip{
return ((cost.getChildByName("cost_burn_jump") as MovieClip));
}
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
_arg3 = new BombCostume();
cost = (_arg3.getChildByName("cost") as MovieClip);
txtTimer = (_arg3.getChildByName("txtTimer") as TextField);
txtTimer.text = "";
var _local4:Number = (_arg3.x / Level.RATIO);
var _local5:Number = ((_arg3.y + 5) / Level.RATIO);
w = (8 / Level.RATIO);
h = (16 / Level.RATIO);
_arg2 = Box2DParser.createBox(w, h, new b2Vec2(_local4, _local5), 0, b2Body.b2_dynamicBody, 0, 0, 0, 0, dy);
bottomFix = _arg2.GetFixtureList();
bottomFix.SetFilterData(_arg1.bombFilter);
fusePos = new b2Vec2((-15 / Level.RATIO), (-17 / Level.RATIO));
fuseFix = Box2DParser.createCircleFixture(_arg2, (8 / Level.RATIO), fusePos.x, fusePos.y);
fuseFix.SetSensor(true);
fuseFix.SetUserData("fuse");
var _local6:b2MassData = new b2MassData();
_local6.mass = 10;
_arg2.SetMassData(_local6);
_arg2.SetLinearDamping(1);
_arg2.SetUserData(this);
super.initialize(_arg1, _arg2, _arg3);
}
public function setOnFire():void{
if (isFuseBurning){
return;
};
isFuseBurning = true;
fuseTimer = (burnSec * costume.stage.frameRate);
}
override public function update():void{
var _local7:Boolean;
super.update();
body.SetAwake(true);
body.SetBullet(true);
if (costume.transform.pixelBounds.top > (Level.LEVEL_HEIGHT + 100)){
level.safeRemovePhysObject(this);
return;
};
if (((((!((level.state == GameState.GAME))) && (!((level.state == GameState.LEVEL_COMPLETE))))) && (!((level.state == GameState.GAME_OVER))))){
stopCurSound();
normalCost.stop();
return;
};
if (isFuseBurning){
fuseTimer--;
txtTimer.text = (Math.floor((fuseTimer / costume.stage.frameRate)) + 1).toString();
if (fuseTimer <= 0){
explode();
return;
};
};
var _local1:Number = body.GetPosition().x;
var _local2:Number = (((body.GetPosition().y + dy) + h) + (1 / Level.RATIO));
var _local3:b2Body = Utilites.getBodyAtPoint(level.world, _local1, _local2, true);
var _local4:b2Body = Utilites.getBodyAtPoint(level.world, (_local1 - w), _local2, true);
var _local5:b2Body = Utilites.getBodyAtPoint(level.world, (_local1 + w), _local2, true);
state = (((((_local3) || (_local4))) || (_local5))) ? 0 : 1;
if (((fromCannon) && ((state == 0)))){
fromCannon = false;
};
var _local6:b2Vec2 = body.GetLinearVelocity();
if (!fromCannon){
if (((Input.isKeyDown(39)) || (Input.isKeyDown(68)))){
_local6.x = Utilites.clamp(_local6.x, 5, 9999);
if (state == 1){
_local6.x = (_local6.x * flyPower);
};
};
if (((Input.isKeyDown(37)) || (Input.isKeyDown(65)))){
_local6.x = Utilites.clamp(_local6.x, -9999, -5);
if (state == 1){
_local6.x = (_local6.x * flyPower);
};
};
};
if (Math.abs(_local6.x) < 0.5){
animState = (isFuseBurning) ? 3 : 0;
} else {
if (_local6.x > 0){
animState = (isFuseBurning) ? 4 : 1;
cost.scaleX = 1;
tmp.x = fusePos.x;
tmp.y = fusePos.y;
b2CircleShape(fuseFix.GetShape()).SetLocalPosition(tmp);
} else {
if (_local6.x < 0){
animState = (isFuseBurning) ? 4 : 1;
cost.scaleX = -1;
tmp.x = -(fusePos.x);
tmp.y = fusePos.y;
b2CircleShape(fuseFix.GetShape()).SetLocalPosition(tmp);
};
};
};
body.SetLinearVelocity(_local6);
if (state == 0){
bottomFix.SetDensity(1);
bottomFix.SetRestitution(0.1);
bottomFix.SetFriction(1);
_local7 = ((((((_local3) && (!((_local3.GetUserData() is Spring))))) || (((_local4) && (!((_local4.GetUserData() is Spring))))))) || (((_local5) && (!((_local5.GetUserData() is Spring))))));
if (((_local7) && (((((Input.isKeyDown(38)) || (Input.isKeyDown(87)))) || (Input.isKeyDown(32)))))){
if (!upDown){
upDown = true;
flyPower = 1;
state = 1;
body.SetLinearVelocity(new b2Vec2(0, -10));
};
} else {
upDown = false;
};
};
if (state == 1){
if (!isFuseBurning){
animState = 2;
} else {
if (animState == 3){
animState = 5;
} else {
animState = 6;
};
};
bottomFix.SetDensity(0);
bottomFix.SetRestitution(0);
bottomFix.SetFriction(0);
};
updateSound();
updateAnimation();
}
private function updateSound():void{
if (animState < 3){
if (animState == 0){
stopCurSound();
};
if (animState == 1){
if (((((curSound) && (curSound.played))) || (!((prevAnimState == 1))))){
stopCurSound();
curSound = SoundManager.playOnce("nyawav", 0.7);
};
};
};
if (animState >= 3){
if (prevAnimState < 3){
stopCurSound();
curSound = SoundManager.playOnce("Aaaa2wav", 0.6);
};
if (animState == 3){
if (((curSound.played) || (!((prevAnimState == 3))))){
stopCurSound();
curSound = SoundManager.playOnce("whatwav", 0.9);
};
};
if (animState == 4){
if (((curSound.played) || ((prevAnimState == 3)))){
stopCurSound();
curSound = SoundManager.playOnce("helpwav", 0.9);
};
};
};
}
private function stopCurSound():void{
if (curSound){
curSound.stop();
};
}
private function updateAnimation():void{
var _local1:MovieClip;
var _local2:int;
switch (animState){
case 0:
normalCost.gotoAndStop("walk_stop");
break;
case 1:
if (prevAnimState != 1){
normalCost.gotoAndPlay("walk_and_jump");
};
break;
case 2:
normalCost.gotoAndStop("walk_and_jump");
break;
case 3:
if (prevAnimState != 3){
normalCost.gotoAndPlay("burn_idle");
};
break;
case 4:
if (prevAnimState != 4){
normalCost.gotoAndPlay("burn_run");
};
break;
case 5:
normalCost.gotoAndStop("burn_idle_jump");
break;
case 6:
normalCost.gotoAndStop("burn_jump");
break;
};
if (isFuseBurning){
_local1 = (normalCost.getChildByName("fuse") as MovieClip);
if (_local1){
_local2 = ((1 - (fuseTimer / (burnSec * costume.stage.frameRate))) * _local1.totalFrames);
_local1.gotoAndStop(_local2);
};
};
prevAnimState = animState;
}
public function explode(){
var makeBoom:Function;
makeBoom = function (_arg1:b2Fixture):Boolean{
var _local2:b2Body = _arg1.GetBody();
var _local3:BasePhysicsObject = _local2.GetUserData();
if (((level.currentLevel.hasOwnProperty("checkExplode")) && (!(level.currentLevel.checkExplode(body.GetUserData(), _local3))))){
return (true);
};
var _local4:Number = expForce;
if (!_local3){
return (true);
};
if (_local3.costume.name == "yadro"){
_local4 = (_local4 * 1.5);
_local3.body.SetBullet(true);
};
if ((_local3 is Rope)){
Rope(_local3).breakRope();
};
if (((!((_local3 == this))) && ((_local3 is Dynamite)))){
Dynamite(_local3).setOnFire();
};
if (_local3.costume.name.indexOf("wood") > -1){
WoodObject(_local3).explode(body.GetPosition());
return (true);
};
if ((_local3 is Zombie)){
Zombie(_local3).explode(body.GetPosition());
return (true);
};
var _local5:b2DistanceOutput = new b2DistanceOutput();
var _local6:b2SimplexCache = new b2SimplexCache();
var _local7:b2DistanceInput = new b2DistanceInput();
_local7.proxyA = new b2DistanceProxy();
_local7.proxyA.Set(body.GetFixtureList().GetNext().GetShape());
_local7.transformA = body.GetTransform();
_local7.proxyB = new b2DistanceProxy();
_local7.proxyB.Set(_arg1.GetShape());
_local7.transformB = _local2.GetTransform();
b2Distance.Distance(_local5, _local6, _local7);
var _local8:b2Vec2 = _local5.pointA;
var _local9:b2Vec2 = new b2Vec2((_local5.pointB.x - _local8.x), (_local5.pointB.y - _local8.y));
var _local10:Number = _local5.distance;
var _local11:Number = (((expRad - _local10) / expRad) * _local4);
_local9.Normalize();
_local9.Multiply(_local11);
_local2.SetAwake(true);
_local2.ApplyImpulse(_local9, _local5.pointB);
return (true);
};
stopCurSound();
SoundManager.playOnce("ExpSmall2wav", 0.3);
var explode:MovieClip = new Explode();
explode.x = costume.x;
explode.y = costume.y;
level.currentLevel.addChild(explode);
var circle:b2CircleShape = new b2CircleShape(expRad);
circle.SetLocalPosition(body.GetWorldCenter());
level.world.QueryShape(makeBoom, circle);
level.safeRemovePhysObject(this);
fuseFix.GetBody().GetUserData();
}
override public function dispose():void{
stopCurSound();
level.aliveBombs--;
super.dispose();
}
}
}//package
Section 145
//bomba4ki_ingamemp3 (bomba4ki_ingamemp3)
package {
import flash.media.*;
public dynamic class bomba4ki_ingamemp3 extends Sound {
}
}//package
Section 146
//bomba4ki_menuwav (bomba4ki_menuwav)
package {
import flash.media.*;
public dynamic class bomba4ki_menuwav extends Sound {
}
}//package
Section 147
//BombCostume (BombCostume)
package {
import flash.display.*;
import flash.text.*;
public dynamic class BombCostume extends MovieClip {
public var cost:MovieClip;
public var txtTimer:TextField;
}
}//package
Section 148
//Box2DParser (Box2DParser)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import flash.geom.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
public class Box2DParser {
private static var world:b2World;
public static function parse(_arg1:MovieClip, _arg2:Level):void{
var _local3:Number;
var _local4:Number;
var _local9:DisplayObject;
var _local10:Sprite;
var _local11:Sprite;
var _local12:Boolean;
var _local13:int;
var _local14:b2Vec2;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:b2Body;
var _local19:BasePhysicsObject;
var _local20:int;
var _local21:Sprite;
var _local22:Point;
var _local23:Sprite;
var _local24:Number;
var _local25:Number;
var _local26:int;
var _local27:b2FilterData;
if (_arg1.bombsCount != undefined){
_arg2.bombsCount = parseInt(_arg1.bombsCount.text);
} else {
throw ("не найден текстфилд с именем bombsCount");
};
world = _arg2.world;
_local3 = Level.RATIO;
_local4 = (_local3 * 2);
var _local5:Number = 0;
var _local6:Array = new Array();
var _local7:Array = ["zombie", "cannon", "spring", "acceleration", "button", "water", "rope", "candle", "torch", "lightcup_fire", "dynamite", "dynamite_static", "dynamite_dynamic"];
var _local8:int = (_arg1.numChildren - 1);
for (;_local8 >= 0;_local8--) {
_local9 = _arg1.getChildAt(_local8);
if (!(_local9 is Sprite)){
_local9.cacheAsBitmap = true;
} else {
_local10 = (_local9 as Sprite);
_local11 = _local10;
if (_local10.name.indexOf("joint") > -1){
_local6.push(_local10);
} else {
_local12 = true;
_local13 = 0;
while (_local13 < _local7.length) {
if (_local10.name.indexOf(_local7[_local13]) > -1){
_local12 = false;
break;
};
_local13++;
};
if (_local12){
_local10 = (createRastFromVector(_local10) as Sprite);
_local11 = (_arg1.removeChildAt(_local8) as Sprite);
_arg1.addChildAt(_local10, _local8);
};
_local14 = new b2Vec2((_local10.x / _local3), (_local10.y / _local3));
_local15 = _local10.rotation;
_local10.rotation = 0;
_local16 = (_local10.width / _local4);
_local17 = (_local10.height / _local4);
_local10.rotation = _local15;
_local15 = (_local15 / Level.DEG_TO_RAD);
_local18 = null;
_local19 = new BasePhysicsObject();
if (_local10.name.indexOf("cannon") > -1){
_local20 = (parseInt(_local10.name.substr(6)) - 1);
_arg2.cannons[_local20] = MovieClip(_local10);
} else {
if (_local10.name.indexOf("button") > -1){
_local18 = createCircle((_local17 * 1.5), _local14, _local15, b2Body.b2_dynamicBody, 2, 0, 0);
_local19 = new GameButton();
} else {
if (_local10.name.indexOf("spikes") > -1){
if (_local10.name.indexOf("dynamic") > -1){
_local18 = createBox(_local16, _local17, _local14, _local15, b2Body.b2_dynamicBody, 4, 0, 0.5);
} else {
_local18 = createBox(_local16, (_local17 / 2), _local14, _local15, b2Body.b2_staticBody);
};
} else {
if (_local10.name.indexOf("zombie") > -1){
_local19 = new Zombie();
_local18 = Zombie(_local19).createBody(_local10);
} else {
if (_local10.name.indexOf("circle_saw") > -1){
_local18 = createCircle(_local16, _local14, _local15, b2Body.b2_staticBody);
_local19 = new CircleSaw();
} else {
if (((!((_local10.name == "platform_path"))) && ((_local10.name.indexOf("platform") > -1)))){
_local18 = createBox(_local16, _local17, _local14, _local15);
_local19 = new Platform();
} else {
if (_local10.name.indexOf("spring") > -1){
_local19 = new Spring();
_local21 = (_local10.getChildByName("top") as Sprite);
_local10.localToGlobal(new Point(_local21.x, _local21.y));
_local22 = _local10.localToGlobal(new Point(_local21.x, _local21.y));
_local14.x = (_local22.x / _local3);
_local14.y = (_local22.y / _local3);
_local18 = createBox(_local16, ((_local21.height * _local10.scaleY) / _local4), _local14, _local15, b2Body.b2_dynamicBody, 0.3, 0, 10);
} else {
if (_local10.name.indexOf("acceleration") > -1){
_local18 = createBox(_local16, _local17, _local14, _local15, b2Body.b2_staticBody);
_local19 = new Acceleration();
} else {
if (_local10.name.indexOf("dynamite") > -1){
_local19 = new Dynamite();
_local23 = (createRastFromVector(_local10["body"]) as Sprite);
_local10.removeChild(_local10["body"]);
_local10.addChild(_local23);
_local24 = ((_local23.width - 4) / _local4);
_local25 = ((_local23.height - 4) / _local4);
_local26 = ((_local10.name.indexOf("static") > -1)) ? b2Body.b2_staticBody : b2Body.b2_dynamicBody;
_local18 = createBox(_local24, _local25, _local14, _local15, _local26, 2, 0, 0.5);
addPhysObject(_arg2, _local19, _local18, _local10);
_local18 = null;
continue;
} else {
if (_local10.name.indexOf("box_static_invisible") > -1){
_local18 = createBox(_local16, _local17, _local14, _local15);
_local10.visible = false;
} else {
if (_local10.name.indexOf("box_dynamic") > -1){
_local18 = createBox(_local16, _local17, _local14, _local15, b2Body.b2_dynamicBody, 4, 0, 0.5);
_local27 = _local18.GetFixtureList().GetFilterData();
} else {
if (_local10.name.indexOf("box_static") > -1){
_local18 = createBox(_local16, _local17, _local14, _local15);
};
};
};
};
};
};
};
};
};
};
};
};
if (_local10.name.indexOf("wood") > -1){
_local19 = new WoodObject();
WoodObject(_local19).originScaleX = _local11.scaleX;
WoodObject(_local19).originScaleY = _local11.scaleY;
};
switch (_local10.name){
case "rope":
_local18 = createBox(_local16, _local17, _local14, _local15, b2Body.b2_dynamicBody, 15, 0, 0.5);
_local19 = new Rope();
break;
case "yadro":
_local18 = createCircle(_local16, _local14, _local15, b2Body.b2_dynamicBody, 2, 0, 0.5);
break;
case "slow_down":
_local18 = createBox(_local16, _local17, _local14, _local15, b2Body.b2_staticBody);
_local19 = new SlowDown();
break;
case "water":
_local16 = ((400 * _local10.scaleX) / _local4);
_local17 = ((20 * _local10.scaleY) / _local4);
_local14.y = (((_local10.y - (_local10.height / 2)) + (3 * _local10.scaleY)) / _local3);
_local18 = createBox(_local16, _local17, _local14, 0);
_local19 = new Water();
break;
case "circle_dynamic":
_local18 = createCircle(_local16, _local14, _local15, b2Body.b2_dynamicBody, 2, 0, 0.5);
break;
case "circle_static":
_local18 = createCircle(_local16, _local14, _local15);
break;
case "candle":
_local5 = (10 / Level.RATIO);
_local18 = createCircle(_local5, _local14, _local15, b2Body.b2_staticBody, 2, 0, 0.5);
_local19 = new Fire();
_local19.isCostumeMain = true;
_local19.name = "fire";
break;
case "lightcup":
_local18 = createBox(_local16, _local17, _local14, _local15, b2Body.b2_dynamicBody, 2, 0, 0.5);
_local18.GetFixtureList().SetSensor(true);
break;
case "lightcup_fire":
_local18 = createBox(_local16, _local17, _local14, _local15, b2Body.b2_dynamicBody, 2, 0, 0.5);
_local19 = new Fire();
_local10.visible = false;
break;
case "torch":
_local5 = (10 / Level.RATIO);
_local18 = createCircle(_local5, _local14, _local15, b2Body.b2_staticBody, 2, 0, 0.5);
_local19 = new Fire();
_local19.isCostumeMain = true;
_local19.name = "fire";
break;
};
if (_local18 != null){
addPhysObject(_arg2, _local19, _local18, _local10);
};
};
};
};
_local8 = 0;
while (_local8 < _local6.length) {
if (_local6[_local8].name.indexOf("revolute_joint") > -1){
createRevoluteJoint(_arg2, _local6[_local8], world);
};
_local8++;
};
}
public static function createRastFromVector(_arg1:DisplayObject):DisplayObject{
if ((((_arg1.width == 0)) || ((_arg1.height == 0)))){
return (_arg1);
};
var _local2 = (_arg1.name == "bg");
var _local3:Number = _arg1.rotation;
var _local4:Number = _arg1.x;
var _local5:Number = _arg1.y;
_arg1.rotation = 0;
_arg1.x = 0;
_arg1.y = 0;
var _local6:Matrix = _arg1.transform.matrix.clone();
var _local7:Rectangle = _arg1.getRect(_arg1.parent);
if (_local2){
if (_local7.x < 0){
_local7.x = 0;
};
if (_local7.y < 0){
_local7.y = 0;
};
if (_local7.right > Level.LEVEL_WIDTH){
_local7.right = Level.LEVEL_WIDTH;
};
if ((_local5 + _local7.height) > Level.LEVEL_HEIGHT){
_local7.height = (Level.LEVEL_HEIGHT - _local5);
};
if (_local4 < 0){
_local7.x = (_local7.x - _local4);
};
if (_local5 < 0){
_local7.y = (_local7.y - _local5);
};
};
_local6.translate(-(_local7.left), -(_local7.top));
var _local8:BitmapData = new BitmapData(_local7.width, _local7.height, true, 0);
_local8.draw(_arg1, _local6, _arg1.transform.colorTransform);
var _local9:Bitmap = new Bitmap(_local8, "auto", !(_local2));
_local9.x = _local7.left;
_local9.y = _local7.top;
var _local10:Sprite = new Sprite();
_local10.addChild(_local9);
_local10.name = _arg1.name;
_local10.blendMode = _arg1.blendMode;
_local10.filters = _arg1.filters;
_local10.rotation = _local3;
_local10.x = _local4;
_local10.y = _local5;
return (_local10);
}
public static function createBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2, _arg4:Number, _arg5:uint=0, _arg6:Number=0, _arg7:Number=0, _arg8:Number=0.5, _arg9:Number=0, _arg10:Number=0):b2Body{
var _local11:b2PolygonShape = new b2PolygonShape();
_local11.SetAsOrientedBox(_arg1, _arg2, new b2Vec2(_arg9, _arg10), 0);
var _local12:b2FixtureDef = new b2FixtureDef();
_local12.shape = _local11;
_local12.density = _arg6;
_local12.restitution = _arg7;
_local12.friction = _arg8;
var _local13:b2BodyDef = new b2BodyDef();
_local13.type = _arg5;
_local13.position.SetV(_arg3);
var _local14:b2Body = world.CreateBody(_local13);
_local14.SetAngle(_arg4);
_local14.CreateFixture(_local12);
return (_local14);
}
public static function createBoxByCostume(_arg1:Sprite, _arg2:uint=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0.2):b2Body{
var _local6:Number = Level.RATIO;
var _local7:Number = (_local6 * 2);
var _local8:Point = _arg1.localToGlobal(new Point());
var _local9:b2Vec2 = new b2Vec2((_local8.x / _local6), (_local8.y / _local6));
var _local10:Number = _arg1.rotation;
_arg1.rotation = 0;
var _local11:Number = (_arg1.width / _local7);
var _local12:Number = (_arg1.height / _local7);
_arg1.rotation = _local10;
_local10 = (_local10 / Level.DEG_TO_RAD);
if (_arg1.parent){
_local11 = (_local11 * _arg1.parent.scaleX);
_local12 = (_local12 * _arg1.parent.scaleY);
};
return (createBox(_local11, _local12, _local9, _local10, b2Body.b2_dynamicBody, 2, 0, 0.5));
}
public static function createBoxFixture(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6:Number=0, _arg7:Number=0, _arg8:Number=0.2, _arg9:Number=0):b2Fixture{
var _local10:b2PolygonShape = new b2PolygonShape();
_local10.SetAsOrientedBox(_arg2, _arg3, new b2Vec2(_arg4, _arg5), _arg9);
var _local11:b2FixtureDef = new b2FixtureDef();
_local11.shape = _local10;
_local11.density = _arg6;
_local11.restitution = _arg7;
_local11.friction = _arg8;
return (_arg1.CreateFixture(_local11));
}
public static function createCircleByCostume(_arg1:Sprite, _arg2:uint=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0.2):b2Body{
var _local6:Number = Level.RATIO;
var _local7:Number = (_local6 * 2);
var _local8:b2Vec2 = new b2Vec2((_arg1.x / _local6), (_arg1.y / _local6));
var _local9:Number = _arg1.rotation;
_arg1.rotation = 0;
var _local10:Number = (_arg1.height / _local7);
if (_arg1.parent){
_local10 = (_local10 * _arg1.parent.scaleY);
};
_arg1.rotation = _local9;
_local9 = (_local9 / Level.DEG_TO_RAD);
return (createCircle(_local10, _local8, _local9, b2Body.b2_dynamicBody, 2, 0, 0.5));
}
public static function createCircleFixture(_arg1, _arg2, _arg3, _arg4, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0.2, _arg8:Number=0):b2Fixture{
var _local9:b2CircleShape = new b2CircleShape(_arg2);
_local9.SetLocalPosition(new b2Vec2(_arg3, _arg4));
var _local10:b2FixtureDef = new b2FixtureDef();
_local10.shape = _local9;
_local10.density = _arg5;
_local10.restitution = _arg6;
_local10.friction = _arg7;
return (_arg1.CreateFixture(_local10));
}
private static function createRevoluteJoint(_arg1:Level, _arg2:Sprite, _arg3:b2World):void{
var bodyA:b2Body;
var bodyB:b2Body;
var join:Function;
var speedStr:String;
var speed:Number;
var level = _arg1;
var mcJoint = _arg2;
var world = _arg3;
join = function (_arg1:b2Fixture):Boolean{
if (!bodyA){
bodyA = _arg1.GetBody();
} else {
if (!bodyB){
bodyB = _arg1.GetBody();
} else {
trace("Внимание! Рядом с соединением найден треий объект!");
};
};
return (true);
};
var parent:Sprite = (mcJoint.parent as Sprite);
var jointPos:b2Vec2 = new b2Vec2((mcJoint.x / Level.RATIO), (mcJoint.y / Level.RATIO));
var hasLimit = (mcJoint.name.indexOf("fix") > -1);
var hasMotor = (mcJoint.name.indexOf("motor") > -1);
var withGround = (mcJoint.name.indexOf("ground") > -1);
bodyA = null;
bodyB = null;
world.QueryPoint(join, jointPos);
if (!bodyA){
throw (((("не найдены объекты для соединения " + mcJoint.x) + ";") + mcJoint.y));
};
if (((!(bodyB)) || (withGround))){
bodyB = world.GetGroundBody();
};
var jointDef2:b2RevoluteJointDef = new b2RevoluteJointDef();
jointDef2.Initialize(bodyA, bodyB, jointPos);
if (hasLimit){
jointDef2.enableLimit = true;
};
if (hasMotor){
speedStr = mcJoint.name.substring((mcJoint.name.lastIndexOf("_") + 1));
speed = 0;
if (speedStr.indexOf("m") == -1){
speed = int(speedStr);
} else {
speed = -(int(speedStr.substring(1)));
};
jointDef2.enableMotor = true;
jointDef2.motorSpeed = speed;
jointDef2.maxMotorTorque = 9999999;
};
if ((((bodyA.GetUserData() is Rope)) && ((bodyB.GetUserData() is Rope)))){
jointDef2.enableLimit = true;
jointDef2.lowerAngle = (-(Math.PI) / 4);
jointDef2.upperAngle = (Math.PI / 4);
jointDef2.referenceAngle = 0;
};
world.CreateJoint(jointDef2);
parent.removeChild(mcJoint);
}
public static function createCircle(_arg1:Number, _arg2:b2Vec2, _arg3:Number=0, _arg4:uint=0, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0.2):b2Body{
var _local8:b2CircleShape = new b2CircleShape(_arg1);
var _local9:b2FixtureDef = new b2FixtureDef();
_local9.shape = _local8;
_local9.density = _arg5;
_local9.restitution = _arg6;
_local9.friction = _arg7;
var _local10:b2BodyDef = new b2BodyDef();
_local10.type = _arg4;
_local10.position.SetV(_arg2);
var _local11:b2Body = world.CreateBody(_local10);
_local11.SetAngle(_arg3);
_local11.CreateFixture(_local9);
return (_local11);
}
public static function addPhysObject(_arg1:Level, _arg2:BasePhysicsObject, _arg3:b2Body, _arg4:Sprite):void{
_arg1.physObjects.push(_arg2);
_arg2.initialize(_arg1, _arg3, _arg4);
}
public static function getSpritePos(_arg1:Sprite):b2Vec2{
var _local2:Point = _arg1.localToGlobal(Utilites.ZERO_POINT);
return (new b2Vec2((_local2.x / Level.RATIO), (_local2.y / Level.RATIO)));
}
public static function getSpriteRot(_arg1:Sprite):Number{
var _local2:Point = _arg1.localToGlobal(Utilites.ZERO_POINT);
var _local3:Point = _arg1.localToGlobal(new Point(0, -100));
return (Math.atan2((_local2.x - _local3.x), (_local2.y - _local3.y)));
}
}
}//package
Section 149
//CircleSaw (CircleSaw)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import flash.geom.*;
import Box2D.Common.Math.*;
public class CircleSaw extends BasePhysicsObject {
private var dirX:int;// = 1
private var dirY:int;// = 0
private var speed:Number;// = 3
private var pos:b2Vec2;
private var moveBounds:Rectangle;
public function CircleSaw(){
pos = new b2Vec2();
super();
}
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
super.initialize(_arg1, _arg2, _arg3);
if (_arg3.name.indexOf("vertical") != -1){
dirX = 0;
dirY = 1;
};
}
public function init():void{
var _local3:DisplayObject;
var _local4:Rectangle;
var _local1:Rectangle = costume.getRect(level.currentLevel);
var _local2:int;
while (_local2 < level.currentLevel.numChildren) {
_local3 = level.currentLevel.getChildAt(_local2);
if (_local3.name == "saw_path"){
_local4 = _local3.getRect(level.currentLevel);
if (_local1.intersects(_local4)){
moveBounds = _local4.clone();
level.currentLevel.removeChild(_local3);
return;
};
};
_local2++;
};
throw (((("не найден путь для пилы " + costume.x) + ", ") + costume.y));
}
override public function update():void{
costume.x = (costume.x + (dirX * speed));
costume.y = (costume.y + (dirY * speed));
pos.x = (costume.x / Level.RATIO);
pos.y = (costume.y / Level.RATIO);
body.SetPosition(pos);
costume.rotation = (costume.rotation + 7);
var _local1:Rectangle = costume.transform.pixelBounds;
if ((((dirX == 1)) && ((_local1.right > moveBounds.right)))){
dirX = -1;
};
if ((((dirX == -1)) && ((_local1.left < moveBounds.left)))){
dirX = 1;
};
if ((((dirY == 1)) && ((_local1.bottom > moveBounds.bottom)))){
dirY = -1;
};
if ((((dirY == -1)) && ((_local1.top < moveBounds.top)))){
dirY = 1;
};
}
}
}//package
Section 150
//Cloud1 (Cloud1)
package {
import flash.display.*;
public dynamic class Cloud1 extends MovieClip {
}
}//package
Section 151
//Cloud2 (Cloud2)
package {
import flash.display.*;
public dynamic class Cloud2 extends MovieClip {
}
}//package
Section 152
//Clouds (Clouds)
package {
import flash.display.*;
public class Clouds {
private var level:Level;
private var clouds:Array;
private var maxCount:Number;// = 15
public function Clouds(_arg1:Level){
clouds = new Array();
super();
this.level = _arg1;
}
public function createSky(){
var _local4:int;
while (clouds.length > 0) {
removeCloud(clouds[0]);
};
var _local1:Number = 0;
var _local2:Number = 0;
var _local3:int;
while (_local3 < 5) {
_local4 = 0;
while (_local4 < 3) {
_local1 = ((_local3 * 140) + Utilites.randomNumber(-30, 30));
_local2 = ((40 + (_local4 * 80)) + Utilites.randomNumber(-20, 20));
createCloud(_local1, _local2);
_local4++;
};
_local3++;
};
}
private function createCloud(_arg1:Number, _arg2:Number){
var _local3:MovieClip;
var _local4:int = Utilites.randomInt(1, 2);
if (_local4 == 1){
_local3 = new Cloud1();
};
if (_local4 == 2){
_local3 = new Cloud2();
};
_local3.alpha = 0.4;
var _local5:Number = ((1 - (_arg2 / 300)) + Utilites.randomNumber(0, 0.3));
_local3.scaleX = _local5;
_local3.scaleY = _local5;
_local3.x = _arg1;
_local3.y = _arg2;
_local3.speedX = ((0.6 - (_arg2 / 400)) + Utilites.randomNumber(-0.1, 0.1));
_local3.speedX = Utilites.clamp(_local3.speedX, 0.2, 0.5);
_local3.speedX = (1 / int((1 / _local3.speedX)));
_local3.alpha = (0.4 - (_arg2 / 700));
clouds.push(_local3);
level.currentLevel.addChildAt(_local3, 1);
}
private function getCloudY():Number{
var _local5:MovieClip;
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
while (_local4 < clouds.length) {
_local5 = clouds[_local4];
if (_local5.y <= 60){
_local1++;
} else {
if (_local5.y <= 140){
_local2++;
} else {
if (_local5.y <= 220){
_local3++;
};
};
};
_local4++;
};
if (_local3 < 5){
return (((40 + (2 * 80)) + Utilites.randomNumber(-20, 20)));
};
if (_local2 < 5){
return (((40 + (1 * 80)) + Utilites.randomNumber(-20, 20)));
};
return ((40 + Utilites.randomNumber(-20, 20)));
}
public function update():void{
var _local2:MovieClip;
var _local3:Number;
var _local4:Number;
if (level.state == GameState.PAUSE){
return;
};
var _local1:int = (clouds.length - 1);
while (_local1 >= 0) {
_local2 = clouds[_local1];
_local2.x = (_local2.x + _local2.speedX);
if (_local2.transform.pixelBounds.left > Level.LEVEL_WIDTH){
removeCloud(_local2);
};
_local1--;
};
if (clouds.length < maxCount){
_local3 = -50;
_local4 = getCloudY();
createCloud(_local3, _local4);
};
}
private function removeCloud(_arg1:MovieClip):void{
_arg1.parent.removeChild(_arg1);
clouds.splice(clouds.indexOf(_arg1), 1);
}
}
}//package
Section 153
//ContactListener (ContactListener)
package {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class ContactListener extends b2ContactListener {
private var level:Level;
public function ContactListener(_arg1:Level){
this.level = _arg1;
}
override public function PreSolve(_arg1:b2Contact, _arg2:b2Manifold):void{
super.PreSolve(_arg1, _arg2);
}
override public function BeginContact(_arg1:b2Contact):void{
var _local9:Bomb;
super.BeginContact(_arg1);
var _local2:BasePhysicsObject = _arg1.GetFixtureA().GetBody().GetUserData();
var _local3:BasePhysicsObject = _arg1.GetFixtureB().GetBody().GetUserData();
var _local4:Acceleration = (getObjByClass(_local2, _local3, Acceleration) as Acceleration);
if (_local4){
if (_local4 == _local2){
_local4.addObj(_local3);
};
if (_local4 == _local3){
_local4.addObj(_local2);
};
return;
};
var _local5:SlowDown = (getObjByClass(_local2, _local3, SlowDown) as SlowDown);
if (_local5){
if (_local5 == _local2){
_local5.addObj(_local3);
};
if (_local5 == _local3){
_local5.addObj(_local2);
};
return;
};
var _local6:Spring = (getObjByClass(_local2, _local3, Spring) as Spring);
if (_local6){
if (_local6 == _local2){
_local6.addObj(_local3);
};
if (_local6 == _local3){
_local6.addObj(_local2);
};
return;
};
var _local7:CircleSaw = (getObjByClass(_local2, _local3, CircleSaw) as CircleSaw);
if (_local7){
_local9 = (getObjByClass(_local2, _local3, Bomb) as Bomb);
if (((((_local9) && (!(_arg1.GetFixtureA().IsSensor())))) && (!(_arg1.GetFixtureB().IsSensor())))){
_local9.explode();
};
return;
};
var _local8:Fire = (getObjByClass(_local2, _local3, Fire) as Fire);
if (((_local8) && (_local8.alive))){
if ((((_arg1.GetFixtureA().GetUserData() == "fuse")) || ((_arg1.GetFixtureB().GetUserData() == "fuse")))){
_local9 = (getObjByClass(_local2, _local3, Bomb) as Bomb);
_local9.setOnFire();
};
};
if (((((!((_local2 == null))) && ((_local2.costume.name.indexOf("spikes") > -1)))) || (((!((_local3 == null))) && ((_local3.costume.name.indexOf("spikes") > -1)))))){
_local9 = (getObjByClass(_local2, _local3, Bomb) as Bomb);
if (_local9){
_local9.explode();
};
};
}
override public function EndContact(_arg1:b2Contact):void{
super.EndContact(_arg1);
var _local2:BasePhysicsObject = _arg1.GetFixtureA().GetBody().GetUserData();
var _local3:BasePhysicsObject = _arg1.GetFixtureB().GetBody().GetUserData();
var _local4:Acceleration = (getObjByClass(_local2, _local3, Acceleration) as Acceleration);
if (_local4){
if (_local4 == _local2){
_local4.removeObj(_local3);
};
if (_local4 == _local3){
_local4.removeObj(_local2);
};
return;
};
var _local5:SlowDown = (getObjByClass(_local2, _local3, SlowDown) as SlowDown);
if (_local5){
if (_local5 == _local2){
_local5.removeObj(_local3);
};
if (_local5 == _local3){
_local5.removeObj(_local2);
};
return;
};
var _local6:Spring = (getObjByClass(_local2, _local3, Spring) as Spring);
if (_local6){
if (_local6 == _local2){
_local6.removeObj(_local3);
};
if (_local6 == _local3){
_local6.removeObj(_local2);
};
return;
};
}
override public function PostSolve(_arg1:b2Contact, _arg2:b2ContactImpulse):void{
var _local7:Number;
var _local8:int;
var _local9:BasePhysicsObject;
var _local10:b2Vec2;
super.PostSolve(_arg1, _arg2);
var _local3:BasePhysicsObject = _arg1.GetFixtureA().GetBody().GetUserData();
var _local4:BasePhysicsObject = _arg1.GetFixtureB().GetBody().GetUserData();
var _local5:Bomb = (getObjByClass(_local3, _local4, Bomb) as Bomb);
var _local6:Zombie = (getObjByClass(_local3, _local4, Zombie) as Zombie);
if (((_local6) && (!(_local5)))){
_local7 = 0;
_local8 = 0;
while (_local8 < _arg2.normalImpulses.length) {
_local7 = b2Math.Max(_local7, _arg2.normalImpulses[_local8]);
_local8++;
};
if (_local7 > 70){
trace(("impulse = " + _local7));
_local9 = ((_local3 is Zombie)) ? _local4 : _local3;
if ((((_local9.costume.name == "yadro")) || ((_local7 > 140)))){
_local9.body.SetBullet(true);
_local6.hit(_local9.prevVel);
_local10 = _local9.prevVel.Copy();
_local10.Multiply(0.5);
_local9.body.SetLinearVelocity(_local9.prevVel);
};
};
};
}
private function isCostName(_arg1:BasePhysicsObject, _arg2:BasePhysicsObject, _arg3:String):Boolean{
return (((((!((_arg1 == null))) && ((_arg1.costume.name == _arg3)))) || (((!((_arg2 == null))) && ((_arg2.costume.name == _arg3))))));
}
private function getObjByCostName(_arg1:BasePhysicsObject, _arg2:BasePhysicsObject, _arg3:String):BasePhysicsObject{
if (_arg1.costume.name == _arg3){
return (_arg1);
};
if (_arg2.costume.name == _arg3){
return (_arg2);
};
return (null);
}
private function getObjByClass(_arg1:BasePhysicsObject, _arg2:BasePhysicsObject, _arg3:Class):BasePhysicsObject{
if ((_arg1 is _arg3)){
return (_arg1);
};
if ((_arg2 is _arg3)){
return (_arg2);
};
return (null);
}
}
}//package
Section 154
//Debug (Debug)
package {
import flash.display.*;
import flash.text.*;
public class Debug {
private static var txt:TextField;
private static var initialized:Boolean = false;
public static function initialize(_arg1:Stage){
initialized = true;
txt = new TextField();
_arg1.addChild(txt);
txt.y = 100;
txt.autoSize = TextFieldAutoSize.LEFT;
txt.defaultTextFormat = new TextFormat("Tahoma", 14, 0xFFFFFF);
}
public static function add(_arg1:String):void{
if (!initialized){
return;
};
txt.appendText((_arg1 + "\n"));
}
}
}//package
Section 155
//DGSound (DGSound)
package {
import flash.events.*;
import flash.media.*;
public class DGSound {
public var sound:Sound;
private var channel:SoundChannel;
private var volume:Number;// = 1
private var position:Number;// = 0
public var loops:int;// = 1
public var played:Boolean;
public var name:String;
public function DGSound(_arg1:Sound, _arg2:String){
this.sound = _arg1;
this.name = _arg2;
}
public function get vol():Number{
return (channel.soundTransform.volume);
}
public function set vol(_arg1:Number):void{
channel.soundTransform = new SoundTransform(_arg1);
}
public function get transform():SoundTransform{
return (channel.soundTransform);
}
public function set transform(_arg1:SoundTransform):void{
channel.soundTransform = _arg1;
}
public function play(_arg1:int, _arg2:Number, _arg3:Number):void{
this.volume = _arg2;
this.loops = _arg1;
channel = sound.play(position, _arg1, new SoundTransform(_arg3));
channel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
played = false;
}
private function soundCompleteHandler(_arg1:Event):void{
channel.removeEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
played = true;
}
public function stop():void{
if (channel != null){
channel.stop();
channel.removeEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
};
position = 0;
loops = -1;
played = true;
}
public function pause():void{
position = channel.position;
channel.stop();
channel.removeEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
}
public function restoreVolume():void{
vol = volume;
}
public function resume():void{
if ((((position >= sound.length)) || ((loops > 1)))){
position = 0;
};
channel = sound.play(position, loops, new SoundTransform(volume));
channel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
}
}
}//package
Section 156
//Dynamite (Dynamite)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
public class Dynamite extends BasePhysicsObject {
private var expRad:Number;
private var expForce:Number;// = 100
public var fuseFixture:b2Fixture;
private var isFuseBurning:Boolean;// = false
public function Dynamite(){
expRad = (100 / Level.RATIO);
super();
}
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
super.initialize(_arg1, _arg2, _arg3);
var _local4:MovieClip = (_arg3.getChildByName("fuse") as MovieClip);
var _local5:b2PolygonShape = new b2PolygonShape();
_local5.SetAsOrientedBox(((_local4.width / Level.RATIO) / 2), (1 / Level.RATIO), new b2Vec2((_local4.x / Level.RATIO), (_local4.y / Level.RATIO)));
fuseFixture = _arg2.CreateFixture2(_local5);
fuseFixture.SetUserData("fuse");
_local4.stop();
}
override public function stopAnimation():void{
costume["fuse"].stop();
}
override public function resumeAnimation():void{
if (isFuseBurning){
costume["fuse"].play();
};
}
override public function update():void{
super.update();
var _local1:MovieClip = costume["fuse"];
if (_local1.currentFrame == _local1.totalFrames){
explode();
};
}
public function setOnFire(){
isFuseBurning = true;
costume["fuse"].play();
fuseFixture.SetSensor(true);
}
public function explode(){
var makeBoom:Function;
var explode:MovieClip;
makeBoom = function (_arg1:b2Fixture):Boolean{
var _local2:b2Body = _arg1.GetBody();
if ((_local2.GetUserData() is Fire)){
_local2.GetUserData().killFire();
};
var _local3:BasePhysicsObject = _local2.GetUserData();
if (((!((_local3 == this))) && ((_local3 is Dynamite)))){
Dynamite(_local3).setOnFire();
};
var _local4:b2DistanceOutput = new b2DistanceOutput();
var _local5:b2SimplexCache = new b2SimplexCache();
var _local6:b2DistanceInput = new b2DistanceInput();
_local6.proxyA = new b2DistanceProxy();
_local6.proxyA.Set(body.GetFixtureList().GetNext().GetShape());
_local6.transformA = body.GetTransform();
_local6.proxyB = new b2DistanceProxy();
_local6.proxyB.Set(_arg1.GetShape());
_local6.transformB = _local2.GetTransform();
b2Distance.Distance(_local4, _local5, _local6);
var _local7:b2Vec2 = _local4.pointA;
var _local8:b2Vec2 = new b2Vec2((_local4.pointB.x - _local7.x), (_local4.pointB.y - _local7.y));
var _local9:Number = _local4.distance;
var _local10:Number = (((expRad - _local9) / expRad) * expForce);
_local8.Normalize();
_local8.Multiply(_local10);
_local2.SetAwake(true);
_local2.ApplyImpulse(_local8, _local4.pointB);
return (true);
};
var createExplode:Boolean;
if (createExplode){
explode = new Explode();
explode.x = costume.x;
explode.y = costume.y;
level.addChild(explode);
};
var circle:b2CircleShape = new b2CircleShape(expRad);
circle.SetLocalPosition(body.GetWorldCenter());
level.world.QueryShape(makeBoom, circle);
level.safeRemovePhysObject(this);
fuseFixture.GetBody().GetUserData();
}
}
}//package
Section 157
//Expcannonwav (Expcannonwav)
package {
import flash.media.*;
public dynamic class Expcannonwav extends Sound {
}
}//package
Section 158
//Explode (Explode)
package {
import flash.display.*;
public dynamic class Explode extends MovieClip {
public function Explode(){
addFrameScript(8, frame9);
}
function frame9(){
stop();
parent.removeChild(this);
}
}
}//package
Section 159
//Explode2 (Explode2)
package {
import flash.display.*;
public dynamic class Explode2 extends MovieClip {
public function Explode2(){
addFrameScript(8, frame9);
}
function frame9(){
stop();
parent.removeChild(this);
}
}
}//package
Section 160
//ExpSmall2wav (ExpSmall2wav)
package {
import flash.media.*;
public dynamic class ExpSmall2wav extends Sound {
}
}//package
Section 161
//Fire (Fire)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import dgparticles.*;
import flash.geom.*;
public class Fire extends BasePhysicsObject {
private var emitter:Emitter;
public var power:Number;// = 5
public var alive:Boolean;// = true
public var emPos:Point;
public function Fire(){
emPos = new Point(0, 5);
super();
}
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
super.initialize(_arg1, _arg2, _arg3);
_arg2.GetFixtureList().SetFilterData(_arg1.bombFilter);
name = "fire";
var _local4:Point = _arg3.localToGlobal(emPos);
if (_arg3.name == "torch"){
emitter = _arg1.ps.createEmmiter("fire2", _local4);
_arg2.GetFixtureList().SetSensor(true);
} else {
if (_arg3.name == "lightcup_fire"){
emitter = _arg1.ps.createEmmiter("fire_cup", _local4);
} else {
emitter = _arg1.ps.createEmmiter("fire_cup", _local4);
_arg2.GetFixtureList().SetSensor(true);
};
};
_arg3.cacheAsBitmap = true;
(_arg3 as MovieClip).stop();
}
override public function update():void{
var _local1:Point;
super.update();
if (emitter){
_local1 = costume.localToGlobal(emPos);
if (emitter.settings.name == "fire3"){
_local1.y = (_local1.y + 10);
};
emitter.position = _local1;
};
}
public function killFire():void{
alive = false;
level.ps.killEmmiter(emitter);
if (costume.name != "candle2"){
level.safeRemovePhysObjectBody(this);
};
(costume as MovieClip).gotoAndPlay(2);
}
override public function dispose():void{
killFire();
super.dispose();
}
}
}//package
Section 162
//FpsCounter (FpsCounter)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class FpsCounter {
public static var fps:int;
private static var initialized:Boolean;
private static var _stage:Stage;
private static var timeCounter:int;
private static var fpsCounter:int;
private static var lastTime:Number;
public static function initialize(_arg1:Stage){
if (initialized){
return;
};
_stage = _arg1;
_arg1.addEventListener(Event.ENTER_FRAME, update);
initialized = true;
}
private static function update(_arg1:Event):void{
var _local2:int = getTimer();
var _local3:int = (_local2 - lastTime);
lastTime = _local2;
fpsCounter = (fpsCounter + 1);
timeCounter = (timeCounter + _local3);
if (timeCounter > 1000){
timeCounter = (timeCounter - 1000);
fps = fpsCounter;
fpsCounter = 0;
};
}
public static function dispose():void{
if (initialized){
_stage.removeEventListener(Event.ENTER_FRAME, update);
initialized = false;
};
}
}
}//package
Section 163
//GameButton (GameButton)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import flash.events.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
public class GameButton extends BasePhysicsObject {
private var state:int;// = 0
private var btBody:MovieClip;
private var btJoint:b2Joint;
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
super.initialize(_arg1, _arg2, _arg3);
btBody = (_arg3.getChildByName("body") as MovieClip);
var _local4:b2CircleShape = (_arg2.GetFixtureList().GetShape() as b2CircleShape);
_local4.GetLocalPosition().y = (_local4.GetLocalPosition().y + (10 / Level.RATIO));
}
public function init():void{
var _local3:b2PrismaticJointDef;
var _local1:b2Vec2 = body.GetWorldCenter().Copy();
_local1.y = (_local1.y + (15 / Level.RATIO));
var _local2:b2Body = Utilites.getBodyAtPoint(level.world, _local1.x, _local1.y, true, [body]);
_local3 = new b2PrismaticJointDef();
_local3.Initialize(body, _local2, _local1, new b2Vec2(0, 1));
_local3.lowerTranslation = (-20 / Level.RATIO);
_local3.enableLimit = true;
_local3.upperTranslation = (0 / Level.RATIO);
_local3.motorSpeed = (1 / Level.RATIO);
_local3.maxMotorForce = 100;
_local3.enableMotor = true;
btJoint = level.world.CreateJoint(_local3);
}
override public function update():void{
if (state == 1){
return;
};
btBody.y = ((body.GetPosition().y * Level.RATIO) - costume.y);
if (btBody.y > 4){
btBody.y = 4;
state = 1;
level.safeRemovePhysObjectBody(this);
costume.dispatchEvent(new Event("btPressed"));
};
}
}
}//package
Section 164
//GameState (GameState)
package {
public class GameState {
public static const GAME:int = 0;
public static const BEFORE_GAME:int = 1;
public static const PAUSE:int = 2;
public static const LEVEL_COMPLETE:int = 3;
public static const LEVEL_COMPLETE_SCREEN:int = 4;
public static const GAME_OVER:int = 5;
public static const GAME_OVER_SCREEN:int = 6;
public static const GAME_COMPLETE:int = 7;
}
}//package
Section 165
//helpwav (helpwav)
package {
import flash.media.*;
public dynamic class helpwav extends Sound {
}
}//package
Section 166
//Input (Input)
package {
import flash.display.*;
import flash.events.*;
public class Input {
private static var pressedKeys:Array = new Array();
private static var initialized:Boolean;
public static var isMouseDown:Boolean;
public static function initialize(_arg1:Stage){
if (initialized){
return;
};
initialized = true;
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyUp);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
_arg1.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
}
private static function keyDown(_arg1:KeyboardEvent):void{
var _local2:int = pressedKeys.indexOf(_arg1.keyCode);
if (_local2 == -1){
pressedKeys.push(_arg1.keyCode);
};
}
private static function keyUp(_arg1:KeyboardEvent):void{
var _local2:int = pressedKeys.indexOf(_arg1.keyCode);
if (_local2 > -1){
pressedKeys.splice(_local2, 1);
};
}
private static function mouseDown(_arg1:MouseEvent):void{
isMouseDown = true;
}
private static function mouseUp(_arg1:MouseEvent):void{
isMouseDown = false;
}
public static function isKeyDown(_arg1:int):Boolean{
var _local2:int = pressedKeys.indexOf(_arg1);
return ((_local2 > -1));
}
}
}//package
Section 167
//Level (Level)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import flash.text.*;
import flash.events.*;
import dgparticles.*;
import flash.geom.*;
import Box2D.Common.Math.*;
import com.greensock.*;
import flash.net.*;
import com.greensock.easing.*;
public class Level extends Sprite {
public var txtScore:TextField;
public var pauseScreen:MovieClip;
public var blackRect:MovieClip;
public var btMuteMusic:MovieClip;
public var btMenu:MovieClip;
public var shadowRect:MovieClip;
public var btReset:MovieClip;
public var txtBombsCount:TextField;
public var gameOverScreen:MovieClip;
public var levelCompleteScreen:MovieClip;
public var btWalk:SimpleButton;
public var btMuteSound:MovieClip;
public var world:b2World;
public var physObjects:Array;
public var hiddenTriggers:Array;
private var physObjectsToRemove:Array;
private var physObjectsBodiesToRemove:Array;
public var currentLevel:MovieClip;
private var curLevelIndex:int;
public var state:int;// = 1
public var ps:ParticleSystem;
public var buttonFilter:b2FilterData;
public var bombFilter:b2FilterData;
private var textAnimator:TextAnimator;
public var bombsCount:int;
public var aliveBombs:int;// = 0
public var cannons:Array;
private var curCannonIndex:int;// = 0
private var score:Number;// = 0
private var totalScore:Number;// = 0
private var finalCounter:Number;// = -1
private var finalTime:Number;// = 2.5
public var aliveZombies:Number;// = 0
private var clouds:Clouds;
private var elapsedFrames:uint;// = 0
private var debugSprite:Sprite;
public static const LEVEL_WIDTH:Number = 700;
public static const LEVEL_HEIGHT:Number = 525;
public static const RATIO:int = 30;
public static const DEG_TO_RAD = 57.2957795130823;
public static const RAD_TO_DEG = 0.0174532925199433;
public static var beginFromLevel:int = 1;
public function Level(){
physObjects = new Array();
hiddenTriggers = new Array();
physObjectsToRemove = new Array();
physObjectsBodiesToRemove = new Array();
buttonFilter = new b2FilterData();
bombFilter = new b2FilterData();
textAnimator = new TextAnimator();
cannons = new Array();
super();
}
public function get main():Main{
return ((parent as Main));
}
public function initialize():void{
FpsCounter.initialize(stage);
Input.initialize(stage);
Debug.initialize(stage);
clouds = new Clouds(this);
bombFilter.groupIndex = -2;
buttonFilter.groupIndex = -1;
createWorld();
var _local1:BitmapLayer = new BitmapLayer(LEVEL_WIDTH, LEVEL_HEIGHT);
addChildAt(_local1, 1);
ps = new ParticleSystem(_local1);
ps.addSettingsByObject({name:"fire_cup", emissionRate:20, capacity:1000, lifeTime:100000000, angle:20, direction:180, imageName:"particle6", blendMode:"add", radius:0, moveWithEmmiter:1, middle:50, minParticleLife:800, maxParticleLife:500, minSpin:0, maxSpin:0, minVelocity:20, maxVelocity:80, minGravityY:0, maxGravityY:0, minAcceleration:20, maxAcceleration:30, minTangAcceleration:0, maxTangAcceleration:0, startScaleX:1.2, startScaleY:0.8, midScaleX:1.2, midScaleY:1.1, endScaleX:0, endScaleY:0, startColor:1020041472, midColor:3036636723, endColor:0});
ps.addSettingsByObject({name:"fire", emissionRate:18, capacity:1000, lifeTime:10000000, angle:20, direction:180, imageName:"particle6", blendMode:"add", radius:0, moveWithEmmiter:1, middle:50, minParticleLife:700, maxParticleLife:500, minSpin:0, maxSpin:0, minVelocity:20, maxVelocity:80, minGravityY:0, maxGravityY:0, minAcceleration:20, maxAcceleration:30, minTangAcceleration:0, maxTangAcceleration:0, startScaleX:1.4, startScaleY:1.4, midScaleX:1.7, midScaleY:1.7, endScaleX:0.6, endScaleY:0.6, startColor:1775016192, midColor:1946117683, endColor:0});
ps.addSettingsByObject({name:"fire2", emissionRate:15, capacity:1000, lifeTime:10000000, angle:20, direction:180, imageName:"particle16", blendMode:"add", radius:0, moveWithEmmiter:0, middle:50, minParticleLife:600, maxParticleLife:700, minSpin:0, maxSpin:0, minVelocity:20, maxVelocity:80, minGravityY:0, maxGravityY:0, minAcceleration:20, maxAcceleration:30, minTangAcceleration:0, maxTangAcceleration:0, startScaleX:1.2, startScaleY:1.2, midScaleX:1.4, midScaleY:1.4, endScaleX:0.1, endScaleY:0.1, startColor:1439471872, midColor:2784978483, endColor:0});
ps.addSettingsByObject({name:"fire3", emissionRate:15, capacity:1000, lifeTime:10000000, angle:20, direction:180, imageName:"particle1", blendMode:"add", radius:0, moveWithEmmiter:1, middle:50, minParticleLife:800, maxParticleLife:1000, minSpin:0, maxSpin:0, minVelocity:40, maxVelocity:60, minGravityY:0, maxGravityY:0, minAcceleration:20, maxAcceleration:30, minTangAcceleration:0, maxTangAcceleration:0, startScaleX:1.2, startScaleY:1.2, midScaleX:0.9, midScaleY:0.9, endScaleX:0.1, endScaleY:0.1, startColor:1442814208, midColor:2784978483, endColor:0xCCCCCC});
loadLevel(beginFromLevel);
addEventListener(Event.ENTER_FRAME, update);
prepareGame();
shadowRect.btSelectLevel.addEventListener(MouseEvent.CLICK, gotoSelectLevel);
levelCompleteScreen.completePanel.btNextLevel.addEventListener(MouseEvent.CLICK, nextLevel);
gameOverScreen.btMainMenu.addEventListener(MouseEvent.CLICK, gotoMainMenu);
gameOverScreen.btTryAgain.addEventListener(MouseEvent.CLICK, btTryAgainHandler);
btWalk.addEventListener(MouseEvent.CLICK, gotoWalkThrough);
btReset.addEventListener(MouseEvent.CLICK, resetLevel);
btMenu.addEventListener(MouseEvent.CLICK, gotoMainMenu);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUp);
setChildIndex(_local1, 1);
setChildIndex(shadowRect, 4);
setChildIndex(pauseScreen, 5);
prepareBlackRect();
blackRect.alpha = 1;
TweenMax.to(blackRect, 0.4, {autoAlpha:0});
var _local2:MovieClip = MovieClip(getChildByName("btMuteMusic"));
_local2.buttonMode = true;
_local2.bt.gotoAndStop((SoundManager.enableMusic) ? 1 : 2);
_local2.bt.addEventListener(MouseEvent.CLICK, btMusicClick);
var _local3:MovieClip = MovieClip(getChildByName("btMuteSound"));
_local3.buttonMode = true;
_local3.bt.gotoAndStop((SoundManager.enableSound) ? 1 : 2);
_local3.bt.addEventListener(MouseEvent.CLICK, btSoundClick);
SoundManager.stopAll();
SoundManager.playLoop("bomba4ki_ingamemp3", 0.1);
}
private function gotoWalkThrough(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://armorgames.com/guide/mad-bombs-game-walk-through"), "_blank");
}
private function btMusicClick(_arg1:MouseEvent):void{
SoundManager.enableMusic = !(SoundManager.enableMusic);
MovieClip(getChildByName("btMuteMusic")).bt.gotoAndStop((SoundManager.enableMusic) ? 1 : 2);
}
private function btSoundClick(_arg1:MouseEvent):void{
SoundManager.enableSound = !(SoundManager.enableSound);
MovieClip(getChildByName("btMuteSound")).bt.gotoAndStop((SoundManager.enableSound) ? 1 : 2);
}
public function prepareBlackRect():void{
blackRect.x = 0;
blackRect.y = 0;
blackRect.alpha = 0;
blackRect.visible = true;
setChildIndex(blackRect, (numChildren - 1));
}
private function btTryAgainHandler(_arg1:Event=null):void{
var func1:Function;
var e = _arg1;
func1 = function ():void{
loadLevel(curLevelIndex);
gameOverScreen.x = -(LEVEL_WIDTH);
beginGame();
TweenMax.to(blackRect, 0.1, {autoAlpha:0});
};
prepareBlackRect();
TweenLite.to(blackRect, 0.2, {alpha:0.9, onComplete:func1});
}
private function keyUp(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == 27)) || ((_arg1.keyCode == 80)))){
if (state == GameState.GAME){
pauseOn();
} else {
if (state == GameState.PAUSE){
pauseOff();
};
};
};
if ((((_arg1.keyCode == 82)) && ((state == GameState.GAME)))){
resetLevel();
};
if (_arg1.keyCode == 32){
if (state == GameState.BEFORE_GAME){
beginGame();
} else {
if (state == GameState.LEVEL_COMPLETE_SCREEN){
nextLevel();
} else {
if (state == GameState.GAME_OVER_SCREEN){
btTryAgainHandler();
};
};
};
};
}
private function resetLevel(_arg1:MouseEvent=null):void{
var func1:Function;
var e = _arg1;
func1 = function ():void{
prepareGame();
loadLevel(curLevelIndex);
TweenMax.to(blackRect, 0.1, {autoAlpha:0});
};
prepareBlackRect();
TweenLite.to(blackRect, 0.1, {alpha:0.9, onComplete:func1});
}
private function gotoMainMenu(_arg1:MouseEvent):void{
var func1:Function;
var e = _arg1;
func1 = function ():void{
dispose();
main.gotoAndStop("main menu");
};
prepareBlackRect();
TweenLite.to(blackRect, 0.2, {alpha:1, onComplete:func1});
}
private function gotoSelectLevel(_arg1:MouseEvent):void{
var func1:Function;
var e = _arg1;
func1 = function ():void{
dispose();
main.gotoAndStop("select level");
};
prepareBlackRect();
TweenLite.to(blackRect, 0.2, {alpha:1, onComplete:func1});
}
public function dispose():void{
stage.removeEventListener(KeyboardEvent.KEY_UP, keyUp);
removeEventListener(Event.ENTER_FRAME, update);
disposeCurrentLevel();
ps.dispose();
}
private function disposeCurrentLevel(){
if (((currentLevel) && (currentLevel.hasOwnProperty("dispose")))){
currentLevel.dispose();
};
if (currentLevel){
while (physObjects.length > 0) {
removeObject(physObjects[0]);
};
removeChild(currentLevel);
};
}
private function loadLevel(_arg1:int):void{
var _local5:BasePhysicsObject;
curLevelIndex = _arg1;
aliveZombies = 0;
curCannonIndex = 0;
cannons.splice(0, cannons.length);
finalCounter = (finalTime * stage.frameRate);
disposeCurrentLevel();
var _local2:MovieClip = Utilites.getLevelByIndex(_arg1);
addChildAt(_local2, 0);
var _local3:String = stage.quality;
stage.quality = "HIGH";
currentLevel = _local2;
Box2DParser.parse(_local2, this);
main.changeQuality(_local3);
if (currentLevel.hasOwnProperty("initialize")){
currentLevel.initialize();
};
clouds.createSky();
var _local4:int;
while (_local4 < physObjects.length) {
_local5 = physObjects[_local4];
if ((((((_local5 is GameButton)) || ((_local5 is CircleSaw)))) || ((_local5 is Platform)))){
physObjects[_local4].init();
};
_local4++;
};
updateGUI();
}
private function prepareGame():void{
score = 1000;
shadowRect.x = 0;
shadowRect.alpha = 1;
shadowRect.visible = true;
levelCompleteScreen.x = -700;
state = GameState.BEFORE_GAME;
shadowRect.txtCurLevel.text = ("Level " + curLevelIndex);
updateGUI();
}
private function beginGame():void{
state = GameState.GAME;
TweenMax.to(shadowRect, 0.3, {autoAlpha:0});
TweenMax.to(gameOverScreen, 0.3, {autoAlpha:0});
}
public function completeLevel():void{
var _local1:int = parseInt(currentLevel.bombsCount.text);
_local1 = (aliveBombs + bombsCount);
_local1 = (_local1 * 100);
var _local2:Number = (Math.floor(score) + _local1);
totalScore = (totalScore + _local2);
Saves.saves[(curLevelIndex - 1)].score = _local2;
if ((((curLevelIndex < Main.totalLevels)) && ((Saves.saves[curLevelIndex].score == undefined)))){
Saves.saves[curLevelIndex].score = 0;
};
Saves.save();
if (curLevelIndex == Main.totalLevels){
completeGame();
return;
};
state = GameState.LEVEL_COMPLETE_SCREEN;
levelCompleteScreen.x = 0;
levelCompleteScreen.y = 0;
levelCompleteScreen.alpha = 0;
TweenLite.to(levelCompleteScreen, 1, {alpha:1});
var _local3:MovieClip = levelCompleteScreen.completePanel;
_local3.txtScore.text = Math.floor(score);
_local3.txtPowerBonus.text = _local1;
_local3.txtTotalScore.text = Saves.totalScore().toString();
TweenLite.delayedCall(2, animateText);
}
private function animateText():void{
}
public function completeGame():void{
var func1:Function;
func1 = function ():void{
dispose();
main.gotoAndStop("congratulation");
};
state = GameState.GAME_COMPLETE;
prepareBlackRect();
TweenLite.to(blackRect, 0.2, {alpha:1, onComplete:func1});
}
public function nextLevel(_arg1:MouseEvent=null){
var func1:Function;
var e = _arg1;
func1 = function ():void{
levelCompleteScreen.x = -700;
TweenLite.killDelayedCallsTo(animateText);
textAnimator.stop();
loadLevel((curLevelIndex + 1));
prepareGame();
TweenMax.to(blackRect, 1.5, {autoAlpha:0});
};
prepareBlackRect();
TweenLite.to(blackRect, 0.2, {alpha:1, onComplete:func1});
}
public function gameOver():void{
state = GameState.GAME_OVER_SCREEN;
gameOverScreen.alpha = 0;
gameOverScreen.y = 0;
gameOverScreen.x = 0;
gameOverScreen.visible = true;
TweenLite.to(gameOverScreen, 0.5, {alpha:1});
}
public function pauseOn():void{
state = GameState.PAUSE;
pauseScreen.alpha = 0;
pauseScreen.x = 0;
pauseScreen.y = 0;
TweenLite.to(pauseScreen, 0.5, {alpha:1});
stopObjectsAnimation();
pauseScreen.textPaused.x = 350;
pauseScreen.textPaused.y = 260;
}
public function pauseOff():void{
var hidePauseScreen:Function;
hidePauseScreen = function ():void{
pauseScreen.x = -700;
pauseScreen.y = 0;
};
state = GameState.GAME;
TweenLite.to(pauseScreen, 0.5, {alpha:0, onComplete:hidePauseScreen});
resumeObjectsAnimation();
}
private function stopObjectsAnimation():void{
var _local1:int;
while (_local1 < physObjects.length) {
physObjects[_local1].stopAnimation();
_local1++;
};
}
private function resumeObjectsAnimation():void{
var _local1:int;
while (_local1 < physObjects.length) {
physObjects[_local1].resumeAnimation();
_local1++;
};
}
private function createWorld():void{
var _local1:b2Vec2 = new b2Vec2(0, 20);
world = new b2World(_local1, true);
world.SetContactListener(new ContactListener(this));
}
private function addObject(_arg1:BasePhysicsObject):void{
physObjects.push(_arg1);
}
private function removeObject(_arg1:BasePhysicsObject):void{
_arg1.dispose();
physObjects.splice(physObjects.indexOf(_arg1), 1);
}
public function safeRemovePhysObjectBody(_arg1:BasePhysicsObject):void{
physObjectsBodiesToRemove.push(_arg1);
}
private function removePhysObjectsBodies():void{
var _local1:int;
while (_local1 < physObjectsBodiesToRemove.length) {
physObjectsBodiesToRemove[_local1].destroyBody();
_local1++;
};
physObjectsBodiesToRemove.splice(0, physObjectsBodiesToRemove.length);
}
public function safeRemovePhysObject(_arg1:BasePhysicsObject):void{
physObjectsToRemove.push(_arg1);
}
private function removePhysObjects():void{
var _local2:BasePhysicsObject;
var _local1:int;
while (_local1 < physObjectsToRemove.length) {
_local2 = physObjectsToRemove[_local1];
if (physObjects.indexOf(_local2) > -1){
removeObject(_local2);
};
_local1++;
};
physObjectsToRemove.splice(0, physObjectsToRemove.length);
}
private function update(_arg1:Event):void{
elapsedFrames++;
if (state != GameState.PAUSE){
updatePhysics();
};
clouds.update();
if (((((!((state == GameState.GAME))) && (!((state == GameState.LEVEL_COMPLETE))))) && (!((state == GameState.GAME_OVER))))){
return;
};
if (aliveZombies == 0){
state = GameState.LEVEL_COMPLETE;
};
if ((((aliveBombs <= 0)) && ((state == GameState.GAME)))){
if (bombsCount <= 0){
state = GameState.GAME_OVER;
} else {
createBomb();
};
};
score = Utilites.clamp((score - 0.1), 100, 999999);
updateGUI();
if ((((state == GameState.LEVEL_COMPLETE)) || ((state == GameState.GAME_OVER)))){
finalCounter--;
if (finalCounter < 0){
if (state == GameState.LEVEL_COMPLETE){
completeLevel();
} else {
gameOver();
};
};
};
}
private function updatePhysics():void{
removePhysObjects();
removePhysObjectsBodies();
if (debugSprite){
debugSprite.visible = Input.isKeyDown(17);
if (Input.isKeyDown(17)){
world.DrawDebugData();
};
};
world.Step((1 / stage.frameRate), 30, 30);
var _local1:int = (physObjects.length - 1);
while (_local1 >= 0) {
physObjects[_local1].update();
_local1--;
};
}
private function updateGUI():void{
txtBombsCount.text = bombsCount.toString();
txtScore.text = Math.floor(score).toString();
}
private function createBomb():void{
bombsCount--;
aliveBombs++;
var _local1:MovieClip = cannons[curCannonIndex];
_local1.play();
SoundManager.playOnce("Expcannonwav", 0.3);
var _local2:Bomb = new Bomb();
_local2.initialize(this, null, null);
addObject(_local2);
var _local3:Point = _local1.localToGlobal(new Point((_local1.width / 2), (-(_local1.height) / 2)));
var _local4:b2Vec2 = new b2Vec2((_local3.x / RATIO), (_local3.y / RATIO));
_local2.body.SetPosition(_local4);
currentLevel.addChild(_local2.costume);
var _local5:b2Vec2 = _local4.Copy();
_local5.Subtract(new b2Vec2((_local1.x / RATIO), (_local1.y / RATIO)));
_local5.Multiply(2);
_local2.body.SetLinearVelocity(_local5);
_local2.update();
var _local6:MovieClip = new Explode2();
_local6.x = _local3.x;
_local6.y = _local3.y;
_local6.alpha = 0.8;
currentLevel.addChild(_local6);
curCannonIndex++;
if (curCannonIndex > (cannons.length - 1)){
curCannonIndex = 0;
};
}
public function getObjByCostume(_arg1:DisplayObject):BasePhysicsObject{
var _local2:int;
while (_local2 < physObjects.length) {
if (_arg1 == physObjects[_local2].costume){
return (physObjects[_local2]);
};
_local2++;
};
return (null);
}
public function everyFrames(_arg1:int):Boolean{
return (!((int(((elapsedFrames - 1) / _arg1)) == int((elapsedFrames / _arg1)))));
}
private function setDebugDraw():void{
debugSprite = new Sprite();
addChild(debugSprite);
var _local1:b2DebugDraw = new b2DebugDraw();
_local1.SetSprite(debugSprite);
_local1.SetDrawScale(30);
_local1.SetFillAlpha(0.3);
_local1.SetLineThickness(1);
_local1.SetFlags((b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit));
world.SetDebugDraw(_local1);
}
}
}//package
Section 168
//Level0 (Level0)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level0 extends MovieClip {
public var saw_path:MovieClip;
public var spring:MovieClip;
public var zombie:MovieClip;
public var bombsCount:TextField;
public var box_dynamic_wood:MovieClip;
public var acceleration_left:MovieClip;
public var button:MovieClip;
public var spikes:MovieClip;
public var box_dynamic:MovieClip;
public var circle_saw:MovieClip;
public var candle:MovieClip;
public var box_static_invisible:MovieClip;
public var yadro:MovieClip;
public var box_static:MovieClip;
public var slow_down:MovieClip;
public var cannon_1:MovieClip;
}
}//package
Section 169
//Level1 (Level1)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level1 extends MovieClip {
public var zombie:MovieClip;
public var bombsCount:TextField;
public var candle:MovieClip;
public var box_static_invisible:MovieClip;
public var cannon_1:MovieClip;
public var box_static:MovieClip;
}
}//package
Section 170
//Level10 (Level10)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level10 extends MovieClip {
public var spikes_dynamic:MovieClip;
public var revolute_joint_fix:MovieClip;
public var zombie:MovieClip;
public var bombsCount:TextField;
public var cannon1:MovieClip;
public var rope:MovieClip;
public var box_dynamic:MovieClip;
public var revolute_joint:MovieClip;
public var box_static_invisible:MovieClip;
public var box_static:MovieClip;
}
}//package
Section 171
//Level11 (Level11)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level11 extends MovieClip {
public var zombie:MovieClip;
public var bombsCount:TextField;
public var box_dynamic_wood:MovieClip;
public var cannon1:MovieClip;
public var spikes:MovieClip;
public var box_static_invisible:MovieClip;
public var yadro:MovieClip;
public var box_static:MovieClip;
}
}//package
Section 172
//Level12 (Level12)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level12 extends MovieClip {
public var zombie:MovieClip;
public var bombsCount:TextField;
public var box_dynamic_wood:MovieClip;
public var cannon1:MovieClip;
public var cannon2:MovieClip;
public var cannon3:MovieClip;
public var revolute_joint:MovieClip;
public var box_static_invisible:MovieClip;
public var candle:MovieClip;
public var box_static:MovieClip;
}
}//package
Section 173
//Level13 (Level13)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level13 extends MovieClip {
public var spring:MovieClip;
public var zombie:MovieClip;
public var bombsCount:TextField;
public var cannon1:MovieClip;
public var spikes:MovieClip;
public var box_static_invisible:MovieClip;
public var candle:MovieClip;
public var circle_dynamic:MovieClip;
public var box_static:MovieClip;
}
}//package
Section 174
//Level14 (Level14)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level14 extends MovieClip {
public var spikes_dynamic:MovieClip;
public var revolute_joint_fix:MovieClip;
public var zombie:MovieClip;
public var bombsCount:TextField;
public var cannon1:MovieClip;
public var cannon2:MovieClip;
public var box_dynamic:MovieClip;
public var revolute_joint:MovieClip;
public var box_static_invisible:MovieClip;
public var candle:MovieClip;
public var yadro:MovieClip;
public var circle_dynamic:MovieClip;
public var box_static:MovieClip;
}
}//package
Section 175
//Level15 (Level15)
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
public class Level15 extends MovieClip {
public var zombie:MovieClip;
public var box_static_3:MovieClip;
public var bombsCount:TextField;
public var box_static_2:MovieClip;
public var box_static_1:MovieClip;
public var cannon1:MovieClip;
public var cannon2:MovieClip;
public var spikes:MovieClip;
public var cannon3:MovieClip;
public var box_dynamic:MovieClip;
public var button1:MovieClip;
public var revolute_joint:MovieClip;
public var button2:MovieClip;
public var button3:MovieClip;
public var candle:MovieClip;
public var box_static_invisible:MovieClip;
public var box_static:MovieClip;
private var isBt1:Boolean;// = false
private var isBt2:Boolean;// = false
private var isBt3:Boolean;// = false
private var isBt4:Boolean;// = false
private var gate1:DisplayObject;
private var gate2:DisplayObject;
private var gate3:DisplayObject;
public function initialize(){
getChildByName("button1").addEventListener("btPressed", bt1Click);
getChildByName("button2").addEventListener("btPressed", bt2Click);
getChildByName("button3").addEventListener("btPressed", bt3Click);
addEventListener(Event.ENTER_FRAME, update);
gate1 = getChildByName("box_static_1");
gate2 = getChildByName("box_static_2");
gate3 = getChildByName("box_static_3");
(parent as Level).getObjByCostume(gate1).isCostumeMain = true;
(parent as Level).getObjByCostume(gate2).isCostumeMain = true;
(parent as Level).getObjByCostume(gate3).isCostumeMain = true;
}
public function checkExplode(_arg1:Bomb, _arg2:BasePhysicsObject):Boolean{
if ((_arg2 is Zombie)){
if ((((_arg1.costume.x < 580)) || ((_arg1.costume.y > 215)))){
return (false);
};
};
return (true);
}
private function update(_arg1:Event):void{
if ((parent as Level).state == GameState.PAUSE){
return;
};
if (((isBt1) && ((gate1.y < 435)))){
gate1.y = Utilites.clamp((gate1.y + 2), 0, 435);
};
if (((isBt2) && ((gate2.y < 303)))){
gate2.y = Utilites.clamp((gate2.y + 2), 0, 303);
};
if (((isBt3) && ((gate3.y < 303)))){
gate3.y = Utilites.clamp((gate3.y + 2), 0, 303);
};
}
private function bt1Click(_arg1:Event):void{
isBt1 = true;
}
private function bt2Click(_arg1:Event):void{
isBt2 = true;
}
private function bt3Click(_arg1:Event):void{
isBt3 = true;
}
public function dispose(){
getChildByName("button1").removeEventListener("btPressed", bt1Click);
getChildByName("button2").removeEventListener("btPressed", bt2Click);
getChildByName("button3").removeEventListener("btPressed", bt3Click);
removeEventListener(Event.ENTER_FRAME, update);
}
}
}//package
Section 176
//Level16 (Level16)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level16 extends MovieClip {
public var spring:MovieClip;
public var zombie:MovieClip;
public var bombsCount:TextField;
public var box_dynamic_wood:MovieClip;
public var cannon1:MovieClip;
public var cannon2:MovieClip;
public var lightcup:MovieClip;
public var spikes:MovieClip;
public var box_dynamic:MovieClip;
public var acceleration_right:MovieClip;
public var lightcup_fire:MovieClip;
public var revolute_joint:MovieClip;
public var box_static_invisible:MovieClip;
public var box_static:MovieClip;
}
}//package
Section 177
//Level17 (Level17)
package {
import flash.display.*;
import flash.text.*;
public class Level17 extends MovieClip {
public var saw_path:MovieClip;
public var zombie:MovieClip;
public var bombsCount:TextField;
public var box_dynamic_wood:MovieClip;
public var lightcup:MovieClip;
public var box_dynamic:MovieClip;
public var circle_saw:MovieClip;
public var lightcup_fire:MovieClip;
public var revolute_joint:MovieClip;
public var box_static_invisible:MovieClip;
public var cannon_1:MovieClip;
public var box_static:MovieClip;
public function checkExplode(_arg1:Bomb, _arg2:BasePhysicsObject):Boolean{
if ((_arg2 is Zombie)){
if (_arg1.costume.y > 200){
return (false);
};
};
return (true);
}
}
}//package
Section 178
//Level18 (Level18)
package {
import flash.display.*;
import flash.text.*;
public class Level18 extends MovieClip {
public var zombie:MovieClip;
public var bombsCount:TextField;
public var cannon1:MovieClip;
public var cannon2:MovieClip;
public var platform:MovieClip;
public var candle:MovieClip;
public var box_static_invisible:MovieClip;
public var platform_path:MovieClip;
public var box_static:MovieClip;
public function checkExplode(_arg1:Bomb, _arg2:BasePhysicsObject):Boolean{
if ((_arg2 is Zombie)){
if (_arg1.costume.y < 140){
return (false);
};
};
return (true);
}
}
}//package
Section 179
//Level19 (Level19)
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
public class Level19 extends MovieClip {
public var box_static_4:MovieClip;
public var zombie:MovieClip;
public var box_static_3:MovieClip;
public var bombsCount:TextField;
public var box_static_2:MovieClip;
public var box_dynamic_wood:MovieClip;
public var acceleration_left:MovieClip;
public var box_static_1:MovieClip;
public var cannon1:MovieClip;
public var cannon2:MovieClip;
public var spikes:MovieClip;
public var box_dynamic:MovieClip;
public var acceleration_right:MovieClip;
public var button1:MovieClip;
public var button2:MovieClip;
public var button3:MovieClip;
public var candle:MovieClip;
public var box_static_invisible:MovieClip;
public var yadro:MovieClip;
public var button4:MovieClip;
public var box_static:MovieClip;
private var isBt1:Boolean;// = false
private var isBt2:Boolean;// = false
private var isBt3:Boolean;// = false
private var isBt4:Boolean;// = false
private var gate1:DisplayObject;
private var gate2:DisplayObject;
private var gate3:DisplayObject;
private var gate4:DisplayObject;
public function initialize(){
getChildByName("button1").addEventListener("btPressed", bt1Click);
getChildByName("button2").addEventListener("btPressed", bt2Click);
getChildByName("button3").addEventListener("btPressed", bt3Click);
getChildByName("button4").addEventListener("btPressed", bt4Click);
addEventListener(Event.ENTER_FRAME, update);
gate1 = getChildByName("box_static_1");
gate2 = getChildByName("box_static_2");
gate3 = getChildByName("box_static_3");
gate4 = getChildByName("box_static_4");
(parent as Level).getObjByCostume(gate1).isCostumeMain = true;
(parent as Level).getObjByCostume(gate2).isCostumeMain = true;
(parent as Level).getObjByCostume(gate3).isCostumeMain = true;
(parent as Level).getObjByCostume(gate4).isCostumeMain = true;
}
public function checkExplode(_arg1:Bomb, _arg2:BasePhysicsObject):Boolean{
if ((_arg2 is Zombie)){
if ((((((_arg1.costume.y < 370)) || ((((_arg1.costume.x > 370)) && (((!(isBt3)) || (!(isBt4)))))))) || ((((_arg1.costume.x < 240)) && (((!(isBt1)) || (!(isBt2)))))))){
return (false);
};
};
return (true);
}
private function update(_arg1:Event):void{
if ((parent as Level).state != GameState.GAME){
return;
};
if (((isBt1) && ((gate1.y > 317)))){
gate1.y = Utilites.clamp((gate1.y - 2), 317, 99999);
};
if (((isBt2) && ((gate2.y > 317)))){
gate2.y = Utilites.clamp((gate2.y - 2), 317, 99999);
};
if (((isBt3) && ((gate3.y > 317)))){
gate3.y = Utilites.clamp((gate3.y - 2), 317, 99999);
};
if (((isBt4) && ((gate4.y > 317)))){
gate4.y = Utilites.clamp((gate4.y - 2), 317, 99999);
};
}
private function bt1Click(_arg1:Event):void{
isBt1 = true;
}
private function bt2Click(_arg1:Event):void{
isBt2 = true;
}
private function bt3Click(_arg1:Event):void{
isBt3 = true;
}
private function bt4Click(_arg1:Event):void{
isBt4 = true;
}
public function dispose(){
trace("disposing");
getChildByName("button1").removeEventListener("btPressed", bt1Click);
getChildByName("button2").removeEventListener("btPressed", bt2Click);
getChildByName("button3").removeEventListener("btPressed", bt3Click);
getChildByName("button4").removeEventListener("btPressed", bt4Click);
removeEventListener(Event.ENTER_FRAME, update);
}
}
}//package
Section 180
//Level2 (Level2)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level2 extends MovieClip {
public var zombie:MovieClip;
public var bombsCount:TextField;
public var box_dynamic_wood:MovieClip;
public var circle_static:MovieClip;
public var candle:MovieClip;
public var box_static_invisible:MovieClip;
public var cannon_1:MovieClip;
public var box_static:MovieClip;
}
}//package
Section 181
//Level20 (Level20)
package {
import flash.display.*;
import flash.text.*;
public class Level20 extends MovieClip {
public var saw_path:MovieClip;
public var zombie:MovieClip;
public var bombsCount:TextField;
public var box_dynamic_wood:MovieClip;
public var cannon1:MovieClip;
public var lightcup:MovieClip;
public var spikes:MovieClip;
public var box_dynamic:MovieClip;
public var acceleration_right:MovieClip;
public var circle_saw:MovieClip;
public var lightcup_fire:MovieClip;
public var revolute_joint:MovieClip;
public var candle:MovieClip;
public var box_static_invisible:MovieClip;
public var box_static:MovieClip;
public function checkExplode(_arg1:Bomb, _arg2:BasePhysicsObject):Boolean{
if ((_arg2 is Zombie)){
if (_arg1.costume.y < 370){
return (false);
};
};
return (true);
}
}
}//package
Section 182
//Level3 (Level3)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level3 extends MovieClip {
public var zombie:MovieClip;
public var bombsCount:TextField;
public var box_dynamic_wood:MovieClip;
public var cannon1:MovieClip;
public var cannon2:MovieClip;
public var candle:MovieClip;
public var box_static_invisible:MovieClip;
public var box_static:MovieClip;
}
}//package
Section 183
//Level4 (Level4)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level4 extends MovieClip {
public var spring:MovieClip;
public var zombie:MovieClip;
public var bombsCount:TextField;
public var box_dynamic_wood:MovieClip;
public var candle:MovieClip;
public var box_static_invisible:MovieClip;
public var cannon_1:MovieClip;
public var box_static:MovieClip;
}
}//package
Section 184
//Level5 (Level5)
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
public class Level5 extends MovieClip {
public var zombie:MovieClip;
public var bombsCount:TextField;
public var box_static_1:MovieClip;
public var cannon1:MovieClip;
public var box_dynamic:MovieClip;
public var button1:MovieClip;
public var zombie1:MovieClip;
public var box_static_invisible:MovieClip;
public var candle:MovieClip;
public var box_static:MovieClip;
private var isBt1:Boolean;// = false
private var gate1:DisplayObject;
public function initialize(){
getChildByName("button1").addEventListener("btPressed", bt1Click);
addEventListener(Event.ENTER_FRAME, update);
gate1 = getChildByName("box_static_1");
(parent as Level).getObjByCostume(gate1).isCostumeMain = true;
}
public function checkExplode(_arg1:Bomb, _arg2:BasePhysicsObject):Boolean{
if ((_arg2 is Zombie)){
if ((((_arg2.costume.name == "zombie1")) && ((_arg1.costume.x < 580)))){
return (false);
};
};
return (true);
}
private function update(_arg1:Event):void{
if ((parent as Level).state != GameState.GAME){
return;
};
if (((isBt1) && ((gate1.y < 438)))){
gate1.y = Utilites.clamp((gate1.y + 2), 0, 438);
};
}
private function bt1Click(_arg1:Event):void{
isBt1 = true;
}
public function dispose(){
getChildByName("button1").removeEventListener("btPressed", bt1Click);
removeEventListener(Event.ENTER_FRAME, update);
}
}
}//package
Section 185
//Level6 (Level6)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level6 extends MovieClip {
public var spring:MovieClip;
public var zombie:MovieClip;
public var bombsCount:TextField;
public var box_dynamic_wood:MovieClip;
public var lightcup:MovieClip;
public var rope:MovieClip;
public var box_dynamic:MovieClip;
public var lightcup_fire:MovieClip;
public var revolute_joint:MovieClip;
public var candle:MovieClip;
public var box_static_invisible:MovieClip;
public var cannon_1:MovieClip;
public var box_static:MovieClip;
}
}//package
Section 186
//Level7 (Level7)
package {
import flash.display.*;
import flash.text.*;
public class Level7 extends MovieClip {
public var saw_path:MovieClip;
public var zombie:MovieClip;
public var bombsCount:TextField;
public var cannon1:MovieClip;
public var spikes:MovieClip;
public var rope:MovieClip;
public var circle_saw:MovieClip;
public var revolute_joint:MovieClip;
public var box_static_invisible:MovieClip;
public var candle:MovieClip;
public var box_static:MovieClip;
public function checkExplode(_arg1:Bomb, _arg2:BasePhysicsObject):Boolean{
if ((_arg2 is Zombie)){
if (_arg1.costume.y < 370){
return (false);
};
};
return (true);
}
}
}//package
Section 187
//Level8 (Level8)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level8 extends MovieClip {
public var zombie:MovieClip;
public var bombsCount:TextField;
public var box_dynamic_wood:MovieClip;
public var candle:MovieClip;
public var box_static_invisible:MovieClip;
public var yadro:MovieClip;
public var cannon_1:MovieClip;
public var box_static:MovieClip;
}
}//package
Section 188
//Level9 (Level9)
package {
import flash.display.*;
import flash.text.*;
public class Level9 extends MovieClip {
public var spring:MovieClip;
public var bombsCount:TextField;
public var box_dynamic_wood:MovieClip;
public var cannon1:MovieClip;
public var acceleration_right:MovieClip;
public var zombie1:MovieClip;
public var box_static_invisible:MovieClip;
public var zombie2:MovieClip;
public var candle:MovieClip;
public var zombie3:MovieClip;
public var box_static:MovieClip;
public function checkExplode(_arg1:Bomb, _arg2:BasePhysicsObject):Boolean{
if ((_arg2 is Zombie)){
if ((((_arg2.costume.name == "zombie1")) && ((_arg1.costume.y > 200)))){
return (false);
};
if ((((_arg2.costume.name == "zombie2")) && ((((_arg1.costume.y < 220)) || ((_arg1.costume.y > 340)))))){
return (false);
};
if ((((_arg2.costume.name == "zombie3")) && ((_arg1.costume.y < 370)))){
return (false);
};
};
return (true);
}
}
}//package
Section 189
//Main (Main)
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import dgparticles.*;
import Playtomic.*;
import com.greensock.*;
import flash.net.*;
import com.greensock.easing.*;
public class Main extends MovieClip {
public var txtScore:TextField;
public var Level13:SimpleButton;
public var Level14:SimpleButton;
public var mcQuality:MovieClip;
public var Level15:SimpleButton;
public var Level1:SimpleButton;
public var Level16:SimpleButton;
public var Level2:SimpleButton;
public var blackRect:MovieClip;
public var btQuality:SimpleButton;
public var Level17:SimpleButton;
public var Level3:SimpleButton;
public var btMuteMusic:MovieClip;
public var Level18:SimpleButton;
public var Level4:SimpleButton;
public var Level19:SimpleButton;
public var Level5:SimpleButton;
public var txtInfo:TextField;
public var Armor_logo:MovieClip;
public var Level6:SimpleButton;
public var btnMoreGames:SimpleButton;
public var Level7:SimpleButton;
public var Level8:SimpleButton;
public var credits:MovieClip;
public var btPlay:SimpleButton;
public var Level9:SimpleButton;
public var level:Level;
public var btMainMenu:SimpleButton;
public var copyRights:TextField;
public var blackRect1:MovieClip;
public var Level10:SimpleButton;
public var Level20:SimpleButton;
public var Level11:SimpleButton;
public var Level12:SimpleButton;
public var btCredits:SimpleButton;
public var AG_splash:MovieClip;
public var btMusic:MovieClip;
public var i:int;
public var bt:SimpleButton;
public static const totalLevels:int = 20;
public function Main(){
addFrameScript(0, frame1, 1, frame2, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8);
tabChildren = false;
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
Saves.load();
}
public function MGClick(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://armorgames.com/"), "_blank");
}
public function AGClick(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://armorgames.com/"), "_blank");
}
public function btMusicClick(_arg1:MouseEvent):void{
SoundManager.enableMusic = !(SoundManager.enableMusic);
MovieClip(getChildByName("btMuteMusic")).bt.gotoAndStop((SoundManager.enableMusic) ? 1 : 2);
}
public function changeStageQuality(_arg1:MouseEvent){
changeQuality();
}
public function update(_arg1:Event):void{
mcQuality.gotoAndStop(stage.quality);
}
public function playHandler(_arg1:MouseEvent):void{
var gotoSelectLevel:Function;
var e = _arg1;
gotoSelectLevel = function ():void{
gotoAndStop("select level");
removeChild(blackRect1);
removeEventListener(Event.ENTER_FRAME, update);
};
blackRect1.visible = true;
TweenLite.to(blackRect1, 0.2, {alpha:0.9, onComplete:gotoSelectLevel});
}
public function showCredits(_arg1:MouseEvent):void{
credits.x = 0;
credits.y = 0;
credits.alpha = 0;
credits.visible = true;
TweenMax.to(credits, 0.5, {autoAlpha:1});
}
public function MoreGamesClick(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://armorgames.com/"), "_blank");
}
public function showLevelInfo(_arg1:MouseEvent):void{
trace(Saves.saves[(parseInt(_arg1.target.name.substr(5)) - 1)].score);
}
public function gotoLevel(_arg1:MouseEvent):void{
var gotoGame:Function;
var e = _arg1;
gotoGame = function ():void{
Level.beginFromLevel = parseInt(e.target.name.substr(5));
removeChild(blackRect);
gotoAndStop("game");
};
if (!e.target.enabled){
return;
};
blackRect.visible = true;
TweenLite.to(blackRect, 0.1, {alpha:1, onComplete:gotoGame});
}
public function gotoMainMenu(_arg1:MouseEvent):void{
var gotoMm:Function;
var e = _arg1;
gotoMm = function ():void{
removeChild(blackRect);
gotoAndStop("main menu");
};
blackRect.visible = true;
TweenLite.to(blackRect, 0.1, {alpha:1, onComplete:gotoMm});
}
public function btMainMenuClick(_arg1:MouseEvent):void{
var gotoMM:Function;
var e = _arg1;
gotoMM = function ():void{
gotoAndStop("main menu");
};
blackRect.visible = true;
TweenLite.to(blackRect, 0.2, {alpha:0.9, onComplete:gotoMM});
}
private function keyUpHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 81){
changeQuality();
};
}
public function changeQuality(_arg1:String=null){
if (!_arg1){
if (stage.quality == "HIGH"){
stage.quality = "MEDIUM";
} else {
if (stage.quality == "MEDIUM"){
stage.quality = "LOW";
} else {
stage.quality = "HIGH";
};
};
} else {
stage.quality = _arg1;
};
ParticleSystem.smoothing = !((stage.quality == "LOW"));
}
function frame1(){
stage.showDefaultContextMenu = false;
stage.scaleMode = StageScaleMode.NO_SCALE;
tabChildren = false;
Log.View(2103, "38b5a2272f574025", root.loaderInfo.loaderURL);
}
function frame2(){
stop();
Armor_logo.buttonMode = true;
Armor_logo.addEventListener(MouseEvent.CLICK, MGClick);
}
function frame4(){
AG_splash.buttonMode = true;
AG_splash.addEventListener(MouseEvent.CLICK, AGClick);
}
function frame5(){
stop();
FpsCounter.initialize(stage);
tabChildren = false;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.showDefaultContextMenu = false;
stage.align = StageAlign.TOP_LEFT;
SoundManager.initialize(stage);
if (SoundManager.getCount("bomba4ki_menuwav") == 0){
SoundManager.stopAll();
SoundManager.playLoop("bomba4ki_menuwav", 0.3);
};
btMusic = MovieClip(getChildByName("btMuteMusic"));
btMusic.buttonMode = true;
btMusic.bt.gotoAndStop((SoundManager.enableMusic) ? 1 : 2);
btMusic.bt.addEventListener(MouseEvent.CLICK, btMusicClick);
btQuality.addEventListener(MouseEvent.CLICK, changeStageQuality);
addEventListener(Event.ENTER_FRAME, update);
btPlay.addEventListener(MouseEvent.CLICK, playHandler);
blackRect1.x = 0;
blackRect1.y = 0;
TweenMax.to(blackRect1, 1, {autoAlpha:0});
btCredits.addEventListener(MouseEvent.CLICK, showCredits);
btnMoreGames.addEventListener(MouseEvent.CLICK, MoreGamesClick);
Armor_logo.buttonMode = true;
Armor_logo.addEventListener(MouseEvent.CLICK, MoreGamesClick);
setChildIndex(blackRect1, (numChildren - 1));
}
function frame6(){
stop();
i = 1;
while (i <= Main.totalLevels) {
bt = (getChildByName(("Level" + i.toString())) as SimpleButton);
bt.enabled = !((Saves.saves[(i - 1)].score == undefined));
bt.alpha = (bt.enabled) ? 1 : 0.6;
bt.addEventListener(MouseEvent.CLICK, gotoLevel);
bt.addEventListener(MouseEvent.MOUSE_OVER, showLevelInfo);
i++;
};
setChildIndex(blackRect, (numChildren - 1));
blackRect.x = 0;
blackRect.y = 0;
blackRect.alpha = 1;
TweenMax.to(blackRect, 0.4, {autoAlpha:0});
btMainMenu.addEventListener(MouseEvent.CLICK, gotoMainMenu);
}
function frame7(){
stop();
level.initialize();
}
function frame8(){
txtScore.text = Saves.totalScore().toString();
blackRect.x = 0;
blackRect.y = 0;
blackRect.alpha = 1;
TweenMax.to(blackRect, 0.4, {autoAlpha:0});
btMainMenu.addEventListener(MouseEvent.CLICK, btMainMenuClick);
}
}
}//package
Section 190
//nyawav (nyawav)
package {
import flash.media.*;
public dynamic class nyawav extends Sound {
}
}//package
Section 191
//particle1 (particle1)
package {
import flash.display.*;
public dynamic class particle1 extends BitmapData {
public function particle1(_arg1:int=32, _arg2:int=32){
super(_arg1, _arg2);
}
}
}//package
Section 192
//particle11 (particle11)
package {
import flash.display.*;
public dynamic class particle11 extends BitmapData {
public function particle11(_arg1:int=32, _arg2:int=32){
super(_arg1, _arg2);
}
}
}//package
Section 193
//particle13 (particle13)
package {
import flash.display.*;
public dynamic class particle13 extends BitmapData {
public function particle13(_arg1:int=32, _arg2:int=32){
super(_arg1, _arg2);
}
}
}//package
Section 194
//particle16 (particle16)
package {
import flash.display.*;
public dynamic class particle16 extends BitmapData {
public function particle16(_arg1:int=32, _arg2:int=32){
super(_arg1, _arg2);
}
}
}//package
Section 195
//particle16_ (particle16_)
package {
import flash.display.*;
public dynamic class particle16_ extends BitmapData {
public function particle16_(_arg1:int=32, _arg2:int=32){
super(_arg1, _arg2);
}
}
}//package
Section 196
//particle6 (particle6)
package {
import flash.display.*;
public dynamic class particle6 extends BitmapData {
public function particle6(_arg1:int=32, _arg2:int=32){
super(_arg1, _arg2);
}
}
}//package
Section 197
//particle6_ (particle6_)
package {
import flash.display.*;
public dynamic class particle6_ extends BitmapData {
public function particle6_(_arg1:int=32, _arg2:int=32){
super(_arg1, _arg2);
}
}
}//package
Section 198
//Platform (Platform)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import flash.geom.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Contacts.*;
public class Platform extends BasePhysicsObject {
private var dirX:int;// = 1
private var dirY:int;// = 0
private var speed:Number;// = 3
private var pos:b2Vec2;
private var moveBounds:Rectangle;
public function Platform(){
pos = new b2Vec2();
super();
}
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
super.initialize(_arg1, _arg2, _arg3);
if (_arg3.name.indexOf("vertical") != -1){
dirX = 0;
dirY = 1;
};
}
public function init():void{
var _local3:DisplayObject;
var _local4:Rectangle;
var _local1:Rectangle = costume.getRect(level.currentLevel);
var _local2:int;
while (_local2 < level.currentLevel.numChildren) {
_local3 = level.currentLevel.getChildAt(_local2);
if (_local3.name == "platform_path"){
_local4 = _local3.getRect(level.currentLevel);
if (_local1.intersects(_local4)){
moveBounds = _local4.clone();
level.currentLevel.removeChild(_local3);
return;
};
};
_local2++;
};
throw (((("не найден путь для платформы " + costume.x) + ", ") + costume.y));
}
override public function update():void{
var _local3:b2Vec2;
var _local4:b2Body;
costume.x = (costume.x + (dirX * speed));
costume.y = (costume.y + (dirY * speed));
pos.x = (costume.x / Level.RATIO);
pos.y = (costume.y / Level.RATIO);
body.SetPosition(pos);
var _local1:Rectangle = costume.transform.pixelBounds;
if ((((dirX == 1)) && ((_local1.right > moveBounds.right)))){
dirX = -1;
};
if ((((dirX == -1)) && ((_local1.left < moveBounds.left)))){
dirX = 1;
};
if ((((dirY == 1)) && ((_local1.bottom > moveBounds.bottom)))){
dirY = -1;
};
if ((((dirY == -1)) && ((_local1.top < moveBounds.top)))){
dirY = 1;
};
var _local2:b2ContactEdge = body.GetContactList();
while (_local2) {
if (_local2.contact.GetFixtureA() != body.GetFixtureList()){
_local4 = _local2.contact.GetFixtureA().GetBody();
} else {
_local4 = _local2.contact.GetFixtureB().GetBody();
};
_local3 = _local4.GetPosition();
if (body.GetPosition().y > _local3.y){
_local3.x = (_local3.x + ((dirX * speed) / Level.RATIO));
_local3.y = (_local3.y + ((dirY * speed) / Level.RATIO));
_local4.SetPosition(_local3);
};
_local2 = _local2.next;
};
}
}
}//package
Section 199
//preloader (preloader)
package {
import flash.display.*;
import flash.events.*;
public class preloader extends MovieClip {
public var percent:Number;// = 0
public function preloader(){
addEventListener(Event.ENTER_FRAME, Update);
}
public function Update(_arg1:Event):void{
var _local2:Number = loaderInfo.bytesLoaded;
var _local3:Number = loaderInfo.bytesTotal;
if (_local3 > 0){
percent = Math.floor(((_local2 / _local3) * 100));
};
gotoAndStop((percent + 1));
if ((((_local2 >= _local3)) || ((_local3 == 0)))){
removeEventListener(Event.ENTER_FRAME, Update);
if ((parent is MovieClip)){
(parent as MovieClip).gotoAndStop("splash");
};
};
}
}
}//package
Section 200
//RastrMovieClip (RastrMovieClip)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class RastrMovieClip {
public var rastrCostume:Sprite;
private var bmpCostume:Bitmap;
private var bmpFrames:Array;
private var bmpCoords:Array;
private var currentBmpFrame:BmpFrame;
public var currentFrame:int;// = 0
public var totalFrames:int;// = 1
public function get currentLabel():String{
return (currentBmpFrame.label);
}
public function initialize(_arg1:MovieClip, _arg2:Rectangle=null){
totalFrames = _arg1.totalFrames;
rasterize(_arg1, _arg2);
rastrCostume.addEventListener(Event.ENTER_FRAME, update);
}
private function update(_arg1:Event):void{
currentFrame++;
if (currentFrame >= totalFrames){
currentFrame = 0;
};
currentBmpFrame = bmpFrames[currentFrame];
bmpCostume.bitmapData = currentBmpFrame.bmpData;
bmpCostume.x = currentBmpFrame.x;
bmpCostume.y = currentBmpFrame.y;
bmpCostume.smoothing = true;
}
private function rasterize(_arg1:MovieClip, _arg2:Rectangle):void{
var _local4:BmpFrame;
bmpCostume = new Bitmap(null, PixelSnapping.AUTO, true);
rastrCostume = new Sprite();
rastrCostume.addChild(bmpCostume);
rastrCostume.name = _arg1.name;
rastrCostume.blendMode = _arg1.blendMode;
rastrCostume.filters = _arg1.filters;
rastrCostume.x = _arg1.x;
rastrCostume.y = _arg1.y;
_arg1.x = 0;
_arg1.y = 0;
_arg1.filters = [];
bmpFrames = new Array();
bmpCoords = new Array();
var _local3:int;
while (_local3 <= _arg1.totalFrames) {
_local4 = createRastFromVector(_arg1, _local3, _arg2);
bmpFrames.push(_local4);
_local3++;
};
bmpCostume.bitmapData = bmpFrames[0].bmpData;
bmpCostume.x = bmpFrames[0].x;
bmpCostume.y = bmpFrames[0].y;
_arg1.x = rastrCostume.x;
_arg1.y = rastrCostume.y;
_arg1.gotoAndPlay(1);
_arg1.visible = false;
_arg1.filters = rastrCostume.filters;
}
private function createRastFromVector(_arg1:MovieClip, _arg2:int, _arg3:Rectangle):BmpFrame{
_arg1.gotoAndStop(_arg2);
if ((((_arg1.width == 0)) || ((_arg1.height == 0)))){
return (new BmpFrame());
};
var _local4:Matrix = _arg1.transform.matrix.clone();
if (!_arg3){
_arg3 = _arg1.getRect(_arg1.parent);
};
_local4.translate(-(_arg3.left), -(_arg3.top));
var _local5:BitmapData = new BitmapData(_arg3.width, _arg3.height, true, 0);
_local5.draw(_arg1, _local4, _arg1.transform.colorTransform);
var _local6:BmpFrame = new BmpFrame();
_local6.bmpData = _local5;
_local6.x = _arg3.left;
_local6.y = _arg3.top;
_local6.label = _arg1.currentFrameLabel;
return (_local6);
}
public function gotoAndPlay(_arg1:String):void{
var _local2:int;
while (_local2 < bmpFrames.length) {
if (bmpFrames[_local2].label == _arg1){
currentFrame = _local2;
return;
};
_local2++;
};
}
public function dispose(){
rastrCostume.removeEventListener(Event.ENTER_FRAME, update);
}
}
}//package
import flash.display.*;
class BmpFrame {
public var x:Number;// = 0
public var y:Number;// = 0
public var bmpData:BitmapData;// = null
public var label:String;
private function BmpFrame(){
}
}
Section 201
//Rope (Rope)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Joints.*;
public class Rope extends BasePhysicsObject {
private var burning:Boolean;// = false
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
super.initialize(_arg1, _arg2, _arg3);
MovieClip(_arg3).stop();
}
public function setOnFire(_arg1:b2Manifold){
if (burning){
return;
};
burning = true;
MovieClip(costume).play();
}
public function breakRope():void{
var _local1:b2JointEdge = body.GetJointList();
if (((_local1) && (_local1.next))){
level.world.DestroyJoint(_local1.joint);
};
}
override public function update():void{
var _local1:b2JointEdge;
super.update();
if (MovieClip(costume).currentFrame == MovieClip(costume).totalFrames){
_local1 = body.GetJointList();
while (_local1) {
level.world.DestroyJoint(_local1.joint);
_local1 = _local1.next;
};
level.safeRemovePhysObject(this);
};
}
}
}//package
Section 202
//Saves (Saves)
package {
import flash.net.*;
import flash.utils.*;
public class Saves {
public static var saves:Array = new Array();
public static function save(){
var _local1:ByteArray = new ByteArray();
var _local2:int;
while (_local2 < Main.totalLevels) {
if (saves[_local2] != undefined){
_local1.writeObject(saves[_local2]);
};
_local2++;
};
var _local3:SharedObject = SharedObject.getLocal("mad_bombs_game_by_dgcompany");
_local3.data.saves = _local1;
_local3.flush();
}
public static function load(){
var i:int;
var obj:Object;
var data:ByteArray = new ByteArray();
var savesObject:SharedObject = SharedObject.getLocal("mad_bombs_game_by_dgcompany");
data = savesObject.data.saves;
i = 0;
while (i < Main.totalLevels) {
try {
obj = data.readObject();
saves[i] = obj;
} catch(err:Error) {
saves[i] = new Object();
};
i = (i + 1);
};
saves[0].score = 0;
}
public static function totalScore():int{
var _local1:int;
var _local2:int;
while (_local2 < Main.totalLevels) {
if (saves[_local2].score != undefined){
_local1 = (_local1 + saves[_local2].score);
};
_local2++;
};
return (_local1);
}
}
}//package
Section 203
//sliver1 (sliver1)
package {
import flash.display.*;
public dynamic class sliver1 extends MovieClip {
}
}//package
Section 204
//sliver2 (sliver2)
package {
import flash.display.*;
public dynamic class sliver2 extends MovieClip {
}
}//package
Section 205
//SlowDown (SlowDown)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import Box2D.Common.Math.*;
public class SlowDown extends BasePhysicsObject {
private var collisionObjects:Array;
public function SlowDown(){
collisionObjects = new Array();
super();
}
public function addObj(_arg1:BasePhysicsObject):void{
collisionObjects.push(_arg1);
}
public function removeObj(_arg1:BasePhysicsObject):void{
collisionObjects.splice(collisionObjects.indexOf(_arg1), 1);
}
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
super.initialize(_arg1, _arg2, _arg3);
_arg2.GetFixtureList().SetSensor(true);
}
override public function update():void{
var _local2:b2Body;
var _local3:b2Vec2;
var _local1:int;
while (_local1 < collisionObjects.length) {
_local2 = collisionObjects[_local1].body;
_local3 = _local2.GetLinearVelocity();
_local3.x = (_local3.x / 1.5);
_local2.SetLinearVelocity(_local3);
_local1++;
};
}
}
}//package
Section 206
//SoundManager (SoundManager)
package {
import flash.display.*;
import flash.events.*;
public class SoundManager {
private static var sounds:Array = new Array();
private static var _enableSound:Boolean = true;
private static var _enableMusic:Boolean = true;
private static var initialized:Boolean = false;
public static function get enableSound():Boolean{
return (_enableSound);
}
public static function set enableSound(_arg1:Boolean):void{
var _local3:DGSound;
_enableSound = _arg1;
var _local2:int;
while (_local2 < sounds.length) {
_local3 = sounds[_local2];
if (((!((_local3.name == "bomba4ki_ingamemp3"))) && (!((_local3.name == "bomba4ki_menuwav"))))){
if (_enableSound){
_local3.restoreVolume();
} else {
_local3.vol = 0;
};
};
_local2++;
};
}
public static function get enableMusic():Boolean{
return (_enableMusic);
}
public static function set enableMusic(_arg1:Boolean):void{
var _local3:DGSound;
_enableMusic = _arg1;
var _local2:int;
while (_local2 < sounds.length) {
_local3 = sounds[_local2];
if ((((_local3.name == "bomba4ki_ingamemp3")) || ((_local3.name == "bomba4ki_menuwav")))){
if (_enableMusic){
_local3.restoreVolume();
} else {
_local3.vol = 0;
};
};
_local2++;
};
}
public static function initialize(_arg1:Stage):void{
if (!initialized){
_arg1.addEventListener(Event.ENTER_FRAME, update);
};
initialized = true;
}
public static function update(_arg1:Event=null):void{
if (!enableSound){
return;
};
var _local2:int = (sounds.length - 1);
while (_local2 >= 0) {
if (sounds[_local2].played){
sounds[_local2].loops--;
if (sounds[_local2].loops <= 0){
sounds.splice(_local2, 1);
};
};
_local2--;
};
}
public static function playLoop(_arg1:String, _arg2:Number):DGSound{
var _local4:Number;
var _local3:DGSound = new DGSound(Utilites.getSoundByName(_arg1), _arg1);
if ((((_arg1 == "bomba4ki_ingamemp3")) || ((_arg1 == "bomba4ki_menuwav")))){
_local4 = (enableMusic) ? _arg2 : 0;
} else {
_local4 = (enableSound) ? _arg2 : 0;
};
_local3.play(999999, _arg2, _local4);
sounds.push(_local3);
return (_local3);
}
public static function playOnce(_arg1:String, _arg2:Number):DGSound{
if (sounds.length >= 32){
return (null);
};
var _local3:DGSound = new DGSound(Utilites.getSoundByName(_arg1), _arg1);
var _local4:int = getCount(_arg1);
_arg2 = Utilites.clamp(_arg2, 0, 10);
if (_arg2 == 0){
return (null);
};
var _local5:Number = (enableSound) ? _arg2 : 0;
_local3.play(0, _arg2, _local5);
sounds.push(_local3);
return (_local3);
}
public static function removeSound(_arg1:DGSound):void{
if (_arg1 == null){
return;
};
var _local2:int = (sounds.length - 1);
while (_local2 >= 0) {
if (_arg1.name == sounds[_local2].name){
sounds[_local2].stop();
sounds.splice(_local2, 1);
return;
};
_local2--;
};
}
public static function getCount(_arg1:String):int{
var _local2:int;
var _local3:int;
while (_local3 < sounds.length) {
if (_arg1 == sounds[_local3].name){
_local2++;
};
_local3++;
};
return (_local2);
}
public static function getSoundByName(_arg1:String):DGSound{
var _local2:int = (sounds.length - 1);
while (_local2 >= 0) {
if (_arg1 == sounds[_local2].name){
return ((sounds[_local2] as DGSound));
};
_local2--;
};
return (null);
}
public static function stopAll():void{
var _local1:int;
while (_local1 < sounds.length) {
sounds[_local1].stop();
_local1++;
};
sounds.splice(0, sounds.length);
}
public static function pauseAll():void{
enableSound = false;
var _local1:int;
while (_local1 < sounds.length) {
sounds[_local1].pause();
_local1++;
};
}
public static function resumeAll():void{
enableSound = true;
var _local1:int;
while (_local1 < sounds.length) {
sounds[_local1].resume();
_local1++;
};
}
public static function playButtonClick():void{
SoundManager.playOnce("Click.wav", 1);
}
}
}//package
Section 207
//Spring (Spring)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import flash.geom.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
public class Spring extends BasePhysicsObject {
private var btJoint:b2PrismaticJoint;
private var isGetBack:Boolean;// = false
private var bottom:b2Body;
private var yTrans:Number;
private var isTimerOn:Boolean;// = false
private var timer:Number;// = -1
private var vel:b2Vec2;
private var collisionObjects:Array;
public function Spring(){
vel = new b2Vec2(20, 20);
collisionObjects = new Array();
super();
}
public function addObj(_arg1:BasePhysicsObject):void{
collisionObjects.push(_arg1);
}
public function removeObj(_arg1:BasePhysicsObject):void{
collisionObjects.splice(collisionObjects.indexOf(_arg1), 1);
}
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
var _local7:b2Vec2;
super.initialize(_arg1, _arg2, _arg3);
_arg2.SetBullet(true);
MovieClip(_arg3).stop();
yTrans = ((32 / Level.RATIO) * _arg3.scaleY);
var _local4:Sprite = (_arg3.getChildByName("bottom") as Sprite);
var _local5:Point = _arg3.localToGlobal(new Point(_local4.x, _local4.y));
var _local6:b2Vec2 = new b2Vec2((_local5.x / Level.RATIO), (_local5.y / Level.RATIO));
bottom = Box2DParser.createBox((((_local4.width / 2) / Level.RATIO) * _arg3.scaleX), (((_local4.height / 2) / Level.RATIO) * _arg3.scaleY), _local6, _arg2.GetAngle());
_local7 = new b2Vec2(Math.sin(_arg2.GetAngle()), -(Math.cos(_arg2.GetAngle())));
vel.x = (vel.x * _local7.x);
vel.y = (vel.y * _local7.y);
var _local8:b2PrismaticJointDef = new b2PrismaticJointDef();
_local8.Initialize(_arg2, bottom, bottom.GetPosition(), _local7);
_local8.lowerTranslation = 0;
_local8.enableLimit = true;
_local8.upperTranslation = yTrans;
_local8.motorSpeed = (-10 / Level.RATIO);
_local8.maxMotorForce = 5000;
_local8.enableMotor = true;
btJoint = (_arg1.world.CreateJoint(_local8) as b2PrismaticJoint);
}
override public function update():void{
var _local1:Number = btJoint.GetJointTranslation();
var _local2:int = ((_local1 / yTrans) * MovieClip(costume).totalFrames);
MovieClip(costume).gotoAndStop(_local2);
if (((!(isGetBack)) && ((_local1 > (yTrans - (2 / Level.RATIO)))))){
isGetBack = true;
playSound();
};
if (((isGetBack) && ((_local1 < (10 / Level.RATIO))))){
isGetBack = false;
};
if (((!(isGetBack)) && ((_local1 > 0.1)))){
if (timer < 0){
timer = (1 * level.stage.frameRate);
};
timer--;
if (timer < 0){
isGetBack = true;
playSound();
};
};
if (isGetBack){
timer = -1;
btJoint.SetMaxMotorForce(10000000);
btJoint.SetMotorSpeed((-500 / Level.RATIO));
updateBack();
} else {
btJoint.SetMaxMotorForce(50);
btJoint.SetMotorSpeed((0 / Level.RATIO));
};
}
private function playSound():void{
SoundManager.playOnce("springwav", 0.3);
}
private function updateBack():void{
var _local2:BasePhysicsObject;
var _local1:int;
while (_local1 < collisionObjects.length) {
_local2 = collisionObjects[_local1];
if (_local2.body.GetType() == b2Body.b2_dynamicBody){
_local2.body.SetLinearVelocity(vel.Copy());
};
_local1++;
};
}
override public function dispose():void{
level.world.DestroyBody(bottom);
super.dispose();
}
}
}//package
Section 208
//springwav (springwav)
package {
import flash.media.*;
public dynamic class springwav extends Sound {
}
}//package
Section 209
//TextAnimator (TextAnimator)
package {
import flash.text.*;
import flash.events.*;
public class TextAnimator {
private var step:Number;
private var from:Number;
private var to:Number;
private var current:Number;
private var tField:TextField;
private var onComplete:Function;
public function animate(_arg1:TextField, _arg2:Number, _arg3:Number, _arg4:Function=null):void{
this.to = _arg3;
this.from = _arg2;
this.tField = _arg1;
this.onComplete = _arg4;
current = _arg2;
step = ((_arg3 - _arg2) / 20);
_arg1.addEventListener(Event.ENTER_FRAME, update);
}
private function update(_arg1:Event):void{
current = (current + step);
current = Utilites.clamp(current, from, to);
tField.text = int(current).toString();
if (current >= to){
tField.removeEventListener(Event.ENTER_FRAME, update);
if (onComplete != null){
onComplete.call(this);
};
};
}
public function stop():void{
if (((tField) && (tField.hasEventListener(Event.ENTER_FRAME)))){
tField.removeEventListener(Event.ENTER_FRAME, update);
};
}
}
}//package
Section 210
//Utilites (Utilites)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import flash.geom.*;
import Box2D.Common.Math.*;
import flash.media.*;
public class Utilites {
public static const ZERO_POINT:Point = new Point();
public static const ZERO_VECT:b2Vec2 = new b2Vec2();
public static function randomInt(_arg1, _arg2:Number):int{
if (_arg1 == _arg2){
return (_arg1);
};
return (Math.round(((Math.random() * (_arg2 - _arg1)) + _arg1)));
}
public static function randomNumber(_arg1, _arg2:Number):Number{
if (_arg1 == _arg2){
return (_arg1);
};
return (((Math.random() * (_arg2 - _arg1)) + _arg1));
}
public static function inRange(_arg1, _arg2, _arg3:Number):Boolean{
return ((((_arg1 >= _arg2)) && ((_arg1 <= _arg3))));
}
public static function clamp(_arg1, _arg2, _arg3:Number):Number{
if (_arg1 < _arg2){
_arg1 = _arg2;
};
if (_arg1 > _arg3){
_arg1 = _arg3;
};
return (_arg1);
}
public static function arrayToString(_arg1:Array):String{
var _local3:int;
var _local2 = "";
if (_arg1){
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + (_arg1[_local3].toString() + "; "));
_local3++;
};
};
return (_local2);
}
public static function getBodyAtPoint(_arg1:b2World, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Array=null):b2Body{
var body:b2Body;
var readResult:Function;
var world = _arg1;
var x = _arg2;
var y = _arg3;
var includeStatic = _arg4;
var except = _arg5;
readResult = function (_arg1:b2Fixture):Boolean{
if (_arg1.IsSensor()){
return (true);
};
body = _arg1.GetBody();
if (((except) && ((except.indexOf(body) > -1)))){
body = null;
return (true);
};
if (((!(includeStatic)) && ((body.GetType() == b2Body.b2_staticBody)))){
body = null;
return (true);
};
return (false);
};
body = null;
world.QueryPoint(readResult, new b2Vec2(x, y));
return (body);
}
public static function getLevelByIndex(_arg1:int):MovieClip{
var _local2:MovieClip;
switch (_arg1){
case 1:
_local2 = new Level1();
break;
case 2:
_local2 = new Level2();
break;
case 3:
_local2 = new Level3();
break;
case 4:
_local2 = new Level4();
break;
case 5:
_local2 = new Level5();
break;
case 6:
_local2 = new Level6();
break;
case 7:
_local2 = new Level7();
break;
case 8:
_local2 = new Level8();
break;
case 9:
_local2 = new Level9();
break;
case 10:
_local2 = new Level10();
break;
case 11:
_local2 = new Level11();
break;
case 12:
_local2 = new Level12();
break;
case 13:
_local2 = new Level13();
break;
case 14:
_local2 = new Level14();
break;
case 15:
_local2 = new Level15();
break;
case 16:
_local2 = new Level16();
break;
case 17:
_local2 = new Level17();
break;
case 18:
_local2 = new Level18();
break;
case 19:
_local2 = new Level19();
break;
case 20:
_local2 = new Level20();
break;
};
return (_local2);
}
public static function getParticleByName(_arg1:String):BitmapData{
var _local2:BitmapData;
switch (_arg1){
case "particle1":
_local2 = new particle1();
break;
case "particle6":
_local2 = new particle6();
break;
case "particle16":
_local2 = new particle16();
break;
};
return (_local2);
}
public static function getSoundByName(_arg1:String):Sound{
var _local2:Sound;
switch (_arg1){
case "Expcannonwav":
_local2 = new Expcannonwav();
break;
case "Aaaa2wav":
_local2 = new Aaaa2wav();
break;
case "springwav":
_local2 = new springwav();
break;
case "bomba4ki_ingamemp3":
_local2 = new bomba4ki_ingamemp3();
break;
case "bomba4ki_menuwav":
_local2 = new bomba4ki_menuwav();
break;
case "ExpSmall2wav":
_local2 = new ExpSmall2wav();
break;
case "helpwav":
_local2 = new helpwav();
break;
case "nyawav":
_local2 = new nyawav();
break;
case "whatwav":
_local2 = new whatwav();
break;
};
return (_local2);
}
}
}//package
Section 211
//Water (Water)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import flash.geom.*;
public class Water extends BasePhysicsObject {
private var rastBody:RastrMovieClip;
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
super.initialize(_arg1, _arg2, _arg3);
var _local4:MovieClip = (_arg3.getChildByName("maska") as MovieClip);
var _local5:Rectangle = _local4.getRect(_arg3);
_local4.getRect(_arg3).x = (_local5.x * _arg3.scaleX);
_local5.width = (_local5.width * _arg3.scaleX);
_local5.y = (_local5.y * _arg3.scaleY);
_local5.height = (_local5.height * _arg3.scaleY);
rastBody = new RastrMovieClip();
rastBody.initialize(MovieClip(_arg3), _local5);
var _local6:int = _arg3.parent.getChildIndex(_arg3);
_arg3.parent.addChildAt(rastBody.rastrCostume, _local6);
_arg3.parent.removeChild(_arg3);
}
override public function update():void{
}
}
}//package
Section 212
//whatwav (whatwav)
package {
import flash.media.*;
public dynamic class whatwav extends Sound {
}
}//package
Section 213
//WoodObject (WoodObject)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import Box2D.Common.Math.*;
public class WoodObject extends BasePhysicsObject {
private var explodeState:int;// = 0
private var expForce:Number;
private var expDir:Number;
public var originScaleX:Number;// = 1
public var originScaleY:Number;// = 1
public function explode(_arg1:b2Vec2):void{
var _local2:b2Vec2;
if (explodeState == 0){
explodeState = 1;
_local2 = body.GetPosition().Copy();
_local2.Subtract(_arg1);
expForce = (_local2.Length() * 10);
expDir = (Math.atan2(_local2.y, _local2.x) + (Math.PI / 2));
};
}
override public function update():void{
var _local1:int;
var _local2:int;
var _local3:MovieClip;
var _local4:AutoRemoveObject;
var _local5:b2Body;
var _local6:Number;
var _local7:b2Vec2;
super.update();
if (explodeState == 1){
explodeState = 2;
level.safeRemovePhysObject(this);
if (Math.abs((originScaleX - originScaleY)) > 1){
return;
};
_local1 = Utilites.randomInt(3, 4);
_local2 = 0;
while (_local2 < _local1) {
if (Math.random() < 0.5){
_local3 = new sliver2();
} else {
_local3 = new sliver1();
};
level.currentLevel.addChild(_local3);
_local3.x = costume.x;
_local3.y = costume.y;
_local3.scaleX = originScaleX;
_local3.scaleY = originScaleY;
_local4 = new AutoRemoveObject();
_local4.lifeTime = (Utilites.randomNumber(3, 4) * costume.stage.frameRate);
_local5 = Box2DParser.createBoxByCostume(_local3, b2Body.b2_dynamicBody, 0.1, 0, 0);
_local5.SetAngle(Utilites.randomNumber(0, (2 * Math.PI)));
Box2DParser.addPhysObject(level, _local4, _local5, _local3);
_local6 = (expDir + Utilites.randomNumber((-(Math.PI) / 2), (Math.PI / 2)));
_local7 = new b2Vec2((Math.sin(_local6) * expForce), (Math.cos(_local6) * expForce));
_local5.SetLinearVelocity(_local7);
_local5.SetAngularVelocity(Utilites.randomNumber(1, 5));
_local2++;
};
};
}
}
}//package
Section 214
//Zombie (Zombie)
package {
import Box2D.Dynamics.*;
import flash.display.*;
import Box2D.Common.Math.*;
public class Zombie extends BasePhysicsObject {
private var expForce:Number;
private var expDir:Number;
private var expPos:b2Vec2;
private var state:int;// = 0
private var hitVel:b2Vec2;
public var head:Sprite;
public var bodyCost:Sprite;
public var rightArm1:Sprite;
public var rightArm2:Sprite;
public var leftArm1:Sprite;
public var leftArm2:Sprite;
public var rightLeg1:Sprite;
public var rightLeg2:Sprite;
public var leftLeg1:Sprite;
public var leftLeg2:Sprite;
private var partiesFilter:b2FilterData;
public function Zombie(){
partiesFilter = new b2FilterData();
super();
}
override public function initialize(_arg1:Level, _arg2:b2Body, _arg3:Sprite):void{
super.initialize(_arg1, _arg2, _arg3);
_arg1.aliveZombies++;
bodyCost = (Box2DParser.createRastFromVector(_arg3.getChildByName("body")) as Sprite);
_arg3.removeChild(_arg3.getChildByName("body"));
_arg3.addChild(bodyCost);
head = (Box2DParser.createRastFromVector(_arg3.getChildByName("head")) as Sprite);
_arg3.removeChild(_arg3.getChildByName("head"));
_arg3.addChild(head);
rightArm1 = (Box2DParser.createRastFromVector(_arg3.getChildByName("right_arm_1")) as Sprite);
_arg3.removeChild(_arg3.getChildByName("right_arm_1"));
_arg3.addChild(rightArm1);
rightArm2 = (Box2DParser.createRastFromVector(_arg3.getChildByName("right_arm_2")) as Sprite);
_arg3.removeChild(_arg3.getChildByName("right_arm_2"));
_arg3.addChild(rightArm2);
leftArm1 = (Box2DParser.createRastFromVector(_arg3.getChildByName("left_arm_1")) as Sprite);
_arg3.removeChild(_arg3.getChildByName("left_arm_1"));
_arg3.addChild(leftArm1);
if (_arg3.getChildByName("left_arm_2") != null){
leftArm2 = (Box2DParser.createRastFromVector(_arg3.getChildByName("left_arm_2")) as Sprite);
_arg3.removeChild(_arg3.getChildByName("left_arm_2"));
_arg3.addChild(leftArm2);
};
rightLeg1 = (Box2DParser.createRastFromVector(_arg3.getChildByName("right_leg_1")) as Sprite);
_arg3.removeChild(_arg3.getChildByName("right_leg_1"));
_arg3.addChild(rightLeg1);
rightLeg2 = (Box2DParser.createRastFromVector(_arg3.getChildByName("right_leg_2")) as Sprite);
_arg3.removeChild(_arg3.getChildByName("right_leg_2"));
_arg3.addChild(rightLeg2);
leftLeg1 = (Box2DParser.createRastFromVector(_arg3.getChildByName("left_leg_1")) as Sprite);
_arg3.removeChild(_arg3.getChildByName("left_leg_1"));
_arg3.addChild(leftLeg1);
leftLeg2 = (Box2DParser.createRastFromVector(_arg3.getChildByName("left_leg_2")) as Sprite);
_arg3.removeChild(_arg3.getChildByName("left_leg_2"));
_arg3.addChild(leftLeg2);
}
public function createBody(_arg1:Sprite):b2Body{
var _local2:Number = (((_arg1.getChildByName("head").height / Level.RATIO) / 2) * _arg1.scaleY);
var _local3:Number = (((_arg1.width / Level.RATIO) / 2) * _arg1.scaleX);
var _local4:Number = (((_arg1.height / Level.RATIO) / 2) - _local2);
var _local5:b2Vec2 = new b2Vec2((_arg1.x / Level.RATIO), (_arg1.y / Level.RATIO));
body = Box2DParser.createBox(_local3, _local4, _local5, 0, b2Body.b2_staticBody, 0, 0, 0.5, 0, _local2);
Box2DParser.createCircleFixture(body, _local2, 0, (-(_local2) * 2), 0, 0, 0);
return (body);
}
public function explode(_arg1:b2Vec2):void{
this.expPos = _arg1;
state = 1;
}
public function hit(_arg1:b2Vec2):void{
this.hitVel = _arg1;
state = 2;
}
override public function update():void{
var _local1:BasePhysicsObject;
var _local2:BasePhysicsObject;
var _local3:b2Vec2;
super.update();
if ((((state == 1)) || ((state == 2)))){
level.aliveZombies--;
if (state == 2){
createBodyPart(expPos, rightArm1, false, true);
createBodyPart(expPos, rightArm2, false, true);
createBodyPart(expPos, leftArm1, false, true);
if (leftArm2){
createBodyPart(expPos, leftArm2, false, true);
};
createBodyPart(expPos, rightLeg1, false, true);
createBodyPart(expPos, rightLeg2, false, true);
createBodyPart(expPos, leftLeg1, false, true);
createBodyPart(expPos, leftLeg2, false, true);
_local1 = createBodyPart(expPos, bodyCost, false, true);
_local2 = createBodyPart(expPos, head, true, true);
};
if (state == 1){
_local3 = body.GetPosition().Copy();
_local3.Subtract(expPos);
expForce = (_local3.Length() * 10);
expDir = (Math.atan2(_local3.y, _local3.x) + (Math.PI / 2));
createBodyPart(expPos, rightArm1);
createBodyPart(expPos, rightArm2);
createBodyPart(expPos, leftArm1);
if (leftArm2){
createBodyPart(expPos, leftArm2);
};
createBodyPart(expPos, rightLeg1);
createBodyPart(expPos, rightLeg2);
createBodyPart(expPos, leftLeg1);
createBodyPart(expPos, leftLeg2);
createBodyPart(expPos, bodyCost);
createBodyPart(expPos, head, true);
};
level.safeRemovePhysObject(this);
dispose();
};
}
private function createBodyPart(_arg1:b2Vec2, _arg2:Sprite, _arg3:Boolean=false, _arg4:Boolean=false):BasePhysicsObject{
var _local8:b2Body;
var _local5:int = level.currentLevel.getChildIndex(costume);
level.currentLevel.addChildAt(_arg2, _local5);
_arg2.scaleX = (_arg2.scaleX * costume.scaleX);
_arg2.scaleY = (_arg2.scaleY * costume.scaleY);
_arg2.x = (_arg2.x + costume.x);
_arg2.y = (_arg2.y + costume.y);
var _local6:AutoRemoveObject = new AutoRemoveObject();
_local6.lifeTime = (Utilites.randomNumber(3, 4) * costume.stage.frameRate);
if (_arg3){
_local8 = Box2DParser.createCircleByCostume(_arg2, b2Body.b2_dynamicBody, 0.1, 0, 0);
} else {
_local8 = Box2DParser.createBoxByCostume(_arg2, b2Body.b2_dynamicBody, 0.1, 0, 0);
};
Box2DParser.addPhysObject(level, _local6, _local8, _arg2);
if (_arg4){
return (_local6);
};
var _local7:b2Vec2 = _local8.GetPosition().Copy();
_local7.Subtract(_arg1);
_local7.Normalize();
_local7.Multiply(expForce);
_local8.SetLinearVelocity(_local7);
if (_local7.x > 0){
_local8.SetAngularVelocity(Utilites.randomNumber(1, 2));
} else {
_local8.SetAngularVelocity(Utilites.randomNumber(-2, -1));
};
return (_local6);
}
}
}//package