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.Dynamics.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
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.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Collision {
public static const b2_nullFeature:uint = 0xFF;
private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2();
public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local6:int;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:Array;
var _local11:b2Mat22;
var _local12:b2Vec2;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:int;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_local6 = _arg1.m_vertexCount;
_local7 = _arg1.m_vertices;
_local8 = _arg1.m_normals;
_local9 = _arg4.m_vertexCount;
_local10 = _arg4.m_vertices;
_local11 = _arg2.R;
_local12 = _local8[_arg3];
_local13 = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y));
_local14 = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y));
_local11 = _arg5.R;
_local15 = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14));
_local16 = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14));
_local17 = 0;
_local18 = Number.MAX_VALUE;
_local19 = 0;
while (_local19 < _local9) {
_local12 = _local10[_local19];
_local25 = ((_local12.x * _local15) + (_local12.y * _local16));
if (_local25 < _local18){
_local18 = _local25;
_local17 = _local19;
};
_local19++;
};
_local12 = _local7[_arg3];
_local11 = _arg2.R;
_local20 = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
_local21 = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local12 = _local10[_local17];
_local11 = _arg5.R;
_local22 = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
_local23 = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local22 = (_local22 - _local20);
_local23 = (_local23 - _local21);
_local24 = ((_local22 * _local13) + (_local23 * _local14));
return (_local24);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = _arg2.lowerBound;
_local4 = _arg1.upperBound;
_local5 = (_local3.x - _local4.x);
_local6 = (_local3.y - _local4.y);
_local3 = _arg1.lowerBound;
_local4 = _arg2.upperBound;
_local7 = (_local3.x - _local4.x);
_local8 = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{
var _local7:int;
var _local8:Array;
var _local9:int;
var _local10:Array;
var _local11:Array;
var _local12:b2Mat22;
var _local13:b2Vec2;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:int;
var _local20:ClipVertex;
var _local21:int;
var _local22:int;
var _local23:Number;
_local7 = _arg2.m_vertexCount;
_local8 = _arg2.m_normals;
_local9 = _arg5.m_vertexCount;
_local10 = _arg5.m_vertices;
_local11 = _arg5.m_normals;
_local12 = _arg3.R;
_local13 = _local8[_arg4];
_local14 = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y));
_local15 = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y));
_local12 = _arg6.R;
_local16 = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15));
_local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15));
_local14 = _local16;
_local17 = 0;
_local18 = Number.MAX_VALUE;
_local19 = 0;
while (_local19 < _local9) {
_local13 = _local11[_local19];
_local23 = ((_local14 * _local13.x) + (_local15 * _local13.y));
if (_local23 < _local18){
_local18 = _local23;
_local17 = _local19;
};
_local19++;
};
_local21 = _local17;
_local22 = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0;
_local20 = _arg1[0];
_local13 = _local10[_local21];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local21;
_local20.id.features.incidentVertex = 0;
_local20 = _arg1[1];
_local13 = _local10[_local22];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local22;
_local20.id.features.incidentVertex = 1;
}
public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{
var _local6:ClipVertex;
var _local7:int;
var _local8:Array;
var _local9:Number;
var _local10:int;
var _local11:Array;
var _local12:Number;
var _local13:b2PolygonShape;
var _local14:b2PolygonShape;
var _local15:b2XForm;
var _local16:b2XForm;
var _local17:int;
var _local18:uint;
var _local19:Number;
var _local20:Number;
var _local21:Array;
var _local22:int;
var _local23:Array;
var _local24:b2Vec2;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:b2Vec2;
var _local28:b2Vec2;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Array;
var _local33:Array;
var _local34:int;
var _local35:int;
var _local36:int;
var _local37:b2Vec2;
var _local38:Number;
var _local39:b2ManifoldPoint;
_arg1.pointCount = 0;
_local7 = 0;
_local8 = [_local7];
_local9 = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5);
_local7 = _local8[0];
if (_local9 > 0){
return;
};
_local10 = 0;
_local11 = [_local10];
_local12 = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3);
_local10 = _local11[0];
if (_local12 > 0){
return;
};
_local15 = new b2XForm();
_local16 = new b2XForm();
_local19 = 0.98;
_local20 = 0.001;
if (_local12 > ((_local19 * _local9) + _local20)){
_local13 = _arg4;
_local14 = _arg2;
_local15.Set(_arg5);
_local16.Set(_arg3);
_local17 = _local10;
_local18 = 1;
} else {
_local13 = _arg2;
_local14 = _arg4;
_local15.Set(_arg3);
_local16.Set(_arg5);
_local17 = _local7;
_local18 = 0;
};
_local21 = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16);
_local22 = _local13.m_vertexCount;
_local23 = _local13.m_vertices;
_local24 = _local23[_local17];
_local25 = _local24.Copy();
if ((_local17 + 1) < _local22){
_local24 = _local23[int((_local17 + 1))];
_local37 = _local24.Copy();
} else {
_local24 = _local23[0];
_local37 = _local24.Copy();
};
_local26 = b2Math.SubtractVV(_local37, _local25);
_local27 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25));
_local27.Normalize();
_local28 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local37 = b2Math.b2MulX(_local15, _local37);
_local29 = b2Math.b2Dot(_local28, _local25);
_local30 = -(b2Math.b2Dot(_local27, _local25));
_local31 = b2Math.b2Dot(_local27, _local37);
_local32 = [new ClipVertex(), new ClipVertex()];
_local33 = [new ClipVertex(), new ClipVertex()];
_local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30);
if (_local34 < 2){
return;
};
_local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31);
if (_local34 < 2){
return;
};
_arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy();
_local35 = 0;
_local36 = 0;
while (_local36 < b2Settings.b2_maxManifoldPoints) {
_local6 = _local33[_local36];
_local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29);
if (_local38 <= 0){
_local39 = _arg1.points[_local35];
_local39.separation = _local38;
_local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local39.id.key = _local6.id._key;
_local39.id.features.flip = _local18;
_local35++;
};
_local36++;
};
_arg1.pointCount = _local35;
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local6:int;
var _local7:Array;
var _local8:b2Vec2;
var _local9:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:int;
var _local15:Number;
var _local16:int;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:int;
var _local21:Number;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:Number;
_local6 = _arg2.m_vertexCount;
_local7 = _arg2.m_normals;
_local9 = _arg5.R;
_local8 = _arg4.m_centroid;
_local10 = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)));
_local11 = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)));
_local9 = _arg3.R;
_local8 = _arg2.m_centroid;
_local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))));
_local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))));
_local12 = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y));
_local13 = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y));
_local14 = 0;
_local15 = -(Number.MAX_VALUE);
_local16 = 0;
while (_local16 < _local6) {
_local8 = _local7[_local16];
_local25 = ((_local8.x * _local12) + (_local8.y * _local13));
if (_local25 > _local15){
_local15 = _local25;
_local14 = _local16;
};
_local16++;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
_local18 = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1);
_local19 = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5);
if (_local19 > 0){
return (_local19);
};
_local20 = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0;
_local21 = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5);
if (_local21 > 0){
return (_local21);
};
if ((((_local19 > _local17)) && ((_local19 > _local21)))){
_local24 = -1;
_local22 = _local18;
_local23 = _local19;
} else {
if (_local21 > _local17){
_local24 = 1;
_local22 = _local20;
_local23 = _local21;
} else {
_arg1[0] = _local14;
return (_local17);
};
};
while (true) {
if (_local24 == -1){
_local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1);
} else {
_local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
if (_local17 > _local23){
_local22 = _local14;
_local23 = _local17;
} else {
break;
};
};
_arg1[0] = _local22;
return (_local23);
}
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:ClipVertex;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:b2Vec2;
var _local13:ClipVertex;
_local6 = 0;
_local5 = _arg2[0];
_local7 = _local5.v;
_local5 = _arg2[1];
_local8 = _local5.v;
_local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4);
_local10 = (b2Math.b2Dot(_arg3, _local8) - _arg4);
if (_local9 <= 0){
var _temp1 = _local6;
_local6 = (_local6 + 1);
var _local14 = _temp1;
_arg1[_local14] = _arg2[0];
};
if (_local10 <= 0){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_local14 = _temp2;
_arg1[_local14] = _arg2[1];
};
if ((_local9 * _local10) < 0){
_local11 = (_local9 / (_local9 - _local10));
_local5 = _arg1[_local6];
_local12 = _local5.v;
_local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x)));
_local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y)));
_local5 = _arg1[_local6];
if (_local9 > 0){
_local13 = _arg2[0];
_local5.id = _local13.id;
} else {
_local13 = _arg2[1];
_local5.id = _local13.id;
};
_local6++;
};
return (_local6);
}
public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2Mat22;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:b2ManifoldPoint;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_arg1.pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_localPosition;
_local8 = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
_local9 = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_localPosition;
_local10 = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
_local11 = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local12 = (_local10 - _local8);
_local13 = (_local11 - _local9);
_local14 = ((_local12 * _local12) + (_local13 * _local13));
_local15 = _arg2.m_radius;
_local16 = _arg4.m_radius;
_local17 = (_local15 + _local16);
if (_local14 > (_local17 * _local17)){
return;
};
if (_local14 < Number.MIN_VALUE){
_local18 = -(_local17);
_arg1.normal.Set(0, 1);
} else {
_local24 = Math.sqrt(_local14);
_local18 = (_local24 - _local17);
_local25 = (1 / _local24);
_arg1.normal.x = (_local25 * _local12);
_arg1.normal.y = (_local25 * _local13);
};
_arg1.pointCount = 1;
_local19 = _arg1.points[0];
_local19.id.key = 0;
_local19.separation = _local18;
_local8 = (_local8 + (_local15 * _arg1.normal.x));
_local9 = (_local9 + (_local15 * _arg1.normal.y));
_local10 = (_local10 - (_local16 * _arg1.normal.x));
_local11 = (_local11 - (_local16 * _arg1.normal.y));
_local20 = (0.5 * (_local8 + _local10));
_local21 = (0.5 * (_local9 + _local11));
_local22 = (_local20 - _arg3.position.x);
_local23 = (_local21 - _arg3.position.y);
_local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y));
_local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y));
_local22 = (_local20 - _arg5.position.x);
_local23 = (_local21 - _arg5.position.y);
_local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y));
_local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y));
}
public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2ManifoldPoint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local12:b2Mat22;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:Number;
var _local21:int;
var _local22:Array;
var _local23:Array;
var _local24:int;
var _local25:int;
var _local26:int;
var _local27:b2Vec2;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_arg1.pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_localPosition;
_local13 = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
_local14 = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)));
_local7 = (_local13 - _arg3.position.x);
_local8 = (_local14 - _arg3.position.y);
_local12 = _arg3.R;
_local15 = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local16 = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local18 = 0;
_local19 = -(Number.MAX_VALUE);
_local20 = _arg4.m_radius;
_local21 = _arg2.m_vertexCount;
_local22 = _arg2.m_vertices;
_local23 = _arg2.m_normals;
_local24 = 0;
while (_local24 < _local21) {
_local11 = _local22[_local24];
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local11 = _local23[_local24];
_local34 = ((_local11.x * _local7) + (_local11.y * _local8));
if (_local34 > _local20){
return;
};
if (_local34 > _local19){
_local19 = _local34;
_local18 = _local24;
};
_local24++;
};
if (_local19 < Number.MIN_VALUE){
_arg1.pointCount = 1;
_local11 = _local23[_local18];
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y));
_arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y));
_local6 = _arg1.points[0];
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local19 - _local20);
return;
};
_local25 = _local18;
_local26 = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
_local11 = _local22[_local25];
_local27 = _local22[_local26];
_local28 = (_local27.x - _local11.x);
_local29 = (_local27.y - _local11.y);
_local30 = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local31 = ((_local7 * _local28) + (_local8 * _local29));
_local6 = _arg1.points[0];
if (_local31 <= 0){
_local32 = _local11.x;
_local33 = _local11.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local25;
} else {
if (_local31 >= _local30){
_local32 = _local27.x;
_local33 = _local27.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local26;
} else {
_local32 = ((_local28 * _local31) + _local11.x);
_local33 = ((_local29 * _local31) + _local11.y);
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = 0;
};
};
_local7 = (_local15 - _local32);
_local8 = (_local16 - _local33);
_local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local7 / _local17);
_local8 = (_local8 / _local17);
if (_local17 > _local20){
return;
};
_arg1.pointCount = 1;
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8));
_arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8));
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local17 - _local20);
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
}
}
}//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID)
package Box2D.Collision {
public class b2ContactID {
public var _key:uint;
public var features:Features;
public function b2ContactID(){
features = new Features();
super();
features._m_id = this;
}
public function Set(_arg1:b2ContactID):void{
key = _arg1._key;
}
public function Copy():b2ContactID{
var _local1:b2ContactID;
_local1 = new b2ContactID();
_local1.key = key;
return (_local1);
}
public function get key():uint{
return (_key);
}
public function set key(_arg1:uint):void{
_key = _arg1;
features._referenceEdge = (_key & 0xFF);
features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF);
features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF);
features._flip = (((_key & 4278190080) >> 24) & 0xFF);
}
}
}//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class b2ContactPoint {
public var separation:Number;
public var normal:b2Vec2;
public var position:b2Vec2;
public var restitution:Number;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var id:b2ContactID;
public var friction:Number;
public var velocity:b2Vec2;
public function b2ContactPoint(){
position = new b2Vec2();
velocity = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Distance {
private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var gPoint:b2Point = new b2Point();
public static var g_GJK_Iterations:int = 0;
public static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{
var _local4:Number;
var _local5:int;
var _local6:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local4 = (100 * Number.MIN_VALUE);
_local5 = 0;
while (_local5 < _arg3) {
_local6 = _arg2[_local5];
_local7 = Math.abs((_arg1.x - _local6.x));
_local8 = Math.abs((_arg1.y - _local6.y));
_local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x));
_local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y));
if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){
return (true);
};
_local5++;
};
return (false);
}
public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{
var _local7:b2Vec2;
var _local8:Array;
var _local9:Array;
var _local10:Array;
var _local11:int;
var _local12:Number;
var _local13:int;
var _local14:int;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:int;
_local8 = s_p1s;
_local9 = s_p2s;
_local10 = s_points;
_local11 = 0;
_arg1.SetV(_arg3.GetFirstVertex(_arg4));
_arg2.SetV(_arg5.GetFirstVertex(_arg6));
_local12 = 0;
_local13 = 20;
_local14 = 0;
while (_local14 < _local13) {
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local17 = _arg3.Support(_arg4, _local15, _local16);
_local18 = _arg5.Support(_arg6, -(_local15), -(_local16));
_local12 = ((_local15 * _local15) + (_local16 * _local16));
_local19 = (_local18.x - _local17.x);
_local20 = (_local18.y - _local17.y);
_local21 = ((_local15 * _local19) + (_local16 * _local20));
if ((_local12 - ((_local15 * _local19) + (_local16 * _local20))) <= (0.01 * _local12)){
if (_local11 == 0){
_arg1.SetV(_local17);
_arg2.SetV(_local18);
};
g_GJK_Iterations = _local14;
return (Math.sqrt(_local12));
};
switch (_local11){
case 0:
_local7 = _local8[0];
_local7.SetV(_local17);
_local7 = _local9[0];
_local7.SetV(_local18);
_local7 = _local10[0];
_local7.x = _local19;
_local7.y = _local20;
_arg1.SetV(_local8[0]);
_arg2.SetV(_local9[0]);
_local11++;
break;
case 1:
_local7 = _local8[1];
_local7.SetV(_local17);
_local7 = _local9[1];
_local7.SetV(_local18);
_local7 = _local10[1];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessTwo(_arg1, _arg2, _local8, _local9, _local10);
break;
case 2:
_local7 = _local8[2];
_local7.SetV(_local17);
_local7 = _local9[2];
_local7.SetV(_local18);
_local7 = _local10[2];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessThree(_arg1, _arg2, _local8, _local9, _local10);
break;
};
if (_local11 == 3){
g_GJK_Iterations = _local14;
return (0);
};
_local22 = -(Number.MAX_VALUE);
_local23 = 0;
while (_local23 < _local11) {
_local7 = _local10[_local23];
_local22 = b2Math.b2Max(_local22, ((_local7.x * _local7.x) + (_local7.y * _local7.y)));
_local23++;
};
if ((((_local11 == 3)) || ((_local12 <= ((100 * Number.MIN_VALUE) * _local22))))){
g_GJK_Iterations = _local14;
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local12 = ((_local15 * _local15) + (_local16 * _local16));
return (Math.sqrt(_local12));
};
_local14++;
};
g_GJK_Iterations = _local13;
return (Math.sqrt(_local12));
}
public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local7 = _arg4.R;
_local8 = _arg3.m_localPosition;
_local9 = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local10 = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local7 = _arg6.R;
_local8 = _arg5.m_localPosition;
_local11 = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local12 = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local13 = (_local11 - _local9);
_local14 = (_local12 - _local10);
_local15 = ((_local13 * _local13) + (_local14 * _local14));
_local16 = (_arg3.m_radius - b2Settings.b2_toiSlop);
_local17 = (_arg5.m_radius - b2Settings.b2_toiSlop);
_local18 = (_local16 + _local17);
if (_local15 > (_local18 * _local18)){
_local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14)));
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_local20 = (_local19 - _local18);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = (_local11 - (_local17 * _local13));
_arg2.y = (_local12 - (_local17 * _local14));
return (_local20);
};
if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){
_local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14)));
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
};
_arg1.x = _local9;
_arg1.y = _local10;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
}
public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local14:b2Vec2;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg5[2];
_local9 = _arg3[0];
_local10 = _arg3[1];
_local11 = _arg3[2];
_local12 = _arg4[0];
_local13 = _arg4[1];
_local14 = _arg4[2];
_local15 = _local6.x;
_local16 = _local6.y;
_local17 = _local7.x;
_local18 = _local7.y;
_local19 = _local8.x;
_local20 = _local8.y;
_local21 = (_local17 - _local15);
_local22 = (_local18 - _local16);
_local23 = (_local19 - _local15);
_local24 = (_local20 - _local16);
_local25 = (_local19 - _local17);
_local26 = (_local20 - _local18);
_local27 = -(((_local15 * _local21) + (_local16 * _local22)));
_local28 = ((_local17 * _local21) + (_local18 * _local22));
_local29 = -(((_local15 * _local23) + (_local16 * _local24)));
_local30 = ((_local19 * _local23) + (_local20 * _local24));
_local31 = -(((_local17 * _local25) + (_local18 * _local26)));
_local32 = ((_local19 * _local25) + (_local20 * _local26));
if ((((_local30 <= 0)) && ((_local32 <= 0)))){
_arg1.SetV(_local11);
_arg2.SetV(_local14);
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (1);
};
_local33 = ((_local21 * _local24) - (_local22 * _local23));
_local34 = (_local33 * ((_local15 * _local18) - (_local16 * _local17)));
_local36 = (_local33 * ((_local17 * _local20) - (_local18 * _local19)));
if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){
_local35 = (_local31 / (_local31 + _local32));
_arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x)));
_arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y)));
_arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x)));
_arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y)));
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (2);
};
_local37 = (_local33 * ((_local19 * _local16) - (_local20 * _local15)));
if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){
_local35 = (_local29 / (_local29 + _local30));
_arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x)));
_arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y)));
_arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x)));
_arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y)));
_local10.SetV(_local11);
_local13.SetV(_local14);
_local7.SetV(_local8);
return (2);
};
_local38 = ((_local36 + _local37) + _local34);
_local38 = (1 / _local38);
_local39 = (_local36 * _local38);
_local40 = (_local37 * _local38);
_local41 = ((1 - _local39) - _local40);
_arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x));
_arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y));
_arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x));
_arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y));
return (3);
}
public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local9:b2Point;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local9 = gPoint;
_local8 = _arg5.m_localPosition;
_local7 = _arg6.R;
_local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local10 = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity);
_local11 = (_arg5.m_radius - b2Settings.b2_toiSlop);
if (_local10 > _local11){
_local10 = (_local10 - _local11);
_local12 = (_arg2.x - _arg1.x);
_local13 = (_arg2.y - _arg1.y);
_local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13)));
_local12 = (_local12 / _local14);
_local13 = (_local13 / _local14);
_arg2.x = (_arg2.x - (_local11 * _local12));
_arg2.y = (_arg2.y - (_local11 * _local13));
} else {
_local10 = 0;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
};
return (_local10);
}
public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{
var _local7:int;
var _local8:int;
_local7 = _arg3.m_type;
_local8 = _arg5.m_type;
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6));
};
return (0);
}
public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg3[0];
_local9 = _arg3[1];
_local10 = _arg4[0];
_local11 = _arg4[1];
_local12 = -(_local7.x);
_local13 = -(_local7.y);
_local14 = (_local6.x - _local7.x);
_local15 = (_local6.y - _local7.y);
_local16 = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
_local14 = (_local14 / _local16);
_local15 = (_local15 / _local16);
_local17 = ((_local12 * _local14) + (_local13 * _local15));
if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){
_arg1.SetV(_local9);
_arg2.SetV(_local11);
_local8.SetV(_local9);
_local10.SetV(_local11);
_local6.SetV(_local7);
return (1);
};
_local17 = (_local17 / _local16);
_arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x)));
_arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y)));
_arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x)));
_arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y)));
return (2);
}
}
}//package Box2D.Collision
Section 18
//b2Manifold (Box2D.Collision.b2Manifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Manifold {
public var points:Array;
public var pointCount:int;// = 0
public var normal:b2Vec2;
public function b2Manifold(){
var _local1:int;
pointCount = 0;
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ManifoldPoint();
_local1++;
};
normal = new b2Vec2();
}
public function Set(_arg1:b2Manifold):void{
var _local2:int;
pointCount = _arg1.pointCount;
_local2 = 0;
while (_local2 < b2Settings.b2_maxManifoldPoints) {
(points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]);
_local2++;
};
normal.SetV(_arg1.normal);
}
public function Reset():void{
var _local1:int;
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
normal.SetZero();
pointCount = 0;
}
}
}//package Box2D.Collision
Section 19
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2ManifoldPoint {
public var separation:Number;
public var localPoint2:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var localPoint1:b2Vec2;
public var id:b2ContactID;
public function b2ManifoldPoint(){
localPoint1 = new b2Vec2();
localPoint2 = new b2Vec2();
id = new b2ContactID();
super();
}
public function Set(_arg1:b2ManifoldPoint):void{
localPoint1.SetV(_arg1.localPoint1);
localPoint2.SetV(_arg1.localPoint2);
separation = _arg1.separation;
normalImpulse = _arg1.normalImpulse;
tangentImpulse = _arg1.tangentImpulse;
id.key = _arg1.id.key;
}
public function Reset():void{
localPoint1.SetZero();
localPoint2.SetZero();
separation = 0;
normalImpulse = 0;
tangentImpulse = 0;
id.key = 0;
}
}
}//package Box2D.Collision
Section 20
//b2OBB (Box2D.Collision.b2OBB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2OBB {
public var R:b2Mat22;
public var center:b2Vec2;
public var extents:b2Vec2;
public function b2OBB(){
R = new b2Mat22();
center = new b2Vec2();
extents = new b2Vec2();
super();
}
}
}//package Box2D.Collision
Section 21
//b2Pair (Box2D.Collision.b2Pair)
package Box2D.Collision {
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.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2TimeOfImpact {
public static var s_xf1:b2XForm = new b2XForm();
public static var s_xf2:b2XForm = new b2XForm();
public static var s_p1:b2Vec2 = new b2Vec2();
public static var s_p2:b2Vec2 = new b2Vec2();
public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:int;
var _local20:int;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:b2XForm;
var _local27:b2XForm;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
_local7 = _arg1.m_sweepRadius;
_local8 = _arg3.m_sweepRadius;
_local9 = _arg2.t0;
_local10 = (_arg2.c.x - _arg2.c0.x);
_local11 = (_arg2.c.y - _arg2.c0.y);
_local12 = (_arg4.c.x - _arg4.c0.x);
_local13 = (_arg4.c.y - _arg4.c0.y);
_local14 = (_arg2.a - _arg2.a0);
_local15 = (_arg4.a - _arg4.a0);
_local16 = 0;
_local17 = s_p1;
_local18 = s_p2;
_local19 = 20;
_local20 = 0;
_local21 = 0;
_local22 = 0;
_local23 = 0;
_local24 = 0;
while (true) {
_local25 = (((1 - _local16) * _local9) + _local16);
_local26 = s_xf1;
_local27 = s_xf2;
_arg2.GetXForm(_local26, _local25);
_arg4.GetXForm(_local27, _local25);
_local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27);
if (_local20 == 0){
if (_local23 > (2 * b2Settings.b2_toiSlop)){
_local24 = (1.5 * b2Settings.b2_toiSlop);
} else {
_local5 = (0.05 * b2Settings.b2_toiSlop);
_local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop));
_local24 = ((_local5 > _local6)) ? _local5 : _local6;
};
};
if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){
break;
};
_local21 = (_local18.x - _local17.x);
_local22 = (_local18.y - _local17.y);
_local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22)));
_local21 = (_local21 / _local28);
_local22 = (_local22 / _local28);
_local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8));
if (_local29 == 0){
_local16 = 1;
break;
};
_local30 = ((_local23 - _local24) / _local29);
_local31 = (_local16 + _local30);
if ((((_local31 < 0)) || ((1 < _local31)))){
_local16 = 1;
break;
};
if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){
break;
};
_local16 = _local31;
_local20++;
};
return (_local16);
}
}
}//package Box2D.Collision
Section 28
//ClipVertex (Box2D.Collision.ClipVertex)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class ClipVertex {
public var v:b2Vec2;
public var id:b2ContactID;
public function ClipVertex(){
v = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features)
package Box2D.Collision {
public class Features {
public var _referenceEdge:int;
public var _incidentEdge:int;
public var _flip:int;
public var _incidentVertex:int;
public var _m_id:b2ContactID;
public function get referenceEdge():int{
return (_referenceEdge);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
public function get flip():int{
return (_flip);
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set referenceEdge(_arg1:int):void{
_referenceEdge = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF));
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
}
}//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22)
package Box2D.Common.Math {
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){
var _local4:Number;
var _local5:Number;
col1 = new b2Vec2();
col2 = new b2Vec2();
super();
if (((!((_arg2 == null))) && (!((_arg3 == null))))){
col1.SetV(_arg2);
col2.SetV(_arg3);
} else {
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
col1.x = _local4;
col2.x = -(_local5);
col1.y = _local5;
col2.y = _local4;
};
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function Set(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function SetM(_arg1:b2Mat22):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = col1.x;
_local3 = col2.x;
_local4 = col1.y;
_local5 = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
_local6 = (1 / _local6);
_arg1.col1.x = (_local6 * _local5);
_arg1.col2.x = (-(_local6) * _local3);
_arg1.col1.y = (-(_local6) * _local4);
_arg1.col2.y = (_local6 * _local2);
return (_arg1);
}
public function GetAngle():Number{
return (Math.atan2(col1.y, col1.x));
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = col1.x;
_local5 = col2.x;
_local6 = col1.y;
_local7 = col2.y;
_local8 = ((_local4 * _local7) - (_local5 * _local6));
_local8 = (1 / _local8);
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
}
}//package Box2D.Common.Math
Section 31
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1));
public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity);
public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0);
public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = b2MulMV(_arg1.R, _arg2);
_local3.x = (_local3.x + _arg1.position.x);
_local3.y = (_local3.y + _arg1.position.y);
return (_local3);
}
public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:*;
_local3 = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22;
_local2 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
_local3 = SubtractVV(_arg2, _arg1.position);
_local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y));
_local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y));
_local3.x = _local4;
return (_local3);
}
public static function b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2;
_local2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2Mat22;
_local3 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
_local4 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
_local5 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean;
_local2 = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2NextPowerOfTwo(_arg1:uint):uint{
_arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647));
_arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823));
_arg1 = (_arg1 | ((_arg1 >> 4) & 268435455));
_arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF));
_arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF));
return ((_arg1 + 1));
}
public static function b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
}
}//package Box2D.Common.Math
Section 32
//b2Sweep (Box2D.Common.Math.b2Sweep)
package Box2D.Common.Math {
public class b2Sweep {
public var localCenter:b2Vec2;
public var c:b2Vec2;
public var a:Number;
public var c0:b2Vec2;
public var a0:Number;
public var t0:Number;
public function b2Sweep(){
localCenter = new b2Vec2();
c0 = new b2Vec2();
c = new b2Vec2();
super();
}
public function Advance(_arg1:Number):void{
var _local2:Number;
if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){
_local2 = ((_arg1 - t0) / (1 - t0));
c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x));
c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y));
a0 = (((1 - _local2) * a0) + (_local2 * a));
t0 = _arg1;
};
}
public function GetXForm(_arg1:b2XForm, _arg2:Number):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
if ((1 - t0) > Number.MIN_VALUE){
_local4 = ((_arg2 - t0) / (1 - t0));
_arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x));
_arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y));
_local5 = (((1 - _local4) * a0) + (_local4 * a));
_arg1.R.Set(_local5);
} else {
_arg1.position.SetV(c);
_arg1.R.Set(a);
};
_local3 = _arg1.R;
_arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y)));
_arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y)));
}
}
}//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2)
package Box2D.Common.Math {
public class b2Vec2 {
public var x:Number;
public var y:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function LengthSquared():Number{
return (((x * x) + (y * y)));
}
public function SetZero():void{
x = 0;
y = 0;
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function CrossVF(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function Normalize():Number{
var _local1:Number;
var _local2:Number;
_local1 = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
_local2 = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm)
package Box2D.Common.Math {
public class b2XForm {
public var R:b2Mat22;
public var position:b2Vec2;
public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{
position = new b2Vec2();
R = new b2Mat22();
super();
if (_arg1){
position.SetV(_arg1);
R.SetM(_arg2);
};
}
public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{
position.SetV(_arg1);
R.SetM(_arg2);
}
public function Set(_arg1:b2XForm):void{
position.SetV(_arg1.position);
R.SetM(_arg1.R);
}
public function SetIdentity():void{
position.SetZero();
R.SetIdentity();
}
}
}//package Box2D.Common.Math
Section 35
//b2Color (Box2D.Common.b2Color)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Color {
private var _g:uint;// = 0
private var _b:uint;// = 0
private var _r:uint;// = 0
public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){
_r = 0;
_g = 0;
_b = 0;
super();
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function get color():uint{
return (((_r | (_g << 8)) | (_b << 16)));
}
public function set r(_arg1:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set b(_arg1:Number):void{
_b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set g(_arg1:Number):void{
_g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
}
}//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static const b2_linearSleepTolerance:Number = 0.01;
public static const b2_angularSlop:Number = 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.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var restitution:Number;
public var body1:b2Body;
public var manifold:b2Manifold;
public var normal:b2Vec2;
public var body2:b2Body;
public var friction:Number;
public var pointCount:int;
public function b2ContactConstraint(){
var _local1:int;
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var r2:b2Vec2;
public var separation:Number;
public var positionImpulse:Number;
public var normalImpulse:Number;
public var equalizedMass:Number;
public var tangentMass:Number;
public var tangentImpulse:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var normalMass:Number;
public var velocityBias:Number;
public var r1:b2Vec2;
public function b2ContactConstraintPoint(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
r1 = new b2Vec2();
r2 = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2ContactEdge {
public var next:b2ContactEdge;
public var other:b2Body;
public var contact:b2Contact;
public var prev:b2ContactEdge;
}
}//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var primary:Boolean;
public var createFcn:Function;
public var destroyFcn:Function;
}
}//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
public class b2ContactResult {
public var normal:b2Vec2;
public var position:b2Vec2;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ContactResult(){
position = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
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.Dynamics.*;
import Box2D.Common.Math.*;
public class b2RevoluteJointDef extends b2JointDef {
public var referenceAngle:Number;
public var upperAngle:Number;
public var lowerAngle:Number;
public var motorSpeed:Number;
public var maxMotorTorque:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public function b2RevoluteJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_revoluteJoint;
localAnchor1.Set(0, 0);
localAnchor2.Set(0, 0);
referenceAngle = 0;
lowerAngle = 0;
upperAngle = 0;
maxMotorTorque = 0;
motorSpeed = 0;
enableLimit = false;
enableMotor = false;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 64
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
public class b2Body {
public var m_next:b2Body;
public var m_contactList:b2ContactEdge;
public var m_angularVelocity:Number;
public var m_shapeList:b2Shape;
public var m_force:b2Vec2;
public var m_mass:Number;
public var m_sweep:b2Sweep;
public var m_xf:b2XForm;
public var m_torque:Number;
public var m_userData;
public var m_flags:uint;
public var m_world:b2World;
public var m_prev:b2Body;
public var m_invMass:Number;
public var m_type:int;
public var m_linearDamping:Number;
public var m_angularDamping:Number;
public var m_invI:Number;
public var m_linearVelocity:b2Vec2;
public var m_sleepTime:Number;
public var m_shapeCount:int;
public var m_jointList:b2JointEdge;
public var m_I:Number;
public static var e_fixedRotationFlag:uint = 64;
public static var e_frozenFlag:uint = 2;
public static var e_maxTypes:uint = 3;
public static var e_sleepFlag:uint = 8;
private static var s_massData:b2MassData = new b2MassData();
public static var e_bulletFlag:uint = 32;
public static var e_staticType:uint = 1;
public static var e_islandFlag:uint = 4;
public static var e_allowSleepFlag:uint = 16;
private static var s_xf1:b2XForm = new b2XForm();
public static var e_dynamicType:uint = 2;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
var _local3:b2Mat22;
var _local4:b2Vec2;
m_xf = new b2XForm();
m_sweep = new b2Sweep();
m_linearVelocity = new b2Vec2();
m_force = new b2Vec2();
super();
m_flags = 0;
if (_arg1.isBullet){
m_flags = (m_flags | e_bulletFlag);
};
if (_arg1.fixedRotation){
m_flags = (m_flags | e_fixedRotationFlag);
};
if (_arg1.allowSleep){
m_flags = (m_flags | e_allowSleepFlag);
};
if (_arg1.isSleeping){
m_flags = (m_flags | e_sleepFlag);
};
m_world = _arg2;
m_xf.position.SetV(_arg1.position);
m_xf.R.Set(_arg1.angle);
m_sweep.localCenter.SetV(_arg1.massData.center);
m_sweep.t0 = 1;
m_sweep.a0 = (m_sweep.a = _arg1.angle);
_local3 = m_xf.R;
_local4 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_jointList = null;
m_contactList = null;
m_prev = null;
m_next = null;
m_linearDamping = _arg1.linearDamping;
m_angularDamping = _arg1.angularDamping;
m_force.Set(0, 0);
m_torque = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_sleepTime = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.massData.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.massData.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
m_userData = _arg1.userData;
m_shapeList = null;
m_shapeCount = 0;
}
public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_arg1.x - m_sweep.c.x)))));
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function WakeUp():void{
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 0;
}
public function GetLocalCenter():b2Vec2{
return (m_sweep.localCenter);
}
public function ApplyTorque(_arg1:Number):void{
if (IsSleeping()){
WakeUp();
};
m_torque = (m_torque + _arg1);
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsDynamic():Boolean{
return ((m_type == e_dynamicType));
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
public function SynchronizeTransform():void{
var _local1:b2Mat22;
var _local2:b2Vec2;
m_xf.R.Set(m_sweep.a);
_local1 = m_xf.R;
_local2 = m_sweep.localCenter;
m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y)));
m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y)));
}
public function GetInertia():Number{
return (m_I);
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function SetMassFromShapes():void{
var _local1:b2Shape;
var _local2:Number;
var _local3:Number;
var _local4:b2MassData;
var _local5:b2Mat22;
var _local6:b2Vec2;
var _local7:int;
if (m_world.m_lock == true){
return;
};
m_mass = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
_local2 = 0;
_local3 = 0;
_local4 = s_massData;
_local1 = m_shapeList;
while (_local1) {
_local1.ComputeMass(_local4);
m_mass = (m_mass + _local4.mass);
_local2 = (_local2 + (_local4.mass * _local4.center.x));
_local3 = (_local3 + (_local4.mass * _local4.center.y));
m_I = (m_I + _local4.I);
_local1 = _local1.m_next;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
_local2 = (_local2 * m_invMass);
_local3 = (_local3 * m_invMass);
};
if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){
m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3))));
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
m_sweep.localCenter.Set(_local2, _local3);
_local5 = m_xf.R;
_local6 = m_sweep.localCenter;
m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local1 = m_shapeList;
while (_local1) {
_local1.UpdateSweepRadius(m_sweep.localCenter);
_local1 = _local1.m_next;
};
_local7 = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local7 != m_type){
_local1 = m_shapeList;
while (_local1) {
_local1.RefilterProxy(m_world.m_broadPhase, m_xf);
_local1 = _local1.m_next;
};
};
}
public function PutToSleep():void{
m_flags = (m_flags | e_sleepFlag);
m_sleepTime = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_force.SetZero();
m_torque = 0;
}
public function GetJointList():b2JointEdge{
return (m_jointList);
}
public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{
var _local3:b2Shape;
var _local4:b2Mat22;
var _local5:b2Vec2;
var _local6:Boolean;
var _local7:Boolean;
if (m_world.m_lock == true){
return (true);
};
if (IsFrozen()){
return (false);
};
m_xf.R.Set(_arg2);
m_xf.position.SetV(_arg1);
_local4 = m_xf.R;
_local5 = m_sweep.localCenter;
m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y));
m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_sweep.a0 = (m_sweep.a = _arg2);
_local6 = false;
_local3 = m_shapeList;
while (_local3) {
_local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf);
if (_local7 == false){
_local6 = true;
break;
};
_local3 = _local3.m_next;
};
if (_local6 == true){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local3 = m_shapeList;
while (_local3) {
_local3.DestroyProxy(m_world.m_broadPhase);
_local3 = _local3.m_next;
};
return (false);
};
m_world.m_broadPhase.Commit();
return (true);
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(m_xf, _arg1));
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_force.x = (m_force.x + _arg1.x);
m_force.y = (m_force.y + _arg1.y);
m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)));
}
public function SynchronizeShapes():Boolean{
var _local1:b2XForm;
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local4:b2Shape;
var _local5:Boolean;
_local1 = s_xf1;
_local1.R.Set(m_sweep.a0);
_local2 = _local1.R;
_local3 = m_sweep.localCenter;
_local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y)));
_local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y)));
_local5 = true;
_local4 = m_shapeList;
while (_local4) {
_local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf);
if (_local5 == false){
break;
};
_local4 = _local4.m_next;
};
if (_local5 == false){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local4 = m_shapeList;
while (_local4) {
_local4.DestroyProxy(m_world.m_broadPhase);
_local4 = _local4.m_next;
};
return (false);
};
return (true);
}
public function GetAngle():Number{
return (m_sweep.a);
}
public function GetXForm():b2XForm{
return (m_xf);
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x));
m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y));
m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))));
}
public function GetNext():b2Body{
return (m_next);
}
public function GetMass():Number{
return (m_mass);
}
public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22;
var _local3:b2Vec2;
_local2 = m_xf.R;
_local3 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x)))));
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SetMass(_arg1:b2MassData):void{
var _local2:b2Shape;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:int;
if (m_world.m_lock == true){
return;
};
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
m_sweep.localCenter.SetV(_arg1.center);
_local3 = m_xf.R;
_local4 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local2 = m_shapeList;
while (_local2) {
_local2.UpdateSweepRadius(m_sweep.localCenter);
_local2 = _local2.m_next;
};
_local5 = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local5 != m_type){
_local2 = m_shapeList;
while (_local2) {
_local2.RefilterProxy(m_world.m_broadPhase, m_xf);
_local2 = _local2.m_next;
};
};
}
public function IsStatic():Boolean{
return ((m_type == e_staticType));
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_xf.R, _arg1));
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function Advance(_arg1:Number):void{
m_sweep.Advance(_arg1);
m_sweep.c.SetV(m_sweep.c0);
m_sweep.a = m_sweep.a0;
SynchronizeTransform();
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_bulletFlag);
} else {
m_flags = (m_flags & ~(e_bulletFlag));
};
}
public function CreateShape(_arg1:b2ShapeDef):b2Shape{
var _local2:b2Shape;
if (m_world.m_lock == true){
return (null);
};
_local2 = b2Shape.Create(_arg1, m_world.m_blockAllocator);
_local2.m_next = m_shapeList;
m_shapeList = _local2;
m_shapeCount++;
_local2.m_body = this;
_local2.CreateProxy(m_world.m_broadPhase, m_xf);
_local2.UpdateSweepRadius(m_sweep.localCenter);
return (_local2);
}
public function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointEdge;
_local2 = m_jointList;
while (_local2) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
public function DestroyShape(_arg1:b2Shape):void{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:Boolean;
if (m_world.m_lock == true){
return;
};
_arg1.DestroyProxy(m_world.m_broadPhase);
_local2 = m_shapeList;
_local3 = null;
_local4 = false;
while (_local2 != null) {
if (_local2 == _arg1){
if (_local3){
_local3.m_next = _arg1.m_next;
} else {
m_shapeList = _arg1.m_next;
};
_local4 = true;
break;
};
_local3 = _local2;
_local2 = _local2.m_next;
};
_arg1.m_body = null;
_arg1.m_next = null;
m_shapeCount--;
b2Shape.Destroy(_arg1, m_world.m_blockAllocator);
}
public function GetUserData(){
return (m_userData);
}
public function IsBullet():Boolean{
return (((m_flags & e_bulletFlag) == e_bulletFlag));
}
public function GetWorldCenter():b2Vec2{
return (m_sweep.c);
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_xf.R, _arg1));
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22;
var _local3:b2Vec2;
_local2 = m_xf.R;
_local3 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (_local3);
}
public function GetWorld():b2World{
return (m_world);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
}
}//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class b2BodyDef {
public var isSleeping:Boolean;
public var position:b2Vec2;
public var isBullet:Boolean;
public var allowSleep:Boolean;
public var userData;
public var angularDamping:Number;
public var fixedRotation:Boolean;
public var angle:Number;
public var linearDamping:Number;
public var massData:b2MassData;
public function b2BodyDef(){
massData = new b2MassData();
position = new b2Vec2();
super();
massData.center.SetZero();
massData.mass = 0;
massData.I = 0;
userData = null;
position.Set(0, 0);
angle = 0;
linearDamping = 0;
angularDamping = 0;
allowSleep = true;
isSleeping = false;
fixedRotation = false;
isBullet = false;
}
}
}//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
public class b2ContactFilter {
public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter);
;
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData;
var _local4:b2FilterData;
var _local5:Boolean;
_local3 = _arg1.GetFilterData();
_local4 = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
_local5 = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
}
}//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactListener {
public function Add(_arg1:b2ContactPoint):void{
}
public function Remove(_arg1:b2ContactPoint):void{
}
public function Persist(_arg1:b2ContactPoint):void{
}
public function Result(_arg1:b2ContactResult):void{
}
}
}//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactManager extends b2PairCallback {
public var m_world:b2World;
public var m_destroyImmediate:Boolean;
public var m_nullContact:b2NullContact;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2ContactManager(){
m_nullContact = new b2NullContact();
super();
m_world = null;
m_destroyImmediate = false;
}
override public function PairAdded(_arg1, _arg2){
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2Contact;
_local3 = (_arg1 as b2Shape);
_local4 = (_arg2 as b2Shape);
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (m_nullContact);
};
if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){
return (m_nullContact);
};
_local7 = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator);
if (_local7 == null){
return (m_nullContact);
};
_local3 = _local7.m_shape1;
_local4 = _local7.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local7.m_prev = null;
_local7.m_next = m_world.m_contactList;
if (m_world.m_contactList != null){
m_world.m_contactList.m_prev = _local7;
};
m_world.m_contactList = _local7;
_local7.m_node1.contact = _local7;
_local7.m_node1.other = _local6;
_local7.m_node1.prev = null;
_local7.m_node1.next = _local5.m_contactList;
if (_local5.m_contactList != null){
_local5.m_contactList.prev = _local7.m_node1;
};
_local5.m_contactList = _local7.m_node1;
_local7.m_node2.contact = _local7;
_local7.m_node2.other = _local5;
_local7.m_node2.prev = null;
_local7.m_node2.next = _local6.m_contactList;
if (_local6.m_contactList != null){
_local6.m_contactList.prev = _local7.m_node2;
};
_local6.m_contactList = _local7.m_node2;
m_world.m_contactCount++;
return (_local7);
}
override public function PairRemoved(_arg1, _arg2, _arg3):void{
var _local4:b2Contact;
if (_arg3 == null){
return;
};
_local4 = (_arg3 as b2Contact);
if (_local4 == m_nullContact){
return;
};
Destroy(_local4);
}
public function Destroy(_arg1:b2Contact):void{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:int;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Array;
var _local10:b2ContactPoint;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2Vec2;
var _local16:b2Vec2;
_local2 = _arg1.m_shape1;
_local3 = _arg1.m_shape2;
_local4 = _arg1.m_manifoldCount;
if ((((_local4 > 0)) && (m_world.m_contactListener))){
_local7 = _local2.m_body;
_local8 = _local3.m_body;
_local9 = _arg1.GetManifolds();
_local10 = s_evalCP;
_local10.shape1 = _arg1.m_shape1;
_local10.shape2 = _arg1.m_shape1;
_local10.friction = _arg1.m_friction;
_local10.restitution = _arg1.m_restitution;
_local11 = 0;
while (_local11 < _local4) {
_local12 = _local9[_local11];
_local10.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local10.position = _local7.GetWorldPoint(_local14.localPoint1);
_local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1);
_local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2);
_local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y));
_local10.separation = _local14.separation;
_local10.id.key = _local14.id._key;
m_world.m_contactListener.Remove(_local10);
_local13++;
};
_local11++;
};
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_world.m_contactList){
m_world.m_contactList = _arg1.m_next;
};
_local5 = _local2.m_body;
_local6 = _local3.m_body;
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local5.m_contactList){
_local5.m_contactList = _arg1.m_node1.next;
};
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local6.m_contactList){
_local6.m_contactList = _arg1.m_node2.next;
};
b2Contact.Destroy(_arg1, m_world.m_blockAllocator);
m_world.m_contactCount--;
}
public function Collide():void{
var _local1:b2Contact;
var _local2:b2Body;
var _local3:b2Body;
_local1 = m_world.m_contactList;
while (_local1) {
_local2 = _local1.m_shape1.m_body;
_local3 = _local1.m_shape2.m_body;
if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){
} else {
_local1.Update(m_world.m_contactListener);
};
_local1 = _local1.m_next;
};
}
}
}//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import flash.display.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
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):void{
var _local4:int;
m_sprite.graphics.lineStyle();
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha);
_local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.endFill();
}
public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
}
public function DrawXForm(_arg1:b2XForm):void{
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale));
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale));
}
public function ClearFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags & ~(_arg1));
}
public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{
m_sprite.graphics.lineStyle();
m_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, _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.Collision.Shapes.*;
import Box2D.Common.Math.*;
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:uint;
var _local18:b2Pair;
var _local19:b2Proxy;
var _local20:b2Proxy;
var _local21:b2Vec2;
var _local22:b2Vec2;
var _local23:b2Proxy;
var _local24:b2PolygonShape;
var _local25:b2OBB;
var _local26:b2Vec2;
var _local27:b2Mat22;
var _local28:b2Vec2;
var _local29: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){
if (_local16._iD == 26){
DrawShape(_local4, _local11, new b2Color((0 / 0xFF), (0 / 0xFF), (0 / 0xFF)), _local15);
} else {
if (_local16._iD == 56){
DrawShape(_local4, _local11, new b2Color((0 / 0xFF), (0xFF / 0xFF), (0xFF / 0xFF)), _local15);
} else {
DrawShape(_local4, _local11, new b2Color((0xFF / 0xFF), (0xFF / 0xFF), (0xFF / 0xFF)), _local15);
};
};
};
continue;
} else {
if (_local3.IsStatic()){
DrawShape(_local4, _local11, new b2Color((0xFF / 0xFF), (0xFF / 0xFF), (0xFF / 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) {
DrawJoint(_local5);
_local5 = _local5.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local6 = m_broadPhase;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.9, 0.3);
_local2 = 0;
while (_local2 < b2Pair.b2_tableCapacity) {
_local17 = _local6.m_pairManager.m_hashTable[_local2];
while (_local17 != b2Pair.b2_nullPair) {
_local18 = _local6.m_pairManager.m_pairs[_local17];
_local19 = _local6.m_proxyPool[_local18.proxyId1];
_local20 = _local6.m_proxyPool[_local18.proxyId2];
_local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value));
_local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value));
_local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value));
_local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value));
_local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local20.lowerBounds[0]].value));
_local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local20.lowerBounds[1]].value));
_local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local20.upperBounds[0]].value));
_local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local20.upperBounds[1]].value));
_local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x));
_local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y));
_local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x));
_local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y));
m_debugDraw.DrawSegment(_local8, _local9, _local10);
_local17 = _local18.next;
};
_local2++;
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local6 = m_broadPhase;
_local21 = _local6.m_worldAABB.lowerBound;
_local22 = _local6.m_worldAABB.upperBound;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.3, 0.9);
_local2 = 0;
while (_local2 < b2Settings.b2_maxProxies) {
_local23 = _local6.m_proxyPool[_local2];
if (_local23.IsValid() == false){
} else {
_local12.lowerBound.x = (_local21.x + (_local7.x * _local6.m_bounds[0][_local23.lowerBounds[0]].value));
_local12.lowerBound.y = (_local21.y + (_local7.y * _local6.m_bounds[1][_local23.lowerBounds[1]].value));
_local12.upperBound.x = (_local21.x + (_local7.x * _local6.m_bounds[0][_local23.upperBounds[0]].value));
_local12.upperBound.y = (_local21.y + (_local7.y * _local6.m_bounds[1][_local23.upperBounds[1]].value));
_local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y);
_local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y);
_local14[2].Set(_local12.upperBound.x, _local12.upperBound.y);
_local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y);
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local2++;
};
_local14[0].Set(_local21.x, _local21.y);
_local14[1].Set(_local22.x, _local21.y);
_local14[2].Set(_local22.x, _local22.y);
_local14[3].Set(_local21.x, _local22.y);
m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9));
};
if ((_local1 & b2DebugDraw.e_obbBit)){
_local10.Set(0.5, 0.3, 0.5);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local4.m_type != b2Shape.e_polygonShape){
} else {
_local24 = (_local4 as b2PolygonShape);
_local25 = _local24.GetOBB();
_local26 = _local25.extents;
_local14[0].Set(-(_local26.x), -(_local26.y));
_local14[1].Set(_local26.x, -(_local26.y));
_local14[2].Set(_local26.x, _local26.y);
_local14[3].Set(-(_local26.x), _local26.y);
_local2 = 0;
while (_local2 < 4) {
_local27 = _local25.R;
_local28 = _local14[_local2];
_local29 = (_local25.center.x + ((_local27.col1.x * _local28.x) + (_local27.col2.x * _local28.y)));
_local14[_local2].y = (_local25.center.y + ((_local27.col1.y * _local28.x) + (_local27.col2.y * _local28.y)));
_local14[_local2].x = _local29;
_local27 = _local11.R;
_local29 = (_local11.position.x + ((_local27.col1.x * _local28.x) + (_local27.col2.x * _local28.y)));
_local14[_local2].y = (_local11.position.y + ((_local27.col1.y * _local28.x) + (_local27.col2.y * _local28.y)));
_local14[_local2].x = _local29;
_local2++;
};
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_centerOfMassBit)){
_local3 = m_bodyList;
while (_local3) {
_local11 = s_xf;
_local11.R = _local3.m_xf.R;
_local11.position = _local3.GetWorldCenter();
m_debugDraw.DrawXForm(_local11);
_local3 = _local3.m_next;
};
};
}
public function DestroyBody(_arg1:b2Body):void{
var _local2:b2JointEdge;
var _local3:b2Shape;
var _local4:b2JointEdge;
var _local5:b2Shape;
if (m_lock == true){
return;
};
_local2 = _arg1.m_jointList;
while (_local2) {
_local4 = _local2;
_local2 = _local2.next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeJoint(_local4.joint);
};
DestroyJoint(_local4.joint);
};
_local3 = _arg1.m_shapeList;
while (_local3) {
_local5 = _local3;
_local3 = _local3.m_next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeShape(_local5);
};
_local5.DestroyProxy(m_broadPhase);
b2Shape.Destroy(_local5, m_blockAllocator);
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_bodyList){
m_bodyList = _arg1.m_next;
};
m_bodyCount--;
}
public function SetContactFilter(_arg1:b2ContactFilter):void{
m_contactFilter = _arg1;
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{
var _local5:b2Color;
var _local6:b2CircleShape;
var _local7:b2Vec2;
var _local8:Number;
var _local9:b2Vec2;
var _local10:int;
var _local11:b2PolygonShape;
var _local12:int;
var _local13:Array;
var _local14:Array;
var _local15:Array;
_local5 = s_coreColor;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local6 = (_arg1 as b2CircleShape);
_local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition);
_local8 = _local6.m_radius;
_local9 = _arg2.R.col1;
m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3);
if (_arg4){
m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5);
};
break;
case b2Shape.e_polygonShape:
_local11 = (_arg1 as b2PolygonShape);
_local12 = _local11.GetVertexCount();
_local13 = _local11.GetVertices();
_local14 = new Array(b2Settings.b2_maxPolygonVertices);
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]);
_local10++;
};
m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3);
if (_arg4){
_local15 = _local11.GetCoreVertices();
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]);
_local10++;
};
m_debugDraw.DrawPolygon(_local14, _local12, _local5);
};
break;
};
}
public function GetContactCount():int{
return (m_contactCount);
}
public function Solve(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Island;
var _local4:b2Contact;
var _local5:b2Joint;
var _local6:int;
var _local7:Array;
var _local8:b2Body;
var _local9:int;
var _local10:int;
var _local11:b2Body;
var _local12:b2ContactEdge;
var _local13:b2JointEdge;
var _local14:Boolean;
m_positionIterationCount = 0;
_local3 = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2 = _local2.m_next;
};
_local4 = m_contactList;
while (_local4) {
_local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag));
_local4 = _local4.m_next;
};
_local5 = m_jointList;
while (_local5) {
_local5.m_islandFlag = false;
_local5 = _local5.m_next;
};
_local6 = m_bodyCount;
_local7 = new Array(_local6);
_local8 = m_bodyList;
while (_local8) {
if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){
} else {
if (_local8.IsStatic()){
} else {
_local3.Clear();
_local9 = 0;
var _temp1 = _local9;
_local9 = (_local9 + 1);
var _local15 = _temp1;
_local7[_local15] = _local8;
_local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag);
while (_local9 > 0) {
--_local9;
_local2 = _local7[_local9];
_local3.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local12 = _local2.m_contactList;
while (_local12) {
if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){
} else {
if (_local12.contact.m_manifoldCount == 0){
} else {
_local3.AddContact(_local12.contact);
_local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag);
_local11 = _local12.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local9;
_local9 = (_local9 + 1);
var _local16 = _temp2;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
};
_local12 = _local12.next;
};
_local13 = _local2.m_jointList;
while (_local13) {
if (_local13.joint.m_islandFlag == true){
} else {
_local3.AddJoint(_local13.joint);
_local13.joint.m_islandFlag = true;
_local11 = _local13.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local9;
_local9 = (_local9 + 1);
_local16 = _temp3;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
_local13 = _local13.next;
};
};
};
_local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep);
if (_local3.m_positionIterationCount > m_positionIterationCount){
m_positionIterationCount = _local3.m_positionIterationCount;
};
_local10 = 0;
while (_local10 < _local3.m_bodyCount) {
_local2 = _local3.m_bodies[_local10];
if (_local2.IsStatic()){
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
};
_local10++;
};
};
};
_local8 = _local8.m_next;
};
_local2 = m_bodyList;
while (_local2) {
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local14 = _local2.SynchronizeShapes();
if ((((_local14 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
};
};
_local2 = _local2.m_next;
};
m_broadPhase.Commit();
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array;
var _local5:int;
var _local6:int;
_local4 = new Array(_arg3);
_local5 = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
_local6 = 0;
while (_local6 < _local5) {
_arg2[_local6] = _local4[_local6];
_local6++;
};
return (_local5);
}
public function SetGravity(_arg1:b2Vec2):void{
m_gravity = _arg1;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local8:b2Island;
var _local9:int;
var _local10:Array;
var _local11:b2Contact;
var _local12:b2Contact;
var _local13:Number;
var _local14:b2Body;
var _local15:int;
var _local16:b2TimeStep;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:b2Body;
var _local21:Boolean;
_local8 = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener);
_local9 = m_bodyCount;
_local10 = new Array(_local9);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2.m_sweep.t0 = 0;
_local2 = _local2.m_next;
};
_local11 = m_contactList;
while (_local11) {
_local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local11 = _local11.m_next;
};
while (true) {
_local12 = null;
_local13 = 1;
_local11 = m_contactList;
for (;_local11;(_local11 = _local11.m_next)) {
if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){
} else {
_local18 = 1;
if ((_local11.m_flags & b2Contact.e_toiFlag)){
_local18 = _local11.m_toi;
} else {
_local3 = _local11.m_shape1;
_local4 = _local11.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){
continue;
};
_local19 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local19 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local19);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local19 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local19);
};
};
_local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep);
if ((((_local18 > 0)) && ((_local18 < 1)))){
_local18 = (((1 - _local18) * _local19) + _local18);
if (_local18 > 1){
_local18 = 1;
};
};
_local11.m_toi = _local18;
_local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){
_local12 = _local11;
_local13 = _local18;
};
};
};
if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){
break;
};
_local3 = _local12.m_shape1;
_local4 = _local12.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local5.Advance(_local13);
_local6.Advance(_local13);
_local12.Update(m_contactListener);
_local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag));
if (_local12.m_manifoldCount == 0){
} else {
_local14 = _local5;
if (_local14.IsStatic()){
_local14 = _local6;
};
_local8.Clear();
_local15 = 0;
var _temp1 = _local15;
_local15 = (_local15 + 1);
var _local22 = _temp1;
_local10[_local22] = _local14;
_local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag);
while (_local15 > 0) {
--_local15;
_local2 = _local10[_local15];
_local8.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local8.m_contactCount == _local8.m_contactCapacity){
} else {
if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){
} else {
if (_local7.contact.m_manifoldCount == 0){
} else {
_local8.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local20 = _local7.other;
if ((_local20.m_flags & b2Body.e_islandFlag)){
} else {
if (_local20.IsStatic() == false){
_local20.Advance(_local13);
_local20.WakeUp();
};
var _temp2 = _local15;
_local15 = (_local15 + 1);
var _local23 = _temp2;
_local10[_local23] = _local20;
_local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local7 = _local7.next;
};
};
};
_local16 = new b2TimeStep();
_local16.dt = ((1 - _local13) * _arg1.dt);
_local16.inv_dt = (1 / _local16.dt);
_local16.maxIterations = _arg1.maxIterations;
_local8.SolveTOI(_local16);
_local17 = 0;
while (_local17 < _local8.m_bodyCount) {
_local2 = _local8.m_bodies[_local17];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local21 = _local2.SynchronizeShapes();
if ((((_local21 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
_local7 = _local2.m_contactList;
while (_local7) {
_local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag));
_local7 = _local7.next;
};
};
};
_local17++;
};
_local17 = 0;
while (_local17 < _local8.m_contactCount) {
_local11 = _local8.m_contacts[_local17];
_local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local17++;
};
m_broadPhase.Commit();
};
};
}
public function GetJointList():b2Joint{
return (m_jointList);
}
public function Validate():void{
m_broadPhase.Validate();
}
public function GetPairCount():int{
return (m_broadPhase.m_pairManager.m_pairCount);
}
public function GetBodyList():b2Body{
return (m_bodyList);
}
public function SetWarmStarting(_arg1:Boolean):void{
m_warmStarting = _arg1;
}
public function SetPositionCorrection(_arg1:Boolean):void{
m_positionCorrection = _arg1;
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local2:b2Joint;
var _local3:b2Body;
var _local4:b2Shape;
_local2 = b2Joint.Create(_arg1, m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_node1.joint = _local2;
_local2.m_node1.other = _local2.m_body2;
_local2.m_node1.prev = null;
_local2.m_node1.next = _local2.m_body1.m_jointList;
if (_local2.m_body1.m_jointList){
_local2.m_body1.m_jointList.prev = _local2.m_node1;
};
_local2.m_body1.m_jointList = _local2.m_node1;
_local2.m_node2.joint = _local2;
_local2.m_node2.other = _local2.m_body1;
_local2.m_node2.prev = null;
_local2.m_node2.next = _local2.m_body2.m_jointList;
if (_local2.m_body2.m_jointList){
_local2.m_body2.m_jointList.prev = _local2.m_node2;
};
_local2.m_body2.m_jointList = _local2.m_node2;
if (_arg1.collideConnected == false){
_local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.RefilterProxy(m_broadPhase, _local3.m_xf);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local2:Boolean;
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Body;
var _local6:b2Shape;
_local2 = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_jointList){
m_jointList = _arg1.m_next;
};
_local3 = _arg1.m_body1;
_local4 = _arg1.m_body2;
_local3.WakeUp();
_local4.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local4.m_jointList){
_local4.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, m_blockAllocator);
m_jointCount--;
if (_local2 == false){
_local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.RefilterProxy(m_broadPhase, _local5.m_xf);
_local6 = _local6.m_next;
};
};
}
public function SetContactListener(_arg1:b2ContactListener):void{
m_contactListener = _arg1;
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
var _local2:b2Body;
if (m_lock == true){
return (null);
};
_local2 = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
public function SetBoundaryListener(_arg1:b2BoundaryListener):void{
m_boundaryListener = _arg1;
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function Step(_arg1:Number, _arg2:int):void{
var _local3:b2TimeStep;
m_lock = true;
_local3 = new b2TimeStep();
_local3.dt = _arg1;
_local3.maxIterations = _arg2;
if (_arg1 > 0){
_local3.inv_dt = (1 / _arg1);
} else {
_local3.inv_dt = 0;
};
_local3.dtRatio = (m_inv_dt0 * _arg1);
_local3.positionCorrection = m_positionCorrection;
_local3.warmStarting = m_warmStarting;
m_contactManager.Collide();
if (_local3.dt > 0){
Solve(_local3);
};
if (((m_continuousPhysics) && ((_local3.dt > 0)))){
SolveTOI(_local3);
};
DrawDebugData();
m_inv_dt0 = _local3.inv_dt;
m_lock = false;
}
public function GetBodyCount():int{
return (m_bodyCount);
}
public function GetJointCount():int{
return (m_jointCount);
}
}
}//package Box2D.Dynamics
Section 75
//GCSWFConnection (gc.utils.GCSWFConnection)
package gc.utils {
import flash.events.*;
import flash.net.*;
public class GCSWFConnection extends EventDispatcher {
protected var _host:Boolean;
protected var _connected:Boolean;
protected var _baseID:String;
public var clientVersion:String;
protected var _callbackObjects:Array;
protected var _lc:LocalConnection;
protected var _version:String;
protected var _myID:String;
protected var _client:Object;
protected var _logName:String;// = "GC-API"
protected var _close:Boolean;
protected var _extID:String;
protected var _queuedMessages:Array;
public static const CONNECTED:String = "CONNECTED";
public function GCSWFConnection(_arg1:String, _arg2:Object, _arg3:String="unknown"){
var connectionID = _arg1;
var client = _arg2;
var version = _arg3;
super();
_connected = false;
_host = true;
_queuedMessages = [];
_close = false;
_client = client;
_version = version;
_baseID = connectionID.split(":").join("");
_lc = new LocalConnection();
_lc.allowDomain("*");
_lc.allowInsecureDomain("*");
_lc.client = this;
_lc.addEventListener(StatusEvent.STATUS, onStatus);
try {
_lc.connect((_baseID + "_HOST"));
} catch(e:ArgumentError) {
_host = false;
};
_myID = (_baseID + (_host) ? "_HOST" : "_CLIENT");
_extID = (_baseID + (_host) ? "_CLIENT" : "_HOST");
if (!_host){
try {
_lc.connect(_myID);
} catch(e:ArgumentError) {
trace((("[" + _logName) + "] [GCSWFConnection] ERROR! Failed to connect"));
};
_lc.send(_extID, "GC_utils_GCSWFConnection_init", _version);
trace((("[" + _logName) + "] [GCSWFConnection] Connected as client.."));
} else {
trace((("[" + _logName) + "] [GCSWFConnection] Connected as host.."));
};
}
protected function bridgeConnected():void{
var _local2:String;
var _local3:Array;
var _local4:Array;
var _local1:int;
while (_local1 < _queuedMessages.length) {
_local2 = _queuedMessages[_local1].methodName;
_local3 = _queuedMessages[_local1].methodArgs;
_local4 = [_local2];
if (_local3){
_local4 = _local4.concat(_local3);
};
send.apply(null, _local4);
_local1++;
};
_queuedMessages = [];
if (_close){
close();
};
}
public function GC_utils_GCSWFConnection_init(_arg1:String):void{
trace((("[" + _logName) + "] [GCSWFConnection] Reccieved Init"));
if (_host){
_lc.send(_extID, "GC_utils_GCSWFConnection_init", _version);
};
_connected = true;
clientVersion = _arg1;
bridgeConnected();
dispatchEvent(new Event(CONNECTED));
}
public function send(_arg1:String, ... _args):void{
if (_connected){
_args.unshift(_arg1);
_args.unshift("GC_utils_GCSWFConnection_receive");
_args.unshift(_extID);
_lc.send.apply(_lc, _args);
} else {
_queuedMessages.push({methodName:_arg1, methodArgs:_args});
};
}
public function get connected():Boolean{
return (_connected);
}
public function get id():String{
return (_baseID);
}
private function onStatus(_arg1:StatusEvent):void{
if (_arg1.level == "error"){
};
}
public function GC_utils_GCSWFConnection_receive(_arg1:String, ... _args):void{
var methodName = _arg1;
var args = _args;
try {
_client[methodName].apply(_client, args);
} catch(e) {
};
}
public function close():void{
trace((("[" + _logName) + "] [GCSWFConnection] Connection Closing"));
if (_queuedMessages.length != 0){
_close = true;
return;
};
try {
_lc.close();
} catch(e) {
};
_lc = null;
_connected = false;
}
}
}//package gc.utils
Section 76
//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 77
//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 78
//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 79
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType == "application"){
return (_local2);
};
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!(clip is DisplayObject)){
trace("Warning: Object passed as container clip not a descendant of the DisplayObject type");
return (null);
};
if (MovieClip(clip).stage == null){
trace("Warning: Container clip for ad is not attached to the stage");
return (null);
};
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
if (!options.skip){
loader.load(req);
};
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_w:Number;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var progress:Number;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}, progress_override:function (_arg1:Object):Number{
return (NaN);
}, bar_offset:0};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
if (options.skip){
ad_timeout = 0;
};
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = (10 + options.bar_offset);
bar.y = (h - 20);
};
bar_w = ((w - bar.x) - 10);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo(bar_w, 0);
backing.lineTo(bar_w, 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo(bar_w, 0);
inside.lineTo(bar_w, 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo(bar_w, 0);
outline.lineTo(bar_w, 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
progress = Math.min(1, options.progress_override(clip));
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
if (!isNaN(progress)){
complete = (progress == 1);
} else {
if (clip.loaderInfo.bytesLoaded == clip.loaderInfo.bytesTotal){
complete = true;
} else {
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Object;
var _local11:Number;
var _local12:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
_local7 = Math.min(1, options.progress_override(_local1));
if (_local7 == 1){
complete = true;
};
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local8 = ((100 * _local6) / _local5);
if (!isNaN(_local7)){
_local8 = (100 * _local7);
};
_local9 = ((100 * _local3) / chk.ad_msec);
_local10 = this._mochiad_bar._inside;
_local11 = Math.min(100, Math.min(((_local8) || (0)), _local9));
_local11 = Math.max(this.last_pcnt, _local11);
this.last_pcnt = _local11;
_local10.scaleX = (_local11 * 0.01);
options.ad_progress(_local11);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local8});
if (_local8 >= 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local12 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local12 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local8 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (unloaded){
MochiAd.unload(_local1);
} else {
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package mochi.as3
Section 80
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_HIDE:String = "StoreHide";
public static const LOGGED_IN:String = "LoggedIn";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
public static const IO_ERROR:String = "IOError";
public static const STORE_ITEMS:String = "StoreItems";
public static const USER_INFO:String = "UserInfo";
public static const LOGIN_SHOW:String = "LoginShow";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const STORE_SHOW:String = "StoreShow";
public static const ITEM_NEW:String = "ItemNew";
public static const ITEM_OWNED:String = "ItemOwned";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const ERROR:String = "Error";
public static const LOGGED_OUT:String = "LoggedOut";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOWN:String = "LoginShown";
public static var _user_info:Object = null;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static var _inventory:MochiInventory;
public static function getUserInfo():void{
MochiServices.send("coins_getUserInfo");
}
public static function requestLogin():void{
MochiServices.send("coins_requestLogin");
}
public static function showItem(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showItem call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("coins_saveUserProperties", _arg1);
}
public static function get loggedIn():Boolean{
return (!((_user_info == null)));
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
if (_arg1 == LOGGED_IN){
_inventory = new MochiInventory();
_user_info = _arg2;
} else {
if (_arg1 == LOGGED_OUT){
if (inventory){
_inventory.release();
_inventory = null;
};
_user_info = null;
};
};
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showLoginWidget", {options:_arg1});
}
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function showStore(_arg1:Object=null):void{
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function hideLoginWidget():void{
MochiServices.send("coins_hideLoginWidget");
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
public static function showVideo(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
}
}//package mochi.as3
Section 81
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function reencode():void{
var _local1:uint;
_local1 = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String;
_local1 = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function get value():Number{
return (Number(this.toString()));
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String;
_local3 = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 82
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
return;
};
for (_local3 in eventTable[_arg1]) {
var _local6 = eventTable[_arg1];
_local6[_local3](_arg2);
};
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
eventTable[_arg1] = [];
return;
};
for (_local3 in eventTable[_arg1]) {
if (eventTable[_arg1][_local3] != _arg2){
} else {
eventTable[_arg1].splice(Number(_local3), 1);
};
};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_arg2);
}
}
}//package mochi.as3
Section 83
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const FORMAT_LONG:String = "LongForm";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const FORMAT_SHORT:String = "ShortForm";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_CENTER:String = "ALIGN_C";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
private static var gameStart:Number;
private static var levelStart:Number;
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{
var _local3:Object;
var _local4:Object;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
_local3.clip = _arg1;
MochiServices.send("events_setNotifications", _local3, null, null);
}
public static function endGame():void{
var _local1:Number;
_local1 = (new Date().time - gameStart);
trigger("end_game", {time:_local1});
}
public static function startGame():void{
gameStart = new Date().time;
trigger("start_game");
}
public static function trigger(_arg1:String, _arg2:Object=null):void{
if (_arg2 == null){
_arg2 = {};
} else {
if (_arg2["kind"] != undefined){
trace("WARNING: optional arguments package contains key 'id', it will be overwritten");
_arg2["kind"] = _arg1;
};
};
MochiServices.send("events_triggerEvent", {eventObject:_arg2}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startLevel():void{
levelStart = new Date().time;
trigger("start_level");
}
public static function endLevel():void{
var _local1:Number;
_local1 = (new Date().time - levelStart);
trigger("end_level", {time:_local1});
}
}
}//package mochi.as3
Section 84
//MochiInventory (mochi.as3.MochiInventory)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
public dynamic class MochiInventory extends Proxy {
private var _timer:Timer;
private var _names:Array;
private var _consumableProperties:Object;
private var _syncID:Number;
private var _outstandingID:Number;
private var _syncPending:Boolean;
public static const READY:String = "InvReady";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
private static const CONSUMER_KEY:String = "MochiConsumables";
public static const WRITTEN:String = "InvWritten";
public static const NOT_READY:String = "InvNotReady";
public static const VALUE_ERROR:String = "InvValueError";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public function MochiInventory():void{
MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems);
MochiCoins.addEventListener(MochiCoins.LOGGED_IN, loggedIn);
MochiCoins.addEventListener(MochiCoins.LOGGED_OUT, loggedOut);
_syncPending = false;
_outstandingID = 0;
_syncID = 0;
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, sync);
_timer.start();
if (MochiCoins.loggedIn){
loggedIn();
} else {
loggedOut();
};
}
private function newItems(_arg1:Object):void{
this[_arg1.id] = (this[_arg1.id] + _arg1.count);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiCoins.removeEventListener(MochiCoins.LOGGED_IN, loggedIn);
MochiCoins.removeEventListener(MochiCoins.LOGGED_OUT, loggedOut);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (false);
};
if (_consumableProperties[_arg1] == undefined){
return (false);
};
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:MochiDigits;
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return;
};
if (!(_arg2 is Number)){
triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2});
return;
};
if (_consumableProperties[_arg1]){
_local3 = MochiDigits(_consumableProperties[_arg1]);
if (_local3.value == _arg2){
return;
};
_local3.value = _arg2;
} else {
_names.push(_arg1);
_consumableProperties[_arg1] = new MochiDigits(_arg2);
};
_syncID++;
}
private function sync(_arg1:Event=null):void{
var _local2:Object;
var _local3:String;
if (((_syncPending) || ((_syncID == _outstandingID)))){
return;
};
_outstandingID = _syncID;
_local2 = {};
for (_local3 in _consumableProperties) {
_local2[_local3] = MochiDigits(_consumableProperties[_local3]).value;
};
MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag);
_syncPending = true;
}
private function putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
if (!_consumableProperties[_arg1]){
return (false);
};
_names.splice(_names.indexOf(_arg1), 1);
delete _consumableProperties[_arg1];
return (true);
}
private function getConsumableBag(_arg1:MochiUserData):void{
var _local2:String;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
return;
};
_consumableProperties = {};
_names = new Array();
if (_arg1.data){
for (_local2 in _arg1.data) {
_names.push(_local2);
_consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]);
};
};
triggerEvent(READY, {});
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 85
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _preserved:Object;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
public static var servicesSync:MochiSync = new MochiSync();
private static var _clip:MovieClip;
private static var _id:String;
private static var _services:String = "services.swf";
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _loader:Loader;
private static var _connecting:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _listenChannelName:String = "__ms_";
public static var onError:Object;
public static var netup:Boolean = true;
private static var _mochiLC:String = "MochiLC.swf";
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function onReceive(_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = _clip._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete _clip._callbacks[cb];
}
public static function get childClip():Object{
return (_clip);
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1));
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local3:Array;
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:MovieClip;
var _local8:LocalConnection;
var _local9:String;
var _local10:ByteArray;
var _local11:ByteArray;
var _local12:uint;
var _local13:uint;
var _local14:Loader;
_local3 = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
_local5 = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
_local6 = [0, 64, 0, 0, 0];
_local7 = new MovieClip();
_local8 = new LocalConnection();
_local9 = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
_local10 = new ByteArray();
_local11 = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
_local12 = ((_local3.length + _local11.length) + 4);
_local13 = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var vars:Object;
var avm1Click:DisplayObject;
var s:String;
var i:Number;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
vars = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
s = "?";
i = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
var _local2:Rectangle;
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
_local2 = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function warnID(_arg1:String, _arg2:Boolean):void{
var _local3:Number;
_arg1 = _arg1.toLowerCase();
if (_arg1.length != 16){
trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length"));
return;
} else {
if (_arg1 == "1e113c7239048b3f"){
if (_arg2){
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
};
return;
} else {
if (_arg1 == "84993a1de4031cd8"){
if (_arg2){
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
};
return;
};
};
};
_local3 = 0;
while (_local3 < _arg1.length) {
switch (_arg1.charAt(_local3)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + _arg1));
return;
};
_local3++;
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_mochiLocalConnection.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.4 as3");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_clip._queue))){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
public static function get id():String{
return (_id);
}
private static function onEvent(_arg1:Object):void{
var _local2:String;
var _local3:String;
_local2 = _arg1.target;
_local3 = _arg1.event;
switch (_local2){
case "events":
MochiEvents.triggerEvent(_arg1.event, _arg1.args);
break;
case "coins":
MochiCoins.triggerEvent(_arg1.event, _arg1.args);
break;
case "sync":
servicesSync.triggerEvent(_arg1.event, _arg1.args);
break;
};
}
private static function urlOptions(_arg1:Object):Object{
var _local2:Object;
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
_local2 = {};
if (_arg1.stage){
_local3 = _arg1.stage.loaderInfo.parameters.mochiad_options;
} else {
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
};
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_clip._queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function loadLCBridge(_arg1:Object):void{
var loader:Loader;
var mochiLCURL:String;
var req:URLRequest;
var complete:Function;
var clip = _arg1;
loader = new Loader();
mochiLCURL = (_servURL + _mochiLC);
req = new URLRequest(mochiLCURL);
complete = function (_arg1:Object):void{
_mochiLocalConnection = MovieClip(loader.content);
listen();
};
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
loader.load(req);
clip.addChild(loader);
}
private static function listen():void{
_mochiLocalConnection.connect(_listenChannelName);
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
trace("Waiting for MochiAds services to connect...");
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var _local3:String;
var _local4:String;
var _local5:URLRequest;
var _local6:URLVariables;
_local3 = ("_mochiservices_com_" + _arg1);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
_local4 = (_servURL + _services);
if (urlOptions(_arg2).servicesURL){
_local4 = urlOptions(_arg2).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(_local4);
_clip = createEmptyMovieClip(_arg2, _local3, 10336, false);
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
_local5 = new URLRequest(_local4);
_local6 = new URLVariables();
_local6.listenLC = _listenChannelName;
_local6.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local6.api_version = getVersion();
if (widget){
_local6.widget = true;
};
_local5.data = _local6;
_loader.load(_local5);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
warnID(id, false);
if ((clip is DisplayObject)){
if (clip.stage == null){
trace("MochiServices connect requires the containing clip be attached to the stage");
};
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function bringToTop(_arg1:Event=null):void{
var e = _arg1;
if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
}
}
}//package mochi.as3
Section 86
//MochiSync (mochi.as3.MochiSync)
package mochi.as3 {
import flash.utils.*;
public dynamic class MochiSync extends Proxy {
private var _syncContainer:Object;
public static var SYNC_PROPERTY:String = "UpdateProperty";
public static var SYNC_REQUEST:String = "SyncRequest";
public function MochiSync():void{
_syncContainer = {};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
switch (_arg1){
case SYNC_REQUEST:
MochiServices.send("sync_syncronize", _syncContainer);
break;
case SYNC_PROPERTY:
_syncContainer[_arg2.name] = _arg2.value;
break;
};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (_syncContainer[_arg1]);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:String;
if (_syncContainer[_arg1] == _arg2){
return;
};
_local3 = _arg1.toString();
_syncContainer[_local3] = _arg2;
MochiServices.send("sync_propUpdate", {name:_local3, value:_arg2});
}
}
}//package mochi.as3
Section 87
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var callback:Function;// = null
public var error:Event;// = null
public var key:String;// = null
public var operation:String;// = null
public var data;// = null
public var _loader:URLLoader;
public function MochiUserData(_arg1:String="", _arg2:Function=null){
key = null;
data = null;
error = null;
operation = null;
callback = null;
super();
this.key = _arg1;
this.callback = _arg2;
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
public function request(_arg1:String, _arg2:ByteArray):void{
var api_url:String;
var api_token:String;
var args:URLVariables;
var req:URLRequest;
var _operation = _arg1;
var _data = _arg2;
operation = _operation;
api_url = MochiCoins.getAPIURL();
api_token = MochiCoins.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
_loader = new URLLoader();
args = new URLVariables();
args.op = _operation;
args.key = key;
req = new URLRequest((((MochiCoins.getAPIURL() + "/") + "MochiUserData?") + args.toString()));
req.method = URLRequestMethod.POST;
req.contentType = "application/x-mochi-userdata";
req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)];
req.data = _data;
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, completeHandler);
_loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
try {
_loader.load(req);
} catch(e:SecurityError) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString())));
};
}
public function completeHandler(_arg1:Event):void{
var event = _arg1;
try {
if (_loader.data.length){
data = deserialize(_loader.data);
} else {
data = null;
};
} catch(e:Error) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString())));
return;
};
if (callback != null){
performCallback();
} else {
dispatchEvent(event);
};
close();
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function getEvent():void{
request("get", serialize(null));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
public function close():void{
if (_loader){
_loader.removeEventListener(Event.COMPLETE, completeHandler);
_loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_loader.close();
_loader = null;
};
error = null;
callback = null;
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public static function get(_arg1:String, _arg2:Function):void{
var _local3:MochiUserData;
_local3 = new MochiUserData(_arg1, _arg2);
_local3.getEvent();
}
public static function put(_arg1:String, _arg2, _arg3:Function):void{
var _local4:MochiUserData;
_local4 = new MochiUserData(_arg1, _arg3);
_local4.putEvent(_arg2);
}
}
}//package mochi.as3
Section 88
//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 89
//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 90
//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 91
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 92
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
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 93
//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 94
//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 95
//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 96
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
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 97
//Test (TestBed.Test)
package TestBed {
import flash.display.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
import flash.media.*;
import General.*;
import flash.utils.*;
public class Test {
public var _classBrickH:Class;
public var _classBrickI:Class;
public var _classBrickL:Class;
public var _classBrickIGlassBR1:Class;
public var _classBrickJ:Class;
public var _classRotatingCrossBlades:Class;
public var _classBrickS:Class;
public var _classBrickT:Class;
public var _classBrickOGlassBR2:Class;
public var _lives:int;// = 1
public var _classBrickZ:Class;
public var _classBrickOGlassBR1:Class;
public var _classSuperLong:Class;
public var _classBrickO:Class;
private var m_twinkleSkip:int;// = 1
public var _classBrickWideCrossG:Class;
public var _timedOut:Boolean;// = false
public var _classBrickBlock:Class;
public var _classBrickIGlassBR2:Class;
public var _classBrickBlockGlassBR1:Class;
public var _classBrickBlockGlassBR2:Class;
public var _tauntTimer:int;// = 0
public var _classBrickOHelium:Class;
public var _classBrickVeryLong:Class;
public var _classBrickRocket:Class;
public var _startFreeze:int;// = 0
public var _classSunHelium:Class;
public var m_iterations:int;// = 15
public var m_blockWidth:Number;// = 40
public var _theEndDiamondsDropped:int;// = 0
public var _selectionList:Array;
public var _playerObjectsAllGone:Boolean;// = false
public var _classBrickBlockGlass:Class;
public var _lootDiamondsAdded:int;// = 0
public var _classBrickAlien:Class;
private var _limitY320x480:Number;// = 0
private var _drawScaleAdder:Number;// = 0
public var _chooseAShapeTimer:int;// = 0
public var _classBrickWacky1:Class;
public var _classBrickWacky2:Class;
public var _classBrickWacky4:Class;
public var m_mouseJoint:b2MouseJoint;
public var _selectionsAngle:Array;
public var _running:Boolean;// = false
public var _classBrickConnect:Class;
public var _classBrickHoleBox:Class;
public var _pointBlocksMax:int;// = 0
public var _classBrickO1T:Class;
private var _currentBlock:int;// = 0
public var _aNewLevelPackIsOpenTimer: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 m_angle:Number;// = 0
public var _bestRedraw:Boolean;// = true
private var _limitY480x320:Number;// = 0
public var _classRotatingCrossBig:Class;
public var _perfectStrikeAdded:int;// = 0
public var _classBrickBlockG:Class;
public var _classBrickHinge:Class;
public var _classBrickWideCross:Class;
private var _getBodyTouchedOthers:Boolean;// = false
public var _classPyramidHelium:Class;
public var m_timeStep:Number;// = 0.00833333333333333
public var _resultDiamondsAdded:int;// = 0
public var _classBrickJesus:Class;
public var _classBrickWacky1Mirror:Class;
public var _makeAsManyShown:Boolean;// = false
public var m_sprite:Sprite;
public var _nextLevelIsOpenTimer:int;// = 0
public var _classBrickConnectMirror:Class;
public var _stabile:Boolean;// = false
public var _lootDiamondsDelay:int;// = 1
public var _classBrickPacman:Class;
public var _playerObjects:int;// = 0
public var _classDiamond1:Class;
public var _classDiamond2:Class;
public var _classDiamond3:Class;
public var _classTriangleRight:Class;
public var _perfectStrikeTimer:int;// = 0
public var _selectionsN:int;// = 0
public var _perfectStrikeSkipper:int;// = 2
public var _theEndDiamondDelay:int;// = 0
public var _classSun:Class;
public var _classSaw2X:Class;
public var _plus1Added:int;// = 0
public var _classBrickKiila:Class;
public var _selectionsX:Array;
public var _classPyramid1T:Class;
public var _waitingDelay:int;// = 20
public var _waiting:Boolean;// = false
public var _classBrickOG:Class;
public var _removed:int;// = 0
public var _selectionsY:Array;
public var _classBrickPoleG:Class;
public var _classBrickPole:Class;
private var _firstRun:Boolean;// = true
public var _makeAsManyTimer:int;// = 0
public var _classBrickHingeBig:Class;
public var _classBrickBlock1T:Class;
public var m_blockHeight:Number;// = 40
public var _diamondsMask:int;// = 0
public var _diamonds:int;// = 0
public var m_world:b2World;
public var _classTriangleLeft:Class;
private var mousePVec:b2Vec2;
public var _diamondsDrawn:int;// = 0
public var _resultDiamondsDelay:int;// = 1
public var m_bomb:b2Body;
public var _classBrickWhoaMirror:Class;
public var _classBrickCrossG:Class;
public var _pointBlocks:int;// = 0
public var _classRotatingCrossBox:Class;
public var _classSaw1:Class;
public var _score:int;// = 0
public var _classSunG:Class;
public var _classBrickHingeVeryBig:Class;
private var _density:Number;// = 10
private var _radius:Number;// = 20
public var _classBrickOGlass:Class;
public var _theEndRunning:Boolean;// = false
public var _classBrickSalmiack:Class;
public var _theEndDiamondsMax:int;// = 0
public var _classBrickCorner:Class;
public var _classBrickHingeVeryBigStraight:Class;
public var _damping:Boolean;// = false
public var _classBrickWhoa:Class;
public var _diamondsOldBest:int;// = 0
public var _classRotatingCross:Class;
public var _classBrickBlockHelium:Class;
public var _classBrickCross:Class;
public var _classBrickCornerLong:Class;
public var _stabileCounter:int;// = 20
public var _dampTimerLeft:int;// = 9999
public var _classBrickIGlass:Class;
private var m_randomPointX:Number;
private var m_randomPointY:Number;
private static const C_MRGN:Number = 0.2;
public static var m_debugDraw:b2DebugDraw = null;
public static var m_physScale:Number = 20;
public static var mouseYWorldPhys:Number;
public static var mouseXWorldPhys:Number;
public static var m_goalScale:Number = 1.5;
public static var mouseYWorld:Number;
public static var _friction:Number = 0.8;
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;
_classDiamond1 = Test__classDiamond1;
_classDiamond2 = Test__classDiamond2;
_classDiamond3 = Test__classDiamond3;
_classBrickSalmiack = Test__classBrickSalmiack;
_classSaw1 = Test__classSaw1;
_classSaw2X = Test__classSaw2X;
_classBrickConnect = Test__classBrickConnect;
_classBrickConnectMirror = Test__classBrickConnectMirror;
_classBrickWideCross = Test__classBrickWideCross;
_classBrickWideCrossG = Test__classBrickWideCrossG;
_classBrickRocket = Test__classBrickRocket;
_classBrickPacman = Test__classBrickPacman;
_classBrickH = Test__classBrickH;
_classBrickHinge = Test__classBrickHinge;
_classBrickHingeBig = Test__classBrickHingeBig;
_classBrickHingeVeryBig = Test__classBrickHingeVeryBig;
_classBrickHingeVeryBigStraight = Test__classBrickHingeVeryBigStraight;
_classBrickI = Test__classBrickI;
_classBrickT = Test__classBrickT;
_classBrickO = Test__classBrickO;
_classBrickOG = Test__classBrickOG;
_classBrickS = Test__classBrickS;
_classBrickZ = Test__classBrickZ;
_classBrickL = Test__classBrickL;
_classBrickJ = Test__classBrickJ;
_classBrickBig = Test__classBrickBig;
_classBrickCross = Test__classBrickCross;
_classBrickCrossG = Test__classBrickCrossG;
_classBrickVeryLong = Test__classBrickVeryLong;
_classBrickAlien = Test__classBrickAlien;
_classBrickWhoa = Test__classBrickWhoa;
_classBrickWhoaMirror = Test__classBrickWhoaMirror;
_classBrickBlock = Test__classBrickBlock;
_classBrickBlockG = Test__classBrickBlockG;
_classBrickCorner = Test__classBrickCorner;
_classBrickCornerLong = Test__classBrickCornerLong;
_classBrickJesus = Test__classBrickJesus;
_classBrickWacky1 = Test__classBrickWacky1;
_classBrickWacky1Mirror = Test__classBrickWacky1Mirror;
_classBrickWacky2 = Test__classBrickWacky2;
_classBrickWacky4 = Test__classBrickWacky4;
_classBrickWacky4Mirror = Test__classBrickWacky4Mirror;
_classBrickPole = Test__classBrickPole;
_classBrickPoleG = Test__classBrickPoleG;
_classSuperLong = Test__classSuperLong;
_classTriangleLeft = Test__classTriangleLeft;
_classTriangleRight = Test__classTriangleRight;
_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;
_classBrickIGlass = Test__classBrickIGlass;
_classBrickIGlassBR1 = Test__classBrickIGlassBR1;
_classBrickIGlassBR2 = Test__classBrickIGlassBR2;
_classBrickOGlass = Test__classBrickOGlass;
_classBrickOGlassBR1 = Test__classBrickOGlassBR1;
_classBrickOGlassBR2 = Test__classBrickOGlassBR2;
_classBrickBlockGlass = Test__classBrickBlockGlass;
_classBrickBlockGlassBR1 = Test__classBrickBlockGlassBR1;
_classBrickBlockGlassBR2 = Test__classBrickBlockGlassBR2;
_classBrickKiila = Test__classBrickKiila;
_classBrickHoleBox = Test__classBrickHoleBox;
_classRotatingCross = Test__classRotatingCross;
_classRotatingCrossBig = Test__classRotatingCrossBig;
_classRotatingCrossBlades = Test__classRotatingCrossBlades;
_classRotatingCrossBox = Test__classRotatingCrossBox;
_removed = 0;
_score = 0;
_lives = 1;
m_blockWidth = 40;
m_blockHeight = 40;
m_twinkleSkip = 1;
_density = 10;
_running = false;
_timedOut = false;
_makeAsManyShown = false;
_makeAsManyTimer = 0;
m_mouseBody = null;
m_angle = 0;
_waiting = false;
_firstRun = true;
_currentBlock = 0;
_radius = 20;
_drawScaleAdder = 0;
_theEndDiamondsDropped = 0;
_theEndDiamondsMax = 0;
_theEndDiamondDelay = 0;
_theEndRunning = false;
_startFreeze = 0;
_perfectStrikeTimer = 0;
_perfectStrikeAdded = 0;
_perfectStrikeSkipper = 2;
_waitingDelay = 20;
_bestRedraw = true;
_nextLevelIsOpenTimer = 0;
_aNewLevelPackIsOpenTimer = 0;
_stabileCounter = 20;
_stabile = false;
_selectionList = new Array();
_selectionsN = 0;
_selectionsX = new Array();
_selectionsY = new Array();
_selectionsAngle = new Array();
_diamonds = 0;
_diamondsMask = 0;
_diamondsOldBest = 0;
_diamondsDrawn = 0;
_plus1Added = 0;
_resultDiamondsDelay = 1;
_resultDiamondsAdded = 0;
_lootDiamondsDelay = 1;
_lootDiamondsAdded = 0;
_tauntTimer = 0;
_playerObjects = 0;
_playerObjectsAllGone = false;
_chooseAShapeTimer = 0;
_damping = false;
_dampTimerLeft = 9999;
_limitY320x480 = 0;
_limitY480x320 = 0;
m_iterations = 15;
m_timeStep = (1 / 120);
mousePVec = new b2Vec2();
_getBodyTouchedOthers = false;
_pointBlocksMax = 0;
_pointBlocks = 0;
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 = 1;
_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 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);
}
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);
}
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 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);
}
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 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 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 coverInDust(_arg1:b2Body, _arg2:Number=1):void{
var _local3:b2XForm;
var _local4:b2Vec2;
var _local5:b2Shape;
_local3 = _arg1.GetXForm();
_local4 = _arg1.GetPosition();
_local5 = _arg1.GetShapeList();
while (_local5 != null) {
coverInDustShape(_local5, _local4, _local3, _arg2);
_local5 = _local5.GetNext();
};
}
public function addBoxGlass(_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 = 72;
_local6.m_userData._glass = true;
_local6.m_userData._hitpoints = (20 * 20);
_local9 = new Bitmap(new _classBrickOGlass().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
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 DestroyBodies():void{
var _local1:b2Body;
_local1 = m_world.m_bodyList;
while (_local1) {
if (((!((_local1.m_userData == null))) && ((_local1.m_userData._iD >= 0)))){
DestroyBody(_local1);
};
_local1 = _local1.m_next;
};
}
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 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):void{
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:b2CircleShape;
var _local9:Number;
var _local10:int;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Particle;
var _local17:b2PolygonShape;
var _local18:int;
var _local19:Array;
var _local20:Array;
var _local21:int;
var _local22:b2Vec2;
_local5 = _arg1.GetType();
if (_local5 == b2Shape.e_circleShape){
_local8 = (_arg1 as b2CircleShape);
_local9 = _local8.GetRadius();
_local10 = ((((_local8.GetRadius() * _local9) * 0x0100) * _arg4) * Main.getQualityMultiplier());
_local11 = b2Math.b2MulX(_arg3, _local8.GetLocalPosition());
b2Math.b2MulX(_arg3, _local8.GetLocalPosition()).x = (_local11.x * m_debugDraw.m_drawScale);
_local11.y = (_local11.y * m_debugDraw.m_drawScale);
_local6 = 0;
while (_local6 < _local10) {
_local12 = (Math.random() * _local9);
_local13 = ((Math.random() * Math.PI) * 2);
_local14 = ((Math.cos(_local13) * _local12) * m_debugDraw.m_drawScale);
_local15 = ((Math.sin(_local13) * _local12) * m_debugDraw.m_drawScale);
_local16 = Main.m_particleManager.addParticle(Particle.PARTICLE_TYPE_EXPLOSION, ((_local11.x + _local14) + 300), (_local11.y + _local15), 0xFFFFFF);
if (_local16 != null){
_local16._life = (_local16._life + (Math.random() * 10));
_local16._speedX = (_local14 * 0.1);
_local16._speedY = (_local15 * 0.1);
};
_local6++;
};
} else {
if (_local5 == b2Shape.e_polygonShape){
_local17 = (_arg1 as b2PolygonShape);
_local18 = _local17.GetVertexCount();
_local19 = _local17.GetVertices();
_local20 = new Array(b2Settings.b2_maxPolygonVertices);
_local6 = 0;
while (_local6 < _local18) {
_local20[_local6] = b2Math.b2MulX(_arg3, _local19[_local6]);
_local6++;
};
_local21 = (_local18 - 2);
_local22 = new b2Vec2();
_local22.x = (_arg2.x * m_debugDraw.m_drawScale);
_local22.y = (_arg2.y * m_debugDraw.m_drawScale);
_local6 = 0;
while (_local6 < _local21) {
_local10 = ((getParticlesInsideTriangle(_local20[0], _local20[(_local6 + 1)], _local20[(_local6 + 2)]) * _arg4) * Main.getQualityMultiplier());
_local7 = 0;
while (_local7 < _local10) {
getRandomPointInTriangle(_local20[0], _local20[(_local6 + 1)], _local20[(_local6 + 2)]);
m_randomPointX = (m_randomPointX * m_debugDraw.m_drawScale);
m_randomPointY = (m_randomPointY * m_debugDraw.m_drawScale);
_local14 = ((m_randomPointX - _local22.x) * 0.1);
_local15 = ((m_randomPointY - _local22.y) * 0.1);
_local16 = Main.m_particleManager.addParticle(Particle.PARTICLE_TYPE_EXPLOSION, (m_randomPointX + 300), m_randomPointY, 0xFFFFFF);
if (_local16 != null){
_local16._life = (_local16._life + (Math.random() * 10));
_local16._speedX = _local14;
_local16._speedY = _local15;
};
_local7++;
};
_local6++;
};
};
};
}
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);
}
public function addPyramidMini(_arg1:Number=0, _arg2:Boolean=true, _arg3:Number=-10000, _arg4:Number=-10000):b2Body{
trace("addPyramidMini() IS NOT IMPLEMENTED!!!");
return (null);
}
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);
}
public function addBlockGlass(_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 = 73;
_local6.m_userData._glass = true;
_local6.m_userData._hitpoints = (40 * 40);
_local9 = new Bitmap(new _classBrickBlockGlass().bitmapData);
_local9.x = -11405;
_local9.y = 10;
_local9.smoothing = true;
m_sprite.addChild(_local9);
_local6.m_userData._sprite = _local9;
return (_local6);
}
public function addBallGeneral(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int, _arg5:Number, _arg6:Boolean, _arg7:int=0):b2Body{
var _local8:Number;
var _local9:b2BodyDef;
var _local10:b2Body;
var _local11:b2CircleDef;
var _local12:UserData;
_local8 = 20;
_local9 = new b2BodyDef();
_local9.isSleeping = false;
_local9.position.Set(_arg2, _arg3);
if (_arg4 >= 0){
_local12 = new UserData();
_local12._iD = _arg4;
_local12._radius = _arg1;
_local9.userData = _local12;
};
_local10 = m_world.CreateBody(_local9);
_local11 = new b2CircleDef();
_local11.isSensor = _arg6;
_local11.radius = (_arg1 / _local8);
_local11.density = _arg5;
_local11.friction = _friction;
_local11.restitution = 0.1;
_local10.CreateShape(_local11);
_local10.SetMassFromShapes();
return (_local10);
}
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;
_local6.m_userData._isPlayerObject = false;
_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{
if (((!((_arg1.m_userData == null))) && (!((_arg1.m_userData._sprite == null))))){
m_sprite.removeChild(_arg1.m_userData._sprite);
_arg1.m_userData._sprite = null;
};
if (((!((_arg1.m_userData == null))) && (!((_arg1.m_userData._spriteShadow == null))))){
m_sprite.removeChild(_arg1.m_userData._spriteShadow);
_arg1.m_userData._spriteShadow = null;
};
if (((!((_arg1.m_userData == null))) && (!((_arg1.m_userData._object == null))))){
m_world.DestroyJoint(_arg1.m_userData._object);
};
m_world.DestroyBody(_arg1);
}
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:Number;
var _local24:Number;
var _local25:Number;
var _local26:Boolean;
var _local27:UserData;
_local10 = 0;
_local18 = 1;
_local19 = 1;
_local20 = 1;
_local21 = 1;
_local22 = -1;
_local26 = true;
if (_arg1 != null){
_local27 = _arg1.m_userData;
_local13 = _arg1.GetPosition().x;
_local14 = _arg1.GetPosition().y;
_local11 = _arg1.GetAngle();
_local12 = _local27._radius;
_local17 = _local27._iD;
_local15 = _local27._width;
_local16 = _local27._height;
_local18 = _local27._scale;
_local19 = _local27._width;
_local20 = _local27._height;
_local21 = _local27._alpha;
_local22 = _local27._currentBlock;
_local26 = _local27._pointBlock;
_local23 = _local27._startX;
_local24 = _local27._startY;
_local25 = _local27._startAngle;
} else {
_local13 = _arg8;
_local14 = _arg9;
_local11 = _arg5;
_local12 = _arg4;
_local17 = _arg3;
_local15 = _arg6;
_local16 = _arg7;
_local19 = _local15;
_local20 = _local16;
_local23 = _local13;
_local24 = _local14;
_local25 = _arg5;
};
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 == 26){
_arg1 = addTargetArea(_local10, true, _local13, _local14, _local12);
} 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 = addBoxGlass(_local10, _arg2, _local13, _local14);
_local22 = 68;
} else {
if (_local17 == 73){
_arg1 = addBlockGlass(_local10, _arg2, _local13, _local14);
_local22 = 69;
} else {
if (_local17 == 74){
_arg1 = addLongGlass(_local10, _arg2, _local13, _local14);
_local22 = 70;
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
_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;
_arg1.m_userData._startX = _local23;
_arg1.m_userData._startY = _local24;
_arg1.m_userData._startAngle = _local25;
_arg1.m_userData._pointBlock = _local26;
CreateShadowSprite(_arg1.m_userData);
trace(((((("_startX = " + _local23) + " _startY = ") + _local24) + " startAngle = ") + _local25));
return (_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 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);
}
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;
_local7.m_userData._isPlayerObject = false;
_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 RepaintSprite(_arg1:UserData):void{
var _local2:BitmapData;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:uint;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
if ((((((_arg1 == null)) || ((_arg1._sprite == null)))) || (_arg1._pointBlock))){
return;
};
_local2 = _arg1._sprite.bitmapData;
_local3 = _local2.width;
_local4 = _local2.height;
_local5 = 0;
while (_local5 < _local4) {
_local6 = 0;
while (_local6 < _local3) {
_local7 = _local2.getPixel32(_local6, _local5);
_local8 = ((_local7 >> 16) & 0xFF);
_local9 = ((_local7 >> 8) & 0xFF);
_local10 = (_local7 & 0xFF);
_local11 = (((0.3 * _local8) + (0.59 * _local9)) + (0.11 * _local10));
if (_local11 > 0xFF){
_local11 = 0xFF;
};
_local7 = (_local7 & 4278190080);
_local7 = (_local7 | (((_local11 << 16) | (_local11 << 8)) | _local11));
_local2.setPixel32(_local6, _local5, _local7);
_local6++;
};
_local5++;
};
}
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);
}
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 UpdateMouseWorld():void{
mouseXWorldPhys = (Input.mousseX / m_debugDraw.m_drawScale);
mouseYWorldPhys = (Input.mousseY / m_debugDraw.m_drawScale);
mouseXWorld = Input.mousseX;
mouseYWorld = Input.mousseY;
}
private function changeSprite(_arg1:UserData, _arg2:Bitmap):void{
var _local3:Bitmap;
_local3 = _arg1._sprite;
_arg2.x = _local3.x;
_arg2.y = _local3.y;
_arg2.scaleX = _local3.scaleX;
_arg2.scaleY = _local3.scaleY;
_arg2.alpha = _local3.alpha;
_arg2.rotation = _local3.rotation;
_arg2.smoothing = true;
m_sprite.addChild(_arg2);
m_sprite.removeChild(_local3);
_arg1._sprite = _arg2;
BringSpritesOnTop();
}
private function calculateIPhoneDottedLineLimits():void{
_limitY320x480 = (-((240 - 110)) / m_debugDraw.m_drawScale);
_limitY480x320 = (-(((160 - 110) + 20)) / 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);
}
public function addLongGlass(_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 = 74;
_local6.m_userData._glass = true;
_local6.m_userData._hitpoints = (40 * 10);
_local9 = new Bitmap(new _classBrickIGlass().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):void{
var items:Array;
var i:int;
var tX:Number;
var tY:Number;
var iPhone:int;
var scaleIPhone:Number;
var iD:int;
var radius:Number;
var width:Number;
var height:Number;
var slippery:int;
var angle:Number;
var body:b2Body;
var sensor:Boolean;
var s = _arg1;
DestroyBodies();
_waiting = false;
_stabile = false;
_startFreeze = 0;
_stabileCounter = 20;
items = s.split(" ");
if ((((items == null)) || ((items.length < 2)))){
return;
};
i = 0;
while (i < items.length) {
if (items[i] == "<level>"){
break;
};
trace(("item " + items[i]));
i = (i + 1);
};
trace(((i + " & ") + items.length));
if (i >= items.length){
i = -1;
};
i = (i + 1);
i = (i + 1);
m_debugDraw.m_drawScale = Number(items[i]);
i = (i + 1);
_drawScaleAdder = Number(items[i]);
trace("************************* LEVEL LOADED ************************");
trace(((((" setScaling(" + m_debugDraw.m_drawScale) + ", ") + _drawScaleAdder) + "); // m_debugDraw.m_drawScale, _drawScaleAdder"));
i = (i + 1);
iPhone = int(items[i]);
calculateIPhoneDottedLineLimits();
trace(((" setOrientation(" + iPhone) + "); // 0 - 600x500, 1 - 320x480, 2 - 480x320"));
trace(" b2Body* body;");
trace(" b2Vec2 pos;");
scaleIPhone = ((10 / 8) * (m_debugDraw.m_drawScale / 20));
trace(((" setScaling(" + (m_debugDraw.m_drawScale / 20)) + ");"));
try {
while (i < items.length) {
i = (i + 1);
iD = int(items[i]);
radius = 1;
width = 30;
height = 30;
if (iD == 1000){
i = (i + 1);
m_goalScale = Number(items[i]);
} else {
if (iD == 1001){
i = (i + 1);
slippery = int(items[i]);
} else {
if ((((iD < 26)) || ((iD >= 29)))){
if ((((((((((((((((((iD == 20)) || ((iD == 34)))) || ((iD == 41)))) || ((iD == 44)))) || ((iD == 46)))) || ((iD == 50)))) || ((iD == 52)))) || ((iD == 56)))) || ((iD == 71)))){
i = (i + 1);
radius = Number(items[i]);
};
i = (i + 1);
tX = Number(items[i]);
i = (i + 1);
tY = Number(items[i]);
i = (i + 1);
angle = Number(items[i]);
body = cloneBody(null, false, iD, radius, 0, 30, 30, tX, tY);
body.SetXForm(new b2Vec2(tX, tY), angle);
body.m_userData._startX = tX;
body.m_userData._startY = tY;
body.m_userData._startAngle = angle;
sensor = isIPhoneSleeping(tY);
radius = (radius * scaleIPhone);
tX = (tX * scaleIPhone);
tY = (tY * scaleIPhone);
angle = (angle * -1);
if ((((((iD == 4)) || ((iD == 5)))) || ((iD == 3)))){
angle = (angle + Math.PI);
} else {
if ((((iD == 13)) || ((iD == 29)))){
angle = (angle - (Math.PI * 0.5));
};
};
trace(((((((((((((" body = cloneBody(NULL, " + sensor) + ", ") + iD) + ", ") + radius) + ", ") + angle) + ", 1, 1, ") + tX) + ", ") + -(tY)) + ");"));
trace(((((((" pos.x = " + tX) + "; pos.y = ") + -(tY)) + "; body->SetXForm(pos, ") + angle) + ");"));
} else {
if (iD == 27){
i = (i + 1);
radius = Number(items[i]);
i = (i + 1);
tX = Number(items[i]);
i = (i + 1);
tY = Number(items[i]);
body = cloneBody(null, false, iD, radius, 0);
body.SetXForm(new b2Vec2(tX, tY), 0);
radius = (radius * scaleIPhone);
tX = (tX * scaleIPhone);
tY = (tY * scaleIPhone);
trace(((((" body = cloneBody(NULL, false, " + iD) + ", ") + radius) + ", 0.0);"));
trace(((((" pos.x = " + tX) + "; pos.y = ") + -(tY)) + "; body->SetXForm(pos, 0.0);"));
} else {
if (iD == 28){
i = (i + 1);
tX = Number(items[i]);
i = (i + 1);
tY = Number(items[i]);
i = (i + 1);
width = Number(items[i]);
i = (i + 1);
height = Number(items[i]);
i = (i + 1);
angle = Number(items[i]);
body = cloneBody(null, false, iD, 0, 0, width, height);
body.SetXForm(new b2Vec2(tX, tY), angle);
radius = (radius * scaleIPhone);
tX = (tX * scaleIPhone);
tY = (tY * scaleIPhone);
width = (width * scaleIPhone);
height = (height * scaleIPhone);
angle = (angle * -1);
trace(((((((" body = cloneBody(NULL, false, " + iD) + ", 0.0, 0.0, ") + width) + ", ") + height) + ");"));
trace(((((((" pos.x = " + tX) + "; pos.y = ") + -(tY)) + "; body->SetXForm(pos, ") + angle) + ");"));
};
};
};
};
};
};
} catch(error:Error) {
};
Update(true);
RepaintNonPlayerObjects();
BringSpritesOnTop();
trace(" setScaling(1.0f);");
}
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);
m_sprite.addChild(_local6.m_userData._sprite);
return (_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;
_local7.m_userData._isPlayerObject = false;
_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);
m_sprite.addChild(_local6.m_userData._sprite);
_local6.m_userData._1T = true;
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;
_local7.m_userData._isPlayerObject = false;
_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 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);
}
public function Update(_arg1:Boolean, _arg2:Boolean=false, _arg3:int=60):void{
var _local4:Number;
var _local5:uint;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:b2Body;
var _local13:Number;
var _local14:Number;
var _local15:b2Body;
var _local16:b2Vec2;
var _local17:b2Body;
var _local18:UserData;
var _local19:b2Vec2;
var _local20:Boolean;
var _local21:b2Body;
var _local22:b2Vec2;
var _local23:Number;
var _local24:Bitmap;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Bitmap;
var _local30:int;
if (!_arg1){
return;
};
if (_firstRun){
_firstRun = false;
_local12 = m_world.m_bodyList;
while (_local12) {
_local12.WakeUp();
_local12 = _local12.m_next;
};
};
if (((_arg2) && (_theEndRunning))){
_theEndDiamondDelay++;
if (_theEndDiamondDelay >= 10){
_theEndDiamondDelay = 0;
if (_theEndDiamondsDropped < _theEndDiamondsMax){
_theEndDiamondsDropped++;
_local13 = (7 + (Math.random() * 9));
cloneBody(null, false, 34, _local13, 0, 0, 0, 0, -15);
BringSpritesOnTop();
};
};
};
if (((((Input.isKeyPressed(65)) || (Input.isKeyPressed(37)))) || ((Main.s_mouseWheel > 0)))){
if (m_mouseBody != null){
m_angle = (m_angle - (Math.PI * 0.25));
Main._playRotate = m_mouseBody.m_userData._iD;
};
Main.s_mouseWheel = 0;
_local14 = (m_angle / (Math.PI * 0.25));
m_angle = ((_local14 * Math.PI) * 0.25);
};
if (((((Input.isKeyPressed(68)) || (Input.isKeyPressed(39)))) || ((Main.s_mouseWheel < 0)))){
if (m_mouseBody != null){
m_angle = (m_angle + (Math.PI * 0.25));
Main._playRotate = m_mouseBody.m_userData._iD;
};
Main.s_mouseWheel = 0;
_local14 = (m_angle / (Math.PI * 0.25));
m_angle = ((_local14 * Math.PI) * 0.25);
};
while (m_angle < (-(Math.PI) * 2)) {
m_angle = (m_angle + (Math.PI * 2));
};
while (m_angle > (Math.PI * 2)) {
m_angle = (m_angle - (Math.PI * 2));
};
Main.m_sprite.x = (600 * 0.5);
Main.m_sprite.y = (500 * 0.5);
m_debugDraw.m_drawScale = (20 + _drawScaleAdder);
UpdateMouseWorld();
if (m_mouseBody != null){
m_mouseBody.SetXForm(new b2Vec2((Input.mousseX / m_debugDraw.m_drawScale), (Input.mousseY / m_debugDraw.m_drawScale)), m_angle);
m_mouseBody.m_angularVelocity = 0;
m_mouseBody.m_linearVelocity.x = 0;
m_mouseBody.m_linearVelocity.y = 0;
m_mouseBody.m_force.x = 0;
m_mouseBody.m_force.y = 0;
m_mouseBody.m_userData._isTouching = false;
};
_local4 = (60 / _arg3);
_local5 = getTimer();
m_world.Step((m_timeStep * _local4), m_iterations);
Main.m_fpsCounter.updatePhys(_local5);
if (((Input.mousePressed) && (!((m_mouseBody == null))))){
Input.mousePressed = false;
if (((isIPhoneSleeping(m_mouseBody.GetPosition().y)) && (!(_arg2)))){
if (!m_mouseBody.GetShapeList().IsSensor()){
_local21 = cloneBody(m_mouseBody, true, m_mouseBody.m_userData._iD);
DestroyBody(m_mouseBody);
m_mouseBody = _local21;
};
m_mouseBody.PutToSleep();
m_mouseBody.SetXForm(new b2Vec2(m_mouseBody.m_userData._startX, m_mouseBody.m_userData._startY), m_mouseBody.m_userData._startAngle);
m_mouseBody = null;
Main._playReturnShape = 1;
} else {
if (((!(m_mouseBody.IsStatic())) && (isCollidingTestGeometry(m_mouseBody)))){
Main._playBadPickup = 1;
} else {
_local15 = cloneBody(m_mouseBody, false);
DestroyBody(m_mouseBody);
m_mouseBody = null;
m_angle = 0;
if (!_arg2){
RepaintSprite(_local15.m_userData);
};
_local15.WakeUp();
BringSpritesOnTop();
};
};
};
if (((((Input.mousePressed) && ((m_mouseBody == null)))) && ((_lives > 0)))){
_local15 = GetBodyAtMouse(true, _arg2);
if (_getBodyTouchedOthers){
Main._playBadPickup = 1;
};
if (((_waiting) && (!((_local15 == null))))){
} else {
if (_local15 != null){
_local16 = _local15.GetPosition();
if (((_arg2) || (isIPhoneSleeping(_local16.y)))){
m_mouseBody = cloneBody(_local15, true);
m_mouseBody.SetXForm(_local15.GetPosition(), _local15.GetAngle());
m_angle = _local15.GetAngle();
DestroyBody(_local15);
BringSpritesOnTop();
if (m_mouseBody.m_userData._sprite != null){
m_sprite.removeChild(m_mouseBody.m_userData._sprite);
m_sprite.addChild(m_mouseBody.m_userData._sprite);
};
Main._playOn = true;
Main._playGrabShape = 1;
_running = true;
};
};
};
};
if (((_waiting) && (!((m_mouseBody == null))))){
coverInDust(m_mouseBody);
DestroyBody(m_mouseBody);
m_mouseBody = null;
};
_local6 = 0;
_local7 = 0;
_local8 = 0;
_local9 = 0;
_local10 = (Math.random() * _pointBlocks);
_local11 = 0;
_stabile = true;
_local12 = m_world.m_bodyList;
while (_local12 != null) {
_local17 = _local12.m_next;
if (_local12.m_userData != null){
_local18 = _local12.m_userData;
_local19 = _local12.GetPosition();
if (_local18._isPlayerObject){
_local8++;
};
if (_local18._pointBlock){
if (_local11 == _local10){
twinkleBody(_local12);
};
_local11++;
};
if (_local12.m_shapeList.IsSensor()){
if (_startFreeze < 2){
_local18._pointBlock = false;
};
_local12.PutToSleep();
} else {
calculateIPhoneDottedLineLimits();
if (_startFreeze < 2){
if (((!((m_mouseBody == _local12))) && (isIPhoneSleeping(_local19.y)))){
_local18._pointBlock = false;
if (!_local12.GetShapeList().IsSensor()){
_local21 = cloneBody(_local12, true, _local18._iD);
DestroyBody(_local12);
_local12 = _local21;
_local18 = _local12.m_userData;
};
_local12.PutToSleep();
} else {
if (((!(_local12.IsStatic())) && (_local18._isPlayerObject))){
_local18._pointBlock = true;
} else {
_local18._pointBlock = false;
};
_local12.WakeUp();
};
if (!_local18._isPlayerObject){
_local18._pointBlock = false;
};
};
};
if (_damping){
_local22 = _local12.GetLinearVelocity();
if (_local22.Length() < 0.25){
_local22.x = (_local22.x * 0.95);
_local22.y = (_local22.y * 0.95);
};
_local12.SetLinearVelocity(_local22);
_local23 = _local12.GetAngularVelocity();
if (Math.abs(_local23) < 0.025){
_local12.SetAngularVelocity((_local23 * 0.95));
};
};
if (_local18._sprite != null){
_local24 = _local18._sprite;
_local24.rotation = 0;
_local25 = _local12.GetAngle();
_local26 = (m_debugDraw.m_drawScale / 20);
_local27 = (_local19.x * m_debugDraw.m_drawScale);
_local28 = (_local19.y * m_debugDraw.m_drawScale);
if (_local18._iD == 26){
_local26 = (_local26 * m_goalScale);
};
if (!_local18._scaleFixed){
_local18._scaleFixed = true;
_local18._scale = (_local18._scale * 1.02);
};
_local24.scaleX = (_local26 * _local18._scale);
_local24.scaleY = (_local26 * _local18._scale);
rot(_local24, _local27, _local28, ((_local25 * 180) / Math.PI), (-(_local24.width) * 0.5), (-(_local24.height) * 0.5));
_local18._spriteX = _local27;
_local18._spriteY = _local28;
if (_local12.m_shapeList.IsSensor()){
_local18._sprite.alpha = (0.8 * _local18._alpha);
} else {
_local18._sprite.alpha = _local18._alpha;
};
if (_local18._spriteShadow != null){
_local29 = _local18._spriteShadow;
_local29.scaleX = _local24.scaleX;
_local29.scaleY = _local24.scaleY;
_local29.x = (_local24.x + _local18._shadowOffsetX);
_local29.y = (_local24.y + _local18._shadowOffsetY);
_local29.rotation = _local24.rotation;
_local29.alpha = (_local18._sprite.alpha * 0.3);
};
};
if (_local18._isPlayerObject){
if ((((_local12.GetLinearVelocity().Length() > 0.1)) || ((Math.abs(_local12.GetAngularVelocity()) > 0.003)))){
_stabile = false;
};
if (_local12.GetShapeList().IsSensor()){
_local7++;
};
if (_local18._pointBlock){
_local6++;
};
};
if (_local18._glass){
runGlassSprite(_local12, _local18);
};
_local20 = false;
if (_arg2){
if (_local19.y > (250 / m_debugDraw.m_drawScale)){
_local20 = true;
};
} else {
if ((((((((_local19.y > (250 / m_debugDraw.m_drawScale))) || ((_local19.y < (-250 / m_debugDraw.m_drawScale))))) || ((_local19.x > (300 / m_debugDraw.m_drawScale))))) || ((_local19.x < (-300 / m_debugDraw.m_drawScale))))){
_local20 = true;
};
};
if (_local20){
_local30 = 1;
if ((((_local18._iD < 100)) && (!(_arg2)))){
if (_local18._pointBlock){
if (Main.m_this.addPlus1(_local18, -10)){
_local30 = 3;
} else {
_local30 = 2;
};
};
};
coverInDust(_local12);
DestroyBody(_local12);
Main.m_this.playBlockExplosion(_local30);
Main.sm_redrawSlotBar = true;
} else {
if (((_local18._glass) && ((_local18._damage > _local18._hitpoints)))){
if (_local18._pointBlock){
Main.m_this.addPlus1(_local18, 0);
};
coverInDust(_local12);
DestroyBody(_local12);
Main._playGlassBreak = 1;
Main.sm_redrawSlotBar = true;
} else {
if (((((_waiting) && (_local12.GetShapeList().IsSensor()))) && ((_local9 == 0)))){
coverInDust(_local12);
DestroyBody(_local12);
Main.m_this.playBlockExplosion(1);
Main.sm_redrawSlotBar = true;
_local9++;
};
};
};
};
_local12 = _local17;
};
if (((!(_arg2)) && ((_startFreeze >= 2)))){
if (_pointBlocksMax < _local6){
_pointBlocksMax = _local6;
};
if (_pointBlocks != _local6){
Main.sm_redrawSlotBar = true;
_pointBlocks = _local6;
};
_playerObjects = (_local8 - _local7);
if ((((((_playerObjects == 0)) || ((_local7 == 0)))) && (!(_waiting)))){
_waiting = true;
};
if (((_stabile) && (_waiting))){
_stabileCounter--;
} else {
_stabileCounter = 20;
};
if (_stabileCounter <= 0){
_stabile = true;
} else {
_stabile = false;
};
};
if (_startFreeze < 2){
_startFreeze++;
};
}
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);
}
private function twinkleBody(_arg1:b2Body):void{
var _local2:b2XForm;
var _local3:b2Vec2;
var _local4:int;
var _local5:b2Shape;
var _local6:int;
if (Main.s_quality > 1){
return;
};
m_twinkleSkip--;
if (m_twinkleSkip >= 0){
return;
};
m_twinkleSkip = 1;
_local2 = _arg1.GetXForm();
_local3 = _arg1.GetPosition();
_local4 = 0;
_local5 = _arg1.GetShapeList();
while (_local5 != null) {
_local4++;
_local5 = _local5.GetNext();
};
_local6 = (Math.random() * _local4);
_local4 = 0;
_local5 = _arg1.GetShapeList();
while (_local5 != null) {
if (_local4 == _local6){
twinkleShape(_local5, _local3, _local2);
return;
};
_local4++;
_local5 = _local5.GetNext();
};
}
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;
_local9.m_userData._isPlayerObject = false;
return (_local9);
}
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);
}
private 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);
m_randomPointX = (((_local4 * _arg1.x) + (_local5 * _arg2.x)) + (_local6 * _arg3.x));
m_randomPointY = (((_local4 * _arg1.y) + (_local5 * _arg2.y)) + (_local6 * _arg3.y));
}
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);
}
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 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;
_local6.m_userData._isPlayerObject = false;
_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 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 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 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, _density, _arg2);
setBallSprite(new Bitmap(new _classDiamond1().bitmapData), _local6.m_userData, _arg5);
m_sprite.addChild(_local6.m_userData._sprite);
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 = _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 = 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:Number;
var _local7:UserData;
var _local8:b2Body;
var _local9:b2BodyDef;
var _local10:b2PolygonDef;
var _local11:Number;
var _local12:Number;
var _local13:b2RevoluteJointDef;
var _local14:b2Body;
var _local15:b2CircleDef;
var _local16:int;
_local6 = 20;
_local7 = new UserData();
_local7._iD = 50;
_local7._radius = _arg5;
_arg5 = (_arg5 / _local6);
_local9 = new b2BodyDef();
_local10 = new b2PolygonDef();
_local11 = (_arg5 * 1.2);
_local12 = (_arg5 * 0.2);
_local13 = new b2RevoluteJointDef();
_local14 = m_world.GetGroundBody();
_local9 = new b2BodyDef();
_local9.position.Set(_arg3, _arg4);
_local9.angle = _arg1;
_local8 = m_world.CreateBody(_local9);
_local15 = new b2CircleDef();
_local15.radius = _arg5;
_local15.density = 20;
_local15.friction = _friction;
_local15.isSensor = _arg2;
_local8.CreateShape(_local15);
_local8.m_userData = _local7;
_local8.m_userData._isPlayerObject = false;
_local16 = 0;
while (_local16 < 4) {
_local10 = new b2PolygonDef();
_local10.SetAsOrientedBox(_local11, _local12, new b2Vec2(0, 0), ((Math.PI * _local16) / 4));
_local10.density = 1;
_local10.friction = _friction;
_local10.isSensor = _arg2;
_local8.CreateShape(_local10);
_local16++;
};
_local8.SetMassFromShapes();
_local13.Initialize(_local14, _local8, new b2Vec2(_arg3, _arg4));
_local13.motorSpeed = 0;
_local13.enableMotor = false;
_local7._object = (m_world.CreateJoint(_local13) as b2RevoluteJoint);
return (_local8);
}
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;
_local6.m_userData._1T = true;
_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 RepaintNonPlayerObjects():void{
var _local1:b2Body;
_local1 = m_world.m_bodyList;
while (_local1) {
if (((((!((_local1.m_userData == null))) && (!((_local1.m_userData._sprite == null))))) && (!(_local1.m_userData._isPlayerObject)))){
RepaintSprite(_local1.m_userData);
};
_local1 = _local1.m_next;
};
}
private function isCollidingTestGeometry(_arg1:b2Body):Boolean{
var _local2:b2Shape;
var _local3:Boolean;
_local2 = getCollisionTestGeometry(_arg1);
_local3 = isCollidingTest(_local2, _arg1.GetXForm(), _arg1);
return (_local3);
}
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 = _density;
_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);
}
private function isIPhoneSleeping(_arg1:Number):Boolean{
if (_arg1 < (-140 / m_debugDraw.m_drawScale)){
return (true);
};
return (false);
}
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, _density, true);
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);
}
public function addBGBox(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):b2Body{
return (addOrientedBGBox(_arg1, _arg2, _arg3, _arg4, 0));
}
public function GetBodyAtMouse(_arg1:Boolean=false, _arg2:Boolean=false):b2Body{
var _local3:b2AABB;
var _local4:int;
var _local5:Array;
var _local6:int;
var _local7:b2Body;
var _local8:b2Body;
var _local9:int;
var _local10:b2Shape;
var _local11:Boolean;
mousePVec.Set(mouseXWorldPhys, mouseYWorldPhys);
_local3 = new b2AABB();
_local3.lowerBound.Set((mouseXWorldPhys - 0.001), (mouseYWorldPhys - 0.001));
_local3.upperBound.Set((mouseXWorldPhys + 0.001), (mouseYWorldPhys + 0.001));
_local4 = 10;
_local5 = new Array();
_local6 = m_world.Query(_local3, _local5, _local4);
_local7 = null;
_local8 = null;
_getBodyTouchedOthers = false;
_local9 = 0;
while (_local9 < _local6) {
_local10 = (_local5[_local9] as b2Shape);
_local11 = (_local5[_local9] as b2Shape).TestPoint(_local10.GetBody().GetXForm(), mousePVec);
if (_local11){
_local8 = _local10.GetBody();
if (m_mouseBody == _local8){
} else {
if (((!(_local10.IsSensor())) && (!(_arg2)))){
_getBodyTouchedOthers = true;
} else {
if (((_local8.IsStatic()) && (!(_arg1)))){
_getBodyTouchedOthers = true;
} else {
_local7 = _local8;
};
};
};
};
_local9++;
};
return (_local7);
}
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 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 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;
_local6.m_userData._isPlayerObject = false;
_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);
}
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 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;
_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;
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);
m_sprite.addChild(_local6.m_userData._sprite);
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;
_local6.m_userData._isPlayerObject = false;
_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 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);
}
private function isCollidingTest(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Body):Boolean{
var _local4:b2Manifold;
var _local5:Boolean;
var _local6:Boolean;
var _local7:b2Body;
var _local8:b2Body;
var _local9:b2Shape;
var _local10:Boolean;
var _local11:Boolean;
_local4 = new b2Manifold();
while (_arg1 != null) {
_local5 = (_arg1 is b2CircleShape);
_local6 = (_arg1 is b2PolygonShape);
_local7 = m_world.m_bodyList;
while (_local7 != null) {
_local8 = _local7.m_next;
if (_local7 == _arg3){
_local7 = _local8;
} else {
_local9 = _local7.GetShapeList();
while (_local9 != null) {
_local10 = (_local9 is b2CircleShape);
_local11 = (_local9 is b2PolygonShape);
if (((_local5) && (_local10))){
b2Collision.b2CollideCircles(_local4, (_arg1 as b2CircleShape), _arg2, (_local9 as b2CircleShape), _local7.GetXForm());
} else {
if (((_local5) && (_local11))){
b2Collision.b2CollidePolygonAndCircle(_local4, (_local9 as b2PolygonShape), _local7.GetXForm(), (_arg1 as b2CircleShape), _arg2);
} else {
if (((_local6) && (_local10))){
b2Collision.b2CollidePolygonAndCircle(_local4, (_arg1 as b2PolygonShape), _arg2, (_local9 as b2CircleShape), _local7.GetXForm());
} else {
if (((_local6) && (_local11))){
b2Collision.b2CollidePolygons(_local4, (_arg1 as b2PolygonShape), _arg2, (_local9 as b2PolygonShape), _local7.GetXForm());
};
};
};
};
if (_local4.pointCount > 0){
return (true);
};
_local9 = _local9.GetNext();
};
_local7 = _local8;
};
};
_arg1 = _arg1.GetNext();
};
return (false);
}
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;
_local7.m_userData._isPlayerObject = false;
_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 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);
m_sprite.addChild(_local6.m_userData._sprite);
_local6.m_userData._directedGravity = true;
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);
m_sprite.addChild(_local6.m_userData._sprite);
_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);
_local6.m_userData._isPlayerObject = false;
return (_local6);
}
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;
}
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;
_local6.m_userData._1T = true;
_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 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);
m_sprite.addChild(_local6.m_userData._sprite);
_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);
_local6.m_userData._isPlayerObject = false;
return (_local6);
}
private function getCollisionTestGeometry(_arg1:b2Body):b2Shape{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Shape;
var _local6:b2CircleShape;
var _local7:b2CircleDef;
var _local8:b2PolygonShape;
var _local9:b2PolygonDef;
var _local10:Number;
var _local11:Number;
var _local12:Array;
var _local13:int;
var _local14:Number;
var _local15:Number;
_local2 = _arg1.GetShapeList();
_local3 = null;
_local4 = null;
_local5 = null;
while (_local2 != null) {
_local5 = null;
if ((_local2 is b2CircleShape)){
_local6 = (_local2 as b2CircleShape);
_local7 = new b2CircleDef();
_local7.localPosition.x = _local6.GetLocalPosition().x;
_local7.localPosition.y = _local6.GetLocalPosition().y;
_local7.radius = (_local6.GetRadius() - C_MRGN);
_local5 = new b2CircleShape(_local7);
trace(((((("new b2CircleShape: localPositionX = " + _local7.localPosition.x) + " localPositionY = ") + _local7.localPosition.y) + " radius = ") + _local7.radius));
} else {
if ((_local2 is b2PolygonShape)){
_local8 = (_local2 as b2PolygonShape);
_local9 = new b2PolygonDef();
_local9.vertexCount = _local8.GetVertexCount();
_local10 = 0;
_local11 = 0;
_local12 = _local8.GetVertices();
_local13 = 0;
while (_local13 < _local9.vertexCount) {
_local10 = (_local10 + _local12[_local13].x);
_local11 = (_local11 + _local12[_local13].y);
_local13++;
};
_local10 = (_local10 / _local9.vertexCount);
_local11 = (_local11 / _local9.vertexCount);
_local13 = 0;
while (_local13 < _local9.vertexCount) {
if (_local12[_local13].x < _local10){
_local14 = C_MRGN;
} else {
_local14 = -(C_MRGN);
};
if (_local12[_local13].y < _local11){
_local15 = C_MRGN;
} else {
_local15 = -(C_MRGN);
};
_local9.vertices[_local13] = new b2Vec2((_local12[_local13].x + _local14), (_local12[_local13].y + _local15));
_local13++;
};
_local5 = new b2PolygonShape(_local9);
};
};
if (_local3 == null){
_local3 = _local5;
_local4 = _local5;
} else {
_local3.m_next = _local5;
_local3 = _local5;
};
_local2 = _local2.GetNext();
};
return (_local4);
}
private function twinkleShape(_arg1:b2Shape, _arg2:b2Vec2, _arg3:b2XForm):void{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:b2CircleShape;
var _local8:Number;
var _local9:b2Vec2;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Particle;
var _local15:b2PolygonShape;
var _local16:int;
var _local17:Array;
var _local18:Array;
var _local19:b2Vec2;
var _local20:int;
var _local21:int;
_local4 = _arg1.GetType();
if (_local4 == b2Shape.e_circleShape){
_local7 = (_arg1 as b2CircleShape);
_local8 = _local7.GetRadius();
_local9 = b2Math.b2MulX(_arg3, _local7.GetLocalPosition());
b2Math.b2MulX(_arg3, _local7.GetLocalPosition()).x = (_local9.x * m_debugDraw.m_drawScale);
_local9.y = (_local9.y * m_debugDraw.m_drawScale);
_local10 = (Math.random() * _local8);
_local11 = ((Math.random() * Math.PI) * 2);
_local12 = ((Math.cos(_local11) * _local10) * m_debugDraw.m_drawScale);
_local13 = ((Math.sin(_local11) * _local10) * m_debugDraw.m_drawScale);
_local14 = Main.m_particleManager.addParticle(Particle.PARTICLE_TYPE_TWINKLE, ((_local9.x + _local12) + 300), (_local9.y + _local13), 0xFFFFFF);
if (_local14 != null){
_local14._life = (_local14._life + (Math.random() * 10));
};
} else {
if (_local4 == b2Shape.e_polygonShape){
_local15 = (_arg1 as b2PolygonShape);
_local16 = _local15.GetVertexCount();
_local17 = _local15.GetVertices();
_local18 = new Array(b2Settings.b2_maxPolygonVertices);
_local5 = 0;
while (_local5 < _local16) {
_local18[_local5] = b2Math.b2MulX(_arg3, _local17[_local5]);
_local5++;
};
_local19 = new b2Vec2();
_local19.x = (_arg2.x * m_debugDraw.m_drawScale);
_local19.y = (_arg2.y * m_debugDraw.m_drawScale);
_local20 = (_local16 - 2);
_local21 = ((Math.random() * 0.99) * _local20);
getRandomPointInTriangle(_local18[0], _local18[(_local21 + 1)], _local18[(_local21 + 2)]);
m_randomPointX = (m_randomPointX * m_debugDraw.m_drawScale);
m_randomPointY = (m_randomPointY * m_debugDraw.m_drawScale);
_local12 = ((m_randomPointX - _local19.x) * 0.1);
_local13 = ((m_randomPointY - _local19.y) * 0.1);
_local14 = Main.m_particleManager.addParticle(Particle.PARTICLE_TYPE_TWINKLE, (m_randomPointX + 300), m_randomPointY, 0xFFFFFF);
if (_local14 != null){
_local14._life = (_local14._life + (Math.random() * 10));
};
};
};
}
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);
}
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;
_local7.m_userData._isPlayerObject = false;
return (_local7);
}
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);
}
private function isColliding(_arg1:b2Body):Boolean{
return (isCollidingTest(_arg1.GetShapeList(), _arg1.GetXForm(), _arg1));
}
private function runGlassSprite(_arg1:b2Body, _arg2:UserData):void{
var _local3:Number;
_local3 = (_arg2._hitpoints / 3);
if (_arg2._damage > (2 * _local3)){
if (_arg2._spriteNumber != 2){
if (_arg2._iD == 72){
changeSprite(_arg2, new Bitmap(new _classBrickOGlassBR2().bitmapData));
} else {
if (_arg2._iD == 73){
changeSprite(_arg2, new Bitmap(new _classBrickBlockGlassBR2().bitmapData));
} else {
if (_arg2._iD == 74){
changeSprite(_arg2, new Bitmap(new _classBrickIGlassBR2().bitmapData));
};
};
};
coverInDust(_arg1, 0.1);
_arg2._spriteNumber = 2;
Main._playGlassCrack = 1;
};
} else {
if (_arg2._damage > _local3){
if (_arg2._spriteNumber != 1){
if (_arg2._iD == 72){
changeSprite(_arg2, new Bitmap(new _classBrickOGlassBR1().bitmapData));
} else {
if (_arg2._iD == 73){
changeSprite(_arg2, new Bitmap(new _classBrickBlockGlassBR1().bitmapData));
} else {
if (_arg2._iD == 74){
changeSprite(_arg2, new Bitmap(new _classBrickIGlassBR1().bitmapData));
};
};
};
coverInDust(_arg1, 0.1);
_arg2._spriteNumber = 1;
Main._playGlassCrack = 1;
};
};
};
}
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 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 RepaintSprites():void{
var _local1:b2Body;
_local1 = m_world.m_bodyList;
while (_local1) {
if (((!((_local1.m_userData == null))) && (!((_local1.m_userData._sprite == null))))){
RepaintSprite(_local1.m_userData);
};
_local1 = _local1.m_next;
};
}
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 BringSpritesOnTop():void{
var _local1:b2Body;
_local1 = m_world.m_bodyList;
while (_local1) {
if (((!((_local1.m_userData == null))) && (!((_local1.m_userData._sprite == null))))){
m_sprite.removeChild(_local1.m_userData._sprite);
m_sprite.addChild(_local1.m_userData._sprite);
};
_local1 = _local1.m_next;
};
Main.m_this.BringPlus1OnTop();
}
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;
_local6.m_userData._1T = true;
_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 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 98
//Test__classBrickAlien (TestBed.Test__classBrickAlien)
package TestBed {
import mx.core.*;
public class Test__classBrickAlien extends BitmapAsset {
}
}//package TestBed
Section 99
//Test__classBrickBig (TestBed.Test__classBrickBig)
package TestBed {
import mx.core.*;
public class Test__classBrickBig extends BitmapAsset {
}
}//package TestBed
Section 100
//Test__classBrickBlock (TestBed.Test__classBrickBlock)
package TestBed {
import mx.core.*;
public class Test__classBrickBlock extends BitmapAsset {
}
}//package TestBed
Section 101
//Test__classBrickBlock1T (TestBed.Test__classBrickBlock1T)
package TestBed {
import mx.core.*;
public class Test__classBrickBlock1T extends BitmapAsset {
}
}//package TestBed
Section 102
//Test__classBrickBlockG (TestBed.Test__classBrickBlockG)
package TestBed {
import mx.core.*;
public class Test__classBrickBlockG extends BitmapAsset {
}
}//package TestBed
Section 103
//Test__classBrickBlockGlass (TestBed.Test__classBrickBlockGlass)
package TestBed {
import mx.core.*;
public class Test__classBrickBlockGlass extends BitmapAsset {
}
}//package TestBed
Section 104
//Test__classBrickBlockGlassBR1 (TestBed.Test__classBrickBlockGlassBR1)
package TestBed {
import mx.core.*;
public class Test__classBrickBlockGlassBR1 extends BitmapAsset {
}
}//package TestBed
Section 105
//Test__classBrickBlockGlassBR2 (TestBed.Test__classBrickBlockGlassBR2)
package TestBed {
import mx.core.*;
public class Test__classBrickBlockGlassBR2 extends BitmapAsset {
}
}//package TestBed
Section 106
//Test__classBrickBlockHelium (TestBed.Test__classBrickBlockHelium)
package TestBed {
import mx.core.*;
public class Test__classBrickBlockHelium extends BitmapAsset {
}
}//package TestBed
Section 107
//Test__classBrickConnect (TestBed.Test__classBrickConnect)
package TestBed {
import mx.core.*;
public class Test__classBrickConnect extends BitmapAsset {
}
}//package TestBed
Section 108
//Test__classBrickConnectMirror (TestBed.Test__classBrickConnectMirror)
package TestBed {
import mx.core.*;
public class Test__classBrickConnectMirror extends BitmapAsset {
}
}//package TestBed
Section 109
//Test__classBrickCorner (TestBed.Test__classBrickCorner)
package TestBed {
import mx.core.*;
public class Test__classBrickCorner extends BitmapAsset {
}
}//package TestBed
Section 110
//Test__classBrickCornerLong (TestBed.Test__classBrickCornerLong)
package TestBed {
import mx.core.*;
public class Test__classBrickCornerLong extends BitmapAsset {
}
}//package TestBed
Section 111
//Test__classBrickCross (TestBed.Test__classBrickCross)
package TestBed {
import mx.core.*;
public class Test__classBrickCross extends BitmapAsset {
}
}//package TestBed
Section 112
//Test__classBrickCrossG (TestBed.Test__classBrickCrossG)
package TestBed {
import mx.core.*;
public class Test__classBrickCrossG extends BitmapAsset {
}
}//package TestBed
Section 113
//Test__classBrickH (TestBed.Test__classBrickH)
package TestBed {
import mx.core.*;
public class Test__classBrickH extends BitmapAsset {
}
}//package TestBed
Section 114
//Test__classBrickHinge (TestBed.Test__classBrickHinge)
package TestBed {
import mx.core.*;
public class Test__classBrickHinge extends BitmapAsset {
}
}//package TestBed
Section 115
//Test__classBrickHingeBig (TestBed.Test__classBrickHingeBig)
package TestBed {
import mx.core.*;
public class Test__classBrickHingeBig extends BitmapAsset {
}
}//package TestBed
Section 116
//Test__classBrickHingeVeryBig (TestBed.Test__classBrickHingeVeryBig)
package TestBed {
import mx.core.*;
public class Test__classBrickHingeVeryBig extends BitmapAsset {
}
}//package TestBed
Section 117
//Test__classBrickHingeVeryBigStraight (TestBed.Test__classBrickHingeVeryBigStraight)
package TestBed {
import mx.core.*;
public class Test__classBrickHingeVeryBigStraight extends BitmapAsset {
}
}//package TestBed
Section 118
//Test__classBrickHoleBox (TestBed.Test__classBrickHoleBox)
package TestBed {
import mx.core.*;
public class Test__classBrickHoleBox extends BitmapAsset {
}
}//package TestBed
Section 119
//Test__classBrickI (TestBed.Test__classBrickI)
package TestBed {
import mx.core.*;
public class Test__classBrickI extends BitmapAsset {
}
}//package TestBed
Section 120
//Test__classBrickIGlass (TestBed.Test__classBrickIGlass)
package TestBed {
import mx.core.*;
public class Test__classBrickIGlass extends BitmapAsset {
}
}//package TestBed
Section 121
//Test__classBrickIGlassBR1 (TestBed.Test__classBrickIGlassBR1)
package TestBed {
import mx.core.*;
public class Test__classBrickIGlassBR1 extends BitmapAsset {
}
}//package TestBed
Section 122
//Test__classBrickIGlassBR2 (TestBed.Test__classBrickIGlassBR2)
package TestBed {
import mx.core.*;
public class Test__classBrickIGlassBR2 extends BitmapAsset {
}
}//package TestBed
Section 123
//Test__classBrickJ (TestBed.Test__classBrickJ)
package TestBed {
import mx.core.*;
public class Test__classBrickJ extends BitmapAsset {
}
}//package TestBed
Section 124
//Test__classBrickJesus (TestBed.Test__classBrickJesus)
package TestBed {
import mx.core.*;
public class Test__classBrickJesus extends BitmapAsset {
}
}//package TestBed
Section 125
//Test__classBrickKiila (TestBed.Test__classBrickKiila)
package TestBed {
import mx.core.*;
public class Test__classBrickKiila extends BitmapAsset {
}
}//package TestBed
Section 126
//Test__classBrickL (TestBed.Test__classBrickL)
package TestBed {
import mx.core.*;
public class Test__classBrickL extends BitmapAsset {
}
}//package TestBed
Section 127
//Test__classBrickO (TestBed.Test__classBrickO)
package TestBed {
import mx.core.*;
public class Test__classBrickO extends BitmapAsset {
}
}//package TestBed
Section 128
//Test__classBrickO1T (TestBed.Test__classBrickO1T)
package TestBed {
import mx.core.*;
public class Test__classBrickO1T extends BitmapAsset {
}
}//package TestBed
Section 129
//Test__classBrickOG (TestBed.Test__classBrickOG)
package TestBed {
import mx.core.*;
public class Test__classBrickOG extends BitmapAsset {
}
}//package TestBed
Section 130
//Test__classBrickOGlass (TestBed.Test__classBrickOGlass)
package TestBed {
import mx.core.*;
public class Test__classBrickOGlass extends BitmapAsset {
}
}//package TestBed
Section 131
//Test__classBrickOGlassBR1 (TestBed.Test__classBrickOGlassBR1)
package TestBed {
import mx.core.*;
public class Test__classBrickOGlassBR1 extends BitmapAsset {
}
}//package TestBed
Section 132
//Test__classBrickOGlassBR2 (TestBed.Test__classBrickOGlassBR2)
package TestBed {
import mx.core.*;
public class Test__classBrickOGlassBR2 extends BitmapAsset {
}
}//package TestBed
Section 133
//Test__classBrickOHelium (TestBed.Test__classBrickOHelium)
package TestBed {
import mx.core.*;
public class Test__classBrickOHelium extends BitmapAsset {
}
}//package TestBed
Section 134
//Test__classBrickPacman (TestBed.Test__classBrickPacman)
package TestBed {
import mx.core.*;
public class Test__classBrickPacman extends BitmapAsset {
}
}//package TestBed
Section 135
//Test__classBrickPole (TestBed.Test__classBrickPole)
package TestBed {
import mx.core.*;
public class Test__classBrickPole extends BitmapAsset {
}
}//package TestBed
Section 136
//Test__classBrickPoleG (TestBed.Test__classBrickPoleG)
package TestBed {
import mx.core.*;
public class Test__classBrickPoleG extends BitmapAsset {
}
}//package TestBed
Section 137
//Test__classBrickRocket (TestBed.Test__classBrickRocket)
package TestBed {
import mx.core.*;
public class Test__classBrickRocket extends BitmapAsset {
}
}//package TestBed
Section 138
//Test__classBrickS (TestBed.Test__classBrickS)
package TestBed {
import mx.core.*;
public class Test__classBrickS extends BitmapAsset {
}
}//package TestBed
Section 139
//Test__classBrickSalmiack (TestBed.Test__classBrickSalmiack)
package TestBed {
import mx.core.*;
public class Test__classBrickSalmiack extends BitmapAsset {
}
}//package TestBed
Section 140
//Test__classBrickT (TestBed.Test__classBrickT)
package TestBed {
import mx.core.*;
public class Test__classBrickT extends BitmapAsset {
}
}//package TestBed
Section 141
//Test__classBrickWacky1 (TestBed.Test__classBrickWacky1)
package TestBed {
import mx.core.*;
public class Test__classBrickWacky1 extends BitmapAsset {
}
}//package TestBed
Section 142
//Test__classBrickWacky1Mirror (TestBed.Test__classBrickWacky1Mirror)
package TestBed {
import mx.core.*;
public class Test__classBrickWacky1Mirror extends BitmapAsset {
}
}//package TestBed
Section 143
//Test__classBrickWacky2 (TestBed.Test__classBrickWacky2)
package TestBed {
import mx.core.*;
public class Test__classBrickWacky2 extends BitmapAsset {
}
}//package TestBed
Section 144
//Test__classBrickWacky4 (TestBed.Test__classBrickWacky4)
package TestBed {
import mx.core.*;
public class Test__classBrickWacky4 extends BitmapAsset {
}
}//package TestBed
Section 145
//Test__classBrickWacky4Mirror (TestBed.Test__classBrickWacky4Mirror)
package TestBed {
import mx.core.*;
public class Test__classBrickWacky4Mirror extends BitmapAsset {
}
}//package TestBed
Section 146
//Test__classBrickVeryLong (TestBed.Test__classBrickVeryLong)
package TestBed {
import mx.core.*;
public class Test__classBrickVeryLong extends BitmapAsset {
}
}//package TestBed
Section 147
//Test__classBrickWhoa (TestBed.Test__classBrickWhoa)
package TestBed {
import mx.core.*;
public class Test__classBrickWhoa extends BitmapAsset {
}
}//package TestBed
Section 148
//Test__classBrickWhoaMirror (TestBed.Test__classBrickWhoaMirror)
package TestBed {
import mx.core.*;
public class Test__classBrickWhoaMirror extends BitmapAsset {
}
}//package TestBed
Section 149
//Test__classBrickWideCross (TestBed.Test__classBrickWideCross)
package TestBed {
import mx.core.*;
public class Test__classBrickWideCross extends BitmapAsset {
}
}//package TestBed
Section 150
//Test__classBrickWideCrossG (TestBed.Test__classBrickWideCrossG)
package TestBed {
import mx.core.*;
public class Test__classBrickWideCrossG extends BitmapAsset {
}
}//package TestBed
Section 151
//Test__classBrickZ (TestBed.Test__classBrickZ)
package TestBed {
import mx.core.*;
public class Test__classBrickZ extends BitmapAsset {
}
}//package TestBed
Section 152
//Test__classDiamond1 (TestBed.Test__classDiamond1)
package TestBed {
import mx.core.*;
public class Test__classDiamond1 extends BitmapAsset {
}
}//package TestBed
Section 153
//Test__classDiamond2 (TestBed.Test__classDiamond2)
package TestBed {
import mx.core.*;
public class Test__classDiamond2 extends BitmapAsset {
}
}//package TestBed
Section 154
//Test__classDiamond3 (TestBed.Test__classDiamond3)
package TestBed {
import mx.core.*;
public class Test__classDiamond3 extends BitmapAsset {
}
}//package TestBed
Section 155
//Test__classPyramid (TestBed.Test__classPyramid)
package TestBed {
import mx.core.*;
public class Test__classPyramid extends BitmapAsset {
}
}//package TestBed
Section 156
//Test__classPyramid1T (TestBed.Test__classPyramid1T)
package TestBed {
import mx.core.*;
public class Test__classPyramid1T extends BitmapAsset {
}
}//package TestBed
Section 157
//Test__classPyramidHelium (TestBed.Test__classPyramidHelium)
package TestBed {
import mx.core.*;
public class Test__classPyramidHelium extends BitmapAsset {
}
}//package TestBed
Section 158
//Test__classRotatingCross (TestBed.Test__classRotatingCross)
package TestBed {
import mx.core.*;
public class Test__classRotatingCross extends BitmapAsset {
}
}//package TestBed
Section 159
//Test__classRotatingCrossBig (TestBed.Test__classRotatingCrossBig)
package TestBed {
import mx.core.*;
public class Test__classRotatingCrossBig extends BitmapAsset {
}
}//package TestBed
Section 160
//Test__classRotatingCrossBlades (TestBed.Test__classRotatingCrossBlades)
package TestBed {
import mx.core.*;
public class Test__classRotatingCrossBlades extends BitmapAsset {
}
}//package TestBed
Section 161
//Test__classRotatingCrossBox (TestBed.Test__classRotatingCrossBox)
package TestBed {
import mx.core.*;
public class Test__classRotatingCrossBox extends BitmapAsset {
}
}//package TestBed
Section 162
//Test__classSaw1 (TestBed.Test__classSaw1)
package TestBed {
import mx.core.*;
public class Test__classSaw1 extends BitmapAsset {
}
}//package TestBed
Section 163
//Test__classSaw2X (TestBed.Test__classSaw2X)
package TestBed {
import mx.core.*;
public class Test__classSaw2X extends BitmapAsset {
}
}//package TestBed
Section 164
//Test__classSun (TestBed.Test__classSun)
package TestBed {
import mx.core.*;
public class Test__classSun extends BitmapAsset {
}
}//package TestBed
Section 165
//Test__classSun1T (TestBed.Test__classSun1T)
package TestBed {
import mx.core.*;
public class Test__classSun1T extends BitmapAsset {
}
}//package TestBed
Section 166
//Test__classSunG (TestBed.Test__classSunG)
package TestBed {
import mx.core.*;
public class Test__classSunG extends BitmapAsset {
}
}//package TestBed
Section 167
//Test__classSunHelium (TestBed.Test__classSunHelium)
package TestBed {
import mx.core.*;
public class Test__classSunHelium extends BitmapAsset {
}
}//package TestBed
Section 168
//Test__classSuperLong (TestBed.Test__classSuperLong)
package TestBed {
import mx.core.*;
public class Test__classSuperLong extends BitmapAsset {
}
}//package TestBed
Section 169
//Test__classTriangleLeft (TestBed.Test__classTriangleLeft)
package TestBed {
import mx.core.*;
public class Test__classTriangleLeft extends BitmapAsset {
}
}//package TestBed
Section 170
//Test__classTriangleRight (TestBed.Test__classTriangleRight)
package TestBed {
import mx.core.*;
public class Test__classTriangleRight extends BitmapAsset {
}
}//package TestBed
Section 171
//Audio (Audio)
package {
import flash.media.*;
public class Audio {
public var _soundBlockExplosion2:Sound;
public var _soundBlockExplosion3:Sound;
public var _classMP3EarnDiamond:Class;
public var _soundReturnShape:Sound;
public var _soundGame:Sound;
public var _soundEarnDiamond:Sound;
public var _soundGameSpecial:Sound;
public var _classMP3BlockExplosion1:Class;
public var _classMP3BlockExplosion2:Class;
public var _classMP3BlockExplosion3:Class;
public var _classMP3GlassBreak1:Class;
public var _classMP3GlassBreak2:Class;
public var _classMP3GlassBreak3:Class;
public var _classMP3GlassBreak4:Class;
public var _soundOkHarmony:Sound;
public var _soundGlass1:Sound;
public var _soundGlass2:Sound;
public var _soundGlass3:Sound;
public var _classMP3OkHarmony:Class;
public var _soundConcrete01:Sound;
public var _soundConcrete02:Sound;
public var _soundConcrete03:Sound;
public var _soundConcrete04:Sound;
public var _soundConcrete05:Sound;
public var _soundConcrete06:Sound;
public var _soundConcrete07:Sound;
public var _classMP3Concrete01:Class;
public var _soundGlassBreak1:Sound;
public var _soundGlassBreak2:Sound;
public var _classMP3Concrete04:Class;
public var _classMP3Concrete06:Class;
public var _classMP3Concrete07:Class;
public var _soundConcrete08:Sound;
public var _soundGrabShape:Sound;
public var _classMP3Concrete03:Class;
public var _soundGlassBreak3:Sound;
public var _classMP3Concrete05:Class;
public var _classMP3SoundGame:Class;
public var _classMP3Concrete08:Class;
public var _classMP3Concrete02:Class;
public var _soundMenu:Sound;
public var _soundGlassBreak4:Sound;
public var _classMP3Rotate01:Class;
public var _classMP3Rotate02:Class;
public var _classMP3Rotate03:Class;
public var _classMP3PerfectStrike:Class;
public var _soundMenuButton:Sound;
public var _classMP3GrabShape:Class;
public var _classMP3MenuButton:Class;
public var _soundBadPickup:Sound;
public var _classMP3BadPickup:Class;
public var _soundRotate01:Sound;
public var _soundRotate02:Sound;
public var _soundRotate03:Sound;
public var _classMP3SoundGameSpecial:Class;
public var _soundGlassCrack:Sound;
public var _classMP3GlassCrack:Class;
public var _classMP3Glass2:Class;
public var _classMP3Glass3:Class;
public var _soundPerfectStrike:Sound;
public var _classMP3Glass1:Class;
public var _classMP3SoundMenu:Class;
public var _soundBlockExplosion1:Sound;
public var _classMP3ReturnShape:Class;
public function Audio(){
_classMP3SoundMenu = Audio__classMP3SoundMenu;
_soundMenu = new _classMP3SoundMenu();
_classMP3SoundGame = Audio__classMP3SoundGame;
_soundGame = new _classMP3SoundGame();
_classMP3SoundGameSpecial = Audio__classMP3SoundGameSpecial;
_soundGameSpecial = new _classMP3SoundGameSpecial();
_classMP3MenuButton = Audio__classMP3MenuButton;
_soundMenuButton = new _classMP3MenuButton();
_classMP3GrabShape = Audio__classMP3GrabShape;
_soundGrabShape = new _classMP3GrabShape();
_classMP3ReturnShape = Audio__classMP3ReturnShape;
_soundReturnShape = new _classMP3ReturnShape();
_classMP3Rotate01 = Audio__classMP3Rotate01;
_soundRotate01 = new _classMP3Rotate01();
_classMP3Rotate02 = Audio__classMP3Rotate02;
_soundRotate02 = new _classMP3Rotate02();
_classMP3Rotate03 = Audio__classMP3Rotate03;
_soundRotate03 = new _classMP3Rotate03();
_classMP3BadPickup = Audio__classMP3BadPickup;
_soundBadPickup = new _classMP3BadPickup();
_classMP3Concrete01 = Audio__classMP3Concrete01;
_soundConcrete01 = new _classMP3Concrete01();
_classMP3Concrete02 = Audio__classMP3Concrete02;
_soundConcrete02 = new _classMP3Concrete02();
_classMP3Concrete03 = Audio__classMP3Concrete03;
_soundConcrete03 = new _classMP3Concrete03();
_classMP3Concrete04 = Audio__classMP3Concrete04;
_soundConcrete04 = new _classMP3Concrete04();
_classMP3Concrete05 = Audio__classMP3Concrete05;
_soundConcrete05 = new _classMP3Concrete05();
_classMP3Concrete06 = Audio__classMP3Concrete06;
_soundConcrete06 = new _classMP3Concrete06();
_classMP3Concrete07 = Audio__classMP3Concrete07;
_soundConcrete07 = new _classMP3Concrete07();
_classMP3Concrete08 = Audio__classMP3Concrete08;
_soundConcrete08 = new _classMP3Concrete08();
_classMP3Glass1 = Audio__classMP3Glass1;
_soundGlass1 = new _classMP3Glass1();
_classMP3Glass2 = Audio__classMP3Glass2;
_soundGlass2 = new _classMP3Glass2();
_classMP3Glass3 = Audio__classMP3Glass3;
_soundGlass3 = new _classMP3Glass3();
_classMP3GlassCrack = Audio__classMP3GlassCrack;
_soundGlassCrack = new _classMP3GlassCrack();
_classMP3GlassBreak1 = Audio__classMP3GlassBreak1;
_soundGlassBreak1 = new _classMP3GlassBreak1();
_classMP3GlassBreak2 = Audio__classMP3GlassBreak2;
_soundGlassBreak2 = new _classMP3GlassBreak2();
_classMP3GlassBreak3 = Audio__classMP3GlassBreak3;
_soundGlassBreak3 = new _classMP3GlassBreak3();
_classMP3GlassBreak4 = Audio__classMP3GlassBreak4;
_soundGlassBreak4 = new _classMP3GlassBreak4();
_classMP3BlockExplosion1 = Audio__classMP3BlockExplosion1;
_soundBlockExplosion1 = new _classMP3BlockExplosion1();
_classMP3BlockExplosion2 = Audio__classMP3BlockExplosion2;
_soundBlockExplosion2 = new _classMP3BlockExplosion2();
_classMP3BlockExplosion3 = Audio__classMP3BlockExplosion3;
_soundBlockExplosion3 = new _classMP3BlockExplosion3();
_classMP3EarnDiamond = Audio__classMP3EarnDiamond;
_soundEarnDiamond = new _classMP3EarnDiamond();
_classMP3OkHarmony = Audio__classMP3OkHarmony;
_soundOkHarmony = new _classMP3OkHarmony();
_classMP3PerfectStrike = Audio__classMP3PerfectStrike;
_soundPerfectStrike = new _classMP3PerfectStrike();
super();
}
}
}//package
Section 172
//Audio__classMP3BadPickup (Audio__classMP3BadPickup)
package {
import mx.core.*;
public class Audio__classMP3BadPickup extends SoundAsset {
}
}//package
Section 173
//Audio__classMP3BlockExplosion1 (Audio__classMP3BlockExplosion1)
package {
import mx.core.*;
public class Audio__classMP3BlockExplosion1 extends SoundAsset {
}
}//package
Section 174
//Audio__classMP3BlockExplosion2 (Audio__classMP3BlockExplosion2)
package {
import mx.core.*;
public class Audio__classMP3BlockExplosion2 extends SoundAsset {
}
}//package
Section 175
//Audio__classMP3BlockExplosion3 (Audio__classMP3BlockExplosion3)
package {
import mx.core.*;
public class Audio__classMP3BlockExplosion3 extends SoundAsset {
}
}//package
Section 176
//Audio__classMP3Concrete01 (Audio__classMP3Concrete01)
package {
import mx.core.*;
public class Audio__classMP3Concrete01 extends SoundAsset {
}
}//package
Section 177
//Audio__classMP3Concrete02 (Audio__classMP3Concrete02)
package {
import mx.core.*;
public class Audio__classMP3Concrete02 extends SoundAsset {
}
}//package
Section 178
//Audio__classMP3Concrete03 (Audio__classMP3Concrete03)
package {
import mx.core.*;
public class Audio__classMP3Concrete03 extends SoundAsset {
}
}//package
Section 179
//Audio__classMP3Concrete04 (Audio__classMP3Concrete04)
package {
import mx.core.*;
public class Audio__classMP3Concrete04 extends SoundAsset {
}
}//package
Section 180
//Audio__classMP3Concrete05 (Audio__classMP3Concrete05)
package {
import mx.core.*;
public class Audio__classMP3Concrete05 extends SoundAsset {
}
}//package
Section 181
//Audio__classMP3Concrete06 (Audio__classMP3Concrete06)
package {
import mx.core.*;
public class Audio__classMP3Concrete06 extends SoundAsset {
}
}//package
Section 182
//Audio__classMP3Concrete07 (Audio__classMP3Concrete07)
package {
import mx.core.*;
public class Audio__classMP3Concrete07 extends SoundAsset {
}
}//package
Section 183
//Audio__classMP3Concrete08 (Audio__classMP3Concrete08)
package {
import mx.core.*;
public class Audio__classMP3Concrete08 extends SoundAsset {
}
}//package
Section 184
//Audio__classMP3EarnDiamond (Audio__classMP3EarnDiamond)
package {
import mx.core.*;
public class Audio__classMP3EarnDiamond extends SoundAsset {
}
}//package
Section 185
//Audio__classMP3Glass1 (Audio__classMP3Glass1)
package {
import mx.core.*;
public class Audio__classMP3Glass1 extends SoundAsset {
}
}//package
Section 186
//Audio__classMP3Glass2 (Audio__classMP3Glass2)
package {
import mx.core.*;
public class Audio__classMP3Glass2 extends SoundAsset {
}
}//package
Section 187
//Audio__classMP3Glass3 (Audio__classMP3Glass3)
package {
import mx.core.*;
public class Audio__classMP3Glass3 extends SoundAsset {
}
}//package
Section 188
//Audio__classMP3GlassBreak1 (Audio__classMP3GlassBreak1)
package {
import mx.core.*;
public class Audio__classMP3GlassBreak1 extends SoundAsset {
}
}//package
Section 189
//Audio__classMP3GlassBreak2 (Audio__classMP3GlassBreak2)
package {
import mx.core.*;
public class Audio__classMP3GlassBreak2 extends SoundAsset {
}
}//package
Section 190
//Audio__classMP3GlassBreak3 (Audio__classMP3GlassBreak3)
package {
import mx.core.*;
public class Audio__classMP3GlassBreak3 extends SoundAsset {
}
}//package
Section 191
//Audio__classMP3GlassBreak4 (Audio__classMP3GlassBreak4)
package {
import mx.core.*;
public class Audio__classMP3GlassBreak4 extends SoundAsset {
}
}//package
Section 192
//Audio__classMP3GlassCrack (Audio__classMP3GlassCrack)
package {
import mx.core.*;
public class Audio__classMP3GlassCrack extends SoundAsset {
}
}//package
Section 193
//Audio__classMP3GrabShape (Audio__classMP3GrabShape)
package {
import mx.core.*;
public class Audio__classMP3GrabShape extends SoundAsset {
}
}//package
Section 194
//Audio__classMP3MenuButton (Audio__classMP3MenuButton)
package {
import mx.core.*;
public class Audio__classMP3MenuButton extends SoundAsset {
}
}//package
Section 195
//Audio__classMP3OkHarmony (Audio__classMP3OkHarmony)
package {
import mx.core.*;
public class Audio__classMP3OkHarmony extends SoundAsset {
}
}//package
Section 196
//Audio__classMP3PerfectStrike (Audio__classMP3PerfectStrike)
package {
import mx.core.*;
public class Audio__classMP3PerfectStrike extends SoundAsset {
}
}//package
Section 197
//Audio__classMP3ReturnShape (Audio__classMP3ReturnShape)
package {
import mx.core.*;
public class Audio__classMP3ReturnShape extends SoundAsset {
}
}//package
Section 198
//Audio__classMP3Rotate01 (Audio__classMP3Rotate01)
package {
import mx.core.*;
public class Audio__classMP3Rotate01 extends SoundAsset {
}
}//package
Section 199
//Audio__classMP3Rotate02 (Audio__classMP3Rotate02)
package {
import mx.core.*;
public class Audio__classMP3Rotate02 extends SoundAsset {
}
}//package
Section 200
//Audio__classMP3Rotate03 (Audio__classMP3Rotate03)
package {
import mx.core.*;
public class Audio__classMP3Rotate03 extends SoundAsset {
}
}//package
Section 201
//Audio__classMP3SoundGame (Audio__classMP3SoundGame)
package {
import mx.core.*;
public class Audio__classMP3SoundGame extends SoundAsset {
}
}//package
Section 202
//Audio__classMP3SoundGameSpecial (Audio__classMP3SoundGameSpecial)
package {
import mx.core.*;
public class Audio__classMP3SoundGameSpecial extends SoundAsset {
}
}//package
Section 203
//Audio__classMP3SoundMenu (Audio__classMP3SoundMenu)
package {
import mx.core.*;
public class Audio__classMP3SoundMenu extends SoundAsset {
}
}//package
Section 204
//ContactListener (ContactListener)
package {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
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);
}
override public function Remove(_arg1:b2ContactPoint):void{
}
private function collide(_arg1:b2ContactPoint, _arg2:Boolean):void{
var _local3:b2Body;
var _local4:b2Body;
var _local5:UserData;
var _local6:UserData;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:Number;
var _local14:b2Vec2;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Particle;
_local3 = _arg1.shape1.m_body;
_local4 = _arg1.shape2.m_body;
_local5 = _local3.m_userData;
_local6 = _local4.m_userData;
if (_local5 != null){
_local5._isTouching = true;
};
if (_local6 != null){
_local6._isTouching = true;
};
if (((_arg1.shape1.m_isSensor) || (_arg1.shape2.m_isSensor))){
return;
};
_local7 = _local3.m_linearVelocity.Length();
_local8 = _local4.m_linearVelocity.Length();
if (!_arg2){
_local13 = 0;
if (_local5 != null){
_local13 = (_local3.GetMass() * _arg1.velocity.Length());
if (_local6 != null){
_local6._damage = (_local6._damage + (_local13 * 0.5));
};
};
if (_local6 != null){
_local13 = (_local4.GetMass() * _arg1.velocity.Length());
if (_local5 != null){
_local5._damage = (_local5._damage + (_local13 * 0.5));
};
};
};
_local9 = _arg1.velocity.Length();
if (!_arg2){
_local14 = new b2Vec2();
_local14.x = (_local3.m_linearVelocity.x - _local4.m_linearVelocity.x);
_local14.y = (_local3.m_linearVelocity.y - _local4.m_linearVelocity.y);
_local15 = _local14.Length();
_local15 = (_local15 * 0.015);
if (_local15 > 1){
_local15 = 1;
};
if (_local15 > 0.08){
if (((((!((_local5 == null))) && (_local5._glass))) || (((!((_local6 == null))) && (_local6._glass))))){
Main._playGlassHitVolume = _local15;
Main._playGlassHit = 0;
} else {
Main._playHitVolume = _local15;
Main._playHit = 0;
};
};
};
_local10 = (_local7 + _local8);
_local11 = 0xEEEEEE;
_local10 = (_local10 / 5);
_local12 = 0;
while (_local12 < _local10) {
_local16 = ((((_arg1.position.x * Test.m_debugDraw.m_drawScale) + (Math.random() * 2)) - 1) + 300);
_local17 = (((_arg1.position.y * Test.m_debugDraw.m_drawScale) + (Math.random() * 2)) - 1);
_local18 = Main.m_particleManager.addParticle(Particle.PARTICLE_TYPE_DUST, _local16, _local17, _local11);
if (_local18 != null){
_local18._speedX = ((Math.random() * 0.5) - 0.25);
_local18._speedY = ((Math.random() * 0.5) - 0.25);
_local18._life = (_local18._life + (Math.random() * 10));
};
_local12++;
};
}
}
}//package
Section 205
//GamesChart (GamesChart)
package {
import flash.display.*;
public class GamesChart {
public static var onGCEvent:Function = null;
private static var _errors:Object = {noInterface:"[GC-API] ERROR! Please call gc.setup() first. See: http://wiki.gameschart.com/index.php/Static_Functions", alreadyDefinedInterface:"[GC-API] ERROR! Can only call setup once! See: http://wiki.gameschart.com/index.php/Static_Functions", noContainerMC:"[GC-API] ERROR! You must supply a container to hold GamesChart! See: http://wiki.gameschart.com/index.php/Static_Functions#Setup", noGameIDHash:"[GC-API] ERROR! You must supply the game ID key associated with this game! http://wiki.gameschart.com/index.php/Static_Functions#Setup"};
private static var _interface:GCBrainInterface;
public static var VERSION:String = "0.2.0";
public static function openCharts():void{
if (_interface == null){
trace(_errors.noInterface);
return;
};
_interface.sendNotification(GCNotificationTypes.SHOW_CHART_LISTS, {});
}
public static function hideTab():void{
if (_interface == null){
trace(_errors.noInterface);
return;
};
_interface.sendNotification(GCNotificationTypes.HIDE_TAB, {});
}
public static function showTab(_arg1:Number, _arg2:Number):void{
if (_interface == null){
trace(_errors.noInterface);
return;
};
_interface.sendNotification(GCNotificationTypes.SHOW_TAB, {xPos:_arg1, yPos:_arg2});
}
public static function setup(_arg1:Stage, _arg2:String):void{
if (_interface == null){
if (_arg1 == null){
trace(_errors.noContainerMC);
return;
};
if ((((_arg2 == null)) || ((_arg2 == "")))){
trace(_errors.noGameIDHash);
return;
};
_interface = new GCBrainInterface(_arg1);
_interface.begin(_arg2);
} else {
trace(_errors.alreadyDefinedInterface);
};
}
}
}//package
Section 206
//GCBrainInterface (GCBrainInterface)
package {
import flash.events.*;
import flash.display.*;
import gc.utils.*;
import flash.net.*;
import flash.system.*;
import flash.external.*;
public class GCBrainInterface {
private var _lcID:int;
private var _container:Sprite;
private var _notificationBuffer:Array;
private var _conn:GCSWFConnection;
private var _brainLoader:Loader;
private var _brainLoaded:Boolean;
private var _stage:Stage;
public static var apiType:String = "AS3-API";
private static var BRAIN_URL:String = "http://gameschart.com/flash_client/getBrain.php";
public function GCBrainInterface(_arg1:Stage){
_stage = _arg1;
_container = new Sprite();
_container.addEventListener(Event.ENTER_FRAME, onFrameEntered);
_stage.addChild(_container);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
trace(("[GC-API] Games Chart v." + GamesChart.VERSION));
_lcID = (Math.random() * 10000);
loadBrain();
startLC();
}
public function begin(_arg1:String):void{
sendNotification(GCNotificationTypes.BEGIN_LOAD, {gameIDHash:_arg1, apiType:apiType, apiVersion:GamesChart.VERSION, swfURL:getURL()});
}
public function onGCEvent(_arg1:String, _arg2:Object):void{
if (GamesChart.onGCEvent != null){
GamesChart.onGCEvent.apply(null, [_arg1, _arg2]);
};
}
private function getURL():String{
var pageURL:String;
try {
pageURL = String(ExternalInterface.call("window.location.href.toString"));
if (pageURL == "null"){
return (_container.stage.loaderInfo.url);
} else {
return (pageURL);
};
} catch(e:Error) {
};
return (_container.stage.loaderInfo.url);
}
private function onFrameEntered(_arg1:Event):void{
if (!_stage.contains(_container)){
_stage.addChild(_container);
} else {
if (_stage.getChildIndex(_container) != (_stage.numChildren - 1)){
_stage.setChildIndex(_container, (_stage.numChildren - 1));
};
};
}
private function onFinishedLoading(_arg1:Event):void{
_brainLoaded = true;
trace("[GC-API] Brain Loaded!");
}
public function sendNotification(_arg1:String, _arg2:Object, _arg3:String=""):void{
if (_conn.connected){
_conn.send("sendNotification", _arg1, _arg2, _arg3);
} else {
_notificationBuffer.push({name:_arg1, body:_arg2, type:_arg3});
};
}
private function loadBrain():void{
_brainLoaded = false;
_brainLoader = new Loader();
_brainLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onFinishedLoading);
_brainLoader.load(new URLRequest(((BRAIN_URL + "?r=") + _lcID)));
_container.addChild(_brainLoader);
trace("[GC-API] Loading Brain.. ");
}
private function startLC():void{
_notificationBuffer = [];
_conn = new GCSWFConnection(("_GamesChartLC" + _lcID), this, GamesChart.VERSION);
_conn.addEventListener(GCSWFConnection.CONNECTED, onLCConnected);
}
private function onLCConnected(_arg1:Event):void{
var _local2:Object;
trace("[GC-API] API Connected to Brain!");
while (_notificationBuffer.length > 0) {
_local2 = _notificationBuffer.pop();
sendNotification(_local2.name, _local2.body, _local2.type);
};
}
}
}//package
Section 207
//GCNotificationTypes (GCNotificationTypes)
package {
public class GCNotificationTypes {
public static var LOAD_SKIN_AND_STYLE:String = "LOAD_SKIN_AND_STYLE";
public static var BEGIN_LOAD:String = "BEGIN_LOAD";
public static var STARTUP:String = "STARTUP";
public static var SHOW_CHART_LISTS:String = "SHOW_CHART_LISTS";
public static var SHOW_TAB:String = "SHOW_TAB";
public static var SKIN_AND_STYLE_LOADED:String = "SKIN_AND_STYLE_LOADED";
public static var LAUNCH_GAME:String = "LAUNCH_GAME";
public static var HIDE_TAB:String = "HIDE_TAB";
}
}//package
Section 208
//Main (Main)
package {
import flash.display.*;
import flash.events.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
import TestBed.*;
import flash.media.*;
import General.*;
import flash.text.*;
import flash.filters.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
import mochi.*;
import flash.utils.*;
public dynamic class Main extends MovieClip {
public var _bitmapAchievement:Bitmap;// = null
public var _classLevelPackLoot:Class;
public var _bitmapMenuBar:Bitmap;// = null
public var _bgm:int;// = -1
public var _classAchievement111Diamonds:Class;
public var _classSealBack:Class;
private var _help2Shown:Boolean;// = false
public var _classTitleScreenPlanet:Class;
private var _helpY:Number;// = 0
private var _helpX:Number;// = 0
public var _classAchievement20Levels3:Class;
public var _bitmapLevelPackLoot:Bitmap;// = null
public var _classTaunt1:Class;
public var _classTaunt2:Class;
public var _classTaunt4:Class;
public var _classTaunt5:Class;
public var _bitmapLevelSelectionScreen:Bitmap;// = null
public var _classTaunt3:Class;
public var _classAchievement60Levels2:Class;
public var _bitmapHelpText:Bitmap;// = null
public var _classMenuBarLockedIcon:Class;
private var _playWorkingDelay:int;// = 0
private var _helpHeliumShown:Boolean;// = false
private var _rotatePlanet:Number;// = 0
private var _plus1SpritesN:int;// = 0
public var _classLevelPackSelectionLockedQuestionMark:Class;
public var _bitmapMenuBarCogWheel:Bitmap;// = null
private var _helpHeavyShown:Boolean;// = false
public var _classWaitSecondsUntil:Class;
public var _bitmapFGNLogo:Bitmap;// = null
public var _bitmapSealBack:Bitmap;// = null
private var _plus1States:Array;
public var _classAchievementsScreen:Class;
public var _classLevelPackSelectionLockedDiamond:Class;
public var _bitmapTheEndScreen:Bitmap;// = null
public var _showHelp:Boolean;// = true
public var _classAchievement10Levels2:Class;
public var _classAchievement10Levels3:Class;
public var _classTheEndCongratulations:Class;
public var _bitmapYesNo:Bitmap;// = null
private var _help4Shown:Boolean;// = false
public var _bitmapInstructionsScreen:Bitmap;// = null
public var _classLevelPackSelectionCogWheel:Class;
private var _helpRotateExit:Boolean;// = false
public var m_currTest:Test;// = null
private var m_inGameMenuBarScrollY:Number;// = 0
public var _classWait:Class;
public var _classCreditsScreen:Class;
public var _first:Boolean;// = true
public var _audioBank:Audio;// = null
public var m_black:Sprite;// = null
public var _classSealFront:Class;
private var m_inGameMenuBarStayUp:Boolean;// = false
public var _classLevelPackScoreboard:Class;
private var _help5Shown:Boolean;// = false
public var _bitmapCreditsScreen:Bitmap;// = null
public var _bitmapLevelPackScoreboard:Bitmap;// = null
private var _helpDirectedGravityShown:Boolean;// = false
public var _classYesNo:Class;
private var m_inGameMenuBarLocked:Boolean;// = false
public var _bitmapLevelPackNew:Bitmap;// = null
public var _bitmapBackground:Bitmap;// = null
public var _bitmapChooseAShape:Bitmap;// = null
public var _bitmapMakeAsMany:Bitmap;// = null
public var _classAchievement45Levels:Class;
public var _classTitleScreenBackground:Class;
public var _classDamping:Class;
public var _classTitleScreenForeground:Class;
private var _plus1Speed:Array;
private var _plus1Sprites:Array;
private var _help6Shown:Boolean;// = false
public var _bitmapTheEndCongratulations:Bitmap;// = null
public var _classAchievement45Levels2:Class;
private var _helpBitmapZooming:Boolean;// = false
public var _classInstructionsScreen:Class;
public var _classTheEndScreen:Class;
public var _classPerfectBalance:Class;
private var _playHitDelay:int;// = 5
public var _bitmapTitleScreenPlanet:Bitmap;// = null
private var m_achievementTimer:int;// = 0
public var _bitmapLevelPackSelectionCogWheel:Bitmap;// = null
private var m_theEndExplosionTimer:int;// = 0
public var _classLevelSelectionScreen:Class;
public var m_currId:int;// = 0
public var _firstRun:Boolean;// = true
private var _help3AShown:Boolean;// = false
private var _helpGlassShown:Boolean;// = false
private var _help7Shown:Boolean;// = false
public var _classMenuBarCogWheel:Class;
public var _classAchievement10Levels:Class;
public var _classLevelPackSelectionLockedIcon:Class;
public var _classMenuBarSource:Class;
public var _classMenuIndicator:Class;
private var _help1Shown:Boolean;// = false
public var _classAchievementAllLevelPacks:Class;
public var _bitmapTitleScreenBackground:Bitmap;// = null
public var _bitmapSealFront:Bitmap;// = null
private var _rotateSeal:Number;// = 0
public var _bitmapTitleScreenForeground:Bitmap;// = null
public var _bitmapAchievementsScreen:Bitmap;// = null
public var _classBackgroundFlash1:Class;
public var _classBackgroundFlash2:Class;
public var _classBackgroundFlash3:Class;
public var _classBackgroundFlash4:Class;
public var _classLevelPackNew:Class;
public var _classAchievement60Levels:Class;
public var _bitmapMenuBarSource:Bitmap;// = null
public var _bitmapMenuIndicator:Bitmap;// = null
private var _help3BShown:Boolean;// = false
public var m_oldTime:int;// = 0
private var _playGlassHitDelay:int;// = 5
public var _soundTransformVolumeLow:SoundTransform;
private static const ACHIEVEMENT_BIT_10_LEVELS_2:int = (1 << 3);
private static const ACHIEVEMENT_BIT_10_LEVELS_3:int = (1 << 6);
private static const LEVEL_DATA_STRINGS_PACK_X:Array = ["20 0 0 1001 0 20 23.90000000000001 -12.700885481069541 6.906867389640557 -0.0007520029192284872 74 -12.750136597183838 8.600344295143186 -0.00027510308574983314 20 23.90000000000001 -5.95 -1.2899999990173237 0 28 -12.8 9.6 10 10 0 28 -4.25 3.5 10 70 0 4 10.45 -9.945833333333333 0 3 4.85 -9.945833333333333 -6.283185307179586 40 -2.25 -9.795833333333334 0 19 -10.25 -9.945833333333333 0 28 -0.95 10.5 10 10 0 1 -5.981960708913466 2.1197369986288064 0.0008067018049410182 1 -5.986671518281701 4.114716866448463 0.0007995515501741169 1 -5.991966687659447 6.109683736973498 0.0007863951149406505 1 -6.197081335227247 8.104492297254488 0.0007617725058695325 28 -6 9.6 10 10 0 58 2.25 2.1 -1.5707963267948966 28 -5.3 0.4 31 10 0 1000 1.5 ", "20 0 0 1001 0 46 20.3 10.9 -9.95 0 46 35 0.6 -9.9 0 32 5.7 -9.94375 -4.71238898038469 10 -5.95 -10.043750000000001 -3.141592653589793 24 -0.025009405614251426 -6.45295455562544 0.0046135927228676075 1 -5.431359070304187 -4.978833004723261 0.005220924624206473 1 5.515528838580533 -4.929463662477897 -0.0018081093080635482 2 5.519443898934477 -3.43446827389153 -0.0018144505279706186 2 -5.487938519117832 -3.484172239717471 0.005199585624172496 74 -6.965311878363081 -0.9843054772009172 -1.5727108569328647 74 7.0222760695271695 -0.9344961073318822 -1.5685119805620549 1 5.459886636135399 0.05801461877514432 0.00008187222046444027 1 6.508758870497196 2.05979627640258 0.001941866986366087 1 -5.456743462155344 0.008756370218781815 0.0017785707397056367 1 -6.5073868063377125 2.0099136337318866 -0.0018308375479381162 74 -4.95062199767414 3.004692152518957 -1.569926679764261 74 5.002093030943303 3.053767800718131 -1.5722946620475444 1 6.502769028398093 4.054829495436189 0.001978999417963682 1 -6.502614269740719 4.0049299858899925 -0.001847215502928466 28 0 10.5 20 10 0 72 3.509026674610263 -4.925794229715495 -0.006938851340544607 72 -3.4248282395649827 -4.967957766021871 0.010352621563051025 72 4.8087699061486475 -1.938178163675613 -0.0018152094937714765 72 -4.803893110569229 -1.985816701597761 0.005072222162808323 28 5.55 5.55 20 10 0 28 -5.45 5.5 20 10 0 1000 1.5 ", "20 0 0 1001 0 22 -0.1 -10.695833333333333 -0.7853981633974483 20 20 -1.3371019276307725 -5.309792215216227 0.01516446771018013 20 20 -0.23820384183037696 -3.644779778194849 0.11086148936631317 20 20 -2.4220204334493816 -3.63560434449497 -0.11797818553868432 20 20 -1.3230581977704585 -1.9706865161747789 0.10309133234964465 5 0.7102511029595541 -2.5021299636163974 -1.5294428072044657 4 -3.416904927187622 -2.4799762946650206 1.570726573156415 19 -1.421658070970991 -0.47618557736879935 0.0019470834701014782 74 -0.42961669223818855 0.5200387202923988 0.001671600132897689 72 -3.4547981315103615 1.0152874125989786 0.002806739230898366 72 -3.48076077755393 3.0100591912050754 0.0029022924781635746 2 -3.9397230020186775 6.003646369961324 -1.567923383166866 72 -1.4595286052690024 2.0133338514593255 0.0015109394030378854 72 0.557559262666022 2.0161965177307453 0.0012845303935156392 72 -0.39081645994723696 5.010739330882374 0.00705225072532815 29 -0.38640102164260876 5.00975436168943 -1.5697405537784663 5 0.058215126436536424 7.005458305060159 0.000247281024743494 74 -1.9364238674395855 6.003725025557869 -1.5681902383148507 28 -1.45 8.5 100 10 0 10 6.4 -9.747916666666667 0 10 -10.45 -9.847916666666666 0 46 23.60000000000001 11.3 -9.747916666666667 0 46 23.300000000000008 -4.55 -9.797916666666667 0 1000 1.5 ", "20 0 0 1001 0 72 -10.66402743216937 5.555509971675514 1.3994253762384812 72 13.650002111149032 -3.7450733166667027 -0.0007305238168306108 69 -11.25 -10.05 -3.141592653589793 10 -4.1 -10.1 -3.141592653589793 42 2.65 -10.1 1.5707963267948966 19 9.8 -10.2 -3.141592653589793 28 14.05 3.75 10 130 0 28 4.4 7.15 10 62 0 28 -4.7 6.05 180 10 -0.17 28 -5.1 -1.45 180 10 0.16000000000000003 28 9.1 9.75 90 10 0 73 2.404426732552195 -2.769123493937237 0.15971305032554703 20 19.7 -0.6986920828974528 -2.243293710269812 0.26135221601859054 20 19.7 -2.638640036172003 -2.556066692568387 0.4344102973456763 20 19.7 -4.578472223516038 -2.8695570481947765 0.07032900749563871 20 19.7 -6.521054396585409 -3.181909453445118 0.3988924172363473 20 19.7 -8.461022794454458 -3.4945563555915133 0.3617497205710904 28 -13.6 -4.4 10 40 0 1000 1.5 ", "20 0 0 1001 0 71 21.800000000000004 8.55 -9.697916666666666 0 71 21.800000000000004 4.85 -9.697916666666666 0 20 13.999999999999986 -5.3 -9.647916666666667 0 20 13.999999999999986 -8.05 -9.647916666666667 0 20 13.999999999999986 -10.8 -9.647916666666667 0 20 13.999999999999986 -2.8 -9.647916666666667 0 67 1 -9.691666666666666 0 48 -7.2438292342334645 -0.8854537032759886 0.0010674943067765302 1 -6.9972247616671694 1.1097892294764535 0.00106236291077097 74 -7.1488924675494445 2.6045963697019094 0.001054265249203492 28 -12.9 1.55 30 170 0 28 -7.25 3.6 10 10 0 28 8.65 5.75 10 10 0 24 8.602817121403136 -0.7454031084926034 -1.570343798483947 28 -5.9 10.55 170 10 0 1000 1.5 "];
private static const LEVEL_PACK_COG_WHEEL_SCALE:Array = [0.77, 0.77, 1.05, 0.8, 0.9, 1.05, 0.8, 1, 0.7, 0.58, 0.58, 0.54, 0.52];
private static const IGML_QUALITY_DY:Number = 42;
private static const IGML_QUALITY_DX:Number = 45;
private static const LEVEL_DATA_STRINGS_PACK_Y:Array = ["20 0 0 1001 0 48 4.35 -9.795833333333334 0 19 -0.8 -9.793750000000001 0 67 -6.05 -9.739583333333334 0 48 -0.1491327313867326 4.055435285241738 -0.000862488345766498 46 27.80000000000002 -2.9370037620883664 -3.2995354156556567 0.19732186540378444 29 -2.913817818966915 -2.755680309033484 0.7427865294846433 65 0.5 5.55 -0.0011328283823295962 28 -7.5 8.05 140 40 0 28 -10.3 3.25 84 60 0 28 -12.5 -1.75 40 40 0 49 -3.158260014446828 3.059894039066351 -0.0013376671320220028 2 -3.714456581266746 0.5661539007025961 -0.0013428340335946511 21 -5.095219820751546 0.0731561347112295 -2.357578291528727 30 4.899581337595641 3.049496300488736 -0.0006855456344740706 1000 1.5 ", "20 0 0 1001 0 67 -9.05 -9.3 0 67 -12.15 -9.3 0 5 12.9 -9.647916666666667 -1.5707963267948966 19 8.2 -9.897916666666667 0 33 3.05 -9.997916666666667 4.71238898038469 67 -1.7 -9.297916666666667 0 67 -5.6 -10.647916666666667 0 28 0.15 7.1 40 40 0.7853981633974483 33 -0.9099715911116415 4.629301439807243 -0.7836839027091745 12 1.2147391746466267 3.2249053217099792 0.7870143841351767 33 -0.9043618633638358 1.8143810690952078 -0.7837523904674099 12 1.2193194916047903 0.4107849114672655 0.7871316807833236 7 -3.036563700584188 3.923454776357527 0.7810601431473159 6 3.355699006347805 2.52045133125864 -0.7695537983094868 5 2.6373828225337843 4.6447271354528885 -0.7854022066382766 8 0.16962061822936383 -2.0620078165232383 -0.7789345319555163 20 24.80000000000001 0.18534083061155934 -4.488629817044849 0.00888386154091898 28 9.9 -6.55 140 17 0 28 -9.5 -6.55 140 17 0 1000 1.5 ", "20 0 0 1001 0 28 -0.1 9.95 150 10 0.03 46 15.49999999999999 4.9 -9.797916666666667 0 46 15.49999999999999 -4.95 -9.797916666666667 0 53 0.2 -9.952083333333333 -3.141592653589793 74 11.65 -9.847916666666666 -3.141592653589793 74 -11.05 -9.797916666666667 -3.141592653589793 28 7.65 -1.85 10 20 0 28 -8.35 -1.8 10 20 0 28 -0.35 -3.3 170 10 0 20 19.7 3.3902703831304772 -1.4170436360160037 -0.16113417998996565 20 19.7 1.4235965162349782 -1.4164433425546439 -0.30030783011757306 20 19.7 -2.5402981471436235 -1.4111337830598636 -0.17442933573115085 20 19.7 -4.505295101302202 -1.4091591898797347 -0.04234331980276678 28 6.2 2.05 10 10 0 28 -7.4 2.05 10 10 0 3 5.566609614599665 -0.9434433228150068 -1.5713254945246478 3 -6.492188976833098 -0.945961116711016 1.5852390393864801 24 -0.49651782636043645 0.0668006285308804 -0.0009995998394129303 74 -6.793028783028402 1.0582557426544623 0.03267795988459913 74 6.114420298226311 1.0535775480420158 -0.0034777352835527265 1 -0.5603280206251564 -1.4288869682706786 -0.001770767089041732 1000 1.5 ", "20 0 0 1001 0 8 -1.6 -9.897916666666667 -3.142185051467233 46 22.70000000000001 9.5 -10.093749999999998 0 2 4.1 -9.941666666666666 -3.141592653589793 68 -7.599999928002295 -9.979166666666796 -0.0000034558897485103436 28 -0.2 1.05 10 30 0 2 -8.798230410175913 -3.9853855441297625 -1.5716871519887277 2 -8.842560395728476 0.012001441421234584 -1.5764189989527766 74 -5.317958675710444 3.5050574193642254 0.000040094541096013007 74 -7.800669289336314 -2.985136406308777 -1.5701223761949 72 -7.338992084567267 0.010186597295563331 0.0006858717865750636 72 -7.335955083122032 2.0051890426992727 0.0006858413756985704 60 2.95 4.85 -4.71238898038469 28 12.9 6.95 10 40 0 28 10.7 -3.7 10 40 0 28 -2.9 9.5 10 10 0 28 -4.9 7 30 60 0 9 -4.820755637962372 1.009695844265379 1.5719686911211128 4 -4.29519837033893 -0.48464108419072305 -1.5695985621825022 1 -6.29105235069425 -1.9874512198473464 0.0016193250308921246 1 -4.279918613017912 -2.9796057178669395 0.001197680086832483 72 -6.30297811121008 -3.982476205319535 0.0016425611749659758 5 -5.80134117145899 -4.977486591698728 -3.1396790464105884 4 -4.3037290092238 -5.474614109883054 -1.5698395195533927 28 -6.85 7 10 60 0 28 -2.75 -4.2 10 40 0 28 -13.85 -1.9 10 40 0 28 -7.85 7 10 60 0 3 -8.365685175782886 3.5050689547258123 1.565888829268367 1000 1.5 ", "20 0 0 1001 0 22 8.1 -10.747916666666667 -0.7853981633974483 46 32.300000000000026 2.9 -9.847916666666666 0 37 -3.4 -9.947916666666666 0 2 -8.75 -9.989583333333334 -1.5707963267948966 28 7.4 10.5 156 10 0 20 16.699999999999992 -7.643146376709496 0.6051533448908966 0.14733357631973082 20 14.599999999999987 -6.486227155588488 1.657830631184946 -0.20027942027319864 20 19.699999999999996 -8.04247935636939 2.3756740948530166 -0.0050475022620805575 20 31.700000000000028 -5.987118757652327 3.9132514487869825 -0.33358088781773193 65 -9 6.15 -0.05109316242336282 28 -13.85 5.4 80 10 -0.060000000000000005 28 0.15 6 10 10 0 65 3.65 4.95 -0.013586161097326379 20 23.90000000000001 -8.717263117030694 4.443345569221285 -3.577439155938285 28 12.7 2.5 50 150 0 28 -7.75 9.1 10 20 0 28 -5.25 10.25 60 10 0 1000 1.5 "];
private static const LEVEL_DATA_STRINGS_PACK_Z:Array = ["20 0 0 1001 0 70 11.2 -9.9 -0.7853981633974483 69 6.4 -10.8 0 67 -10.15 -8.85 0 67 -7.05 -8.85 0 67 -5.15 -11.1 0 31 5.35 -8.85 0 67 -3.95 -8.847916666666666 0 68 -0.25 -9.847916666666666 0 28 0.2 -2.8 120 10 0 24 0.2000000200522949 -1.694999999999998 -2.2940517276938857e-17 28 0.2 -0.7 120 10 0 73 -7.9008741475691915 2.604215484720818 -0.001867269493685419 73 -7.892699504308513 -1.390826387072496 -0.0018580526255935453 73 8.255895498818672 2.70128385649334 0.0019633448810618325 73 8.262075584694358 -1.2937470912735438 0.0019652361577859696 28 8.15 5.2 10 10 0 28 -7.75 5.1 10 10 0 1000 1.5 ", "20 0 0 1001 0 2 3.25 -9.743750000000002 0 46 38.89999999999996 -3.85 -10.041666666666666 0 7 9.7 -9.891666666666667 0 48 -10.6 -9.891666666666667 0 28 10.45 -0.4 110 10 -0.3600000000000002 45 1.15 6.85 -3.141592653589793 28 -7.35 5.95 10 100 0 28 -1.15 10.45 120 10 0 65 -0.7 2.95 0 28 5 5.95 10 100 0 74 3.1492816800029853 0.4734833986185912 -0.0021998540145513395 28 5 -4.6 10 12 0 74 4.6961214101582875 -2.0093491946159903 1.5744393620608854 20 12.199999999999982 5.768652138313311 0.18138683949889267 -0.8868136012208535 20 12.199999999999982 6.905921696241601 -0.24676724312927484 -1.2341766576705429 20 12.199999999999982 8.043445991446621 -0.6750215311044144 -0.9910077896029774 20 12.199999999999982 9.181746502651286 -1.1033114947312406 -0.8261800252905882 1000 1.5 ", "20 0 0 1001 0 31 -11.05 -9.85 0 67 -0.3 -11 0 67 -0.3 -8.75 0 70 -4.649986993430064 -9.895833353633888 -0.00312158185419213 46 17.299999999999994 12.2 -9.94375 3.0327730101841817 46 17.299999999999994 9.1 -9.89375 -0.20097690973649737 29 4.3 -8.99375 -2.356194490192345 1 -4.528029080611021 5.254999961352303 -1.5707962881471358 72 -10.450022858893865 -3.9900236395863895 0.0000052747182517396765 72 -10.450022390272665 -1.9950134091781042 -0.00000495572822734062 72 7.493508790016118 1.264961326811851 -0.000011146701342673402 28 -10.45 4.5 20 110 0 28 0 9.5 190 10 0 74 5.94621285565948 5.254986549096167 -1.5708273192856061 74 8.945998471869554 5.254968848135231 -1.570859020419725 74 7.442098526581858 2.7599609919708636 -0.000011166532094029873 28 -6.2 7.75 70 30 0 28 7.500000000000001 8.250000000000002 40 20 0 1000 1.5 ", "20 0 0 1001 0 28 -10.45 8.85 10 40 0 18 -5.05 -10.15 -3.141592653589793 22 -8.6 -9.9 0.7853981633974483 22 -1.35 -10.05 -2.356194490192345 10 4.3 -9.9 -3.141592653589793 71 21.500000000000004 9.75 -9.847916666666666 0 67 -13 -9.902083333333334 3.141592653589793 5 12.75 -9.897916666666667 4.71238898038469 20 21.500000000000004 -13.902589095139364 -5.22343053417983 0.043185660635751764 20 21.500000000000004 -11.788819361163457 -4.846909217938685 0.10510483234319141 20 21.500000000000004 -9.673805298201692 -4.474659004874116 0.07250761047113459 20 21.500000000000004 -7.5624554040046466 -4.096206069544138 -0.0259863085697399 20 21.500000000000004 -5.446558665608017 -3.725142913189097 0.2935706991658346 20 21.500000000000004 -3.3321727262415872 -3.3504052385196283 0.16276805650012474 74 -0.2540907072588375 -2.8534330650543067 -0.15599008457253302 28 -8.4 -2.65 10 130 -1.3953981633974488 28 3.55 -4.5 10 60 0.5653981633974481 28 -0.15 10.35 150 10 0 28 7.85 6.85 10 80 0 28 10.9 7.3 10 70 0 28 -8.15 8.35 10 50 0 65 -0.15 4.5 1.5707963267948966 1000 1.5 ", "20 0 0 1001 0 5 -9.35 -9.95 -1.5707963267948966 46 25.700000000000017 -6 -9.8 0 18 -1.55 -9.75 -1.5707963267948966 74 3.2 -8.75 0 37 2.65 -11.05 -3.141592653589793 46 25.700000000000017 -12.7 -9.747916666666667 0 10 11.5 -10.697916666666666 0 10 9 -9.147916666666667 -3.141592653589793 28 -4.3 8.2 30 10 0 74 -5.301508538923753 5.704789765583176 -1.5711662780277902 74 7.648533675599077 5.604069850219466 -1.5724206304009505 74 11.698800342110383 5.604764878009455 -1.5712670138883427 74 9.689593545674171 -5.858962044728689 0.0001912086882215298 28 9.75 8.1 51 10 0 74 11.193634076752653 -3.3631366742888567 -1.5694573329734596 74 8.178287705086124 -3.364240816414855 -1.5705511669514371 72 9.689804058180371 -4.3586852634746025 0.00033664450343108576 1 9.688967125370885 -2.3637195403894844 0.00033303926928749826 5 9.633612824797634 -0.3688189935723653 -3.1412670710930533 5 9.62166739979204 0.626089110883948 0.00027145240787689663 5 9.66237814460964 2.620781894019562 -3.141380645209236 5 9.648893481745736 3.61567174452359 0.00015660711948018848 4 9.69319129346125 5.610288470690008 -3.1415575524436647 4 9.694992633384256 6.605174831683857 0.0000026590070265850526 28 -4.95 -3.3500000000000005 20 80 0 1000 1.5 "];
private static const LEVEL_DATA_STRINGS_PACK_5:Array = ["20 0 0 1001 0 46 34.7 2.6 -10.05 0 5 6.3 -10 -1.5707963267948966 2 -0.75 -10.05 -4.71238898038469 2 -5.8 -10.05 -4.71238898038469 2 -3.25 -10.033333333333333 -1.5707963267948966 20 16.699999999999992 4.364747062140013 -3.106830610121713 -0.5227416204701776 20 15.79999999999999 1.813223707856014 -2.398249287202375 -0.1701694585321142 28 4.5 10.5 20 10 0 65 -0.45 5.5 0 20 18.799999999999997 3.365507387365641 -1.6447707347854523 0.017608813047467933 29 3.3411892935420537 -1.730565052039645 0.5405275136129294 20 20 4.5 9.005000000000004 0 27 10.099999999999977 6.3 -1.8 27 10.099999999999977 0.7 -0.4 20 14.899999999999988 2.8474046708493153 -3.5291159135982224 0.3253475161806961 20 20 3.940507485113345 -4.888697287172895 -0.06128947511717157 74 5.640975792364792 -4.6002721814574565 -1.9195117859598656 1000 1.5 ", "20 0 0 1001 0 2 7.65 -9.847916666666666 0 46 20 2.4 -9.697916666666666 0.00004164661924551989 1 -2.15 -9.647916666666667 0 19 -8.05 -9.597916666666666 0.0045857483176274605 28 -13.2 1.15 40 170 0 27 1 1.25 -6.35 28 -12.25 -1.15 20 49 0 28 -10.45 1.8 60 10 0 58 -7.05 0.75 -0.013237811090520225 28 -11.05 -0.8 9 8 0 20 23.800000000000033 -9.415000106282859 -0.9038383591539209 -0.2608283087739231 46 25.300000000000033 -6.967355829806723 -1.0112482690723312 -0.364445761665432 28 -2.95 10.25 50 10 0 28 -2.95 4.25 50 10 0 28 6.4 5.6 13 10 0 1 6.350006775238014 4.105000187018683 -2.9393143318580305e-8 1 6.349989223498026 2.110000550010147 -6.209271736393667e-8 72 6.349966142339253 0.11254519587521865 -0.0005020964741992081 1000 1.5 ", "20 0 0 1001 0 1 -7.7 -9.6 0 54 -12.1 -9.6 0 28 4.6 9.5 20 10 0 1 4.600417586278855 8.004760966057002 0.00022033471811767262 5 4.6046908780048765 5.505542661293919 -1.5705450229196403 5 4.609261275333067 4.507437763991188 1.5717567953211744 72 4.6007134250004285 2.0100074925071043 0.0033827498185083644 1 4.604677919912428 0.012893993186218406 0.0055004669268532945 23 12.15 -9.997916666666667 0 24 1.05 -11.497916666666667 0 46 28.10000000000002 0.9 -9.297916666666667 0 28 -4.4 8.55 20 10 0 1 -4.400244458158681 7.055161706818847 -0.00007432848384791487 72 -4.399466893009208 5.06044094621393 -0.00018368255742596095 4 -4.405526615207854 2.5654933140926346 1.5705214170586517 4 -4.410821318231075 1.570532260240239 -1.5710859879484074 1 -4.448717707520713 -0.9244398168476676 -0.00030290255268489147 1000 1.5 ", "20 0 0 1001 0 61 9.25 -9.55 -1.5707963267948966 39 4.4 -10.45 0 67 0.35 -8.8 0 67 -2.95 -10.8 0 20 18.799999999999997 -5.65 -8.7 0 20 16.999999999999993 -8.25 -10.9 0 20 18.199999999999996 -10.2 -8.7 0 72 -4.999721651579159 5.0530720288326645 -0.00011219654335648453 72 4.999504218319377 5.051935077588164 -0.00011556968962555895 74 3.8825004748365037 1.0610041816191367 -1.5723225420059062 2 0.42344805108325595 -2.428078392124493 -0.00042083126980099576 19 1.4258533858759508 -1.4335135422194218 -0.0004182088153532907 20 18.799999999999997 0.3340031253918675 0.12733228089345827 0.052317609633502314 72 -2.5777084176566096 -1.9321720127138164 -0.0001116325188367791 1 2.2807483756660742 0.06723565883990486 -0.0001081588283612776 1 2.2768697957182376 2.0622360689204644 -0.00010815878476893564 1 0.2804220301896956 2.062332817083553 -0.000009964681392398791 30 -2.719573562383946 1.0628408949739545 -0.00011212220611470048 24 -0.01665855113858244 3.557515254880362 -0.00011465275529766875 28 0.05 6.55 110 10 0 1000 1.5 ", "20 0 0 1001 0 2 0 -9.947916666666666 -1.5707963267948966 22 3.5999999999999996 -10.095833333333333 -1.5707963267948966 24 -8.15 -9.095833333333333 0 54 7.75 -10.008333333333331 0 46 29.00000000000002 12 -10.041666666666666 4.539529612444804 52 26.600000000000016 9.8 2.975 0 74 -10.776297936612524 0.38385004849553683 0.3799999999998439 72 10.137509428515948 8.19671898624445 0.37817648878183724 52 26.600000000000016 -2.7 -2.1208333333333336 0 28 9.75 -2.85 30 90 0 28 3.4 -4.35 30 60 0 28 -2.6 -5.4 30 39 0 28 -0.9000000000000001 5.4 250 10 0.3800000000000002 52 29.300000000000026 3.4 0.11000000000000168 0 1000 1.5 "];
private static const LEVELS_DIAMOND_LIMITS:Array = [3, 5, 3, 5, 4, 7, 4, 6, 6, 8, 2, 3, 1, 2, 5, 7, 3, 6, 1, 1, 3, 6, 4, 6, 4, 12, 2, 3, 1, 2, 6, 11, 5, 8, 3, 6, 3, 5, 1, 1, 2, 3, 4, 5, 4, 5, 24, 26, 2, 5, 3, 7, 3, 5, 6, 10, 6, 12, 4, 5, 1, 6, 3, 5, 3, 4, 3, 4, 4, 6, 10, 24, 3, 4, 8, 13, 6, 12, 3, 9, 5, 10, 3, 5, 3, 4, 8, 12, 5, 8, 2, 6, 16, 19, 9, 17, 4, 8, 3, 4, 4, 7, 4, 9, 6, 10, 10, 14, 3, 5, 4, 5, 3, 6, 6, 7, 3, 7, 10, 14, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9];
private static const IGML_RESET_DY:Number = 42;
private static const IGML_MENU_DX:Number = 45;
private static const IGML_MENU_DY:Number = 42;
private static const THE_END_LEVEL:String = "20 0 0 1001 0 28 0 8.85 10 40 1.5707963267948966 28 6 7.7 10 90 1.5707963267948966 28 -5.95 7.7 10 90 -1.5707963267948966 28 12.55 4 40 10 1.5707963267948966 28 -12.5 4.05 40 10 1.5707963267948966 27 20 12.55 0 27 20 -12.45 0 28 -10 2.55 10 90 0 28 10 2.55 10 90 0 1000 1.5 ";
private static const IGML_AUDIO_DX:Number = 32;
private static const ACHIEVEMENT_BIT_ALL_LEVEL_PACKS:int = (1 << 8);
private static const IGML_RESET_DX:Number = 45;
private static const ACHIEVEMENT_BIT_60_LEVELS:int = (1 << 2);
private static const LEVEL_DATA_STRINGS_PACK_1A:Array = ["20 0 0 1001 0 13 8.45 -9.9 0 20 19.4 -6.95 -10 0 5 3.05 -9.697916666666666 -3.141592653589793 8 -2.2 -9.947916666666666 0 28 1.05 8.5 50 40 0 19 0.9926361424413294 3.5044344941385903 -1.5719230805099782 24 1.0408734277206058 0.007242143035737688 0.003629446700996351 8 1.0058631627852952 -1.9918609528620375 0.005497509772855311 20 20 -0.75 5.505000000000002 0 20 20 2.85 5.504166666666667 3.1252778143198167e-15 1000 1.5 ", "20 0 0 1001 0 4 6.25 -9.7 0 9 -5.6 -9.85 0 20 23.90000000000001 0.8 4.606249999999999 0 20 21.200000000000003 -1.2024411030556863 -1.2500885178089545 -0.00017496389017795689 14 0.55 -9.95 0 4 3.222296280091394 2.309500474546791 -1.571312379789594 2 2.728071265864699 3.804749551053582 -1.5713111418726353 19 -1.2027227184185376 2.80489763948148 -1.5710191767721584 28 0.8 7.8 50 40 0 1000 1.5 ", "20 0 0 1001 0 1 3.1 -9.9 0 4 -2 -9.9 0 67 -7.9 -9.95 -1.5707963267948966 67 8.7 -9.9 1.5707963267948966 5 -2.942395034269846 6.402689510154326 -1.5813079107075294 4 3.4061494544308437 6.405676556646584 1.5752884800853137 33 1.9269334550435118 -3.5884301988600913 -0.0012181462643121516 10 -0.8219227563186147 -2.590082601840913 -3.142812787639419 30 0.128688151783556 -0.09625541808382718 -0.0012189544317186773 19 -1.4467318664082616 4.902530263050563 -1.5758287353412848 19 1.9111280974481997 4.902456590239884 -1.5669921919558365 28 0.25 8.4 60 10 0 1000 1.5 ", "20 0 0 1001 0 39 5 -9.75 0 71 29.600000000000023 -0.5 -9.95 0 67 -4.85 -9.8 0 19 1.2113760756846996 0.19440149376140659 -0.5105599259526532 33 -1.3052474589742726 -2.183512779688904 -0.3591612894896026 19 -2.192815116726712 -0.5464775551880612 -0.036278347603786974 20 28.10000000000002 -4.0938241985026025 1.4237687353783237 -0.17146688634198295 29 1.0270587100011335 3.1592091841958982 -2.080174511056444 29 -3.0530512188162344 5.012055843515553 -2.999161807654292 27 121.99999999999918 0.8 10.150000000000002 1000 1.5 ", "20 0 0 1001 0 4 4.65 -9.6 0 46 30.200000000000024 0 -9.8 0 5 -4.7 -9.8 0 28 -4 8.55 30 10 0 28 4.05 8.55 30 10 0 1 -4.500033585308959 7.055049268243792 -0.0000010126598316568505 1 -4.549796175058767 5.060129061483747 0.000003475702467679618 1 -4.499516303151793 3.065188691336647 0.000007442341933684274 1 -4.499684850914893 1.0702200248965368 0.000007305928557346993 1 4.498818442290934 7.055032931833004 0.000015063229127289041 1 4.500631173670677 5.060088049729161 0.000037777862239641585 1 4.501373169263717 3.065128939059338 0.00005368288672293541 1 4.4517000023912106 1.0701459877445159 0.0000616582768686687 1000 1.5 "];
private static const IGML_AUDIO_DY:Number = 32;
private static const LEVEL_DATA_STRINGS_PACK_1B:Array = ["20 0 0 1001 0 5 5.85 -9.9 -1.5707963267948966 20 26.600000000000016 4.845676518832297 -0.6701976572722845 0.0013908295177453255 67 -6.9 -9.75 0 32 -0.7 -9.9 0 19 4.846501400799335 3.654786526041823 1.5703474965224211 24 -5.906255427322104 3.454492259984548 -4.713410719272651 28 4.85 7.15 10 10 0 28 -5.95 9.95 10 10 0 1000 1.5 ", "20 0 0 1001 0 20 30.500000000000025 -0.5 -10.35 1.7068257640818496 20 20 -7.35 -9.2 3.9269908169872414 19 7.05 -9.641666666666667 0 28 7.05 10.55 10 50 0 2 7.050442227810484 6.054257358213571 1.5722800886543005 2 7.050242404410772 2.0582784764306097 1.5708420279805684 28 7 -1.5 20 20 0 28 -2.55 9.05 23 160 0 28 -7.95 7 10 180 0 1000 1.5 ", "20 0 0 1001 0 69 -6.1 -10 0 24 2.9 -10 0 20 23.90000000000001 11.05 6.760000000000001 0 20 23.90000000000001 11.2 -4.190833333333334 0 20 23.90000000000001 6.1 1.8589713541666657 0 20 23.90000000000001 0.1 6.808971354166666 0 20 23.90000000000001 -11.8 6.756666666666667 0 20 23.90000000000001 -5.9 1.8599999999999997 0 20 23.90000000000001 0.1 -4.239999999999998 0 20 23.90000000000001 -11.85 -4.2410286458333335 0 28 11.2 -2.5 10 10 0 28 11.1 8.45 10 10 0 28 0.1 8.5 10 10 0 28 -11.9 8.45 10 10 0 28 6.1 3.55 10 10 0 28 -5.95 3.55 10 10 0 28 0.1 -2.55 10 10 0 28 -11.85 -2.55 10 10 0 1000 1.5 ", "20 0 0 1001 0 52 38.89999999999996 -1.1 5.739999996630004 -7.820072946320616e-16 20 24.200000000000017 -2.75 -9.897916666666667 0 52 26.000000000000018 2.2 -9.854166666666666 0 72 3.898424933473401 -2.196322753891344 -0.0015812285645593438 72 -3.600430317887262 -2.1892561127897663 -0.0004497069674423001 20 23.300000000000008 -1.1546686684359766 -2.3583128091143593 -0.0038173317229102557 20 23.300000000000008 1.4476270119493126 -2.3565378495228706 -0.0018484419921815693 24 0.049888360528756684 -0.6959051196973068 -0.00045256403315531386 28 0.05 1.8 40 40 0 1000 1.5 ", "20 0 0 1001 0 67 -4.75 -10.33333333333333 0 15 3.8 -9.18333333333333 0 19 1.1500000043502894 0.5549287549951417 0.00017809268907106616 28 0.55 2.05 20 20 0 28 0.05 -1.05 10 20 0 1000 1.5 "];
private static const PLUS_1_SPRITES_MAX:int = 64;
private static const ACHIEVEMENT_BIT_20_LEVELS_3:int = (1 << 7);
private static const IGML_SHOW_BEST_PY:Number = 3;
private static const IGML_SHOW_BEST_PX:Number = (((61 + 45) + ((61 - 16) - 32)) - 5);
private static const ACHIEVEMENT_BIT_45_LEVELS:int = (1 << 1);
private static const SCOREBOARD_CENTERS:Array = [250, 185, 243, 286, 371, 195, 471, 188, 328, 196, 288, 330, 444, 305, 395, 395, 220, 388, 417, 181, 405, 387, 316, 302, 0, 0];
private static const ACHIEVEMENT_SPRITE_CX:int = 299;
private static const LEVEL_PACK_DIAMOND_LIMITS:Array = [0, 5, 12, 24, 35, 50, 65, 78, 89, 999, 999, 999, 99];
private static const LEVEL_PACK_ICONS:Array = [101, 139, 173, 84, 240, 272, 220, 188, 231, 328, 173, 208, 476, 197, 236, 440, 337, 382, 292, 301, 336, 244, 395, 352, 351, 444, 474, 540, 132, 156, 523, 377, 402, 193, 313, 338, 432, 432, 454];
private static const ACHIEVEMENT_SPRITE_CY:int = 458;
public static const SCREEN_DX:int = 600;
public static const SCREEN_DY:int = 500;
private static const IGML_SHOW_BEST_DY:Number = 42;
private static const IGML_SHOW_BEST_DX:Number = 45;
private static const ACHIEVEMENT_BIT_111_DIAMONDS:int = (1 << 9);
private static const ACHIEVEMENT_BIT_10_LEVELS:int = (1 << 0);
private static const IGML_QUALITY_PX:Number = 61;
private static const IGML_QUALITY_PY:Number = 3;
private static const ACHIEVEMENT_BIT_60_LEVELS_2:int = (1 << 5);
private static const IGML_RESET_PX:Number = 245;
private static const LEVEL_PACKS_MAX:int = 13;
private static const ACHIEVEMENT_BIT_45_LEVELS_2:int = (1 << 4);
private static const LEVEL_DATA_STRINGS_PACK_2:Array = ["20 0 0 1001 0 20 22.700000000000006 -10.7 -10.05 0 20 22.700000000000006 12 -10.1 0 24 3.05 -10.1 0 68 -5.8 -10 -3.141592653589793 28 -0.7 9.3 120 10 0.14 28 0 1.5 20 10 0 28 -0.5 -1.5 20 10 0 28 0.5 4.55 20 10 0 20 20 -1 -3 0 20 17.299999999999994 -0.55 0.1400000000000004 0 20 17.299999999999994 -0.15 3.190000000000001 0 19 2.546930207530995 6.255783793957181 -1.8091511148315578 8 -1.798858337389729 7.214092007926414 -0.6464547302820621 20 17.299999999999994 -4.112539965842876 7.44446373396786 2.63469453194552 1000 1.5 ", "20 0 0 1001 0 74 -8.615571060518652 1.1860481679179273 0.7911799375427205 72 -10.534567799766286 1.9603733940216397 -0.0002633065373365909 73 -8.999903867199974 4.955047048487564 -0.00007579123179882415 19 9.954621769736912 4.0044957958673555 -1.5691038939565891 19 7.4964742131485105 4.0046015440156975 -1.5723973514617016 13 7 -10.25 0 22 -0.1 -10 0 46 28.70000000000002 -8.3 -9.85 0 20 35.599999999999994 -0.4 -2.1258229166666665 0 28 8.75 7.5 30 10 0 28 -0.4 0.15 30 10 0 28 -9.85 7.45 30 10 0 1000 1.5 ", "20 0 0 1001 0 67 -6.5 -10 0 67 -10.5 -10 0 20 16.999999999999993 10.15 -10 0 19 4 -10 1.7254351068899387e-8 67 -2.5 -10 0 72 6.7008741574681725 -1.8241907810154976 -0.000024758578374947818 28 -8.1 6.35 40 10 0 28 5.5 6.35 110 10 0 20 16.999999999999993 1.6496446981016757 5.005050049961633 -0.00041295541201493346 20 16.999999999999993 5.599322025105526 5.005106359055106 -0.0007930023475254285 20 16.999999999999993 9.700334063061465 5.005100984458384 0.0003939458989368669 28 12.45 6.85 40 20 0 28 14.7 2.35 20 110 0 24 6.04935505991329 3.6603518250055593 0.00002710518470595191 48 2.3482733000490983 2.165329002167716 0.000058726640084259237 48 5.893647594645236 2.1656170096481646 0.00008415170037065453 48 9.344698512372009 2.1655720018261895 -0.00003252095209921912 9 4.551193434043524 0.6706139285026964 -3.1414795266376583 1 7.600941367593609 0.17070898415491334 -0.00006085663972504737 72 4.402530337672974 -1.824339585509883 0.0001233339957497918 20 16.999999999999993 -7.15 5.005000000000002 0 28 0.4 7.35 210 10 0 1000 1.5 ", "20 0 0 1001 0 20 32.00000000000003 -3.1 -9.75 0.7853981633974483 66 3.55 -10.1 3.141592653589793 1 -5.303994031083203 1.7873002375373768 -0.2623671441068027 1 -5.054812420019293 3.7872974641644035 -0.26355220710402666 27 20 0.5 5.4 28 0.5 9.55 140 70 0 24 -0.13510418933921853 4.02227479340469 -0.26118767243203367 1000 1.5 ", "20 0 0 1001 0 20 23.90000000000001 5.25 -9.69375 0 7 -4.25 -9.69375 3.9269908169872414 20 34.7 0.75 -9.89375 -1.0548462248465889 28 -13.95 -3.95 90 20 0 28 -13 -2.95 90 20 0 28 -11.95 -1.95 90 20 0 28 -11 -1.45 90 10 0 28 6.5 8.05 10 140 0 28 4.55 8.55 10 130 0 28 2.6 8.55 10 110 0 28 0.6 9.55 10 110 0 31 -7.740187242031914 3.001734767292964 4.7106771920601735 28 -5.5 10 60 80 0 28 9.6 9.9 10 150 0 2 9.59970595331137 0.40431848973949813 1.5694295791873458 1000 1.5 "];
private static const LEVEL_DATA_STRINGS_PACK_4:Array = ["20 0 0 1001 0 28 -11.95 8.55 10 10 0 28 13 8.55 10 10 0 28 9.05 -2.45 10 10 0 28 -9 -2.45 10 10 0 4 -6 -9.75 1.5707963267948966 39 5.4 -9.85 -1.5707963267948966 30 -0.2 -9.9 0 29 0.6613354577524687 3.0088865613249816 -3.138566126903599 1 0.705358183897342 3.007139363937916 0.0014119282026955637 9 0.1997484061258895 6.004337582505198 -1.5711614132728473 28 0.05 8.5 60 10 0 1000 1.5 ", "20 0 0 1001 0 2 6.55 -10.3 0 4 1.25 -10.25 -1.5707963267948966 5 -2.35 -10.2 -1.5707963267948966 22 -6.45 -10.15 0 72 0.10501031635255405 0.07100713334450591 -0.000006299856200109442 72 0.10897680330963175 2.0657904759728307 -0.0000011606639135199779 72 0.10000938042220126 4.060499340113459 -0.0000031701270285650978 72 0.09911168910272138 6.055161063147656 0.000004587574807482711 28 0 7.55 60 10 0 28 5.5 6 10 40 0 28 -5.5 6 10 40 0 20 23.60000000000001 -0.036957056604264356 -2.103894187399052 0.5714068900330413 1000 1.5 ", "20 0 0 1001 0 67 7.4 -10.05 0 24 -1.9 -10.05 0 28 4.9 5.15 10 20 0 20 25.400000000000013 -6.35 -2.7649999999999997 0 20 25.400000000000013 5.85 -0.9650000000000004 0 28 -0.5 5.65 100 10 0 28 -7.1 -1 30 10 0 28 6.35 0.8 30 10 0 20 25.400000000000013 0.5 3.8845833333333335 -1.5817479052342385e-15 20 18.799999999999997 -4.9 4.2106249999999985 0 20 21.200000000000003 4.8 3.095000000000001 0 1000 1.5 ", "20 0 0 1001 0 71 20.6 4.1 -10.1 0 71 20.6 -3.9 -10.1 0 67 -11.4 -10.05 0 71 20.6 -7.35 -10.05 0 3 0.15 -10.097916666666666 0 54 12.35 -10.102083333333333 0 71 20.6 7.75 -10.097916666666666 0 20 20 0.8516774449902085 1.021380413993088 0.4015386545223139 20 20 -4.272348749564737 1.04225386825929 -0.6957808117174866 74 0.3374071629406971 -2.471357762157448 0.0016555947545177677 74 4.4884372162476565 -2.488024296276579 -0.009668742632578206 74 -3.8252702614954064 -2.461394571992 -0.01384717869879387 72 2.844272294456388 -0.9752954847091102 -0.004320217394412024 72 -1.9636785698084813 -0.978490124140382 -0.00011268072733699651 74 6.54307312797748 -0.012859164689957882 -1.5809445791885754 74 -5.786826006590517 0.061441565505220536 -1.5853945308739807 72 -1.9516594220533903 1.0162998567808736 -0.00009226391682219284 20 20 4.85149707439082 1.0047096148141392 -0.09834867182589173 72 2.85168459156115 1.0194986362804097 -0.0042814579111269905 74 5.100449241738248 2.4971235569626096 -0.010359092695299 74 -4.259174127035961 2.537165253329522 -0.013176466338159871 74 0.40169739399376697 2.515375096291614 0.0021275067704709786 72 6.850598603771089 3.9742539684480946 -0.012348709085820975 72 -6.110133246044421 4.056750877060676 -0.012467395941237556 72 2.998051164837006 4.012751510758314 -0.002630446312070858 72 -2.048477292593458 4.01136546990821 -0.004394530502122498 74 5.550397603875183 5.4853994749308965 -0.012540410207054988 74 -4.549378486844438 5.532456006699951 -0.01237533076522928 74 0.4019068520193528 5.507356063646517 0.0016022470092516732 28 -2 8.5 10 10 0 72 -6.94844008690603 7.054397050907649 0.0011933595385884277 72 -1.9972127832251698 7.003473748560427 -0.003687832782507167 72 3.0008238201932165 7.005087556704037 -0.000012644933788506669 72 7.949614919454948 6.949061690667444 -0.014855130659495107 28 -7 8.55 10 10 0 28 3.05 8.5 10 10 0 28 8.05 8.45 10 10 0 28 5.55 9.45 60 10 0 28 -4.5 9.45 60 10 0 1000 1.5 ", "20 0 0 1001 0 5 -7.65 -9.75 -1.5707963267948966 11 7.25 -9.7 3.141592653589793 2 2.05 -9.95 -4.71238898038469 2 -2.6 -9.95 -4.71238898038469 1 -0.763085569841148 -0.9872649304656912 0.003036365055204772 5 -0.8019090333357597 1.5090003939472891 1.5725089545556568 1 0.20293116977147338 2.0063686131893195 -0.0018205547696499237 15 1.2251196268321034 1.0055495889557047 1.5746176742090496 31 0.21276911981006283 4.004471705699836 0.00019449089365295127 28 0.05 9 40 80 0 1000 1.5 "];
private static const IGML_MENU_PY:Number = 3;
private static const IGML_RESET_PY:Number = 3;
private static const LEVEL_DATA_STRINGS_PACK_3:Array = ["20 0 0 1001 0 15 -0.65 -9.95 0 69 6.8 -9.85 -3.141592653589793 71 16.999999999999993 -12.3 -9.9 1.5707963267948966 71 16.999999999999993 12.5 -9.85 -1.5707963267948966 48 -7.8 -9.85 0 28 0.25 9.2 30 10 0 1 0.13163484506023243 7.704885122060959 1.5708209099928285 1 0.7688978572688213 5.707718605062193 -0.001744437906613314 1 0.09186290188152284 3.71139097360725 -0.0005040062965359605 1 0.8127399312602883 1.712968362921301 0.0013418781170276017 48 -0.022559917002787238 -0.2831549751905486 0.0013206266125428984 48 0.6235944419419024 -2.277541960156425 0.0010821557787903265 72 -1.2322999200413658 1.7187476366433962 -0.005833129863659789 72 1.9757876474790186 -0.2803900177406072 0.001773340252321906 72 2.173318558594581 3.712773078463535 0.004344196986816131 72 -1.2903997858600487 5.711025367361001 -0.004189305731516637 72 2.154301368067493 7.698435910805686 -0.006587226542232721 1000 1.5 ", "20 0 0 1001 0 2 4.35 -8.647916666666667 0 2 -3.75 -8.697916666666666 0 54 -12.95 -9.456249999999999 -1.5707963267948966 54 13 -9.456249999999999 0 19 8.1 -10.64375 0 19 0.3 -10.69375 0 19 -7.8 -10.69375 0 72 9.50000141457388 -4.795046355033581 0.00018495017418253715 72 6.999412137583439 -4.799173891068071 -0.0005886351308739747 72 -10.500027439910012 -4.945037024508493 -0.0007306603138970137 72 -7.799998585426145 -4.945046357923675 0.00018494909039404282 52 27.200000000000017 -9.05 -1.5949999999999998 0 28 8.25 -3.3 30 10 0 28 -9.05 -3.45 30 10 0 28 -0.5 3.55 50 10 0 52 27.200000000000017 -1.95 5.4049999999999985 -3.2328482771880457e-15 52 27.200000000000017 1.1 5.405186197916667 0 52 27.200000000000017 8.2 -1.4449999999999994 0 1000 1.5 ", "20 0 0 1001 0 22 -5.95 -10.85 -0.7853981633974483 46 26.600000000000016 0.1 -9.75 -3.141592653589793 4 5.8 -9.7 1.5707963267948966 28 3.9 2.9 40 10 -0.14999999999999997 2 -0.3548221899753298 7.043649689992143 1.524097551117804 28 -3.65 3 40 10 0.2900000000000001 1 -0.13372937273378158 2.1264905603621584 -0.8306403592361012 42 -0.07006267027692736 3.53167949972104 -0.045262392466396996 27 7.699999999999973 0.2 9.4 28 3.6 8.25 50 10 -0.4200000000000002 27 7.699999999999973 5.4 1.7 8 -0.2292717327810438 0.014760409462426863 -3.972199685091927 5 -0.5851636679523449 -2.380634461583863 -0.04507690512970538 20 31.100000000000023 0.29412690778238565 -3.9716606836031256 3.1317780598940153 1000 1.5 ", "20 0 0 1001 0 28 11.75 1.3 87 130 0 28 6.4 5.2 60 140 1.1253981633974486 11 6.25 -9.997916666666667 -3.141592653589793 69 -0.35 -10.252083333333333 -3.141592653589793 70 -6.75 -10.152083333333334 -3.141592653589793 28 -6 8.3 10 42 0 28 -1.7 5.5 18 10 0 28 3.5 3.3499999999999996 100 10 -0.45000000000000023 11 -3.71572116102798 4.525282827659911 -3.1643289832149213 27 10.099999999999977 -4.7 5.55 20 17.599999999999994 -0.35891032661084105 3.6870469964800927 -1.6892066051902441 20 17.599999999999994 1.2231096658346055 2.9207054208333005 0.16139605859194575 20 17.599999999999994 2.803974880385782 2.157217859180334 0.021033746727570454 20 17.599999999999994 4.382863670701442 1.3909699177498116 0.18538896454623907 1000 1.5 ", "20 0 0 1001 0 71 21.800000000000004 5.7 -10 1.5707963267948966 19 0.2 -8.9 0 3 -0.05 -10.95 0 67 -5.7 -9.85 -1.5707963267948966 28 8 5.5 10 50 0 28 -7.95 5.55 10 50 0 28 0.05 7.5 150 10 0 28 0 4.5 10 70 0 20 28.700000000000024 -0.05 -0.43000000000000105 -1.2035330232201333e-16 1000 1.5 "];
private static const LEVEL_DATA_STRINGS_PACK_7:Array = ["20 0 0 1001 0 71 23.300000000000008 2.5 -10.05 0 67 -2.95 -10 0 74 6.232325018351711 -0.2491052976401259 1.0236246408372185 74 -5.2782244122626 -0.5179582566721331 -1.0107236926749437 46 23.000000000000007 1.333141886804068 -3.349378843614028 -0.12208868032309723 46 23.000000000000007 -0.96581320569822 -3.2803026639462187 -0.09794210649977632 1 3.5470936081786113 -1.808560615079352 -0.3296176251502604 1 -2.7765407862619393 -1.534358954023526 0.19426228196911513 74 0.3657253193723509 -1.6746237505256998 -0.030048437013013303 20 23.000000000000007 4.531887295479665 0.12151442330849897 -0.4460040527607082 20 23.000000000000007 1.8114150125603892 -0.0724282214978272 -0.500998318343274 20 23.000000000000007 -0.7774918103952151 0.005412023513729481 -0.4876133133811599 20 23.000000000000007 -3.9260006457918184 0.4255682923499418 -0.03065029374216129 20 23.000000000000007 3.0393338620971186 1.8663962461312265 0.5744644900663484 20 23.000000000000007 0.5739019551285236 1.860265268556814 0.606902178382882 20 23.000000000000007 -2.1360531774202935 1.8618961976852582 0.27348132948306 7 -5.471854958928559 1.9329248017323701 0.6833097851847122 6 6.063359598377681 1.9270786065178882 2.875433428745531 2 4.111115130645703 3.513803822629942 0.0023237015141749067 2 -3.9412800627726616 3.512797102602121 -0.0033195295955087056 73 0.07919389468503701 5.005091777105364 0.000011144741657110275 1 3.0812105539207755 5.006697490783624 0.0019052584505006493 1 -2.9292550973801363 5.004597296241236 -0.003067414981583681 1 5.078360897205032 5.010706381040882 0.0020768175639212755 1 -4.926575122167099 5.010761951408093 -0.003103083375881646 74 4.076370656685972 6.503453258556718 0.0018121952611863867 74 -3.9203985107457413 6.5024916096778895 -0.002843742728376701 28 0.1 7.5 100 10 0 1000 1.5 ", "20 0 0 1001 0 67 -1.7 -9.4 3.141592653589793 67 2.6 -10 3.141592653589793 13 -3.999602599850544 0.5534838984136206 1.571584815900472 24 -0.04785131127413771 2.552675094370279 0.00041531335255849157 28 -3 8.55 30 110 0 28 4.05 8.55 30 110 0 4 -4.493234605452201 -0.44615413368076745 -1.566339349263388 2 4.555835106006508 0.05871654063551941 1.5728817617526172 1000 1.5 ", "20 0 0 1001 0 2 0.0007030764593168046 2.015280877409896 -1.570814263614952 72 0.9520350966403907 5.010368416979253 0.00016629405551213665 72 -1.0515311423552611 5.010246056255284 -0.0000011450457478797423 1 0.050062696347003006 7.00515949354418 0.000027102354476480696 38 5 -9.947916666666666 0 67 -0.35 -9.947916666666666 0 67 -4.2 -9.997916666666667 0 72 1.5883471323239484 -2.9845821986743046 -0.0038408541349124066 72 -1.6069810840823933 -2.979482861482749 -0.002247857820929623 19 0.09517459960090689 -1.4849355609958452 -0.0015042984636463854 1 1.593720597861222 0.010229288949052827 -0.0030844997140809763 1 -1.552110158219786 0.014735310142016777 0.00045329201277051685 1 1.5977642004855361 2.0068222138443046 -0.0014905436095256405 1 -1.551503542197409 2.0097476927309805 0.0004477272662475973 11 2.600703754769644 5.503470939579654 1.5698422007520951 11 -2.5528094852273555 5.504332004292989 -1.5703524455748608 28 0.05 8.5 60 10 0 1000 1.5 ", "20 0 0 1001 0 46 26.300000000000015 13.05 -9.995833333333335 0 47 9.95 -9.995833333333335 0 1 -13.05 -10.0375 0 1 -9.8 -10.0375 0 1 -6.45 -9.9875 -1.5707963267948966 24 1.35 -9.935416666666665 0 28 9.4 8.55 20 10 0 28 11.35 8.55 20 10 0 72 9.395980374444203 7.0551754103637 -0.00008284382712221796 1 11.391399738876629 7.0550855913538015 0.000058248178621201755 1 9.350087828210235 5.0605390810258095 -0.00016544878388717339 72 11.353889376603155 5.060281711923576 0.00011557420915290256 72 9.303159540171535 3.0658307731932357 -0.00023551610128861623 1 11.305305875222352 3.0655202908099617 0.00011474396269206462 1 9.301405937954586 1.0711108780381629 -0.00030214665806615283 72 11.306546639730843 1.070768372144219 0.00009886435453977423 1 11.277163988219826 -0.9240383931767638 0.00007607930232566513 72 9.275720125981747 -0.9237030096457985 -0.0003962811725823606 1 9.284482952418925 -2.918591837832414 -0.000480905285094234 72 11.304176686757422 -2.918912290502316 0.00007750407703938493 1 11.281018623687352 -4.913853644141646 0.00007482544342499537 72 9.276039283598093 -4.913514024766715 -0.0004933584485315862 28 -10.6 6.05 124 10 0.39539816339744793 1000 1.5 ", "20 0 0 1001 0 48 6.2621359223300965 -9.318305016181231 0 72 3.3009708737864076 -9.318305016181231 -1.5707963267948966 19 -1.6019417475728157 -9.269761326860843 0 48 -6.45631067961165 -9.366848705501617 0 28 -1.95 5.35 10 4 0 28 2 5.4 10 5 0 28 0.15 9.75 50 10 -0.29000000000000015 28 0 -5.45 30 10 0 28 2 -0.95 10 100 0 28 -2 -0.95 10 100 0 74 -0.04060740435800759 4.655547340281915 -0.00015508527906409907 20 16.999999999999993 -0.6558552136431823 3.3120612690312528 0.00919226273205778 20 16.999999999999993 0.6564894848431324 2.2424400694055966 0.03844400220249109 20 16.999999999999993 -0.656365567782531 1.1732585424768265 0.15383203355757877 20 16.999999999999993 0.6561871013003596 0.10339469682980376 -0.2402547627624636 20 16.999999999999993 -0.6559649235835364 -0.9673703496662652 0.09000664939149071 20 16.999999999999993 0.6557088716480707 -2.0392107972328843 -0.09332399438650885 20 16.999999999999993 -0.6554887277738038 -3.1121819484477005 0.000694709020213455 20 15.49999999999999 0.7301814510637308 -3.950526707436769 -0.21465708731021713 1000 1.5 "];
private static const LEVEL_DATA_STRINGS_PACK_8:Array = ["20 0 0 1001 0 46 28.700000000000024 -2.65 -10.65 0 5 -12.55 -9.25 1.5707963267948966 46 28.700000000000024 -9.5 -9.2 0 46 28.100000000000023 -5.8 -9.147916666666667 0 53 12.1 -10.054166666666667 0 53 7.1 -10.054166666666667 0 1 2.9 -10.945833333333333 0 1 0.25 -8.845833333333333 0 46 31.700000000000028 -8.9 -3.630000000000001 0 28 -9.35 -1.55 20 10 0 65 -1.55 0.7 2.356194490192345 72 7.484484816696247 -1.94313760090388 -0.004035164732093917 54 8.930514563523873 0.05031144078637657 -0.005292555197806658 54 6.035074111518889 0.05580693998737246 -1.5634707545291258 72 9.562296035916866 -1.9494917118052024 -0.0021606912818592358 72 5.421852718057 -1.944299241783952 0.005831725321759649 55 7.514287620939764 3.9022810850036005 -0.7915879432511931 54 10.484060014494387 2.0437349757375083 1.5677266704433281 54 10.984777951552552 0.0469496761138589 1.5682056278743803 54 4.554855347383169 2.0472980092125073 0.007818817215269204 54 11.568528210010118 -1.9527250832566372 -0.0021804779042620876 54 3.419014810063514 -1.952730668973601 0.002272759015901511 72 3.9884564797446704 0.04687290232942942 0.00558396318597304 28 10.85 -3.45 40 10 0 28 4.25 -3.45 40 10 0 1000 1.5 ", "20 0 0 1001 0 21 8.1 -9.245833333333335 -2.356194490192345 4 2.4 -10.195833333333333 0 46 26.000000000000018 -3 -10.245833333333335 0 22 -8.45 -9.295833333333334 2.356194490192345 9 4.450617174657743 1.0504950799473762 1.5711170287787874 20 20 -1.55 6.500865791374814 -7.127173251029436e-15 20 20 -1.75 -1.9949999999999997 0 20 20 -1.6 2.0550000000000006 0 28 0.55 3.55 80 10 0 28 -2.95 -0.5 90 10 0 20 20 -6.5 -2 0 28 -3.3 8 60 10 0 1000 1.5 ", "20 0 0 1001 0 46 25.100000000000012 4.3 -9.847916666666666 0 19 -3.4 -9.895833333333334 0 74 7.600004969310246 5.750138087435929 -1.570785853839093 74 2.1998796559226834 5.754086345784745 -1.572630363637326 74 -3.350240853692528 5.75495838665638 -1.5708795673435434 74 -8.900354887578422 5.754920970509386 -1.5709544357770147 28 0.2 8.25 210 10 0 1000 1.5 ", "20 0 0 1001 0 7 2.45 -9.85 -0.001997238537463877 20 14.899999999999988 -2.1 -9.8 0 46 33.500000000000014 -6.65 -9.9 0 20 17.299999999999994 -11.45 -9.8 0 54 7.9 -9.80625 0 54 12.35 -9.80625 0 60 6.5 3.05 0 60 -7.6 3 0 28 -0.4 0.05 120 10 0 72 -5.003008260934627 -1.4449697317149515 0.000004053015876208981 24 -0.5056872225536653 -2.9398969404130937 0.0000033680720748282103 22 -5.1114659413431465 -4.93491578478772 -6.2831807727511775 21 3.997437748390959 -4.934884908507129 0.000029893444562260987 20 21.200000000000003 -2.8434748611556104 -4.494880214861033 0.00907021080773018 20 21.200000000000003 -0.46051552420366143 -4.494884600938834 0.04301784575139601 20 21.200000000000003 1.8065546880019008 -4.4948217392795335 0.05870266066079406 20 21.200000000000003 -4.4975179246750825 -5.812961518013698 0.000628996550474015 20 21.200000000000003 -1.653337618877903 -6.24323973326936 -0.04403314080932258 20 21.200000000000003 0.674882324621072 -6.281569475934453 0.014230025519378322 20 21.200000000000003 3.425886271581382 -5.8553119470531225 0.24846019742937903 72 3.798431635053706 -1.444960278565699 -0.000002348855300153494 1000 1.5 ", "20 0 0 1001 0 67 -12.6 -8.85 0 70 11.947053721745057 -10.047053721745058 0.7853981633974483 72 8.3 -8.945833333333333 0 72 5.25 -10.695833333333333 0 72 2.25 -8.995833333333334 0 72 -0.85 -10.645833333333334 0 72 -3.95 -8.945833333333333 0 67 -7.15 -10.595833333333333 0 67 -10.05 -8.845833333333333 0 74 4.224448710587688 -0.6621336909440794 -0.2499888747313923 74 4.198965320118732 0.3713107233852635 -0.24999901094486648 28 -1.5 10.35 120 10 0 28 4 5.9 10 96 0 28 -7.05 7.75 10 60 0 28 14 -3.9 20 70 0 28 8.5 0.3 100 10 -0.25000000000000006 28 -9.1 4.85 50 10 -0.24000000000000005 65 -1.55 2.9 -1.8863452826787028 20 21.800000000000004 7.312929328635518 -1.0361278499880942 -0.11984287046982091 20 21.800000000000004 9.42109961756002 -1.5711431844678792 -0.11886128087202008 20 21.800000000000004 11.5488578377253 -2.1143559808298433 -0.1795014620307628 20 21.800000000000004 7.900054885772051 -3.1314507354344236 -0.03902759536186898 20 21.800000000000004 10.020985386025023 -3.662655060811875 -0.07352194828151756 20 21.800000000000004 8.499524187168637 -5.222969512973011 -0.02374265664391503 28 7.15 4.35 10 70 0 28 10.45 3.5 10 70 0 28 13.65 2.9 10 70 0 28 -7 -4.3 10 60 0 28 -9.15 -2.5 10 40 1.9307963267948969 1000 1.5 "];
private static const IGML_AUDIO_PX:Number = 16;
private static const IGML_AUDIO_PY:Number = 9;
private static const IGML_MENU_PX:Number = 193;
private static const LEVEL_DATA_STRINGS_PACK_6:Array = ["20 0 0 1001 0 10 -6.2 -9.85 -3.141592653589793 46 22.700000000000006 6.75 -9.797916666666667 -4.2872095399885726e-8 68 1.1 -9.947916666666666 0 28 -10.1 -6.2 113 24 0 28 13.9 6 40 100 0 20 18.199999999999996 -1.759730871782595 -2.7441615002968605 0.011873453287630028 20 18.199999999999996 0.0448692730425715 -2.550477518290597 0.10762422861559667 20 18.199999999999996 1.8494447276074946 -2.3568306882882015 0.2980060430177923 20 17.599999999999994 3.6207093236064347 -2.136517332697192 0.5484671223995833 20 17.599999999999994 5.375046384653336 -2.0920862066847836 -0.00528249454628287 24 0.09178662049588433 -1.132374033270157 0.10691161639221908 28 -2.45 2.1 20 58 0 28 4.8 2.5 10 30 0 28 11.9 0 80 100 0 28 7.25 -0.5 20 90 0 28 5.8 2 10 40 0 28 1.65 2.5 29 30 0 1000 1.5 ", "20 0 0 1001 0 2 4.5 -9.245833333333335 0 5 -0.29999999999999993 -9.445833333333333 0 1 -4.25 -9.395833333333334 -0.00003305806651189719 1 0.49889913204462694 -0.92967582389255 0.000003464280487610487 2 0.45255264765091613 -2.424634925560847 0.0000036918187414603743 2 0.4460688309451431 0.565250610837578 0.0000012257289334706007 1 0.5062977304159331 2.0601529039742608 9.33675149064325e-7 2 0.5058922994832323 3.5550408558661415 9.044315014224653e-7 28 0.5 8.05 20 80 3.141592653589793 1000 1.5", "20 0 0 1001 0 31 9.05 -9.7 3.141592653589793 46 20 -11.05 -9.8 0 24 -2.2 -9.7 0 27 12.199999999999982 0.2 -4.45 72 -1.2936046493807416 2.22025798801658 0.000023368446816869556 72 -1.29614642253024 4.215215344645946 0.000019805912930010435 72 -1.2981884628043106 6.210140729703263 0.000013677177773603382 72 -1.3002313361429014 8.205045909041495 0.000005782596024331739 28 -1.3 9.7 40 10 0 28 -1.55 0.05 40 10 0 1000 1.5 ", "20 0 0 1001 0 2 -2 -9.44375 0 1 3.65 -9.543750000000001 0 8 -0.0963717482215529 -3.4843407871334655 -0.009467473005588147 6 -0.557078835498322 -0.4848505904184931 1.5613395808915664 7 0.46513701105397953 1.5055033125040176 1.566304310671639 38 -0.05329376383193678 3.5042450504021594 6.2816600944604675 28 0.05 10.5 60 110 0 1000 1.5 ", "20 0 0 1001 0 48 -7.55 -9.941666666666666 0 20 14.299999999999986 0.55 -9.889583333333334 0 48 8.5 -9.937499999999998 0 48 4.5 -9.9875 0 48 -3.5 -9.937499999999998 0 28 13.5 1.1 30 130 0 28 5.9 -3.9 170 30 0 20 22.100000000000005 5.085456392279196 1.9722814622753624 0.024647766625586643 28 5.5 8.85 190 40 0 28 2.6 6.3 10 13 -3.141592653589793 24 3.0375717439220056 5.131077893898636 0.20708200218299486 21 8.251117551272092 5.715159846612852 -2.142260874645075 20 22.100000000000005 5.775812325638663 4.071203554769622 0.09932977285721845 20 22.100000000000005 3.6134883991573843 3.617144475604475 0.14888058686760156 20 22.100000000000005 7.693382551219238 2.9826497324128454 0.17022325914766392 28 0.4 -2.8 20 50 0.7853981633974483 28 -1.6 -2.35 20 40 0 1000 1.5 "];
public static var _bitmapANewLevelPackIsOpen:Bitmap = null;
public static var s_mouseClickedX:int;
public static var s_mouseClickedY:int;
public static var sm_levelPackScoreboardX:Number = 0;
public static var sm_levelPackScoreboardY:Number = 0;
public static var s_mouseClicked:Boolean = false;
public static var _playGlassCrack:int = -1;
public static var _bitmapQualityHigh:Bitmap = null;
public static var _playBadPickup:int = -1;
public static var _bitmapNextLevelIsOpen:Bitmap = null;
public static var _classHelp2:Class = Main__classHelp2;
public static var sm_redrawSlotBar:Boolean = false;
public static var _classHelp4:Class = Main__classHelp4;
public static var _classHelp5:Class = Main__classHelp5;
public static var _classHelp6:Class = Main__classHelp6;
public static var _classHelp7:Class = Main__classHelp7;
public static var _classHelp1:Class = Main__classHelp1;
public static var _bitmapAudioOff:Bitmap = null;
public static var _classSlotBlack:Class = Main__classSlotBlack;
public static var _classHelpDirectedGravity:Class = Main__classHelpDirectedGravity;
public static var _classPerfectStrike:Class = Main__classPerfectStrike;
public static var _bitmapAudioOn:Bitmap = null;
public static var _bitmapResetButton:Bitmap = null;
public static var _nice:Boolean = false;
public static var _playReturnShape:int = -1;
public static var _classHelpGlass:Class = Main__classHelpGlass;
public static var s_mouseOver:Boolean = false;
public static var _bitmapQualityBest:Bitmap = null;
public static var _outlineFilter:GlowFilter = new GlowFilter(0, 1, 3, 3, 1000, 1);
public static var sm_levelBestBalls:Array = new Array(80);
public static var _bitmapMenuButton:Bitmap = null;
public static var _classShowBestYes:Class = Main__classShowBestYes;
public static var m_particleManager:ParticleManager = new ParticleManager();
public static var _bitmapWalkthroughButton:Bitmap = null;
public static var _classNextLevelIsOpen:Class = Main__classNextLevelIsOpen;
public static var _classSlotBarBest:Class = Main__classSlotBarBest;
public static var _bitmapAllDone:Bitmap = null;
public static var _fontClass1:Class = Main__fontClass1;
public static var _classSlotDiamondBright:Class = Main__classSlotDiamondBright;
public static var _classSlotMinus:Class = Main__classSlotMinus;
public static var s_selectedLevelPack:int = 0;
public static var _bitmapWaitSecondsUntil:Bitmap = null;
public static var _classMakeAsMany:Class = Main__classMakeAsMany;
public static var _playHit:int = -1;
public static var _bitmapQualityLow:Bitmap = null;
public static var _bitmapParticleLayer:Bitmap = new Bitmap(new BitmapData(SCREEN_DX, SCREEN_DY, true, 0), "auto", true);
public static var _classMenuButton:Class = Main__classMenuButton;
public static var s_showBest:Boolean = false;
public static var _bitmapDamping:Bitmap = null;
public static var _audio:Boolean = true;
public static var m_sprite:Sprite = null;
public static var sm_levelPackScoreboardNext:int = -1;
public static var _bitmapWait:Bitmap = null;
public static var sm_levelPackUnlockedTimer:int = 0;
public static var _bitmapNextButton:Bitmap = null;
public static var _textFieldLPSBig:TextField = null;
public static var s_mouseWheel:int = 0;
public static var _classQualityHigh:Class = Main__classQualityHigh;
public static var _bitmapShowBestNo:Bitmap = null;
public static var sm_achievementBits:int = 0;
public static var sm_levelPackUnlocked:Array = new Array(LEVEL_PACKS_MAX);
public static var sm_levelPackCurrId:Array = new Array(LEVEL_PACKS_MAX);
public static var _classResetButton:Class = Main__classResetButton;
public static var _classQualityLow:Class = Main__classQualityLow;
public static var s_quality:int = 1;
public static var m_this:Main = null;
public static var _classSlotDiamondGray:Class = Main__classSlotDiamondGray;
public static var _textFieldLPSSmall:TextField = null;
public static var _classHelp3B:Class = Main__classHelp3B;
public static var _classQualityBest:Class = Main__classQualityBest;
public static var _playRotate:int = -1;
public static var _classHelp3A:Class = Main__classHelp3A;
public static var _classAudioOff:Class = Main__classAudioOff;
public static var _classHelpHelium:Class = Main__classHelpHelium;
public static var _playOn:Boolean = false;
public static var _classQualityMedium:Class = Main__classQualityMedium;
public static var _failed:Boolean = false;
public static var _playGlassBreak:int = -1;
public static var _classNextButton:Class = Main__classNextButton;
public static var _playGlassHitVolume:Number = 0;
public static var sm_levelUnlocked:Array = new Array(80);
public static var sm_levelBestMask:Array = new Array(80);
public static var _classSlotBarScore:Class = Main__classSlotBarScore;
public static var _bitmapShowBestYes:Bitmap = null;
public static var _classShowBestNo:Class = Main__classShowBestNo;
public static var sm_levelPackUnlockedID:int = -1;
public static var m_input:Input = null;
public static var _bitmapSlotBarBest:Bitmap = null;
public static var _classHelpHeavy:Class = Main__classHelpHeavy;
public static var sm_fps:int = 60;
public static var _textFieldDampTimer:TextField = null;
public static var _classAudioOn:Class = Main__classAudioOn;
public static var s_mouseX:Number = 0;
public static var _bitmapQualityMedium:Bitmap = null;
public static var s_mouseY:Number = 0;
public static var _playGlassHit:int = -1;
public static var _classWalkthroughButton:Class = Main__classWalkthroughButton;
public static var _playHitVolume:Number = 0;
public static var _bitmapTaunt:Bitmap = null;
public static var _bitmapSlotBarScore:Bitmap = null;
public static var _classChooseAShape:Class = Main__classChooseAShape;
public static var _classNextLevelIsOpenSmall:Class = Main__classNextLevelIsOpenSmall;
public static var _bitmapPerfectStrike1:Bitmap = null;
public static var _bitmapPerfectStrike2:Bitmap = null;
public static var sm_levelPackScoreboard:int = -1;
public static var _bitmapPerfectStrike3:Bitmap = null;
public static var m_fpsCounter:FpsCounter = new FpsCounter();
public static var _classSlotBright:Class = Main__classSlotBright;
public static var _classANewLevelPackIsOpen:Class = Main__classANewLevelPackIsOpen;
public static var _playGrabShape:int = -1;
public static var sm_levelBest:Array = new Array(80);
public function Main(){
_classTitleScreenBackground = Main__classTitleScreenBackground;
_bitmapTitleScreenBackground = null;
_classTitleScreenPlanet = Main__classTitleScreenPlanet;
_bitmapTitleScreenPlanet = null;
_classTitleScreenForeground = Main__classTitleScreenForeground;
_bitmapTitleScreenForeground = null;
_classInstructionsScreen = Main__classInstructionsScreen;
_bitmapInstructionsScreen = null;
_classAchievementsScreen = Main__classAchievementsScreen;
_bitmapAchievementsScreen = null;
_classCreditsScreen = Main__classCreditsScreen;
_bitmapCreditsScreen = null;
_classTheEndScreen = Main__classTheEndScreen;
_bitmapTheEndScreen = null;
_classTheEndCongratulations = Main__classTheEndCongratulations;
_bitmapTheEndCongratulations = null;
_classLevelPackNew = Main__classLevelPackNew;
_bitmapLevelPackNew = null;
_classLevelPackScoreboard = Main__classLevelPackScoreboard;
_bitmapLevelPackScoreboard = null;
_classLevelPackLoot = Main__classLevelPackLoot;
_bitmapLevelPackLoot = null;
_classMenuIndicator = Main__classMenuIndicator;
_bitmapMenuIndicator = null;
_classYesNo = Main__classYesNo;
_bitmapYesNo = null;
_classLevelSelectionScreen = Main__classLevelSelectionScreen;
_bitmapLevelSelectionScreen = null;
_classLevelPackSelectionCogWheel = Main__classLevelPackSelectionCogWheel;
_bitmapLevelPackSelectionCogWheel = null;
_classLevelPackSelectionLockedIcon = Main__classLevelPackSelectionLockedIcon;
_classLevelPackSelectionLockedDiamond = Main__classLevelPackSelectionLockedDiamond;
_classLevelPackSelectionLockedQuestionMark = Main__classLevelPackSelectionLockedQuestionMark;
_classMenuBarSource = Main__classMenuBarSource;
_bitmapMenuBarSource = null;
_bitmapMenuBar = null;
_classMenuBarLockedIcon = Main__classMenuBarLockedIcon;
_classMenuBarCogWheel = Main__classMenuBarCogWheel;
_bitmapMenuBarCogWheel = null;
_audioBank = null;
_classAchievement10Levels = Main__classAchievement10Levels;
_classAchievement45Levels = Main__classAchievement45Levels;
_classAchievement60Levels = Main__classAchievement60Levels;
_classAchievement10Levels2 = Main__classAchievement10Levels2;
_classAchievement45Levels2 = Main__classAchievement45Levels2;
_classAchievement60Levels2 = Main__classAchievement60Levels2;
_classAchievement10Levels3 = Main__classAchievement10Levels3;
_classAchievement20Levels3 = Main__classAchievement20Levels3;
_classAchievement111Diamonds = Main__classAchievement111Diamonds;
_classAchievementAllLevelPacks = Main__classAchievementAllLevelPacks;
_bitmapAchievement = null;
_classPerfectBalance = Main__classPerfectBalance;
_classTaunt1 = Main__classTaunt1;
_classTaunt2 = Main__classTaunt2;
_classTaunt3 = Main__classTaunt3;
_classTaunt4 = Main__classTaunt4;
_classTaunt5 = Main__classTaunt5;
_classWait = Main__classWait;
_classWaitSecondsUntil = Main__classWaitSecondsUntil;
_classDamping = Main__classDamping;
_classSealBack = Main__classSealBack;
_bitmapSealBack = null;
_classSealFront = Main__classSealFront;
_bitmapSealFront = null;
_classBackgroundFlash1 = Main__classBackgroundFlash1;
_classBackgroundFlash2 = Main__classBackgroundFlash2;
_classBackgroundFlash3 = Main__classBackgroundFlash3;
_classBackgroundFlash4 = Main__classBackgroundFlash4;
_bitmapBackground = null;
_bitmapHelpText = null;
_bitmapChooseAShape = null;
_bitmapMakeAsMany = null;
_plus1SpritesN = 0;
_plus1Sprites = new Array(PLUS_1_SPRITES_MAX);
_plus1States = new Array(PLUS_1_SPRITES_MAX);
_plus1Speed = new Array(PLUS_1_SPRITES_MAX);
m_black = null;
_soundTransformVolumeLow = new SoundTransform(0.4);
_showHelp = true;
_firstRun = true;
_first = true;
_bgm = -1;
_help1Shown = false;
_help2Shown = false;
_help3AShown = false;
_help3BShown = false;
_help4Shown = false;
_help5Shown = false;
_help6Shown = false;
_help7Shown = false;
_helpGlassShown = false;
_helpHeavyShown = false;
_helpHeliumShown = false;
_helpDirectedGravityShown = false;
_helpX = 0;
_helpY = 0;
_helpBitmapZooming = false;
_helpRotateExit = false;
m_inGameMenuBarScrollY = 0;
m_inGameMenuBarStayUp = false;
m_inGameMenuBarLocked = false;
m_theEndExplosionTimer = 0;
_rotatePlanet = 0;
_bitmapFGNLogo = null;
m_achievementTimer = 0;
_rotateSeal = 0;
_playHitDelay = 5;
_playGlassHitDelay = 5;
_playWorkingDelay = 0;
m_oldTime = 0;
m_currId = 0;
m_currTest = null;
super();
resetProgress();
}
private function isThisLevelPackCompleted(_arg1:int):Boolean{
var _local2:int;
_local2 = (_arg1 * 5);
if ((((((((((sm_levelUnlocked[(_local2 + 0)] < 2)) || ((sm_levelUnlocked[(_local2 + 1)] < 2)))) || ((sm_levelUnlocked[(_local2 + 2)] < 2)))) || ((sm_levelUnlocked[(_local2 + 3)] < 2)))) || ((sm_levelUnlocked[(_local2 + 4)] < 2)))){
return (false);
};
return (true);
}
private function runLevelSelectionScreen():void{
var _local1:int;
var _local2:int;
var _local3:Bitmap;
var _local4:Number;
var _local5:Number;
var _local6:int;
var _local7:int;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Particle;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:int;
_rotateSeal = (_rotateSeal + 0.01);
_local3 = _bitmapLevelPackSelectionCogWheel;
_local3.scaleX = LEVEL_PACK_COG_WHEEL_SCALE[s_selectedLevelPack];
_local3.scaleY = _local3.scaleX;
_local3.rotation = 0;
_local1 = (s_selectedLevelPack * 3);
Test.rot(_local3, LEVEL_PACK_ICONS[_local1], LEVEL_PACK_ICONS[(_local1 + 1)], ((_rotateSeal * 180) / Math.PI), (-(_local3.width) * 0.5), (-(_local3.height) * 0.5));
if (sm_levelPackUnlockedTimer > 0){
sm_levelPackUnlockedTimer--;
_local15 = LEVEL_PACK_COG_WHEEL_SCALE[sm_levelPackUnlockedID];
_local1 = (sm_levelPackUnlockedID * 3);
var _temp1 = _local1;
_local1 = (_local1 + 1);
_local4 = LEVEL_PACK_ICONS[_temp1];
_local5 = LEVEL_PACK_ICONS[_local1];
_local1 = 0;
while (_local1 < 8) {
_local8 = ((Math.random() * Math.PI) * 2);
_local9 = ((45 * _local15) * 0.9);
_local10 = (_local9 * Math.cos(_local8));
_local11 = (_local9 * Math.sin(_local8));
_local12 = m_particleManager.addParticle(Particle.PARTICLE_TYPE_EXPLOSION, (_local4 + _local10), (_local5 + _local11), 4294967295);
if (_local12 != null){
_local9 = (_local9 * (0.9 + (Math.random() * 0.1)));
_local12._speedX = (_local10 * 0.01);
_local12._speedY = (_local11 * 0.01);
_local12._life = (_local12._life + (Math.random() * 10));
};
_local1++;
};
if (_bitmapLevelPackNew == null){
_bitmapLevelPackNew = new Bitmap(new _classLevelPackNew().bitmapData);
_bitmapLevelPackNew.smoothing = true;
_bitmapLevelPackNew.x = (_local4 - (_bitmapLevelPackNew.width * 0.5));
_bitmapLevelPackNew.y = (_local5 - ((45 * _local15) * 0.95));
addChild(_bitmapLevelPackNew);
};
} else {
if (_bitmapLevelPackNew != null){
removeChild(_bitmapLevelPackNew);
_bitmapLevelPackNew = null;
};
};
_local4 = s_mouseX;
_local5 = s_mouseY;
_local6 = -1;
_local2 = 0;
_local1 = 0;
while (_local1 < LEVEL_PACKS_MAX) {
var _temp2 = _local2;
_local2 = (_local2 + 1);
_local13 = LEVEL_PACK_ICONS[_temp2];
var _temp3 = _local2;
_local2 = (_local2 + 1);
_local14 = LEVEL_PACK_ICONS[_temp3];
var _temp4 = _local2;
_local2 = (_local2 + 1);
_local15 = LEVEL_PACK_ICONS[_temp4];
_local15 = Math.abs((_local14 - _local15));
if (isPointInsideCircle(_local4, _local5, _local13, _local14, _local15)){
_local6 = _local1;
break;
};
_local1++;
};
if ((((_local6 < 0)) || ((((_local6 >= 0)) && (!((sm_levelPackUnlocked[_local6] == 0))))))){
if (_local6 >= 12){
sm_levelPackScoreboardNext = -1;
} else {
sm_levelPackScoreboardNext = _local6;
};
};
if (sm_levelPackScoreboardNext != sm_levelPackScoreboard){
if (_bitmapLevelPackScoreboard != null){
_bitmapLevelPackScoreboard.scaleX = (_bitmapLevelPackScoreboard.scaleX - 0.05);
_bitmapLevelPackScoreboard.scaleY = _bitmapLevelPackScoreboard.scaleX;
_bitmapLevelPackScoreboard.x = (sm_levelPackScoreboardX - (_bitmapLevelPackScoreboard.width * 0.5));
_bitmapLevelPackScoreboard.y = (sm_levelPackScoreboardY - (_bitmapLevelPackScoreboard.height * 0.5));
_bitmapLevelPackScoreboard.alpha = (_bitmapLevelPackScoreboard.alpha - 0.1);
if (_bitmapLevelPackScoreboard.alpha <= 0){
removeChild(_bitmapLevelPackScoreboard);
_bitmapLevelPackScoreboard = null;
sm_levelPackScoreboard = -1;
};
} else {
if (sm_levelPackScoreboardNext >= 0){
_local1 = (sm_levelPackScoreboardNext << 1);
sm_levelPackScoreboardX = SCOREBOARD_CENTERS[(_local1 + 0)];
sm_levelPackScoreboardY = SCOREBOARD_CENTERS[(_local1 + 1)];
_bitmapLevelPackScoreboard = getLevelPackScoreboardBitmap(sm_levelPackScoreboardNext);
_bitmapLevelPackScoreboard.smoothing = true;
_bitmapLevelPackScoreboard.scaleX = 0.5;
_bitmapLevelPackScoreboard.scaleY = 0.5;
_bitmapLevelPackScoreboard.alpha = 0;
_bitmapLevelPackScoreboard.x = (sm_levelPackScoreboardX - (_bitmapLevelPackScoreboard.width * 0.5));
_bitmapLevelPackScoreboard.y = (sm_levelPackScoreboardY - (_bitmapLevelPackScoreboard.height * 0.5));
addChild(_bitmapLevelPackScoreboard);
sm_levelPackScoreboard = sm_levelPackScoreboardNext;
};
};
} else {
if (_bitmapLevelPackScoreboard != null){
_bitmapLevelPackScoreboard.scaleX = (_bitmapLevelPackScoreboard.scaleX + 0.05);
if (_bitmapLevelPackScoreboard.scaleX >= 1){
_bitmapLevelPackScoreboard.scaleX = 1;
};
_bitmapLevelPackScoreboard.scaleY = _bitmapLevelPackScoreboard.scaleX;
_bitmapLevelPackScoreboard.x = (sm_levelPackScoreboardX - (_bitmapLevelPackScoreboard.width * 0.5));
_bitmapLevelPackScoreboard.y = (sm_levelPackScoreboardY - (_bitmapLevelPackScoreboard.height * 0.5));
_bitmapLevelPackScoreboard.alpha = (_bitmapLevelPackScoreboard.alpha + 0.1);
if (_bitmapLevelPackScoreboard.alpha >= 1){
_bitmapLevelPackScoreboard.alpha = 1;
};
};
};
if (Math.random() > 0.7){
_local16 = -1;
_local17 = (Math.random() * SCREEN_DY);
_local18 = ((Math.random() * 5) + 2);
_local19 = ((0xFF * _local18) / 7);
_local19 = (((_local19 << 16) | (_local19 << 8)) | _local19);
_local12 = m_particleManager.addParticle(Particle.PARTICLE_TYPE_SHOOTING_STAR, _local16, _local17, ((0xFF << 24) | _local19));
if (_local12 != null){
_local12._speedX = _local18;
};
};
if (!Input.mouseClicked){
return;
};
if (isPointInside(_local4, _local5, 27, 437, 127, 486)){
buttonPressed();
toggleLevelSelectionScreen();
toggleTitleScreen();
};
_local7 = -1;
if ((((_local6 >= 0)) && (!((sm_levelPackUnlocked[_local6] == 0))))){
_local7 = _local6;
};
if (_local7 >= 0){
buttonPressed();
if (s_selectedLevelPack != _local7){
s_selectedLevelPack = _local7;
} else {
if (s_selectedLevelPack == (LEVEL_PACKS_MAX - 1)){
buttonPressed();
toggleTheEndScreen();
} else {
m_currId = sm_levelPackCurrId[s_selectedLevelPack];
buttonPressed();
resetPressed();
toggleLevelSelectionScreen();
startGame();
};
};
};
}
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 runTitleScreenPlanet():void{
var _local1:Bitmap;
_local1 = _bitmapTitleScreenPlanet;
if (((isPointInside(s_mouseX, s_mouseY, 220, (211 - 20), 345, (273 - 20))) && ((_bitmapYesNo == null)))){
_local1.scaleX = (_local1.scaleX + 0.05);
if (_local1.scaleX > 1.25){
_local1.scaleX = 1.25;
};
_local1.scaleY = _local1.scaleX;
} else {
_local1.scaleX = (_local1.scaleX - 0.01);
if (_local1.scaleX < 1.05){
_local1.scaleX = 1.05;
};
_local1.scaleY = _local1.scaleX;
};
_rotatePlanet = (_rotatePlanet - 0.001);
_local1.rotation = 0;
Test.rot(_local1, (145 + (314 * 0.5)), 260, ((_rotatePlanet * 180) / Math.PI), (-(_local1.width) * 0.5), (-(_local1.height) * 0.5));
}
private function runInstructionsScreen():void{
var _local1:Number;
var _local2:Number;
if (!Input.mouseClicked){
return;
};
_local1 = s_mouseX;
_local2 = s_mouseY;
if (isPointInside(_local1, _local2, (190 + 30), 444, (298 + 30), 488)){
buttonPressed();
toggleInstructionsScreen();
toggleTitleScreen();
};
}
private function SettingsSave():void{
var _local1:SharedObject;
trace("SettingsSave()...");
_local1 = SharedObject.getLocal("ImperfectBalanceSettings");
_local1.data.header = "IBS3";
_local1.data.version = "1.0.0";
_local1.data.levelBest = cloneArray(sm_levelBest);
_local1.data.levelBestBalls = cloneArray(sm_levelBestBalls);
_local1.data.levelBestMask = cloneArray(sm_levelBestMask);
_local1.data.levelUnlocked = cloneArray(sm_levelUnlocked);
_local1.data.levelPackUnlocked = cloneArray(sm_levelPackUnlocked);
_local1.data.achievementBits = sm_achievementBits;
_local1.data.audio = _audio;
_local1.data.checksum = calculateSaveChecksum(sm_levelBest, sm_levelBestBalls, sm_levelBestMask, sm_levelUnlocked, sm_levelPackUnlocked, sm_achievementBits);
_local1.flush();
trace(("... success! checksum = " + _local1.data.checksum));
}
public function mouseOut(_arg1:MouseEvent):void{
s_mouseOver = false;
}
private function keepMenuBarTopmost():void{
removeChild(_bitmapMenuBar);
addChild(_bitmapMenuBar);
removeChild(_bitmapMenuBarCogWheel);
addChild(_bitmapMenuBarCogWheel);
}
private function buttonPressed(_arg1:Boolean=true):void{
Input.mousePressed = false;
Input.mouseClicked = false;
Input.mouseDown = false;
s_mouseClicked = false;
if (_arg1){
playButtonSound();
};
}
private function resetProgress():void{
var _local1:int;
_local1 = 0;
while (_local1 < 80) {
sm_levelBest[_local1] = 0;
sm_levelBestBalls[_local1] = 0;
sm_levelBestMask[_local1] = 0;
sm_levelUnlocked[_local1] = 0;
_local1++;
};
_local1 = 0;
while (_local1 < LEVEL_PACKS_MAX) {
sm_levelPackUnlocked[_local1] = 0;
sm_levelPackCurrId[_local1] = 0;
_local1++;
};
sm_levelPackUnlocked[0] = 1;
sm_levelUnlocked[0] = 1;
}
private function playSFX():void{
var _local1:SoundTransform;
var _local2:Number;
var _local3:Number;
if (_playRotate >= 0){
if (_audio){
_local1 = new SoundTransform(0.2);
_audioBank._soundRotate01.play(0, 1, _local1);
};
_playRotate = -1;
};
if (_playBadPickup >= 0){
if (_audio){
_local1 = new SoundTransform(0.4);
_audioBank._soundBadPickup.play(0, 1, _local1);
};
_playBadPickup = -1;
};
if (_playGrabShape >= 0){
if (_audio){
_local1 = new SoundTransform(0.05);
_audioBank._soundGrabShape.play(0, 1, _local1);
};
_playGrabShape = -1;
};
if (_playReturnShape >= 0){
if (_audio){
_local1 = new SoundTransform(0.05);
_audioBank._soundReturnShape.play(0, 1, _local1);
};
_playReturnShape = -1;
};
if (_playGlassBreak >= 0){
if (_audio){
_local1 = new SoundTransform(0.2);
_local2 = Math.random();
_local3 = 4;
if (_local2 < (1 / _local3)){
_audioBank._soundGlassBreak1.play(0, 1, _local1);
} else {
if (_local2 < (2 / _local3)){
_audioBank._soundGlassBreak2.play(0, 1, _local1);
} else {
if (_local2 < (3 / _local3)){
_audioBank._soundGlassBreak3.play(0, 1, _local1);
} else {
_audioBank._soundGlassBreak4.play(0, 1, _local1);
};
};
};
};
_playGlassBreak = -1;
};
if (_playGlassCrack >= 0){
if (_audio){
_local1 = new SoundTransform(0.2);
_audioBank._soundGlassCrack.play(0, 1, _local1);
};
_playGlassCrack = -1;
};
if (_playHitDelay < 5){
_playHitDelay++;
};
if (_playHit >= 0){
if (((_audio) && ((_playHitDelay == 5)))){
_local1 = new SoundTransform((_playHitVolume * 0.9));
_local2 = Math.random();
_local3 = 8;
if (_local2 < (1 / _local3)){
_audioBank._soundConcrete01.play(0, 1, _local1);
} else {
if (_local2 < (2 / _local3)){
_audioBank._soundConcrete02.play(0, 1, _local1);
} else {
if (_local2 < (3 / _local3)){
_audioBank._soundConcrete03.play(0, 1, _local1);
} else {
if (_local2 < (4 / _local3)){
_audioBank._soundConcrete04.play(0, 1, _local1);
} else {
if (_local2 < (5 / _local3)){
_audioBank._soundConcrete05.play(0, 1, _local1);
} else {
if (_local2 < (6 / _local3)){
_audioBank._soundConcrete06.play(0, 1, _local1);
} else {
if (_local2 < (7 / _local3)){
_audioBank._soundConcrete07.play(0, 1, _local1);
} else {
_audioBank._soundConcrete08.play(0, 1, _local1);
};
};
};
};
};
};
};
};
_playHitDelay = 0;
_playHit = -1;
};
if (_playGlassHitDelay < 5){
_playGlassHitDelay++;
};
if (_playGlassHit >= 0){
if (((_audio) && ((_playGlassHitDelay == 5)))){
_local1 = new SoundTransform((_playGlassHitVolume * 0.6));
_local2 = Math.random();
if (_local2 < (1 / 3)){
_audioBank._soundGlass1.play(0, 1, _local1);
} else {
if (_local2 < (2 / 3)){
_audioBank._soundGlass2.play(0, 1, _local1);
} else {
_audioBank._soundGlass3.play(0, 1, _local1);
};
};
};
_playGlassHitDelay = 0;
_playGlassHit = -1;
};
_playWorkingDelay++;
if (_playWorkingDelay == 40){
if (Math.random() > 0.92){
};
_playWorkingDelay = 0;
};
}
public function onEnterFrame(_arg1:Event):void{
if (m_black != null){
m_black.alpha = (m_black.alpha - 0.05);
if (m_black.alpha <= 0){
removeChild(m_black);
m_black = null;
};
};
if (((_first) && (!((m_currTest == null))))){
changeBGM();
_first = false;
};
mainLoop();
}
private function unlockLevelPack(_arg1:int):void{
sm_levelPackUnlocked[_arg1] = 1;
sm_levelUnlocked[(_arg1 * 5)] = 1;
sm_levelPackUnlockedID = _arg1;
sm_levelPackUnlockedTimer = 500;
if (_bitmapANewLevelPackIsOpen != null){
removeChild(_bitmapANewLevelPackIsOpen);
_bitmapANewLevelPackIsOpen = null;
};
_bitmapANewLevelPackIsOpen = new Bitmap(new _classANewLevelPackIsOpen().bitmapData);
_bitmapANewLevelPackIsOpen.smoothing = true;
_bitmapANewLevelPackIsOpen.x = ((SCREEN_DX * 0.5) - (_bitmapANewLevelPackIsOpen.width * 0.5));
_bitmapANewLevelPackIsOpen.y = ((420 - 100) + 55);
_bitmapANewLevelPackIsOpen.alpha = 0;
_bitmapANewLevelPackIsOpen.smoothing = true;
addChild(_bitmapANewLevelPackIsOpen);
}
private function runCreditsScreen():void{
var _local1:Number;
var _local2:Number;
var _local3:Particle;
var _local4:Number;
var _local5:Number;
_local1 = ((102 - 3) + (Math.random() * (398 + 6)));
_local2 = ((85 - 3) + (Math.random() * (37 + 6)));
_local3 = m_particleManager.addParticle(Particle.PARTICLE_TYPE_TWINKLE, _local1, _local2, 4294967295);
if (_local3 != null){
_local3._life = (_local3._life + (Math.random() * 40));
};
m_particleManager.liveParticles(0, _bitmapParticleLayer);
if (!Input.mouseClicked){
return;
};
_local4 = s_mouseX;
_local5 = s_mouseY;
if (isPointInside(_local4, _local5, (190 + 30), 444, (298 + 30), 488)){
buttonPressed();
toggleCreditsScreen();
toggleTitleScreen();
};
}
private function CalculateTotalDiamondsLevelPack(_arg1:int):int{
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = 0;
_arg1 = (_arg1 * 5);
_local3 = 0;
while (_local3 < 5) {
_local4 = (sm_levelBest[(_arg1 + _local3)] ^ sm_levelBestMask[(_arg1 + _local3)]);
if (_local4 > 3){
_local4 = 0;
};
_local2 = (_local2 + _local4);
_local3++;
};
return (_local2);
}
private function toggleInstructionsScreen():void{
if (_bitmapInstructionsScreen != null){
removeChild(_bitmapInstructionsScreen);
_bitmapInstructionsScreen = null;
} else {
_bitmapInstructionsScreen = new Bitmap(new _classInstructionsScreen().bitmapData);
_bitmapInstructionsScreen.smoothing = true;
addChild(_bitmapInstructionsScreen);
};
}
private function toggleTitleScreen():void{
if (_bitmapTitleScreenBackground != null){
removeChild(_bitmapTitleScreenBackground);
_bitmapTitleScreenBackground = null;
removeChild(_bitmapTitleScreenPlanet);
_bitmapTitleScreenPlanet = null;
removeChild(_bitmapTitleScreenForeground);
_bitmapTitleScreenForeground = null;
removeChild(_bitmapAudioOn);
removeChild(_bitmapAudioOff);
if (MyPreloader._ttursasSeal){
removeChild(_bitmapSealBack);
removeChild(_bitmapSealFront);
};
if (_bitmapFGNLogo != null){
removeChild(_bitmapFGNLogo);
_bitmapFGNLogo = null;
};
} else {
_bitmapTitleScreenBackground = new Bitmap(new _classTitleScreenBackground().bitmapData);
_bitmapTitleScreenBackground.smoothing = true;
_bitmapTitleScreenBackground.x = 0;
_bitmapTitleScreenBackground.y = 0;
addChild(_bitmapTitleScreenBackground);
_bitmapTitleScreenPlanet = new Bitmap(new _classTitleScreenPlanet().bitmapData);
_bitmapTitleScreenPlanet.smoothing = true;
_bitmapTitleScreenPlanet.alpha = 0.9;
addChild(_bitmapTitleScreenPlanet);
runTitleScreenPlanet();
_bitmapTitleScreenForeground = new Bitmap(new _classTitleScreenForeground().bitmapData);
_bitmapTitleScreenForeground.smoothing = true;
_bitmapTitleScreenForeground.x = (190 - 25);
_bitmapTitleScreenForeground.y = (217 - 20);
addChild(_bitmapTitleScreenForeground);
_bitmapAudioOn.x = 63;
_bitmapAudioOn.y = 348;
_bitmapAudioOff.x = 63;
_bitmapAudioOff.y = 348;
addChild(_bitmapAudioOn);
addChild(_bitmapAudioOff);
updateTitleScreenAudioButton();
if (MyPreloader._ttursasSeal){
addChild(_bitmapSealBack);
addChild(_bitmapSealFront);
updateSealOfQuantity();
};
if (MyPreloader._freeGamesNews){
_bitmapFGNLogo = new Bitmap(new MyPreloader._classFGNLogo().bitmapData);
_bitmapFGNLogo.smoothing = true;
_bitmapFGNLogo.scaleX = 0.5;
_bitmapFGNLogo.scaleY = 0.5;
_bitmapFGNLogo.x = 25;
_bitmapFGNLogo.y = (SCREEN_DY - 90);
addChild(_bitmapFGNLogo);
};
};
}
public function init(_arg1:Boolean, _arg2:Boolean, _arg3:Sprite):void{
var _local4:TextFormat;
var _local5:TextField;
_nice = _arg1;
_failed = _arg2;
m_this = this;
Font.registerFont(_fontClass1);
SettingsLoad();
stage.focus = this;
stage.quality = StageQuality.HIGH;
s_quality = 1;
_bitmapBackground = new Bitmap(new _classBackgroundFlash1().bitmapData);
_bitmapBackground.smoothing = true;
_bitmapBackground.x = 0;
_bitmapBackground.y = 0;
_bitmapBackground.visible = false;
addChild(_bitmapBackground);
_bitmapSlotBarScore = new Bitmap(new _classSlotBarScore().bitmapData);
_bitmapSlotBarScore.smoothing = true;
_bitmapSlotBarScore.y = 107;
_bitmapSlotBarScore.visible = false;
addChild(_bitmapSlotBarScore);
_bitmapSlotBarBest = new Bitmap(new _classSlotBarBest().bitmapData);
_bitmapSlotBarBest.smoothing = true;
_bitmapSlotBarBest.y = 107;
_bitmapSlotBarBest.visible = false;
addChild(_bitmapSlotBarBest);
putSlotBarsToLeft();
_bitmapMenuBarSource = new Bitmap(new _classMenuBarSource().bitmapData);
_bitmapMenuBarSource.smoothing = true;
_bitmapMenuBar = new Bitmap(new _classMenuBarSource().bitmapData);
_bitmapMenuBar.smoothing = true;
_bitmapMenuBar.y = SCREEN_DY;
_bitmapMenuBarCogWheel = new Bitmap(new _classMenuBarCogWheel().bitmapData);
_bitmapMenuBarCogWheel.smoothing = true;
_bitmapMenuBarCogWheel.y = SCREEN_DY;
addEventListener(Event.ENTER_FRAME, onEnterFrame, false, 0, true);
addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheelEvent);
addEventListener(MouseEvent.MOUSE_DOWN, mousePress, false, 0, true);
addEventListener(MouseEvent.MOUSE_MOVE, mouseMove, false, 0, true);
addEventListener(MouseEvent.MOUSE_OUT, mouseOut, false, 0, true);
addEventListener(MouseEvent.MOUSE_OVER, mouseOver, false, 0, true);
_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;
_bitmapShowBestYes = new Bitmap(new _classShowBestYes().bitmapData);
_bitmapShowBestYes.smoothing = true;
_bitmapShowBestNo = new Bitmap(new _classShowBestNo().bitmapData);
_bitmapShowBestNo.smoothing = true;
_bitmapLevelPackSelectionCogWheel = new Bitmap(new _classLevelPackSelectionCogWheel().bitmapData);
_bitmapLevelPackSelectionCogWheel.smoothing = true;
_bitmapLevelPackSelectionCogWheel.x = -10000;
m_sprite = new Sprite();
addChild(m_sprite);
m_input = new Input(m_sprite);
_local4 = new TextFormat("Geometric 231", 32, 0xFFFFFF, false, false, false);
_local4.align = TextFormatAlign.LEFT;
_local5 = new TextField();
_local5.defaultTextFormat = _local4;
_local5.width = 200;
_local5.height = 40;
_local5.embedFonts = true;
_local5.mouseEnabled = false;
_local5.text = "0";
_local5.filters = [_outlineFilter];
_local5.antiAliasType = AntiAliasType.ADVANCED;
_textFieldLPSBig = _local5;
_textFieldLPSBig.visible = false;
_local4 = new TextFormat("Geometric 231", 18, 0xFFFFFF, false, false, false);
_local4.align = TextFormatAlign.LEFT;
_local5 = new TextField();
_local5.defaultTextFormat = _local4;
_local5.width = 100;
_local5.height = 20;
_local5.embedFonts = true;
_local5.mouseEnabled = false;
_local5.text = "0";
_local5.filters = [_outlineFilter];
_local5.antiAliasType = AntiAliasType.ADVANCED;
_textFieldLPSSmall = _local5;
_textFieldLPSSmall.visible = false;
_local4 = new TextFormat("Geometric 231", 40, 0xFFFFFF, false, false, false);
_local4.align = TextFormatAlign.CENTER;
_local5 = new TextField();
_local5.defaultTextFormat = _local4;
_local5.width = 100;
_local5.height = 60;
_local5.embedFonts = true;
_local5.mouseEnabled = false;
_local5.text = "0";
_local5.filters = [_outlineFilter];
_local5.antiAliasType = AntiAliasType.ADVANCED;
_textFieldDampTimer = _local5;
_textFieldDampTimer.visible = false;
addChild(_textFieldDampTimer);
if (MyPreloader._ttursasSeal){
_bitmapSealBack = new Bitmap(new _classSealBack().bitmapData);
_bitmapSealBack.x = -10000;
_bitmapSealBack.y = 0;
_bitmapSealBack.smoothing = true;
_bitmapSealBack.visible = false;
addChild(_bitmapSealBack);
_bitmapSealFront = new Bitmap(new _classSealFront().bitmapData);
_bitmapSealFront.x = -10000;
_bitmapSealFront.y = 0;
_bitmapSealFront.smoothing = true;
_bitmapSealFront.visible = false;
addChild(_bitmapSealFront);
};
_audioBank = new Audio();
SoundMixer.stopAll();
toggleTitleScreen();
m_particleManager.initialize();
addChild(_bitmapParticleLayer);
m_black = _arg3;
addChild(_arg3);
}
private function getLevelPackScoreboardBitmap(_arg1:int):Bitmap{
var _local2:Bitmap;
var _local3:BitmapData;
var _local4:BitmapData;
var _local5:BitmapData;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
_local2 = new Bitmap(new _classLevelPackScoreboard().bitmapData);
_local3 = _local2.bitmapData;
_local4 = new _classLevelPackSelectionLockedDiamond().bitmapData;
_local5 = new _classSlotMinus().bitmapData;
_local6 = (_arg1 * 5);
_local7 = 0;
while (_local7 < 5) {
_local8 = (sm_levelBest[_local6] ^ sm_levelBestMask[_local6]);
_local6++;
if (_local8 == 0){
copyFullBitmapData(_local3, _local5, 71, (87 + (_local7 * 20)));
};
_local9 = 0;
while (_local9 < _local8) {
copyFullBitmapDataRotate(_local3, _local4, (71 + (_local9 * 21)), (86 + (_local7 * 19.5)), ((Math.random() * Math.PI) * 2));
_local9++;
};
_local7++;
};
return (_local2);
}
private function playButtonSound():void{
var _local1:SoundTransform;
if (_audio){
_local1 = new SoundTransform(0.3);
_audioBank._soundMenuButton.play(0, 1, _local1);
};
}
private function toggleTheEndScreen():void{
if (_bitmapTheEndScreen != null){
removeChild(_bitmapTheEndScreen);
_bitmapTheEndScreen = null;
removeChild(_bitmapTheEndCongratulations);
_bitmapTheEndCongratulations = null;
} else {
_bitmapTheEndScreen = new Bitmap(new _classTheEndScreen().bitmapData);
_bitmapTheEndScreen.smoothing = true;
_bitmapTheEndScreen.alpha = 0;
addChild(_bitmapTheEndScreen);
removeChild(m_sprite);
addChild(m_sprite);
m_sprite.alpha = 0;
_bitmapTheEndCongratulations = new Bitmap(new _classTheEndCongratulations().bitmapData);
_bitmapTheEndCongratulations.smoothing = true;
_bitmapTheEndCongratulations.alpha = 0;
_bitmapTheEndCongratulations.x = 36;
_bitmapTheEndCongratulations.y = 14;
addChild(_bitmapTheEndCongratulations);
resetPressed();
};
changeBGM();
}
private function runPerfectStrike(_arg1:Bitmap):void{
_arg1.alpha = (_arg1.alpha + 0.05);
if (_arg1.alpha > 1){
_arg1.alpha = 1;
};
_arg1.scaleX = (_arg1.scaleX - 0.1);
if (_arg1.scaleX < 1){
_arg1.scaleX = 1;
};
_arg1.scaleY = _arg1.scaleX;
_arg1.x = (300 - (_arg1.width * 0.5));
_arg1.y = (230 - (_arg1.height * 0.5));
}
private function runAchievements():void{
var _local1:Bitmap;
_local1 = _bitmapAchievement;
if (_local1 == null){
return;
};
m_achievementTimer++;
if (m_achievementTimer < 300){
_local1.alpha = (_local1.alpha + 0.05);
if (_local1.alpha > 1){
_local1.alpha = 1;
};
return;
};
_local1.alpha = (_local1.alpha - 0.03);
_local1.scaleX = (_local1.scaleX + 0.05);
_local1.scaleY = (_local1.scaleY + 0.05);
_local1.x = (ACHIEVEMENT_SPRITE_CX - (_local1.width * 0.5));
_local1.y = (ACHIEVEMENT_SPRITE_CY - (_local1.height * 0.5));
if (_local1.alpha <= 0){
removeChild(_local1);
_bitmapAchievement = null;
evaluateAchievementsInGame();
};
}
public function playBlockExplosion(_arg1:int):void{
var _local2:SoundTransform;
if (!_audio){
return;
};
_local2 = new SoundTransform(0.1);
if (_arg1 == 1){
_audioBank._soundBlockExplosion1.play(0, 1, _local2);
} else {
if (_arg1 == 2){
_audioBank._soundBlockExplosion2.play(0, 1, _local2);
} else {
if (_arg1 == 3){
_audioBank._soundBlockExplosion3.play(0, 1, _local2);
};
};
};
}
private function unlockAchievement(_arg1:int):void{
var _local2:Bitmap;
sm_achievementBits = (sm_achievementBits | _arg1);
_local2 = null;
if ((_arg1 & ACHIEVEMENT_BIT_10_LEVELS) != 0){
_local2 = new Bitmap(new _classAchievement10Levels().bitmapData);
} else {
if ((_arg1 & ACHIEVEMENT_BIT_45_LEVELS) != 0){
_local2 = new Bitmap(new _classAchievement45Levels().bitmapData);
} else {
if ((_arg1 & ACHIEVEMENT_BIT_60_LEVELS) != 0){
_local2 = new Bitmap(new _classAchievement60Levels().bitmapData);
} else {
if ((_arg1 & ACHIEVEMENT_BIT_10_LEVELS_2) != 0){
_local2 = new Bitmap(new _classAchievement10Levels2().bitmapData);
} else {
if ((_arg1 & ACHIEVEMENT_BIT_45_LEVELS_2) != 0){
_local2 = new Bitmap(new _classAchievement45Levels2().bitmapData);
} else {
if ((_arg1 & ACHIEVEMENT_BIT_60_LEVELS_2) != 0){
_local2 = new Bitmap(new _classAchievement60Levels2().bitmapData);
} else {
if ((_arg1 & ACHIEVEMENT_BIT_10_LEVELS_3) != 0){
_local2 = new Bitmap(new _classAchievement10Levels3().bitmapData);
} else {
if ((_arg1 & ACHIEVEMENT_BIT_20_LEVELS_3) != 0){
_local2 = new Bitmap(new _classAchievement20Levels3().bitmapData);
} else {
if ((_arg1 & ACHIEVEMENT_BIT_ALL_LEVEL_PACKS) != 0){
_local2 = new Bitmap(new _classAchievementAllLevelPacks().bitmapData);
} else {
if ((_arg1 & ACHIEVEMENT_BIT_111_DIAMONDS) != 0){
_local2 = new Bitmap(new _classAchievement111Diamonds().bitmapData);
};
};
};
};
};
};
};
};
};
};
if (_local2 != null){
_local2.smoothing = true;
_local2.alpha = 0;
_local2.x = (ACHIEVEMENT_SPRITE_CX - (_local2.width * 0.5));
_local2.y = (ACHIEVEMENT_SPRITE_CY - (_local2.height * 0.5));
_bitmapAchievement = _local2;
m_achievementTimer = 0;
addChild(_local2);
};
SettingsSave();
sendToKongregate(_arg1);
}
private function runTitleScreen():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:Particle;
var _local8:Boolean;
updateSealOfQuantity();
runTitleScreenPlanet();
_local1 = 0;
while (_local1 < 2) {
_local5 = ((31 - 4) + (Math.random() * (542 + 8)));
_local6 = ((16 - 4) + (Math.random() * (51 + 8)));
_local7 = m_particleManager.addParticle(Particle.PARTICLE_TYPE_TWINKLE, _local5, _local6, 4294967295);
if (_local7 != null){
_local7._life = (_local7._life + (Math.random() * 40));
};
_local1++;
};
m_particleManager.liveParticles(0, _bitmapParticleLayer);
if (!Input.mouseClicked){
return;
};
_local2 = s_mouseX;
_local3 = s_mouseY;
if (_bitmapYesNo != null){
_local8 = false;
if (isPointInside(_local2, _local3, 474, 416, 582, 467)){
_local8 = true;
} else {
if (isPointInside(_local2, _local3, 522, 362, 583, 403)){
_local8 = true;
} else {
if (isPointInside(_local2, _local3, 455, 353, 516, 394)){
resetProgress();
_local8 = true;
};
};
};
if (_local8){
buttonPressed();
removeChild(_bitmapYesNo);
_bitmapYesNo = null;
};
return;
};
if (isPointInsideDelta(_local2, _local3, _bitmapAudioOn.x, _bitmapAudioOn.y, _bitmapAudioOn.width, _bitmapAudioOn.height)){
buttonPressed(false);
_audio = !(_audio);
updateTitleScreenAudioButton();
if (_audio){
changeBGM();
} else {
SoundMixer.stopAll();
_bgm = -1;
};
SettingsSave();
};
if (isPointInside(_local2, _local3, 474, 416, 582, 467)){
buttonPressed();
_bitmapYesNo = new Bitmap(new _classYesNo().bitmapData);
_bitmapYesNo.smoothing = true;
addChild(_bitmapYesNo);
};
if (((MyPreloader._ttursasSeal) && (isPointInsideDelta(_local2, _local3, _bitmapSealFront.x, _bitmapSealFront.y, _bitmapSealFront.width, _bitmapSealFront.height)))){
buttonPressed();
navigateToURL(new URLRequest("http://www.ttursas.com/"), "_blank");
};
_local4 = -20;
if (isPointInside(_local2, _local3, 220, (211 + _local4), 345, (273 + _local4))){
buttonPressed();
toggleTitleScreen();
toggleLevelSelectionScreen();
};
if (isPointInside(_local2, _local3, 188, (301 + _local4), 406, (349 + _local4))){
buttonPressed();
toggleTitleScreen();
toggleInstructionsScreen();
};
if (isPointInside(_local2, _local3, 167, (350 + _local4), 395, (388 + _local4))){
buttonPressed();
toggleTitleScreen();
toggleAchievementsScreen();
};
if (isPointInside(_local2, _local3, 215, (391 + _local4), 425, (432 + _local4))){
buttonPressed();
toggleTitleScreen();
toggleCreditsScreen();
};
if (isPointInside(_local2, _local3, 179, 418, 392, 461)){
buttonPressed();
navigateToURL(new URLRequest("http://www.freegamesnews.com"), "_blank");
};
if (isPointInsideBitmap(_bitmapFGNLogo, _local2, _local3)){
buttonPressed();
navigateToURL(new URLRequest("http://www.freegamesnews.com"), "_blank");
};
}
private function redrawLevelSelectionScreen():void{
var _local1:BitmapData;
var _local2:int;
var _local3:BitmapData;
var _local4:BitmapData;
var _local5:BitmapData;
var _local6:int;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local1 = _bitmapLevelSelectionScreen.bitmapData;
_local2 = CalculateTotalDiamonds();
_textFieldLPSBig.text = (_local2 + "");
_local1.draw(_textFieldLPSBig, new Matrix(1, 0, 0, 1, 82, 342), null, null, null, true);
if (((MyPreloader._kongregate) && (!((MyPreloader._kongregateAPI == null))))){
MyPreloader._kongregateAPI.stats.submit("Diamonds", _local2);
};
_local3 = new _classLevelPackSelectionLockedIcon().bitmapData;
_local4 = new _classLevelPackSelectionLockedDiamond().bitmapData;
_local5 = new _classLevelPackSelectionLockedQuestionMark().bitmapData;
_local6 = 0;
while (_local6 < LEVEL_PACKS_MAX) {
if (sm_levelPackUnlocked[_local6] == 0){
_local7 = LEVEL_PACK_ICONS[((_local6 * 3) + 0)];
_local8 = LEVEL_PACK_ICONS[((_local6 * 3) + 1)];
_local9 = (LEVEL_PACK_COG_WHEEL_SCALE[_local6] * 0.95);
copyFullBitmapDataScale(_local1, _local3, (_local7 - (45 * _local9)), (_local8 - (45 * _local9)), _local9);
if ((((_local6 <= 8)) || ((_local6 == 12)))){
copyFullBitmapData(_local1, _local4, ((_local7 - (_local4.width * 0.5)) - 11), (_local8 - (_local4.height * 0.5)));
_textFieldLPSSmall.text = (LEVEL_PACK_DIAMOND_LIMITS[_local6] + "");
_local1.draw(_textFieldLPSSmall, new Matrix(1, 0, 0, 1, (_local7 - 2), (_local8 - 13)), null, null, null, true);
} else {
copyFullBitmapData(_local1, _local5, (_local7 - (_local5.width * 0.5)), (_local8 - (_local5.height * 0.5)));
};
};
_local6++;
};
}
private function putSlotBarsToLeft():void{
if (s_showBest){
_bitmapSlotBarScore.x = ((5 + 21) + 1);
_bitmapSlotBarBest.x = 5;
} else {
_bitmapSlotBarScore.x = 5;
};
}
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);
}
public function addPlus1(_arg1:UserData, _arg2:Number):Boolean{
var _local3:Boolean;
var _local4:int;
var _local5:Bitmap;
if (_plus1SpritesN >= PLUS_1_SPRITES_MAX){
return (false);
};
_local3 = false;
_local4 = ((s_selectedLevelPack * 5) + m_currId);
m_currTest._plus1Added++;
if (LEVELS_DIAMOND_LIMITS[((_local4 * 2) + 0)] == m_currTest._plus1Added){
_local5 = new Bitmap(new _classSlotDiamondBright().bitmapData);
_local3 = true;
} else {
if (LEVELS_DIAMOND_LIMITS[((_local4 * 2) + 1)] == m_currTest._plus1Added){
_local5 = new Bitmap(new _classSlotDiamondBright().bitmapData);
_local3 = true;
} else {
_local5 = new Bitmap(new _classSlotBright().bitmapData);
};
};
_local5.smoothing = true;
_local5.scaleX = 0.8;
_local5.scaleY = 0.8;
_local5.alpha = 0.7;
_local5.x = (_arg1._spriteX - (_local5.width * 0.5));
_local5.y = ((_arg1._spriteY - (_local5.height * 0.5)) + _arg2);
m_currTest.m_sprite.addChild(_local5);
_plus1States[_plus1SpritesN] = 0;
_plus1Speed[_plus1SpritesN] = (0.3 + (Math.random() * 0.3));
var _local6 = _plus1SpritesN++;
_plus1Sprites[_local6] = _local5;
if (_local3){
earnDiamond();
};
addTaunt(_local3);
return (_local3);
}
private function putSlotBarsToRight():void{
if (s_showBest){
_bitmapSlotBarScore.x = ((((SCREEN_DX - 21) - 5) - 1) - 21);
_bitmapSlotBarBest.x = ((SCREEN_DX - 21) - 5);
} else {
_bitmapSlotBarScore.x = ((SCREEN_DX - 21) - 5);
};
}
private function hideGameScreen():void{
_bitmapBackground.visible = false;
_bitmapSlotBarScore.visible = false;
_bitmapSlotBarBest.visible = false;
removeChild(_bitmapMenuBar);
removeChild(_bitmapMenuBarCogWheel);
if (_bitmapHelpText != null){
removeChild(_bitmapHelpText);
_bitmapHelpText = null;
};
if (_bitmapWalkthroughButton != null){
removeChild(_bitmapWalkthroughButton);
_bitmapWalkthroughButton = null;
};
if (_bitmapTaunt != null){
removeChild(_bitmapTaunt);
_bitmapTaunt = null;
};
changeBGM();
}
private function runTheEndScreen():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:int;
var _local8:Particle;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
if (_bitmapTheEndScreen.alpha < 1){
_bitmapTheEndScreen.alpha = (_bitmapTheEndScreen.alpha + 0.05);
if (_bitmapTheEndScreen.alpha >= 1){
_bitmapTheEndScreen.alpha = 1;
toggleLevelSelectionScreen();
};
m_sprite.alpha = _bitmapTheEndScreen.alpha;
return;
};
if (_bitmapTheEndCongratulations.alpha < 1){
_bitmapTheEndCongratulations.alpha = (_bitmapTheEndCongratulations.alpha + 0.05);
if (_bitmapTheEndCongratulations.alpha >= 1){
_bitmapTheEndCongratulations.alpha = 1;
};
} else {
m_currTest._theEndRunning = true;
};
if (m_theEndExplosionTimer < 20){
m_theEndExplosionTimer++;
} else {
m_theEndExplosionTimer = 0;
_local3 = (32 + (Math.random() * 16));
_local5 = (Math.random() * SCREEN_DX);
_local6 = (Math.random() * SCREEN_DY);
_local7 = 0xFFFFFF;
if (Math.random() > 0.5){
_local7 = 13429503;
};
_local4 = 0;
while (_local4 < _local3) {
_local8 = m_particleManager.addParticle(Particle.PARTICLE_TYPE_EXPLOSION, _local5, _local6, _local7);
if (_local8 != null){
_local9 = ((Math.random() * Math.PI) * 2);
_local10 = (1 + (Math.random() * 5));
_local11 = (_local10 * Math.cos(_local9));
_local12 = (_local10 * Math.sin(_local9));
_local8._speedX = (_local11 * 0.1);
_local8._speedY = (_local12 * 0.1);
_local8._life = (_local8._life + (Math.random() * 40));
};
_local4++;
};
};
m_particleManager.liveParticles(0, _bitmapParticleLayer);
if (!Input.mouseClicked){
return;
};
_local1 = s_mouseX;
_local2 = s_mouseY;
if (isPointInside(_local1, _local2, 6, 450, 93, 494)){
buttonPressed();
toggleLevelSelectionScreen();
toggleTheEndScreen();
m_particleManager.reset();
};
}
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);
}
public function mouseMove(_arg1:MouseEvent):void{
s_mouseX = mouseX;
s_mouseY = mouseY;
}
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);
}
public function earnDiamond():void{
var _local1:SoundTransform;
if (!_audio){
return;
};
_local1 = new SoundTransform(0.1);
_audioBank._soundEarnDiamond.play(0, 1, _local1);
}
private function sendToKongregate(_arg1:int):void{
if (MyPreloader._kongregateAPI == null){
return;
};
if ((_arg1 & ACHIEVEMENT_BIT_10_LEVELS) != 0){
MyPreloader._kongregateAPI.stats.submit("10Levels1Diamonds", 1);
};
if ((_arg1 & ACHIEVEMENT_BIT_45_LEVELS) != 0){
MyPreloader._kongregateAPI.stats.submit("45Levels1Diamonds", 1);
};
if ((_arg1 & ACHIEVEMENT_BIT_60_LEVELS) != 0){
MyPreloader._kongregateAPI.stats.submit("60Levels1Diamonds", 1);
};
if ((_arg1 & ACHIEVEMENT_BIT_10_LEVELS_2) != 0){
MyPreloader._kongregateAPI.stats.submit("10Levels2Diamonds", 1);
};
if ((_arg1 & ACHIEVEMENT_BIT_45_LEVELS_2) != 0){
MyPreloader._kongregateAPI.stats.submit("45Levels2Diamonds", 1);
};
if ((_arg1 & ACHIEVEMENT_BIT_60_LEVELS_2) != 0){
MyPreloader._kongregateAPI.stats.submit("60Levels2Diamonds", 1);
};
if ((_arg1 & ACHIEVEMENT_BIT_10_LEVELS_3) != 0){
MyPreloader._kongregateAPI.stats.submit("10Levels3Diamonds", 1);
};
if ((_arg1 & ACHIEVEMENT_BIT_20_LEVELS_3) != 0){
MyPreloader._kongregateAPI.stats.submit("20Levels3Diamonds", 1);
};
if ((_arg1 & ACHIEVEMENT_BIT_ALL_LEVEL_PACKS) != 0){
MyPreloader._kongregateAPI.stats.submit("AllLevelPacksOpen", 1);
};
if ((_arg1 & ACHIEVEMENT_BIT_111_DIAMONDS) != 0){
MyPreloader._kongregateAPI.stats.submit("111Diamonds", 1);
};
}
private function toggleLevelSelectionScreen():void{
m_particleManager.reset();
if (_bitmapLevelSelectionScreen != null){
removeChild(_bitmapLevelSelectionScreen);
_bitmapLevelSelectionScreen = null;
removeChild(_bitmapLevelPackSelectionCogWheel);
if (_bitmapLevelPackNew != null){
removeChild(_bitmapLevelPackNew);
_bitmapLevelPackNew = null;
};
if (_bitmapLevelPackScoreboard != null){
removeChild(_bitmapLevelPackScoreboard);
_bitmapLevelPackScoreboard = null;
sm_levelPackScoreboard = -1;
};
SettingsSave();
} else {
_bitmapLevelSelectionScreen = new Bitmap(new _classLevelSelectionScreen().bitmapData);
_bitmapLevelSelectionScreen.smoothing = true;
redrawLevelSelectionScreen();
addChild(_bitmapLevelSelectionScreen);
addChild(_bitmapLevelPackSelectionCogWheel);
};
}
public function BringPlus1OnTop():void{
var _local1:int;
_local1 = 0;
while (_local1 < _plus1SpritesN) {
m_currTest.m_sprite.removeChild(_plus1Sprites[_local1]);
m_currTest.m_sprite.addChild(_plus1Sprites[_local1]);
_local1++;
};
}
private function updateSealOfQuantity():void{
var _local1:Bitmap;
if (!MyPreloader._ttursasSeal){
return;
};
if (_bitmapTitleScreenBackground != null){
_bitmapSealBack.visible = true;
_bitmapSealFront.visible = true;
_bitmapSealFront.x = ((15 - 10) + 18);
_bitmapSealFront.y = ((490 - 105) + 18);
_rotateSeal = (_rotateSeal + 0.01);
_local1 = _bitmapSealBack;
_local1.rotation = 0;
Test.rot(_local1, ((15 + 50) - 10), (490 - 55), ((_rotateSeal * 180) / Math.PI), (-(_local1.width) * 0.5), (-(_local1.height) * 0.5));
} else {
_bitmapSealBack.visible = false;
_bitmapSealFront.visible = false;
};
}
private function runAchievementsScreen():void{
var _local1:Number;
var _local2:Number;
if (!Input.mouseClicked){
return;
};
_local1 = s_mouseX;
_local2 = s_mouseY;
if (isPointInside(_local1, _local2, (190 + 30), 444, (298 + 30), 488)){
buttonPressed();
toggleAchievementsScreen();
toggleTitleScreen();
};
}
public function onMouseWheelEvent(_arg1:MouseEvent):void{
s_mouseWheel = _arg1.delta;
}
public function mousePress(_arg1:MouseEvent):void{
s_mouseClickedX = mouseX;
s_mouseClickedY = mouseY;
s_mouseClicked = true;
}
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);
}
private function runInGameMenuBar():void{
var _local1:Boolean;
var _local2:Boolean;
var _local3:Bitmap;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:int;
var _local8:int;
_local1 = false;
_local2 = false;
if (s_mouseY > 465){
_local2 = true;
} else {
if ((((s_mouseY > 450)) && ((m_inGameMenuBarScrollY > 0)))){
_local2 = true;
};
};
if (((!((m_currTest == null))) && (!((m_currTest.m_mouseBody == null))))){
_local2 = false;
m_inGameMenuBarLocked = true;
};
if (m_inGameMenuBarStayUp){
_local2 = true;
m_inGameMenuBarLocked = false;
if (Input.mouseClicked){
m_inGameMenuBarStayUp = false;
};
};
if (m_inGameMenuBarLocked){
_local2 = false;
if (s_mouseY < 465){
m_inGameMenuBarLocked = false;
};
};
if (_local2){
m_inGameMenuBarScrollY = (m_inGameMenuBarScrollY + 5);
if (m_inGameMenuBarScrollY >= 50){
m_inGameMenuBarScrollY = 50;
_local1 = true;
};
} else {
m_inGameMenuBarScrollY = (m_inGameMenuBarScrollY - 5);
if (m_inGameMenuBarScrollY < 0){
m_inGameMenuBarScrollY = 0;
};
};
_bitmapMenuBar.y = (SCREEN_DY - m_inGameMenuBarScrollY);
_rotateSeal = (_rotateSeal + 0.01);
_local3 = _bitmapMenuBarCogWheel;
_local3.rotation = 0;
Test.rot(_local3, ((343 + (40 * m_currId)) + 20), (_bitmapMenuBar.y + 25), ((_rotateSeal * 180) / Math.PI), (-(_local3.width) * 0.5), (-(_local3.height) * 0.5));
if (!Input.mouseClicked){
return;
};
_local4 = s_mouseX;
_local5 = s_mouseY;
if (_local1){
_local6 = _bitmapMenuBar.y;
if (isPointInsideDelta(_local4, _local5, IGML_AUDIO_PX, (IGML_AUDIO_PY + _local6), IGML_AUDIO_DX, IGML_AUDIO_DY)){
buttonPressed();
_audio = !(_audio);
if (_audio){
changeBGM();
} else {
SoundMixer.stopAll();
_bgm = -1;
};
redrawInGameMenuBar();
SettingsSave();
};
if (isPointInsideDelta(_local4, _local5, IGML_QUALITY_PX, (IGML_QUALITY_PY + _local6), IGML_QUALITY_DX, IGML_QUALITY_DY)){
buttonPressed();
if (s_quality == 0){
stage.quality = StageQuality.HIGH;
s_quality = 1;
} else {
if (s_quality == 1){
stage.quality = StageQuality.MEDIUM;
s_quality = 2;
} else {
if (s_quality == 2){
stage.quality = StageQuality.LOW;
s_quality = 3;
} else {
stage.quality = StageQuality.BEST;
s_quality = 0;
};
};
};
redrawInGameMenuBar();
};
if (isPointInsideDelta(_local4, _local5, IGML_SHOW_BEST_PX, (IGML_SHOW_BEST_PY + _local6), IGML_SHOW_BEST_DX, IGML_SHOW_BEST_DY)){
buttonPressed();
s_showBest = !(s_showBest);
if (_bitmapSlotBarScore.x < (SCREEN_DX * 0.5)){
putSlotBarsToLeft();
} else {
putSlotBarsToRight();
};
redrawInGameMenuBar();
};
if (isPointInsideDelta(_local4, _local5, IGML_MENU_PX, (IGML_MENU_PY + _local6), IGML_MENU_DX, IGML_MENU_DY)){
buttonPressed();
returnToLevelSelectionFromGame();
};
if (isPointInsideDelta(_local4, _local5, IGML_RESET_PX, (IGML_RESET_PY + _local6), IGML_RESET_DX, IGML_RESET_DY)){
buttonPressed();
resetPressed();
};
_local7 = 0;
while (_local7 < 5) {
if (isPointInsideDelta(_local4, _local5, (343 + (40 * _local7)), _local6, 40, 50)){
_local8 = ((s_selectedLevelPack * 5) + _local7);
if (sm_levelUnlocked[_local8] == 0){
} else {
_local8 = ((s_selectedLevelPack * 5) + m_currId);
if ((sm_levelBest[_local8] ^ sm_levelBestMask[_local8]) > 0){
sm_levelUnlocked[_local8] = 2;
};
m_currId = _local7;
buttonPressed();
resetPressed();
};
};
_local7++;
};
};
}
private function toggleCreditsScreen():void{
if (_bitmapCreditsScreen != null){
removeChild(_bitmapCreditsScreen);
_bitmapCreditsScreen = null;
} else {
_bitmapCreditsScreen = new Bitmap(new _classCreditsScreen().bitmapData);
_bitmapCreditsScreen.smoothing = true;
addChild(_bitmapCreditsScreen);
};
}
private function redrawInGameMenuBar():void{
var _local1:BitmapData;
var _local2:BitmapData;
var _local3:int;
var _local4:int;
_local1 = _bitmapMenuBarSource.bitmapData;
_local2 = _bitmapMenuBar.bitmapData;
copyFullBitmapData(_local2, _local1, 0, 0);
if (_audio){
_local1 = _bitmapAudioOn.bitmapData;
} else {
_local1 = _bitmapAudioOff.bitmapData;
};
copyFullBitmapData(_local2, _local1, IGML_AUDIO_PX, IGML_AUDIO_PY);
if (s_quality == 0){
_local1 = _bitmapQualityBest.bitmapData;
} else {
if (s_quality == 1){
_local1 = _bitmapQualityHigh.bitmapData;
} else {
if (s_quality == 2){
_local1 = _bitmapQualityMedium.bitmapData;
} else {
if (s_quality == 3){
_local1 = _bitmapQualityLow.bitmapData;
};
};
};
};
copyFullBitmapData(_local2, _local1, IGML_QUALITY_PX, IGML_QUALITY_PY);
if (s_showBest){
_local1 = _bitmapShowBestYes.bitmapData;
} else {
_local1 = _bitmapShowBestNo.bitmapData;
};
copyFullBitmapData(_local2, _local1, IGML_SHOW_BEST_PX, IGML_SHOW_BEST_PY);
_local1 = new _classMenuButton().bitmapData;
copyFullBitmapData(_local2, _local1, IGML_MENU_PX, IGML_MENU_PY);
_local1 = new _classResetButton().bitmapData;
copyFullBitmapData(_local2, _local1, IGML_RESET_PX, IGML_RESET_PY);
_local3 = 0;
while (_local3 < 5) {
_local4 = ((s_selectedLevelPack * 5) + _local3);
if (sm_levelUnlocked[_local4] == 0){
copyFullBitmapData(_local2, new _classMenuBarLockedIcon().bitmapData, (343 + (40 * _local3)), 0);
};
_local3++;
};
}
private function addDiamondExplosion(_arg1:Number, _arg2:Number):void{
var _local3:int;
var _local4:Particle;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = 0;
while (_local3 < 64) {
_local4 = m_particleManager.addParticle(Particle.PARTICLE_TYPE_EXPLOSION, _arg1, _arg2, 4294967040);
if (_local4 != null){
_local5 = ((Math.random() * Math.PI) * 2);
_local6 = (1 + (Math.random() * 5));
_local7 = (8 * Math.cos(_local5));
_local8 = (8 * Math.sin(_local5));
_local4._speedX = (_local7 * 0.2);
_local4._speedY = (_local8 * 0.2);
_local4._life = (_local4._life + (Math.random() * 40));
};
_local3++;
};
}
private function returnToLevelSelectionFromGame():void{
SettingsSave();
toggleLevelSelectionScreen();
hideGameScreen();
}
private function changeBGM():void{
var _local1:int;
if (!_audio){
return;
};
_local1 = 0;
if (areWeInMenu()){
_local1 = 2;
} else {
if (s_selectedLevelPack <= 8){
_local1 = 0;
} else {
_local1 = 1;
};
};
if (_bitmapTheEndScreen != null){
_local1 = 1;
};
if (_bgm != _local1){
SoundMixer.stopAll();
if (_local1 == 0){
_audioBank._soundGame.play(0, int.MAX_VALUE, _soundTransformVolumeLow);
} else {
if (_local1 == 1){
_audioBank._soundGameSpecial.play(0, int.MAX_VALUE, _soundTransformVolumeLow);
} else {
_audioBank._soundMenu.play(0, int.MAX_VALUE, _soundTransformVolumeLow);
};
};
_bgm = _local1;
};
}
public function areWeInMenu():Boolean{
if (((((((((!((_bitmapTitleScreenBackground == null))) || (!((_bitmapCreditsScreen == null))))) || (!((_bitmapInstructionsScreen == null))))) || (!((_bitmapLevelSelectionScreen == null))))) || (!((_bitmapAchievementsScreen == null))))){
return (true);
};
return (false);
}
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 mouseOver(_arg1:MouseEvent):void{
s_mouseOver = true;
}
private function removePlus1Sprites():void{
var _local1:int;
_local1 = 0;
while (_local1 < _plus1SpritesN) {
m_currTest.m_sprite.removeChild(_plus1Sprites[_local1]);
_plus1Sprites[_local1] = null;
_local1++;
};
_plus1SpritesN = 0;
}
private function toggleAchievementsScreen():void{
var _local1:BitmapData;
if (_bitmapAchievementsScreen != null){
removeChild(_bitmapAchievementsScreen);
_bitmapAchievementsScreen = null;
} else {
_bitmapAchievementsScreen = new Bitmap(new _classAchievementsScreen().bitmapData);
_bitmapAchievementsScreen.smoothing = true;
_local1 = _bitmapAchievementsScreen.bitmapData;
if ((sm_achievementBits & ACHIEVEMENT_BIT_10_LEVELS) != 0){
copyFullBitmapDataScale(_local1, new _classAchievement10Levels().bitmapData, 51, (64 + (76 * 0)), 0.75);
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_45_LEVELS) != 0){
copyFullBitmapDataScale(_local1, new _classAchievement45Levels().bitmapData, 51, (64 + (76 * 1)), 0.75);
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_60_LEVELS) != 0){
copyFullBitmapDataScale(_local1, new _classAchievement60Levels().bitmapData, 51, (64 + (76 * 2)), 0.75);
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_10_LEVELS_2) != 0){
copyFullBitmapDataScale(_local1, new _classAchievement10Levels2().bitmapData, 51, (64 + (76 * 3)), 0.75);
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_45_LEVELS_2) != 0){
copyFullBitmapDataScale(_local1, new _classAchievement45Levels2().bitmapData, 51, (64 + (76 * 4)), 0.75);
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_60_LEVELS_2) != 0){
copyFullBitmapDataScale(_local1, new _classAchievement60Levels2().bitmapData, 312, (64 + (76 * 0)), 0.75);
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_10_LEVELS_3) != 0){
copyFullBitmapDataScale(_local1, new _classAchievement10Levels3().bitmapData, 312, (64 + (76 * 1)), 0.75);
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_20_LEVELS_3) != 0){
copyFullBitmapDataScale(_local1, new _classAchievement20Levels3().bitmapData, 312, (64 + (76 * 2)), 0.75);
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_ALL_LEVEL_PACKS) != 0){
copyFullBitmapDataScale(_local1, new _classAchievementAllLevelPacks().bitmapData, 312, (64 + (76 * 3)), 0.75);
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_111_DIAMONDS) != 0){
copyFullBitmapDataScale(_local1, new _classAchievement111Diamonds().bitmapData, 312, (64 + (76 * 4)), 0.75);
};
addChild(_bitmapAchievementsScreen);
};
}
public function redrawSlotBar(_arg1:Boolean):void{
var _local2:BitmapData;
var _local3:BitmapData;
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:int;
var _local10:Number;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:Boolean;
if (_arg1){
_local2 = new _classSlotBarBest().bitmapData;
_local3 = _bitmapSlotBarBest.bitmapData;
} else {
_local2 = new _classSlotBarScore().bitmapData;
_local3 = _bitmapSlotBarScore.bitmapData;
};
copyFullBitmapData(_local3, _local2, 0, 0);
_local4 = m_currTest._pointBlocksMax;
_local5 = 21;
_local6 = 1;
_local7 = 0;
if (_local4 > 14){
_local7 = (_local7 + 4);
_local5 = (_local5 * 0.6);
_local6 = (_local6 * 0.6);
};
_local8 = ((s_selectedLevelPack * 5) + m_currId);
_local9 = m_currTest._pointBlocks;
_local10 = (62 + ((_local4 - 1) * _local5));
_local11 = (_local4 - _local9);
_local12 = 0;
if (_arg1){
_local11 = sm_levelBestBalls[_local8];
};
_local13 = 0;
while (_local13 < _local4) {
_local14 = false;
if (_local13 == (LEVELS_DIAMOND_LIMITS[((_local8 * 2) + 0)] - 1)){
_local14 = true;
} else {
if (_local13 == (LEVELS_DIAMOND_LIMITS[((_local8 * 2) + 1)] - 1)){
_local14 = true;
};
};
if (_local13 < _local11){
if (_local14){
_local2 = new _classSlotDiamondBright().bitmapData;
if (((!(_arg1)) && ((m_currTest._diamondsDrawn <= _local12)))){
m_currTest._diamondsDrawn++;
addDiamondExplosion(((_local7 + _bitmapSlotBarScore.x) + (_local2.width * 0.5)), (((_local10 + _bitmapSlotBarScore.y) + (_local2.height * 0.5)) - m_sprite.y));
};
_local12++;
} else {
_local2 = new _classSlotBright().bitmapData;
};
} else {
if (_local14){
_local2 = new _classSlotDiamondGray().bitmapData;
} else {
_local2 = new _classSlotBlack().bitmapData;
};
};
copyFullBitmapDataScale(_local3, _local2, _local7, _local10, _local6);
_local10 = (_local10 - _local5);
_local13++;
};
if (_arg1){
return;
};
if ((((_local12 > 0)) && ((m_currTest._playerObjects == 0)))){
_local12++;
m_currTest._playerObjectsAllGone = true;
m_currTest._perfectStrikeAdded = 1;
};
m_currTest._diamondsMask = (Math.random() * 0xFFFFFF);
m_currTest._diamonds = (_local12 ^ m_currTest._diamondsMask);
}
public function addTaunt(_arg1:Boolean):void{
var _local2:Bitmap;
var _local3:Number;
if (_bitmapTaunt != null){
if (!_arg1){
return;
};
removeChild(_bitmapTaunt);
_bitmapTaunt = null;
};
if (_arg1){
_local2 = new Bitmap(new _classTaunt2().bitmapData);
} else {
_local3 = Math.random();
if (_local3 < 0.25){
_local2 = new Bitmap(new _classTaunt1().bitmapData);
} else {
if (_local3 < 0.5){
_local2 = new Bitmap(new _classTaunt3().bitmapData);
} else {
if (_local3 < 0.75){
_local2 = new Bitmap(new _classTaunt4().bitmapData);
} else {
_local2 = new Bitmap(new _classTaunt5().bitmapData);
};
};
};
};
_local2.smoothing = true;
_local2.x = ((SCREEN_DX * 0.5) - (_local2.width * 0.5));
_local2.y = (300 - (_local2.height * 0.5));
addChild(_local2);
_bitmapTaunt = _local2;
m_currTest._tauntTimer = 100;
}
private function addHelpBitmap(_arg1:BitmapData, _arg2:Number, _arg3:Number):Bitmap{
var _local4:Bitmap;
_helpX = _arg2;
_helpY = _arg3;
_local4 = new Bitmap(_arg1);
_local4.x = (_arg2 - (_local4.width * 0.5));
_local4.y = (_arg3 - (_local4.height * 0.5));
_local4.smoothing = true;
addChild(_local4);
keepMenuBarTopmost();
return (_local4);
}
private function CalculateTotalDiamonds():int{
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = 0;
_local2 = 0;
while (_local2 < 80) {
_local3 = (sm_levelBest[_local2] ^ sm_levelBestMask[_local2]);
if (_local3 > 3){
_local3 = 0;
};
_local1 = (_local1 + _local3);
_local2++;
};
return (_local1);
}
private function updateTitleScreenAudioButton():void{
if (_audio){
_bitmapAudioOn.visible = true;
_bitmapAudioOff.visible = false;
} else {
_bitmapAudioOn.visible = false;
_bitmapAudioOff.visible = true;
};
}
private function calculateSaveChecksum(_arg1:Array, _arg2:Array, _arg3:Array, _arg4:Array, _arg5:Array, _arg6:int):int{
var _local7:int;
var _local8:int;
var _local9:int;
_local8 = 0;
_local7 = 0;
while (_local7 < 80) {
if ((_local7 & 1) == 0){
_local8 = (_local8 + (_arg1[_local7] * (_local7 + 1)));
} else {
_local8 = (_local8 ^ _arg1[_local7]);
};
_local8 = (_local8 - _arg2[_local7]);
_local8 = (_local8 ^ _arg3[_local7]);
_local8 = (_local8 + _arg4[_local7]);
_local7++;
};
_local9 = 137;
_local7 = 0;
while (_local7 < LEVEL_PACKS_MAX) {
if (_arg5[_local7] != 0){
_local8 = (_local8 + _local9);
} else {
_local8 = (_local8 ^ _local9);
};
_local9 = (_local9 + (_local8 & 383));
_local7++;
};
_local8 = (_local8 + _arg6);
_local8 = (_local8 ^ _arg6);
return ((_local8 & 16220031));
}
private function evaluateAchievementsInGame():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Boolean;
var _local7:int;
if (_bitmapAchievement != null){
return;
};
if (m_currTest == null){
return;
};
_local1 = 0;
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = 0;
while (_local5 < 80) {
_local7 = (sm_levelBest[_local5] ^ sm_levelBestMask[_local5]);
if (_local7 >= 1){
_local1++;
};
if (_local7 >= 2){
_local2++;
};
if (_local7 >= 3){
_local3++;
};
_local4 = (_local4 + _local7);
_local5++;
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_10_LEVELS) == 0){
if (_local1 >= 10){
unlockAchievement(ACHIEVEMENT_BIT_10_LEVELS);
return;
};
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_45_LEVELS) == 0){
if (_local1 >= 45){
unlockLevelPack(10);
unlockAchievement(ACHIEVEMENT_BIT_45_LEVELS);
return;
};
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_60_LEVELS) == 0){
if (_local1 >= 60){
unlockAchievement(ACHIEVEMENT_BIT_60_LEVELS);
return;
};
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_10_LEVELS_2) == 0){
if (_local2 >= 10){
unlockAchievement(ACHIEVEMENT_BIT_10_LEVELS_2);
return;
};
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_45_LEVELS_2) == 0){
if (_local2 >= 45){
unlockAchievement(ACHIEVEMENT_BIT_45_LEVELS_2);
return;
};
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_60_LEVELS_2) == 0){
if (_local2 >= 60){
unlockAchievement(ACHIEVEMENT_BIT_60_LEVELS_2);
return;
};
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_10_LEVELS_3) == 0){
if (_local3 >= 10){
unlockLevelPack(9);
unlockAchievement(ACHIEVEMENT_BIT_10_LEVELS_3);
return;
};
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_20_LEVELS_3) == 0){
if (_local3 >= 20){
unlockLevelPack(11);
unlockAchievement(ACHIEVEMENT_BIT_20_LEVELS_3);
return;
};
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_111_DIAMONDS) == 0){
if (_local4 >= 111){
unlockAchievement(ACHIEVEMENT_BIT_111_DIAMONDS);
return;
};
};
_local6 = true;
_local5 = 0;
while (_local5 < LEVEL_PACKS_MAX) {
if (sm_levelPackUnlocked[_local5] == 0){
_local6 = false;
break;
};
_local5++;
};
if ((sm_achievementBits & ACHIEVEMENT_BIT_ALL_LEVEL_PACKS) == 0){
if (_local6){
unlockAchievement(ACHIEVEMENT_BIT_ALL_LEVEL_PACKS);
return;
};
};
}
private function startGame():void{
var _local1:BitmapData;
var _local2:BitmapData;
if (s_selectedLevelPack < 3){
_local1 = new _classBackgroundFlash1().bitmapData;
} else {
if (s_selectedLevelPack < 6){
_local1 = new _classBackgroundFlash2().bitmapData;
} else {
if (s_selectedLevelPack < 9){
_local1 = new _classBackgroundFlash3().bitmapData;
} else {
_local1 = new _classBackgroundFlash4().bitmapData;
};
};
};
_local2 = _bitmapBackground.bitmapData;
copyFullBitmapData(_local2, _local1, 0, 0);
_bitmapBackground.visible = true;
_bitmapSlotBarScore.visible = true;
_bitmapSlotBarBest.visible = true;
sm_levelPackUnlockedTimer = 0;
removeChild(m_sprite);
addChild(m_sprite);
removeChild(_bitmapSlotBarScore);
addChild(_bitmapSlotBarScore);
removeChild(_bitmapSlotBarBest);
addChild(_bitmapSlotBarBest);
if (MyPreloader._walkthroughButton){
_bitmapWalkthroughButton = new Bitmap(new _classWalkthroughButton().bitmapData);
_bitmapWalkthroughButton.smoothing = true;
_bitmapWalkthroughButton.x = 2;
_bitmapWalkthroughButton.y = 2;
_bitmapWalkthroughButton.scaleX = 0.5;
_bitmapWalkthroughButton.scaleY = 0.5;
_bitmapWalkthroughButton.alpha = 0.7;
addChild(_bitmapWalkthroughButton);
};
m_inGameMenuBarScrollY = 0;
_bitmapMenuBar.y = SCREEN_DY;
_bitmapMenuBarCogWheel.y = _bitmapMenuBar.y;
redrawInGameMenuBar();
addChild(_bitmapMenuBar);
addChild(_bitmapMenuBarCogWheel);
changeBGM();
}
private function addLootDiamonds():void{
var _local1:int;
var _local2:int;
var _local3:Number;
var _local4:BitmapData;
var _local5:BitmapData;
if (m_currTest._lootDiamondsDelay > 0){
m_currTest._lootDiamondsDelay--;
return;
};
m_currTest._lootDiamondsDelay = 1;
_local1 = CalculateTotalDiamondsLevelPack(s_selectedLevelPack);
_local2 = 28;
if (_local1 < 10){
_local2 = 20;
};
_local3 = ((((_bitmapLevelPackLoot.width * 0.5) - ((_local1 * 0.5) * 20)) + (m_currTest._lootDiamondsAdded * 20)) - _local2);
_local4 = _bitmapLevelPackLoot.bitmapData;
if (m_currTest._lootDiamondsAdded < _local1){
_local5 = new _classSlotDiamondBright().bitmapData;
copyFullBitmapData(_local4, _local5, _local3, (27 - 2));
m_currTest._lootDiamondsAdded++;
} else {
if (m_currTest._lootDiamondsAdded == _local1){
_textFieldLPSSmall.text = ("= " + _local1);
_local4.draw(_textFieldLPSSmall, new Matrix(1, 0, 0, 1, _local3, (25 - 2)), null, null, null, true);
m_currTest._lootDiamondsAdded++;
};
};
}
private function showEarlyTutorialHelps():void{
if (!_help1Shown){
_help1Shown = true;
_bitmapHelpText = addHelpBitmap(new _classHelp1().bitmapData, (SCREEN_DX * 0.5), 130);
} else {
if (!_help2Shown){
_help2Shown = true;
_helpRotateExit = true;
_bitmapHelpText = addHelpBitmap(new _classHelp2().bitmapData, (SCREEN_DX * 0.5), 130);
} else {
if (!_help3AShown){
_help3AShown = true;
_bitmapHelpText = addHelpBitmap(new _classHelp3A().bitmapData, 160, 320);
} else {
if (!_help3BShown){
_help3BShown = true;
_bitmapHelpText = addHelpBitmap(new _classHelp3B().bitmapData, (SCREEN_DX * 0.5), 144);
} else {
if (!_help4Shown){
_help4Shown = true;
_bitmapHelpText = addHelpBitmap(new _classHelp4().bitmapData, ((60 + 135) - 15), 170);
} else {
if (!_help5Shown){
_help5Shown = true;
_bitmapHelpText = addHelpBitmap(new _classHelp5().bitmapData, ((60 + 125) - 15), 175);
} else {
if (!_help6Shown){
_help6Shown = true;
_bitmapHelpText = addHelpBitmap(new _classHelp6().bitmapData, 135, ((SCREEN_DY - 60) - 50));
m_inGameMenuBarStayUp = true;
};
};
};
};
};
};
};
}
private function SettingsLoad():void{
var _local1:SharedObject;
var _local2:int;
trace("SettingsLoad()...");
_local1 = SharedObject.getLocal("ImperfectBalanceSettings");
if ((((_local1 == null)) || (!((_local1.data.header == "IBS3"))))){
return;
};
_local2 = calculateSaveChecksum(_local1.data.levelBest, _local1.data.levelBestBalls, _local1.data.levelBestMask, _local1.data.levelUnlocked, _local1.data.levelPackUnlocked, _local1.data.achievementBits);
trace(((("checksum = " + _local2) + " sO.data.checksum = ") + _local1.data.checksum));
if (((!((MyPreloader._kongregateAPI == null))) && (!((_local2 == _local1.data.checksum))))){
MyPreloader._kongregateAPI.stats.submit("SaveFileChecksumMismatch", 1);
};
sm_levelBest = _local1.data.levelBest;
sm_levelBestBalls = _local1.data.levelBestBalls;
sm_levelBestMask = _local1.data.levelBestMask;
sm_levelUnlocked = _local1.data.levelUnlocked;
sm_levelPackUnlocked = _local1.data.levelPackUnlocked;
sm_achievementBits = _local1.data.achievementBits;
_audio = _local1.data.audio;
sendToKongregate(sm_achievementBits);
trace("... success!");
}
private function resetPressed():void{
if (m_currTest != null){
m_currTest.DestroyBodies();
};
m_currTest = null;
}
private function recreateLevel():void{
var _local1:int;
m_currTest = new Test();
if (_bitmapTheEndScreen != null){
m_currTest.useEditorLevel(THE_END_LEVEL);
m_currTest._theEndDiamondsMax = CalculateTotalDiamonds();
} else {
if (s_selectedLevelPack == 0){
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS_PACK_1A[m_currId]);
} else {
if (s_selectedLevelPack == 1){
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS_PACK_1B[m_currId]);
} else {
if (s_selectedLevelPack == 2){
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS_PACK_2[m_currId]);
} else {
if (s_selectedLevelPack == 3){
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS_PACK_3[m_currId]);
} else {
if (s_selectedLevelPack == 4){
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS_PACK_4[m_currId]);
} else {
if (s_selectedLevelPack == 5){
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS_PACK_5[m_currId]);
} else {
if (s_selectedLevelPack == 6){
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS_PACK_6[m_currId]);
} else {
if (s_selectedLevelPack == 7){
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS_PACK_7[m_currId]);
} else {
if (s_selectedLevelPack == 8){
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS_PACK_8[m_currId]);
} else {
if (s_selectedLevelPack == 9){
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS_PACK_X[m_currId]);
} else {
if (s_selectedLevelPack == 10){
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS_PACK_Y[m_currId]);
} else {
m_currTest.useEditorLevel(LEVEL_DATA_STRINGS_PACK_Z[m_currId]);
};
};
};
};
};
};
};
};
};
};
};
};
_playOn = false;
_textFieldDampTimer.visible = false;
m_particleManager.reset();
if (_bitmapAllDone != null){
removeChild(_bitmapAllDone);
_bitmapAllDone = null;
};
if (_bitmapLevelPackLoot != null){
removeChild(_bitmapLevelPackLoot);
_bitmapLevelPackLoot = null;
};
if (_bitmapWait != null){
removeChild(_bitmapWait);
_bitmapWait = null;
};
if (_bitmapWaitSecondsUntil != null){
removeChild(_bitmapWaitSecondsUntil);
_bitmapWaitSecondsUntil = null;
};
if (_bitmapDamping != null){
removeChild(_bitmapDamping);
_bitmapDamping = null;
};
if (_bitmapMenuButton != null){
removeChild(_bitmapMenuButton);
_bitmapMenuButton = null;
};
if (_bitmapResetButton != null){
removeChild(_bitmapResetButton);
_bitmapResetButton = null;
};
if (_bitmapNextButton != null){
removeChild(_bitmapNextButton);
_bitmapNextButton = null;
};
if (_bitmapPerfectStrike1 != null){
removeChild(_bitmapPerfectStrike1);
_bitmapPerfectStrike1 = null;
};
if (_bitmapPerfectStrike2 != null){
removeChild(_bitmapPerfectStrike2);
_bitmapPerfectStrike2 = null;
};
if (_bitmapPerfectStrike3 != null){
removeChild(_bitmapPerfectStrike3);
_bitmapPerfectStrike3 = null;
};
if (_bitmapNextLevelIsOpen != null){
removeChild(_bitmapNextLevelIsOpen);
_bitmapNextLevelIsOpen = null;
};
if (_bitmapANewLevelPackIsOpen != null){
removeChild(_bitmapANewLevelPackIsOpen);
_bitmapANewLevelPackIsOpen = null;
};
if (_bitmapMenuIndicator != null){
removeChild(_bitmapMenuIndicator);
_bitmapMenuIndicator = null;
};
if (_bitmapChooseAShape != null){
removeChild(_bitmapChooseAShape);
_bitmapChooseAShape = null;
};
if (_bitmapMakeAsMany != null){
removeChild(_bitmapMakeAsMany);
_bitmapMakeAsMany = null;
};
if (_bitmapTaunt != null){
removeChild(_bitmapTaunt);
_bitmapTaunt = null;
};
_local1 = ((s_selectedLevelPack * 5) + m_currId);
m_currTest._diamondsOldBest = (sm_levelBest[_local1] ^ sm_levelBestMask[_local1]);
if ((((((s_selectedLevelPack == 0)) && ((m_currId == 0)))) && (_help6Shown))){
_help1Shown = false;
_help2Shown = false;
_help3AShown = false;
_help3BShown = false;
_help4Shown = false;
_help5Shown = false;
_help6Shown = false;
};
SettingsSave();
}
private function runHelpTexts():void{
var _local1:Boolean;
_local1 = false;
if (((!((m_currTest == null))) && (m_currTest._waiting))){
_local1 = true;
};
if ((((_bitmapHelpText == null)) && (!(_local1)))){
if (s_selectedLevelPack == 0){
if (m_currId == 0){
showEarlyTutorialHelps();
} else {
if (m_currId == 1){
showEarlyTutorialHelps();
} else {
if ((((m_currId == 2)) || ((m_currId == 3)))){
if (!_helpDirectedGravityShown){
_helpDirectedGravityShown = true;
_bitmapHelpText = addHelpBitmap(new _classHelpDirectedGravity().bitmapData, (SCREEN_DX * 0.5), 140);
};
} else {
if (m_currId == 4){
if (!_helpHeavyShown){
_helpHeavyShown = true;
_bitmapHelpText = addHelpBitmap(new _classHelpHeavy().bitmapData, (SCREEN_DX * 0.5), 140);
} else {
if (!_help7Shown){
_help7Shown = true;
_bitmapHelpText = addHelpBitmap(new _classHelp7().bitmapData, (SCREEN_DX * 0.5), 140);
};
};
};
};
};
};
};
if (s_selectedLevelPack == 1){
if (m_currId == 3){
if (!_helpHeliumShown){
_helpHeliumShown = true;
_bitmapHelpText = addHelpBitmap(new _classHelpHelium().bitmapData, (SCREEN_DX * 0.5), 140);
} else {
if (!_helpGlassShown){
_helpGlassShown = true;
_bitmapHelpText = addHelpBitmap(new _classHelpGlass().bitmapData, (SCREEN_DX * 0.5), 140);
};
};
};
};
} else {
if (_bitmapHelpText != null){
if (((Input.mouseClicked) || (_local1))){
_helpBitmapZooming = true;
};
if (((_helpRotateExit) && (((((((((!((s_mouseWheel == 0))) || (Input.isKeyPressed(65)))) || (Input.isKeyPressed(37)))) || (Input.isKeyPressed(68)))) || (Input.isKeyPressed(39)))))){
_helpBitmapZooming = true;
};
if (_helpBitmapZooming){
_helpRotateExit = false;
_bitmapHelpText.scaleX = (_bitmapHelpText.scaleX + 0.05);
_bitmapHelpText.scaleY = (_bitmapHelpText.scaleY + 0.05);
_bitmapHelpText.alpha = (_bitmapHelpText.alpha - 0.05);
if (_bitmapHelpText.alpha <= 0){
removeChild(_bitmapHelpText);
_bitmapHelpText = null;
_helpBitmapZooming = false;
} else {
_bitmapHelpText.x = (_helpX - (_bitmapHelpText.width * 0.5));
_bitmapHelpText.y = (_helpY - (_bitmapHelpText.height * 0.5));
};
};
};
};
}
private function addResultDiamonds():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:BitmapData;
var _local5:BitmapData;
var _local6:int;
var _local7:Number;
if (m_currTest._resultDiamondsDelay > 0){
m_currTest._resultDiamondsDelay--;
return;
};
m_currTest._resultDiamondsDelay = 1;
_local1 = ((s_selectedLevelPack * 5) + m_currId);
_local2 = m_currTest._diamondsOldBest;
_local3 = (m_currTest._diamonds ^ m_currTest._diamondsMask);
_local4 = new _classSlotDiamondBright().bitmapData;
_local5 = _bitmapAllDone.bitmapData;
_local6 = m_currTest._resultDiamondsAdded;
_local7 = (_local6 * 20);
if ((((_local2 == 0)) && ((_local6 == 0)))){
copyFullBitmapData(_local5, new _classSlotMinus().bitmapData, (166 + _local7), 41);
} else {
if (_local6 < _local2){
copyFullBitmapData(_local5, _local4, (166 + _local7), 41);
};
};
if ((((_local3 == 0)) && ((_local6 == 0)))){
copyFullBitmapData(_local5, new _classSlotMinus().bitmapData, (166 + _local7), 62);
};
if (_local6 < _local3){
copyFullBitmapData(_local5, _local4, (166 + _local7), 62);
};
m_currTest._resultDiamondsAdded++;
}
private function runPlus1s():void{
var _local1:int;
_local1 = 0;
while (_local1 < _plus1SpritesN) {
var _local2 = _plus1States;
var _local3 = _local1;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
if (_plus1States[_local1] < 20){
} else {
_plus1Sprites[_local1].y = (_plus1Sprites[_local1].y - _plus1Speed[_local1]);
if (_plus1States[_local1] < 120){
} else {
_plus1Sprites[_local1].alpha = (_plus1Sprites[_local1].alpha - 0.05);
if (_plus1Sprites[_local1].alpha <= 0){
m_currTest.m_sprite.removeChild(_plus1Sprites[_local1]);
_plus1Sprites[_local1] = _plus1Sprites[(_plus1SpritesN - 1)];
_plus1States[_local1] = _plus1States[(_plus1SpritesN - 1)];
_plus1Speed[_local1] = _plus1Speed[(_plus1SpritesN - 1)];
_plus1Sprites[(_plus1SpritesN - 1)] = null;
_plus1SpritesN--;
_local1--;
};
};
};
_local1++;
};
}
private function runGameScreen():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:SoundTransform;
runInGameMenuBar();
if (m_currTest == null){
return;
};
if (_bitmapTaunt != null){
if (m_currTest._tauntTimer > 0){
m_currTest._tauntTimer--;
} else {
_bitmapTaunt.alpha = (_bitmapTaunt.alpha - 0.1);
if (_bitmapTaunt.alpha <= 0){
removeChild(_bitmapTaunt);
_bitmapTaunt = null;
};
};
};
sm_levelPackCurrId[s_selectedLevelPack] = m_currId;
if (Input.isKeyPressed(27)){
buttonPressed();
returnToLevelSelectionFromGame();
};
if ((((s_mouseX > (SCREEN_DX - 100))) || ((((s_selectedLevelPack == 0)) && ((m_currId == 0)))))){
putSlotBarsToLeft();
} else {
if (s_mouseX < 100){
putSlotBarsToRight();
};
};
if (s_showBest){
_bitmapSlotBarBest.visible = true;
} else {
_bitmapSlotBarBest.visible = false;
};
if (((((m_currTest._waiting) && ((_bitmapWait == null)))) && ((_bitmapAllDone == null)))){
if (m_currTest._waitingDelay <= 0){
_bitmapWait = new Bitmap(new _classWait().bitmapData);
_bitmapWait.smoothing = true;
_bitmapWait.x = (300 - (_bitmapWait.width * 0.5));
_bitmapWait.y = 10;
addChild(_bitmapWait);
_bitmapWaitSecondsUntil = new Bitmap(new _classWaitSecondsUntil().bitmapData);
_bitmapWaitSecondsUntil.smoothing = true;
_bitmapWaitSecondsUntil.x = (300 - (_bitmapWaitSecondsUntil.width * 0.5));
_bitmapWaitSecondsUntil.y = 60;
addChild(_bitmapWaitSecondsUntil);
m_currTest._dampTimerLeft = 9999;
_textFieldDampTimer.text = "9";
_textFieldDampTimer.x = (300 - (_textFieldDampTimer.width * 0.5));
_textFieldDampTimer.y = (54 - (_textFieldDampTimer.height * 0.5));
_textFieldDampTimer.visible = true;
} else {
m_currTest._waitingDelay--;
};
};
if (((((m_currTest._waiting) && (m_currTest._stabile))) && ((_bitmapAllDone == null)))){
if (_bitmapWait != null){
_bitmapWait.visible = false;
};
if (_bitmapWaitSecondsUntil != null){
_bitmapWaitSecondsUntil.visible = false;
};
if (_bitmapDamping != null){
_bitmapDamping.visible = false;
};
_textFieldDampTimer.visible = false;
redrawSlotBar(false);
_local1 = ((s_selectedLevelPack * 5) + m_currId);
if ((sm_levelBest[_local1] ^ sm_levelBestMask[_local1]) > 0){
sm_levelUnlocked[_local1] = 2;
};
trace(((("value1 = " + (sm_levelBest[_local1] ^ sm_levelBestMask[_local1])) + " value2 = ") + sm_levelUnlocked[_local1]));
_bitmapAllDone = new Bitmap(new _classPerfectBalance().bitmapData);
_bitmapAllDone.smoothing = true;
_bitmapAllDone.x = (300 - (_bitmapAllDone.width * 0.5));
_bitmapAllDone.y = (50 - (_bitmapAllDone.height * 0.5));
_bitmapAllDone.scaleX = 0.6;
_bitmapAllDone.scaleY = 0.6;
_bitmapAllDone.alpha = 0;
addChild(_bitmapAllDone);
_bitmapMenuButton = new Bitmap(new _classMenuButton().bitmapData);
_bitmapMenuButton.smoothing = true;
_bitmapMenuButton.y = (115 - (_bitmapMenuButton.height * 0.5));
_bitmapMenuButton.alpha = 0;
addChild(_bitmapMenuButton);
_bitmapResetButton = new Bitmap(new _classResetButton().bitmapData);
_bitmapResetButton.smoothing = true;
_bitmapResetButton.y = (115 - (_bitmapResetButton.height * 0.5));
_bitmapResetButton.alpha = 0;
addChild(_bitmapResetButton);
if ((((m_currId < 4)) && ((sm_levelUnlocked[((s_selectedLevelPack * 5) + m_currId)] > 1)))){
_bitmapNextButton = new Bitmap(new _classNextButton().bitmapData);
_bitmapNextButton.smoothing = true;
_bitmapNextButton.y = (115 - (_bitmapNextButton.height * 0.5));
_bitmapNextButton.alpha = 0;
addChild(_bitmapNextButton);
_bitmapMenuButton.x = ((300 - 50) - (_bitmapMenuButton.width * 0.5));
_bitmapResetButton.x = (300 - (_bitmapResetButton.width * 0.5));
_bitmapNextButton.x = ((300 + 50) - (_bitmapNextButton.width * 0.5));
} else {
_bitmapMenuButton.x = ((300 - 40) - (_bitmapMenuButton.width * 0.5));
_bitmapResetButton.x = ((300 + 40) - (_bitmapResetButton.width * 0.5));
};
_playOn = false;
if (isThisLevelPackCompleted(s_selectedLevelPack)){
_bitmapLevelPackLoot = new Bitmap(new _classLevelPackLoot().bitmapData);
_bitmapLevelPackLoot.smoothing = true;
_bitmapLevelPackLoot.x = (300 - (_bitmapAllDone.width * 0.5));
_bitmapLevelPackLoot.y = ((SCREEN_DY - 25) - (_bitmapAllDone.height * 0.5));
_bitmapLevelPackLoot.scaleX = 0.6;
_bitmapLevelPackLoot.scaleY = 0.6;
_bitmapLevelPackLoot.alpha = 0;
addChild(_bitmapLevelPackLoot);
};
keepMenuBarTopmost();
if (_audio){
_local8 = new SoundTransform(0.4);
if (m_currTest._perfectStrikeAdded > 0){
_audioBank._soundPerfectStrike.play(0, 1, _local8);
} else {
_audioBank._soundOkHarmony.play(0, 1, _local8);
};
};
};
if (_bitmapAllDone != null){
_bitmapAllDone.alpha = (_bitmapAllDone.alpha + 0.1);
if (_bitmapAllDone.alpha >= 0.9999){
_bitmapAllDone.alpha = 1;
addResultDiamonds();
};
_bitmapAllDone.scaleX = (_bitmapAllDone.scaleX + 0.04);
if (_bitmapAllDone.scaleX > 1){
_bitmapAllDone.scaleX = 1;
};
_bitmapAllDone.scaleY = _bitmapAllDone.scaleX;
_bitmapAllDone.x = (300 - (_bitmapAllDone.width * 0.5));
_bitmapAllDone.y = (50 - (_bitmapAllDone.height * 0.5));
_bitmapMenuButton.alpha = (_bitmapMenuButton.alpha + 0.1);
if (_bitmapMenuButton.alpha > 1){
_bitmapMenuButton.alpha = 1;
};
_bitmapResetButton.alpha = _bitmapMenuButton.alpha;
if (_bitmapNextButton != null){
_bitmapNextButton.alpha = _bitmapMenuButton.alpha;
};
};
if (_bitmapLevelPackLoot != null){
_bitmapLevelPackLoot.alpha = (_bitmapLevelPackLoot.alpha + 0.1);
if (_bitmapLevelPackLoot.alpha >= 0.9999){
_bitmapLevelPackLoot.alpha = 1;
addLootDiamonds();
};
_bitmapLevelPackLoot.scaleX = (_bitmapLevelPackLoot.scaleX + 0.04);
if (_bitmapLevelPackLoot.scaleX > 1){
_bitmapLevelPackLoot.scaleX = 1;
};
_bitmapLevelPackLoot.scaleY = _bitmapLevelPackLoot.scaleX;
_bitmapLevelPackLoot.x = (300 - (_bitmapLevelPackLoot.width * 0.5));
_bitmapLevelPackLoot.y = ((SCREEN_DY - 25) - (_bitmapLevelPackLoot.height * 0.5));
};
if (_bitmapPerfectStrike1 != null){
runPerfectStrike(_bitmapPerfectStrike1);
};
if (_bitmapPerfectStrike2 != null){
runPerfectStrike(_bitmapPerfectStrike2);
};
if (_bitmapPerfectStrike3 != null){
runPerfectStrike(_bitmapPerfectStrike3);
};
if (_bitmapPerfectStrike1 != null){
if (_bitmapPerfectStrike1.scaleX < 1.01){
m_currTest._perfectStrikeTimer++;
if (m_currTest._perfectStrikeTimer > 200){
removeChild(_bitmapPerfectStrike1);
_bitmapPerfectStrike1 = null;
if (_bitmapPerfectStrike2 != null){
removeChild(_bitmapPerfectStrike2);
_bitmapPerfectStrike2 = null;
};
if (_bitmapPerfectStrike3 != null){
removeChild(_bitmapPerfectStrike3);
_bitmapPerfectStrike3 = null;
};
};
};
};
if (_bitmapNextLevelIsOpen != null){
_bitmapNextLevelIsOpen.alpha = (_bitmapNextLevelIsOpen.alpha + 0.1);
if (_bitmapNextLevelIsOpen.alpha > 1){
_bitmapNextLevelIsOpen.alpha = 1;
};
if (_bitmapNextLevelIsOpen.alpha > 0.999){
m_currTest._nextLevelIsOpenTimer++;
if (m_currTest._nextLevelIsOpenTimer > 300){
removeChild(_bitmapNextLevelIsOpen);
_bitmapNextLevelIsOpen = null;
m_currTest._nextLevelIsOpenTimer;
};
};
};
if (_bitmapANewLevelPackIsOpen != null){
_bitmapANewLevelPackIsOpen.alpha = (_bitmapANewLevelPackIsOpen.alpha + 0.1);
if (_bitmapANewLevelPackIsOpen.alpha > 1){
_bitmapANewLevelPackIsOpen.alpha = 1;
};
if (_bitmapANewLevelPackIsOpen.alpha > 0.999){
m_currTest._aNewLevelPackIsOpenTimer++;
if (m_currTest._aNewLevelPackIsOpenTimer > 300){
removeChild(_bitmapANewLevelPackIsOpen);
_bitmapANewLevelPackIsOpen = null;
m_currTest._aNewLevelPackIsOpenTimer = 0;
};
};
};
_local1 = ((s_selectedLevelPack * 5) + m_currId);
_local2 = (m_currTest._diamonds ^ m_currTest._diamondsMask);
if ((sm_levelBest[_local1] ^ sm_levelBestMask[_local1]) < _local2){
sm_levelBest[_local1] = m_currTest._diamonds;
sm_levelBestMask[_local1] = m_currTest._diamondsMask;
evaluateAchievementsInGame();
};
_local3 = (m_currTest._pointBlocksMax - m_currTest._pointBlocks);
if (sm_levelBestBalls[_local1] < _local3){
sm_levelBestBalls[_local1] = _local3;
};
_local4 = CalculateTotalDiamonds();
if ((((m_currId < 4)) && (!((m_currTest == null))))){
if (sm_levelUnlocked[(_local1 + 1)] == 0){
if (_local2 > 0){
sm_levelUnlocked[(_local1 + 1)] = 1;
redrawInGameMenuBar();
if (s_selectedLevelPack == 0){
_bitmapNextLevelIsOpen = new Bitmap(new _classNextLevelIsOpen().bitmapData);
} else {
_bitmapNextLevelIsOpen = new Bitmap(new _classNextLevelIsOpenSmall().bitmapData);
};
_bitmapNextLevelIsOpen.smoothing = true;
_bitmapNextLevelIsOpen.x = ((SCREEN_DX * 0.5) - (_bitmapNextLevelIsOpen.width * 0.5));
_bitmapNextLevelIsOpen.y = (420 - 100);
if (s_selectedLevelPack != 0){
_bitmapNextLevelIsOpen.y = (_bitmapNextLevelIsOpen.y + 15);
};
_bitmapNextLevelIsOpen.alpha = 0;
_bitmapNextLevelIsOpen.smoothing = true;
addChild(_bitmapNextLevelIsOpen);
evaluateAchievementsInGame();
keepMenuBarTopmost();
};
};
};
_local5 = 0;
while (_local5 < LEVEL_PACKS_MAX) {
if ((((_local4 >= LEVEL_PACK_DIAMOND_LIMITS[_local5])) && ((sm_levelPackUnlocked[_local5] == 0)))){
unlockLevelPack(_local5);
evaluateAchievementsInGame();
keepMenuBarTopmost();
};
_local5++;
};
if (Input.isKeyPressed("R".charCodeAt(0))){
resetPressed();
};
if (!Input.mouseClicked){
return;
};
_local6 = s_mouseX;
_local7 = s_mouseY;
if (isPointInsideBitmap(_bitmapMenuButton, _local6, _local7)){
buttonPressed();
returnToLevelSelectionFromGame();
} else {
if (isPointInsideBitmap(_bitmapResetButton, _local6, _local7)){
buttonPressed();
resetPressed();
} else {
if (isPointInsideBitmap(_bitmapNextButton, _local6, _local7)){
m_currId++;
buttonPressed();
resetPressed();
} else {
if (isPointInsideBitmap(_bitmapWalkthroughButton, _local6, _local7)){
buttonPressed();
navigateToURL(new URLRequest("http://www.freegamesnews.com/en/video/2010/ImperfectBalanceVideo1-2.php"), "_blank");
};
};
};
};
}
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 function mainLoop():void{
var _local1:Boolean;
var _local2:int;
var _local3:int;
var _local4:Bitmap;
var _local5:int;
removeChild(_bitmapParticleLayer);
m_sprite.graphics.clear();
if (_bitmapTitleScreenBackground != null){
runTitleScreen();
} else {
if (_bitmapTheEndScreen != null){
runTheEndScreen();
} else {
if (_bitmapInstructionsScreen != null){
runInstructionsScreen();
} else {
if (_bitmapCreditsScreen != null){
runCreditsScreen();
} else {
if (_bitmapAchievementsScreen != null){
runAchievementsScreen();
} else {
if (_bitmapLevelSelectionScreen != null){
runLevelSelectionScreen();
} else {
runGameScreen();
if (!areWeInMenu()){
runHelpTexts();
};
};
};
};
};
};
};
runAchievements();
if (Input.isKeyPressed("M".charCodeAt(0))){
_audio = !(_audio);
if (_audio){
changeBGM();
} else {
_bgm = -1;
SoundMixer.stopAll();
};
SettingsSave();
};
if (Input.isKeyPressed("R".charCodeAt(0))){
resetPressed();
};
if (m_currTest == null){
recreateLevel();
};
if (_firstRun){
_firstRun = false;
m_currTest.Update(true, true, sm_fps);
m_oldTime = getTimer();
};
_local1 = !(areWeInMenu());
m_currTest.Update(_local1, !((_bitmapTheEndScreen == null)));
runPlus1s();
if (sm_redrawSlotBar){
sm_redrawSlotBar = false;
redrawSlotBar(false);
if (m_currTest._bestRedraw){
m_currTest._bestRedraw = false;
redrawSlotBar(true);
};
};
if ((((m_currTest._perfectStrikeAdded >= 1)) && ((m_currTest._perfectStrikeAdded <= 3)))){
if (m_currTest._perfectStrikeSkipper > 0){
m_currTest._perfectStrikeSkipper--;
} else {
m_currTest._perfectStrikeSkipper = 2;
_local4 = new Bitmap(new _classPerfectStrike().bitmapData);
_local4.smoothing = true;
_local4.scaleX = 3;
_local4.scaleY = 3;
_local4.alpha = 0;
_local4.x = (300 - (_local4.width * 0.5));
_local4.y = (250 - (_local4.height * 0.5));
addChild(_local4);
if (_bitmapPerfectStrike1 == null){
_bitmapPerfectStrike1 = _local4;
} else {
if (_bitmapPerfectStrike2 == null){
_bitmapPerfectStrike2 = _local4;
} else {
if (_bitmapPerfectStrike3 == null){
_bitmapPerfectStrike3 = _local4;
} else {
removeChild(_local4);
};
};
};
m_currTest._perfectStrikeAdded++;
};
};
_local2 = getTimer();
_local3 = (_local2 - m_oldTime);
m_oldTime = _local2;
if (((_local1) && ((_bitmapTheEndScreen == null)))){
if (((m_currTest._waiting) && ((_bitmapMenuButton == null)))){
m_currTest._dampTimerLeft = (m_currTest._dampTimerLeft - _local3);
_local5 = int((m_currTest._dampTimerLeft / 1000));
if ((((_local5 <= 0)) && (!(m_currTest._damping)))){
_local5 = 0;
m_currTest._damping = true;
if (_bitmapWaitSecondsUntil != null){
_bitmapWaitSecondsUntil.visible = false;
};
_textFieldDampTimer.visible = false;
_bitmapDamping = new Bitmap(new _classDamping().bitmapData);
_bitmapDamping.smoothing = true;
_bitmapDamping.x = (300 - (_bitmapDamping.width * 0.5));
_bitmapDamping.y = 40;
addChild(_bitmapDamping);
} else {
_textFieldDampTimer.text = (_local5 + "");
};
};
if (_bitmapMenuIndicator == null){
_bitmapMenuIndicator = new Bitmap(new _classMenuIndicator().bitmapData);
_bitmapMenuIndicator.smoothing = true;
_bitmapMenuIndicator.alpha = 0;
_bitmapMenuIndicator.x = 530;
_bitmapMenuIndicator.y = ((SCREEN_DY - _bitmapMenuIndicator.height) - 2);
addChild(_bitmapMenuIndicator);
keepMenuBarTopmost();
} else {
_bitmapMenuIndicator.alpha = (_bitmapMenuIndicator.alpha + 0.1);
if (_bitmapMenuIndicator.alpha > 1){
_bitmapMenuIndicator.alpha = 1;
};
};
if ((((((_bitmapHelpText == null)) && (!(m_currTest._running)))) && ((_bitmapChooseAShape == null)))){
m_currTest._chooseAShapeTimer++;
if (m_currTest._chooseAShapeTimer > 10){
_bitmapChooseAShape = addHelpBitmap(new _classChooseAShape().bitmapData, (SCREEN_DX * 0.5), 130);
_bitmapChooseAShape.alpha = 0;
};
};
if (_bitmapChooseAShape != null){
if (!m_currTest._running){
_bitmapChooseAShape.alpha = (_bitmapChooseAShape.alpha + 0.1);
if (_bitmapChooseAShape.alpha > 1){
_bitmapChooseAShape.alpha = 1;
};
} else {
_bitmapChooseAShape.alpha = (_bitmapChooseAShape.alpha - 0.1);
if (_bitmapChooseAShape.alpha <= 0){
removeChild(_bitmapChooseAShape);
_bitmapChooseAShape = null;
if ((((s_selectedLevelPack < 1)) && (!(m_currTest._makeAsManyShown)))){
m_currTest._makeAsManyShown = true;
_bitmapMakeAsMany = addHelpBitmap(new _classMakeAsMany().bitmapData, (SCREEN_DX * 0.5), 130);
_bitmapMakeAsMany.alpha = 0;
};
};
};
};
if (_bitmapMakeAsMany != null){
m_currTest._makeAsManyTimer++;
if (m_currTest._makeAsManyTimer < 200){
_bitmapMakeAsMany.alpha = (_bitmapMakeAsMany.alpha + 0.1);
if (_bitmapMakeAsMany.alpha > 1){
_bitmapMakeAsMany.alpha = 1;
};
} else {
_bitmapMakeAsMany.alpha = (_bitmapMakeAsMany.alpha - 0.1);
if (_bitmapMakeAsMany.alpha <= 0){
removeChild(_bitmapMakeAsMany);
_bitmapMakeAsMany = null;
};
};
};
};
if (_local1){
m_particleManager.liveParticles(m_sprite.y, _bitmapParticleLayer);
} else {
m_particleManager.liveParticles(0, _bitmapParticleLayer);
};
addChild(_bitmapParticleLayer);
if (_bitmapLevelPackNew != null){
removeChild(_bitmapLevelPackNew);
addChild(_bitmapLevelPackNew);
};
if (_bitmapLevelPackScoreboard != null){
removeChild(_bitmapLevelPackScoreboard);
addChild(_bitmapLevelPackScoreboard);
};
if (_bitmapAchievement != null){
removeChild(_bitmapAchievement);
addChild(_bitmapAchievement);
};
Input.update();
playSFX();
m_fpsCounter.update();
FRateLimiter.limitFrame(sm_fps);
Input.mouseClicked = false;
s_mouseClicked = false;
}
public static function cloneArray(_arg1:Array):Array{
var _local2:int;
var _local3:Array;
var _local4:int;
_local2 = _arg1.length;
_local3 = new Array(_local2);
_local4 = 0;
while (_local4 < _local2) {
_local3[_local4] = _arg1[_local4];
_local4++;
};
return (_local3);
}
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);
}
}
}//package
Section 209
//Main__classAchievement10Levels (Main__classAchievement10Levels)
package {
import mx.core.*;
public class Main__classAchievement10Levels extends BitmapAsset {
}
}//package
Section 210
//Main__classAchievement10Levels2 (Main__classAchievement10Levels2)
package {
import mx.core.*;
public class Main__classAchievement10Levels2 extends BitmapAsset {
}
}//package
Section 211
//Main__classAchievement10Levels3 (Main__classAchievement10Levels3)
package {
import mx.core.*;
public class Main__classAchievement10Levels3 extends BitmapAsset {
}
}//package
Section 212
//Main__classAchievement111Diamonds (Main__classAchievement111Diamonds)
package {
import mx.core.*;
public class Main__classAchievement111Diamonds extends BitmapAsset {
}
}//package
Section 213
//Main__classAchievement20Levels3 (Main__classAchievement20Levels3)
package {
import mx.core.*;
public class Main__classAchievement20Levels3 extends BitmapAsset {
}
}//package
Section 214
//Main__classAchievement45Levels (Main__classAchievement45Levels)
package {
import mx.core.*;
public class Main__classAchievement45Levels extends BitmapAsset {
}
}//package
Section 215
//Main__classAchievement45Levels2 (Main__classAchievement45Levels2)
package {
import mx.core.*;
public class Main__classAchievement45Levels2 extends BitmapAsset {
}
}//package
Section 216
//Main__classAchievement60Levels (Main__classAchievement60Levels)
package {
import mx.core.*;
public class Main__classAchievement60Levels extends BitmapAsset {
}
}//package
Section 217
//Main__classAchievement60Levels2 (Main__classAchievement60Levels2)
package {
import mx.core.*;
public class Main__classAchievement60Levels2 extends BitmapAsset {
}
}//package
Section 218
//Main__classAchievementAllLevelPacks (Main__classAchievementAllLevelPacks)
package {
import mx.core.*;
public class Main__classAchievementAllLevelPacks extends BitmapAsset {
}
}//package
Section 219
//Main__classAchievementsScreen (Main__classAchievementsScreen)
package {
import mx.core.*;
public class Main__classAchievementsScreen extends BitmapAsset {
}
}//package
Section 220
//Main__classANewLevelPackIsOpen (Main__classANewLevelPackIsOpen)
package {
import mx.core.*;
public class Main__classANewLevelPackIsOpen extends BitmapAsset {
}
}//package
Section 221
//Main__classAudioOff (Main__classAudioOff)
package {
import mx.core.*;
public class Main__classAudioOff extends BitmapAsset {
}
}//package
Section 222
//Main__classAudioOn (Main__classAudioOn)
package {
import mx.core.*;
public class Main__classAudioOn extends BitmapAsset {
}
}//package
Section 223
//Main__classBackgroundFlash1 (Main__classBackgroundFlash1)
package {
import mx.core.*;
public class Main__classBackgroundFlash1 extends BitmapAsset {
}
}//package
Section 224
//Main__classBackgroundFlash2 (Main__classBackgroundFlash2)
package {
import mx.core.*;
public class Main__classBackgroundFlash2 extends BitmapAsset {
}
}//package
Section 225
//Main__classBackgroundFlash3 (Main__classBackgroundFlash3)
package {
import mx.core.*;
public class Main__classBackgroundFlash3 extends BitmapAsset {
}
}//package
Section 226
//Main__classBackgroundFlash4 (Main__classBackgroundFlash4)
package {
import mx.core.*;
public class Main__classBackgroundFlash4 extends BitmapAsset {
}
}//package
Section 227
//Main__classChooseAShape (Main__classChooseAShape)
package {
import mx.core.*;
public class Main__classChooseAShape extends BitmapAsset {
}
}//package
Section 228
//Main__classCreditsScreen (Main__classCreditsScreen)
package {
import mx.core.*;
public class Main__classCreditsScreen extends BitmapAsset {
}
}//package
Section 229
//Main__classDamping (Main__classDamping)
package {
import mx.core.*;
public class Main__classDamping extends BitmapAsset {
}
}//package
Section 230
//Main__classHelp1 (Main__classHelp1)
package {
import mx.core.*;
public class Main__classHelp1 extends BitmapAsset {
}
}//package
Section 231
//Main__classHelp2 (Main__classHelp2)
package {
import mx.core.*;
public class Main__classHelp2 extends BitmapAsset {
}
}//package
Section 232
//Main__classHelp3A (Main__classHelp3A)
package {
import mx.core.*;
public class Main__classHelp3A extends BitmapAsset {
}
}//package
Section 233
//Main__classHelp3B (Main__classHelp3B)
package {
import mx.core.*;
public class Main__classHelp3B extends BitmapAsset {
}
}//package
Section 234
//Main__classHelp4 (Main__classHelp4)
package {
import mx.core.*;
public class Main__classHelp4 extends BitmapAsset {
}
}//package
Section 235
//Main__classHelp5 (Main__classHelp5)
package {
import mx.core.*;
public class Main__classHelp5 extends BitmapAsset {
}
}//package
Section 236
//Main__classHelp6 (Main__classHelp6)
package {
import mx.core.*;
public class Main__classHelp6 extends BitmapAsset {
}
}//package
Section 237
//Main__classHelp7 (Main__classHelp7)
package {
import mx.core.*;
public class Main__classHelp7 extends BitmapAsset {
}
}//package
Section 238
//Main__classHelpDirectedGravity (Main__classHelpDirectedGravity)
package {
import mx.core.*;
public class Main__classHelpDirectedGravity extends BitmapAsset {
}
}//package
Section 239
//Main__classHelpGlass (Main__classHelpGlass)
package {
import mx.core.*;
public class Main__classHelpGlass extends BitmapAsset {
}
}//package
Section 240
//Main__classHelpHeavy (Main__classHelpHeavy)
package {
import mx.core.*;
public class Main__classHelpHeavy extends BitmapAsset {
}
}//package
Section 241
//Main__classHelpHelium (Main__classHelpHelium)
package {
import mx.core.*;
public class Main__classHelpHelium extends BitmapAsset {
}
}//package
Section 242
//Main__classInstructionsScreen (Main__classInstructionsScreen)
package {
import mx.core.*;
public class Main__classInstructionsScreen extends BitmapAsset {
}
}//package
Section 243
//Main__classLevelPackLoot (Main__classLevelPackLoot)
package {
import mx.core.*;
public class Main__classLevelPackLoot extends BitmapAsset {
}
}//package
Section 244
//Main__classLevelPackNew (Main__classLevelPackNew)
package {
import mx.core.*;
public class Main__classLevelPackNew extends BitmapAsset {
}
}//package
Section 245
//Main__classLevelPackScoreboard (Main__classLevelPackScoreboard)
package {
import mx.core.*;
public class Main__classLevelPackScoreboard extends BitmapAsset {
}
}//package
Section 246
//Main__classLevelPackSelectionCogWheel (Main__classLevelPackSelectionCogWheel)
package {
import mx.core.*;
public class Main__classLevelPackSelectionCogWheel extends BitmapAsset {
}
}//package
Section 247
//Main__classLevelPackSelectionLockedDiamond (Main__classLevelPackSelectionLockedDiamond)
package {
import mx.core.*;
public class Main__classLevelPackSelectionLockedDiamond extends BitmapAsset {
}
}//package
Section 248
//Main__classLevelPackSelectionLockedIcon (Main__classLevelPackSelectionLockedIcon)
package {
import mx.core.*;
public class Main__classLevelPackSelectionLockedIcon extends BitmapAsset {
}
}//package
Section 249
//Main__classLevelPackSelectionLockedQuestionMark (Main__classLevelPackSelectionLockedQuestionMark)
package {
import mx.core.*;
public class Main__classLevelPackSelectionLockedQuestionMark extends BitmapAsset {
}
}//package
Section 250
//Main__classLevelSelectionScreen (Main__classLevelSelectionScreen)
package {
import mx.core.*;
public class Main__classLevelSelectionScreen extends BitmapAsset {
}
}//package
Section 251
//Main__classMakeAsMany (Main__classMakeAsMany)
package {
import mx.core.*;
public class Main__classMakeAsMany extends BitmapAsset {
}
}//package
Section 252
//Main__classMenuBarCogWheel (Main__classMenuBarCogWheel)
package {
import mx.core.*;
public class Main__classMenuBarCogWheel extends BitmapAsset {
}
}//package
Section 253
//Main__classMenuBarLockedIcon (Main__classMenuBarLockedIcon)
package {
import mx.core.*;
public class Main__classMenuBarLockedIcon extends BitmapAsset {
}
}//package
Section 254
//Main__classMenuBarSource (Main__classMenuBarSource)
package {
import mx.core.*;
public class Main__classMenuBarSource extends BitmapAsset {
}
}//package
Section 255
//Main__classMenuButton (Main__classMenuButton)
package {
import mx.core.*;
public class Main__classMenuButton extends BitmapAsset {
}
}//package
Section 256
//Main__classMenuIndicator (Main__classMenuIndicator)
package {
import mx.core.*;
public class Main__classMenuIndicator extends BitmapAsset {
}
}//package
Section 257
//Main__classNextButton (Main__classNextButton)
package {
import mx.core.*;
public class Main__classNextButton extends BitmapAsset {
}
}//package
Section 258
//Main__classNextLevelIsOpen (Main__classNextLevelIsOpen)
package {
import mx.core.*;
public class Main__classNextLevelIsOpen extends BitmapAsset {
}
}//package
Section 259
//Main__classNextLevelIsOpenSmall (Main__classNextLevelIsOpenSmall)
package {
import mx.core.*;
public class Main__classNextLevelIsOpenSmall extends BitmapAsset {
}
}//package
Section 260
//Main__classPerfectBalance (Main__classPerfectBalance)
package {
import mx.core.*;
public class Main__classPerfectBalance extends BitmapAsset {
}
}//package
Section 261
//Main__classPerfectStrike (Main__classPerfectStrike)
package {
import mx.core.*;
public class Main__classPerfectStrike extends BitmapAsset {
}
}//package
Section 262
//Main__classQualityBest (Main__classQualityBest)
package {
import mx.core.*;
public class Main__classQualityBest extends BitmapAsset {
}
}//package
Section 263
//Main__classQualityHigh (Main__classQualityHigh)
package {
import mx.core.*;
public class Main__classQualityHigh extends BitmapAsset {
}
}//package
Section 264
//Main__classQualityLow (Main__classQualityLow)
package {
import mx.core.*;
public class Main__classQualityLow extends BitmapAsset {
}
}//package
Section 265
//Main__classQualityMedium (Main__classQualityMedium)
package {
import mx.core.*;
public class Main__classQualityMedium extends BitmapAsset {
}
}//package
Section 266
//Main__classResetButton (Main__classResetButton)
package {
import mx.core.*;
public class Main__classResetButton extends BitmapAsset {
}
}//package
Section 267
//Main__classSealBack (Main__classSealBack)
package {
import mx.core.*;
public class Main__classSealBack extends BitmapAsset {
}
}//package
Section 268
//Main__classSealFront (Main__classSealFront)
package {
import mx.core.*;
public class Main__classSealFront extends BitmapAsset {
}
}//package
Section 269
//Main__classShowBestNo (Main__classShowBestNo)
package {
import mx.core.*;
public class Main__classShowBestNo extends BitmapAsset {
}
}//package
Section 270
//Main__classShowBestYes (Main__classShowBestYes)
package {
import mx.core.*;
public class Main__classShowBestYes extends BitmapAsset {
}
}//package
Section 271
//Main__classSlotBarBest (Main__classSlotBarBest)
package {
import mx.core.*;
public class Main__classSlotBarBest extends BitmapAsset {
}
}//package
Section 272
//Main__classSlotBarScore (Main__classSlotBarScore)
package {
import mx.core.*;
public class Main__classSlotBarScore extends BitmapAsset {
}
}//package
Section 273
//Main__classSlotBlack (Main__classSlotBlack)
package {
import mx.core.*;
public class Main__classSlotBlack extends BitmapAsset {
}
}//package
Section 274
//Main__classSlotBright (Main__classSlotBright)
package {
import mx.core.*;
public class Main__classSlotBright extends BitmapAsset {
}
}//package
Section 275
//Main__classSlotDiamondBright (Main__classSlotDiamondBright)
package {
import mx.core.*;
public class Main__classSlotDiamondBright extends BitmapAsset {
}
}//package
Section 276
//Main__classSlotDiamondGray (Main__classSlotDiamondGray)
package {
import mx.core.*;
public class Main__classSlotDiamondGray extends BitmapAsset {
}
}//package
Section 277
//Main__classSlotMinus (Main__classSlotMinus)
package {
import mx.core.*;
public class Main__classSlotMinus extends BitmapAsset {
}
}//package
Section 278
//Main__classTaunt1 (Main__classTaunt1)
package {
import mx.core.*;
public class Main__classTaunt1 extends BitmapAsset {
}
}//package
Section 279
//Main__classTaunt2 (Main__classTaunt2)
package {
import mx.core.*;
public class Main__classTaunt2 extends BitmapAsset {
}
}//package
Section 280
//Main__classTaunt3 (Main__classTaunt3)
package {
import mx.core.*;
public class Main__classTaunt3 extends BitmapAsset {
}
}//package
Section 281
//Main__classTaunt4 (Main__classTaunt4)
package {
import mx.core.*;
public class Main__classTaunt4 extends BitmapAsset {
}
}//package
Section 282
//Main__classTaunt5 (Main__classTaunt5)
package {
import mx.core.*;
public class Main__classTaunt5 extends BitmapAsset {
}
}//package
Section 283
//Main__classTheEndCongratulations (Main__classTheEndCongratulations)
package {
import mx.core.*;
public class Main__classTheEndCongratulations extends BitmapAsset {
}
}//package
Section 284
//Main__classTheEndScreen (Main__classTheEndScreen)
package {
import mx.core.*;
public class Main__classTheEndScreen extends BitmapAsset {
}
}//package
Section 285
//Main__classTitleScreenBackground (Main__classTitleScreenBackground)
package {
import mx.core.*;
public class Main__classTitleScreenBackground extends BitmapAsset {
}
}//package
Section 286
//Main__classTitleScreenForeground (Main__classTitleScreenForeground)
package {
import mx.core.*;
public class Main__classTitleScreenForeground extends BitmapAsset {
}
}//package
Section 287
//Main__classTitleScreenPlanet (Main__classTitleScreenPlanet)
package {
import mx.core.*;
public class Main__classTitleScreenPlanet extends BitmapAsset {
}
}//package
Section 288
//Main__classWait (Main__classWait)
package {
import mx.core.*;
public class Main__classWait extends BitmapAsset {
}
}//package
Section 289
//Main__classWaitSecondsUntil (Main__classWaitSecondsUntil)
package {
import mx.core.*;
public class Main__classWaitSecondsUntil extends BitmapAsset {
}
}//package
Section 290
//Main__classWalkthroughButton (Main__classWalkthroughButton)
package {
import mx.core.*;
public class Main__classWalkthroughButton extends BitmapAsset {
}
}//package
Section 291
//Main__classYesNo (Main__classYesNo)
package {
import mx.core.*;
public class Main__classYesNo extends BitmapAsset {
}
}//package
Section 292
//Main__fontClass1 (Main__fontClass1)
package {
import mx.core.*;
public class Main__fontClass1 extends FontAsset {
}
}//package
Section 293
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 294
//MyPreloader (MyPreloader)
package {
import flash.events.*;
import flash.display.*;
import mochi.as3.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.ui.*;
import flash.media.*;
import flash.system.*;
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 _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 _sI:String;// = "i"
private var _loadingBar:Sprite;// = null
private var _sK:String;// = "k"
private var _sL:String;// = "l"
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 _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 _sS:String;// = "s"
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 _allDone:Boolean;// = false
private var _bitmapAndkon200x200:Bitmap;// = null
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 _maxGames:Boolean = false;
public static const _freeGamesNews:Boolean = true;
public static const _walkthroughButton:Boolean = true;
public static const _gamesChart:Boolean = true;
public static const _mochi:Boolean = false;
public static const _flashGameLicense:Boolean = false;
public static const SCREEN_DX:int = 600;
public static const SCREEN_DY:int = 500;
public static const _cpmStar:Boolean = true;
public static const _connectingSingles:Boolean = false;
public static const FOG_GAME_NAME:String = "ImperfectBalance";
private static const _debug:Boolean = false;
public static const ORIGINAL_FPS:int = 60;
public static const _freeOnlineGames:Boolean = false;
public static const _gpsStudios:Boolean = false;
public static var _fontClass1:Class = MyPreloader__fontClass1;
private static var _error:Boolean = false;
public static var _andkon:Boolean = false;
public static var gameID:int = 360;
public static var _loaded:Boolean = false;
private static var _passThrough:Boolean = false;
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 _classLoadingScreen:Class = MyPreloader__classLoadingScreen;
public static var _classSponsorMovie:Class;
public static var _mochiads_game_id:String = "8855f5102a8d3a37";
public static var _classFGNLogo:Class = MyPreloader__classFGNLogo;
public static var _classLoadingScreenStartButton:Class = MyPreloader__classLoadingScreenStartButton;
public static var _outlineFilter:GlowFilter = new GlowFilter(0, 1, 3, 3, 1000, 1);
public static var m_particleManager:ParticleManager = new ParticleManager();
public static var _bitmapFGNLogo:Bitmap = null;
public static var MindJoltAPI:Object = null;
public function MyPreloader(){
_bitmapLoadingScreen = null;
_black = null;
_black2 = null;
_backgroundSprite = null;
_loadingBar = null;
_bitmapAndkon400x400 = null;
_bitmapAndkon200x200 = null;
_bitmapConnectingSinglesLogo = null;
_bitmapLoadingScreenStartButton = null;
_spriteLoadingScreenStartButton = null;
_spriteMouseClick = null;
_adBox = null;
_sponsorMovieClip = 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:Particle;
var _local6:String;
var _local7:Number;
var _local8:Number;
var _local9:String;
var _local10:Number;
var _local11:Number;
var _local12:int;
var _local13:Number;
var _local14:Sprite;
var _local15:int;
var _local16:int;
var _local17:int;
if (!_initDone){
_initDone = true;
initialize();
};
if (_bitmapParticleLayer != null){
_local3 = ((122 - 3) + (Math.random() * (356 + 6)));
_local4 = (20 + (Math.random() * 57));
_local5 = m_particleManager.addParticle(Particle.PARTICLE_TYPE_TWINKLE, _local3, _local4, 4294967295);
if (_local5 != null){
_local5._life = (_local5._life + (Math.random() * 40));
};
m_particleManager.liveParticles(0, _bitmapParticleLayer);
};
_local2 = (30 * 15);
_canPass0Timer++;
if (_canPass0Timer > _local2){
_canPass0 = true;
};
if (((((((_maxGames) || (_flashGameLicense))) || (_debug))) || (_kongregate))){
_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;
};
};
_local6 = stage.loaderInfo.url;
_local7 = (_local6.indexOf("://") + 3);
_local8 = _local6.indexOf("/", _local7);
_local9 = _local6.substring(_local7, _local8);
_local10 = (_local9.lastIndexOf(".") - 1);
_local11 = (_local9.lastIndexOf(".", _local10) + 1);
_local9 = _local9.substring(_local11, _local9.length);
if (((_kongregate) || (!((_kongregateAPI == null))))){
if (_local9 != (((((((((((((_sK + _sO) + _sN) + _sG) + _sR) + _sE) + _sG) + _sA) + _sT) + _sE) + _sDot) + _sC) + _sO) + _sM)){
_phase = -1;
};
};
if (_connectingSingles){
if (_local9 != ((((((((((((((((((((_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 (_local9 != (((((((((((_sM + _sA) + _sX) + _sG) + _sA) + _sM) + _sE) + _sS) + _sDot) + _sC) + _sO) + _sM)){
_phase = -1;
};
};
if (_flashGameLicense){
if (_local9 != (((((((((((((((((((_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)))){
};
};
} 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 (_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 (_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);
};
};
};
_phase = 3;
} else {
if (_phase == 3){
if (_bitmapAndkon400x400 != null){
_bitmapAndkon400x400.alpha = (_bitmapAndkon400x400.alpha + 0.05);
if (_bitmapAndkon400x400.alpha > 1){
_bitmapAndkon400x400.alpha = 1;
};
};
_frames++;
_local12 = 0;
if (_gpsStudios){
_local12 = 218;
} else {
if (_maxGames){
_local12 = 186;
} else {
if (_bitmapAndkon400x400 != null){
_local12 = 150;
} else {
if (_freeGamesNews){
_local12 = (7 * 60);
runFGNLogo(_frames);
} else {
_phase = 4;
};
};
};
};
if (_frames == _local12){
if (_maxGames){
_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 (_local12 > 0){
_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;
};
} else {
_allDone = true;
};
} else {
if (_phase == 10){
} else {
if (_phase == -1){
};
};
};
};
};
};
};
};
if (_allDone){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
nextFrame();
if (_bitmapAndkon200x200 != null){
removeChild(_bitmapAndkon200x200);
_bitmapAndkon200x200 = null;
};
if (_bitmapAndkon400x400 != null){
removeChild(_bitmapAndkon400x400);
_bitmapAndkon400x400 = null;
};
if (_bitmapConnectingSinglesLogo != null){
removeChild(_bitmapConnectingSinglesLogo);
_bitmapConnectingSinglesLogo = null;
};
if (_textFieldPercent != null){
removeChild(_textFieldPercent);
_textFieldPercent = null;
};
init();
} else {
if (_loadingBar != null){
_local13 = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal);
_local14 = _loadingBar;
_local15 = 329;
_local16 = 70;
if (_textFieldPercent != null){
_local17 = int((_local13 * 100));
_textFieldPercent.text = (_local17 + "%");
};
_local14.graphics.clear();
_local14.graphics.beginFill(0x222222);
_local14.graphics.drawRect((_local15 - 2), (_local16 - 2), (140 + 4), (10 + 4));
_local14.graphics.endFill();
_local14.graphics.beginFill(0xDDDDDD);
_local14.graphics.drawRect(_local15, _local16, (140 * _local13), 10);
_local14.graphics.endFill();
};
};
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 initialize():void{
var oY:Number;
var b:Bitmap;
var s:Sprite;
var textFormat:TextFormat;
var text:TextField;
var newMenu:ContextMenu;
var ctm1:ContextMenuItem;
var ctm2:ContextMenuItem;
var ctm3:ContextMenuItem;
var ctm4:ContextMenuItem;
var cpmstarViewSWFUrl:String;
var cpmstarLoader:Loader;
var url:String;
stage.focus = this;
stop();
stage.scaleMode = StageScaleMode.EXACT_FIT;
stage.quality = StageQuality.HIGH;
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);
m_particleManager.initialize();
addChild(_bitmapParticleLayer);
if (_mochi){
MochiServices.connect(_mochiads_game_id, this);
MochiAd.showPreGameAd({clip:root, id:_mochiads_game_id, res:"600x500", background:1919759, color:7579235, outline:0, no_bg:false, ad_failed:ad_failed, ad_finished:ad_finished});
};
if (((!(_maxGames)) && (!(_freeOnlineGames)))){
MochiBot.track(this, "b62635ab");
};
if (((((((((_connectingSingles) || (_passThrough))) || (_maxGames))) || (_flashGameLicense))) || (_cpmStar))){
_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 (_gamesChart){
GamesChart.setup(stage, "6bd6cc2ddd6f59908f4fd18864592db8");
GamesChart.hideTab();
};
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 = 60;
text.height = 30;
text.embedFonts = true;
text.mouseEnabled = false;
text.text = "0%";
text.filters = [_outlineFilter];
text.antiAliasType = AntiAliasType.ADVANCED;
addChild(text);
_textFieldPercent = text;
}
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 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 (((((!((_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 (_bitmapAndkon200x200 != null){
_local2 = _bitmapAndkon200x200.x;
_local3 = _bitmapAndkon200x200.y;
_local4 = (_local2 + _bitmapAndkon200x200.width);
_local5 = (_local3 + _bitmapAndkon200x200.height);
if ((((((((mouseX >= _local2)) && ((mouseX <= _local4)))) && ((mouseY >= _local3)))) && ((mouseY <= _local5)))){
navigateToURL(new URLRequest("http://www.andkon.com/arcade/"));
_once = true;
};
};
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/"));
_once = true;
};
};
}
public function ad_failed():void{
_loaded = true;
_nice = true;
_canPass0 = true;
}
private function secOK(_arg1:Event):void{
_nice = true;
_loaded = true;
}
}
}//package
Section 295
//MyPreloader__classFGNLogo (MyPreloader__classFGNLogo)
package {
import mx.core.*;
public class MyPreloader__classFGNLogo extends BitmapAsset {
}
}//package
Section 296
//MyPreloader__classLoadingScreen (MyPreloader__classLoadingScreen)
package {
import mx.core.*;
public class MyPreloader__classLoadingScreen extends BitmapAsset {
}
}//package
Section 297
//MyPreloader__classLoadingScreenStartButton (MyPreloader__classLoadingScreenStartButton)
package {
import mx.core.*;
public class MyPreloader__classLoadingScreenStartButton extends BitmapAsset {
}
}//package
Section 298
//MyPreloader__fontClass1 (MyPreloader__fontClass1)
package {
import mx.core.*;
public class MyPreloader__fontClass1 extends FontAsset {
}
}//package
Section 299
//Particle (Particle)
package {
import flash.geom.*;
public class Particle {
public var _alive:Boolean;
public var _speedX:Number;
public var _speedY:Number;
public var _type:int;
public var _iD:int;
public var _x:Number;
public var _alpha:Number;// = 1
public var _size:Number;
public var _color:uint;// = 4294967295
public var _life:Number;
public var _rectangle:Rectangle;// = null
public var _y:Number;
public static const PARTICLE_TYPE_TWINKLE:int = 2;
public static const PARTICLE_LIFE_TIMES:Array = [20, 40, 20, 150];
public static const PARTICLE_TYPE_EXPLOSION:int = 1;
public static const PARTICLE_TYPE_SHOOTING_STAR:int = 3;
public static const PARTICLE_TYPE_DUST:int = 0;
public function Particle(_arg1:int){
_rectangle = null;
_alpha = 1;
_color = 4294967295;
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:Number;
var _local4:Number;
if (_life < 20){
_alpha = (_life / 20);
} else {
_alpha = 1;
};
if ((((((((_alpha < 0)) || ((_x < -2)))) || ((_y > 502)))) || ((_x > 602)))){
_alpha = 0;
_life = 0;
};
_local3 = (_x + _speedX);
_local4 = (_y + _speedY);
if (_type == PARTICLE_TYPE_DUST){
_speedY = (_speedY + 0.04);
};
_x = _local3;
_y = _local4;
_rectangle.x = (_local3 - _size);
_rectangle.y = ((_local4 + _arg1) - _size);
_color = ((_color & 0xFFFFFF) | ((_alpha * 0xFF) << 24));
}
public function resetGraphics():void{
if ((((_type == PARTICLE_TYPE_DUST)) || ((_type == PARTICLE_TYPE_SHOOTING_STAR)))){
_size = 2;
} else {
if (_type == PARTICLE_TYPE_TWINKLE){
_size = 1;
} else {
_size = 3;
};
};
_rectangle = new Rectangle(0, 0, _size, _size);
_size = (_size * 0.5);
}
public function rebirth():void{
_alive = true;
_life = PARTICLE_LIFE_TIMES[_type];
_alpha = 0.5;
}
}
}//package
Section 300
//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 + 0x0400);
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._color = _arg5;
_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;
if ((((((_arg2 < -1)) || ((_arg3 > 501)))) || ((_arg2 > 601)))){
return (null);
};
_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 301
//UserData (UserData)
package {
import flash.display.*;
public class UserData {
public var _helium:Boolean;// = false
public var _sticky:Boolean;// = false
public var _scaleFixed:Boolean;// = false
public var _damage:Number;// = 0
public var _iD:int;// = -1
public var _spriteShadow:Bitmap;// = null
public var _directedGravity:Boolean;// = false
public var _startAngle:Number;// = 0
public var _radius:Number;// = 1
public var _isTouching:Boolean;// = false
public var _hitpoints:Number;// = 0
public var _height:Number;// = 30
public var _width:Number;// = 30
public var _scale:Number;// = 1
public var _spriteNumber:int;// = 0
public var _startX:Number;// = 0
public var _startY:Number;// = 0
public var _object:Object;// = null
public var _alpha:Number;// = 1
public var _1T:Boolean;// = false
public var _color:int;// = 0
public var _shadowOffsetX:Number;// = 4
public var _shadowOffsetY:Number;// = 4
public var _sprite:Bitmap;// = null
public var _isPlayerObject:Boolean;// = true
public var _currentBlock:int;// = -1
public var _spriteX:Number;// = 0
public var _spriteY:Number;// = 0
public var _pointBlock:Boolean;// = false
public var _glass:Boolean;// = false
public function UserData(){
_iD = -1;
_sprite = null;
_color = 0;
_radius = 1;
_scale = 1;
_width = 30;
_height = 30;
_alpha = 1;
_currentBlock = -1;
_object = null;
_helium = false;
_sticky = false;
_directedGravity = false;
_glass = false;
_damage = 0;
_1T = false;
_hitpoints = 0;
_startX = 0;
_startY = 0;
_startAngle = 0;
_spriteShadow = null;
_pointBlock = false;
_shadowOffsetX = 4;
_shadowOffsetY = 4;
_isTouching = false;
_spriteX = 0;
_spriteY = 0;
_isPlayerObject = true;
_spriteNumber = 0;
_scaleFixed = false;
super();
}
}
}//package