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 = 0xFFFF;
public static const b2_invalid:uint = 0xFFFF;
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.Common.Math.*;
import Box2D.Collision.Shapes.*;
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.Common.Math.*;
import Box2D.Collision.Shapes.*;
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.Common.Math.*;
import Box2D.Collision.Shapes.*;
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 {
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 = 0xFFFF;
public static var e_pairBuffered:uint = 1;
public static var b2_nullProxy:uint = 0xFFFF;
public static var b2_tableCapacity:int = 4096;
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.Common.Math.*;
import Box2D.Collision.Shapes.*;
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 = 0.0349065850398866;
public static const b2_linearSlop:Number = 0.005;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_maxProxies:int = 0x0200;
public static const b2_maxAngularVelocitySquared:Number = 62500;
public static const b2_maxPolygonVertices:int = 8;
public static const b2_velocityThreshold:Number = 1;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_maxPairs:int = 4096;
public static const b2_maxTOIContactsPerIsland:int = 32;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_maxAngularVelocity:Number = 250;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
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.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
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.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
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.Common.Math.*;
import Box2D.Collision.Shapes.*;
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.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
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.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
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.Common.Math.*;
import Box2D.Collision.Shapes.*;
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.Common.Math.*;
import Box2D.Collision.Shapes.*;
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.Common.Math.*;
import Box2D.Collision.Shapes.*;
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 flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
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;// = 8
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 = 8;
m_alpha = 1;
m_fillAlpha = 1;
m_xformScale = 1;
super();
m_drawFlags = 0;
}
public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color, _arg4:int=0):void{
var _local5:int;
m_sprite.graphics.lineStyle(m_lineThickness, _arg4, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha);
_local5 = 1;
while (_local5 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local5].x * m_drawScale), (_arg1[_local5].y * m_drawScale));
_local5++;
};
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 * 4), _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_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();
}
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 * 4), _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.Collision.*;
import Box2D.Dynamics.Joints.*;
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:Number;
var _local9:b2ContactSolver;
var _local10:b2Vec2;
var _local11:UserData;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:int;
var _local16:Boolean;
var _local17:Boolean;
var _local18:Boolean;
var _local19:Number;
var _local20:Number;
var _local21:Number;
_local8 = _arg2.Length();
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local10 = new b2Vec2(_arg2.x, _arg2.y);
_local11 = (_local6.GetUserData() as UserData);
if (_local11._helium){
_local10.x = -(_arg2.x);
_local10.y = -(_arg2.y);
} else {
if (_local11._directedGravity){
_local12 = _local6.GetAngle();
_local12 = (_local12 + (Math.PI * 1.5));
_local13 = -(Math.cos(_local12));
_local14 = -(Math.sin(_local12));
_local10.x = (_local13 * _local8);
_local10.y = (_local14 * _local8);
};
};
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_local10.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_local10.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++;
};
_local9 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local9.InitVelocityConstraints(_arg1);
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitVelocityConstraints(_arg1);
_local5++;
};
_local5 = 0;
while (_local5 < _arg1.maxIterations) {
_local9.SolveVelocityConstraints();
_local15 = 0;
while (_local15 < m_jointCount) {
_local7 = m_joints[_local15];
_local7.SolveVelocityConstraints(_arg1);
_local15++;
};
_local5++;
};
_local9.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) {
_local16 = _local9.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local17 = true;
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local18 = _local7.SolvePositionConstraints();
_local17 = ((_local17) && (_local18));
_local5++;
};
if (((_local16) && (_local17))){
break;
};
m_positionIterationCount++;
};
};
Report(_local9.m_constraints);
if (_arg4){
_local19 = Number.MAX_VALUE;
_local20 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local21 = (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;
_local19 = 0;
};
if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local21)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local20)))){
_local6.m_sleepTime = 0;
_local19 = 0;
} else {
_local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt);
_local19 = b2Math.b2Min(_local19, _local6.m_sleepTime);
};
};
_local5++;
};
if (_local19 >= 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.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Joints.*;
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:UserData;
var _local17:Number;
var _local18: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();
for (;_local4;(_local4 = _local4.m_next)) {
if (_local3.m_userData != null){
_local16 = (_local3.m_userData as UserData);
if ((((_local16._sprite == null)) && (!(_local16._invisible)))){
if (_local16._iD == 56){
DrawShape(_local4, _local11, new b2Color((0 / 0xFF), (0xFF / 0xFF), (0xFF / 0xFF)), _local15);
} else {
if (_local16._iD == 72){
DrawShape(_local4, _local11, new b2Color(((_local16._color & 0xFF) / 0xFF), (((_local16._color >> 8) & 0xFF) / 0xFF), (((_local16._color >> 16) & 0xFF) / 0xFF)), _local15);
} else {
if (_local16._iD == 73){
DrawShapeBorders(_local4, _local11, new b2Color(((_local16._color & 0xFF) / 0xFF), (((_local16._color >> 8) & 0xFF) / 0xFF), (((_local16._color >> 16) & 0xFF) / 0xFF)), _local15);
} else {
if (_local16._iD == 74){
_local17 = m_debugDraw.m_alpha;
_local18 = m_debugDraw.m_fillAlpha;
m_debugDraw.m_alpha = _local16._alpha;
m_debugDraw.m_fillAlpha = _local16._alpha;
DrawShape(_local4, _local11, new b2Color(((_local16._color & 0xFF) / 0xFF), (((_local16._color >> 8) & 0xFF) / 0xFF), (((_local16._color >> 16) & 0xFF) / 0xFF)), _local15);
m_debugDraw.m_alpha = _local17;
m_debugDraw.m_fillAlpha = _local18;
} else {
if (_local16._iD == 75){
DrawShapeBorders(_local4, _local11, new b2Color(((_local16._color & 0xFF) / 0xFF), (((_local16._color >> 8) & 0xFF) / 0xFF), (((_local16._color >> 16) & 0xFF) / 0xFF)), _local15);
} else {
if (_local16._iD == 76){
DrawShapeBorders(_local4, _local11, new b2Color(((_local16._color & 0xFF) / 0xFF), (((_local16._color >> 8) & 0xFF) / 0xFF), (((_local16._color >> 16) & 0xFF) / 0xFF)), _local15);
} else {
if (_local16._iD == 77){
DrawShapeBorders(_local4, _local11, new b2Color(((_local16._color & 0xFF) / 0xFF), (((_local16._color >> 8) & 0xFF) / 0xFF), (((_local16._color >> 16) & 0xFF) / 0xFF)), _local15);
} else {
if (_local16._iD == 101){
DrawShape(_local4, _local11, new b2Color((192 / 0xFF), (139 / 0xFF), (68 / 0xFF)), _local15);
} else {
if (_local16._iD == 102){
_local17 = m_debugDraw.m_alpha;
_local18 = m_debugDraw.m_fillAlpha;
m_debugDraw.m_alpha = _local16._alpha;
m_debugDraw.m_fillAlpha = _local16._alpha;
DrawShape(_local4, _local11, new b2Color((233 / 0xFF), (233 / 0xFF), (233 / 0xFF)), _local15);
m_debugDraw.m_alpha = _local17;
m_debugDraw.m_fillAlpha = _local18;
} else {
DrawShape(_local4, _local11, new b2Color((0 / 0xFF), (0 / 0xFF), (0 / 0xFF)), _local15);
};
};
};
};
};
};
};
};
};
};
continue;
} else {
if (_local3.IsStatic()){
DrawShape(_local4, _local11, new b2Color((0 / 0xFF), (0 / 0xFF), (0 / 0xFF)), _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);
};
};
};
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_jointBit)){
_local5 = m_jointList;
while (_local5) {
if (_local5.m_type == b2Joint.e_mouseJoint){
DrawJoint(_local5);
};
_local5 = _local5.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 DrawShapeSolidBorders(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean, _arg5:int=0):void{
var _local6:int;
var _local7:b2PolygonShape;
var _local8:int;
var _local9:Array;
var _local10:Array;
var _local11:Array;
switch (_arg1.m_type){
case b2Shape.e_polygonShape:
_local7 = (_arg1 as b2PolygonShape);
_local8 = _local7.GetVertexCount();
_local9 = _local7.GetVertices();
_local10 = new Array(b2Settings.b2_maxPolygonVertices);
_local11 = _local7.GetCoreVertices();
_local6 = 0;
while (_local6 < _local8) {
_local10[_local6] = b2Math.b2MulX(_arg2, _local11[_local6]);
_local6++;
};
m_debugDraw.DrawSolidPolygon(_local10, _local8, _arg3, _arg5);
break;
};
}
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 DrawShapeBorders(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{
var _local5:b2CircleShape;
var _local6:b2Vec2;
var _local7:Number;
var _local8:b2Vec2;
var _local9:int;
var _local10:b2PolygonShape;
var _local11:int;
var _local12:Array;
var _local13:Array;
var _local14:Array;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local5 = (_arg1 as b2CircleShape);
_local6 = b2Math.b2MulX(_arg2, _local5.m_localPosition);
_local7 = _local5.m_radius;
_local8 = _arg2.R.col1;
m_debugDraw.DrawCircle(_local6, (_local7 - b2Settings.b2_toiSlop), _arg3);
break;
case b2Shape.e_polygonShape:
_local10 = (_arg1 as b2PolygonShape);
_local11 = _local10.GetVertexCount();
_local12 = _local10.GetVertices();
_local13 = new Array(b2Settings.b2_maxPolygonVertices);
_local14 = _local10.GetCoreVertices();
_local9 = 0;
while (_local9 < _local11) {
_local13[_local9] = b2Math.b2MulX(_arg2, _local14[_local9]);
_local9++;
};
m_debugDraw.DrawPolygon(_local13, _local11, _arg3);
break;
};
}
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
//FpsCounter (General.FpsCounter)
package General {
import flash.display.*;
import flash.text.*;
import flash.system.*;
import flash.utils.*;
public class FpsCounter extends Sprite {
private var oldT:uint;
private var mfpsCount:int;// = 0
private var avgCount:int;// = 30
private var avgCount2:int;// = 30
private var textBox:TextField;
private var mfpsCount2:int;// = 0
private var textBox3:TextField;
private var textBox2:TextField;
public function FpsCounter(){
mfpsCount = 0;
mfpsCount2 = 0;
avgCount = 30;
avgCount2 = 30;
super();
textBox = new TextField();
textBox.text = "...";
textBox.textColor = 11145540;
textBox.selectable = false;
textBox2 = new TextField();
textBox2.text = "...";
textBox2.width = 150;
textBox2.textColor = 11145540;
textBox2.selectable = false;
textBox2.y = 15;
textBox3 = new TextField();
textBox3.text = "...";
textBox3.textColor = 11145540;
textBox3.selectable = false;
textBox3.y = 30;
oldT = getTimer();
addChild(textBox);
addChild(textBox2);
addChild(textBox3);
}
public function updateEnd():void{
}
public function updatePhys(_arg1:uint):void{
var _local2:uint;
var _local3:uint;
_local2 = getTimer();
_local3 = (_local2 - _arg1);
mfpsCount2 = (mfpsCount2 + _local3);
if (avgCount2 < 1){
textBox2.text = String((((("Physics step: " + Math.round((mfpsCount2 / 30))) + " ms (") + Math.round((1000 / (mfpsCount2 / 30)))) + " fps)"));
avgCount2 = 30;
mfpsCount2 = 0;
};
avgCount2--;
}
public function update():void{
var _local1:uint;
var _local2:uint;
_local1 = getTimer();
_local2 = (_local1 - oldT);
mfpsCount = (mfpsCount + _local2);
if (avgCount < 1){
textBox.text = String((Math.round((1000 / (mfpsCount / 30))) + " fps average"));
avgCount = 30;
mfpsCount = 0;
};
avgCount--;
oldT = getTimer();
textBox3.text = (Math.round((System.totalMemory / (0x0400 * 0x0400))) + " MB used");
}
}
}//package General
Section 76
//FRateLimiter (General.FRateLimiter)
package General {
import flash.utils.*;
public class FRateLimiter {
private static var newT:uint = oldT;
private static var oldT:uint = getTimer();
public static function limitFrame(_arg1:uint):void{
var _local2:uint;
_local2 = (1000 / _arg1);
while (Math.abs((newT - oldT)) < _local2) {
newT = getTimer();
};
oldT = getTimer();
}
}
}//package General
Section 77
//Input (General.Input)
package General {
import flash.display.*;
import flash.events.*;
public class Input extends Sprite {
private static var keyArr:Array;
public static var mousseX:Number = -10000;
public static var mousseY:Number = -10000;
public static var mouseReleased:Boolean = false;
public static var mouseScreenY:Number = 0;
public static var mouseScreenX:Number = 0;
public static var mouseDragY:Number = 0;
public static var mouseOver:Boolean = false;
public static var mouseDragX:Number = 0;
public static var mouse:Sprite = new Sprite();
public static var m_this:Input = null;
public static var previousEventButtonDown:Boolean = false;
public static var timeSinceLastKey:int = 0;
public static var mousePressed:Boolean = false;
public static var mouseOffsetX:Number = 0;
public static var mouseOffsetY:Number = 0;
public static var ascii:Array;
public static var mouseDownX:Number = 0;
public static var mouseDownY:Number = 0;
public static var previousEventStageX:Number = 0;
public static var previousEventStageY:Number = 0;
private static var bufferSize:int;
public static var m_stageMc:Sprite;
public static var mouseDown:Boolean = false;
public static var lastKey:int = 0;
public static var mouseClicked:Boolean = false;
private static var keyState:Array;
private static var keyBuffer:Array;
public function Input(_arg1:Sprite){
var _local2:int;
super();
m_this = this;
m_stageMc = _arg1;
ascii = new Array(222);
fillAscii();
initKeyState();
bufferSize = 5;
keyBuffer = new Array(bufferSize);
_local2 = 0;
while (_local2 < bufferSize) {
keyBuffer[_local2] = new Array(0, 0);
_local2++;
};
_arg1.stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPress, false, 0, true);
_arg1.stage.addEventListener(KeyboardEvent.KEY_UP, keyRelease, false, 0, true);
_arg1.stage.addEventListener(MouseEvent.MOUSE_DOWN, mousePress, false, 0, true);
_arg1.stage.addEventListener(MouseEvent.MOUSE_UP, mouseRelease, false, 0, true);
_arg1.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove, false, 0, true);
_arg1.stage.addEventListener(Event.MOUSE_LEAVE, mouseLeave, false, 0, true);
mouse.graphics.lineStyle(0.1, 0, 100);
mouse.graphics.moveTo(0, 0);
mouse.graphics.lineTo(0, 0.1);
}
public function mouseLeave(_arg1:Event):void{
mouseReleased = mouseDown;
mouseDown = false;
}
public function mouseMove(_arg1:MouseEvent):void{
if (mouseDown != _arg1.buttonDown){
mouseDown = _arg1.buttonDown;
mouseReleased = !(_arg1.buttonDown);
mousePressed = _arg1.buttonDown;
mouseDragX = 0;
mouseDragY = 0;
};
mouseScreenX = mouseX;
mouseScreenY = mouseY;
mousseX = (_arg1.stageX - m_stageMc.x);
mousseY = (_arg1.stageY - m_stageMc.y);
mouseOffsetX = (mousseX - mouse.x);
mouseOffsetY = (mousseY - mouse.y);
if (mouseDown){
mouseDragX = (mouseDragX + mouseOffsetX);
mouseDragY = (mouseDragY + mouseOffsetY);
};
mouse.x = mousseX;
mouse.y = mousseY;
previousEventButtonDown = _arg1.buttonDown;
previousEventStageX = _arg1.stageX;
previousEventStageY = _arg1.stageY;
}
public function keyPress(_arg1:KeyboardEvent):void{
keyState[_arg1.keyCode] = Math.max(keyState[_arg1.keyCode], 1);
lastKey = _arg1.keyCode;
}
private function fillAscii():void{
ascii[65] = "A";
ascii[66] = "B";
ascii[67] = "C";
ascii[68] = "D";
ascii[69] = "E";
ascii[70] = "F";
ascii[71] = "G";
ascii[72] = "H";
ascii[73] = "I";
ascii[74] = "J";
ascii[75] = "K";
ascii[76] = "L";
ascii[77] = "M";
ascii[78] = "N";
ascii[79] = "O";
ascii[80] = "P";
ascii[81] = "Q";
ascii[82] = "R";
ascii[83] = "S";
ascii[84] = "T";
ascii[85] = "U";
ascii[86] = "V";
ascii[87] = "W";
ascii[88] = "X";
ascii[89] = "Y";
ascii[90] = "Z";
ascii[48] = "0";
ascii[49] = "1";
ascii[50] = "2";
ascii[51] = "3";
ascii[52] = "4";
ascii[53] = "5";
ascii[54] = "6";
ascii[55] = "7";
ascii[56] = "8";
ascii[57] = "9";
ascii[32] = "Spacebar";
ascii[17] = "Ctrl";
ascii[16] = "Shift";
ascii[192] = "~";
ascii[38] = "up";
ascii[40] = "down";
ascii[37] = "left";
ascii[39] = "right";
ascii[96] = "Numpad 0";
ascii[97] = "Numpad 1";
ascii[98] = "Numpad 2";
ascii[99] = "Numpad 3";
ascii[100] = "Numpad 4";
ascii[101] = "Numpad 5";
ascii[102] = "Numpad 6";
ascii[103] = "Numpad 7";
ascii[104] = "Numpad 8";
ascii[105] = "Numpad 9";
ascii[111] = "Numpad /";
ascii[106] = "Numpad *";
ascii[109] = "Numpad -";
ascii[107] = "Numpad +";
ascii[110] = "Numpad .";
ascii[45] = "Insert";
ascii[46] = "Delete";
ascii[33] = "Page Up";
ascii[34] = "Page Down";
ascii[35] = "End";
ascii[36] = "Home";
ascii[112] = "F1";
ascii[113] = "F2";
ascii[114] = "F3";
ascii[115] = "F4";
ascii[116] = "F5";
ascii[117] = "F6";
ascii[118] = "F7";
ascii[119] = "F8";
ascii[188] = ",";
ascii[190] = ".";
ascii[186] = ";";
ascii[222] = "'";
ascii[219] = "[";
ascii[221] = "]";
ascii[189] = "-";
ascii[187] = "+";
ascii[220] = "\\";
ascii[191] = "/";
ascii[9] = "TAB";
ascii[8] = "Backspace";
ascii[27] = "ESC";
}
public function resetMouse():void{
}
public function keyRelease(_arg1:KeyboardEvent):void{
var _local2:int;
keyState[_arg1.keyCode] = -1;
_local2 = (bufferSize - 1);
while (_local2 > 0) {
keyBuffer[_local2] = keyBuffer[(_local2 - 1)];
_local2--;
};
keyBuffer[0] = [_arg1.keyCode, 0];
}
public function mousePress(_arg1:MouseEvent):void{
mousePressed = true;
mouseDown = true;
mouseDragX = 0;
mouseDragY = 0;
mouseDownX = mouse.x;
mouseDownY = mouse.y;
mouseClicked = true;
}
public function mouseMove2():void{
if (mouseDown != previousEventButtonDown){
mouseDown = previousEventButtonDown;
mouseReleased = !(previousEventButtonDown);
mousePressed = previousEventButtonDown;
mouseDragX = 0;
mouseDragY = 0;
};
mouseScreenX = mouseX;
mouseScreenY = mouseY;
mousseX = (previousEventStageX - m_stageMc.x);
mousseY = (previousEventStageY - m_stageMc.y);
mouseOffsetX = (mousseX - mouse.x);
mouseOffsetY = (mousseY - mouse.y);
if (mouseDown){
mouseDragX = (mouseDragX + mouseOffsetX);
mouseDragY = (mouseDragY + mouseOffsetY);
};
mouse.x = mousseX;
mouse.y = mousseY;
}
public static function getKeyHold(_arg1:int):int{
return (Math.max(0, keyState[_arg1]));
}
public static function isKeyPressed(_arg1:int):Boolean{
timeSinceLastKey = 0;
return ((keyState[_arg1] == 1));
}
public static function isKeyDown(_arg1:int):Boolean{
return ((keyState[_arg1] > 0));
}
public static function getKeyString(_arg1:uint):String{
return (ascii[_arg1]);
}
public static function mouseRelease(_arg1:MouseEvent):void{
mouseDown = false;
mouseReleased = true;
mouseDragX = 0;
mouseDragY = 0;
}
public static function isKeyReleased(_arg1:int):Boolean{
return ((keyState[_arg1] == -1));
}
public static function isKeyInBuffer(_arg1:int, _arg2:int, _arg3:int):Boolean{
return ((((keyBuffer[_arg2][0] == _arg1)) && ((keyBuffer[_arg2][1] <= _arg3))));
}
public static function mouseMoveTrigger():void{
m_this.mouseMove2();
}
public static function update():void{
var _local1:int;
var _local2:int;
_local1 = 0;
while (_local1 < keyArr.length) {
if (keyState[keyArr[_local1]] != 0){
var _local3 = keyState;
var _local4 = keyArr[_local1];
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
};
_local1++;
};
_local2 = 0;
while (_local2 < bufferSize) {
_local3 = keyBuffer[_local2];
_local4 = 1;
_local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
_local2++;
};
mouseReleased = false;
mousePressed = false;
mouseOver = false;
}
public static function initKeyState():void{
var _local1:int;
keyState = new Array(222);
keyArr = new Array();
_local1 = 0;
while (_local1 < 222) {
keyState[_local1] = new int(0);
if (ascii[_local1] != undefined){
keyArr.push(_local1);
};
_local1++;
};
}
}
}//package General
Section 78
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "2.0.1.0";
public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 79
//ButtonAsset (mx.core.ButtonAsset)
package mx.core {
public class ButtonAsset extends FlexSimpleButton implements IFlexAsset, IFlexDisplayObject {
private var _measuredWidth:Number;
private var _measuredHeight:Number;
mx_internal static const VERSION:String = "2.0.1.0";
public function ButtonAsset(){
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 80
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "2.0.1.0";
}
}//package mx.core
Section 81
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "2.0.1.0";
public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 82
//FlexMovieClip (mx.core.FlexMovieClip)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexMovieClip extends MovieClip {
mx_internal static const VERSION:String = "2.0.1.0";
public function FlexMovieClip(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 83
//FlexSimpleButton (mx.core.FlexSimpleButton)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexSimpleButton extends SimpleButton {
mx_internal static const VERSION:String = "2.0.1.0";
public function FlexSimpleButton(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 84
//FontAsset (mx.core.FontAsset)
package mx.core {
import flash.text.*;
public class FontAsset extends Font implements IFlexAsset {
mx_internal static const VERSION:String = "2.0.1.0";
}
}//package mx.core
Section 85
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 86
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.display.*;
import flash.events.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function set height(_arg1:Number):void;
function get scaleY():Number;
function move(_arg1:Number, _arg2:Number):void;
function get scaleX():Number;
function set mask(_arg1:DisplayObject):void;
function set scaleX(_arg1:Number):void;
function set name(_arg1:String):void;
function set scaleY(_arg1:Number):void;
function get visible():Boolean;
function get measuredWidth():Number;
function set visible(_arg1:Boolean):void;
function get alpha():Number;
function get height():Number;
function get width():Number;
function get parent():DisplayObjectContainer;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set y(_arg1:Number):void;
function get x():Number;
function get y():Number;
function set alpha(_arg1:Number):void;
}
}//package mx.core
Section 87
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function get repeaters():Array;
function get instanceIndices():Array;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 88
//MovieClipAsset (mx.core.MovieClipAsset)
package mx.core {
public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject {
private var _measuredWidth:Number;
private var _measuredHeight:Number;
mx_internal static const VERSION:String = "2.0.1.0";
public function MovieClipAsset(){
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 89
//MovieClipLoaderAsset (mx.core.MovieClipLoaderAsset)
package mx.core {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.system.*;
public class MovieClipLoaderAsset extends MovieClipAsset implements IFlexAsset, IFlexDisplayObject {
private var requestedWidth:Number;
private var loader:Loader;// = null
private var requestedHeight:Number;
private var initialized:Boolean;// = false
protected var initialWidth:Number;// = 0
protected var initialHeight:Number;// = 0
mx_internal static const VERSION:String = "2.0.1.0";
public function MovieClipLoaderAsset(){
var _local1:LoaderContext;
loader = null;
initialized = false;
initialWidth = 0;
initialHeight = 0;
super();
_local1 = new LoaderContext();
_local1.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.loadBytes(movieClipData, _local1);
addChild(loader);
}
private function completeHandler(_arg1:Event):void{
initialized = true;
initialWidth = loader.width;
initialHeight = loader.height;
if (!isNaN(requestedWidth)){
loader.width = requestedWidth;
};
if (!isNaN(requestedHeight)){
loader.height = requestedHeight;
};
dispatchEvent(_arg1);
}
override public function get height():Number{
if (!initialized){
return (initialHeight);
};
return (super.height);
}
override public function set height(_arg1:Number):void{
if (!initialized){
requestedHeight = _arg1;
} else {
loader.height = _arg1;
};
}
public function get movieClipData():ByteArray{
return (null);
}
override public function set width(_arg1:Number):void{
if (!initialized){
requestedWidth = _arg1;
} else {
loader.width = _arg1;
};
}
override public function get measuredWidth():Number{
return (initialWidth);
}
override public function get measuredHeight():Number{
return (initialHeight);
}
override public function get width():Number{
if (!initialized){
return (initialWidth);
};
return (super.width);
}
}
}//package mx.core
Section 90
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 91
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "2.0.1.0";
}
}//package mx.core
Section 92
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import flash.utils.*;
import mx.core.*;
public class NameUtil {
mx_internal static const VERSION:String = "2.0.1.0";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var _local2:String;
var _local3:DisplayObject;
var _local4:String;
var _local5:Array;
_local3 = _arg1;
while (_local3 != null) {
if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
break;
};
_local4 = _local3.name;
if ((_local3 is IRepeaterClient)){
_local5 = IRepeaterClient(_local3).instanceIndices;
if (_local5){
_local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
};
};
_local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2);
_local3 = _local3.parent;
};
return (_local2);
}
public static function createUniqueName(_arg1:Object):String{
var _local2:String;
var _local3:int;
var _local4:int;
if (!_arg1){
return (null);
};
_local2 = getQualifiedClassName(_arg1);
_local3 = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
_local4 = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 93
//Test (TestBed.Test)
package TestBed {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
import flash.media.*;
import General.*;
import flash.geom.*;
import flash.utils.*;
public class Test {
public var _classBrickH:Class;
public var _classBrickI:Class;
public var _classBrickL:Class;
public var _classBrickO:Class;
public var _classBrickJ:Class;
public var _classRotatingCrossBlades:Class;
public var _classBrickS:Class;
public var _classBrickT:Class;
public var _lives:int;// = 1
public var _classBrickZ:Class;
public var _classSuperLong:Class;
public var _classBrickWideCrossG:Class;
public var _classBrickBlock:Class;
public var _classWaterDrop:Class;
private var _limitY320x480:Number;// = 0
public var _classBrickVeryLong:Class;
public var _classBrickRocket:Class;
public var _classSunHelium:Class;
public var m_blockWidth:Number;// = 40
public var _classInDoor:Class;
public var _classBrickOHelium:Class;
public var _classBrickAlien:Class;
public var m_iterations:int;// = 15
public var _selectionList:Array;
private var _color:int;// = 0
private var _drawScaleAdder:Number;// = 0
public var _classBrickWacky1:Class;
public var _classBrickWacky2:Class;
public var _classBrickWacky4:Class;
public var _selectionsAngle:Array;
public var _running:Boolean;// = false
public var _classBrickConnect:Class;
public var _classBrickHoleBox:Class;
private var _level:int;// = 0
public var _classBrickO1T:Class;
private var _currentBlock:int;// = 0
public var _classBrickWacky4Mirror:Class;
public var m_mouseBody:b2Body;// = null
public var _classSun1T:Class;
public var _classPyramid:Class;
public var _classBrickBig:Class;
public var _classTunnelHole:Class;
private var _limitY480x320:Number;// = 0
public var _classRotatingCrossBig:Class;
private var m_topProps:Array;// = null
public var _storyShown:Boolean;// = false
public var _classBrickBlockG:Class;
public var _classBrickHinge:Class;
public var _classBrickWideCross:Class;
public var _classPyramidHelium:Class;
private var _diamondSpriteSpeedX:Number;// = 0
private var _diamondSpriteSpeedY:Number;// = 0
public var _classVine1:Class;
public var _classVine2:Class;
public var _classVine3:Class;
public var _classVine4:Class;
public var _classVine5:Class;
public var _classVine6:Class;
public var _classVine7:Class;
public var _classVine8:Class;
public var _classVine9:Class;
private var _diamondShadowOffsetX:Number;// = 0
public var _classBrickWacky1Mirror:Class;
public var _classBrickJesus:Class;
public var _classBrickConnectMirror:Class;
private var _diamondShadowOffsetY:Number;// = 0
public var m_sprite:Sprite;
public var _classBrickPacman:Class;
public var _missionFailed:Boolean;// = false
public var _classDiamond1:Class;
public var _classDiamond2:Class;
public var _classDiamond3:Class;
private var _diamondSpriteShadow:Bitmap;// = null
public var _classTriangleRight:Class;
private var _inDoorSprite:Bitmap;// = null
public var _selectionsX:Array;
public var _classSun:Class;
public var _classSaw2X:Class;
public var _selectionsN:int;// = 0
public var _classBrickKiila:Class;
public var _classPyramid1T:Class;
public var _storyHided:Boolean;// = false
public var _waiting:Boolean;// = false
public var _classBrickOG:Class;
public var _removed:int;// = 0
public var _classVine10:Class;
public var _classVine11:Class;
public var _classVine12:Class;
public var _classVine13:Class;
public var _classVine14:Class;
public var _classBrickPole:Class;
private var _diamondDensity:Number;// = 0.05
public var _classBrickPoleG:Class;
public var m_bomb:b2Body;
public var _classBrickBlock1T:Class;
private var _diamondSprite:Bitmap;// = null
public var _classFinalExit:Class;
private var _firstRun:Boolean;// = true
public var _classBrickHingeBig:Class;
public var _selectionsY:Array;
public var _levelCompleted:Boolean;// = false
public var _classTriangleLeft:Class;
public var m_blockHeight:Number;// = 40
public var m_world:b2World;
private var _limitYStopMode:Number;// = 0
private var mousePVec:b2Vec2;
private var m_topPropsN:int;// = 0
public var m_timeStep:Number;// = 0.00833333333333333
public var _classBrickWhoaMirror:Class;
public var _classBrickCrossG:Class;
public var _classRotatingCrossBox:Class;
public var _classSaw1:Class;
public var _classPyramidMini:Class;
public var _score:int;// = 0
public var _classSunG:Class;
public var _classTreasureChest:Class;
public var _classBrickHingeVeryBig:Class;
public var _classBrickSalmiack:Class;
private var _density:Number;// = 10
public var _classBrickCorner:Class;
private var _radius:Number;// = 20
public var _classBrickHingeVeryBigStraight:Class;
public var _stabilizing:Boolean;// = false
public var _classBrickWhoa:Class;
public var _classRotatingCross:Class;
public var _classBrickBlockHelium:Class;
public var _classBrickCross:Class;
public var _classBrickCornerLong:Class;
public var m_mouseJoint:b2MouseJoint;
private var _exitX:Number;// = 0
private var _exitY:Number;// = 0
public var _timedOut:Boolean;// = false
private static const OUTLINE_WIDTH:int = 2;
private static const BLUE_SENSOR_ACTIVATION_TIME:int = 45;
private static const SENSOR_ALPHA_SOURCE:Number = 0.2;
private static const SENSOR_ALPHA_TARGET:Number = 0.2;
public static var _classFootLeft1:Class = Test__classFootLeft1;
public static var s_randomPointY:Number;
public static var m_physScale:Number = 20;
public static var mouseYWorldPhys:Number;
public static var _classHead1:Class = Test__classHead1;
public static var _friction:Number = 0.8;
public static var mouseYWorld:Number;
public static var _classHandLeft1:Class = Test__classHandLeft1;
public static var m_debugDraw:b2DebugDraw = null;
public static var m_goalScale:Number = 1.5;
public static var mouseXWorldPhys:Number;
public static var s_randomPointX:Number;
public static var _classFootRight1:Class = Test__classFootRight1;
public static var _classHandRight1:Class = Test__classHandRight1;
public static var mouseXWorld:Number;
public function Test(){
var _local1:b2AABB;
var _local2:b2Vec2;
var _local3:Boolean;
var _local4:b2DebugDraw;
_classSun = Test__classSun;
_classSunG = Test__classSunG;
_classWaterDrop = Test__classWaterDrop;
_classVine1 = Test__classVine1;
_classVine2 = Test__classVine2;
_classVine3 = Test__classVine3;
_classVine4 = Test__classVine4;
_classVine5 = Test__classVine5;
_classVine6 = Test__classVine6;
_classVine7 = Test__classVine7;
_classVine8 = Test__classVine8;
_classVine9 = Test__classVine9;
_classVine10 = Test__classVine10;
_classVine11 = Test__classVine11;
_classVine12 = Test__classVine12;
_classVine13 = Test__classVine13;
_classVine14 = Test__classVine14;
_classTunnelHole = Test__classTunnelHole;
_classFinalExit = Test__classFinalExit;
_classInDoor = Test__classInDoor;
_classTreasureChest = Test__classTreasureChest;
_classDiamond1 = Test__classDiamond1;
_classDiamond2 = Test__classDiamond2;
_classDiamond3 = Test__classDiamond3;
_classBrickConnect = Test__classBrickConnect;
_classBrickConnectMirror = Test__classBrickConnectMirror;
_classBrickHingeVeryBigStraight = Test__classBrickHingeVeryBigStraight;
_classBrickI = Test__classBrickI;
_classBrickT = Test__classBrickT;
_classBrickO = Test__classBrickO;
_classBrickJ = Test__classBrickJ;
_classBrickAlien = Test__classBrickAlien;
_classBrickWhoaMirror = Test__classBrickWhoaMirror;
_classBrickBlock = Test__classBrickBlock;
_classBrickCornerLong = Test__classBrickCornerLong;
_classBrickWacky1 = Test__classBrickWacky1;
_classBrickWacky1Mirror = Test__classBrickWacky1Mirror;
_classBrickPole = Test__classBrickPole;
_classSuperLong = Test__classSuperLong;
_classPyramid = Test__classPyramid;
_classBrickBlock1T = Test__classBrickBlock1T;
_classSun1T = Test__classSun1T;
_classBrickO1T = Test__classBrickO1T;
_classPyramid1T = Test__classPyramid1T;
_classBrickBlockHelium = Test__classBrickBlockHelium;
_classSunHelium = Test__classSunHelium;
_classBrickOHelium = Test__classBrickOHelium;
_classPyramidHelium = Test__classPyramidHelium;
_removed = 0;
_score = 0;
_lives = 1;
m_blockWidth = 40;
m_blockHeight = 40;
_density = 10;
_running = false;
_timedOut = false;
m_topPropsN = 0;
m_topProps = null;
_diamondDensity = (10 * 0.005);
m_mouseBody = null;
_waiting = false;
_firstRun = true;
_missionFailed = false;
_currentBlock = 0;
_radius = 20;
_drawScaleAdder = 0;
_color = 0;
_inDoorSprite = null;
_diamondSpriteSpeedX = 0;
_diamondSpriteSpeedY = 0;
_diamondSprite = null;
_diamondSpriteShadow = null;
_exitX = 0;
_exitY = 0;
_diamondShadowOffsetX = 0;
_diamondShadowOffsetY = 0;
_levelCompleted = false;
_selectionList = new Array();
_selectionsN = 0;
_selectionsX = new Array();
_selectionsY = new Array();
_selectionsAngle = new Array();
_limitY320x480 = 0;
_limitY480x320 = 0;
_limitYStopMode = 0;
m_iterations = 15;
m_timeStep = (1 / 120);
mousePVec = new b2Vec2();
_stabilizing = false;
_level = 0;
_storyShown = false;
_storyHided = false;
super();
m_sprite = Main.m_sprite;
_local1 = new b2AABB();
_local1.lowerBound.Set(-20000, -20000);
_local1.upperBound.Set(20000, 20000);
_local2 = new b2Vec2(0, 30);
_local3 = true;
m_world = new b2World(_local1, _local2, _local3);
_local4 = new b2DebugDraw();
_local4.m_sprite = m_sprite;
_local4.m_drawScale = 20;
_local4.m_fillAlpha = 0.7;
_local4.m_lineThickness = 1;
_local4.m_drawFlags = (b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit);
m_debugDraw = _local4;
m_world.SetDebugDraw(_local4);
m_world.SetContactListener(new ContactListener());
}
public function AddShadowSprites():void{
var _local1:b2Body;
_local1 = m_world.m_bodyList;
while (_local1) {
if (((!((_local1.m_userData == null))) && (!((_local1.m_userData._sprite == null))))){
CreateShadowSprite(_local1.m_userData);
};
_local1 = _local1.m_next;
};
}
public function addPole(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-60 / _local5), (-10 / _local5));
_local8.vertices[1].Set((60 / _local5), (-10 / _local5));
_local8.vertices[2].Set((60 / _local5), (10 / _local5));
_local8.vertices[3].Set((-60 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 19;
_local9 = new Bitmap(new _classBrickPole().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function coverInDust(_arg1:b2Body, _arg2:Bitmap, _arg3:Number=1):void{
var _local4:UserData;
var _local5:b2XForm;
var _local6:b2Vec2;
var _local7:b2Shape;
var _local8:Matrix;
var _local9:BitmapData;
if (_arg2 == null){
return;
};
_local4 = _arg1.GetUserData();
if (_local4 != null){
if (_local4._sprite != null){
_local8 = new Matrix();
_local9 = _local4._sprite.bitmapData;
_local8.rotate(_arg1.GetAngle());
_local8.translate((_local4._sprite.x + 300), (_local4._sprite.y + 250));
_arg2.bitmapData.draw(_local9, _local8, null, null, null, true);
};
};
_local5 = _arg1.GetXForm();
_local6 = _arg1.GetPosition();
_local7 = _arg1.GetShapeList();
while (_local7 != null) {
coverInDustShape(_local7, _local6, _local5, _arg3, _arg2);
_local7 = _local7.GetNext();
};
}
public function addSalmiack(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-20 / _local5), (-20 / _local5));
_local8.vertices[1].Set((60 / _local5), (-20 / _local5));
_local8.vertices[2].Set((20 / _local5), (20 / _local5));
_local8.vertices[3].Set((-60 / _local5), (20 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 64;
_local9 = new Bitmap(new _classBrickSalmiack().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function getBodiesByColorAll(_arg1:int):Array{
var _local2:Array;
var _local3:int;
var _local4:b2Body;
var _local5:UserData;
_local2 = null;
_local3 = 0;
trace(("getBodiesByColorAll() " + _arg1));
_local4 = m_world.m_bodyList;
while (_local4) {
if (_local4.m_userData != null){
_local5 = _local4.m_userData;
if (_local5._color == _arg1){
if (_local2 == null){
_local2 = new Array(1);
};
var _temp1 = _local3;
_local3 = (_local3 + 1);
var _local6 = _temp1;
_local2[_local6] = _local4;
trace("got one!");
};
};
_local4 = _local4.m_next;
};
return (_local2);
}
public function addBoxG(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.SetAsBox((20 / _local5), (20 / _local5));
_local8.isSensor = _arg2;
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 67;
_local6.m_userData._directedGravity = true;
_local9 = new Bitmap(new _classBrickOG().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addCross(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set(((-5 * 2) / _local5), (((-10 * 2) - 10) / _local5));
_local8.vertices[1].Set(((5 * 2) / _local5), (((-10 * 2) - 10) / _local5));
_local8.vertices[2].Set(((5 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local8.vertices[3].Set(((-5 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set(((15 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local8.vertices[1].Set(((15 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[2].Set(((-15 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[3].Set(((-15 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set(((-5 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[1].Set(((5 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[2].Set(((5 * 2) / _local5), (((20 * 2) - 10) / _local5));
_local8.vertices[3].Set(((-5 * 2) / _local5), (((20 * 2) - 10) / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 8;
_local9 = new Bitmap(new _classBrickCross().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addCrossG(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set(((-5 * 2) / _local5), (((-10 * 2) - 10) / _local5));
_local8.vertices[1].Set(((5 * 2) / _local5), (((-10 * 2) - 10) / _local5));
_local8.vertices[2].Set(((5 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local8.vertices[3].Set(((-5 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set(((15 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local8.vertices[1].Set(((15 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[2].Set(((-15 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[3].Set(((-15 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set(((-5 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[1].Set(((5 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[2].Set(((5 * 2) / _local5), (((20 * 2) - 10) / _local5));
_local8.vertices[3].Set(((-5 * 2) / _local5), (((20 * 2) - 10) / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 69;
_local6.m_userData._directedGravity = true;
_local9 = new Bitmap(new _classBrickCrossG().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addConnectMirror(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-50 / _local5), (0 / _local5));
_local8.vertices[1].Set((-30 / _local5), (0 / _local5));
_local8.vertices[2].Set((-30 / _local5), (20 / _local5));
_local8.vertices[3].Set((-50 / _local5), (20 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-50 / _local5), (-20 / _local5));
_local8.vertices[1].Set((10 / _local5), (-20 / _local5));
_local8.vertices[2].Set((10 / _local5), (0 / _local5));
_local8.vertices[3].Set((-50 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-10 / _local5), (0 / _local5));
_local8.vertices[1].Set((50 / _local5), (0 / _local5));
_local8.vertices[2].Set((50 / _local5), (20 / _local5));
_local8.vertices[3].Set((-10 / _local5), (20 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((30 / _local5), (-20 / _local5));
_local8.vertices[1].Set((50 / _local5), (-20 / _local5));
_local8.vertices[2].Set((50 / _local5), (0 / _local5));
_local8.vertices[3].Set((30 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 40;
_local9 = new Bitmap(new _classBrickConnectMirror().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function ManageTeddySprite(_arg1:UserData):void{
_arg1._scale = 0.8;
}
public function addOrientedBox(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean):b2Body{
var _local7:Number;
var _local8:b2PolygonDef;
var _local9:b2BodyDef;
var _local10:b2Body;
_local7 = 20;
_local8 = new b2PolygonDef();
_local8.friction = _friction;
_local8.density = _density;
_local8.isSensor = _arg6;
_local8.restitution = 0;
_local9 = new b2BodyDef();
_local8.SetAsOrientedBox((_arg1 / _local7), (_arg2 / _local7), new b2Vec2(0, 0), _arg5);
_local9.position.Set(_arg3, _arg4);
_local10 = m_world.CreateBody(_local9);
_local10.CreateShape(_local8);
_local10.SetMassFromShapes();
_local10.m_userData = new UserData();
_local10.m_userData._iD = 72;
_local10.m_userData._width = _arg1;
_local10.m_userData._height = _arg2;
_local10.m_userData._color = 0x999999;
return (_local10);
}
public function addWideCrossG(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set(((-5 * 2) / _local5), (((-10 * 2) - 10) / _local5));
_local8.vertices[1].Set(((5 * 2) / _local5), (((-10 * 2) - 10) / _local5));
_local8.vertices[2].Set(((5 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local8.vertices[3].Set(((-5 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((50 / _local5), (((0 * 2) - 10) / _local5));
_local8.vertices[1].Set((50 / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[2].Set((-50 / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[3].Set((-50 / _local5), (((0 * 2) - 10) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set(((-5 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[1].Set(((5 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[2].Set(((5 * 2) / _local5), (((20 * 2) - 10) / _local5));
_local8.vertices[3].Set(((-5 * 2) / _local5), (((20 * 2) - 10) / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 70;
_local6.m_userData._directedGravity = true;
_local9 = new Bitmap(new _classBrickWideCrossG().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function useEditorLevel(_arg1:String, _arg2:int):void{
var _local3:Array;
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:int;
var _local8:Number;
var _local9:Bitmap;
var _local10:b2Body;
var _local11:int;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:int;
var _local16:Number;
var _local17:b2Body;
var _local18:Boolean;
var _local19:int;
var _local20:UserData;
var _local21:Array;
var _local22:Bitmap;
var _local23:Number;
var _local24:Number;
_level = _arg2;
DestroyBodies();
_local3 = _arg1.split(" ");
if ((((_local3 == null)) || ((_local3.length < 2)))){
return;
};
_local4 = 0;
while (_local4 < _local3.length) {
if (_local3[_local4] == "<level>"){
break;
};
trace(("item " + _local3[_local4]));
_local4++;
};
trace(((_local4 + " & ") + _local3.length));
if (_local4 >= _local3.length){
_local4 = -1;
};
_local4++;
var _temp1 = _local4;
_local4 = (_local4 + 1);
m_debugDraw.m_drawScale = Number(_local3[_temp1]);
var _temp2 = _local4;
_local4 = (_local4 + 1);
_drawScaleAdder = Number(_local3[_temp2]);
trace("************************* LEVEL LOADED ************************");
var _temp3 = _local4;
_local4 = (_local4 + 1);
_local7 = int(_local3[_temp3]);
calculateIPhoneDottedLineLimits();
trace(((" setOrientation(" + _local7) + "); // 1 - 320x480, 0 - 480x320"));
trace(" b2Body* body;");
trace(" b2Vec2 pos;");
_local8 = ((10 / 8) * (m_debugDraw.m_drawScale / 20));
trace(((" setScaling(" + (m_debugDraw.m_drawScale / 20)) + ");"));
while (_local4 < _local3.length) {
var _temp4 = _local4;
_local4 = (_local4 + 1);
_local11 = int(_local3[_temp4]);
_local12 = 1;
_local13 = 30;
_local14 = 30;
if (_local11 == 1000){
var _temp5 = _local4;
_local4 = (_local4 + 1);
m_goalScale = Number(_local3[_temp5]);
} else {
if (_local11 == 1001){
var _temp6 = _local4;
_local4 = (_local4 + 1);
_local15 = int(_local3[_temp6]);
if (_local15 == 0){
Main._iceMode = false;
} else {
Main._iceMode = true;
};
trace(((" setIceMode(" + Main._iceMode) + ");"));
Main.iceModeExecute();
} else {
if ((((_local11 <= 26)) || ((((((((((((((((_local11 >= 29)) && (!((_local11 == 72))))) && (!((_local11 == 73))))) && (!((_local11 == 74))))) && (!((_local11 == 75))))) && (!((_local11 == 76))))) && (!((_local11 == 77))))) && (!((_local11 == 78))))))){
if ((((((((((((((((((((_local11 == 20)) || ((_local11 == 26)))) || ((_local11 == 34)))) || ((_local11 == 41)))) || ((_local11 == 44)))) || ((_local11 == 46)))) || ((_local11 == 50)))) || ((_local11 == 52)))) || ((_local11 == 56)))) || ((_local11 == 71)))){
var _temp7 = _local4;
_local4 = (_local4 + 1);
_local12 = Number(_local3[_temp7]);
};
var _temp8 = _local4;
_local4 = (_local4 + 1);
_local5 = Number(_local3[_temp8]);
var _temp9 = _local4;
_local4 = (_local4 + 1);
_local6 = Number(_local3[_temp9]);
var _temp10 = _local4;
_local4 = (_local4 + 1);
_local16 = Number(_local3[_temp10]);
if (_local11 == 26){
_local16 = 0;
};
_local17 = cloneBody(null, false, _local11, _local12, 0, 30, 30, _local5, _local6);
if (_local17 != null){
_local17.SetXForm(new b2Vec2(_local5, _local6), _local16);
_local18 = isIPhoneSleeping(_local6);
_local12 = (_local12 * _local8);
_local5 = (_local5 * _local8);
_local6 = (_local6 * _local8);
_local16 = (_local16 * -1);
if ((((((_local11 == 4)) || ((_local11 == 5)))) || ((_local11 == 3)))){
_local16 = (_local16 + Math.PI);
} else {
if ((((_local11 == 13)) || ((_local11 == 29)))){
_local16 = (_local16 - (Math.PI * 0.5));
};
};
trace(((((((((((((" body = cloneBody(NULL, " + _local18) + ", ") + _local11) + ", ") + _local12) + ", ") + _local16) + ", 1, 1, ") + _local5) + ", ") + -(_local6)) + ");"));
trace(((((((" pos.x = " + _local5) + "; pos.y = ") + -(_local6)) + "; body->SetXForm(pos, ") + _local16) + ");"));
};
} else {
if (_local11 == 27){
var _temp11 = _local4;
_local4 = (_local4 + 1);
_local12 = Number(_local3[_temp11]);
var _temp12 = _local4;
_local4 = (_local4 + 1);
_local5 = Number(_local3[_temp12]);
var _temp13 = _local4;
_local4 = (_local4 + 1);
_local6 = Number(_local3[_temp13]);
_local17 = cloneBody(null, false, _local11, _local12, 0);
_local17.SetXForm(new b2Vec2(_local5, _local6), 0);
_local12 = (_local12 * _local8);
_local5 = (_local5 * _local8);
_local6 = (_local6 * _local8);
trace(((((" body = cloneBody(NULL, false, " + _local11) + ", ") + _local12) + ", 0.0);"));
trace(((((" pos.x = " + _local5) + "; pos.y = ") + -(_local6)) + "; body->SetXForm(pos, 0.0);"));
} else {
if (_local11 == 28){
var _temp14 = _local4;
_local4 = (_local4 + 1);
_local5 = Number(_local3[_temp14]);
var _temp15 = _local4;
_local4 = (_local4 + 1);
_local6 = Number(_local3[_temp15]);
var _temp16 = _local4;
_local4 = (_local4 + 1);
_local13 = Number(_local3[_temp16]);
var _temp17 = _local4;
_local4 = (_local4 + 1);
_local14 = Number(_local3[_temp17]);
var _temp18 = _local4;
_local4 = (_local4 + 1);
_local16 = Number(_local3[_temp18]);
_local17 = cloneBody(null, false, _local11, 0, 0, _local13, _local14);
_local17.SetXForm(new b2Vec2(_local5, _local6), _local16);
_local12 = (_local12 * _local8);
_local5 = (_local5 * _local8);
_local6 = (_local6 * _local8);
_local13 = (_local13 * _local8);
_local14 = (_local14 * _local8);
_local16 = (_local16 * -1);
trace(((((((" body = cloneBody(NULL, false, " + _local11) + ", 0.0, 0.0, ") + _local13) + ", ") + _local14) + ");"));
trace(((((((" pos.x = " + _local5) + "; pos.y = ") + -(_local6)) + "; body->SetXForm(pos, ") + _local16) + ");"));
} else {
if ((((_local11 == 72)) || ((_local11 == 78)))){
var _temp19 = _local4;
_local4 = (_local4 + 1);
_local5 = Number(_local3[_temp19]);
var _temp20 = _local4;
_local4 = (_local4 + 1);
_local6 = Number(_local3[_temp20]);
var _temp21 = _local4;
_local4 = (_local4 + 1);
_local13 = Number(_local3[_temp21]);
var _temp22 = _local4;
_local4 = (_local4 + 1);
_local14 = Number(_local3[_temp22]);
var _temp23 = _local4;
_local4 = (_local4 + 1);
_local16 = Number(_local3[_temp23]);
_local17 = cloneBody(null, false, _local11, 0, 0, _local13, _local14);
_local17.SetXForm(new b2Vec2(_local5, _local6), _local16);
_local12 = (_local12 * _local8);
_local5 = (_local5 * _local8);
_local6 = (_local6 * _local8);
_local13 = (_local13 * _local8);
_local14 = (_local14 * _local8);
_local16 = (_local16 * -1);
trace(((((((" body = cloneBody(NULL, false, " + _local11) + ", 0.0, 0.0, ") + _local13) + ", ") + _local14) + ");"));
trace(((((((" pos.x = " + _local5) + "; pos.y = ") + -(_local6)) + "; body->SetXForm(pos, ") + _local16) + ");"));
} else {
if ((((((((((_local11 == 73)) || ((_local11 == 74)))) || ((_local11 == 75)))) || ((_local11 == 76)))) || ((_local11 == 77)))){
var _temp24 = _local4;
_local4 = (_local4 + 1);
_local5 = Number(_local3[_temp24]);
var _temp25 = _local4;
_local4 = (_local4 + 1);
_local6 = Number(_local3[_temp25]);
var _temp26 = _local4;
_local4 = (_local4 + 1);
_local13 = Number(_local3[_temp26]);
var _temp27 = _local4;
_local4 = (_local4 + 1);
_local14 = Number(_local3[_temp27]);
var _temp28 = _local4;
_local4 = (_local4 + 1);
_local16 = Number(_local3[_temp28]);
var _temp29 = _local4;
_local4 = (_local4 + 1);
_local19 = int(_local3[_temp29]);
if ((((((((_local19 & 0xFF00) >> 8) >= 64)) && (((_local19 & 0xFF) == 30)))) && ((((_local19 & 0xFF0000) >> 16) == 30)))){
_local17 = cloneBody(null, true, _local11, 0, 0, _local13, _local14);
} else {
if ((((((((_local19 & 0xFF00) >> 8) >= 64)) && (((_local19 & 0xFF) == 30)))) && ((((_local19 & 0xFF0000) >> 16) >= 64)))){
_local17 = cloneBody(null, true, _local11, 0, 0, _local13, _local14);
} else {
_local17 = cloneBody(null, false, _local11, 0, 0, _local13, _local14);
};
};
_local17.SetXForm(new b2Vec2(_local5, _local6), _local16);
_local17.m_userData._color = _local19;
_local12 = (_local12 * _local8);
_local5 = (_local5 * _local8);
_local6 = (_local6 * _local8);
_local13 = (_local13 * _local8);
_local14 = (_local14 * _local8);
_local16 = (_local16 * -1);
trace(((((((" body = cloneBody(NULL, false, " + _local11) + ", 0.0, 0.0, ") + _local13) + ", ") + _local14) + ");"));
trace(((((((" pos.x = " + _local5) + "; pos.y = ") + -(_local6)) + "; body->SetXForm(pos, ") + _local16) + ");"));
};
};
};
};
};
};
};
};
_local9 = createWallTexture(Main._bitmapTextureA, (0.3 + ((_arg2 / 29) * 0.7)));
_local10 = m_world.m_bodyList;
while (_local10) {
if (_local10.m_userData != null){
_local20 = _local10.m_userData;
if (_local20._iD == 28){
CreateTextureForBody(_local10, false, _local9, true, false);
} else {
if (_local20._iD == 72){
CreateTextureForBody(_local10, true, Main._bitmapTextureC, true, true);
} else {
if (_local20._iD == 78){
CreateTextureForBody(_local10, true, Main._bitmapTextureB, true, true);
} else {
if (_local20._iD == 73){
CreateTextureForBody(_local10, false, Main._bitmapTextureD, true, true);
_local20._alpha = SENSOR_ALPHA_SOURCE;
_local21 = getBodiesByColor(_local20._color);
_local4 = 0;
while (((!((_local21 == null))) && ((_local4 < _local21.length)))) {
_local17 = _local21[_local4];
if (_local17 != null){
CreateTextureForBody(_local17, true, Main._bitmapTextureD, true, true);
};
_local4++;
};
} else {
if (_local20._iD == 75){
CreateTextureForBody(_local10, false, Main._bitmapTextureF, true, true);
_local20._alpha = SENSOR_ALPHA_SOURCE;
_local21 = getBodiesByColor(_local20._color);
_local4 = 0;
while (((!((_local21 == null))) && ((_local4 < _local21.length)))) {
_local17 = _local21[_local4];
if (_local17 != null){
CreateTextureForBody(_local17, true, Main._bitmapTextureF, true, true);
};
_local4++;
};
} else {
if (_local20._iD == 76){
CreateTextureForBody(_local10, false, Main._bitmapTextureE, true, true);
_local20._alpha = SENSOR_ALPHA_SOURCE;
_local21 = getBodiesByColor(_local20._color);
_local4 = 0;
while (((!((_local21 == null))) && ((_local4 < _local21.length)))) {
_local17 = _local21[_local4];
if (_local17 != null){
CreateTextureForBody(_local17, true, Main._bitmapTextureE, true, true);
};
_local4++;
};
} else {
if (_local20._iD == 77){
CreateTextureForBody(_local10, false, Main._bitmapTextureD, true, true);
_local20._alpha = SENSOR_ALPHA_SOURCE;
_local21 = getBodiesByColor(_local20._color);
_local4 = 0;
while (((!((_local21 == null))) && ((_local4 < _local21.length)))) {
_local17 = _local21[_local4];
if (_local17 != null){
CreateTextureForBody(_local17, true, Main._bitmapTextureD, true, true);
_local17.m_userData._alpha = SENSOR_ALPHA_TARGET;
};
_local4++;
};
};
};
};
};
};
};
};
};
_local10 = _local10.m_next;
};
_stabilizing = true;
Update(true, null);
Update(true, null);
_stabilizing = false;
_local10 = m_world.m_bodyList;
while (_local10) {
if (_local10.m_userData != null){
_local20 = _local10.m_userData;
if (_local20._iD == 35){
if (_inDoorSprite == null){
_local23 = 0;
_local24 = 0;
if (_arg2 == 0){
_local22 = new Bitmap(new _classTreasureChest().bitmapData);
_local22.scaleX = 0.5;
_local22.scaleY = 0.5;
_local22.alpha = 1;
_local23 = 18;
_local24 = -11;
} else {
_local22 = new Bitmap(new _classInDoor().bitmapData);
_local22.scaleX = 0.6;
_local22.scaleY = 0.6;
_local22.alpha = 1;
_local24 = -6;
};
_local22.x = (((_local20._sprite.x + (_local20._sprite.width * 0.5)) - (_local22.width * 0.5)) + _local23);
_local22.y = (((_local20._sprite.y + (_local20._sprite.height * 0.5)) - (_local22.height * 0.5)) + _local24);
_local22.smoothing = true;
m_sprite.addChild(_local22);
_inDoorSprite = _local22;
};
};
};
_local10 = _local10.m_next;
};
BringSpritesOnTop();
bringDiamondsAndBlocksOnTop();
trace(" setScaling(1.0f);");
}
public function addOrientedBoxHeavy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean):b2Body{
var _local7:Number;
var _local8:b2PolygonDef;
var _local9:b2BodyDef;
var _local10:b2Body;
_local7 = 20;
_local8 = new b2PolygonDef();
_local8.friction = (_friction * 3);
_local8.density = (_density * 15);
_local8.isSensor = _arg6;
_local8.restitution = 0;
_local9 = new b2BodyDef();
_local8.SetAsOrientedBox((_arg1 / _local7), (_arg2 / _local7), new b2Vec2(0, 0), _arg5);
_local9.position.Set(_arg3, _arg4);
_local9.isBullet = true;
_local10 = m_world.CreateBody(_local9);
_local10.CreateShape(_local8);
_local10.SetMassFromShapes();
_local10.m_userData = new UserData();
_local10.m_userData._iD = 78;
_local10.m_userData._width = _arg1;
_local10.m_userData._height = _arg2;
_local10.m_userData._color = 5579281;
_local10.m_userData._pickable = false;
return (_local10);
}
public function DestroyBodies():void{
var _local1:b2Body;
var _local2:int;
_local1 = m_world.m_bodyList;
while (_local1) {
if (((!((_local1.m_userData == null))) && ((_local1.m_userData._iD >= 0)))){
DestroyBody(_local1);
};
_local1 = _local1.m_next;
};
if (_diamondSprite != null){
m_sprite.removeChild(_diamondSprite);
_diamondSprite = null;
};
if (_diamondSpriteShadow != null){
m_sprite.removeChild(_diamondSpriteShadow);
_diamondSpriteShadow = null;
};
if (_inDoorSprite != null){
m_sprite.removeChild(_inDoorSprite);
_inDoorSprite = null;
};
_local2 = 0;
while (_local2 < m_topPropsN) {
if (m_topProps[_local2] != null){
Main.m_spriteTop.removeChild(m_topProps[_local2]);
m_topProps[_local2] = null;
};
_local2++;
};
m_topProps = null;
}
public function addBall(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int, _arg5:Number=1):b2Body{
return (addBallGeneral(_arg1, _arg2, _arg3, _arg4, _arg5, false));
}
private function coverInDustShape(_arg1:b2Shape, _arg2:b2Vec2, _arg3:b2XForm, _arg4:Number, _arg5:Bitmap):void{
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:BitmapData;
var _local10:b2CircleShape;
var _local11:Number;
var _local12:int;
var _local13:b2Vec2;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:uint;
var _local19:Particle;
var _local20:b2PolygonShape;
var _local21:int;
var _local22:Array;
var _local23:Array;
var _local24:int;
var _local25:b2Vec2;
_local6 = _arg1.GetType();
_local9 = _arg5.bitmapData;
if (_local6 == b2Shape.e_circleShape){
_local10 = (_arg1 as b2CircleShape);
_local11 = _local10.GetRadius();
_local12 = ((((_local10.GetRadius() * _local11) * 0x0100) * _arg4) * Main.getQualityMultiplier());
_local13 = b2Math.b2MulX(_arg3, _local10.GetLocalPosition());
b2Math.b2MulX(_arg3, _local10.GetLocalPosition()).x = (_local13.x * m_debugDraw.m_drawScale);
_local13.y = (_local13.y * m_debugDraw.m_drawScale);
_local7 = 0;
while (_local7 < _local12) {
_local14 = (Math.random() * _local11);
_local15 = ((Math.random() * Math.PI) * 2);
_local16 = ((Math.cos(_local15) * _local14) * m_debugDraw.m_drawScale);
_local17 = ((Math.sin(_local15) * _local14) * m_debugDraw.m_drawScale);
_local18 = _local9.getPixel32(((_local13.x + _local16) + 300), ((_local13.y + _local17) + 250));
_local19 = Main.m_particleManager.addParticle(Particle.PARTICLE_TYPE_EXPLOSION, ((_local13.x + _local16) + 300), (_local13.y + _local17), _local18);
if (_local19 != null){
_local19._life = (_local19._life + (Math.random() * 20));
_local19._speedX = (_local16 * 0.06);
_local19._speedY = (_local17 * 0.06);
};
_local7++;
};
} else {
if (_local6 == b2Shape.e_polygonShape){
_local20 = (_arg1 as b2PolygonShape);
_local21 = _local20.GetVertexCount();
_local22 = _local20.GetVertices();
_local23 = new Array(b2Settings.b2_maxPolygonVertices);
_local7 = 0;
while (_local7 < _local21) {
_local23[_local7] = b2Math.b2MulX(_arg3, _local22[_local7]);
_local7++;
};
_local24 = (_local21 - 2);
_local25 = new b2Vec2();
_local25.x = (_arg2.x * m_debugDraw.m_drawScale);
_local25.y = (_arg2.y * m_debugDraw.m_drawScale);
_local7 = 0;
while (_local7 < _local24) {
_local12 = ((getParticlesInsideTriangle(_local23[0], _local23[(_local7 + 1)], _local23[(_local7 + 2)]) * _arg4) * Main.getQualityMultiplier());
_local8 = 0;
while (_local8 < _local12) {
getRandomPointInTriangle(_local23[0], _local23[(_local7 + 1)], _local23[(_local7 + 2)]);
s_randomPointX = (s_randomPointX * m_debugDraw.m_drawScale);
s_randomPointY = (s_randomPointY * m_debugDraw.m_drawScale);
_local16 = ((s_randomPointX - _local25.x) * 0.06);
_local17 = ((s_randomPointY - _local25.y) * 0.06);
_local18 = _local9.getPixel32((s_randomPointX + 300), (s_randomPointY + 250));
_local19 = Main.m_particleManager.addParticle(Particle.PARTICLE_TYPE_EXPLOSION, (s_randomPointX + 300), s_randomPointY, _local18);
if (_local19 != null){
_local19._life = (_local19._life + (Math.random() * 20));
_local19._speedX = _local16;
_local19._speedY = _local17;
};
_local8++;
};
_local7++;
};
};
};
}
public function addCorner(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((10 / _local5), (-30 / _local5));
_local8.vertices[1].Set((30 / _local5), (-30 / _local5));
_local8.vertices[2].Set((30 / _local5), (30 / _local5));
_local8.vertices[3].Set((10 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-30 / _local5), (10 / _local5));
_local8.vertices[1].Set((10 / _local5), (10 / _local5));
_local8.vertices[2].Set((10 / _local5), (30 / _local5));
_local8.vertices[3].Set((-30 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 13;
_local9 = new Bitmap(new _classBrickCorner().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function getParticlesInsideTriangle(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):int{
var _local4:Number;
_local4 = (0.5 * Math.abs((((_arg1.x - _arg3.x) * (_arg2.y - _arg1.y)) - ((_arg1.x - _arg2.x) * (_arg3.y - _arg1.y)))));
return ((_local4 * 128));
}
public function addPyramidMini(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 3;
_local8.vertices[2].Set((-10 / _local5), (10 / _local5));
_local8.vertices[1].Set((10 / _local5), (10 / _local5));
_local8.vertices[0].Set((0 / _local5), (-10 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 25;
_local9 = new Bitmap(new _classPyramidMini().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function CreateTeddyUserData():UserData{
var _local1:UserData;
_local1 = new UserData();
_local1._iD = 102;
_local1._color = 0xFFFFFF;
return (_local1);
}
private function bringDiamondsAndBlocksOnTop():void{
var _local1:b2Body;
var _local2:UserData;
_local1 = m_world.m_bodyList;
while (_local1) {
if (_local1.m_userData != null){
_local2 = _local1.m_userData;
if ((((_local2._iD == 72)) || ((_local2._iD == 78)))){
if (_local2._sprite != null){
PutShadowBack(_local2);
};
};
};
_local1 = _local1.m_next;
};
_local1 = m_world.m_bodyList;
while (_local1) {
if (_local1.m_userData != null){
_local2 = _local1.m_userData;
if ((((_local2._iD >= 34)) && ((_local2._iD <= 36)))){
if (_local2._sprite != null){
PutShadowBack(_local2);
};
};
};
_local1 = _local1.m_next;
};
}
public function addBlock(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.SetAsBox((40 / _local5), (40 / _local5));
_local8.isSensor = _arg2;
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 30;
_local9 = new Bitmap(new _classBrickBlock().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addWacky4Mirror(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((10 / _local5), (-40 / _local5));
_local8.vertices[1].Set((30 / _local5), (-40 / _local5));
_local8.vertices[2].Set((30 / _local5), (40 / _local5));
_local8.vertices[3].Set((10 / _local5), (40 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-10 / _local5), (-40 / _local5));
_local8.vertices[1].Set((10 / _local5), (-40 / _local5));
_local8.vertices[2].Set((10 / _local5), (-20 / _local5));
_local8.vertices[3].Set((-10 / _local5), (-20 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-30 / _local5), (-40 / _local5));
_local8.vertices[1].Set((-10 / _local5), (-40 / _local5));
_local8.vertices[2].Set((-10 / _local5), (0 / _local5));
_local8.vertices[3].Set((-30 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 32;
_local9 = new Bitmap(new _classBrickWacky4Mirror().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function addTopProp(_arg1:Bitmap):void{
Main.m_spriteTop.addChild(_arg1);
if (m_topProps == null){
m_topProps = new Array(16);
};
var _local2 = m_topPropsN++;
m_topProps[_local2] = _arg1;
}
private function PutShadowBack(_arg1:UserData):void{
m_sprite.removeChild(_arg1._sprite);
m_sprite.removeChild(_arg1._spriteShadow);
m_sprite.addChild(_arg1._spriteShadow);
m_sprite.addChild(_arg1._sprite);
}
public function addBallGeneral(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int, _arg5:Number, _arg6:Boolean, _arg7:int=0, _arg8:Number=0):b2Body{
var _local9:Number;
var _local10:b2BodyDef;
var _local11:b2Body;
var _local12:b2CircleDef;
var _local13:UserData;
_local9 = 20;
_local10 = new b2BodyDef();
_local10.isSleeping = false;
_local10.position.Set(_arg2, _arg3);
if (_arg4 >= 0){
_local13 = new UserData();
_local13._iD = _arg4;
_local13._radius = _arg1;
_local10.userData = _local13;
};
_local11 = m_world.CreateBody(_local10);
_local12 = new b2CircleDef();
_local12.isSensor = _arg6;
_local12.radius = (_arg1 / _local9);
_local12.density = _arg5;
_local12.friction = (_friction + _arg8);
_local12.restitution = 0.1;
_local11.CreateShape(_local12);
_local11.SetMassFromShapes();
return (_local11);
}
public function addVeryLong(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-60 / _local5), (-10 / _local5));
_local8.vertices[1].Set((60 / _local5), (-10 / _local5));
_local8.vertices[2].Set((60 / _local5), (10 / _local5));
_local8.vertices[3].Set((-60 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((40 / _local5), (-30 / _local5));
_local8.vertices[1].Set((60 / _local5), (-30 / _local5));
_local8.vertices[2].Set((60 / _local5), (-10 / _local5));
_local8.vertices[3].Set((40 / _local5), (-10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((40 / _local5), (10 / _local5));
_local8.vertices[1].Set((60 / _local5), (10 / _local5));
_local8.vertices[2].Set((60 / _local5), (30 / _local5));
_local8.vertices[3].Set((40 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 10;
_local9 = new Bitmap(new _classBrickVeryLong().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addHingeVeryBigStraight(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
var _local10:b2RevoluteJointDef;
var _local11:b2Vec2;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-100 / _local5), (-10 / _local5));
_local8.vertices[1].Set((100 / _local5), (-10 / _local5));
_local8.vertices[2].Set((100 / _local5), (10 / _local5));
_local8.vertices[3].Set((-100 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 65;
_local9 = new Bitmap(new _classBrickHingeVeryBigStraight().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
_local10 = new b2RevoluteJointDef();
_local11 = _local6.GetPosition();
_local10.Initialize(m_world.GetGroundBody(), _local6, _local11);
_local10.enableMotor = false;
_local6.m_userData._object = (m_world.CreateJoint(_local10) as b2RevoluteJoint);
return (_local6);
}
public function DestroyBody(_arg1:b2Body):void{
var _local2:UserData;
_local2 = _arg1.m_userData;
if (_local2 != null){
if (_local2._sprite != null){
m_sprite.removeChild(_local2._sprite);
_local2._sprite = null;
};
if (_local2._spriteShadow != null){
m_sprite.removeChild(_local2._spriteShadow);
_local2._spriteShadow = null;
};
if (_local2._object != null){
m_world.DestroyJoint((_local2._object as b2Joint));
};
if (_local2._iD == 35){
_missionFailed = true;
};
};
if (m_mouseBody == _arg1){
m_mouseBody = null;
if (m_mouseJoint){
m_world.DestroyJoint(m_mouseJoint);
m_mouseJoint = null;
};
};
m_world.DestroyBody(_arg1);
}
public function addWhoa(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-40 / _local5), (-10 / _local5));
_local8.vertices[1].Set((40 / _local5), (-10 / _local5));
_local8.vertices[2].Set((40 / _local5), (10 / _local5));
_local8.vertices[3].Set((-40 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((20 / _local5), (-30 / _local5));
_local8.vertices[1].Set((40 / _local5), (-30 / _local5));
_local8.vertices[2].Set((40 / _local5), (-10 / _local5));
_local8.vertices[3].Set((20 / _local5), (-10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-40 / _local5), (10 / _local5));
_local8.vertices[1].Set((-20 / _local5), (10 / _local5));
_local8.vertices[2].Set((-20 / _local5), (30 / _local5));
_local8.vertices[3].Set((-40 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 12;
_local9 = new Bitmap(new _classBrickWhoa().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function cloneBody(_arg1:b2Body, _arg2:Boolean, _arg3:int=-1, _arg4:Number=1, _arg5:Number=0, _arg6:Number=30, _arg7:Number=30, _arg8:Number=0, _arg9:Number=0):b2Body{
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:int;
var _local23:int;
var _local24:Boolean;
var _local25:UserData;
_local10 = 0;
_local18 = 1;
_local19 = 1;
_local20 = 1;
_local21 = 1;
_local22 = -1;
_local23 = 0;
_local24 = false;
if (_arg1 != null){
_local24 = true;
_local25 = _arg1.m_userData;
_local13 = _arg1.GetPosition().x;
_local14 = _arg1.GetPosition().y;
_local11 = _arg1.GetAngle();
_local12 = _local25._radius;
_local17 = _local25._iD;
_local15 = _local25._width;
_local16 = _local25._height;
_local18 = _local25._scale;
_local19 = _local25._width;
_local20 = _local25._height;
_local21 = _local25._alpha;
_local23 = _local25._color;
_local22 = _local25._currentBlock;
} else {
_local13 = _arg8;
_local14 = _arg9;
_local11 = _arg5;
_local12 = _arg4;
_local17 = _arg3;
_local15 = _arg6;
_local16 = _arg7;
_local19 = _local15;
_local20 = _local16;
};
if (_local17 == 1){
_arg1 = addBox(_local10, _arg2, _local13, _local14);
_local22 = 0;
} else {
if (_local17 == 2){
_arg1 = addLong(_local10, _arg2, _local13, _local14);
_local22 = 1;
} else {
if (_local17 == 3){
_arg1 = addT(_local10, _arg2, _local13, _local14);
_local22 = 2;
} else {
if (_local17 == 4){
_arg1 = addJ(_local10, _arg2, _local13, _local14);
_local22 = 3;
} else {
if (_local17 == 5){
_arg1 = addL(_local10, _arg2, _local13, _local14);
_local22 = 4;
} else {
if (_local17 == 6){
_arg1 = addS(_local10, _arg2, _local13, _local14);
_local22 = 5;
} else {
if (_local17 == 7){
_arg1 = addZ(_local10, _arg2, _local13, _local14);
_local22 = 6;
} else {
if (_local17 == 8){
_arg1 = addCross(_local10, _arg2, _local13, _local14);
_local22 = 7;
} else {
if (_local17 == 9){
_arg1 = addBig(_local10, _arg2, _local13, _local14);
_local22 = 8;
} else {
if (_local17 == 10){
_arg1 = addVeryLong(_local10, _arg2, _local13, _local14);
_local22 = 9;
} else {
if (_local17 == 11){
_arg1 = addAlien(_local10, _arg2, _local13, _local14);
_local22 = 10;
} else {
if (_local17 == 12){
_arg1 = addWhoa(_local10, _arg2, _local13, _local14);
_local22 = 11;
} else {
if (_local17 == 13){
_arg1 = addCorner(_local10, _arg2, _local13, _local14);
_local22 = 27;
} else {
if (_local17 == 14){
_arg1 = addJesus(_local10, _arg2, _local13, _local14);
_local22 = 13;
} else {
if (_local17 == 15){
_arg1 = addWacky1(_local10, _arg2, _local13, _local14);
_local22 = 23;
} else {
if (_local17 == 16){
_arg1 = addWacky2(_local10, _arg2, _local13, _local14);
_local22 = 15;
} else {
if (_local17 == 17){
_arg1 = addWacky2(_local10, _arg2, _local13, _local14);
_local22 = 15;
} else {
if (_local17 == 18){
_arg1 = addWacky4(_local10, _arg2, _local13, _local14);
_local22 = 25;
} else {
if (_local17 == 19){
_arg1 = addPole(_local10, _arg2, _local13, _local14);
_local22 = 17;
} else {
if (_local17 == 20){
_arg1 = addCircle(_local10, _arg2, _local13, _local14, _local12);
_local22 = 18;
} else {
if (_local17 == 21){
_arg1 = addTriangleLeft(_local10, _arg2, _local13, _local14);
_local22 = 36;
} else {
if (_local17 == 22){
_arg1 = addTriangleRight(_local10, _arg2, _local13, _local14);
_local22 = 37;
} else {
if (_local17 == 23){
_arg1 = addPyramid(_local10, _arg2, _local13, _local14);
_local22 = 19;
} else {
if (_local17 == 24){
_arg1 = addSuperLong(_local10, _arg2, _local13, _local14);
_local22 = 20;
} else {
if (_local17 == 25){
_arg1 = addPyramidMini(_local10, _arg2, _local13, _local14);
} else {
if (_local17 == 27){
_arg1 = addBGBall(_local12, _local13, _local14);
_local22 = 21;
} else {
if (_local17 == 28){
_arg1 = addOrientedBGBox(_local15, _local16, _local13, _local14, _local10);
_local22 = 22;
} else {
if (_local17 == 29){
_arg1 = addCornerLong(_local10, _arg2, _local13, _local14);
_local22 = 14;
} else {
if (_local17 == 30){
_arg1 = addBlock(_local10, _arg2, _local13, _local14);
_local22 = 16;
} else {
if (_local17 == 31){
_arg1 = addWacky1Mirror(_local10, _arg2, _local13, _local14);
_local22 = 24;
} else {
if (_local17 == 32){
_arg1 = addWacky4Mirror(_local10, _arg2, _local13, _local14);
_local22 = 26;
} else {
if (_local17 == 33){
_arg1 = addWhoaMirror(_local10, _arg2, _local13, _local14);
_local22 = 12;
} else {
if (_local17 == 34){
_arg1 = addDiamond1(_local10, _arg2, _local13, _local14, _local12);
_local22 = 28;
} else {
if (_local17 == 35){
_arg1 = addDiamond2(_local10, _arg2, _local13, _local14);
_local22 = 29;
} else {
if (_local17 == 36){
_arg1 = addDiamond3(_local10, _arg2, _local13, _local14);
_local22 = 30;
} else {
if (_local17 == 37){
_arg1 = addConnect(_local10, _arg2, _local13, _local14);
_local22 = 31;
} else {
if (_local17 == 38){
_arg1 = addWideCross(_local10, _arg2, _local13, _local14);
_local22 = 34;
} else {
if (_local17 == 39){
_arg1 = addRocket(_local10, _arg2, _local13, _local14);
_local22 = 33;
} else {
if (_local17 == 40){
_arg1 = addConnectMirror(_local10, _arg2, _local13, _local14);
_local22 = 32;
} else {
if (_local17 == 41){
_arg1 = addSaw1(_local10, _arg2, _local13, _local14, _local12);
_local22 = 35;
} else {
if (_local17 == 42){
_arg1 = addPacman(_local10, _arg2, _local13, _local14);
_local22 = 38;
} else {
if (_local17 == 43){
_arg1 = addH(_local10, _arg2, _local13, _local14);
_local22 = 39;
} else {
if (_local17 == 44){
_arg1 = addSaw2(_local10, _arg2, _local13, _local14, _local12);
_local22 = 40;
} else {
if (_local17 == 45){
_arg1 = addHinge(_local10, _arg2, _local13, _local14);
_local22 = 41;
} else {
if (_local17 == 46){
_arg1 = addCircle1T(_local10, _arg2, _local13, _local14, _local12);
_local22 = 42;
} else {
if (_local17 == 47){
_arg1 = addPyramid1T(_local10, _arg2, _local13, _local14);
_local22 = 43;
} else {
if (_local17 == 48){
_arg1 = addBox1T(_local10, _arg2, _local13, _local14);
_local22 = 44;
} else {
if (_local17 == 49){
_arg1 = addBlock1T(_local10, _arg2, _local13, _local14);
_local22 = 45;
} else {
if (_local17 == 50){
_arg1 = addCog(_local10, _arg2, _local13, _local14, _local12);
_local22 = 46;
} else {
if (_local17 == 51){
_arg1 = addRotatingCross(_local10, _arg2, _local13, _local14);
_local22 = 47;
} else {
if (_local17 == 52){
_arg1 = addCircleHelium(_local10, _arg2, _local13, _local14, _local12);
_local22 = 48;
} else {
if (_local17 == 53){
_arg1 = addPyramidHelium(_local10, _arg2, _local13, _local14);
_local22 = 49;
} else {
if (_local17 == 54){
_arg1 = addBoxHelium(_local10, _arg2, _local13, _local14);
_local22 = 50;
} else {
if (_local17 == 55){
_arg1 = addBlockHelium(_local10, _arg2, _local13, _local14);
_local22 = 51;
} else {
if (_local17 == 56){
_arg1 = addGlueBall(_local12, _local13, _local14);
_local22 = 52;
} else {
if (_local17 == 57){
_arg1 = addKiila(_local10, _arg2, _local13, _local14);
_local22 = 53;
} else {
if (_local17 == 58){
_arg1 = addHingeBig(_local10, _arg2, _local13, _local14);
_local22 = 54;
} else {
if (_local17 == 59){
_arg1 = addRotatingCrossBig(_local10, _arg2, _local13, _local14);
_local22 = 55;
} else {
if (_local17 == 60){
_arg1 = addHingeVeryBig(_local10, _arg2, _local13, _local14);
_local22 = 56;
} else {
if (_local17 == 61){
_arg1 = addHoleBox(_local10, _arg2, _local13, _local14);
_local22 = 57;
} else {
if (_local17 == 62){
_arg1 = addRotatingCrossBlades(_local10, _arg2, _local13, _local14);
_local22 = 58;
} else {
if (_local17 == 63){
_arg1 = addRotatingCrossBox(_local10, _arg2, _local13, _local14);
_local22 = 59;
} else {
if (_local17 == 64){
_arg1 = addSalmiack(_local10, _arg2, _local13, _local14);
_local22 = 60;
} else {
if (_local17 == 65){
_arg1 = addHingeVeryBigStraight(_local10, _arg2, _local13, _local14);
_local22 = 61;
} else {
if (_local17 == 66){
_arg1 = addPoleG(_local10, _arg2, _local13, _local14);
_local22 = 62;
} else {
if (_local17 == 67){
_arg1 = addBoxG(_local10, _arg2, _local13, _local14);
_local22 = 63;
} else {
if (_local17 == 68){
_arg1 = addBlockG(_local10, _arg2, _local13, _local14);
_local22 = 64;
} else {
if (_local17 == 69){
_arg1 = addCrossG(_local10, _arg2, _local13, _local14);
_local22 = 65;
} else {
if (_local17 == 70){
_arg1 = addWideCrossG(_local10, _arg2, _local13, _local14);
_local22 = 66;
} else {
if (_local17 == 71){
_arg1 = addCircleG(_local10, _arg2, _local13, _local14, _local12);
_local22 = 67;
} else {
if (_local17 == 72){
_arg1 = addOrientedBox(_local15, _local16, _local13, _local14, _local10, _arg2);
_local22 = 68;
} else {
if (_local17 == 26){
_arg1 = addTargetArea(_local10, true, _local13, _local14, _local12);
_local22 = 69;
} else {
if (_local17 == 73){
_arg1 = addSensorHideWall(_local15, _local16, _local13, _local14, _local10, true);
_local22 = 70;
} else {
if (_local17 == 74){
_arg1 = addOrientedBoxSensorWall(_local15, _local16, _local13, _local14, _local10, _arg2, _local23);
_local22 = 1074;
} else {
if (_local17 == 75){
_arg1 = addSensorKillWall(_local15, _local16, _local13, _local14, _local10, true);
_local22 = 71;
} else {
if (_local17 == 76){
_arg1 = addSensorCreateWall(_local15, _local16, _local13, _local14, _local10, true);
_local22 = 72;
} else {
if (_local17 == 77){
_arg1 = addSensorHideWallInvert(_local15, _local16, _local13, _local14, _local10, true);
_local22 = 73;
} else {
if (_local17 == 78){
_arg1 = addOrientedBoxHeavy(_local15, _local16, _local13, _local14, _local10, _arg2);
_local22 = 74;
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
if (_arg1 == null){
return (null);
};
_arg1.SetXForm(new b2Vec2(_local13, _local14), _local11);
_arg1.m_userData._width = _local19;
_arg1.m_userData._height = _local20;
_arg1.m_userData._alpha = _local21;
_arg1.m_userData._currentBlock = _local22;
if (_local24){
_arg1.m_userData._color = _local23;
};
CreateShadowSprite(_arg1.m_userData);
return (_arg1);
}
public function addRotatingCross(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:UserData;
var _local7:b2Body;
var _local8:b2BodyDef;
var _local9:b2PolygonDef;
var _local10:b2RevoluteJointDef;
var _local11:b2Body;
var _local12:Bitmap;
_local5 = 20;
_local6 = new UserData();
_local6._iD = 51;
_local8 = new b2BodyDef();
_local9 = new b2PolygonDef();
_local10 = new b2RevoluteJointDef();
_local11 = m_world.GetGroundBody();
_local8 = new b2BodyDef();
_local8.position.Set(_arg3, _arg4);
_local8.angle = _arg1;
_local7 = m_world.CreateBody(_local8);
_local9.density = 20;
_local9.friction = _friction;
_local9.isSensor = _arg2;
_local9.vertexCount = 4;
_local9.vertices[0].Set(((-5 * 2) / _local5), (((-10 * 2) - 10) / _local5));
_local9.vertices[1].Set(((5 * 2) / _local5), (((-10 * 2) - 10) / _local5));
_local9.vertices[2].Set(((5 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local9.vertices[3].Set(((-5 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local7.CreateShape(_local9);
_local9.vertices[0].Set(((15 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local9.vertices[1].Set(((15 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local9.vertices[2].Set(((-15 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local9.vertices[3].Set(((-15 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local7.CreateShape(_local9);
_local9.vertices[0].Set(((-5 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local9.vertices[1].Set(((5 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local9.vertices[2].Set(((5 * 2) / _local5), (((20 * 2) - 10) / _local5));
_local9.vertices[3].Set(((-5 * 2) / _local5), (((20 * 2) - 10) / _local5));
_local7.CreateShape(_local9);
_local7.m_userData = _local6;
_local7.SetMassFromShapes();
_local12 = new Bitmap(new _classRotatingCross().bitmapData);
_local12.x = -11405;
_local12.y = 10;
_local12.smoothing = true;
m_sprite.addChild(_local12);
_local7.m_userData._sprite = _local12;
_local10.Initialize(_local11, _local7, new b2Vec2(_arg3, _arg4));
_local10.motorSpeed = 0;
_local10.enableMotor = false;
_local6._object = (m_world.CreateJoint(_local10) as b2RevoluteJoint);
return (_local7);
}
public function addWacky1Mirror(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-60 / _local5), (0 / _local5));
_local8.vertices[1].Set((-40 / _local5), (0 / _local5));
_local8.vertices[2].Set((-40 / _local5), (20 / _local5));
_local8.vertices[3].Set((-60 / _local5), (20 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-60 / _local5), (-20 / _local5));
_local8.vertices[1].Set((0 / _local5), (-20 / _local5));
_local8.vertices[2].Set((0 / _local5), (0 / _local5));
_local8.vertices[3].Set((-60 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-20 / _local5), (0 / _local5));
_local8.vertices[1].Set((60 / _local5), (0 / _local5));
_local8.vertices[2].Set((60 / _local5), (20 / _local5));
_local8.vertices[3].Set((-20 / _local5), (20 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((40 / _local5), (-20 / _local5));
_local8.vertices[1].Set((60 / _local5), (-20 / _local5));
_local8.vertices[2].Set((60 / _local5), (0 / _local5));
_local8.vertices[3].Set((40 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 31;
_local9 = new Bitmap(new _classBrickWacky1Mirror().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function CreateTextureForBody(_arg1:b2Body, _arg2:Boolean, _arg3:Bitmap, _arg4:Boolean, _arg5:Boolean):void{
var _local6:b2Vec2;
var _local7:UserData;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
_local6 = _arg1.GetPosition();
_local7 = _arg1.GetUserData();
_local8 = (((_local6.x * m_debugDraw.m_drawScale) + 300) - _local7._width);
_local9 = (((_local6.y * m_debugDraw.m_drawScale) + 250) - _local7._height);
_local10 = _arg1.GetAngle();
if ((((((_local10 < -0.01)) || ((_local10 > 0.01)))) || (_arg5))){
_local11 = (_arg3.width - (_local7._width * 2));
_local12 = (_arg3.height - (_local7._height * 2));
_local8 = (Math.random() * _local11);
_local9 = (Math.random() * _local12);
if (_local8 < 0){
_local8 = 0;
};
if (_local9 < 0){
_local9 = 0;
};
};
if (_arg2){
createSpriteBoxWithOutlines(_arg3, _local7, _local8, _local9);
} else {
createSpriteBox(_arg3, _local7, _local8, _local9);
};
if (_arg4){
CreateShadowSprite(_local7);
};
}
public function addAlien(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-50 / _local5), (-10 / _local5));
_local8.vertices[1].Set((50 / _local5), (-10 / _local5));
_local8.vertices[2].Set((50 / _local5), (10 / _local5));
_local8.vertices[3].Set((-50 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-10 / _local5), (-30 / _local5));
_local8.vertices[1].Set((10 / _local5), (-30 / _local5));
_local8.vertices[2].Set((10 / _local5), (-10 / _local5));
_local8.vertices[3].Set((-10 / _local5), (-10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-50 / _local5), (10 / _local5));
_local8.vertices[1].Set((-30 / _local5), (10 / _local5));
_local8.vertices[2].Set((-30 / _local5), (30 / _local5));
_local8.vertices[3].Set((-50 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((30 / _local5), (10 / _local5));
_local8.vertices[1].Set((50 / _local5), (10 / _local5));
_local8.vertices[2].Set((50 / _local5), (30 / _local5));
_local8.vertices[3].Set((30 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 11;
_local9 = new Bitmap(new _classBrickAlien().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addBig(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-40 / _local5), (-10 / _local5));
_local8.vertices[1].Set((40 / _local5), (-10 / _local5));
_local8.vertices[2].Set((40 / _local5), (30 / _local5));
_local8.vertices[3].Set((-40 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((0 / _local5), (-30 / _local5));
_local8.vertices[1].Set((20 / _local5), (-30 / _local5));
_local8.vertices[2].Set((20 / _local5), (-10 / _local5));
_local8.vertices[3].Set((0 / _local5), (-10 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 9;
_local9 = new Bitmap(new _classBrickBig().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function calculateIPhoneDottedLineLimits():void{
_limitY320x480 = (-((240 - 110)) / m_debugDraw.m_drawScale);
_limitY480x320 = (-((160 - 110)) / m_debugDraw.m_drawScale);
_limitYStopMode = ((250 - 45) / m_debugDraw.m_drawScale);
}
public function addLong(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.SetAsBox((40 / _local5), (10 / _local5));
_local8.isSensor = _arg2;
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 2;
_local9 = new Bitmap(new _classBrickI().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function DestroyBodiesThatTouch(_arg1:b2Body, _arg2:Bitmap):void{
var _local3:b2Body;
var _local4:b2Body;
var _local5:UserData;
var _local6:int;
if (_arg2 == null){
return;
};
_local3 = m_world.m_bodyList;
while (_local3) {
_local4 = _local3;
_local3 = _local3.m_next;
if (_local4.m_userData != null){
_local5 = _local4.m_userData;
_local6 = 0;
while (_local6 < _local5._collidesWithSensorsN) {
if (_local5._collidesWithSensors[_local6] == _arg1){
Main.m_this.playBlockExplosion(1);
coverInDust(_local4, _arg2);
DestroyBody(_local4);
break;
};
_local6++;
};
};
};
}
public function addRotatingCrossBig(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:UserData;
var _local7:b2Body;
var _local8:b2BodyDef;
var _local9:b2PolygonDef;
var _local10:b2RevoluteJointDef;
var _local11:b2Body;
var _local12:Bitmap;
_local5 = 20;
_local6 = new UserData();
_local6._iD = 59;
_local8 = new b2BodyDef();
_local9 = new b2PolygonDef();
_local10 = new b2RevoluteJointDef();
_local11 = m_world.GetGroundBody();
_local8 = new b2BodyDef();
_local8.position.Set(_arg3, _arg4);
_local8.angle = _arg1;
_local7 = m_world.CreateBody(_local8);
_local9.density = 20;
_local9.friction = _friction;
_local9.isSensor = _arg2;
_local9.vertexCount = 4;
_local9.vertices[0].Set((-10 / _local5), (-50 / _local5));
_local9.vertices[1].Set((10 / _local5), (-50 / _local5));
_local9.vertices[2].Set((10 / _local5), (-10 / _local5));
_local9.vertices[3].Set((-10 / _local5), (-10 / _local5));
_local7.CreateShape(_local9);
_local9.vertices[0].Set((50 / _local5), (-10 / _local5));
_local9.vertices[1].Set((50 / _local5), (10 / _local5));
_local9.vertices[2].Set((-50 / _local5), (10 / _local5));
_local9.vertices[3].Set((-50 / _local5), (-10 / _local5));
_local7.CreateShape(_local9);
_local9.vertices[0].Set((-10 / _local5), (10 / _local5));
_local9.vertices[1].Set((10 / _local5), (10 / _local5));
_local9.vertices[2].Set((10 / _local5), (50 / _local5));
_local9.vertices[3].Set((-10 / _local5), (50 / _local5));
_local7.CreateShape(_local9);
_local7.m_userData = _local6;
_local7.SetMassFromShapes();
_local12 = new Bitmap(new _classRotatingCrossBig().bitmapData);
_local12.x = -11405;
_local12.y = 10;
_local12.smoothing = true;
m_sprite.addChild(_local12);
_local7.m_userData._sprite = _local12;
_local10.Initialize(_local11, _local7, new b2Vec2(_arg3, _arg4));
_local10.motorSpeed = 0;
_local10.enableMotor = false;
_local6._object = (m_world.CreateJoint(_local10) as b2RevoluteJoint);
return (_local7);
}
public function addRocket(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-40 / _local5), (-30 / _local5));
_local8.vertices[1].Set((0 / _local5), (-30 / _local5));
_local8.vertices[2].Set((0 / _local5), (-10 / _local5));
_local8.vertices[3].Set((-40 / _local5), (-10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-20 / _local5), (-10 / _local5));
_local8.vertices[1].Set((40 / _local5), (-10 / _local5));
_local8.vertices[2].Set((40 / _local5), (10 / _local5));
_local8.vertices[3].Set((-20 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-40 / _local5), (10 / _local5));
_local8.vertices[1].Set((0 / _local5), (10 / _local5));
_local8.vertices[2].Set((0 / _local5), (30 / _local5));
_local8.vertices[3].Set((-40 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 39;
_local9 = new Bitmap(new _classBrickRocket().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addCircle(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000, _arg5:Number=10):b2Body{
var _local6:b2Body;
_local6 = addBallGeneral(_arg5, _arg3, _arg4, 20, _density, _arg2);
setBallSprite(new Bitmap(new _classSun().bitmapData), _local6.m_userData, _arg5);
return (_local6);
}
public function addRotatingCrossBlades(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:UserData;
var _local7:b2Body;
var _local8:b2BodyDef;
var _local9:b2PolygonDef;
var _local10:b2RevoluteJointDef;
var _local11:b2Body;
var _local12:Bitmap;
_local5 = 20;
_local6 = new UserData();
_local6._iD = 62;
_local8 = new b2BodyDef();
_local9 = new b2PolygonDef();
_local10 = new b2RevoluteJointDef();
_local11 = m_world.GetGroundBody();
_local8 = new b2BodyDef();
_local8.position.Set(_arg3, _arg4);
_local8.angle = _arg1;
_local7 = m_world.CreateBody(_local8);
_local9.density = 20;
_local9.friction = _friction;
_local9.isSensor = _arg2;
_local9.vertexCount = 4;
_local9.vertices[0].Set((-10 / _local5), (-50 / _local5));
_local9.vertices[1].Set((10 / _local5), (-30 / _local5));
_local9.vertices[2].Set((10 / _local5), (-10 / _local5));
_local9.vertices[3].Set((-10 / _local5), (-10 / _local5));
_local7.CreateShape(_local9);
_local9.vertices[0].Set((50 / _local5), (-10 / _local5));
_local9.vertices[1].Set((30 / _local5), (10 / _local5));
_local9.vertices[2].Set((-50 / _local5), (10 / _local5));
_local9.vertices[3].Set((-30 / _local5), (-10 / _local5));
_local7.CreateShape(_local9);
_local9.vertices[0].Set((-10 / _local5), (10 / _local5));
_local9.vertices[1].Set((10 / _local5), (10 / _local5));
_local9.vertices[2].Set((10 / _local5), (50 / _local5));
_local9.vertices[3].Set((-10 / _local5), (30 / _local5));
_local7.CreateShape(_local9);
_local7.m_userData = _local6;
_local7.SetMassFromShapes();
_local12 = new Bitmap(new _classRotatingCrossBlades().bitmapData);
_local12.x = -11405;
_local12.y = 10;
_local12.smoothing = true;
m_sprite.addChild(_local12);
_local7.m_userData._sprite = _local12;
_local10.Initialize(_local11, _local7, new b2Vec2(_arg3, _arg4));
_local10.motorSpeed = 0;
_local10.enableMotor = false;
_local6._object = (m_world.CreateJoint(_local10) as b2RevoluteJoint);
return (_local7);
}
public function addCircle1T(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000, _arg5:Number=10):b2Body{
var _local6:b2Body;
_local6 = addBallGeneral(_arg5, _arg3, _arg4, 46, (_density * 5), _arg2);
setBallSprite(new Bitmap(new _classSun1T().bitmapData), _local6.m_userData, _arg5);
return (_local6);
}
public function addBlockHelium(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.SetAsBox((40 / _local5), (40 / _local5));
_local8.isSensor = _arg2;
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 55;
_local6.m_userData._helium = true;
_local9 = new Bitmap(new _classBrickBlockHelium().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function explodeWaterDrop(_arg1:b2Body):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:Number;
var _local5:int;
var _local6:Number;
var _local7:int;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Body;
var _local12:Number;
var _local13:Number;
var _local14:b2Vec2;
_local2 = _arg1.GetLinearVelocity();
_local3 = _arg1.GetPosition();
_local4 = (Math.random() * 0.5);
_local5 = 30;
_local6 = 0.07;
if (Main.s_quality == 0){
_local5 = 30;
} else {
if (Main.s_quality == 1){
_local5 = 30;
} else {
if (Main.s_quality == 2){
_local5 = 20;
} else {
_local5 = 10;
};
};
};
_local7 = 0;
while (_local7 < _local5) {
if (Math.random() < 0.5){
} else {
_local8 = (Math.cos(_local4) * _local6);
_local9 = (Math.sin(_local4) * _local6);
_local4 = (_local4 + ((2 * Math.PI) / _local5));
_local10 = ((Math.random() * 0.3) + 1);
_local11 = addBallGeneral(_local10, (_local3.x + _local8), (_local3.y + _local9), 101, _arg1.m_shapeList.m_density, false, _arg1.m_userData._color, 10);
_local12 = ((Math.random() * 0.7) + 0.3);
_local13 = ((Math.random() * 0.7) + 0.3);
_local14 = new b2Vec2(((_local8 * 40) * _local12), ((_local9 * 40) * _local13));
new b2Vec2(((_local8 * 40) * _local12), ((_local9 * 40) * _local13)).x = (_local14.x + _local2.x);
_local14.y = (_local14.y + _local2.y);
_local11.SetLinearVelocity(_local14);
_local11.WakeUp();
setBallSprite(new Bitmap(new _classWaterDrop().bitmapData), _local11.m_userData, _local10);
};
_local7++;
};
DestroyBody(_arg1);
}
public function getEditorLevel():String{
var _local1:String;
var _local2:b2Body;
var _local3:UserData;
var _local4:Number;
_local1 = " <level> ";
_local1 = (_local1 + (((m_debugDraw.m_drawScale + " ") + _drawScaleAdder) + " "));
_local1 = (_local1 + "0 ");
if (Main._iceMode){
_local1 = (_local1 + "1001 1 ");
} else {
_local1 = (_local1 + "1001 0 ");
};
_local2 = m_world.m_bodyList;
for (;_local2;(_local2 = _local2.m_next)) {
if (_local2.m_userData != null){
_local3 = _local2.m_userData;
if ((((_local3._iD <= 26)) || ((((((((((((((((_local3._iD >= 29)) && (!((_local3._iD == 72))))) && (!((_local3._iD == 73))))) && (!((_local3._iD == 74))))) && (!((_local3._iD == 75))))) && (!((_local3._iD == 76))))) && (!((_local3._iD == 77))))) && (!((_local3._iD == 78))))))){
_local1 = (_local1 + (_local3._iD + " "));
if ((((((((((((((((((((_local3._iD == 20)) || ((_local3._iD == 26)))) || ((_local3._iD == 34)))) || ((_local3._iD == 41)))) || ((_local3._iD == 44)))) || ((_local3._iD == 46)))) || ((_local3._iD == 50)))) || ((_local3._iD == 52)))) || ((_local3._iD == 56)))) || ((_local3._iD == 71)))){
_local1 = (_local1 + (_local3._radius + " "));
};
_local1 = (_local1 + (((((_local2.GetPosition().x + " ") + _local2.GetPosition().y) + " ") + _local2.GetAngle()) + " "));
} else {
if ((((_local3._iD == 72)) || ((_local3._iD == 78)))){
_local1 = (_local1 + (_local3._iD + " "));
_local1 = (_local1 + (((_local2.GetPosition().x + " ") + _local2.GetPosition().y) + " "));
_local1 = (_local1 + (((_local2.m_userData._width + " ") + _local2.m_userData._height) + " "));
_local4 = _local2.GetAngle();
_local1 = (_local1 + (_local4 + " "));
trace(("out angle = " + _local4));
} else {
if ((((((((((_local3._iD == 73)) || ((_local3._iD == 74)))) || ((_local3._iD == 75)))) || ((_local3._iD == 76)))) || ((_local3._iD == 77)))){
_local1 = (_local1 + (_local3._iD + " "));
_local1 = (_local1 + (((_local2.GetPosition().x + " ") + _local2.GetPosition().y) + " "));
_local1 = (_local1 + (((_local2.m_userData._width + " ") + _local2.m_userData._height) + " "));
_local4 = _local2.GetAngle();
_local1 = (_local1 + (_local4 + " "));
_local1 = (_local1 + (_local2.m_userData._color + " "));
trace(("out angle = " + _local4));
} else {
if (_local3._iD == 27){
_local1 = (_local1 + (_local3._iD + " "));
_local1 = (_local1 + (_local3._radius + " "));
trace(((("27 out " + _local2.GetPosition().x) + " ") + _local2.GetPosition().y));
_local1 = (_local1 + (((_local2.GetPosition().x + " ") + _local2.GetPosition().y) + " "));
} else {
if (_local3._iD == 28){
_local1 = (_local1 + (_local3._iD + " "));
_local1 = (_local1 + (((_local2.GetPosition().x + " ") + _local2.GetPosition().y) + " "));
_local1 = (_local1 + (((_local2.m_userData._width + " ") + _local2.m_userData._height) + " "));
_local4 = _local2.GetAngle();
_local1 = (_local1 + (_local4 + " "));
trace(("out angle = " + _local4));
continue;
};
};
};
};
};
};
};
_local1 = (_local1 + (("1000 " + m_goalScale) + " "));
return (_local1);
}
public function addSuperLong(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.SetAsBox((120 / _local5), (10 / _local5));
_local8.isSensor = _arg2;
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 24;
_local9 = new Bitmap(new _classSuperLong().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addOrientedBGBox(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):b2Body{
var _local6:Number;
var _local7:b2PolygonDef;
var _local8:b2BodyDef;
var _local9:b2Body;
_local6 = 20;
_local7 = new b2PolygonDef();
_local7.friction = _friction;
_local7.restitution = 0;
_local8 = new b2BodyDef();
_local7.SetAsOrientedBox((_arg1 / _local6), (_arg2 / _local6), new b2Vec2(0, 0), _arg5);
_local8.position.Set(_arg3, _arg4);
_local9 = m_world.CreateBody(_local8);
_local9.CreateShape(_local7);
_local9.SetMassFromShapes();
_local9.m_userData = new UserData();
_local9.m_userData._iD = 28;
_local9.m_userData._width = _arg1;
_local9.m_userData._height = _arg2;
_local9.m_userData._color = 0xFFFFFF;
return (_local9);
}
public function addWaterDrop(_arg1:Number, _arg2:Number, _arg3:Number):b2Body{
var _local4:Number;
var _local5:b2BodyDef;
var _local6:b2Body;
var _local7:b2CircleDef;
if (_stabilizing){
return (null);
};
_local4 = 20;
_local5 = new b2BodyDef();
_local5.isSleeping = true;
_local5.position.Set(_arg2, _arg3);
_local6 = m_world.CreateBody(_local5);
_local7 = new b2CircleDef();
_local7.radius = (_arg1 / _local4);
_local7.density = (_diamondDensity * 0.03);
_local7.friction = _friction;
_local7.restitution = 0.3;
_local6.CreateShape(_local7);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 100;
_local6.m_userData._radius = _arg1;
_local6.m_userData._color = 9101823;
_local6.m_userData._glowAlphaAngle = (Math.PI * 0.5);
_local6.SetBullet(true);
setBallSprite(new Bitmap(new _classWaterDrop().bitmapData), _local6.m_userData, _arg1);
return (_local6);
}
public function addSensorCreateWall(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean):b2Body{
var _local7:Number;
var _local8:b2PolygonDef;
var _local9:b2BodyDef;
var _local10:b2Body;
var _local11:int;
var _local12:int;
var _local13:int;
_local7 = 20;
_local8 = new b2PolygonDef();
_local8.friction = _friction;
_local8.density = 0;
_local8.isSensor = _arg6;
_local8.restitution = 0;
_local9 = new b2BodyDef();
_local8.SetAsOrientedBox((_arg1 / _local7), (_arg2 / _local7), new b2Vec2(0, 0), _arg5);
_local9.position.Set(_arg3, _arg4);
_local10 = m_world.CreateBody(_local9);
_local10.CreateShape(_local8);
_local10.SetMassFromShapes();
_local10.m_userData = new UserData();
_local10.m_userData._iD = 76;
_local10.m_userData._width = _arg1;
_local10.m_userData._height = _arg2;
_local11 = 30;
_local12 = (int((Math.random() * 191)) + 64);
_local13 = 30;
_local10.m_userData._color = (((_local11 << 16) | (_local12 << 8)) | _local13);
return (_local10);
}
public function addConnect(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-50 / _local5), (-20 / _local5));
_local8.vertices[1].Set((-30 / _local5), (-20 / _local5));
_local8.vertices[2].Set((-30 / _local5), (0 / _local5));
_local8.vertices[3].Set((-50 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-50 / _local5), (0 / _local5));
_local8.vertices[1].Set((10 / _local5), (0 / _local5));
_local8.vertices[2].Set((10 / _local5), (20 / _local5));
_local8.vertices[3].Set((-50 / _local5), (20 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-10 / _local5), (-20 / _local5));
_local8.vertices[1].Set((50 / _local5), (-20 / _local5));
_local8.vertices[2].Set((50 / _local5), (0 / _local5));
_local8.vertices[3].Set((-10 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((30 / _local5), (0 / _local5));
_local8.vertices[1].Set((50 / _local5), (0 / _local5));
_local8.vertices[2].Set((50 / _local5), (20 / _local5));
_local8.vertices[3].Set((30 / _local5), (20 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 37;
_local9 = new Bitmap(new _classBrickConnect().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addHoleBox(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-30 / _local5), (-30 / _local5));
_local8.vertices[1].Set((30 / _local5), (-30 / _local5));
_local8.vertices[2].Set((30 / _local5), (-10 / _local5));
_local8.vertices[3].Set((-30 / _local5), (-10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-30 / _local5), (-10 / _local5));
_local8.vertices[1].Set((10 / _local5), (-10 / _local5));
_local8.vertices[2].Set((10 / _local5), (10 / _local5));
_local8.vertices[3].Set((-30 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-30 / _local5), (10 / _local5));
_local8.vertices[1].Set((30 / _local5), (10 / _local5));
_local8.vertices[2].Set((30 / _local5), (30 / _local5));
_local8.vertices[3].Set((-30 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 61;
_local9 = new Bitmap(new _classBrickHoleBox().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addWacky1(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-60 / _local5), (-20 / _local5));
_local8.vertices[1].Set((-40 / _local5), (-20 / _local5));
_local8.vertices[2].Set((-40 / _local5), (0 / _local5));
_local8.vertices[3].Set((-60 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-60 / _local5), (0 / _local5));
_local8.vertices[1].Set((0 / _local5), (0 / _local5));
_local8.vertices[2].Set((0 / _local5), (20 / _local5));
_local8.vertices[3].Set((-60 / _local5), (20 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-20 / _local5), (-20 / _local5));
_local8.vertices[1].Set((60 / _local5), (-20 / _local5));
_local8.vertices[2].Set((60 / _local5), (0 / _local5));
_local8.vertices[3].Set((-20 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((40 / _local5), (0 / _local5));
_local8.vertices[1].Set((60 / _local5), (0 / _local5));
_local8.vertices[2].Set((60 / _local5), (20 / _local5));
_local8.vertices[3].Set((40 / _local5), (20 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 15;
_local9 = new Bitmap(new _classBrickWacky1().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addWacky2(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-40 / _local5), (-30 / _local5));
_local8.vertices[1].Set((0 / _local5), (-30 / _local5));
_local8.vertices[2].Set((0 / _local5), (-10 / _local5));
_local8.vertices[3].Set((-40 / _local5), (-10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-20 / _local5), (-10 / _local5));
_local8.vertices[1].Set((20 / _local5), (-10 / _local5));
_local8.vertices[2].Set((20 / _local5), (10 / _local5));
_local8.vertices[3].Set((-20 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-40 / _local5), (10 / _local5));
_local8.vertices[1].Set((0 / _local5), (10 / _local5));
_local8.vertices[2].Set((0 / _local5), (30 / _local5));
_local8.vertices[3].Set((-40 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((20 / _local5), (-30 / _local5));
_local8.vertices[1].Set((40 / _local5), (-30 / _local5));
_local8.vertices[2].Set((40 / _local5), (30 / _local5));
_local8.vertices[3].Set((20 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 16;
_local9 = new Bitmap(new _classBrickWacky2().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function twinkleBody(_arg1:b2Body):void{
var _local2:UserData;
var _local3:b2XForm;
var _local4:b2Vec2;
var _local5:int;
var _local6:uint;
var _local7:b2Shape;
var _local8:int;
if (_stabilizing){
return;
};
_local2 = _arg1.GetUserData();
_local2._twinkleSkip--;
if (_local2._twinkleSkip >= 0){
return;
};
_local2._twinkleSkip = 5;
_local3 = _arg1.GetXForm();
_local4 = _arg1.GetPosition();
_local5 = 0;
_local6 = 4294967295;
_local7 = _arg1.GetShapeList();
while (_local7 != null) {
_local5++;
_local7 = _local7.GetNext();
};
_local8 = (Math.random() * _local5);
_local5 = 0;
_local7 = _arg1.GetShapeList();
while (_local7 != null) {
if (_local5 == _local8){
twinkleShape(_local7, _local4, _local3, _local6);
return;
};
_local5++;
_local7 = _local7.GetNext();
};
}
public function addSensorHideWall(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean):b2Body{
var _local7:Number;
var _local8:b2PolygonDef;
var _local9:b2BodyDef;
var _local10:b2Body;
var _local11:int;
var _local12:int;
var _local13:int;
_local7 = 20;
_local8 = new b2PolygonDef();
_local8.friction = _friction;
_local8.density = 0;
_local8.isSensor = _arg6;
_local8.restitution = 0;
_local9 = new b2BodyDef();
_local8.SetAsOrientedBox((_arg1 / _local7), (_arg2 / _local7), new b2Vec2(0, 0), _arg5);
_local9.position.Set(_arg3, _arg4);
_local10 = m_world.CreateBody(_local9);
_local10.CreateShape(_local8);
_local10.SetMassFromShapes();
_local10.m_userData = new UserData();
_local10.m_userData._iD = 73;
_local10.m_userData._width = _arg1;
_local10.m_userData._height = _arg2;
_local11 = 30;
_local12 = 30;
_local13 = (int((Math.random() * 191)) + 64);
_local10.m_userData._color = (((_local11 << 16) | (_local12 << 8)) | _local13);
return (_local10);
}
public function addHinge(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
var _local10:b2RevoluteJointDef;
var _local11:b2Vec2;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-60 / _local5), (-10 / _local5));
_local8.vertices[1].Set((60 / _local5), (-10 / _local5));
_local8.vertices[2].Set((60 / _local5), (10 / _local5));
_local8.vertices[3].Set((-60 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 45;
_local9 = new Bitmap(new _classBrickHinge().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
_local10 = new b2RevoluteJointDef();
_local11 = _local6.GetPosition();
_local10.Initialize(m_world.GetGroundBody(), _local6, _local11);
_local10.enableMotor = false;
_local6.m_userData._object = (m_world.CreateJoint(_local10) as b2RevoluteJoint);
return (_local6);
}
public function addWacky4(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-30 / _local5), (-40 / _local5));
_local8.vertices[1].Set((-10 / _local5), (-40 / _local5));
_local8.vertices[2].Set((-10 / _local5), (40 / _local5));
_local8.vertices[3].Set((-30 / _local5), (40 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-10 / _local5), (-40 / _local5));
_local8.vertices[1].Set((10 / _local5), (-40 / _local5));
_local8.vertices[2].Set((10 / _local5), (-20 / _local5));
_local8.vertices[3].Set((-10 / _local5), (-20 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((10 / _local5), (-40 / _local5));
_local8.vertices[1].Set((30 / _local5), (-40 / _local5));
_local8.vertices[2].Set((30 / _local5), (0 / _local5));
_local8.vertices[3].Set((10 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 18;
_local9 = new Bitmap(new _classBrickWacky4().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addDiamond1(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000, _arg5:Number=10):b2Body{
var _local6:b2Body;
_local6 = addBallGeneral(_arg5, _arg3, _arg4, 34, _diamondDensity, _arg2);
setBallSprite(new Bitmap(new _classDiamond1().bitmapData), _local6.m_userData, _arg5);
return (_local6);
}
public function addDiamond2(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local8.density = _diamondDensity;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.SetAsBox((20 / _local5), (20 / _local5));
_local8.isSensor = _arg2;
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 35;
_local9 = new Bitmap(new _classDiamond2().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addCog(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000, _arg5:Number=4):b2Body{
var _local6:Bitmap;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local7 = Math.random();
_local8 = 0;
_local9 = 0;
_local10 = (6 + ((Main.m_currId / 5.5) * 2));
if (_local7 < (1 / _local10)){
_local6 = new Bitmap(new _classVine1().bitmapData);
_local6.scaleX = (_arg5 / 38);
} else {
if (_local7 < (2 / _local10)){
_local6 = new Bitmap(new _classVine2().bitmapData);
_local6.scaleX = (_arg5 / 38);
} else {
if (_local7 < (3 / _local10)){
_local6 = new Bitmap(new _classVine3().bitmapData);
_local6.scaleX = (_arg5 / 34);
} else {
if (_local7 < (4 / _local10)){
_local6 = new Bitmap(new _classVine4().bitmapData);
_local6.scaleX = (_arg5 / 34);
} else {
if (_local7 < (5 / _local10)){
_local6 = new Bitmap(new _classVine5().bitmapData);
_local6.scaleX = (_arg5 / 38);
_local8 = (-(_local6.scaleX) * 24);
} else {
if (_local7 < (6 / _local10)){
_local6 = new Bitmap(new _classVine6().bitmapData);
_local6.scaleX = (_arg5 / 38);
_local8 = (-(_local6.scaleX) * 24);
} else {
if (_local7 < (7 / _local10)){
_local6 = new Bitmap(new _classVine7().bitmapData);
_local6.scaleX = (_arg5 / 38);
} else {
if (_local7 < (8 / _local10)){
_local6 = new Bitmap(new _classVine8().bitmapData);
_local6.scaleX = (_arg5 / 38);
} else {
if (_local7 < (9 / _local10)){
_local6 = new Bitmap(new _classVine9().bitmapData);
_local6.scaleX = (_arg5 / 38);
} else {
if (_local7 < (10 / _local10)){
_local6 = new Bitmap(new _classVine10().bitmapData);
_local6.scaleX = (_arg5 / 38);
} else {
if (_local7 < (11 / _local10)){
_local6 = new Bitmap(new _classVine11().bitmapData);
_local6.scaleX = (_arg5 / 38);
} else {
if (_local7 < (12 / _local10)){
_local6 = new Bitmap(new _classVine12().bitmapData);
_local6.scaleX = (_arg5 / 38);
} else {
if (_local7 < (13 / _local10)){
_local6 = new Bitmap(new _classVine13().bitmapData);
_local6.scaleX = (_arg5 / 38);
} else {
_local6 = new Bitmap(new _classVine14().bitmapData);
_local6.scaleX = (_arg5 / 38);
};
};
};
};
};
};
};
};
};
};
};
};
};
_local6.scaleY = _local6.scaleX;
_local6.x = ((((_arg3 * m_debugDraw.m_drawScale) + 300) - (_local6.width * 0.5)) + _local9);
_local6.y = ((((_arg4 * m_debugDraw.m_drawScale) + 250) - (_local6.height * 0.5)) + _local8);
_local6.smoothing = true;
_local6.alpha = 0.7;
addTopProp(_local6);
return (null);
}
public function createSpriteBox(_arg1:Bitmap, _arg2:UserData, _arg3:Number, _arg4:Number):void{
var _local5:BitmapData;
var _local6:BitmapData;
_local5 = _arg1.bitmapData;
_local6 = new BitmapData((_arg2._width * 2), (_arg2._height * 2), false, 0);
_local6.copyPixels(_local5, new Rectangle(_arg3, _arg4, (_arg2._width * 2), (_arg2._height * 2)), new Point(0, 0));
_arg2._sprite = new Bitmap(_local6);
_arg2._sprite.smoothing = true;
_arg2._sprite.x = -11405;
_arg2._sprite.y = 10;
m_sprite.addChild(_arg2._sprite);
}
public function addBox1T(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local8.density = (_density * 5);
_local8.friction = _friction;
_local8.restitution = 0;
_local8.SetAsBox((20 / _local5), (20 / _local5));
_local8.isSensor = _arg2;
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 48;
_local9 = new Bitmap(new _classBrickO1T().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addDiamond3(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _diamondDensity;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 6;
_local8.vertices[0].Set((14 / _local5), (-25 / _local5));
_local8.vertices[1].Set((30 / _local5), (0 / _local5));
_local8.vertices[2].Set((14 / _local5), (25 / _local5));
_local8.vertices[3].Set((-14 / _local5), (25 / _local5));
_local8.vertices[4].Set((-30 / _local5), (0 / _local5));
_local8.vertices[5].Set((-14 / _local5), (-25 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 36;
_local9 = new Bitmap(new _classDiamond3().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addTargetArea(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000, _arg5:Number=10):b2Body{
var _local6:b2Body;
_local6 = addBallGeneral(_arg5, _arg3, _arg4, 26, 0, true);
if (_level == 29){
setBallSprite(new Bitmap(new _classFinalExit().bitmapData), _local6.m_userData, (_arg5 * 1.2));
} else {
setBallSprite(new Bitmap(new _classTunnelHole().bitmapData), _local6.m_userData, _arg5);
};
return (_local6);
}
private function CreateShadowSprite(_arg1:UserData):void{
var _local2:BitmapData;
var _local3:BitmapData;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:uint;
var _local9:Bitmap;
if ((((((_arg1 == null)) || ((_arg1._sprite == null)))) || (!((_arg1._spriteShadow == null))))){
return;
};
_local2 = _arg1._sprite.bitmapData;
_local3 = _local2.clone();
_local4 = _local2.width;
_local5 = _local2.height;
_arg1._shadowOffsetX = 4;
_arg1._shadowOffsetY = 4;
_local6 = 0;
while (_local6 < _local5) {
_local7 = 0;
while (_local7 < _local4) {
_local8 = _local2.getPixel32(_local7, _local6);
_local8 = (_local8 & 4278190080);
_local3.setPixel32(_local7, _local6, _local8);
_local7++;
};
_local6++;
};
_local9 = new Bitmap(_local3);
_arg1._spriteShadow = _local9;
m_sprite.addChild(_local9);
}
private function twinkleBodyFrames(_arg1:b2Body):void{
var _local2:b2XForm;
var _local3:b2Vec2;
var _local4:UserData;
var _local5:uint;
var _local6:Number;
var _local7:Number;
if (_stabilizing){
return;
};
_local2 = _arg1.GetXForm();
_local3 = _arg1.GetPosition();
_local4 = _arg1.GetUserData();
_local5 = 4294967295;
_local6 = _local4._particleLeftOvers;
_local7 = (_local4._particleVolume / 0x0200);
if (_local7 < 0.8){
_local7 = 0.8;
};
_local6 = (_local6 + _local7);
while (_local6 >= 1) {
twinkleShapeFrames(_arg1.GetShapeList(), _local3, _local2, _local5, _local4);
_local6--;
};
_local4._particleLeftOvers = _local6;
}
public function addBGBox(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):b2Body{
return (addOrientedBGBox(_arg1, _arg2, _arg3, _arg4, 0));
}
private function isIPhoneSleeping(_arg1:Number):Boolean{
return (false);
}
private function drawSprite(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:BitmapData, _arg6:Number=1, _arg7:Number=1):void{
var _local8:ColorTransform;
var _local9:Matrix;
_local8 = new ColorTransform();
_local8.alphaMultiplier = _arg7;
_local9 = new Matrix();
_local9.rotate(_arg2);
_local9.scale(_arg6, _arg6);
_local9.translate(_arg3, _arg4);
_arg5.draw(_arg1, _local9, _local8, "normal", null, true);
}
public function Update(_arg1:Boolean, _arg2:Bitmap):void{
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local6:uint;
var _local7:int;
var _local8:Number;
var _local9:Number;
var _local10:UserData;
var _local11:int;
var _local12:b2Body;
var _local13:Array;
var _local14:b2Body;
var _local15:Bitmap;
var _local16:b2Vec2;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Bitmap;
if (!_arg1){
return;
};
if (_diamondSprite != null){
_local8 = (_diamondSprite.x + (_diamondSprite.width * 0.5));
_local9 = (_diamondSprite.y + (_diamondSprite.height * 0.5));
_diamondSprite.scaleX = (_diamondSprite.scaleX - 0.01);
_diamondSprite.scaleY = (_diamondSprite.scaleY - 0.01);
if (_diamondSprite.scaleX <= 0){
m_sprite.removeChild(_diamondSprite);
m_sprite.removeChild(_diamondSpriteShadow);
_diamondSprite = null;
_diamondSpriteShadow = null;
} else {
if (_local8 < _exitX){
_diamondSpriteSpeedX = (_diamondSpriteSpeedX + 0.6);
} else {
if (_local8 > _exitX){
_diamondSpriteSpeedX = (_diamondSpriteSpeedX - 0.6);
};
};
if (_local9 < _exitY){
_diamondSpriteSpeedY = (_diamondSpriteSpeedY + 0.6);
} else {
if (_local9 > _exitY){
_diamondSpriteSpeedY = (_diamondSpriteSpeedY - 0.6);
};
};
_local8 = (_local8 + _diamondSpriteSpeedX);
_local9 = (_local9 + _diamondSpriteSpeedY);
_diamondSprite.x = (_local8 - (_diamondSprite.width * 0.5));
_diamondSprite.y = (_local9 - (_diamondSprite.height * 0.5));
_diamondSpriteShadow.scaleX = _diamondSprite.scaleX;
_diamondSpriteShadow.scaleY = _diamondSprite.scaleY;
_diamondSpriteShadow.x = (_diamondSprite.x + _diamondShadowOffsetX);
_diamondSpriteShadow.y = (_diamondSprite.y + _diamondShadowOffsetY);
};
};
if (_firstRun){
_firstRun = false;
_local5 = m_world.m_bodyList;
while (_local5) {
_local5.WakeUp();
_local5 = _local5.m_next;
};
};
_local3 = 0;
if (m_mouseBody != null){
_local3 = m_mouseBody.GetAngle();
};
if (((((Input.isKeyDown(65)) || (Input.isKeyDown(37)))) || ((Main._mouseWheel > 0)))){
_local3 = (_local3 - 0.015);
Main._mouseWheel = 0;
};
if (((((Input.isKeyDown(68)) || (Input.isKeyDown(39)))) || ((Main._mouseWheel < 0)))){
_local3 = (_local3 + 0.015);
Main._mouseWheel = 0;
};
while (_local3 < (-(Math.PI) * 2)) {
_local3 = (_local3 + (Math.PI * 2));
};
while (_local3 > (Math.PI * 2)) {
_local3 = (_local3 - (Math.PI * 2));
};
if (m_mouseBody != null){
m_mouseBody.SetXForm(m_mouseBody.GetPosition(), _local3);
};
Main.m_sprite.x = (600 * 0.5);
Main.m_sprite.y = (500 * 0.5);
m_debugDraw.m_drawScale = (20 + _drawScaleAdder);
UpdateMouseWorld();
MouseDrag();
_local4 = null;
_local5 = m_world.m_bodyList;
while (_local5) {
if (_local5.m_userData != null){
_local10 = _local5.m_userData;
_local10._collided = false;
_local10._collidesWithSensorsN = 0;
_local10._glow = false;
};
_local5 = _local5.m_next;
};
_local5 = GetBodyAtMouse(true);
if (((((!((_local5 == null))) && (!((_local5.m_userData == null))))) && ((m_mouseJoint == null)))){
_local10 = _local5.m_userData;
_local11 = _local10._iD;
if ((((_local11 >= 73)) && ((_local11 <= 77)))){
_local13 = getBodiesByColorAll(_local10._color);
_local7 = 0;
while (((!((_local13 == null))) && ((_local7 < _local13.length)))) {
_local4 = _local13[_local7];
if (((!((_local4 == null))) && (!((_local4 == _local5))))){
_local4.m_userData._glow = true;
};
_local7++;
};
};
};
_local6 = getTimer();
m_world.Step(m_timeStep, m_iterations);
Main.m_fpsCounter.updatePhys(_local6);
if (!Main.s_controlMouseOnly){
if (m_mouseBody != null){
m_mouseBody.m_angularVelocity = 0;
};
};
_local5 = m_world.m_bodyList;
while (_local5) {
_local12 = _local5.m_next;
if (_local5.m_userData != null){
_local10 = _local5.m_userData;
if (_local10._iD == 74){
if (_local5.GetShapeList().IsSensor()){
_local10._alpha = SENSOR_ALPHA_TARGET;
} else {
_local10._alpha = 1;
};
};
};
_local10 = _local5.m_userData;
if (_local10 != null){
if (_local10._iD == 26){
if (_local10._levelCompleted){
_levelCompleted = true;
};
} else {
if (_local10._iD == 56){
if (Math.random() < 0.007){
_local18 = ((Math.random() * 0.4) - 0.2);
_local19 = ((Math.random() * 0.4) - 0.2);
addWaterDrop((2 + (Math.random() * 2)), (_local5.GetPosition().x + _local18), (_local5.GetPosition().y + _local19));
};
} else {
if (_local10._iD == 100){
if (_local10._damage > 0.9){
explodeWaterDrop(_local5);
};
} else {
if (_local10._iD == 101){
_local10._alpha = ((30 - _local10._damage) / 30);
if (_local10._alpha < 0){
_local10._alpha = 0;
};
if (_local10._damage > 30){
DestroyBody(_local5);
};
} else {
if ((((_local10._iD == 34)) || ((_local10._iD == 36)))){
twinkleBody(_local5);
} else {
if (_local10._iD == 35){
twinkleBody(_local5);
if (_local10._levelCompleted){
_diamondSpriteSpeedX = _local10._speedX;
_diamondSpriteSpeedY = _local10._speedY;
_diamondSprite = _local10._sprite;
_diamondSpriteShadow = _local10._spriteShadow;
_diamondShadowOffsetX = _local10._shadowOffsetX;
_diamondShadowOffsetY = _local10._shadowOffsetY;
_local10._sprite = null;
_local10._spriteShadow = null;
DestroyBody(_local5);
_missionFailed = false;
};
} else {
if (_local10._iD == 73){
twinkleBodyFrames(_local5);
if (_local10._collided){
if (_local10._timer < BLUE_SENSOR_ACTIVATION_TIME){
_local10._timer++;
};
} else {
_local10._timer = 0;
};
_local13 = getBodiesByColor(_local10._color);
_local7 = 0;
while (((!((_local13 == null))) && ((_local7 < _local13.length)))) {
_local4 = _local13[_local7];
if (_local4 != null){
if (_local10._collided){
if (_local10._timer == 1){
Main.m_this.playDoorDelay();
};
if (_local10._timer >= BLUE_SENSOR_ACTIVATION_TIME){
if (!_local4.GetShapeList().IsSensor()){
_local14 = cloneBody(_local4, true);
CreateTextureForBody(_local14, true, Main._bitmapTextureD, true, true);
_local14.m_userData._alpha = SENSOR_ALPHA_TARGET;
PutShadowBack(_local14.m_userData);
if (_local12 == _local4){
_local12 = _local4.m_next;
};
coverInSparkles(_local4);
DestroyBody(_local4);
bringDiamondsAndBlocksOnTop();
Main.m_this.playDoorOpenClose();
};
};
} else {
if (_local4.GetShapeList().IsSensor()){
DestroyBodiesThatTouch(_local4, _arg2);
_local14 = cloneBody(_local4, false);
CreateTextureForBody(_local14, true, Main._bitmapTextureD, true, true);
_local14.m_userData._alpha = 1;
PutShadowBack(_local14.m_userData);
if (_local12 == _local4){
_local12 = _local4.m_next;
};
coverInSparkles(_local4);
DestroyBody(_local4);
bringDiamondsAndBlocksOnTop();
Main.m_this.playDoorOpenClose();
};
};
};
_local7++;
};
} else {
if (_local10._iD == 77){
twinkleBodyFrames(_local5);
if (_local10._collided){
if (_local10._timer < BLUE_SENSOR_ACTIVATION_TIME){
_local10._timer++;
};
} else {
_local10._timer = 0;
};
_local13 = getBodiesByColor(_local10._color);
_local7 = 0;
while (((!((_local13 == null))) && ((_local7 < _local13.length)))) {
_local4 = _local13[_local7];
if (_local4 != null){
if (!_local10._collided){
if (!_local4.GetShapeList().IsSensor()){
_local14 = cloneBody(_local4, true);
CreateTextureForBody(_local14, true, Main._bitmapTextureD, true, true);
_local14.m_userData._alpha = SENSOR_ALPHA_TARGET;
PutShadowBack(_local14.m_userData);
if (_local12 == _local4){
_local12 = _local4.m_next;
};
coverInSparkles(_local4);
DestroyBody(_local4);
bringDiamondsAndBlocksOnTop();
Main.m_this.playDoorOpenClose();
};
} else {
if (_local10._timer == 1){
Main.m_this.playDoorDelay();
};
if (_local10._timer >= BLUE_SENSOR_ACTIVATION_TIME){
if (_local4.GetShapeList().IsSensor()){
DestroyBodiesThatTouch(_local4, _arg2);
_local14 = cloneBody(_local4, false);
CreateTextureForBody(_local14, true, Main._bitmapTextureD, true, true);
_local14.m_userData._alpha = 1;
PutShadowBack(_local14.m_userData);
if (_local12 == _local4){
_local12 = _local4.m_next;
};
coverInSparkles(_local4);
DestroyBody(_local4);
bringDiamondsAndBlocksOnTop();
Main.m_this.playDoorOpenClose();
};
};
};
};
_local7++;
};
} else {
if (_local10._iD == 75){
twinkleBodyFrames(_local5);
_local13 = getBodiesByColor(_local10._color);
_local7 = 0;
while (((!((_local13 == null))) && ((_local7 < _local13.length)))) {
_local4 = _local13[_local7];
if (_local4 != null){
if (_local10._collided){
if (_local12 == _local4){
_local12 = _local4.m_next;
};
_local13[_local7] = null;
Main.m_this.playBlockExplosion(2);
coverInDust(_local4, _arg2);
DestroyBody(_local4);
_local10._fadeAway = true;
};
};
_local7++;
};
} else {
if (_local10._iD == 76){
twinkleBodyFrames(_local5);
_local13 = getBodiesByColor(_local10._color);
_local7 = 0;
while (((!((_local13 == null))) && ((_local7 < _local13.length)))) {
_local4 = _local13[_local7];
if (((!((_local4 == null))) && (_local4.m_shapeList.IsSensor()))){
if (_local10._collided){
_local13[_local7] = null;
_local10._fadeAway = true;
DestroyBodiesThatTouch(_local4, _arg2);
_local14 = cloneBody(_local4, false);
CreateTextureForBody(_local14, true, Main._bitmapTextureE, true, true);
_local14.m_userData._alpha = 1;
PutShadowBack(_local14.m_userData);
if (_local12 == _local4){
_local12 = _local4.m_next;
};
coverInSparkles(_local4);
DestroyBody(_local4);
Main.m_this.playDoorOpenClose();
};
};
_local7++;
};
} else {
if (((_local10._touchDestroys) && ((_local10._damage > 0)))){
DestroyBody(_local5);
};
};
};
};
};
};
};
};
};
};
};
};
_local5 = _local12;
};
_local5 = m_world.m_bodyList;
while (_local5) {
_local12 = _local5.m_next;
if (_local5.m_userData != null){
_local10 = _local5.m_userData;
if (_local10._fadeAway){
_local10._alpha = (_local10._alpha - 0.05);
if (_local10._alpha < 0){
DestroyBody(_local5);
_local5 = _local12;
continue;
};
};
if (_local5.m_shapeList.IsSensor()){
_local5.PutToSleep();
} else {
calculateIPhoneDottedLineLimits();
if (((!((m_mouseBody == _local5))) && (isIPhoneSleeping(_local5.GetPosition().y)))){
_local5.PutToSleep();
} else {
_local5.WakeUp();
};
};
if (_local10._sprite != null){
_local15 = _local10._sprite;
_local15.rotation = 0;
_local16 = _local5.GetPosition();
_local17 = (m_debugDraw.m_drawScale / 20);
_local3 = _local5.GetAngle();
_local18 = (_local16.x * m_debugDraw.m_drawScale);
_local19 = (_local16.y * m_debugDraw.m_drawScale);
_local10._speedX = (_local18 - _local10._oldX);
_local10._speedY = (_local19 - _local10._oldY);
_local10._oldX = _local18;
_local10._oldY = _local19;
if (_local10._iD == 26){
_local17 = (_local17 * m_goalScale);
};
_local15.scaleX = (_local17 * _local10._scale);
_local15.scaleY = (_local17 * _local10._scale);
rot(_local15, _local18, _local19, ((_local3 * 180) / Math.PI), (-(_local15.width) * 0.5), (-(_local15.height) * 0.5));
_local20 = Math.cos(_local10._glowAlphaAngle);
if (_local20 < 0){
_local20 = -(_local20);
};
_local10._glowAlpha = (_local20 * _local10._alpha);
_local10._sprite.alpha = _local10._glowAlpha;
if (_local10._glow){
_local10._glowAlphaAngle = (_local10._glowAlphaAngle + 0.05);
if (_local10._glowAlphaAngle >= (Math.PI * 2)){
_local10._glowAlphaAngle = (_local10._glowAlphaAngle - (Math.PI * 2));
};
} else {
if (_local10._glowAlphaAngle <= 0.01){
_local10._glowAlphaAngle = 0;
} else {
if (_local10._glowAlphaAngle <= Math.PI){
_local10._glowAlphaAngle = (_local10._glowAlphaAngle + 0.05);
if (_local10._glowAlphaAngle >= Math.PI){
_local10._glowAlphaAngle = 0;
};
} else {
_local10._glowAlphaAngle = (_local10._glowAlphaAngle + 0.05);
if (_local10._glowAlphaAngle >= (Math.PI * 2)){
_local10._glowAlphaAngle = 0;
};
};
};
};
if (_local10._spriteShadow != null){
_local21 = _local10._spriteShadow;
_local21.scaleX = _local15.scaleX;
_local21.scaleY = _local15.scaleY;
_local21.x = (_local15.x + _local10._shadowOffsetX);
_local21.y = (_local15.y + _local10._shadowOffsetY);
_local21.rotation = _local15.rotation;
_local21.alpha = (_local10._sprite.alpha * 0.4);
};
};
//unresolved if
Main.playHitSound(_local10._iD, _local10._iD, 0.5, true);
DestroyBody(_local5);
_local5 = _local12;
} else {
_local5 = _local12;
};
};
}
public function addSensorKillWall(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean):b2Body{
var _local7:Number;
var _local8:b2PolygonDef;
var _local9:b2BodyDef;
var _local10:b2Body;
var _local11:int;
var _local12:int;
var _local13:int;
_local7 = 20;
_local8 = new b2PolygonDef();
_local8.friction = _friction;
_local8.density = 0;
_local8.isSensor = _arg6;
_local8.restitution = 0;
_local9 = new b2BodyDef();
_local8.SetAsOrientedBox((_arg1 / _local7), (_arg2 / _local7), new b2Vec2(0, 0), _arg5);
_local9.position.Set(_arg3, _arg4);
_local10 = m_world.CreateBody(_local9);
_local10.CreateShape(_local8);
_local10.SetMassFromShapes();
_local10.m_userData = new UserData();
_local10.m_userData._iD = 75;
_local10.m_userData._width = _arg1;
_local10.m_userData._height = _arg2;
_local11 = (int((Math.random() * 191)) + 64);
_local12 = 30;
_local13 = 30;
_local10.m_userData._color = (((_local11 << 16) | (_local12 << 8)) | _local13);
return (_local10);
}
public function GetBodyAtMouse(_arg1:Boolean=false):b2Body{
var _local2:b2AABB;
var _local3:int;
var _local4:Array;
var _local5:int;
var _local6:b2Body;
var _local7:Boolean;
var _local8:int;
var _local9:b2Shape;
var _local10: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 = true;
_local7 = false;
_local8 = 0;
while (_local8 < _local5) {
if (((!(_local4[_local8].GetBody().IsStatic())) || (_arg1))){
_local9 = (_local4[_local8] as b2Shape);
_local10 = (_local4[_local8] as b2Shape).TestPoint(_local9.GetBody().GetXForm(), mousePVec);
if (_local10){
_local6 = _local9.GetBody();
break;
};
};
_local8++;
};
return (_local6);
}
public function createWallTexture(_arg1:Bitmap, _arg2:Number):Bitmap{
var _local3:Bitmap;
var _local4:BitmapData;
var _local5:Number;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:uint;
var _local14:uint;
if (_arg2 < 0){
_arg2 = 0;
} else {
if (_arg2 > 1){
_arg2 = 1;
};
};
_local3 = new Bitmap(_arg1.bitmapData.clone(), "auto", true);
_local4 = _local3.bitmapData;
_local5 = (1 - _arg2);
_local6 = _local3.height;
_local7 = _local3.width;
_local8 = 0;
while (_local8 < _local6) {
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local4.getPixel32(_local9, _local8);
_local11 = ((_local10 >> 16) & 0xFF);
_local12 = ((_local10 >> 8) & 0xFF);
_local13 = (_local10 & 0xFF);
_local14 = (((0.3 * _local11) + (0.59 * _local12)) + (0.11 * _local13));
if (_local14 > 0xFF){
_local14 = 0xFF;
};
_local14 = (_local14 * _local5);
_local11 = ((_local11 * _arg2) + _local14);
_local12 = ((_local12 * _arg2) + _local14);
_local13 = ((_local13 * _arg2) + _local14);
_local10 = (_local10 & 4278190080);
_local10 = (_local10 | (((_local11 << 16) | (_local12 << 8)) | _local13));
_local4.setPixel32(_local9, _local8, _local10);
_local9++;
};
_local8++;
};
return (_local3);
}
public function addBlockG(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.SetAsBox((40 / _local5), (40 / _local5));
_local8.isSensor = _arg2;
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 68;
_local6.m_userData._directedGravity = true;
_local9 = new Bitmap(new _classBrickBlockG().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addBoxHelium(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.SetAsBox((20 / _local5), (20 / _local5));
_local8.isSensor = _arg2;
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 54;
_local6.m_userData._helium = true;
_local9 = new Bitmap(new _classBrickOHelium().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addKiila(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 6;
_local8.vertices[0].Set((-50 / _local5), (-10 / _local5));
_local8.vertices[1].Set((50 / _local5), (-10 / _local5));
_local8.vertices[2].Set((60 / _local5), (0 / _local5));
_local8.vertices[3].Set((50 / _local5), (10 / _local5));
_local8.vertices[4].Set((-50 / _local5), (10 / _local5));
_local8.vertices[5].Set((-60 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 57;
_local9 = new Bitmap(new _classBrickKiila().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function MouseDrag():void{
var _local1:b2Body;
var _local2:b2MouseJointDef;
var _local3:b2Vec2;
if (((Input.mouseDown) && (!(m_mouseJoint)))){
_local1 = GetBodyAtMouse();
if (_local1){
if (((!((_local1.m_userData == null))) && (_local1.m_userData._pickable))){
_local2 = new b2MouseJointDef();
_local2.body1 = m_world.GetGroundBody();
_local2.body2 = _local1;
_local2.target.Set(mouseXWorldPhys, mouseYWorldPhys);
if (Main.s_controlMouseOnly){
_local2.maxForce = (200 * _local1.GetMass());
} else {
_local2.maxForce = (300 * _local1.GetMass());
};
_local2.timeStep = m_timeStep;
m_mouseJoint = (m_world.CreateJoint(_local2) as b2MouseJoint);
m_mouseBody = _local1;
_local1.WakeUp();
if ((((_local1.m_userData._iD >= 34)) && ((_local1.m_userData._iD <= 36)))){
Main._diamondTouched = true;
};
Main.m_this.playGrabShape();
};
};
};
if (!Input.mouseDown){
if (m_mouseJoint){
m_world.DestroyJoint(m_mouseJoint);
m_mouseJoint = null;
m_mouseBody = null;
Main.m_this.playReleaseShape();
};
};
if (m_mouseJoint){
_local3 = new b2Vec2(mouseXWorldPhys, mouseYWorldPhys);
m_mouseJoint.SetTarget(_local3);
};
}
public function addJesus(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-40 / _local5), (-20 / _local5));
_local8.vertices[1].Set((40 / _local5), (-20 / _local5));
_local8.vertices[2].Set((40 / _local5), (0 / _local5));
_local8.vertices[3].Set((-40 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((0 / _local5), (-40 / _local5));
_local8.vertices[1].Set((20 / _local5), (-40 / _local5));
_local8.vertices[2].Set((20 / _local5), (-20 / _local5));
_local8.vertices[3].Set((0 / _local5), (-20 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((0 / _local5), (0 / _local5));
_local8.vertices[1].Set((20 / _local5), (0 / _local5));
_local8.vertices[2].Set((20 / _local5), (40 / _local5));
_local8.vertices[3].Set((0 / _local5), (40 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 14;
_local9 = new Bitmap(new _classBrickJesus().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function getBiggestSpriteY(_arg1:int):Number{
var _local2:b2Body;
var _local3:UserData;
var _local4:Number;
_local4 = -100000;
_local2 = m_world.m_bodyList;
while (_local2) {
if (_local2.m_userData != null){
_local3 = _local2.m_userData;
if (_local3._iD == _arg1){
if (_local3._sprite != null){
if (_local4 < _local3._sprite.y){
_local4 = _local3._sprite.y;
};
};
};
};
_local2 = _local2.m_next;
};
return (_local4);
}
public function addTriangleLeft(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 3;
_local8.vertices[2].Set((-30 / _local5), (30 / _local5));
_local8.vertices[1].Set((30 / _local5), (30 / _local5));
_local8.vertices[0].Set((30 / _local5), (-30 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 21;
_local9 = new Bitmap(new _classTriangleLeft().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addOrientedBoxSensorWall(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean, _arg7:int):b2Body{
var _local8:Number;
var _local9:b2PolygonDef;
var _local10:b2BodyDef;
var _local11:b2Body;
_local8 = 20;
_local9 = new b2PolygonDef();
_local9.friction = _friction;
_local9.density = 0;
_local9.isSensor = _arg6;
_local9.restitution = 0;
_local10 = new b2BodyDef();
_local9.SetAsOrientedBox((_arg1 / _local8), (_arg2 / _local8), new b2Vec2(0, 0), _arg5);
_local10.position.Set(_arg3, _arg4);
_local11 = m_world.CreateBody(_local10);
_local11.CreateShape(_local9);
_local11.SetMassFromShapes();
_local11.m_userData = new UserData();
_local11.m_userData._iD = 74;
_local11.m_userData._width = _arg1;
_local11.m_userData._height = _arg2;
_local11.m_userData._color = _arg7;
return (_local11);
}
private function twinkleShapeFrames(_arg1:b2Shape, _arg2:b2Vec2, _arg3:b2XForm, _arg4:uint, _arg5:UserData):void{
var _local6:int;
var _local7:int;
var _local8:b2PolygonShape;
var _local9:int;
var _local10:Array;
var _local11:Array;
var _local12:int;
var _local13:int;
var _local14:b2Vec2;
var _local15:b2Vec2;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Particle;
var _local22:int;
_local6 = _arg1.GetType();
if (_local6 == b2Shape.e_polygonShape){
_local8 = (_arg1 as b2PolygonShape);
_local9 = _local8.GetVertexCount();
_local10 = _local8.GetVertices();
_local11 = new Array(b2Settings.b2_maxPolygonVertices);
_local7 = 0;
while (_local7 < _local9) {
_local11[_local7] = b2Math.b2MulX(_arg3, _local10[_local7]);
_local7++;
};
if (_local9 == 4){
_local22 = getParticlesInsideTriangle(_local11[0], _local11[1], _local11[2]);
_local22 = (_local22 + getParticlesInsideTriangle(_local11[0], _local11[2], _local11[3]));
_arg5._particleVolume = _local22;
};
_local12 = int(((Math.random() * _local9) * 0.99));
_local13 = (_local12 + 1);
if (_local13 >= _local9){
_local13 = (_local13 - _local9);
};
_local14 = _local11[_local12];
_local15 = _local11[_local13];
_local16 = (_local15.x - _local14.x);
_local17 = (_local15.y - _local14.y);
_local18 = Math.random();
_local19 = ((_local14.x + (_local16 * _local18)) * m_debugDraw.m_drawScale);
_local20 = ((_local14.y + (_local17 * _local18)) * m_debugDraw.m_drawScale);
_local21 = Main.m_particleManager.addParticle(Particle.PARTICLE_TYPE_TWINKLE, (_local19 + 300), _local20, _arg4);
if (_local21 != null){
_local21._life = (_local21._life + (Math.random() * 10));
};
};
}
public function addPoleG(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-60 / _local5), (-10 / _local5));
_local8.vertices[1].Set((60 / _local5), (-10 / _local5));
_local8.vertices[2].Set((60 / _local5), (10 / _local5));
_local8.vertices[3].Set((-60 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 66;
_local6.m_userData._directedGravity = true;
_local9 = new Bitmap(new _classBrickPoleG().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addPyramid(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 3;
_local8.vertices[2].Set((-40 / _local5), (40 / _local5));
_local8.vertices[1].Set((40 / _local5), (40 / _local5));
_local8.vertices[0].Set((0 / _local5), (-40 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 23;
_local9 = new Bitmap(new _classPyramid().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addBox(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.SetAsBox((20 / _local5), (20 / _local5));
_local8.isSensor = _arg2;
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 1;
_local9 = new Bitmap(new _classBrickO().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addHingeVeryBig(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
var _local10:b2RevoluteJointDef;
var _local11:b2Vec2;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-100 / _local5), (-10 / _local5));
_local8.vertices[1].Set((100 / _local5), (-10 / _local5));
_local8.vertices[2].Set((100 / _local5), (10 / _local5));
_local8.vertices[3].Set((-100 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-100 / _local5), (-30 / _local5));
_local8.vertices[1].Set((-80 / _local5), (-30 / _local5));
_local8.vertices[2].Set((-80 / _local5), (-10 / _local5));
_local8.vertices[3].Set((-100 / _local5), (-10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((80 / _local5), (10 / _local5));
_local8.vertices[1].Set((100 / _local5), (10 / _local5));
_local8.vertices[2].Set((100 / _local5), (30 / _local5));
_local8.vertices[3].Set((80 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 60;
_local9 = new Bitmap(new _classBrickHingeVeryBig().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
_local10 = new b2RevoluteJointDef();
_local11 = _local6.GetPosition();
_local10.Initialize(m_world.GetGroundBody(), _local6, _local11);
_local10.enableMotor = false;
_local6.m_userData._object = (m_world.CreateJoint(_local10) as b2RevoluteJoint);
return (_local6);
}
public function addWhoaMirror(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-40 / _local5), (-10 / _local5));
_local8.vertices[1].Set((40 / _local5), (-10 / _local5));
_local8.vertices[2].Set((40 / _local5), (10 / _local5));
_local8.vertices[3].Set((-40 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((20 / _local5), (10 / _local5));
_local8.vertices[1].Set((40 / _local5), (10 / _local5));
_local8.vertices[2].Set((40 / _local5), (30 / _local5));
_local8.vertices[3].Set((20 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-40 / _local5), (-30 / _local5));
_local8.vertices[1].Set((-20 / _local5), (-30 / _local5));
_local8.vertices[2].Set((-20 / _local5), (-10 / _local5));
_local8.vertices[3].Set((-40 / _local5), (-10 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 33;
_local9 = new Bitmap(new _classBrickWhoaMirror().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function coverInSparkles(_arg1:b2Body):void{
var _local2:b2XForm;
var _local3:b2Vec2;
var _local4:b2Shape;
_local2 = _arg1.GetXForm();
_local3 = _arg1.GetPosition();
_local4 = _arg1.GetShapeList();
while (_local4 != null) {
coverInSparklesShape(_local4, _local3, _local2);
_local4 = _local4.GetNext();
};
}
public function addPacman(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((30 / _local5), (-30 / _local5));
_local8.vertices[1].Set((30 / _local5), (30 / _local5));
_local8.vertices[2].Set((0 / _local5), (30 / _local5));
_local8.vertices[3].Set((0 / _local5), (0 / _local5));
_local6.CreateShape(_local8);
_local8.vertexCount = 4;
_local8.vertices[0].Set((-30 / _local5), (-30 / _local5));
_local8.vertices[1].Set((0 / _local5), (0 / _local5));
_local8.vertices[2].Set((0 / _local5), (30 / _local5));
_local8.vertices[3].Set((-30 / _local5), (30 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 42;
_local9 = new Bitmap(new _classBrickPacman().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addWideCross(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set(((-5 * 2) / _local5), (((-10 * 2) - 10) / _local5));
_local8.vertices[1].Set(((5 * 2) / _local5), (((-10 * 2) - 10) / _local5));
_local8.vertices[2].Set(((5 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local8.vertices[3].Set(((-5 * 2) / _local5), (((0 * 2) - 10) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((50 / _local5), (((0 * 2) - 10) / _local5));
_local8.vertices[1].Set((50 / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[2].Set((-50 / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[3].Set((-50 / _local5), (((0 * 2) - 10) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set(((-5 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[1].Set(((5 * 2) / _local5), (((10 * 2) - 10) / _local5));
_local8.vertices[2].Set(((5 * 2) / _local5), (((20 * 2) - 10) / _local5));
_local8.vertices[3].Set(((-5 * 2) / _local5), (((20 * 2) - 10) / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 38;
_local9 = new Bitmap(new _classBrickWideCross().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function selectionAdd(_arg1:b2Body, _arg2:Number, _arg3:Number, _arg4:Number):void{
_arg2 = (_arg2 - 300);
_arg3 = (_arg3 - 250);
_arg1.PutToSleep();
_arg1.SetXForm(new b2Vec2((_arg2 / m_physScale), (_arg3 / m_physScale)), _arg4);
_arg1.m_angularVelocity = 0;
_arg1.m_linearVelocity.x = 0;
_arg1.m_linearVelocity.y = 0;
_arg1.m_force.x = 0;
_arg1.m_force.y = 0;
}
public function addGlueBall(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int=0xFFFF00):b2Body{
var _local5:Number;
var _local6:b2BodyDef;
var _local7:b2Body;
var _local8:b2CircleDef;
_local5 = 20;
_local6 = new b2BodyDef();
_local6.isSleeping = true;
_local6.position.Set(_arg2, _arg3);
_local7 = m_world.CreateBody(_local6);
_local8 = new b2CircleDef();
_local8.radius = (_arg1 / _local5);
_local8.density = 0;
_local8.friction = 1000;
_local8.restitution = 0;
_local8.isSensor = true;
_local7.CreateShape(_local8);
_local7.SetMassFromShapes();
_local7.m_userData = new UserData();
_local7.m_userData._iD = 56;
_local7.m_userData._radius = _arg1;
_local7.m_userData._color = 0xFFFF00;
_local7.m_userData._sticky = true;
_local7.m_userData._invisible = true;
return (_local7);
}
public function addCircleHelium(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000, _arg5:Number=10):b2Body{
var _local6:b2Body;
_local6 = addBallGeneral(_arg5, _arg3, _arg4, 52, _density, _arg2);
_local6.m_userData._helium = true;
setBallSprite(new Bitmap(new _classSunHelium().bitmapData), _local6.m_userData, _arg5);
return (_local6);
}
public function addHingeBig(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
var _local10:b2RevoluteJointDef;
var _local11:b2Vec2;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-80 / _local5), (-10 / _local5));
_local8.vertices[1].Set((80 / _local5), (-10 / _local5));
_local8.vertices[2].Set((80 / _local5), (10 / _local5));
_local8.vertices[3].Set((-80 / _local5), (10 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 58;
_local9 = new Bitmap(new _classBrickHingeBig().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
_local10 = new b2RevoluteJointDef();
_local11 = _local6.GetPosition();
_local10.Initialize(m_world.GetGroundBody(), _local6, _local11);
_local10.enableMotor = false;
_local6.m_userData._object = (m_world.CreateJoint(_local10) as b2RevoluteJoint);
return (_local6);
}
public function createSpriteBoxWithOutlines(_arg1:Bitmap, _arg2:UserData, _arg3:Number, _arg4:Number):void{
var _local5:BitmapData;
createSpriteBox(_arg1, _arg2, _arg3, _arg4);
_local5 = _arg2._sprite.bitmapData;
_local5.fillRect(new Rectangle(0, 0, (_arg2._width * 2), OUTLINE_WIDTH), 0);
_local5.fillRect(new Rectangle(0, ((_arg2._height * 2) - OUTLINE_WIDTH), (_arg2._width * 2), OUTLINE_WIDTH), 0);
_local5.fillRect(new Rectangle(0, 0, OUTLINE_WIDTH, (_arg2._height * 2)), 0);
_local5.fillRect(new Rectangle(((_arg2._width * 2) - OUTLINE_WIDTH), 0, OUTLINE_WIDTH, (_arg2._height * 2)), 0);
}
public function addRotatingCrossBox(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:UserData;
var _local7:b2Body;
var _local8:b2BodyDef;
var _local9:b2PolygonDef;
var _local10:b2RevoluteJointDef;
var _local11:b2Body;
var _local12:Bitmap;
_local5 = 20;
_local6 = new UserData();
_local6._iD = 63;
_local8 = new b2BodyDef();
_local9 = new b2PolygonDef();
_local10 = new b2RevoluteJointDef();
_local11 = m_world.GetGroundBody();
_local8 = new b2BodyDef();
_local8.position.Set(_arg3, _arg4);
_local8.angle = _arg1;
_local7 = m_world.CreateBody(_local8);
_local9.density = 20;
_local9.friction = _friction;
_local9.isSensor = _arg2;
_local9.vertexCount = 8;
_local9.vertices[0].Set((-10 / _local5), (-30 / _local5));
_local9.vertices[1].Set((10 / _local5), (-30 / _local5));
_local9.vertices[2].Set((30 / _local5), (-10 / _local5));
_local9.vertices[3].Set((30 / _local5), (10 / _local5));
_local9.vertices[4].Set((10 / _local5), (30 / _local5));
_local9.vertices[5].Set((-10 / _local5), (30 / _local5));
_local9.vertices[6].Set((-30 / _local5), (10 / _local5));
_local9.vertices[7].Set((-30 / _local5), (-10 / _local5));
_local7.CreateShape(_local9);
_local7.m_userData = _local6;
_local7.SetMassFromShapes();
_local12 = new Bitmap(new _classRotatingCrossBox().bitmapData);
_local12.x = -11405;
_local12.y = 10;
_local12.smoothing = true;
m_sprite.addChild(_local12);
_local7.m_userData._sprite = _local12;
_local10.Initialize(_local11, _local7, new b2Vec2(_arg3, _arg4));
_local10.motorSpeed = 0;
_local10.enableMotor = false;
_local6._object = (m_world.CreateJoint(_local10) as b2RevoluteJoint);
return (_local7);
}
private function setBallSprite(_arg1:Bitmap, _arg2:UserData, _arg3:Number):void{
var _local4:Number;
_arg2._sprite = _arg1;
_local4 = (_arg2._sprite.width * 0.5);
_arg2._sprite.scaleX = (_arg3 / _local4);
_arg2._sprite.scaleY = (_arg3 / _local4);
_arg2._scale = (_arg3 / _local4);
_arg2._sprite.smoothing = true;
_arg2._radius = _arg3;
m_sprite.addChild(_arg2._sprite);
}
public function addBlock1T(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local8.density = (_density * 5);
_local8.friction = _friction;
_local8.restitution = 0;
_local8.SetAsBox((40 / _local5), (40 / _local5));
_local8.isSensor = _arg2;
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 49;
_local9 = new Bitmap(new _classBrickBlock1T().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addSaw2(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000, _arg5:Number=10):b2Body{
var _local6:b2Body;
var _local7:b2RevoluteJointDef;
var _local8:b2Vec2;
_local6 = addBallGeneral(_arg5, _arg3, _arg4, 44, _density, _arg2);
setBallSprite(new Bitmap(new _classSaw2X().bitmapData), _local6.m_userData, _arg5);
_local7 = new b2RevoluteJointDef();
_local8 = _local6.GetPosition();
_local7.Initialize(m_world.GetGroundBody(), _local6, _local8);
_local7.maxMotorTorque = (_arg5 * 20);
_local7.enableMotor = !(_arg2);
_local7.motorSpeed = (-(_arg5) * 2);
_local6.m_userData._object = (m_world.CreateJoint(_local7) as b2RevoluteJoint);
return (_local6);
}
private function getBodiesByColor(_arg1:int):Array{
var _local2:Array;
var _local3:int;
var _local4:b2Body;
var _local5:UserData;
_local2 = null;
_local3 = 0;
_local4 = m_world.m_bodyList;
while (_local4) {
if (_local4.m_userData != null){
_local5 = _local4.m_userData;
if (_local5._color == _arg1){
if (_local5._iD == 74){
if (_local2 == null){
_local2 = new Array(1);
};
var _temp1 = _local3;
_local3 = (_local3 + 1);
var _local6 = _temp1;
_local2[_local6] = _local4;
};
};
};
_local4 = _local4.m_next;
};
return (_local2);
}
public function addPyramidHelium(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 3;
_local8.vertices[2].Set((-40 / _local5), (40 / _local5));
_local8.vertices[1].Set((40 / _local5), (40 / _local5));
_local8.vertices[0].Set((0 / _local5), (-40 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 53;
_local6.m_userData._helium = true;
_local9 = new Bitmap(new _classPyramidHelium().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addCircleG(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000, _arg5:Number=10):b2Body{
var _local6:b2Body;
_local6 = addBallGeneral(_arg5, _arg3, _arg4, 71, _density, _arg2);
setBallSprite(new Bitmap(new _classSunG().bitmapData), _local6.m_userData, _arg5);
_local6.m_userData._directedGravity = true;
return (_local6);
}
public function addSensorHideWallInvert(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean):b2Body{
var _local7:Number;
var _local8:b2PolygonDef;
var _local9:b2BodyDef;
var _local10:b2Body;
var _local11:int;
var _local12:int;
var _local13:int;
_local7 = 20;
_local8 = new b2PolygonDef();
_local8.friction = _friction;
_local8.density = 0;
_local8.isSensor = _arg6;
_local8.restitution = 0;
_local9 = new b2BodyDef();
_local8.SetAsOrientedBox((_arg1 / _local7), (_arg2 / _local7), new b2Vec2(0, 0), _arg5);
_local9.position.Set(_arg3, _arg4);
_local10 = m_world.CreateBody(_local9);
_local10.CreateShape(_local8);
_local10.SetMassFromShapes();
_local10.m_userData = new UserData();
_local10.m_userData._iD = 77;
_local10.m_userData._width = _arg1;
_local10.m_userData._height = _arg2;
_local11 = (int((Math.random() * 191)) + 64);
_local12 = (int((Math.random() * 191)) + 64);
_local13 = 30;
_local10.m_userData._color = (((_local11 << 16) | (_local12 << 8)) | _local13);
return (_local10);
}
public function addBGBall(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int=0):b2Body{
var _local5:Number;
var _local6:b2BodyDef;
var _local7:b2Body;
var _local8:b2CircleDef;
_local5 = 20;
_local6 = new b2BodyDef();
_local6.isSleeping = true;
_local6.position.Set(_arg2, _arg3);
_local7 = m_world.CreateBody(_local6);
_local8 = new b2CircleDef();
_local8.radius = (_arg1 / _local5);
_local8.density = 0;
_local8.friction = _friction;
_local8.restitution = 0.1;
_local7.CreateShape(_local8);
_local7.SetMassFromShapes();
_local7.m_userData = new UserData();
_local7.m_userData._iD = 27;
_local7.m_userData._radius = _arg1;
_local7.m_userData._color = 0xFFFFFF;
return (_local7);
}
public function addH(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((-20 / _local5), (-30 / _local5));
_local8.vertices[1].Set((-20 / _local5), (30 / _local5));
_local8.vertices[2].Set((-40 / _local5), (30 / _local5));
_local8.vertices[3].Set((-40 / _local5), (-30 / _local5));
_local6.CreateShape(_local8);
_local8.vertexCount = 4;
_local8.vertices[0].Set((40 / _local5), (-30 / _local5));
_local8.vertices[1].Set((40 / _local5), (30 / _local5));
_local8.vertices[2].Set((20 / _local5), (30 / _local5));
_local8.vertices[3].Set((20 / _local5), (-30 / _local5));
_local6.CreateShape(_local8);
_local8.vertexCount = 4;
_local8.vertices[0].Set((20 / _local5), (-10 / _local5));
_local8.vertices[1].Set((20 / _local5), (10 / _local5));
_local8.vertices[2].Set((-20 / _local5), (10 / _local5));
_local8.vertices[3].Set((-20 / _local5), (-10 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 43;
_local9 = new Bitmap(new _classBrickH().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addJ(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set(((5 * 2) / _local5), ((-10 * 2) / _local5));
_local8.vertices[1].Set(((15 * 2) / _local5), ((-10 * 2) / _local5));
_local8.vertices[2].Set(((15 * 2) / _local5), ((0 * 2) / _local5));
_local8.vertices[3].Set(((5 * 2) / _local5), ((0 * 2) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set(((15 * 2) / _local5), ((0 * 2) / _local5));
_local8.vertices[1].Set(((15 * 2) / _local5), ((10 * 2) / _local5));
_local8.vertices[2].Set(((-15 * 2) / _local5), ((10 * 2) / _local5));
_local8.vertices[3].Set(((-15 * 2) / _local5), ((0 * 2) / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 4;
_local9 = new Bitmap(new _classBrickJ().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
private function coverInSparklesShape(_arg1:b2Shape, _arg2:b2Vec2, _arg3:b2XForm):void{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:b2PolygonShape;
var _local8:int;
var _local9:Array;
var _local10:Array;
var _local11:int;
var _local12:b2Vec2;
var _local13:int;
var _local14:int;
var _local15:b2Vec2;
var _local16:b2Vec2;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Particle;
_local4 = _arg1.GetType();
if (_local4 == b2Shape.e_polygonShape){
_local7 = (_arg1 as b2PolygonShape);
_local8 = _local7.GetVertexCount();
_local9 = _local7.GetVertices();
_local10 = new Array(b2Settings.b2_maxPolygonVertices);
_local5 = 0;
while (_local5 < _local8) {
_local10[_local5] = b2Math.b2MulX(_arg3, _local9[_local5]);
_local5++;
};
_local11 = 0;
if (_local8 == 4){
_local11 = getParticlesInsideTriangle(_local10[0], _local10[1], _local10[2]);
_local11 = (_local11 + getParticlesInsideTriangle(_local10[0], _local10[2], _local10[3]));
_local11 = (_local11 / 16);
};
_local12 = new b2Vec2();
_local12.x = (_arg2.x * m_debugDraw.m_drawScale);
_local12.y = (_arg2.y * m_debugDraw.m_drawScale);
while (_local11 > 0) {
_local13 = int(((Math.random() * _local8) * 0.99));
_local14 = (_local13 + 1);
if (_local14 >= _local8){
_local14 = (_local14 - _local8);
};
_local15 = _local10[_local13];
_local16 = _local10[_local14];
_local17 = (_local16.x - _local15.x);
_local18 = (_local16.y - _local15.y);
_local19 = Math.random();
_local20 = ((_local15.x + (_local17 * _local19)) * m_debugDraw.m_drawScale);
_local21 = ((_local15.y + (_local18 * _local19)) * m_debugDraw.m_drawScale);
_local22 = Main.m_particleManager.addParticle(Particle.PARTICLE_TYPE_SPARKLE, (_local20 + 300), _local21, 4294967295);
if (_local22 != null){
_local22._speedX = ((_local20 - _local12.x) * 0.03);
_local22._speedY = ((_local21 - _local12.y) * 0.03);
_local22._life = (_local22._life + (Math.random() * 10));
};
_local11--;
};
};
}
private function twinkleShape(_arg1:b2Shape, _arg2:b2Vec2, _arg3:b2XForm, _arg4:uint):void{
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:b2CircleShape;
var _local9:Number;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Particle;
var _local16:b2PolygonShape;
var _local17:int;
var _local18:Array;
var _local19:Array;
var _local20:int;
var _local21:int;
_local5 = _arg1.GetType();
if (_local5 == b2Shape.e_circleShape){
_local8 = (_arg1 as b2CircleShape);
_local9 = _local8.GetRadius();
_local10 = b2Math.b2MulX(_arg3, _local8.GetLocalPosition());
b2Math.b2MulX(_arg3, _local8.GetLocalPosition()).x = (_local10.x * m_debugDraw.m_drawScale);
_local10.y = (_local10.y * m_debugDraw.m_drawScale);
_local11 = ((Math.random() * _local9) * m_debugDraw.m_drawScale);
_local12 = ((Math.random() * Math.PI) * 2);
_local13 = (Math.cos(_local12) * _local11);
_local14 = (Math.sin(_local12) * _local11);
_local15 = Main.m_particleManager.addParticle(Particle.PARTICLE_TYPE_TWINKLE, ((_local10.x + _local13) + 300), (_local10.y + _local14), _arg4);
if (_local15 != null){
_local15._life = (_local15._life + (Math.random() * 10));
};
} else {
if (_local5 == b2Shape.e_polygonShape){
_local16 = (_arg1 as b2PolygonShape);
_local17 = _local16.GetVertexCount();
_local18 = _local16.GetVertices();
_local19 = new Array(b2Settings.b2_maxPolygonVertices);
_local6 = 0;
while (_local6 < _local17) {
_local19[_local6] = b2Math.b2MulX(_arg3, _local18[_local6]);
_local6++;
};
_local20 = (_local17 - 2);
_local21 = int(((Math.random() * 0.99) * _local20));
getRandomPointInTriangle(_local19[0], _local19[(_local21 + 1)], _local19[(_local21 + 2)]);
s_randomPointX = (s_randomPointX * m_debugDraw.m_drawScale);
s_randomPointY = (s_randomPointY * m_debugDraw.m_drawScale);
_local15 = Main.m_particleManager.addParticle(Particle.PARTICLE_TYPE_TWINKLE, (s_randomPointX + 300), s_randomPointY, _arg4);
if (_local15 != null){
_local15._life = (_local15._life + (Math.random() * 10));
};
};
};
}
public function addTeddy(_arg1:Number, _arg2:Number):void{
var _local3:b2BodyDef;
var _local4:b2CircleDef;
var _local5:b2PolygonDef;
var _local6:b2RevoluteJointDef;
var _local7:UserData;
var _local8:Number;
var _local9:Number;
var _local10:b2Body;
var _local11:b2Body;
var _local12:b2Body;
var _local13:b2Body;
var _local14:b2Body;
var _local15:b2Body;
var _local16:b2Body;
var _local17:b2Body;
var _local18:b2Body;
var _local19:b2Body;
var _local20:b2Body;
var _local21:b2Body;
_local4 = new b2CircleDef();
_local5 = new b2PolygonDef();
_local6 = new b2RevoluteJointDef();
_local8 = m_physScale;
m_physScale = 36;
_local9 = 0.1;
_local4.radius = (24 / m_physScale);
_local4.density = _local9;
_local4.friction = 0.4;
_local4.restitution = 0.3;
_local3 = new b2BodyDef();
_local7 = CreateTeddyUserData();
_local7._sprite = new Bitmap(new _classHead1().bitmapData);
_local7._sprite.smoothing = true;
m_sprite.addChild(_local7._sprite);
ManageTeddySprite(_local7);
_local3.userData = _local7;
_local3.position.Set((_arg1 / m_physScale), ((_arg2 - 10) / m_physScale));
_local10 = m_world.CreateBody(_local3);
_local10.CreateShape(_local4);
_local10.SetMassFromShapes();
_local5.SetAsBox((15 / m_physScale), (10 / m_physScale));
_local5.density = _local9;
_local5.friction = 0.4;
_local5.restitution = 0.1;
_local3 = new b2BodyDef();
_local7 = CreateTeddyUserData();
_local3.userData = _local7;
_local3.position.Set((_arg1 / m_physScale), ((_arg2 + 28) / m_physScale));
_local11 = m_world.CreateBody(_local3);
_local11.CreateShape(_local5);
_local11.SetMassFromShapes();
_local3 = new b2BodyDef();
_local7 = CreateTeddyUserData();
_local3.userData = _local7;
_local3.position.Set((_arg1 / m_physScale), ((_arg2 + 43) / m_physScale));
_local12 = m_world.CreateBody(_local3);
_local12.CreateShape(_local5);
_local12.SetMassFromShapes();
_local3 = new b2BodyDef();
_local7 = CreateTeddyUserData();
_local3.userData = _local7;
_local3.position.Set((_arg1 / m_physScale), ((_arg2 + 58) / m_physScale));
_local13 = m_world.CreateBody(_local3);
_local13.CreateShape(_local5);
_local13.SetMassFromShapes();
_local5.SetAsBox((18 / m_physScale), (6.5 / m_physScale));
_local5.density = _local9;
_local5.friction = 0.4;
_local5.restitution = 0.1;
_local3 = new b2BodyDef();
_local3.position.Set(((_arg1 - 30) / m_physScale), ((_arg2 + 20) / m_physScale));
_local7 = CreateTeddyUserData();
_local3.userData = _local7;
_local14 = m_world.CreateBody(_local3);
_local14.CreateShape(_local5);
_local14.SetMassFromShapes();
_local3.position.Set(((_arg1 + 30) / m_physScale), ((_arg2 + 20) / m_physScale));
_local7 = CreateTeddyUserData();
_local3.userData = _local7;
_local15 = m_world.CreateBody(_local3);
_local15.CreateShape(_local5);
_local15.SetMassFromShapes();
_local5.SetAsBox((17 / m_physScale), (6 / m_physScale));
_local5.density = _local9;
_local5.friction = 0.4;
_local5.restitution = 0.1;
_local3 = new b2BodyDef();
_local3.position.Set(((_arg1 - 57) / m_physScale), ((_arg2 + 20) / m_physScale));
_local7 = CreateTeddyUserData();
_local7._sprite = new Bitmap(new _classHandLeft1().bitmapData);
_local7._sprite.smoothing = true;
m_sprite.addChild(_local7._sprite);
ManageTeddySprite(_local7);
_local3.userData = _local7;
_local16 = m_world.CreateBody(_local3);
_local16.CreateShape(_local5);
_local16.SetMassFromShapes();
_local3.position.Set(((_arg1 + 57) / m_physScale), ((_arg2 + 20) / m_physScale));
_local7 = CreateTeddyUserData();
_local7._sprite = new Bitmap(new _classHandRight1().bitmapData);
_local7._sprite.smoothing = true;
m_sprite.addChild(_local7._sprite);
ManageTeddySprite(_local7);
_local3.userData = _local7;
_local17 = m_world.CreateBody(_local3);
_local17.CreateShape(_local5);
_local17.SetMassFromShapes();
_local5.SetAsBox((7.5 / m_physScale), (22 / m_physScale));
_local5.density = _local9;
_local5.friction = 0.4;
_local5.restitution = 0.1;
_local3 = new b2BodyDef();
_local3.position.Set(((_arg1 - 11) / m_physScale), ((_arg2 + 85) / m_physScale));
_local7 = CreateTeddyUserData();
_local3.userData = _local7;
_local18 = m_world.CreateBody(_local3);
_local18.CreateShape(_local5);
_local18.SetMassFromShapes();
_local3.position.Set(((_arg1 + 11) / m_physScale), ((_arg2 + 85) / m_physScale));
_local7 = CreateTeddyUserData();
_local3.userData = _local7;
_local19 = m_world.CreateBody(_local3);
_local19.CreateShape(_local5);
_local19.SetMassFromShapes();
_local5.SetAsBox((6 / m_physScale), (20 / m_physScale));
_local5.density = _local9;
_local5.friction = 0.4;
_local5.restitution = 0.1;
_local3 = new b2BodyDef();
_local3.position.Set(((_arg1 - 11) / m_physScale), ((_arg2 + 120) / m_physScale));
_local7 = CreateTeddyUserData();
_local7._sprite = new Bitmap(new _classFootLeft1().bitmapData);
_local7._sprite.smoothing = true;
m_sprite.addChild(_local7._sprite);
ManageTeddySprite(_local7);
_local3.userData = _local7;
_local20 = m_world.CreateBody(_local3);
_local20.CreateShape(_local5);
_local20.SetMassFromShapes();
_local3.position.Set(((_arg1 + 11) / m_physScale), ((_arg2 + 120) / m_physScale));
_local7 = CreateTeddyUserData();
_local7._sprite = new Bitmap(new _classFootRight1().bitmapData);
_local7._sprite.smoothing = true;
m_sprite.addChild(_local7._sprite);
ManageTeddySprite(_local7);
_local3.userData = _local7;
_local21 = m_world.CreateBody(_local3);
_local21.CreateShape(_local5);
_local21.SetMassFromShapes();
_local6.enableLimit = true;
_local6.lowerAngle = (-40 / (180 / Math.PI));
_local6.upperAngle = (40 / (180 / Math.PI));
_local6.Initialize(_local11, _local10, new b2Vec2((_arg1 / m_physScale), ((_arg2 + 15) / m_physScale)));
m_world.CreateJoint(_local6);
_local6.lowerAngle = (-85 / (180 / Math.PI));
_local6.upperAngle = (130 / (180 / Math.PI));
_local6.Initialize(_local11, _local14, new b2Vec2(((_arg1 - 18) / m_physScale), ((_arg2 + 20) / m_physScale)));
m_world.CreateJoint(_local6);
_local6.lowerAngle = (-130 / (180 / Math.PI));
_local6.upperAngle = (85 / (180 / Math.PI));
_local6.Initialize(_local11, _local15, new b2Vec2(((_arg1 + 18) / m_physScale), ((_arg2 + 20) / m_physScale)));
m_world.CreateJoint(_local6);
_local6.lowerAngle = (-130 / (180 / Math.PI));
_local6.upperAngle = (10 / (180 / Math.PI));
_local6.Initialize(_local14, _local16, new b2Vec2(((_arg1 - 45) / m_physScale), ((_arg2 + 20) / m_physScale)));
m_world.CreateJoint(_local6);
_local6.lowerAngle = (-10 / (180 / Math.PI));
_local6.upperAngle = (130 / (180 / Math.PI));
_local6.Initialize(_local15, _local17, new b2Vec2(((_arg1 + 45) / m_physScale), ((_arg2 + 20) / m_physScale)));
m_world.CreateJoint(_local6);
_local6.lowerAngle = (-15 / (180 / Math.PI));
_local6.upperAngle = (15 / (180 / Math.PI));
_local6.Initialize(_local11, _local12, new b2Vec2((_arg1 / m_physScale), ((_arg2 + 35) / m_physScale)));
m_world.CreateJoint(_local6);
_local6.Initialize(_local12, _local13, new b2Vec2((_arg1 / m_physScale), ((_arg2 + 50) / m_physScale)));
m_world.CreateJoint(_local6);
_local6.lowerAngle = (-65 / (180 / Math.PI));
_local6.upperAngle = (65 / (180 / Math.PI));
_local6.Initialize(_local13, _local18, new b2Vec2(((_arg1 - 11) / m_physScale), ((_arg2 + 72) / m_physScale)));
m_world.CreateJoint(_local6);
_local6.lowerAngle = (-65 / (180 / Math.PI));
_local6.upperAngle = (65 / (180 / Math.PI));
_local6.Initialize(_local13, _local19, new b2Vec2(((_arg1 + 11) / m_physScale), ((_arg2 + 72) / m_physScale)));
m_world.CreateJoint(_local6);
_local6.lowerAngle = (-25 / (180 / Math.PI));
_local6.upperAngle = (115 / (180 / Math.PI));
_local6.Initialize(_local18, _local20, new b2Vec2(((_arg1 - 11) / m_physScale), ((_arg2 + 105) / m_physScale)));
m_world.CreateJoint(_local6);
_local6.lowerAngle = (-115 / (180 / Math.PI));
_local6.upperAngle = (25 / (180 / Math.PI));
_local6.Initialize(_local19, _local21, new b2Vec2(((_arg1 + 11) / m_physScale), ((_arg2 + 105) / m_physScale)));
m_world.CreateJoint(_local6);
m_physScale = _local8;
}
public function addL(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[3].Set(((-5 * 2) / _local5), ((-10 * 2) / _local5));
_local8.vertices[2].Set(((-15 * 2) / _local5), ((-10 * 2) / _local5));
_local8.vertices[1].Set(((-15 * 2) / _local5), ((0 * 2) / _local5));
_local8.vertices[0].Set(((-5 * 2) / _local5), ((0 * 2) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set(((15 * 2) / _local5), ((0 * 2) / _local5));
_local8.vertices[1].Set(((15 * 2) / _local5), ((10 * 2) / _local5));
_local8.vertices[2].Set(((-15 * 2) / _local5), ((10 * 2) / _local5));
_local8.vertices[3].Set(((-15 * 2) / _local5), ((0 * 2) / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 5;
_local9 = new Bitmap(new _classBrickL().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addTriangleRight(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 3;
_local8.vertices[2].Set((-30 / _local5), (30 / _local5));
_local8.vertices[1].Set((30 / _local5), (30 / _local5));
_local8.vertices[0].Set((-30 / _local5), (-30 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 22;
_local9 = new Bitmap(new _classTriangleRight().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addSaw1(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000, _arg5:Number=10):b2Body{
var _local6:b2Body;
var _local7:b2RevoluteJointDef;
var _local8:b2Vec2;
_local6 = addBallGeneral(_arg5, _arg3, _arg4, 41, _density, _arg2);
setBallSprite(new Bitmap(new _classSaw1().bitmapData), _local6.m_userData, _arg5);
_local7 = new b2RevoluteJointDef();
_local8 = _local6.GetPosition();
_local7.Initialize(m_world.GetGroundBody(), _local6, _local8);
_local7.maxMotorTorque = (_arg5 * 20);
_local7.enableMotor = !(_arg2);
_local7.motorSpeed = (_arg5 * 2);
_local6.m_userData._object = (m_world.CreateJoint(_local7) as b2RevoluteJoint);
return (_local6);
}
public function BringSpritesOnTop():void{
var _local1:b2Body;
_local1 = m_world.m_bodyList;
while (_local1) {
if (((!((_local1.m_userData == null))) && (!((_local1.m_userData._sprite == null))))){
if (_local1.m_userData._iD != 26){
m_sprite.removeChild(_local1.m_userData._sprite);
m_sprite.addChild(_local1.m_userData._sprite);
};
};
_local1 = _local1.m_next;
};
}
public function precalculateBackground(_arg1:BitmapData):void{
var _local2:UserData;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
drawSprite(_inDoorSprite.bitmapData, 0, (_inDoorSprite.x + 300), (_inDoorSprite.y + 250), _arg1, _inDoorSprite.scaleX, _inDoorSprite.alpha);
m_sprite.removeChild(_inDoorSprite);
_inDoorSprite = null;
_local3 = m_world.m_bodyList;
while (_local3) {
if (_local3.m_userData != null){
_local2 = _local3.m_userData;
if ((((_local2._iD == 26)) && (!((_local2._spriteShadow == null))))){
_local4 = (_local2._spriteShadow.x + 300);
_local5 = (_local2._spriteShadow.y + 250);
drawSprite(_local2._spriteShadow.bitmapData, 0, _local4, _local5, _arg1, _local2._spriteShadow.scaleX, _local2._spriteShadow.alpha);
m_sprite.removeChild(_local2._spriteShadow);
_local2._spriteShadow = null;
};
if ((((_local2._iD == 26)) && (!((_local2._sprite == null))))){
_exitX = (_local2._sprite.x + (_local2._sprite.width * 0.5));
_exitY = (_local2._sprite.y + (_local2._sprite.height * 0.5));
_local4 = (_local2._sprite.x + 300);
_local5 = (_local2._sprite.y + 250);
drawSprite(_local2._sprite.bitmapData, 0, _local4, _local5, _arg1, _local2._sprite.scaleX, _local2._sprite.alpha);
m_sprite.removeChild(_local2._sprite);
_local2._sprite = null;
_local2._invisible = true;
};
};
_local3 = _local3.m_next;
};
_local3 = m_world.m_bodyList;
while (_local3) {
if (_local3.m_userData != null){
_local2 = _local3.m_userData;
if ((((_local2._iD == 28)) && (!((_local2._spriteShadow == null))))){
_local4 = (_local2._spriteShadow.x + 300);
_local5 = (_local2._spriteShadow.y + 250);
drawSprite(_local2._spriteShadow.bitmapData, _local3.GetAngle(), _local4, _local5, _arg1, 1, _local2._spriteShadow.alpha);
m_sprite.removeChild(_local2._spriteShadow);
_local2._spriteShadow = null;
};
};
_local3 = _local3.m_next;
};
_local3 = m_world.m_bodyList;
while (_local3) {
if (_local3.m_userData != null){
_local2 = _local3.m_userData;
if ((((_local2._iD == 28)) && (!((_local2._sprite == null))))){
_local4 = (_local2._sprite.x + 300);
_local5 = (_local2._sprite.y + 250);
drawSprite(_local2._sprite.bitmapData, _local3.GetAngle(), _local4, _local5, _arg1, 1);
m_sprite.removeChild(_local2._sprite);
_local2._sprite = null;
_local2._invisible = true;
};
};
_local3 = _local3.m_next;
};
}
public function addS(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[3].Set(((5 * 2) / _local5), ((-10 * 2) / _local5));
_local8.vertices[2].Set(((-15 * 2) / _local5), ((-10 * 2) / _local5));
_local8.vertices[1].Set(((-15 * 2) / _local5), ((0 * 2) / _local5));
_local8.vertices[0].Set(((5 * 2) / _local5), ((0 * 2) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set(((15 * 2) / _local5), ((0 * 2) / _local5));
_local8.vertices[1].Set(((15 * 2) / _local5), ((10 * 2) / _local5));
_local8.vertices[2].Set(((-5 * 2) / _local5), ((10 * 2) / _local5));
_local8.vertices[3].Set(((-5 * 2) / _local5), ((0 * 2) / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 6;
_local9 = new Bitmap(new _classBrickS().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addT(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set(((-5 * 2) / _local5), ((-10 * 2) / _local5));
_local8.vertices[1].Set(((5 * 2) / _local5), ((-10 * 2) / _local5));
_local8.vertices[2].Set(((5 * 2) / _local5), ((0 * 2) / _local5));
_local8.vertices[3].Set(((-5 * 2) / _local5), ((0 * 2) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set(((15 * 2) / _local5), ((0 * 2) / _local5));
_local8.vertices[1].Set(((15 * 2) / _local5), ((10 * 2) / _local5));
_local8.vertices[2].Set(((-15 * 2) / _local5), ((10 * 2) / _local5));
_local8.vertices[3].Set(((-15 * 2) / _local5), ((0 * 2) / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 3;
_local9 = new Bitmap(new _classBrickT().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function UpdateMouseWorld():void{
mouseXWorldPhys = (Input.mousseX / m_debugDraw.m_drawScale);
mouseYWorldPhys = (Input.mousseY / m_debugDraw.m_drawScale);
mouseXWorld = Input.mousseX;
mouseYWorld = Input.mousseY;
}
public function addZ(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[3].Set(((15 * 2) / _local5), ((-10 * 2) / _local5));
_local8.vertices[2].Set(((-5 * 2) / _local5), ((-10 * 2) / _local5));
_local8.vertices[1].Set(((-5 * 2) / _local5), ((0 * 2) / _local5));
_local8.vertices[0].Set(((15 * 2) / _local5), ((0 * 2) / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set(((5 * 2) / _local5), ((0 * 2) / _local5));
_local8.vertices[1].Set(((5 * 2) / _local5), ((10 * 2) / _local5));
_local8.vertices[2].Set(((-15 * 2) / _local5), ((10 * 2) / _local5));
_local8.vertices[3].Set(((-15 * 2) / _local5), ((0 * 2) / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 7;
_local9 = new Bitmap(new _classBrickZ().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addPyramid1T(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = (_density * 5);
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 3;
_local8.vertices[2].Set((-40 / _local5), (40 / _local5));
_local8.vertices[1].Set((40 / _local5), (40 / _local5));
_local8.vertices[0].Set((0 / _local5), (-40 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 47;
_local9 = new Bitmap(new _classPyramid1T().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addCornerLong(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
var _local5:Number;
var _local6:b2Body;
var _local7:b2BodyDef;
var _local8:b2PolygonDef;
var _local9:Bitmap;
_local5 = 20;
_local7 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local7.position.Set(_arg3, _arg4);
_local7.angle = _arg1;
_local6 = m_world.CreateBody(_local7);
_local8.density = _density;
_local8.friction = _friction;
_local8.restitution = 0;
_local8.isSensor = _arg2;
_local8.vertexCount = 4;
_local8.vertices[0].Set((20 / _local5), (-40 / _local5));
_local8.vertices[1].Set((40 / _local5), (-40 / _local5));
_local8.vertices[2].Set((40 / _local5), (40 / _local5));
_local8.vertices[3].Set((20 / _local5), (40 / _local5));
_local6.CreateShape(_local8);
_local8.vertices[0].Set((-40 / _local5), (20 / _local5));
_local8.vertices[1].Set((20 / _local5), (20 / _local5));
_local8.vertices[2].Set((20 / _local5), (40 / _local5));
_local8.vertices[3].Set((-40 / _local5), (40 / _local5));
_local6.CreateShape(_local8);
_local6.SetMassFromShapes();
_local6.m_userData = new UserData();
_local6.m_userData._iD = 29;
_local9 = new Bitmap(new _classBrickCornerLong().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public static function getRandomPointInTriangle(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local4 = Math.random();
_local5 = Math.random();
if ((_local4 + _local5) > 1){
_local4 = (1 - _local4);
_local5 = (1 - _local5);
};
_local6 = ((1 - _local4) - _local5);
s_randomPointX = (((_local4 * _arg1.x) + (_local5 * _arg2.x)) + (_local6 * _arg3.x));
s_randomPointY = (((_local4 * _arg1.y) + (_local5 * _arg2.y)) + (_local6 * _arg3.y));
}
public static function rot(_arg1:Bitmap, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{
var _local7:Number;
var _local8:Number;
while (_arg4 > 360) {
_arg4 = (_arg4 - 360);
};
while (_arg4 < -360) {
_arg4 = (_arg4 + 360);
};
_local7 = Math.cos(((_arg4 * Math.PI) / 180));
_local8 = Math.sin(((_arg4 * Math.PI) / 180));
_arg1.rotation = _arg4;
_arg1.x = ((_arg2 + (_arg5 * _local7)) - (_arg6 * _local8));
_arg1.y = ((_arg3 + (_arg6 * _local7)) + (_arg5 * _local8));
}
}
}//package TestBed
Section 94
//Test__classBrickAlien (TestBed.Test__classBrickAlien)
package TestBed {
import mx.core.*;
public class Test__classBrickAlien extends BitmapAsset {
}
}//package TestBed
Section 95
//Test__classBrickBlock (TestBed.Test__classBrickBlock)
package TestBed {
import mx.core.*;
public class Test__classBrickBlock extends BitmapAsset {
}
}//package TestBed
Section 96
//Test__classBrickBlock1T (TestBed.Test__classBrickBlock1T)
package TestBed {
import mx.core.*;
public class Test__classBrickBlock1T extends BitmapAsset {
}
}//package TestBed
Section 97
//Test__classBrickBlockHelium (TestBed.Test__classBrickBlockHelium)
package TestBed {
import mx.core.*;
public class Test__classBrickBlockHelium extends BitmapAsset {
}
}//package TestBed
Section 98
//Test__classBrickConnect (TestBed.Test__classBrickConnect)
package TestBed {
import mx.core.*;
public class Test__classBrickConnect extends BitmapAsset {
}
}//package TestBed
Section 99
//Test__classBrickConnectMirror (TestBed.Test__classBrickConnectMirror)
package TestBed {
import mx.core.*;
public class Test__classBrickConnectMirror extends BitmapAsset {
}
}//package TestBed
Section 100
//Test__classBrickCornerLong (TestBed.Test__classBrickCornerLong)
package TestBed {
import mx.core.*;
public class Test__classBrickCornerLong extends BitmapAsset {
}
}//package TestBed
Section 101
//Test__classBrickHingeVeryBigStraight (TestBed.Test__classBrickHingeVeryBigStraight)
package TestBed {
import mx.core.*;
public class Test__classBrickHingeVeryBigStraight extends BitmapAsset {
}
}//package TestBed
Section 102
//Test__classBrickI (TestBed.Test__classBrickI)
package TestBed {
import mx.core.*;
public class Test__classBrickI extends BitmapAsset {
}
}//package TestBed
Section 103
//Test__classBrickJ (TestBed.Test__classBrickJ)
package TestBed {
import mx.core.*;
public class Test__classBrickJ extends BitmapAsset {
}
}//package TestBed
Section 104
//Test__classBrickO (TestBed.Test__classBrickO)
package TestBed {
import mx.core.*;
public class Test__classBrickO extends BitmapAsset {
}
}//package TestBed
Section 105
//Test__classBrickO1T (TestBed.Test__classBrickO1T)
package TestBed {
import mx.core.*;
public class Test__classBrickO1T extends BitmapAsset {
}
}//package TestBed
Section 106
//Test__classBrickOHelium (TestBed.Test__classBrickOHelium)
package TestBed {
import mx.core.*;
public class Test__classBrickOHelium extends BitmapAsset {
}
}//package TestBed
Section 107
//Test__classBrickPole (TestBed.Test__classBrickPole)
package TestBed {
import mx.core.*;
public class Test__classBrickPole extends BitmapAsset {
}
}//package TestBed
Section 108
//Test__classBrickT (TestBed.Test__classBrickT)
package TestBed {
import mx.core.*;
public class Test__classBrickT extends BitmapAsset {
}
}//package TestBed
Section 109
//Test__classBrickWacky1 (TestBed.Test__classBrickWacky1)
package TestBed {
import mx.core.*;
public class Test__classBrickWacky1 extends BitmapAsset {
}
}//package TestBed
Section 110
//Test__classBrickWacky1Mirror (TestBed.Test__classBrickWacky1Mirror)
package TestBed {
import mx.core.*;
public class Test__classBrickWacky1Mirror extends BitmapAsset {
}
}//package TestBed
Section 111
//Test__classBrickWhoaMirror (TestBed.Test__classBrickWhoaMirror)
package TestBed {
import mx.core.*;
public class Test__classBrickWhoaMirror extends BitmapAsset {
}
}//package TestBed
Section 112
//Test__classDiamond1 (TestBed.Test__classDiamond1)
package TestBed {
import mx.core.*;
public class Test__classDiamond1 extends BitmapAsset {
}
}//package TestBed
Section 113
//Test__classDiamond2 (TestBed.Test__classDiamond2)
package TestBed {
import mx.core.*;
public class Test__classDiamond2 extends BitmapAsset {
}
}//package TestBed
Section 114
//Test__classDiamond3 (TestBed.Test__classDiamond3)
package TestBed {
import mx.core.*;
public class Test__classDiamond3 extends BitmapAsset {
}
}//package TestBed
Section 115
//Test__classFinalExit (TestBed.Test__classFinalExit)
package TestBed {
import mx.core.*;
public class Test__classFinalExit extends BitmapAsset {
}
}//package TestBed
Section 116
//Test__classFootLeft1 (TestBed.Test__classFootLeft1)
package TestBed {
import mx.core.*;
public class Test__classFootLeft1 extends BitmapAsset {
}
}//package TestBed
Section 117
//Test__classFootRight1 (TestBed.Test__classFootRight1)
package TestBed {
import mx.core.*;
public class Test__classFootRight1 extends BitmapAsset {
}
}//package TestBed
Section 118
//Test__classHandLeft1 (TestBed.Test__classHandLeft1)
package TestBed {
import mx.core.*;
public class Test__classHandLeft1 extends BitmapAsset {
}
}//package TestBed
Section 119
//Test__classHandRight1 (TestBed.Test__classHandRight1)
package TestBed {
import mx.core.*;
public class Test__classHandRight1 extends BitmapAsset {
}
}//package TestBed
Section 120
//Test__classHead1 (TestBed.Test__classHead1)
package TestBed {
import mx.core.*;
public class Test__classHead1 extends BitmapAsset {
}
}//package TestBed
Section 121
//Test__classInDoor (TestBed.Test__classInDoor)
package TestBed {
import mx.core.*;
public class Test__classInDoor extends BitmapAsset {
}
}//package TestBed
Section 122
//Test__classPyramid (TestBed.Test__classPyramid)
package TestBed {
import mx.core.*;
public class Test__classPyramid extends BitmapAsset {
}
}//package TestBed
Section 123
//Test__classPyramid1T (TestBed.Test__classPyramid1T)
package TestBed {
import mx.core.*;
public class Test__classPyramid1T extends BitmapAsset {
}
}//package TestBed
Section 124
//Test__classPyramidHelium (TestBed.Test__classPyramidHelium)
package TestBed {
import mx.core.*;
public class Test__classPyramidHelium extends BitmapAsset {
}
}//package TestBed
Section 125
//Test__classSun (TestBed.Test__classSun)
package TestBed {
import mx.core.*;
public class Test__classSun extends BitmapAsset {
}
}//package TestBed
Section 126
//Test__classSun1T (TestBed.Test__classSun1T)
package TestBed {
import mx.core.*;
public class Test__classSun1T extends BitmapAsset {
}
}//package TestBed
Section 127
//Test__classSunG (TestBed.Test__classSunG)
package TestBed {
import mx.core.*;
public class Test__classSunG extends BitmapAsset {
}
}//package TestBed
Section 128
//Test__classSunHelium (TestBed.Test__classSunHelium)
package TestBed {
import mx.core.*;
public class Test__classSunHelium extends BitmapAsset {
}
}//package TestBed
Section 129
//Test__classSuperLong (TestBed.Test__classSuperLong)
package TestBed {
import mx.core.*;
public class Test__classSuperLong extends BitmapAsset {
}
}//package TestBed
Section 130
//Test__classTreasureChest (TestBed.Test__classTreasureChest)
package TestBed {
import mx.core.*;
public class Test__classTreasureChest extends BitmapAsset {
}
}//package TestBed
Section 131
//Test__classTunnelHole (TestBed.Test__classTunnelHole)
package TestBed {
import mx.core.*;
public class Test__classTunnelHole extends BitmapAsset {
}
}//package TestBed
Section 132
//Test__classWaterDrop (TestBed.Test__classWaterDrop)
package TestBed {
import mx.core.*;
public class Test__classWaterDrop extends BitmapAsset {
}
}//package TestBed
Section 133
//Test__classVine1 (TestBed.Test__classVine1)
package TestBed {
import mx.core.*;
public class Test__classVine1 extends BitmapAsset {
}
}//package TestBed
Section 134
//Test__classVine10 (TestBed.Test__classVine10)
package TestBed {
import mx.core.*;
public class Test__classVine10 extends BitmapAsset {
}
}//package TestBed
Section 135
//Test__classVine11 (TestBed.Test__classVine11)
package TestBed {
import mx.core.*;
public class Test__classVine11 extends BitmapAsset {
}
}//package TestBed
Section 136
//Test__classVine12 (TestBed.Test__classVine12)
package TestBed {
import mx.core.*;
public class Test__classVine12 extends BitmapAsset {
}
}//package TestBed
Section 137
//Test__classVine13 (TestBed.Test__classVine13)
package TestBed {
import mx.core.*;
public class Test__classVine13 extends BitmapAsset {
}
}//package TestBed
Section 138
//Test__classVine14 (TestBed.Test__classVine14)
package TestBed {
import mx.core.*;
public class Test__classVine14 extends BitmapAsset {
}
}//package TestBed
Section 139
//Test__classVine2 (TestBed.Test__classVine2)
package TestBed {
import mx.core.*;
public class Test__classVine2 extends BitmapAsset {
}
}//package TestBed
Section 140
//Test__classVine3 (TestBed.Test__classVine3)
package TestBed {
import mx.core.*;
public class Test__classVine3 extends BitmapAsset {
}
}//package TestBed
Section 141
//Test__classVine4 (TestBed.Test__classVine4)
package TestBed {
import mx.core.*;
public class Test__classVine4 extends BitmapAsset {
}
}//package TestBed
Section 142
//Test__classVine5 (TestBed.Test__classVine5)
package TestBed {
import mx.core.*;
public class Test__classVine5 extends BitmapAsset {
}
}//package TestBed
Section 143
//Test__classVine6 (TestBed.Test__classVine6)
package TestBed {
import mx.core.*;
public class Test__classVine6 extends BitmapAsset {
}
}//package TestBed
Section 144
//Test__classVine7 (TestBed.Test__classVine7)
package TestBed {
import mx.core.*;
public class Test__classVine7 extends BitmapAsset {
}
}//package TestBed
Section 145
//Test__classVine8 (TestBed.Test__classVine8)
package TestBed {
import mx.core.*;
public class Test__classVine8 extends BitmapAsset {
}
}//package TestBed
Section 146
//Test__classVine9 (TestBed.Test__classVine9)
package TestBed {
import mx.core.*;
public class Test__classVine9 extends BitmapAsset {
}
}//package TestBed
Section 147
//Audio (Audio)
package {
import flash.media.*;
public class Audio {
public var _soundLoopEndSound:Sound;
public var _soundBone11:Sound;
public var _soundBone12:Sound;
public var _soundBone13:Sound;
public var _soundBone14:Sound;
public var _classMP3Ontto:Class;
public var _soundReturnShape:Sound;
public var _soundGame:Sound;
public var _classDrop1:Class;
public var _classDrop2:Class;
public var _classDrop3:Class;
public var _soundWind01:Sound;
public var _soundWind02:Sound;
public var _soundDoorDelay:Sound;
public var _soundCurse:Sound;
public var _soundNoise01:Sound;
public var _soundNoise02:Sound;
public var _classStone01:Class;
public var _classStone02:Class;
public var _classStone03:Class;
public var _classStone04:Class;
public var _classStone05:Class;
public var _classStone06:Class;
public var _classStone07:Class;
public var _soundNoise04:Sound;
public var _soundNoise05:Sound;
public var _soundNoise03:Sound;
public var _classMP3Concrete02:Class;
public var _classMP3Concrete03:Class;
public var _classMP3Concrete06:Class;
public var _soundGrabShape:Sound;
public var _classMP3Bone11:Class;
public var _classMP3Bone12:Class;
public var _classMP3Bone13:Class;
public var _classMP3Bone14:Class;
public var _classMP3GrabShape:Class;
public var _classMP3BlockExplosion:Class;
public var _classMP3Wind01:Class;
public var _classMP3Wind02:Class;
public var _soundBase01:Sound;
public var _soundBase02:Sound;
public var _classMP3Noise01:Class;
public var _classMP3Noise02:Class;
public var _classMP3Noise03:Class;
public var _soundBase06:Sound;
public var _classMP3Noise05:Class;
public var _soundBase08:Sound;
public var _classMenuButton:Class;
public var _soundBase03:Sound;
public var _soundBase04:Sound;
public var _soundBase05:Sound;
public var _classMP3Noise04:Class;
public var _soundBase07:Sound;
public var _soundBase09:Sound;
public var _soundBase10:Sound;
public var _soundFlute01:Sound;
public var _soundDrop1:Sound;
public var _soundFlute03:Sound;
public var _soundDrop3:Sound;
public var _soundFlute05:Sound;
public var _classMP3SoundMenu:Class;
public var _soundFlute08:Sound;
public var _soundFlute02:Sound;
public var _soundDrop2:Sound;
public var _soundFlute04:Sound;
public var _soundStone07:Sound;
public var _soundStone01:Sound;
public var _soundFlute07:Sound;
public var _soundStone03:Sound;
public var _soundStone05:Sound;
public var _soundStone06:Sound;
public var _soundFlute06:Sound;
public var _soundStone02:Sound;
public var _soundFlute09:Sound;
public var _classMP3Curse:Class;
public var _soundFlute11:Sound;
public var _soundFlute12:Sound;
public var _soundFlute13:Sound;
public var _soundFlute14:Sound;
public var _soundFlute10:Sound;
public var _soundStone04:Sound;
public var _classMP3LoopEndSound:Class;
public var _soundBlockExplosion:Sound;
public var _classMP3LoopStartSound:Class;
public var _classMP3Base01:Class;
public var _classMP3Flute01:Class;
public var _classMP3Flute02:Class;
public var _classMP3Flute03:Class;
public var _classMP3Flute04:Class;
public var _classMP3Flute05:Class;
public var _classMP3Flute06:Class;
public var _classMP3Flute07:Class;
public var _classMP3Flute08:Class;
public var _classMP3Flute09:Class;
public var _classMP3Base04:Class;
public var _classMP3Base05:Class;
public var _classMP3Base06:Class;
public var _classMP3Base07:Class;
public var _classMP3Base08:Class;
public var _classMP3Base09:Class;
public var _classMP3Base02:Class;
public var _classMP3Base03:Class;
public var _soundOkHarmony:Sound;
public var _soundLCH01:Sound;
public var _classMP3Base10:Class;
public var _classMP3Flute10:Class;
public var _classMP3Flute11:Class;
public var _classMP3Flute12:Class;
public var _classMP3Flute13:Class;
public var _classMP3Flute14:Class;
public var _classMP3OkHarmony:Class;
public var _soundConcrete02:Sound;
public var _soundConcrete03:Sound;
public var _soundConcrete06:Sound;
public var _soundOntto:Sound;
public var _classMP3SoundGame:Class;
public var _soundMenu:Sound;
public var _soundDoorOpenClose:Sound;
public var _soundMenuButton:Sound;
public var _soundLoopStartSound:Sound;
public var _classDoorOpenClose:Class;
public var _classMP3ReturnShape:Class;
public var _classMP3LCH01:Class;
public var _classDoorDelay:Class;
public function Audio(){
_classMP3SoundMenu = Audio__classMP3SoundMenu;
_soundMenu = new _classMP3SoundMenu();
_classMP3SoundGame = Audio__classMP3SoundGame;
_soundGame = new _classMP3SoundGame();
_classMP3Wind01 = Audio__classMP3Wind01;
_soundWind01 = new _classMP3Wind01();
_classMP3Wind02 = Audio__classMP3Wind02;
_soundWind02 = new _classMP3Wind02();
_classMenuButton = Audio__classMenuButton;
_soundMenuButton = new _classMenuButton();
_classDrop1 = Audio__classDrop1;
_soundDrop1 = new _classDrop1();
_classDrop2 = Audio__classDrop2;
_soundDrop2 = new _classDrop2();
_classDrop3 = Audio__classDrop3;
_soundDrop3 = new _classDrop3();
_classDoorDelay = Audio__classDoorDelay;
_soundDoorDelay = new _classDoorDelay();
_classDoorOpenClose = Audio__classDoorOpenClose;
_soundDoorOpenClose = new _classDoorOpenClose();
_classMP3Bone11 = Audio__classMP3Bone11;
_soundBone11 = new _classMP3Bone11();
_classMP3Bone12 = Audio__classMP3Bone12;
_soundBone12 = new _classMP3Bone12();
_classMP3Bone13 = Audio__classMP3Bone13;
_soundBone13 = new _classMP3Bone13();
_classMP3Bone14 = Audio__classMP3Bone14;
_soundBone14 = new _classMP3Bone14();
_classMP3Concrete02 = Audio__classMP3Concrete02;
_soundConcrete02 = new _classMP3Concrete02();
_classMP3Concrete03 = Audio__classMP3Concrete03;
_soundConcrete03 = new _classMP3Concrete03();
_classMP3Concrete06 = Audio__classMP3Concrete06;
_soundConcrete06 = new _classMP3Concrete06();
_classStone01 = Audio__classStone01;
_soundStone01 = new _classStone01();
_classStone02 = Audio__classStone02;
_soundStone02 = new _classStone02();
_classStone03 = Audio__classStone03;
_soundStone03 = new _classStone03();
_classStone04 = Audio__classStone04;
_soundStone04 = new _classStone04();
_classStone05 = Audio__classStone05;
_soundStone05 = new _classStone05();
_classStone06 = Audio__classStone06;
_soundStone06 = new _classStone06();
_classStone07 = Audio__classStone07;
_soundStone07 = new _classStone07();
_classMP3Noise01 = Audio__classMP3Noise01;
_soundNoise01 = new _classMP3Noise01();
_classMP3Noise02 = Audio__classMP3Noise02;
_soundNoise02 = new _classMP3Noise02();
_classMP3Noise03 = Audio__classMP3Noise03;
_soundNoise03 = new _classMP3Noise03();
_classMP3Noise04 = Audio__classMP3Noise04;
_soundNoise04 = new _classMP3Noise04();
_classMP3Noise05 = Audio__classMP3Noise05;
_soundNoise05 = new _classMP3Noise05();
_classMP3Ontto = Audio__classMP3Ontto;
_soundOntto = new _classMP3Ontto();
_classMP3Flute01 = Audio__classMP3Flute01;
_soundFlute01 = new _classMP3Flute01();
_classMP3Flute02 = Audio__classMP3Flute02;
_soundFlute02 = new _classMP3Flute02();
_classMP3Flute03 = Audio__classMP3Flute03;
_soundFlute03 = new _classMP3Flute03();
_classMP3Flute04 = Audio__classMP3Flute04;
_soundFlute04 = new _classMP3Flute04();
_classMP3Flute05 = Audio__classMP3Flute05;
_soundFlute05 = new _classMP3Flute05();
_classMP3Flute06 = Audio__classMP3Flute06;
_soundFlute06 = new _classMP3Flute06();
_classMP3Flute07 = Audio__classMP3Flute07;
_soundFlute07 = new _classMP3Flute07();
_classMP3Flute08 = Audio__classMP3Flute08;
_soundFlute08 = new _classMP3Flute08();
_classMP3Flute09 = Audio__classMP3Flute09;
_soundFlute09 = new _classMP3Flute09();
_classMP3Flute10 = Audio__classMP3Flute10;
_soundFlute10 = new _classMP3Flute10();
_classMP3Flute11 = Audio__classMP3Flute11;
_soundFlute11 = new _classMP3Flute11();
_classMP3Flute12 = Audio__classMP3Flute12;
_soundFlute12 = new _classMP3Flute12();
_classMP3Flute13 = Audio__classMP3Flute13;
_soundFlute13 = new _classMP3Flute13();
_classMP3Flute14 = Audio__classMP3Flute14;
_soundFlute14 = new _classMP3Flute14();
_classMP3Base01 = Audio__classMP3Base01;
_soundBase01 = new _classMP3Base01();
_classMP3Base02 = Audio__classMP3Base02;
_soundBase02 = new _classMP3Base02();
_classMP3Base03 = Audio__classMP3Base03;
_soundBase03 = new _classMP3Base03();
_classMP3Base04 = Audio__classMP3Base04;
_soundBase04 = new _classMP3Base04();
_classMP3Base05 = Audio__classMP3Base05;
_soundBase05 = new _classMP3Base05();
_classMP3Base06 = Audio__classMP3Base06;
_soundBase06 = new _classMP3Base06();
_classMP3Base07 = Audio__classMP3Base07;
_soundBase07 = new _classMP3Base07();
_classMP3Base08 = Audio__classMP3Base08;
_soundBase08 = new _classMP3Base08();
_classMP3Base09 = Audio__classMP3Base09;
_soundBase09 = new _classMP3Base09();
_classMP3Base10 = Audio__classMP3Base10;
_soundBase10 = new _classMP3Base10();
_classMP3LCH01 = Audio__classMP3LCH01;
_soundLCH01 = new _classMP3LCH01();
_classMP3OkHarmony = Audio__classMP3OkHarmony;
_soundOkHarmony = new _classMP3OkHarmony();
_classMP3LoopStartSound = Audio__classMP3LoopStartSound;
_soundLoopStartSound = new _classMP3LoopStartSound();
_classMP3LoopEndSound = Audio__classMP3LoopEndSound;
_soundLoopEndSound = new _classMP3LoopEndSound();
_classMP3Curse = Audio__classMP3Curse;
_soundCurse = new _classMP3Curse();
_classMP3GrabShape = Audio__classMP3GrabShape;
_soundGrabShape = new _classMP3GrabShape();
_classMP3ReturnShape = Audio__classMP3ReturnShape;
_soundReturnShape = new _classMP3ReturnShape();
_classMP3BlockExplosion = Audio__classMP3BlockExplosion;
_soundBlockExplosion = new _classMP3BlockExplosion();
super();
}
}
}//package
Section 148
//Audio__classDoorDelay (Audio__classDoorDelay)
package {
import mx.core.*;
public class Audio__classDoorDelay extends SoundAsset {
}
}//package
Section 149
//Audio__classDoorOpenClose (Audio__classDoorOpenClose)
package {
import mx.core.*;
public class Audio__classDoorOpenClose extends SoundAsset {
}
}//package
Section 150
//Audio__classDrop1 (Audio__classDrop1)
package {
import mx.core.*;
public class Audio__classDrop1 extends SoundAsset {
}
}//package
Section 151
//Audio__classDrop2 (Audio__classDrop2)
package {
import mx.core.*;
public class Audio__classDrop2 extends SoundAsset {
}
}//package
Section 152
//Audio__classDrop3 (Audio__classDrop3)
package {
import mx.core.*;
public class Audio__classDrop3 extends SoundAsset {
}
}//package
Section 153
//Audio__classMenuButton (Audio__classMenuButton)
package {
import mx.core.*;
public class Audio__classMenuButton extends SoundAsset {
}
}//package
Section 154
//Audio__classMP3Base01 (Audio__classMP3Base01)
package {
import mx.core.*;
public class Audio__classMP3Base01 extends SoundAsset {
}
}//package
Section 155
//Audio__classMP3Base02 (Audio__classMP3Base02)
package {
import mx.core.*;
public class Audio__classMP3Base02 extends SoundAsset {
}
}//package
Section 156
//Audio__classMP3Base03 (Audio__classMP3Base03)
package {
import mx.core.*;
public class Audio__classMP3Base03 extends SoundAsset {
}
}//package
Section 157
//Audio__classMP3Base04 (Audio__classMP3Base04)
package {
import mx.core.*;
public class Audio__classMP3Base04 extends SoundAsset {
}
}//package
Section 158
//Audio__classMP3Base05 (Audio__classMP3Base05)
package {
import mx.core.*;
public class Audio__classMP3Base05 extends SoundAsset {
}
}//package
Section 159
//Audio__classMP3Base06 (Audio__classMP3Base06)
package {
import mx.core.*;
public class Audio__classMP3Base06 extends SoundAsset {
}
}//package
Section 160
//Audio__classMP3Base07 (Audio__classMP3Base07)
package {
import mx.core.*;
public class Audio__classMP3Base07 extends SoundAsset {
}
}//package
Section 161
//Audio__classMP3Base08 (Audio__classMP3Base08)
package {
import mx.core.*;
public class Audio__classMP3Base08 extends SoundAsset {
}
}//package
Section 162
//Audio__classMP3Base09 (Audio__classMP3Base09)
package {
import mx.core.*;
public class Audio__classMP3Base09 extends SoundAsset {
}
}//package
Section 163
//Audio__classMP3Base10 (Audio__classMP3Base10)
package {
import mx.core.*;
public class Audio__classMP3Base10 extends SoundAsset {
}
}//package
Section 164
//Audio__classMP3BlockExplosion (Audio__classMP3BlockExplosion)
package {
import mx.core.*;
public class Audio__classMP3BlockExplosion extends SoundAsset {
}
}//package
Section 165
//Audio__classMP3Bone11 (Audio__classMP3Bone11)
package {
import mx.core.*;
public class Audio__classMP3Bone11 extends SoundAsset {
}
}//package
Section 166
//Audio__classMP3Bone12 (Audio__classMP3Bone12)
package {
import mx.core.*;
public class Audio__classMP3Bone12 extends SoundAsset {
}
}//package
Section 167
//Audio__classMP3Bone13 (Audio__classMP3Bone13)
package {
import mx.core.*;
public class Audio__classMP3Bone13 extends SoundAsset {
}
}//package
Section 168
//Audio__classMP3Bone14 (Audio__classMP3Bone14)
package {
import mx.core.*;
public class Audio__classMP3Bone14 extends SoundAsset {
}
}//package
Section 169
//Audio__classMP3Concrete02 (Audio__classMP3Concrete02)
package {
import mx.core.*;
public class Audio__classMP3Concrete02 extends SoundAsset {
}
}//package
Section 170
//Audio__classMP3Concrete03 (Audio__classMP3Concrete03)
package {
import mx.core.*;
public class Audio__classMP3Concrete03 extends SoundAsset {
}
}//package
Section 171
//Audio__classMP3Concrete06 (Audio__classMP3Concrete06)
package {
import mx.core.*;
public class Audio__classMP3Concrete06 extends SoundAsset {
}
}//package
Section 172
//Audio__classMP3Curse (Audio__classMP3Curse)
package {
import mx.core.*;
public class Audio__classMP3Curse extends SoundAsset {
}
}//package
Section 173
//Audio__classMP3Flute01 (Audio__classMP3Flute01)
package {
import mx.core.*;
public class Audio__classMP3Flute01 extends SoundAsset {
}
}//package
Section 174
//Audio__classMP3Flute02 (Audio__classMP3Flute02)
package {
import mx.core.*;
public class Audio__classMP3Flute02 extends SoundAsset {
}
}//package
Section 175
//Audio__classMP3Flute03 (Audio__classMP3Flute03)
package {
import mx.core.*;
public class Audio__classMP3Flute03 extends SoundAsset {
}
}//package
Section 176
//Audio__classMP3Flute04 (Audio__classMP3Flute04)
package {
import mx.core.*;
public class Audio__classMP3Flute04 extends SoundAsset {
}
}//package
Section 177
//Audio__classMP3Flute05 (Audio__classMP3Flute05)
package {
import mx.core.*;
public class Audio__classMP3Flute05 extends SoundAsset {
}
}//package
Section 178
//Audio__classMP3Flute06 (Audio__classMP3Flute06)
package {
import mx.core.*;
public class Audio__classMP3Flute06 extends SoundAsset {
}
}//package
Section 179
//Audio__classMP3Flute07 (Audio__classMP3Flute07)
package {
import mx.core.*;
public class Audio__classMP3Flute07 extends SoundAsset {
}
}//package
Section 180
//Audio__classMP3Flute08 (Audio__classMP3Flute08)
package {
import mx.core.*;
public class Audio__classMP3Flute08 extends SoundAsset {
}
}//package
Section 181
//Audio__classMP3Flute09 (Audio__classMP3Flute09)
package {
import mx.core.*;
public class Audio__classMP3Flute09 extends SoundAsset {
}
}//package
Section 182
//Audio__classMP3Flute10 (Audio__classMP3Flute10)
package {
import mx.core.*;
public class Audio__classMP3Flute10 extends SoundAsset {
}
}//package
Section 183
//Audio__classMP3Flute11 (Audio__classMP3Flute11)
package {
import mx.core.*;
public class Audio__classMP3Flute11 extends SoundAsset {
}
}//package
Section 184
//Audio__classMP3Flute12 (Audio__classMP3Flute12)
package {
import mx.core.*;
public class Audio__classMP3Flute12 extends SoundAsset {
}
}//package
Section 185
//Audio__classMP3Flute13 (Audio__classMP3Flute13)
package {
import mx.core.*;
public class Audio__classMP3Flute13 extends SoundAsset {
}
}//package
Section 186
//Audio__classMP3Flute14 (Audio__classMP3Flute14)
package {
import mx.core.*;
public class Audio__classMP3Flute14 extends SoundAsset {
}
}//package
Section 187
//Audio__classMP3GrabShape (Audio__classMP3GrabShape)
package {
import mx.core.*;
public class Audio__classMP3GrabShape extends SoundAsset {
}
}//package
Section 188
//Audio__classMP3LCH01 (Audio__classMP3LCH01)
package {
import mx.core.*;
public class Audio__classMP3LCH01 extends SoundAsset {
}
}//package
Section 189
//Audio__classMP3LoopEndSound (Audio__classMP3LoopEndSound)
package {
import mx.core.*;
public class Audio__classMP3LoopEndSound extends SoundAsset {
}
}//package
Section 190
//Audio__classMP3LoopStartSound (Audio__classMP3LoopStartSound)
package {
import mx.core.*;
public class Audio__classMP3LoopStartSound extends SoundAsset {
}
}//package
Section 191
//Audio__classMP3Noise01 (Audio__classMP3Noise01)
package {
import mx.core.*;
public class Audio__classMP3Noise01 extends SoundAsset {
}
}//package
Section 192
//Audio__classMP3Noise02 (Audio__classMP3Noise02)
package {
import mx.core.*;
public class Audio__classMP3Noise02 extends SoundAsset {
}
}//package
Section 193
//Audio__classMP3Noise03 (Audio__classMP3Noise03)
package {
import mx.core.*;
public class Audio__classMP3Noise03 extends SoundAsset {
}
}//package
Section 194
//Audio__classMP3Noise04 (Audio__classMP3Noise04)
package {
import mx.core.*;
public class Audio__classMP3Noise04 extends SoundAsset {
}
}//package
Section 195
//Audio__classMP3Noise05 (Audio__classMP3Noise05)
package {
import mx.core.*;
public class Audio__classMP3Noise05 extends SoundAsset {
}
}//package
Section 196
//Audio__classMP3OkHarmony (Audio__classMP3OkHarmony)
package {
import mx.core.*;
public class Audio__classMP3OkHarmony extends SoundAsset {
}
}//package
Section 197
//Audio__classMP3Ontto (Audio__classMP3Ontto)
package {
import mx.core.*;
public class Audio__classMP3Ontto extends SoundAsset {
}
}//package
Section 198
//Audio__classMP3ReturnShape (Audio__classMP3ReturnShape)
package {
import mx.core.*;
public class Audio__classMP3ReturnShape extends SoundAsset {
}
}//package
Section 199
//Audio__classMP3SoundGame (Audio__classMP3SoundGame)
package {
import mx.core.*;
public class Audio__classMP3SoundGame extends SoundAsset {
}
}//package
Section 200
//Audio__classMP3SoundMenu (Audio__classMP3SoundMenu)
package {
import mx.core.*;
public class Audio__classMP3SoundMenu extends SoundAsset {
}
}//package
Section 201
//Audio__classMP3Wind01 (Audio__classMP3Wind01)
package {
import mx.core.*;
public class Audio__classMP3Wind01 extends SoundAsset {
}
}//package
Section 202
//Audio__classMP3Wind02 (Audio__classMP3Wind02)
package {
import mx.core.*;
public class Audio__classMP3Wind02 extends SoundAsset {
}
}//package
Section 203
//Audio__classStone01 (Audio__classStone01)
package {
import mx.core.*;
public class Audio__classStone01 extends SoundAsset {
}
}//package
Section 204
//Audio__classStone02 (Audio__classStone02)
package {
import mx.core.*;
public class Audio__classStone02 extends SoundAsset {
}
}//package
Section 205
//Audio__classStone03 (Audio__classStone03)
package {
import mx.core.*;
public class Audio__classStone03 extends SoundAsset {
}
}//package
Section 206
//Audio__classStone04 (Audio__classStone04)
package {
import mx.core.*;
public class Audio__classStone04 extends SoundAsset {
}
}//package
Section 207
//Audio__classStone05 (Audio__classStone05)
package {
import mx.core.*;
public class Audio__classStone05 extends SoundAsset {
}
}//package
Section 208
//Audio__classStone06 (Audio__classStone06)
package {
import mx.core.*;
public class Audio__classStone06 extends SoundAsset {
}
}//package
Section 209
//Audio__classStone07 (Audio__classStone07)
package {
import mx.core.*;
public class Audio__classStone07 extends SoundAsset {
}
}//package
Section 210
//ContactListener (ContactListener)
package {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import TestBed.*;
public class ContactListener extends b2ContactListener {
override public function Persist(_arg1:b2ContactPoint):void{
collide(_arg1, true);
}
override public function Add(_arg1:b2ContactPoint):void{
collide(_arg1, false);
}
private function collide(_arg1:b2ContactPoint, _arg2:Boolean):void{
var _local3:b2Body;
var _local4:b2Body;
var _local5:UserData;
var _local6:UserData;
var _local7:int;
var _local8:int;
var _local9:Boolean;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:int;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Particle;
_local3 = _arg1.shape1.m_body;
_local4 = _arg1.shape2.m_body;
_local5 = _local3.m_userData;
_local6 = _local4.m_userData;
_local7 = -1;
_local8 = -2;
if (_local5 != null){
_local7 = _local5._iD;
};
if (_local6 != null){
_local8 = _local6._iD;
};
_local9 = false;
if ((((_local7 == 100)) || ((_local7 == 101)))){
_local9 = true;
};
if ((((_local8 == 100)) || ((_local8 == 101)))){
_local9 = true;
};
if (((!((_local5 == null))) && (!(_local9)))){
_local5._collided = true;
if (_arg1.shape2.IsSensor()){
if (_local5._collidesWithSensorsN < _local5._collidesWithSensors.length){
var _local21 = _local5._collidesWithSensorsN++;
_local5._collidesWithSensors[_local21] = _local4;
};
};
};
if (((!((_local6 == null))) && (!(_local9)))){
_local6._collided = true;
_local8 = _local6._iD;
if (_arg1.shape1.IsSensor()){
if (_local6._collidesWithSensorsN < _local6._collidesWithSensors.length){
_local21 = _local6._collidesWithSensorsN++;
_local6._collidesWithSensors[_local21] = _local3;
};
};
};
if ((((_local7 == 101)) && ((_local8 == 101)))){
return;
};
if ((((((_local7 >= 34)) && ((_local7 <= 36)))) && ((_local8 == 26)))){
_local5._levelCompleted = true;
_local6._levelCompleted = true;
} else {
if ((((((_local8 >= 34)) && ((_local8 <= 36)))) && ((_local7 == 26)))){
_local5._levelCompleted = true;
_local6._levelCompleted = true;
};
};
if (((_arg1.shape1.m_isSensor) || (_arg1.shape2.m_isSensor))){
return;
};
_local10 = _local3.m_linearVelocity.Length();
_local11 = _local4.m_linearVelocity.Length();
_local12 = _arg1.velocity.Length();
if (!_arg2){
_local17 = _local12;
if (_local17 < _local10){
_local17 = _local10;
};
if (_local17 < _local11){
_local17 = _local11;
};
_local17 = (_local17 * 0.03);
if (_local17 > 1){
_local17 = 1;
};
if (_local17 > 0.07){
Main.playHitSound(_local7, _local8, _local17);
};
};
if ((((_local7 < 100)) || ((_local8 < 100)))){
if (_local5 != null){
_local5._damage = (_local5._damage + 1);
};
if (_local6 != null){
_local6._damage = (_local6._damage + 1);
};
};
if ((((_local7 >= 100)) || ((_local8 >= 100)))){
return;
};
_local13 = (_local10 + _local11);
_local14 = 0xEEEEEE;
_local15 = Particle.PARTICLE_TYPE_DUST;
_local13 = (_local13 / 5);
_local16 = 0;
while (_local16 < _local13) {
_local18 = ((((_arg1.position.x * Test.m_debugDraw.m_drawScale) + (Math.random() * 2)) - 1) + 300);
_local19 = (((_arg1.position.y * Test.m_debugDraw.m_drawScale) + (Math.random() * 2)) - 1);
_local20 = Main.m_particleManager.addParticle(_local15, _local18, _local19, _local14);
if (_local20 != null){
_local20._speedX = ((Math.random() * 0.5) - 0.25);
_local20._speedY = ((Math.random() * 0.5) - 0.25);
_local20._life = (_local20._life + (Math.random() * 10));
};
_local16++;
};
}
}
}//package
Section 211
//Main (Main)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
import flash.media.*;
import TestBed.*;
import General.*;
import flash.filters.*;
import flash.ui.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
import mochi.*;
import flash.utils.*;
public dynamic class Main extends MovieClip {
private var _bgm:int;// = -1
public var _bitmapCursorHelper:Bitmap;// = null
public var _classSealBack:Class;
public var _classTextureB:Class;
public var _classTextureC:Class;
public var _classTextureD:Class;
public var _classTextureE:Class;
public var _classTextureF:Class;
public var _classTravelLineSlot:Class;
public var _classTextureA:Class;
private var _infernoLevelsCompleted:int;// = 0
public var _helpStatus:Boolean;// = false
private var _ttVertexCloud:TTVertexCloud;// = null
private var _playBaseDelay:int;// = 0
private var _previousBase:int;// = -1
private var _previousFlute:int;// = -1
private var _levelNameTimer:int;// = 0
private var _previousNoise:int;// = -1
private var _bgmSound:Sound;// = null
private var _playWorkingDelay:int;// = 0
private var _rotate:Number;// = 0
public var _classTitleScreen:Class;
public var _classCreditsScreenBackground:Class;
public var _bitmapCursorHandOpen:Bitmap;// = null
public var _classInstructionsScreen:Class;
private var _playFluteDelay:int;// = 0
public var _classTheEndScreen:Class;
public var _classButtonWalkthrough:Class;
public var _mouseClickedX:int;
private var _matrix:Array;
public var _mouseClickedY:int;
public var _classPerfectBalance:Class;
public var _classMissionFailed:Class;
private var _playNoiseDelayMax:int;// = 100
public var _bitmapSealBack:Bitmap;// = null
private var _black:Sprite;// = null
public var _movieClipGamesFreeButton:SimpleButton;// = null
private var _playNoiseDelay:int;// = 100
public var _firstRun:Boolean;// = true
public var _classStory10:Class;
public var _classStory11:Class;
public var _bitmapCursorHandClosed:Bitmap;// = null
public var _bitmapTheEndScreen:Bitmap;// = null
public var _classStory12:Class;
public var _bitmapBackgroundFlash:Bitmap;// = null
public var _bitmapCreditsScreenBackground:Bitmap;// = null
public var _bitmapInstructionsScreen:Bitmap;// = null
private var _killBGM:Boolean;// = false
public var _gridMode:int;// = 0
public var s_travelLineLevelCoordinates:Array;
public var _mouseX:int;
public var _class3DLogo:Class;
public var _mouseY:int;
public var _bitmapSealFront:Bitmap;// = null
public var _classTravelLine:Class;
public var _classTravelLineSlotLocked:Class;
public var m_currTest:Test;// = null
public var _classTravelLineSlotCurrent:Class;
public var _bitmapButtonWalkthrough:Bitmap;// = null
private var _bgmSoundChannel:SoundChannel;// = null
public var _mouseClicked:Boolean;// = false
private var _rotateSeal:Number;// = 0
public var _classBackgroundFlash:Class;
public var _classCreditsScreen:Class;
public var _first:Boolean;// = true
private var _audioBank:Audio;// = null
public var _classStory1:Class;
public var _bitmapTitleScreen:Bitmap;// = null
public var _classStory3:Class;
public var _classStory6:Class;
public var _classStory7:Class;
public var _classStory8:Class;
public var _classStory2:Class;
private var _infernoSound:int;// = 100
public var _classSealFront:Class;
private var _bitmapVertexCloud:Bitmap;// = null
public var _classStory5a:Class;
public var _classStory5b:Class;
public var _classStory9:Class;
private var _killSFXFrames:int;// = 30
public var _classStory4:Class;
private var m_oldTime:int;
private var _scoreSent:Boolean;// = true
public var _bitmapCreditsScreen:Bitmap;// = null
public static const SCREEN_DY:int = 500;
public static const SCREEN_DX:int = 600;
public static const LEVELS_MAX:int = 30;
private static const LEVEL_DATA_STRINGS:Array = ["<level> 20 0 0 1001 0 50 22.40000000000001 3.35 2.55 -1.0364914779665537e-21 50 18.499999999999996 -7 6.3 1.0162371816025856e-20 28 -11 2.7 110 46 0 26 26.000000000000018 12.95 7.4 -3.9548596482297376e-19 28 0.35 6.25 40 38 0 28 11.5 2.95 110 40 0 28 -0.3 -5.5 318 130 0 28 0 -13 320 20 0 28 -15 -1.4 10 210 0 35 -13.149933915032081 8.004999868554014 1.3144599436448373e-7 28 1 13.45 320 89 0 28 15.05 4.15 10 210 0 50 28.40000000000002 5 2.85 1.9678488331610396e-21 56 15.799999999999994 4.95 1.9 0 1000 1.5 ", "<level> 20 0 0 1001 0 50 19.400000000000002 -4.15 -0.65 9.484213106529625e-23 50 28.700000000000024 2.5 -0.1 7.454575416755247e-23 28 -13.55 -0.8 60 50 0 28 -0.55 10.8 320 35 0 72 5.956619977769881 5.700326472962705 25 67 -0.00007735311544623644 28 1.05 4.5 70 30 0 28 15.05 -2.25 10 258 0 28 0 -13 320 20 0 26 26.000000000000018 13.05 7.5 -3.9548596482297376e-19 35 -12.64999759926054 8.054999934540488 6.545951462312651e-8 28 -10 3.5 89 50 0 28 0.4 -8.5 318 130 0 72 -1.002043952420884 7.854999923700649 22 24 6.936304992207454e-8 72 9.397952610593757 7.854999923700646 22 24 6.936305232756923e-8 28 -1.45 0.45 20 66 0 28 12.2 1.05 80 99 0 28 -14.75 7.1 10 210 0 1000 1.5 ", "<level> 20 0 0 1001 0 74 -0.2 -4.2 43 22 0 1973955 73 7.3 -8.2 20 22 0 1973955 28 11.55 3.45 100 46 0 28 -8.449999999999998 7.749999999999998 149 54 0 28 -4.750000000000003 1 74 20 0 28 -14.000000000000004 2.5500000000000007 50 50 0 26 26.000000000000018 13.05 8.55 -3.9548596482297376e-19 28 9 6.05 129 20 0 28 -14.9 -1.65 10 45 0 35 -13.04999838795664 -0.9450000388541959 3.885419740308267e-8 28 15.05 8.55 10 39 0 28 -10.15 -8.1 150 100 0 72 -10.099937718685712 3.454999957706386 22 32 -3.8448740235365454e-8 72 -7.749996233493973 3.954999961051239 22 22 1.570796362202861 28 -0.25 12.9 307 57 0 72 1.1000000198141433 3.804999999995998 101 25 7.925085982183676e-13 72 -5.349997926165234 4.004999956730172 20 21 4.3269827106436854e-8 28 8.75 -2.45 129 89 0 28 6.6 -12.3 201 56 0 50 14.599999999999987 -5.1 -2.05 -1.1775854571528416e-20 50 20.6 12.05 -8.1 -2.5067263452350454e-21 1000 1.5 ", "<level> 20 0 0 1001 0 50 20.900000000000002 -8.5 2.35 -3.5186618705326844e-23 50 15.49999999999999 9.25 6.9 -2.261627930750017e-23 28 15.05 3.4 10 210 0 28 -0.7 10.95 320 38 0 35 -13.149973140302809 8.054999960618916 3.938108300411961e-8 28 -15 -1.4 10 210 0 26 26.000000000000018 13.05 7.5 -3.9548596482297376e-19 28 -0.65 -5.45 320 130 0 28 -12 3.5 50 50 0 28 -5 3.45 30 50 0 28 10.05 5.5 90 10 0 28 8.05 2.2 50 25 0 73 -7.95 2.35 20 20 0 1973899 74 1 2.95 90 10 0 1973899 73 13.35 3.85 20 20 0 1973962 74 6.55 7.6 20 30 0 1973962 72 1.0999999926319215 1.9550000000000012 80 10 -2.910922647679646e-17 28 0.45 -12.2 320 20 0 1000 1.5 ", "<level> 20 0 0 1001 0 50 27.200000000000017 -1.3 0.2 -9.323686107403678e-23 50 14.299999999999986 3.7 -0.6 1.5879952207322246e-22 73 -5.3 -0.65 20 10 0 1973924 73 6.25 7.85 20 20 0 1973860 72 -3.449999949701905 7.255000000000006 55 36 -3.141592653589793 28 7.35 -9.35 88 70 0 28 -1.9 -8.7 110 145 0 72 -9.099999494405882 3.054999973921578 20 20 2.6078421363656055e-8 72 7.600001190062937 -3.795000052427187 27 27 3.8834954902552306e-8 28 7.55 5.3 140 25 0 35 -12.849970980937776 3.0549998690808513 1.3091915638119306e-7 28 3.6 -8.45 18 140 0 74 7.550000000000001 -1.9499999999999993 60 10 0 1973860 26 26.000000000000018 13.05 2.55 -3.9548596482297376e-19 28 12.999999999999996 -7.499999999999999 49 170 0 28 0 -13 320 20 0 28 -15.000000000000002 -1.4 10 210 0 28 -11.15 6.549999999999999 90 50 0 28 -15.95 -6.3 186 145 0 28 11.05 7.6 70 30 0 28 -0.05 11 320 39 0 28 15.05 4.05 10 210 0 28 1.55 3.55 20 30 0 74 1.5 0.25 20 30 0 1973924 1000 1.5 ", "<level> 20 0 0 1001 0 50 32.300000000000026 1.1 0.7 8.439592432416651e-23 50 25.700000000000014 10 0.3 -3.615293683648193e-23 50 13.699999999999985 7.8 -0.4 -1.9830805246817055e-22 50 20 6.65 -0.05 3.4718432317724534e-23 74 -7.75 6.95 10 33 0 1991966 76 3.8 0.35 10 32 0 1991966 72 7.699221527645813 7.400665951759803 25 29 -0.0005246196108714904 72 4.650012086601134 7.4049999685127625 25 29 2.5189789843333863e-8 72 -10.299999307357995 7.4049999685127625 25 29 2.518978986311292e-8 28 7.35 -7.05 160 113 0 28 12.9 -0.2 34 58 0 28 8.9 3.75 113 33 0 74 -11.45 6.95 58 33 0 2010142 76 -1.1 6.95 10 33 0 2010142 28 -7.65 -3.55 143 172 0 28 -15.05 -1.7 10 220 0 28 -0.9 10.7 320 37 0 28 0 -13 320 20 0 28 15.05 -1.6 10 210 0 35 -13.14997386184798 7.854999961155932 3.884406812726688e-8 26 29.900000000000027 12.75 7.15 -3.9548596482297376e-19 1000 1.5 ", "<level> 20 0 0 1001 0 50 21.500000000000004 10.9 5.3 -0.06757069859442155 50 23.000000000000007 -13.1 6.65 -0.016720975239305453 50 18.499999999999996 -1.7 -1.95 -0.0024266066378446213 75 -5.65 -0.6 53 36 0 11017758 78 3.9979007749231843 -5.449871374484219 31 92 0.00013942144503917934 74 4 -0.2 15 13 0 11017758 28 4 -11.4 43 24 0 28 6.45 -7.45 14 120 0 28 1.55 -7.35 13 130 0 28 4 10.65 17 119 0 50 14.599999999999987 13.25 4.8 -0.05984375715514858 28 -1.7499999999999998 -7.849999999999998 17 92 0 28 -6.300000000000001 -8.150000000000002 18 97 0 28 -3.9 -11.75 45 25 0 26 27.80000000000002 11.3 -0.4 0 28 12.5 -3.3500000000000005 53 25 0 28 14.2 -0.85 23 49 0 28 13 2.6 80 25 0 28 -14.7 0.3 18 50 0 28 -13.5 -2.7 50 30 0 28 -12.95 3.6 50 30 0 35 -12.449998580124477 1.1049998563050238 1.4369498653755024e-7 28 -4.25 7.9 31 124 0 74 -4 -3.3 12 11 0 11017758 78 -3.998236877774904 -7.04526564213779 24 64 -0.00004637291018449303 28 -14.25 -5 30 25 0 28 -2.75 6.9 20 25 0 28 -5.65 4.55 20 18 0 72 11.059526616062222 -5.345227547461088 19 15 0.00023798484355520364 72 13.001270192019597 -6.131997969091087 33 13 0.6732541868430587 56 8.899999999999974 13.25 4.35 0 1000 1.5 ", "<level> 20 0 0 1001 0 56 12.499999999999982 -8.4 -8.2 0 50 19.4 -8.4 -7.7 5.161269241946531e-20 50 18.799999999999997 -12.8 5.25 -1.1845237843244979e-21 50 21.500000000000004 3.3 -7.55 -1.3709613143275962e-21 50 16.999999999999993 8.7 -0.85 1.2503806756590116e-22 28 -3.35 -7.15 27 106 0 46 28.70000000000002 -11.870741579895403 -5.7299999999999995 0 35 13.100314758788151 -6.995000013302665 1.330266509985445e-8 72 6.750215710786033 7.504998405517145 70 10 4.555665447449855e-7 72 -2.5335911788106382 0.3215818415604498 20 20 -0.4725427854134384 72 -0.4949999999999992 1.9081442444135408 20 20 -3.7087904974933047e-16 72 -2.6420585229593803 2.6070850145788893 20 20 -0.31864599715030817 46 33.80000000000001 -1.1849958389480812 4.953744693265097 0.48386484787963735 65 -4.95 6.15 0.27843506984035 28 -4.9 -4.05 20 180 0 28 -0.1 -13 320 10 0 72 4.148405322721927 6.009986531063279 20 20 -0.000007178270244808899 28 -15.05 5.95 10 42 0 28 -0.45000000000000007 9 310 20 0 28 0.05 13.2 310 82 0 28 6.55 -0.35 20 113 0 28 1.5 -0.55 20 110 0 28 -12.5 -0.15 60 83 0 28 -14.75 -9.45 16 134 0 28 0.55 -10.85 340 37 0 28 13.05 7.2 50 124 0 26 25.700000000000017 12.9 -0.5 -0.8019615851234191 28 15.05 -5.05 10 152 0 28 11.05 -4 110 40 0 1000 1.5 ", "<level> 20 0 0 1001 0 72 0.8085156227743329 2.503404552719016 189 10 -0.00012507291597074478 72 0.3232098306308343 -2.396433630067666 10 88 -0.0001485913481810695 28 9.55 -2 40 70 0 28 8.45 5.05 59 40 0 28 0.5500000000000002 8 40 100 0 28 -6.449999999999999 5.099999999999998 40 40 0 28 -0.15 -11.85 290 36 0 28 -10.2 -6 35 20 0 28 13.55 -3.4499999999999993 60 210 0 28 -13.5 7.95 40 40 0 28 -13.45 -5.45 40 170 0 35 -10.438152871941693 -7.995000078235315 7.823531853477636e-8 72 6.5503162961757155 9.00499992123781 20 20 7.876219372321407e-8 72 3.9503115458559126 9.004999921237806 20 20 7.876219722756144e-8 28 -15 4.55 10 30 0 72 -12.7999990558042 4.754999897165735 25 24 3.14159273585721 72 -2.5545047610523355 0.7088233205073992 28 26 -0.00012473486185780904 72 -5.397398460887733 0.8072813519975758 25 24 0.0012940032420714878 28 -0.15 13.05 310 61 0 26 26.600000000000016 13.55 8.55 6.283185307179586 50 22.100000000000005 -9.35 -3.55 -4.00962527866204e-22 50 13.999999999999986 -5.5 7.95 8.878432920900917e-22 28 -2.999999999999999 -7 50 80 0 28 6.35 -7 110 80 0 1000 1.5 ", "<level> 20 0 0 1001 0 46 12.799999999999983 1.55 -13 2.9625267430867464 26 26.900000000000016 12.95 2.5 -0.39165959895631897 50 22.700000000000006 2.2 -3.7 -5.8491617957718646e-21 30 2.0500018974418373 2.004999947850637 2.607468435207002e-8 30 -2.349998318888747 2.0049999475853086 2.6207348505370127e-8 1 -6.299998743564579 -1.7450000521568572 5.2156858463815545e-8 50 23.000000000000007 -5.6 2.45 1.3720580139728477e-21 50 20 -9.75 2.3 2.7774745854179627e-22 35 -13.15505909698215 3.00499664642384 0.000002788978537556921 28 0.30000000000000016 7.500000000000004 320 70 0 28 -11.5 0.10000000000000003 140 17 0 28 11.599999999999998 0.15 140 17 0 28 0 13.45 320 115 0 28 -10.25 -3.05 55 51 0 28 10.25 -3.1 54 58 0 28 15.05 4.2 10 97 0 28 -14.95 5.05 10 114 0 28 0 -6.6 210 27 0 28 -8.5 -8.45 20 30 0 28 -4.5 -7.45 20 30 0 28 8.55 -8.45 20 30 0 28 4.55 -7.45 20 30 0 28 0 -8.9 20 30 0 28 -7.45 5.05 20 30 0 28 7.55 5 20 30 0 28 14.15 -0.95 40 20 0 28 -14.35 -0.95 40 20 0 1 6.550000118191315 -1.69500000001326 1.3259942669040512e-11 50 14.599999999999987 -8.65 1.95 -2.0668502756730747e-20 1000 1.5 ", "<level> 20 0 0 1001 0 50 19.7 -12.4 7.4 1.0488489581980752e-22 50 18.199999999999996 -13.4 7.3 -7.969726357885722e-22 28 1.9 13.95 385 94 0 2 -3.900459984632077 6.9542675065985184 -1.5722656318403805 72 1.2443455759158044 4.2516199360000835 70 94 0.00008102930519834109 2 5.9495395895394925 6.954920960261376 -1.570954456282668 28 16.550000000000004 5.550000000000001 200 90 0 28 8.55 -5.700000000000002 200 73 0 48 -5.999653218916855 -5.94500003938109 3.9381090780712606e-8 28 15.05 -1.6 10 210 0 28 -15 -1.4 10 210 0 28 0 -13 320 20 0 28 -0.25 9.949999999999996 320 20 0 35 -13.099923152112238 -5.945000039381091 3.9381091681682944e-8 28 -0.1 -10.55 340 50 0 26 26.000000000000018 13 -0.55 -3.9548596482297376e-19 28 -9.55 0.55 100 110 0 76 10.9 -0.5 10 25 0 2002718 74 -0.3 -1.3 80 10 0 2002718 50 13.999999999999986 -9.95 7.05 1.1098041151126148e-21 50 22.40000000000001 -8.7 7.55 -1.3285114407292494e-21 50 15.199999999999989 -6.05 7.1 2.7764609066176834e-23 1000 1.5 ", "<level> 20 0 0 1001 0 20 16.09999999999999 -8.6 8.24939518229167 1.861955491459379 29 -7.052177962062182 7.233117915912734 4.1990488793824605 1 4.141594418980226 7.982885693140799 3.9607956540705977 1 -0.8946605274690658 0.0845921429072932 -0.21881728426567243 20 10.399999999999975 0.6930159670023432 0.22534142675566377 -0.09500311918047002 28 10.5 -5.55 20 80 0 28 6.05 2.1 10 30 0 74 10 -0.45 89 18 0 1973968 73 -3.5 -10.1 20 14 0 1973968 28 11.05 8.35 110 126 0 26 27.500000000000018 13.05 -4.5 -1.1274696143332182e-16 28 8.05 -4.6 50 32 0 28 15.05 3.7 10 210 0 50 19.4 0.4 -4.7 5.376322127027636e-21 50 23.90000000000001 -5.2 -9.45 5.035024036848026e-22 28 9.1 -12.3 210 126 0 28 -15.6 2.65 29 230 0 28 0.65 12.8 320 47 0 28 1.55 -9.5 60 70 0 28 -0.75 -13.3 320 45 0 28 0.9499999999999998 4.550000000000001 30 50 0 29 0.00012836581511921352 2.9577160489981065 -3.3589696302780996 28 4.35 -9.55 60 120 -0.6453981633974482 28 -12.45 -7.55 80 90 0 35 -13.154304238219485 1.0535373268565027 -0.0005946943865824921 28 -15.45 6.55 80 90 0 28 -13.45 11.55 80 90 0 28 -12.45 13.55 80 90 0 28 -11.55 -14.45 80 90 0 28 -15.55 -6.45 80 90 0 1 -2.742259316561824 9.453475883793152 1.572321141388498 20 20.6 -4.772072512544333 9.420231673382782 3.3499919963371347 1 -0.38806309010603107 9.09810194674979 -2.646202157846274 1 2.220930747082422 9.455000000000009 3.506165444780636e-16 1000 1.5 ", "<level> 20 0 0 1001 0 50 24.50000000000001 6.05 -8.65 7.937732679701821e-22 50 28.10000000000002 -1.6 -1.1 1.054104350378727e-22 19 11.020836475295345 -0.4089118369810946 -2.861496372815885 19 7.321531177324093 0.4049999999999938 -6.2831853071795845 28 3.6 -11.9 243 33 0 74 4.15 4.55 27 25 0 1973827 73 2 0.05 10 10 0 1973827 74 -5.95 4.5 25 25 0 1973992 73 -3.8 0.05 10 10 0 1973992 46 16.999999999999996 2.7333587843643707 -7.112524612323714 -0.7770066645401755 46 20.300000000000004 0.8741315270473687 -7.166134365629355 -0.41618344376659244 46 24.200000000000017 -1.3450000000000017 -7.228225151293553 -0.7395541322576437 28 2.500000000000001 -5.15 166 22 -0.059999999999999984 28 2.6 -4.05 166 22 0 28 -13 -5.8 170 175 0 28 11.050000000000004 1.8999999999999995 170 20 0 26 26.000000000000018 13 4.55 -3.9548596482297376e-19 28 -0.65 10.55 340 90 0 28 15.05 -1.6 10 210 0 28 -15 -1.4 10 210 0 28 -0.25 9.95 320 20 0 35 -12.74054361800946 5.054999973921577 2.60784244684908e-8 28 12.05 -8.45 50 110 0 28 -5.700000000000001 -7.4 63 60 0 28 11.65 -7.65 63 60 0 1000 1.5 ", "<level> 20 0 0 1001 0 50 16.09999999999999 -1.6 7.1 -1.8906553383631204e-21 50 22.700000000000006 6.7 -0.5 -1.169832359154373e-21 50 27.500000000000018 12.7 -8.55 -1.0198554314054353e-22 74 4.9 -4.8 16 31 0 1973876 73 -10.95 -3.75 20 20 0 1973876 73 -6.3 0.6 20 20 0 1973878 74 -9.7 -6.5 86 8 0 1995550 76 2.3 -4.45 25 26 0 1995550 74 2.25 1 24 69 0 2001950 76 -9.2 6.2 78 20 0 2001950 28 0.6 -6.8 110 7 -0.04 28 0.45 -13.1 349 55 0 28 -12.2 -7.5 40 5 0 35 -11.293138560598246 -8.745000026078415 2.6078415580162108e-8 28 -14.05 -9.75 30 50 0 28 -1.3 13 349 81 0 1 7.046726205557397 -3.9950021157435818 0.0000014361305723219158 74 4.65 3.05 14 36 0 1973878 28 -3.5 4.7 30 28 -0.040000000000000015 28 -3.45 0.2 30 36 0.03 28 -3.45 -2.95 30 32 -0.009999999999999997 28 -4.3 -12.3 190 17 -0.07 28 -10.35 8.85 130 16 0.17 28 -0.95 -0.85 30 120 0 28 -13.8 -4.25 30 30 0.060000000000000005 28 -14.05 0.2 30 30 -0.04 28 -14.8 4.4 30 30 0.11 28 15.05 -1.6 10 210 0 28 -15 -1.4 10 210 0 28 -0.25 9.95 320 20 0 28 10.5 -2.5 120 10 0 28 4.65 -1 10 40 0 28 11.05 5.15 10 77 0 26 26.000000000000018 13.1 7.414583333333333 -3.9548596482297376e-19 28 4.25 5.5 134 10 0 73 9.35 3.75 20 20 0 1973867 74 11 -0.35 10 30 0 1973867 73 9.15 7.55 20 20 0 1973844 74 13.05 4.35 24 25 0 1973844 20 22.700000000000006 9.178661686820934 -4.130867806854544 -0.06009255095276892 19 10.922240701545798 -4.982397703999777 -2.595623297360675 1000 1.5 ", "<level> 20 0 0 1001 0 56 13.399999999999988 7.3 -10.1 3.141592653589793 50 18.5 -2.9 3.85 -2.2573563789389655e-22 50 23.900000000000013 12.35 -3.35 1.648399731017709e-22 50 30.200000000000028 7.3 -8.9 4.0805805820770936e-23 20 19.700000000000003 -3.50001455992794 -6.923015864201408 4.979244722374456 74 -0.15 -9.3 20 20 0 5119518 28 -10.05 6.5 110 83 0 35 -12.27276320193673 -8.940969809898235 0.0006579575497048747 33 -12.411580641450248 -7.445836817687315 -3.1406748994754947 49 12.25506706380242 -7.945569606115483 0.0000021925796606755993 28 -13.55 0.35 180 40 0 28 -9.5 -1.5 120 10 0 28 -15 -1.4 10 210 0 28 14.05 -5.45 70 10 0 28 -5.450000000000001 2.05 70 10 0 28 -7.05 -0.65 70 20 0 28 -13 -2.4 140 60 0.455398163397448 24 -2.27589896562503 -4.464257623679937 -4.605182201665215 28 -13 -5.45 30 30 0 28 -0.85 -12.65 320 36 0 20 22.40000000000001 -4.355773927409137 -3.115 1.728019528485512 20 22.40000000000001 -6.48584782517023 -3.7918931937426135 1.611552946502002 20 22.40000000000001 -4.83402701198566 -5.300163816108986 -3.8640728232572386 20 18.5 -8.443772124448266 -4.533515278751547 -4.4915906908339815 20 18.5 -9.492859323353452 -6.051224423842677 2.6332904854035264 20 22.40000000000001 -6.997614693803124 -5.972344207356272 5.085226925749867 20 22.40000000000001 -8.36075452970492 -7.749211807056554 2.726810717460559 28 -0.55 13.35 320 66 0 28 10.55 8.5 20 37 0 28 15.05 -0.45 10 242 0 26 26.000000000000018 13.1 8.5 -3.9548596482297376e-19 75 -0.35 -1.85 20 20 0 5119518 20 15.799999999999994 -5.4585886917637385 -7.099871489080563 1.6301793458898148 74 11.85 5.45 50 21 0 2012446 76 2.5 8.8 135 20 0 2012446 1000 1.5 ", "<level> 20 0 0 1001 0 56 12.499999999999982 -9.4 -11.9 0 56 12.499999999999982 5.4 -11.85 0 50 26.600000000000016 -9.4 -10.95 -2.4200716895883067e-22 50 22.100000000000005 5.4 -11.3 -3.00721895899653e-22 34 15.400000000000013 -2.75 -4.964999999999999 0 28 -4.5 -2.7 12 45 0 28 -1.05 -2.7 12 45 0 28 -2.6 -2.75 30 29 0 28 16.1 3.9 39 45 0 28 -0.05 -0.5 218 28 0 28 -15.5 3.75 39 62 0 35 -11.705190269535285 4.454472455522005 0.0000122487396531478 28 -10 1.4 110 27 0 28 11.8 1.8 110 20 0 28 11.8 6.45 110 20 0 28 0 8.400000000000002 240 20 0 30 3.738469416373727 5.404999830339829 -8.48300904172923e-8 1 2.1128202456442797 2.409999875150977 8.262723969877732e-9 1 4.118370529759001 2.4099962669120942 -0.0000036160369724419696 28 -10 6.45 110 20 0 30 -0.29920168765056787 5.404999547222103 2.263889758261779e-7 1 0.05011591389528095 2.4099991452346283 7.07458143593703e-7 26 22.40000000000001 12.65 4.1 0 3 2.3977199143646244 -2.8950005830320618 -1.565765337677594e-7 2 4.2955786518642824 -3.4847588959872153 0.6350434131139512 50 17.899999999999995 -13.45 -12.2 2.6712003389528543e-21 50 32.300000000000026 11.25 -11.55 3.3758369729666604e-22 50 36.19999999999999 1.7 -11.15 -3.128169271613058e-23 50 19.4 -7.55 10.65 5.376322127027636e-21 1000 1.5 ", "<level> 20 0 0 1001 0 20 23.000000000000007 -6.282865755326874 -4.075000248883916 0.7507733977262502 74 7.6 -0.5 20 27 0 1973872 73 5.95 -5.35 10 7 0 1973872 28 6 -9.7 57 50 -0.7853981633974483 28 -8.1 -10.75 57 50 0.7853981633974483 2 -5.625010503333326 -2.430000142012365 -3.1415925170061607 28 -0.55 -12 320 80 0 28 10.55 6.05 120 60 0 28 15.05 -1.6 10 210 0 28 -15 -1.4 10 210 0 28 0 -13 320 20 0 26 26.000000000000018 13.05 1.5 -3.9548596482297376e-19 28 -8.9 6.050000000000001 148 60 0 72 -6.499739272139881 2.054999839558154 50 20 -3.141592583570151 48 -7.99314293152481 0.05999960338979276 2.0470301270578297e-7 48 -5.294293210507334 0.05999993689640121 8.15009186921095e-8 19 -6.23805909637684 -1.4350002291284998 -3.141592518827263 35 -13.049998765531992 2.0549999345404517 6.54595515522714e-8 28 -13.05 -4.65 30 100 0 28 12.05 -6.95 110 99 0 28 9.05 2.4 50 27 0 28 -17.45 12.25 320 114 0 28 20.55 9.35 320 80 0 76 1.55 8.9 57 30 0 2000670 28 -14.25 -4.15 57 50 -0.7853981633974483 28 -13.3 -9.45 57 50 0 28 -4.25 8.75 57 50 0.7853981633974483 28 7.3 8.8 57 50 -0.7853981633974483 28 15.4 -3.55 57 50 0.7853981633974483 74 9.8 -0.45 20 27 0 2000670 50 20.90000000000001 0.2 -6.6 -7.037323741065462e-23 50 25.700000000000017 2.95 -6.3 -1.0845881050944659e-22 50 20.000000000000004 -9.4 -6.6 1.735921615886201e-22 1000 1.5 ", "<level> 20 0 0 1001 0 74 4.7 5.95 20 55 0 1973979 50 13.399999999999984 -8.9 6.65 -4.81930503415356e-22 50 22.100000000000005 -11.5 7.2 -1.00240631966551e-22 50 30.800000000000026 0.45 -8.1 5.28080173294169e-22 50 17.299999999999994 -7.4 -8.95 1.5831398212872444e-21 35 -13.150008029811456 -7.890001858789185 -0.000001384975926801565 28 0.45 12.8 317 60 0 28 3.55 -10 40 20 0 28 13.15 3 40 20 0 28 9.55 9.05 40 20 0 28 9.55 3.55 40 30 0 28 -0.7 -12.15 320 40 0 19 2.945976665594864 5.954005024435658 -1.5727983029828259 19 -4.603878482139919 5.954232925608009 -1.572326765166865 74 -6.5 -1.1 20 13 0 1974007 73 -3.4 -2.45 20 10 0 1974007 28 15.05 -1.6 10 210 0 28 -15 -1.4 10 210 0 28 -0.25 9.95 320 20 0 26 26.000000000000018 13.05 7.35 -3.9548596482297376e-19 28 9.55 -5.05 120 160 0 28 -10 -3.3999999999999995 90 30 0 73 -12.25 -1.05 40 10 0 1973973 74 -6.55 7.3 20 30 0 1973973 73 -13.3 7.3 20 30 0 1973979 28 -10 -13.6 90 69 0 1 -4.4006612056914545 1.958274864385613 -0.00010803386020588107 1 2.540923366394542 1.9597845874368927 -0.002228446924686607 31 -11.492116730213096 -5.895004154926817 -3.141594038565719 28 -10.35 2.7 99 60 0 28 6.15 -6.15 50 50 -0.7853981633974483 28 -3.25 -12.7 50 50 0.40539816339744794 1000 1.5 ", "<level> 20 0 0 1001 0 50 14.299999999999986 -2.7 -1 3.175990441464449e-22 50 20 -13.15 -9.35 3.4718432317724534e-23 73 -9.45 -9.5 20 20 0 1973926 35 -13.299998729853376 1.004999973921578 2.6078422628338906e-8 74 -12.65 3 35 20 0 1973926 74 3.6000000000000005 2.9 79 16 0 1973889 73 3.1 -7.75 83 8 0 1973889 72 3.0958027557621417 -1.795749639238006 87 78 -0.00021752466101345605 1 -13.348391350980537 -3.49500005214825 5.21482513237743e-8 1 -4.895126698131125 -5.490016551342336 0.00001683017169584476 1 -4.911705559471803 -3.4950124219142253 -4.712376558393308 26 26.000000000000018 13.15 3.020833333333332 -3.9548596482297376e-19 28 15.05 -1.6 10 210 0 28 -15 -1.4 10 210 0 47 -2.6397931924818643 8.160572608999871 2.034443984478074 28 11.25 7.9 100 60 0 28 14.05 -6.050000000000001 130 120 0 28 4.6 -14.35 130 120 0 28 -0.55 -13.45 320 55 0 28 -4.45 -2.25 60 5 0 28 -2.45 -7.5 20 100 0 28 -13 -2.25 30 5 0 28 3.65 6.9 70 60 0 28 7.650000000000004 4.5 310 19 0.15000000000000008 28 -8.95 2.5000000000000004 36 18 -0.20000000000000012 28 -0.6 13.15 320 82 0 46 33.500000000000014 -6.75 7.375624999999999 -1.7289006910577087 46 25.700000000000017 -13.220000000000002 7.769998594267133 -0.16777728840879183 48 -9.820341889500254 8.055000000000009 -1.5707963267948952 48 -11.452203657701753 6.213773063007699 -0.975183915050788 19 -7.4581948929965165 0.7508708605964319 0.08415278512589126 1000 1.5 ", "<level> 20 0 0 1001 0 56 16.699999999999992 4.05 -2.05 0 74 8.5 6.3 20 23 0 1974007 28 -11.15 -8.65 153 112 0 28 11.25 -8.6 153 112 0 28 13.2 -5.75 153 112 0 28 -13.1 -5.75 153 112 0 28 -0.05 -10.6 315 112 0 28 15.05 5.15 10 210 0 26 26.000000000000018 13.15 8.6 -3.9548596482297376e-19 28 9.6 12.4 41 96 0 74 10.7 6.3 20 23 0 2019614 72 -6.559888341566652 8.054938962388087 20 20 -0.000047850494644693285 28 -11.499999999999975 11.049999999999976 320 40 0 28 -15.05 -1.7499999999999996 10 215 0 28 0 -13 320 20 0 28 13.2 1.25 113 75 0 28 7.75 -0.65 44 34 0 28 -13.099999999999998 -0.7500000000000002 113 75 0 28 -7.65 -0.7 44 34 0 28 -13.549999999999995 5.95000000000001 40 10 0 35 -13.538297672032709 4.454999948370046 5.1629964995704734e-8 72 -13.05496864919929 8.05215196875945 20 30 1.570790923101995 28 -0.05 -4.55 60 60 -0.7853981633974483 28 25.15 14.8 320 96 0 72 -9.559680656185307 8.55499999999999 40 10 -3.1415926535897927 72 -9.002618465688652 6.070051543410435 30 30 -0.43162060942514585 72 -3.8109530213289373 7.552817785192036 30 30 -1.572252117661641 72 4.050000548374973 8.05499893718896 20 20 0.000002081434645292985 76 -0.1 7.85 30 20 0 2019614 73 -0.1 0.35 20 10 0 1974007 50 29.00000000000002 4.1 -1 1.2126497841410284e-22 50 18.799999999999997 -6.3 2.3 -2.3690475686489957e-21 1000 1.5 ", "<level> 20 0 0 1001 0 50 19.7 -8.85 -1.05 6.323798222054227e-23 28 -3.7 10.15 10 150 0 28 1.55 7.45 10 163 0 20 4.999999999999974 -9.54073439272226 -7.888357050633546 -0.40888911583564164 20 7.9999999999999725 -3.963135906680912 -8.283116042091251 -0.8434792402004672 75 4.75 -4 29 26 0 10362398 74 5.4 1.55 61 17 0 6888990 28 12.5 -1.65 76 102 0 4 -3.862797896146612 1.6526745084342107 0.0034993922309679557 2 -9.719704145744329 3.0447959234287256 1.289642961953771 74 -6.65 7.4 43 19 0 2029854 28 -14.65 -6.2 31 101 0 28 -15.65 3.7 45 48 0 28 -12.650000000000002 7.5 71 48 0 28 1.15 -10.75 332 36 0 35 -11.999998030518361 4.104999910042713 1.5707964167521888 28 4 -8 59 50 0 28 14.45 -7.85 19 33 0 74 -3.899999999999999 -5.25 92 20 0 10362398 28 -13 -2.45 45 84 0 28 -10.2 -4.2 28 30 0 20 19.7 -9.770458658275949 -6.679999999999999 -0.26606578039387446 20 17.899999999999995 -7.9504109909848335 -7.14412243154298 -0.35745365768542076 20 11.59999999999998 -6.431419380524398 -6.8249999999999975 -1.855844621714653 20 11.59999999999998 -4.975213587997096 -6.8249999999999975 3.397992597344411 20 10.699999999999978 -2.5948285619484244 -6.779999999999998 1.8067982929035233 20 16.699999999999992 0.2157986330201017 -7.079999999999998 0.9873448248700022 20 14.299999999999986 -1.3250131181252167 -6.960022513304428 1.8628003605265915 20 11.59999999999998 -6.719835138643691 -7.948350017660604 0.45212749747036357 20 10.399999999999975 -2.2517787841947254 -7.772379388128915 -2.8110744950650934 20 10.699999999999978 -5.633777040107539 -7.718572775461716 -3.087573335545067 20 12.799999999999985 -0.7512016658323475 -8.187163231876522 -1.2516977543581924 20 11.29999999999998 -3.445612708919875 -7.46934123281728 2.2306825180501075 20 8.299999999999972 -3.9893158348266327 -6.659999999999997 -2.4761315564034123 20 7.9999999999999725 -4.398431259067637 -7.613959980687362 1.2764240252262253 20 7.9999999999999725 -4.873388836704496 -8.254109788675436 -0.29964863672398767 20 9.799999999999976 0.5636546451722657 -8.353340565131568 0.15781386145460963 20 6.1999999999999735 -9.007775162113807 -7.721664703064197 2.198875967653967 28 7.2 -6.3 16 92 0 74 9.15 -7.85 17 16 0 2029854 28 13.45 10.7 76 65 0 26 36.79999999999998 11.95 5.45 0 28 15.2 5.2 21 65 0 75 12.25 -7.85 17 17 0 6888990 28 -8.9 -3.2 18 17 0 76 -1.1 7.85 36 33 0 2029854 1000 1.5 ", "<level> 20 0 0 1001 0 56 14.299999999999986 11.25 -3.45 0 50 28.70000000000002 11.25 -2.05 1.7120502390009022e-21 50 21.500000000000004 -3.9 -2.5 -1.3709613143275962e-21 50 25.700000000000014 -12.15 3.3 -3.615293683648193e-23 74 10.8 -7.45 12 44 0 2026014 76 -0.3 -5.9 198 13 0 2026014 73 8.05 1.2 10 10 0 1973890 73 3.05 1.3 10 10 0 1973993 73 -2 0.95 10 10 0 1973878 73 -6.95 1.2 10 10 0 1973975 28 -12.5 0.15 40 10 0 72 -11.061441609025351 8.078050198252969 25 43 4.1338237040195205 28 -13.5 -0.7 40 45 0 74 8 -8.45 10 30 0 1973890 74 3.05 -8.6 10 30 0 1973993 74 -1.95 -8.4 10 30 0 1973878 74 -7 -8.4 10 30 0 1973975 28 -14.5 -0.5 40 30 0 72 8.14674627348048 8.449382969600993 37 26 -1.5751304992443493 28 15.05 11.4 70 40 0.7853981633974483 28 14.6 -6.45 50 10 0 28 1.25 -11.6 320 33 0 28 0.05 -4.449999999999999 270 10 0 28 15.05 -1.7 10 238 0 28 -15 1.75 10 320 0 35 -13.049998198256667 -7.9950001728218005 1.7282181565314877e-7 28 -14.45 -6.5 50 10 0 26 26.000000000000018 13.1 -8.4 -3.9548596482297376e-19 28 0.6000000000000002 14.099999999999998 320 76 0 28 -9.6 11.05 40 40 -0.6000000000000002 28 -15.55 10.45 70 40 0.7853981633974483 28 -5.699999999999999 10.7 22 22 -0.7853981633974483 72 11.244448532336085 7.987459738553623 32 19 -2.3619234042517747 20 21.500000000000004 5.543389210280434 9.230000000000002 0.0002827821547137411 52 31.100000000000023 6.25 -2.399999999999999 0.7585812911773913 52 20.600000000000005 -0.95 -2.925 -0.00022256019257796568 52 14.899999999999991 -6.749999999999999 -3.2100000000000004 1.314109602067424e-12 28 0.05 13.45 70 64 -0.3500000000000002 72 2.2541777308862847 7.02791190279818 187 10 -0.19987997386746406 28 15.35 -1.6 36 27 0 1000 1.5 ", "<level> 20 0 0 1001 0 26 42.49999999999993 -7.35 -3.3 0 74 -4.35 -3.3 11 43 0 10559006 75 -12.7 -2.1 15 14 0 10559006 28 -4.65 0.1 190 18 0 35 -0.4499992186156464 3.90499997392158 2.6078420969351524e-8 74 7.45 -3.25 26 24 0 13160990 77 3.7 2.6 15 15 0 13160990 72 7.550043015139403 2.604999229400478 41 66 -3.7590231901293935e-7 72 2.459173937483663 -2.545000006734375 40 35 3.3671875786620707e-9 28 2.7 7.299999999999999 227 28 0 28 -0.5 6 26 22 0 28 -4.5 3.75 37 69 0 28 11.35 0.15 30 137 0 28 -10.15 -3.75 25 68 0 28 0.6 -7.25 256 28 0 72 -1.555795233157738 -2.395000010711457 34 32 6.300857008740665e-9 1 -0.09999709978475348 -9.645000091537973 9.153797685165797e-8 50 15.79999999999999 -10.4 2.15 0.3711047504276459 50 36.499999999999986 -12.35 3.3 -0.5924821955637164 50 26.000000000000018 -8 2.65 -5.1544004448498975e-21 1000 1.5 ", "<level> 20 0 0 1001 0 74 10.95 5.4 10 46 0 1973848 72 -0.8977787911408378 1.4859513851715906 10 130 0.0699030545000885 34 11.89999999999998 12.097066645297003 -6.5923420236929395 -1.6863552411936067 34 19.7 4.978308009914925 -7.8080336981709735 -2.1706465550908796 48 6.450039361735556 -5.944999999999997 -1.5707963267948961 50 13.999999999999986 -3.4 -5 2.2196082302252293e-22 50 24.20000000000001 -11.35 4.65 3.824942982490049e-23 50 23.60000000000001 9.05 -8.4 7.310509281573203e-23 56 16.39999999999999 9.05 -9.05 0 1 8.999318762014454 5.009895746279829 -0.0001299244065711365 28 25.3 10.5 320 50 0 28 -7.45 10.5 320 50 0 46 27.500000000000018 10.54992461445937 -5.374375000000001 -0.1519244252027604 48 13.090500303110957 -4.999075754421095 -0.000867154035583537 28 4.300000000000001 -0.8000000000000003 85 64 0 28 16.85 -0.5999999999999999 150 68 0 47 -12.049997882023824 -2.9950001094408454 -5.4720424191063474e-8 28 -15 -1.4 10 210 0 28 15.05 -1.6000000000000003 10 210 0 35 -13.150464723450549 7.004999960618904 3.938109790378652e-8 1 -9.30164487011499 7.00499605112583 -0.000001870095383660512 1 -6.89782712823492 7.004999768821844 2.3117818338681746e-7 1 -8.017645888132968 5.009985697301631 0.00001404391559623243 1 9.196994533866432 7.004914984767612 -0.00008501884659270603 26 26.000000000000018 13.05 6.6 -3.9548596482297376e-19 74 7.25 5.45 10 50 0 1984286 74 6.05 5.45 10 50 0 1996062 28 -8 1 130 40 0 76 -3.5 6.65 20 25 0 1996062 76 1.55 6.7 20 25 0 1984286 74 -10.6 -6.45 73 10 0 1973953 1 -8.399998744083437 -7.9450000388541815 3.1415926924439774 73 -13 -8.4 24 26 0 1973848 28 -10.2 -10.05 5 40 0 73 -0.85 -8.75 15 22 0 1973953 28 -4.25 -10.1 50 82 0 28 0.45 -12.65 320 53 0 28 1.65 -7.3 32 130 0 28 4.800000000000001 -3.0500000000000016 54 38 0 28 13.25 -10.9 54 38 0 28 3.15 -5.050000000000001 27 38 0 46 27.500000000000018 -6.0699898587952 -2.37375 2.089633001036787 1000 1.5 ", "<level> 20 0 0 1001 0 50 18.499999999999996 12.25 3.05 1.1291524240028733e-21 50 24.50000000000001 -2.35 6.65 7.937732679701821e-22 74 11.1 -2.4 10 23 0 1973921 73 2.95 -9.25 27 10 0 1973921 28 -13.45 7.05 147 47 0 28 15.85 1.3 147 10 0 20 17.599999999999998 9.95 10.123350260416666 0 20 17.599999999999998 12.45 10.125000000000004 0 28 13.55 0.35 60 24 0 28 18.55 9.8 100 215 0 74 -5.95 -2.5 127 10 0 8658462 28 1.25 -11.6 320 33 0 28 15.05 -1.6 10 210 0 28 -15.05 -1.7500000000000002 10 215 0 26 26.000000000000018 13.1 -2.5 -3.9548596482297376e-19 28 -18.9 -7.6 128 112 0 28 15.9 8.15 147 10 0 28 15.900000000000002 11.5 147 10 0 28 15.55 -14.75 100 215 0 78 -5.998304298147459 -6.345000000803377 124 67 -1.2957690300992478e-10 28 0.9 -10 10 80 0 28 -10.2 4 215 20 0 28 -10.25 14.75 215 115 0 20 19.4 9.7 6.685000000000002 0 75 9.5 3.1 20 20 0 8658462 35 -13.449997745955084 2.0049999355942725 6.440572983597223e-8 72 -5.599998838364936 1.4549999687068365 31 33 -1.5707963078293417 72 -9.999999498396988 1.5049999690206837 32 30 1.9362073123020423e-8 20 23.00000000000001 -4.150000000000003 7.855000000000001 1.1909521200669032e-14 20 13.699999999999989 -0.65 8.319602213541668 -6.724877601844218e-14 1000 1.5 ", "<level> 20 0 0 1001 0 35 -12.971355782740389 0.0010689953827686812 -0.12074190298219534 28 -10.45 0.2 20 160 0 28 -14.75 5.6 88 87 -0.11999999999999998 50 17.299999999999994 3.6 4.65 6.3325592851489775e-21 50 32.90000000000002 -0.85 -1.4 1.9070226017346973e-22 74 11.45 3.8 56 21 0 1973840 28 23.65 12.95 320 78 0 78 6.299963540496938 -4.245030353272159 39 105 -0.000012006174460098689 74 13 -2.2 26 92 0 1973840 73 6.25 2.4 38 7 0 1973840 26 26.000000000000018 13 -8.25 -3.9548596482297376e-19 28 9.95 -5.45 28 160 0 28 0.75 -4.6 56 20 0 28 2.15 0.5 25 20 0 28 -7 6.6 70 30 0 28 -8.8 1.05 46 20 0 28 -0.75 -12.8 320 56 0 28 -9 -2.95 10 10 0 28 -8.55 -5.95 20 20 0 75 -12.95 -4.9 25 20 0 8330782 73 1.9 -8.8 20 20 0 1973985 37 0.4999999945698681 -6.595677761789086 -0.0002711193465903202 28 -6.449999999999999 5.999999999999998 60 20 0 28 -7.949999999999999 1 30 20 0 28 15.05 -1.6 10 210 0 28 -15 -1.4 10 210 0 28 3.5500000000000007 -4.549999999999999 10 160 0 1 -7.749995870340586 -0.9950003773482362 3.7734830702919905e-7 1 -8.06130659084484 4.004999947843136 5.215686468067474e-8 1 -5.913981583397125 4.001256047663245 0.000914693751874561 74 6.2499999999999964 1.4999999999999998 40 10 0 8330782 74 0.1 6.65 68 4 0 1973985 46 20 1.8999999999999997 -1.4949999999999997 -4.259013639473969e-15 28 15.8 8.5 115 69 0 28 -5.65 12.75 201 113 0 1000 1.5 ", "<level> 20 0 0 1001 0 50 22.100000000000005 -13.45 -0.5 -1.00240631966551e-22 50 31.700000000000028 7.85 -6.9 1.078683554261168e-22 78 0.5112394949882463 -3.8950000278653856 140 18 7.987187945291332e-9 20 18.499999999999996 -2.5750182076824975 4.027150350697141 -0.4694530791446113 2 -8.970674113532574 4.459591535270562 -3.143476973650695 74 0 -1.5 80 30 0 5053982 75 -13.25 -8.65 20 20 0 5053982 78 5.6483199152944294 1.4038017418857303 80 21 0.0013278945646244252 78 -5.151320286444971 1.403717280348706 80 21 -0.0009507401097120072 78 6.100005968199111 6.003497974418742 90 21 0.001072450323381193 78 -5.561166927490597 6.001958237746527 90 21 -0.0015873763183454253 74 5.05 3.45 30 20 0 5053982 74 -5 3.45 30 20 0 5053982 28 1.25 -11.6 320 33 0 28 15.05 -1.6 10 210 0 28 -0.6 10.849999999999998 320 40 0 28 -15.05 -1.75 10 215 0 74 -5.95 8.05 30 20 0 5053982 74 6 8.05 30 20 0 5053982 26 26.000000000000018 0 7.4 -3.9548596482297376e-19 11 2.1154271188830363 -6.355691746963524 3.6052928766260286 2 8.950004476474776 4.461553568921319 -3.1405202032664117 20 22.700000000000006 3.1807424665674473 -7.64938859337344 -0.7233844455141994 35 -12.541445090271756 7.8549999872242475 1.277575037244326e-8 28 -14.55 -4 40 40 0 28 14.5 -3.95 40 40 0 28 -6.5 -11 40 40 0 28 7.55 -11 40 40 0 31 -7.050056863889224 -0.6394784386058805 -0.0009507400178964923 1000 1.5 ", "<level> 20 0 0 1001 0 28 1.05 -6.45 30 30 0 28 -2 10.05 69 80 0 28 -15.05 2.65 10 245 0 35 -4.299900449309921 5.0549999217646855 7.823531850770352e-8 28 11 9 10 40 0 1 2.566036826172822 8.00499996061892 3.9381081446006174e-8 23 0.43709789556906786 4.053752686119326 0.0012299355352443598 28 1.25 -11.6 320 33 0 28 -10.95 -12.95 90 80 0 28 13.25 -9 54 20 0 2 5.567827844544212 8.50500000000265 -3.932367439080837e-14 28 4.1 11 141 40 0 20 20.90000000000001 5.276613631091546 6.9650000000047125 1.4096337891595772 28 17.45 13 141 40 0 26 26.000000000000018 13 9.65 -3.9548596482297376e-19 28 15.05 3.3 10 299 0 72 13.049641807481827 -3.8950417543710665 26 77 -0.000032120274706879495 73 -8.2 -8.55 21 5 0 1973928 74 10.25 -4 21 74 0 1973928 28 13.85 0.95 47 20 0 74 10.25 3.35 20 70 0 1973944 73 -13.15 -8.55 22 5 0 1973944 74 13.05 5.1 26 59 0 1973944 50 31.100000000000023 -1.75 -7.9 -1.2158222296354252e-21 50 23.000000000000007 -11.05 -7.4 2.286763356621413e-22 50 33.500000000000014 1.55 -2.7 1.3522998870609916e-22 50 22.40000000000001 4.6 -8.45 -1.3285114407292494e-21 1000 1.5 ", "<level> 20 0 0 1001 0 36 -8.75 -14.85 -0.000011110346933498797 50 30.800000000000026 12.95 -9.15 3.0532495544551207e-21 50 14.599999999999987 -0.65 -9.65 -5.314757851730766e-20 26 26.300000000000015 -1 -3.1 0 74 -9.2 0.5 32 39 0 1974014 73 7.8 -9.35 15 14 0 1974014 75 -4.65 -5 12 11 0 5316126 74 6.15 -6 12 82 0 5316126 73 8.05 -2.8 17 17 0 1973986 35 -0.04996384142473887 4.804999947316229 5.2683772917647004e-8 28 12.35 -11.9 21 19 0 28 10.35 -12.1 29 75 0 28 3.2 -12.35 121 37 0 28 10.4 -3.8 18 61 0 28 8.85 4.9 36 58 0 28 8.7 -0.75 67 16 0 28 -3.35 0.5 79 44 0 28 -14.7 0.2 41 601 0 28 -4.05 7.25 51 120 0 28 -14.7 0.5 73 44 0 28 -4.4 -10.95 23 96 0 28 -4.45 -1.75 23 42 0 28 -3 -11.7 12 241 0 74 -9.15 -11.55 65 26 0 1973986 72 10.250000000937488 -7.5988540991772835 33 15 -0.00025457106648129837 28 4.85 9.35 162 71 0 75 -9.75 20.55 47 50 0 11935262 74 2.95 -0.7 40 11 0 11935262 72 11.750001838323808 5.204999961831789 12 12 6.361368692208875e-8 56 10.399999999999975 12.75 -10.65 0 50 18.199999999999996 -1.6 -9.5 -4.9336401263102065e-22 56 15.199999999999989 1.55 -9.75 0 50 23.000000000000007 1.45 -9.05 -1.809261572650828e-21 50 21.500000000000004 -11.75 3.95 -2.6559539022651062e-21 72 3.6000023393355316 -1.695000012151955 9 9 2.7004344986517633e-8 28 8.1 0.6 15 18 0 75 9.45 0.6 8 7 0 5774878 74 3.4 1.9 50 12 0 5774878 28 8.75 1.85 51 14 0 1000 1.5 ", "<level> 20 0 0 1001 0 50 23.000000000000007 4.2 0.55 1.1433816783107065e-22 50 36.19999999999999 7.6 -7.6 -1.564084635806529e-23 50 19.1 6.1 -8.65 -1.6973677284318795e-21 74 10.7 7.05 11 31 0 2017054 76 -0.85 -0.9 80 30 0 2017054 26 26.000000000000018 8 7.6 -3.9548596482297376e-19 28 -7.8 1.1 30 80 0 1 13.354481718863077 3.7044836943077 2.6574637266258323 2 13.096117219230404 7.054529417686021 -1.5717392698456596 28 8.85 1.05 53 80 0 29 3.004469283588296 5.917816894806003 0.299104385038282 20 12.499999999999982 -13.85 8.429999999999998 0 2 7.35059488941301 -3.445000000000147 -7.24092958978483e-14 19 -13.49699291947952 2.3668066510227885 -4.522238786641864 28 -15.05 -1.75 10 215 0 28 1.25 -11.6 320 33 0 28 -5.95 5.6 10 170 0 28 6 5.55 10 170 0 28 -15.2 14.15 182 102 0 28 14.95 14.150000000000002 182 102 0 35 -7.849998654210674 8.054999935067395 6.493260810651889e-8 74 2.05 -5.85 10 50 0 1973862 73 0.85 -5.85 10 50 0 1973862 74 -0.45 -5.85 10 50 0 1973954 73 -1.7 -5.85 10 50 0 1973954 29 -11.75920713186911 6.282316895673055 2.1573298767410485 28 -14.35 -9.9 36 37 0 28 14.3 -9.8 36 37 0 28 0.05 8.9 30 30 -0.7853981633974483 28 6.65 2.05 30 30 0.7853981633974483 28 -6.6 2.05 30 30 -0.7853981633974483 28 4.8 -1.95 20 20 0 28 15.2 0.5 10 210 0 50 29.300000000000026 10.2 -8.05 -1.4121563294895118e-21 50 15.49999999999999 -4.75 3.35 -4.523255861500034e-23 50 34.400000000000006 13.45 -5.65 4.229619407602886e-23 56 15.199999999999989 13.45 -7.05 -0.7853981633974483 1000 1.5 "];
public static const LEVEL_SKELETON:int = 28;
public static var _textFieldOf40:TextField = null;
public static var m_sprite:Sprite = null;
public static var m_spriteTop:Sprite = null;
public static var m_currId:int = 0;
public static var _classQualityHigh:Class = Main__classQualityHigh;
public static var _classButtonMenu:Class = Main__classButtonMenu;
public static var _bitmapQualityHigh:Bitmap = null;
public static var _playBonesVolume:Number = 1;
public static var _bitmapTravelLine:Bitmap = null;
public static var sm_unlockedMax:int = 0;
public static var _bitmapAudioOn:Bitmap = null;
public static var _classQualityLow:Class = Main__classQualityLow;
public static var m_this:Main = null;
public static var _bitmapButtonNext:Bitmap = null;
public static var _bitmapAudioOff:Bitmap = null;
public static var s_quality:int = 1;
public static var _bitmapMissionFailed:Bitmap = null;
public static var _nice:Boolean = false;
public static var _playHitStoneVolume:Number = 1;
public static var _bitmapStory:Array = new Array(4);
public static var _diamondTouched:Boolean = false;
public static var _classQualityBest:Class = Main__classQualityBest;
public static var _classCursorHandClosed:Class = Main__classCursorHandClosed;
public static var _classAudioOff:Class = Main__classAudioOff;
public static var _bitmapQualityBest:Bitmap = null;
public static var _outlineFilter:GlowFilter = new GlowFilter(0, 1, 3, 3, 1000, 1);
public static var _classQualityMedium:Class = Main__classQualityMedium;
public static var _failed:Boolean = false;
public static var _classButtonRetry:Class = Main__classButtonRetry;
public static var s_controlMouseOnly:Boolean = false;
public static var _bitmapButtonRetry:Bitmap = null;
public static var _playDropVolume:Number = 1;
public static var _bitmapButtonPrev:Bitmap = null;
public static var m_particleManager:ParticleManager = new ParticleManager();
public static var _mouseWheel:int = 0;
public static var m_input:Input = null;
public static var _playHit:int = -1;
public static var _textFieldLevelName:TextField = null;
public static var _fontClass1:Class = Main__fontClass1;
public static var _iceMode:Boolean = false;
public static var _bitmapAllDone:Bitmap = null;
public static var _classAudioOn:Class = Main__classAudioOn;
public static var _classButtonNext:Class = Main__classButtonNext;
public static var _bitmapButtonMenu:Bitmap = null;
public static var _playDrop:int = -1;
public static var _bitmapQualityMedium:Bitmap = null;
public static var _classCursorHandOpen:Class = Main__classCursorHandOpen;
public static var _textFieldLevelNumberOpen:TextField = null;
public static var _bitmapParticleLayer:Bitmap = new Bitmap(new BitmapData(SCREEN_DX, SCREEN_DY, true, 0), "auto", true);
public static var _textFieldLevelNumber:TextField = null;
public static var _playHitVolume:Number = 1;
public static var _bitmapQualityLow:Bitmap = null;
public static var _classCursorHelper:Class = Main__classCursorHelper;
public static var _playHitStone:int = -1;
private static var _audio:Boolean = true;
public static var _playBones:int = -1;
public static var _classButtonPrev:Class = Main__classButtonPrev;
public static var _helloKitty:Boolean = true;
public static var _bitmapStoryN:int = 0;
public static var _mouseVisible:Boolean = false;
public static var _bitmapTextureA:Bitmap = null;
public static var _bitmapTextureB:Bitmap = null;
public static var _bitmapTextureC:Bitmap = null;
public static var _bitmapTextureD:Bitmap = null;
public static var _bitmapTextureE:Bitmap = null;
public static var _bitmapTextureF:Bitmap = null;
public static var m_fpsCounter:FpsCounter = new FpsCounter();
public static var _playLooseLife:Boolean = false;
public function Main(){
_audioBank = null;
_classTitleScreen = Main__classTitleScreen;
_bitmapTitleScreen = null;
_classTheEndScreen = Main__classTheEndScreen;
_bitmapTheEndScreen = null;
_class3DLogo = Main__class3DLogo;
_classButtonWalkthrough = Main__classButtonWalkthrough;
_bitmapButtonWalkthrough = null;
_classStory1 = Main__classStory1;
_classStory2 = Main__classStory2;
_classStory3 = Main__classStory3;
_classStory4 = Main__classStory4;
_classStory5a = Main__classStory5a;
_classStory5b = Main__classStory5b;
_classStory6 = Main__classStory6;
_classStory7 = Main__classStory7;
_classStory8 = Main__classStory8;
_classStory9 = Main__classStory9;
_classStory10 = Main__classStory10;
_classStory11 = Main__classStory11;
_classStory12 = Main__classStory12;
_classTextureA = Main__classTextureA;
_classTextureB = Main__classTextureB;
_classTextureC = Main__classTextureC;
_classTextureD = Main__classTextureD;
_classTextureE = Main__classTextureE;
_classTextureF = Main__classTextureF;
_classPerfectBalance = Main__classPerfectBalance;
_classMissionFailed = Main__classMissionFailed;
_classTravelLineSlot = Main__classTravelLineSlot;
_classTravelLineSlotLocked = Main__classTravelLineSlotLocked;
_classTravelLineSlotCurrent = Main__classTravelLineSlotCurrent;
_classTravelLine = Main__classTravelLine;
_classSealBack = Main__classSealBack;
_bitmapSealBack = null;
_classSealFront = Main__classSealFront;
_bitmapSealFront = null;
_classInstructionsScreen = Main__classInstructionsScreen;
_bitmapInstructionsScreen = null;
_classCreditsScreen = Main__classCreditsScreen;
_bitmapCreditsScreen = null;
_classCreditsScreenBackground = Main__classCreditsScreenBackground;
_bitmapCreditsScreenBackground = null;
_classBackgroundFlash = Main__classBackgroundFlash;
_bitmapBackgroundFlash = null;
_bitmapCursorHandOpen = null;
_bitmapCursorHandClosed = null;
_bitmapCursorHelper = null;
_black = null;
_gridMode = 0;
_helpStatus = false;
_firstRun = true;
_first = true;
_bgm = -1;
_bgmSound = null;
_bgmSoundChannel = null;
_mouseClicked = false;
s_travelLineLevelCoordinates = new Array((3 * LEVELS_MAX));
_bitmapVertexCloud = null;
_ttVertexCloud = null;
_rotate = 0;
_matrix = new Array(16);
_movieClipGamesFreeButton = null;
_killBGM = false;
_playNoiseDelayMax = 100;
_playNoiseDelay = 100;
_playFluteDelay = 0;
_playBaseDelay = 0;
_previousNoise = -1;
_previousFlute = -1;
_previousBase = -1;
_killSFXFrames = 30;
_rotateSeal = 0;
_playWorkingDelay = 0;
_levelNameTimer = 0;
_infernoSound = 100;
_infernoLevelsCompleted = 0;
_scoreSent = true;
m_currTest = null;
super();
Mouse.hide();
Font.registerFont(_fontClass1);
}
private function isPointInside(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Boolean{
if ((((((((_arg1 >= _arg3)) && ((_arg2 >= _arg4)))) && ((_arg1 <= _arg5)))) && ((_arg2 <= _arg6)))){
return (true);
};
return (false);
}
private function createTextField(_arg1:String, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:String):TextField{
var _local8:TextFormat;
var _local9:TextField;
_local8 = new TextFormat("Geometric 231", _arg6, 0xFFFFFF, false, false, false);
_local8.align = _arg7;
_local9 = new TextField();
_local9.defaultTextFormat = _local8;
_local9.x = _arg2;
_local9.y = _arg3;
_local9.width = _arg4;
_local9.height = _arg5;
_local9.embedFonts = true;
_local9.mouseEnabled = false;
_local9.text = _arg1;
_local9.filters = [_outlineFilter];
_local9.antiAliasType = AntiAliasType.ADVANCED;
_local9.cacheAsBitmap = true;
return (_local9);
}
private function copyFullBitmapData(_arg1:BitmapData, _arg2:BitmapData, _arg3:Number, _arg4:Number):void{
_arg1.copyPixels(_arg2, new Rectangle(0, 0, _arg2.width, _arg2.height), new Point(_arg3, _arg4));
}
private function SettingsSave():void{
var _local1:SharedObject;
_local1 = SharedObject.getLocal("PerfectBalanceSettings");
_local1.data.header = "PB2S5";
_local1.data.unlockedMax = sm_unlockedMax;
_local1.flush();
}
private function runInstructionsScreen():void{
var _local1:Number;
var _local2:Number;
if (!Input.mouseClicked){
return;
};
_local1 = _mouseClickedX;
_local2 = _mouseClickedY;
if (isPointInside(_local1, _local2, 262, 450, 340, 483)){
buttonPressed();
toggleInstructionsScreen();
toggleTitleScreen();
};
}
private function addWindParticles(_arg1:int, _arg2:Number, _arg3:Number):void{
var _local4:int;
var _local5:Number;
_local4 = 0;
while (_local4 < _arg1) {
_local5 = (_arg2 + (_arg3 * Math.random()));
addWindParticle(_local5);
_local4++;
};
}
private function updateTitleScreenQualityButton():void{
if (s_quality == 0){
_bitmapQualityBest.visible = true;
_bitmapQualityHigh.visible = false;
_bitmapQualityMedium.visible = false;
_bitmapQualityLow.visible = false;
} else {
if (s_quality == 1){
_bitmapQualityBest.visible = false;
_bitmapQualityHigh.visible = true;
_bitmapQualityMedium.visible = false;
_bitmapQualityLow.visible = false;
} else {
if (s_quality == 2){
_bitmapQualityBest.visible = false;
_bitmapQualityHigh.visible = false;
_bitmapQualityMedium.visible = true;
_bitmapQualityLow.visible = false;
} else {
_bitmapQualityBest.visible = false;
_bitmapQualityHigh.visible = false;
_bitmapQualityMedium.visible = false;
_bitmapQualityLow.visible = true;
};
};
};
}
private function updateSealOfQuantity():void{
var _local1:Bitmap;
if (!MyPreloader._ttursasSeal){
return;
};
if (_bitmapTitleScreen != null){
_bitmapSealBack.visible = true;
_bitmapSealFront.visible = true;
_bitmapSealFront.x = (((15 - 10) + 18) + 25);
_bitmapSealFront.y = ((490 - 105) + 18);
_rotateSeal = (_rotateSeal + 0.01);
_local1 = _bitmapSealBack;
_local1.rotation = 0;
Test.rot(_local1, (((15 + 50) - 10) + 25), (490 - 55), ((_rotateSeal * 180) / Math.PI), (-(_local1.width) * 0.5), (-(_local1.height) * 0.5));
} else {
_bitmapSealBack.visible = false;
_bitmapSealFront.visible = false;
};
}
private function buttonPressed(_arg1:Boolean=true):void{
Input.mousePressed = false;
Input.mouseClicked = false;
Input.mouseDown = false;
_mouseClicked = false;
if (_arg1){
playButtonSound();
};
}
public function onMouseWheelEvent(_arg1:MouseEvent):void{
_mouseWheel = _arg1.delta;
}
private function getNextSample(_arg1:Number, _arg2:int):int{
var _local3:int;
_local3 = int((Math.random() * _arg1));
while (_local3 == _arg2) {
_local3 = int((Math.random() * _arg1));
};
trace(((("previous = " + _arg2) + " s = ") + _local3));
return (_local3);
}
public function mousePress(_arg1:MouseEvent):void{
_mouseClickedX = mouseX;
_mouseClickedY = mouseY;
_mouseClicked = true;
if (isPointInsideBitmap(_bitmapButtonWalkthrough, mouseX, mouseY)){
buttonPressed();
navigateToURL(new URLRequest("http://www.gamesfree.com/game/gemgrab_walkthrough.html"), "_blank");
};
}
private function toggleCreditsScreen():void{
if (_bitmapCreditsScreen != null){
removeChild(_bitmapCreditsScreen);
_bitmapCreditsScreen = null;
removeChild(_bitmapCreditsScreenBackground);
_bitmapCreditsScreenBackground = null;
removeChild(_bitmapVertexCloud);
_bitmapVertexCloud = null;
_ttVertexCloud = null;
_rotate = 0;
} else {
_bitmapVertexCloud = new Bitmap(new BitmapData(SCREEN_DX, SCREEN_DY, true, 0), "auto", true);
addChild(_bitmapVertexCloud);
_ttVertexCloud = new TTVertexCloud();
_ttVertexCloud.importVerticesFromBitmap(new Bitmap(new _class3DLogo().bitmapData));
_bitmapCreditsScreenBackground = new Bitmap(new _classCreditsScreenBackground().bitmapData);
_bitmapCreditsScreenBackground.smoothing = true;
addChild(_bitmapCreditsScreenBackground);
_bitmapCreditsScreen = new Bitmap(new _classCreditsScreen().bitmapData);
_bitmapCreditsScreen.smoothing = true;
addChild(_bitmapCreditsScreen);
};
}
public function onEnterFrame(_arg1:Event):void{
var _local2:Boolean;
var _local3:Boolean;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:SoundTransform;
var _local8:Number;
var _local9:int;
removeChild(_bitmapParticleLayer);
if (_black != null){
_black.alpha = (_black.alpha - 0.1);
if (_black.alpha <= 0){
removeChild(_black);
_black = null;
};
};
if (((_first) && (!((m_currTest == null))))){
changeBGM();
_first = false;
};
if (((_killBGM) && (!((_bgmSoundChannel == null))))){
_bgm = -1;
_local7 = _bgmSoundChannel.soundTransform;
_bgmSoundChannel.soundTransform.volume = (_local7.volume - 0.001);
if (_local7.volume < 0){
_local7.volume = 0;
};
_bgmSoundChannel.soundTransform = _local7;
if (_diamondTouched){
changeBGM();
if (m_currId == 0){
playCurse();
} else {
playLoopStartSound();
};
_killBGM = false;
};
};
if (_bitmapTheEndScreen != null){
runTheEndScreen();
} else {
if (_bitmapTitleScreen != null){
runTitleScreen();
} else {
if (_bitmapCreditsScreen != null){
runCreditsScreen();
} else {
if (_bitmapInstructionsScreen != null){
runInstructionsScreen();
} else {
runGameScreen();
};
};
};
};
if (Input.isKeyPressed("M".charCodeAt(0))){
toggleAudio();
};
m_sprite.graphics.clear();
_local2 = false;
if (Input.isKeyPressed("R".charCodeAt(0))){
recreateLevel();
};
if (m_currTest == null){
recreateLevel();
};
_local3 = AreWeInMenu();
if (_firstRun){
_firstRun = false;
m_currTest.Update(true, _bitmapParticleLayer);
m_oldTime = getTimer();
};
m_currTest.Update(!(_local3), _bitmapParticleLayer);
_local4 = getTimer();
_local5 = (_local4 - m_oldTime);
m_oldTime = _local4;
if (!_local3){
if (_levelNameTimer >= 0){
_levelNameTimer = (_levelNameTimer - _local5);
if (_levelNameTimer <= 0){
_textFieldLevelName.alpha = 0;
_textFieldLevelName.visible = false;
} else {
if (_levelNameTimer > 500){
_textFieldLevelName.alpha = 1;
_textFieldLevelName.visible = true;
} else {
_textFieldLevelName.alpha = (_levelNameTimer / 500);
};
};
_textFieldOf40.alpha = _textFieldLevelName.alpha;
_textFieldOf40.x = (300 - (_textFieldOf40.width * 0.5));
_textFieldOf40.y = ((_textFieldLevelName.y + _textFieldLevelName.height) - 4);
};
};
m_particleManager.liveParticles(m_sprite.y, _bitmapParticleLayer);
addChild(_bitmapParticleLayer);
Input.update();
if (_killSFXFrames > 0){
_killSFXFrames--;
_playHit = -1;
_playDrop = -1;
_playHitStone = -1;
_playBones = -1;
};
if (_playBones >= 0){
if (_audio){
_local7 = new SoundTransform(_playBonesVolume);
_local8 = Math.random();
if (_local8 < (1 / 4)){
_audioBank._soundBone11.play(0, 1, _local7);
} else {
if (_local8 < (2 / 4)){
_audioBank._soundBone12.play(0, 1, _local7);
} else {
if (_local8 < (3 / 4)){
_audioBank._soundBone13.play(0, 1, _local7);
} else {
_audioBank._soundBone14.play(0, 1, _local7);
};
};
};
};
_playBones = -1;
};
if (_playHit >= 0){
if (_audio){
_local7 = new SoundTransform(_playHitVolume);
_local8 = Math.random();
if (_local8 < (1 / 3)){
_audioBank._soundConcrete02.play(0, 1, _local7);
} else {
if (_local8 < (2 / 3)){
_audioBank._soundConcrete03.play(0, 1, _local7);
} else {
_audioBank._soundConcrete06.play(0, 1, _local7);
};
};
};
_playHit = -1;
};
if (_playDrop >= 0){
if (_audio){
_local7 = new SoundTransform(_playDropVolume);
_local8 = Math.random();
if (_local8 < (1 / 3)){
_audioBank._soundDrop1.play(0, 1, _local7);
} else {
if (_local8 < (2 / 3)){
_audioBank._soundDrop2.play(0, 1, _local7);
} else {
_audioBank._soundDrop3.play(0, 1, _local7);
};
};
};
_playDrop = -1;
};
if (_playHitStone >= 0){
if (_audio){
_local7 = new SoundTransform((_playHitStoneVolume * 0.9));
_local8 = Math.random();
if (_local8 < (1 / 7)){
_audioBank._soundStone01.play(0, 1, _local7);
} else {
if (_local8 < (2 / 7)){
_audioBank._soundStone02.play(0, 1, _local7);
} else {
if (_local8 < (3 / 7)){
_audioBank._soundStone03.play(0, 1, _local7);
} else {
if (_local8 < (4 / 7)){
_audioBank._soundStone04.play(0, 1, _local7);
} else {
if (_local8 < (5 / 7)){
_audioBank._soundStone05.play(0, 1, _local7);
} else {
if (_local8 < (6 / 7)){
_audioBank._soundStone06.play(0, 1, _local7);
} else {
_audioBank._soundStone07.play(0, 1, _local7);
};
};
};
};
};
};
};
_playHitStone = -1;
};
if (((!(_local3)) && (!(_killBGM)))){
if (((_audio) && ((Math.random() > 0.97)))){
_playNoiseDelay--;
if (_playNoiseDelay <= 0){
_playNoiseDelay = _playNoiseDelayMax;
_local7 = new SoundTransform(0.2);
_local9 = getNextSample(4.9999, _previousNoise);
_previousNoise = _local9;
if (_local9 == 0){
_audioBank._soundNoise01.play(0, 1, _local7);
} else {
if (_local9 == 1){
_audioBank._soundNoise02.play(0, 1, _local7);
} else {
if (_local9 == 2){
_audioBank._soundNoise03.play(0, 1, _local7);
} else {
if (_local9 == 3){
_audioBank._soundNoise04.play(0, 1, _local7);
} else {
_audioBank._soundNoise05.play(0, 1, _local7);
};
};
};
};
};
};
if (((_audio) && ((_bgm == 0)))){
_playFluteDelay--;
if (_playFluteDelay <= 0){
_playFluteDelay = ((8 * 60) + ((12 * 60) * Math.random()));
_local7 = new SoundTransform(0.2);
_local9 = getNextSample(13.9999, _previousFlute);
_previousFlute = _local9;
if (_local9 == 0){
_audioBank._soundFlute01.play(0, 1, _local7);
} else {
if (_local9 == 1){
_audioBank._soundFlute02.play(0, 1, _local7);
} else {
if (_local9 == 2){
_audioBank._soundFlute03.play(0, 1, _local7);
} else {
if (_local9 == 3){
_audioBank._soundFlute04.play(0, 1, _local7);
} else {
if (_local9 == 4){
_audioBank._soundFlute05.play(0, 1, _local7);
} else {
if (_local9 == 5){
_audioBank._soundFlute06.play(0, 1, _local7);
} else {
if (_local9 == 6){
_audioBank._soundFlute07.play(0, 1, _local7);
} else {
if (_local9 == 7){
_audioBank._soundFlute08.play(0, 1, _local7);
} else {
if (_local9 == 8){
_audioBank._soundFlute09.play(0, 1, _local7);
} else {
if (_local9 == 9){
_audioBank._soundFlute10.play(0, 1, _local7);
} else {
if (_local9 == 10){
_audioBank._soundFlute11.play(0, 1, _local7);
} else {
if (_local9 == 11){
_audioBank._soundFlute12.play(0, 1, _local7);
} else {
if (_local9 == 12){
_audioBank._soundFlute13.play(0, 1, _local7);
} else {
_audioBank._soundFlute14.play(0, 1, _local7);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
_playBaseDelay--;
if (_playBaseDelay <= 0){
_playBaseDelay = ((8 * 60) + ((12 * 60) * Math.random()));
_local7 = new SoundTransform(0.3);
_local9 = getNextSample(9.9999, _previousBase);
_previousBase = _local9;
if (_local9 == 0){
_audioBank._soundBase01.play(0, 1, _local7);
} else {
if (_local9 == 1){
_audioBank._soundBase02.play(0, 1, _local7);
} else {
if (_local9 == 2){
_audioBank._soundBase03.play(0, 1, _local7);
} else {
if (_local9 == 3){
_audioBank._soundBase04.play(0, 1, _local7);
} else {
if (_local9 == 4){
_audioBank._soundBase05.play(0, 1, _local7);
} else {
if (_local9 == 5){
_audioBank._soundBase06.play(0, 1, _local7);
} else {
if (_local9 == 6){
_audioBank._soundBase07.play(0, 1, _local7);
} else {
if (_local9 == 7){
_audioBank._soundBase08.play(0, 1, _local7);
} else {
if (_local9 == 8){
_audioBank._soundBase09.play(0, 1, _local7);
} else {
_audioBank._soundBase10.play(0, 1, _local7);
};
};
};
};
};
};
};
};
};
};
};
};
if (((m_currTest._missionFailed) && ((_bitmapMissionFailed == null)))){
_bitmapMissionFailed = new Bitmap(new _classMissionFailed().bitmapData);
_bitmapMissionFailed.smoothing = true;
_bitmapMissionFailed.x = (300 - (_bitmapMissionFailed.width * 0.5));
_bitmapMissionFailed.y = (100 - (_bitmapMissionFailed.height * 0.5));
_bitmapMissionFailed.scaleX = 0.6;
_bitmapMissionFailed.scaleY = 0.6;
_bitmapMissionFailed.alpha = 0;
_bitmapMissionFailed.smoothing = true;
addChild(_bitmapMissionFailed);
_levelNameTimer = 0;
playCurse();
};
if (((m_currTest._levelCompleted) && ((_bitmapAllDone == null)))){
if (m_currId == sm_unlockedMax){
sm_unlockedMax++;
redrawTravelLine();
};
_bitmapAllDone = new Bitmap(new _classPerfectBalance().bitmapData);
_bitmapAllDone.smoothing = true;
_bitmapAllDone.x = (300 - (_bitmapAllDone.width * 0.5));
_bitmapAllDone.y = (100 - (_bitmapAllDone.height * 0.5));
_bitmapAllDone.scaleX = 0.6;
_bitmapAllDone.scaleY = 0.6;
_bitmapAllDone.alpha = 0;
_bitmapAllDone.smoothing = true;
addChild(_bitmapAllDone);
_playFluteDelay = ((10 * 60) + ((12 * 60) * Math.random()));
_playBaseDelay = ((10 * 60) + ((12 * 60) * Math.random()));
_levelNameTimer = 0;
if (_audio){
_local7 = new SoundTransform(0.6);
_audioBank._soundOkHarmony.play(0, 1, _local7);
};
};
if (_bitmapAllDone != null){
_bitmapAllDone.alpha = (_bitmapAllDone.alpha + 0.1);
if (_bitmapAllDone.alpha > 1){
_bitmapAllDone.alpha = 1;
};
_bitmapAllDone.scaleX = (_bitmapAllDone.scaleX + 0.04);
if (_bitmapAllDone.scaleX > 1){
_bitmapAllDone.scaleX = 1;
};
_bitmapAllDone.scaleY = _bitmapAllDone.scaleX;
_bitmapAllDone.x = ((600 * 0.5) - (_bitmapAllDone.width * 0.5));
_bitmapAllDone.y = (100 - (_bitmapAllDone.height * 0.5));
};
if (_bitmapMissionFailed != null){
_bitmapMissionFailed.alpha = (_bitmapMissionFailed.alpha + 0.1);
if (_bitmapMissionFailed.alpha > 1){
_bitmapMissionFailed.alpha = 1;
};
_bitmapMissionFailed.scaleX = (_bitmapMissionFailed.scaleX + 0.04);
if (_bitmapMissionFailed.scaleX > 1){
_bitmapMissionFailed.scaleX = 1;
};
_bitmapMissionFailed.scaleY = _bitmapMissionFailed.scaleX;
_bitmapMissionFailed.x = ((600 * 0.5) - (_bitmapMissionFailed.width * 0.5));
_bitmapMissionFailed.y = (100 - (_bitmapMissionFailed.height * 0.5));
};
if (_local3){
_bitmapBackgroundFlash.visible = false;
} else {
_bitmapBackgroundFlash.visible = true;
};
m_sprite.visible = _bitmapBackgroundFlash.visible;
m_spriteTop.visible = m_sprite.visible;
runStorySprites();
_local6 = 1;
if (m_currTest != null){
_local6 = (Test.m_debugDraw.m_drawScale / 20);
};
m_fpsCounter.update();
FRateLimiter.limitFrame(60);
runMouseCursor();
Input.mouseClicked = false;
}
private function isPointInsideDelta(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Boolean{
var _local7:Number;
var _local8:Number;
_local7 = (_arg3 + _arg5);
_local8 = (_arg4 + _arg6);
if ((((((((_arg1 >= _arg3)) && ((_arg2 >= _arg4)))) && ((_arg1 <= _local7)))) && ((_arg2 <= _local8)))){
return (true);
};
return (false);
}
public function onMouseLeaveEvent(_arg1:MouseEvent):void{
_mouseVisible = false;
}
private function runCreditsScreen():void{
var _local1:Number;
var _local2:Number;
removeChild(_bitmapVertexCloud);
_ttVertexCloud.getIdentity(_matrix);
_ttVertexCloud.translate(0, 0, 150, _matrix);
_ttVertexCloud.rotateX((_rotate * 0.04), _matrix);
_ttVertexCloud.rotateY((_rotate * 0.6), _matrix);
_ttVertexCloud.rotateZ((_rotate * 0.01), _matrix);
_rotate = (_rotate + 0.01);
_ttVertexCloud.perspectiveProjectionAngle(50, 350, ((120 / 180) * Math.PI), (SCREEN_DX / SCREEN_DY), _matrix);
_ttVertexCloud.transform(_matrix);
_ttVertexCloud.draw(_bitmapVertexCloud);
addChild(_bitmapVertexCloud);
removeChild(_bitmapCreditsScreen);
addChild(_bitmapCreditsScreen);
if (!Input.mouseClicked){
return;
};
_local1 = _mouseClickedX;
_local2 = _mouseClickedY;
if (isPointInside(_local1, _local2, 262, 450, 340, 483)){
buttonPressed();
toggleCreditsScreen();
toggleTitleScreen();
};
}
private function toggleInstructionsScreen():void{
if (_bitmapInstructionsScreen != null){
removeChild(_bitmapInstructionsScreen);
_bitmapInstructionsScreen = null;
} else {
_bitmapInstructionsScreen = new Bitmap(new _classInstructionsScreen().bitmapData);
_bitmapInstructionsScreen.smoothing = true;
addChild(_bitmapInstructionsScreen);
};
}
public function AreWeInMenu():Boolean{
if (_bitmapTitleScreen != null){
return (true);
};
if (_bitmapCreditsScreen != null){
return (true);
};
if (_bitmapInstructionsScreen != null){
return (true);
};
if (_bitmapTheEndScreen != null){
return (true);
};
return (false);
}
private function toggleAudio():void{
_audio = !(_audio);
updateTitleScreenAudioButton();
if (_audio){
changeBGM();
} else {
SoundMixer.stopAll();
_bgm = -1;
};
SettingsSave();
}
public function playDoorOpenClose():void{
var _local1:SoundTransform;
if (!_audio){
return;
};
_local1 = new SoundTransform(0.1);
_audioBank._soundDoorOpenClose.play(0, 1, _local1);
}
private function runMouseCursor():void{
var _local1:int;
var _local2:int;
removeChild(_bitmapCursorHandOpen);
addChild(_bitmapCursorHandOpen);
removeChild(_bitmapCursorHandClosed);
addChild(_bitmapCursorHandClosed);
removeChild(_bitmapCursorHelper);
addChild(_bitmapCursorHelper);
if (_mouseVisible){
_local1 = (_mouseX - (_bitmapCursorHandOpen.width * 0.5));
_local2 = (_mouseY - (_bitmapCursorHandOpen.height * 0.5));
_bitmapCursorHandClosed.x = _local1;
_bitmapCursorHandClosed.y = _local2;
_bitmapCursorHandOpen.x = _local1;
_bitmapCursorHandOpen.y = _local2;
_bitmapCursorHelper.x = (_mouseX - (_bitmapCursorHelper.width * 0.5));
_bitmapCursorHelper.y = ((_mouseY - (_bitmapCursorHelper.height * 0.5)) + 10);
if (Input.mouseDown){
_bitmapCursorHandOpen.visible = false;
_bitmapCursorHandClosed.visible = true;
} else {
_bitmapCursorHandOpen.visible = true;
_bitmapCursorHandClosed.visible = false;
};
if (((((!((m_currTest == null))) && (!((m_currTest.m_mouseJoint == null))))) && ((m_currId < 5)))){
_bitmapCursorHelper.alpha = (_bitmapCursorHelper.alpha + 0.1);
if (_bitmapCursorHelper.alpha > 1){
_bitmapCursorHelper.alpha = 1;
};
} else {
_bitmapCursorHelper.alpha = (_bitmapCursorHelper.alpha - 0.1);
if (_bitmapCursorHelper.alpha < 0){
_bitmapCursorHelper.alpha = 0;
};
};
} else {
_bitmapCursorHandOpen.visible = false;
_bitmapCursorHandClosed.visible = false;
};
}
private function changeBGM():void{
var _local1:int;
var _local2:SoundTransform;
_killBGM = false;
if (!_audio){
return;
};
_local1 = 0;
if (AreWeInMenu()){
_local1 = 1;
} else {
if (m_currId == 24){
_local1 = 2;
} else {
if (m_currId == 6){
_local1 = 3;
};
};
};
if (_bgm == _local1){
return;
};
SoundMixer.stopAll();
_local2 = new SoundTransform(0.5);
if (_local1 == 0){
_bgmSound = _audioBank._soundGame;
} else {
if (_local1 == 1){
_bgmSound = _audioBank._soundMenu;
} else {
if (_local1 == 2){
_bgmSound = _audioBank._soundWind02;
} else {
if (_local1 == 3){
_bgmSound = _audioBank._soundWind01;
};
};
};
};
_bgmSoundChannel = _bgmSound.play(0, int.MAX_VALUE, _local2);
_bgm = _local1;
}
private function toggleTitleScreen():void{
var _local1:Number;
var _local2:Number;
m_particleManager.reset();
if (_bitmapTitleScreen != null){
removeChild(_bitmapTitleScreen);
_bitmapTitleScreen = null;
removeChild(_bitmapAudioOn);
removeChild(_bitmapAudioOff);
removeChild(_bitmapQualityBest);
removeChild(_bitmapQualityHigh);
removeChild(_bitmapQualityMedium);
removeChild(_bitmapQualityLow);
if (MyPreloader._ttursasSeal){
removeChild(_bitmapSealBack);
removeChild(_bitmapSealFront);
};
if (_movieClipGamesFreeButton != null){
removeChild(_movieClipGamesFreeButton);
_movieClipGamesFreeButton = null;
};
} else {
_bitmapTitleScreen = new Bitmap(new _classTitleScreen().bitmapData);
_bitmapTitleScreen.smoothing = true;
addChild(_bitmapTitleScreen);
_local1 = 48;
_local2 = 25;
_bitmapAudioOn.x = _local1;
_bitmapAudioOn.y = _local2;
_bitmapAudioOff.x = _local1;
_bitmapAudioOff.y = _local2;
addChild(_bitmapAudioOn);
addChild(_bitmapAudioOff);
updateTitleScreenAudioButton();
_local1 = (_local1 - 10);
_local2 = (_local2 - 8);
_bitmapQualityBest.x = (_local1 - 5);
_bitmapQualityBest.y = (_local2 + 52);
_bitmapQualityHigh.x = (_local1 - 5);
_bitmapQualityHigh.y = (_local2 + 52);
_bitmapQualityMedium.x = (_local1 - 5);
_bitmapQualityMedium.y = (_local2 + 52);
_bitmapQualityLow.x = (_local1 - 5);
_bitmapQualityLow.y = (_local2 + 52);
addChild(_bitmapQualityBest);
addChild(_bitmapQualityHigh);
addChild(_bitmapQualityMedium);
addChild(_bitmapQualityLow);
updateTitleScreenQualityButton();
if (MyPreloader._ttursasSeal){
addChild(_bitmapSealBack);
addChild(_bitmapSealFront);
updateSealOfQuantity();
};
if (MyPreloader._gamesFree){
_movieClipGamesFreeButton = MyPreloader.GetGamesFreeButton();
addChild(_movieClipGamesFreeButton);
_movieClipGamesFreeButton.x = 220;
_movieClipGamesFreeButton.y = 325;
_movieClipGamesFreeButton.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownGamesFree);
};
};
}
private function copyFullBitmapDataScale(_arg1:BitmapData, _arg2:BitmapData, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:Matrix;
_local6 = new Matrix();
_local6.scale(_arg5, _arg5);
_local6.translate(_arg3, _arg4);
_arg1.draw(_arg2, _local6, null, null, null, true);
}
public function init(_arg1:Boolean, _arg2:Boolean, _arg3:Sprite):void{
var _local4:TextFormat;
var _local5:TextField;
_playFluteDelay = ((8 * 60) + ((12 * 60) * Math.random()));
_playBaseDelay = ((8 * 60) + ((12 * 60) * Math.random()));
_nice = _arg1;
_failed = _arg2;
_black = _arg3;
m_this = this;
Font.registerFont(_fontClass1);
SettingsLoad();
stage.focus = this;
stage.quality = StageQuality.HIGH;
_bitmapBackgroundFlash = new Bitmap(new _classBackgroundFlash().bitmapData);
_bitmapBackgroundFlash.smoothing = true;
_bitmapBackgroundFlash.x = 0;
_bitmapBackgroundFlash.y = 0;
_bitmapBackgroundFlash.visible = true;
addChild(_bitmapBackgroundFlash);
_bitmapCursorHandOpen = new Bitmap(new _classCursorHandOpen().bitmapData);
_bitmapCursorHandOpen.smoothing = true;
_bitmapCursorHandOpen.visible = true;
_bitmapCursorHandOpen.scaleX = 0.7;
_bitmapCursorHandOpen.scaleY = 0.7;
addChild(_bitmapCursorHandOpen);
_bitmapCursorHandClosed = new Bitmap(new _classCursorHandClosed().bitmapData);
_bitmapCursorHandClosed.smoothing = true;
_bitmapCursorHandClosed.visible = false;
_bitmapCursorHandClosed.scaleX = 0.7;
_bitmapCursorHandClosed.scaleY = 0.7;
addChild(_bitmapCursorHandClosed);
_bitmapCursorHelper = new Bitmap(new _classCursorHelper().bitmapData);
_bitmapCursorHelper.smoothing = true;
_bitmapCursorHelper.visible = true;
_bitmapCursorHelper.alpha = 0;
_bitmapCursorHelper.scaleX = 0.7;
_bitmapCursorHelper.scaleY = 0.7;
addChild(_bitmapCursorHelper);
addEventListener(Event.ENTER_FRAME, onEnterFrame, false, 0, true);
addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheelEvent);
addEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveEvent);
addEventListener(MouseEvent.MOUSE_DOWN, mousePress, false, 0, true);
m_fpsCounter.x = 7;
m_fpsCounter.y = 5;
m_sprite = new Sprite();
addChild(m_sprite);
m_spriteTop = new Sprite();
addChild(m_spriteTop);
m_input = new Input(m_sprite);
_local4 = new TextFormat("Geometric 231", 36, 0xFFFFFF, false, false, false);
_local4.align = TextFormatAlign.CENTER;
_local5 = new TextField();
_local5.defaultTextFormat = _local4;
_local5.x = (300 - 100);
_local5.y = (90 - 20);
_local5.width = 200;
_local5.height = 40;
_local5.embedFonts = true;
_local5.mouseEnabled = false;
_local5.text = "TRIAL X";
_local5.filters = [_outlineFilter];
_local5.antiAliasType = AntiAliasType.ADVANCED;
_local5.cacheAsBitmap = true;
_textFieldLevelName = _local5;
_local4 = new TextFormat("Geometric 231", 18, 0xFFFFFF, false, false, false);
_local4.align = TextFormatAlign.CENTER;
_local5 = new TextField();
_local5.defaultTextFormat = _local4;
_local5.x = (300 - 100);
_local5.y = (90 + 20);
_local5.width = 200;
_local5.height = 20;
_local5.embedFonts = true;
_local5.mouseEnabled = false;
_local5.text = ("OF " + LEVELS_MAX);
_local5.filters = [_outlineFilter];
_local5.antiAliasType = AntiAliasType.ADVANCED;
_local5.cacheAsBitmap = true;
_textFieldOf40 = _local5;
_local4 = new TextFormat("Geometric 231", 12, 0xFFFFFF, false, false, false);
_local4.align = TextFormatAlign.RIGHT;
_local5 = new TextField();
_local5.defaultTextFormat = _local4;
_local5.x = (600 - 110);
_local5.y = (500 - 24);
_local5.width = 100;
_local5.height = 20;
_local5.embedFonts = true;
_local5.mouseEnabled = false;
_local5.text = ("1 OF " + LEVELS_MAX);
_local5.filters = [_outlineFilter];
_local5.antiAliasType = AntiAliasType.ADVANCED;
_local5.cacheAsBitmap = true;
_textFieldLevelNumber = _local5;
_local4 = new TextFormat("Geometric 231", 12, 0xFFFFFF, false, false, false);
_local4.align = TextFormatAlign.LEFT;
_local5 = new TextField();
_local5.defaultTextFormat = _local4;
_local5.x = 10;
_local5.y = (500 - 24);
_local5.width = 100;
_local5.height = 20;
_local5.embedFonts = true;
_local5.mouseEnabled = false;
_local5.text = "1 OPEN";
_local5.filters = [_outlineFilter];
_local5.antiAliasType = AntiAliasType.ADVANCED;
_local5.cacheAsBitmap = true;
_textFieldLevelNumberOpen = _local5;
if (MyPreloader._ttursasSeal){
_bitmapSealBack = new Bitmap(new _classSealBack().bitmapData);
_bitmapSealBack.x = -10000;
_bitmapSealBack.y = 0;
_bitmapSealBack.smoothing = true;
_bitmapSealFront = new Bitmap(new _classSealFront().bitmapData);
_bitmapSealFront.x = -10000;
_bitmapSealFront.y = 0;
_bitmapSealFront.smoothing = true;
};
_audioBank = new Audio();
SoundMixer.stopAll();
_bitmapAudioOn = new Bitmap(new _classAudioOn().bitmapData);
_bitmapAudioOn.smoothing = true;
_bitmapAudioOff = new Bitmap(new _classAudioOff().bitmapData);
_bitmapAudioOff.smoothing = true;
_bitmapQualityBest = new Bitmap(new _classQualityBest().bitmapData);
_bitmapQualityBest.smoothing = true;
_bitmapQualityHigh = new Bitmap(new _classQualityHigh().bitmapData);
_bitmapQualityHigh.smoothing = true;
_bitmapQualityLow = new Bitmap(new _classQualityLow().bitmapData);
_bitmapQualityLow.smoothing = true;
_bitmapQualityMedium = new Bitmap(new _classQualityMedium().bitmapData);
_bitmapQualityMedium.smoothing = true;
_bitmapTravelLine = new Bitmap(new _classTravelLine().bitmapData);
_bitmapTravelLine.smoothing = true;
_bitmapButtonNext = new Bitmap(new _classButtonNext().bitmapData);
_bitmapButtonNext.smoothing = true;
_bitmapButtonNext.x = ((((SCREEN_DX * 0.5) + 70) + 28) - (_bitmapButtonNext.width * 0.5));
_bitmapButtonNext.y = (((SCREEN_DY - _bitmapButtonNext.height) - 3) + 5);
_bitmapButtonPrev = new Bitmap(new _classButtonPrev().bitmapData);
_bitmapButtonPrev.smoothing = true;
_bitmapButtonPrev.x = ((((SCREEN_DX * 0.5) - 70) - 28) - (_bitmapButtonPrev.width * 0.5));
_bitmapButtonPrev.y = (((SCREEN_DY - _bitmapButtonPrev.height) - 3) + 5);
_bitmapButtonRetry = new Bitmap(new _classButtonRetry().bitmapData);
_bitmapButtonRetry.smoothing = true;
_bitmapButtonRetry.x = (((SCREEN_DX * 0.5) + 28) - (_bitmapButtonRetry.width * 0.5));
_bitmapButtonRetry.y = ((((SCREEN_DY - _bitmapButtonRetry.height) - 3) + 5) + 5);
_bitmapButtonMenu = new Bitmap(new _classButtonMenu().bitmapData);
_bitmapButtonMenu.smoothing = true;
_bitmapButtonMenu.x = (((SCREEN_DX * 0.5) - 28) - (_bitmapButtonMenu.width * 0.5));
_bitmapButtonMenu.y = ((((SCREEN_DY - _bitmapButtonMenu.height) - 3) + 5) + 5);
_bitmapTextureA = new Bitmap(new _classTextureA().bitmapData);
_bitmapTextureA.smoothing = true;
_bitmapTextureB = new Bitmap(new _classTextureB().bitmapData);
_bitmapTextureB.smoothing = true;
_bitmapTextureC = new Bitmap(new _classTextureC().bitmapData);
_bitmapTextureC.smoothing = true;
_bitmapTextureD = new Bitmap(new _classTextureD().bitmapData);
_bitmapTextureD.smoothing = true;
_bitmapTextureE = new Bitmap(new _classTextureE().bitmapData);
_bitmapTextureE.smoothing = true;
_bitmapTextureF = new Bitmap(new _classTextureF().bitmapData);
_bitmapTextureF.smoothing = true;
recreateLevel();
SoundMixer.stopAll();
toggleTitleScreen();
m_particleManager.initialize();
addChild(_bitmapParticleLayer);
if (_black != null){
addChild(_black);
};
}
private function playButtonSound():void{
var _local1:SoundTransform;
if (_audio){
_local1 = new SoundTransform(0.3);
_audioBank._soundMenuButton.play(0, 1, _local1);
};
}
public function playSpecialSound():void{
var _local1:SoundTransform;
if (!_audio){
return;
};
_local1 = new SoundTransform(0.3);
_audioBank._soundOntto.play(0, 1, _local1);
}
public function playLoopEndSound():void{
var _local1:SoundTransform;
if (AreWeInMenu()){
return;
};
if (!_audio){
return;
};
_local1 = new SoundTransform(0.2);
_audioBank._soundLoopEndSound.play(0, 1, _local1);
}
public function playReleaseShape():void{
var _local1:SoundTransform;
if (_audio){
_local1 = new SoundTransform(0.1);
_audioBank._soundReturnShape.play(0, 1, _local1);
};
}
private function addStorySprite(_arg1:Bitmap, _arg2:int, _arg3:int):void{
addChild(_arg1);
_arg1.x = (_arg2 - (_arg1.width * 0.5));
_arg1.y = (_arg3 - (_arg1.height * 0.5));
_arg1.smoothing = true;
var _local4 = _bitmapStoryN++;
_bitmapStory[_local4] = _arg1;
}
private function showTheEndScreen():void{
if (_bitmapTheEndScreen != null){
return;
};
_bitmapTheEndScreen = new Bitmap(new _classTheEndScreen().bitmapData);
_bitmapTheEndScreen.smoothing = true;
_bitmapTheEndScreen.alpha = 0;
addChild(_bitmapTheEndScreen);
playCurse();
}
private function updateTitleScreenAudioButton():void{
if (_audio){
_bitmapAudioOn.visible = true;
_bitmapAudioOff.visible = false;
} else {
_bitmapAudioOn.visible = false;
_bitmapAudioOff.visible = true;
};
}
private function PlayLevelChangedSound():void{
var _local1:SoundTransform;
if (!_audio){
return;
};
_local1 = new SoundTransform(0.2);
_audioBank._soundLCH01.play(0, 1, _local1);
}
public function playBlockExplosion(_arg1:int):void{
var _local2:SoundTransform;
if (!_audio){
return;
};
_local2 = new SoundTransform(0.3);
_audioBank._soundBlockExplosion.play(0, 1, _local2);
}
private function isPointInsideCircle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Boolean{
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local6 = (_arg1 - _arg3);
_local7 = (_arg2 - _arg4);
_local8 = ((_local6 * _local6) + (_local7 * _local7));
if (_local8 < (_arg5 * _arg5)){
return (true);
};
return (false);
}
private function runTitleScreen():void{
var _local1:Particle;
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:int;
updateSealOfQuantity();
addWindParticles(1, 0, 195);
addWindParticles(1, 408, 192);
_local1 = null;
if (Math.random() > 0.5){
Test.getRandomPointInTriangle(new b2Vec2(278, 167), new b2Vec2(0x0100, 250), new b2Vec2(345, 275));
_local2 = Test.s_randomPointX;
_local3 = Test.s_randomPointY;
} else {
Test.getRandomPointInTriangle(new b2Vec2(278, 167), new b2Vec2(368, 190), new b2Vec2(345, 275));
_local2 = Test.s_randomPointX;
_local3 = Test.s_randomPointY;
};
_local1 = m_particleManager.addParticle(Particle.PARTICLE_TYPE_TWINKLE, _local2, (_local3 - 250), 4294967295);
if (_local1 != null){
_local1._life = (_local1._life + (Math.random() * 10));
};
if (!_mouseClicked){
return;
};
_local4 = _mouseClickedX;
_local5 = _mouseClickedY;
_local3 = 0;
if (MyPreloader._gamesFree){
_local3 = -15;
};
if (isPointInside(_local4, _local5, 245, (306 + _local3), 361, (347 + _local3))){
buttonPressed();
recreateLevel();
toggleTitleScreen();
showGameScreen();
if ((((((m_currId == 0)) || ((m_currId == 10)))) || ((m_currId == LEVEL_SKELETON)))){
playLoopEndSound();
_killBGM = true;
} else {
changeBGM();
};
};
if (isPointInside(_local4, _local5, 208, 382, 400, 414)){
buttonPressed();
toggleTitleScreen();
toggleInstructionsScreen();
};
if (isPointInside(_local4, _local5, 244, 421, 366, 455)){
buttonPressed();
toggleTitleScreen();
toggleCreditsScreen();
};
if (isPointInsideDelta(_local4, _local5, _bitmapAudioOn.x, _bitmapAudioOn.y, _bitmapAudioOn.width, _bitmapAudioOn.height)){
buttonPressed(false);
toggleAudio();
};
if (isPointInsideDelta(_local4, _local5, _bitmapQualityBest.x, _bitmapQualityBest.y, _bitmapQualityBest.width, _bitmapQualityBest.height)){
buttonPressed();
s_quality++;
if (s_quality == 4){
s_quality = 0;
};
updateTitleScreenQualityButton();
if (s_quality == 0){
stage.quality = StageQuality.BEST;
} else {
if (s_quality == 1){
stage.quality = StageQuality.HIGH;
} else {
if (s_quality == 2){
stage.quality = StageQuality.MEDIUM;
} else {
stage.quality = StageQuality.LOW;
};
};
};
SettingsSave();
};
if (((MyPreloader._ttursasSeal) && (isPointInsideDelta(_local4, _local5, _bitmapSealFront.x, _bitmapSealFront.y, _bitmapSealFront.width, _bitmapSealFront.height)))){
buttonPressed();
navigateToURL(new URLRequest("http://www.ttursas.com/"), "_blank");
};
}
public function redrawTravelLine():void{
var _local1:BitmapData;
var _local2:BitmapData;
var _local3:Number;
var _local4:Number;
var _local5:int;
var _local6:Number;
var _local7:int;
var _local8:Number;
_local1 = new _classTravelLine().bitmapData;
_local2 = _bitmapTravelLine.bitmapData;
copyFullBitmapData(_local2, _local1, 0, 0);
_local3 = 0.8;
_local4 = 15;
_local5 = LEVELS_MAX;
_local6 = (((600 - 15) - 15) / (_local5 - 1));
_local7 = 0;
while (_local7 < _local5) {
if (_local7 <= sm_unlockedMax){
_local1 = new _classTravelLineSlot().bitmapData;
} else {
_local1 = new _classTravelLineSlotLocked().bitmapData;
};
_local8 = _local3;
if ((((_local7 == 0)) || ((_local7 == (_local5 - 1))))){
_local8 = (_local8 + 0.2);
};
copyFullBitmapDataScale(_local2, _local1, (_local4 - ((20 * _local8) * 0.5)), (20 - ((20 * _local8) * 0.5)), _local8);
s_travelLineLevelCoordinates[((_local7 * 3) + 0)] = _local4;
s_travelLineLevelCoordinates[((_local7 * 3) + 1)] = 20;
s_travelLineLevelCoordinates[((_local7 * 3) + 2)] = ((20 * _local8) * 0.5);
if (_local7 == m_currId){
_local1 = new _classTravelLineSlotCurrent().bitmapData;
_local8 = _local3;
if ((((_local7 == 0)) || ((_local7 == (_local5 - 1))))){
_local8 = (_local8 + 0.2);
};
copyFullBitmapDataScale(_local2, _local1, (_local4 - ((14 * _local8) * 0.5)), (20 - ((14 * _local8) * 0.5)), _local8);
};
_local4 = (_local4 + _local6);
_local7++;
};
}
public function playDoorDelay():void{
var _local1:SoundTransform;
if (!_audio){
return;
};
_local1 = new SoundTransform(0.1);
_audioBank._soundDoorDelay.play(0, 1, _local1);
}
public function playCurse():void{
var _local1:SoundTransform;
if (!_audio){
return;
};
_local1 = new SoundTransform(0.2);
_audioBank._soundCurse.play(0, 1, _local1);
}
private function runStorySprites():void{
var _local1:int;
var _local2:Number;
var _local3:Bitmap;
if (m_currId == LEVEL_SKELETON){
_local2 = m_currTest.getBiggestSpriteY(102);
if (!m_currTest._storyShown){
if (_local2 > (50 - 250)){
addStorySprite(new Bitmap(new _classStory11().bitmapData), 360, 415);
m_currTest._storyShown = true;
};
} else {
if (_local2 > (300 - 250)){
_diamondTouched = true;
m_currTest._storyHided = true;
};
};
if (!m_currTest._storyHided){
return;
};
};
if (!_diamondTouched){
return;
};
_local1 = 0;
while (_local1 < _bitmapStoryN) {
_local3 = _bitmapStory[_local1];
_local3.alpha = (_local3.alpha - 0.01);
if (_local3.alpha <= 0){
removeChild(_local3);
_bitmapStory[_local1] = _bitmapStory[--_bitmapStoryN];
_bitmapStory[_bitmapStoryN] = null;
_local1--;
};
_local1++;
};
}
private function recreateLevel():void{
var _local1:int;
var _local2:int;
var _local3:int;
_diamondTouched = false;
if (m_currTest != null){
m_currTest.DestroyBodies();
};
m_currTest = new Test();
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS[m_currId], m_currId);
_scoreSent = false;
m_particleManager.reset();
m_sprite.y = 0;
if (_bitmapAllDone != null){
removeChild(_bitmapAllDone);
_bitmapAllDone = null;
};
if (_bitmapMissionFailed != null){
removeChild(_bitmapMissionFailed);
_bitmapMissionFailed = null;
};
_levelNameTimer = 3000;
_local1 = (m_currId + 1);
if (_local1 < 10){
_textFieldLevelName.text = ("ROOM 0" + _local1);
} else {
_textFieldLevelName.text = ("ROOM " + _local1);
};
SettingsSave();
redrawTravelLine();
copyFullBitmapData(_bitmapBackgroundFlash.bitmapData, new _classBackgroundFlash().bitmapData, 0, 0);
m_currTest.precalculateBackground(_bitmapBackgroundFlash.bitmapData);
_textFieldLevelNumber.text = (((m_currId + 1) + " OF ") + LEVELS_MAX);
_local2 = (sm_unlockedMax + 1);
if (_local2 > LEVELS_MAX){
_local2 = LEVELS_MAX;
};
_textFieldLevelNumberOpen.text = (_local2 + " OPEN");
_local3 = 0;
while (_local3 < _bitmapStoryN) {
removeChild(_bitmapStory[_local3]);
_bitmapStory[_local3] = null;
_local3++;
};
_bitmapStoryN = 0;
if (m_currId == 0){
addStorySprite(new Bitmap(new _classStory1().bitmapData), 300, 180);
} else {
if (m_currId == 2){
addStorySprite(new Bitmap(new _classStory2().bitmapData), 475, 205);
} else {
if (m_currId == 3){
addStorySprite(new Bitmap(new _classStory3().bitmapData), 300, 200);
} else {
if (m_currId == 5){
addStorySprite(new Bitmap(new _classStory4().bitmapData), 135, 280);
} else {
if (m_currId == 9){
addStorySprite(new Bitmap(new _classStory6().bitmapData), 300, 390);
} else {
if (m_currId == 12){
addStorySprite(new Bitmap(new _classStory8().bitmapData), 125, 180);
} else {
if (m_currId == 14){
addStorySprite(new Bitmap(new _classStory7().bitmapData), 105, 300);
} else {
if (m_currId == 15){
addStorySprite(new Bitmap(new _classStory5a().bitmapData), 300, 242);
addStorySprite(new Bitmap(new _classStory5b().bitmapData), 135, 415);
} else {
if (m_currId == 19){
addStorySprite(new Bitmap(new _classStory9().bitmapData), 115, 140);
} else {
if (m_currId == 24){
addStorySprite(new Bitmap(new _classStory10().bitmapData), 88, 390);
} else {
if (m_currId == 29){
addStorySprite(new Bitmap(new _classStory12().bitmapData), 470, 270);
};
};
};
};
};
};
};
};
};
};
};
_killSFXFrames = 30;
if (m_currId == LEVEL_SKELETON){
m_currTest.addTeddy(-360, -700);
m_currTest._stabilizing = true;
_local3 = 0;
while (_local3 < 1) {
m_currTest.Update(true, null);
_local3++;
};
m_currTest._stabilizing = false;
_killSFXFrames = 90;
};
if (((((((_killBGM) && (!((m_currId == 0))))) && (!((m_currId == 9))))) && (!((m_currId == LEVEL_SKELETON))))){
_killBGM = false;
changeBGM();
playLoopStartSound();
};
if (((!(_killBGM)) && ((((((m_currId == 0)) || ((m_currId == 9)))) || ((m_currId == LEVEL_SKELETON)))))){
playLoopEndSound();
_killBGM = true;
};
if (!_killBGM){
changeBGM();
};
}
private function runTheEndScreen():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Particle;
_bitmapTheEndScreen.alpha = (_bitmapTheEndScreen.alpha + 0.05);
if (_bitmapTheEndScreen.alpha > 1){
_bitmapTheEndScreen.alpha = 1;
};
if (Math.random() > 0.5){
_local3 = (220 + (50 * Math.random()));
_local4 = ((179 + ((323 - 179) * Math.random())) - 250);
_local5 = m_particleManager.addParticle(Particle.PARTICLE_TYPE_SPARKLE, _local3, _local4, 4294967295);
if (_local5 != null){
_local5._life = (_local5._life + (Math.random() * 30));
};
};
if (!Input.mouseClicked){
return;
};
_local1 = _mouseClickedX;
_local2 = _mouseClickedY;
if (isPointInside(_local1, _local2, 262, 450, 340, 483)){
buttonPressed();
removeChild(_bitmapTheEndScreen);
_bitmapTheEndScreen = null;
toggleTitleScreen();
};
}
private function showGameScreen():void{
_bitmapTravelLine.x = 0;
_bitmapTravelLine.y = -5;
redrawTravelLine();
addChild(_bitmapTravelLine);
_textFieldLevelName = recreateTextField(_textFieldLevelName);
_textFieldOf40 = recreateTextField(_textFieldOf40);
_textFieldLevelNumber = recreateTextField(_textFieldLevelNumber);
_textFieldLevelNumberOpen = recreateTextField(_textFieldLevelNumberOpen);
addChild(_textFieldLevelName);
addChild(_textFieldOf40);
addChild(_textFieldLevelNumber);
addChild(_textFieldLevelNumberOpen);
addChild(_bitmapButtonNext);
addChild(_bitmapButtonPrev);
addChild(_bitmapButtonRetry);
addChild(_bitmapButtonMenu);
if (MyPreloader._walkthrough){
_bitmapButtonWalkthrough = new Bitmap(new _classButtonWalkthrough().bitmapData);
_bitmapButtonWalkthrough.smoothing = true;
_bitmapButtonWalkthrough.x = ((SCREEN_DX - _bitmapButtonWalkthrough.width) - 3);
_bitmapButtonWalkthrough.y = 25;
_bitmapButtonWalkthrough.alpha = 1;
_bitmapButtonWalkthrough.smoothing = true;
addChild(_bitmapButtonWalkthrough);
};
}
public function onMouseMoveEvent(_arg1:MouseEvent):void{
_mouseVisible = true;
_mouseX = mouseX;
_mouseY = mouseY;
}
public function onMouseDownGamesFree(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.gamesfree.com"), "_blank");
}
private function hideGameScreen():void{
removeChild(_bitmapTravelLine);
removeChild(_textFieldLevelName);
removeChild(_textFieldOf40);
removeChild(_textFieldLevelNumber);
removeChild(_textFieldLevelNumberOpen);
removeChild(_bitmapButtonNext);
removeChild(_bitmapButtonPrev);
removeChild(_bitmapButtonRetry);
removeChild(_bitmapButtonMenu);
if (_bitmapButtonWalkthrough != null){
removeChild(_bitmapButtonWalkthrough);
_bitmapButtonWalkthrough = null;
};
}
public function playGrabShape():void{
var _local1:SoundTransform;
if (_audio){
_local1 = new SoundTransform(0.1);
_audioBank._soundGrabShape.play(0, 1, _local1);
};
}
private function runGameScreen():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:int;
var _local6:int;
var _local7:Number;
var _local8:Number;
var _local9:Number;
if (m_currId == 0){
_bitmapButtonPrev.alpha = 0.4;
} else {
_bitmapButtonPrev.alpha = 1;
};
if (m_currId == sm_unlockedMax){
_bitmapButtonNext.alpha = 0.4;
} else {
_bitmapButtonNext.alpha = 1;
};
if (m_currId == 19){
addWindParticles(1, 390, 60);
} else {
if (m_currId == 20){
addWindParticles(1, 236, 83);
} else {
if (m_currId == 24){
addWindParticles(1, (320 - 9), (150 + 8));
} else {
if (m_currId == 28){
addWindParticles(1, (50 - 2), 120);
};
};
};
};
if (!Input.mouseClicked){
return;
};
_local1 = _mouseClickedX;
_local2 = _mouseClickedY;
if (_bitmapAllDone != null){
_local3 = _bitmapAllDone.x;
_local4 = _bitmapAllDone.y;
if (isPointInside(_local1, _local2, (_local3 + 100), (_local4 + 42), (_local3 + 184), (_local4 + 77))){
PlayLevelChangedSound();
if (m_currId == 29){
showTheEndScreen();
} else {
m_currId++;
recreateLevel();
};
};
};
if (isPointInsideBitmap(_bitmapButtonPrev, _local1, _local2)){
if (m_currId > 0){
m_currId--;
PlayLevelChangedSound();
recreateLevel();
};
};
if (isPointInsideBitmap(_bitmapButtonNext, _local1, _local2)){
if (m_currId < sm_unlockedMax){
PlayLevelChangedSound();
if (m_currId == 29){
showTheEndScreen();
} else {
m_currId++;
recreateLevel();
};
};
};
if (_bitmapMissionFailed != null){
_local3 = _bitmapMissionFailed.x;
_local4 = _bitmapMissionFailed.y;
if (isPointInside(_local1, _local2, (_local3 + 114), (_local4 + 42), (_local3 + 168), (_local4 + 77))){
buttonPressed();
recreateLevel();
};
};
if (isPointInsideBitmap(_bitmapButtonRetry, _local1, _local2)){
buttonPressed();
recreateLevel();
};
if (isPointInsideBitmap(_bitmapButtonMenu, _local1, _local2)){
buttonPressed();
hideGameScreen();
toggleTitleScreen();
changeBGM();
};
if (isPointInsideBitmap(_bitmapTravelLine, _local1, _local2)){
_local5 = 0;
_local6 = 0;
while (_local6 <= sm_unlockedMax) {
var _temp1 = _local5;
_local5 = (_local5 + 1);
_local3 = (s_travelLineLevelCoordinates[_temp1] + _bitmapTravelLine.x);
var _temp2 = _local5;
_local5 = (_local5 + 1);
_local4 = (s_travelLineLevelCoordinates[_temp2] + _bitmapTravelLine.y);
var _temp3 = _local5;
_local5 = (_local5 + 1);
_local7 = s_travelLineLevelCoordinates[_temp3];
_local8 = (_local3 - _local1);
_local9 = (_local4 - _local2);
if (((_local8 * _local8) + (_local9 * _local9)) <= (_local7 * _local7)){
m_currId = _local6;
buttonPressed();
recreateLevel();
break;
};
_local6++;
};
};
}
private function SettingsLoad():void{
var _local1:SharedObject;
_local1 = SharedObject.getLocal("PerfectBalanceSettings");
if ((((_local1 == null)) || (!((_local1.data.header == "PB2S5"))))){
return;
};
sm_unlockedMax = _local1.data.unlockedMax;
}
private function addWindParticle(_arg1:Number):void{
var _local2:Number;
var _local3:uint;
var _local4:Particle;
_local2 = (0.7 + (Math.random() * 0.7));
_local3 = ((0xFF * _local2) / 1.4);
_local3 = (((4278190080 | (_local3 << 16)) | (_local3 << 8)) | _local3);
_local4 = m_particleManager.addParticle(Particle.PARTICLE_TYPE_WIND, _arg1, ((SCREEN_DY * 0.5) + 1), _local3);
if (_local4 != null){
_local4._life = (_local4._life + (Math.random() * 30));
_local4._speedY = (_local4._speedY - _local2);
};
}
private function isPointInsideBitmap(_arg1:Bitmap, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (_arg1 == null){
return (false);
};
_local4 = _arg1.x;
_local5 = _arg1.y;
_local6 = (_local4 + _arg1.width);
_local7 = (_local5 + _arg1.height);
if ((((((((_arg2 >= _local4)) && ((_arg3 >= _local5)))) && ((_arg2 <= _local6)))) && ((_arg3 <= _local7)))){
return (true);
};
return (false);
}
private function recreateTextField(_arg1:TextField):TextField{
var _local2:TextFormat;
_local2 = _arg1.getTextFormat();
return (createTextField(_arg1.text, _arg1.x, _arg1.y, _arg1.width, _arg1.height, (_local2.size as int), _local2.align));
}
public function playLoopStartSound():void{
var _local1:SoundTransform;
if (!_audio){
return;
};
_local1 = new SoundTransform(0.2);
_audioBank._soundLoopStartSound.play(0, 1, _local1);
}
private function copyFullBitmapDataRotate(_arg1:BitmapData, _arg2:BitmapData, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:Matrix;
_local6 = new Matrix();
_local6.translate((-(_arg2.width) * 0.5), (-(_arg2.height) * 0.5));
_local6.rotate(_arg5);
_local6.translate((_arg2.width * 0.5), (_arg2.height * 0.5));
_local6.translate(_arg3, _arg4);
_arg1.draw(_arg2, _local6, null, null, null, true);
}
public static function getQualityMultiplier():Number{
if (s_quality == 0){
return (1);
};
if (s_quality == 1){
return (0.8);
};
if (s_quality == 2){
return (0.7);
};
return (0.6);
}
public static function playHitSound(_arg1:int, _arg2:int, _arg3:Number, _arg4:Boolean=false):void{
var _local5:Boolean;
_local5 = true;
if ((((_arg1 == 101)) || ((_arg2 == 101)))){
_local5 = false;
} else {
if ((((_arg1 == 100)) || ((_arg2 == 100)))){
Main._playDropVolume = (_arg3 * 0.4);
Main._playDrop = 0;
_local5 = false;
} else {
if ((((_arg1 == 102)) || ((_arg2 == 102)))){
if (_arg1 != _arg2){
Main._playBonesVolume = (_arg3 * 0.3);
Main._playBones = 0;
};
} else {
if ((((((_arg1 >= 34)) && ((_arg1 <= 36)))) || ((((_arg2 >= 34)) && ((_arg2 <= 36)))))){
Main._playHitVolume = (_arg3 * 0.3);
Main._playHit = 0;
} else {
Main._playHitStoneVolume = (_arg3 * 0.3);
Main._playHitStone = 0;
};
};
};
};
if (((((_arg4) && (_local5))) && ((Math.random() > 0.95)))){
m_this.playSpecialSound();
};
}
public static function iceModeExecute():void{
Test._friction = 0.8;
}
}
}//package
Section 212
//Main__class3DLogo (Main__class3DLogo)
package {
import mx.core.*;
public class Main__class3DLogo extends BitmapAsset {
}
}//package
Section 213
//Main__classAudioOff (Main__classAudioOff)
package {
import mx.core.*;
public class Main__classAudioOff extends BitmapAsset {
}
}//package
Section 214
//Main__classAudioOn (Main__classAudioOn)
package {
import mx.core.*;
public class Main__classAudioOn extends BitmapAsset {
}
}//package
Section 215
//Main__classBackgroundFlash (Main__classBackgroundFlash)
package {
import mx.core.*;
public class Main__classBackgroundFlash extends BitmapAsset {
}
}//package
Section 216
//Main__classButtonMenu (Main__classButtonMenu)
package {
import mx.core.*;
public class Main__classButtonMenu extends BitmapAsset {
}
}//package
Section 217
//Main__classButtonNext (Main__classButtonNext)
package {
import mx.core.*;
public class Main__classButtonNext extends BitmapAsset {
}
}//package
Section 218
//Main__classButtonPrev (Main__classButtonPrev)
package {
import mx.core.*;
public class Main__classButtonPrev extends BitmapAsset {
}
}//package
Section 219
//Main__classButtonRetry (Main__classButtonRetry)
package {
import mx.core.*;
public class Main__classButtonRetry extends BitmapAsset {
}
}//package
Section 220
//Main__classButtonWalkthrough (Main__classButtonWalkthrough)
package {
import mx.core.*;
public class Main__classButtonWalkthrough extends BitmapAsset {
}
}//package
Section 221
//Main__classCreditsScreen (Main__classCreditsScreen)
package {
import mx.core.*;
public class Main__classCreditsScreen extends BitmapAsset {
}
}//package
Section 222
//Main__classCreditsScreenBackground (Main__classCreditsScreenBackground)
package {
import mx.core.*;
public class Main__classCreditsScreenBackground extends BitmapAsset {
}
}//package
Section 223
//Main__classCursorHandClosed (Main__classCursorHandClosed)
package {
import mx.core.*;
public class Main__classCursorHandClosed extends BitmapAsset {
}
}//package
Section 224
//Main__classCursorHandOpen (Main__classCursorHandOpen)
package {
import mx.core.*;
public class Main__classCursorHandOpen extends BitmapAsset {
}
}//package
Section 225
//Main__classCursorHelper (Main__classCursorHelper)
package {
import mx.core.*;
public class Main__classCursorHelper extends BitmapAsset {
}
}//package
Section 226
//Main__classInstructionsScreen (Main__classInstructionsScreen)
package {
import mx.core.*;
public class Main__classInstructionsScreen extends BitmapAsset {
}
}//package
Section 227
//Main__classMissionFailed (Main__classMissionFailed)
package {
import mx.core.*;
public class Main__classMissionFailed extends BitmapAsset {
}
}//package
Section 228
//Main__classPerfectBalance (Main__classPerfectBalance)
package {
import mx.core.*;
public class Main__classPerfectBalance extends BitmapAsset {
}
}//package
Section 229
//Main__classQualityBest (Main__classQualityBest)
package {
import mx.core.*;
public class Main__classQualityBest extends BitmapAsset {
}
}//package
Section 230
//Main__classQualityHigh (Main__classQualityHigh)
package {
import mx.core.*;
public class Main__classQualityHigh extends BitmapAsset {
}
}//package
Section 231
//Main__classQualityLow (Main__classQualityLow)
package {
import mx.core.*;
public class Main__classQualityLow extends BitmapAsset {
}
}//package
Section 232
//Main__classQualityMedium (Main__classQualityMedium)
package {
import mx.core.*;
public class Main__classQualityMedium extends BitmapAsset {
}
}//package
Section 233
//Main__classSealBack (Main__classSealBack)
package {
import mx.core.*;
public class Main__classSealBack extends BitmapAsset {
}
}//package
Section 234
//Main__classSealFront (Main__classSealFront)
package {
import mx.core.*;
public class Main__classSealFront extends BitmapAsset {
}
}//package
Section 235
//Main__classStory1 (Main__classStory1)
package {
import mx.core.*;
public class Main__classStory1 extends BitmapAsset {
}
}//package
Section 236
//Main__classStory10 (Main__classStory10)
package {
import mx.core.*;
public class Main__classStory10 extends BitmapAsset {
}
}//package
Section 237
//Main__classStory11 (Main__classStory11)
package {
import mx.core.*;
public class Main__classStory11 extends BitmapAsset {
}
}//package
Section 238
//Main__classStory12 (Main__classStory12)
package {
import mx.core.*;
public class Main__classStory12 extends BitmapAsset {
}
}//package
Section 239
//Main__classStory2 (Main__classStory2)
package {
import mx.core.*;
public class Main__classStory2 extends BitmapAsset {
}
}//package
Section 240
//Main__classStory3 (Main__classStory3)
package {
import mx.core.*;
public class Main__classStory3 extends BitmapAsset {
}
}//package
Section 241
//Main__classStory4 (Main__classStory4)
package {
import mx.core.*;
public class Main__classStory4 extends BitmapAsset {
}
}//package
Section 242
//Main__classStory5a (Main__classStory5a)
package {
import mx.core.*;
public class Main__classStory5a extends BitmapAsset {
}
}//package
Section 243
//Main__classStory5b (Main__classStory5b)
package {
import mx.core.*;
public class Main__classStory5b extends BitmapAsset {
}
}//package
Section 244
//Main__classStory6 (Main__classStory6)
package {
import mx.core.*;
public class Main__classStory6 extends BitmapAsset {
}
}//package
Section 245
//Main__classStory7 (Main__classStory7)
package {
import mx.core.*;
public class Main__classStory7 extends BitmapAsset {
}
}//package
Section 246
//Main__classStory8 (Main__classStory8)
package {
import mx.core.*;
public class Main__classStory8 extends BitmapAsset {
}
}//package
Section 247
//Main__classStory9 (Main__classStory9)
package {
import mx.core.*;
public class Main__classStory9 extends BitmapAsset {
}
}//package
Section 248
//Main__classTextureA (Main__classTextureA)
package {
import mx.core.*;
public class Main__classTextureA extends BitmapAsset {
}
}//package
Section 249
//Main__classTextureB (Main__classTextureB)
package {
import mx.core.*;
public class Main__classTextureB extends BitmapAsset {
}
}//package
Section 250
//Main__classTextureC (Main__classTextureC)
package {
import mx.core.*;
public class Main__classTextureC extends BitmapAsset {
}
}//package
Section 251
//Main__classTextureD (Main__classTextureD)
package {
import mx.core.*;
public class Main__classTextureD extends BitmapAsset {
}
}//package
Section 252
//Main__classTextureE (Main__classTextureE)
package {
import mx.core.*;
public class Main__classTextureE extends BitmapAsset {
}
}//package
Section 253
//Main__classTextureF (Main__classTextureF)
package {
import mx.core.*;
public class Main__classTextureF extends BitmapAsset {
}
}//package
Section 254
//Main__classTheEndScreen (Main__classTheEndScreen)
package {
import mx.core.*;
public class Main__classTheEndScreen extends BitmapAsset {
}
}//package
Section 255
//Main__classTitleScreen (Main__classTitleScreen)
package {
import mx.core.*;
public class Main__classTitleScreen extends BitmapAsset {
}
}//package
Section 256
//Main__classTravelLine (Main__classTravelLine)
package {
import mx.core.*;
public class Main__classTravelLine extends BitmapAsset {
}
}//package
Section 257
//Main__classTravelLineSlot (Main__classTravelLineSlot)
package {
import mx.core.*;
public class Main__classTravelLineSlot extends BitmapAsset {
}
}//package
Section 258
//Main__classTravelLineSlotCurrent (Main__classTravelLineSlotCurrent)
package {
import mx.core.*;
public class Main__classTravelLineSlotCurrent extends BitmapAsset {
}
}//package
Section 259
//Main__classTravelLineSlotLocked (Main__classTravelLineSlotLocked)
package {
import mx.core.*;
public class Main__classTravelLineSlotLocked extends BitmapAsset {
}
}//package
Section 260
//Main__fontClass1 (Main__fontClass1)
package {
import mx.core.*;
public class Main__fontClass1 extends FontAsset {
}
}//package
Section 261
//MyPreloader (MyPreloader)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
import flash.net.*;
import flash.ui.*;
import flash.media.*;
import flash.system.*;
import mochi.as3.*;
public dynamic class MyPreloader extends MovieClip {
private var _textFieldPercent:TextField;// = null
private var _initDone:Boolean;// = false
private var _fgnState:int;// = 0
private var _canPass0Timer:int;// = 0
private var _nice:Boolean;// = false
private var _timer:int;// = 0
private var _spriteLoadingScreenStartButton:Sprite;// = null
private var _sDDot:String;// = ":"
private var _foregroundSprite:Sprite;// = null
private var _phase:int;// = 0
private var _sDot:String;// = "."
private var _bitmapLoadingScreenStartButton:Bitmap;// = null
private var _sA:String;// = "a"
private var _sC:String;// = "c"
private var _sD:String;// = "d"
private var _sE:String;// = "e"
private var _sF:String;// = "f"
private var _sG:String;// = "g"
private var _sH:String;// = "h"
private var _andkonLogoTransparent:MovieClip;// = null
private var _loadingBar:Sprite;// = null
private var _sK:String;// = "k"
private var _sM:String;// = "m"
private var _sN:String;// = "n"
private var _sO:String;// = "o"
private var _sP:String;// = "p"
private var _sR:String;// = "r"
private var _sS:String;// = "s"
private var _sT:String;// = "t"
private var _sU:String;// = "u"
private var _sW:String;// = "w"
private var _sX:String;// = "x"
private var _sZ:String;// = "z"
private var _spriteMouseClick:Sprite;// = null
private var _sI:String;// = "i"
private var _sL:String;// = "l"
private var _black:Sprite;// = null
private var _sponsorMovieClip:MovieClip;// = null
private var _bitmapLoadingScreen:Bitmap;// = null
private var _black2:Sprite;// = null
private var _failed:Boolean;// = false
private var _once:Boolean;// = false
private var _moFunZoneMovieClip:MovieClip;// = null
private var _allDone:Boolean;// = false
private var _bitmapAndkon400x400:Bitmap;// = null
public var _adBox:Sprite;// = null
private var _canPass0:Boolean;// = false
private var _frames:int;// = 0
private var _sSlash:String;// = "/"
private var _bitmapConnectingSinglesLogo:Bitmap;// = null
private var _backgroundSprite:Sprite;// = null
public static const _kongregate:Boolean = false;
public static const _ttursasSeal:Boolean = false;
public static const _walkthrough:Boolean = true;
public static const _maxGames:Boolean = false;
public static const _freeGamesNews:Boolean = false;
public static const _gamesChart:Boolean = false;
public static const _flashGameLicense:Boolean = false;
public static const _mochi:Boolean = false;
public static const SCREEN_DX:int = 600;
public static const SCREEN_DY:int = 500;
public static const _gamesFree:Boolean = true;
public static const _cpmStar:Boolean = false;
public static const _connectingSingles:Boolean = false;
public static const FOG_GAME_NAME:String = "GemGrab";
private static const _debug:Boolean = false;
public static const _armorGames:Boolean = false;
public static const ORIGINAL_FPS:int = 60;
public static const _freeOnlineGames:Boolean = false;
public static const _ttursas:Boolean = false;
public static const _gpsStudios:Boolean = false;
public static const _andkon:Boolean = false;
public static var _bitmapFGNLogo:Bitmap = null;
public static var _fontClass1:Class = MyPreloader__fontClass1;
private static var _error:Boolean = false;
public static var gameID:int = 360;
public static var _loaded:Boolean = false;
public static var _classGamesFreeButton:Class = MyPreloader__classGamesFreeButton;
private static var _passThrough:Boolean = true;
public static var _bitmapParticleLayer:Bitmap = new Bitmap(new BitmapData(SCREEN_DX, SCREEN_DY, true, 0), "auto", true);
public static var _kongregateAPI = null;
public static var _classAndkon400x400:Class;
public static var _classLoadingScreen:Class = MyPreloader__classLoadingScreen;
public static var _classSponsorMovie:Class = MyPreloader__classSponsorMovie;
public static var _mochiads_game_id:String = "8c49844b3baed17d";
public static var _classFGNLogo:Class;
public static var _classLoadingScreenStartButton:Class = MyPreloader__classLoadingScreenStartButton;
public static var _classThisCopyIsSiteLocked:Class = MyPreloader__classThisCopyIsSiteLocked;
public static var _classAndkonLogoTransparent:Class;
public static var m_particleManager:ParticleManager = new ParticleManager();
public static var MindJoltAPI:Object = null;
public static var _outlineFilter:GlowFilter = new GlowFilter(0, 1, 3, 3, 1000, 1);
public static var _movieClipGamesFreeButton:SimpleButton = null;
public function MyPreloader(){
_bitmapLoadingScreen = null;
_black = null;
_black2 = null;
_backgroundSprite = null;
_foregroundSprite = null;
_loadingBar = null;
_bitmapConnectingSinglesLogo = null;
_bitmapLoadingScreenStartButton = null;
_spriteLoadingScreenStartButton = null;
_spriteMouseClick = null;
_adBox = null;
_sponsorMovieClip = null;
_bitmapAndkon400x400 = null;
_andkonLogoTransparent = null;
_moFunZoneMovieClip = null;
_sDot = ".";
_sDDot = ":";
_sSlash = "/";
_sA = "a";
_sC = "c";
_sD = "d";
_sE = "e";
_sF = "f";
_sG = "g";
_sH = "h";
_sI = "i";
_sK = "k";
_sL = "l";
_sM = "m";
_sN = "n";
_sO = "o";
_sP = "p";
_sR = "r";
_sS = "s";
_sT = "t";
_sU = "u";
_sW = "w";
_sX = "x";
_sZ = "z";
_initDone = false;
_textFieldPercent = null;
_once = false;
_allDone = false;
_phase = 0;
_frames = 0;
_canPass0 = false;
_timer = 0;
_canPass0Timer = 0;
_nice = false;
_failed = false;
_fgnState = 0;
super();
Font.registerFont(_fontClass1);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function runFGNLogo(_arg1:int):void{
var _local2:int;
_local2 = 0;
if (_fgnState == 0){
_bitmapFGNLogo.alpha = (_bitmapFGNLogo.alpha + 0.03);
if (_bitmapFGNLogo.alpha > 1){
_bitmapFGNLogo.alpha = 1;
_local2++;
};
_bitmapFGNLogo.y = (_bitmapFGNLogo.y - 4);
if (_bitmapFGNLogo.y < ((SCREEN_DY * 0.5) - (_bitmapFGNLogo.height * 0.5))){
_bitmapFGNLogo.y = ((SCREEN_DY * 0.5) - (_bitmapFGNLogo.height * 0.5));
_local2++;
};
if (_local2 == 2){
_fgnState = 1;
};
} else {
if (_fgnState == 1){
if (_arg1 >= (4 * 60)){
_fgnState = 2;
};
} else {
if (_fgnState == 2){
if (_bitmapFGNLogo.y >= (SCREEN_DY - (4 * 30))){
_bitmapFGNLogo.alpha = (_bitmapFGNLogo.alpha - 0.03);
if (_bitmapFGNLogo.alpha < 0){
_bitmapFGNLogo.alpha = 0;
};
};
_bitmapFGNLogo.y = (_bitmapFGNLogo.y + 4);
};
};
};
}
private function secError(_arg1:Event):void{
_error = true;
}
public function highscores(_arg1:int=0):void{
navigateToURL(new URLRequest(((("http://www.gpstudios.com/highscores.php?id=" + gameID) + "&level=") + _arg1)), "_blank");
}
public function gpstudios():void{
navigateToURL(new URLRequest("http://www.gpstudios.com"), "_blank");
}
public function downloadGame():void{
navigateToURL(new URLRequest("http://www.gpstudios.com/downloads/brick-yard-2.rar"), "_blank");
}
public function onEnterFrame(_arg1:Event):void{
var _local2:int;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Particle;
var _local8:Bitmap;
var _local9:int;
var _local10:Number;
var _local11:Sprite;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:int;
var _local16:int;
if (!_initDone){
_initDone = true;
initialize();
};
if (_phase < 0){
return;
};
if (_bitmapParticleLayer != null){
if (Math.random() > 0.8){
_local3 = 391;
_local4 = 442;
_local5 = ((Math.PI * 2) * Math.random());
_local6 = (Math.random() * 17);
_local3 = (_local3 + (Math.cos(_local5) * _local6));
_local4 = (_local4 + (Math.sin(_local5) * _local6));
_local7 = m_particleManager.addParticle(Particle.PARTICLE_TYPE_TWINKLE, _local3, _local4, 4294967295);
if (_local7 != null){
_local7._life = (_local7._life + (Math.random() * 10));
};
};
m_particleManager.liveParticles(0, _bitmapParticleLayer);
};
_local2 = (30 * 15);
_canPass0Timer++;
if (_canPass0Timer > _local2){
_canPass0 = true;
};
if (((((((((((((((_maxGames) || (_flashGameLicense))) || (_debug))) || (_kongregate))) || (_armorGames))) || (_andkon))) || (_passThrough))) || (_gamesFree))){
_canPass0 = true;
_timer = (30 * 2);
};
if (_phase == 0){
if ((((((framesLoaded == totalFrames)) && ((root.loaderInfo.bytesLoaded >= root.loaderInfo.bytesTotal)))) && (_canPass0))){
if (_passThrough){
_phase = 1;
} else {
_timer++;
if (_timer >= (30 * 2)){
_spriteLoadingScreenStartButton.visible = true;
_bitmapLoadingScreenStartButton.visible = true;
_phase = 10;
};
};
};
} else {
if (_phase == 1){
if (_black == null){
_black = new Sprite();
_black.graphics.clear();
_black.graphics.lineStyle();
if (_maxGames){
_black.graphics.beginFill(0xFFFFFF);
} else {
_black.graphics.beginFill(0);
};
_black.graphics.drawRect(0, 0, SCREEN_DX, SCREEN_DY);
_black.graphics.endFill();
_black.x = 0;
_black.y = 0;
_black.alpha = 0;
_black.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
addChild(_black);
};
_black.alpha = (_black.alpha + 0.05);
if (_black.alpha >= 1){
_black.alpha = 1;
_phase = 2;
};
} else {
if (_phase == 2){
if (_adBox != null){
removeChild(_adBox);
_adBox = null;
};
_backgroundSprite.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
if (_bitmapLoadingScreen != null){
removeChild(_bitmapLoadingScreen);
_bitmapLoadingScreen = null;
};
if (_loadingBar != null){
removeChild(_loadingBar);
_loadingBar = null;
};
if (_spriteMouseClick != null){
removeChild(_spriteMouseClick);
_spriteMouseClick = null;
};
if (_bitmapLoadingScreenStartButton != null){
removeChild(_bitmapLoadingScreenStartButton);
_bitmapLoadingScreenStartButton = null;
};
if (_spriteLoadingScreenStartButton != null){
removeChild(_spriteLoadingScreenStartButton);
_spriteLoadingScreenStartButton = null;
};
if (_movieClipGamesFreeButton != null){
removeChild(_movieClipGamesFreeButton);
_movieClipGamesFreeButton = null;
};
if (_bitmapParticleLayer != null){
removeChild(_bitmapParticleLayer);
_bitmapParticleLayer = null;
};
m_particleManager = null;
stage.frameRate = ORIGINAL_FPS;
if (_gpsStudios){
_sponsorMovieClip = (new _classSponsorMovie() as MovieClip);
addChild(_sponsorMovieClip);
_sponsorMovieClip.x = 0;
_sponsorMovieClip.y = 0;
_sponsorMovieClip.play();
} else {
if (_gamesFree){
_sponsorMovieClip = (new _classSponsorMovie() as MovieClip);
addChild(_sponsorMovieClip);
_sponsorMovieClip.buttonMode = true;
_sponsorMovieClip.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownGamesFree);
_sponsorMovieClip.x = -30;
_sponsorMovieClip.y = 10;
_sponsorMovieClip.play();
stage.frameRate = 15;
} else {
if (_maxGames){
_sponsorMovieClip = (new _classSponsorMovie() as MovieClip);
addChild(_sponsorMovieClip);
_sponsorMovieClip.x = 25;
_sponsorMovieClip.y = 200;
_sponsorMovieClip.play();
} else {
if (_freeGamesNews){
_bitmapFGNLogo = new Bitmap(new _classFGNLogo().bitmapData);
_bitmapFGNLogo.smoothing = true;
_bitmapFGNLogo.x = ((SCREEN_DX * 0.5) - (_bitmapFGNLogo.width * 0.5));
_bitmapFGNLogo.y = SCREEN_DY;
_bitmapFGNLogo.alpha = 0;
addChild(_bitmapFGNLogo);
} else {
if (_armorGames){
_sponsorMovieClip = (new _classSponsorMovie() as MovieClip);
_sponsorMovieClip.x = 25;
_sponsorMovieClip.y = 50;
_sponsorMovieClip.play();
addChild(_sponsorMovieClip);
} else {
if (_andkon){
_local8 = new Bitmap(new _classAndkon400x400().bitmapData);
_local8.smoothing = true;
_local8.alpha = 0;
addChild(_local8);
_local8.x = ((SCREEN_DX * 0.5) - (_local8.width * 0.5));
_local8.y = ((SCREEN_DY * 0.5) - (_local8.height * 0.5));
_bitmapAndkon400x400 = _local8;
_foregroundSprite = new Sprite();
_foregroundSprite.graphics.clear();
_foregroundSprite.graphics.lineStyle();
_foregroundSprite.graphics.beginFill(0);
_foregroundSprite.graphics.drawRect(0, 0, SCREEN_DX, SCREEN_DY);
_foregroundSprite.graphics.endFill();
_foregroundSprite.x = 0;
_foregroundSprite.y = 0;
_foregroundSprite.alpha = 0;
_foregroundSprite.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
addChild(_foregroundSprite);
};
};
};
};
};
};
_phase = 3;
} else {
if (_phase == 3){
if (_bitmapAndkon400x400 != null){
_bitmapAndkon400x400.alpha = (_bitmapAndkon400x400.alpha + 0.05);
if (_bitmapAndkon400x400.alpha > 1){
_bitmapAndkon400x400.alpha = 1;
};
};
_frames++;
_local9 = 0;
if (_gpsStudios){
_local9 = 218;
} else {
if (_gamesFree){
_local9 = 120;
} else {
if (_maxGames){
_local9 = 186;
} else {
if (_bitmapAndkon400x400 != null){
_local9 = 150;
} else {
if (_armorGames){
_local9 = 260;
} else {
if (_moFunZoneMovieClip != null){
_local9 = 350;
} else {
if (_freeGamesNews){
_local9 = (7 * 60);
runFGNLogo(_frames);
} else {
_phase = 4;
};
};
};
};
};
};
};
if (_frames == _local9){
stage.frameRate = ORIGINAL_FPS;
if (((_maxGames) || (_gamesFree))){
_sponsorMovieClip.enabled = false;
_sponsorMovieClip.stop();
_sponsorMovieClip.soundTransform = new SoundTransform(0, 0);
removeChild(_sponsorMovieClip);
_sponsorMovieClip = null;
_phase = 4;
} else {
if (_freeGamesNews){
removeChild(_bitmapFGNLogo);
_bitmapFGNLogo = null;
_phase = 4;
} else {
_phase = 4;
if ((((_local9 > 0)) && (!(_andkon)))){
_phase = 44;
if (_black2 == null){
_black2 = new Sprite();
_black2.graphics.clear();
_black2.graphics.lineStyle();
_black2.graphics.beginFill(0);
_black2.graphics.drawRect(0, 0, SCREEN_DX, SCREEN_DY);
_black2.graphics.endFill();
_black2.x = 0;
_black2.y = 0;
_black2.alpha = 0;
addChild(_black2);
};
};
};
};
};
} else {
if (_phase == 44){
_black2.alpha = (_black2.alpha + 0.05);
if (_black2.alpha >= 1){
_black2.alpha = 1;
_phase = 4;
if (_sponsorMovieClip != null){
_sponsorMovieClip.enabled = false;
_sponsorMovieClip.stop();
removeChild(_sponsorMovieClip);
_sponsorMovieClip = null;
};
if (_black2 != null){
removeChild(_black2);
_black2 = null;
};
};
} else {
if (_phase == 4){
if (_bitmapAndkon400x400 != null){
_bitmapAndkon400x400.alpha = (_bitmapAndkon400x400.alpha - 0.05);
if (_bitmapAndkon400x400.alpha <= 0){
_bitmapAndkon400x400.alpha = 0;
_phase = 5;
_allDone = true;
if (_andkonLogoTransparent != null){
removeChild(_andkonLogoTransparent);
_andkonLogoTransparent = null;
};
if (_bitmapAndkon400x400 != null){
removeChild(_bitmapAndkon400x400);
_bitmapAndkon400x400 = null;
};
};
} else {
_allDone = true;
};
} else {
if (_phase == 10){
} else {
if (_phase == -1){
};
};
};
};
};
};
};
};
if (_allDone){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
nextFrame();
if (_bitmapConnectingSinglesLogo != null){
removeChild(_bitmapConnectingSinglesLogo);
_bitmapConnectingSinglesLogo = null;
};
if (_foregroundSprite != null){
removeChild(_foregroundSprite);
_foregroundSprite = null;
};
if (_textFieldPercent != null){
removeChild(_textFieldPercent);
_textFieldPercent = null;
};
if (_moFunZoneMovieClip != null){
_moFunZoneMovieClip.enabled = false;
_moFunZoneMovieClip.stop();
removeChild(_moFunZoneMovieClip);
_moFunZoneMovieClip = null;
};
init();
} else {
if (_loadingBar != null){
_local10 = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal);
_local11 = _loadingBar;
_local12 = 145;
_local13 = 10;
_local14 = 245;
_local15 = 16;
if (_textFieldPercent != null){
_textFieldPercent.x = _local14;
_textFieldPercent.y = (_local15 - 6);
_local16 = int((_local10 * 100));
_textFieldPercent.text = (_local16 + "%");
};
_local11.graphics.clear();
_local11.graphics.beginFill(0x111111);
_local11.graphics.drawRect((_local14 - 2), (_local15 - 2), (_local12 + 4), (_local13 + 4));
_local11.graphics.endFill();
_local11.graphics.beginFill(0xEEEEEE);
_local11.graphics.drawRect(_local14, _local15, (_local12 * _local10), _local13);
_local11.graphics.endFill();
};
};
if (((((!(_armorGames)) && (!(_andkon)))) && (!(_gamesFree)))){
if (_black != null){
removeChild(_black);
addChild(_black);
};
if (_bitmapFGNLogo != null){
removeChild(_bitmapFGNLogo);
addChild(_bitmapFGNLogo);
};
};
}
public function ad_finished():void{
_loaded = true;
_nice = true;
_canPass0 = true;
}
private function init():void{
var _local1:Class;
var _local2:Object;
_local1 = Class(getDefinitionByName("Main"));
if (_local1){
_local2 = new (_local1);
addChild((_local2 as DisplayObject));
removeChild(_black);
_local2.init(_nice, _failed, _black);
_black = null;
};
}
public function tips():void{
navigateToURL(new URLRequest("http://www.gpstudios.com/brick_yard_2_tips.php"), "_blank");
}
private function dispatchHandler(_arg1:Event):void{
if (_arg1.type == Event.COMPLETE){
_canPass0 = true;
_loaded = true;
};
trace(("CPMStar Event: " + _arg1.type));
dispatchEvent(_arg1);
}
public function loadFinished(_arg1:Event):void{
MindJoltAPI = _arg1.currentTarget.content;
MindJoltAPI.service.connect();
trace("[MindJoltAPI] service manually loaded");
}
private function kongregateInit():void{
var _local1:Object;
var _local2:String;
var _local3:URLRequest;
var _local4:Loader;
_local1 = LoaderInfo(root.loaderInfo).parameters;
_local2 = ((_local1.api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf"));
trace(("API path: " + _local2));
Security.allowDomain("*.kongregate.com");
_local3 = new URLRequest(_local2);
_local4 = new Loader();
_local4.contentLoaderInfo.addEventListener(Event.COMPLETE, kongregateLoadComplete);
_local4.load(_local3);
this.addChild(_local4);
}
private function initialize():void{
var url:String;
var urlStart:Number;
var urlEnd:Number;
var domain:String;
var LastDot:Number;
var domEnd:Number;
var oY:Number;
var b:Bitmap;
var s:Sprite;
var textFormat:TextFormat;
var text:TextField;
var bSL:Bitmap;
var variables:URLVariables;
var request:URLRequest;
var loader:URLLoader;
var newMenu:ContextMenu;
var ctm1:ContextMenuItem;
var ctm2:ContextMenuItem;
var ctm3:ContextMenuItem;
var ctm4:ContextMenuItem;
var cpmstarViewSWFUrl:String;
var cpmstarLoader:Loader;
stage.focus = this;
stop();
if (_ttursas){
stage.scaleMode = StageScaleMode.NO_SCALE;
} else {
stage.scaleMode = StageScaleMode.EXACT_FIT;
};
stage.quality = StageQuality.HIGH;
url = stage.loaderInfo.url;
urlStart = (url.indexOf("://") + 3);
urlEnd = url.indexOf("/", urlStart);
domain = url.substring(urlStart, urlEnd);
LastDot = (domain.lastIndexOf(".") - 1);
domEnd = (domain.lastIndexOf(".", LastDot) + 1);
domain = domain.substring(domEnd, domain.length);
if (((_kongregate) || (!((_kongregateAPI == null))))){
};
if (_connectingSingles){
if (domain != ((((((((((((((((((((_sC + _sO) + _sN) + _sN) + _sE) + _sC) + _sT) + _sI) + _sN) + _sG) + _sS) + _sI) + _sN) + _sG) + _sL) + _sE) + _sS) + _sDot) + _sC) + _sO) + _sM)){
_phase = -1;
};
};
if (_maxGames){
if (domain != (((((((((((_sM + _sA) + _sX) + _sG) + _sA) + _sM) + _sE) + _sS) + _sDot) + _sC) + _sO) + _sM)){
_phase = -1;
};
};
if (_flashGameLicense){
if (domain != (((((((((((((((((((_sF + _sL) + _sA) + _sS) + _sH) + _sG) + _sA) + _sM) + _sE) + _sL) + _sI) + _sC) + _sE) + _sN) + _sS) + _sE) + _sDot) + _sC) + _sO) + _sM)){
_phase = -1;
};
};
if (((_freeGamesNews) && (!(_kongregate)))){
if (domain != (((((((((((((((((_sF + _sR) + _sE) + _sE) + _sG) + _sA) + _sM) + _sE) + _sS) + _sN) + _sE) + _sW) + _sS) + _sDot) + _sI) + _sN) + _sF) + _sO)){
_phase = -1;
};
};
if (_armorGames){
if (domain != (((((((((((((_sA + _sR) + _sM) + _sO) + _sR) + _sG) + _sA) + _sM) + _sE) + _sS) + _sDot) + _sC) + _sO) + _sM)){
_phase = -1;
};
};
if (_andkon){
if (domain != (((((((((_sA + _sN) + _sD) + _sK) + _sO) + _sN) + _sDot) + _sC) + _sO) + _sM)){
_phase = -1;
};
};
if (_ttursas){
if (domain != ((((((((((_sT + _sT) + _sU) + _sR) + _sS) + _sA) + _sS) + _sDot) + _sC) + _sO) + _sM)){
_phase = -1;
};
};
if (_gamesFree){
};
if (_phase < 0){
bSL = new Bitmap(new _classThisCopyIsSiteLocked().bitmapData);
bSL.smoothing = true;
addChild(bSL);
return;
};
if (((_gamesFree) && (!((loaderInfo.url.substring(0, 4) == "file"))))){
Security.allowDomain("*");
Security.loadPolicyFile("http://track.g-bot.net/crossdomain.xml");
variables = new URLVariables();
variables.id = "gemgrab";
variables.ui = loaderInfo.url;
request = new URLRequest("http://track.g-bot.net/track.php");
request.method = "POST";
request.data = variables;
loader = new URLLoader();
loader.load(request);
};
if (_gpsStudios){
newMenu = new ContextMenu();
newMenu.hideBuiltInItems();
ctm1 = new ContextMenuItem("Play More Games at GPStudios");
ctm1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, function ():void{
gpstudios();
});
ctm2 = new ContextMenuItem("Check Out The Tips Page");
ctm2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, function ():void{
tips();
});
ctm3 = new ContextMenuItem("Check Out The Highscores");
ctm3.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, function ():void{
highscores();
});
ctm4 = new ContextMenuItem("Add This Game To Your Site!");
ctm4.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, function ():void{
downloadGame();
});
newMenu.customItems.push(ctm1, ctm2, ctm3, ctm4);
contextMenu = newMenu;
};
_backgroundSprite = new Sprite();
_backgroundSprite.graphics.clear();
_backgroundSprite.graphics.lineStyle();
_backgroundSprite.graphics.beginFill(0);
_backgroundSprite.graphics.drawRect(0, 0, SCREEN_DX, SCREEN_DY);
_backgroundSprite.graphics.endFill();
_backgroundSprite.x = 0;
_backgroundSprite.y = 0;
_backgroundSprite.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
addChild(_backgroundSprite);
oY = 0;
if (_connectingSingles){
oY = -120;
};
b = new Bitmap(new _classLoadingScreen().bitmapData);
b.smoothing = true;
addChild(b);
_bitmapLoadingScreen = b;
_loadingBar = new Sprite();
addChild(_loadingBar);
s = new Sprite();
s.graphics.clear();
s.graphics.lineStyle();
s.graphics.beginFill(0);
s.graphics.drawRect(0, 0, b.width, b.height);
s.graphics.endFill();
s.x = b.x;
s.y = b.y;
s.alpha = 0;
s.visible = true;
s.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
addChild(s);
_spriteMouseClick = s;
if (_cpmStar){
_adBox = new Sprite();
_adBox.x = ((SCREEN_DX * 0.5) - 150);
_adBox.y = ((SCREEN_DY * 0.5) - 120);
_adBox.mouseChildren = true;
this.mouseChildren = true;
Security.allowDomain("server.cpmstar.com");
cpmstarViewSWFUrl = "http://server.cpmstar.com/adviewas3.swf";
cpmstarLoader = new Loader();
cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler);
cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler);
url = ((((cpmstarViewSWFUrl + "?poolid=") + 10803) + "&subpoolid=") + 1);
trace(url);
cpmstarLoader.load(new URLRequest(url));
cpmstarLoader.mouseChildren = true;
_adBox.addChild(cpmstarLoader);
addChild(_adBox);
};
b = new Bitmap(new _classLoadingScreenStartButton().bitmapData);
b.smoothing = true;
b.x = ((SCREEN_DX * 0.5) - (b.width * 0.5));
b.y = 400;
b.visible = false;
_bitmapLoadingScreenStartButton = b;
s = new Sprite();
s.graphics.clear();
s.graphics.lineStyle();
s.graphics.beginFill(0);
s.graphics.drawRect(0, 0, b.width, b.height);
s.graphics.endFill();
s.x = b.x;
s.y = b.y;
s.alpha = 0;
s.visible = false;
s.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
addChild(s);
_spriteLoadingScreenStartButton = s;
if (_maxGames){
b.y = (b.y - 80);
s.y = (s.y - 80);
};
addChild(b);
if (_andkon){
_andkonLogoTransparent = (new _classAndkonLogoTransparent() as MovieClip);
addChild(_andkonLogoTransparent);
_andkonLogoTransparent.x = 190;
_andkonLogoTransparent.y = 160;
_andkonLogoTransparent.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
};
if (((((((((((((((_connectingSingles) || (_passThrough))) || (_maxGames))) || (_flashGameLicense))) || (_cpmStar))) || (_armorGames))) || (_andkon))) || (_gamesFree))){
if (!_kongregate){
_loaded = true;
_nice = true;
};
};
if (_kongregate){
kongregateInit();
_passThrough = true;
};
if (_gpsStudios){
Security.allowDomain("www.gpstudios.com");
Security.loadPolicyFile("http://www.gpstudios.com/crossdomain.xml");
};
if (_gamesFree){
_movieClipGamesFreeButton = GetGamesFreeButton();
addChild(_movieClipGamesFreeButton);
_movieClipGamesFreeButton.x = 220;
_movieClipGamesFreeButton.y = 440;
_movieClipGamesFreeButton.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownGamesFree);
};
m_particleManager.initialize();
addChild(_bitmapParticleLayer);
textFormat = new TextFormat("Geometric 231", 14, 0xFFFFFF, false, false, false);
textFormat.align = TextFormatAlign.RIGHT;
text = new TextField();
text.defaultTextFormat = textFormat;
text.x = -408;
text.y = -81;
text.width = (145 + 45);
text.height = 20;
text.embedFonts = true;
text.mouseEnabled = false;
text.text = "0%";
text.filters = [_outlineFilter];
text.antiAliasType = AntiAliasType.ADVANCED;
addChild(text);
_textFieldPercent = text;
}
private function waitForReadyMoFunZone():void{
}
private function kongregateLoadComplete(_arg1:Event):void{
_kongregateAPI = _arg1.target.content;
if (_kongregateAPI != null){
_kongregateAPI.services.connect();
trace(("\n" + _kongregateAPI.services));
trace(("\n" + _kongregateAPI.user));
trace(("\n" + _kongregateAPI.scores));
trace(("\n" + _kongregateAPI.stats));
};
_loaded = true;
_nice = true;
_canPass0 = true;
}
private function onMouseDown(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
trace(((("mouseX = " + mouseX) + " mouseY = ") + mouseY));
if (((_armorGames) && ((_phase <= 1)))){
if ((((((((mouseX >= 60)) && ((mouseY >= 180)))) && ((mouseX <= 542)))) && ((mouseY <= 316)))){
navigateToURL(new URLRequest("http://www.armorgames.com"), "_blank");
return;
};
};
if (((_andkon) && ((_phase == 3)))){
navigateToURL(new URLRequest("http://www.andkon.com/arcade/"), "_blank");
return;
};
if (((((!((_bitmapLoadingScreenStartButton == null))) && (_bitmapLoadingScreenStartButton.visible))) && ((_phase == 10)))){
_local2 = _bitmapLoadingScreenStartButton.x;
_local3 = _bitmapLoadingScreenStartButton.y;
_local4 = (_local2 + _bitmapLoadingScreenStartButton.width);
_local5 = (_local3 + _bitmapLoadingScreenStartButton.height);
if ((((((((mouseX >= _local2)) && ((mouseX <= _local4)))) && ((mouseY >= _local3)))) && ((mouseY <= _local5)))){
_phase = 1;
return;
};
};
if (_bitmapFGNLogo != null){
_local2 = _bitmapFGNLogo.x;
_local3 = _bitmapFGNLogo.y;
_local4 = (_local2 + _bitmapFGNLogo.width);
_local5 = (_local3 + _bitmapFGNLogo.height);
if ((((((((mouseX >= _local2)) && ((mouseX <= _local4)))) && ((mouseY >= _local3)))) && ((mouseY <= _local5)))){
navigateToURL(new URLRequest("http://www.freegamesnews.com"), "_blank");
return;
};
};
if (_once){
return;
};
if (((_maxGames) && ((((_phase == 0)) || ((_phase == 10)))))){
if ((((((((mouseX >= 22)) && ((mouseY >= 218)))) && ((mouseX <= 533)))) && ((mouseY <= 316)))){
navigateToURL(new URLRequest("http://www.maxgames.com"), "_blank");
_once = true;
};
};
if (_phase > 0){
return;
};
trace("bitmap tests...");
if (_andkonLogoTransparent != null){
_local2 = _andkonLogoTransparent.x;
_local3 = _andkonLogoTransparent.y;
_local4 = (_local2 + 210);
_local5 = (_local3 + 220);
if ((((((((mouseX >= _local2)) && ((mouseX <= _local4)))) && ((mouseY >= _local3)))) && ((mouseY <= _local5)))){
navigateToURL(new URLRequest("http://www.andkon.com/arcade/"), "_blank");
};
};
if (_bitmapConnectingSinglesLogo != null){
_local2 = _bitmapConnectingSinglesLogo.x;
_local3 = _bitmapConnectingSinglesLogo.y;
_local4 = (_local2 + _bitmapConnectingSinglesLogo.width);
_local5 = (_local3 + _bitmapConnectingSinglesLogo.height);
trace("testing ConnectingSinglesLogo...");
if ((((((((mouseX >= _local2)) && ((mouseX <= _local4)))) && ((mouseY >= _local3)))) && ((mouseY <= _local5)))){
trace("nvigateToURL()!");
navigateToURL(new URLRequest("http://www.connectingsingles.com/"), "_blank");
_once = true;
};
};
}
public function ad_failed():void{
_loaded = true;
_nice = true;
_canPass0 = true;
}
private function secOK(_arg1:Event):void{
_nice = true;
_loaded = true;
}
public static function onMouseDownGamesFree(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.gamesfree.com"), "_blank");
}
public static function GetGamesFreeButton():SimpleButton{
var _local1:SimpleButton;
var _local2:GlowFilter;
var _local3:DropShadowFilter;
_local1 = (new _classGamesFreeButton() as SimpleButton);
_local2 = new GlowFilter(0, 1, 7, 7);
_local3 = new DropShadowFilter(4, 45, 0, 0.4, 6, 6);
_local1.filters = [_local2, _local3];
return (_local1);
}
}
}//package
Section 262
//MyPreloader__classGamesFreeButton (MyPreloader__classGamesFreeButton)
package {
import mx.core.*;
public class MyPreloader__classGamesFreeButton extends ButtonAsset {
}
}//package
Section 263
//MyPreloader__classLoadingScreen (MyPreloader__classLoadingScreen)
package {
import mx.core.*;
public class MyPreloader__classLoadingScreen extends BitmapAsset {
}
}//package
Section 264
//MyPreloader__classLoadingScreenStartButton (MyPreloader__classLoadingScreenStartButton)
package {
import mx.core.*;
public class MyPreloader__classLoadingScreenStartButton extends BitmapAsset {
}
}//package
Section 265
//MyPreloader__classSponsorMovie (MyPreloader__classSponsorMovie)
package {
import flash.utils.*;
import mx.core.*;
public class MyPreloader__classSponsorMovie extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function MyPreloader__classSponsorMovie(){
dataClass = MyPreloader__classSponsorMovie_dataClass;
super();
initialWidth = (12320 / 20);
initialHeight = (10141 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 266
//MyPreloader__classSponsorMovie_dataClass (MyPreloader__classSponsorMovie_dataClass)
package {
import mx.core.*;
public class MyPreloader__classSponsorMovie_dataClass extends ByteArrayAsset {
}
}//package
Section 267
//MyPreloader__classThisCopyIsSiteLocked (MyPreloader__classThisCopyIsSiteLocked)
package {
import mx.core.*;
public class MyPreloader__classThisCopyIsSiteLocked extends BitmapAsset {
}
}//package
Section 268
//MyPreloader__fontClass1 (MyPreloader__fontClass1)
package {
import mx.core.*;
public class MyPreloader__fontClass1 extends FontAsset {
}
}//package
Section 269
//Particle (Particle)
package {
import flash.geom.*;
public class Particle {
public var _x:Number;
public var _baseAlpha:uint;// = 0
public var _speedX:Number;
public var _speedY:Number;
public var _baseColor:uint;// = 0
public var _alive:Boolean;
public var _type:int;
public var _iD:int;
public var _life:Number;
public var _alpha:Number;// = 1
public var _size:Number;
public var _color:uint;// = 0
public var _rectangle:Rectangle;// = null
public var _y:Number;
public static const PARTICLE_LIFE_TIMES:Array = [20, 40, 20, 150, 30, 60];
public static const PARTICLE_TYPE_EXPLOSION:int = 1;
public static const PARTICLE_TYPE_SPARKLE:int = 4;
public static const GRAVITY:Array = [0.04, 0, 0, 0, 0, 0];
public static const PARTICLE_TYPE_TWINKLE:int = 2;
public static const PARTICLE_TYPE_SHOOTING_STAR:int = 3;
public static const PARTICLE_TYPE_WIND:int = 5;
public static const BASE_ALPHA:Array = [1, 1, 1, 1, 1, 0.3];
public static const PARTICLE_TYPE_DUST:int = 0;
public function Particle(_arg1:int){
_rectangle = null;
_alpha = 1;
_baseAlpha = 0;
_color = 0;
_baseColor = 0;
super();
_iD = _arg1;
_x = 0;
_y = 0;
_speedX = 0;
_speedY = 0;
_life = 0;
_alive = false;
}
public function live(_arg1:Number):void{
var _local2:int;
var _local3:uint;
var _local4:Number;
var _local5:Number;
_local3 = _baseAlpha;
if (_life < 20){
_local3 = uint(((_local3 * _life) / 20));
};
_local4 = (_x + _speedX);
_local5 = (_y + _speedY);
_speedY = (_speedY + GRAVITY[_type]);
_x = _local4;
_y = _local5;
_rectangle.x = (_local4 - _size);
_rectangle.y = ((_local5 + _arg1) - _size);
_color = (_baseColor | (_local3 << 24));
}
public function resetGraphics():void{
if (_type == PARTICLE_TYPE_EXPLOSION){
_size = 3;
} else {
_size = 2;
};
_rectangle = new Rectangle(0, 0, _size, _size);
_size = (_size * 0.5);
}
public function rebirth():void{
_alive = true;
_life = PARTICLE_LIFE_TIMES[_type];
_baseAlpha = uint((BASE_ALPHA[_type] * 0xFF));
}
}
}//package
Section 270
//ParticleManager (ParticleManager)
package {
import flash.display.*;
import flash.geom.*;
public class ParticleManager {
public var _particlesDeadIndex:int;// = 0
private var _particlesAliveIndices:Array;// = null
private var _particles:Array;// = null
private var _particlesDeadIndices:Array;// = null
public var _particlesAlive:int;// = 0
public static var particlesMax:int = (0x1000 + 0x1000);
public function ParticleManager(){
var _local1:int;
_particles = null;
_particlesAliveIndices = null;
_particlesDeadIndices = null;
_particlesAlive = 0;
_particlesDeadIndex = 0;
super();
_particles = new Array(particlesMax);
_particlesAliveIndices = new Array(particlesMax);
_particlesDeadIndices = new Array(particlesMax);
_local1 = 0;
while (_local1 < particlesMax) {
_particles[_local1] = new Particle(_local1);
_local1++;
};
}
private function resetParticle(_arg1:Particle, _arg2:int, _arg3:Number, _arg4:Number, _arg5:uint):void{
_arg1._type = _arg2;
_arg1._baseColor = (_arg5 & 0xFFFFFF);
_arg1._color = _arg1._baseColor;
_arg1.resetGraphics();
_arg1._x = _arg3;
_arg1._y = _arg4;
_arg1._speedX = 0;
_arg1._speedY = 0;
_arg1.rebirth();
}
public function addParticle(_arg1:int, _arg2:Number, _arg3:Number, _arg4:uint):Particle{
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Particle;
_local7 = _particlesDeadIndices[_particlesDeadIndex];
if (_local7 >= 0){
_local8 = _particles[_particlesDeadIndex];
resetParticle(_local8, _arg1, _arg2, _arg3, _arg4);
_particlesAliveIndices[_particlesAlive] = _particlesDeadIndex;
_particlesAlive++;
_particlesDeadIndices[_particlesDeadIndex] = -1;
_particlesDeadIndex = _local7;
return (_local8);
};
_local5 = -1;
_local6 = (0x0400 * 0x0400);
_local7 = 0;
while (_local7 < particlesMax) {
_local8 = _particles[_local7];
if (_local8._type == 1){
} else {
if (_local8._life < _local6){
_local6 = _local8._life;
_local5 = _local7;
};
};
_local7++;
};
if (_local5 < 0){
return (null);
};
_local8 = _particles[_local5];
resetParticle(_local8, _arg1, _arg2, _arg3, _arg4);
return (_local8);
}
public function reset():void{
var _local1:int;
_local1 = 0;
while (_local1 < particlesMax) {
_particles[_local1]._alive = false;
_particlesAliveIndices[_local1] = -1;
_particlesDeadIndices[_local1] = (_local1 + 1);
_local1++;
};
_particlesDeadIndices[(particlesMax - 1)] = -1;
_particlesDeadIndex = 0;
_particlesAlive = 0;
}
public function initialize():void{
var _local1:int;
_local1 = 0;
while (_local1 < particlesMax) {
_particlesAliveIndices[_local1] = -1;
_particlesDeadIndices[_local1] = (_local1 + 1);
_local1++;
};
_particlesDeadIndices[(particlesMax - 1)] = -1;
_particlesDeadIndex = 0;
_particlesAlive = 0;
}
public function liveParticles(_arg1:Number, _arg2:Bitmap):void{
var _local3:BitmapData;
var _local4:Particle;
var _local5:int;
var _local6:int;
_local3 = _arg2.bitmapData;
_local3.fillRect(new Rectangle(0, 0, _local3.width, _local3.height), 0);
_local5 = 0;
while (_local5 < _particlesAlive) {
_local6 = _particlesAliveIndices[_local5];
_local4 = _particles[_local6];
if (!_local4._alive){
} else {
_local4.live(_arg1);
_local4._life = (_local4._life - 1);
if (_local4._life <= 0){
_local4._alive = false;
_particlesAliveIndices[_local5] = _particlesAliveIndices[(_particlesAlive - 1)];
_particlesAlive--;
_particlesDeadIndices[_local6] = _particlesDeadIndex;
_particlesDeadIndex = _local6;
_local5--;
} else {
_local3.fillRect(_local4._rectangle, _local4._color);
};
};
_local5++;
};
}
public function destroy():void{
}
}
}//package
Section 271
//TTVertexCloud (TTVertexCloud)
package {
import flash.display.*;
import flash.geom.*;
public class TTVertexCloud {
public var m_verticesTransformed:Array;// = null
private var m_tmpMatrix2nd:Array;
public var m_vertexColors:Array;// = null
public var m_verticesN:int;// = 0
private var m_tmpMatrix:Array;
public var m_verticesOriginal:Array;// = null
public function TTVertexCloud(){
m_verticesN = 0;
m_verticesOriginal = null;
m_vertexColors = null;
m_verticesTransformed = null;
m_tmpMatrix = new Array((4 * 4));
m_tmpMatrix2nd = new Array((4 * 4));
super();
}
public function draw(_arg1:Bitmap):void{
var _local2:BitmapData;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:TTVertexContainer;
_local2 = _arg1.bitmapData;
_local2.fillRect(new Rectangle(0, 0, _local2.width, _local2.height), 0);
_local3 = ((_local2.width >> 1) - 2.5);
_local4 = ((_local2.height >> 1) - 2.5);
_local5 = 0;
while (_local5 < m_verticesN) {
_local6 = m_verticesTransformed[_local5];
_local2.fillRect(new Rectangle((_local6.pX + _local3), (_local6.pY + _local4), 5, 5), _local6.color);
_local5++;
};
}
public function translate(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Array):void{
getIdentity(m_tmpMatrix);
m_tmpMatrix[12] = _arg1;
m_tmpMatrix[13] = _arg2;
m_tmpMatrix[14] = _arg3;
multiply(m_tmpMatrix, _arg4);
}
public function importVerticesFromBitmap(_arg1:Bitmap):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:BitmapData;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:uint;
_local2 = (_arg1.width * _arg1.height);
m_verticesOriginal = new Array((_local2 * 3));
m_vertexColors = new Array(_local2);
m_verticesTransformed = new Array(0);
_local3 = 0;
_local4 = _arg1.width;
_local5 = _arg1.height;
_local6 = _arg1.bitmapData;
_local7 = 0;
_local12 = 0;
while (_local12 < _local5) {
_local13 = 0;
while (_local13 < _local4) {
_local14 = _local6.getPixel32(_local13, _local12);
if ((_local14 >> 24) != 0){
_local8 = ((_local14 >> 16) & 0xFF);
_local9 = ((_local14 >> 8) & 0xFF);
_local10 = (_local14 & 0xFF);
_local11 = (((0.3 * _local8) + (0.59 * _local9)) + (0.11 * _local10));
if (_local11 > 0xFF){
_local11 = 0xFF;
};
if (_local11 >= 0){
m_vertexColors[_local3] = _local14;
var _temp1 = _local7;
_local7 = (_local7 + 1);
var _local15 = _temp1;
m_verticesOriginal[_local15] = ((_local13 * 1.5) - (_local4 * 0.5));
var _temp2 = _local7;
_local7 = (_local7 + 1);
var _local16 = _temp2;
m_verticesOriginal[_local16] = ((_local12 * 1.5) - (_local5 * 0.5));
var _temp3 = _local7;
_local7 = (_local7 + 1);
var _local17 = _temp3;
m_verticesOriginal[_local17] = ((128 - _local11) * 0.02);
m_verticesTransformed.push(new TTVertexContainer());
_local3++;
};
};
_local13++;
};
_local12++;
};
m_verticesN = _local3;
}
public function rotateX(_arg1:Number, _arg2:Array):void{
var _local3:Number;
var _local4:Number;
zeroTMPMatrix();
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
m_tmpMatrix[0] = 1;
m_tmpMatrix[5] = _local3;
m_tmpMatrix[6] = _local4;
m_tmpMatrix[9] = -(_local4);
m_tmpMatrix[10] = _local3;
m_tmpMatrix[15] = 1;
multiply(m_tmpMatrix, _arg2);
}
public function rotateY(_arg1:Number, _arg2:Array):void{
var _local3:Number;
var _local4:Number;
zeroTMPMatrix();
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
m_tmpMatrix[0] = _local3;
m_tmpMatrix[2] = -(_local4);
m_tmpMatrix[5] = 1;
m_tmpMatrix[8] = _local4;
m_tmpMatrix[10] = _local3;
m_tmpMatrix[15] = 1;
multiply(m_tmpMatrix, _arg2);
}
public function rotateZ(_arg1:Number, _arg2:Array):void{
var _local3:Number;
var _local4:Number;
zeroTMPMatrix();
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
m_tmpMatrix[0] = _local3;
m_tmpMatrix[1] = _local4;
m_tmpMatrix[4] = -(_local4);
m_tmpMatrix[5] = _local3;
m_tmpMatrix[10] = 1;
m_tmpMatrix[15] = 1;
multiply(m_tmpMatrix, _arg2);
}
private function multiply(_arg1:Array, _arg2:Array):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
_local3 = 0;
while (_local3 < 16) {
m_tmpMatrix2nd[_local3] = _arg2[_local3];
_local3++;
};
_local4 = 0;
while (_local4 < 4) {
_local5 = (_local4 << 2);
_local6 = 0;
while (_local6 < 4) {
_arg2[((_local4 * 4) + _local6)] = ((((_arg1[((4 * 0) + _local6)] * m_tmpMatrix2nd[(_local5 + 0)]) + (_arg1[((4 * 1) + _local6)] * m_tmpMatrix2nd[(_local5 + 1)])) + (_arg1[((4 * 2) + _local6)] * m_tmpMatrix2nd[(_local5 + 2)])) + (_arg1[((4 * 3) + _local6)] * m_tmpMatrix2nd[(_local5 + 3)]));
_local6++;
};
_local4++;
};
}
public function perspectiveProjectionAngle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Array):void{
var _local6:Number;
zeroTMPMatrix();
_local6 = Math.tan((_arg3 * 0.5));
m_tmpMatrix[0] = (_local6 / _arg4);
m_tmpMatrix[5] = _local6;
m_tmpMatrix[10] = (_arg2 / (_arg2 - _arg1));
m_tmpMatrix[11] = 1;
m_tmpMatrix[14] = ((-(_arg2) * _arg1) / (_arg2 - _arg1));
multiply(m_tmpMatrix, _arg5);
}
public function perspectiveProjection(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Array):void{
zeroTMPMatrix();
m_tmpMatrix[0] = ((2 * _arg1) / _arg3);
m_tmpMatrix[5] = ((2 * _arg1) / _arg4);
m_tmpMatrix[10] = (_arg2 / (_arg2 - _arg1));
m_tmpMatrix[11] = 1;
m_tmpMatrix[14] = ((-(_arg2) * _arg1) / (_arg2 - _arg1));
multiply(m_tmpMatrix, _arg5);
}
public function transform(_arg1:Array):void{
var _local2:Number;
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:int;
var _local15:int;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:TTVertexContainer;
_local2 = _arg1[0];
_local3 = _arg1[1];
_local4 = _arg1[2];
_local5 = _arg1[4];
_local6 = _arg1[5];
_local7 = _arg1[6];
_local8 = _arg1[8];
_local9 = _arg1[9];
_local10 = _arg1[10];
_local11 = _arg1[12];
_local12 = _arg1[13];
_local13 = _arg1[14];
_local14 = 0;
_local15 = 0;
while (_local15 < m_verticesN) {
var _temp1 = _local14;
_local14 = (_local14 + 1);
_local16 = m_verticesOriginal[_temp1];
var _temp2 = _local14;
_local14 = (_local14 + 1);
_local17 = m_verticesOriginal[_temp2];
var _temp3 = _local14;
_local14 = (_local14 + 1);
_local18 = m_verticesOriginal[_temp3];
_local19 = m_verticesTransformed[_local15];
_local19.pX = ((((_local16 * _local2) + (_local17 * _local5)) + (_local18 * _local8)) + _local11);
_local19.pY = ((((_local16 * _local3) + (_local17 * _local6)) + (_local18 * _local9)) + _local12);
_local19.pZ = ((((_local16 * _local4) + (_local17 * _local7)) + (_local18 * _local10)) + _local13);
_local19.color = m_vertexColors[_local15];
_local15++;
};
m_verticesTransformed.sortOn("pZ", (Array.DESCENDING | Array.NUMERIC));
}
private function zeroTMPMatrix():void{
var _local1:int;
_local1 = 0;
while (_local1 < 16) {
m_tmpMatrix[_local1] = 0;
_local1++;
};
}
public function getIdentity(_arg1:Array):void{
var _local2:int;
_local2 = 0;
while (_local2 < 16) {
_arg1[_local2] = 0;
_local2++;
};
_arg1[0] = 1;
_arg1[5] = 1;
_arg1[10] = 1;
_arg1[15] = 1;
}
}
}//package
Section 272
//TTVertexContainer (TTVertexContainer)
package {
public class TTVertexContainer {
public var color:uint;
public var pX:Number;
public var pY:Number;
public var pZ:Number;
}
}//package
Section 273
//UserData (UserData)
package {
import flash.display.*;
public class UserData {
public var _particleLeftOvers:Number;// = 1.1
public var _oldBlock:int;// = -1
public var _sticky:Boolean;// = false
public var _fadeAway:Boolean;// = false
public var _damage:Number;// = 0
public var _speedX:Number;// = 0
public var _speedY:Number;// = 0
public var _touchDestroys:Boolean;// = false
public var _iD:int;// = -1
public var _glowAlphaAngle:Number;// = 0
public var _twinkleSkip:int;// = 1
public var _spriteShadow:Bitmap;// = null
public var _directedGravity:Boolean;// = false
public var _invisible:Boolean;// = false
public var _radius:Number;// = 1
public var _collided:Boolean;// = false
public var _height:Number;// = 20
public var _width:Number;// = 20
public var _scale:Number;// = 1
public var _levelCompleted:Boolean;// = false
public var _glowAlpha:Number;// = 0
public var _pickable:Boolean;// = true
public var _object:Object;// = null
public var _alpha:Number;// = 1
public var _color:int;// = 0
public var _shadowOffsetY:Number;// = 4
public var _timer:int;// = 0
public var _sprite:Bitmap;// = null
public var _glow:Boolean;// = false
public var _shadowOffsetX:Number;// = 4
public var _particleVolume:int;// = 0
public var _oldX:Number;// = 0
public var _oldY:Number;// = 0
public var _currentBlock:int;// = -1
public var _collidesWithSensors:Array;
public var _helium:Boolean;// = false
public var _collidesWithSensorsN:int;// = 0
public function UserData(){
_iD = -1;
_sprite = null;
_color = 0;
_radius = 1;
_scale = 1;
_width = 20;
_height = 20;
_alpha = 1;
_currentBlock = -1;
_object = null;
_helium = false;
_sticky = false;
_directedGravity = false;
_collided = false;
_oldBlock = -1;
_levelCompleted = false;
_spriteShadow = null;
_shadowOffsetX = 4;
_shadowOffsetY = 4;
_speedX = 0;
_speedY = 0;
_oldX = 0;
_oldY = 0;
_fadeAway = false;
_glow = false;
_glowAlpha = 0;
_glowAlphaAngle = 0;
_invisible = false;
_damage = 0;
_touchDestroys = false;
_pickable = true;
_particleVolume = 0;
_particleLeftOvers = 1.1;
_twinkleSkip = 1;
_timer = 0;
_collidesWithSensorsN = 0;
_collidesWithSensors = new Array(8);
super();
}
}
}//package