Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2CircleDef extends b2ShapeDef {
public var localPosition:b2Vec2;
public var radius:Number;
public function b2CircleDef(){
localPosition = new b2Vec2(0, 0);
super();
type = b2Shape.e_circleShape;
radius = 1;
}
}
}//package Box2D.Collision.Shapes
Section 2
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2CircleShape extends b2Shape {
public var m_radius:Number;
public var m_localPosition:b2Vec2;
public function b2CircleShape(_arg1:b2ShapeDef){
var _local2:b2CircleDef;
m_localPosition = new b2Vec2();
super(_arg1);
_local2 = (_arg1 as b2CircleDef);
m_type = e_circleShape;
m_localPosition.SetV(_local2.localPosition);
m_radius = _local2.radius;
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
_local3 = _arg1.R;
_local4 = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
_local5 = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_local4 = (_arg2.x - _local4);
_local5 = (_arg2.y - _local5);
return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius)));
}
public function GetLocalPosition():b2Vec2{
return (m_localPosition);
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local6:b2Mat22;
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;
_local6 = _arg1.R;
_local7 = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y)));
_local8 = (_arg1.position.x + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y)));
_local9 = (_arg4.p1.x - _local7);
_local10 = (_arg4.p1.y - _local8);
_local11 = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius));
if (_local11 < 0){
return (false);
};
_local12 = (_arg4.p2.x - _arg4.p1.x);
_local13 = (_arg4.p2.y - _arg4.p1.y);
_local14 = ((_local9 * _local12) + (_local10 * _local13));
_local15 = ((_local12 * _local12) + (_local13 * _local13));
_local16 = ((_local14 * _local14) - (_local15 * _local11));
if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){
return (false);
};
_local17 = -((_local14 + Math.sqrt(_local16)));
if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){
_local17 = (_local17 / _local15);
_arg2[0] = _local17;
_arg3.x = (_local9 + (_local17 * _local12));
_arg3.y = (_local10 + (_local17 * _local13));
_arg3.Normalize();
return (true);
};
return (false);
}
override public function ComputeMass(_arg1:b2MassData):void{
_arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius);
_arg1.center.SetV(m_localPosition);
_arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y))));
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = _arg2.R;
_local5 = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
_local6 = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_local4 = _arg3.R;
_local7 = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
_local8 = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius));
_arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius));
}
public function GetRadius():Number{
return (m_radius);
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:Number;
var _local3:Number;
_local2 = (m_localPosition.x - _arg1.x);
_local3 = (m_localPosition.y - _arg1.y);
_local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.R;
_local4 = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
_local5 = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius));
_arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius));
}
}
}//package Box2D.Collision.Shapes
Section 3
//b2FilterData (Box2D.Collision.Shapes.b2FilterData)
package Box2D.Collision.Shapes {
public class b2FilterData {
public var maskBits:uint;// = 0xFFFF
public var groupIndex:int;// = 0
public var categoryBits:uint;// = 1
public function b2FilterData(){
categoryBits = 1;
maskBits = 0xFFFF;
groupIndex = 0;
super();
}
public function Copy():b2FilterData{
var _local1:b2FilterData;
_local1 = new b2FilterData();
_local1.categoryBits = categoryBits;
_local1.maskBits = maskBits;
_local1.groupIndex = groupIndex;
return (_local1);
}
}
}//package Box2D.Collision.Shapes
Section 4
//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(){
mass = 0;
center = new b2Vec2(0, 0);
I = 0;
super();
}
}
}//package Box2D.Collision.Shapes
Section 5
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PolygonDef extends b2ShapeDef {
public var vertexCount:int;
public var vertices:Array;
private static var s_mat:b2Mat22 = new b2Mat22();
public function b2PolygonDef(){
var _local1:int;
vertices = new Array(b2Settings.b2_maxPolygonVertices);
super();
type = b2Shape.e_polygonShape;
vertexCount = 0;
_local1 = 0;
while (_local1 < b2Settings.b2_maxPolygonVertices) {
vertices[_local1] = new b2Vec2();
_local1++;
};
}
public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{
var _local5:b2Vec2;
var _local6:b2Mat22;
var _local7:int;
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
if (_arg3){
_local5 = _arg3;
_local6 = s_mat;
_local6.Set(_arg4);
_local7 = 0;
while (_local7 < vertexCount) {
_arg3 = vertices[_local7];
_arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y)));
_arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y)));
_arg3.x = _arg1;
_local7++;
};
};
}
public function SetAsBox(_arg1:Number, _arg2:Number):void{
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
}
}
}//package Box2D.Collision.Shapes
Section 6
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolygonShape extends b2Shape {
public var m_vertices:Array;
public var m_normals:Array;
private var s_supportVec:b2Vec2;
public var m_obb:b2OBB;
public var m_coreVertices:Array;
public var m_centroid:b2Vec2;
public var m_vertexCount:int;
private static var s_computeMat:b2Mat22 = new b2Mat22();
private static var s_sweptAABB1:b2AABB = new b2AABB();
private static var s_sweptAABB2:b2AABB = new b2AABB();
public function b2PolygonShape(_arg1:b2ShapeDef){
var _local2:b2PolygonDef;
var _local3:int;
var _local4:int;
var _local5:int;
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;
s_supportVec = new b2Vec2();
m_obb = new b2OBB();
m_vertices = new Array(b2Settings.b2_maxPolygonVertices);
m_normals = new Array(b2Settings.b2_maxPolygonVertices);
m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices);
super(_arg1);
m_type = e_polygonShape;
_local2 = (_arg1 as b2PolygonDef);
m_vertexCount = _local2.vertexCount;
_local4 = _local3;
_local5 = _local3;
_local3 = 0;
while (_local3 < m_vertexCount) {
m_vertices[_local3] = _local2.vertices[_local3].Copy();
_local3++;
};
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = _local3;
_local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0;
_local6 = (m_vertices[_local5].x - m_vertices[_local4].x);
_local7 = (m_vertices[_local5].y - m_vertices[_local4].y);
_local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8));
_local3++;
};
m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount);
ComputeOBB(m_obb, m_vertices, m_vertexCount);
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1);
_local5 = _local3;
_local9 = m_normals[_local4].x;
_local10 = m_normals[_local4].y;
_local11 = m_normals[_local5].x;
_local12 = m_normals[_local5].y;
_local13 = (m_vertices[_local3].x - m_centroid.x);
_local14 = (m_vertices[_local3].y - m_centroid.y);
_local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop);
_local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop);
_local17 = (1 / ((_local9 * _local12) - (_local10 * _local11)));
m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y));
_local3++;
};
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
var _local10:Number;
_local4 = _arg1.R;
_local5 = (_arg2.x - _arg1.position.x);
_local6 = (_arg2.y - _arg1.position.y);
_local7 = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y));
_local8 = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y));
_local9 = 0;
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);
}
public function GetCoreVertices():Array{
return (m_coreVertices);
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
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 _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:Number;
var _local21:Number;
_local6 = 0;
_local7 = _arg5;
_local8 = (_arg4.p1.x - _arg1.position.x);
_local9 = (_arg4.p1.y - _arg1.position.y);
_local10 = _arg1.R;
_local12 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local13 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local8 = (_arg4.p2.x - _arg1.position.x);
_local9 = (_arg4.p2.y - _arg1.position.y);
_local10 = _arg1.R;
_local14 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local15 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local16 = (_local14 - _local12);
_local17 = (_local15 - _local13);
_local18 = -1;
_local19 = 0;
while (_local19 < m_vertexCount) {
_local11 = m_vertices[_local19];
_local8 = (_local11.x - _local12);
_local9 = (_local11.y - _local13);
_local11 = m_normals[_local19];
_local20 = ((_local11.x * _local8) + (_local11.y * _local9));
_local21 = ((_local11.x * _local16) + (_local11.y * _local17));
if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){
_local6 = (_local20 / _local21);
_local18 = _local19;
} else {
if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){
_local7 = (_local20 / _local21);
};
};
if (_local7 < _local6){
return (false);
};
_local19++;
};
if (_local18 >= 0){
_arg2[0] = _local6;
_local10 = _arg1.R;
_local11 = m_normals[_local18];
_arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
return (true);
};
return (false);
}
public function GetCentroid():b2Vec2{
return (m_centroid);
}
override public function ComputeMass(_arg1:b2MassData):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
var _local10:b2Vec2;
var _local11:b2Vec2;
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;
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = (1 / 3);
_local9 = 0;
while (_local9 < m_vertexCount) {
_local10 = m_vertices[_local9];
_local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0];
_local12 = (_local10.x - _local6);
_local13 = (_local10.y - _local7);
_local14 = (_local11.x - _local6);
_local15 = (_local11.y - _local7);
_local16 = ((_local12 * _local15) - (_local13 * _local14));
_local17 = (0.5 * _local16);
_local4 = (_local4 + _local17);
_local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x)));
_local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y)));
_local18 = _local6;
_local19 = _local7;
_local20 = _local12;
_local21 = _local13;
_local22 = _local14;
_local23 = _local15;
_local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18));
_local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19));
_local5 = (_local5 + (_local16 * (_local24 + _local25)));
_local9++;
};
_arg1.mass = (m_density * _local4);
_local2 = (_local2 * (1 / _local4));
_local3 = (_local3 * (1 / _local4));
_arg1.center.Set(_local2, _local3);
_arg1.I = (m_density * _local5);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:int;
var _local11:Number;
_local5 = _arg1.R;
_local6 = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y));
_local7 = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y));
_local8 = 0;
_local4 = m_coreVertices[0];
_local9 = ((_local4.x * _local6) + (_local4.y * _local7));
_local10 = 1;
while (_local10 < m_vertexCount) {
_local4 = m_coreVertices[_local10];
_local11 = ((_local4.x * _local6) + (_local4.y * _local7));
if (_local11 > _local9){
_local8 = _local10;
_local9 = _local11;
};
_local10++;
};
_local5 = _arg1.R;
_local4 = m_coreVertices[_local8];
s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y)));
s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y)));
return (s_supportVec);
}
public function GetVertexCount():int{
return (m_vertexCount);
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2AABB;
var _local5:b2AABB;
_local4 = s_sweptAABB1;
_local5 = s_sweptAABB2;
ComputeAABB(_local4, _arg2);
ComputeAABB(_local5, _arg3);
_arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y);
_arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y);
}
public function GetVertices():Array{
return (m_vertices);
}
public function GetNormals():Array{
return (m_normals);
}
public function GetOBB():b2OBB{
return (m_obb);
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_coreVertices[0]));
}
public function Centroid(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_centroid));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:b2Vec2;
var _local3:int;
var _local4:Number;
var _local5:Number;
m_sweepRadius = 0;
_local3 = 0;
while (_local3 < m_vertexCount) {
_local2 = m_coreVertices[_local3];
_local4 = (_local2.x - _arg1.x);
_local5 = (_local2.y - _arg1.y);
_local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
if (_local4 > m_sweepRadius){
m_sweepRadius = _local4;
};
_local3++;
};
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local5 = s_computeMat;
_local3 = _arg2.R;
_local4 = m_obb.R.col1;
_local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local4 = m_obb.R.col2;
_local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local5.Abs();
_local6 = _local5;
_local4 = m_obb.extents;
_local7 = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y));
_local8 = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y));
_local3 = _arg2.R;
_local4 = m_obb.center;
_local9 = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)));
_local10 = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)));
_arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8));
_arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8));
}
public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
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();
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = (1 / 3);
_local8 = 0;
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);
}
public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{
var _local4:int;
var _local5:Array;
var _local6:Number;
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;
_local5 = new Array((b2Settings.b2_maxPolygonVertices + 1));
_local4 = 0;
while (_local4 < _arg3) {
_local5[_local4] = _arg2[_local4];
_local4++;
};
_local5[_arg3] = _local5[0];
_local6 = 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 7
//b2Shape (Box2D.Collision.Shapes.b2Shape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class b2Shape {
public var m_type:int;
public var m_sweepRadius:Number;
public var m_density:Number;
public var m_filter:b2FilterData;
public var m_friction:Number;
public var m_next:b2Shape;
public var m_restitution:Number;
public var m_userData;
public var m_isSensor:Boolean;
public var m_proxyId:uint;
public var m_body:b2Body;
public static const e_polygonShape:int = 1;
public static const e_unknownShape:int = -1;
public static const e_circleShape:int = 0;
public static const e_shapeTypeCount:int = 2;
private static var s_resetAABB:b2AABB = new b2AABB();
private static var s_syncAABB:b2AABB = new b2AABB();
private static var s_proxyAABB:b2AABB = new b2AABB();
public function b2Shape(_arg1:b2ShapeDef){
m_userData = _arg1.userData;
m_friction = _arg1.friction;
m_restitution = _arg1.restitution;
m_density = _arg1.density;
m_body = null;
m_sweepRadius = 0;
m_next = null;
m_proxyId = b2Pair.b2_nullProxy;
m_filter = _arg1.filter.Copy();
m_isSensor = _arg1.isSensor;
}
public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
return (false);
}
public function GetSweepRadius():Number{
return (m_sweepRadius);
}
public function GetNext():b2Shape{
return (m_next);
}
public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
}
public function GetType():int{
return (m_type);
}
public function GetRestitution():Number{
return (m_restitution);
}
public function GetFriction():Number{
return (m_friction);
}
public function GetFilterData():b2FilterData{
return (m_filter.Copy());
}
public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
return (false);
}
public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB;
var _local4:Boolean;
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
_arg1.DestroyProxy(m_proxyId);
_local3 = s_resetAABB;
ComputeAABB(_local3, _arg2);
_local4 = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetFilterData(_arg1:b2FilterData):void{
m_filter = _arg1.Copy();
}
public function GetUserData(){
return (m_userData);
}
public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{
var _local4:b2AABB;
if (m_proxyId == b2Pair.b2_nullProxy){
return (false);
};
_local4 = s_syncAABB;
ComputeSweptAABB(_local4, _arg2, _arg3);
if (_arg1.InRange(_local4)){
_arg1.MoveProxy(m_proxyId, _local4);
return (true);
};
return (false);
}
public function ComputeMass(_arg1:b2MassData):void{
}
public function IsSensor():Boolean{
return (m_isSensor);
}
public function DestroyProxy(_arg1:b2BroadPhase):void{
if (m_proxyId != b2Pair.b2_nullProxy){
_arg1.DestroyProxy(m_proxyId);
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function UpdateSweepRadius(_arg1:b2Vec2):void{
}
public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
}
public function GetBody():b2Body{
return (m_body);
}
public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB;
var _local4:Boolean;
_local3 = s_proxyAABB;
ComputeAABB(_local3, _arg2);
_local4 = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public static function Destroy(_arg1:b2Shape, _arg2):void{
}
public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{
switch (_arg1.type){
case e_circleShape:
return (new b2CircleShape(_arg1));
case e_polygonShape:
return (new b2PolygonShape(_arg1));
default:
return (null);
};
}
}
}//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef)
package Box2D.Collision.Shapes {
public class b2ShapeDef {
public var isSensor:Boolean;// = false
public var density:Number;// = 0
public var type:int;// = -1
public var restitution:Number;// = 0
public var userData;// = null
public var filter:b2FilterData;
public var friction:Number;// = 0.2
public function b2ShapeDef(){
type = b2Shape.e_unknownShape;
userData = null;
friction = 0.2;
restitution = 0;
density = 0;
isSensor = false;
filter = new b2FilterData();
super();
}
}
}//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2AABB {
public var upperBound:b2Vec2;
public var lowerBound:b2Vec2;
public function b2AABB(){
lowerBound = new b2Vec2();
upperBound = new b2Vec2();
super();
}
public function IsValid():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:Boolean;
_local1 = (upperBound.x - lowerBound.x);
_local2 = (upperBound.y - lowerBound.y);
_local3 = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid()));
return (_local3);
}
}
}//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound)
package Box2D.Collision {
public class b2Bound {
public var proxyId:uint;
public var stabbingCount:uint;
public var value:uint;
public function Swap(_arg1:b2Bound):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
_local2 = value;
_local3 = proxyId;
_local4 = stabbingCount;
value = _arg1.value;
proxyId = _arg1.proxyId;
stabbingCount = _arg1.stabbingCount;
_arg1.value = _local2;
_arg1.proxyId = _local3;
_arg1.stabbingCount = _local4;
}
public function IsLower():Boolean{
return (((value & 1) == 0));
}
public function IsUpper():Boolean{
return (((value & 1) == 1));
}
}
}//package Box2D.Collision
Section 11
//b2BoundValues (Box2D.Collision.b2BoundValues)
package Box2D.Collision {
public class b2BoundValues {
public var lowerValues:Array;
public var upperValues:Array;
public function b2BoundValues(){
lowerValues = [0, 0];
upperValues = [0, 0];
super();
}
}
}//package Box2D.Collision
Section 12
//b2BroadPhase (Box2D.Collision.b2BroadPhase)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2BroadPhase {
public var m_quantizationFactor:b2Vec2;
public var m_worldAABB:b2AABB;
public var m_bounds:Array;
public var m_freeProxy:uint;
public var m_proxyCount:int;
public var m_proxyPool:Array;
public var m_queryResultCount:int;
public var m_pairManager:b2PairManager;
public var m_timeStamp:uint;
public var m_queryResults:Array;
public static const b2_nullEdge:uint = b2Settings.USHRT_MAX;
public static const b2_invalid:uint = b2Settings.USHRT_MAX;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:b2Proxy;
var _local7:int;
m_pairManager = new b2PairManager();
m_proxyPool = new Array(b2Settings.b2_maxPairs);
m_bounds = new Array((2 * b2Settings.b2_maxProxies));
m_queryResults = new Array(b2Settings.b2_maxProxies);
m_quantizationFactor = new b2Vec2();
super();
m_pairManager.Initialize(this, _arg2);
m_worldAABB = _arg1;
m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
m_queryResults[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
_local4 = (_arg1.upperBound.x - _arg1.lowerBound.x);
_local5 = (_arg1.upperBound.y - _arg1.lowerBound.y);
m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4);
m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5);
_local3 = 0;
while (_local3 < (b2Settings.b2_maxProxies - 1)) {
_local6 = new b2Proxy();
m_proxyPool[_local3] = _local6;
_local6.SetNext((_local3 + 1));
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
_local3++;
};
_local6 = new b2Proxy();
m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6;
_local6.SetNext(b2Pair.b2_nullProxy);
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
m_freeProxy = 0;
m_timeStamp = 1;
m_queryResultCount = 0;
}
public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{
var _local4:Array;
var _local5:Array;
var _local6:uint;
var _local7:uint;
var _local8:Array;
var _local9:Array;
var _local10:int;
var _local11:int;
var _local12:b2Proxy;
_local4 = new Array();
_local5 = new Array();
ComputeBounds(_local4, _local5, _arg1);
_local8 = [_local6];
_local9 = [_local7];
Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0);
Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1);
_local10 = 0;
_local11 = 0;
while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) {
_local12 = m_proxyPool[m_queryResults[_local11]];
_arg2[_local11] = _local12.userData;
_local11++;
_local10++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local10);
}
public function Commit():void{
m_pairManager.Commit();
}
public function GetProxy(_arg1:int):b2Proxy{
var _local2:b2Proxy;
_local2 = m_proxyPool[_arg1];
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){
return (null);
};
return (_local2);
}
private function IncrementTimeStamp():void{
var _local1:uint;
if (m_timeStamp == b2Settings.USHRT_MAX){
_local1 = 0;
while (_local1 < b2Settings.b2_maxProxies) {
(m_proxyPool[_local1] as b2Proxy).timeStamp = 0;
_local1++;
};
m_timeStamp = 1;
} else {
m_timeStamp++;
};
}
private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
var _local11:uint;
var _local12:int;
var _local13:int;
var _local14:b2Proxy;
_local8 = BinarySearch(_arg5, _arg6, _arg3);
_local9 = BinarySearch(_arg5, _arg6, _arg4);
_local11 = _local8;
while (_local11 < _local9) {
_local10 = _arg5[_local11];
if (_local10.IsLower()){
IncrementOverlapCount(_local10.proxyId);
};
_local11++;
};
if (_local8 > 0){
_local12 = (_local8 - 1);
_local10 = _arg5[_local12];
_local13 = _local10.stabbingCount;
while (_local13) {
_local10 = _arg5[_local12];
if (_local10.IsLower()){
_local14 = m_proxyPool[_local10.proxyId];
if (_local8 <= _local14.upperBounds[_arg7]){
IncrementOverlapCount(_local10.proxyId);
_local13--;
};
};
_local12--;
};
};
_arg1[0] = _local8;
_arg2[0] = _local9;
}
private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{
var _local3:int;
var _local4:Array;
var _local5:b2Bound;
var _local6:b2Bound;
_local3 = 0;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg1.lowerBounds[_local3]];
_local6 = _local4[_arg2.upperBounds[_local3]];
if (_local5.value > _local6.value){
return (false);
};
_local5 = _local4[_arg1.upperBounds[_local3]];
_local6 = _local4[_arg2.lowerBounds[_local3]];
if (_local5.value < _local6.value){
return (false);
};
_local3++;
};
return (true);
}
private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local4 = _arg3.lowerBound.x;
_local5 = _arg3.lowerBound.y;
_local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x);
_local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y);
_local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x);
_local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y);
_local6 = _arg3.upperBound.x;
_local7 = _arg3.upperBound.y;
_local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x);
_local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y);
_local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x);
_local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y);
_arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1));
_arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1);
_arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1));
_arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1);
}
public function CreateProxy(_arg1:b2AABB, _arg2):uint{
var _local3:uint;
var _local4:b2Proxy;
var _local5:uint;
var _local6:uint;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:int;
var _local11:Array;
var _local12:uint;
var _local13:uint;
var _local14:Array;
var _local15:Array;
var _local16:Array;
var _local17:int;
var _local18:int;
var _local19:b2Bound;
var _local20:b2Bound;
var _local21:b2Bound;
var _local22:int;
var _local23:b2Proxy;
_local5 = m_freeProxy;
_local4 = m_proxyPool[_local5];
m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
_local6 = (2 * m_proxyCount);
_local7 = new Array();
_local8 = new Array();
ComputeBounds(_local7, _local8, _arg1);
_local9 = 0;
while (_local9 < 2) {
_local11 = m_bounds[_local9];
_local14 = [_local12];
_local15 = [_local13];
Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9);
_local12 = _local14[0];
_local13 = _local15[0];
_local16 = new Array();
_local18 = (_local6 - _local13);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local13 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local13 + 2);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local16 = new Array();
_local18 = (_local13 - _local12);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local12 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local12 + 1);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local13++;
_local19 = _local11[_local12];
_local20 = _local11[_local13];
_local19.value = _local7[_local9];
_local19.proxyId = _local5;
_local20.value = _local8[_local9];
_local20.proxyId = _local5;
_local21 = _local11[int((_local12 - 1))];
_local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount;
_local21 = _local11[int((_local13 - 1))];
_local20.stabbingCount = _local21.stabbingCount;
_local3 = _local12;
while (_local3 < _local13) {
_local21 = _local11[_local3];
_local21.stabbingCount++;
_local3++;
};
_local3 = _local12;
while (_local3 < (_local6 + 2)) {
_local19 = _local11[_local3];
_local23 = m_proxyPool[_local19.proxyId];
if (_local19.IsLower()){
_local23.lowerBounds[_local9] = _local3;
} else {
_local23.upperBounds[_local9] = _local3;
};
_local3++;
};
_local9++;
};
m_proxyCount++;
_local10 = 0;
while (_local10 < m_queryResultCount) {
m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]);
_local10++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local5);
}
public function DestroyProxy(_arg1:uint):void{
var _local2:b2Bound;
var _local3:b2Bound;
var _local4:b2Proxy;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Array;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:Array;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:uint;
var _local18:int;
var _local19:b2Proxy;
_local4 = m_proxyPool[_arg1];
_local5 = (2 * m_proxyCount);
_local6 = 0;
while (_local6 < 2) {
_local8 = m_bounds[_local6];
_local9 = _local4.lowerBounds[_local6];
_local10 = _local4.upperBounds[_local6];
_local2 = _local8[_local9];
_local11 = _local2.value;
_local3 = _local8[_local10];
_local12 = _local3.value;
_local13 = new Array();
_local15 = ((_local10 - _local9) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local9 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = _local9;
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local13 = new Array();
_local15 = ((_local5 - _local10) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local10 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = (_local10 - 1);
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = (_local5 - 2);
_local17 = _local9;
while (_local17 < _local15) {
_local2 = _local8[_local17];
_local19 = m_proxyPool[_local2.proxyId];
if (_local2.IsLower()){
_local19.lowerBounds[_local6] = _local17;
} else {
_local19.upperBounds[_local6] = _local17;
};
_local17++;
};
_local15 = (_local10 - 1);
_local18 = _local9;
while (_local18 < _local15) {
_local2 = _local8[_local18];
_local2.stabbingCount--;
_local18++;
};
Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6);
_local6++;
};
_local7 = 0;
while (_local7 < m_queryResultCount) {
m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]);
_local7++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
_local4.userData = null;
_local4.overlapCount = b2_invalid;
_local4.lowerBounds[0] = b2_invalid;
_local4.lowerBounds[1] = b2_invalid;
_local4.upperBounds[0] = b2_invalid;
_local4.upperBounds[1] = b2_invalid;
_local4.SetNext(m_freeProxy);
m_freeProxy = _arg1;
m_proxyCount--;
}
public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{
var _local3:int;
var _local4:Array;
var _local5:b2Bound;
_local3 = 0;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg2.upperBounds[_local3]];
if (_arg1.lowerValues[_local3] > _local5.value){
return (false);
};
_local5 = _local4[_arg2.lowerBounds[_local3]];
if (_arg1.upperValues[_local3] < _local5.value){
return (false);
};
_local3++;
};
return (true);
}
public function Validate():void{
var _local1:b2Pair;
var _local2:b2Proxy;
var _local3:b2Proxy;
var _local4:Boolean;
var _local5:int;
var _local6:b2Bound;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
_local5 = 0;
while (_local5 < 2) {
_local6 = m_bounds[_local5];
_local7 = (2 * m_proxyCount);
_local8 = 0;
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local6[_local9];
if (_local10.IsLower() == true){
_local8++;
} else {
_local8--;
};
_local9++;
};
_local5++;
};
}
private function IncrementOverlapCount(_arg1:uint):void{
var _local2:b2Proxy;
_local2 = m_proxyPool[_arg1];
if (_local2.timeStamp < m_timeStamp){
_local2.timeStamp = m_timeStamp;
_local2.overlapCount = 1;
} else {
_local2.overlapCount = 2;
m_queryResults[m_queryResultCount] = _arg1;
m_queryResultCount++;
};
}
public function InRange(_arg1:b2AABB):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = _arg1.lowerBound.x;
_local3 = _arg1.lowerBound.y;
_local2 = (_local2 - m_worldAABB.upperBound.x);
_local3 = (_local3 - m_worldAABB.upperBound.y);
_local4 = m_worldAABB.lowerBound.x;
_local5 = m_worldAABB.lowerBound.y;
_local4 = (_local4 - _arg1.upperBound.x);
_local5 = (_local5 - _arg1.upperBound.y);
_local2 = b2Math.b2Max(_local2, _local4);
_local3 = b2Math.b2Max(_local3, _local5);
return ((b2Math.b2Max(_local2, _local3) < 0));
}
public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{
var _local3:Array;
var _local4:int;
var _local5:uint;
var _local6:uint;
var _local7:b2Bound;
var _local8:b2Bound;
var _local9:b2Bound;
var _local10:uint;
var _local11:b2Proxy;
var _local12:uint;
var _local13:b2Proxy;
var _local14:b2BoundValues;
var _local15:b2BoundValues;
var _local16:Array;
var _local17:uint;
var _local18:uint;
var _local19:uint;
var _local20:uint;
var _local21:int;
var _local22:int;
var _local23:uint;
var _local24:b2Proxy;
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){
return;
};
if (_arg2.IsValid() == false){
return;
};
_local12 = (2 * m_proxyCount);
_local13 = m_proxyPool[_arg1];
_local14 = new b2BoundValues();
ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2);
_local15 = new b2BoundValues();
_local5 = 0;
while (_local5 < 2) {
_local7 = m_bounds[_local5][_local13.lowerBounds[_local5]];
_local15.lowerValues[_local5] = _local7.value;
_local7 = m_bounds[_local5][_local13.upperBounds[_local5]];
_local15.upperValues[_local5] = _local7.value;
_local5++;
};
_local5 = 0;
while (_local5 < 2) {
_local16 = m_bounds[_local5];
_local17 = _local13.lowerBounds[_local5];
_local18 = _local13.upperBounds[_local5];
_local19 = _local14.lowerValues[_local5];
_local20 = _local14.upperValues[_local5];
_local7 = _local16[_local17];
_local21 = (_local19 - _local7.value);
_local7.value = _local19;
_local7 = _local16[_local18];
_local22 = (_local20 - _local7.value);
_local7.value = _local20;
if (_local21 < 0){
_local6 = _local17;
while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local8.proxyId];
_local8.stabbingCount++;
if (_local8.IsUpper() == true){
if (TestOverlap(_local14, _local24)){
m_pairManager.AddBufferedPair(_arg1, _local23);
};
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
if (_local22 > 0){
_local6 = _local18;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount++;
if (_local9.IsLower() == true){
if (TestOverlap(_local14, _local11)){
m_pairManager.AddBufferedPair(_arg1, _local10);
};
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local21 > 0){
_local6 = _local17;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount--;
if (_local9.IsUpper()){
if (TestOverlap(_local15, _local11)){
m_pairManager.RemoveBufferedPair(_arg1, _local10);
};
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local22 < 0){
_local6 = _local18;
while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local23];
_local8.stabbingCount--;
if (_local8.IsLower() == true){
if (TestOverlap(_local15, _local24)){
m_pairManager.RemoveBufferedPair(_arg1, _local23);
};
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
_local5++;
};
}
public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:b2Bound;
_local4 = 0;
_local5 = (_arg2 - 1);
while (_local4 <= _local5) {
_local6 = ((_local4 + _local5) / 2);
_local7 = _arg1[_local6];
if (_local7.value > _arg3){
_local5 = (_local6 - 1);
} else {
if (_local7.value < _arg3){
_local4 = (_local6 + 1);
} else {
return (uint(_local6));
};
};
};
return (uint(_local4));
}
}
}//package Box2D.Collision
Section 13
//b2BufferedPair (Box2D.Collision.b2BufferedPair)
package Box2D.Collision {
public class b2BufferedPair {
public var proxyId1:uint;
public var proxyId2:uint;
}
}//package Box2D.Collision
Section 14
//b2Collision (Box2D.Collision.b2Collision)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Collision {
public static const b2_nullFeature:uint = 0xFF;
private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2();
public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local6:int;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:Array;
var _local11:b2Mat22;
var _local12:b2Vec2;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:int;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_local6 = _arg1.m_vertexCount;
_local7 = _arg1.m_vertices;
_local8 = _arg1.m_normals;
_local9 = _arg4.m_vertexCount;
_local10 = _arg4.m_vertices;
_local11 = _arg2.R;
_local12 = _local8[_arg3];
_local13 = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y));
_local14 = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y));
_local11 = _arg5.R;
_local15 = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14));
_local16 = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14));
_local17 = 0;
_local18 = Number.MAX_VALUE;
_local19 = 0;
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;
_local20 = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
_local21 = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local12 = _local10[_local17];
_local11 = _arg5.R;
_local22 = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
_local23 = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local22 = (_local22 - _local20);
_local23 = (_local23 - _local21);
_local24 = ((_local22 * _local13) + (_local23 * _local14));
return (_local24);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = _arg2.lowerBound;
_local4 = _arg1.upperBound;
_local5 = (_local3.x - _local4.x);
_local6 = (_local3.y - _local4.y);
_local3 = _arg1.lowerBound;
_local4 = _arg2.upperBound;
_local7 = (_local3.x - _local4.x);
_local8 = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{
var _local7:int;
var _local8:Array;
var _local9:int;
var _local10:Array;
var _local11:Array;
var _local12:b2Mat22;
var _local13:b2Vec2;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:int;
var _local20:ClipVertex;
var _local21:int;
var _local22:int;
var _local23:Number;
_local7 = _arg2.m_vertexCount;
_local8 = _arg2.m_normals;
_local9 = _arg5.m_vertexCount;
_local10 = _arg5.m_vertices;
_local11 = _arg5.m_normals;
_local12 = _arg3.R;
_local13 = _local8[_arg4];
_local14 = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y));
_local15 = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y));
_local12 = _arg6.R;
_local16 = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15));
_local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15));
_local14 = _local16;
_local17 = 0;
_local18 = Number.MAX_VALUE;
_local19 = 0;
while (_local19 < _local9) {
_local13 = _local11[_local19];
_local23 = ((_local14 * _local13.x) + (_local15 * _local13.y));
if (_local23 < _local18){
_local18 = _local23;
_local17 = _local19;
};
_local19++;
};
_local21 = _local17;
_local22 = (((_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;
}
public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{
var _local6:ClipVertex;
var _local7:int;
var _local8:Array;
var _local9:Number;
var _local10:int;
var _local11:Array;
var _local12:Number;
var _local13:b2PolygonShape;
var _local14:b2PolygonShape;
var _local15:b2XForm;
var _local16:b2XForm;
var _local17:int;
var _local18:uint;
var _local19:Number;
var _local20:Number;
var _local21:Array;
var _local22:int;
var _local23:Array;
var _local24:b2Vec2;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:b2Vec2;
var _local28:b2Vec2;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Array;
var _local33:Array;
var _local34:int;
var _local35:int;
var _local36:int;
var _local37:b2Vec2;
var _local38:Number;
var _local39:b2ManifoldPoint;
_arg1.pointCount = 0;
_local7 = 0;
_local8 = [_local7];
_local9 = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5);
_local7 = _local8[0];
if (_local9 > 0){
return;
};
_local10 = 0;
_local11 = [_local10];
_local12 = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3);
_local10 = _local11[0];
if (_local12 > 0){
return;
};
_local15 = new b2XForm();
_local16 = new b2XForm();
_local19 = 0.98;
_local20 = 0.001;
if (_local12 > ((_local19 * _local9) + _local20)){
_local13 = _arg4;
_local14 = _arg2;
_local15.Set(_arg5);
_local16.Set(_arg3);
_local17 = _local10;
_local18 = 1;
} else {
_local13 = _arg2;
_local14 = _arg4;
_local15.Set(_arg3);
_local16.Set(_arg5);
_local17 = _local7;
_local18 = 0;
};
_local21 = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16);
_local22 = _local13.m_vertexCount;
_local23 = _local13.m_vertices;
_local24 = _local23[_local17];
_local25 = _local24.Copy();
if ((_local17 + 1) < _local22){
_local24 = _local23[int((_local17 + 1))];
_local37 = _local24.Copy();
} else {
_local24 = _local23[0];
_local37 = _local24.Copy();
};
_local26 = b2Math.SubtractVV(_local37, _local25);
_local27 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25));
_local27.Normalize();
_local28 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local37 = b2Math.b2MulX(_local15, _local37);
_local29 = b2Math.b2Dot(_local28, _local25);
_local30 = -(b2Math.b2Dot(_local27, _local25));
_local31 = b2Math.b2Dot(_local27, _local37);
_local32 = [new ClipVertex(), new ClipVertex()];
_local33 = [new ClipVertex(), new ClipVertex()];
_local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30);
if (_local34 < 2){
return;
};
_local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31);
if (_local34 < 2){
return;
};
_arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy();
_local35 = 0;
_local36 = 0;
while (_local36 < b2Settings.b2_maxManifoldPoints) {
_local6 = _local33[_local36];
_local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29);
if (_local38 <= 0){
_local39 = _arg1.points[_local35];
_local39.separation = _local38;
_local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local39.id.key = _local6.id._key;
_local39.id.features.flip = _local18;
_local35++;
};
_local36++;
};
_arg1.pointCount = _local35;
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local6:int;
var _local7:Array;
var _local8:b2Vec2;
var _local9:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:int;
var _local15:Number;
var _local16:int;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:int;
var _local21:Number;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:Number;
_local6 = _arg2.m_vertexCount;
_local7 = _arg2.m_normals;
_local9 = _arg5.R;
_local8 = _arg4.m_centroid;
_local10 = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)));
_local11 = (_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))));
_local12 = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y));
_local13 = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y));
_local14 = 0;
_local15 = -(Number.MAX_VALUE);
_local16 = 0;
while (_local16 < _local6) {
_local8 = _local7[_local16];
_local25 = ((_local8.x * _local12) + (_local8.y * _local13));
if (_local25 > _local15){
_local15 = _local25;
_local14 = _local16;
};
_local16++;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
_local18 = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1);
_local19 = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5);
if (_local19 > 0){
return (_local19);
};
_local20 = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0;
_local21 = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5);
if (_local21 > 0){
return (_local21);
};
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 > 0){
return (_local17);
};
if (_local17 > _local23){
_local22 = _local14;
_local23 = _local17;
} else {
break;
};
};
_arg1[0] = _local22;
return (_local23);
}
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:ClipVertex;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:b2Vec2;
var _local13:ClipVertex;
_local6 = 0;
_local5 = _arg2[0];
_local7 = _local5.v;
_local5 = _arg2[1];
_local8 = _local5.v;
_local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4);
_local10 = (b2Math.b2Dot(_arg3, _local8) - _arg4);
if (_local9 <= 0){
var _temp1 = _local6;
_local6 = (_local6 + 1);
var _local14 = _temp1;
_arg1[_local14] = _arg2[0];
};
if (_local10 <= 0){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_local14 = _temp2;
_arg1[_local14] = _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 b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2Mat22;
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:Number;
var _local18:Number;
var _local19:b2ManifoldPoint;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_arg1.pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_localPosition;
_local8 = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
_local9 = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_localPosition;
_local10 = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
_local11 = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local12 = (_local10 - _local8);
_local13 = (_local11 - _local9);
_local14 = ((_local12 * _local12) + (_local13 * _local13));
_local15 = _arg2.m_radius;
_local16 = _arg4.m_radius;
_local17 = (_local15 + _local16);
if (_local14 > (_local17 * _local17)){
return;
};
if (_local14 < Number.MIN_VALUE){
_local18 = -(_local17);
_arg1.normal.Set(0, 1);
} else {
_local24 = Math.sqrt(_local14);
_local18 = (_local24 - _local17);
_local25 = (1 / _local24);
_arg1.normal.x = (_local25 * _local12);
_arg1.normal.y = (_local25 * _local13);
};
_arg1.pointCount = 1;
_local19 = _arg1.points[0];
_local19.id.key = 0;
_local19.separation = _local18;
_local8 = (_local8 + (_local15 * _arg1.normal.x));
_local9 = (_local9 + (_local15 * _arg1.normal.y));
_local10 = (_local10 - (_local16 * _arg1.normal.x));
_local11 = (_local11 - (_local16 * _arg1.normal.y));
_local20 = (0.5 * (_local8 + _local10));
_local21 = (0.5 * (_local9 + _local11));
_local22 = (_local20 - _arg3.position.x);
_local23 = (_local21 - _arg3.position.y);
_local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y));
_local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y));
_local22 = (_local20 - _arg5.position.x);
_local23 = (_local21 - _arg5.position.y);
_local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y));
_local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y));
}
public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2ManifoldPoint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local12:b2Mat22;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:Number;
var _local21:int;
var _local22:Array;
var _local23:Array;
var _local24:int;
var _local25:int;
var _local26:int;
var _local27:b2Vec2;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_arg1.pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_localPosition;
_local13 = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
_local14 = (_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;
_local15 = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local16 = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local18 = 0;
_local19 = -(Number.MAX_VALUE);
_local20 = _arg4.m_radius;
_local21 = _arg2.m_vertexCount;
_local22 = _arg2.m_vertices;
_local23 = _arg2.m_normals;
_local24 = 0;
while (_local24 < _local21) {
_local11 = _local22[_local24];
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local11 = _local23[_local24];
_local34 = ((_local11.x * _local7) + (_local11.y * _local8));
if (_local34 > _local20){
return;
};
if (_local34 > _local19){
_local19 = _local34;
_local18 = _local24;
};
_local24++;
};
if (_local19 < Number.MIN_VALUE){
_arg1.pointCount = 1;
_local11 = _local23[_local18];
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y));
_arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y));
_local6 = _arg1.points[0];
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local19 - _local20);
return;
};
_local25 = _local18;
_local26 = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
_local11 = _local22[_local25];
_local27 = _local22[_local26];
_local28 = (_local27.x - _local11.x);
_local29 = (_local27.y - _local11.y);
_local30 = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local31 = ((_local7 * _local28) + (_local8 * _local29));
_local6 = _arg1.points[0];
if (_local31 <= 0){
_local32 = _local11.x;
_local33 = _local11.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local25;
} else {
if (_local31 >= _local30){
_local32 = _local27.x;
_local33 = _local27.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local26;
} else {
_local32 = ((_local28 * _local31) + _local11.x);
_local33 = ((_local29 * _local31) + _local11.y);
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = 0;
};
};
_local7 = (_local15 - _local32);
_local8 = (_local16 - _local33);
_local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local7 / _local17);
_local8 = (_local8 / _local17);
if (_local17 > _local20){
return;
};
_arg1.pointCount = 1;
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8));
_arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8));
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local17 - _local20);
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
}
}
}//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID)
package Box2D.Collision {
public class b2ContactID {
public var _key:uint;
public var features:Features;
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;
_local1 = 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 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class b2ContactPoint {
public var separation:Number;
public var normal:b2Vec2;
public var position:b2Vec2;
public var restitution:Number;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var id:b2ContactID;
public var friction:Number;
public var velocity:b2Vec2;
public function b2ContactPoint(){
position = new b2Vec2();
velocity = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Distance {
private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var gPoint:b2Point = new b2Point();
public static var g_GJK_Iterations:int = 0;
public static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{
var _local4:Number;
var _local5:int;
var _local6:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local4 = (100 * Number.MIN_VALUE);
_local5 = 0;
while (_local5 < _arg3) {
_local6 = _arg2[_local5];
_local7 = Math.abs((_arg1.x - _local6.x));
_local8 = Math.abs((_arg1.y - _local6.y));
_local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x));
_local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y));
if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){
return (true);
};
_local5++;
};
return (false);
}
public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{
var _local7:b2Vec2;
var _local8:Array;
var _local9:Array;
var _local10:Array;
var _local11:int;
var _local12:Number;
var _local13:int;
var _local14:int;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:int;
_local8 = s_p1s;
_local9 = s_p2s;
_local10 = s_points;
_local11 = 0;
_arg1.SetV(_arg3.GetFirstVertex(_arg4));
_arg2.SetV(_arg5.GetFirstVertex(_arg6));
_local12 = 0;
_local13 = 20;
_local14 = 0;
while (_local14 < _local13) {
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local17 = _arg3.Support(_arg4, _local15, _local16);
_local18 = _arg5.Support(_arg6, -(_local15), -(_local16));
_local12 = ((_local15 * _local15) + (_local16 * _local16));
_local19 = (_local18.x - _local17.x);
_local20 = (_local18.y - _local17.y);
_local21 = ((_local15 * _local19) + (_local16 * _local20));
if ((_local12 - ((_local15 * _local19) + (_local16 * _local20))) <= (0.01 * _local12)){
if (_local11 == 0){
_arg1.SetV(_local17);
_arg2.SetV(_local18);
};
g_GJK_Iterations = _local14;
return (Math.sqrt(_local12));
};
switch (_local11){
case 0:
_local7 = _local8[0];
_local7.SetV(_local17);
_local7 = _local9[0];
_local7.SetV(_local18);
_local7 = _local10[0];
_local7.x = _local19;
_local7.y = _local20;
_arg1.SetV(_local8[0]);
_arg2.SetV(_local9[0]);
_local11++;
break;
case 1:
_local7 = _local8[1];
_local7.SetV(_local17);
_local7 = _local9[1];
_local7.SetV(_local18);
_local7 = _local10[1];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessTwo(_arg1, _arg2, _local8, _local9, _local10);
break;
case 2:
_local7 = _local8[2];
_local7.SetV(_local17);
_local7 = _local9[2];
_local7.SetV(_local18);
_local7 = _local10[2];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessThree(_arg1, _arg2, _local8, _local9, _local10);
break;
};
if (_local11 == 3){
g_GJK_Iterations = _local14;
return (0);
};
_local22 = -(Number.MAX_VALUE);
_local23 = 0;
while (_local23 < _local11) {
_local7 = _local10[_local23];
_local22 = b2Math.b2Max(_local22, ((_local7.x * _local7.x) + (_local7.y * _local7.y)));
_local23++;
};
if ((((_local11 == 3)) || ((_local12 <= ((100 * Number.MIN_VALUE) * _local22))))){
g_GJK_Iterations = _local14;
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local12 = ((_local15 * _local15) + (_local16 * _local16));
return (Math.sqrt(_local12));
};
_local14++;
};
g_GJK_Iterations = _local13;
return (Math.sqrt(_local12));
}
public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
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;
_local7 = _arg4.R;
_local8 = _arg3.m_localPosition;
_local9 = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local10 = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local7 = _arg6.R;
_local8 = _arg5.m_localPosition;
_local11 = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local12 = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local13 = (_local11 - _local9);
_local14 = (_local12 - _local10);
_local15 = ((_local13 * _local13) + (_local14 * _local14));
_local16 = (_arg3.m_radius - b2Settings.b2_toiSlop);
_local17 = (_arg5.m_radius - b2Settings.b2_toiSlop);
_local18 = (_local16 + _local17);
if (_local15 > (_local18 * _local18)){
_local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14)));
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_local20 = (_local19 - _local18);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = (_local11 - (_local17 * _local13));
_arg2.y = (_local12 - (_local17 * _local14));
return (_local20);
};
if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){
_local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14)));
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
};
_arg1.x = _local9;
_arg1.y = _local10;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
}
public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:b2Vec2;
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 _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
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;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg5[2];
_local9 = _arg3[0];
_local10 = _arg3[1];
_local11 = _arg3[2];
_local12 = _arg4[0];
_local13 = _arg4[1];
_local14 = _arg4[2];
_local15 = _local6.x;
_local16 = _local6.y;
_local17 = _local7.x;
_local18 = _local7.y;
_local19 = _local8.x;
_local20 = _local8.y;
_local21 = (_local17 - _local15);
_local22 = (_local18 - _local16);
_local23 = (_local19 - _local15);
_local24 = (_local20 - _local16);
_local25 = (_local19 - _local17);
_local26 = (_local20 - _local18);
_local27 = -(((_local15 * _local21) + (_local16 * _local22)));
_local28 = ((_local17 * _local21) + (_local18 * _local22));
_local29 = -(((_local15 * _local23) + (_local16 * _local24)));
_local30 = ((_local19 * _local23) + (_local20 * _local24));
_local31 = -(((_local17 * _local25) + (_local18 * _local26)));
_local32 = ((_local19 * _local25) + (_local20 * _local26));
if ((((_local30 <= 0)) && ((_local32 <= 0)))){
_arg1.SetV(_local11);
_arg2.SetV(_local14);
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (1);
};
_local33 = ((_local21 * _local24) - (_local22 * _local23));
_local34 = (_local33 * ((_local15 * _local18) - (_local16 * _local17)));
_local36 = (_local33 * ((_local17 * _local20) - (_local18 * _local19)));
if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){
_local35 = (_local31 / (_local31 + _local32));
_arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x)));
_arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y)));
_arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x)));
_arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y)));
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (2);
};
_local37 = (_local33 * ((_local19 * _local16) - (_local20 * _local15)));
if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){
_local35 = (_local29 / (_local29 + _local30));
_arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x)));
_arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y)));
_arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x)));
_arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y)));
_local10.SetV(_local11);
_local13.SetV(_local14);
_local7.SetV(_local8);
return (2);
};
_local38 = ((_local36 + _local37) + _local34);
_local38 = (1 / _local38);
_local39 = (_local36 * _local38);
_local40 = (_local37 * _local38);
_local41 = ((1 - _local39) - _local40);
_arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x));
_arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y));
_arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x));
_arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y));
return (3);
}
public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local9:b2Point;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local9 = gPoint;
_local8 = _arg5.m_localPosition;
_local7 = _arg6.R;
_local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local10 = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity);
_local11 = (_arg5.m_radius - b2Settings.b2_toiSlop);
if (_local10 > _local11){
_local10 = (_local10 - _local11);
_local12 = (_arg2.x - _arg1.x);
_local13 = (_arg2.y - _arg1.y);
_local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13)));
_local12 = (_local12 / _local14);
_local13 = (_local13 / _local14);
_arg2.x = (_arg2.x - (_local11 * _local12));
_arg2.y = (_arg2.y - (_local11 * _local13));
} else {
_local10 = 0;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
};
return (_local10);
}
public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{
var _local7:int;
var _local8:int;
_local7 = _arg3.m_type;
_local8 = _arg5.m_type;
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6));
};
return (0);
}
public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg3[0];
_local9 = _arg3[1];
_local10 = _arg4[0];
_local11 = _arg4[1];
_local12 = -(_local7.x);
_local13 = -(_local7.y);
_local14 = (_local6.x - _local7.x);
_local15 = (_local6.y - _local7.y);
_local16 = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
_local14 = (_local14 / _local16);
_local15 = (_local15 / _local16);
_local17 = ((_local12 * _local14) + (_local13 * _local15));
if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){
_arg1.SetV(_local9);
_arg2.SetV(_local11);
_local8.SetV(_local9);
_local10.SetV(_local11);
_local6.SetV(_local7);
return (1);
};
_local17 = (_local17 / _local16);
_arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x)));
_arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y)));
_arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x)));
_arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y)));
return (2);
}
}
}//package Box2D.Collision
Section 18
//b2Manifold (Box2D.Collision.b2Manifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Manifold {
public var points:Array;
public var pointCount:int;// = 0
public var normal:b2Vec2;
public function b2Manifold(){
var _local1:int;
pointCount = 0;
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ManifoldPoint();
_local1++;
};
normal = new b2Vec2();
}
public function Set(_arg1:b2Manifold):void{
var _local2:int;
pointCount = _arg1.pointCount;
_local2 = 0;
while (_local2 < b2Settings.b2_maxManifoldPoints) {
(points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]);
_local2++;
};
normal.SetV(_arg1.normal);
}
public function Reset():void{
var _local1:int;
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
normal.SetZero();
pointCount = 0;
}
}
}//package Box2D.Collision
Section 19
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2ManifoldPoint {
public var separation:Number;
public var localPoint2:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var localPoint1:b2Vec2;
public var id:b2ContactID;
public function b2ManifoldPoint(){
localPoint1 = new b2Vec2();
localPoint2 = new b2Vec2();
id = new b2ContactID();
super();
}
public function Set(_arg1:b2ManifoldPoint):void{
localPoint1.SetV(_arg1.localPoint1);
localPoint2.SetV(_arg1.localPoint2);
separation = _arg1.separation;
normalImpulse = _arg1.normalImpulse;
tangentImpulse = _arg1.tangentImpulse;
id.key = _arg1.id.key;
}
public function Reset():void{
localPoint1.SetZero();
localPoint2.SetZero();
separation = 0;
normalImpulse = 0;
tangentImpulse = 0;
id.key = 0;
}
}
}//package Box2D.Collision
Section 20
//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 21
//b2Pair (Box2D.Collision.b2Pair)
package Box2D.Collision {
import Box2D.Common.*;
public class b2Pair {
public var userData;// = null
public var proxyId1:uint;
public var proxyId2:uint;
public var status:uint;
public var next:uint;
public static var e_pairFinal:uint = 4;
public static var b2_tableMask:int = (b2_tableCapacity - 1);
public static var e_pairRemoved:uint = 2;
public static var b2_nullPair:uint = b2Settings.USHRT_MAX;
public static var e_pairBuffered:uint = 1;
public static var b2_nullProxy:uint = b2Settings.USHRT_MAX;
public static var b2_tableCapacity:int = b2Settings.b2_maxPairs;
public function b2Pair(){
userData = null;
super();
}
public function SetBuffered():void{
status = (status | e_pairBuffered);
}
public function IsBuffered():Boolean{
return (((status & e_pairBuffered) == e_pairBuffered));
}
public function IsFinal():Boolean{
return (((status & e_pairFinal) == e_pairFinal));
}
public function ClearRemoved():void{
status = (status & ~(e_pairRemoved));
}
public function SetFinal():void{
status = (status | e_pairFinal);
}
public function IsRemoved():Boolean{
return (((status & e_pairRemoved) == e_pairRemoved));
}
public function ClearBuffered():void{
status = (status & ~(e_pairBuffered));
}
public function SetRemoved():void{
status = (status | e_pairRemoved);
}
}
}//package Box2D.Collision
Section 22
//b2PairCallback (Box2D.Collision.b2PairCallback)
package Box2D.Collision {
public class b2PairCallback {
public function PairRemoved(_arg1, _arg2, _arg3):void{
}
public function PairAdded(_arg1, _arg2){
return (null);
}
}
}//package Box2D.Collision
Section 23
//b2PairManager (Box2D.Collision.b2PairManager)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PairManager {
public var m_pairCount:int;
public var m_pairBuffer:Array;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_pairBufferCount:int;
public var m_hashTable:Array;
public var m_broadPhase:b2BroadPhase;
public var m_freePair:uint;
public function b2PairManager(){
var _local1:uint;
super();
m_hashTable = new Array(b2Pair.b2_tableCapacity);
_local1 = 0;
while (_local1 < b2Pair.b2_tableCapacity) {
m_hashTable[_local1] = b2Pair.b2_nullPair;
_local1++;
};
m_pairs = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1] = new b2Pair();
_local1++;
};
m_pairBuffer = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairBuffer[_local1] = new b2BufferedPair();
_local1++;
};
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy;
m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy;
m_pairs[_local1].userData = null;
m_pairs[_local1].status = 0;
m_pairs[_local1].next = (_local1 + 1);
_local1++;
};
m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair;
m_pairCount = 0;
m_pairBufferCount = 0;
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:b2Pair;
var _local5:uint;
_local5 = m_hashTable[_arg3];
_local4 = m_pairs[_local5];
while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) {
_local5 = _local4.next;
_local4 = m_pairs[_local5];
};
if (_local5 == b2Pair.b2_nullPair){
return (null);
};
return (_local4);
}
private function Find(_arg1:uint, _arg2:uint):b2Pair{
var _local3:uint;
var _local4:uint;
if (_arg1 > _arg2){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
return (FindHash(_arg1, _arg2, _local3));
}
private function ValidateBuffer():void{
}
public function Commit():void{
var _local1:b2BufferedPair;
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:b2Pair;
var _local6:b2Proxy;
var _local7:b2Proxy;
_local3 = 0;
_local4 = m_broadPhase.m_proxyPool;
_local2 = 0;
while (_local2 < m_pairBufferCount) {
_local1 = m_pairBuffer[_local2];
_local5 = Find(_local1.proxyId1, _local1.proxyId2);
_local5.ClearBuffered();
_local6 = _local4[_local5.proxyId1];
_local7 = _local4[_local5.proxyId2];
if (_local5.IsRemoved()){
if (_local5.IsFinal() == true){
m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData);
};
_local1 = m_pairBuffer[_local3];
_local1.proxyId1 = _local5.proxyId1;
_local1.proxyId2 = _local5.proxyId2;
_local3++;
} else {
if (_local5.IsFinal() == false){
_local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData);
_local5.SetFinal();
};
};
_local2++;
};
_local2 = 0;
while (_local2 < _local3) {
_local1 = m_pairBuffer[_local2];
RemovePair(_local1.proxyId1, _local1.proxyId2);
_local2++;
};
m_pairBufferCount = 0;
if (b2BroadPhase.s_validate){
ValidateTable();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair;
_local4 = Find(_arg1, _arg2);
if (_local4 == null){
return;
};
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.SetRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function RemovePair(_arg1:uint, _arg2:uint){
var _local3:b2Pair;
var _local4:uint;
var _local5:uint;
var _local6:b2Pair;
var _local7:uint;
var _local8:uint;
var _local9:*;
if (_arg1 > _arg2){
_local7 = _arg1;
_arg1 = _arg2;
_arg2 = _local7;
};
_local4 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
_local5 = m_hashTable[_local4];
_local6 = null;
while (_local5 != b2Pair.b2_nullPair) {
if (Equals(m_pairs[_local5], _arg1, _arg2)){
_local8 = _local5;
_local3 = m_pairs[_local5];
if (_local6){
_local6.next = _local3.next;
} else {
m_hashTable[_local4] = _local3.next;
};
_local3 = m_pairs[_local8];
_local9 = _local3.userData;
_local3.next = m_freePair;
_local3.proxyId1 = b2Pair.b2_nullProxy;
_local3.proxyId2 = b2Pair.b2_nullProxy;
_local3.userData = null;
_local3.status = 0;
m_freePair = _local8;
m_pairCount--;
return (_local9);
} else {
_local6 = m_pairs[_local5];
_local5 = _local6.next;
};
};
return (null);
}
public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{
m_broadPhase = _arg1;
m_callback = _arg2;
}
public function AddBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair;
_local4 = AddPair(_arg1, _arg2);
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.ClearRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function AddPair(_arg1:uint, _arg2:uint):b2Pair{
var _local3:uint;
var _local4:b2Pair;
var _local5:uint;
var _local6:uint;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
_local4 = FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
_local5 = m_freePair;
_local4 = m_pairs[_local5];
m_freePair = _local4.next;
_local4.proxyId1 = _arg1;
_local4.proxyId2 = _arg2;
_local4.status = 0;
_local4.userData = null;
_local4.next = m_hashTable[_local3];
m_hashTable[_local3] = _local5;
m_pairCount++;
return (_local4);
}
private function ValidateTable():void{
}
public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{
return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2))));
}
public static function Hash(_arg1:uint, _arg2:uint):uint{
var _local3:uint;
_local3 = (((_arg2 << 16) & 4294901760) | _arg1);
_local3 = (~(_local3) + ((_local3 << 15) & 4294934528));
_local3 = (_local3 ^ ((_local3 >> 12) & 1048575));
_local3 = (_local3 + ((_local3 << 2) & 4294967292));
_local3 = (_local3 ^ ((_local3 >> 4) & 268435455));
_local3 = (_local3 * 2057);
_local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF));
return (_local3);
}
public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{
return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3))));
}
}
}//package Box2D.Collision
Section 24
//b2Point (Box2D.Collision.b2Point)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2Point {
public var p:b2Vec2;
public function b2Point(){
p = new b2Vec2();
super();
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (p);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
return (p);
}
}
}//package Box2D.Collision
Section 25
//b2Proxy (Box2D.Collision.b2Proxy)
package Box2D.Collision {
public class b2Proxy {
public var overlapCount:uint;
public var lowerBounds:Array;
public var upperBounds:Array;
public var userData;// = null
public var timeStamp:uint;
public function b2Proxy(){
lowerBounds = [uint(0), uint(0)];
upperBounds = [uint(0), uint(0)];
userData = null;
super();
}
public function GetNext():uint{
return (lowerBounds[0]);
}
public function IsValid():Boolean{
return (!((overlapCount == b2BroadPhase.b2_invalid)));
}
public function SetNext(_arg1:uint):void{
lowerBounds[0] = (_arg1 & 0xFFFF);
}
}
}//package Box2D.Collision
Section 26
//b2Segment (Box2D.Collision.b2Segment)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2Segment {
public var p1:b2Vec2;
public var p2:b2Vec2;
public function b2Segment(){
p1 = new b2Vec2();
p2 = new b2Vec2();
super();
}
public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{
var _local5:b2Vec2;
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;
_local5 = _arg3.p1;
_local6 = (_arg3.p2.x - _local5.x);
_local7 = (_arg3.p2.y - _local5.y);
_local8 = (p2.x - p1.x);
_local9 = (p2.y - p1.y);
_local10 = _local9;
_local11 = -(_local8);
_local12 = (100 * Number.MIN_VALUE);
_local13 = -(((_local6 * _local10) + (_local7 * _local11)));
if (_local13 > _local12){
_local14 = (_local5.x - p1.x);
_local15 = (_local5.y - p1.y);
_local16 = ((_local14 * _local10) + (_local15 * _local11));
if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){
_local17 = ((-(_local7) * _local15) + (_local7 * _local14));
if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){
_local16 = (_local16 / _local13);
_local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
_local10 = (_local10 / _local18);
_local11 = (_local11 / _local18);
_arg1[0] = _local16;
_arg2.Set(_local10, _local11);
return (true);
};
};
};
return (false);
}
}
}//package Box2D.Collision
Section 27
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2TimeOfImpact {
public static var s_xf1:b2XForm = new b2XForm();
public static var s_xf2:b2XForm = new b2XForm();
public static var s_p1:b2Vec2 = new b2Vec2();
public static var s_p2:b2Vec2 = new b2Vec2();
public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):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:b2Vec2;
var _local18:b2Vec2;
var _local19:int;
var _local20:int;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:b2XForm;
var _local27:b2XForm;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
_local7 = _arg1.m_sweepRadius;
_local8 = _arg3.m_sweepRadius;
_local9 = _arg2.t0;
_local10 = (_arg2.c.x - _arg2.c0.x);
_local11 = (_arg2.c.y - _arg2.c0.y);
_local12 = (_arg4.c.x - _arg4.c0.x);
_local13 = (_arg4.c.y - _arg4.c0.y);
_local14 = (_arg2.a - _arg2.a0);
_local15 = (_arg4.a - _arg4.a0);
_local16 = 0;
_local17 = s_p1;
_local18 = s_p2;
_local19 = 20;
_local20 = 0;
_local21 = 0;
_local22 = 0;
_local23 = 0;
_local24 = 0;
while (true) {
_local25 = (((1 - _local16) * _local9) + _local16);
_local26 = s_xf1;
_local27 = s_xf2;
_arg2.GetXForm(_local26, _local25);
_arg4.GetXForm(_local27, _local25);
_local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27);
if (_local20 == 0){
if (_local23 > (2 * b2Settings.b2_toiSlop)){
_local24 = (1.5 * b2Settings.b2_toiSlop);
} else {
_local5 = (0.05 * b2Settings.b2_toiSlop);
_local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop));
_local24 = ((_local5 > _local6)) ? _local5 : _local6;
};
};
if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){
break;
};
_local21 = (_local18.x - _local17.x);
_local22 = (_local18.y - _local17.y);
_local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22)));
_local21 = (_local21 / _local28);
_local22 = (_local22 / _local28);
_local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8));
if (_local29 == 0){
_local16 = 1;
break;
};
_local30 = ((_local23 - _local24) / _local29);
_local31 = (_local16 + _local30);
if ((((_local31 < 0)) || ((1 < _local31)))){
_local16 = 1;
break;
};
if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){
break;
};
_local16 = _local31;
_local20++;
};
return (_local16);
}
}
}//package Box2D.Collision
Section 28
//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();
}
}
}//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features)
package Box2D.Collision {
public class Features {
public var _referenceEdge:int;
public var _incidentEdge:int;
public var _flip:int;
public var _incidentVertex:int;
public var _m_id:b2ContactID;
public function get referenceEdge():int{
return (_referenceEdge);
}
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 get incidentEdge():int{
return (_incidentEdge);
}
public function set referenceEdge(_arg1:int):void{
_referenceEdge = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF));
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
}
}//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22)
package Box2D.Common.Math {
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){
var _local4:Number;
var _local5:Number;
col1 = new b2Vec2();
col2 = new b2Vec2();
super();
if (((!((_arg2 == null))) && (!((_arg3 == null))))){
col1.SetV(_arg2);
col2.SetV(_arg3);
} else {
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
col1.x = _local4;
col2.x = -(_local5);
col1.y = _local5;
col2.y = _local4;
};
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function Set(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.cos(_arg1);
_local3 = 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 SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
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 Abs():void{
col1.Abs();
col2.Abs();
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = col1.x;
_local3 = col2.x;
_local4 = col1.y;
_local5 = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
_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 GetAngle():Number{
return (Math.atan2(col1.y, col1.x));
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = col1.x;
_local5 = col2.x;
_local6 = col1.y;
_local7 = col2.y;
_local8 = ((_local4 * _local7) - (_local5 * _local6));
_local8 = (1 / _local8);
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
}
}//package Box2D.Common.Math
Section 31
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1));
public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity);
public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0);
public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = b2MulMV(_arg1.R, _arg2);
_local3.x = (_local3.x + _arg1.position.x);
_local3.y = (_local3.y + _arg1.position.y);
return (_local3);
}
public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:*;
_local3 = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22;
_local2 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function b2MulXT(_arg1:b2XForm, _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 b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2;
_local2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2Mat22;
_local3 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
_local4 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
_local5 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean;
_local2 = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2NextPowerOfTwo(_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 b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
}
}//package Box2D.Common.Math
Section 32
//b2Sweep (Box2D.Common.Math.b2Sweep)
package Box2D.Common.Math {
public class b2Sweep {
public var localCenter:b2Vec2;
public var c:b2Vec2;
public var a:Number;
public var c0:b2Vec2;
public var a0:Number;
public var t0:Number;
public function b2Sweep(){
localCenter = new b2Vec2();
c0 = new b2Vec2();
c = new b2Vec2();
super();
}
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;
};
}
public function GetXForm(_arg1:b2XForm, _arg2:Number):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
if ((1 - t0) > Number.MIN_VALUE){
_local4 = ((_arg2 - t0) / (1 - t0));
_arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x));
_arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y));
_local5 = (((1 - _local4) * a0) + (_local4 * a));
_arg1.R.Set(_local5);
} else {
_arg1.position.SetV(c);
_arg1.R.Set(a);
};
_local3 = _arg1.R;
_arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y)));
_arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y)));
}
}
}//package Box2D.Common.Math
Section 33
//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 Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function LengthSquared():Number{
return (((x * x) + (y * y)));
}
public function SetZero():void{
x = 0;
y = 0;
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
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 SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function CrossVF(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function Normalize():Number{
var _local1:Number;
var _local2:Number;
_local1 = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
_local2 = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm)
package Box2D.Common.Math {
public class b2XForm {
public var R:b2Mat22;
public var position:b2Vec2;
public function b2XForm(_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 Set(_arg1:b2XForm):void{
position.SetV(_arg1.position);
R.SetM(_arg1.R);
}
public function SetIdentity():void{
position.SetZero();
R.SetIdentity();
}
}
}//package Box2D.Common.Math
Section 35
//b2Color (Box2D.Common.b2Color)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Color {
private var _g:uint;// = 0
private var _b:uint;// = 0
private var _r:uint;// = 0
public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){
_r = 0;
_g = 0;
_b = 0;
super();
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function get color():uint{
return (((_r | (_g << 8)) | (_b << 16)));
}
public function set r(_arg1:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set b(_arg1:Number):void{
_b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set g(_arg1:Number):void{
_g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
}
}//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static const b2_linearSleepTolerance:Number = 0.01;
public static const b2_angularSlop:Number = ((2 / 180) * b2_pi);
public static const b2_linearSlop:Number = 0.005;
public static const b2_pi:Number = Math.PI;
public static const b2_maxProxies:int = 0x0400;
public static const b2_maxAngularVelocitySquared:Number = 62500;
public static const b2_maxPolygonVertices:int = 64;
public static const b2_velocityThreshold:Number = 1;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_maxPairs:int = 8192;
public static const b2_maxTOIContactsPerIsland:int = 32;
public static const b2_timeToSleep:Number = 1;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_maxAngularVelocity:Number = 250;
public static const b2_maxAngularCorrection:Number = ((8 / 180) * b2_pi);
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_maxLinearVelocity:Number = 200;
public static const b2_maxLinearCorrection:Number = 0.2;
public static const b2_toiSlop:Number = 0.04;
public static const b2_maxLinearVelocitySquared:Number = 40000;
public static function b2Assert(_arg1:Boolean):void{
var _local2:b2Vec2;
if (!_arg1){
_local2.x++;
};
}
}
}//package Box2D.Common
Section 37
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class b2CircleContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
var _local3:b2ManifoldPoint;
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
_local3 = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactPoint;
var _local8:b2ManifoldPoint;
_local5 = m_shape1.m_body;
_local6 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf);
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
m_manifoldCount = 1;
_local8 = m_manifold.points[0];
if (m0.pointCount == 0){
_local8.normalImpulse = 0;
_local8.tangentImpulse = 0;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Add(_local7);
};
} else {
_local4 = m0.points[0];
_local8.normalImpulse = _local4.normalImpulse;
_local8.tangentImpulse = _local4.tangentImpulse;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Persist(_local7);
};
};
} else {
m_manifoldCount = 0;
if ((((m0.pointCount > 0)) && (_arg1))){
_local4 = m0.points[0];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2CircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2Contact {
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_prev:b2Contact;
public var m_toi:Number;
public var m_next:b2Contact;
public var m_friction:Number;
public var m_manifoldCount:int;
public var m_node1:b2ContactEdge;
public var m_node2:b2ContactEdge;
public var m_restitution:Number;
public var m_flags:uint;
public static var e_toiFlag:uint = 8;
public static var e_nonSolidFlag:uint = 1;
public static var e_slowFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var s_registers:Array;
public static var s_initialized:Boolean = false;
public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){
m_node1 = new b2ContactEdge();
m_node2 = new b2ContactEdge();
super();
m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
m_shape1 = null;
m_shape2 = null;
return;
};
if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){
m_flags = (m_flags | e_nonSolidFlag);
};
m_shape1 = _arg1;
m_shape2 = _arg2;
m_manifoldCount = 0;
m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction));
m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution);
m_prev = null;
m_next = null;
m_node1.contact = null;
m_node1.prev = null;
m_node1.next = null;
m_node1.other = null;
m_node2.contact = null;
m_node2.prev = null;
m_node2.next = null;
m_node2.other = null;
}
public function GetShape1():b2Shape{
return (m_shape1);
}
public function IsSolid():Boolean{
return (((m_flags & e_nonSolidFlag) == 0));
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetManifolds():Array{
return (null);
}
public function GetShape2():b2Shape{
return (m_shape2);
}
public function GetManifoldCount():int{
return (m_manifoldCount);
}
public function Update(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:int;
var _local4:b2Body;
var _local5:b2Body;
_local2 = m_manifoldCount;
Evaluate(_arg1);
_local3 = m_manifoldCount;
_local4 = m_shape1.m_body;
_local5 = m_shape2.m_body;
if ((((_local3 == 0)) && ((_local2 > 0)))){
_local4.WakeUp();
_local5.WakeUp();
};
if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){
m_flags = (m_flags & ~(e_slowFlag));
} else {
m_flags = (m_flags | e_slowFlag);
};
}
public function Evaluate(_arg1:b2ContactListener):void{
}
public static function InitializeRegisters():void{
var _local1:int;
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
_local1 = 0;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_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);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
var _local3:int;
var _local4:int;
var _local5:b2ContactRegister;
var _local6:Function;
if (_arg1.m_manifoldCount > 0){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
_local3 = _arg1.m_shape1.m_type;
_local4 = _arg1.m_shape2.m_type;
_local5 = s_registers[_local3][_local4];
_local6 = _local5.destroyFcn;
_local6(_arg1, _arg2);
}
public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{
s_registers[_arg3][_arg4].createFcn = _arg1;
s_registers[_arg3][_arg4].destroyFcn = _arg2;
s_registers[_arg3][_arg4].primary = true;
if (_arg3 != _arg4){
s_registers[_arg4][_arg3].createFcn = _arg1;
s_registers[_arg4][_arg3].destroyFcn = _arg2;
s_registers[_arg4][_arg3].primary = false;
};
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local4:int;
var _local5:int;
var _local6:b2ContactRegister;
var _local7:Function;
var _local8:b2Contact;
var _local9:int;
var _local10:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
_local4 = _arg1.m_type;
_local5 = _arg2.m_type;
_local6 = s_registers[_local4][_local5];
_local7 = _local6.createFcn;
if (_local7 != null){
if (_local6.primary){
return (_local7(_arg1, _arg2, _arg3));
};
_local8 = _local7(_arg2, _arg1, _arg3);
_local9 = 0;
while (_local9 < _local8.m_manifoldCount) {
_local10 = _local8.GetManifolds()[_local9];
_local8.GetManifolds()[_local9].normal = _local10.normal.Negative();
_local9++;
};
return (_local8);
//unresolved jump
};
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 39
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var restitution:Number;
public var body1:b2Body;
public var manifold:b2Manifold;
public var normal:b2Vec2;
public var body2:b2Body;
public var friction:Number;
public var pointCount:int;
public function b2ContactConstraint(){
var _local1:int;
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var r2:b2Vec2;
public var separation:Number;
public var positionImpulse:Number;
public var normalImpulse:Number;
public var equalizedMass:Number;
public var tangentMass:Number;
public var tangentImpulse:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var normalMass:Number;
public var velocityBias:Number;
public var r1:b2Vec2;
public function b2ContactConstraintPoint(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
r1 = new b2Vec2();
r2 = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2ContactEdge {
public var next:b2ContactEdge;
public var other:b2Body;
public var contact:b2Contact;
public var prev:b2ContactEdge;
}
}//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var primary:Boolean;
public var createFcn:Function;
public var destroyFcn:Function;
}
}//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
public class b2ContactResult {
public var normal:b2Vec2;
public var position:b2Vec2;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ContactResult(){
position = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactSolver {
public var m_constraintCount:int;
public var m_constraints:Array;
public var m_allocator;
public var m_step:b2TimeStep;
public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){
var _local5:b2Contact;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _local9:int;
var _local10:b2Body;
var _local11:b2Body;
var _local12:int;
var _local13:Array;
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:int;
var _local23:b2Manifold;
var _local24:Number;
var _local25:Number;
var _local26:b2ContactConstraint;
var _local27:uint;
var _local28:b2ManifoldPoint;
var _local29:b2ContactConstraintPoint;
var _local30:Number;
var _local31:Number;
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;
m_step = new b2TimeStep();
m_constraints = new Array();
super();
m_step.dt = _arg1.dt;
m_step.inv_dt = _arg1.inv_dt;
m_step.maxIterations = _arg1.maxIterations;
m_allocator = _arg4;
m_constraintCount = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
m_constraintCount = (m_constraintCount + _local5.m_manifoldCount);
_local6++;
};
_local6 = 0;
while (_local6 < m_constraintCount) {
m_constraints[_local6] = new b2ContactConstraint();
_local6++;
};
_local9 = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
_local10 = _local5.m_shape1.m_body;
_local11 = _local5.m_shape2.m_body;
_local12 = _local5.m_manifoldCount;
_local13 = _local5.GetManifolds();
_local14 = _local5.m_friction;
_local15 = _local5.m_restitution;
_local16 = _local10.m_linearVelocity.x;
_local17 = _local10.m_linearVelocity.y;
_local18 = _local11.m_linearVelocity.x;
_local19 = _local11.m_linearVelocity.y;
_local20 = _local10.m_angularVelocity;
_local21 = _local11.m_angularVelocity;
_local22 = 0;
while (_local22 < _local12) {
_local23 = _local13[_local22];
_local24 = _local23.normal.x;
_local25 = _local23.normal.y;
_local26 = m_constraints[_local9];
_local26.body1 = _local10;
_local26.body2 = _local11;
_local26.manifold = _local23;
_local26.normal.x = _local24;
_local26.normal.y = _local25;
_local26.pointCount = _local23.pointCount;
_local26.friction = _local14;
_local26.restitution = _local15;
_local27 = 0;
while (_local27 < _local26.pointCount) {
_local28 = _local23.points[_local27];
_local29 = _local26.points[_local27];
_local29.normalImpulse = _local28.normalImpulse;
_local29.tangentImpulse = _local28.tangentImpulse;
_local29.separation = _local28.separation;
_local29.positionImpulse = 0;
_local29.localAnchor1.SetV(_local28.localPoint1);
_local29.localAnchor2.SetV(_local28.localPoint2);
_local8 = _local10.m_xf.R;
_local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x);
_local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33));
_local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33));
_local32 = _local30;
_local29.r1.Set(_local32, _local33);
_local8 = _local11.m_xf.R;
_local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x);
_local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35));
_local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35));
_local34 = _local30;
_local29.r2.Set(_local34, _local35);
_local36 = ((_local32 * _local32) + (_local33 * _local33));
_local37 = ((_local34 * _local34) + (_local35 * _local35));
_local38 = ((_local32 * _local24) + (_local33 * _local25));
_local39 = ((_local34 * _local24) + (_local35 * _local25));
_local40 = (_local10.m_invMass + _local11.m_invMass);
_local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39)))));
_local29.normalMass = (1 / _local40);
_local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass));
_local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39)))));
_local29.equalizedMass = (1 / _local41);
_local42 = _local25;
_local43 = -(_local24);
_local44 = ((_local32 * _local42) + (_local33 * _local43));
_local45 = ((_local34 * _local42) + (_local35 * _local43));
_local46 = (_local10.m_invMass + _local11.m_invMass);
_local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45)))));
_local29.tangentMass = (1 / _local46);
_local29.velocityBias = 0;
if (_local29.separation > 0){
_local29.velocityBias = (-60 * _local29.separation);
};
_local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33));
_local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32));
_local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31));
if (_local47 < -(b2Settings.b2_velocityThreshold)){
_local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47));
};
_local27++;
};
_local9++;
_local22++;
};
_local6++;
};
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local5:int;
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;
_local5 = 0;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_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.r1.x * _local22) - (_local20.r1.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.r2.x * _local22) - (_local20.r2.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 SolvePositionConstraints(_arg1:Number):Boolean{
var _local2:Number;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:int;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:b2Vec2;
var _local10:Number;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:int;
var _local20:int;
var _local21:b2ContactConstraintPoint;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
_local2 = 0;
_local5 = 0;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_sweep.c;
_local10 = _local7.m_sweep.a;
_local11 = _local8.m_sweep.c;
_local12 = _local8.m_sweep.a;
_local13 = (_local7.m_mass * _local7.m_invMass);
_local14 = (_local7.m_mass * _local7.m_invI);
_local15 = (_local8.m_mass * _local8.m_invMass);
_local16 = (_local8.m_mass * _local8.m_invI);
_local17 = _local6.normal.x;
_local18 = _local6.normal.y;
_local19 = _local6.pointCount;
_local20 = 0;
while (_local20 < _local19) {
_local21 = _local6.points[_local20];
_local3 = _local7.m_xf.R;
_local4 = _local7.m_sweep.localCenter;
_local22 = (_local21.localAnchor1.x - _local4.x);
_local23 = (_local21.localAnchor1.y - _local4.y);
_local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23));
_local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23));
_local22 = _local26;
_local3 = _local8.m_xf.R;
_local4 = _local8.m_sweep.localCenter;
_local24 = (_local21.localAnchor2.x - _local4.x);
_local25 = (_local21.localAnchor2.y - _local4.y);
_local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25));
_local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25));
_local24 = _local26;
_local27 = (_local9.x + _local22);
_local28 = (_local9.y + _local23);
_local29 = (_local11.x + _local24);
_local30 = (_local11.y + _local25);
_local31 = (_local29 - _local27);
_local32 = (_local30 - _local28);
_local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation);
_local2 = b2Math.b2Min(_local2, _local33);
_local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0));
_local35 = (-(_local21.equalizedMass) * _local34);
_local36 = _local21.positionImpulse;
_local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0);
_local35 = (_local21.positionImpulse - _local36);
_local37 = (_local35 * _local17);
_local38 = (_local35 * _local18);
_local9.x = (_local9.x - (_local13 * _local37));
_local9.y = (_local9.y - (_local13 * _local38));
_local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37))));
_local7.m_sweep.a = _local10;
_local7.SynchronizeTransform();
_local11.x = (_local11.x + (_local15 * _local37));
_local11.y = (_local11.y + (_local15 * _local38));
_local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37))));
_local8.m_sweep.a = _local12;
_local8.SynchronizeTransform();
_local20++;
};
_local5++;
};
return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop)));
}
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:b2Mat22;
var _local18:b2Vec2;
var _local19:int;
var _local20:b2ContactConstraint;
var _local21:b2Body;
var _local22:b2Body;
var _local23:Number;
var _local24:Number;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:int;
var _local38:Number;
_local19 = 0;
while (_local19 < m_constraintCount) {
_local20 = m_constraints[_local19];
_local21 = _local20.body1;
_local22 = _local20.body2;
_local23 = _local21.m_angularVelocity;
_local24 = _local22.m_angularVelocity;
_local25 = _local21.m_linearVelocity;
_local26 = _local22.m_linearVelocity;
_local27 = _local21.m_invMass;
_local28 = _local21.m_invI;
_local29 = _local22.m_invMass;
_local30 = _local22.m_invI;
_local31 = _local20.normal.x;
_local32 = _local20.normal.y;
_local33 = _local32;
_local34 = -(_local31);
_local35 = _local20.friction;
_local37 = _local20.pointCount;
_local1 = 0;
while (_local1 < _local37) {
_local2 = _local20.points[_local1];
_local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y));
_local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x));
_local9 = ((_local7 * _local31) + (_local8 * _local32));
_local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias));
_local10 = ((_local7 * _local33) + (_local8 * _local34));
_local12 = (_local2.tangentMass * -(_local10));
_local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0);
_local11 = (_local13 - _local2.normalImpulse);
_local38 = (_local35 * _local2.normalImpulse);
_local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38);
_local12 = (_local14 - _local2.tangentImpulse);
_local15 = ((_local11 * _local31) + (_local12 * _local33));
_local16 = ((_local11 * _local32) + (_local12 * _local34));
_local25.x = (_local25.x - (_local27 * _local15));
_local25.y = (_local25.y - (_local27 * _local16));
_local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15))));
_local26.x = (_local26.x + (_local29 * _local15));
_local26.y = (_local26.y + (_local29 * _local16));
_local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15))));
_local2.normalImpulse = _local13;
_local2.tangentImpulse = _local14;
_local1++;
};
_local21.m_angularVelocity = _local23;
_local22.m_angularVelocity = _local24;
_local19++;
};
}
public function FinalizeVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
_local1 = 0;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2NullContact extends b2Contact {
override public function GetManifolds():Array{
return (null);
}
override public function Evaluate(_arg1:b2ContactListener):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolyAndCircleContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
var _local3:b2ManifoldPoint;
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape));
b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape));
m_manifold.pointCount = 0;
_local3 = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2ManifoldPoint;
var _local6:b2Body;
var _local7:b2Body;
var _local8:Array;
var _local9:b2ContactPoint;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
_local6 = m_shape1.m_body;
_local7 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf);
_local8 = [false, false];
_local9 = s_evalCP;
_local9.shape1 = m_shape1;
_local9.shape2 = m_shape2;
_local9.friction = m_friction;
_local9.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local2 = 0;
while (_local2 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local2];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local8[_local13] == true){
} else {
_local5 = m0.points[_local13];
if (_local5.id._key == _local12){
_local8[_local13] = true;
_local10.normalImpulse = _local5.normalImpulse;
_local10.tangentImpulse = _local5.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Persist(_local9);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Add(_local9);
};
_local2++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local2 = 0;
while (_local2 < m0.pointCount) {
if (_local8[_local2]){
} else {
_local5 = m0.points[_local2];
_local9.position = _local6.GetWorldPoint(_local5.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m0.normal);
_local9.separation = _local5.separation;
_local9.id.key = _local5.id._key;
_arg1.Remove(_local9);
};
_local2++;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndCircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class b2PolygonContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{
m0 = new b2Manifold();
m_manifolds = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactPoint;
var _local8:int;
var _local9:Array;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
_local5 = m_shape1.m_body;
_local6 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf);
_local9 = [false, false];
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local8 = 0;
while (_local8 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local8];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local9[_local13] == true){
} else {
_local4 = m0.points[_local13];
if (_local4.id._key == _local12){
_local9[_local13] = true;
_local10.normalImpulse = _local4.normalImpulse;
_local10.tangentImpulse = _local4.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Persist(_local7);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Add(_local7);
};
_local8++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local8 = 0;
while (_local8 < m0.pointCount) {
if (_local9[_local8]){
} else {
_local4 = m0.points[_local8];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
_local8++;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolygonContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2DistanceJoint extends b2Joint {
public var m_mass:Number;
public var m_u:b2Vec2;
public var m_impulse:Number;
public var m_dampingRatio:Number;
public var m_frequencyHz:Number;
public var m_localAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_bias:Number;
public var m_gamma:Number;
public 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.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_length = _arg1.length;
m_frequencyHz = _arg1.frequencyHz;
m_dampingRatio = _arg1.dampingRatio;
m_impulse = 0;
m_gamma = 0;
m_bias = 0;
m_inv_dt = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2;
_local1 = new b2Vec2();
_local1.SetV(m_u);
_local1.Multiply((m_inv_dt * m_impulse));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
var _local2:b2Body;
var _local3:b2Body;
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;
if (m_frequencyHz > 0){
return (true);
};
_local2 = m_body1;
_local3 = m_body2;
_local1 = _local2.m_xf.R;
_local4 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5));
_local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5));
_local4 = _local6;
_local1 = _local3.m_xf.R;
_local7 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local8 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8));
_local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8));
_local7 = _local6;
_local9 = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4);
_local10 = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5);
_local11 = Math.sqrt(((_local9 * _local9) + (_local10 * _local10)));
_local9 = (_local9 / _local11);
_local10 = (_local10 / _local11);
_local12 = (_local11 - m_length);
_local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local13 = (-(m_mass) * _local12);
m_u.Set(_local9, _local10);
_local14 = (_local13 * m_u.x);
_local15 = (_local13 * m_u.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14))));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15));
_local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14))));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop));
}
override public 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;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
m_inv_dt = _arg1.inv_dt;
_local4 = m_body1;
_local5 = m_body2;
_local2 = _local4.m_xf.R;
_local6 = (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;
_local8 = (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);
_local10 = 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();
};
_local11 = ((_local6 * m_u.y) - (_local7 * m_u.x));
_local12 = ((_local8 * m_u.y) - (_local9 * m_u.x));
_local13 = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12));
m_mass = (1 / _local13);
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 = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17))));
m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma);
m_mass = (1 / (_local13 + m_gamma));
};
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 public function GetReactionTorque():Number{
return (0);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:b2Body;
var _local4:b2Body;
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;
_local3 = m_body1;
_local4 = m_body2;
_local2 = _local3.m_xf.R;
_local5 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6));
_local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6));
_local5 = _local7;
_local2 = _local4.m_xf.R;
_local8 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local9 = (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;
_local10 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6));
_local11 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5));
_local12 = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9));
_local13 = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8));
_local14 = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11)));
_local15 = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse)));
m_impulse = (m_impulse + _local15);
_local16 = (_local15 * m_u.x);
_local17 = (_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))));
}
}
}//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2DistanceJointDef extends b2JointDef {
public var length:Number;
public var dampingRatio:Number;
public var frequencyHz:Number;
public var localAnchor2:b2Vec2;
public var localAnchor1:b2Vec2;
public function b2DistanceJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = 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{
var _local5:Number;
var _local6:Number;
body1 = _arg1;
body2 = _arg2;
localAnchor1.SetV(body1.GetLocalPoint(_arg3));
localAnchor2.SetV(body2.GetLocalPoint(_arg4));
_local5 = (_arg4.x - _arg3.x);
_local6 = (_arg4.y - _arg3.y);
length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
frequencyHz = 0;
dampingRatio = 0;
}
}
}//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2GearJoint extends b2Joint {
public var m_force:Number;
public var m_mass:Number;
public var m_prismatic1:b2PrismaticJoint;
public var m_prismatic2:b2PrismaticJoint;
public var m_ground1:b2Body;
public var m_ground2:b2Body;
public var m_constant:Number;
public var m_revolute1:b2RevoluteJoint;
public var m_revolute2:b2RevoluteJoint;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_ratio:Number;
public var m_J:b2Jacobian;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local2:int;
var _local3:int;
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);
_local2 = _arg1.joint1.m_type;
_local3 = _arg1.joint2.m_type;
m_revolute1 = null;
m_prismatic1 = null;
m_revolute2 = null;
m_prismatic2 = null;
m_ground1 = _arg1.joint1.m_body1;
m_body1 = _arg1.joint1.m_body2;
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.m_body1;
m_body2 = _arg1.joint2.m_body2;
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_force = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2;
_local1 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = 0;
_local2 = m_body1;
_local3 = m_body2;
if (m_revolute1){
_local4 = m_revolute1.GetJointAngle();
} else {
_local4 = m_prismatic1.GetJointTranslation();
};
if (m_revolute2){
_local5 = m_revolute2.GetJointAngle();
} else {
_local5 = m_prismatic2.GetJointTranslation();
};
_local6 = (m_constant - (_local4 + (m_ratio * _local5)));
_local7 = (-(m_mass) * _local6);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y));
_local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((_local1 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Body;
var _local5: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 _local14:Number;
var _local15:Number;
_local2 = m_ground1;
_local3 = m_ground2;
_local4 = m_body1;
_local5 = m_body2;
_local14 = 0;
m_J.SetZero();
if (m_revolute1){
m_J.angular1 = -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.linear1.Set(-(_local6), -(_local7));
m_J.angular1 = -(_local12);
_local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12)));
};
if (m_revolute2){
m_J.angular2 = -(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.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7));
m_J.angular2 = (-(m_ratio) * _local12);
_local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12))));
};
m_mass = (1 / _local14);
if (_arg1.warmStarting){
_local15 = (_arg1.dt * m_force);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2));
} else {
m_force = 0;
};
}
override public function GetReactionTorque():Number{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = m_body2.m_xf.R;
_local2 = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x);
_local3 = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y);
_local4 = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3));
_local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3));
_local2 = _local4;
_local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x))));
return (_local4);
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local5 = ((-(_arg1.inv_dt) * m_mass) * _local4);
m_force = (m_force + _local5);
_local6 = (_arg1.dt * _local5);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2));
}
}
}//package Box2D.Dynamics.Joints
Section 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef)
package Box2D.Dynamics.Joints {
public class b2GearJointDef extends b2JointDef {
public var joint2:b2Joint;
public var joint1:b2Joint;
public var ratio:Number;
public function b2GearJointDef(){
type = b2Joint.e_gearJoint;
joint1 = null;
joint2 = null;
ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2Jacobian {
public var linear1:b2Vec2;
public var linear2:b2Vec2;
public var angular2:Number;
public var angular1:Number;
public function b2Jacobian(){
linear1 = new b2Vec2();
linear2 = new b2Vec2();
super();
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linear1.SetV(_arg1);
angular1 = _arg2;
linear2.SetV(_arg3);
angular2 = _arg4;
}
public function SetZero():void{
linear1.SetZero();
angular1 = 0;
linear2.SetZero();
angular2 = 0;
}
public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{
return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4)));
}
}
}//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2Joint {
public var m_islandFlag:Boolean;
public var m_body1:b2Body;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_type:int;
public var m_collideConnected:Boolean;
public var m_node1:b2JointEdge;
public var m_node2:b2JointEdge;
public var m_inv_dt:Number;
public var m_userData;
public var m_body2:b2Body;
public static const e_unknownJoint:int = 0;
public static const e_inactiveLimit:int = 0;
public static const e_atUpperLimit:int = 2;
public static const e_atLowerLimit:int = 1;
public static const e_gearJoint:int = 6;
public static const e_revoluteJoint:int = 1;
public static const e_equalLimits:int = 3;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_prismaticJoint:int = 2;
public static const e_mouseJoint:int = 5;
public function b2Joint(_arg1:b2JointDef){
m_node1 = new b2JointEdge();
m_node2 = new b2JointEdge();
super();
m_type = _arg1.type;
m_prev = null;
m_next = null;
m_body1 = _arg1.body1;
m_body2 = _arg1.body2;
m_collideConnected = _arg1.collideConnected;
m_islandFlag = false;
m_userData = _arg1.userData;
}
public function GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
}
public function GetType():int{
return (m_type);
}
public function GetBody2():b2Body{
return (m_body2);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetReactionTorque():Number{
return (0);
}
public function GetUserData(){
return (m_userData);
}
public function GetReactionForce():b2Vec2{
return (null);
}
public function SolvePositionConstraints():Boolean{
return (false);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetBody1():b2Body{
return (m_body1);
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function InitPositionConstraints():void{
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
_local3 = null;
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;
default:
break;
};
return (_local3);
}
}
}//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointDef {
public var collideConnected:Boolean;
public var body1:b2Body;
public var body2:b2Body;
public var userData;
public var type:int;
public function b2JointDef(){
type = b2Joint.e_unknownJoint;
userData = null;
body1 = null;
body2 = null;
collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointEdge {
public var joint:b2Joint;
public var other:b2Body;
public var next:b2JointEdge;
public var prev:b2JointEdge;
}
}//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2MouseJoint extends b2Joint {
public var m_beta:Number;
public var m_mass:b2Mat22;
public var m_target:b2Vec2;
public var m_impulse:b2Vec2;
public var m_localAnchor:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K:b2Mat22;
public var m_gamma:Number;
public var m_C:b2Vec2;
public var m_maxForce:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
var _local2:Number;
var _local3:Number;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
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_body2.m_xf.position.x);
_local3 = (m_target.y - m_body2.m_xf.position.y);
_local4 = m_body2.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();
_local5 = m_body2.m_mass;
_local6 = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
_local7 = (((2 * _local5) * _arg1.dampingRatio) * _local6);
_local8 = ((_arg1.timeStep * _local5) * (_local6 * _local6));
m_gamma = (1 / (_local7 + _local8));
m_beta = (_local8 / (_local7 + _local8));
}
override public function GetAnchor1():b2Vec2{
return (m_target);
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor));
}
override public function GetReactionForce():b2Vec2{
return (m_impulse);
}
override public function SolvePositionConstraints():Boolean{
return (true);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local7 = _local2.m_invMass;
_local8 = _local2.m_invI;
K1.col1.x = _local7;
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = _local7;
K2.col1.x = ((_local8 * _local5) * _local5);
K2.col2.x = ((-(_local8) * _local4) * _local5);
K2.col1.y = ((-(_local8) * _local4) * _local5);
K2.col2.y = ((_local8 * _local4) * _local4);
K.SetM(K1);
K.AddM(K2);
K.col1.x = (K.col1.x + m_gamma);
K.col2.y = (K.col2.y + m_gamma);
K.Invert(m_mass);
m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x);
m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y);
_local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98);
_local9 = (_arg1.dt * m_impulse.x);
_local10 = (_arg1.dt * m_impulse.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9))));
}
override public function GetReactionTorque():Number{
return (0);
}
public function SetTarget(_arg1:b2Vec2):void{
if (m_body2.IsSleeping()){
m_body2.WakeUp();
};
m_target = _arg1;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
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;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local6 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local7 = (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;
_local8 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7));
_local9 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6));
_local3 = m_mass;
_local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x));
_local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y));
_local10 = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)));
_local11 = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)));
_local12 = m_impulse.x;
_local13 = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
_local14 = m_impulse.Length();
if (_local14 > m_maxForce){
m_impulse.Multiply((m_maxForce / _local14));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
_local15 = (_arg1.dt * _local10);
_local16 = (_arg1.dt * _local11);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
}
}
}//package Box2D.Dynamics.Joints
Section 57
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2MouseJointDef extends b2JointDef {
public var frequencyHz:Number;
public var dampingRatio:Number;
public var maxForce:Number;
public var target:b2Vec2;
public var timeStep:Number;
public function b2MouseJointDef(){
target = new b2Vec2();
super();
type = b2Joint.e_mouseJoint;
maxForce = 0;
frequencyHz = 5;
dampingRatio = 0.7;
timeStep = (1 / 60);
}
}
}//package Box2D.Dynamics.Joints
Section 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PrismaticJoint extends b2Joint {
public var m_limitForce:Number;
public var m_refAngle:Number;
public var m_lowerTranslation:Number;
public var m_localXAxis1:b2Vec2;
public var m_torque:Number;
public var m_enableLimit:Boolean;
public var m_motorForce:Number;
public var m_force:Number;
public var m_localYAxis1:b2Vec2;
public var m_motorMass:Number;
public var m_maxMotorForce:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_angularMass:Number;
public var m_limitState:int;
public var m_linearMass:Number;
public var m_upperTranslation:Number;
public var m_motorJacobian:b2Jacobian;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_linearJacobian:b2Jacobian;
public var m_enableMotor:Boolean;
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_linearJacobian = new b2Jacobian();
m_motorJacobian = new b2Jacobian();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_localXAxis1.SetV(_arg1.localAxis1);
m_localYAxis1.x = -(m_localXAxis1.y);
m_localYAxis1.y = m_localXAxis1.x;
m_refAngle = _arg1.referenceAngle;
m_linearJacobian.SetZero();
m_linearMass = 0;
m_force = 0;
m_angularMass = 0;
m_torque = 0;
m_motorJacobian.SetZero();
m_motorMass = 0;
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 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;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetUpperLimit():Number{
return (m_upperTranslation);
}
public function GetLowerLimit():Number{
return (m_lowerTranslation);
}
public function GetJointTranslation():Number{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:b2Vec2;
var _local9:Number;
_local1 = m_body1;
_local2 = m_body2;
_local4 = _local1.GetWorldPoint(m_localAnchor1);
_local5 = _local2.GetWorldPoint(m_localAnchor2);
_local6 = (_local5.x - _local4.x);
_local7 = (_local5.y - _local4.y);
_local8 = _local1.GetWorldVector(m_localXAxis1);
_local9 = ((_local8.x * _local6) + (_local8.y * _local7));
return (_local9);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerTranslation = _arg1;
m_upperTranslation = _arg2;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body1.m_xf.R;
_local2 = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y)));
_local3 = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y)));
_local4 = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y)));
_local5 = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y)));
return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5))));
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9: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 _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
_local3 = m_body1;
_local4 = m_body2;
_local5 = _local3.m_invMass;
_local6 = _local4.m_invMass;
_local7 = _local3.m_invI;
_local8 = _local4.m_invI;
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local21 = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
_local22 = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
_local23 = ((_local21 * _local19) + (_local22 * _local20));
_local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local24 = (-(m_linearMass) * _local23);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2));
_local25 = b2Math.b2Abs(_local23);
_local26 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle);
_local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local27 = (-(m_angularMass) * _local26);
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
_local28 = b2Math.b2Abs(_local26);
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y));
_local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y));
_local31 = ((_local29 * _local19) + (_local30 * _local20));
_local32 = 0;
if (m_limitState == e_equalLimits){
_local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26));
} else {
if (m_limitState == e_atLowerLimit){
_local1 = (_local31 - m_lowerTranslation);
_local25 = b2Math.b2Max(_local25, -(_local1));
_local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
} else {
if (m_limitState == e_atUpperLimit){
_local1 = (_local31 - m_upperTranslation);
_local25 = b2Math.b2Max(_local25, _local1);
_local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
};
};
};
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop))));
}
public function GetJointSpeed():Number{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
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:b2Vec2;
var _local16:b2Vec2;
var _local17:b2Vec2;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local1 = m_body1;
_local2 = m_body2;
_local3 = _local1.m_xf.R;
_local4 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local5 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local3 = _local2.m_xf.R;
_local7 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local8 = (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;
_local9 = (_local1.m_sweep.c.x + _local4);
_local10 = (_local1.m_sweep.c.y + _local5);
_local11 = (_local2.m_sweep.c.x + _local7);
_local12 = (_local2.m_sweep.c.y + _local8);
_local13 = (_local11 - _local9);
_local14 = (_local12 - _local10);
_local15 = _local1.GetWorldVector(m_localXAxis1);
_local16 = _local1.m_linearVelocity;
_local17 = _local2.m_linearVelocity;
_local18 = _local1.m_angularVelocity;
_local19 = _local2.m_angularVelocity;
_local20 = (((_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 SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
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:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (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;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (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;
_local10 = _local2.m_invMass;
_local11 = _local3.m_invMass;
_local12 = _local2.m_invI;
_local13 = _local3.m_invI;
_local4 = _local2.m_xf.R;
_local14 = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y));
_local15 = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y));
_local16 = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x);
_local17 = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y);
m_linearJacobian.linear1.x = -(_local14);
m_linearJacobian.linear1.y = -(_local15);
m_linearJacobian.linear2.x = _local14;
m_linearJacobian.linear2.y = _local15;
m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14)));
m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14));
m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2));
m_linearMass = (1 / m_linearMass);
m_angularMass = (_local12 + _local13);
if (m_angularMass > Number.MIN_VALUE){
m_angularMass = (1 / m_angularMass);
};
if (((m_enableLimit) || (m_enableMotor))){
_local4 = _local2.m_xf.R;
_local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y));
_local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y));
m_motorJacobian.linear1.x = -(_local18);
m_motorJacobian.linear1.y = -(_local19);
m_motorJacobian.linear2.x = _local18;
m_motorJacobian.linear2.y = _local19;
m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18)));
m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18));
m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2));
m_motorMass = (1 / m_motorMass);
if (m_enableLimit){
_local20 = (_local16 - _local6);
_local21 = (_local17 - _local7);
_local22 = ((_local18 * _local20) + (_local19 * _local21));
if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local22 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local22 >= m_upperTranslation){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
};
};
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit == false){
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x)));
_local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y)));
_local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x)));
_local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y)));
_local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1)));
_local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2)));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28));
} else {
m_force = 0;
m_torque = 0;
m_limitForce = 0;
m_motorForce = 0;
};
m_limitPositionImpulse = 0;
}
public function GetMotorForce():Number{
return (m_motorForce);
}
public function SetMaxMotorForce(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
override public function GetReactionTorque():Number{
return (m_torque);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
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;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_invMass;
_local5 = _local3.m_invMass;
_local6 = _local2.m_invI;
_local7 = _local3.m_invI;
_local9 = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local10 = ((-(_arg1.inv_dt) * m_linearMass) * _local9);
m_force = (m_force + _local10);
_local11 = (_arg1.dt * _local10);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2));
_local12 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local13 = ((-(_arg1.inv_dt) * m_angularMass) * _local12);
m_torque = (m_torque + _local13);
_local14 = (_arg1.dt * _local13);
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed);
_local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15);
_local17 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce);
_local16 = (m_motorForce - _local17);
_local11 = (_arg1.dt * _local16);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local19);
} else {
if (m_limitState == e_atLowerLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
} else {
if (m_limitState == e_atUpperLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
};
};
};
_local11 = (_arg1.dt * _local19);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
}
}
}//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PrismaticJointDef extends b2JointDef {
public var localAxis1:b2Vec2;
public var referenceAngle:Number;
public var maxMotorForce:Number;
public var motorSpeed:Number;
public var upperTranslation:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public var lowerTranslation:Number;
public function b2PrismaticJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
localAxis1 = new b2Vec2();
super();
type = b2Joint.e_prismaticJoint;
localAxis1.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{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
localAxis1 = body1.GetLocalVector(_arg4);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PulleyJoint extends b2Joint {
public var m_ground:b2Body;
public var m_maxLength2:Number;
public var m_limitForce1:Number;
public var m_maxLength1:Number;
public var m_limitState1:int;
public var m_limitState2:int;
public var m_limitPositionImpulse2:Number;
public var m_force:Number;
public var m_limitPositionImpulse1:Number;
public var m_constant:Number;
public var m_state:int;
public var m_ratio:Number;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_positionImpulse:Number;
public var m_limitMass2:Number;
public var m_limitMass1:Number;
public var m_pulleyMass:Number;
public var m_u1:b2Vec2;
public var m_u2:b2Vec2;
public var m_limitForce2:Number;
public 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_body1.m_world.m_groundBody;
m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x);
m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y);
m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x);
m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_ratio = _arg1.ratio;
m_constant = (_arg1.length1 + (m_ratio * _arg1.length2));
m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength)));
m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio));
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
}
public function GetGroundAnchor2():b2Vec2{
var _local1:b2Vec2;
_local1 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor2);
return (_local1);
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2;
_local1 = m_u2.Copy();
_local1.Multiply(m_force);
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
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:Number;
var _local23:Number;
_local1 = m_body1;
_local2 = m_body2;
_local4 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local5 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local6 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local7 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
_local23 = 0;
if (m_state == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local16 = m_u1.Length();
_local17 = m_u2.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local16));
} else {
m_u1.SetZero();
};
if (_local17 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = ((m_constant - _local16) - (m_ratio * _local17));
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_pulleyMass) * _local18);
_local20 = m_positionImpulse;
m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19));
_local19 = (m_positionImpulse - _local20);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local14 = ((-(m_ratio) * _local19) * m_u2.x);
_local15 = ((-(m_ratio) * _local19) * m_u2.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local1.SynchronizeTransform();
_local2.SynchronizeTransform();
};
if (m_limitState1 == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
_local16 = m_u1.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.x = (m_u1.x * (1 / _local16));
m_u1.y = (m_u1.y * (1 / _local16));
} else {
m_u1.SetZero();
};
_local18 = (m_maxLength1 - _local16);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass1) * _local18);
_local21 = m_limitPositionImpulse1;
m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19));
_local19 = (m_limitPositionImpulse1 - _local21);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local1.SynchronizeTransform();
};
if (m_limitState2 == e_atUpperLimit){
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local17 = m_u2.Length();
if (_local17 > b2Settings.b2_linearSlop){
m_u2.x = (m_u2.x * (1 / _local17));
m_u2.y = (m_u2.y * (1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = (m_maxLength2 - _local17);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass2) * _local18);
_local21 = m_limitPositionImpulse2;
m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19));
_local19 = (m_limitPositionImpulse2 - _local21);
_local14 = (-(_local19) * m_u2.x);
_local15 = (-(_local19) * m_u2.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local2.SynchronizeTransform();
};
return ((_local23 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
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:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local5 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (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;
_local10 = (_local2.m_sweep.c.x + _local5);
_local11 = (_local2.m_sweep.c.y + _local6);
_local12 = (_local3.m_sweep.c.x + _local8);
_local13 = (_local3.m_sweep.c.y + _local9);
_local14 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local15 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local16 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local17 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
m_u1.Set((_local10 - _local14), (_local11 - _local15));
m_u2.Set((_local12 - _local16), (_local13 - _local17));
_local18 = m_u1.Length();
_local19 = 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();
};
_local20 = ((m_constant - _local18) - (m_ratio * _local19));
if (_local20 > 0){
m_state = e_inactiveLimit;
m_force = 0;
} else {
m_state = e_atUpperLimit;
m_positionImpulse = 0;
};
if (_local18 < m_maxLength1){
m_limitState1 = e_inactiveLimit;
m_limitForce1 = 0;
} else {
m_limitState1 = e_atUpperLimit;
m_limitPositionImpulse1 = 0;
};
if (_local19 < m_maxLength2){
m_limitState2 = e_inactiveLimit;
m_limitForce2 = 0;
} else {
m_limitState2 = e_atUpperLimit;
m_limitPositionImpulse2 = 0;
};
_local21 = ((_local5 * m_u1.y) - (_local6 * m_u1.x));
_local22 = ((_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){
_local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x);
_local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y);
_local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x);
_local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * 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_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
public function GetRatio():Number{
return (m_ratio);
}
public function GetLength2():Number{
var _local1:b2Vec2;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body2.GetWorldPoint(m_localAnchor2);
_local2 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local3 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
_local4 = (_local1.x - _local2);
_local5 = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
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;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local5 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (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 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18);
_local20 = m_force;
m_force = b2Math.b2Max(0, (m_force + _local19));
_local19 = (m_force - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x);
_local17 = (((-(_arg1.dt) * 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 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18);
_local20 = m_limitForce1;
m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19));
_local19 = (m_limitForce1 - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _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 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18);
_local20 = m_limitForce2;
m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19));
_local19 = (m_limitForce2 - _local20);
_local16 = ((-(_arg1.dt) * _local19) * m_u2.x);
_local17 = ((-(_arg1.dt) * _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))));
};
}
public function GetLength1():Number{
var _local1:b2Vec2;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body1.GetWorldPoint(m_localAnchor1);
_local2 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local3 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local4 = (_local1.x - _local2);
_local5 = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetGroundAnchor1():b2Vec2{
var _local1:b2Vec2;
_local1 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor1);
return (_local1);
}
}
}//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PulleyJointDef extends b2JointDef {
public var maxLength2:Number;
public var length1:Number;
public var length2:Number;
public var maxLength1:Number;
public var ratio:Number;
public var groundAnchor1:b2Vec2;
public var groundAnchor2:b2Vec2;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public function b2PulleyJointDef(){
groundAnchor1 = new b2Vec2();
groundAnchor2 = new b2Vec2();
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_pulleyJoint;
groundAnchor1.Set(-1, 1);
groundAnchor2.Set(1, 1);
localAnchor1.Set(-1, 0);
localAnchor2.Set(1, 0);
length1 = 0;
maxLength1 = 0;
length2 = 0;
maxLength2 = 0;
ratio = 1;
collideConnected = true;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
body1 = _arg1;
body2 = _arg2;
groundAnchor1.SetV(_arg3);
groundAnchor2.SetV(_arg4);
localAnchor1 = body1.GetLocalPoint(_arg5);
localAnchor2 = body2.GetLocalPoint(_arg6);
_local8 = (_arg5.x - _arg3.x);
_local9 = (_arg5.y - _arg3.y);
length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local10 = (_arg6.x - _arg4.x);
_local11 = (_arg6.y - _arg4.y);
length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
ratio = _arg7;
_local12 = (length1 + (ratio * length2));
maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength));
maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio);
}
}
}//package Box2D.Dynamics.Joints
Section 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2RevoluteJoint extends b2Joint {
public var m_limitForce:Number;
public var m_motorForce:Number;
public var m_pivotMass:b2Mat22;
public var m_enableLimit:Boolean;
public var m_limitState:int;
public var m_motorMass:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K3:b2Mat22;
private var K:b2Mat22;
public var m_pivotForce:b2Vec2;
public var m_motorSpeed:Number;
public var m_enableMotor:Boolean;
public var m_limitPositionImpulse:Number;
public var m_maxMotorTorque:Number;
public var m_referenceAngle:Number;
public var m_lowerAngle:Number;
public var m_upperAngle:Number;
public static var tImpulse:b2Vec2 = new b2Vec2();
public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
K3 = new b2Mat22();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_pivotForce = new b2Vec2();
m_pivotMass = new b2Mat22();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_referenceAngle = _arg1.referenceAngle;
m_pivotForce.Set(0, 0);
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 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;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetUpperLimit():Number{
return (m_upperAngle);
}
public function GetLowerLimit():Number{
return (m_lowerAngle);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerAngle = _arg1;
m_upperAngle = _arg2;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
return (m_pivotForce);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:b2Mat22;
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:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local3 = m_body1;
_local4 = m_body2;
_local5 = 0;
_local6 = _local3.m_xf.R;
_local7 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local8 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8));
_local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8));
_local7 = _local9;
_local6 = _local4.m_xf.R;
_local10 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11));
_local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11));
_local10 = _local9;
_local12 = (_local3.m_sweep.c.x + _local7);
_local13 = (_local3.m_sweep.c.y + _local8);
_local14 = (_local4.m_sweep.c.x + _local10);
_local15 = (_local4.m_sweep.c.y + _local11);
_local16 = (_local14 - _local12);
_local17 = (_local15 - _local13);
_local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17)));
_local18 = _local3.m_invMass;
_local19 = _local4.m_invMass;
_local20 = _local3.m_invI;
_local21 = _local4.m_invI;
K1.col1.x = (_local18 + _local19);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local18 + _local19);
K2.col1.x = ((_local20 * _local8) * _local8);
K2.col2.x = ((-(_local20) * _local7) * _local8);
K2.col1.y = ((-(_local20) * _local7) * _local8);
K2.col2.y = ((_local20 * _local7) * _local7);
K3.col1.x = ((_local21 * _local11) * _local11);
K3.col2.x = ((-(_local21) * _local10) * _local11);
K3.col1.y = ((-(_local21) * _local10) * _local11);
K3.col2.y = ((_local21 * _local10) * _local10);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Solve(tImpulse, -(_local16), -(_local17));
_local22 = tImpulse.x;
_local23 = tImpulse.y;
_local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23));
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22))));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22))));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
_local24 = 0;
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle);
_local26 = 0;
if (m_limitState == e_equalLimits){
_local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local24 = b2Math.b2Abs(_local2);
} else {
if (m_limitState == e_atLowerLimit){
_local2 = (_local25 - m_lowerAngle);
_local24 = b2Math.b2Max(0, -(_local2));
_local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
} else {
if (m_limitState == e_atUpperLimit){
_local2 = (_local25 - m_upperAngle);
_local24 = b2Math.b2Max(0, _local2);
_local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
};
};
};
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop))));
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function SetMaxMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
public function GetJointAngle():Number{
return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
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;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (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;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (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;
_local10 = _local2.m_invMass;
_local11 = _local3.m_invMass;
_local12 = _local2.m_invI;
_local13 = _local3.m_invI;
K1.col1.x = (_local10 + _local11);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local10 + _local11);
K2.col1.x = ((_local12 * _local7) * _local7);
K2.col2.x = ((-(_local12) * _local6) * _local7);
K2.col1.y = ((-(_local12) * _local6) * _local7);
K2.col2.y = ((_local12 * _local6) * _local6);
K3.col1.x = ((_local13 * _local9) * _local9);
K3.col2.x = ((-(_local13) * _local8) * _local9);
K3.col1.y = ((-(_local13) * _local8) * _local9);
K3.col2.y = ((_local13 * _local8) * _local8);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Invert(m_pivotMass);
m_motorMass = (1 / (_local12 + _local13));
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit){
_local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle);
if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
m_limitState = e_equalLimits;
} else {
if (_local14 <= m_lowerAngle){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local14 >= m_upperAngle){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
} else {
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
} else {
m_pivotForce.SetZero();
m_motorForce = 0;
m_limitForce = 0;
};
m_limitPositionImpulse = 0;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
public function GetMotorTorque():Number{
return (m_motorForce);
}
override public function GetReactionTorque():Number{
return (m_limitForce);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
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;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (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;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (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;
_local11 = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7));
_local12 = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6));
_local13 = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12)));
_local14 = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12)));
m_pivotForce.x = (m_pivotForce.x + _local13);
m_pivotForce.y = (m_pivotForce.y + _local14);
_local15 = (_arg1.dt * _local13);
_local16 = (_arg1.dt * _local14);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15))));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed);
_local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17);
_local19 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque);
_local18 = (m_motorForce - _local19);
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local21);
} else {
if (m_limitState == e_atLowerLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
} else {
if (m_limitState == e_atUpperLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
};
};
};
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21));
};
}
}
}//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2RevoluteJointDef extends b2JointDef {
public var referenceAngle:Number;
public var upperAngle:Number;
public var lowerAngle:Number;
public var motorSpeed:Number;
public var maxMotorTorque:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public function b2RevoluteJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_revoluteJoint;
localAnchor1.Set(0, 0);
localAnchor2.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{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 64
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
public class b2Body {
public var m_next:b2Body;
public var m_contactList:b2ContactEdge;
public var m_angularVelocity:Number;
public var m_shapeList:b2Shape;
public var m_force:b2Vec2;
public var m_mass:Number;
public var m_sweep:b2Sweep;
public var m_xf:b2XForm;
public var m_torque:Number;
public var m_userData;
public var m_flags:uint;
public var m_world:b2World;
public var m_prev:b2Body;
public var m_invMass:Number;
public var m_type:int;
public var m_linearDamping:Number;
public var m_angularDamping:Number;
public var m_invI:Number;
public var m_linearVelocity:b2Vec2;
public var m_sleepTime:Number;
public var m_shapeCount:int;
public var m_jointList:b2JointEdge;
public var m_I:Number;
public static var e_fixedRotationFlag:uint = 64;
public static var e_frozenFlag:uint = 2;
public static var e_maxTypes:uint = 3;
public static var e_sleepFlag:uint = 8;
private static var s_massData:b2MassData = new b2MassData();
public static var e_bulletFlag:uint = 32;
public static var e_staticType:uint = 1;
public static var e_islandFlag:uint = 4;
public static var e_allowSleepFlag:uint = 16;
private static var s_xf1:b2XForm = new b2XForm();
public static var e_dynamicType:uint = 2;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
var _local3:b2Mat22;
var _local4:b2Vec2;
m_xf = new b2XForm();
m_sweep = new b2Sweep();
m_linearVelocity = new b2Vec2();
m_force = new b2Vec2();
super();
m_flags = 0;
if (_arg1.isBullet){
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.isSleeping){
m_flags = (m_flags | e_sleepFlag);
};
m_world = _arg2;
m_xf.position.SetV(_arg1.position);
m_xf.R.Set(_arg1.angle);
m_sweep.localCenter.SetV(_arg1.massData.center);
m_sweep.t0 = 1;
m_sweep.a0 = (m_sweep.a = _arg1.angle);
_local3 = m_xf.R;
_local4 = 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_contactList = null;
m_prev = null;
m_next = null;
m_linearDamping = _arg1.linearDamping;
m_angularDamping = _arg1.angularDamping;
m_force.Set(0, 0);
m_torque = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_sleepTime = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.massData.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.massData.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
m_userData = _arg1.userData;
m_shapeList = null;
m_shapeCount = 0;
}
public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_arg1.x - m_sweep.c.x)))));
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function WakeUp():void{
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 0;
}
public function GetLocalCenter():b2Vec2{
return (m_sweep.localCenter);
}
public function ApplyTorque(_arg1:Number):void{
if (IsSleeping()){
WakeUp();
};
m_torque = (m_torque + _arg1);
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsDynamic():Boolean{
return ((m_type == e_dynamicType));
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
public function SynchronizeTransform():void{
var _local1:b2Mat22;
var _local2:b2Vec2;
m_xf.R.Set(m_sweep.a);
_local1 = m_xf.R;
_local2 = 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)));
}
public function GetInertia():Number{
return (m_I);
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function SetMassFromShapes():void{
var _local1:b2Shape;
var _local2:Number;
var _local3:Number;
var _local4:b2MassData;
var _local5:b2Mat22;
var _local6:b2Vec2;
var _local7:int;
if (m_world.m_lock == true){
return;
};
m_mass = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
_local2 = 0;
_local3 = 0;
_local4 = s_massData;
_local1 = m_shapeList;
while (_local1) {
_local1.ComputeMass(_local4);
m_mass = (m_mass + _local4.mass);
_local2 = (_local2 + (_local4.mass * _local4.center.x));
_local3 = (_local3 + (_local4.mass * _local4.center.y));
m_I = (m_I + _local4.I);
_local1 = _local1.m_next;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
_local2 = (_local2 * m_invMass);
_local3 = (_local3 * m_invMass);
};
if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){
m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3))));
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
m_sweep.localCenter.Set(_local2, _local3);
_local5 = m_xf.R;
_local6 = m_sweep.localCenter;
m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.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);
_local1 = m_shapeList;
while (_local1) {
_local1.UpdateSweepRadius(m_sweep.localCenter);
_local1 = _local1.m_next;
};
_local7 = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local7 != m_type){
_local1 = m_shapeList;
while (_local1) {
_local1.RefilterProxy(m_world.m_broadPhase, m_xf);
_local1 = _local1.m_next;
};
};
}
public function PutToSleep():void{
m_flags = (m_flags | e_sleepFlag);
m_sleepTime = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_force.SetZero();
m_torque = 0;
}
public function GetJointList():b2JointEdge{
return (m_jointList);
}
public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{
var _local3:b2Shape;
var _local4:b2Mat22;
var _local5:b2Vec2;
var _local6:Boolean;
var _local7:Boolean;
if (m_world.m_lock == true){
return (true);
};
if (IsFrozen()){
return (false);
};
m_xf.R.Set(_arg2);
m_xf.position.SetV(_arg1);
_local4 = m_xf.R;
_local5 = 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);
_local6 = false;
_local3 = m_shapeList;
while (_local3) {
_local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf);
if (_local7 == false){
_local6 = true;
break;
};
_local3 = _local3.m_next;
};
if (_local6 == true){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local3 = m_shapeList;
while (_local3) {
_local3.DestroyProxy(m_world.m_broadPhase);
_local3 = _local3.m_next;
};
return (false);
};
m_world.m_broadPhase.Commit();
return (true);
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(m_xf, _arg1));
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
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 SynchronizeShapes():Boolean{
var _local1:b2XForm;
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local4:b2Shape;
var _local5:Boolean;
_local1 = s_xf1;
_local1.R.Set(m_sweep.a0);
_local2 = _local1.R;
_local3 = 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)));
_local5 = true;
_local4 = m_shapeList;
while (_local4) {
_local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf);
if (_local5 == false){
break;
};
_local4 = _local4.m_next;
};
if (_local5 == false){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local4 = m_shapeList;
while (_local4) {
_local4.DestroyProxy(m_world.m_broadPhase);
_local4 = _local4.m_next;
};
return (false);
};
return (true);
}
public function GetAngle():Number{
return (m_sweep.a);
}
public function GetXForm():b2XForm{
return (m_xf);
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
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 GetNext():b2Body{
return (m_next);
}
public function GetMass():Number{
return (m_mass);
}
public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22;
var _local3:b2Vec2;
_local2 = m_xf.R;
_local3 = 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.x - (m_angularVelocity * (_local3.x - m_sweep.c.x)))));
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SetMass(_arg1:b2MassData):void{
var _local2:b2Shape;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:int;
if (m_world.m_lock == true){
return;
};
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
m_sweep.localCenter.SetV(_arg1.center);
_local3 = m_xf.R;
_local4 = 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);
_local2 = m_shapeList;
while (_local2) {
_local2.UpdateSweepRadius(m_sweep.localCenter);
_local2 = _local2.m_next;
};
_local5 = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local5 != m_type){
_local2 = m_shapeList;
while (_local2) {
_local2.RefilterProxy(m_world.m_broadPhase, m_xf);
_local2 = _local2.m_next;
};
};
}
public function IsStatic():Boolean{
return ((m_type == e_staticType));
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_xf.R, _arg1));
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function Advance(_arg1:Number):void{
m_sweep.Advance(_arg1);
m_sweep.c.SetV(m_sweep.c0);
m_sweep.a = m_sweep.a0;
SynchronizeTransform();
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_bulletFlag);
} else {
m_flags = (m_flags & ~(e_bulletFlag));
};
}
public function CreateShape(_arg1:b2ShapeDef):b2Shape{
var _local2:b2Shape;
if (m_world.m_lock == true){
return (null);
};
_local2 = b2Shape.Create(_arg1, m_world.m_blockAllocator);
_local2.m_next = m_shapeList;
m_shapeList = _local2;
m_shapeCount++;
_local2.m_body = this;
_local2.CreateProxy(m_world.m_broadPhase, m_xf);
_local2.UpdateSweepRadius(m_sweep.localCenter);
return (_local2);
}
public function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointEdge;
_local2 = m_jointList;
while (_local2) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
public function DestroyShape(_arg1:b2Shape):void{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:Boolean;
if (m_world.m_lock == true){
return;
};
_arg1.DestroyProxy(m_world.m_broadPhase);
_local2 = m_shapeList;
_local3 = null;
_local4 = false;
while (_local2 != null) {
if (_local2 == _arg1){
if (_local3){
_local3.m_next = _arg1.m_next;
} else {
m_shapeList = _arg1.m_next;
};
_local4 = true;
break;
};
_local3 = _local2;
_local2 = _local2.m_next;
};
_arg1.m_body = null;
_arg1.m_next = null;
m_shapeCount--;
b2Shape.Destroy(_arg1, m_world.m_blockAllocator);
}
public function GetUserData(){
return (m_userData);
}
public function IsBullet():Boolean{
return (((m_flags & e_bulletFlag) == e_bulletFlag));
}
public function GetWorldCenter():b2Vec2{
return (m_sweep.c);
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_xf.R, _arg1));
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22;
var _local3:b2Vec2;
_local2 = m_xf.R;
_local3 = 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 GetWorld():b2World{
return (m_world);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
}
}//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class b2BodyDef {
public var isSleeping:Boolean;
public var position:b2Vec2;
public var isBullet:Boolean;
public var allowSleep:Boolean;
public var userData;
public var angularDamping:Number;
public var fixedRotation:Boolean;
public var angle:Number;
public var linearDamping:Number;
public var massData:b2MassData;
public function b2BodyDef(){
massData = new b2MassData();
position = new b2Vec2();
super();
massData.center.SetZero();
massData.mass = 0;
massData.I = 0;
userData = null;
position.Set(0, 0);
angle = 0;
linearDamping = 0;
angularDamping = 0;
allowSleep = true;
isSleeping = false;
fixedRotation = false;
isBullet = false;
}
}
}//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
public class b2ContactFilter {
public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter);
;
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData;
var _local4:b2FilterData;
var _local5:Boolean;
_local3 = _arg1.GetFilterData();
_local4 = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
_local5 = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
}
}//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactListener {
public function Add(_arg1:b2ContactPoint):void{
}
public function Remove(_arg1:b2ContactPoint):void{
}
public function Persist(_arg1:b2ContactPoint):void{
}
public function Result(_arg1:b2ContactResult):void{
}
}
}//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactManager extends b2PairCallback {
public var m_world:b2World;
public var m_destroyImmediate:Boolean;
public var m_nullContact:b2NullContact;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2ContactManager(){
m_nullContact = new b2NullContact();
super();
m_world = null;
m_destroyImmediate = false;
}
override public function PairAdded(_arg1, _arg2){
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2Contact;
_local3 = (_arg1 as b2Shape);
_local4 = (_arg2 as b2Shape);
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (m_nullContact);
};
if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){
return (m_nullContact);
};
_local7 = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator);
if (_local7 == null){
return (m_nullContact);
};
_local3 = _local7.m_shape1;
_local4 = _local7.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local7.m_prev = null;
_local7.m_next = m_world.m_contactList;
if (m_world.m_contactList != null){
m_world.m_contactList.m_prev = _local7;
};
m_world.m_contactList = _local7;
_local7.m_node1.contact = _local7;
_local7.m_node1.other = _local6;
_local7.m_node1.prev = null;
_local7.m_node1.next = _local5.m_contactList;
if (_local5.m_contactList != null){
_local5.m_contactList.prev = _local7.m_node1;
};
_local5.m_contactList = _local7.m_node1;
_local7.m_node2.contact = _local7;
_local7.m_node2.other = _local5;
_local7.m_node2.prev = null;
_local7.m_node2.next = _local6.m_contactList;
if (_local6.m_contactList != null){
_local6.m_contactList.prev = _local7.m_node2;
};
_local6.m_contactList = _local7.m_node2;
m_world.m_contactCount++;
return (_local7);
}
override public function PairRemoved(_arg1, _arg2, _arg3):void{
var _local4:b2Contact;
if (_arg3 == null){
return;
};
_local4 = (_arg3 as b2Contact);
if (_local4 == m_nullContact){
return;
};
Destroy(_local4);
}
public function Destroy(_arg1:b2Contact):void{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:int;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Array;
var _local10:b2ContactPoint;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2Vec2;
var _local16:b2Vec2;
_local2 = _arg1.m_shape1;
_local3 = _arg1.m_shape2;
_local4 = _arg1.m_manifoldCount;
if ((((_local4 > 0)) && (m_world.m_contactListener))){
_local7 = _local2.m_body;
_local8 = _local3.m_body;
_local9 = _arg1.GetManifolds();
_local10 = s_evalCP;
_local10.shape1 = _arg1.m_shape1;
_local10.shape2 = _arg1.m_shape1;
_local10.friction = _arg1.m_friction;
_local10.restitution = _arg1.m_restitution;
_local11 = 0;
while (_local11 < _local4) {
_local12 = _local9[_local11];
_local10.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local10.position = _local7.GetWorldPoint(_local14.localPoint1);
_local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1);
_local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2);
_local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y));
_local10.separation = _local14.separation;
_local10.id.key = _local14.id._key;
m_world.m_contactListener.Remove(_local10);
_local13++;
};
_local11++;
};
};
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;
};
_local5 = _local2.m_body;
_local6 = _local3.m_body;
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local5.m_contactList){
_local5.m_contactList = _arg1.m_node1.next;
};
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local6.m_contactList){
_local6.m_contactList = _arg1.m_node2.next;
};
b2Contact.Destroy(_arg1, m_world.m_blockAllocator);
m_world.m_contactCount--;
}
public function Collide():void{
var _local1:b2Contact;
var _local2:b2Body;
var _local3:b2Body;
_local1 = m_world.m_contactList;
while (_local1) {
_local2 = _local1.m_shape1.m_body;
_local3 = _local1.m_shape2.m_body;
if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){
} else {
_local1.Update(m_world.m_contactListener);
};
_local1 = _local1.m_next;
};
}
}
}//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
import flash.display.*;
public class b2DebugDraw {
public var m_xformScale:Number;// = 1
public var m_fillAlpha:Number;// = 1
public var m_alpha:Number;// = 1
public var m_lineThickness:Number;// = 1
public var m_drawFlags:uint;
public var m_sprite:Sprite;
public var m_drawScale:Number;// = 1
public static var e_coreShapeBit:uint = 4;
public static var e_shapeBit:uint = 1;
public static var e_centerOfMassBit:uint = 64;
public static var e_aabbBit:uint = 8;
public static var e_obbBit:uint = 16;
public static var e_pairBit:uint = 32;
public static var e_jointBit:uint = 2;
public function b2DebugDraw(){
m_drawScale = 1;
m_lineThickness = 1;
m_alpha = 1;
m_fillAlpha = 1;
m_xformScale = 1;
super();
m_drawFlags = 0;
}
public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
var _local4:int;
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);
_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 DrawXForm(_arg1:b2XForm):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));
}
public function ClearFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags & ~(_arg1));
}
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 SetFlags(_arg1:uint):void{
m_drawFlags = _arg1;
}
public function AppendFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags | _arg1);
}
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 GetFlags():uint{
return (m_drawFlags);
}
public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
var _local4:int;
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
_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));
}
}
}//package Box2D.Dynamics
Section 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Joints.*;
public class b2DestructionListener {
public function SayGoodbyeJoint(_arg1:b2Joint):void{
}
public function SayGoodbyeShape(_arg1:b2Shape):void{
}
}
}//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2Island {
public var m_joints:Array;
public var m_listener:b2ContactListener;
public var m_positionIterationCount:int;
public var m_bodyCapacity:int;
public var m_bodies:Array;
public var m_jointCapacity:int;
public var m_contactCount:int;
public var m_contacts:Array;
public var m_contactCapacity:int;
public var m_jointCount:int;
public var m_allocator;
public var m_bodyCount:int;
private static var s_reportCR:b2ContactResult = new b2ContactResult();
public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){
var _local6:int;
super();
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_bodies = new Array(_arg1);
_local6 = 0;
while (_local6 < _arg1) {
m_bodies[_local6] = null;
_local6++;
};
m_contacts = new Array(_arg2);
_local6 = 0;
while (_local6 < _arg2) {
m_contacts[_local6] = null;
_local6++;
};
m_joints = new Array(_arg3);
_local6 = 0;
while (_local6 < _arg3) {
m_joints[_local6] = null;
_local6++;
};
m_positionIterationCount = 0;
}
public function AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
public function Report(_arg1:Array):void{
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local4:int;
var _local5:b2Contact;
var _local6:b2ContactConstraint;
var _local7:b2ContactResult;
var _local8:b2Body;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2ContactConstraintPoint;
if (m_listener == null){
return;
};
_local4 = 0;
while (_local4 < m_contactCount) {
_local5 = m_contacts[_local4];
_local6 = _arg1[_local4];
_local7 = s_reportCR;
_local7.shape1 = _local5.m_shape1;
_local7.shape2 = _local5.m_shape2;
_local8 = _local7.shape1.m_body;
_local9 = _local5.m_manifoldCount;
_local10 = _local5.GetManifolds();
_local11 = 0;
while (_local11 < _local9) {
_local12 = _local10[_local11];
_local7.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local15 = _local6.points[_local13];
_local7.position = _local8.GetWorldPoint(_local14.localPoint1);
_local7.normalImpulse = _local15.normalImpulse;
_local7.tangentImpulse = _local15.tangentImpulse;
_local7.id.key = _local14.id.key;
m_listener.Result(_local7);
_local13++;
};
_local11++;
};
_local4++;
};
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{
var _local5:int;
var _local6:b2Body;
var _local7:b2Joint;
var _local8:b2ContactSolver;
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y))));
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_force.SetZero();
_local6.m_torque = 0;
_local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity);
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity);
};
if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity);
} else {
_local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity;
};
};
};
_local5++;
};
_local8 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local8.InitVelocityConstraints(_arg1);
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitVelocityConstraints(_arg1);
_local5++;
};
_local5 = 0;
while (_local5 < _arg1.maxIterations) {
_local8.SolveVelocityConstraints();
_local9 = 0;
while (_local9 < m_jointCount) {
_local7 = m_joints[_local9];
_local7.SolveVelocityConstraints(_arg1);
_local9++;
};
_local5++;
};
_local8.FinalizeVelocityConstraints();
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_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();
};
_local5++;
};
if (_arg3){
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitPositionConstraints();
_local5++;
};
m_positionIterationCount = 0;
while (m_positionIterationCount < _arg1.maxIterations) {
_local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local11 = true;
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local12 = _local7.SolvePositionConstraints();
_local11 = ((_local11) && (_local12));
_local5++;
};
if (((_local10) && (_local11))){
break;
};
m_positionIterationCount++;
};
};
Report(_local8.m_constraints);
if (_arg4){
_local13 = Number.MAX_VALUE;
_local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.m_invMass == 0){
} else {
if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){
_local6.m_sleepTime = 0;
_local13 = 0;
};
if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){
_local6.m_sleepTime = 0;
_local13 = 0;
} else {
_local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt);
_local13 = b2Math.b2Min(_local13, _local6.m_sleepTime);
};
};
_local5++;
};
if (_local13 >= b2Settings.b2_timeToSleep){
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag);
_local6.m_linearVelocity.SetZero();
_local6.m_angularVelocity = 0;
_local5++;
};
};
};
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:int;
var _local3:b2ContactSolver;
var _local4:Number;
var _local5:b2Body;
var _local6:Boolean;
_local3 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local3.SolveVelocityConstraints();
_local2++;
};
_local2 = 0;
while (_local2 < m_bodyCount) {
_local5 = m_bodies[_local2];
if (_local5.IsStatic()){
} else {
_local5.m_sweep.c0.SetV(_local5.m_sweep.c);
_local5.m_sweep.a0 = _local5.m_sweep.a;
_local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y));
_local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity));
_local5.SynchronizeTransform();
};
_local2++;
};
_local4 = 0.75;
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local6 = _local3.SolvePositionConstraints(_local4);
if (_local6){
break;
};
_local2++;
};
Report(_local3.m_constraints);
}
}
}//package Box2D.Dynamics
Section 73
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var warmStarting:Boolean;
public var positionCorrection:Boolean;
public var dt:Number;
public var maxIterations:int;
public var dtRatio:Number;
public var inv_dt:Number;
}
}//package Box2D.Dynamics
Section 74
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2World {
public var m_inv_dt0:Number;
public var m_boundaryListener:b2BoundaryListener;
public var m_contactList:b2Contact;
public var m_blockAllocator;
public var m_contactListener:b2ContactListener;
public var m_allowSleep:Boolean;
public var m_broadPhase:b2BroadPhase;
public var m_destructionListener:b2DestructionListener;
public var m_jointCount:int;
public var m_bodyCount:int;
public var m_lock:Boolean;
public var m_positionIterationCount:int;
public var m_groundBody:b2Body;
public var m_contactCount:int;
public var m_debugDraw:b2DebugDraw;
public var m_contactFilter:b2ContactFilter;
public var m_bodyList:b2Body;
public var m_stackAllocator;
public var m_jointList:b2Joint;
public var m_gravity:b2Vec2;
public var m_contactManager:b2ContactManager;
private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8);
public static var m_continuousPhysics:Boolean;
public static var m_warmStarting:Boolean;
private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6);
public static var m_positionCorrection:Boolean;
private static var s_xf:b2XForm = new b2XForm();
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
var _local4:b2BodyDef;
m_contactManager = new b2ContactManager();
super();
m_destructionListener = null;
m_boundaryListener = null;
m_contactFilter = b2ContactFilter.b2_defaultFilter;
m_contactListener = null;
m_debugDraw = null;
m_bodyList = null;
m_contactList = null;
m_jointList = null;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_positionCorrection = true;
m_warmStarting = true;
m_continuousPhysics = true;
m_allowSleep = _arg3;
m_gravity = _arg2;
m_lock = false;
m_inv_dt0 = 0;
m_contactManager.m_world = this;
m_broadPhase = new b2BroadPhase(_arg1, m_contactManager);
_local4 = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function DrawJoint(_arg1:b2Joint):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2XForm;
var _local5:b2XForm;
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Color;
var _local11:b2PulleyJoint;
var _local12:b2Vec2;
var _local13:b2Vec2;
_local2 = _arg1.m_body1;
_local3 = _arg1.m_body2;
_local4 = _local2.m_xf;
_local5 = _local3.m_xf;
_local6 = _local4.position;
_local7 = _local5.position;
_local8 = _arg1.GetAnchor1();
_local9 = _arg1.GetAnchor2();
_local10 = 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.GetGroundAnchor1();
_local13 = _local11.GetGroundAnchor2();
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);
};
};
}
public function Refilter(_arg1:b2Shape):void{
_arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf);
}
public function SetDebugDraw(_arg1:b2DebugDraw):void{
m_debugDraw = _arg1;
}
public function SetContinuousPhysics(_arg1:Boolean):void{
m_continuousPhysics = _arg1;
}
public function GetProxyCount():int{
return (m_broadPhase.m_proxyCount);
}
public function DrawDebugData():void{
var _local1:uint;
var _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
var _local5:b2Joint;
var _local6:b2BroadPhase;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Color;
var _local11:b2XForm;
var _local12:b2AABB;
var _local13:b2AABB;
var _local14:Array;
var _local15:Boolean;
var _local16:uint;
var _local17:b2Pair;
var _local18:b2Proxy;
var _local19:b2Proxy;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:b2Proxy;
var _local23:b2PolygonShape;
var _local24:b2OBB;
var _local25:b2Vec2;
var _local26:b2Mat22;
var _local27:b2Vec2;
var _local28:Number;
if (m_debugDraw == null){
return;
};
m_debugDraw.m_sprite.graphics.clear();
_local1 = m_debugDraw.GetFlags();
_local7 = new b2Vec2();
_local8 = new b2Vec2();
_local9 = new b2Vec2();
_local10 = new b2Color(0, 0, 0);
_local12 = new b2AABB();
_local13 = new b2AABB();
_local14 = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
if ((_local1 & b2DebugDraw.e_shapeBit)){
_local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local3.IsStatic()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15);
} else {
if (_local3.IsSleeping()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15);
} else {
DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15);
};
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_jointBit)){
_local5 = m_jointList;
while (_local5) {
DrawJoint(_local5);
_local5 = _local5.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local6 = m_broadPhase;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.9, 0.3);
_local2 = 0;
while (_local2 < b2Pair.b2_tableCapacity) {
_local16 = _local6.m_pairManager.m_hashTable[_local2];
while (_local16 != b2Pair.b2_nullPair) {
_local17 = _local6.m_pairManager.m_pairs[_local16];
_local18 = _local6.m_proxyPool[_local17.proxyId1];
_local19 = _local6.m_proxyPool[_local17.proxyId2];
_local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value));
_local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value));
_local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value));
_local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value));
_local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value));
_local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value));
_local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value));
_local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value));
_local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x));
_local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y));
_local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x));
_local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y));
m_debugDraw.DrawSegment(_local8, _local9, _local10);
_local16 = _local17.next;
};
_local2++;
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local6 = m_broadPhase;
_local20 = _local6.m_worldAABB.lowerBound;
_local21 = _local6.m_worldAABB.upperBound;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.3, 0.9);
_local2 = 0;
while (_local2 < b2Settings.b2_maxProxies) {
_local22 = _local6.m_proxyPool[_local2];
if (_local22.IsValid() == false){
} else {
_local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value));
_local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value));
_local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value));
_local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value));
_local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y);
_local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y);
_local14[2].Set(_local12.upperBound.x, _local12.upperBound.y);
_local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y);
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local2++;
};
_local14[0].Set(_local20.x, _local20.y);
_local14[1].Set(_local21.x, _local20.y);
_local14[2].Set(_local21.x, _local21.y);
_local14[3].Set(_local20.x, _local21.y);
m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9));
};
if ((_local1 & b2DebugDraw.e_obbBit)){
_local10.Set(0.5, 0.3, 0.5);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local4.m_type != b2Shape.e_polygonShape){
} else {
_local23 = (_local4 as b2PolygonShape);
_local24 = _local23.GetOBB();
_local25 = _local24.extents;
_local14[0].Set(-(_local25.x), -(_local25.y));
_local14[1].Set(_local25.x, -(_local25.y));
_local14[2].Set(_local25.x, _local25.y);
_local14[3].Set(-(_local25.x), _local25.y);
_local2 = 0;
while (_local2 < 4) {
_local26 = _local24.R;
_local27 = _local14[_local2];
_local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local26 = _local11.R;
_local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local2++;
};
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
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.DrawXForm(_local11);
_local3 = _local3.m_next;
};
};
}
public function DestroyBody(_arg1:b2Body):void{
var _local2:b2JointEdge;
var _local3:b2Shape;
var _local4:b2JointEdge;
var _local5:b2Shape;
if (m_lock == true){
return;
};
_local2 = _arg1.m_jointList;
while (_local2) {
_local4 = _local2;
_local2 = _local2.next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeJoint(_local4.joint);
};
DestroyJoint(_local4.joint);
};
_local3 = _arg1.m_shapeList;
while (_local3) {
_local5 = _local3;
_local3 = _local3.m_next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeShape(_local5);
};
_local5.DestroyProxy(m_broadPhase);
b2Shape.Destroy(_local5, m_blockAllocator);
};
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 SetContactFilter(_arg1:b2ContactFilter):void{
m_contactFilter = _arg1;
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{
var _local5:b2Color;
var _local6:b2CircleShape;
var _local7:b2Vec2;
var _local8:Number;
var _local9:b2Vec2;
var _local10:int;
var _local11:b2PolygonShape;
var _local12:int;
var _local13:Array;
var _local14:Array;
var _local15:Array;
_local5 = s_coreColor;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local6 = (_arg1 as b2CircleShape);
_local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition);
_local8 = _local6.m_radius;
_local9 = _arg2.R.col1;
m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3);
if (_arg4){
m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5);
};
break;
case b2Shape.e_polygonShape:
_local11 = (_arg1 as b2PolygonShape);
_local12 = _local11.GetVertexCount();
_local13 = _local11.GetVertices();
_local14 = new Array(b2Settings.b2_maxPolygonVertices);
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]);
_local10++;
};
m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3);
if (_arg4){
_local15 = _local11.GetCoreVertices();
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]);
_local10++;
};
m_debugDraw.DrawPolygon(_local14, _local12, _local5);
};
break;
};
}
public function GetContactCount():int{
return (m_contactCount);
}
public function Solve(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Island;
var _local4:b2Contact;
var _local5:b2Joint;
var _local6:int;
var _local7:Array;
var _local8:b2Body;
var _local9:int;
var _local10:int;
var _local11:b2Body;
var _local12:b2ContactEdge;
var _local13:b2JointEdge;
var _local14:Boolean;
m_positionIterationCount = 0;
_local3 = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2 = _local2.m_next;
};
_local4 = m_contactList;
while (_local4) {
_local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag));
_local4 = _local4.m_next;
};
_local5 = m_jointList;
while (_local5) {
_local5.m_islandFlag = false;
_local5 = _local5.m_next;
};
_local6 = m_bodyCount;
_local7 = new Array(_local6);
_local8 = m_bodyList;
while (_local8) {
if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){
} else {
if (_local8.IsStatic()){
} else {
_local3.Clear();
_local9 = 0;
var _temp1 = _local9;
_local9 = (_local9 + 1);
var _local15 = _temp1;
_local7[_local15] = _local8;
_local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag);
while (_local9 > 0) {
--_local9;
_local2 = _local7[_local9];
_local3.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local12 = _local2.m_contactList;
while (_local12) {
if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){
} else {
if (_local12.contact.m_manifoldCount == 0){
} else {
_local3.AddContact(_local12.contact);
_local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag);
_local11 = _local12.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local9;
_local9 = (_local9 + 1);
var _local16 = _temp2;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
};
_local12 = _local12.next;
};
_local13 = _local2.m_jointList;
while (_local13) {
if (_local13.joint.m_islandFlag == true){
} else {
_local3.AddJoint(_local13.joint);
_local13.joint.m_islandFlag = true;
_local11 = _local13.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local9;
_local9 = (_local9 + 1);
_local16 = _temp3;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
_local13 = _local13.next;
};
};
};
_local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep);
if (_local3.m_positionIterationCount > m_positionIterationCount){
m_positionIterationCount = _local3.m_positionIterationCount;
};
_local10 = 0;
while (_local10 < _local3.m_bodyCount) {
_local2 = _local3.m_bodies[_local10];
if (_local2.IsStatic()){
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
};
_local10++;
};
};
};
_local8 = _local8.m_next;
};
_local2 = m_bodyList;
while (_local2) {
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local14 = _local2.SynchronizeShapes();
if ((((_local14 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
};
};
_local2 = _local2.m_next;
};
m_broadPhase.Commit();
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array;
var _local5:int;
var _local6:int;
_local4 = new Array(_arg3);
_local5 = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
_local6 = 0;
while (_local6 < _local5) {
_arg2[_local6] = _local4[_local6];
_local6++;
};
return (_local5);
}
public function SetGravity(_arg1:b2Vec2):void{
m_gravity = _arg1;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local8:b2Island;
var _local9:int;
var _local10:Array;
var _local11:b2Contact;
var _local12:b2Contact;
var _local13:Number;
var _local14:b2Body;
var _local15:int;
var _local16:b2TimeStep;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:b2Body;
var _local21:Boolean;
_local8 = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener);
_local9 = m_bodyCount;
_local10 = new Array(_local9);
_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;
};
while (true) {
_local12 = null;
_local13 = 1;
_local11 = m_contactList;
for (;_local11;(_local11 = _local11.m_next)) {
if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){
} else {
_local18 = 1;
if ((_local11.m_flags & b2Contact.e_toiFlag)){
_local18 = _local11.m_toi;
} else {
_local3 = _local11.m_shape1;
_local4 = _local11.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){
continue;
};
_local19 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local19 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local19);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local19 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local19);
};
};
_local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep);
if ((((_local18 > 0)) && ((_local18 < 1)))){
_local18 = (((1 - _local18) * _local19) + _local18);
if (_local18 > 1){
_local18 = 1;
};
};
_local11.m_toi = _local18;
_local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){
_local12 = _local11;
_local13 = _local18;
};
};
};
if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){
break;
};
_local3 = _local12.m_shape1;
_local4 = _local12.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local5.Advance(_local13);
_local6.Advance(_local13);
_local12.Update(m_contactListener);
_local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag));
if (_local12.m_manifoldCount == 0){
} else {
_local14 = _local5;
if (_local14.IsStatic()){
_local14 = _local6;
};
_local8.Clear();
_local15 = 0;
var _temp1 = _local15;
_local15 = (_local15 + 1);
var _local22 = _temp1;
_local10[_local22] = _local14;
_local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag);
while (_local15 > 0) {
--_local15;
_local2 = _local10[_local15];
_local8.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local8.m_contactCount == _local8.m_contactCapacity){
} else {
if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){
} else {
if (_local7.contact.m_manifoldCount == 0){
} else {
_local8.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local20 = _local7.other;
if ((_local20.m_flags & b2Body.e_islandFlag)){
} else {
if (_local20.IsStatic() == false){
_local20.Advance(_local13);
_local20.WakeUp();
};
var _temp2 = _local15;
_local15 = (_local15 + 1);
var _local23 = _temp2;
_local10[_local23] = _local20;
_local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local7 = _local7.next;
};
};
};
_local16 = new b2TimeStep();
_local16.dt = ((1 - _local13) * _arg1.dt);
_local16.inv_dt = (1 / _local16.dt);
_local16.maxIterations = _arg1.maxIterations;
_local8.SolveTOI(_local16);
_local17 = 0;
while (_local17 < _local8.m_bodyCount) {
_local2 = _local8.m_bodies[_local17];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local21 = _local2.SynchronizeShapes();
if ((((_local21 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
_local7 = _local2.m_contactList;
while (_local7) {
_local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag));
_local7 = _local7.next;
};
};
};
_local17++;
};
_local17 = 0;
while (_local17 < _local8.m_contactCount) {
_local11 = _local8.m_contacts[_local17];
_local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local17++;
};
m_broadPhase.Commit();
};
};
}
public function GetJointList():b2Joint{
return (m_jointList);
}
public function Validate():void{
m_broadPhase.Validate();
}
public function GetPairCount():int{
return (m_broadPhase.m_pairManager.m_pairCount);
}
public function GetBodyList():b2Body{
return (m_bodyList);
}
public function SetWarmStarting(_arg1:Boolean):void{
m_warmStarting = _arg1;
}
public function SetPositionCorrection(_arg1:Boolean):void{
m_positionCorrection = _arg1;
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local2:b2Joint;
var _local3:b2Body;
var _local4:b2Shape;
_local2 = b2Joint.Create(_arg1, m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_node1.joint = _local2;
_local2.m_node1.other = _local2.m_body2;
_local2.m_node1.prev = null;
_local2.m_node1.next = _local2.m_body1.m_jointList;
if (_local2.m_body1.m_jointList){
_local2.m_body1.m_jointList.prev = _local2.m_node1;
};
_local2.m_body1.m_jointList = _local2.m_node1;
_local2.m_node2.joint = _local2;
_local2.m_node2.other = _local2.m_body1;
_local2.m_node2.prev = null;
_local2.m_node2.next = _local2.m_body2.m_jointList;
if (_local2.m_body2.m_jointList){
_local2.m_body2.m_jointList.prev = _local2.m_node2;
};
_local2.m_body2.m_jointList = _local2.m_node2;
if (_arg1.collideConnected == false){
_local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.RefilterProxy(m_broadPhase, _local3.m_xf);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local2:Boolean;
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Body;
var _local6:b2Shape;
_local2 = _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;
};
_local3 = _arg1.m_body1;
_local4 = _arg1.m_body2;
_local3.WakeUp();
_local4.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local4.m_jointList){
_local4.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, m_blockAllocator);
m_jointCount--;
if (_local2 == false){
_local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.RefilterProxy(m_broadPhase, _local5.m_xf);
_local6 = _local6.m_next;
};
};
}
public function SetContactListener(_arg1:b2ContactListener):void{
m_contactListener = _arg1;
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
var _local2:b2Body;
if (m_lock == true){
return (null);
};
_local2 = 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 SetBoundaryListener(_arg1:b2BoundaryListener):void{
m_boundaryListener = _arg1;
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function Step(_arg1:Number, _arg2:int):void{
var _local3:b2TimeStep;
m_lock = true;
_local3 = new b2TimeStep();
_local3.dt = _arg1;
_local3.maxIterations = _arg2;
if (_arg1 > 0){
_local3.inv_dt = (1 / _arg1);
} else {
_local3.inv_dt = 0;
};
_local3.dtRatio = (m_inv_dt0 * _arg1);
_local3.positionCorrection = m_positionCorrection;
_local3.warmStarting = m_warmStarting;
m_contactManager.Collide();
if (_local3.dt > 0){
Solve(_local3);
};
if (((m_continuousPhysics) && ((_local3.dt > 0)))){
SolveTOI(_local3);
};
DrawDebugData();
m_inv_dt0 = _local3.inv_dt;
m_lock = false;
}
public function GetBodyCount():int{
return (m_bodyCount);
}
public function GetJointCount():int{
return (m_jointCount);
}
}
}//package Box2D.Dynamics
Section 75
//b2iBody (Box2DIntegration.b2iBody)
package Box2DIntegration {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2iBody extends b2iGameObject {
public var bodyDef:b2BodyDef;
public var m_body:b2Body;
public function b2iBody(){
bodyDef = new b2BodyDef();
}
public function createBody2(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:b2iLevel;
var _local5:b2ShapeDef;
var _local6:b2iShape;
var _local7:int;
_local4 = b2iLevel(parent);
bodyDef.position.Set(_local4.physCoord(this.x), _local4.physCoord(this.y));
bodyDef.angle = (this.rotation * 0.017453293);
if (static){
m_body = _local4.m_world.CreateBody(bodyDef);
} else {
m_body = _local4.m_world.CreateBody(bodyDef);
};
m_body.m_userData = this;
_local7 = 0;
while (_local7 < this.numChildren) {
if ((this.getChildAt(_local7) is b2iShape)){
_local6 = b2iShape(this.getChildAt(_local7));
_local5 = _local6.createShape(_local4, this);
_local5.density = _arg1;
_local5.friction = _arg2;
_local5.restitution = _arg3;
m_body.CreateShape(_local5);
};
_local7++;
};
m_body.SetMassFromShapes();
}
public function createBody():void{
var _local1:b2iLevel;
var _local2:b2ShapeDef;
var _local3:b2iShape;
var _local4:int;
_local1 = b2iLevel(parent);
bodyDef.position.Set(_local1.physCoord(this.x), _local1.physCoord(this.y));
bodyDef.angle = (this.rotation * 0.017453293);
m_body = _local1.m_world.CreateBody(bodyDef);
m_body.m_userData = this;
_local4 = 0;
while (_local4 < this.numChildren) {
if ((this.getChildAt(_local4) is b2iShape)){
_local3 = b2iShape(this.getChildAt(_local4));
_local2 = _local3.createShape(_local1, this);
m_body.CreateShape(_local2);
};
_local4++;
};
m_body.SetMassFromShapes();
}
override public function Update():void{
var _local1:b2iLevel;
var _local2:b2Vec2;
_local1 = b2iLevel(parent);
_local2 = this.m_body.GetPosition();
this.x = (_local2.x * _local1.m_physScale);
this.y = (_local2.y * _local1.m_physScale);
this.rotation = (this.m_body.GetAngle() * 57.29577951);
}
}
}//package Box2DIntegration
Section 76
//b2iBoxShape (Box2DIntegration.b2iBoxShape)
package Box2DIntegration {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import flash.geom.*;
public class b2iBoxShape extends b2iShape {
public function b2iBoxShape(){
shapeDef = new b2PolygonDef();
}
override public function createShape(_arg1:b2iLevel, _arg2:b2iGameObject):b2ShapeDef{
var _local3:b2PolygonDef;
var _local4:Rectangle;
var _local5:b2Vec2;
_local3 = b2PolygonDef(shapeDef);
_local4 = this.getRect(this);
_local5 = new b2Vec2(_arg1.physCoord((this.x * _arg2.scaleX)), _arg1.physCoord((this.y * _arg2.scaleY)));
_local3.SetAsOrientedBox(((_arg1.physCoord((_local4.width / 2)) * this.scaleX) * _arg2.scaleX), ((_arg1.physCoord((_local4.height / 2)) * this.scaleY) * _arg2.scaleY), _local5, (this.rotation * 0.017453293));
_local3.density = density;
_local3.friction = friction;
_local3.restitution = restitution;
_local3.isSensor = sensor;
_local3.filter.groupIndex = colgroup;
_local3.filter.categoryBits = categoryBits;
_local3.filter.maskBits = maskBits;
return (_local3);
}
}
}//package Box2DIntegration
Section 77
//b2iCircleShape (Box2DIntegration.b2iCircleShape)
package Box2DIntegration {
import Box2D.Collision.Shapes.*;
public class b2iCircleShape extends b2iShape {
public function b2iCircleShape(){
shapeDef = new b2CircleDef();
}
override public function createShape(_arg1:b2iLevel, _arg2:b2iGameObject):b2ShapeDef{
var _local3:b2CircleDef;
_local3 = b2CircleDef(shapeDef);
_local3.radius = (_arg1.physCoord((this.width / 2)) * _arg2.scaleX);
_local3.localPosition.Set(_arg1.physCoord((this.x * _arg2.scaleX)), _arg1.physCoord((this.y * _arg2.scaleY)));
_local3.restitution = restitution;
_local3.density = density;
_local3.friction = friction;
_local3.isSensor = sensor;
_local3.filter.groupIndex = colgroup;
_local3.filter.categoryBits = categoryBits;
_local3.filter.maskBits = maskBits;
return (_local3);
}
}
}//package Box2DIntegration
Section 78
//b2iGameObject (Box2DIntegration.b2iGameObject)
package Box2DIntegration {
import flash.display.*;
public class b2iGameObject extends MovieClip {
public function Update():void{
}
}
}//package Box2DIntegration
Section 79
//b2iJoint (Box2DIntegration.b2iJoint)
package Box2DIntegration {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
public class b2iJoint extends b2iGameObject {
protected var torqueResistance_:Number;
public var m_joint:b2Joint;
protected var forceResistance_:Number;
public var jd:b2JointDef;
public function get torqueResistance():Number{
return (this.torqueResistance_);
}
public function set forceResistance(_arg1:Number):void{
forceResistance_ = _arg1;
}
public function get forceResistance():Number{
return (this.forceResistance_);
}
public function set torqueResistance(_arg1:Number):void{
torqueResistance_ = _arg1;
}
protected function checkDestroy(_arg1:b2iLevel):void{
var _local2:Number;
var _local3:b2Vec2;
if (forceResistance_ != 0){
_local3 = this.m_joint.GetReactionForce();
if (_local3.Length() > forceResistance_){
_arg1.m_world.DestroyJoint(this.m_joint);
_arg1.removeChild(this);
};
};
_local2 = this.m_joint.GetReactionTorque();
}
override public function Update():void{
var _local1:b2iLevel;
var _local2:b2Vec2;
_local1 = b2iLevel(parent);
_local2 = this.m_joint.GetAnchor1();
this.x = (_local2.x * _local1.m_physScale);
this.y = (_local2.y * _local1.m_physScale);
checkDestroy(_local1);
}
public function createJoint():void{
}
}
}//package Box2DIntegration
Section 80
//b2iLevel (Box2DIntegration.b2iLevel)
package Box2DIntegration {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
import flash.display.*;
public class b2iLevel extends b2iObjectGroup {
public var m_physScale:Number;
public var draw_geometry:Boolean;
public var m_iterations:int;
protected var mousePVec:b2Vec2;
public var m_world:b2World;
public var mouseYWorld:Number;
public var mouseXWorldPhys:Number;
public var mouseYWorldPhys:Number;
public var m_timeStep:Number;
public var mouseXWorld:Number;
public function b2iLevel(){
mousePVec = new b2Vec2();
super();
draw_geometry = false;
}
public function destroy():void{
this.parent.removeChild(this);
m_world = null;
}
public function physCoord(_arg1:Number):Number{
return ((_arg1 / m_physScale));
}
public function restart():void{
}
public function GetBodyAtMouse(_arg1:Boolean=false):b2Body{
var _local2:b2AABB;
var _local3:int;
var _local4:Array;
var _local5:int;
var _local6:b2Body;
var _local7:int;
var _local8:b2Shape;
var _local9:Boolean;
mousePVec.Set(mouseXWorldPhys, mouseYWorldPhys);
_local2 = new b2AABB();
_local2.lowerBound.Set((mouseXWorldPhys - 0.001), (mouseYWorldPhys - 0.001));
_local2.upperBound.Set((mouseXWorldPhys + 0.001), (mouseYWorldPhys + 0.001));
_local3 = 10;
_local4 = new Array();
_local5 = m_world.Query(_local2, _local4, _local3);
_local6 = null;
_local7 = 0;
while (_local7 < _local5) {
if ((((_local4[_local7].m_body.IsStatic() == false)) || (_arg1))){
_local8 = (_local4[_local7] as b2Shape);
_local9 = (_local4[_local7] as b2Shape).TestPoint(_local8.m_body.GetXForm(), mousePVec);
if (_local9){
_local6 = _local8.m_body;
break;
};
};
_local7++;
};
return (_local6);
}
public function start():void{
}
public function UpdateMouseWorld():void{
mouseXWorldPhys = (mouseX / m_physScale);
mouseYWorldPhys = (mouseY / m_physScale);
mouseXWorld = mouseX;
mouseYWorld = mouseY;
}
override public function adoptChildren(_arg1:DisplayObject):void{
this.addChild(_arg1);
}
public function drawGeometry():void{
var _local1:b2DebugDraw;
var _local2:Sprite;
draw_geometry = true;
_local1 = new b2DebugDraw();
_local2 = new Sprite();
_local2.graphics.beginFill(0xFFFFFF);
_local2.graphics.drawRect(0, 0, 2000, 2000);
addChild(_local2);
_local1.m_sprite = _local2;
_local1.m_drawScale = m_physScale;
_local1.m_fillAlpha = 0.3;
_local1.m_lineThickness = 1;
_local1.m_drawFlags = (b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit);
m_world.SetDebugDraw(_local1);
}
public function createLevel(_arg1:int=1000, _arg2:int=-1000, _arg3:int=1000, _arg4:int=-1000, _arg5:b2Vec2=null, _arg6:Boolean=true, _arg7:int=1, _arg8:int=10, _arg9:Number=0.0166666666666667):void{
var _local10:b2AABB;
var _local11:b2Vec2;
_local10 = new b2AABB();
_local10.lowerBound.Set(_arg2, _arg4);
_local10.upperBound.Set(_arg1, _arg3);
m_physScale = _arg7;
m_iterations = _arg8;
m_timeStep = _arg9;
if (_arg5){
_local11 = new b2Vec2(_arg5.x, _arg5.y);
} else {
_local11 = new b2Vec2(0, 0);
};
m_world = new b2World(_local10, _local11, _arg6);
}
override public function Update():void{
m_world.Step(m_timeStep, m_iterations);
UpdateChildren();
UpdateMouseWorld();
}
}
}//package Box2DIntegration
Section 81
//b2iObjectGroup (Box2DIntegration.b2iObjectGroup)
package Box2DIntegration {
import Box2D.Common.Math.*;
import flash.display.*;
public class b2iObjectGroup extends MovieClip {
public function UpdateChildren():void{
var _local1:*;
var _local2:b2iGameObject;
var _local3:b2Vec2;
var _local4:int;
_local3 = new b2Vec2();
_local4 = 0;
while (_local4 < this.numChildren) {
_local1 = this.getChildAt(_local4);
if ((_local1 is b2iGameObject)){
_local2 = b2iGameObject(_local1);
_local2.Update();
};
_local4++;
};
}
public function adoptChildren(_arg1:DisplayObject):void{
}
public function Update():void{
}
}
}//package Box2DIntegration
Section 82
//b2iRevoluteJoint (Box2DIntegration.b2iRevoluteJoint)
package Box2DIntegration {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
import flash.geom.*;
import flash.display.*;
public class b2iRevoluteJoint extends b2iJoint {
protected var torque_:Number;
public var useStatic:Boolean;// = true
public var useGround:Boolean;// = true
protected var speed_:Number;
public function b2iRevoluteJoint(){
useGround = true;
useStatic = true;
super();
jd = new b2RevoluteJointDef();
}
private function createJoint2(_arg1:b2RevoluteJointDef, _arg2:b2World):b2Joint{
if (torque_ > 0){
_arg1.enableMotor = true;
_arg1.motorSpeed = speed_;
_arg1.maxMotorTorque = torque_;
};
return (b2RevoluteJoint(_arg2.CreateJoint(_arg1)));
}
public function set torque(_arg1:Number):void{
torque_ = _arg1;
}
public function get torque():Number{
return (this.torque_);
}
public function get speed():Number{
return (this.speed_);
}
public function set speed(_arg1:Number):void{
speed_ = _arg1;
}
override public function createJoint():void{
var _local1:b2iLevel;
var _local2:b2World;
var _local3:b2RevoluteJointDef;
var _local4:b2AABB;
var _local5:Array;
var _local6:int;
var _local7:Array;
var _local8:int;
var _local9:b2Body;
var _local10:int;
var _local11:Boolean;
_local1 = b2iLevel(parent);
_local2 = _local1.m_world;
_local3 = b2RevoluteJointDef(jd);
_local4 = new b2AABB();
_local4.lowerBound.Set((_local1.physCoord(this.x) - 0.001), (_local1.physCoord(this.y) - 0.001));
_local4.upperBound.Set((_local1.physCoord(this.x) + 0.001), (_local1.physCoord(this.y) + 0.001));
_local5 = new Array();
_local6 = 10;
_local7 = new Array();
_local8 = _local2.Query(_local4, _local7, _local6);
_local9 = null;
_local10 = 0;
while (_local10 < _local8) {
if ((((_local7[_local10].m_body.IsStatic() == false)) || (useStatic))){
_local11 = _local7[_local10].TestPoint(_local7[_local10].GetBody().GetXForm(), new b2Vec2(_local1.physCoord(this.x), _local1.physCoord(this.y)));
if (_local11){
_local5.push(_local7[_local10].m_body);
};
};
_local10++;
};
if (_local5.length > 0){
if (_local5.length >= 2){
_local3.Initialize(_local5[0], _local5[1], new b2Vec2(_local1.physCoord(this.x), _local1.physCoord(this.y)));
m_joint = createJoint2(_local3, _local2);
} else {
if (useGround){
_local3.Initialize((_local3.body1 = _local2.m_groundBody), _local5[0], new b2Vec2(_local1.physCoord(this.x), _local1.physCoord(this.y)));
m_joint = createJoint2(_local3, _local2);
} else {
m_joint = null;
};
};
} else {
m_joint = null;
};
if (!m_joint){
throw (Error("Unable to create revolute joint: No bodies to attach to"));
};
}
}
}//package Box2DIntegration
Section 83
//b2iShape (Box2DIntegration.b2iShape)
package Box2DIntegration {
import Box2D.Collision.Shapes.*;
import flash.display.*;
public class b2iShape extends MovieClip {
protected var restitution_:Number;
protected var colgroup_:int;
protected var density_:Number;
protected var friction_:Number;
protected var maskbits_:int;
public var shapeDef:b2ShapeDef;
protected var categorybits_:int;
protected var sensor_:Boolean;
public function get friction():Number{
return (this.friction_);
}
public function set colgroup(_arg1:int):void{
colgroup_ = _arg1;
}
public function get maskBits():int{
return (this.maskbits_);
}
public function get categoryBits():int{
return (this.categorybits_);
}
public function set friction(_arg1:Number):void{
friction_ = _arg1;
}
public function createShape(_arg1:b2iLevel, _arg2:b2iGameObject):b2ShapeDef{
return (null);
}
public function set maskBits(_arg1:int):void{
maskbits_ = _arg1;
}
public function set categoryBits(_arg1:int):void{
categorybits_ = _arg1;
}
public function get restitution():Number{
return (this.restitution_);
}
public function set sensor(_arg1:Boolean):void{
sensor_ = _arg1;
}
public function get sensor():Boolean{
return (this.sensor_);
}
public function set density(_arg1:Number):void{
density_ = _arg1;
}
public function set restitution(_arg1:Number):void{
restitution_ = _arg1;
}
public function get density():Number{
return (this.density_);
}
public function get colgroup():int{
return (this.colgroup_);
}
}
}//package Box2DIntegration
Section 84
//MD5 (com.adobe.crypto.MD5)
package com.adobe.crypto {
import flash.utils.*;
import com.adobe.utils.*;
public class MD5 {
public static var digest:ByteArray;
private static function ff(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(f, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function f(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg2) | (~(_arg1) & _arg3)));
}
private static function g(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg3) | (_arg2 & ~(_arg3))));
}
private static function h(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 ^ _arg2) ^ _arg3));
}
private static function i(_arg1:int, _arg2:int, _arg3:int):int{
return ((_arg2 ^ (_arg1 | ~(_arg3))));
}
private static function transform(_arg1:Function, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int):int{
var _local9:int;
_local9 = (((_arg2 + int(_arg1(_arg3, _arg4, _arg5))) + _arg6) + _arg8);
return ((IntUtil.rol(_local9, _arg7) + _arg3));
}
private static function hh(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(h, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
public static function hash(_arg1:String):String{
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (hashBinary(_local2));
}
private static function createBlocks(_arg1:ByteArray):Array{
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = new Array();
_local3 = (_arg1.length * 8);
_local4 = 0xFF;
_local5 = 0;
while (_local5 < _local3) {
_local2[int((_local5 >> 5))] = (_local2[int((_local5 >> 5))] | ((_arg1[(_local5 / 8)] & _local4) << (_local5 % 32)));
_local5 = (_local5 + 8);
};
_local2[int((_local3 >> 5))] = (_local2[int((_local3 >> 5))] | (128 << (_local3 % 32)));
_local2[int(((((_local3 + 64) >>> 9) << 4) + 14))] = _local3;
return (_local2);
}
public static function hashBinary(_arg1:ByteArray):String{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:int;
_local2 = 1732584193;
_local3 = -271733879;
_local4 = -1732584194;
_local5 = 271733878;
_local10 = createBlocks(_arg1);
_local11 = _local10.length;
_local12 = 0;
while (_local12 < _local11) {
_local6 = _local2;
_local7 = _local3;
_local8 = _local4;
_local9 = _local5;
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 7, -680876936);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 1))], 12, -389564586);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 17, 606105819);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 3))], 22, -1044525330);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 7, -176418897);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 5))], 12, 1200080426);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 17, -1473231341);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 7))], 22, -45705983);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 7, 1770035416);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 9))], 12, -1958414417);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 17, -42063);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 11))], 22, -1990404162);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 7, 1804603682);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 13))], 12, -40341101);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 17, -1502002290);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 15))], 22, 1236535329);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 5, -165796510);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 6))], 9, -1069501632);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 14, 643717713);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 0))], 20, -373897302);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 5, -701558691);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 10))], 9, 38016083);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 14, -660478335);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 4))], 20, -405537848);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 5, 568446438);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 14))], 9, -1019803690);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 14, -187363961);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 8))], 20, 1163531501);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 5, -1444681467);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 2))], 9, -51403784);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 14, 1735328473);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 12))], 20, -1926607734);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 4, -378558);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 8))], 11, -2022574463);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 16, 1839030562);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 14))], 23, -35309556);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 4, -1530992060);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 4))], 11, 1272893353);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 16, -155497632);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 10))], 23, -1094730640);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 4, 681279174);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 0))], 11, -358537222);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 16, -722521979);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 6))], 23, 76029189);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 4, -640364487);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 12))], 11, -421815835);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 16, 530742520);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 2))], 23, -995338651);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 6, -198630844);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 7))], 10, 1126891415);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 15, -1416354905);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 5))], 21, -57434055);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 6, 1700485571);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 3))], 10, -1894986606);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 15, -1051523);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 1))], 21, -2054922799);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 6, 1873313359);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 15))], 10, -30611744);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 15, -1560198380);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 13))], 21, 1309151649);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 6, -145523070);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 11))], 10, -1120210379);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 15, 718787259);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 9))], 21, -343485551);
_local2 = (_local2 + _local6);
_local3 = (_local3 + _local7);
_local4 = (_local4 + _local8);
_local5 = (_local5 + _local9);
_local12 = (_local12 + 16);
};
digest = new ByteArray();
digest.writeInt(_local2);
digest.writeInt(_local3);
digest.writeInt(_local4);
digest.writeInt(_local5);
digest.position = 0;
return ((((IntUtil.toHex(_local2) + IntUtil.toHex(_local3)) + IntUtil.toHex(_local4)) + IntUtil.toHex(_local5)));
}
private static function gg(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(g, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function ii(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(i, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
public static function hashBytes(_arg1:ByteArray):String{
return (hashBinary(_arg1));
}
}
}//package com.adobe.crypto
Section 85
//IntUtil (com.adobe.utils.IntUtil)
package com.adobe.utils {
public class IntUtil {
private static var hexChars:String = "0123456789abcdef";
public static function toHex(_arg1:int, _arg2:Boolean=false):String{
var _local3:String;
var _local4:int;
var _local5:int;
_local3 = "";
if (_arg2){
_local4 = 0;
while (_local4 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> (((3 - _local4) * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> ((3 - _local4) * 8)) & 15))));
_local4++;
};
} else {
_local5 = 0;
while (_local5 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> ((_local5 * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> (_local5 * 8)) & 15))));
_local5++;
};
};
return (_local3);
}
public static function ror(_arg1:int, _arg2:int):uint{
var _local3:int;
_local3 = (32 - _arg2);
return (((_arg1 << _local3) | (_arg1 >>> (32 - _local3))));
}
public static function rol(_arg1:int, _arg2:int):int{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
}
}//package com.adobe.utils
Section 86
//ConvexHull (com.FlashDynamix.geom.ConvexHull)
package com.FlashDynamix.geom {
import flash.geom.*;
import com.FlashDynamix.types.*;
public class ConvexHull {
public static function bottomRight(_arg1:Array):int{
var _local2:int;
var _local3:int;
var _local4:*;
_local2 = 0;
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _arg1[_local3];
if ((((_local4.y > _arg1[_local2].y)) || ((((_local4.y >= _arg1[_local2].y)) && ((_local4.x > _arg1[_local2].x)))))){
_local2 = _local3;
};
_local3++;
};
return (_local2);
}
public static function sortC(_arg1:Function, _arg2:Array):Array{
sortCC(_arg1, _arg2).reverse();
_arg2.unshift(_arg2.pop());
return (_arg2);
}
public static function isLeft(_arg1, _arg2, _arg3):int{
return ((((_arg2.x - _arg1.x) * (_arg3.y - _arg1.y)) - ((_arg3.x - _arg1.x) * (_arg2.y - _arg1.y))));
}
public static function bottomLeft(_arg1:Array):int{
var _local2:int;
var _local3:int;
var _local4:Point;
_local2 = 0;
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _arg1[_local3];
if ((((_local4.y > _arg1[_local2].y)) || ((((_local4.y >= _arg1[_local2].y)) && ((_local4.x < _arg1[_local2].x)))))){
_local2 = _local3;
};
_local3++;
};
return (_local2);
}
public static function findAngle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
if ((((_local5 == 0)) && ((_local6 == 0)))){
return (0);
};
_local7 = (Math.atan((_local6 / _local5)) * (180 / Math.PI));
if ((((_local5 >= 0)) && ((_local6 >= 0)))){
_local7 = (90 + _local7);
} else {
if ((((_local5 >= 0)) && ((_local6 < 0)))){
_local7 = (90 + _local7);
} else {
if ((((_local5 < 0)) && ((_local6 > 0)))){
_local7 = (270 + _local7);
} else {
if ((((_local5 < 0)) && ((_local6 <= 0)))){
_local7 = (270 + _local7);
};
};
};
};
return (_local7);
}
public static function bfpHullD(_arg1:Array, _arg2:int):Array{
var _local3:Array;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:Point;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:Array;
var _local16:int;
_local3 = new Array();
_local4 = _arg1.length;
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = 0;
_local9 = _arg1[0].x;
_local10 = _arg1[0].x;
_local12 = 0;
_local13 = -1;
_local14 = 0;
_local14 = 1;
while (_local14 < _local4) {
_local11 = _arg1[_local14];
if (_local11.x <= _local9){
if (_local11.x < _local9){
_local9 = _local11.x;
_local6 = _local14;
_local5 = _local6;
} else {
if (_local11.y < _arg1[_local5].y){
_local5 = _local14;
} else {
if (_local11.y > _arg1[_local6].y){
_local6 = _local14;
};
};
};
};
if (_local11.x >= _local10){
if (_local11.x > _local10){
_local10 = _local11.x;
_local8 = _local14;
_local7 = _local8;
} else {
if (_local11.y < _arg1[_local7].y){
_local7 = _local14;
} else {
if (_local11.y > _arg1[_local8].y){
_local8 = _local14;
};
};
};
};
_local14++;
};
if (_local9 == _local10){
++_local13;
var _local17 = _local13;
_local3[_local17] = _arg1[_local5];
if (_local6 != _local5){
++_local13;
var _local18 = _local13;
_local3[_local18] = _arg1[_local6];
};
return (_local3);
};
_local15 = new Array((_arg2 + 2));
_local15[0] = new Object();
_local15[0].min = _local5;
_local15[0].max = _local6;
_local15[(_arg2 + 1)] = new Object();
_local15[(_arg2 + 1)].min = _local7;
_local15[(_arg2 + 1)].max = _local8;
_local16 = 0;
_local16 = 1;
while (_local16 <= _arg2) {
_local15[_local16] = new Object();
_local15[_local16].min = (_local15[_local16].max = -1);
_local16++;
};
_local16 = 0;
_local14 = 0;
for (;_local14 < _local4;_local14++) {
_local11 = _arg1[_local14];
if ((((_local11.x == _local9)) || ((_local11.x == _local10)))){
} else {
if (ConvexHull.isLeft(_arg1[_local5], _arg1[_local7], _local11) < 0){
_local16 = int((((_arg2 * (_local11.x - _local9)) / (_local10 - _local9)) + 1));
if (_local15[_local16].min == -1){
_local15[_local16].min = _local14;
} else {
if (_local11.y < _arg1[_local15[_local16].min].y){
_local15[_local16].min = _local14;
};
};
} else {
if (ConvexHull.isLeft(_arg1[_local6], _arg1[_local8], _local11) > 0){
_local16 = int((((_arg2 * (_local11.x - _local9)) / (_local10 - _local9)) + 1));
if (_local15[_local16].max == -1){
_local15[_local16].max = _local14;
} else {
if (_local11.y > _arg1[_local15[_local16].max].y){
_local15[_local16].max = _local14;
};
};
continue;
};
};
};
};
_local14 = 0;
while (_local14 <= (_arg2 + 1)) {
if (_local15[_local14].min == -1){
} else {
_local11 = _arg1[_local15[_local14].min];
while (_local13 > 0) {
if (ConvexHull.isLeft(_local3[(_local13 - 1)], _local3[_local13], _local11) > 0){
break;
} else {
_local13--;
};
};
++_local13;
_local17 = _local13;
_local3[_local17] = _local11;
};
_local14++;
};
if (_local8 != _local7){
++_local13;
_local17 = _local13;
_local3[_local17] = _arg1[_local8];
};
_local12 = _local13;
_local14 = _arg2;
while (_local14 >= 0) {
if (_local15[_local14].max == -1){
} else {
_local11 = _arg1[_local15[_local14].max];
while (_local13 > _local12) {
if (ConvexHull.isLeft(_local3[(_local13 - 1)], _local3[_local13], _local11) > 0){
break;
} else {
_local13--;
};
};
++_local13;
_local17 = _local13;
_local3[_local17] = _local11;
};
_local14--;
};
if (_local6 != _local5){
++_local13;
_local17 = _local13;
_local3[_local17] = _arg1[_local5];
};
_local3.pop();
return (_local3);
}
public static function grahamScan2D(_arg1:Array):Array{
var _local2:Array;
var _local3:int;
ConvexHull.sortC(ConvexHull.bottomRight, _arg1);
_local2 = new Array(_arg1[1], _arg1[0]);
_local3 = 2;
while (_local3 < _arg1.length) {
if (_local2.length > 1){
if (ConvexHull.isLeft(_local2[0], _local2[1], _arg1[_local3]) < 0){
_local2.unshift(_arg1[_local3]);
_local3++;
} else {
_local2.splice(0, 1);
};
} else {
_local2.unshift(_arg1[_local3]);
_local3++;
};
};
return (_local2);
}
public static function sortCC(_arg1:Function, _arg2:Array):Array{
var idx:Number;
var pt:Point;
var same:Array;
var start = _arg1;
var p = _arg2;
idx = start(p);
pt = p[idx];
same = new Array();
p.sort(function (_arg1, _arg2){
var _local3:Number;
var _local4:Number;
_local3 = Line.angle(pt, _arg1);
_local4 = Line.angle(pt, _arg2);
if (_local3 > _local4){
return (-1);
};
if (_local3 < _local4){
return (1);
};
same.push(_arg1);
return (0);
});
Array2.removeItems(p, same);
return (p);
}
public static function startBottomRight(_arg1:Array):Array{
var _local2:Number;
var _local3:Array;
_local2 = ConvexHull.bottomRight(_arg1);
_local3 = _arg1.slice(_local2, _arg1.length);
_local3 = _local3.concat(_arg1.slice(0, _local2));
return (_local3);
}
}
}//package com.FlashDynamix.geom
Section 87
//Line (com.FlashDynamix.geom.Line)
package com.FlashDynamix.geom {
public class Line {
public static function isParallel(_arg1, _arg2, _arg3, _arg4):Boolean{
return ((Line.angle(_arg1, _arg2) == Line.angle(_arg3, _arg4)));
}
public static function angle(_arg1, _arg2):Number{
return (Math.atan2((_arg2.y - _arg1.y), (_arg2.x - _arg1.x)));
}
public static function projectOnLine(_arg1, _arg2, _arg3){
var _local4:*;
_local4 = Line.angle(_arg1, _arg2);
return ({x:(_arg1.x + (Math.cos(_local4) * _arg3)), y:(_arg1.y + (Math.sin(_local4) * _arg3))});
}
public static function length(_arg1, _arg2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function isPointOnLine(_arg1, _arg2, _arg3):Boolean{
return ((((Math.abs((Line.degree(_arg1, _arg2) - Line.degree(_arg1, _arg3))) < 0.25)) && ((Line.length(_arg1, _arg3) <= Line.length(_arg1, _arg2)))));
}
public static function scalar(_arg1, _arg2, _arg3):Number{
var _local4:Number;
var _local5:Number;
_local4 = Line.length(_arg1, _arg2);
_local5 = Line.length(_arg1, _arg3);
return ((_local5 / _local4));
}
public static function degree(_arg1, _arg2):Number{
return (((angle(_arg1, _arg2) * 180) / Math.PI));
}
}
}//package com.FlashDynamix.geom
Section 88
//Array2 (com.FlashDynamix.types.Array2)
package com.FlashDynamix.types {
public class Array2 {
public static function insertAt(_arg1:Number, _arg2:Array, _arg3:Array):Array{
var _local4:Array;
_local4 = _arg2.splice(_arg1);
_arg2 = _arg2.concat(_arg3);
return (_arg2.concat(_local4));
}
public static function remove(_arg1:Array, _arg2):Array{
var _local3:*;
_local3 = 0;
while (_local3 < _arg1.length) {
if (_arg1[_local3] == _arg2){
_arg1.splice(_local3, 1);
_local3--;
};
_local3++;
};
return (_arg1);
}
public static function addBetween(_arg1:Array, _arg2){
var _local3:*;
_local3 = 1;
while (_local3 < _arg1.length) {
_arg1.splice(_local3, 0, _arg2);
_local3++;
_local3++;
};
return (_arg1);
}
public static function removeEmpty(_arg1:Array, _arg2):Array{
var _local3:*;
_local3 = 0;
while (_local3 < _arg1.length) {
if (_arg1[_local3] == _arg2){
_arg1.splice(_local3, 1);
_local3--;
};
_local3++;
};
return (_arg1);
}
public static function setEmpty(_arg1:Array, _arg2, _arg3):Array{
var _local4:*;
_local4 = 0;
while (_local4 < _arg1.length) {
if (_arg1[_local4] == _arg2){
_arg1[_local4] = _arg3;
};
_local4++;
};
return (_arg1);
}
public static function removeItems(_arg1:Array, _arg2:Array):Array{
var _local3:*;
_local3 = 0;
while (_local3 < _arg2.length) {
remove(_arg1, _arg2[_local3]);
_local3++;
};
return (_arg1);
}
public static function contains(_arg1:Array, _arg2):Boolean{
var _local3:*;
_local3 = 0;
while (_local3 < _arg1.length) {
if (_arg1[_local3].valueOf() == _arg2.valueOf()){
return (true);
};
_local3++;
};
return (false);
}
}
}//package com.FlashDynamix.types
Section 89
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
public class AdLoader extends Sprite {
private var contentspotid:String;
private var cpmstarLoader:Loader;
public function AdLoader(_arg1:String){
this.contentspotid = _arg1;
addEventListener(Event.ADDED, addedHandler);
}
private function addedHandler(_arg1:Event):void{
var _local2:String;
var _local3:DisplayObjectContainer;
removeEventListener(Event.ADDED, addedHandler);
Security.allowDomain("server.cpmstar.com");
_local2 = "http://server.cpmstar.com/adviewas3.swf";
_local3 = parent;
cpmstarLoader = new Loader();
cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler);
cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler);
cpmstarLoader.load(new URLRequest(((_local2 + "?contentspotid=") + contentspotid)));
addChild(cpmstarLoader);
}
private function dispatchHandler(_arg1:Event):void{
dispatchEvent(_arg1);
}
}
}//package CPMStar
Section 90
//Color (fl.motion.Color)
package fl.motion {
import flash.geom.*;
import flash.display.*;
public class Color extends ColorTransform {
private var _tintMultiplier:Number;// = 0
private var _tintColor:Number;// = 0
public function Color(_arg1:Number=1, _arg2:Number=1, _arg3:Number=1, _arg4:Number=1, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0, _arg8:Number=0){
_tintColor = 0;
_tintMultiplier = 0;
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
public function setTint(_arg1:uint, _arg2:Number):void{
var _local3:uint;
var _local4:uint;
var _local5:uint;
this._tintColor = _arg1;
this._tintMultiplier = _arg2;
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = (1 - _arg2)));
_local3 = ((_arg1 >> 16) & 0xFF);
_local4 = ((_arg1 >> 8) & 0xFF);
_local5 = (_arg1 & 0xFF);
this.redOffset = Math.round((_local3 * _arg2));
this.greenOffset = Math.round((_local4 * _arg2));
this.blueOffset = Math.round((_local5 * _arg2));
}
public function set tintColor(_arg1:uint):void{
this.setTint(_arg1, this.tintMultiplier);
}
public function get brightness():Number{
return ((this.redOffset) ? (1 - this.redMultiplier) : (this.redMultiplier - 1));
}
private function deriveTintColor():uint{
var _local1:Number;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
_local1 = (1 / this.tintMultiplier);
_local2 = Math.round((this.redOffset * _local1));
_local3 = Math.round((this.greenOffset * _local1));
_local4 = Math.round((this.blueOffset * _local1));
_local5 = (((_local2 << 16) | (_local3 << 8)) | _local4);
return (_local5);
}
public function get tintMultiplier():Number{
return (this._tintMultiplier);
}
public function get tintColor():uint{
return (this._tintColor);
}
public function set brightness(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (_arg1 > 1){
_arg1 = 1;
} else {
if (_arg1 < -1){
_arg1 = -1;
};
};
_local2 = (1 - Math.abs(_arg1));
_local3 = 0;
if (_arg1 > 0){
_local3 = (_arg1 * 0xFF);
};
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = _local2));
this.redOffset = (this.greenOffset = (this.blueOffset = _local3));
}
public function set tintMultiplier(_arg1:Number):void{
this.setTint(this.tintColor, _arg1);
}
private function parseXML(_arg1:XML=null):Color{
var _local2:XML;
var _local3:XML;
var _local4:String;
var _local5:uint;
if (!_arg1){
return (this);
};
_local2 = _arg1.elements()[0];
if (!_local2){
return (this);
};
for each (_local3 in _local2.attributes()) {
_local4 = _local3.localName();
if (_local4 == "tintColor"){
_local5 = (Number(_local3.toString()) as uint);
this.tintColor = _local5;
} else {
this[_local4] = Number(_local3.toString());
};
};
return (this);
}
public static function interpolateColor(_arg1:uint, _arg2:uint, _arg3:Number):uint{
var _local4:Number;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:uint;
var _local14:uint;
var _local15:uint;
var _local16:uint;
var _local17:uint;
_local4 = (1 - _arg3);
_local5 = ((_arg1 >> 24) & 0xFF);
_local6 = ((_arg1 >> 16) & 0xFF);
_local7 = ((_arg1 >> 8) & 0xFF);
_local8 = (_arg1 & 0xFF);
_local9 = ((_arg2 >> 24) & 0xFF);
_local10 = ((_arg2 >> 16) & 0xFF);
_local11 = ((_arg2 >> 8) & 0xFF);
_local12 = (_arg2 & 0xFF);
_local13 = ((_local5 * _local4) + (_local9 * _arg3));
_local14 = ((_local6 * _local4) + (_local10 * _arg3));
_local15 = ((_local7 * _local4) + (_local11 * _arg3));
_local16 = ((_local8 * _local4) + (_local12 * _arg3));
_local17 = ((((_local13 << 24) | (_local14 << 16)) | (_local15 << 8)) | _local16);
return (_local17);
}
public static function interpolateTransform(_arg1:ColorTransform, _arg2:ColorTransform, _arg3:Number):ColorTransform{
var _local4:Number;
var _local5:ColorTransform;
_local4 = (1 - _arg3);
_local5 = new ColorTransform(((_arg1.redMultiplier * _local4) + (_arg2.redMultiplier * _arg3)), ((_arg1.greenMultiplier * _local4) + (_arg2.greenMultiplier * _arg3)), ((_arg1.blueMultiplier * _local4) + (_arg2.blueMultiplier * _arg3)), ((_arg1.alphaMultiplier * _local4) + (_arg2.alphaMultiplier * _arg3)), ((_arg1.redOffset * _local4) + (_arg2.redOffset * _arg3)), ((_arg1.greenOffset * _local4) + (_arg2.greenOffset * _arg3)), ((_arg1.blueOffset * _local4) + (_arg2.blueOffset * _arg3)), ((_arg1.alphaOffset * _local4) + (_arg2.alphaOffset * _arg3)));
return (_local5);
}
public static function fromXML(_arg1:XML):Color{
return (Color(new (Color).parseXML(_arg1)));
}
}
}//package fl.motion
Section 91
//Fade (fl.transitions.Fade)
package fl.transitions {
import flash.display.*;
public class Fade extends Transition {
protected var _alphaFinal:Number;
public function Fade(_arg1:MovieClip, _arg2:Object, _arg3:TransitionManager){
super(_arg1, _arg2, _arg3);
this._alphaFinal = this.manager.contentAppearance.alpha;
}
override protected function _render(_arg1:Number):void{
this._content.alpha = (this._alphaFinal * _arg1);
}
override public function get type():Class{
return (Fade);
}
}
}//package fl.transitions
Section 92
//Transition (fl.transitions.Transition)
package fl.transitions {
import flash.geom.*;
import flash.display.*;
import flash.events.*;
public class Transition extends EventDispatcher {
protected var _direction:uint;// = 0
protected var _progress:Number;
public var ID:int;
protected var _twn:Tween;
protected var _content:MovieClip;
protected var _height:Number;// = NAN
protected var _width:Number;// = NAN
protected var _outerBounds:Rectangle;
protected var _easing:Function;
protected var _innerBounds:Rectangle;
protected var _manager:TransitionManager;
protected var _duration:Number;// = 2
public static const IN:uint = 0;
public static const OUT:uint = 1;
public function Transition(_arg1:MovieClip, _arg2:Object, _arg3:TransitionManager){
_direction = 0;
_duration = 2;
_width = NaN;
_height = NaN;
super();
this.content = _arg1;
this.direction = _arg2.direction;
this.duration = _arg2.duration;
this.easing = _arg2.easing;
this.manager = _arg3;
this._innerBounds = this.manager._innerBounds;
this._outerBounds = this.manager._outerBounds;
this._width = this.manager._width;
this._height = this.manager._height;
this._resetTween();
}
public function stop():void{
this._twn.fforward();
this._twn.stop();
}
private function _resetTween():void{
if (this._twn){
this._twn.stop();
this._twn.removeEventListener(TweenEvent.MOTION_FINISH, this.onMotionFinished);
};
this._twn = new Tween(this, "", this.easing, 0, 1, this.duration, true);
this._twn.stop();
this._twn.prop = "progress";
this._twn.addEventListener(TweenEvent.MOTION_FINISH, this.onMotionFinished, false, 0, true);
}
public function onMotionFinished(_arg1:Object):void{
if (this.direction == Transition.OUT){
this.dispatchEvent(new Event("transitionOutDone"));
} else {
this.dispatchEvent(new Event("transitionInDone"));
};
}
public function get duration():Number{
return (this._duration);
}
public function set duration(_arg1:Number):void{
if (_arg1){
this._duration = _arg1;
if (this._twn){
this._twn.duration = _arg1;
};
};
}
public function get easing():Function{
return (this._easing);
}
public function get manager():TransitionManager{
return (this._manager);
}
public function get progress():Number{
return (this._progress);
}
protected function _render(_arg1:Number):void{
}
public function get type():Class{
return (Transition);
}
public function drawCircle(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number):void{
_arg1.graphics.moveTo((_arg2 + _arg4), _arg3);
_arg1.graphics.curveTo((_arg4 + _arg2), ((Math.tan((Math.PI / 8)) * _arg4) + _arg3), ((Math.sin((Math.PI / 4)) * _arg4) + _arg2), ((Math.sin((Math.PI / 4)) * _arg4) + _arg3));
_arg1.graphics.curveTo(((Math.tan((Math.PI / 8)) * _arg4) + _arg2), (_arg4 + _arg3), _arg2, (_arg4 + _arg3));
_arg1.graphics.curveTo(((-(Math.tan((Math.PI / 8))) * _arg4) + _arg2), (_arg4 + _arg3), ((-(Math.sin((Math.PI / 4))) * _arg4) + _arg2), ((Math.sin((Math.PI / 4)) * _arg4) + _arg3));
_arg1.graphics.curveTo((-(_arg4) + _arg2), ((Math.tan((Math.PI / 8)) * _arg4) + _arg3), (-(_arg4) + _arg2), _arg3);
_arg1.graphics.curveTo((-(_arg4) + _arg2), ((-(Math.tan((Math.PI / 8))) * _arg4) + _arg3), ((-(Math.sin((Math.PI / 4))) * _arg4) + _arg2), ((-(Math.sin((Math.PI / 4))) * _arg4) + _arg3));
_arg1.graphics.curveTo(((-(Math.tan((Math.PI / 8))) * _arg4) + _arg2), (-(_arg4) + _arg3), _arg2, (-(_arg4) + _arg3));
_arg1.graphics.curveTo(((Math.tan((Math.PI / 8)) * _arg4) + _arg2), (-(_arg4) + _arg3), ((Math.sin((Math.PI / 4)) * _arg4) + _arg2), ((-(Math.sin((Math.PI / 4))) * _arg4) + _arg3));
_arg1.graphics.curveTo((_arg4 + _arg2), ((-(Math.tan((Math.PI / 8))) * _arg4) + _arg3), (_arg4 + _arg2), _arg3);
}
public function cleanUp():void{
this.removeEventListener("transitionInDone", this._manager.transitionInDone);
this.removeEventListener("transitionOutDone", this._manager.transitionOutDone);
this.stop();
}
public function set easing(_arg1:Function):void{
this._easing = _arg1;
if (this._twn){
this._twn.func = _arg1;
};
}
public function set manager(_arg1:TransitionManager):void{
if (this._manager){
this.removeEventListener("transitionInDone", this._manager.transitionInDone);
this.removeEventListener("transitionOutDone", this._manager.transitionOutDone);
};
this._manager = _arg1;
this.addEventListener("transitionInDone", this._manager.transitionInDone);
this.addEventListener("transitionOutDone", this._manager.transitionOutDone);
}
public function set progress(_arg1:Number):void{
if (this._progress == _arg1){
return;
};
this._progress = _arg1;
if (this._direction){
this._render((1 - _arg1));
} else {
this._render(_arg1);
};
this.dispatchEvent(new Event("transitionProgress"));
}
public function start():void{
this.content.visible = true;
this._twn.start();
}
public function drawBox(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
_arg1.graphics.moveTo(_arg2, _arg3);
_arg1.graphics.lineTo((_arg2 + _arg4), _arg3);
_arg1.graphics.lineTo((_arg2 + _arg4), (_arg3 + _arg5));
_arg1.graphics.lineTo(_arg2, (_arg3 + _arg5));
_arg1.graphics.lineTo(_arg2, _arg3);
}
public function set content(_arg1:MovieClip):void{
if (_arg1){
this._content = _arg1;
if (this._twn){
this._twn.obj = _arg1;
};
};
}
private function _noEase(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public function get content():MovieClip{
return (this._content);
}
public function set direction(_arg1:Number):void{
this._direction = (_arg1) ? 1 : 0;
}
public function get direction():Number{
return (this._direction);
}
}
}//package fl.transitions
Section 93
//TransitionManager (fl.transitions.TransitionManager)
package fl.transitions {
import flash.geom.*;
import flash.display.*;
import flash.events.*;
public class TransitionManager extends EventDispatcher {
public var _innerBounds:Rectangle;
private var _visualPropList:Object;
private var _triggerEvent:String;
public var className:String;// = "TransitionManager"
public var type:Object;
private var _contentAppearance:Object;
private var _content:MovieClip;
public var _width:Number;// = NAN
public var _height:Number;// = NAN
public var _outerBounds:Rectangle;
private var _transitions:Object;
private static var IDCount:int = 0;
public function TransitionManager(_arg1:MovieClip){
type = TransitionManager;
className = "TransitionManager";
_width = NaN;
_height = NaN;
_visualPropList = {x:null, y:null, scaleX:null, scaleY:null, alpha:null, rotation:null};
super();
this.content = _arg1;
this._transitions = {};
}
public function get content():MovieClip{
return (this._content);
}
public function removeAllTransitions():void{
var _local1:Transition;
for each (_local1 in this._transitions) {
_local1.cleanUp();
this.removeTransition(_local1);
};
}
function transitionInDone(_arg1:Object):void{
var _local2:Boolean;
this.removeTransition(_arg1.target);
if (this.numInTransitions == 0){
_local2 = this._content.visible;
if ((((this._triggerEvent == "hide")) || ((this._triggerEvent == "hideChild")))){
this._content.visible = false;
};
if (_local2){
this.dispatchEvent(new Event("allTransitionsInDone"));
};
};
}
public function get numOutTransitions():Number{
var _local1:Number;
var _local2:Object;
var _local3:Transition;
_local1 = 0;
_local2 = this._transitions;
for each (_local3 in _local2) {
if (_local3.direction){
_local1++;
};
};
return (_local1);
}
public function get contentAppearance():Object{
return (this._contentAppearance);
}
public function saveContentAppearance():void{
var _local1:MovieClip;
var _local2:Object;
var _local3:String;
_local1 = this._content;
if (!this._contentAppearance){
_local2 = (this._contentAppearance = {});
for (_local3 in this._visualPropList) {
_local2[_local3] = _local1[_local3];
};
_local2.colorTransform = _local1.transform.colorTransform;
};
this._innerBounds = _local1.getBounds(_local1);
this._outerBounds = _local1.getBounds(_local1.parent);
this._width = _local1.width;
this._height = _local1.height;
}
public function addTransition(_arg1:Transition):Transition{
_arg1.ID = ++TransitionManager.IDCount;
this._transitions[_arg1.ID] = _arg1;
return (_arg1);
}
public function startTransition(_arg1:Object):Transition{
var _local2:Class;
var _local3:Transition;
this.removeTransition(this.findTransition(_arg1));
_local2 = _arg1.type;
_local3 = new _local2(this._content, _arg1, this);
this.addTransition(_local3);
_local3.start();
return (_local3);
}
function transitionOutDone(_arg1:Object):void{
var _local2:Boolean;
this.removeTransition(_arg1.target);
if (this.numOutTransitions == 0){
this.restoreContentAppearance();
_local2 = this._content.visible;
if (((_local2) && ((((_triggerEvent == "hide")) || ((_triggerEvent == "hideChild")))))){
this._content.visible = false;
};
if (_local2){
this.dispatchEvent(new Event("allTransitionsOutDone"));
};
};
}
public function restoreContentAppearance():void{
var _local1:MovieClip;
var _local2:Object;
var _local3:String;
_local1 = this._content;
_local2 = this._contentAppearance;
for (_local3 in this._visualPropList) {
_local1[_local3] = _local2[_local3];
};
_local1.transform.colorTransform = _local2.colorTransform;
}
public function get numTransitions():Number{
var _local1:Number;
var _local2:Transition;
_local1 = 0;
for each (_local2 in this._transitions) {
_local1++;
};
return (_local1);
}
public function findTransition(_arg1:Object):Transition{
var _local2:Transition;
for each (_local2 in this._transitions) {
if (_local2.type == _arg1.type){
return (_local2);
};
};
return (null);
}
public function set content(_arg1:MovieClip):void{
this._content = _arg1;
this.saveContentAppearance();
}
public function get numInTransitions():Number{
var _local1:Number;
var _local2:Object;
var _local3:Transition;
_local1 = 0;
_local2 = this._transitions;
for each (_local3 in _local2) {
if (!_local3.direction){
_local1++;
};
};
return (_local1);
}
public function removeTransition(_arg1:Transition):Boolean{
if (((((!(_arg1)) || (!(this._transitions)))) || (!(this._transitions[_arg1.ID])))){
return (false);
};
_arg1.cleanUp();
return (delete this._transitions[_arg1.ID]);
}
public function get transitionsList():Object{
return (this._transitions);
}
public static function start(_arg1:MovieClip, _arg2:Object):Transition{
if (!_arg1.__transitionManager){
_arg1.__transitionManager = new TransitionManager(_arg1);
};
if (_arg2.direction == 1){
_arg1.__transitionManager._triggerEvent = "hide";
} else {
_arg1.__transitionManager._triggerEvent = "reveal";
};
return (_arg1.__transitionManager.startTransition(_arg2));
}
}
}//package fl.transitions
Section 94
//Tween (fl.transitions.Tween)
package fl.transitions {
import flash.display.*;
import flash.utils.*;
import flash.events.*;
public class Tween extends EventDispatcher {
private var _position:Number;// = NAN
public var prevTime:Number;// = NAN
public var prevPos:Number;// = NAN
public var isPlaying:Boolean;// = false
public var begin:Number;// = NAN
private var _fps:Number;// = NAN
private var _time:Number;// = NAN
public var change:Number;// = NAN
private var _finish:Number;// = NAN
public var looping:Boolean;// = false
private var _intervalID:uint;// = 0
public var func:Function;
private var _timer:Timer;// = null
private var _startTime:Number;// = NAN
public var prop:String;// = ""
private var _duration:Number;// = NAN
public var obj:Object;// = null
public var useSeconds:Boolean;// = false
protected static var _mc:MovieClip = new MovieClip();
public function Tween(_arg1:Object, _arg2:String, _arg3:Function, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean=false){
isPlaying = false;
obj = null;
prop = "";
func = function (_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
};
begin = NaN;
change = NaN;
useSeconds = false;
prevTime = NaN;
prevPos = NaN;
looping = false;
_duration = NaN;
_time = NaN;
_fps = NaN;
_position = NaN;
_startTime = NaN;
_intervalID = 0;
_finish = NaN;
_timer = null;
super();
if (!arguments.length){
return;
};
this.obj = _arg1;
this.prop = _arg2;
this.begin = _arg4;
this.position = _arg4;
this.duration = _arg6;
this.useSeconds = _arg7;
if ((_arg3 is Function)){
this.func = _arg3;
};
this.finish = _arg5;
this._timer = new Timer(100);
this.start();
}
public function continueTo(_arg1:Number, _arg2:Number):void{
this.begin = this.position;
this.finish = _arg1;
if (!isNaN(_arg2)){
this.duration = _arg2;
};
this.start();
}
public function stop():void{
this.stopEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_STOP, this._time, this._position));
}
private function fixTime():void{
if (this.useSeconds){
this._startTime = (getTimer() - (this._time * 1000));
};
}
public function set FPS(_arg1:Number):void{
var _local2:Boolean;
_local2 = this.isPlaying;
this.stopEnterFrame();
this._fps = _arg1;
if (_local2){
this.startEnterFrame();
};
}
public function get finish():Number{
return ((this.begin + this.change));
}
public function get duration():Number{
return (this._duration);
}
protected function startEnterFrame():void{
var _local1:Number;
if (isNaN(this._fps)){
_mc.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, false, 0, true);
} else {
_local1 = (1000 / this._fps);
this._timer.delay = _local1;
this._timer.addEventListener(TimerEvent.TIMER, this.timerHandler, false, 0, true);
this._timer.start();
};
this.isPlaying = true;
}
public function set time(_arg1:Number):void{
this.prevTime = this._time;
if (_arg1 > this.duration){
if (this.looping){
this.rewind((_arg1 - this._duration));
this.update();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_LOOP, this._time, this._position));
} else {
if (this.useSeconds){
this._time = this._duration;
this.update();
};
this.stop();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_FINISH, this._time, this._position));
};
} else {
if (_arg1 < 0){
this.rewind();
this.update();
} else {
this._time = _arg1;
this.update();
};
};
}
protected function stopEnterFrame():void{
if (isNaN(this._fps)){
_mc.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
} else {
this._timer.stop();
};
this.isPlaying = false;
}
public function getPosition(_arg1:Number=NaN):Number{
if (isNaN(_arg1)){
_arg1 = this._time;
};
return (this.func(_arg1, this.begin, this.change, this._duration));
}
public function set finish(_arg1:Number):void{
this.change = (_arg1 - this.begin);
}
public function set duration(_arg1:Number):void{
this._duration = ((_arg1)<=0) ? Infinity : _arg1;
}
public function setPosition(_arg1:Number):void{
this.prevPos = this._position;
if (this.prop.length){
this.obj[this.prop] = (this._position = _arg1);
};
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_CHANGE, this._time, this._position));
}
public function resume():void{
this.fixTime();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_RESUME, this._time, this._position));
}
public function fforward():void{
this.time = this._duration;
this.fixTime();
}
protected function onEnterFrame(_arg1:Event):void{
this.nextFrame();
}
public function get position():Number{
return (this.getPosition(this._time));
}
public function yoyo():void{
this.continueTo(this.begin, this.time);
}
public function nextFrame():void{
if (this.useSeconds){
this.time = ((getTimer() - this._startTime) / 1000);
} else {
this.time = (this._time + 1);
};
}
protected function timerHandler(_arg1:TimerEvent):void{
this.nextFrame();
_arg1.updateAfterEvent();
}
public function get FPS():Number{
return (this._fps);
}
public function rewind(_arg1:Number=0):void{
this._time = _arg1;
this.fixTime();
this.update();
}
public function set position(_arg1:Number):void{
this.setPosition(_arg1);
}
public function get time():Number{
return (this._time);
}
private function update():void{
this.setPosition(this.getPosition(this._time));
}
public function start():void{
this.rewind();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_START, this._time, this._position));
}
public function prevFrame():void{
if (!this.useSeconds){
this.time = (this._time - 1);
};
}
}
}//package fl.transitions
Section 95
//TweenEvent (fl.transitions.TweenEvent)
package fl.transitions {
import flash.events.*;
public class TweenEvent extends Event {
public var time:Number;// = NAN
public var position:Number;// = NAN
public static const MOTION_START:String = "motionStart";
public static const MOTION_STOP:String = "motionStop";
public static const MOTION_LOOP:String = "motionLoop";
public static const MOTION_CHANGE:String = "motionChange";
public static const MOTION_FINISH:String = "motionFinish";
public static const MOTION_RESUME:String = "motionResume";
public function TweenEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false){
time = NaN;
position = NaN;
super(_arg1, _arg4, _arg5);
this.time = _arg2;
this.position = _arg3;
}
override public function clone():Event{
return (new TweenEvent(this.type, this.time, this.position, this.bubbles, this.cancelable));
}
}
}//package fl.transitions
Section 96
//BoundaryListener (Game.BoundaryListener)
package Game {
import Box2D.Dynamics.*;
public class BoundaryListener extends b2BoundaryListener {
override public function Violation(_arg1:b2Body):void{
Globals.destroyList.push(_arg1.m_userData);
}
}
}//package Game
Section 97
//Globals (Game.Globals)
package Game {
import flash.media.*;
import flash.net.*;
public class Globals {
public static const GAME_LEVELCOMPLETE:int = 3;
public static const GAME_RESUME:int = 4;
public static const GAME_PAUSED:int = 1;
public static const PUSH_MODE:int = 4;
public static const SCALE:int = 20;
public static const GAME_RESTART:int = 2;
public static const PIN_MODE:int = 2;
public static const CRAYON_MODE:int = 0;
public static const HINGE_MODE:int = 3;
public static const GAME_PLAY:int = 0;
public static const ERASER_MODE:int = 1;
public static const GAME_BACK_TO_MENU:int = 5;
public static var pointerMode:int;
public static var currentLevel:int;
public static var gameID:String = "1285";
public static var numLevels:int = (levels.length / 2);
public static var music1:Sound;
public static var music2:Sound;
public static var destroyList:Array;
public static var gameState:int;
public static var gamePaused:Boolean;
public static var lastGameState:int;
public static var savedData:SharedObject;
public static var useFilter:Boolean = true;
public static var levels:Array = [NivelFreePlay, "azul", Nivel1, "amarillo", NuevoNivel2, "amarillo", NuevoNivel3, "blanco", Nivel27, "blanco", Nivel3, "azul", Nivel5, "amarillo", Nivel2, "amarillo", Nivel4, "azul", Nivel6, "negro", Nivel7, "negro", Nivel8, "azul", Nivel9, "blanco", Nivel10, "negro", Nivel12, "azul", Nivel13, "amarillo", Nivel14, "azul", Nivel15, "negro", Nivel16, "negro", Nivel18, "blanco", Nivel17, "blanco", Nivel19, "azul", Nivel21, "amarillo", Nivel20, "azul", Nivel22, "negro", Nivel23, "azul", Nivel24, "negro", Nivel25, "blanco", Nivel38, "amarillo", Nivel37, "azul", Nivel26, "negro", Nivel39, "blanco", Nivel40, "azul"];
public static var soundChannel:SoundChannel;
public static function stopMusic(){
if (soundChannel){
soundChannel.stop();
};
soundChannel = null;
}
public static function startMusic(){
if (soundChannel){
soundChannel.stop();
};
soundChannel = Globals.music2.play(0, int.MAX_VALUE);
}
}
}//package Game
Section 98
//MochiBot (Game.MochiBot)
package Game {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package Game
Section 99
//MPContactListener (Game.MPContactListener)
package Game {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import flash.utils.*;
public class MPContactListener extends b2ContactListener {
public const MAX_SEPARATION:int = -5;
public var estrellitaContact:MWBody;// = null
public var overlappingBodies:Dictionary;
public function MPContactListener(){
estrellitaContact = null;
super();
}
override public function Add(_arg1:b2ContactPoint):void{
var _local2:MWBody;
var _local3:MWBody;
_local2 = _arg1.shape1.GetBody().GetUserData();
_local3 = _arg1.shape2.GetBody().GetUserData();
if ((((_local2 is Estrellita)) || ((_local2 is EstrellitaObj)))){
if ((((_local3 is Bolita)) || ((_local3 is Cajita)))){
estrellitaContact = _local2;
};
} else {
if ((((_local3 is Estrellita)) || ((_local3 is EstrellitaObj)))){
if ((((_local2 is Bolita)) || ((_local2 is Cajita)))){
estrellitaContact = _local3;
};
};
};
}
override public function Persist(_arg1:b2ContactPoint):void{
var _local2:b2Body;
var _local3:b2Body;
if (_arg1.separation < MAX_SEPARATION){
_local2 = _arg1.shape1.GetBody();
_local3 = _arg1.shape2.GetBody();
if (((((!(_local2.IsStatic())) && (_local3.IsStatic()))) && (!((_local2.GetJointList() == null))))){
overlappingBodies[_local2] = 1;
};
if (((((!(_local3.IsStatic())) && (_local2.IsStatic()))) && (!((_local3.GetJointList() == null))))){
overlappingBodies[_local3] = 1;
};
return;
};
}
public function cleanOverlapping(){
overlappingBodies = new Dictionary();
}
}
}//package Game
Section 100
//MWBody (Game.MWBody)
package Game {
import flash.display.*;
import Box2DIntegration.*;
public class MWBody extends b2iBody {
public var canDestroy:Boolean;// = true
public var id:uint;// = 0
public var connectedToPinned:Boolean;
public var pin:Pin;// = null
public var canPin:Boolean;// = true
public var drawable:Boolean;// = false
public var figura:Bitmap;
private static var idCount = 0;
public function MWBody(){
canPin = true;
canDestroy = true;
pin = null;
id = 0;
drawable = false;
super();
idCount++;
connectedToPinned = false;
drawable = false;
id = idCount;
figura = null;
}
}
}//package Game
Section 101
//MWLevel (Game.MWLevel)
package Game {
import Box2DIntegration.*;
public dynamic class MWLevel extends b2iLevel {
public var fondo:String;
public var i_bolita:Bolita;
public var numPins:int;// = 0
public var bolita:b2iGameObject;
public var i_cajita:Cajita;
public function MWLevel(){
numPins = 0;
super();
}
public function getFondo():String{
return (fondo);
}
public function setFondo(_arg1:String):void{
fondo = _arg1;
}
}
}//package Game
Section 102
//Contenedor_23 (MP2_fla.Contenedor_23)
package MP2_fla {
import flash.display.*;
public dynamic class Contenedor_23 extends MovieClip {
public function Contenedor_23(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package MP2_fla
Section 103
//CrayonAd_169 (MP2_fla.CrayonAd_169)
package MP2_fla {
import flash.display.*;
public dynamic class CrayonAd_169 extends MovieClip {
public var crayonLink1:SimpleButton;
}
}//package MP2_fla
Section 104
//Figura5_194 (MP2_fla.Figura5_194)
package MP2_fla {
import flash.display.*;
public dynamic class Figura5_194 extends MovieClip {
public function Figura5_194(){
addFrameScript(133, frame134);
}
function frame134(){
}
}
}//package MP2_fla
Section 105
//Fondos_204 (MP2_fla.Fondos_204)
package MP2_fla {
import flash.display.*;
public dynamic class Fondos_204 extends MovieClip {
public function Fondos_204(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame2(){
stop();
}
}
}//package MP2_fla
Section 106
//LevelNum_178 (MP2_fla.LevelNum_178)
package MP2_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LevelNum_178 extends MovieClip {
public var textfield:TextField;
public function LevelNum_178(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
textfield.mouseEnabled = false;
stop();
}
function frame2(){
textfield.mouseEnabled = false;
stop();
}
}
}//package MP2_fla
Section 107
//LoadingBar_17 (MP2_fla.LoadingBar_17)
package MP2_fla {
import flash.display.*;
public dynamic class LoadingBar_17 extends MovieClip {
public var loadingbarmask:MovieClip;
}
}//package MP2_fla
Section 108
//main_155 (MP2_fla.main_155)
package MP2_fla {
import flash.display.*;
public dynamic class main_155 extends MovieClip {
public var selectLevel_button:SimpleButton;
public var music_button:MovieClip;
public var help_button:SimpleButton;
}
}//package MP2_fla
Section 109
//MainTimeline (MP2_fla.MainTimeline)
package MP2_fla {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
import flash.geom.*;
import flash.display.*;
import flash.utils.*;
import flash.events.*;
import fl.motion.*;
import fl.transitions.*;
import Game.*;
import Box2DIntegration.*;
import MyUtils.*;
import com.FlashDynamix.geom.*;
import flash.media.*;
import CPMStar.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
import fl.transitions.easing.*;
public dynamic class MainTimeline extends MovieClip {
public const SCREEN_WIDTH:int = 640;
public const SCROLL_SPEED:int = 10;
public const FIRST_PUSH_STR:Number = 100;
public const SCREEN_HEIGHT:int = 480;
public const MIN_ANGLE:Number = 7;
public const UI_MAIN:int = 2;
public const UI_ALL:int = 1;
public const DRAWING_DENSITY:Number = 2.5;
public const DRAWING_RESTITUTION:Number = 0;
public const BOX_THICKNESS:Number = 3;
public const LINEAR_DAMPING:Number = 0.1;
public const PIN_RANGE:Number = 0.25;
public const MIN_PUSH_DIST:Number = 100;
public const PUSH_TIMER:int = 90;
public const CIRCLE_AUGMENT:Number = 0.05;
public const UI_NONE:int = 3;
public const DRAWING_FRICTION:Number = 0.5;
public const MIN_PERIMETER:Number = 2;
public const CLOSE_DISTANCE:Number = 1.05;
public const MIN_DIST_TO_LINE:Number = 0.5;
public const LIFE_SPAN:int = 3600;
public const MAX_PERIMETER:Number = 75;
public const MAX_CIRCLE_RADIUS:Number = 5;
public const MIN_DISTANCE:Number = 0.25;
public const ANGULAR_DAMPING:Number = 0.05;
public const PUSH_STR:Number = 2;
public const MIN_CIRCLE_RADIUS:Number = 0.5;
public const TORQUE_BOLA:Number = 60000000;
public const CIRCLE_PRECISION:int = 8;
public const HINGE_RESISTANCE:Number = 300000;
public var b_back_options:SimpleButton;
public var bu_OQuality:MovieClip;
public var perimeter:Number;
public var drawing:Boolean;
public var ad:DisplayObject;
public var bu_FP:SimpleButton;
public var connectedPinned:Array;
public var circleTimer:Timer;
public var logoTimer:Timer;
public var noTint:Color;
public var i:int;
public var CRAYON_SPACE:Number;
public var name_input_next:SimpleButton;
public var bu_OMusic:MovieClip;
public var inGameSuperUI:InGameSuperUI;
public var contenedor:MovieClip;
public var lastPoint:Point;
public var CPMStarContentSpotID:String;
public var i_fondo:MovieClip;
public var movieBytesTotal:int;
public var letsplay:SimpleButton;
public var colorProperties:Array;
public var quality:int;
public var contactListener:MPContactListener;
public var loadingbar:MovieClip;
public var currentColorProperty:int;
public var puntosFigura:Array;
public var bubble_logo:MovieClip;
public var circleRadius:Number;
public var lastGroup:int;
public var crayonBrushes:Array;
public var level_score_tf:TextField;
public var linksXRow:int;
public var posicionEstrellas:Array;
public var sinTable:Array;
public var input_name:TextField;
public var firstPush:int;
public var b_White:SimpleButton;
public var estrellasOrigen:Array;
public var b_back_credits:SimpleButton;
public var pinnedObjects:Array;
public var crayonLink:SimpleButton;
public var b_Blue:SimpleButton;
public var startTime:int;
public var cosTable:Array;
public var pushing:Boolean;
public var uiSwitchState:int;
public var bola:b2iBody;
public var drawingCircle:Boolean;
public var adBox:MovieClip;
public var mp1_link:SimpleButton;
public var bar_init_x:int;
public var whiteTint:Color;
public var i_tuto:MovieClip;
public var secondsUsed:Number;
public var bolaStart:Point;
public var b_Red:SimpleButton;
public var endTimer:Timer;
public var cursor:Point;
public var timerBackToMenu:Timer;
public var estrellas:Array;
public var newBody:MovieClip;
public var cursorMC:MovieClip;
public var level:MWLevel;
public var inGameUI:InGameUI;
public var newBodyPos:Point;
public var links:MovieClip;
public var musicLink:SimpleButton;
public var linkList:Array;
public var shapesUsed:int;
public var bu_OTutorial:MovieClip;
public var minimumTime:int;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12);
}
public function handleKeyUp(_arg1:KeyboardEvent){
var _local2:String;
_local2 = String.fromCharCode(_arg1.charCode);
if (_arg1.keyCode == Keyboard.SPACE){
if (Globals.gameState == Globals.GAME_PLAY){
if (Globals.currentLevel != (Globals.numLevels + 1)){
Globals.gameState = Globals.GAME_RESTART;
};
};
} else {
if ((((_local2 == "a")) || ((_local2 == "A")))){
if (Globals.pointerMode == Globals.ERASER_MODE){
Globals.pointerMode = Globals.CRAYON_MODE;
};
} else {
if ((((_local2 == "d")) || ((_local2 == "D")))){
if (Globals.pointerMode == Globals.HINGE_MODE){
Globals.pointerMode = Globals.CRAYON_MODE;
};
} else {
if ((((_local2 == "s")) || ((_local2 == "S")))){
if (Globals.pointerMode == Globals.PIN_MODE){
Globals.pointerMode = Globals.CRAYON_MODE;
};
} else {
if ((((_local2 == "w")) || ((_local2 == "W")))){
if (Globals.pointerMode == Globals.PUSH_MODE){
Globals.pointerMode = Globals.CRAYON_MODE;
};
} else {
if (_arg1.keyCode == Keyboard.ESCAPE){
if (Globals.gameState == Globals.GAME_PLAY){
inGameGoBackToMenu();
};
};
};
};
};
};
};
}
public function adjustPoly(_arg1:Point, _arg2:Array):Point{
var _local3:Point;
var _local4:Point;
_local3 = new Point();
for each (_local4 in _arg2) {
_local4.x = ((_local4.x * Globals.SCALE) - _arg1.x);
_local4.y = ((_local4.y * Globals.SCALE) - _arg1.y);
_local3.x = Math.max(_local3.x, _local4.x);
_local3.y = Math.max(_local3.y, _local4.y);
};
return (_local3);
}
public function mergeGroups(_arg1:b2Body, _arg2:b2Body):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Array;
_local3 = _arg1.GetShapeList().GetFilterData().groupIndex;
_local4 = _arg2.GetShapeList().GetFilterData().groupIndex;
if ((((_local3 == 0)) && ((_local4 == 0)))){
_local5 = getNextGroup();
} else {
_local5 = Math.min(_local3, _local4);
};
_local6 = [];
propagateGroup(_arg1, _local5, _local6);
}
public function pushBall(){
var _local1:b2Vec2;
var _local2:Number;
_local1 = new b2Vec2((bola.x - cursorMC.x), (bola.y - cursorMC.y));
_local2 = (Math.min((MIN_PUSH_DIST / _local1.Length()), 1) * PUSH_STR);
_local1.Normalize();
_local1.Multiply(_local2);
bola.m_body.ApplyForce(_local1, bola.m_body.GetWorldCenter());
if (firstPush == 0){
firstPush = PUSH_TIMER;
_local1.Normalize();
_local1.Multiply(FIRST_PUSH_STR);
bola.m_body.ApplyForce(_local1, bola.m_body.GetWorldCenter());
};
}
function frame10(){
secondsUsed = 0;
colorProperties = new Array(16416705, 16094470, 8701998, 7943053);
initSinCosTables();
shapesUsed = 0;
whiteTint = new Color();
whiteTint.setTint(0xFFFFFF, 1);
noTint = new Color();
cursor = new Point();
cursorMC = new Cursor();
cursorMC.mouseEnabled = false;
newBodyPos = new Point();
inGameUI = new InGameUI();
inGameSuperUI = new InGameSuperUI();
initInGameUI();
initializeLevel(pickLevel(Globals.currentLevel));
stop();
CRAYON_SPACE = 3;
crayonBrushes = [new Brush1(1, 1), new Brush2(1, 1), new Brush3(1, 1), new Brush4(1, 1)];
}
function frame11(){
stop();
}
public function handleKeyDown(_arg1:KeyboardEvent){
var _local2:String;
_local2 = String.fromCharCode(_arg1.charCode);
if ((((((_local2 == "a")) || ((_local2 == "A")))) && (!(drawing)))){
Globals.pointerMode = Globals.ERASER_MODE;
} else {
if ((((((_local2 == "d")) || ((_local2 == "D")))) && (!(drawing)))){
Globals.pointerMode = Globals.HINGE_MODE;
} else {
if ((((((_local2 == "s")) || ((_local2 == "S")))) && (!(drawing)))){
Globals.pointerMode = Globals.PIN_MODE;
} else {
if ((((((_local2 == "w")) || ((_local2 == "W")))) && (!(drawing)))){
Globals.pointerMode = Globals.PUSH_MODE;
};
};
};
};
}
function frame12(){
if (Globals.soundChannel){
bu_OMusic.gotoAndStop("on");
} else {
bu_OMusic.gotoAndStop("off");
};
quality = 1;
b_back_options.addEventListener(MouseEvent.CLICK, backToMenu, false, 0, true);
bu_OMusic.addEventListener(MouseEvent.MOUSE_OVER, f2MouseOverMusicButton, false, 0, true);
bu_OMusic.addEventListener(MouseEvent.MOUSE_OUT, f2MouseOffMusicButton, false, 0, true);
bu_OMusic.addEventListener(MouseEvent.CLICK, f2toggleMusic, false, 0, true);
bu_OTutorial.addEventListener(MouseEvent.MOUSE_OVER, f2MouseOverTutorialButton, false, 0, true);
bu_OTutorial.addEventListener(MouseEvent.MOUSE_OUT, f2MouseOffTutorialButton, false, 0, true);
bu_OTutorial.addEventListener(MouseEvent.CLICK, f2toggleTutorial, false, 0, true);
bu_OQuality.addEventListener(MouseEvent.MOUSE_OVER, f2MouseOverQualityButton, false, 0, true);
bu_OQuality.addEventListener(MouseEvent.MOUSE_OUT, f2MouseOffQualityButton, false, 0, true);
bu_OQuality.addEventListener(MouseEvent.CLICK, f2toggleQuality, false, 0, true);
stop();
}
public function connectedToPinned(_arg1:b2Body):Boolean{
var _local2:Array;
var _local3:b2JointEdge;
_local2 = new Array();
_local2.push(_arg1);
if (_arg1.m_userData.pin){
return (true);
};
if (_arg1.m_userData.canPin){
_local3 = _arg1.GetJointList();
while (_local3 != null) {
if (_local3.other.m_userData.pin){
return (true);
};
if (connectedToPinned2(_local3.other, _local2)){
return (true);
};
_local3 = _local3.next;
};
};
return (false);
}
function frame1(){
stop();
logoTimer = new Timer(3000, 1);
logoTimer.start();
logoTimer.addEventListener(TimerEvent.TIMER_COMPLETE, fgotopreloader, false, 0, true);
}
function frame2(){
stop();
CPMStarContentSpotID = "451QFBED252F";
ad = new AdLoader(CPMStarContentSpotID);
adBox.addChild(ad);
bubble_logo.addEventListener(MouseEvent.CLICK, bubbleboxLogoLink, false, 0, true);
TransitionManager.start(this, {type:Fade, direction:Transition.IN});
addEventListener(Event.ENTER_FRAME, loadProgress, false, 0, true);
minimumTime = (10 * 1000);
startTime = getTimer();
bar_init_x = loadingbar.loadingbarmask.x;
movieBytesTotal = this.root.loaderInfo.bytesTotal;
}
function frame4(){
Globals.music2 = new Chapter1();
Globals.startMusic();
stage.frameRate = 30;
Globals.savedData = SharedObject.getLocal("magicPen2");
if (!Globals.savedData.data.levelScores){
Globals.savedData.data.levelScores = new Array((Globals.numLevels - 1));
Globals.savedData.data.hasWon = false;
Globals.savedData.data.bestScore = 0;
Globals.savedData.data.bestScoreSent = 0;
i = 0;
while (i < (Globals.numLevels - 1)) {
Globals.savedData.data.levelScores[i] = -1;
i++;
};
};
if (!Globals.savedData.data.bestScoreSent){
Globals.savedData.data.bestScoreSent = 0;
};
}
function frame5(){
stop();
b_Red.addEventListener(MouseEvent.CLICK, fplay, false, 0, true);
b_White.addEventListener(MouseEvent.CLICK, foptions, false, 0, true);
b_Blue.addEventListener(MouseEvent.CLICK, fcredits, false, 0, true);
crayonLink.addEventListener(MouseEvent.CLICK, listenCrayonLink, false, 0, true);
musicLink.addEventListener(MouseEvent.CLICK, listenMusicLink, false, 0, true);
}
function frame8(){
linksXRow = 7;
linkList = [];
level_score_tf.text = "";
level_score_tf.mouseEnabled = false;
refreshLinks();
stop();
mp1_link.addEventListener(MouseEvent.CLICK, bubbleboxMP1, false, 0, true);
}
function frame6(){
stop();
name_input_next.addEventListener(MouseEvent.CLICK, listenInputNext, false, 0, true);
input_name.restrict = "A-Za-z0-9";
input_name.addEventListener(TextEvent.TEXT_INPUT, name_listener, false, 0, true);
stage.focus = input_name;
}
public function resetBola(){
var _local1:int;
if (Globals.gameState == Globals.GAME_PLAY){
destroyJoints(bola.m_body);
level.m_world.DestroyBody(bola.m_body);
bola.m_body = null;
level.removeChild(bola);
if ((bola is Bolita)){
bola = new Bolita();
} else {
bola = new Cajita();
};
level.addChild(bola);
bola.createBody();
bola.m_body.SetXForm(new b2Vec2(bolaStart.x, bolaStart.y), 0);
bola.m_body.m_angularVelocity = 0;
bola.m_body.m_linearVelocity.Set(0, 0);
bola.m_body.m_torque = 0;
bola.m_body.m_force.Set(0, 0);
_local1 = 0;
_local1 = 0;
while (_local1 < estrellasOrigen.length) {
if (estrellas.indexOf(estrellasOrigen[_local1]) == -1){
level.addChild(estrellasOrigen[_local1]);
estrellasOrigen[_local1].m_body.SetXForm(posicionEstrellas[_local1][0], posicionEstrellas[_local1][1]);
estrellasOrigen[_local1].createBody();
};
_local1++;
};
estrellas = new Array();
_local1 = 0;
while (_local1 < estrellasOrigen.length) {
estrellas.push(estrellasOrigen[_local1]);
_local1++;
};
};
}
function frame9(){
b_back_credits.addEventListener(MouseEvent.CLICK, backToMenu, false, 0, true);
stop();
}
function frame3(){
stop();
removeChild(this.contenedor);
MochiBot.track(this, "8c6a3986");
play();
}
public function removeFigura(_arg1:MovieClip){
if (_arg1.figura != null){
_arg1.removeChild(_arg1.figura);
_arg1.figura = null;
};
}
function frame7(){
letsplay.addEventListener(MouseEvent.CLICK, startGame, false, 0, true);
stop();
}
public function clearLS(){
var _local1:LevelLink;
for each (_local1 in linkList) {
_local1.removeEventListener(MouseEvent.CLICK, selectLevel);
_local1.removeEventListener(MouseEvent.MOUSE_OVER, updateScoreField);
};
linkList = [];
removeChild(links);
bu_FP.removeEventListener(MouseEvent.CLICK, selectFreePlay);
mp1_link.removeEventListener(MouseEvent.CLICK, bubbleboxMP1);
links = null;
}
public function getNextGroup():int{
lastGroup = (lastGroup - 1);
return (lastGroup);
}
public function fplay(_arg1:Event){
Globals.currentLevel = 1;
if (!Globals.savedData.data.playedBefore){
Globals.savedData.data.playedBefore = true;
};
if (!Globals.savedData.data.player_name){
gotoAndStop("getName");
} else {
gotoAndStop("selectLevel");
};
}
public function f2MouseOffMusicButton(_arg1:Event){
if (Globals.soundChannel){
bu_OMusic.gotoAndStop("on");
} else {
bu_OMusic.gotoAndStop("off");
};
}
public function scrollLevel(){
if (mouseX > 590){
level.x = (level.x - SCROLL_SPEED);
} else {
if (mouseX < 50){
level.x = (level.x + SCROLL_SPEED);
};
};
if (level.x > 0){
level.x = 0;
} else {
if (level.x < ((-(level.getRect(level).right) + 640) + 80)){
level.x = ((-(level.getRect(level).right) + 640) + 80);
};
};
}
public function initInGameUI(){
uiSwitchState = UI_ALL;
inGameUI.main.help_button.addEventListener(MouseEvent.CLICK, fhelp_button, false, 0, true);
inGameUI.main.music_button.addEventListener(MouseEvent.CLICK, ftoggleMusic, false, 0, true);
inGameUI.main.music_button.addEventListener(MouseEvent.MOUSE_OVER, fMouseOverMusicButton, false, 0, true);
inGameUI.main.music_button.addEventListener(MouseEvent.MOUSE_OUT, fMouseOffMusicButton, false, 0, true);
inGameUI.main.selectLevel_button.addEventListener(MouseEvent.CLICK, fingame_levelSelect, false, 0, true);
inGameSuperUI.uiSwitch_button.addEventListener(MouseEvent.CLICK, fuiSwitch, false, 0, true);
}
public function update(_arg1:Event){
switch (Globals.gameState){
case Globals.GAME_PLAY:
contactListener.cleanOverlapping();
updatePhysics();
destroyOverlapping();
if (pushing){
updatePush();
pushBall();
} else {
if (drawing){
updatePush2();
drawLine();
} else {
updatePush2();
if (newBody){
level.removeChild(newBody);
newBody = null;
};
};
};
updateCursor();
checkEstrellas();
deleteFiguras();
secondsUsed = (secondsUsed + (1 / 30));
break;
case Globals.GAME_PAUSED:
break;
case Globals.GAME_RESUME:
customCursorOn();
Globals.gameState = Globals.lastGameState;
stage.focus = level;
break;
case Globals.GAME_RESTART:
initializeLevel(pickLevel(Globals.currentLevel));
break;
case Globals.GAME_LEVELCOMPLETE:
updatePhysics();
if (drawing){
drawLine();
} else {
if (newBody){
level.removeChild(newBody);
newBody = null;
};
};
updateCursor();
deleteFiguras();
break;
case Globals.GAME_BACK_TO_MENU:
inGameGoBackToMenu();
break;
};
}
public function checkCircleBounds(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
var _local4:b2AABB;
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:b2Vec2;
var _local9:int;
var _local10:int;
_local4 = new b2AABB();
_local4.lowerBound.Set((_arg1 - _arg3), (_arg2 - _arg3));
_local4.upperBound.Set((_arg1 + _arg3), (_arg2 + _arg3));
_local5 = 10;
_local6 = new Array();
_local7 = level.m_world.Query(_local4, _local6, _local5);
_local8 = new b2Vec2();
_local9 = 0;
while (_local9 < _local7) {
if (!((connectedToPinned(_local6[_local9].m_body)) || (_local6[_local9].m_body.m_userData.drawable))){
_local10 = 0;
while (_local10 < CIRCLE_PRECISION) {
_local8.x = (_arg1 + (_arg3 * sinTable[_local10]));
_local8.y = (_arg2 - (_arg3 * cosTable[_local10]));
if (_local6[_local9].TestPoint(_local6[_local9].GetBody().GetXForm(), _local8)){
return (true);
};
_local10++;
};
};
_local9++;
};
return (false);
}
public function bubbleboxMP1(_arg1:Event){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1285&subid=magicpen1link&action=magicpen1");
navigateToURL(_local2);
}
public function propagateGroup(_arg1, _arg2, _arg3):void{
var _local4:b2FilterData;
var _local5:b2JointEdge;
_arg3.push(_arg1);
_local4 = _arg1.GetShapeList().m_filter;
_local4.groupIndex = _arg2;
level.m_world.Refilter(_arg1.GetShapeList());
_local5 = _arg1.GetJointList();
while (_local5 != null) {
if (_arg3.indexOf(_local5.other) == -1){
propagateGroup(_local5.other, _arg2, _arg3);
};
_local5 = _local5.next;
};
}
public function selectFreePlay(_arg1:MouseEvent){
Globals.currentLevel = 0;
clearLS();
gotoAndStop("startGame");
}
public function f2MouseOffTutorialButton(_arg1:Event){
bu_OTutorial.gotoAndStop("on");
}
public function updatePush2(){
if (firstPush > 0){
firstPush--;
};
}
public function siteLock(_arg1:Array):Boolean{
var _local2:Boolean;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
_local2 = true;
_local3 = this.root.loaderInfo.url;
_local4 = (_local3.indexOf("://") + 3);
_local5 = _local3.indexOf("/", _local4);
_local6 = _local3.substring(_local4, _local5);
for each (_local7 in _arg1) {
if (_local6.indexOf(_local7) != -1){
return (false);
};
};
return (true);
}
public function loadProgress(_arg1:Event){
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = this.root.loaderInfo.bytesLoaded;
_local3 = int(((_local2 * loadingbar.loadingbarmask.width) / movieBytesTotal));
_local4 = (getTimer() - startTime);
_local3 = Math.min(_local3, ((Number(_local4) / minimumTime) * loadingbar.loadingbarmask.width));
loadingbar.loadingbarmask.x = (bar_init_x + _local3);
if ((((_local2 >= movieBytesTotal)) && ((_local4 >= minimumTime)))){
bubble_logo.removeEventListener(MouseEvent.CLICK, bubbleboxLogoLink);
removeEventListener(Event.ENTER_FRAME, loadProgress);
removeChild(adBox);
play();
};
}
public function updatePhysics(){
level.Update();
}
public function colisionEstrella(){
var _local1:MWBody;
var _local2:int;
var _local3:MovieClip;
_local1 = contactListener.estrellitaContact;
if (_local1){
contactListener.estrellitaContact = null;
_local2 = estrellas.indexOf(_local1);
if (_local2 >= 0){
level.m_world.DestroyBody(_local1.m_body);
estrellas.splice(_local2, 1);
_local3 = new Puff();
_local3.x = _local1.x;
_local3.y = _local1.y;
level.addChild(_local3);
level.removeChild(_local1);
};
};
}
public function fuiSwitch(_arg1:Event){
switch (uiSwitchState){
case UI_ALL:
uiSwitchState = UI_MAIN;
break;
case UI_MAIN:
uiSwitchState = UI_NONE;
break;
case UI_NONE:
uiSwitchState = UI_ALL;
break;
};
setUIVisibility();
}
public function pointInsideBody(_arg1:Point, _arg2:b2Body){
var _local3:b2Vec2;
var _local4:b2Shape;
_local3 = new b2Vec2(_arg1.x, _arg1.y);
_local4 = _arg2.GetShapeList();
while (_local4 != null) {
if (_local4.TestPoint(_arg2.GetXForm(), _local3)){
return (true);
};
_local4 = _local4.m_next;
};
return (false);
}
public function makeLine2(_arg1:Point, _arg2:Point):Array{
var _local3:Array;
var _local4:Point;
_local3 = new Array();
_local3.push(_arg1);
_local3.push(_arg2);
_local4 = new Point(-((_arg2.y - _arg1.y)), (_arg2.x - _arg1.x));
_local4.normalize((10 / Globals.SCALE));
_local3.push(new Point((_arg2.x + _local4.x), (_arg2.y + _local4.y)));
_local3.push(new Point((_arg1.x + _local4.x), (_arg1.y + _local4.y)));
return (_local3);
}
public function fcredits(_arg1:Event){
gotoAndStop("credits");
}
public function deleteFiguras(){
var _local1:MWBody;
var _local2:int;
_local2 = 0;
while (_local2 < Globals.destroyList.length) {
_local1 = MWBody(Globals.destroyList[_local2]);
if (_local1 == bola){
resetBola();
} else {
destroyJoints(_local1.m_body);
level.m_world.DestroyBody(_local1.m_body);
_local1.m_body = null;
level.removeChild(_local1);
};
_local2++;
};
Globals.destroyList = new Array();
}
public function f2MouseOverTutorialButton(_arg1:Event){
bu_OTutorial.gotoAndStop("on_over");
}
public function updateCursor(){
var _local1:Number;
var _local2:Number;
_local1 = mouseX;
_local2 = mouseY;
if (_local1 < 0){
_local1 = 0;
} else {
if (_local1 > 790){
_local1 = 790;
};
};
if (_local2 < 0){
_local2 = 0;
} else {
if (_local2 > 520){
_local2 = 520;
};
};
cursor.x = (_local1 / Number(Globals.SCALE));
cursor.y = (_local2 / Number(Globals.SCALE));
cursorMC.x = _local1;
cursorMC.y = _local2;
if (pushing){
cursorMC.viento.visible = true;
} else {
cursorMC.viento.visible = false;
};
switch (Globals.pointerMode){
case Globals.CRAYON_MODE:
setCursorLabel("crayon");
cursorMC.rotation = -((((1320 - _local1) - (520 - _local2)) / 12));
break;
case Globals.ERASER_MODE:
setCursorLabel("borrador");
cursorMC.rotation = -((((1320 - _local1) - (520 - _local2)) / 12));
break;
case Globals.HINGE_MODE:
setCursorLabel("hinge");
cursorMC.rotation = 0;
break;
case Globals.PIN_MODE:
setCursorLabel("pin");
cursorMC.rotation = 0;
break;
case Globals.PUSH_MODE:
setCursorLabel("push");
cursorMC.rotation = (Math.atan2((bola.y - cursorMC.y), (bola.x - cursorMC.x)) * Utils.TO_DEG);
break;
};
}
public function eraseBody(_arg1:Number, _arg2:Number):Boolean{
var _local3:b2Body;
var _local4:*;
_local4 = new Point(_arg1, _arg2);
_local3 = getLastBodyAtPoint(_local4);
if (_local3){
if (_local3.m_userData.canDestroy){
destroyJoints(_local3);
level.m_world.DestroyBody(_local3);
_local3.m_userData.m_body = null;
level.removeChild(_local3.m_userData);
return (true);
};
};
return (false);
}
public function f2MouseOffQualityButton(_arg1:Event){
switch (quality){
case 1:
bu_OQuality.gotoAndStop("high");
break;
case 2:
bu_OQuality.gotoAndStop("medium");
break;
case 3:
bu_OQuality.gotoAndStop("low");
break;
};
}
public function refreshLinks(){
var _local1:LevelLink;
var _local2:int;
if (links){
removeChild(links);
};
links = new MovieClip();
_local2 = 1;
while (_local2 < Globals.numLevels) {
_local1 = new LevelLink();
_local1.levelname.text = ("" + _local2);
_local1.y = (Math.floor(((_local2 - 1) / linksXRow)) * 60);
_local1.x = (((_local2 - 1) % linksXRow) * 80);
_local1.addEventListener(MouseEvent.CLICK, selectLevel, false, 0, true);
_local1.addEventListener(MouseEvent.MOUSE_OVER, updateScoreField, false, 0, true);
links.addChild(_local1);
linkList.push(_local1);
if (Globals.savedData.data.levelScores[(_local2 - 1)] >= 0){
_local1.gotoAndStop("check");
};
_local2++;
};
bu_FP.addEventListener(MouseEvent.CLICK, selectFreePlay, false, 0, true);
links.y = 122;
links.x = 160;
addChild(links);
}
public function handleMouseDown(_arg1:MouseEvent){
var _local2:Point;
var _local3:Boolean;
var _local4:Array;
var _local5:b2Body;
var _local6:MWBody;
var _local7:b2Body;
var _local8:int;
var _local9:Pin;
var _local10:b2Body;
var _local11:b2Body;
var _local12:b2Body;
var _local13:Boolean;
var _local14:Bitmap;
var _local15:Pin;
if (drawing){
endDrawing();
if (newBody){
level.removeChild(newBody);
newBody = null;
};
};
switch (Globals.pointerMode){
case Globals.ERASER_MODE:
_local2 = new Point((Number(cursor.x) * Globals.SCALE), (Number(cursor.y) * Globals.SCALE));
_local3 = false;
_local4 = level.getObjectsUnderPoint(_local2);
_local8 = 0;
while (_local8 < _local4.length) {
if ((_local4[_local8].parent is Pin)){
_local9 = Pin(_local4[_local8].parent);
if (_local9.m_joint){
_local10 = _local9.m_joint.GetBody1();
_local11 = _local9.m_joint.GetBody2();
level.m_world.DestroyJoint(_local9.m_joint);
divideGroups(_local10, _local11);
level.removeChild(_local9);
} else {
MWBody(_local9.parent).pin = null;
_local9.parent.removeChild(_local9);
};
_local3 = true;
break;
};
_local8++;
};
if (!_local3){
_local13 = false;
if (!eraseBody(cursor.x, cursor.y)){
};
};
break;
case Globals.CRAYON_MODE:
_local5 = getBodyAtPoint(new Point(cursor.x, cursor.y));
if ((((((_local5 == null)) || (connectedToPinned(_local5)))) || (_local5.m_userData.drawable))){
drawing = true;
drawingCircle = false;
circleRadius = MIN_CIRCLE_RADIUS;
newBody = new MovieClip();
_local14 = new Bitmap(new BitmapData(800, 520, true, 0), "never");
newBody.figura = _local14;
_local14.x = (-(cursor.x) * Globals.SCALE);
_local14.y = (-(cursor.y) * Globals.SCALE);
newBody.addChild(_local14);
puntosFigura = new Array();
connectedPinned = new Array();
perimeter = 0;
level.addChild(newBody);
newBody.graphics.moveTo(0, 0);
lastPoint.x = 0;
lastPoint.y = 0;
newBodyPos.x = cursor.x;
newBodyPos.y = cursor.y;
newBody.x = (cursor.x * Globals.SCALE);
newBody.y = (cursor.y * Globals.SCALE);
puntosFigura.push(lastPoint.clone());
currentColorProperty++;
if (currentColorProperty == colorProperties.length){
currentColorProperty = 0;
};
inGameSuperUI.ui_barra.visible = true;
inGameSuperUI.ui_maskbarra.scaleX = 1;
circleTimer = new Timer(500, 1);
circleTimer.addEventListener(TimerEvent.TIMER_COMPLETE, startCircle, false, 0, true);
circleTimer.start();
};
break;
case Globals.HINGE_MODE:
case Globals.PIN_MODE:
_local7 = getLastBodyAtPoint(new Point(cursor.x, cursor.y));
if (_local7){
if (_local7.m_userData.canPin){
if (!_local7.m_userData.pin){
_local6 = _local7.m_userData;
_local15 = new Pin();
_local15.useStatic = true;
_local15.useGround = false;
if (Globals.pointerMode == Globals.PIN_MODE){
b2RevoluteJointDef(_local15.jd).enableLimit = true;
b2RevoluteJointDef(_local15.jd).lowerAngle = 0;
b2RevoluteJointDef(_local15.jd).upperAngle = 0;
_local15.gotoAndStop("pin");
} else {
_local15.gotoAndStop("hinge");
};
_local6.addChild(_local15);
_local15.x = _local6.mouseX;
_local15.y = _local6.mouseY;
_local6.pin = _local15;
pinnedObjects.push(_local6);
} else {
_local6 = _local7.m_userData;
_local15 = _local6.pin;
_local15.useStatic = true;
_local15.useGround = false;
if (Globals.pointerMode == Globals.PIN_MODE){
b2RevoluteJointDef(_local15.jd).enableLimit = true;
b2RevoluteJointDef(_local15.jd).lowerAngle = 0;
b2RevoluteJointDef(_local15.jd).upperAngle = 0;
_local15.gotoAndStop("pin");
} else {
_local15.gotoAndStop("hinge");
};
_local15.x = _local6.mouseX;
_local15.y = _local6.mouseY;
};
};
};
break;
case Globals.PUSH_MODE:
pushing = true;
break;
};
}
public function inGameGoBackToMenu(){
if (stage.contains(inGameUI)){
customCursorOff();
};
if (level){
removeListeners();
stage.removeChild(level);
level = null;
};
removeUIListeners();
gotoAndStop("menu");
}
public function removeListenersInputName(){
input_name.removeEventListener(TextEvent.TEXT_INPUT, name_listener);
name_input_next.removeEventListener(MouseEvent.CLICK, listenInputNext);
}
public function checkNearToPin(_arg1:b2Body){
if ((((((puntosFigura.length > 1)) && (_arg1.m_userData.pin))) && ((connectedPinned.indexOf(_arg1) == -1)))){
connectedPinned.push(_arg1);
};
}
public function destroyJoints(_arg1:b2Body){
var _local2:b2Joint;
var _local3:b2JointEdge;
var _local4:b2Body;
var _local5:b2Body;
_local3 = _arg1.GetJointList();
while (_local3) {
_local2 = _local3.joint;
_local3 = _local3.next;
_local4 = _local2.GetBody1();
_local5 = _local2.GetBody2();
level.m_world.DestroyJoint(_local2);
divideGroups(_local4, _local5);
level.removeChild(_local2.GetUserData());
};
}
public function listenMusicLink(_arg1:Event):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.tunecore.com/music/magicpen");
navigateToURL(_local2, "_blank");
}
public function fhelp_button(_arg1:Event){
var _local2:MovieClip;
if (Globals.gameState == Globals.GAME_PLAY){
Globals.lastGameState = Globals.gameState;
Globals.gameState = Globals.GAME_PAUSED;
_local2 = new inGameHelp();
stage.addChild(_local2);
customCursorOff();
};
}
public function customCursorOff(){
stage.removeChild(inGameUI);
stage.removeChild(inGameSuperUI);
stage.removeChild(cursorMC);
Mouse.show();
}
public function initializeLevel(_arg1:MWLevel){
var _local2:*;
var _local3:b2Vec2;
var _local4:int;
var _local5:MovieClip;
var _local6:int;
lastGroup = 0;
if (level){
removeListeners();
stage.removeChild(level);
level = null;
};
Globals.gamePaused = false;
Globals.pointerMode = Globals.CRAYON_MODE;
currentColorProperty = 0;
newBody = null;
newBodyPos = new Point();
level = _arg1;
if (level.i_bolita){
bola = level.i_bolita;
} else {
if (level.i_cajita){
bola = level.i_cajita;
};
};
bola.bodyDef.linearDamping = 0.05;
bola.bodyDef.angularDamping = 0.1;
bolaStart = new Point((bola.x / Globals.SCALE), (bola.y / Globals.SCALE));
drawing = false;
pushing = false;
firstPush = 0;
drawingCircle = false;
pinnedObjects = new Array();
stage.addChild(level);
_local2 = level.getRect(level);
_local3 = new b2Vec2(0, 8);
_local4 = 100;
level.createLevel(((1200 / Globals.SCALE) + _local4), ((-400 / Globals.SCALE) - _local4), ((920 / Globals.SCALE) + _local4), (-400 - _local4), _local3, true, Globals.SCALE, 10, (1 / 30));
if (Globals.currentLevel == 0){
inGameSuperUI.levelnum.visible = false;
} else {
inGameSuperUI.levelnum.visible = true;
};
inGameSuperUI.levelnum.textfield.textColor = 0;
inGameUI.main.help_button.transform.colorTransform = noTint;
inGameUI.main.music_button.transform.colorTransform = noTint;
inGameUI.main.selectLevel_button.transform.colorTransform = noTint;
inGameSuperUI.levelnum.textfield.text = (" " + Globals.currentLevel);
setUIVisibility();
_local6 = 0;
while (_local6 < level.numChildren) {
if ((level.getChildAt(_local6) is b2iBody)){
_local5 = MovieClip(level.getChildAt(_local6));
_local5.createBody();
};
_local6++;
};
_local6 = 0;
while (_local6 < level.numChildren) {
if ((level.getChildAt(_local6) is b2iJoint)){
_local5 = MovieClip(level.getChildAt(_local6));
_local5.createJoint();
};
_local6++;
};
bola.m_body.AllowSleeping(false);
estrellas = new Array();
estrellasOrigen = new Array();
posicionEstrellas = new Array();
puntosFigura = new Array();
perimeter = 0;
shapesUsed = 0;
secondsUsed = 0;
lastPoint = new Point(0, 0);
findStars();
stage.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_UP, handleKeyUp, false, 0, true);
addEventListener(Event.ENTER_FRAME, update, false, 0, true);
customCursorOn();
Globals.gameState = Globals.GAME_PLAY;
level.focusRect = false;
stage.focus = level;
i_fondo.gotoAndStop(level.getFondo());
level.m_world.SetBoundaryListener(new BoundaryListener());
Globals.destroyList = new Array();
contactListener = new MPContactListener();
contactListener.estrellitaContact = null;
level.m_world.SetContactListener(contactListener);
}
public function destroyOverlapping(){
var _local1:b2Body;
var _local2:Object;
for (_local2 in contactListener.overlappingBodies) {
_local1 = b2Body(_local2);
if (MWBody(_local1.m_userData).canDestroy){
destroyJoints(_local1);
};
};
}
public function drawLn(_arg1:Point, _arg2:Point, _arg3:BitmapData){
var _local4:BitmapData;
var _local5:Matrix;
var _local6:Number;
var _local7:Point;
var _local8:int;
var _local9:ColorTransform;
var _local10:Number;
var _local11:Number;
_local5 = new Matrix();
_local6 = Math.atan2((_arg2.y - _arg1.y), (_arg2.x - _arg1.x));
_local8 = 0;
_local9 = new ColorTransform();
_local9.color = colorProperties[currentColorProperty];
_local10 = (CRAYON_SPACE / Point.distance(_arg1, _arg2));
_local11 = 0;
while (_local11 <= 1) {
_local5.identity();
_local4 = crayonBrushes[_local8];
_local7 = Point.interpolate(_arg1, _arg2, _local11);
_local5.tx = _local7.x;
_local5.ty = _local7.y;
_arg3.draw(_local4, _local5, _local9);
_local11 = (_local11 + _local10);
_local8++;
_local8 = (_local8 % 4);
};
}
public function checkPinnedObjects(_arg1:MWBody){
var _local2:Array;
var _local3:Array;
var _local4:int;
_local3 = new Array();
_local4 = 0;
while (_local4 < pinnedObjects.length) {
if (((pinnedObjects[_local4].m_body) && (pinnedObjects[_local4].pin))){
if (checkPin(pinnedObjects[_local4], _arg1)){
pinnedObjects[_local4].pin = null;
} else {
_local3.push(pinnedObjects[_local4]);
};
};
_local4++;
};
pinnedObjects = _local3;
}
public function initSinCosTables(){
var _local1:int;
sinTable = new Array(CIRCLE_PRECISION);
cosTable = new Array(CIRCLE_PRECISION);
_local1 = 1;
while (_local1 <= CIRCLE_PRECISION) {
sinTable[(_local1 - 1)] = Math.sin(((_local1 * 360) / CIRCLE_PRECISION));
cosTable[(_local1 - 1)] = Math.cos(((_local1 * 360) / CIRCLE_PRECISION));
_local1++;
};
}
public function f2toggleQuality(_arg1:Event){
quality++;
if (quality > 3){
quality = 1;
};
switch (quality){
case 1:
stage.quality = StageQuality.HIGH;
bu_OQuality.gotoAndStop("high_over");
break;
case 2:
stage.quality = StageQuality.MEDIUM;
bu_OQuality.gotoAndStop("medium_over");
break;
case 3:
stage.quality = StageQuality.LOW;
bu_OQuality.gotoAndStop("low_over");
break;
};
}
public function handleWheel(_arg1:MouseEvent){
if (_arg1.delta > 0){
currentColorProperty--;
if (currentColorProperty < 0){
currentColorProperty = (colorProperties.length - 1);
};
} else {
if (_arg1.delta < 0){
currentColorProperty++;
if (currentColorProperty >= colorProperties.length){
currentColorProperty = 0;
};
};
};
}
public function removeListeners(){
stage.removeEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
stage.removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown);
stage.removeEventListener(KeyboardEvent.KEY_UP, handleKeyUp);
removeEventListener(Event.ENTER_FRAME, update);
}
public function f2MouseOverQualityButton(_arg1:Event){
switch (quality){
case 1:
bu_OQuality.gotoAndStop("high_over");
break;
case 2:
bu_OQuality.gotoAndStop("medium_over");
break;
case 3:
bu_OQuality.gotoAndStop("low_over");
break;
};
}
public function fTimerBackToMenu(_arg1:Event){
timerBackToMenu = null;
if (level){
customCursorOff();
removeListeners();
stage.removeChild(level);
level = null;
};
gotoAndStop("menu");
}
public function lastValidPoint(_arg1:Point, _arg2:Point):Point{
var _local3:Point;
var _local4:Point;
var _local5:Point;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Point;
var _local10:b2Body;
_local3 = new Point((_arg1.x + newBodyPos.x), (_arg1.y + newBodyPos.y));
_local4 = new Point((_arg2.x + newBodyPos.x), (_arg2.y + newBodyPos.y));
_local5 = null;
_local6 = (5 / Globals.SCALE);
_local7 = Math.min((1 / (Point.distance(_arg1, _arg2) / _local6)), 1);
_local8 = _local7;
while (_local8 <= 1) {
_local9 = Point.interpolate(_local4, _local3, _local8);
_local10 = getBodyAtPoint(_local9);
if (((((!((_local10 == null))) && (!(connectedToPinned(_local10))))) && (!(_local10.m_userData.drawable)))){
return (_local5);
};
if (_local10){
checkNearToPin(_local10);
};
_local5 = _local9;
_local8 = (_local8 + _local7);
};
return (_local4);
}
public function setUIVisibility(){
switch (uiSwitchState){
case UI_MAIN:
inGameUI.tips.visible = false;
inGameUI.main.visible = true;
break;
case UI_NONE:
inGameUI.tips.visible = false;
inGameUI.main.visible = false;
break;
case UI_ALL:
inGameUI.tips.visible = true;
inGameUI.main.visible = true;
break;
};
}
public function backToMenu(_arg1:Event){
gotoAndStop("menu");
}
public function findStars(){
var _local1:MovieClip;
var _local2:int;
_local2 = 0;
while (_local2 < level.numChildren) {
if ((((level.getChildAt(_local2) is Estrellita)) || ((level.getChildAt(_local2) is EstrellitaObj)))){
_local1 = MovieClip(level.getChildAt(_local2));
estrellas.push(_local1);
estrellasOrigen.push(_local1);
posicionEstrellas.push([new b2Vec2((_local1.x / Globals.SCALE), (_local1.y / Globals.SCALE)), (_local1.rotation * 0.017453293)]);
};
_local2++;
};
}
public function f2toggleTutorial(_arg1:Event){
var _local2:MovieClip;
_local2 = new inGameHelp();
stage.addChild(_local2);
}
public function customCursorOn(){
stage.addChild(inGameUI);
stage.addChild(inGameSuperUI);
stage.addChild(cursorMC);
Mouse.hide();
}
public function fMouseOverMusicButton(_arg1:Event){
if (Globals.soundChannel){
inGameUI.main.music_button.gotoAndStop("on_over");
} else {
inGameUI.main.music_button.gotoAndStop("off_over");
};
}
public function getLastBodyAtPoint(_arg1:Point):b2Body{
var _local2:b2AABB;
var _local3:b2Vec2;
var _local4:int;
var _local5:Array;
var _local6:int;
var _local7:b2Body;
var _local8:uint;
var _local9:int;
var _local10:Boolean;
_local2 = new b2AABB();
_local2.lowerBound.Set((_arg1.x - 0.0005), (_arg1.y - 0.0005));
_local2.upperBound.Set((_arg1.x + 0.0005), (_arg1.y + 0.0005));
_local3 = new b2Vec2(_arg1.x, _arg1.y);
_local4 = 10;
_local5 = new Array();
_local6 = level.m_world.Query(_local2, _local5, _local4);
_local7 = null;
_local8 = 0;
_local9 = 0;
while (_local9 < _local6) {
_local10 = _local5[_local9].TestPoint(_local5[_local9].GetBody().GetXForm(), _local3);
if (_local10){
if (_local5[_local9].m_body.m_userData.id > _local8){
_local8 = _local5[_local9].m_body.m_userData.id;
_local7 = _local5[_local9].m_body;
};
};
_local9++;
};
return (_local7);
}
public function fMouseOffMusicButton(_arg1:Event){
if (Globals.soundChannel){
inGameUI.main.music_button.gotoAndStop("on");
} else {
inGameUI.main.music_button.gotoAndStop("off");
};
}
public function endDrawing(_arg1:Boolean=true){
var _local2:b2BodyDef;
var _local3:MWBody;
var _local4:b2CircleDef;
var _local5:Array;
var _local6:Array;
var _local7:b2PolygonDef;
var _local8:int;
var _local9:b2BodyDef;
var _local10:MWBody;
drawing = false;
inGameSuperUI.ui_barra.visible = false;
circleTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, startCircle);
circleTimer = null;
if (level.m_world.m_bodyCount < 200){
if (drawingCircle){
_local2 = new b2BodyDef();
_local2.position = new b2Vec2(newBodyPos.x, newBodyPos.y);
_local2.linearDamping = LINEAR_DAMPING;
_local2.angularDamping = ANGULAR_DAMPING;
_local3 = new MWBody();
_local3.m_body = level.m_world.CreateBody(_local2);
_local3.m_body.m_userData = _local3;
_local4 = new b2CircleDef();
_local4.radius = circleRadius;
_local4.density = DRAWING_DENSITY;
_local4.friction = DRAWING_FRICTION;
_local4.restitution = DRAWING_RESTITUTION;
_local4.isSensor = false;
_local4.filter.groupIndex = 0;
_local4.filter.categoryBits = 1;
_local4.filter.maskBits = 0xFFFF;
_local3.m_body.CreateShape(_local4);
_local3.m_body.SetMassFromShapes();
_local3.x = newBody.x;
_local3.y = newBody.y;
drawCircle(_local3, (circleRadius * Globals.SCALE));
level.addChild(_local3);
level.m_world.Step(0, 1);
checkPinnedObjects(_local3);
shapesUsed++;
} else {
if ((((puntosFigura.length > 1)) && (_arg1))){
agregarHingesAFigura();
if (puntosFigura.length == 2){
_local5 = makeLine(puntosFigura[0], puntosFigura[1]);
} else {
_local5 = convexHull(puntosFigura);
_local6 = revisarLinea(_local5);
if (_local6){
_local5 = _local6;
};
};
if (_local5){
_local7 = new b2PolygonDef();
_local7.vertexCount = _local5.length;
_local8 = 0;
while (_local8 < _local5.length) {
_local7.vertices[_local8].Set(_local5[_local8].x, _local5[_local8].y);
_local8++;
};
_local7.density = DRAWING_DENSITY;
_local7.friction = DRAWING_FRICTION;
_local7.restitution = DRAWING_RESTITUTION;
_local7.isSensor = false;
_local7.filter.groupIndex = 0;
_local7.filter.categoryBits = 1;
_local7.filter.maskBits = 0xFFFF;
_local9 = new b2BodyDef();
_local9.linearDamping = LINEAR_DAMPING;
_local9.angularDamping = ANGULAR_DAMPING;
_local9.position = new b2Vec2(newBodyPos.x, newBodyPos.y);
_local10 = new MWBody();
_local10.m_body = level.m_world.CreateBody(_local9);
_local10.m_body.m_userData = _local10;
_local10.x = newBody.x;
_local10.y = newBody.y;
_local10.m_body.CreateShape(_local7);
_local10.m_body.SetMassFromShapes();
drawPolygon(_local10, _local5);
level.addChild(_local10);
level.m_world.Step(0, 1);
checkPinnedObjects(_local10);
shapesUsed++;
};
};
};
};
}
public function convexHull(_arg1:Array){
var _local2:Array;
var _local3:Point;
for each (_local3 in _arg1) {
_local3.x = (_local3.x * Globals.SCALE);
_local3.y = (_local3.y * Globals.SCALE);
};
_local2 = ConvexHull.grahamScan2D(_arg1).reverse();
for each (_local3 in _local2) {
_local3.x = (_local3.x / Globals.SCALE);
_local3.y = (_local3.y / Globals.SCALE);
};
while (_local2.length > 64) {
_local2.pop();
};
return (_local2);
}
public function fingame_levelSelect(_arg1:Event){
var _local2:InGameLevelSelect;
if (Globals.gameState == Globals.GAME_PLAY){
Globals.lastGameState = Globals.gameState;
Globals.gameState = Globals.GAME_PAUSED;
_local2 = new InGameLevelSelect();
stage.addChild(_local2);
customCursorOff();
};
}
public function polyMin(_arg1:Array):Point{
var _local2:Number;
var _local3:Number;
var _local4:Point;
_local2 = 0;
_local3 = 0;
for each (_local4 in _arg1) {
_local2 = Math.min(_local2, _local4.x);
_local3 = Math.min(_local3, _local4.y);
};
return (new Point((_local2 * Globals.SCALE), (_local3 * Globals.SCALE)));
}
public function makeLine(_arg1:Point, _arg2:Point):Array{
var _local3:Array;
if ((((_arg1.x < _arg2.x)) || ((((_arg1.x == _arg2.x)) && ((_arg1.y < _arg2.y)))))){
_local3 = makeLine2(_arg1, _arg2);
} else {
_local3 = makeLine2(_arg2, _arg1);
};
return (_local3);
}
public function handleMouseUp(_arg1:MouseEvent){
if (pushing){
pushing = false;
};
if (drawing){
endDrawing();
};
}
public function ftoggleMusic(_arg1:Event){
if (Globals.soundChannel){
Globals.stopMusic();
inGameUI.main.music_button.gotoAndStop("off");
} else {
Globals.startMusic();
inGameUI.main.music_button.gotoAndStop("on");
};
}
public function bubbleboxLogoLink(_arg1:Event){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1285&subid=logo");
navigateToURL(_local2);
}
public function f2toggleMusic(_arg1:Event){
if (Globals.soundChannel){
Globals.stopMusic();
bu_OMusic.gotoAndStop("off");
} else {
Globals.startMusic();
bu_OMusic.gotoAndStop("on");
};
}
public function removeUIListeners(){
inGameUI.main.help_button.removeEventListener(MouseEvent.CLICK, fhelp_button);
inGameUI.main.music_button.removeEventListener(MouseEvent.CLICK, ftoggleMusic);
inGameUI.main.music_button.removeEventListener(MouseEvent.MOUSE_OVER, fMouseOverMusicButton);
inGameUI.main.music_button.removeEventListener(MouseEvent.MOUSE_OUT, fMouseOffMusicButton);
inGameUI.main.selectLevel_button.removeEventListener(MouseEvent.CLICK, fingame_levelSelect);
inGameSuperUI.uiSwitch_button.removeEventListener(MouseEvent.CLICK, fuiSwitch);
}
public function updateScoreField(_arg1:MouseEvent){
var _local2:int;
var _local3:int;
_local2 = (int(_arg1.currentTarget.levelname.text) - 1);
_local3 = Globals.savedData.data.levelScores[_local2];
if (_local3 > 0){
level_score_tf.text = ("" + _local3);
} else {
level_score_tf.text = "0";
};
}
public function checkEstrellas(){
colisionEstrella();
if (estrellas.length == 0){
Globals.gameState = Globals.GAME_LEVELCOMPLETE;
endTimer = new Timer(1000, 1);
endTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endLevel, false, 0, true);
endTimer.start();
};
}
public function listenCrayonLink(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.crayonphysics.com/");
navigateToURL(_local2, "_blank");
}
public function drawCircle(_arg1:MovieClip, _arg2:Number){
var _local3:BitmapData;
var _local4:BitmapData;
var _local5:int;
var _local6:Number;
var _local7:Matrix;
var _local8:Number;
var _local9:ColorTransform;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Bitmap;
removeFigura(_arg1);
_local3 = new BitmapData(((_arg2 * 2) + 10), ((_arg2 * 2) + 10), true, 0);
_local5 = 0;
_local6 = 0;
_local7 = new Matrix();
_local8 = ((2 * CRAYON_SPACE) / (Math.PI * _arg2));
_local9 = new ColorTransform();
_local9.color = colorProperties[currentColorProperty];
_local12 = (Math.PI / 2);
while (_local6 < _local12) {
_local4 = crayonBrushes[_local5];
_local10 = (Math.cos(_local6) * _arg2);
_local11 = (Math.sin(_local6) * _arg2);
_local7.tx = (_local10 + _arg2);
_local7.ty = (_local11 + _arg2);
_local3.draw(_local4, _local7, _local9);
_local7.tx = (-(_local10) + _arg2);
_local3.draw(_local4, _local7, _local9);
_local7.ty = (-(_local11) + _arg2);
_local3.draw(_local4, _local7, _local9);
_local7.tx = (_local10 + _arg2);
_local3.draw(_local4, _local7, _local9);
_local5++;
_local5 = (_local5 % 4);
_local6 = (_local6 + _local8);
};
_local13 = new Bitmap(_local3, "never", true);
_local13.x = (-(_arg2) - 3);
_local13.y = (-(_arg2) - 3);
_arg1.figura = _local13;
_arg1.addChild(_local13);
}
public function drawLine(){
var _local1:Point;
var _local2:Number;
var _local3:Number;
var _local4:Point;
var _local5:Point;
if (drawingCircle){
if (circleRadius < MAX_CIRCLE_RADIUS){
circleRadius = (circleRadius + CIRCLE_AUGMENT);
drawCircle(newBody, (circleRadius * Globals.SCALE));
inGameSuperUI.ui_maskbarra.scaleX = (1 - (circleRadius / MAX_CIRCLE_RADIUS));
if (checkCircleBounds(newBodyPos.x, newBodyPos.y, circleRadius)){
endDrawing();
};
} else {
endDrawing();
};
} else {
_local1 = new Point((cursor.x - newBodyPos.x), (cursor.y - newBodyPos.y));
_local1 = lastValidPoint(lastPoint, _local1);
if (_local1 != null){
_local1.x = (_local1.x - newBodyPos.x);
_local1.y = (_local1.y - newBodyPos.y);
_local2 = Point.distance(lastPoint, _local1);
_local3 = Point.distance(_local1, new Point(0, 0));
if ((((_local3 < CLOSE_DISTANCE)) && ((perimeter > MIN_PERIMETER)))){
_local4 = new Point(((lastPoint.x * Globals.SCALE) + newBody.x), ((lastPoint.y * Globals.SCALE) + newBody.y));
_local5 = new Point(newBody.x, newBody.y);
drawLn(_local4, _local5, newBody.figura.bitmapData);
endDrawing();
} else {
if (_local2 > MIN_DISTANCE){
_local4 = new Point(((lastPoint.x * Globals.SCALE) + newBody.x), ((lastPoint.y * Globals.SCALE) + newBody.y));
_local5 = new Point(((_local1.x * Globals.SCALE) + newBody.x), ((_local1.y * Globals.SCALE) + newBody.y));
drawLn(_local4, _local5, newBody.figura.bitmapData);
perimeter = (perimeter + _local2);
puntosFigura.push(_local1);
lastPoint.x = _local1.x;
lastPoint.y = _local1.y;
};
};
inGameSuperUI.ui_maskbarra.scaleX = (1 - (perimeter / MAX_PERIMETER));
if (perimeter > MAX_PERIMETER){
endDrawing(false);
};
};
};
}
public function connectedToPinned2(_arg1:b2Body, _arg2:Array):Boolean{
var _local3:b2JointEdge;
_arg2.push(_arg1);
if (_arg1.m_userData.canPin){
_local3 = _arg1.GetJointList();
while (_local3 != null) {
if (_arg2.indexOf(_local3.other) == -1){
if (_local3.other.GetUserData().pin){
return (true);
};
if (connectedToPinned2(_local3.other, _arg2)){
return (true);
};
};
_local3 = _local3.next;
};
};
return (false);
}
public function checkPin(_arg1:MWBody, _arg2:MWBody):Boolean{
var _local3:Pin;
var _local4:Point;
var _local5:Point;
_local3 = _arg1.pin;
_local4 = _local3.localToGlobal(new Point(0, 0));
_local5 = new Point();
_local5.x = (_local4.x / Globals.SCALE);
_local5.y = (_local4.y / Globals.SCALE);
if (pointInsideBody(_local5, _arg2.m_body)){
level.addChild(_local3);
_local3.x = _local4.x;
_local3.y = _local4.y;
b2RevoluteJointDef(_local3.jd).Initialize(_arg1.m_body, _arg2.m_body, new b2Vec2(_local5.x, _local5.y));
_local3.m_joint = b2RevoluteJoint(level.m_world.CreateJoint(_local3.jd));
mergeGroups(_local3.m_joint.GetBody1(), _local3.m_joint.GetBody2());
if (!_local3.m_joint){
level.removeChild(_local3);
} else {
_local3.m_joint.m_userData = _local3;
_local3.nextFrame();
};
return (true);
};
return (false);
}
public function drawPolygon(_arg1:MovieClip, _arg2:Array){
var _local3:Point;
var _local4:Point;
var _local5:Point;
var _local6:Point;
var _local7:BitmapData;
var _local8:int;
var _local9:int;
var _local10:Bitmap;
removeFigura(_arg1);
_local3 = polyMin(_arg2);
_local4 = adjustPoly(_local3, _arg2);
_local5 = new Point();
_local6 = new Point();
_local7 = new BitmapData((_local4.x + 10), (_local4.y + 10), true, 0);
_local8 = _arg2.length;
_local9 = 0;
while (_local9 < (_local8 - 1)) {
_local5.x = _arg2[_local9].x;
_local5.y = _arg2[_local9].y;
_local6.x = _arg2[(_local9 + 1)].x;
_local6.y = _arg2[(_local9 + 1)].y;
drawLn(_local5, _local6, _local7);
_local9++;
};
_local5.x = _arg2[(_local8 - 1)].x;
_local5.y = _arg2[(_local8 - 1)].y;
_local6.x = _arg2[0].x;
_local6.y = _arg2[0].y;
drawLn(_local5, _local6, _local7);
_local10 = new Bitmap(_local7, "never", true);
new Bitmap(_local7, "never", true).x = (_local10.x + (_local3.x - 3));
_local10.y = (_local10.y + (_local3.y - 3));
_arg1.figura = _local10;
_arg1.addChild(_local10);
}
public function foptions(_arg1:Event){
gotoAndStop("options");
}
public function setCursorLabel(_arg1:String){
if (cursorMC.currentLabel != _arg1){
cursorMC.gotoAndStop(_arg1);
};
}
public function angleDiff(_arg1:Number, _arg2:Number){
var _local3:Number;
_local3 = (_arg1 - _arg2);
if (_local3 > 180){
_local3 = (_local3 - 360);
} else {
if (_local3 < -180){
_local3 = (_local3 + 360);
};
};
return (_local3);
}
public function endLevel(_arg1:Event){
var _local2:int;
var _local3:Array;
var _local4:ScoreScreen;
var _local5:int;
var _local6:int;
endTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, endLevel);
_local2 = (Math.max((4900 - ((shapesUsed * 50) + Math.floor(secondsUsed))), 0) + 100);
_local3 = Globals.savedData.data.levelScores;
if ((((_local3[(Globals.currentLevel - 1)] == -1)) || ((_local2 > _local3[(Globals.currentLevel - 1)])))){
_local3[(Globals.currentLevel - 1)] = _local2;
};
_local4 = new ScoreScreen();
Globals.lastGameState = Globals.gameState;
Globals.gameState = Globals.GAME_PAUSED;
_local5 = 0;
for each (_local6 in _local3) {
if (_local6 > 0){
_local5 = (_local5 + _local6);
};
};
stage.addChild(_local4);
if (_local5 > Globals.savedData.data.bestScoreSent){
Globals.savedData.data.bestScore = _local5;
_local4.bsendScore.visible = true;
} else {
_local4.bsendScore.visible = false;
};
_local4.name_f.text = ("" + Globals.savedData.data.player_name);
_local4.numshapes.text = ("" + shapesUsed);
_local4.time.text = (("" + Math.floor(secondsUsed)) + " secs");
_local4.levelScore.text = ("" + _local2);
_local4.totalScore.text = ("" + _local5);
customCursorOff();
}
public function updatePush(){
if (firstPush > 1){
firstPush--;
};
}
public function f2MouseOverMusicButton(_arg1:Event){
if (Globals.soundChannel){
bu_OMusic.gotoAndStop("on_over");
} else {
bu_OMusic.gotoAndStop("off_over");
};
}
public function revisarLinea(_arg1:Array):Array{
var _local2:Boolean;
var _local3:int;
var _local4:Point;
var _local5:Point;
var _local6:Point;
var _local7:Point;
var _local8:Point;
var _local9:Point;
var _local10:Point;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Array;
if (connectedPinned.length > 0){
return (null);
};
_local2 = true;
_local3 = 0;
_local4 = new Point(0, 0);
_local5 = _local4;
_local6 = _local4;
_local7 = _local4;
_local8 = _local4;
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _arg1[_local3];
if (_local4.x < _local5.x){
_local5 = _local4;
} else {
if (_local4.x > _local6.x){
_local6 = _local4;
};
};
if (_local4.y < _local7.y){
_local7 = _local4;
} else {
if (_local4.y > _local8.y){
_local8 = _local4;
};
};
_local3++;
};
if (Point.distance(_local5, _local6) > Point.distance(_local7, _local8)){
_local9 = _local5;
_local10 = _local6;
} else {
if (_local7.x <= _local8.x){
_local9 = _local7;
_local10 = _local8;
} else {
_local9 = _local8;
_local10 = _local7;
};
};
_local11 = calcularAngulo(_local9, _local10);
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _arg1[_local3];
_local12 = angleDiff(_local11, calcularAngulo(_local9, _local4));
_local13 = Point.distance(_local9, _local4);
_local14 = Math.abs((Math.sin(_local12) * _local13));
if (_local14 > MIN_DIST_TO_LINE){
_local2 = false;
break;
};
_local3++;
};
_local15 = null;
if (_local2){
_local15 = makeLine2(_local9, _local10);
};
return (_local15);
}
public function startGame(_arg1:Event){
gotoAndStop("startGame");
}
public function divideGroups(_arg1:b2Body, _arg2:b2Body):void{
var _local3:int;
var _local4:Array;
_local3 = getNextGroup();
_local4 = [];
propagateGroup(_arg2, _local3, _local4);
}
public function agregarHingesAFigura():void{
var _local1:b2Body;
var _local2:Point;
var _local3:Point;
var _local4:Point;
var _local5:Point;
var _local6:Point;
for each (_local1 in connectedPinned) {
_local2 = _local1.m_userData.pin.localToGlobal(new Point(0, 0));
_local2.x = ((_local2.x / Globals.SCALE) - newBodyPos.x);
_local2.y = ((_local2.y / Globals.SCALE) - newBodyPos.y);
_local3 = new Point((_local2.x + PIN_RANGE), (_local2.y + PIN_RANGE));
_local4 = new Point((_local2.x + PIN_RANGE), (_local2.y - PIN_RANGE));
_local5 = new Point((_local2.x - PIN_RANGE), (_local2.y - PIN_RANGE));
_local6 = new Point((_local2.x - PIN_RANGE), (_local2.y + PIN_RANGE));
puntosFigura.push(_local3);
puntosFigura.push(_local4);
puntosFigura.push(_local5);
puntosFigura.push(_local6);
};
}
public function fgotopreloader(_arg1:Event){
logoTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, fgotopreloader);
play();
}
public function startCircle(_arg1:Event){
if (((drawing) && ((puntosFigura.length == 1)))){
if (!checkCircleBounds(newBodyPos.x, newBodyPos.y, circleRadius)){
drawingCircle = true;
};
};
}
public function listenInputNext(_arg1:Event){
var _local2:String;
_local2 = StringUtils.removeExtraWhitespace(input_name.text);
if (_local2.length > 0){
Globals.savedData.data.player_name = _local2;
removeListenersInputName();
Globals.savedData.flush();
gotoAndStop("instructions");
};
}
public function calcularAngulo(_arg1:Point, _arg2:Point):Number{
return (Math.atan2((_arg2.y - _arg1.y), (_arg2.x - _arg1.x)));
}
public function pickLevel(_arg1:int):MWLevel{
var _local2:int;
var _local3:MWLevel;
_local2 = (_arg1 * 2);
_local3 = new (Globals.levels[_local2]);
_local3.setFondo(Globals.levels[(_local2 + 1)]);
return (_local3);
}
public function getBodyAtPoint(_arg1:Point):b2Body{
var _local2:b2AABB;
var _local3:b2Vec2;
var _local4:int;
var _local5:Array;
var _local6:int;
var _local7:b2Body;
var _local8:int;
var _local9:Boolean;
_local2 = new b2AABB();
_local2.lowerBound.Set((_arg1.x - 0.001), (_arg1.y - 0.001));
_local2.upperBound.Set((_arg1.x + 0.001), (_arg1.y + 0.001));
_local3 = new b2Vec2(_arg1.x, _arg1.y);
_local4 = 10;
_local5 = new Array();
_local6 = level.m_world.Query(_local2, _local5, _local4);
_local7 = null;
_local8 = 0;
while (_local8 < _local6) {
_local9 = _local5[_local8].TestPoint(_local5[_local8].GetBody().GetXForm(), _local3);
if (_local9){
_local7 = _local5[_local8].m_body;
break;
};
_local8++;
};
return (_local7);
}
public function name_listener(_arg1:TextEvent){
var _local2:String;
_local2 = StringUtils.removeExtraWhitespace(input_name.text);
input_name.replaceText(0, input_name.length, _local2);
stage.focus = input_name;
}
public function selectLevel(_arg1:MouseEvent){
var _local2:int;
_local2 = int(_arg1.currentTarget.levelname.text);
Globals.currentLevel = _local2;
clearLS();
gotoAndStop("startGame");
}
}
}//package MP2_fla
Section 110
//MusicButton_158 (MP2_fla.MusicButton_158)
package MP2_fla {
import flash.display.*;
public dynamic class MusicButton_158 extends MovieClip {
public function MusicButton_158(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame2(){
stop();
}
}
}//package MP2_fla
Section 111
//OptionsMusic_205 (MP2_fla.OptionsMusic_205)
package MP2_fla {
import flash.display.*;
public dynamic class OptionsMusic_205 extends MovieClip {
public function OptionsMusic_205(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame2(){
stop();
}
}
}//package MP2_fla
Section 112
//OptionsQuality_207 (MP2_fla.OptionsQuality_207)
package MP2_fla {
import flash.display.*;
public dynamic class OptionsQuality_207 extends MovieClip {
public function OptionsQuality_207(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package MP2_fla
Section 113
//OptionsTutorial_206 (MP2_fla.OptionsTutorial_206)
package MP2_fla {
import flash.display.*;
public dynamic class OptionsTutorial_206 extends MovieClip {
public function OptionsTutorial_206(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package MP2_fla
Section 114
//ORLogo_1 (MP2_fla.ORLogo_1)
package MP2_fla {
import flash.display.*;
import flash.media.*;
public dynamic class ORLogo_1 extends MovieClip {
public var glass:Sound;
public function ORLogo_1(){
addFrameScript(0, frame1, 59, frame60);
}
function frame1(){
glass = new GlassSound();
glass.play();
}
function frame60(){
stop();
}
}
}//package MP2_fla
Section 115
//Puffy_199 (MP2_fla.Puffy_199)
package MP2_fla {
import flash.display.*;
public dynamic class Puffy_199 extends MovieClip {
public function Puffy_199(){
addFrameScript(17, frame18);
}
function frame18(){
stop();
}
}
}//package MP2_fla
Section 116
//PushCursor_139 (MP2_fla.PushCursor_139)
package MP2_fla {
import flash.display.*;
public dynamic class PushCursor_139 extends MovieClip {
public function PushCursor_139(){
addFrameScript(19, frame20);
}
function frame20(){
gotoAndPlay(0);
}
}
}//package MP2_fla
Section 117
//SendScore_163 (MP2_fla.SendScore_163)
package MP2_fla {
import flash.display.*;
public dynamic class SendScore_163 extends MovieClip {
public function SendScore_163(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package MP2_fla
Section 118
//Shard1_12 (MP2_fla.Shard1_12)
package MP2_fla {
import flash.display.*;
public dynamic class Shard1_12 extends MovieClip {
public function Shard1_12(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package MP2_fla
Section 119
//Shard2_13 (MP2_fla.Shard2_13)
package MP2_fla {
import flash.display.*;
public dynamic class Shard2_13 extends MovieClip {
public function Shard2_13(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package MP2_fla
Section 120
//Shard3_14 (MP2_fla.Shard3_14)
package MP2_fla {
import flash.display.*;
public dynamic class Shard3_14 extends MovieClip {
public function Shard3_14(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package MP2_fla
Section 121
//Shard4_15 (MP2_fla.Shard4_15)
package MP2_fla {
import flash.display.*;
public dynamic class Shard4_15 extends MovieClip {
public function Shard4_15(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package MP2_fla
Section 122
//Shard5_16 (MP2_fla.Shard5_16)
package MP2_fla {
import flash.display.*;
public dynamic class Shard5_16 extends MovieClip {
public function Shard5_16(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package MP2_fla
Section 123
//StarPuffy_142 (MP2_fla.StarPuffy_142)
package MP2_fla {
import flash.display.*;
public dynamic class StarPuffy_142 extends MovieClip {
public function StarPuffy_142(){
addFrameScript(15, frame16);
}
function frame16(){
stop();
}
}
}//package MP2_fla
Section 124
//Subrayar_145 (MP2_fla.Subrayar_145)
package MP2_fla {
import flash.display.*;
public dynamic class Subrayar_145 extends MovieClip {
public function Subrayar_145(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package MP2_fla
Section 125
//tips_148 (MP2_fla.tips_148)
package MP2_fla {
import flash.display.*;
public dynamic class tips_148 extends MovieClip {
public var b_d:SimpleButton;
public var b_a:SimpleButton;
public var b_s:SimpleButton;
public var b_space:SimpleButton;
}
}//package MP2_fla
Section 126
//Tutorial_182 (MP2_fla.Tutorial_182)
package MP2_fla {
import flash.display.*;
import flash.events.*;
public dynamic class Tutorial_182 extends MovieClip {
public var frame:int;
public var flechaNoNext:MovieClip;
public var tutnext:SimpleButton;
public var flechaNoBack:MovieClip;
public var tutback:SimpleButton;
public function Tutorial_182(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11);
}
function frame10(){
stop();
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame1(){
frame = 2;
tutnext.addEventListener(MouseEvent.CLICK, gonext, false, 0, true);
tutback.addEventListener(MouseEvent.CLICK, goback, false, 0, true);
checkNextBack();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame9(){
stop();
}
function frame8(){
stop();
}
function frame2(){
stop();
}
function frame11(){
stop();
}
public function checkNextBack(){
tutnext.visible = true;
tutback.visible = true;
flechaNoNext.visible = false;
flechaNoBack.visible = false;
if (frame == 2){
tutback.visible = false;
flechaNoBack.visible = true;
} else {
if (frame == totalFrames){
tutnext.visible = false;
flechaNoNext.visible = true;
};
};
}
public function goback(_arg1:Event){
if (frame > 2){
prevFrame();
};
frame--;
checkNextBack();
}
public function gonext(_arg1:Event){
if (frame < totalFrames){
nextFrame();
};
frame++;
checkNextBack();
}
}
}//package MP2_fla
Section 127
//Vientote_138 (MP2_fla.Vientote_138)
package MP2_fla {
import flash.display.*;
public dynamic class Vientote_138 extends MovieClip {
public function Vientote_138(){
addFrameScript(17, frame18);
}
function frame18(){
gotoAndPlay(0);
}
}
}//package MP2_fla
Section 128
//WindowBreak_11 (MP2_fla.WindowBreak_11)
package MP2_fla {
import flash.display.*;
public dynamic class WindowBreak_11 extends MovieClip {
public function WindowBreak_11(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package MP2_fla
Section 129
//StringUtils (MyUtils.StringUtils)
package MyUtils {
public class StringUtils {
private static function _swapCase(_arg1:String, ... _args):String{
var _local3:String;
var _local4:String;
_local3 = _arg1.toLowerCase();
_local4 = _arg1.toUpperCase();
switch (_arg1){
case _local3:
return (_local4);
case _local4:
return (_local3);
default:
return (_arg1);
};
}
public static function isEmpty(_arg1:String):Boolean{
if (_arg1 == null){
return (true);
};
return (!(_arg1.length));
}
public static function remove(_arg1:String, _arg2:String, _arg3:Boolean=true):String{
var _local4:String;
var _local5:String;
if (_arg1 == null){
return ("");
};
_local4 = escapePattern(_arg2);
_local5 = (_arg3) ? "g" : "ig";
return (_arg1.replace(new RegExp(_local4, _local5), ""));
}
public static function countOf(_arg1:String, _arg2:String, _arg3:Boolean=true):uint{
var _local4:String;
var _local5:String;
if (_arg1 == null){
return (0);
};
_local4 = escapePattern(_arg2);
_local5 = (_arg3) ? "g" : "ig";
return (_arg1.match(new RegExp(_local4, _local5)).length);
}
public static function between(_arg1:String, _arg2:String, _arg3:String):String{
var _local4:String;
var _local5:int;
var _local6:int;
_local4 = "";
if (_arg1 == null){
return (_local4);
};
_local5 = _arg1.indexOf(_arg2);
if (_local5 != -1){
_local5 = (_local5 + _arg2.length);
_local6 = _arg1.indexOf(_arg3, _local5);
if (_local6 != -1){
_local4 = _arg1.substr(_local5, (_local6 - _local5));
};
};
return (_local4);
}
public static function padRight(_arg1:String, _arg2:String, _arg3:uint):String{
var _local4:String;
_local4 = _arg1;
while (_local4.length < _arg3) {
_local4 = (_local4 + _arg2);
};
return (_local4);
}
public static function isNumeric(_arg1:String):Boolean{
var _local2:RegExp;
if (_arg1 == null){
return (false);
};
_local2 = /^[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$/;
return (_local2.test(_arg1));
}
public static function block(_arg1:String, _arg2:uint, _arg3:String="."):Array{
var _local4:Array;
var _local5:uint;
var _local6:uint;
var _local7:RegExp;
var _local8:String;
_local4 = new Array();
if ((((_arg1 == null)) || (!(contains(_arg1, _arg3))))){
return (_local4);
};
_local5 = 0;
_local6 = _arg1.length;
_local7 = new RegExp((("[^" + escapePattern(_arg3)) + "]+$"));
while (_local5 < _local6) {
_local8 = _arg1.substr(_local5, _arg2);
if (!contains(_local8, _arg3)){
_local4.push(truncate(_local8, _local8.length));
_local5 = (_local5 + _local8.length);
};
_local8 = _local8.replace(_local7, "");
_local4.push(_local8);
_local5 = (_local5 + _local8.length);
};
return (_local4);
}
public static function trim(_arg1:String):String{
if (_arg1 == null){
return ("");
};
return (_arg1.replace(/^\s+|\s+$/g, ""));
}
public static function beginsWith(_arg1:String, _arg2:String):Boolean{
if (_arg1 == null){
return (false);
};
return ((_arg1.indexOf(_arg2) == 0));
}
public static function stripTags(_arg1:String):String{
if (_arg1 == null){
return ("");
};
return (_arg1.replace(/<\/?[^>]+>/igm, ""));
}
public static function afterLast(_arg1:String, _arg2:String):String{
var _local3:int;
if (_arg1 == null){
return ("");
};
_local3 = _arg1.lastIndexOf(_arg2);
if (_local3 == -1){
return ("");
};
_local3 = (_local3 + _arg2.length);
return (_arg1.substr(_local3));
}
private static function _minimum(_arg1:uint, _arg2:uint, _arg3:uint):uint{
return (Math.min(_arg1, Math.min(_arg2, Math.min(_arg3, _arg1))));
}
private static function escapePattern(_arg1:String):String{
return (_arg1.replace(/(\]|\[|\{|\}|\(|\)|\*|\+|\?|\.|\\)/g, "\\$1"));
}
public static function removeExtraWhitespace(_arg1:String):String{
var _local2:String;
if (_arg1 == null){
return ("");
};
_local2 = trim(_arg1);
return (_local2.replace(/\s+/g, " "));
}
public static function trimRight(_arg1:String):String{
if (_arg1 == null){
return ("");
};
return (_arg1.replace(/\s+$/, ""));
}
public static function endsWith(_arg1:String, _arg2:String):Boolean{
return ((_arg1.lastIndexOf(_arg2) == (_arg1.length - _arg2.length)));
}
public static function contains(_arg1:String, _arg2:String):Boolean{
if (_arg1 == null){
return (false);
};
return (!((_arg1.indexOf(_arg2) == -1)));
}
public static function properCase(_arg1:String):String{
var _local2:String;
if (_arg1 == null){
return ("");
};
_local2 = _arg1.toLowerCase().replace(/\b([^.?;!]+)/, capitalize);
return (_local2.replace(/\b[i]\b/, "I"));
}
public static function trimLeft(_arg1:String):String{
if (_arg1 == null){
return ("");
};
return (_arg1.replace(/^\s+/, ""));
}
public static function similarity(_arg1:String, _arg2:String):Number{
var _local3:uint;
var _local4:uint;
_local3 = editDistance(_arg1, _arg2);
_local4 = Math.max(_arg1.length, _arg2.length);
if (_local4 == 0){
return (100);
};
return (((1 - (_local3 / _local4)) * 100));
}
public static function wordCount(_arg1:String):uint{
if (_arg1 == null){
return (0);
};
return (_arg1.match(/\b\w+\b/g).length);
}
public static function editDistance(_arg1:String, _arg2:String):uint{
var _local3:uint;
var _local4:Array;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:String;
var _local10:String;
if (_arg1 == null){
_arg1 = "";
};
if (_arg2 == null){
_arg2 = "";
};
if (_arg1 == _arg2){
return (0);
};
_local4 = new Array();
_local6 = _arg1.length;
_local7 = _arg2.length;
if (_local6 == 0){
return (_local7);
};
if (_local7 == 0){
return (_local6);
};
_local3 = 0;
while (_local3 <= _local6) {
_local4[_local3] = new Array();
_local3++;
};
_local3 = 0;
while (_local3 <= _local6) {
_local4[_local3][0] = _local3;
_local3++;
};
_local8 = 0;
while (_local8 <= _local7) {
_local4[0][_local8] = _local8;
_local8++;
};
_local3 = 1;
while (_local3 <= _local6) {
_local9 = _arg1.charAt((_local3 - 1));
_local8 = 1;
while (_local8 <= _local7) {
_local10 = _arg2.charAt((_local8 - 1));
if (_local9 == _local10){
_local5 = 0;
} else {
_local5 = 1;
};
_local4[_local3][_local8] = _minimum((_local4[(_local3 - 1)][_local8] + 1), (_local4[_local3][(_local8 - 1)] + 1), (_local4[(_local3 - 1)][(_local8 - 1)] + _local5));
_local8++;
};
_local3++;
};
return (_local4[_local6][_local7]);
}
public static function hasText(_arg1:String):Boolean{
var _local2:String;
_local2 = removeExtraWhitespace(_arg1);
return (!(!(_local2.length)));
}
public static function reverse(_arg1:String):String{
if (_arg1 == null){
return ("");
};
return (_arg1.split("").reverse().join(""));
}
public static function swapCase(_arg1:String):String{
if (_arg1 == null){
return ("");
};
return (_arg1.replace(/(\w)/, _swapCase));
}
public static function capitalize(_arg1:String, ... _args):String{
var _local3:String;
_local3 = trimLeft(_arg1);
if (_args[0] === true){
return (_local3.replace(/^.|\b./g, _upperCase));
};
return (_local3.replace(/(^\w)/, _upperCase));
}
public static function truncate(_arg1:String, _arg2:uint, _arg3:String="..."):String{
var _local4:String;
if (_arg1 == null){
return ("");
};
_arg2 = (_arg2 - _arg3.length);
_local4 = _arg1;
if (_local4.length > _arg2){
_local4 = _local4.substr(0, _arg2);
if (/[^\s]/.test(_arg1.charAt(_arg2))){
_local4 = trimRight(_local4.replace(/\w+$|\s+$/, ""));
};
_local4 = (_local4 + _arg3);
};
return (_local4);
}
public static function reverseWords(_arg1:String):String{
if (_arg1 == null){
return ("");
};
return (_arg1.split(/\s+/).reverse().join(""));
}
public static function beforeFirst(_arg1:String, _arg2:String):String{
var _local3:int;
if (_arg1 == null){
return ("");
};
_local3 = _arg1.indexOf(_arg2);
if (_local3 == -1){
return ("");
};
return (_arg1.substr(0, _local3));
}
private static function _upperCase(_arg1:String, ... _args):String{
return (_arg1.toUpperCase());
}
public static function afterFirst(_arg1:String, _arg2:String):String{
var _local3:int;
if (_arg1 == null){
return ("");
};
_local3 = _arg1.indexOf(_arg2);
if (_local3 == -1){
return ("");
};
_local3 = (_local3 + _arg2.length);
return (_arg1.substr(_local3));
}
public static function beforeLast(_arg1:String, _arg2:String):String{
var _local3:int;
if (_arg1 == null){
return ("");
};
_local3 = _arg1.lastIndexOf(_arg2);
if (_local3 == -1){
return ("");
};
return (_arg1.substr(0, _local3));
}
public static function padLeft(_arg1:String, _arg2:String, _arg3:uint):String{
var _local4:String;
_local4 = _arg1;
while (_local4.length < _arg3) {
_local4 = (_arg2 + _local4);
};
return (_local4);
}
public static function quote(_arg1:String):String{
var _local2:RegExp;
_local2 = /[\\"\r\n]/g;
return ((("\"" + _arg1.replace(_local2, _quote)) + "\""));
}
private static function _quote(_arg1:String, ... _args):String{
switch (_arg1){
case "\\":
return ("\\\\");
case "\r":
return ("\\r");
case "\n":
return ("\\n");
case "\"":
return ("\\\"");
default:
return ("");
};
}
}
}//package MyUtils
Section 130
//Utils (MyUtils.Utils)
package MyUtils {
import flash.geom.*;
import flash.display.*;
public class Utils {
public static const TO_RAD = 0.0174532925199433;
public static const TO_DEG = 57.2957795130823;
static var p1:Point = new Point();
static var p2:Point = new Point();
public static function interval(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg2 < _arg1){
return (_arg1);
};
if (_arg2 > _arg3){
return (_arg3);
};
return (_arg2);
}
public static function distance2D(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
p1.x = _arg1;
p1.y = _arg2;
p2.x = _arg3;
p2.y = _arg4;
return (Point.distance(p1, p2));
}
public static function distance1D(_arg1:Number, _arg2:Number):Number{
return (Math.abs((_arg1 - _arg2)));
}
public static function fillLeft(_arg1:String, _arg2:int, _arg3:String):String{
var _local4:int;
var _local5:int;
var _local6:String;
var _local7:*;
_local4 = _arg1.length;
_local5 = _arg3.length;
_local6 = new String(_arg1);
_local7 = _local4;
while (_local7 < _arg2) {
_local6 = (_arg3 + _local6);
_local7 = (_local7 + _local5);
};
return (_local6);
}
public static function matrixForEach(_arg1:Array, _arg2:Function):void{
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:int;
_local5 = _arg1.length;
_local6 = _arg1[0].length;
_local3 = 0;
while (_local3 < _local5) {
_local4 = 0;
while (_local4 < _local6) {
_arg2(_arg1[_local3][_local4], _local3, _local4);
_local4++;
};
_local3++;
};
}
public static function angleBPoints(_arg1, _arg2, _arg3, _arg4):Number{
return (Math.atan2((_arg4 - _arg2), (_arg3 - _arg1)));
}
public static function formatTime(_arg1:int, _arg2:int):String{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = Math.floor((Number(_arg1) / _arg2));
_local4 = Math.floor((_local3 / 60));
_local5 = Math.floor((_local4 / 60));
_local4 = (_local4 - (_local5 * 60));
_local3 = (_local3 - (((_local5 * 60) * 60) + (_local4 * 60)));
return (((((("" + fillLeft(String(_local5), 2, "0")) + ":") + fillLeft(String(_local4), 2, "0")) + ":") + fillLeft(String(_local3), 2, "0")));
}
public static function isInInterval(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
return ((((_arg1 > _arg2)) && ((_arg1 < _arg3))));
}
public static function create2DMatrix(_arg1:int, _arg2:int, _arg3):Array{
var _local4:Array;
var _local5:*;
var _local6:int;
_local4 = new Array(_arg1);
_local5 = 0;
while (_local5 < _arg1) {
_local4[_local5] = new Array(_arg2);
_local6 = 0;
while (_local6 < _arg2) {
_local4[_local5][_local6] = _arg3;
_local6++;
};
_local5++;
};
return (_local4);
}
public static function shortAngle(_arg1:Number, _arg2:Number):Number{
if (((((_arg1 * _arg2) > 0)) || ((Math.abs((_arg1 - _arg2)) < Math.PI)))){
return ((_arg2 - _arg1));
};
if (_arg1 > _arg2){
return ((((Math.PI * 2) + _arg2) - _arg1));
};
return ((((-(Math.PI) * 2) + _arg2) - _arg1));
}
public static function fillWithTexture(_arg1:BitmapData, _arg2:BitmapData):void{
var _local3:int;
var _local4:int;
var _local5:Point;
var _local6:int;
var _local7:int;
_local3 = Math.ceil((Number(_arg1.width) / _arg2.width));
_local4 = Math.ceil((Number(_arg1.height) / _arg2.height));
_local5 = new Point();
_local6 = 0;
while (_local6 < _local4) {
_local7 = 0;
while (_local7 < _local3) {
_local5.x = (_local7 * _arg2.width);
_local5.y = (_local6 * _arg2.height);
_arg1.copyPixels(_arg2, _arg2.rect, _local5, null, null, false);
_local7++;
};
_local6++;
};
}
public static function randomRange(_arg1:Number, _arg2:Number):Number{
return (((Math.random() * (_arg2 - _arg1)) + _arg1));
}
public static function polar(_arg1:Number, _arg2:Number, _arg3:Point){
_arg3.x = (Math.cos(_arg2) * _arg1);
_arg3.y = (-(Math.sin(_arg2)) * _arg1);
}
public static function smallest(_arg1:Number, _arg2:Number):Number{
if (Math.abs(_arg1) >= Math.abs(_arg2)){
return (_arg1);
};
return (_arg2);
}
}
}//package MyUtils
Section 131
//Ancla (Ancla)
package {
import Game.*;
public dynamic class Ancla extends MWBody {
public var __id192_:RectShape;
public var __id193_:RectShape;
public var __id194_:RectShape;
public var __id195_:RectShape;
public var __id196_:RectShape;
public var __id190_:RectShape;
public var __id191_:RectShape;
public function Ancla(){
addFrameScript(0, frame1);
__setProp___id190__Ancla_Physics_1();
__setProp___id194__Ancla_Physics_1();
__setProp___id195__Ancla_Physics_1();
__setProp___id192__Ancla_Physics_1();
__setProp___id193__Ancla_Physics_1();
__setProp___id196__Ancla_Physics_1();
__setProp___id191__Ancla_Physics_1();
}
function __setProp___id190__Ancla_Physics_1(){
try {
__id190_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id190_.categoryBits = 1;
__id190_.colgroup = 0;
__id190_.density = 1;
__id190_.friction = 0.1;
__id190_.maskBits = 0xFFFF;
__id190_.restitution = 0.2;
__id190_.sensor = false;
try {
__id190_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id191__Ancla_Physics_1(){
try {
__id191_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id191_.categoryBits = 1;
__id191_.colgroup = 0;
__id191_.density = 2;
__id191_.friction = 0.1;
__id191_.maskBits = 0xFFFF;
__id191_.restitution = 0.2;
__id191_.sensor = false;
try {
__id191_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id192__Ancla_Physics_1(){
try {
__id192_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id192_.categoryBits = 1;
__id192_.colgroup = 0;
__id192_.density = 2;
__id192_.friction = 0.1;
__id192_.maskBits = 0xFFFF;
__id192_.restitution = 0.2;
__id192_.sensor = false;
try {
__id192_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id193__Ancla_Physics_1(){
try {
__id193_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id193_.categoryBits = 1;
__id193_.colgroup = 0;
__id193_.density = 2;
__id193_.friction = 0.1;
__id193_.maskBits = 0xFFFF;
__id193_.restitution = 0.2;
__id193_.sensor = false;
try {
__id193_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id194__Ancla_Physics_1(){
try {
__id194_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id194_.categoryBits = 1;
__id194_.colgroup = 0;
__id194_.density = 2;
__id194_.friction = 0.1;
__id194_.maskBits = 0xFFFF;
__id194_.restitution = 0.2;
__id194_.sensor = false;
try {
__id194_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id195__Ancla_Physics_1(){
try {
__id195_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id195_.categoryBits = 1;
__id195_.colgroup = 0;
__id195_.density = 1;
__id195_.friction = 0.1;
__id195_.maskBits = 0xFFFF;
__id195_.restitution = 0.2;
__id195_.sensor = false;
try {
__id195_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id196__Ancla_Physics_1(){
try {
__id196_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id196_.categoryBits = 1;
__id196_.colgroup = 0;
__id196_.density = 1;
__id196_.friction = 0.1;
__id196_.maskBits = 0xFFFF;
__id196_.restitution = 0.2;
__id196_.sensor = false;
try {
__id196_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 132
//Basura (Basura)
package {
import Game.*;
public dynamic class Basura extends MWBody {
public var __id76_:RectShape;
public function Basura(){
addFrameScript(0, frame1);
__setProp___id76__Basura_Layer1_1();
}
function frame1(){
this.canPin = false;
this.canDestroy = false;
}
function __setProp___id76__Basura_Layer1_1(){
try {
__id76_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id76_.categoryBits = 1;
__id76_.colgroup = 0;
__id76_.density = 3;
__id76_.friction = 0.3;
__id76_.maskBits = 0xFFFF;
__id76_.restitution = 0.2;
__id76_.sensor = false;
try {
__id76_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 133
//BigWall (BigWall)
package {
import Game.*;
public dynamic class BigWall extends MWBody {
public var __id62_:RectShape;
public var __id63_:RectShape;
public var __id64_:RectShape;
public var __id65_:RectShape;
public var __id66_:RectShape;
public function BigWall(){
addFrameScript(0, frame1);
__setProp___id62__BigWall_Physics_1();
__setProp___id63__BigWall_Physics_1();
__setProp___id64__BigWall_Physics_1();
__setProp___id65__BigWall_Physics_1();
__setProp___id66__BigWall_Physics_1();
}
function __setProp___id62__BigWall_Physics_1(){
try {
__id62_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id62_.categoryBits = 1;
__id62_.colgroup = 0;
__id62_.density = 0;
__id62_.friction = 1;
__id62_.maskBits = 0xFFFF;
__id62_.restitution = 0.1;
__id62_.sensor = false;
try {
__id62_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id65__BigWall_Physics_1(){
try {
__id65_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id65_.categoryBits = 1;
__id65_.colgroup = 0;
__id65_.density = 0;
__id65_.friction = 1;
__id65_.maskBits = 0xFFFF;
__id65_.restitution = 0.1;
__id65_.sensor = false;
try {
__id65_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id63__BigWall_Physics_1(){
try {
__id63_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id63_.categoryBits = 1;
__id63_.colgroup = 0;
__id63_.density = 0;
__id63_.friction = 1;
__id63_.maskBits = 0xFFFF;
__id63_.restitution = 0.1;
__id63_.sensor = false;
try {
__id63_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canPin = false;
this.canDestroy = false;
}
function __setProp___id66__BigWall_Physics_1(){
try {
__id66_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id66_.categoryBits = 1;
__id66_.colgroup = 0;
__id66_.density = 0;
__id66_.friction = 1;
__id66_.maskBits = 0xFFFF;
__id66_.restitution = 0.1;
__id66_.sensor = false;
try {
__id66_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id64__BigWall_Physics_1(){
try {
__id64_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id64_.categoryBits = 1;
__id64_.colgroup = 0;
__id64_.density = 0;
__id64_.friction = 1;
__id64_.maskBits = 0xFFFF;
__id64_.restitution = 0.1;
__id64_.sensor = false;
try {
__id64_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 134
//BloqueEgipcio (BloqueEgipcio)
package {
import Game.*;
public dynamic class BloqueEgipcio extends MWBody {
public var __id2_:RectShape;
public function BloqueEgipcio(){
addFrameScript(0, frame1);
__setProp___id2__BloqueEgipcio_Box_1();
}
function frame1(){
this.canPin = true;
this.canDestroy = false;
}
function __setProp___id2__BloqueEgipcio_Box_1(){
try {
__id2_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id2_.categoryBits = 1;
__id2_.colgroup = 0;
__id2_.density = 0;
__id2_.friction = 0.1;
__id2_.maskBits = 0xFFFF;
__id2_.restitution = 0;
__id2_.sensor = false;
try {
__id2_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 135
//BloqueGriego (BloqueGriego)
package {
import Game.*;
public dynamic class BloqueGriego extends MWBody {
public var __id48_:RectShape;
public function BloqueGriego(){
addFrameScript(0, frame1);
__setProp___id48__BloqueGriego_Graphic_1();
}
function __setProp___id48__BloqueGriego_Graphic_1(){
try {
__id48_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id48_.categoryBits = 1;
__id48_.colgroup = 0;
__id48_.density = 0;
__id48_.friction = 0.1;
__id48_.maskBits = 0xFFFF;
__id48_.restitution = 0;
__id48_.sensor = false;
try {
__id48_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canPin = true;
this.canDestroy = false;
}
}
}//package
Section 136
//BloqueMedieval (BloqueMedieval)
package {
import Game.*;
public dynamic class BloqueMedieval extends MWBody {
public var __id75_:RectShape;
public function BloqueMedieval(){
addFrameScript(0, frame1);
__setProp___id75__BloqueMedieval_Graphic_1();
}
function __setProp___id75__BloqueMedieval_Graphic_1(){
try {
__id75_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id75_.categoryBits = 1;
__id75_.colgroup = 0;
__id75_.density = 0;
__id75_.friction = 0.1;
__id75_.maskBits = 0xFFFF;
__id75_.restitution = 0;
__id75_.sensor = false;
try {
__id75_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canPin = true;
this.canDestroy = false;
}
}
}//package
Section 137
//BloqueNivel18 (BloqueNivel18)
package {
import Game.*;
public dynamic class BloqueNivel18 extends MWBody {
public var __id77_:RectShape;
public function BloqueNivel18(){
addFrameScript(0, frame1);
__setProp___id77__BloqueNivel18_Physics_1();
}
function __setProp___id77__BloqueNivel18_Physics_1(){
try {
__id77_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id77_.categoryBits = 1;
__id77_.colgroup = 0;
__id77_.density = 3;
__id77_.friction = 0.1;
__id77_.maskBits = 0xFFFF;
__id77_.restitution = 0.2;
__id77_.sensor = false;
try {
__id77_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
}
}//package
Section 138
//Bola38 (Bola38)
package {
import Game.*;
public dynamic class Bola38 extends MWBody {
public var __id181_:CircleShape;
public function Bola38(){
addFrameScript(0, frame1);
__setProp___id181__Bola38_Physics_1();
}
function frame1(){
this.canDestroy = false;
this.canPin = true;
}
function __setProp___id181__Bola38_Physics_1(){
try {
__id181_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id181_.categoryBits = 1;
__id181_.colgroup = 0;
__id181_.density = 2;
__id181_.friction = 0.1;
__id181_.maskBits = 0xFFFF;
__id181_.restitution = 0;
__id181_.sensor = false;
try {
__id181_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 139
//Bolita (Bolita)
package {
import Game.*;
public dynamic class Bolita extends MWBody {
public var __id27_:CircleShape;
public function Bolita(){
addFrameScript(0, frame1);
__setProp___id27__Bolita_shape_1();
}
function __setProp___id27__Bolita_shape_1(){
try {
__id27_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id27_.categoryBits = 1;
__id27_.colgroup = 0;
__id27_.density = 0.7;
__id27_.friction = 0.1;
__id27_.maskBits = 0xFFFF;
__id27_.restitution = 0.5;
__id27_.sensor = false;
try {
__id27_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canPin = true;
this.canDestroy = false;
this.drawable = true;
}
}
}//package
Section 140
//Boulder (Boulder)
package {
import Game.*;
public dynamic class Boulder extends MWBody {
public var __id91_:RectShape;
public var __id88_:RectShape;
public var __id87_:RectShape;
public var __id92_:RectShape;
public var __id90_:RectShape;
public var __id93_:RectShape;
public var __id86_:CircleShape;
public var __id89_:RectShape;
public function Boulder(){
addFrameScript(0, frame1);
__setProp___id86__Boulder_Physics_1();
__setProp___id93__Boulder_Physics_1();
__setProp___id91__Boulder_Physics_1();
__setProp___id92__Boulder_Physics_1();
__setProp___id90__Boulder_Physics_1();
__setProp___id88__Boulder_Physics_1();
__setProp___id87__Boulder_Physics_1();
__setProp___id89__Boulder_Physics_1();
}
function __setProp___id89__Boulder_Physics_1(){
try {
__id89_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id89_.categoryBits = 1;
__id89_.colgroup = 0;
__id89_.density = 1;
__id89_.friction = 1;
__id89_.maskBits = 0xFFFF;
__id89_.restitution = 0;
__id89_.sensor = false;
try {
__id89_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id87__Boulder_Physics_1(){
try {
__id87_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id87_.categoryBits = 1;
__id87_.colgroup = 0;
__id87_.density = 1;
__id87_.friction = 1;
__id87_.maskBits = 0xFFFF;
__id87_.restitution = 0;
__id87_.sensor = false;
try {
__id87_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id93__Boulder_Physics_1(){
try {
__id93_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id93_.categoryBits = 1;
__id93_.colgroup = 0;
__id93_.density = 1;
__id93_.friction = 1;
__id93_.maskBits = 0xFFFF;
__id93_.restitution = 0;
__id93_.sensor = false;
try {
__id93_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id91__Boulder_Physics_1(){
try {
__id91_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id91_.categoryBits = 1;
__id91_.colgroup = 0;
__id91_.density = 1;
__id91_.friction = 1;
__id91_.maskBits = 0xFFFF;
__id91_.restitution = 0;
__id91_.sensor = false;
try {
__id91_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id88__Boulder_Physics_1(){
try {
__id88_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id88_.categoryBits = 1;
__id88_.colgroup = 0;
__id88_.density = 1;
__id88_.friction = 1;
__id88_.maskBits = 0xFFFF;
__id88_.restitution = 0;
__id88_.sensor = false;
try {
__id88_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id90__Boulder_Physics_1(){
try {
__id90_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id90_.categoryBits = 1;
__id90_.colgroup = 0;
__id90_.density = 1;
__id90_.friction = 1;
__id90_.maskBits = 0xFFFF;
__id90_.restitution = 0;
__id90_.sensor = false;
try {
__id90_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id86__Boulder_Physics_1(){
try {
__id86_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id86_.categoryBits = 1;
__id86_.colgroup = 0;
__id86_.density = 3;
__id86_.friction = 0.3;
__id86_.maskBits = 0xFFFF;
__id86_.restitution = 0;
__id86_.sensor = false;
try {
__id86_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id92__Boulder_Physics_1(){
try {
__id92_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id92_.categoryBits = 1;
__id92_.colgroup = 0;
__id92_.density = 1;
__id92_.friction = 1;
__id92_.maskBits = 0xFFFF;
__id92_.restitution = 0;
__id92_.sensor = false;
try {
__id92_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 141
//Brush1 (Brush1)
package {
import flash.display.*;
public dynamic class Brush1 extends BitmapData {
public function Brush1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 142
//Brush2 (Brush2)
package {
import flash.display.*;
public dynamic class Brush2 extends BitmapData {
public function Brush2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 143
//Brush3 (Brush3)
package {
import flash.display.*;
public dynamic class Brush3 extends BitmapData {
public function Brush3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 144
//Brush4 (Brush4)
package {
import flash.display.*;
public dynamic class Brush4 extends BitmapData {
public function Brush4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 145
//Cajita (Cajita)
package {
import Game.*;
public dynamic class Cajita extends MWBody {
public var __id3_:RectShape;
public function Cajita(){
addFrameScript(0, frame1);
__setProp___id3__Cajita_Physics_1();
}
function frame1(){
this.canPin = true;
this.canDestroy = false;
this.drawable = true;
}
function __setProp___id3__Cajita_Physics_1(){
try {
__id3_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id3_.categoryBits = 1;
__id3_.colgroup = 0;
__id3_.density = 1;
__id3_.friction = 0.5;
__id3_.maskBits = 0xFFFF;
__id3_.restitution = 0.5;
__id3_.sensor = false;
try {
__id3_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 146
//Cart26 (Cart26)
package {
import Game.*;
public dynamic class Cart26 extends MWBody {
public var __id163_:RectShape;
public var __id157_:RectShape;
public var __id160_:RectShape;
public var __id161_:RectShape;
public var __id158_:RectShape;
public var __id162_:RectShape;
public var __id159_:RectShape;
public function Cart26(){
addFrameScript(0, frame1);
__setProp___id157__Cart26_Physics_1();
__setProp___id163__Cart26_Physics_1();
__setProp___id158__Cart26_Physics_1();
__setProp___id162__Cart26_Physics_1();
__setProp___id159__Cart26_Physics_1();
__setProp___id160__Cart26_Physics_1();
__setProp___id161__Cart26_Physics_1();
}
function __setProp___id157__Cart26_Physics_1(){
try {
__id157_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id157_.categoryBits = 1;
__id157_.colgroup = 0;
__id157_.density = 2;
__id157_.friction = 5;
__id157_.maskBits = 0xFFFF;
__id157_.restitution = 0.2;
__id157_.sensor = false;
try {
__id157_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id160__Cart26_Physics_1(){
try {
__id160_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id160_.categoryBits = 1;
__id160_.colgroup = 0;
__id160_.density = 2;
__id160_.friction = 0;
__id160_.maskBits = 0xFFFF;
__id160_.restitution = 0.2;
__id160_.sensor = false;
try {
__id160_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id163__Cart26_Physics_1(){
try {
__id163_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id163_.categoryBits = 1;
__id163_.colgroup = 0;
__id163_.density = 3;
__id163_.friction = 0;
__id163_.maskBits = 0xFFFF;
__id163_.restitution = 0.2;
__id163_.sensor = false;
try {
__id163_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id162__Cart26_Physics_1(){
try {
__id162_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id162_.categoryBits = 1;
__id162_.colgroup = 0;
__id162_.density = 3;
__id162_.friction = 0;
__id162_.maskBits = 0xFFFF;
__id162_.restitution = 0.2;
__id162_.sensor = false;
try {
__id162_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id159__Cart26_Physics_1(){
try {
__id159_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id159_.categoryBits = 1;
__id159_.colgroup = 0;
__id159_.density = 1;
__id159_.friction = 0;
__id159_.maskBits = 0xFFFF;
__id159_.restitution = 0.2;
__id159_.sensor = false;
try {
__id159_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id158__Cart26_Physics_1(){
try {
__id158_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id158_.categoryBits = 1;
__id158_.colgroup = 0;
__id158_.density = 3;
__id158_.friction = 0;
__id158_.maskBits = 0xFFFF;
__id158_.restitution = 0.2;
__id158_.sensor = false;
try {
__id158_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id161__Cart26_Physics_1(){
try {
__id161_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id161_.categoryBits = 1;
__id161_.colgroup = 0;
__id161_.density = 2;
__id161_.friction = 0;
__id161_.maskBits = 0xFFFF;
__id161_.restitution = 0.2;
__id161_.sensor = false;
try {
__id161_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 147
//ChainLink (ChainLink)
package {
import Game.*;
public dynamic class ChainLink extends MWBody {
public var __id110_:RectShape;
public function ChainLink(){
addFrameScript(0, frame1);
__setProp___id110__ChainLink_Physics_1();
}
function __setProp___id110__ChainLink_Physics_1(){
try {
__id110_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id110_.categoryBits = 1;
__id110_.colgroup = 0;
__id110_.density = 0.1;
__id110_.friction = 0.1;
__id110_.maskBits = 0xFFFF;
__id110_.restitution = 0.2;
__id110_.sensor = false;
try {
__id110_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
}
}//package
Section 148
//ChainLinkAttach (ChainLinkAttach)
package {
import Game.*;
public dynamic class ChainLinkAttach extends MWBody {
public var __id147_:RectShape;
public function ChainLinkAttach(){
addFrameScript(0, frame1);
__setProp___id147__ChainLinkAttach_Physics_1();
}
function __setProp___id147__ChainLinkAttach_Physics_1(){
try {
__id147_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id147_.categoryBits = 1;
__id147_.colgroup = 0;
__id147_.density = 0.1;
__id147_.friction = 0.1;
__id147_.maskBits = 0xFFFF;
__id147_.restitution = 0.2;
__id147_.sensor = false;
try {
__id147_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = true;
}
}
}//package
Section 149
//Chapter1 (Chapter1)
package {
import flash.media.*;
public dynamic class Chapter1 extends Sound {
}
}//package
Section 150
//CircleShape (CircleShape)
package {
import Box2DIntegration.*;
public dynamic class CircleShape extends b2iCircleShape {
public function CircleShape(){
addFrameScript(0, frame1);
}
function frame1(){
this.visible = false;
stop();
}
}
}//package
Section 151
//ColumnaBase (ColumnaBase)
package {
import Game.*;
public dynamic class ColumnaBase extends MWBody {
public var __id41_:RectShape;
public var __id42_:RectShape;
public var __id43_:RectShape;
public function ColumnaBase(){
addFrameScript(0, frame1);
__setProp___id41__Columna_1();
__setProp___id42__Columna_1();
__setProp___id43__Columna_1();
}
function __setProp___id43__Columna_1(){
try {
__id43_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id43_.categoryBits = 1;
__id43_.colgroup = 0;
__id43_.density = 0;
__id43_.friction = 1;
__id43_.maskBits = 0xFFFF;
__id43_.restitution = 0.1;
__id43_.sensor = false;
try {
__id43_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id41__Columna_1(){
try {
__id41_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id41_.categoryBits = 1;
__id41_.colgroup = 0;
__id41_.density = 0;
__id41_.friction = 1;
__id41_.maskBits = 0xFFFF;
__id41_.restitution = 0.1;
__id41_.sensor = false;
try {
__id41_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id42__Columna_1(){
try {
__id42_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id42_.categoryBits = 1;
__id42_.colgroup = 0;
__id42_.density = 0;
__id42_.friction = 1;
__id42_.maskBits = 0xFFFF;
__id42_.restitution = 0.1;
__id42_.sensor = false;
try {
__id42_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 152
//ColumnaSeat (ColumnaSeat)
package {
import Game.*;
public dynamic class ColumnaSeat extends MWBody {
public var __id44_:RectShape;
public var __id45_:RectShape;
public var __id47_:RectShape;
public var __id46_:RectShape;
public function ColumnaSeat(){
addFrameScript(0, frame1);
__setProp___id44__Columna_1();
__setProp___id45__Columna_1();
__setProp___id46__Columna_1();
__setProp___id47__Columna_1();
}
function __setProp___id46__Columna_1(){
try {
__id46_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id46_.categoryBits = 1;
__id46_.colgroup = 0;
__id46_.density = 0;
__id46_.friction = 1;
__id46_.maskBits = 0xFFFF;
__id46_.restitution = 0.1;
__id46_.sensor = false;
try {
__id46_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id44__Columna_1(){
try {
__id44_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id44_.categoryBits = 1;
__id44_.colgroup = 0;
__id44_.density = 0;
__id44_.friction = 1;
__id44_.maskBits = 0xFFFF;
__id44_.restitution = 0.1;
__id44_.sensor = false;
try {
__id44_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id47__Columna_1(){
try {
__id47_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id47_.categoryBits = 1;
__id47_.colgroup = 0;
__id47_.density = 0;
__id47_.friction = 1;
__id47_.maskBits = 0xFFFF;
__id47_.restitution = 0.1;
__id47_.sensor = false;
try {
__id47_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id45__Columna_1(){
try {
__id45_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id45_.categoryBits = 1;
__id45_.colgroup = 0;
__id45_.density = 0;
__id45_.friction = 1;
__id45_.maskBits = 0xFFFF;
__id45_.restitution = 0.1;
__id45_.sensor = false;
try {
__id45_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 153
//ColumnaTop (ColumnaTop)
package {
import Game.*;
public dynamic class ColumnaTop extends MWBody {
public var __id52_:RectShape;
public var __id51_:RectShape;
public var __id53_:RectShape;
public var __id54_:RectShape;
public function ColumnaTop(){
addFrameScript(0, frame1);
__setProp___id51__Columna_1();
__setProp___id53__Columna_1();
__setProp___id54__Columna_1();
__setProp___id52__Columna_1();
}
function __setProp___id54__Columna_1(){
try {
__id54_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id54_.categoryBits = 1;
__id54_.colgroup = 0;
__id54_.density = 0;
__id54_.friction = 1;
__id54_.maskBits = 0xFFFF;
__id54_.restitution = 0.1;
__id54_.sensor = false;
try {
__id54_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id52__Columna_1(){
try {
__id52_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id52_.categoryBits = 1;
__id52_.colgroup = 0;
__id52_.density = 0;
__id52_.friction = 1;
__id52_.maskBits = 0xFFFF;
__id52_.restitution = 0.1;
__id52_.sensor = false;
try {
__id52_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id53__Columna_1(){
try {
__id53_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id53_.categoryBits = 1;
__id53_.colgroup = 0;
__id53_.density = 0;
__id53_.friction = 1;
__id53_.maskBits = 0xFFFF;
__id53_.restitution = 0.1;
__id53_.sensor = false;
try {
__id53_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id51__Columna_1(){
try {
__id51_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id51_.categoryBits = 1;
__id51_.colgroup = 0;
__id51_.density = 0;
__id51_.friction = 1;
__id51_.maskBits = 0xFFFF;
__id51_.restitution = 0.1;
__id51_.sensor = false;
try {
__id51_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 154
//Cursor (Cursor)
package {
import flash.display.*;
public dynamic class Cursor extends MovieClip {
public var viento:MovieClip;
public function Cursor(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 155
//Empacador (Empacador)
package {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
import flash.display.*;
import Box2DIntegration.*;
class Empacador extends MovieClip {
private var _b2iLevel:b2iLevel;
private var _b2Bound:b2Bound;
private var _b2PolygonContact:b2PolygonContact;
private var _b2GearJointDef:b2GearJointDef;
private var _b2PulleyJoint:b2PulleyJointDef;
private var _b2World:b2World;
private var _b2iShape:b2iShape;
private var _b2BroadPhase:b2BroadPhase;
private var _b2Pair:b2Pair;
private var _b2Shape:b2Shape;
private var _b2ContactRegister:b2ContactRegister;
private var _b2Mat22:b2Mat22;
private var _b2ContactListener:b2ContactListener;
private var _b2DebugDraw:b2DebugDraw;
private var _b2DestructionListener:b2DestructionListener;
private var _b2iEevoluteJoint:b2iRevoluteJoint;
private var _b2iBody:b2iBody;
private var _b2Math:b2Math;
private var _b2NullContact:b2NullContact;
private var _b2Vec2:b2Vec2;
private var _b2GearJoint:b2GearJoint;
private var _b2Contact:b2Contact;
private var _b2ShapeDef:b2ShapeDef;
private var _b2MouseJointDef:b2MouseJointDef;
private var _b2PrismaticJoint:b2PrismaticJoint;
private var _b2CircleShape:b2CircleShape;
private var _b2MassData:b2MassData;
private var _b2iObjectGroup:b2iObjectGroup;
private var _b2iBoxShape:b2iBoxShape;
private var _b2Manifold:b2Manifold;
private var _b2PolygonDef:b2PolygonDef;
private var _b2BufferedPair:b2BufferedPair;
private var _clipVertex:ClipVertex;
private var _b2iCircleShape:b2iCircleShape;
private var _b2CircleContact:b2CircleContact;
private var _b2PolygonShape:b2PolygonShape;
private var _b2JointDef:b2JointDef;
private var _b2Jacobian:b2Jacobian;
private var _b2Body:b2Body;
private var _b2Proxy;
private var _b2ContactConstraintPoint:b2ContactConstraintPoint;
private var _b2DistanceJointDef:b2DistanceJointDef;
private var _b2TimeStep:b2TimeStep;
private var _b2iGameObject:b2iGameObject;
private var _b2Joint:b2Joint;
private var _b2CircleDef:b2CircleDef;
private var _b2DistanceJoint:b2DistanceJoint;
private var _b2ContactConstraint:b2ContactConstraint;
private var _b2MouseJoint:b2MouseJoint;
private var _b2Collision:b2Collision;
private var _b2PairManager:b2PairManager;
private var _b2ContactFilter:b2ContactFilter;
private var _b2BodyDef:b2BodyDef;
private var _b2ContactId:b2ContactID;
private var _b2JointEdge:b2JointEdge;
private var _b2Sweep:b2Sweep;
private var _b2PairCallback:b2PairCallback;
private var _b2AABB:b2AABB;
private var _features:Features;
private var _b2ContactPoint:b2ContactPoint;
private var _b2PrismaticJointDef:b2PrismaticJointDef;
private var _b2Island:b2Island;
private var _b2OBB:b2OBB;
private var _b2BoundaryListener:b2BoundaryListener;
private var _b2ContactEdge:b2ContactEdge;
private var _b2PolyAndCircleContact:b2PolyAndCircleContact;
private var _b2RevoluteJoint:b2RevoluteJoint;
private var _b2ContactSolver:b2ContactSolver;
private var _b2XForm:b2XForm;
private var _b2RevoluteJointDef:b2RevoluteJointDef;
private var _b2Settings:b2Settings;
private var _b2ContactManager:b2ContactManager;
}
}//package
Section 156
//EslabonNivel16 (EslabonNivel16)
package {
import Game.*;
public dynamic class EslabonNivel16 extends MWBody {
public var __id4_:RectShape;
public function EslabonNivel16(){
addFrameScript(0, frame1);
__setProp___id4__EslabonNivel16_Layer2_1();
}
function frame1(){
this.canDestroy = false;
this.canPin = true;
stop();
}
function __setProp___id4__EslabonNivel16_Layer2_1(){
try {
__id4_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id4_.categoryBits = 1;
__id4_.colgroup = 0;
__id4_.density = 3;
__id4_.friction = 0.1;
__id4_.maskBits = 0xFFFF;
__id4_.restitution = 0.2;
__id4_.sensor = false;
try {
__id4_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 157
//Estrellita (Estrellita)
package {
import Game.*;
public dynamic class Estrellita extends MWBody {
public var __id1_:RectShape;
public function Estrellita(){
addFrameScript(0, frame1, 14, frame15);
__setProp___id1__Estrellita_shapes_1();
}
function frame15(){
stop();
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
this.drawable = true;
}
function __setProp___id1__Estrellita_shapes_1(){
try {
__id1_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id1_.categoryBits = 1;
__id1_.colgroup = 0;
__id1_.density = 0;
__id1_.friction = 1;
__id1_.maskBits = 0xFFFF;
__id1_.restitution = 0;
__id1_.sensor = true;
try {
__id1_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 158
//EstrellitaObj (EstrellitaObj)
package {
import Game.*;
public dynamic class EstrellitaObj extends MWBody {
public var __id74_:RectShape;
public var __id73_:RectShape;
public function EstrellitaObj(){
addFrameScript(0, frame1);
__setProp___id73__EstrellitaObj_Physics_1();
__setProp___id74__EstrellitaObj_Physics_1();
}
function __setProp___id73__EstrellitaObj_Physics_1(){
try {
__id73_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id73_.categoryBits = 1;
__id73_.colgroup = 0;
__id73_.density = 0.5;
__id73_.friction = 0.1;
__id73_.maskBits = 0xFFFF;
__id73_.restitution = 0.2;
__id73_.sensor = false;
try {
__id73_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id74__EstrellitaObj_Physics_1(){
try {
__id74_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id74_.categoryBits = 1;
__id74_.colgroup = 0;
__id74_.density = 0.5;
__id74_.friction = 0.1;
__id74_.maskBits = 0xFFFF;
__id74_.restitution = 0.2;
__id74_.sensor = false;
try {
__id74_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
stop();
this.canPin = false;
this.canDestroy = false;
this.drawable = true;
}
}
}//package
Section 159
//Gate (Gate)
package {
import Game.*;
public dynamic class Gate extends MWBody {
public var __id94_:RectShape;
public function Gate(){
addFrameScript(0, frame1);
__setProp___id94__Gate_Physics_1();
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id94__Gate_Physics_1(){
try {
__id94_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id94_.categoryBits = 1;
__id94_.colgroup = 0;
__id94_.density = 4;
__id94_.friction = 0.1;
__id94_.maskBits = 0xFFFF;
__id94_.restitution = 0.2;
__id94_.sensor = false;
try {
__id94_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 160
//GearNoPin (GearNoPin)
package {
import Game.*;
public dynamic class GearNoPin extends MWBody {
public var __id108_:RectShape;
public var __id109_:RectShape;
public var __id105_:CircleShape;
public var __id106_:RectShape;
public var __id107_:RectShape;
public function GearNoPin(){
addFrameScript(0, frame1);
__setProp___id107__Gear_1();
__setProp___id106__Gear_1();
__setProp___id108__Gear_1();
__setProp___id109__Gear_1();
__setProp___id105__Gear_1();
}
function __setProp___id109__Gear_1(){
try {
__id109_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id109_.categoryBits = 1;
__id109_.colgroup = 0;
__id109_.density = 1;
__id109_.friction = 1;
__id109_.maskBits = 0xFFFF;
__id109_.restitution = 0.1;
__id109_.sensor = false;
try {
__id109_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id105__Gear_1(){
try {
__id105_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id105_.categoryBits = 1;
__id105_.colgroup = 0;
__id105_.density = 1;
__id105_.friction = 0.3;
__id105_.maskBits = 0xFFFF;
__id105_.restitution = 0;
__id105_.sensor = false;
try {
__id105_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id106__Gear_1(){
try {
__id106_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id106_.categoryBits = 1;
__id106_.colgroup = 0;
__id106_.density = 1;
__id106_.friction = 1;
__id106_.maskBits = 0xFFFF;
__id106_.restitution = 0.1;
__id106_.sensor = false;
try {
__id106_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id107__Gear_1(){
try {
__id107_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id107_.categoryBits = 1;
__id107_.colgroup = 0;
__id107_.density = 1;
__id107_.friction = 1;
__id107_.maskBits = 0xFFFF;
__id107_.restitution = 0.1;
__id107_.sensor = false;
try {
__id107_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id108__Gear_1(){
try {
__id108_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id108_.categoryBits = 1;
__id108_.colgroup = 0;
__id108_.density = 1;
__id108_.friction = 1;
__id108_.maskBits = 0xFFFF;
__id108_.restitution = 0.1;
__id108_.sensor = false;
try {
__id108_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 161
//GearPin (GearPin)
package {
import Game.*;
public dynamic class GearPin extends MWBody {
public var __id100_:RectShape;
public var __id96_:CircleShape;
public var __id97_:RectShape;
public var __id98_:RectShape;
public var __id99_:RectShape;
public function GearPin(){
addFrameScript(0, frame1);
__setProp___id96__Gear_1();
__setProp___id97__Gear_1();
__setProp___id98__Gear_1();
__setProp___id100__Gear_1();
__setProp___id99__Gear_1();
}
function __setProp___id97__Gear_1(){
try {
__id97_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id97_.categoryBits = 1;
__id97_.colgroup = 0;
__id97_.density = 1;
__id97_.friction = 1;
__id97_.maskBits = 0xFFFF;
__id97_.restitution = 0.1;
__id97_.sensor = false;
try {
__id97_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id100__Gear_1(){
try {
__id100_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id100_.categoryBits = 1;
__id100_.colgroup = 0;
__id100_.density = 1;
__id100_.friction = 1;
__id100_.maskBits = 0xFFFF;
__id100_.restitution = 0.1;
__id100_.sensor = false;
try {
__id100_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id96__Gear_1(){
try {
__id96_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id96_.categoryBits = 1;
__id96_.colgroup = 0;
__id96_.density = 1;
__id96_.friction = 0.3;
__id96_.maskBits = 0xFFFF;
__id96_.restitution = 0;
__id96_.sensor = false;
try {
__id96_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = true;
}
function __setProp___id99__Gear_1(){
try {
__id99_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id99_.categoryBits = 1;
__id99_.colgroup = 0;
__id99_.density = 1;
__id99_.friction = 1;
__id99_.maskBits = 0xFFFF;
__id99_.restitution = 0.1;
__id99_.sensor = false;
try {
__id99_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id98__Gear_1(){
try {
__id98_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id98_.categoryBits = 1;
__id98_.colgroup = 0;
__id98_.density = 1;
__id98_.friction = 1;
__id98_.maskBits = 0xFFFF;
__id98_.restitution = 0.1;
__id98_.sensor = false;
try {
__id98_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 162
//GlassSound (GlassSound)
package {
import flash.media.*;
public dynamic class GlassSound extends Sound {
}
}//package
Section 163
//inGameHelp (inGameHelp)
package {
import flash.display.*;
import flash.events.*;
import Game.*;
public dynamic class inGameHelp extends MovieClip {
public var resume_button:SimpleButton;
public var i_tuto:MovieClip;
public function inGameHelp(){
addFrameScript(1, frame2);
}
function frame2(){
resume_button.addEventListener(MouseEvent.CLICK, resumegame, false, 0, true);
stop();
}
public function resumegame(_arg1:Event){
Globals.gameState = Globals.GAME_RESUME;
this.parent.removeChild(this);
}
}
}//package
Section 164
//InGameLevelSelect (InGameLevelSelect)
package {
import flash.geom.*;
import flash.display.*;
import flash.utils.*;
import flash.events.*;
import Game.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class InGameLevelSelect extends MovieClip {
public var bu_FP:SimpleButton;
public var resume_button:SimpleButton;
public var level_score_tf:TextField;
public var linksXRow:int;
public var links:MovieClip;
public var mp1_link:SimpleButton;
public var linkList:Array;
public function InGameLevelSelect(){
addFrameScript(0, frame1);
}
public function selectFreePlay(_arg1:MouseEvent){
Globals.currentLevel = 0;
clearLS();
gotoAndStop("startGame");
}
public function updateScoreField(_arg1:MouseEvent){
var _local2:int;
var _local3:int;
_local2 = (int(_arg1.currentTarget.levelname.text) - 1);
_local3 = Globals.savedData.data.levelScores[_local2];
if (_local3 > 0){
level_score_tf.text = ("" + _local3);
} else {
level_score_tf.text = "0";
};
}
function frame1(){
stop();
resume_button.addEventListener(MouseEvent.CLICK, resumegame, false, 0, true);
mp1_link.addEventListener(MouseEvent.CLICK, bubbleboxMP1, false, 0, true);
linksXRow = 7;
linkList = [];
level_score_tf.text = "";
level_score_tf.mouseEnabled = false;
refreshLinks();
}
public function resumegame(_arg1:Event){
Globals.gameState = Globals.GAME_RESUME;
this.parent.removeChild(this);
links = null;
}
public function clearLS(){
var _local1:LevelLink;
for each (_local1 in linkList) {
_local1.removeEventListener(MouseEvent.CLICK, selectLevel);
_local1.removeEventListener(MouseEvent.MOUSE_OVER, updateScoreField);
};
linkList = [];
removeChild(links);
bu_FP.removeEventListener(MouseEvent.CLICK, selectFreePlay);
resume_button.removeEventListener(MouseEvent.CLICK, resumegame);
mp1_link.removeEventListener(MouseEvent.CLICK, bubbleboxMP1);
links = null;
Globals.gameState = Globals.GAME_RESTART;
this.parent.removeChild(this);
}
public function refreshLinks(){
var _local1:LevelLink;
var _local2:int;
if (links){
removeChild(links);
};
links = new MovieClip();
_local2 = 1;
while (_local2 < Globals.numLevels) {
_local1 = new LevelLink();
_local1.levelname.text = ("" + _local2);
_local1.y = (Math.floor(((_local2 - 1) / linksXRow)) * 60);
_local1.x = (((_local2 - 1) % linksXRow) * 50);
if (Globals.savedData.data.levelScores[(_local2 - 1)] >= 0){
_local1.gotoAndStop("check");
};
_local1.addEventListener(MouseEvent.CLICK, selectLevel, false, 0, true);
_local1.addEventListener(MouseEvent.MOUSE_OVER, updateScoreField, false, 0, true);
linkList.push(_local1);
links.addChild(_local1);
_local2++;
};
links.y = 150;
links.x = 200;
addChild(links);
bu_FP.addEventListener(MouseEvent.CLICK, selectFreePlay, false, 0, true);
}
public function bubbleboxMP1(_arg1:Event){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1285&subid=magicpen1link&action=magicpen1");
navigateToURL(_local2);
}
public function selectLevel(_arg1:MouseEvent){
var _local2:int;
_local2 = int(_arg1.currentTarget.levelname.text);
Globals.currentLevel = _local2;
clearLS();
gotoAndStop("startGame");
}
}
}//package
Section 165
//InGameSuperUI (InGameSuperUI)
package {
import flash.display.*;
public dynamic class InGameSuperUI extends MovieClip {
public var ui_barra:MovieClip;
public var ui_maskbarra:MovieClip;
public var uiSwitch_button:SimpleButton;
public var levelnum:MovieClip;
public function InGameSuperUI(){
addFrameScript(0, frame1);
}
function frame1(){
ui_barra.visible = false;
levelnum.mouseEnabled = false;
stop();
}
}
}//package
Section 166
//InGameUI (InGameUI)
package {
import flash.display.*;
public dynamic class InGameUI extends MovieClip {
public var tips:MovieClip;
public var main:MovieClip;
}
}//package
Section 167
//LevelLink (LevelLink)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public dynamic class LevelLink extends MovieClip {
public var levelname:TextField;
public function LevelLink(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
levelname.mouseEnabled = false;
this.buttonMode = true;
this.addEventListener(MouseEvent.ROLL_OVER, agrandar, false, 0, true);
this.addEventListener(MouseEvent.ROLL_OUT, normalizar, false, 0, true);
stop();
}
function frame1(){
}
function frame2(){
levelname.mouseEnabled = false;
this.buttonMode = true;
this.addEventListener(MouseEvent.ROLL_OVER, agrandar, false, 0, true);
this.addEventListener(MouseEvent.ROLL_OUT, normalizar, false, 0, true);
stop();
}
public function normalizar(_arg1:Event){
this.scaleX = 1;
this.scaleY = 1;
}
public function agrandar(_arg1:Event){
this.scaleX = 1.1;
this.scaleY = 1.1;
}
}
}//package
Section 168
//Martillo40 (Martillo40)
package {
import Game.*;
public dynamic class Martillo40 extends MWBody {
public var __id232_:RectShape;
public var __id233_:RectShape;
public var __id234_:RectShape;
public var __id235_:RectShape;
public var __id236_:RectShape;
public var __id231_:RectShape;
public function Martillo40(){
addFrameScript(0, frame1);
__setProp___id231__Martillo40_Physics_1();
__setProp___id235__Martillo40_Physics_1();
__setProp___id236__Martillo40_Physics_1();
__setProp___id234__Martillo40_Physics_1();
__setProp___id232__Martillo40_Physics_1();
__setProp___id233__Martillo40_Physics_1();
}
function __setProp___id233__Martillo40_Physics_1(){
try {
__id233_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id233_.categoryBits = 1;
__id233_.colgroup = 0;
__id233_.density = 3;
__id233_.friction = 0.1;
__id233_.maskBits = 0xFFFF;
__id233_.restitution = 0.2;
__id233_.sensor = false;
try {
__id233_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id234__Martillo40_Physics_1(){
try {
__id234_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id234_.categoryBits = 1;
__id234_.colgroup = 0;
__id234_.density = 3;
__id234_.friction = 0.1;
__id234_.maskBits = 0xFFFF;
__id234_.restitution = 0.2;
__id234_.sensor = false;
try {
__id234_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = true;
}
function __setProp___id235__Martillo40_Physics_1(){
try {
__id235_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id235_.categoryBits = 1;
__id235_.colgroup = 0;
__id235_.density = 3;
__id235_.friction = 0.1;
__id235_.maskBits = 0xFFFF;
__id235_.restitution = 0.2;
__id235_.sensor = false;
try {
__id235_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id231__Martillo40_Physics_1(){
try {
__id231_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id231_.categoryBits = 1;
__id231_.colgroup = 0;
__id231_.density = 2;
__id231_.friction = 0.1;
__id231_.maskBits = 0xFFFF;
__id231_.restitution = 0.2;
__id231_.sensor = false;
try {
__id231_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id232__Martillo40_Physics_1(){
try {
__id232_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id232_.categoryBits = 1;
__id232_.colgroup = 0;
__id232_.density = 6;
__id232_.friction = 0.1;
__id232_.maskBits = 0xFFFF;
__id232_.restitution = 0.2;
__id232_.sensor = false;
try {
__id232_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id236__Martillo40_Physics_1(){
try {
__id236_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id236_.categoryBits = 1;
__id236_.colgroup = 0;
__id236_.density = 3;
__id236_.friction = 0.1;
__id236_.maskBits = 0xFFFF;
__id236_.restitution = 0.2;
__id236_.sensor = false;
try {
__id236_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 169
//Muro (Muro)
package {
import Game.*;
public dynamic class Muro extends MWBody {
public var __id83_:RectShape;
public var __id84_:RectShape;
public var __id85_:RectShape;
public var __id80_:RectShape;
public var __id81_:RectShape;
public var __id82_:RectShape;
public function Muro(){
addFrameScript(0, frame1);
__setProp___id85__Muro_Physics_1();
__setProp___id80__Muro_Physics_1();
__setProp___id81__Muro_Physics_1();
__setProp___id82__Muro_Physics_1();
__setProp___id83__Muro_Physics_1();
__setProp___id84__Muro_Physics_1();
}
function __setProp___id80__Muro_Physics_1(){
try {
__id80_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id80_.categoryBits = 1;
__id80_.colgroup = 0;
__id80_.density = 0;
__id80_.friction = 1;
__id80_.maskBits = 0xFFFF;
__id80_.restitution = 0.1;
__id80_.sensor = false;
try {
__id80_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canPin = false;
this.canDestroy = false;
}
function __setProp___id81__Muro_Physics_1(){
try {
__id81_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id81_.categoryBits = 1;
__id81_.colgroup = 0;
__id81_.density = 0;
__id81_.friction = 1;
__id81_.maskBits = 0xFFFF;
__id81_.restitution = 0.1;
__id81_.sensor = false;
try {
__id81_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id82__Muro_Physics_1(){
try {
__id82_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id82_.categoryBits = 1;
__id82_.colgroup = 0;
__id82_.density = 0;
__id82_.friction = 1;
__id82_.maskBits = 0xFFFF;
__id82_.restitution = 0.1;
__id82_.sensor = false;
try {
__id82_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id83__Muro_Physics_1(){
try {
__id83_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id83_.categoryBits = 1;
__id83_.colgroup = 0;
__id83_.density = 0;
__id83_.friction = 1;
__id83_.maskBits = 0xFFFF;
__id83_.restitution = 0.1;
__id83_.sensor = false;
try {
__id83_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id85__Muro_Physics_1(){
try {
__id85_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id85_.categoryBits = 1;
__id85_.colgroup = 0;
__id85_.density = 0;
__id85_.friction = 1;
__id85_.maskBits = 0xFFFF;
__id85_.restitution = 0.1;
__id85_.sensor = false;
try {
__id85_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id84__Muro_Physics_1(){
try {
__id84_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id84_.categoryBits = 1;
__id84_.colgroup = 0;
__id84_.density = 0;
__id84_.friction = 1;
__id84_.maskBits = 0xFFFF;
__id84_.restitution = 0.1;
__id84_.sensor = false;
try {
__id84_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 170
//Nivel1 (Nivel1)
package {
import Game.*;
public dynamic class Nivel1 extends MWLevel {
}
}//package
Section 171
//Nivel10 (Nivel10)
package {
import Game.*;
public dynamic class Nivel10 extends MWLevel {
}
}//package
Section 172
//Nivel12 (Nivel12)
package {
import Game.*;
public dynamic class Nivel12 extends MWLevel {
}
}//package
Section 173
//Nivel13 (Nivel13)
package {
import Game.*;
public dynamic class Nivel13 extends MWLevel {
}
}//package
Section 174
//Nivel14 (Nivel14)
package {
import Game.*;
public dynamic class Nivel14 extends MWLevel {
}
}//package
Section 175
//Nivel15 (Nivel15)
package {
import Game.*;
public dynamic class Nivel15 extends MWLevel {
}
}//package
Section 176
//Nivel16 (Nivel16)
package {
import Game.*;
public dynamic class Nivel16 extends MWLevel {
}
}//package
Section 177
//Nivel17 (Nivel17)
package {
import Game.*;
public dynamic class Nivel17 extends MWLevel {
}
}//package
Section 178
//Nivel18 (Nivel18)
package {
import Game.*;
public dynamic class Nivel18 extends MWLevel {
}
}//package
Section 179
//Nivel19 (Nivel19)
package {
import Game.*;
public dynamic class Nivel19 extends MWLevel {
}
}//package
Section 180
//Nivel2 (Nivel2)
package {
import Game.*;
public dynamic class Nivel2 extends MWLevel {
}
}//package
Section 181
//Nivel20 (Nivel20)
package {
import Game.*;
public dynamic class Nivel20 extends MWLevel {
}
}//package
Section 182
//Nivel21 (Nivel21)
package {
import Game.*;
public dynamic class Nivel21 extends MWLevel {
}
}//package
Section 183
//Nivel22 (Nivel22)
package {
import Game.*;
public dynamic class Nivel22 extends MWLevel {
}
}//package
Section 184
//Nivel23 (Nivel23)
package {
import Game.*;
public dynamic class Nivel23 extends MWLevel {
public var __id101_:RevJoint;
public function Nivel23(){
__setProp___id101__Nivel23copy_pines_1();
}
function __setProp___id101__Nivel23copy_pines_1(){
try {
__id101_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id101_.forceResistance = 0;
__id101_.speed = 2;
__id101_.torque = 350000;
__id101_.torqueResistance = 350000;
try {
__id101_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 185
//Nivel24 (Nivel24)
package {
import Game.*;
public dynamic class Nivel24 extends MWLevel {
public var __id238_:RevJoint;
public function Nivel24(){
__setProp___id238__Nivel24_pizo_1();
}
function __setProp___id238__Nivel24_pizo_1(){
try {
__id238_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id238_.forceResistance = 350000;
__id238_.speed = 0.25;
__id238_.torque = 850000;
__id238_.torqueResistance = 350000;
try {
__id238_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 186
//Nivel25 (Nivel25)
package {
import Game.*;
public dynamic class Nivel25 extends MWLevel {
public var __id124_:RevJoint;
public var __id136_:RevJoint;
public var __id112_:RevJoint;
public var __id137_:RevJoint;
public var __id125_:RevJoint;
public var __id113_:RevJoint;
public var __id138_:RevJoint;
public var __id126_:RevJoint;
public var __id114_:RevJoint;
public var __id139_:RevJoint;
public var __id103_:RevJoint;
public var __id127_:RevJoint;
public var __id115_:RevJoint;
public var __id128_:RevJoint;
public var __id116_:RevJoint;
public var __id104_:RevJoint;
public var __id117_:RevJoint;
public var __id129_:RevJoint;
public var __id118_:RevJoint;
public var __id119_:RevJoint;
public var __id140_:RevJoint;
public var __id141_:RevJoint;
public var __id130_:RevJoint;
public var __id142_:RevJoint;
public var __id131_:RevJoint;
public var __id132_:RevJoint;
public var __id120_:RevJoint;
public var __id133_:RevJoint;
public var __id121_:RevJoint;
public var __id134_:RevJoint;
public var __id122_:RevJoint;
public var __id135_:RevJoint;
public var __id111_:RevJoint;
public var __id123_:RevJoint;
public function Nivel25(){
__setProp___id139__Nivel25copy_objetos_1();
__setProp___id138__Nivel25copy_objetos_1();
__setProp___id137__Nivel25copy_objetos_1();
__setProp___id136__Nivel25copy_objetos_1();
__setProp___id133__Nivel25copy_objetos_1();
__setProp___id132__Nivel25copy_objetos_1();
__setProp___id128__Nivel25copy_objetos_1();
__setProp___id127__Nivel25copy_objetos_1();
__setProp___id123__Nivel25copy_objetos_1();
__setProp___id104__Nivel25copy_pizo_1();
__setProp___id142__Nivel25copy_objetos_1();
__setProp___id140__Nivel25copy_objetos_1();
__setProp___id124__Nivel25copy_objetos_1();
__setProp___id120__Nivel25copy_objetos_1();
__setProp___id103__Nivel25copy_pizo_1();
__setProp___id141__Nivel25copy_objetos_1();
__setProp___id135__Nivel25copy_objetos_1();
__setProp___id134__Nivel25copy_objetos_1();
__setProp___id131__Nivel25copy_objetos_1();
__setProp___id130__Nivel25copy_objetos_1();
__setProp___id125__Nivel25copy_objetos_1();
__setProp___id121__Nivel25copy_objetos_1();
__setProp___id119__Nivel25copy_objetos_1();
__setProp___id118__Nivel25copy_objetos_1();
__setProp___id117__Nivel25copy_objetos_1();
__setProp___id116__Nivel25copy_objetos_1();
__setProp___id115__Nivel25copy_objetos_1();
__setProp___id114__Nivel25copy_objetos_1();
__setProp___id113__Nivel25copy_objetos_1();
__setProp___id112__Nivel25copy_objetos_1();
__setProp___id111__Nivel25copy_objetos_1();
__setProp___id129__Nivel25copy_objetos_1();
__setProp___id126__Nivel25copy_objetos_1();
__setProp___id122__Nivel25copy_objetos_1();
}
function __setProp___id126__Nivel25copy_objetos_1(){
try {
__id126_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id126_.forceResistance = 350000;
__id126_.speed = 0;
__id126_.torque = 1000;
__id126_.torqueResistance = 1000;
try {
__id126_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id104__Nivel25copy_pizo_1(){
try {
__id104_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id104_.forceResistance = 350000;
__id104_.speed = 0.5;
__id104_.torque = 1850000;
__id104_.torqueResistance = 350000;
try {
__id104_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id115__Nivel25copy_objetos_1(){
try {
__id115_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id115_.forceResistance = 350000;
__id115_.speed = 0;
__id115_.torque = 1000;
__id115_.torqueResistance = 1000;
try {
__id115_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id124__Nivel25copy_objetos_1(){
try {
__id124_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id124_.forceResistance = 350000;
__id124_.speed = 0;
__id124_.torque = 1000;
__id124_.torqueResistance = 1000;
try {
__id124_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id133__Nivel25copy_objetos_1(){
try {
__id133_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id133_.forceResistance = 350000;
__id133_.speed = 0;
__id133_.torque = 1000;
__id133_.torqueResistance = 1000;
try {
__id133_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id135__Nivel25copy_objetos_1(){
try {
__id135_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id135_.forceResistance = 350000;
__id135_.speed = 0;
__id135_.torque = 1000;
__id135_.torqueResistance = 1000;
try {
__id135_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id113__Nivel25copy_objetos_1(){
try {
__id113_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id113_.forceResistance = 350000;
__id113_.speed = 0;
__id113_.torque = 1000;
__id113_.torqueResistance = 1000;
try {
__id113_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id122__Nivel25copy_objetos_1(){
try {
__id122_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id122_.forceResistance = 350000;
__id122_.speed = 0;
__id122_.torque = 1000;
__id122_.torqueResistance = 1000;
try {
__id122_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id142__Nivel25copy_objetos_1(){
try {
__id142_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id142_.forceResistance = 350000;
__id142_.speed = 0;
__id142_.torque = 1000;
__id142_.torqueResistance = 1000;
try {
__id142_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id103__Nivel25copy_pizo_1(){
try {
__id103_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id103_.forceResistance = 350000;
__id103_.speed = 0.5;
__id103_.torque = 1850000;
__id103_.torqueResistance = 350000;
try {
__id103_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id111__Nivel25copy_objetos_1(){
try {
__id111_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id111_.forceResistance = 350000;
__id111_.speed = 0;
__id111_.torque = 1000;
__id111_.torqueResistance = 1000;
try {
__id111_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id131__Nivel25copy_objetos_1(){
try {
__id131_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id131_.forceResistance = 350000;
__id131_.speed = 0;
__id131_.torque = 1000;
__id131_.torqueResistance = 1000;
try {
__id131_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id129__Nivel25copy_objetos_1(){
try {
__id129_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id129_.forceResistance = 350000;
__id129_.speed = 0;
__id129_.torque = 1000;
__id129_.torqueResistance = 1000;
try {
__id129_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id118__Nivel25copy_objetos_1(){
try {
__id118_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id118_.forceResistance = 350000;
__id118_.speed = 0;
__id118_.torque = 1000;
__id118_.torqueResistance = 1000;
try {
__id118_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id138__Nivel25copy_objetos_1(){
try {
__id138_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id138_.forceResistance = 350000;
__id138_.speed = 0;
__id138_.torque = 1000;
__id138_.torqueResistance = 1000;
try {
__id138_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id140__Nivel25copy_objetos_1(){
try {
__id140_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id140_.forceResistance = 350000;
__id140_.speed = 0;
__id140_.torque = 1000;
__id140_.torqueResistance = 1000;
try {
__id140_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id120__Nivel25copy_objetos_1(){
try {
__id120_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id120_.forceResistance = 350000;
__id120_.speed = 0;
__id120_.torque = 1000;
__id120_.torqueResistance = 1000;
try {
__id120_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id127__Nivel25copy_objetos_1(){
try {
__id127_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id127_.forceResistance = 350000;
__id127_.speed = 0;
__id127_.torque = 1000;
__id127_.torqueResistance = 1000;
try {
__id127_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id136__Nivel25copy_objetos_1(){
try {
__id136_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id136_.forceResistance = 350000;
__id136_.speed = 0;
__id136_.torque = 1000;
__id136_.torqueResistance = 1000;
try {
__id136_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id125__Nivel25copy_objetos_1(){
try {
__id125_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id125_.forceResistance = 350000;
__id125_.speed = 0;
__id125_.torque = 1000;
__id125_.torqueResistance = 1000;
try {
__id125_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id116__Nivel25copy_objetos_1(){
try {
__id116_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id116_.forceResistance = 350000;
__id116_.speed = 0;
__id116_.torque = 1000;
__id116_.torqueResistance = 1000;
try {
__id116_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id114__Nivel25copy_objetos_1(){
try {
__id114_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id114_.forceResistance = 350000;
__id114_.speed = 0;
__id114_.torque = 1000;
__id114_.torqueResistance = 1000;
try {
__id114_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id134__Nivel25copy_objetos_1(){
try {
__id134_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id134_.forceResistance = 350000;
__id134_.speed = 0;
__id134_.torque = 1000;
__id134_.torqueResistance = 1000;
try {
__id134_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id123__Nivel25copy_objetos_1(){
try {
__id123_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id123_.forceResistance = 350000;
__id123_.speed = 0;
__id123_.torque = 1000;
__id123_.torqueResistance = 1000;
try {
__id123_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id112__Nivel25copy_objetos_1(){
try {
__id112_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id112_.forceResistance = 350000;
__id112_.speed = 0;
__id112_.torque = 1000;
__id112_.torqueResistance = 1000;
try {
__id112_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id132__Nivel25copy_objetos_1(){
try {
__id132_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id132_.forceResistance = 350000;
__id132_.speed = 0;
__id132_.torque = 1000;
__id132_.torqueResistance = 1000;
try {
__id132_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id119__Nivel25copy_objetos_1(){
try {
__id119_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id119_.forceResistance = 350000;
__id119_.speed = 0;
__id119_.torque = 1000;
__id119_.torqueResistance = 1000;
try {
__id119_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id139__Nivel25copy_objetos_1(){
try {
__id139_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id139_.forceResistance = 350000;
__id139_.speed = 0;
__id139_.torque = 1000;
__id139_.torqueResistance = 1000;
try {
__id139_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id121__Nivel25copy_objetos_1(){
try {
__id121_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id121_.forceResistance = 350000;
__id121_.speed = 0;
__id121_.torque = 1000;
__id121_.torqueResistance = 1000;
try {
__id121_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id141__Nivel25copy_objetos_1(){
try {
__id141_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id141_.forceResistance = 350000;
__id141_.speed = 0;
__id141_.torque = 1000;
__id141_.torqueResistance = 1000;
try {
__id141_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id128__Nivel25copy_objetos_1(){
try {
__id128_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id128_.forceResistance = 350000;
__id128_.speed = 0;
__id128_.torque = 1000;
__id128_.torqueResistance = 1000;
try {
__id128_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id130__Nivel25copy_objetos_1(){
try {
__id130_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id130_.forceResistance = 350000;
__id130_.speed = 0;
__id130_.torque = 1000;
__id130_.torqueResistance = 1000;
try {
__id130_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id137__Nivel25copy_objetos_1(){
try {
__id137_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id137_.forceResistance = 350000;
__id137_.speed = 0;
__id137_.torque = 1000;
__id137_.torqueResistance = 1000;
try {
__id137_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id117__Nivel25copy_objetos_1(){
try {
__id117_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id117_.forceResistance = 350000;
__id117_.speed = 0;
__id117_.torque = 1000;
__id117_.torqueResistance = 1000;
try {
__id117_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 187
//Nivel26 (Nivel26)
package {
import Game.*;
public dynamic class Nivel26 extends MWLevel {
public var __id146_:RevJoint;
public var __id145_:RevJoint;
public function Nivel26(){
__setProp___id146__Nivel26copy_pizo_1();
__setProp___id145__Nivel26copy_pizo_1();
}
function __setProp___id146__Nivel26copy_pizo_1(){
try {
__id146_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id146_.forceResistance = 2500000;
__id146_.speed = 0.2;
__id146_.torque = 2500000;
__id146_.torqueResistance = 2500000;
try {
__id146_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id145__Nivel26copy_pizo_1(){
try {
__id145_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id145_.forceResistance = 1850000;
__id145_.speed = 0.8;
__id145_.torque = 1850000;
__id145_.torqueResistance = 1850000;
try {
__id145_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 188
//Nivel27 (Nivel27)
package {
import Game.*;
public dynamic class Nivel27 extends MWLevel {
}
}//package
Section 189
//Nivel3 (Nivel3)
package {
import Game.*;
public dynamic class Nivel3 extends MWLevel {
public function Nivel3(){
addFrameScript(0, frame1);
}
function frame1(){
}
}
}//package
Section 190
//Nivel37 (Nivel37)
package {
import Game.*;
public dynamic class Nivel37 extends MWLevel {
public var __id170_:RevJoint;
public var __id171_:RevJoint;
public function Nivel37(){
__setProp___id171__Nivel37copy_pizo_1();
__setProp___id170__Nivel37copy_pizo_1();
}
function __setProp___id171__Nivel37copy_pizo_1(){
try {
__id171_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id171_.forceResistance = 350000;
__id171_.speed = -0.6;
__id171_.torque = 350000;
__id171_.torqueResistance = 350000;
try {
__id171_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id170__Nivel37copy_pizo_1(){
try {
__id170_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id170_.forceResistance = 350000;
__id170_.speed = 0.6;
__id170_.torque = 350000;
__id170_.torqueResistance = 350000;
try {
__id170_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 191
//Nivel38 (Nivel38)
package {
import Game.*;
public dynamic class Nivel38 extends MWLevel {
public var __id180_:RevJoint;
public function Nivel38(){
__setProp___id180__Nivel38copy_pizo_1();
}
function __setProp___id180__Nivel38copy_pizo_1(){
try {
__id180_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id180_.forceResistance = 2500000;
__id180_.speed = -0.3;
__id180_.torque = 2500000;
__id180_.torqueResistance = 2500000;
try {
__id180_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 192
//Nivel39 (Nivel39)
package {
import Game.*;
public dynamic class Nivel39 extends MWLevel {
public var __id183_:RevJoint;
public var __id184_:RevJoint;
public var __id182_:RevJoint;
public function Nivel39(){
__setProp___id182__Nivel39copy_pizo_1();
__setProp___id183__Nivel39copy_pizo_1();
__setProp___id184__Nivel39copy_pizo_1();
}
function __setProp___id182__Nivel39copy_pizo_1(){
try {
__id182_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id182_.forceResistance = 1850000;
__id182_.speed = 1.5;
__id182_.torque = 1850000;
__id182_.torqueResistance = 1850000;
try {
__id182_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id183__Nivel39copy_pizo_1(){
try {
__id183_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id183_.forceResistance = 35500000;
__id183_.speed = 0.2;
__id183_.torque = 35500000;
__id183_.torqueResistance = 35500000;
try {
__id183_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id184__Nivel39copy_pizo_1(){
try {
__id184_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id184_.forceResistance = 1850000;
__id184_.speed = -1.5;
__id184_.torque = 1850000;
__id184_.torqueResistance = 1850000;
try {
__id184_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 193
//Nivel4 (Nivel4)
package {
import Game.*;
public dynamic class Nivel4 extends MWLevel {
}
}//package
Section 194
//Nivel40 (Nivel40)
package {
import Game.*;
public dynamic class Nivel40 extends MWLevel {
public var __id209_:RevJoint;
public var __id226_:RevJoint;
public var __id227_:RevJoint;
public var __id228_:RevJoint;
public function Nivel40(){
__setProp___id228__Nivel40copy_objetos_1();
__setProp___id209__Nivel40copy_pizo_1();
__setProp___id227__Nivel40copy_objetos_1();
__setProp___id226__Nivel40copy_objetos_1();
}
function __setProp___id209__Nivel40copy_pizo_1(){
try {
__id209_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id209_.forceResistance = 99000000;
__id209_.speed = 0.75;
__id209_.torque = 99000000;
__id209_.torqueResistance = 99000000;
try {
__id209_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id228__Nivel40copy_objetos_1(){
try {
__id228_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id228_.forceResistance = 250000;
__id228_.speed = -0.5;
__id228_.torque = 25000;
__id228_.torqueResistance = 25000;
try {
__id228_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id226__Nivel40copy_objetos_1(){
try {
__id226_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id226_.forceResistance = 250000;
__id226_.speed = -0.5;
__id226_.torque = 25000;
__id226_.torqueResistance = 25000;
try {
__id226_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id227__Nivel40copy_objetos_1(){
try {
__id227_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id227_.forceResistance = 250000;
__id227_.speed = -0.5;
__id227_.torque = 25000;
__id227_.torqueResistance = 25000;
try {
__id227_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 195
//Nivel5 (Nivel5)
package {
import Game.*;
public dynamic class Nivel5 extends MWLevel {
}
}//package
Section 196
//Nivel6 (Nivel6)
package {
import Game.*;
public dynamic class Nivel6 extends MWLevel {
}
}//package
Section 197
//Nivel7 (Nivel7)
package {
import Game.*;
public dynamic class Nivel7 extends MWLevel {
}
}//package
Section 198
//Nivel8 (Nivel8)
package {
import Game.*;
public dynamic class Nivel8 extends MWLevel {
}
}//package
Section 199
//Nivel9 (Nivel9)
package {
import Game.*;
public dynamic class Nivel9 extends MWLevel {
}
}//package
Section 200
//NivelFreePlay (NivelFreePlay)
package {
import Game.*;
public dynamic class NivelFreePlay extends MWLevel {
}
}//package
Section 201
//NuevoNivel2 (NuevoNivel2)
package {
import Game.*;
public dynamic class NuevoNivel2 extends MWLevel {
}
}//package
Section 202
//NuevoNivel3 (NuevoNivel3)
package {
import Game.*;
public dynamic class NuevoNivel3 extends MWLevel {
}
}//package
Section 203
//Obelisque (Obelisque)
package {
import Game.*;
public dynamic class Obelisque extends MWBody {
public var __id35_:RectShape;
public var __id36_:RectShape;
public var __id37_:RectShape;
public var __id38_:RectShape;
public var __id39_:RectShape;
public function Obelisque(){
addFrameScript(0, frame1);
__setProp___id35__Obelisque_Physics_1();
__setProp___id36__Obelisque_Physics_1();
__setProp___id37__Obelisque_Physics_1();
__setProp___id39__Obelisque_Physics_1();
__setProp___id38__Obelisque_Physics_1();
}
function __setProp___id39__Obelisque_Physics_1(){
try {
__id39_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id39_.categoryBits = 1;
__id39_.colgroup = 0;
__id39_.density = 0;
__id39_.friction = 1;
__id39_.maskBits = 0xFFFF;
__id39_.restitution = 0.1;
__id39_.sensor = false;
try {
__id39_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id36__Obelisque_Physics_1(){
try {
__id36_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id36_.categoryBits = 1;
__id36_.colgroup = 0;
__id36_.density = 0;
__id36_.friction = 1;
__id36_.maskBits = 0xFFFF;
__id36_.restitution = 0.1;
__id36_.sensor = false;
try {
__id36_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id38__Obelisque_Physics_1(){
try {
__id38_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id38_.categoryBits = 1;
__id38_.colgroup = 0;
__id38_.density = 0;
__id38_.friction = 1;
__id38_.maskBits = 0xFFFF;
__id38_.restitution = 0.1;
__id38_.sensor = false;
try {
__id38_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id35__Obelisque_Physics_1(){
try {
__id35_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id35_.categoryBits = 1;
__id35_.colgroup = 0;
__id35_.density = 0;
__id35_.friction = 1;
__id35_.maskBits = 0xFFFF;
__id35_.restitution = 0.1;
__id35_.sensor = false;
try {
__id35_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id37__Obelisque_Physics_1(){
try {
__id37_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id37_.categoryBits = 1;
__id37_.colgroup = 0;
__id37_.density = 0;
__id37_.friction = 1;
__id37_.maskBits = 0xFFFF;
__id37_.restitution = 0.1;
__id37_.sensor = false;
try {
__id37_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 204
//Paquete (Paquete)
package {
public dynamic class Paquete extends Empacador {
}
}//package
Section 205
//Partenon (Partenon)
package {
import Game.*;
public dynamic class Partenon extends MWBody {
public var __id56_:RectShape;
public var __id61_:RectShape;
public var __id55_:RectShape;
public var __id57_:RectShape;
public var __id58_:RectShape;
public var __id60_:RectShape;
public var __id59_:RectShape;
public function Partenon(){
addFrameScript(0, frame1);
__setProp___id58__PartenonHeader_Physics_1();
__setProp___id60__PartenonHeader_Physics_1();
__setProp___id56__PartenonHeader_Physics_1();
__setProp___id61__PartenonHeader_Physics_1();
__setProp___id55__PartenonHeader_Physics_1();
__setProp___id57__PartenonHeader_Physics_1();
__setProp___id59__PartenonHeader_Physics_1();
}
function __setProp___id58__PartenonHeader_Physics_1(){
try {
__id58_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id58_.categoryBits = 1;
__id58_.colgroup = 0;
__id58_.density = 0;
__id58_.friction = 1;
__id58_.maskBits = 0xFFFF;
__id58_.restitution = 0.1;
__id58_.sensor = false;
try {
__id58_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id61__PartenonHeader_Physics_1(){
try {
__id61_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id61_.categoryBits = 1;
__id61_.colgroup = 0;
__id61_.density = 0;
__id61_.friction = 1;
__id61_.maskBits = 0xFFFF;
__id61_.restitution = 0.1;
__id61_.sensor = false;
try {
__id61_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id60__PartenonHeader_Physics_1(){
try {
__id60_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id60_.categoryBits = 1;
__id60_.colgroup = 0;
__id60_.density = 0;
__id60_.friction = 1;
__id60_.maskBits = 0xFFFF;
__id60_.restitution = 0.1;
__id60_.sensor = false;
try {
__id60_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id57__PartenonHeader_Physics_1(){
try {
__id57_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id57_.categoryBits = 1;
__id57_.colgroup = 0;
__id57_.density = 0;
__id57_.friction = 1;
__id57_.maskBits = 0xFFFF;
__id57_.restitution = 0.1;
__id57_.sensor = false;
try {
__id57_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id56__PartenonHeader_Physics_1(){
try {
__id56_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id56_.categoryBits = 1;
__id56_.colgroup = 0;
__id56_.density = 0;
__id56_.friction = 1;
__id56_.maskBits = 0xFFFF;
__id56_.restitution = 0.1;
__id56_.sensor = false;
try {
__id56_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id59__PartenonHeader_Physics_1(){
try {
__id59_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id59_.categoryBits = 1;
__id59_.colgroup = 0;
__id59_.density = 0;
__id59_.friction = 1;
__id59_.maskBits = 0xFFFF;
__id59_.restitution = 0.1;
__id59_.sensor = false;
try {
__id59_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id55__PartenonHeader_Physics_1(){
try {
__id55_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id55_.categoryBits = 1;
__id55_.colgroup = 0;
__id55_.density = 0;
__id55_.friction = 1;
__id55_.maskBits = 0xFFFF;
__id55_.restitution = 0.1;
__id55_.sensor = false;
try {
__id55_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 206
//ParthenonBase (ParthenonBase)
package {
import Game.*;
public dynamic class ParthenonBase extends MWBody {
public var __id50_:RectShape;
public var __id49_:RectShape;
public function ParthenonBase(){
addFrameScript(0, frame1);
__setProp___id50__ParthenonBase_Physics_1();
__setProp___id49__ParthenonBase_Physics_1();
}
function __setProp___id50__ParthenonBase_Physics_1(){
try {
__id50_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id50_.categoryBits = 1;
__id50_.colgroup = 0;
__id50_.density = 0;
__id50_.friction = 1;
__id50_.maskBits = 0xFFFF;
__id50_.restitution = 0.1;
__id50_.sensor = false;
try {
__id50_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id49__ParthenonBase_Physics_1(){
try {
__id49_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id49_.categoryBits = 1;
__id49_.colgroup = 0;
__id49_.density = 0;
__id49_.friction = 1;
__id49_.maskBits = 0xFFFF;
__id49_.restitution = 0.1;
__id49_.sensor = false;
try {
__id49_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
}
}//package
Section 207
//Pin (Pin)
package {
import Box2DIntegration.*;
public dynamic class Pin extends b2iRevoluteJoint {
public function Pin(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 208
//Piramide (Piramide)
package {
import Game.*;
public dynamic class Piramide extends MWBody {
public var __id28_:RectShape;
public var __id29_:RectShape;
public var __id33_:RectShape;
public var __id32_:RectShape;
public var __id34_:RectShape;
public var __id30_:RectShape;
public var __id31_:RectShape;
public function Piramide(){
addFrameScript(0, frame1);
__setProp___id31__Piramide_Physics_1();
__setProp___id34__Piramide_Physics_1();
__setProp___id32__Piramide_Physics_1();
__setProp___id33__Piramide_Physics_1();
__setProp___id28__Piramide_Physics_1();
__setProp___id29__Piramide_Physics_1();
__setProp___id30__Piramide_Physics_1();
}
function __setProp___id33__Piramide_Physics_1(){
try {
__id33_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id33_.categoryBits = 1;
__id33_.colgroup = 0;
__id33_.density = 0;
__id33_.friction = 1;
__id33_.maskBits = 0xFFFF;
__id33_.restitution = 0.1;
__id33_.sensor = false;
try {
__id33_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id29__Piramide_Physics_1(){
try {
__id29_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id29_.categoryBits = 1;
__id29_.colgroup = 0;
__id29_.density = 0;
__id29_.friction = 1;
__id29_.maskBits = 0xFFFF;
__id29_.restitution = 0.1;
__id29_.sensor = false;
try {
__id29_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id30__Piramide_Physics_1(){
try {
__id30_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id30_.categoryBits = 1;
__id30_.colgroup = 0;
__id30_.density = 0;
__id30_.friction = 1;
__id30_.maskBits = 0xFFFF;
__id30_.restitution = 0.1;
__id30_.sensor = false;
try {
__id30_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id34__Piramide_Physics_1(){
try {
__id34_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id34_.categoryBits = 1;
__id34_.colgroup = 0;
__id34_.density = 0;
__id34_.friction = 1;
__id34_.maskBits = 0xFFFF;
__id34_.restitution = 0.1;
__id34_.sensor = false;
try {
__id34_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id32__Piramide_Physics_1(){
try {
__id32_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id32_.categoryBits = 1;
__id32_.colgroup = 0;
__id32_.density = 0;
__id32_.friction = 1;
__id32_.maskBits = 0xFFFF;
__id32_.restitution = 0.1;
__id32_.sensor = false;
try {
__id32_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id28__Piramide_Physics_1(){
try {
__id28_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id28_.categoryBits = 1;
__id28_.colgroup = 0;
__id28_.density = 0;
__id28_.friction = 1;
__id28_.maskBits = 0xFFFF;
__id28_.restitution = 0.1;
__id28_.sensor = false;
try {
__id28_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id31__Piramide_Physics_1(){
try {
__id31_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id31_.categoryBits = 1;
__id31_.colgroup = 0;
__id31_.density = 0;
__id31_.friction = 1;
__id31_.maskBits = 0xFFFF;
__id31_.restitution = 0.1;
__id31_.sensor = false;
try {
__id31_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 209
//Piston (Piston)
package {
import Game.*;
public dynamic class Piston extends MWBody {
public var __id240_:RectShape;
public var __id241_:RectShape;
public var __id239_:RectShape;
public function Piston(){
addFrameScript(0, frame1);
__setProp___id240__Piston_Physics_1();
__setProp___id241__Piston_Physics_1();
__setProp___id239__Piston_Physics_1();
}
function __setProp___id239__Piston_Physics_1(){
try {
__id239_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id239_.categoryBits = 1;
__id239_.colgroup = 0;
__id239_.density = 0.5;
__id239_.friction = 0.2;
__id239_.maskBits = 0xFFFF;
__id239_.restitution = 0;
__id239_.sensor = false;
try {
__id239_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canDestroy = false;
this.canPin = true;
}
function __setProp___id241__Piston_Physics_1(){
try {
__id241_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id241_.categoryBits = 1;
__id241_.colgroup = 0;
__id241_.density = 0.5;
__id241_.friction = 0.2;
__id241_.maskBits = 0xFFFF;
__id241_.restitution = 0;
__id241_.sensor = false;
try {
__id241_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id240__Piston_Physics_1(){
try {
__id240_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id240_.categoryBits = 1;
__id240_.colgroup = 0;
__id240_.density = 0.5;
__id240_.friction = 0.2;
__id240_.maskBits = 0xFFFF;
__id240_.restitution = 0;
__id240_.sensor = false;
try {
__id240_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 210
//Pizo (Pizo)
package {
import Game.*;
public dynamic class Pizo extends MWBody {
public var __id0_:RectShape;
public function Pizo(){
addFrameScript(0, frame1);
__setProp___id0__Pizo_Layer1_1();
}
function frame1(){
this.canPin = false;
this.canDestroy = false;
this.visible = false;
}
function __setProp___id0__Pizo_Layer1_1(){
try {
__id0_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id0_.categoryBits = 1;
__id0_.colgroup = 0;
__id0_.density = 0;
__id0_.friction = 0.5;
__id0_.maskBits = 0xFFFF;
__id0_.restitution = 0.2;
__id0_.sensor = false;
try {
__id0_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 211
//PizoCirculo (PizoCirculo)
package {
import Game.*;
public dynamic class PizoCirculo extends MWBody {
public var __id40_:CircleShape;
public function PizoCirculo(){
addFrameScript(0, frame1);
__setProp___id40__PizoCirculo_Layer1_1();
}
function frame1(){
this.canPin = false;
this.canDestroy = false;
this.visible = false;
}
function __setProp___id40__PizoCirculo_Layer1_1(){
try {
__id40_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id40_.categoryBits = 1;
__id40_.colgroup = 0;
__id40_.density = 0;
__id40_.friction = 0.5;
__id40_.maskBits = 0xFFFF;
__id40_.restitution = 0.2;
__id40_.sensor = false;
try {
__id40_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 212
//Puff (Puff)
package {
import flash.display.*;
public dynamic class Puff extends MovieClip {
public function Puff(){
addFrameScript(20, frame21);
}
function frame21(){
stop();
if (this.parent){
this.parent.removeChild(this);
};
}
}
}//package
Section 213
//Rails (Rails)
package {
import Game.*;
public dynamic class Rails extends MWBody {
public var __id201_:RectShape;
public var __id200_:RectShape;
public var __id202_:RectShape;
public function Rails(){
addFrameScript(0, frame1);
__setProp___id202__Rails_Physics_1();
__setProp___id200__Rails_Physics_1();
__setProp___id201__Rails_Physics_1();
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id201__Rails_Physics_1(){
try {
__id201_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id201_.categoryBits = 1;
__id201_.colgroup = 0;
__id201_.density = 2;
__id201_.friction = 0;
__id201_.maskBits = 0xFFFF;
__id201_.restitution = 0.2;
__id201_.sensor = false;
try {
__id201_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id200__Rails_Physics_1(){
try {
__id200_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id200_.categoryBits = 1;
__id200_.colgroup = 0;
__id200_.density = 2;
__id200_.friction = 0;
__id200_.maskBits = 0xFFFF;
__id200_.restitution = 0.2;
__id200_.sensor = false;
try {
__id200_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id202__Rails_Physics_1(){
try {
__id202_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id202_.categoryBits = 1;
__id202_.colgroup = 0;
__id202_.density = 3;
__id202_.friction = 0;
__id202_.maskBits = 0xFFFF;
__id202_.restitution = 0.2;
__id202_.sensor = false;
try {
__id202_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 214
//RailSlip (RailSlip)
package {
import Game.*;
public dynamic class RailSlip extends MWBody {
public var __id210_:RectShape;
public function RailSlip(){
addFrameScript(0, frame1);
__setProp___id210__RailSlip_Physics_1();
}
function frame1(){
this.canDestroy = false;
this.canPin = false;
}
function __setProp___id210__RailSlip_Physics_1(){
try {
__id210_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id210_.categoryBits = 1;
__id210_.colgroup = 0;
__id210_.density = 2;
__id210_.friction = 0;
__id210_.maskBits = 0xFFFF;
__id210_.restitution = 0.2;
__id210_.sensor = false;
try {
__id210_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 215
//RectShape (RectShape)
package {
import Box2DIntegration.*;
public dynamic class RectShape extends b2iBoxShape {
public function RectShape(){
addFrameScript(0, frame1);
}
function frame1(){
this.visible = false;
stop();
}
}
}//package
Section 216
//RevJoint (RevJoint)
package {
import Box2DIntegration.*;
public dynamic class RevJoint extends b2iRevoluteJoint {
public function RevJoint(){
addFrameScript(0, frame1);
}
function frame1(){
this.visible = false;
}
}
}//package
Section 217
//ScoreScreen (ScoreScreen)
package {
import flash.geom.*;
import flash.display.*;
import flash.utils.*;
import flash.events.*;
import Game.*;
import com.adobe.crypto.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class ScoreScreen extends MovieClip {
public var loader:URLLoader;
public var backToMenuT:Timer;
public var bnext:SimpleButton;
public var loadStatus:int;
public var rollingCredits:MovieClip;
public var time:TextField;
public var more_games_button:SimpleButton;
public var SENDING:int;
public var levelScore:TextField;
public var SENT:int;
public var level_score_tf:TextField;
public var linksXRow:int;
public var NOT_SENT:int;
public var crayonad:MovieClip;
public var name_f:TextField;
public var totalScore:TextField;
public var links:MovieClip;
public var bsendScore:MovieClip;
public var linkList:Array;
public var goToThankYouT:Timer;
public var blevelselect:SimpleButton;
public var thanksTimer:Timer;
public var numshapes:TextField;
public function ScoreScreen(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
public function removeListeners():void{
loader.removeEventListener(Event.COMPLETE, completeHandler);
loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
loader.removeEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}
public function fsendScore(_arg1:Event){
switch (loadStatus){
case NOT_SENT:
sendScore();
break;
case SENT:
navigateToURL(new URLRequest((("http://www.bubblebox.com/highscores/" + Globals.gameID) + ".htm")), "_blank");
break;
case SENDING:
break;
};
}
public function failed():void{
removeListeners();
showFailedMessage();
loadStatus = NOT_SENT;
bsendScore.gotoAndStop("send");
}
public function nextLevel(_arg1:Event){
Globals.currentLevel++;
Globals.gameState = Globals.GAME_RESTART;
this.parent.removeChild(this);
}
function frame4(){
}
function frame5(){
stop();
addEventListener(Event.ENTER_FRAME, rollCredits, false, 0, true);
}
function frame6(){
stop();
crayonad.alpha = 0;
addEventListener(Event.ENTER_FRAME, fadeInAd, false, 0, true);
crayonad.crayonLink1.addEventListener(MouseEvent.CLICK, onMouseClick2);
}
function frame1(){
stop();
NOT_SENT = 1;
SENDING = 2;
SENT = 3;
loader = new URLLoader();
loadStatus = NOT_SENT;
more_games_button.addEventListener(MouseEvent.CLICK, moreGamesLink, false, 0, true);
setup();
}
function frame3(){
stop();
goToThankYouT = new Timer(10000, 1);
goToThankYouT.addEventListener(TimerEvent.TIMER_COMPLETE, goToThankYou, false, 0, true);
goToThankYouT.start();
}
public function ioErrorHandler(_arg1:IOErrorEvent):void{
failed();
}
public function fadeCredits(_arg1:Event){
rollingCredits.alpha = (rollingCredits.alpha - 0.02);
if (rollingCredits.alpha < 0.1){
removeEventListener(Event.ENTER_FRAME, fadeCredits);
gotoAndStop("crayoncredit");
};
}
public function setup(){
if (Globals.currentLevel == (Globals.numLevels - 1)){
bnext.visible = false;
};
if (firstTimeCompletedAll()){
Globals.savedData.data.hasWon = true;
bnext.visible = false;
blevelselect.visible = false;
bsendScore.visible = false;
more_games_button.visible = false;
thanksTimer = new Timer(3000, 1);
thanksTimer.addEventListener(TimerEvent.TIMER_COMPLETE, goThankYou, false, 0, true);
thanksTimer.start();
} else {
bnext.addEventListener(MouseEvent.CLICK, nextLevel, false, 0, true);
blevelselect.addEventListener(MouseEvent.CLICK, flevelSelect, false, 0, true);
bsendScore.addEventListener(MouseEvent.CLICK, fsendScore, false, 0, true);
};
numshapes.mouseEnabled = false;
name_f.mouseEnabled = false;
}
public function moreGamesLink(_arg1:Event){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1285&subid=scorescreen");
navigateToURL(_local2);
}
function frame2(){
stop();
linksXRow = 7;
linkList = [];
refreshLinks();
level_score_tf.text = "";
level_score_tf.mouseEnabled = false;
}
public function fadeInAd(_arg1:Event){
crayonad.alpha = (crayonad.alpha + 0.05);
if (crayonad.alpha >= 0.95){
removeEventListener(Event.ENTER_FRAME, fadeInAd);
backToMenuT = new Timer(18000, 1);
backToMenuT.addEventListener(TimerEvent.TIMER_COMPLETE, goBackToMenu, false, 0, true);
backToMenuT.start();
};
}
public function showFailedMessage(){
}
public function updateScoreField(_arg1:MouseEvent){
var _local2:int;
var _local3:int;
_local2 = (int(_arg1.currentTarget.levelname.text) - 1);
_local3 = Globals.savedData.data.levelScores[_local2];
if (_local3 > 0){
level_score_tf.text = ("" + _local3);
} else {
level_score_tf.text = "0";
};
}
public function goBackToMenu(_arg1:Event){
backToMenuT.removeEventListener(TimerEvent.TIMER_COMPLETE, goBackToMenu);
Globals.gameState = Globals.GAME_BACK_TO_MENU;
this.parent.removeChild(this);
}
public function removeLinkListeners(){
var _local1:LevelLink;
for each (_local1 in linkList) {
_local1.removeEventListener(MouseEvent.CLICK, selectLevel);
_local1.removeEventListener(MouseEvent.MOUSE_OVER, updateScoreField);
};
linkList = [];
}
public function onMouseClick2(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.crayonphysics.com/");
navigateToURL(_local2, "_blank");
}
public function rollCredits(_arg1:Event){
rollingCredits.y = (rollingCredits.y - 2);
if (rollingCredits.y < -899){
removeEventListener(Event.ENTER_FRAME, rollCredits);
addEventListener(Event.ENTER_FRAME, fadeCredits, false, 0, true);
};
}
public function goToThankYou(_arg1:Event){
goToThankYouT.removeEventListener(TimerEvent.TIMER_COMPLETE, goToThankYou);
gotoAndPlay("credits");
}
public function flevelSelect(_arg1:Event){
this.gotoAndStop("levelSelect");
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
failed();
}
public function refreshLinks(){
var _local1:LevelLink;
var _local2:int;
if (links){
removeChild(links);
};
links = new MovieClip();
_local2 = 1;
while (_local2 < Globals.numLevels) {
_local1 = new LevelLink();
_local1.levelname.text = ("" + _local2);
_local1.y = (Math.floor(((_local2 - 1) / linksXRow)) * 60);
_local1.x = (((_local2 - 1) % linksXRow) * 50);
_local1.addEventListener(MouseEvent.CLICK, selectLevel, false, 0, true);
_local1.addEventListener(MouseEvent.MOUSE_OVER, updateScoreField, false, 0, true);
linkList.push(_local1);
links.addChild(_local1);
if (Globals.savedData.data.levelScores[(_local2 - 1)] >= 0){
_local1.gotoAndStop("check");
};
_local2++;
};
links.y = 150;
links.x = 220;
addChild(links);
}
public function firstTimeCompletedAll():Boolean{
var _local1:Array;
var _local2:int;
if (Globals.savedData.data.hasWon){
return (false);
};
_local1 = Globals.savedData.data.levelScores;
_local2 = 0;
while (_local2 < (Globals.numLevels - 1)) {
if (_local1[_local2] <= 0){
return (false);
};
_local2++;
};
return (true);
}
public function completeHandler(_arg1:Event):void{
loadStatus = SENT;
Globals.savedData.data.bestScoreSent = Globals.savedData.data.bestScore;
removeListeners();
bsendScore.gotoAndStop("view");
}
public function goThankYou(_arg1:Event){
thanksTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, goThankYou);
gotoAndStop("completed");
}
public function selectLevel(_arg1:MouseEvent){
var _local2:int;
_local2 = int(_arg1.currentTarget.levelname.text);
removeLinkListeners();
this.parent.removeChild(this);
Globals.currentLevel = _local2;
Globals.gameState = Globals.GAME_RESTART;
removeChild(links);
links = null;
}
public function sendScore(){
var _local1:int;
var _local2:String;
var _local3:String;
var _local4:URLVariables;
var _local5:String;
var _local6:URLRequest;
_local1 = Globals.savedData.data.bestScore;
_local2 = Globals.savedData.data.player_name;
_local3 = ((((((((((Globals.gameID + "_") + "4234232143214421") + "_") + _local1) + "_") + "2537625476251") + "_") + _local2) + "_") + "desleutelistessa");
_local4 = new URLVariables();
_local4.datastring = ((((Globals.gameID + "_") + _local1) + "_") + _local2);
_local4.hashstring = MD5.hash(_local3);
_local5 = "http://www.bubblebox.com/scripts/insertscore2008.php";
_local6 = new URLRequest(_local5);
_local6.data = _local4;
_local6.method = URLRequestMethod.POST;
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, completeHandler, false, 0, true);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler, false, 0, true);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);
loader.load(_local6);
loadStatus = SENDING;
}
}
}//package
Section 218
//Sphinx (Sphinx)
package {
import flash.display.*;
public dynamic class Sphinx extends MovieClip {
}
}//package
Section 219
//Torre (Torre)
package {
import Game.*;
public dynamic class Torre extends MWBody {
public var __id67_:RectShape;
public var __id68_:RectShape;
public var __id72_:RectShape;
public var __id69_:RectShape;
public var __id70_:RectShape;
public var __id71_:RectShape;
public function Torre(){
addFrameScript(0, frame1);
__setProp___id69__Torre_object_1();
__setProp___id72__Torre_object_1();
__setProp___id70__Torre_object_1();
__setProp___id67__Torre_object_1();
__setProp___id71__Torre_object_1();
__setProp___id68__Torre_object_1();
}
function frame1(){
this.canPin = false;
this.canDestroy = false;
}
function __setProp___id67__Torre_object_1(){
try {
__id67_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id67_.categoryBits = 1;
__id67_.colgroup = 0;
__id67_.density = 0;
__id67_.friction = 1;
__id67_.maskBits = 0xFFFF;
__id67_.restitution = 0.1;
__id67_.sensor = false;
try {
__id67_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id68__Torre_object_1(){
try {
__id68_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id68_.categoryBits = 1;
__id68_.colgroup = 0;
__id68_.density = 0;
__id68_.friction = 1;
__id68_.maskBits = 0xFFFF;
__id68_.restitution = 0.1;
__id68_.sensor = false;
try {
__id68_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id69__Torre_object_1(){
try {
__id69_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id69_.categoryBits = 1;
__id69_.colgroup = 0;
__id69_.density = 0;
__id69_.friction = 1;
__id69_.maskBits = 0xFFFF;
__id69_.restitution = 0.1;
__id69_.sensor = false;
try {
__id69_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id70__Torre_object_1(){
try {
__id70_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id70_.categoryBits = 1;
__id70_.colgroup = 0;
__id70_.density = 0;
__id70_.friction = 1;
__id70_.maskBits = 0xFFFF;
__id70_.restitution = 0.1;
__id70_.sensor = false;
try {
__id70_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id71__Torre_object_1(){
try {
__id71_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id71_.categoryBits = 1;
__id71_.colgroup = 0;
__id71_.density = 0;
__id71_.friction = 1;
__id71_.maskBits = 0xFFFF;
__id71_.restitution = 0.1;
__id71_.sensor = false;
try {
__id71_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id72__Torre_object_1(){
try {
__id72_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id72_.categoryBits = 1;
__id72_.colgroup = 0;
__id72_.density = 0;
__id72_.friction = 1;
__id72_.maskBits = 0xFFFF;
__id72_.restitution = 0.1;
__id72_.sensor = false;
try {
__id72_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 220
//Trencito (Trencito)
package {
import Game.*;
public dynamic class Trencito extends MWBody {
public var __id221_:RectShape;
public var __id223_:RectShape;
public var __id224_:CircleShape;
public var __id218_:RectShape;
public var __id222_:RectShape;
public var __id225_:RectShape;
public var __id219_:RectShape;
public var __id220_:RectShape;
public function Trencito(){
addFrameScript(0, frame1);
__setProp___id218__Trencito_Physics_1();
__setProp___id221__Trencito_Physics_1();
__setProp___id220__Trencito_Physics_1();
__setProp___id219__Trencito_Physics_1();
__setProp___id225__Trencito_Physics_1();
__setProp___id223__Trencito_Physics_1();
__setProp___id224__Trencito_Physics_1();
__setProp___id222__Trencito_Physics_1();
}
function __setProp___id223__Trencito_Physics_1(){
try {
__id223_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id223_.categoryBits = 1;
__id223_.colgroup = 0;
__id223_.density = 1;
__id223_.friction = 0.3;
__id223_.maskBits = 0xFFFF;
__id223_.restitution = 0.2;
__id223_.sensor = false;
try {
__id223_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id221__Trencito_Physics_1(){
try {
__id221_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id221_.categoryBits = 1;
__id221_.colgroup = 0;
__id221_.density = 1;
__id221_.friction = 0.3;
__id221_.maskBits = 0xFFFF;
__id221_.restitution = 0.2;
__id221_.sensor = false;
try {
__id221_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id225__Trencito_Physics_1(){
try {
__id225_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id225_.categoryBits = 1;
__id225_.colgroup = 0;
__id225_.density = 1;
__id225_.friction = 0.3;
__id225_.maskBits = 0xFFFF;
__id225_.restitution = 0.2;
__id225_.sensor = false;
try {
__id225_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
this.canPin = false;
this.canDestroy = false;
}
function __setProp___id219__Trencito_Physics_1(){
try {
__id219_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id219_.categoryBits = 1;
__id219_.colgroup = 0;
__id219_.density = 1;
__id219_.friction = 0.3;
__id219_.maskBits = 0xFFFF;
__id219_.restitution = 0.2;
__id219_.sensor = false;
try {
__id219_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id222__Trencito_Physics_1(){
try {
__id222_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id222_.categoryBits = 1;
__id222_.colgroup = 0;
__id222_.density = 1;
__id222_.friction = 0.3;
__id222_.maskBits = 0xFFFF;
__id222_.restitution = 0.2;
__id222_.sensor = false;
try {
__id222_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id220__Trencito_Physics_1(){
try {
__id220_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id220_.categoryBits = 1;
__id220_.colgroup = 0;
__id220_.density = 1;
__id220_.friction = 0.3;
__id220_.maskBits = 0xFFFF;
__id220_.restitution = 0.2;
__id220_.sensor = false;
try {
__id220_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id224__Trencito_Physics_1(){
try {
__id224_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id224_.categoryBits = 1;
__id224_.colgroup = 0;
__id224_.density = 1;
__id224_.friction = 0.1;
__id224_.maskBits = 0xFFFF;
__id224_.restitution = 0;
__id224_.sensor = false;
try {
__id224_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id218__Trencito_Physics_1(){
try {
__id218_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id218_.categoryBits = 1;
__id218_.colgroup = 0;
__id218_.density = 1;
__id218_.friction = 0.3;
__id218_.maskBits = 0xFFFF;
__id218_.restitution = 0.2;
__id218_.sensor = false;
try {
__id218_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package