Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2CircleDef extends b2ShapeDef {
public var radius:Number;
public var localPosition:b2Vec2;
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.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2CircleShape extends b2Shape {
public var m_localPosition:b2Vec2;
public var m_radius:Number;
public function b2CircleShape(_arg1:b2ShapeDef){
m_localPosition = new b2Vec2();
super(_arg1);
var _local2:b2CircleDef = (_arg1 as b2CircleDef);
m_type = e_circleShape;
m_localPosition.SetV(_local2.localPosition);
m_radius = _local2.radius;
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local10:Number;
var _local6:b2Mat22 = _arg1.R;
var _local7:Number = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y)));
var _local8:Number = (_arg1.position.x + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y)));
var _local9:Number = (_arg4.p1.x - _local7);
_local10 = (_arg4.p1.y - _local8);
var _local11:Number = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius));
if (_local11 < 0){
return (false);
};
var _local12:Number = (_arg4.p2.x - _arg4.p1.x);
var _local13:Number = (_arg4.p2.y - _arg4.p1.y);
var _local14:Number = ((_local9 * _local12) + (_local10 * _local13));
var _local15:Number = ((_local12 * _local12) + (_local13 * _local13));
var _local16:Number = ((_local14 * _local14) - (_local15 * _local11));
if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){
return (false);
};
var _local17:Number = -((_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);
}
public function GetLocalPosition():b2Vec2{
return (m_localPosition);
}
public function GetRadius():Number{
return (m_radius);
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2Mat22;
_local4 = _arg2.R;
var _local5:Number = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
var _local6:Number = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_local4 = _arg3.R;
var _local7:Number = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
var _local8:Number = (_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));
}
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 UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:Number = (m_localPosition.x - _arg1.x);
var _local3:Number = (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 = _arg2.R;
var _local4:Number = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
var _local5:Number = (_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));
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Mat22 = _arg1.R;
var _local4:Number = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
var _local5:Number = (_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)));
}
}
}//package Box2D.Collision.Shapes
Section 3
//b2ConcaveArcDef (Box2D.Collision.Shapes.b2ConcaveArcDef)
package Box2D.Collision.Shapes {
public class b2ConcaveArcDef extends b2PolygonDef {
public var radius:Number;
public function b2ConcaveArcDef(){
type = b2Shape.e_concaveArcShape;
radius = 1;
}
}
}//package Box2D.Collision.Shapes
Section 4
//b2ConcaveArcShape (Box2D.Collision.Shapes.b2ConcaveArcShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ConcaveArcShape extends b2PolygonShape {
public var m_radius:Number;
public var m_radius2:Number;
public var m_arcCenter:b2Vec2;
public var m_dot:Number;
public var m_norm:Number;
public function b2ConcaveArcShape(_arg1:b2ShapeDef){
var _local11:*;
var _local12:Number;
super(_arg1);
var _local2:b2ConcaveArcDef = (_arg1 as b2ConcaveArcDef);
m_radius = _local2.radius;
m_radius2 = (m_radius * m_radius);
var _local3:b2Vec2 = m_vertices[0];
var _local4:b2Vec2 = m_vertices[1];
var _local5:Number = (_local3.x - _local4.x);
var _local6:Number = (_local3.y - _local4.y);
var _local7:Number = ((_local5 * _local5) + (_local6 * _local6));
var _local8:Number = Math.sqrt(_local7);
if ((_local7 / 4) > m_radius2){
m_radius2 = (_local7 / 4);
m_radius = (_local8 / 2);
};
var _local9:Number = Math.sqrt((m_radius2 - (_local7 * 0.25)));
m_arcCenter = new b2Vec2((((_local3.x + _local4.x) / 2) + (_local9 * m_normals[0].x)), (((_local3.y + _local4.y) / 2) + (_local9 * m_normals[0].y)));
m_dot = (_local9 / m_radius);
m_norm = ((_local8 / 2) / m_radius);
var _local10:* = ((m_radius + b2Settings.b2_toiSlop) * (m_radius + b2Settings.b2_toiSlop));
_local11 = m_normals[(m_vertexCount - 1)].x;
_local12 = m_normals[(m_vertexCount - 1)].y;
_local5 = (m_coreVertices[0].x - m_arcCenter.x);
_local6 = (m_coreVertices[0].y - m_arcCenter.y);
_local8 = ((_local5 * _local11) + (_local6 * _local12));
_local7 = Math.sqrt((_local10 - (_local8 * _local8)));
m_coreVertices[0].x = ((m_arcCenter.x + (_local8 * _local11)) + (_local7 * _local12));
m_coreVertices[0].y = ((m_arcCenter.y + (_local8 * _local12)) - (_local7 * _local11));
_local11 = m_normals[1].x;
_local12 = m_normals[1].y;
_local5 = (m_coreVertices[1].x - m_arcCenter.x);
_local6 = (m_coreVertices[1].y - m_arcCenter.y);
_local8 = ((_local5 * _local11) + (_local6 * _local12));
_local7 = Math.sqrt((_local10 - (_local8 * _local8)));
m_coreVertices[1].x = ((m_arcCenter.x + (_local8 * _local11)) - (_local7 * _local12));
m_coreVertices[1].y = ((m_arcCenter.y + (_local8 * _local12)) + (_local7 * _local11));
m_type = b2Shape.e_concaveArcShape;
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
b2Settings.b2Assert(false);
return (false);
}
override public function ComputeMass(_arg1:b2MassData):void{
super.ComputeMass(_arg1);
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local9:b2Vec2;
var _local10:Number;
var _local3:b2Mat22 = _arg1.R;
var _local4:Number = (_arg2.x - _arg1.position.x);
var _local5:Number = (_arg2.y - _arg1.position.y);
var _local6:Number = ((_local4 * _local3.col1.x) + (_local5 * _local3.col1.y));
var _local7:Number = ((_local4 * _local3.col2.x) + (_local5 * _local3.col2.y));
var _local8:int;
while (_local8 < m_vertexCount) {
_local9 = m_vertices[_local8];
_local4 = (_local6 - _local9.x);
_local5 = (_local7 - _local9.y);
_local10 = ((_local9.x * _local4) + (_local9.y * _local5));
if (_local10 > 0){
return (false);
};
_local8++;
};
_local4 = (_local6 - m_arcCenter.x);
_local5 = (_local7 - m_arcCenter.y);
return ((((_local4 * _local4) + (_local5 * _local5)) > m_radius2));
}
public static function TriangleMass(_arg1:b2MassData, _arg2:b2Vec2, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:Number){
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:*;
_local6 = (1 / 3);
_local7 = (_arg3.x - _arg2.x);
_local8 = (_arg3.y - _arg2.y);
_local9 = (_arg4.x - _arg2.x);
_local10 = (_arg4.y - _arg2.y);
_local11 = ((_local7 * _local10) - (_local8 * _local9));
var _local12:Number = (0.5 * _local11);
_arg1.mass = (_local12 * _arg5);
_arg1.center.x = (_local6 * ((_arg2.x + _arg3.x) + _arg4.x));
_arg1.center.y = (_local6 * ((_arg2.y + _arg3.y) + _arg4.y));
var _local13:Number = _arg2.x;
var _local14:Number = _arg2.y;
var _local15:Number = _local7;
var _local16:Number = _local8;
var _local17:Number = _local9;
var _local18:Number = _local10;
var _local19:Number = ((_local6 * ((0.25 * (((_local15 * _local15) + (_local17 * _local15)) + (_local17 * _local17))) + ((_local13 * _local15) + (_local13 * _local17)))) + ((0.5 * _local13) * _local13));
var _local20:Number = ((_local6 * ((0.25 * (((_local16 * _local16) + (_local18 * _local16)) + (_local18 * _local18))) + ((_local14 * _local16) + (_local14 * _local18)))) + ((0.5 * _local14) * _local14));
_arg1.I = ((_local11 * (_local19 + _local20)) * _arg5);
}
public static function SegmentMass(_arg1:b2MassData, _arg2:b2Vec2, _arg3:Number, _arg4:b2Vec2, _arg5:Number, _arg6:Number){
var _local7:Number;
_local7 = (Math.asin(((_arg5 / _arg3) / 2)) * 2);
_arg1.mass = ((((0.5 * _arg3) * _arg3) * _local7) * _arg6);
var _local8:Number = (((2 / 3) * _arg5) / _local7);
if (_local7 < Number.MIN_VALUE){
_local8 = ((2 / 3) * _arg3);
};
_arg1.center = new b2Vec2((_arg2.x - (_arg4.x * _local8)), (_arg2.y - (_arg4.y * _local8)));
_arg1.I = ((((0.5 * _arg1.mass) * _arg3) * _arg3) - ((_arg1.mass * _local8) * _local8));
}
}
}//package Box2D.Collision.Shapes
Section 5
//b2ConvexArcShape (Box2D.Collision.Shapes.b2ConvexArcShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ConvexArcShape extends b2Shape {
public var m_localPosition:b2Vec2;
public var m_offset:Number;
public var m_norm:b2Vec2;
public var m_dot:Number;
public var m_vertices:Array;
public var m_d:Number;
public var m_radius:Number;
public var m_obb:b2OBB;
public function b2ConvexArcShape(_arg1:b2ShapeDef){
m_localPosition = new b2Vec2();
m_obb = new b2OBB();
m_vertices = [new b2Vec2(), new b2Vec2()];
m_norm = new b2Vec2();
super(_arg1);
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
b2Settings.b2Assert(false);
return (false);
}
override public function ComputeMass(_arg1:b2MassData):void{
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
super.ComputeSweptAABB(_arg1, _arg2, _arg3);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
b2Settings.b2Assert(false);
return (null);
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
super.ComputeAABB(_arg1, _arg2);
}
public function GetOBB():b2OBB{
return (m_obb);
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
b2Settings.b2Assert(false);
return (false);
}
}
}//package Box2D.Collision.Shapes
Section 6
//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 Copy():b2FilterData{
var _local1:b2FilterData = new b2FilterData();
_local1.categoryBits = categoryBits;
_local1.maskBits = maskBits;
_local1.groupIndex = groupIndex;
return (_local1);
}
}
}//package Box2D.Collision.Shapes
Section 7
//b2MassData (Box2D.Collision.Shapes.b2MassData)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2MassData {
public var mass:Number;// = 0
public var center:b2Vec2;
public var I:Number;// = 0
public function b2MassData(){
center = new b2Vec2(0, 0);
super();
}
function Set(_arg1:b2MassData):void{
mass = _arg1.mass;
center.x = _arg1.center.x;
center.y = _arg1.center.y;
I = _arg1.I;
}
static function Add(... _args):b2MassData{
var _local3:b2MassData;
var _local4:b2MassData;
var _local5:b2MassData;
var _local6:b2Vec2;
var _local2:b2MassData = new (b2MassData);
for each (_local3 in _args) {
_local2.mass = (_local2.mass + _local3.mass);
};
if (Math.abs(_local2.mass) > Number.MIN_VALUE){
for each (_local4 in _args) {
_local2.center.x = (_local2.center.x + (_local4.mass * _local4.center.x));
_local2.center.y = (_local2.center.y + (_local4.mass * _local4.center.y));
};
_local2.center.x = (_local2.center.x / _local2.mass);
_local2.center.y = (_local2.center.y / _local2.mass);
for each (_local5 in _args) {
_local2.I = (_local2.I + _local5.I);
_local6 = b2Math.SubtractVV(_local5.center, _local2.center);
_local2.I = (_local2.I + (_local5.mass * b2Math.b2Dot(_local6, _local6)));
};
};
return (_local2);
}
}
}//package Box2D.Collision.Shapes
Section 8
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PolygonDef extends b2ShapeDef {
public var vertices:Array;
public var vertexCount:int;
private static var s_mat:b2Mat22 = new b2Mat22();
public function b2PolygonDef(){
vertices = new Array(b2Settings.b2_maxPolygonVertices);
super();
type = b2Shape.e_polygonShape;
vertexCount = 0;
var _local1:int;
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 9
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolygonShape extends b2Shape {
public var m_coreVertices:Array;
public var m_vertices:Array;
private var s_supportVec:b2Vec2;
public var m_centroid:b2Vec2;
public var m_normals:Array;
public var m_obb:b2OBB;
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 _local3: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;
var _local2:b2PolygonDef = (_arg1 as b2PolygonDef);
m_vertexCount = _local2.vertexCount;
var _local4:int = _local3;
var _local5:int = _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 ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2AABB = s_sweptAABB1;
var _local5:b2AABB = 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 GetCoreVertices():Array{
return (m_coreVertices);
}
public function GetCentroid():b2Vec2{
return (m_centroid);
}
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 TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local20:Number;
var _local21:Number;
var _local6:Number = 0;
var _local7:Number = _arg5;
_local8 = (_arg4.p1.x - _arg1.position.x);
_local9 = (_arg4.p1.y - _arg1.position.y);
_local10 = _arg1.R;
var _local12:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
var _local13:Number = ((_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;
var _local14:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
var _local15:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
var _local16:Number = (_local14 - _local12);
var _local17:Number = (_local15 - _local13);
var _local18 = -1;
var _local19:int;
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);
}
override public function ComputeMass(_arg1:b2MassData):void{
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;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
var _local7:Number = 0;
var _local8:Number = (1 / 3);
var _local9:int;
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 GetNormals():Array{
return (m_normals);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local11:Number;
_local5 = _arg1.R;
var _local6:Number = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y));
var _local7:Number = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y));
var _local8:int;
_local4 = m_coreVertices[0];
var _local9:Number = ((_local4.x * _local6) + (_local4.y * _local7));
var _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 ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Mat22 = 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();
var _local6:b2Mat22 = _local5;
_local4 = m_obb.extents;
var _local7:Number = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y));
var _local8:Number = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y));
_local3 = _arg2.R;
_local4 = m_obb.center;
var _local9:Number = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)));
var _local10:Number = (_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));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:b2Vec2;
var _local4:Number;
var _local5:Number;
m_sweepRadius = 0;
var _local3:int;
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 TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Vec2;
var _local10:Number;
var _local4:b2Mat22 = _arg1.R;
var _local5:Number = (_arg2.x - _arg1.position.x);
var _local6:Number = (_arg2.y - _arg1.position.y);
var _local7:Number = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y));
var _local8:Number = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y));
var _local9:int;
while (_local9 < m_vertexCount) {
_local3 = m_vertices[_local9];
_local5 = (_local7 - _local3.x);
_local6 = (_local8 - _local3.y);
_local3 = m_normals[_local9];
_local10 = ((_local3.x * _local5) + (_local3.y * _local6));
if (_local10 > 0){
return (false);
};
_local9++;
};
return (true);
}
public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{
var _local3:b2Vec2;
var _local7:Number;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local3 = new b2Vec2();
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
_local7 = (1 / 3);
var _local8:int;
while (_local8 < _arg2) {
_local9 = _arg1[_local8];
_local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0];
_local11 = (_local9.x - _local5);
_local12 = (_local9.y - _local6);
_local13 = (_local10.x - _local5);
_local14 = (_local10.y - _local6);
_local15 = ((_local11 * _local14) - (_local12 * _local13));
_local16 = (0.5 * _local15);
_local4 = (_local4 + _local16);
_local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x)));
_local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y)));
_local8++;
};
_local3.x = (_local3.x * (1 / _local4));
_local3.y = (_local3.y * (1 / _local4));
return (_local3);
}
public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{
var _local4:int;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:b2Mat22;
var _local5:Array = new Array((b2Settings.b2_maxPolygonVertices + 1));
_local4 = 0;
while (_local4 < _arg3) {
_local5[_local4] = _arg2[_local4];
_local4++;
};
_local5[_arg3] = _local5[0];
var _local6:Number = Number.MAX_VALUE;
_local4 = 1;
while (_local4 <= _arg3) {
_local7 = _local5[int((_local4 - 1))];
_local8 = (_local5[_local4].x - _local7.x);
_local9 = (_local5[_local4].y - _local7.y);
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local8 = (_local8 / _local10);
_local9 = (_local9 / _local10);
_local11 = -(_local9);
_local12 = _local8;
_local13 = Number.MAX_VALUE;
_local14 = Number.MAX_VALUE;
_local15 = -(Number.MAX_VALUE);
_local16 = -(Number.MAX_VALUE);
_local17 = 0;
while (_local17 < _arg3) {
_local19 = (_local5[_local17].x - _local7.x);
_local20 = (_local5[_local17].y - _local7.y);
_local21 = ((_local8 * _local19) + (_local9 * _local20));
_local22 = ((_local11 * _local19) + (_local12 * _local20));
if (_local21 < _local13){
_local13 = _local21;
};
if (_local22 < _local14){
_local14 = _local22;
};
if (_local21 > _local15){
_local15 = _local21;
};
if (_local22 > _local16){
_local16 = _local22;
};
_local17++;
};
_local18 = ((_local15 - _local13) * (_local16 - _local14));
if (_local18 < (0.95 * _local6)){
_local6 = _local18;
_arg1.R.col1.x = _local8;
_arg1.R.col1.y = _local9;
_arg1.R.col2.x = _local11;
_arg1.R.col2.y = _local12;
_local23 = (0.5 * (_local13 + _local15));
_local24 = (0.5 * (_local14 + _local16));
_local25 = _arg1.R;
_arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24)));
_arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24)));
_arg1.extents.x = (0.5 * (_local15 - _local13));
_arg1.extents.y = (0.5 * (_local16 - _local14));
};
_local4++;
};
}
}
}//package Box2D.Collision.Shapes
Section 10
//b2Shape (Box2D.Collision.Shapes.b2Shape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class b2Shape {
public var m_next: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_isSensor:Boolean;
public var m_restitution:Number;
public var m_userData;
public var m_proxyId:uint;
public var m_body:b2Body;
public static const e_polygonShape:int = 1;
public static const e_concaveArcShape:int = 5;
public static const e_convexArcShape:int = 4;
public static const e_unknownShape:int = -1;
public static const e_meshShape:int = 3;
public static const e_circleShape:int = 0;
public static const e_shapeTypeCount:int = 6;
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 SetUserData(_arg1):void{
m_userData = _arg1;
}
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{
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
_arg1.DestroyProxy(m_proxyId);
var _local3:b2AABB = s_resetAABB;
ComputeAABB(_local3, _arg2);
var _local4:Boolean = _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{
if (m_proxyId == b2Pair.b2_nullProxy){
return (false);
};
var _local4:b2AABB = 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 = s_proxyAABB;
ComputeAABB(_local3, _arg2);
var _local4:Boolean = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
return (false);
}
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));
case e_convexArcShape:
return (new b2ConvexArcShape(_arg1));
case e_concaveArcShape:
return (new b2ConcaveArcShape(_arg1));
default:
return (null);
};
}
}
}//package Box2D.Collision.Shapes
Section 11
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef)
package Box2D.Collision.Shapes {
public class b2ShapeDef {
public var friction:Number;// = 0.2
public var isSensor:Boolean;// = false
public var density:Number;// = 0
public var restitution:Number;// = 0
public var userData;// = null
public var filter:b2FilterData;
public var type:int;// = -1
public function b2ShapeDef(){
filter = new b2FilterData();
super();
}
}
}//package Box2D.Collision.Shapes
Section 12
//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 = (upperBound.x - lowerBound.x);
var _local2:Number = (upperBound.y - lowerBound.y);
var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid()));
return (_local3);
}
}
}//package Box2D.Collision
Section 13
//b2Bound (Box2D.Collision.b2Bound)
package Box2D.Collision {
public class b2Bound {
public var value:uint;
public var proxyId:uint;
public var stabbingCount:uint;
public function Swap(_arg1:b2Bound):void{
var _local2:uint = value;
var _local3:uint = proxyId;
var _local4:uint = 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 14
//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 15
//b2BroadPhase (Box2D.Collision.b2BroadPhase)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2BroadPhase {
public var m_bounds:Array;
public var m_quantizationFactor:b2Vec2;
public var m_worldAABB:b2AABB;
public var m_freeProxy:uint;
public var m_proxyCount:int;
public var m_proxyPool:Array;
public var m_queryResultCount:int;
public var m_pairManager:b2PairManager;
public var m_timeStamp:uint;
public var m_queryResults:Array;
public static const b2_nullEdge:uint = b2Settings.USHRT_MAX;
public static const b2_invalid:uint = b2Settings.USHRT_MAX;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _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++;
};
var _local4:Number = (_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 _local6:uint;
var _local7:uint;
var _local12:b2Proxy;
var _local4:Array = new Array();
var _local5:Array = new Array();
ComputeBounds(_local4, _local5, _arg1);
var _local8:Array = [_local6];
var _local9:Array = [_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);
var _local10:int;
var _local11:int;
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 = 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 _local10:b2Bound;
var _local12:int;
var _local13:int;
var _local14:b2Proxy;
var _local8:uint = BinarySearch(_arg5, _arg6, _arg3);
var _local9:uint = BinarySearch(_arg5, _arg6, _arg4);
var _local11:uint = _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 _local4:Array;
var _local5:b2Bound;
var _local6:b2Bound;
var _local3:int;
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 = _arg3.lowerBound.x;
var _local5:Number = _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);
var _local6:Number = _arg3.upperBound.x;
var _local7:Number = _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 _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;
var _local5:uint = m_freeProxy;
_local4 = m_proxyPool[_local5];
m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
var _local6:uint = (2 * m_proxyCount);
var _local7:Array = new Array();
var _local8:Array = new Array();
ComputeBounds(_local7, _local8, _arg1);
var _local9:int;
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++;
var _local10:int;
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 _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;
var _local4:b2Proxy = m_proxyPool[_arg1];
var _local5:int = (2 * m_proxyCount);
var _local6:int;
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++;
};
var _local7:int;
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 _local4:Array;
var _local5:b2Bound;
var _local3:int;
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 _local6:b2Bound;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
var _local5:int;
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 = 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 _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;
};
var _local12:uint = (2 * m_proxyCount);
var _local13:b2Proxy = m_proxyPool[_arg1];
var _local14:b2BoundValues = new b2BoundValues();
ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2);
var _local15:b2BoundValues = 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 _local6:int;
var _local7:b2Bound;
var _local4:int;
var _local5:int = (_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 16
//b2BufferedPair (Box2D.Collision.b2BufferedPair)
package Box2D.Collision {
public class b2BufferedPair {
public var proxyId1:uint;
public var proxyId2:uint;
}
}//package Box2D.Collision
Section 17
//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 _local11:b2Mat22;
var _local12:b2Vec2;
var _local25:Number;
var _local6:int = _arg1.m_vertexCount;
var _local7:Array = _arg1.m_vertices;
var _local8:Array = _arg1.m_normals;
var _local9:int = _arg4.m_vertexCount;
var _local10:Array = _arg4.m_vertices;
_local11 = _arg2.R;
_local12 = _local8[_arg3];
var _local13:Number = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y));
var _local14:Number = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y));
_local11 = _arg5.R;
var _local15:Number = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14));
var _local16:Number = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14));
var _local17:int;
var _local18:Number = Number.MAX_VALUE;
var _local19:int;
while (_local19 < _local9) {
_local12 = _local10[_local19];
_local25 = ((_local12.x * _local15) + (_local12.y * _local16));
if (_local25 < _local18){
_local18 = _local25;
_local17 = _local19;
};
_local19++;
};
_local12 = _local7[_arg3];
_local11 = _arg2.R;
var _local20:Number = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
var _local21:Number = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local12 = _local10[_local17];
_local11 = _arg5.R;
var _local22:Number = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
var _local23:Number = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local22 = (_local22 - _local20);
_local23 = (_local23 - _local21);
var _local24:Number = ((_local22 * _local13) + (_local23 * _local14));
return (_local24);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2 = _arg2.lowerBound;
var _local4:b2Vec2 = _arg1.upperBound;
var _local5:Number = (_local3.x - _local4.x);
var _local6:Number = (_local3.y - _local4.y);
_local3 = _arg1.lowerBound;
_local4 = _arg2.upperBound;
var _local7:Number = (_local3.x - _local4.x);
var _local8:Number = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{
var _local12:b2Mat22;
var _local13:b2Vec2;
var _local20:ClipVertex;
var _local23:Number;
var _local7:int = _arg2.m_vertexCount;
var _local8:Array = _arg2.m_normals;
var _local9:int = _arg5.m_vertexCount;
var _local10:Array = _arg5.m_vertices;
var _local11:Array = _arg5.m_normals;
_local12 = _arg3.R;
_local13 = _local8[_arg4];
var _local14:Number = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y));
var _local15:Number = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y));
_local12 = _arg6.R;
var _local16:Number = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15));
_local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15));
_local14 = _local16;
var _local17:int;
var _local18:Number = Number.MAX_VALUE;
var _local19:int;
while (_local19 < _local9) {
_local13 = _local11[_local19];
_local23 = ((_local14 * _local13.x) + (_local15 * _local13.y));
if (_local23 < _local18){
_local18 = _local23;
_local17 = _local19;
};
_local19++;
};
var _local21:int = _local17;
var _local22:int = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0;
_local20 = _arg1[0];
_local13 = _local10[_local21];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local21;
_local20.id.features.incidentVertex = 0;
_local20 = _arg1[1];
_local13 = _local10[_local22];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local22;
_local20.id.features.incidentVertex = 1;
}
public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{
var _local6:ClipVertex;
var _local13:b2PolygonShape;
var _local14:b2PolygonShape;
var _local17:int;
var _local18:uint;
var _local34:int;
var _local37:b2Vec2;
var _local38:Number;
var _local39:b2ManifoldPoint;
_arg1.pointCount = 0;
var _local7:int;
var _local8:Array = [_local7];
var _local9:Number = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5);
_local7 = _local8[0];
if (_local9 > 0){
return;
};
var _local10:int;
var _local11:Array = [_local10];
var _local12:Number = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3);
_local10 = _local11[0];
if (_local12 > 0){
return;
};
var _local15:b2XForm = new b2XForm();
var _local16:b2XForm = new b2XForm();
var _local19:Number = 0.98;
var _local20:Number = 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;
};
var _local21:Array = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16);
var _local22:int = _local13.m_vertexCount;
var _local23:Array = _local13.m_vertices;
var _local24:b2Vec2 = _local23[_local17];
var _local25:b2Vec2 = _local24.Copy();
if ((_local17 + 1) < _local22){
_local24 = _local23[int((_local17 + 1))];
_local37 = _local24.Copy();
} else {
_local24 = _local23[0];
_local37 = _local24.Copy();
};
var _local26:b2Vec2 = b2Math.SubtractVV(_local37, _local25);
var _local27:b2Vec2 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25));
_local27.Normalize();
var _local28:b2Vec2 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local37 = b2Math.b2MulX(_local15, _local37);
var _local29:Number = b2Math.b2Dot(_local28, _local25);
var _local30:Number = -(b2Math.b2Dot(_local27, _local25));
var _local31:Number = b2Math.b2Dot(_local27, _local37);
var _local32:Array = [new ClipVertex(), new ClipVertex()];
var _local33:Array = [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();
var _local35:int;
var _local36:int;
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 _local8:b2Vec2;
var _local9:b2Mat22;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:Number;
var _local6:int = _arg2.m_vertexCount;
var _local7:Array = _arg2.m_normals;
_local9 = _arg5.R;
_local8 = _arg4.m_centroid;
var _local10:Number = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)));
var _local11:Number = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)));
_local9 = _arg3.R;
_local8 = _arg2.m_centroid;
_local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))));
_local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))));
var _local12:Number = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y));
var _local13:Number = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y));
var _local14:int;
var _local15:Number = -(Number.MAX_VALUE);
var _local16:int;
while (_local16 < _local6) {
_local8 = _local7[_local16];
_local25 = ((_local8.x * _local12) + (_local8.y * _local13));
if (_local25 > _local15){
_local15 = _local25;
_local14 = _local16;
};
_local16++;
};
var _local17:Number = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
var _local18:int = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1);
var _local19:Number = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5);
if (_local19 > 0){
return (_local19);
};
var _local20:int = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0;
var _local21:Number = 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 _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);
var _local10:Number = (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 _local18:Number;
var _local24:Number;
var _local25:Number;
_arg1.pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_localPosition;
var _local8:Number = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local9:Number = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_localPosition;
var _local10:Number = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local11:Number = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
var _local12:Number = (_local10 - _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = ((_local12 * _local12) + (_local13 * _local13));
var _local15:Number = _arg2.m_radius;
var _local16:Number = _arg4.m_radius;
var _local17:Number = (_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;
var _local19:b2ManifoldPoint = _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));
var _local20:Number = (0.5 * (_local8 + _local10));
var _local21:Number = (0.5 * (_local9 + _local11));
var _local22:Number = (_local20 - _arg3.position.x);
var _local23:Number = (_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 _local17:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_arg1.pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_localPosition;
var _local13:Number = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
var _local14:Number = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)));
_local7 = (_local13 - _arg3.position.x);
_local8 = (_local14 - _arg3.position.y);
_local12 = _arg3.R;
var _local15:Number = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
var _local16:Number = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
var _local18:int;
var _local19:Number = -(Number.MAX_VALUE);
var _local20:Number = _arg4.m_radius;
var _local21:int = _arg2.m_vertexCount;
var _local22:Array = _arg2.m_vertices;
var _local23:Array = _arg2.m_normals;
var _local24:int;
while (_local24 < _local21) {
_local11 = _local22[_local24];
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local11 = _local23[_local24];
_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;
};
var _local25:int = _local18;
var _local26:int = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
_local11 = _local22[_local25];
var _local27:b2Vec2 = _local22[_local26];
var _local28:Number = (_local27.x - _local11.x);
var _local29:Number = (_local27.y - _local11.y);
var _local30:Number = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
var _local31:Number = ((_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 18
//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 = new b2ContactID();
_local1.key = key;
return (_local1);
}
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);
}
public function get key():uint{
return (_key);
}
}
}//package Box2D.Collision
Section 19
//b2ContactPoint (Box2D.Collision.b2ContactPoint)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class b2ContactPoint {
public var friction:Number;
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 velocity:b2Vec2;
public function b2ContactPoint(){
position = new b2Vec2();
velocity = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 20
//b2Distance (Box2D.Collision.b2Distance)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Distance {
public static var s_initialized:Boolean = false;
public static var g_GJK_Iterations:int = 0;
private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
public static var s_registers:Array;
private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var gPoint:b2Point = new b2Point();
private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
public static var t:Number = -1;
public static var t2:String = "";
public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{
var _local7:b2Vec2;
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;
var _local8:Array = s_p1s;
var _local9:Array = s_p2s;
var _local10:Array = s_points;
var _local11:int;
_arg1.SetV(_arg3.GetFirstVertex(_arg4));
_arg2.SetV(_arg5.GetFirstVertex(_arg6));
var _local12:Number = 0;
var _local13 = 20;
var _local14:int;
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 InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{
var _local6:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local4:Number = (100 * Number.MIN_VALUE);
var _local5:int;
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 ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local35:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
var _local8:b2Vec2 = _arg5[2];
var _local9:b2Vec2 = _arg3[0];
var _local10:b2Vec2 = _arg3[1];
var _local11:b2Vec2 = _arg3[2];
var _local12:b2Vec2 = _arg4[0];
var _local13:b2Vec2 = _arg4[1];
var _local14:b2Vec2 = _arg4[2];
var _local15:Number = _local6.x;
var _local16:Number = _local6.y;
var _local17:Number = _local7.x;
var _local18:Number = _local7.y;
var _local19:Number = _local8.x;
var _local20:Number = _local8.y;
var _local21:Number = (_local17 - _local15);
var _local22:Number = (_local18 - _local16);
var _local23:Number = (_local19 - _local15);
var _local24:Number = (_local20 - _local16);
var _local25:Number = (_local19 - _local17);
var _local26:Number = (_local20 - _local18);
var _local27:Number = -(((_local15 * _local21) + (_local16 * _local22)));
var _local28:Number = ((_local17 * _local21) + (_local18 * _local22));
var _local29:Number = -(((_local15 * _local23) + (_local16 * _local24)));
var _local30:Number = ((_local19 * _local23) + (_local20 * _local24));
var _local31:Number = -(((_local17 * _local25) + (_local18 * _local26)));
var _local32:Number = ((_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);
};
var _local33:Number = ((_local21 * _local24) - (_local22 * _local23));
var _local34:Number = (_local33 * ((_local15 * _local18) - (_local16 * _local17)));
var _local36:Number = (_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);
};
var _local37:Number = (_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);
};
var _local38:Number = ((_local36 + _local37) + _local34);
_local38 = (1 / _local38);
var _local39:Number = (_local36 * _local38);
var _local40:Number = (_local37 * _local38);
var _local41:Number = ((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 Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
var _local7:int = _arg3.GetType();
var _local8:int = _arg5.GetType();
var _local9:* = s_registers[_local7][_local8];
if (_local9.fcn){
if (_local9.primary){
return (_local9.fcn(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6));
};
return (_local9.fcn(_arg2, _arg1, _arg5, _arg6, _arg3, _arg4));
};
return (0);
}
public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local9:b2Point = 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)));
var _local10:Number = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity);
var _local11:Number = (_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 AddType(_arg1:Function, _arg2:int, _arg3:int):void{
s_registers[_arg2][_arg3].fcn = _arg1;
s_registers[_arg2][_arg3].primary = true;
if (_arg2 != _arg3){
s_registers[_arg3][_arg2].fcn = _arg1;
s_registers[_arg3][_arg2].primary = false;
};
}
public static function DistanceCcaC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2ConcaveArcShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local15:b2Vec2;
var _local16:*;
var _local17:*;
var _local18:Number;
var _local19:*;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local9:b2Point = 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)));
var _local10:Number = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity);
var _local11:Number = (_arg5.m_radius - b2Settings.b2_toiSlop);
var _local12:b2Vec2 = b2Math.b2MulX(_arg4, _arg3.m_coreVertices[0]);
var _local13:b2Vec2 = b2Math.b2MulMV(_arg4.R, _arg3.m_normals[0]);
var _local14:Number = (((_arg1.x - _local12.x) * _local13.x) + ((_arg1.y - _local12.y) * _local13.y));
if (_local14 >= 0){
_local15 = b2Math.b2MulX(_arg4, _arg3.m_arcCenter);
_local16 = (_local9.p.x - _local15.x);
_local17 = (_local9.p.y - _local15.y);
_local18 = ((-(_local13.y) * _local16) + (_local13.x * _local17));
if (((_local16 * _local13.x) + (_local17 * _local13.y)) > 0){
if (_local18 < 0){
_local8 = _local12;
} else {
_local8 = b2Math.b2MulX(_arg4, _arg3.m_coreVertices[1]);
};
} else {
if (_local18 <= -(_arg3.m_norm)){
_local8 = _local12;
} else {
if (_local18 >= _arg3.m_norm){
_local8 = b2Math.b2MulX(_arg4, _arg3.m_coreVertices[1]);
} else {
_local19 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17)));
_local10 = (((_arg3.m_radius + (b2Settings.b2_toiSlop * 2)) - _local11) - _local19);
_local16 = (_local16 / _local19);
_local17 = (_local17 / _local19);
if (_local10 < 0){
_local10 = 0;
};
_arg1.x = (_local15.x + (_local16 * (_arg3.m_radius + b2Settings.b2_toiSlop)));
_arg1.y = (_local15.y + (_local17 * (_arg3.m_radius + b2Settings.b2_toiSlop)));
_arg2.x = (_arg2.x + (_local16 * _local11));
_arg2.y = (_arg2.y + (_local17 * _local11));
return (_local10);
};
};
};
_arg1.SetV(_local8);
_local8.x = (_local8.x - _local9.p.x);
_local8.y = (_local8.y - _local9.p.y);
_local10 = (_local8.Normalize() - _local11);
if (_local10 > 0){
_arg2.x = (_arg2.x + (_local11 * _local8.x));
_arg2.y = (_arg2.y + (_local11 * _local8.y));
return (_local10);
};
_arg2.SetV(_arg1);
return (0);
};
if (_local10 > _local11){
_local10 = (_local10 - _local11);
_local20 = (_arg2.x - _arg1.x);
_local21 = (_arg2.y - _arg1.y);
_local22 = Math.sqrt(((_local20 * _local20) + (_local21 * _local21)));
_local20 = (_local20 / _local22);
_local21 = (_local21 / _local22);
_arg2.x = (_arg2.x - (_local11 * _local20));
_arg2.y = (_arg2.y - (_local11 * _local21));
} else {
_local10 = 0;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
};
return (_local10);
}
public static function InitializeRegisters():void{
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
var _local1:int;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_registers[_local1][_local2] = {};
_local2++;
};
_local1++;
};
AddType(b2Distance.DistanceCC, b2Shape.e_circleShape, b2Shape.e_circleShape);
AddType(b2Distance.DistancePC, b2Shape.e_polygonShape, b2Shape.e_circleShape);
AddType(b2Distance.DistanceGeneric, b2Shape.e_polygonShape, b2Shape.e_polygonShape);
AddType(b2Distance.DistanceCcaC, b2Shape.e_concaveArcShape, b2Shape.e_circleShape);
AddType(b2Distance.DistancePCca, b2Shape.e_polygonShape, b2Shape.e_concaveArcShape);
}
public static function DistancePCca(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2ConcaveArcShape, _arg6:b2XForm):Number{
var _local19:Number;
var _local20:Number;
var _local26:*;
t = -1;
t2 = "";
var _local7:Number = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
var _local8:b2Vec2 = b2Math.b2MulX(_arg6, _arg5.m_coreVertices[0]);
var _local9:b2Vec2 = b2Math.b2MulMV(_arg6.R, _arg5.m_normals[0]);
var _local10:Number = (((_arg2.x - _local8.x) * _local9.x) + ((_arg2.y - _local8.y) * _local9.y));
if ((((_local10 < (-(b2Settings.b2_linearSlop) / 4))) && ((_local7 > 0)))){
t = 0;
return (_local7);
};
var _local11:b2Vec2 = b2Math.b2MulX(_arg6, _arg5.m_coreVertices[1]);
var _local12:b2Vec2 = new b2Vec2();
var _local13:* = (b2Settings.b2_linearSlop * b2Settings.b2_linearSlop);
_local12.x = (_local8.x - _arg2.x);
_local12.y = (_local8.y - _arg2.y);
if (((_local12.x * _local12.x) + (_local12.y * _local12.y)) < _local13){
t = 1;
return (_local7);
};
_local12.x = (_local11.x - _arg2.x);
_local12.y = (_local11.y - _arg2.y);
if (((_local12.x * _local12.x) + (_local12.y * _local12.y)) < _local13){
t = 2;
return (_local7);
};
var _local14:b2Vec2 = b2Math.b2MulXT(_arg4, b2Math.b2MulX(_arg6, _arg5.m_arcCenter));
var _local15:b2Vec2 = b2Math.b2MulTMV(_arg4.R, _local9);
var _local16:Number = -1;
var _local17:Number = -1;
var _local18:* = Number.MAX_VALUE;
var _local21:Number = 0;
while (_local21 < _arg3.m_vertexCount) {
_local12.x = (_arg3.m_coreVertices[_local21].x - _local14.x);
_local12.y = (_arg3.m_coreVertices[_local21].y - _local14.y);
_local26 = ((_local12.x * _local15.y) - (_local12.y * _local15.x));
_local19 = ((_local12.x * _local12.x) + (_local12.y * _local12.y));
if (((((_local26 * _local26) < ((_arg5.m_norm * _arg5.m_norm) * _local19))) && ((((_local12.x * _local15.x) + (_local12.y * _local15.y)) < 0)))){
t2 = (t2 + (("(" + _local21) + ") "));
if (_local19 > _local16){
_local16 = _local19;
_local17 = _local21;
_local20 = Math.sqrt(_local19);
_local18 = ((_arg5.m_radius + b2Settings.b2_toiSlop) - _local20);
if (_local18 < 0){
_local18 = 0;
};
_arg1.SetV(b2Math.b2MulX(_arg4, _arg3.m_coreVertices[_local21]));
_local12.x = (_local12.x * ((_arg5.m_radius + b2Settings.b2_toiSlop) / _local20));
_local12.y = (_local12.y * ((_arg5.m_radius + b2Settings.b2_toiSlop) / _local20));
_local12.x = (_local12.x + _local14.x);
_local12.y = (_local12.y + _local14.y);
_arg2.SetV(b2Math.b2MulX(_arg4, _local12));
t = 3;
};
};
_local21++;
};
var _local22:b2Vec2 = new b2Vec2();
var _local23:b2Vec2 = new b2Vec2();
var _local24:b2Point = gPoint;
_local24.p.SetV(_local8);
var _local25:Number = DistanceGeneric(_local22, _local23, _arg3, _arg4, _local24, b2Math.b2XForm_identity);
if (_local25 < _local18){
t = 4;
_local18 = _local25;
_arg1.SetV(_local22);
_arg2.SetV(_local23);
};
_local24.p.SetV(_local11);
_local25 = DistanceGeneric(_local22, _local23, _arg3, _arg4, _local24, b2Math.b2XForm_identity);
if (_local25 < _local18){
t = 5;
_local18 = _local25;
_arg1.SetV(_local22);
_arg2.SetV(_local23);
};
return (_local18);
}
public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local19:Number;
var _local20:Number;
_local7 = _arg4.R;
_local8 = _arg3.m_localPosition;
var _local9:Number = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
var _local10:Number = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local7 = _arg6.R;
_local8 = _arg5.m_localPosition;
var _local11:Number = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
var _local12:Number = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
var _local13:Number = (_local11 - _local9);
var _local14:Number = (_local12 - _local10);
var _local15:Number = ((_local13 * _local13) + (_local14 * _local14));
var _local16:Number = (_arg3.m_radius - b2Settings.b2_toiSlop);
var _local17:Number = (_arg5.m_radius - b2Settings.b2_toiSlop);
var _local18:Number = (_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 ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local10:b2Vec2;
var _local17:Number;
var _local6:b2Vec2 = _arg5[0];
var _local7:b2Vec2 = _arg5[1];
var _local8:b2Vec2 = _arg3[0];
var _local9:b2Vec2 = _arg3[1];
_local10 = _arg4[0];
var _local11:b2Vec2 = _arg4[1];
var _local12:Number = -(_local7.x);
var _local13:Number = -(_local7.y);
var _local14:Number = (_local6.x - _local7.x);
var _local15:Number = (_local6.y - _local7.y);
var _local16:Number = 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 21
//b2Manifold (Box2D.Collision.b2Manifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Manifold {
public var pointCount:int;// = 0
public var normal:b2Vec2;
public var points:Array;
public function b2Manifold(){
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ManifoldPoint();
_local1++;
};
normal = new b2Vec2();
}
public function Set(_arg1:b2Manifold):void{
pointCount = _arg1.pointCount;
var _local2:int;
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;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
normal.SetZero();
pointCount = 0;
}
}
}//package Box2D.Collision
Section 22
//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 23
//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 24
//b2Pair (Box2D.Collision.b2Pair)
package Box2D.Collision {
import Box2D.Common.*;
public class b2Pair {
public var proxyId1:uint;
public var userData;// = null
public var proxyId2:uint;
public var status:uint;
public var next:uint;
public static var e_pairFinal:uint = 4;
public static var b2_tableMask:int = (b2_tableCapacity - 1);
public static var e_pairRemoved:uint = 2;
public static var b2_nullPair:uint = b2Settings.USHRT_MAX;
public static var e_pairBuffered:uint = 1;
public static var b2_nullProxy:uint = b2Settings.USHRT_MAX;
public static var b2_tableCapacity:int = b2Settings.b2_maxPairs;
public function 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 25
//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 26
//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_hashTable:Array;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_pairBufferCount:int;
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 = 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 _local4:uint;
if (_arg1 > _arg2){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
var _local3:uint = (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 _local5:b2Pair;
var _local6:b2Proxy;
var _local7:b2Proxy;
var _local3:int;
var _local4:Array = 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 = 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 _local7:uint;
var _local8:uint;
var _local9:*;
if (_arg1 > _arg2){
_local7 = _arg1;
_arg1 = _arg2;
_arg2 = _local7;
};
var _local4:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local5:uint = m_hashTable[_local4];
var _local6:b2Pair;
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 = 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 _local6:uint;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local4 = FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
var _local5:uint = 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 = (((_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 27
//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 28
//b2Proxy (Box2D.Collision.b2Proxy)
package Box2D.Collision {
public class b2Proxy {
public var overlapCount:uint;
public var userData;// = null
public var lowerBounds:Array;
public var upperBounds:Array;
public var timeStamp:uint;
public function b2Proxy(){
lowerBounds = [uint(0), uint(0)];
upperBounds = [uint(0), uint(0)];
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 29
//b2Segment (Box2D.Collision.b2Segment)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
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 _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local5:b2Vec2 = _arg3.p1;
var _local6:Number = (_arg3.p2.x - _local5.x);
var _local7:Number = (_arg3.p2.y - _local5.y);
var _local8:Number = (p2.x - p1.x);
var _local9:Number = (p2.y - p1.y);
var _local10:Number = _local9;
var _local11:Number = -(_local8);
var _local12:Number = (100 * Number.MIN_VALUE);
var _local13:Number = -(((_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 30
//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 _local25:Number;
var _local26:b2XForm;
var _local27:b2XForm;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local7:Number = _arg1.m_sweepRadius;
var _local8:Number = _arg3.m_sweepRadius;
var _local9:Number = _arg2.t0;
var _local10:Number = (_arg2.c.x - _arg2.c0.x);
var _local11:Number = (_arg2.c.y - _arg2.c0.y);
var _local12:Number = (_arg4.c.x - _arg4.c0.x);
var _local13:Number = (_arg4.c.y - _arg4.c0.y);
var _local14:Number = (_arg2.a - _arg2.a0);
var _local15:Number = (_arg4.a - _arg4.a0);
var _local16:Number = 0;
var _local17:b2Vec2 = s_p1;
var _local18:b2Vec2 = s_p2;
var _local19 = 20;
var _local20:int;
var _local21:Number = 0;
var _local22:Number = 0;
var _local23:Number = 0;
var _local24:Number = 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 31
//ClipVertex (Box2D.Collision.ClipVertex)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class ClipVertex {
public var id:b2ContactID;
public var v:b2Vec2;
public function ClipVertex(){
v = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 32
//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 get incidentVertex():int{
return (_incidentVertex);
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
}
}//package Box2D.Collision
Section 33
//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 SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function Set(_arg1:Number):void{
var _local2:Number;
_local2 = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function 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 _local4:Number;
var _local6:Number;
_local2 = col1.x;
var _local3:Number = col2.x;
_local4 = col1.y;
var _local5:Number = 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 = col1.x;
var _local5:Number = col2.x;
var _local6:Number = col1.y;
var _local7:Number = col2.y;
var _local8:Number = ((_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 34
//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 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = 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 = (_arg1.x - _arg2.x);
var _local4:Number = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:* = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function 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 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function 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 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22 = 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 = (_arg1.x - _arg2.x);
var _local4:Number = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
var _local4:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
var _local5:b2Mat22 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean = (((_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 = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = 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 = 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 = 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 35
//b2Sweep (Box2D.Common.Math.b2Sweep)
package Box2D.Common.Math {
public class b2Sweep {
public var localCenter:b2Vec2;
public var a:Number;
public var c:b2Vec2;
public var a0:Number;
public var c0:b2Vec2;
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 _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);
};
var _local3:b2Mat22 = _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 36
//b2Vec2 (Box2D.Common.Math.b2Vec2)
package Box2D.Common.Math {
public class b2Vec2 {
public var y:Number;
public var x:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
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 MulM(_arg1:b2Mat22):void{
var _local2:Number = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function SetZero():void{
x = 0;
y = 0;
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function Normalize():Number{
var _local1:Number = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
var _local2:Number = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function CrossVF(_arg1:Number):void{
var _local2:Number = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
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 CrossFV(_arg1:Number):void{
var _local2:Number = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number = 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 static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 37
//b2XForm (Box2D.Common.Math.b2XForm)
package Box2D.Common.Math {
public class b2XForm {
public var position:b2Vec2;
public var R:b2Mat22;
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 38
//b2Color (Box2D.Common.b2Color)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Color {
private var _r:uint;// = 0
private var _g:uint;// = 0
private var _b:uint;// = 0
public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){
_r = uint((0xFF * b2Math.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 set b(_arg1:Number):void{
_b = uint((0xFF * b2Math.b2Clamp(_arg1, 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 g(_arg1:Number):void{
_g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
}
}//package Box2D.Common
Section 39
//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 40
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2CircleContact extends b2Contact {
private var m_manifolds:Array;
public var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
var _local3:b2ManifoldPoint = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local8:b2ManifoldPoint;
var _local5:b2Body = m_shape1.m_body;
var _local6:b2Body = 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);
var _local7:b2ContactPoint = 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);
};
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
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 41
//b2ConcaveArcAndCircleContact (Box2D.Dynamics.Contacts.b2ConcaveArcAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ConcaveArcAndCircleContact extends b2PolyAndCircleContact {
private static var s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2ConcaveArcAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
super(_arg1, _arg2);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2ManifoldPoint;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local6:b2Body = m_shape1.m_body;
var _local7:b2Body = m_shape2.m_body;
m0.Set(m_manifolds[0]);
m_manifoldCount = b2CollideConcaveArcAndCircle(m_manifolds, (m_shape1 as b2ConcaveArcShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf);
var _local8:Array = [false, false];
var _local9:b2ContactPoint = 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++;
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2ConcaveArcAndCircleContact(_arg1, _arg2));
}
public static function b2CollideConcaveArcAndCircle(_arg1:Array, _arg2:b2ConcaveArcShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):Number{
var _local7:uint;
var _local8:b2Manifold;
var _local10:b2ManifoldPoint;
var _local11:Number;
var _local12:Number;
var _local13:b2Vec2;
var _local14:b2Mat22;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local21: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 _local6:Boolean;
_local7 = b2Collision.b2_nullFeature;
_local8 = _arg1[0];
var _local9:Number = 0;
_local8.pointCount = 0;
_local14 = _arg5.R;
_local13 = _arg4.m_localPosition;
_local17 = (_arg5.position.x + ((_local14.col1.x * _local13.x) + (_local14.col2.x * _local13.y)));
_local18 = (_arg5.position.y + ((_local14.col1.y * _local13.x) + (_local14.col2.y * _local13.y)));
_local11 = (_local17 - _arg3.position.x);
_local12 = (_local18 - _arg3.position.y);
_local14 = _arg3.R;
var _local19:Number = ((_local11 * _local14.col1.x) + (_local12 * _local14.col1.y));
var _local20:Number = ((_local11 * _local14.col2.x) + (_local12 * _local14.col2.y));
var _local22:int;
var _local23:Number = -(Number.MAX_VALUE);
var _local24:Number = _arg4.m_radius;
var _local25 = 1;
while (_local25 < _arg2.m_vertexCount) {
_local11 = (_local19 - _arg2.m_vertices[_local25].x);
_local12 = (_local20 - _arg2.m_vertices[_local25].y);
_local33 = ((_arg2.m_normals[_local25].x * _local11) + (_arg2.m_normals[_local25].y * _local12));
if (_local33 > _local24){
_local9 = 0;
return (_local9);
};
if (_local33 > _local23){
_local23 = _local33;
_local22 = _local25;
};
_local25++;
};
if (((((true) || ((_local22 == 1)))) || ((_local22 == (_arg2.m_vertexCount - 1))))){
_local33 = ((_arg2.m_normals[0].x * (_local19 - _arg2.m_vertices[0].x)) + (_arg2.m_normals[0].y * (_local20 - _arg2.m_vertices[0].y)));
_local34 = (_local19 - _arg2.m_arcCenter.x);
_local35 = (_local20 - _arg2.m_arcCenter.y);
_local36 = Math.sqrt(((_local34 * _local34) + (_local35 * _local35)));
_local34 = (_local34 / _local36);
_local35 = (_local35 / _local36);
_local33 = Math.max(_local33, (_arg2.m_radius - _local36));
if (_local33 > _local24){
_local9 = 0;
return (_local9);
};
if (_local33 > _local23){
_local23 = _local33;
_local22 = 0;
};
};
if ((((_local22 == 0)) && ((_local24 >= _arg2.m_radius)))){
if (_arg1.length < 2){
_arg1[1] = new b2Manifold();
_arg1[1].pointCount = 0;
_arg1[1].points[0].normalImpulse = 0;
_arg1[1].points[0].tangentImpulse = 0;
};
_local9 = 0;
_local25 = 0;
while (_local25 < 2) {
_local11 = (_arg2.m_vertices[_local25].x - _local19);
_local12 = (_arg2.m_vertices[_local25].y - _local20);
_local37 = ((_local11 * _local11) + (_local12 * _local12));
if (_local37 < (_local24 * _local24)){
_local38 = Math.sqrt(_local37);
_arg1[_local9].pointCount = 1;
_local10 = _arg1[_local9].points[0];
_local10.id.features.incidentEdge = _local7;
_local10.id.features.incidentVertex = _local25;
_local10.id.features.referenceEdge = _local7;
_local10.id.features.flip = 0;
_local10.separation = (_local38 - _local24);
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = (-(_local11) / _local38);
_local12 = (-(_local12) / _local38);
_arg1[_local9].normal.x = ((_local14.col1.x * _local11) + (_local14.col2.x * _local12));
_arg1[_local9].normal.y = ((_local14.col1.y * _local11) + (_local14.col2.y * _local12));
_local15 = (_local17 - (_local24 * _arg1[_local9].normal.x));
_local16 = (_local18 - (_local24 * _arg1[_local9].normal.y));
_local11 = (_local15 - _arg3.position.x);
_local12 = (_local16 - _arg3.position.y);
_local14 = _arg3.R;
_local10.localPoint1.x = ((_local11 * _local14.col1.x) + (_local12 * _local14.col1.y));
_local10.localPoint1.y = ((_local11 * _local14.col2.x) + (_local12 * _local14.col2.y));
_local11 = (_local15 - _arg5.position.x);
_local12 = (_local16 - _arg5.position.y);
_local14 = _arg5.R;
_local10.localPoint2.x = ((_local11 * _local14.col1.x) + (_local12 * _local14.col1.y));
_local10.localPoint2.y = ((_local11 * _local14.col2.x) + (_local12 * _local14.col2.y));
_local9++;
};
_local25++;
};
return (_local9);
};
if (_local23 < Number.MIN_VALUE){
_local8.pointCount = 1;
_local9 = 1;
if (_local22 == 0){
_local14 = _arg3.R;
_local8.normal.x = -(((_local14.col1.x * _local34) + (_local14.col2.x * _local35)));
_local8.normal.y = -(((_local14.col1.y * _local34) + (_local14.col2.y * _local35)));
} else {
_local13 = _arg2.m_normals[_local22];
_local14 = _arg3.R;
_local8.normal.x = ((_local14.col1.x * _local13.x) + (_local14.col2.x * _local13.y));
_local8.normal.y = ((_local14.col1.y * _local13.x) + (_local14.col2.y * _local13.y));
};
_local10 = _local8.points[0];
_local10.id.features.incidentEdge = _local22;
_local10.id.features.incidentVertex = _local7;
_local10.id.features.referenceEdge = 0;
_local10.id.features.flip = 0;
_local15 = (_local17 - (_local24 * _local8.normal.x));
_local16 = (_local18 - (_local24 * _local8.normal.y));
_local11 = (_local15 - _arg3.position.x);
_local12 = (_local16 - _arg3.position.y);
_local14 = _arg3.R;
_local10.localPoint1.x = ((_local11 * _local14.col1.x) + (_local12 * _local14.col1.y));
_local10.localPoint1.y = ((_local11 * _local14.col2.x) + (_local12 * _local14.col2.y));
_local11 = (_local15 - _arg5.position.x);
_local12 = (_local16 - _arg5.position.y);
_local14 = _arg5.R;
_local10.localPoint2.x = ((_local11 * _local14.col1.x) + (_local12 * _local14.col1.y));
_local10.localPoint2.y = ((_local11 * _local14.col2.x) + (_local12 * _local14.col2.y));
_local10.separation = (_local23 - _local24);
return (_local9);
};
var _local26:int = _local22;
var _local27:int = (((_local26 + 1) < _arg2.m_vertexCount)) ? (_local26 + 1) : 0;
var _local28:Number = (_arg2.m_vertices[_local27].x - _arg2.m_vertices[_local26].x);
var _local29:Number = (_arg2.m_vertices[_local27].y - _arg2.m_vertices[_local26].y);
var _local30:Number = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
if (_local30 < Number.MIN_VALUE){
_local11 = (_local19 - _arg2.m_vertices[_local26].x);
_local12 = (_local20 - _arg2.m_vertices[_local26].y);
_local21 = Math.sqrt(((_local11 * _local11) + (_local12 * _local12)));
_local11 = (_local11 / _local21);
_local12 = (_local12 / _local21);
if (_local21 > _local24){
_local9 = 0;
return (_local9);
};
_local8.pointCount = 1;
_local9 = 1;
_local14 = _arg3.R;
_local8.normal.x = ((_local14.col1.x * _local11) + (_local14.col2.x * _local12));
_local8.normal.y = ((_local14.col1.y * _local11) + (_local14.col2.y * _local12));
_local10 = _local8.points[0];
_local10.id.features.incidentEdge = _local7;
_local10.id.features.incidentVertex = _local26;
_local10.id.features.referenceEdge = _local7;
_local10.id.features.flip = 0;
_local15 = (_local17 - (_local24 * _local8.normal.x));
_local16 = (_local18 - (_local24 * _local8.normal.y));
_local11 = (_local15 - _arg3.position.x);
_local12 = (_local16 - _arg3.position.y);
_local14 = _arg3.R;
_local10.localPoint1.x = ((_local11 * _local14.col1.x) + (_local12 * _local14.col1.y));
_local10.localPoint1.y = ((_local11 * _local14.col2.x) + (_local12 * _local14.col2.y));
_local11 = (_local15 - _arg5.position.x);
_local12 = (_local16 - _arg5.position.y);
_local14 = _arg5.R;
_local10.localPoint2.x = ((_local11 * _local14.col1.x) + (_local12 * _local14.col1.y));
_local10.localPoint2.y = ((_local11 * _local14.col2.x) + (_local12 * _local14.col2.y));
_local10.separation = (_local21 - _local24);
return (_local9);
};
_local11 = (_local19 - _arg2.m_vertices[_local26].x);
_local12 = (_local20 - _arg2.m_vertices[_local26].y);
_local10 = _local8.points[0];
_local10.id.features.incidentEdge = 0;
_local10.id.features.incidentVertex = 0;
_local10.id.features.referenceEdge = 0;
_local10.id.features.flip = 0;
if (_local22 == 0){
_local39 = ((_local28 * _local34) + (_local29 * _local35));
if (((_local34 * _arg2.m_normals[0].x) + (_local35 * _arg2.m_normals[0].y)) > 0){
if (_local39 < 0){
_local31 = _arg2.m_vertices[_local26].x;
_local32 = _arg2.m_vertices[_local26].y;
_local10.id.features.incidentVertex = _local26;
_local10.id.features.incidentEdge = _local7;
} else {
_local31 = _arg2.m_vertices[_local27].x;
_local32 = _arg2.m_vertices[_local27].y;
_local10.id.features.incidentVertex = _local27;
_local10.id.features.incidentEdge = _local7;
};
} else {
if (_local39 <= -(_arg2.m_norm)){
_local31 = _arg2.m_vertices[_local26].x;
_local32 = _arg2.m_vertices[_local26].y;
_local10.id.features.incidentVertex = _local26;
_local10.id.features.incidentEdge = _local7;
} else {
if (_local39 >= _arg2.m_norm){
_local31 = _arg2.m_vertices[_local27].x;
_local32 = _arg2.m_vertices[_local27].y;
_local10.id.features.incidentVertex = _local27;
_local10.id.features.incidentEdge = _local7;
} else {
_local31 = (_arg2.m_arcCenter.x + (_local34 * _arg2.m_radius));
_local32 = (_arg2.m_arcCenter.y + (_local35 * _arg2.m_radius));
_local10.id.features.incidentEdge = _local26;
};
};
};
} else {
_local40 = ((_local11 * _local28) + (_local12 * _local29));
if (_local40 <= 0){
_local31 = _arg2.m_vertices[_local26].x;
_local32 = _arg2.m_vertices[_local26].y;
_local10.id.features.incidentVertex = _local26;
_local10.id.features.incidentEdge = _local7;
} else {
if (_local40 >= _local30){
_local31 = _arg2.m_vertices[_local27].x;
_local32 = _arg2.m_vertices[_local27].y;
_local10.id.features.incidentVertex = _local27;
_local10.id.features.incidentEdge = _local7;
} else {
_local31 = ((_local28 * _local40) + _arg2.m_vertices[_local26].x);
_local32 = ((_local29 * _local40) + _arg2.m_vertices[_local26].y);
_local10.id.features.incidentEdge = _local26;
};
};
};
_local11 = (_local19 - _local31);
_local12 = (_local20 - _local32);
_local21 = Math.sqrt(((_local11 * _local11) + (_local12 * _local12)));
_local11 = (_local11 / _local21);
_local12 = (_local12 / _local21);
if (_local21 > _local24){
_local9 = 0;
return (_local9);
};
_local8.pointCount = 1;
_local9 = 1;
_local14 = _arg3.R;
_local8.normal.x = ((_local14.col1.x * _local11) + (_local14.col2.x * _local12));
_local8.normal.y = ((_local14.col1.y * _local11) + (_local14.col2.y * _local12));
_local15 = (_local17 - (_local24 * _local8.normal.x));
_local16 = (_local18 - (_local24 * _local8.normal.y));
_local11 = (_local15 - _arg3.position.x);
_local12 = (_local16 - _arg3.position.y);
_local14 = _arg3.R;
_local10.localPoint1.x = ((_local11 * _local14.col1.x) + (_local12 * _local14.col1.y));
_local10.localPoint1.y = ((_local11 * _local14.col2.x) + (_local12 * _local14.col2.y));
_local11 = (_local15 - _arg5.position.x);
_local12 = (_local16 - _arg5.position.y);
_local14 = _arg5.R;
_local10.localPoint2.x = ((_local11 * _local14.col1.x) + (_local12 * _local14.col1.y));
_local10.localPoint2.y = ((_local11 * _local14.col2.x) + (_local12 * _local14.col2.y));
_local10.separation = (_local21 - _local24);
return (_local9);
}
}
}//package Box2D.Dynamics.Contacts
Section 42
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2Contact {
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_prev:b2Contact;
public var m_toi:Number;
public var m_next:b2Contact;
public var m_friction:Number;
public var m_manifoldCount:int;
public var m_node1:b2ContactEdge;
public var m_node2:b2ContactEdge;
public var m_restitution:Number;
public var m_flags:uint;
public static var e_toiFlag:uint = 8;
public static var e_nonSolidFlag:uint = 1;
public static var e_slowFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var s_registers:Array;
public static var s_initialized:Boolean = false;
public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){
m_node1 = new b2ContactEdge();
m_node2 = new b2ContactEdge();
super();
m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
m_shape1 = null;
m_shape2 = null;
return;
};
if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){
m_flags = (m_flags | e_nonSolidFlag);
};
m_shape1 = _arg1;
m_shape2 = _arg2;
m_manifoldCount = 0;
m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction));
m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution);
m_prev = null;
m_next = null;
m_node1.contact = null;
m_node1.prev = null;
m_node1.next = null;
m_node1.other = null;
m_node2.contact = null;
m_node2.prev = null;
m_node2.next = null;
m_node2.other = null;
}
public function IsSolid():Boolean{
return (((m_flags & e_nonSolidFlag) == 0));
}
public function GetShape1():b2Shape{
return (m_shape1);
}
public function GetShape2():b2Shape{
return (m_shape2);
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetManifoldCount():int{
return (m_manifoldCount);
}
public function GetManifolds():Array{
return (null);
}
public function Update(_arg1:b2ContactListener):void{
var _local2:int = m_manifoldCount;
Evaluate(_arg1);
var _local3:int = m_manifoldCount;
var _local4:b2Body = m_shape1.m_body;
var _local5:b2Body = 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 _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
var _local1:int;
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);
AddType(b2ConcaveArcAndCircleContact.Create, b2ConcaveArcAndCircleContact.Destroy, b2Shape.e_concaveArcShape, b2Shape.e_circleShape);
AddType(b2PolyAndConcaveArcContact.Create, b2PolyAndConcaveArcContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_concaveArcShape);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
if (_arg1.m_manifoldCount > 0){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
var _local3:int = _arg1.m_shape1.m_type;
var _local4:int = _arg1.m_shape2.m_type;
var _local5:b2ContactRegister = s_registers[_local3][_local4];
var _local6:Function = _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 _local8:b2Contact;
var _local9:int;
var _local10:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
var _local4:int = _arg1.m_type;
var _local5:int = _arg2.m_type;
var _local6:b2ContactRegister = s_registers[_local4][_local5];
var _local7:Function = _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 43
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var normal:b2Vec2;
public var restitution:Number;
public var body1:b2Body;
public var manifold:b2Manifold;
public var body2:b2Body;
public var friction:Number;
public var pointCount:int;
public function b2ContactConstraint(){
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 44
//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 tangentMass:Number;
public var equalizedMass: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 45
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2ContactEdge {
public var other:b2Body;
public var prev:b2ContactEdge;
public var contact:b2Contact;
public var next:b2ContactEdge;
}
}//package Box2D.Dynamics.Contacts
Section 46
//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 47
//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 position:b2Vec2;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var normalImpulse:Number;
public var normal:b2Vec2;
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 48
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactSolver {
public var m_constraintCount:int;
public var m_constraints:Array;
public var m_allocator;
public var m_step:b2TimeStep;
public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){
var _local5:b2Contact;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _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++;
};
var _local9:int;
_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 _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:b2ContactConstraintPoint;
var _local21:Number;
var _local22:Number;
var _local23:b2ContactConstraintPoint;
var _local5:int;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.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 _local3:b2Mat22;
var _local4:b2Vec2;
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;
var _local2:Number = 0;
var _local5:int;
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 _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;
var _local19:int;
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 _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
var _local1:int;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 49
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2NullContact extends b2Contact {
override public function Evaluate(_arg1:b2ContactListener):void{
}
override public function GetManifolds():Array{
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 50
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolyAndCircleContact extends b2Contact {
public var m_manifolds:Array;
public var m_manifold:b2Manifold;
public var m0:b2Manifold;
public static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape));
m_manifold.pointCount = 0;
var _local3:b2ManifoldPoint = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2ManifoldPoint;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local6:b2Body = m_shape1.m_body;
var _local7:b2Body = 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);
var _local8:Array = [false, false];
var _local9:b2ContactPoint = 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++;
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
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 51
//b2PolyAndConcaveArcContact (Box2D.Dynamics.Contacts.b2PolyAndConcaveArcContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolyAndConcaveArcContact extends b2PolygonContact {
private var m_arcManifolds:Array;
private var m_arcColl:Boolean;
public function b2PolyAndConcaveArcContact(_arg1:b2Shape, _arg2:b2Shape):void{
m_arcManifolds = [];
super(_arg1, _arg2);
}
private function enlargeManifolds(_arg1:Number):void{
var _local2:b2Manifold;
while (m_arcManifolds.length < _arg1) {
_local2 = new b2Manifold();
_local2.pointCount = 0;
_local2.points[0].normalImpulse = 0;
_local2.points[0].tangentImpulse = 0;
m_arcManifolds.push(_local2);
};
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Body;
var _local3:b2Body;
var _local5:int;
var _local6:int;
var _local7:b2Manifold;
var _local9:b2ManifoldPoint;
var _local10:b2ManifoldPoint;
var _local11:Number;
var _local16:b2PolygonShape;
var _local17:b2ConcaveArcShape;
var _local19:b2Vec2;
var _local20:b2Vec2;
var _local30:Boolean;
var _local31:b2Vec2;
var _local32:b2Vec2;
var _local33:*;
var _local34:*;
var _local35:*;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:*;
var _local40:Number;
var _local43:Number;
var _local44:Number;
var _local45:b2Vec2;
var _local46:Number;
var _local47:b2Vec2;
var _local48:b2Vec2;
var _local49:b2Vec2;
var _local50:b2Vec2;
var _local51:Number;
var _local52:Number;
var _local53:b2Vec2;
var _local54:Number;
var _local55:Number;
var _local56:b2Vec2;
var _local57:Number;
var _local58:Number;
var _local59:Number;
var _local60:Number;
var _local61:b2ManifoldPoint;
var _local62:*;
_local2 = m_shape1.m_body;
_local3 = m_shape2.m_body;
var _local4:uint = b2Collision.b2_nullFeature;
var _local8:Array = [];
if (!m_arcColl){
_local5 = 0;
while (_local5 < m_manifoldCount) {
_local6 = 0;
while (_local6 < m_manifolds[_local5].pointCount) {
_local10 = m_manifolds[_local5].points[_local6];
_local9 = new b2ManifoldPoint();
_local8[_local10.id.key] = _local9;
_local9.normalImpulse = _local10.normalImpulse;
_local9.tangentImpulse = _local10.tangentImpulse;
_local6++;
};
_local5++;
};
if ((((m_manifoldCount == 1)) && ((m_manifolds[0].pointCount == 1)))){
_local11 = m_manifolds[0].points[0].id.key;
} else {
_local11 = -1;
};
} else {
_local5 = 0;
while (_local5 < m_manifoldCount) {
_local6 = 0;
while (_local6 < m_arcManifolds[_local5].pointCount) {
_local10 = m_arcManifolds[_local5].points[_local6];
_local9 = new b2ManifoldPoint();
_local8[_local10.id.key] = _local9;
_local9.normalImpulse = _local10.normalImpulse;
_local9.tangentImpulse = _local10.tangentImpulse;
_local6++;
};
_local5++;
};
if ((((m_manifoldCount == 1)) && ((m_arcManifolds[0].pointCount == 1)))){
_local11 = m_arcManifolds[0].points[0].id.key;
} else {
_local11 = -1;
};
};
super.Evaluate(_arg1);
var _local12:Number = m_manifoldCount;
if (m_manifoldCount == 0){
return;
};
_local9 = m_manifolds[0].points[0];
var _local13:Features = _local9.id.features;
var _local14:Number = (_local13.flip) ? _local13.referenceEdge : _local13.incidentEdge;
var _local15:Number = -(Number.MAX_VALUE);
if ((((((m_manifoldCount == 1)) && (!((_local14 == 0))))) && ((_local9.separation < 0)))){
_local15 = _local9.separation;
};
_local16 = (m_shape1 as b2PolygonShape);
_local17 = (m_shape2 as b2ConcaveArcShape);
var _local18:Number = Number.MAX_VALUE;
_local19 = b2Math.b2MulXT(_local2.m_xf, b2Math.b2MulX(_local3.m_xf, _local17.m_arcCenter));
_local20 = b2Math.b2MulX(_local3.m_xf, _local17.m_vertices[0]);
var _local21:b2Vec2 = _local20.Copy();
_local20 = b2Math.b2MulXT(_local2.m_xf, _local20);
var _local22:b2Vec2 = b2Math.b2MulX(_local3.m_xf, _local17.m_vertices[1]);
var _local23:b2Vec2 = _local22.Copy();
_local22 = b2Math.b2MulXT(_local2.m_xf, _local22);
var _local24:b2Vec2 = b2Math.b2MulTMV(_local2.m_xf.R, b2Math.b2MulMV(_local3.m_xf.R, _local17.m_normals[0].Copy()));
var _local25:Array = [_local21, _local23];
var _local26:Array = [_local20, _local22];
var _local27:Boolean;
m_manifoldCount = 0;
var _local28:Array = [-1, -1];
var _local29:Array = [-1, -1];
if (_local14 == 0){
_local5 = 0;
while (_local5 < 2) {
_local43 = -(Number.MAX_VALUE);
_local44 = -1;
_local45 = _local26[_local5];
if (_local5 == 0){
_local47 = b2Math.b2MulTMV(_local2.m_xf.R, b2Math.b2MulMV(_local3.m_xf.R, _local17.m_normals[(_local17.m_vertexCount - 1)]));
_local48 = b2Math.SubtractVV(_local19, _local45);
_local48.Normalize();
} else {
_local48 = b2Math.b2MulTMV(_local2.m_xf.R, b2Math.b2MulMV(_local3.m_xf.R, _local17.m_normals[1]));
_local47 = b2Math.SubtractVV(_local19, _local45);
_local47.Normalize();
};
_local6 = 0;
while (_local6 < _local16.m_vertexCount) {
_local49 = _local16.m_vertices[_local6];
_local50 = _local16.m_normals[_local6];
if (((_local50.x * _local47.y) - (_local50.y * _local47.x)) < 0){
} else {
if (((_local50.x * _local48.y) - (_local50.y * _local48.x)) > 0){
} else {
_local51 = (_local45.x - _local49.x);
_local52 = (_local45.y - _local49.y);
_local46 = ((_local51 * _local50.x) + (_local52 * _local50.y));
if (_local46 > 0){
_local44 = -1;
break;
};
if (_local46 > _local43){
_local43 = _local46;
_local44 = _local6;
};
};
};
_local6++;
};
if (_local44 != -1){
_local50 = _local16.m_normals[_local44];
_local49 = _local16.m_vertices[_local44];
_local53 = _local16.m_vertices[(((_local44 + 1) < _local16.m_vertexCount)) ? (_local44 + 1) : 0];
_local54 = ((_local50.x * _local47.x) + (_local50.y * _local47.y));
_local55 = ((_local50.x * _local48.x) + (_local50.y * _local48.y));
if (_local54 < _local55){
_local56 = b2Math.b2CrossVF(_local47, 1);
} else {
_local56 = b2Math.b2CrossVF(_local48, -1);
};
_local57 = (((_local45.x - _local49.x) * _local50.x) + ((_local45.y - _local49.y) * _local50.y));
_local58 = ((_local56.x * _local50.x) + (_local56.y * _local50.y));
_local59 = (-(_local57) / _local58);
_local51 = (_local53.x - _local49.x);
_local52 = (_local53.y - _local49.y);
_local60 = ((((_local45.x + (_local59 * _local56.x)) - _local49.x) * _local51) + (((_local45.y + (_local59 * _local56.y)) - _local49.y) * _local52));
if ((((_local60 < 0)) || ((_local60 > ((_local51 * _local51) + (_local52 * _local52)))))){
_local44 = -1;
};
};
if (_local44 != -1){
_local29[_local5] = _local44;
if (_local5 == 0){
_local46 = (((_local53.x - _local45.x) * _local48.x) + ((_local53.y - _local45.y) * _local48.y));
if ((((_local43 < _local46)) && ((_local46 < 0)))){
_local28[_local5] = (((_local44 + 1) < _local16.m_vertexCount)) ? (_local44 + 1) : 0;
_local44 = -1;
};
} else {
_local46 = (((_local49.x - _local45.x) * _local47.x) + ((_local49.y - _local45.y) * _local47.y));
if ((((_local43 < _local46)) && ((_local46 < 0)))){
_local28[_local5] = _local44;
_local44 = -1;
};
};
};
if (_local44 != -1){
m_manifoldCount++;
enlargeManifolds(m_manifoldCount);
_local7 = m_arcManifolds[(m_manifoldCount - 1)];
_local7.pointCount = 1;
_local61 = _local7.points[0];
_local61.localPoint1.SetV(_local26[_local5]);
_local61.localPoint2.SetV(_local17.m_vertices[_local5]);
_local61.id.features.incidentEdge = _local4;
_local61.id.features.incidentVertex = _local5;
_local61.id.features.referenceEdge = _local44;
_local61.id.features.flip = 0;
_local61.separation = _local43;
_local61.normalImpulse = 0;
_local61.tangentImpulse = 0;
_local7.normal = b2Math.b2MulMV(_local2.m_xf.R, _local16.m_normals[_local44]);
_local18 = Math.min(_local18, _local61.separation);
};
_local5++;
};
};
if (_local29[1] == -1){
if (_local29[0] == -1){
_local38 = 1;
_local40 = 0;
} else {
_local38 = (_local16.m_vertexCount - 1);
_local40 = (((_local29[0] + 1) == _local16.m_vertexCount)) ? 0 : (_local29[0] + 1);
};
} else {
_local38 = 1;
_local40 = _local29[1];
};
var _local41:* = false;
_local39 = _local40;
do {
_local30 = true;
_local31 = _local16.m_vertices[_local39];
if (_local29[0] != -1){
_local37 = _local29[0];
_local32 = _local16.m_vertices[(((_local37 + 1) == _local16.m_vertexCount)) ? 0 : (_local37 + 1)];
_local30 = ((_local30) && (((((_local31.x - _local32.x) * _local16.m_normals[_local37].y) - ((_local31.y - _local32.y) * _local16.m_normals[_local37].x)) > 0)));
};
if (_local29[1] != -1){
_local37 = _local29[1];
_local32 = _local16.m_vertices[_local37];
_local30 = ((_local30) && (((((_local31.x - _local32.x) * _local16.m_normals[_local37].y) - ((_local31.y - _local32.y) * _local16.m_normals[_local37].x)) < 0)));
};
if (((_local41) && (!(_local30)))){
_local40 = ((_local39 + _local38) % _local16.m_vertexCount);
};
if (_local30){
_local41 = true;
};
_local31 = new b2Vec2((_local16.m_vertices[_local39].x - _local19.x), (_local16.m_vertices[_local39].y - _local19.y));
_local33 = ((_local31.x * _local31.x) + (_local31.y * _local31.y));
_local34 = Math.sqrt(_local33);
_local35 = (_local17.m_radius - _local34);
_local36 = (((_local16.m_vertices[_local39].x - _local20.x) * _local24.x) + ((_local16.m_vertices[_local39].y - _local20.y) * _local24.y));
_local46 = Math.max(_local35, _local36);
_local18 = Math.min(_local18, _local46);
_local30 = ((_local30) && ((_local46 < 0)));
if (((((_local30) || ((_local39 == _local28[0])))) || ((_local39 == _local28[1])))){
m_manifoldCount++;
enlargeManifolds(m_manifoldCount);
_local7 = m_arcManifolds[(m_manifoldCount - 1)];
_local7.pointCount = 1;
_local61 = _local7.points[0];
_local61.id.features.incidentEdge = _local4;
_local61.id.features.incidentVertex = _local39;
_local61.id.features.referenceEdge = 0;
_local61.id.features.flip = 0;
_local61.normalImpulse = 0;
_local61.tangentImpulse = 0;
_local31.x = (_local31.x / _local34);
_local31.y = (_local31.y / _local34);
_local62 = _local2.m_xf.R;
_local7.normal.x = ((_local62.col1.x * _local31.x) + (_local62.col2.x * _local31.y));
_local7.normal.y = ((_local62.col1.y * _local31.x) + (_local62.col2.y * _local31.y));
_local31 = _local16.m_vertices[_local39];
_local61.localPoint1.SetV(_local31);
_local61.localPoint2.SetV(b2Math.b2MulXT(_local3.m_xf, b2Math.b2MulX(_local2.m_xf, _local31)));
_local61.separation = (_local17.m_radius - _local34);
};
_local39 = ((_local39 + _local38) % _local16.m_vertexCount);
} while (_local39 != _local40);
var _local42:int = m_manifoldCount;
if (_local15 > _local18){
m_arcColl = false;
m_manifoldCount = _local12;
_local5 = 0;
while (_local5 < m_manifoldCount) {
_local6 = 0;
while (_local6 < m_manifolds[_local5].pointCount) {
_local9 = m_manifolds[_local5].points[_local6];
_local10 = _local8[_local9.id.key];
if (_local10){
_local9.normalImpulse = _local10.normalImpulse;
_local9.tangentImpulse = _local10.tangentImpulse;
};
_local6++;
};
_local5++;
};
if (((((!((_local11 == -1))) && ((m_manifoldCount == 1)))) && ((m_manifolds[0].pointCount == 1)))){
_local9 = m_manifolds[0].points[0];
_local10 = _local8[_local11];
if (_local10){
_local9.normalImpulse = _local10.normalImpulse;
_local9.tangentImpulse = _local10.tangentImpulse;
};
};
} else {
m_arcColl = true;
m_manifoldCount = _local42;
_local5 = 0;
while (_local5 < m_manifoldCount) {
_local6 = 0;
while (_local6 < m_arcManifolds[_local5].pointCount) {
_local9 = m_arcManifolds[_local5].points[_local6];
_local10 = _local8[_local9.id.key];
if (_local10){
_local9.normalImpulse = _local10.normalImpulse;
_local9.tangentImpulse = _local10.tangentImpulse;
};
_local6++;
};
_local5++;
};
if (((((!((_local11 == -1))) && ((m_manifoldCount == 1)))) && ((m_arcManifolds[0].pointCount == 1)))){
_local9 = m_arcManifolds[0].points[0];
_local10 = _local8[_local11];
if (_local10){
_local9.normalImpulse = _local10.normalImpulse;
_local9.tangentImpulse = _local10.tangentImpulse;
};
};
};
}
override public function GetManifolds():Array{
if (m_arcColl){
return (m_arcManifolds);
};
return (m_manifolds);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndConcaveArcContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 52
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolygonContact extends b2Contact {
public var m_manifolds:Array;
public var m0:b2Manifold;
public var m_manifold:b2Manifold;
public 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 Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local7:b2ContactPoint;
var _local8:int;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local5:b2Body = m_shape1.m_body;
var _local6:b2Body = 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);
var _local9:Array = [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++;
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
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 53
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2DistanceJoint extends b2Joint {
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_bias:Number;
public var m_gamma:Number;
public var m_u:b2Vec2;
public var m_mass:Number;
public var m_impulse:Number;
public var m_dampingRatio:Number;
public var m_frequencyHz: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 InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local8: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);
var _local7:Number = (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);
var _local9:Number = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6);
m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7);
var _local10:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y)));
if (_local10 > b2Settings.b2_linearSlop){
m_u.Multiply((1 / _local10));
} else {
m_u.SetZero();
};
var _local11:Number = ((_local6 * m_u.y) - (_local7 * m_u.x));
var _local12:Number = ((_local8 * m_u.y) - (_local9 * m_u.x));
var _local13:Number = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12));
m_mass = (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 GetReactionForce():b2Vec2{
var _local1:b2Vec2 = new b2Vec2();
_local1.SetV(m_u);
_local1.Multiply((m_inv_dt * m_impulse));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
if (m_frequencyHz > 0){
return (true);
};
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local1 = _local2.m_xf.R;
var _local4:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local5:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local6:Number = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5));
_local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5));
_local4 = _local6;
_local1 = _local3.m_xf.R;
var _local7:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local8:Number = (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;
var _local9:Number = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4);
var _local10:Number = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5);
var _local11:Number = Math.sqrt(((_local9 * _local9) + (_local10 * _local10)));
_local9 = (_local9 / _local11);
_local10 = (_local10 / _local11);
var _local12:Number = (_local11 - m_length);
_local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local13:Number = (-(m_mass) * _local12);
m_u.Set(_local9, _local10);
var _local14:Number = (_local13 * m_u.x);
var _local15:Number = (_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 SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
_local2 = _local3.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
var _local7:Number = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6));
_local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6));
_local5 = _local7;
_local2 = _local4.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6));
var _local11:Number = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5));
var _local12:Number = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9));
var _local13:Number = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8));
var _local14:Number = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11)));
var _local15:Number = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse)));
m_impulse = (m_impulse + _local15);
var _local16:Number = (_local15 * m_u.x);
var _local17:Number = (_local15 * m_u.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16))));
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17));
_local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
}
}
}//package Box2D.Dynamics.Joints
Section 54
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2DistanceJointDef extends b2JointDef {
public var localAnchor1:b2Vec2;
public var length:Number;
public var dampingRatio:Number;
public var localAnchor2:b2Vec2;
public var frequencyHz:Number;
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{
body1 = _arg1;
body2 = _arg2;
localAnchor1.SetV(body1.GetLocalPoint(_arg3));
localAnchor2.SetV(body2.GetLocalPoint(_arg4));
var _local5:Number = (_arg4.x - _arg3.x);
var _local6:Number = (_arg4.y - _arg3.y);
length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
frequencyHz = 0;
dampingRatio = 0;
}
}
}//package Box2D.Dynamics.Joints
Section 55
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2GearJoint extends b2Joint {
public var m_ground2:b2Body;
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_revolute2:b2RevoluteJoint;
public var m_force:Number;
public var m_mass:Number;
public var m_prismatic2:b2PrismaticJoint;
public var m_ground1:b2Body;
public var m_revolute1:b2RevoluteJoint;
public var m_prismatic1:b2PrismaticJoint;
public var m_constant:Number;
public var m_J:b2Jacobian;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local4:Number;
var _local5:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_J = new b2Jacobian();
super(_arg1);
var _local2:int = _arg1.joint1.m_type;
var _local3:int = _arg1.joint2.m_type;
m_revolute1 = null;
m_prismatic1 = null;
m_revolute2 = null;
m_prismatic2 = null;
m_ground1 = _arg1.joint1.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 InitVelocityConstraints(_arg1:b2TimeStep):void{
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 _local15:Number;
var _local2:b2Body = m_ground1;
var _local3:b2Body = m_ground2;
var _local4:b2Body = m_body1;
var _local5:b2Body = m_body2;
var _local14:Number = 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 = m_body2.m_xf.R;
var _local2:Number = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x);
var _local3:Number = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y);
var _local4:Number = ((_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);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local4:Number;
var _local5:Number;
var _local1:Number = 0;
var _local2:b2Body = m_body1;
var _local3:b2Body = 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();
};
var _local6:Number = (m_constant - (_local4 + (m_ratio * _local5)));
var _local7:Number = (-(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));
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local5:Number = ((-(_arg1.inv_dt) * m_mass) * _local4);
m_force = (m_force + _local5);
var _local6:Number = (_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 56
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef)
package Box2D.Dynamics.Joints {
public class b2GearJointDef extends b2JointDef {
public var joint1:b2Joint;
public var joint2:b2Joint;
public var ratio:Number;
public function b2GearJointDef(){
type = b2Joint.e_gearJoint;
joint1 = null;
joint2 = null;
ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 57
//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 angular1:Number;
public var angular2: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 58
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2Joint {
public var m_islandFlag:Boolean;
public var m_body1:b2Body;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_type:int;
public var m_collideConnected:Boolean;
public var m_node1:b2JointEdge;
public var m_node2:b2JointEdge;
public var m_inv_dt:Number;
public var m_userData;
public var m_body2:b2Body;
public static const e_unknownJoint:int = 0;
public static const e_inactiveLimit:int = 0;
public static const e_atUpperLimit:int = 2;
public static const e_atLowerLimit:int = 1;
public static const e_gearJoint:int = 6;
public static const e_revoluteJoint:int = 1;
public static const e_equalLimits:int = 3;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_prismaticJoint:int = 2;
public static const e_mouseJoint:int = 5;
public function b2Joint(_arg1:b2JointDef){
m_node1 = new b2JointEdge();
m_node2 = new b2JointEdge();
super();
m_type = _arg1.type;
m_prev = null;
m_next = null;
m_body1 = _arg1.body1;
m_body2 = _arg1.body2;
m_collideConnected = _arg1.collideConnected;
m_islandFlag = false;
m_userData = _arg1.userData;
}
public function GetBody2():b2Body{
return (m_body2);
}
public function GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetType():int{
return (m_type);
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
}
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;
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 59
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointDef {
public var body2:b2Body;
public var type:int;
public var userData;
public var collideConnected:Boolean;
public var body1:b2Body;
public function b2JointDef(){
type = b2Joint.e_unknownJoint;
userData = null;
body1 = null;
body2 = null;
collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 60
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointEdge {
public var other:b2Body;
public var next:b2JointEdge;
public var prev:b2JointEdge;
public var joint:b2Joint;
}
}//package Box2D.Dynamics.Joints
Section 61
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2MouseJoint extends b2Joint {
private var K1:b2Mat22;
private var K:b2Mat22;
public var m_beta:Number;
public var m_mass:b2Mat22;
private var K2:b2Mat22;
public var m_target:b2Vec2;
public var m_gamma:Number;
public var m_impulse:b2Vec2;
public var m_C:b2Vec2;
public var m_localAnchor:b2Vec2;
public var m_maxForce:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
var _local3: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);
var _local2:Number = (m_target.x - m_body2.m_xf.position.x);
_local3 = (m_target.y - m_body2.m_xf.position.y);
var _local4:b2Mat22 = 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();
var _local5:Number = m_body2.m_mass;
var _local6:Number = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
var _local7:Number = (((2 * _local5) * _arg1.dampingRatio) * _local6);
var _local8:Number = ((_arg1.timeStep * _local5) * (_local6 * _local6));
m_gamma = (1 / (_local7 + _local8));
m_beta = (_local8 / (_local7 + _local8));
}
public function SetTarget(_arg1:b2Vec2):void{
if (m_body2.IsSleeping()){
m_body2.WakeUp();
};
m_target = _arg1;
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local7:Number;
var _local8: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);
var _local6:Number = ((_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);
var _local9:Number = (_arg1.dt * m_impulse.x);
var _local10:Number = (_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 GetAnchor1():b2Vec2{
return (m_target);
}
override public function GetReactionTorque():Number{
return (0);
}
override public function GetReactionForce():b2Vec2{
return (m_impulse);
}
override public function SolvePositionConstraints():Boolean{
return (true);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local2:b2Body = m_body2;
_local3 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7));
_local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7));
_local6 = _local4;
var _local8:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7));
var _local9:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6));
_local3 = m_mass;
_local4 = ((_local8 + ((m_beta * _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));
var _local10:Number = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)));
var _local11:Number = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)));
var _local12:Number = m_impulse.x;
var _local13:Number = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
var _local14:Number = m_impulse.Length();
if (_local14 > m_maxForce){
m_impulse.Multiply((m_maxForce / _local14));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
var _local15:Number = (_arg1.dt * _local10);
var _local16:Number = (_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 62
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2MouseJointDef extends b2JointDef {
public var timeStep:Number;
public var target:b2Vec2;
public var maxForce:Number;
public var dampingRatio:Number;
public var frequencyHz: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 63
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PrismaticJoint extends b2Joint {
public var m_limitForce:Number;
public var m_lowerTranslation:Number;
public var m_localXAxis1:b2Vec2;
public var m_refAngle:Number;
public var m_torque:Number;
public var m_motorForce:Number;
public var m_enableLimit:Boolean;
public var m_angularMass:Number;
public var m_maxMotorForce:Number;
public var m_localYAxis1:b2Vec2;
public var m_force:Number;
public var m_motorMass:Number;
public var m_upperTranslation:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_limitState:int;
public var m_linearMass:Number;
public var m_motorJacobian:b2Jacobian;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_enableMotor:Boolean;
public var m_linearJacobian:b2Jacobian;
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 SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local6:Number;
var _local8:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = _local2.m_invMass;
var _local5:Number = _local3.m_invMass;
_local6 = _local2.m_invI;
var _local7:Number = _local3.m_invI;
var _local9:Number = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local10:Number = ((-(_arg1.inv_dt) * m_linearMass) * _local9);
m_force = (m_force + _local10);
var _local11:Number = (_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));
var _local12:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity);
var _local13:Number = ((-(_arg1.inv_dt) * m_angularMass) * _local12);
m_torque = (m_torque + _local13);
var _local14:Number = (_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));
};
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function GetUpperLimit():Number{
return (m_upperTranslation);
}
public function GetLowerLimit():Number{
return (m_lowerTranslation);
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetJointTranslation():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
var _local4:b2Vec2 = _local1.GetWorldPoint(m_localAnchor1);
var _local5:b2Vec2 = _local2.GetWorldPoint(m_localAnchor2);
var _local6:Number = (_local5.x - _local4.x);
var _local7:Number = (_local5.y - _local4.y);
var _local8:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local9:Number = ((_local8.x * _local6) + (_local8.y * _local7));
return (_local9);
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Mat22 = m_body1.m_xf.R;
var _local2:Number = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y)));
var _local3:Number = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y)));
var _local4:Number = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y)));
var _local5:Number = (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 _local9:b2Mat22;
var _local10:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = _local3.m_invMass;
var _local6:Number = _local4.m_invMass;
var _local7:Number = _local3.m_invI;
var _local8:Number = _local4.m_invI;
_local9 = _local3.m_xf.R;
var _local11:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local12:Number = (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;
var _local13:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local14:Number = (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;
var _local15:Number = (_local3.m_sweep.c.x + _local11);
var _local16:Number = (_local3.m_sweep.c.y + _local12);
var _local17:Number = (_local4.m_sweep.c.x + _local13);
var _local18:Number = (_local4.m_sweep.c.y + _local14);
var _local19:Number = (_local17 - _local15);
var _local20:Number = (_local18 - _local16);
_local9 = _local3.m_xf.R;
var _local21:Number = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
var _local22:Number = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
var _local23:Number = ((_local21 * _local19) + (_local22 * _local20));
_local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local24:Number = (-(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));
var _local25:Number = b2Math.b2Abs(_local23);
var _local26:Number = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle);
_local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
var _local27:Number = (-(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();
var _local28:Number = 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 SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetJointSpeed():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_xf.R;
var _local4:Number = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
var _local5:Number = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local3 = _local2.m_xf.R;
var _local7:Number = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8));
_local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8));
_local7 = _local6;
var _local9:Number = (_local1.m_sweep.c.x + _local4);
var _local10:Number = (_local1.m_sweep.c.y + _local5);
var _local11:Number = (_local2.m_sweep.c.x + _local7);
var _local12:Number = (_local2.m_sweep.c.y + _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = (_local12 - _local10);
var _local15:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local16:b2Vec2 = _local1.m_linearVelocity;
var _local17:b2Vec2 = _local2.m_linearVelocity;
var _local18:Number = _local1.m_angularVelocity;
var _local19:Number = _local2.m_angularVelocity;
var _local20:Number = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4)))));
return (_local20);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local10:Number = _local2.m_invMass;
var _local11:Number = _local3.m_invMass;
var _local12:Number = _local2.m_invI;
var _local13:Number = _local3.m_invI;
_local4 = _local2.m_xf.R;
var _local14:Number = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y));
var _local15:Number = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y));
var _local16:Number = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x);
var _local17:Number = ((_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 EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
public function SetMaxMotorForce(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
override public function GetReactionTorque():Number{
return (m_torque);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerTranslation = _arg1;
m_upperTranslation = _arg2;
}
}
}//package Box2D.Dynamics.Joints
Section 64
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PrismaticJointDef extends b2JointDef {
public var motorSpeed:Number;
public var localAxis1:b2Vec2;
public var referenceAngle:Number;
public var upperTranslation:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public var maxMotorForce:Number;
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 65
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PulleyJoint extends b2Joint {
public var m_limitState1:int;
public var m_limitState2:int;
public var m_ground:b2Body;
public var m_maxLength2:Number;
public var m_maxLength1:Number;
public var m_limitPositionImpulse1:Number;
public var m_limitPositionImpulse2:Number;
public var m_force:Number;
public var m_constant:Number;
public var m_positionImpulse: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_limitMass1:Number;
public var m_limitMass2:Number;
public var m_pulleyMass:Number;
public var m_u1:b2Vec2;
public var m_limitForce1:Number;
public var m_limitForce2:Number;
public var m_u2:b2Vec2;
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 = 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 = m_u2.Copy();
_local1.Multiply(m_force);
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local3:b2Mat22;
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 _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
var _local4:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local5:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local6:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local7:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
var _local23:Number = 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 _local4:b2Mat22;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (_local2.m_sweep.c.x + _local5);
var _local11:Number = (_local2.m_sweep.c.y + _local6);
var _local12:Number = (_local3.m_sweep.c.x + _local8);
var _local13:Number = (_local3.m_sweep.c.y + _local9);
var _local14:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local15:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local16:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local17:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
m_u1.Set((_local10 - _local14), (_local11 - _local15));
m_u2.Set((_local12 - _local16), (_local13 - _local17));
var _local18:Number = m_u1.Length();
var _local19:Number = m_u2.Length();
if (_local18 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local18));
} else {
m_u1.SetZero();
};
if (_local19 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local19));
} else {
m_u2.SetZero();
};
var _local20:Number = ((m_constant - _local18) - (m_ratio * _local19));
if (_local20 > 0){
m_state = e_inactiveLimit;
m_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;
};
var _local21:Number = ((_local5 * m_u1.y) - (_local6 * m_u1.x));
var _local22:Number = ((_local8 * m_u2.y) - (_local9 * m_u2.x));
m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21));
m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22));
m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2));
m_limitMass1 = (1 / m_limitMass1);
m_limitMass2 = (1 / m_limitMass2);
m_pulleyMass = (1 / m_pulleyMass);
if (_arg1.warmStarting){
_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);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local8: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 _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
if (m_state == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13))));
_local19 = ((-(_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 = m_body1.GetWorldPoint(m_localAnchor1);
var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local4:Number = (_local1.x - _local2);
var _local5:Number = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetLength2():Number{
var _local1:b2Vec2 = m_body2.GetWorldPoint(m_localAnchor2);
var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
var _local4:Number = (_local1.x - _local2);
var _local5:Number = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetGroundAnchor1():b2Vec2{
var _local1:b2Vec2 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor1);
return (_local1);
}
}
}//package Box2D.Dynamics.Joints
Section 66
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PulleyJointDef extends b2JointDef {
public var maxLength1:Number;
public var maxLength2:Number;
public var length1:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var groundAnchor1:b2Vec2;
public var groundAnchor2:b2Vec2;
public var ratio:Number;
public var length2:Number;
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{
body1 = _arg1;
body2 = _arg2;
groundAnchor1.SetV(_arg3);
groundAnchor2.SetV(_arg4);
localAnchor1 = body1.GetLocalPoint(_arg5);
localAnchor2 = body2.GetLocalPoint(_arg6);
var _local8:Number = (_arg5.x - _arg3.x);
var _local9:Number = (_arg5.y - _arg3.y);
length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
var _local10:Number = (_arg6.x - _arg4.x);
var _local11:Number = (_arg6.y - _arg4.y);
length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
ratio = _arg7;
var _local12:Number = (length1 + (ratio * length2));
maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength));
maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio);
}
}
}//package Box2D.Dynamics.Joints
Section 67
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2RevoluteJoint extends b2Joint {
public var m_limitForce:Number;
public var m_pivotMass:b2Mat22;
public var m_motorForce:Number;
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_enableMotor:Boolean;
public var m_referenceAngle:Number;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_upperAngle:Number;
public var m_lowerAngle:Number;
public var m_maxMotorTorque: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 SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local10:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local11:Number = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7));
var _local12:Number = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6));
var _local13:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12)));
var _local14:Number = (-(_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);
var _local15:Number = (_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));
};
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function GetUpperLimit():Number{
return (m_upperAngle);
}
public function GetLowerLimit():Number{
return (m_lowerAngle);
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
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 _local6:b2Mat22;
var _local25:Number;
var _local26:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = 0;
_local6 = _local3.m_xf.R;
var _local7:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
var _local9:Number = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8));
_local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8));
_local7 = _local9;
_local6 = _local4.m_xf.R;
var _local10:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local11:Number = (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;
var _local12:Number = (_local3.m_sweep.c.x + _local7);
var _local13:Number = (_local3.m_sweep.c.y + _local8);
var _local14:Number = (_local4.m_sweep.c.x + _local10);
var _local15:Number = (_local4.m_sweep.c.y + _local11);
var _local16:Number = (_local14 - _local12);
var _local17:Number = (_local15 - _local13);
_local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17)));
var _local18:Number = _local3.m_invMass;
var _local19:Number = _local4.m_invMass;
var _local20:Number = _local3.m_invI;
var _local21:Number = _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));
var _local22:Number = tImpulse.x;
var _local23:Number = 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();
var _local24:Number = 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 SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
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));
}
public function GetMotorTorque():Number{
return (m_motorForce);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local7:Number;
var _local14:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local10:Number = _local2.m_invMass;
var _local11:Number = _local3.m_invMass;
var _local12:Number = _local2.m_invI;
var _local13:Number = _local3.m_invI;
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;
}
override public function GetReactionTorque():Number{
return (m_limitForce);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerAngle = _arg1;
m_upperAngle = _arg2;
}
}
}//package Box2D.Dynamics.Joints
Section 68
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2RevoluteJointDef extends b2JointDef {
public var upperAngle:Number;
public var enableMotor:Boolean;
public var referenceAngle:Number;
public var motorSpeed:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var lowerAngle:Number;
public var maxMotorTorque:Number;
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 69
//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_xf:b2XForm;
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_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_shapeCount:int;
public var m_angularDamping:Number;
public var m_invI:Number;
public var m_linearVelocity:b2Vec2;
public var m_sleepTime:Number;
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){
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);
var _local3:b2Mat22 = m_xf.R;
var _local4:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_jointList = null;
m_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{
m_xf.R.Set(m_sweep.a);
var _local1:b2Mat22 = m_xf.R;
var _local2:b2Vec2 = m_sweep.localCenter;
m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y)));
m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y)));
}
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;
if (m_world.m_lock == true){
return;
};
m_mass = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:b2MassData = 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);
var _local5:b2Mat22 = m_xf.R;
var _local6:b2Vec2 = 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;
};
var _local7:int = 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 _local7:Boolean;
if (m_world.m_lock == true){
return (true);
};
if (IsFrozen()){
return (false);
};
m_xf.R.Set(_arg2);
m_xf.position.SetV(_arg1);
var _local4:b2Mat22 = m_xf.R;
var _local5:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y));
m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_sweep.a0 = (m_sweep.a = _arg2);
var _local6:Boolean;
_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 _local4:b2Shape;
var _local1:b2XForm = s_xf1;
_local1.R.Set(m_sweep.a0);
var _local2:b2Mat22 = _local1.R;
var _local3:b2Vec2 = m_sweep.localCenter;
_local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y)));
_local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y)));
var _local5:Boolean;
_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 GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = m_xf.R;
var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x)))));
}
public function GetNext():b2Body{
return (m_next);
}
public function GetMass():Number{
return (m_mass);
}
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 GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SetMass(_arg1:b2MassData):void{
var _local2:b2Shape;
var _local4:b2Vec2;
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);
var _local3:b2Mat22 = 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;
};
var _local5:int = 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{
if (m_world.m_lock == true){
return (null);
};
var _local2:b2Shape = 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 = 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{
if (m_world.m_lock == true){
return;
};
_arg1.DestroyProxy(m_world.m_broadPhase);
var _local2:b2Shape = m_shapeList;
var _local3:Boolean;
while (_local2 != null) {
if (_local2 == _arg1){
_local2 = _arg1.m_next;
_local3 = true;
break;
};
_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 = m_xf.R;
var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (_local3);
}
public function GetWorld():b2World{
return (m_world);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
}
}//package Box2D.Dynamics
Section 70
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class b2BodyDef {
public var angularDamping:Number;
public var angle:Number;
public var isSleeping:Boolean;
public var position:b2Vec2;
public var isBullet:Boolean;
public var allowSleep:Boolean;
public var userData;
public var fixedRotation:Boolean;
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 71
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 72
//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 = _arg1.GetFilterData();
var _local4:b2FilterData = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
var _local5:Boolean = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
}
}//package Box2D.Dynamics
Section 73
//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 74
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
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 PairRemoved(_arg1, _arg2, _arg3):void{
if (_arg3 == null){
return;
};
var _local4:b2Contact = (_arg3 as b2Contact);
if (_local4 == m_nullContact){
return;
};
Destroy(_local4);
}
public function Destroy(_arg1:b2Contact):void{
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;
var _local2:b2Shape = _arg1.m_shape1;
var _local3:b2Shape = _arg1.m_shape2;
var _local4:int = _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;
};
var _local5:b2Body = _local2.m_body;
var _local6:b2Body = _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--;
}
override public function PairAdded(_arg1, _arg2){
var _local3:b2Shape = (_arg1 as b2Shape);
var _local4:b2Shape = (_arg2 as b2Shape);
var _local5:b2Body = _local3.m_body;
var _local6:b2Body = _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);
};
var _local7:b2Contact = 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);
}
public function Collide():void{
var _local2:b2Body;
var _local3:b2Body;
var _local1:b2Contact = 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 75
//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;// = 1
public var m_drawFlags:uint;
public var m_drawScale:Number;// = 1
public var m_sprite:Sprite;
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_drawFlags = 0;
}
public function DrawPolyline(_arg1:Array, _arg2:int, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
var _local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
}
public function DrawConcaveArc(_arg1:Array, _arg2:int, _arg3:b2Vec2, _arg4:b2Color){
m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
var _local5:Number = 16;
var _local6:Number = (_arg1[0].x - _arg3.x);
var _local7:Number = (_arg1[0].y - _arg3.y);
var _local8:Number = Math.atan2(_local7, _local6);
var _local9:Number = Math.atan2((_arg1[1].y - _arg3.y), (_arg1[1].x - _arg3.x));
var _local10:Number = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
while (_local9 > _local8) {
_local9 = (_local9 - (Math.PI * 2));
};
var _local11:Number = ((_local8 - _local9) / _local5);
var _local12:Number = _local8;
while (_local12 > _local9) {
m_sprite.graphics.lineTo(((_arg3.x + (_local10 * Math.cos(_local12))) * m_drawScale), ((_arg3.y + (_local10 * Math.sin(_local12))) * m_drawScale));
_local12 = (_local12 - _local11);
};
var _local13 = 1;
while (_local13 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local13].x * m_drawScale), (_arg1[_local13].y * m_drawScale));
_local13++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
}
public function DrawSolidConcaveArc(_arg1:Array, _arg2:int, _arg3:b2Vec2, _arg4:b2Color){
m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha);
var _local5:Number = 16;
var _local6:Number = (_arg1[0].x - _arg3.x);
var _local7:Number = (_arg1[0].y - _arg3.y);
var _local8:Number = Math.atan2(_local7, _local6);
var _local9:Number = Math.atan2((_arg1[1].y - _arg3.y), (_arg1[1].x - _arg3.x));
var _local10:Number = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
while (_local9 > _local8) {
_local9 = (_local9 - (Math.PI * 2));
};
var _local11:Number = ((_local8 - _local9) / _local5);
var _local12:Number = _local8;
while (_local12 > _local9) {
m_sprite.graphics.lineTo(((_arg3.x + (_local10 * Math.cos(_local12))) * m_drawScale), ((_arg3.y + (_local10 * Math.sin(_local12))) * m_drawScale));
_local12 = (_local12 - _local11);
};
var _local13 = 1;
while (_local13 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local13].x * m_drawScale), (_arg1[_local13].y * m_drawScale));
_local13++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.endFill();
}
public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha);
var _local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.endFill();
}
public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
}
public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha);
m_sprite.graphics.moveTo(0, 0);
m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
m_sprite.graphics.endFill();
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale));
}
public function 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 SetFlags(_arg1:uint):void{
m_drawFlags = _arg1;
}
public function DrawCurve(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2, _arg4:b2Color):void{
var _local5:Number = 16;
var _local6:Number = (_arg1.x - _arg3.x);
var _local7:Number = (_arg1.y - _arg3.y);
var _local8:Number = Math.atan2(_local7, _local6);
var _local9:Number = Math.atan2((_arg2.y - _arg3.y), (_arg2.x - _arg3.x));
var _local10:Number = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
while (_local9 < _local8) {
_local9 = (_local9 + (Math.PI * 2));
};
var _local11:Number = ((_local9 - _local8) / _local5);
m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha);
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
var _local12:Number = _local8;
while (_local12 <= _local9) {
m_sprite.graphics.lineTo(((_arg3.x + (_local10 * Math.cos(_local12))) * m_drawScale), ((_arg3.y + (_local10 * Math.sin(_local12))) * m_drawScale));
_local12 = (_local12 + _local11);
};
}
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{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
var _local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
}
}
}//package Box2D.Dynamics
Section 76
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Joints.*;
public class b2DestructionListener {
public function SayGoodbyeShape(_arg1:b2Shape):void{
}
public function SayGoodbyeJoint(_arg1:b2Joint):void{
}
}
}//package Box2D.Dynamics
Section 77
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2Island {
public var m_listener:b2ContactListener;
public var m_positionIterationCount:int;
public var m_bodyCapacity:int;
public var m_bodies:Array;
public var m_joints: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 _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;
};
var _local4:int;
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 AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{
var _local5:int;
var _local6:b2Body;
var _local7:b2Joint;
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y))));
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_force.SetZero();
_local6.m_torque = 0;
_local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity);
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity);
};
if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity);
} else {
_local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity;
};
};
};
_local5++;
};
var _local8:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local8.InitVelocityConstraints(_arg1);
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitVelocityConstraints(_arg1);
_local5++;
};
_local5 = 0;
while (_local5 < _arg1.maxIterations) {
_local8.SolveVelocityConstraints();
_local9 = 0;
while (_local9 < m_jointCount) {
_local7 = m_joints[_local9];
_local7.SolveVelocityConstraints(_arg1);
_local9++;
};
_local5++;
};
_local8.FinalizeVelocityConstraints();
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_sweep.c0.SetV(_local6.m_sweep.c);
_local6.m_sweep.a0 = _local6.m_sweep.a;
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y));
_local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity));
_local6.SynchronizeTransform();
};
_local5++;
};
if (_arg3){
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitPositionConstraints();
_local5++;
};
m_positionIterationCount = 0;
while (m_positionIterationCount < _arg1.maxIterations) {
_local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local11 = true;
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local12 = _local7.SolvePositionConstraints();
_local11 = ((_local11) && (_local12));
_local5++;
};
if (((_local10) && (_local11))){
break;
};
m_positionIterationCount++;
};
};
Report(_local8.m_constraints);
if (_arg4){
_local13 = Number.MAX_VALUE;
_local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.m_invMass == 0){
} else {
if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){
_local6.m_sleepTime = 0;
_local13 = 0;
};
if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){
_local6.m_sleepTime = 0;
_local13 = 0;
} else {
_local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt);
_local13 = b2Math.b2Min(_local13, _local6.m_sleepTime);
};
};
_local5++;
};
if (_local13 >= b2Settings.b2_timeToSleep){
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag);
_local6.m_linearVelocity.SetZero();
_local6.m_angularVelocity = 0;
_local5++;
};
};
};
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:int;
var _local5:b2Body;
var _local6:Boolean;
var _local3:b2ContactSolver = 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++;
};
var _local4:Number = 0.75;
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local6 = _local3.SolvePositionConstraints(_local4);
if (_local6){
break;
};
_local2++;
};
Report(_local3.m_constraints);
}
}
}//package Box2D.Dynamics
Section 78
//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 79
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2World {
public var m_inv_dt0:Number;
public var m_boundaryListener:b2BoundaryListener;
public var m_contactList:b2Contact;
public var m_blockAllocator;
public var m_contactListener:b2ContactListener;
public var m_allowSleep:Boolean;
public var m_broadPhase:b2BroadPhase;
public var m_destructionListener:b2DestructionListener;
public var m_jointCount:int;
public var m_bodyCount:int;
public var m_lock:Boolean;
public var m_positionIterationCount:int;
public var m_groundBody:b2Body;
public var m_contactCount:int;
public var m_debugDraw:b2DebugDraw;
public var m_contactFilter:b2ContactFilter;
public var m_bodyList:b2Body;
public var m_stackAllocator;
public var m_jointList:b2Joint;
public var m_gravity:b2Vec2;
public var m_contactManager:b2ContactManager;
private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8);
public static var m_continuousPhysics:Boolean;
public static var m_warmStarting:Boolean;
private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6);
public static var m_positionCorrection:Boolean;
private static var s_xf:b2XForm = new b2XForm();
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
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);
var _local4:b2BodyDef = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function DrawJoint(_arg1:b2Joint):void{
var _local11:b2PulleyJoint;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local2:b2Body = _arg1.m_body1;
var _local3:b2Body = _arg1.m_body2;
var _local4:b2XForm = _local2.m_xf;
var _local5:b2XForm = _local3.m_xf;
var _local6:b2Vec2 = _local4.position;
var _local7:b2Vec2 = _local5.position;
var _local8:b2Vec2 = _arg1.GetAnchor1();
var _local9:b2Vec2 = _arg1.GetAnchor2();
var _local10:b2Color = s_jointColor;
switch (_arg1.m_type){
case b2Joint.e_distanceJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
case b2Joint.e_pulleyJoint:
_local11 = (_arg1 as b2PulleyJoint);
_local12 = _local11.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 _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
var _local5:b2Joint;
var _local6:b2BroadPhase;
var _local11:b2XForm;
var _local15:Boolean;
var _local16:uint;
var _local17:b2Pair;
var _local18:b2Proxy;
var _local19:b2Proxy;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:b2Proxy;
var _local23:b2PolygonShape;
var _local24:b2OBB;
var _local25:b2Vec2;
var _local26:b2Mat22;
var _local27:b2Vec2;
var _local28:Number;
if (m_debugDraw == null){
return;
};
m_debugDraw.m_sprite.graphics.clear();
var _local1:uint = m_debugDraw.GetFlags();
var _local7:b2Vec2 = new b2Vec2();
var _local8:b2Vec2 = new b2Vec2();
var _local9:b2Vec2 = new b2Vec2();
var _local10:b2Color = new b2Color(0, 0, 0);
var _local12:b2AABB = new b2AABB();
var _local13:b2AABB = new b2AABB();
var _local14:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
if ((_local1 & b2DebugDraw.e_shapeBit)){
_local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local3.IsStatic()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15);
} else {
if (_local3.IsSleeping()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15);
} else {
DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15);
};
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_jointBit)){
_local5 = m_jointList;
while (_local5) {
DrawJoint(_local5);
_local5 = _local5.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local6 = m_broadPhase;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.9, 0.3);
_local2 = 0;
while (_local2 < b2Pair.b2_tableCapacity) {
_local16 = _local6.m_pairManager.m_hashTable[_local2];
while (_local16 != b2Pair.b2_nullPair) {
_local17 = _local6.m_pairManager.m_pairs[_local16];
_local18 = _local6.m_proxyPool[_local17.proxyId1];
_local19 = _local6.m_proxyPool[_local17.proxyId2];
_local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value));
_local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value));
_local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value));
_local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value));
_local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value));
_local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value));
_local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value));
_local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value));
_local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x));
_local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y));
_local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x));
_local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y));
m_debugDraw.DrawSegment(_local8, _local9, _local10);
_local16 = _local17.next;
};
_local2++;
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local6 = m_broadPhase;
_local20 = _local6.m_worldAABB.lowerBound;
_local21 = _local6.m_worldAABB.upperBound;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.3, 0.9);
_local2 = 0;
while (_local2 < b2Settings.b2_maxProxies) {
_local22 = _local6.m_proxyPool[_local2];
if (_local22.IsValid() == false){
} else {
_local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value));
_local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value));
_local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value));
_local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value));
_local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y);
_local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y);
_local14[2].Set(_local12.upperBound.x, _local12.upperBound.y);
_local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y);
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local2++;
};
_local14[0].Set(_local20.x, _local20.y);
_local14[1].Set(_local21.x, _local20.y);
_local14[2].Set(_local21.x, _local21.y);
_local14[3].Set(_local20.x, _local21.y);
m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9));
};
if ((_local1 & b2DebugDraw.e_obbBit)){
_local10.Set(0.5, 0.3, 0.5);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local4.m_type != b2Shape.e_polygonShape){
} else {
_local23 = (_local4 as b2PolygonShape);
_local24 = _local23.GetOBB();
_local25 = _local24.extents;
_local14[0].Set(-(_local25.x), -(_local25.y));
_local14[1].Set(_local25.x, -(_local25.y));
_local14[2].Set(_local25.x, _local25.y);
_local14[3].Set(-(_local25.x), _local25.y);
_local2 = 0;
while (_local2 < 4) {
_local26 = _local24.R;
_local27 = _local14[_local2];
_local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local26 = _local11.R;
_local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local2++;
};
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_centerOfMassBit)){
_local3 = m_bodyList;
while (_local3) {
_local11 = s_xf;
_local11.R = _local3.m_xf.R;
_local11.position = _local3.GetWorldCenter();
m_debugDraw.DrawXForm(_local11);
_local3 = _local3.m_next;
};
};
}
public function DestroyBody(_arg1:b2Body):void{
var _local4:b2JointEdge;
var _local5:b2Shape;
if (m_lock == true){
return;
};
var _local2:b2JointEdge = _arg1.m_jointList;
while (_local2) {
_local4 = _local2;
_local2 = _local2.next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeJoint(_local4.joint);
};
DestroyJoint(_local4.joint);
};
var _local3:b2Shape = _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 _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;
var _local16:b2ConcaveArcShape;
var _local5:b2Color = 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;
case b2Shape.e_concaveArcShape:
_local16 = (_arg1 as b2ConcaveArcShape);
_local12 = _local16.GetVertexCount();
_local13 = _local16.GetVertices();
_local7 = b2Math.b2MulX(_arg2, _local16.m_arcCenter);
_local14 = new Array(b2Settings.b2_maxPolygonVertices);
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]);
_local10++;
};
m_debugDraw.DrawSolidConcaveArc(_local14, _local12, _local7, _arg3);
if (_arg4){
_local15 = _local16.GetCoreVertices();
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]);
_local10++;
};
m_debugDraw.DrawConcaveArc(_local14, _local12, _local7, _local5);
};
break;
};
}
public function GetContactCount():int{
return (m_contactCount);
}
public function Solve(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local9:int;
var _local10:int;
var _local11:b2Body;
var _local12:b2ContactEdge;
var _local13:b2JointEdge;
var _local14:Boolean;
m_positionIterationCount = 0;
var _local3:b2Island = 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;
};
var _local4:b2Contact = m_contactList;
while (_local4) {
_local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag));
_local4 = _local4.m_next;
};
var _local5:b2Joint = m_jointList;
while (_local5) {
_local5.m_islandFlag = false;
_local5 = _local5.m_next;
};
var _local6:int = m_bodyCount;
var _local7:Array = new Array(_local6);
var _local8:b2Body = 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 = new Array(_arg3);
var _local5:int = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
var _local6:int;
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 _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;
var _local8:b2Island = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener);
var _local9:int = m_bodyCount;
var _local10:Array = 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 GetBodyList():b2Body{
return (m_bodyList);
}
public function GetPairCount():int{
return (m_broadPhase.m_pairManager.m_pairCount);
}
public function Validate():void{
m_broadPhase.Validate();
}
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 _local3:b2Body;
var _local4:b2Shape;
var _local2:b2Joint = 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 _local5:b2Body;
var _local6:b2Shape;
var _local2:Boolean = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_jointList){
m_jointList = _arg1.m_next;
};
var _local3:b2Body = _arg1.m_body1;
var _local4:b2Body = _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{
if (m_lock == true){
return (null);
};
var _local2:b2Body = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
public function SetBoundaryListener(_arg1:b2BoundaryListener):void{
m_boundaryListener = _arg1;
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function Step(_arg1:Number, _arg2:int):void{
m_lock = true;
var _local3:b2TimeStep = 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 80
//Pnt (com.actionsnippet.geom.Pnt)
package com.actionsnippet.geom {
public class Pnt {
public var x:Number;
public var y:Number;
public function Pnt(_arg1:Number, _arg2:Number){
this.x = _arg1;
this.y = _arg2;
}
}
}//package com.actionsnippet.geom
Section 81
//Triangulate (com.actionsnippet.geom.Triangulate)
package com.actionsnippet.geom {
public class Triangulate {
private const EPSILON:Number = 1E-10;
private function snip(_arg1:Array, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:Array):Boolean{
var _local7:int;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local8 = _arg1[_arg6[_arg2]].x;
_local9 = _arg1[_arg6[_arg2]].y;
_local10 = _arg1[_arg6[_arg3]].x;
_local11 = _arg1[_arg6[_arg3]].y;
_local12 = _arg1[_arg6[_arg4]].x;
_local13 = _arg1[_arg6[_arg4]].y;
if (EPSILON > (((_local10 - _local8) * (_local13 - _local9)) - ((_local11 - _local9) * (_local12 - _local8)))){
return (false);
};
_local7 = 0;
while (_local7 < _arg5) {
if ((((((_local7 == _arg2)) || ((_local7 == _arg3)))) || ((_local7 == _arg4)))){
} else {
_local14 = _arg1[_arg6[_local7]].x;
_local15 = _arg1[_arg6[_local7]].y;
if (insideTriangle(_local8, _local9, _local10, _local11, _local12, _local13, _local14, _local15)){
return (false);
};
};
_local7++;
};
return (true);
}
public function insideTriangle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):Boolean{
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;
_local9 = (_arg5 - _arg3);
_local10 = (_arg6 - _arg4);
_local11 = (_arg1 - _arg5);
_local12 = (_arg2 - _arg6);
_local13 = (_arg3 - _arg1);
_local14 = (_arg4 - _arg2);
_local15 = (_arg7 - _arg1);
_local16 = (_arg8 - _arg2);
_local17 = (_arg7 - _arg3);
_local18 = (_arg8 - _arg4);
_local19 = (_arg7 - _arg5);
_local20 = (_arg8 - _arg6);
_local23 = ((_local9 * _local18) - (_local10 * _local17));
_local21 = ((_local13 * _local16) - (_local14 * _local15));
_local22 = ((_local11 * _local20) - (_local12 * _local19));
return ((((((_local23 >= 0)) && ((_local22 >= 0)))) && ((_local21 >= 0))));
}
public function area(_arg1:Array):Number{
var _local2:int = _arg1.length;
var _local3:Number = 0;
var _local4:int = (_local2 - 1);
var _local5:int;
while (_local5 < _local2) {
_local3 = (_local3 + ((_arg1[_local4].x * _arg1[_local5].y) - (_arg1[_local5].x * _arg1[_local4].y)));
var _temp1 = _local5;
_local5 = (_local5 + 1);
_local4 = _temp1;
};
return ((_local3 * 0.5));
}
public function process(_arg1:Array):Array{
var _local5:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:int;
var _local2:Array = [];
var _local3:int = _arg1.length;
if (_local3 < 3){
return (null);
};
var _local4:Array = [];
if (0 < area(_arg1)){
_local5 = 0;
while (_local5 < _local3) {
_local4[_local5] = _local5;
_local5++;
};
} else {
_local5 = 0;
while (_local5 < _local3) {
_local4[_local5] = ((_local3 - 1) - _local5);
_local5++;
};
};
var _local6:int = _local3;
var _local7:int = (2 * _local6);
_local8 = 0;
_local5 = (_local6 - 1);
while (_local6 > 2) {
var _temp1 = _local7;
_local7 = (_local7 - 1);
if (0 >= _temp1){
return (null);
};
_local9 = _local5;
if (_local6 <= _local9){
_local9 = 0;
};
_local5 = (_local9 + 1);
if (_local6 <= _local5){
_local5 = 0;
};
_local10 = (_local5 + 1);
if (_local6 <= _local10){
_local10 = 0;
};
if (snip(_arg1, _local9, _local5, _local10, _local6, _local4)){
_local11 = _local4[_local9];
_local12 = _local4[_local5];
_local13 = _local4[_local10];
_local2.push(_arg1[_local11]);
_local2.push(_arg1[_local12]);
_local2.push(_arg1[_local13]);
_local8++;
_local14 = _local5;
_local15 = (_local5 + 1);
while (_local15 < _local6) {
_local4[_local14] = _local4[_local15];
_local14++;
_local15++;
};
_local6--;
_local7 = (2 * _local6);
};
};
return (_local2);
}
}
}//package com.actionsnippet.geom
Section 82
//BoxObject (com.actionsnippet.qbox.objects.BoxObject)
package com.actionsnippet.qbox.objects {
import flash.display.*;
import com.actionsnippet.qbox.*;
import flash.events.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class BoxObject extends QuickObject {
public function BoxObject(_arg1:QuickBox2D, _arg2:Object){
super(_arg1, _arg2);
}
override protected function build():void{
var p:Object;
var hw:Number;
var hh:Number;
var t:Number;
p = params;
if ((p.skin is DisplayObject)){
bodyDef.userData = p.skin;
t = p.skin.rotation;
p.skin.rotation = 0;
if (!p.width){
p.width = (p.skin.width / 30);
};
if (!p.height){
p.height = (p.skin.height / 30);
};
p.skin.rotation = t;
};
if (!p.width){
p.width = 1;
};
if (!p.height){
p.height = 1;
};
var boxDef:b2PolygonDef = new b2PolygonDef();
shapeDef = boxDef;
hw = (p.width / 2);
hh = (p.height / 2);
boxDef.SetAsBox(hw, hh);
boxDef.density = p.density;
boxDef.friction = p.friction;
boxDef.restitution = p.restitution;
boxDef.filter.maskBits = p.maskBits;
boxDef.filter.categoryBits = p.categoryBits;
boxDef.filter.groupIndex = p.groupIndex;
if ((p.skin is Class)){
bodyDef.userData = new p.skin();
} else {
if ((p.skin is DisplayObject)){
} else {
if (p.skin != "none"){
bodyDef.userData = new Sprite();
var _local2 = bodyDef.userData.graphics;
with (_local2) {
lineStyle(p.lineThickness, p.lineColor, p.lineAlpha);
beginFill(p.fillColor, p.fillAlpha);
hw = (hw * 30);
hh = (hh * 30);
drawRect(-(hw), -(hh), (p.width * 30), (p.height * 30));
};
};
};
};
body = w.CreateBody(bodyDef);
shape = body.CreateShape(boxDef);
}
override protected function defaultParams(_arg1:Object):void{
}
}
}//package com.actionsnippet.qbox.objects
Section 83
//CircleObject (com.actionsnippet.qbox.objects.CircleObject)
package com.actionsnippet.qbox.objects {
import flash.display.*;
import com.actionsnippet.qbox.*;
import flash.events.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class CircleObject extends QuickObject {
public function CircleObject(_arg1:QuickBox2D, _arg2:Object){
super(_arg1, _arg2);
}
override protected function build():void{
var p:Object;
var circDef:b2CircleDef;
p = params;
circDef = new b2CircleDef();
shapeDef = circDef;
if ((p.skin is DisplayObject)){
bodyDef.userData = p.skin;
if (!p.radius){
p.radius = (p.skin.width / 60);
};
};
if (!p.radius){
p.radius = 0.5;
};
circDef.radius = p.radius;
circDef.density = p.density;
circDef.friction = p.friction;
circDef.restitution = p.restitution;
circDef.filter.maskBits = p.maskBits;
circDef.filter.categoryBits = p.categoryBits;
circDef.filter.groupIndex = p.groupIndex;
if ((p.skin is Class)){
bodyDef.userData = new p.skin();
} else {
if ((p.skin is DisplayObject)){
} else {
if (p.skin != "none"){
bodyDef.userData = new Sprite();
var _local2 = bodyDef.userData.graphics;
with (_local2) {
lineStyle(p.lineThickness, p.lineColor, p.lineAlpha);
beginFill(p.fillColor, p.fillAlpha);
drawCircle(0, 0, (p.radius * 30));
};
};
};
};
body = w.CreateBody(bodyDef);
shape = body.CreateShape(circDef);
}
override protected function defaultParams(_arg1:Object):void{
}
}
}//package com.actionsnippet.qbox.objects
Section 84
//ConcaveArcObject (com.actionsnippet.qbox.objects.ConcaveArcObject)
package com.actionsnippet.qbox.objects {
import flash.display.*;
import com.actionsnippet.qbox.*;
import flash.events.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import com.actionsnippet.geom.*;
public class ConcaveArcObject extends QuickObject {
public static var tri:Triangulate = new Triangulate();
public function ConcaveArcObject(_arg1:QuickBox2D, _arg2:Object){
super(_arg1, _arg2);
}
override protected function build():void{
var p:Object;
var i:int;
var inc:int;
var leng:int;
var poly:Array;
var pnts:Array;
var p1:Pnt;
var p2:Pnt;
var p3:Pnt;
var polyDef:b2ConcaveArcDef;
p = params;
if (p.points){
poly = p.points;
pnts = [];
inc = 0;
leng = (poly.length - 2);
i = 0;
while (i < leng) {
pnts[inc] = new Pnt(poly[i], poly[(i + 1)]);
inc = (inc + 1);
i = (i + 2);
};
poly = ConcaveArcObject.tri.process(pnts);
inc = 0;
p.verts = [];
leng = poly.length;
i = 0;
while (i < leng) {
p1 = poly[i];
p2 = poly[(i + 1)];
p3 = poly[(i + 2)];
p.verts[inc] = [p1.x, p1.y, p2.x, p2.y, p3.x, p3.y];
inc = (inc + 1);
i = (i + 3);
};
pnts = p.points;
};
var autoSkin:Boolean;
if ((p.skin is Class)){
bodyDef.userData = new p.skin();
} else {
if ((p.skin is DisplayObject)){
bodyDef.userData = p.skin;
} else {
if (p.skin != "none"){
bodyDef.userData = new Sprite();
autoSkin = true;
if (p.points){
var _local2 = bodyDef.userData.graphics;
with (_local2) {
lineStyle(p.lineThickness, p.lineColor, p.lineAlpha);
beginFill(p.fillColor, p.fillAlpha);
moveTo((pnts[0] * 30), (pnts[1] * 30));
i = 2;
while (i < (pnts.length - 2)) {
lineTo((pnts[i] * 30), (pnts[(i + 1)] * 30));
i = (i + 2);
};
endFill();
};
};
};
};
};
body = w.CreateBody(bodyDef);
shapeDef = [];
var j:int;
while (j < p.verts.length) {
polyDef = new b2ConcaveArcDef();
shapeDef.push(polyDef);
polyDef.vertexCount = int((p.verts[j].length / 2));
if ((p.verts[j][i] is b2Vec2)){
polyDef.vertices = p.verts[j];
} else {
inc = 0;
i = 0;
while (i < p.verts[j].length) {
polyDef.vertices[inc].Set(p.verts[j][i], p.verts[j][(i + 1)]);
inc = (inc + 1);
i = (i + 2);
};
};
polyDef.radius = p.radius;
polyDef.density = p.density;
polyDef.friction = p.friction;
polyDef.restitution = p.restitution;
polyDef.filter.maskBits = p.maskBits;
polyDef.filter.categoryBits = p.categoryBits;
polyDef.filter.groupIndex = p.groupIndex;
if (((autoSkin) && (p.wireframe))){
_local2 = bodyDef.userData.graphics;
with (_local2) {
lineStyle(p.lineThickness, p.lineColor, p.lineAlpha);
beginFill(p.fillColor, p.fillAlpha);
};
i = 0;
while (i < polyDef.vertexCount) {
_local2 = bodyDef.userData.graphics;
with (_local2) {
if (i == 0){
moveTo((polyDef.vertices[i].x * 30), (polyDef.vertices[i].y * 30));
} else {
lineTo((polyDef.vertices[i].x * 30), (polyDef.vertices[i].y * 30));
};
};
i = (i + 1);
};
bodyDef.userData.graphics.endFill();
};
shape = body.CreateShape(polyDef);
j = (j + 1);
};
}
override protected function defaultParams(_arg1:Object):void{
_arg1.verts = [[-0.5, -1, 1, -1, 1, 1, -1, 1]];
_arg1.wireframe = true;
}
}
}//package com.actionsnippet.qbox.objects
Section 85
//GroupObject (com.actionsnippet.qbox.objects.GroupObject)
package com.actionsnippet.qbox.objects {
import flash.display.*;
import com.actionsnippet.qbox.*;
import flash.events.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class GroupObject extends QuickObject {
public function GroupObject(_arg1:QuickBox2D, _arg2:Object){
super(_arg1, _arg2);
}
override protected function build():void{
var _local3:QuickObject;
var _local4:*;
var _local5:int;
var _local6:b2PolygonDef;
var _local7:Number;
var _local8:int;
var _local9:DisplayObject;
var _local1:Object = params;
body = qbox.w.CreateBody(bodyDef);
if ((_local1.skin is Class)){
bodyDef.userData = new _local1.skin();
bodyDef.userData.width = (_local1.width * 30);
bodyDef.userData.height = (_local1.height * 30);
} else {
if ((_local1.skin is DisplayObject)){
bodyDef.userData = _local1.skin;
} else {
if (_local1.skin != "none"){
bodyDef.userData = new Sprite();
};
};
};
body.m_userData = bodyDef.userData;
var _local2:int;
while (_local2 < _local1.objects.length) {
_local3 = _local1.objects[_local2];
_local4 = _local3.shapeDef;
if ((_local4 is b2ShapeDef)){
if ((_local4 is b2CircleDef)){
_local4.localPosition.Set(_local3.x, _local3.y);
} else {
if ((_local4 is b2PolygonDef)){
_local4.SetAsOrientedBox((_local3.params.width / 2), (_local3.params.height / 2), new b2Vec2(_local3.x, _local3.y), _local3.angle);
};
};
body.CreateShape(_local4);
} else {
if ((_local4 is Array)){
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5];
_local7 = (_local3.params.verts[_local5].length / 2);
_local8 = 0;
while (_local8 < _local7) {
_local6.vertices[_local8].Add(new b2Vec2(_local3.x, _local3.y));
_local8++;
};
body.CreateShape(_local6);
_local5++;
};
};
};
if ((((_local3.userData is DisplayObject)) && (!(_local1.skin)))){
_local9 = _local3.userData;
_local9.x = (_local3.x * 30);
_local9.y = (_local3.y * 30);
_local9.rotation = ((_local3.angle / Math.PI) * 180);
_local3.fullDestroy();
body.m_userData.addChild(_local9);
} else {
_local3.fullDestroy();
};
_local2++;
};
body.SetMassFromShapes();
}
override protected function defaultParams(_arg1:Object):void{
_arg1.objects = [];
}
}
}//package com.actionsnippet.qbox.objects
Section 86
//JointObject (com.actionsnippet.qbox.objects.JointObject)
package com.actionsnippet.qbox.objects {
import flash.display.*;
import com.actionsnippet.qbox.*;
import flash.events.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class JointObject extends QuickObject {
private var jointDef:b2JointDef;
public function JointObject(_arg1:QuickBox2D, _arg2:Object){
super(_arg1, _arg2);
}
private function buildPrismaticJoint(_arg1:Object):void{
var _local2:b2Vec2 = new b2Vec2(0, 1);
var _local3:b2Vec2 = _arg1.a.GetWorldCenter();
if (_arg1.anchor){
_local3 = _arg1.anchor;
} else {
if (((!(_arg1.x1)) && (!(_arg1.y1)))){
_arg1.x1 = _local3.x;
_arg1.y1 = _local3.y;
} else {
_local3.x = _arg1.x1;
_local3.y = _arg1.y1;
};
};
if (_arg1.axis){
_local2 = _arg1.axis;
} else {
if (((!(_arg1.x2)) && (!(_arg1.y2)))){
_arg1.x1 = _local2.x;
_arg1.y1 = _local2.y;
} else {
_local2.x = _arg1.x1;
_local2.y = _arg1.y1;
};
};
jointDef = new b2PrismaticJointDef();
jointDef.userData = null;
var _local4:b2PrismaticJointDef = b2PrismaticJointDef(jointDef);
_local4.Initialize(_arg1.a, _arg1.b, _local3, _local2);
_local4.referenceAngle = _arg1.referenceAngle;
_local4.enableLimit = _arg1.enableLimit;
_local4.upperTranslation = _arg1.upperTranslation;
_local4.lowerTranslation = _arg1.lowerTranslation;
_local4.enableMotor = _arg1.enableMotor;
_local4.motorSpeed = _arg1.motorSpeed;
_local4.maxMotorForce = _arg1.maxMotorForce;
}
private function buildPullyJoint(_arg1:Object):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2Vec2;
if (_arg1.anchor1){
_local4 = _arg1.anchor1;
} else {
_local4 = _arg1.a.GetWorldCenter();
};
if (_arg1.anchor2){
_local5 = _arg1.anchor2;
} else {
_local5 = _arg1.b.GetWorldCenter();
};
if (_arg1.groundAnchor1){
_local2 = _arg1.groundAnchor1;
} else {
_local2 = new b2Vec2(_local4.x, 0);
};
if (_arg1.groundAnchor2){
_local3 = _arg1.groundAnchor2;
} else {
_local3 = new b2Vec2(_local5.x, 0);
};
jointDef = new b2PulleyJointDef();
jointDef.userData = null;
var _local6:b2PulleyJointDef = b2PulleyJointDef(jointDef);
_local6.Initialize(_arg1.a, _arg1.b, _local2, _local3, _local4, _local5, _arg1.ratio);
if (_arg1.maxLength1){
_local6.maxLength1 = _arg1.maxLength1;
};
if (_arg1.maxLength2){
_local6.maxLength2 = _arg1.maxLength2;
};
if (_arg1.length1){
_local6.length1 = _arg1.length1;
};
if (_arg1.length2){
_local6.length2 = _arg1.length2;
};
}
override public function get userData(){
return (jointDef.userData);
}
override protected function defaultParams(_arg1:Object):void{
_arg1.a = null;
_arg1.b = null;
_arg1.frequencyHz = 0;
_arg1.dampingRatio = 0;
_arg1.length = null;
_arg1.collideConnected = true;
_arg1.referenceAngle = 0;
_arg1.enableLimit = false;
_arg1.upperAngle = 0;
_arg1.lowerAngle = 0;
_arg1.enableMotor = false;
_arg1.motorSpeed = 0;
_arg1.maxMotorTorque = 0;
_arg1.lowerTranslation = 0;
_arg1.upperTrasnlation = 0;
_arg1.maxMotorForce = 0;
_arg1.ratio = 1;
}
private function buildRevoluteJoint(_arg1:Object):void{
var _local2:b2Vec2;
_local2 = _arg1.a.GetWorldCenter();
if (((!(_arg1.x1)) && (!(_arg1.y1)))){
_arg1.x1 = _local2.x;
_arg1.y1 = _local2.y;
} else {
_local2.x = _arg1.x1;
_local2.y = _arg1.y1;
};
if (_arg1.vecA == null){
_arg1.vecA = _local2;
};
if (_arg1.anchor){
_arg1.vecA = _arg1.anchor;
};
jointDef = new b2RevoluteJointDef();
jointDef.userData = null;
var _local3:b2RevoluteJointDef = b2RevoluteJointDef(jointDef);
_local3.Initialize(_arg1.a, _arg1.b, _arg1.vecA);
_local3.referenceAngle = _arg1.referenceAngle;
_local3.enableLimit = _arg1.enableLimit;
_local3.upperAngle = _arg1.upperAngle;
_local3.lowerAngle = _arg1.lowerAngle;
_local3.enableMotor = _arg1.enableMotor;
_local3.motorSpeed = _arg1.motorSpeed;
_local3.maxMotorTorque = _arg1.maxMotorTorque;
}
override public function set userData(_arg1){
jointDef.userData = _arg1;
}
private function buildGearJoint(_arg1:Object):void{
jointDef = new b2GearJointDef();
var _local2:b2GearJointDef = b2GearJointDef(jointDef);
_local2.userData = null;
_local2.body1 = _arg1.a;
_local2.body2 = _arg1.b;
_local2.joint1 = _arg1.joint1;
_local2.joint2 = _arg1.joint2;
_local2.ratio = _arg1.ratio;
}
override protected function build():void{
var _local1:Object = params;
if ((((_local1.a == null)) || ((_local1.b == null)))){
throw (new Error("your jointDef must have b2Body instances for its a and b properties"));
};
if ((((_local1.type == null)) || ((_local1.type == "distance")))){
buildDistanceJoint(_local1);
} else {
if (_local1.type == "revolute"){
buildRevoluteJoint(_local1);
} else {
if (_local1.type == "prismatic"){
buildPrismaticJoint(_local1);
} else {
if (_local1.type == "pulley"){
buildPullyJoint(_local1);
} else {
if (_local1.type == "gear"){
buildGearJoint(_local1);
};
};
};
};
};
if (_local1.skin){
userData = new _local1.skin();
if (!(userData is MovieClip)){
throw (new Error("Sorry, joint skins must be dynamic. If you're using a Sprite, just use a MovieClip instead."));
};
userData.startWidth = userData.width;
userData.startHeight = userData.height;
userData.p = params;
} else {
if (_local1.skin == "none"){
userData = params;
} else {
userData = params;
};
};
jointDef.collideConnected = _local1.collideConnected;
joint = w.CreateJoint(jointDef);
}
private function buildDistanceJoint(_arg1:Object):void{
var _local2:b2Vec2;
if (((!(_arg1.x1)) && (!(_arg1.y1)))){
_local2 = _arg1.a.GetWorldCenter();
_arg1.x1 = _local2.x;
_arg1.y1 = _local2.y;
};
if (((!(_arg1.x2)) && (!(_arg1.y2)))){
_local2 = _arg1.b.GetWorldCenter();
_arg1.x2 = _local2.x;
_arg1.y2 = _local2.y;
};
if (_arg1.vecA == null){
_arg1.vecA = new b2Vec2(_arg1.x1, _arg1.y1);
};
if (_arg1.vecB == null){
_arg1.vecB = new b2Vec2(_arg1.x2, _arg1.y2);
};
jointDef = new b2DistanceJointDef();
var _local3:b2DistanceJointDef = b2DistanceJointDef(jointDef);
_local3.Initialize(_arg1.a, _arg1.b, _arg1.vecA, _arg1.vecB);
_local3.frequencyHz = _arg1.frequencyHz;
_local3.dampingRatio = _arg1.dampingRatio;
if (_arg1.length){
_local3.length = _arg1.length;
};
}
}
}//package com.actionsnippet.qbox.objects
Section 87
//PolyObject (com.actionsnippet.qbox.objects.PolyObject)
package com.actionsnippet.qbox.objects {
import flash.display.*;
import com.actionsnippet.qbox.*;
import flash.events.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import com.actionsnippet.geom.*;
public class PolyObject extends QuickObject {
public static var tri:Triangulate = new Triangulate();
public function PolyObject(_arg1:QuickBox2D, _arg2:Object){
super(_arg1, _arg2);
}
override protected function build():void{
var p:Object;
var i:int;
var inc:int;
var leng:int;
var poly:Array;
var pnts:Array;
var p1:Pnt;
var p2:Pnt;
var p3:Pnt;
var polyDef:b2PolygonDef;
p = params;
if (p.points){
poly = p.points;
pnts = [];
inc = 0;
leng = (poly.length - 2);
i = 0;
while (i < leng) {
pnts[inc] = new Pnt(poly[i], poly[(i + 1)]);
inc = (inc + 1);
i = (i + 2);
};
poly = PolyObject.tri.process(pnts);
inc = 0;
p.verts = [];
leng = poly.length;
i = 0;
while (i < leng) {
p1 = poly[i];
p2 = poly[(i + 1)];
p3 = poly[(i + 2)];
p.verts[inc] = [p1.x, p1.y, p2.x, p2.y, p3.x, p3.y];
inc = (inc + 1);
i = (i + 3);
};
pnts = p.points;
};
var autoSkin:Boolean;
if ((p.skin is Class)){
bodyDef.userData = new p.skin();
} else {
if ((p.skin is DisplayObject)){
bodyDef.userData = p.skin;
} else {
if (p.skin != "none"){
bodyDef.userData = new Sprite();
autoSkin = true;
if (p.points){
var _local2 = bodyDef.userData.graphics;
with (_local2) {
lineStyle(p.lineThickness, p.lineColor, p.lineAlpha);
beginFill(p.fillColor, p.fillAlpha);
moveTo((pnts[0] * 30), (pnts[1] * 30));
i = 2;
while (i < (pnts.length - 2)) {
lineTo((pnts[i] * 30), (pnts[(i + 1)] * 30));
i = (i + 2);
};
endFill();
};
};
};
};
};
body = w.CreateBody(bodyDef);
shapeDef = [];
var j:int;
while (j < p.verts.length) {
polyDef = new b2PolygonDef();
shapeDef.push(polyDef);
polyDef.vertexCount = int((p.verts[j].length / 2));
if ((p.verts[j][i] is b2Vec2)){
polyDef.vertices = p.verts[j];
} else {
inc = 0;
i = 0;
while (i < p.verts[j].length) {
polyDef.vertices[inc].Set(p.verts[j][i], p.verts[j][(i + 1)]);
inc = (inc + 1);
i = (i + 2);
};
};
polyDef.density = p.density;
polyDef.friction = p.friction;
polyDef.restitution = p.restitution;
polyDef.filter.maskBits = p.maskBits;
polyDef.filter.categoryBits = p.categoryBits;
polyDef.filter.groupIndex = p.groupIndex;
if (((autoSkin) && (p.wireframe))){
_local2 = bodyDef.userData.graphics;
with (_local2) {
lineStyle(p.lineThickness, p.lineColor, p.lineAlpha);
beginFill(p.fillColor, p.fillAlpha);
};
i = 0;
while (i < polyDef.vertexCount) {
_local2 = bodyDef.userData.graphics;
with (_local2) {
if (i == 0){
moveTo((polyDef.vertices[i].x * 30), (polyDef.vertices[i].y * 30));
} else {
lineTo((polyDef.vertices[i].x * 30), (polyDef.vertices[i].y * 30));
};
};
i = (i + 1);
};
bodyDef.userData.graphics.endFill();
};
shape = body.CreateShape(polyDef);
j = (j + 1);
};
}
override protected function defaultParams(_arg1:Object):void{
_arg1.verts = [[-0.5, -1, 1, -1, 1, 1, -1, 1]];
_arg1.wireframe = true;
}
}
}//package com.actionsnippet.qbox.objects
Section 88
//QuickBox2D (com.actionsnippet.qbox.QuickBox2D)
package com.actionsnippet.qbox {
import flash.display.*;
import flash.events.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import flash.utils.*;
import com.actionsnippet.qbox.objects.*;
public class QuickBox2D extends EventDispatcher {
private var _mouseJoint:b2MouseJoint;
private var _currTime:Number;
private var _mouseX:Number;
private var _gravity:b2Vec2;
private var render:Event;
private var _mouseY:Number;
private var timeStepCallbacks:Array;
private var _elapsedTime:Number;
private var _defaults:Object;
public var iterations:int;// = 20
public var main:MovieClip;
private var _renderJoints:Boolean;// = true
public var timeStep:Number;// = 0.0166666666666667
private var _quickObjects:Dictionary;
private var _simpleRender:Boolean;// = true
private var _mousePVec:b2Vec2;
private var step:Event;
var dragging:Boolean;// = false
var debug:Boolean;
var destroyable:Array;
private var _accumulator:Number;// = 0
public var frim:Boolean;
private var contactListener:b2ContactListener;
private var _customMouse:Boolean;// = false
public var totalTimeSteps:int;// = 0
public var w:b2World;
public var worldAABB:b2AABB;
private var _prevTime:Number;// = 0
public static var REVOLUTE:String = "revolute";
public static var PRISMATIC:String = "prismatic";
public static var GEAR:String = "gear";
public static var STEP:String = "step";
public static var DISTANCE:String = "distance";
public static var PULLEY:String = "pulley";
public function QuickBox2D(_arg1:MovieClip, _arg2:Object=null){
_defaults = new Object();
_mousePVec = new b2Vec2();
_quickObjects = new Dictionary(true);
destroyable = [];
render = new Event("render");
step = new Event("step");
timeStepCallbacks = [];
super();
this.main = _arg1;
init(_arg2);
}
public function mouseDrag():void{
var _local1:QuickObject;
dragging = true;
for each (_local1 in _quickObjects) {
_local1.handCursor();
};
main.stage.addEventListener(MouseEvent.MOUSE_DOWN, createMouse);
main.stage.addEventListener(MouseEvent.MOUSE_UP, destroyMouse);
main.stage.addEventListener(Event.MOUSE_LEAVE, destroyMouse);
}
public function stop():void{
main.removeEventListener(Event.ENTER_FRAME, onRender);
}
public function setDefault(_arg1:Object=null):void{
_defaults = _arg1;
}
public function createMouse(_arg1:MouseEvent):void{
var _local3:b2MouseJointDef;
var _local2:b2Body = GetBodyAtMouse();
if (_quickObjects[_local2]){
if (((_local2) && ((_quickObjects[_local2].params.draggable == true)))){
_local3 = new b2MouseJointDef();
_local3.body1 = w.GetGroundBody();
_local3.body2 = _local2;
_local3.target.Set((_mouseX / 30), (_mouseY / 30));
_local3.maxForce = 3000;
_local3.timeStep = timeStep;
_mouseJoint = (w.CreateJoint(_local3) as b2MouseJoint);
};
} else {
if (_local2){
_local3 = new b2MouseJointDef();
_local3.body1 = w.GetGroundBody();
_local3.body2 = _local2;
_local3.target.Set((_mouseX / 30), (_mouseY / 30));
_local3.maxForce = 3000;
_local3.timeStep = timeStep;
_mouseJoint = (w.CreateJoint(_local3) as b2MouseJoint);
};
};
}
public function addJoint(_arg1:Object):QuickObject{
return (create("joint", _arg1));
}
public function addPoly(_arg1:Object):QuickObject{
return (create("poly", _arg1));
}
private function init(_arg1:Object=null):void{
var _local3:String;
var _local4:Sprite;
var _local5:b2DebugDraw;
var _local6:Sprite;
var _local2:Object = {gravityX:0, gravityY:20, iterations:iterations, timeStep:timeStep, bounds:[-100, -100, 100, 100], debug:false, simpleRender:_simpleRender, renderJoints:true, frim:true, customMouse:false};
if (_arg1 == null){
_arg1 = new Object();
};
for (_local3 in _local2) {
if (_arg1[_local3] == null){
_arg1[_local3] = _local2[_local3];
};
};
_customMouse = _arg1.customMouse;
frim = _arg1.frim;
_simpleRender = _arg1.simpleRender;
_renderJoints = _arg1.renderJoints;
iterations = _arg1.iterations;
timeStep = _arg1.timeStep;
debug = _arg1.debug;
_local4 = new Sprite();
main.addChild(_local4);
if (debug){
_local4.graphics.beginFill(0x333333);
_local4.graphics.drawRect(0, 0, main.stage.stageWidth, main.stage.stageHeight);
};
worldAABB = new b2AABB();
worldAABB.lowerBound.Set(_arg1.bounds[0], _arg1.bounds[1]);
worldAABB.upperBound.Set(_arg1.bounds[2], _arg1.bounds[3]);
_gravity = new b2Vec2(_arg1.gravityX, _arg1.gravityY);
w = new b2World(worldAABB, _gravity, true);
if (debug){
_local5 = new b2DebugDraw();
_local6 = new Sprite();
main.addChild(_local6);
_local5.m_sprite = _local6;
_local5.m_drawScale = 30;
_local5.m_fillAlpha = 0.5;
_local5.m_alpha = 0.5;
_local5.m_lineThickness = 1;
_local5.m_drawFlags = (b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit);
w.SetDebugDraw(_local5);
};
}
public function addContactListener():QuickContacts{
contactListener = new QuickContacts();
w.SetContactListener(contactListener);
return (QuickContacts(contactListener));
}
private function GetBodyAtMouse(_arg1:Boolean=false):b2Body{
var _local10:b2Shape;
var _local11:Boolean;
var _local2:Number = (_mouseX / 30);
var _local3:Number = (_mouseY / 30);
_mousePVec.Set(_local2, _local3);
var _local4:b2AABB = new b2AABB();
_local4.lowerBound.Set((_local2 - 0.001), (_local3 - 0.001));
_local4.upperBound.Set((_local2 + 0.001), (_local3 + 0.001));
var _local5 = 10;
var _local6:Array = new Array();
var _local7:int = w.Query(_local4, _local6, _local5);
var _local8:b2Body;
var _local9:int;
while (_local9 < _local7) {
if ((((_local6[_local9].GetBody().IsStatic() == false)) || (_arg1))){
_local10 = (_local6[_local9] as b2Shape);
_local11 = (_local6[_local9] as b2Shape).TestPoint(_local10.GetBody().GetXForm(), _mousePVec);
if (_local11){
_local8 = _local10.GetBody();
break;
};
};
_local9++;
};
return (_local8);
}
public function set gravity(_arg1:b2Vec2):void{
_gravity = _arg1;
w.SetGravity(_gravity);
}
private function onTraceMouse(_arg1:Event):void{
trace("Mouse: ", (main.mouseX / 30).toFixed(2), (main.mouseY / 30).toFixed(2));
}
private function onDown(_arg1:MouseEvent):void{
main.addEventListener(Event.ENTER_FRAME, onTraceMouse);
}
public function createStageWalls(_arg1:Object=null):void{
var _local3:String;
var _local4:Number;
var _local5:Number;
var _local2:Object = _arg1;
if (_local2 == null){
_local2 = new Object();
};
for (_local3 in _defaults) {
if (_local2[_local3] == null){
_local2[_local3] = _defaults[_local3];
};
};
_local4 = (main.stage.stageWidth / 30);
_local5 = (main.stage.stageHeight / 30);
if ((((_local2.bottom == true)) || ((_local2.bottom == null)))){
addBox({x:(_local4 / 2), y:_local5, width:(_local4 - 1), height:1, density:0, lineThickness:_local2.lineThickness, lineColor:_local2.lineColor, lineAlpha:_local2.lineAlpha, fillColor:_local2.fillColor, fillAlpha:_local2.fillAllpha});
};
if ((((_local2.top == true)) || ((_local2.top == null)))){
addBox({x:(_local4 / 2), y:0, width:(_local4 - 1), height:1, density:0, lineThickness:_local2.lineThickness, lineColor:_local2.lineColor, lineAlpha:_local2.lineAlpha, fillColor:_local2.fillColor, fillAlpha:_local2.fillAllpha});
};
if ((((_local2.left == true)) || ((_local2.left == null)))){
addBox({x:0, y:(_local5 / 2), width:1, height:_local5, density:0, lineThickness:_local2.lineThickness, lineColor:_local2.lineColor, lineAlpha:_local2.lineAlpha, fillColor:_local2.fillColor, fillAlpha:_local2.fillAllpha});
};
if ((((_local2.right == true)) || ((_local2.right == null)))){
addBox({x:_local4, y:(_local5 / 2), width:1, height:_local5, density:0, lineThickness:_local2.lineThickness, lineColor:_local2.lineColor, lineAlpha:_local2.lineAlpha, fillColor:_local2.fillColor, fillAlpha:_local2.fillAllpha});
};
}
public function create(_arg1:String, _arg2:Object):QuickObject{
var _local3:QuickObject;
if (_arg1 == "box"){
_local3 = new BoxObject(this, _arg2);
_quickObjects[_local3.body] = _local3;
} else {
if (_arg1 == "circle"){
_local3 = new CircleObject(this, _arg2);
_quickObjects[_local3.body] = _local3;
} else {
if (_arg1 == "poly"){
_local3 = new PolyObject(this, _arg2);
_quickObjects[_local3.body] = _local3;
} else {
if (_arg1 == "concaveArc"){
_local3 = new ConcaveArcObject(this, _arg2);
_quickObjects[_local3.body] = _local3;
} else {
if (_arg1 == "joint"){
_local3 = new JointObject(this, _arg2);
_quickObjects[_local3.joint] = _local3;
} else {
if (_arg1 == "group"){
_local3 = new GroupObject(this, _arg2);
_quickObjects[_local3.body] = _local3;
} else {
throw (new Error((("QuickBox2D: Sorry, there is no QuickObject subclass for " + _arg1) + " types.")));
};
};
};
};
};
};
return (_local3);
}
function defaultParams(_arg1:Object):void{
var _local2:String;
if (_arg1 == null){
_arg1 = new Object();
};
for (_local2 in _defaults) {
if (_arg1[_local2] == null){
_arg1[_local2] = _defaults[_local2];
};
};
}
public function addConcaveArc(_arg1:Object):QuickObject{
return (create("concaveArc", _arg1));
}
private function destroyMouse(_arg1):void{
if (_mouseJoint){
w.DestroyJoint(_mouseJoint);
_mouseJoint = null;
};
}
public function grid(_arg1:int=30, _arg2:uint=0xFFFF00, _arg3:Number=1):void{
var _local4:Sprite = new Sprite();
main.addChild(_local4);
_local4.graphics.lineStyle(0, _arg2, _arg3);
var _local5:int;
while (_local5 < main.stage.stageWidth) {
_local4.graphics.moveTo(_local5, 0);
_local4.graphics.lineTo(_local5, main.stage.stageHeight);
_local5 = (_local5 + _arg1);
};
_local5 = 0;
while (_local5 < main.stage.stageHeight) {
_local4.graphics.moveTo(0, _local5);
_local4.graphics.lineTo(main.stage.stageWidth, _local5);
_local5 = (_local5 + _arg1);
};
}
public function get gravity():b2Vec2{
return (_gravity);
}
public function addCircle(_arg1:Object):QuickObject{
return (create("circle", _arg1));
}
protected function onRender(_arg1:Event):void{
var _local2:int;
var _local3:int;
var _local4:TimeStepCallback;
if (frim == true){
_currTime = getTimer();
_elapsedTime = ((_currTime - _prevTime) * 0.001);
_prevTime = _currTime;
if (_elapsedTime > 0.25){
_elapsedTime = 0.25;
};
_accumulator = (_accumulator + _elapsedTime);
while (_accumulator >= timeStep) {
w.Step(timeStep, iterations);
dispatchEvent(step);
_accumulator = (_accumulator - timeStep);
totalTimeSteps++;
_local3 = timeStepCallbacks.length;
_local2 = 0;
while (_local2 < _local3) {
_local4 = timeStepCallbacks[_local2];
if (_local4.time == totalTimeSteps){
_local4.callback.apply(null, _local4.args);
};
_local2++;
};
};
} else {
w.Step(timeStep, iterations);
dispatchEvent(step);
totalTimeSteps++;
_local2 = 0;
while (_local2 < _local3) {
_local4 = timeStepCallbacks[_local2];
if (_local4.time == totalTimeSteps){
_local4.callback.apply(null, _local4.args);
};
_local2++;
};
};
_local3 = destroyable.length;
_local2 = 0;
while (_local2 < _local3) {
destroyable[_local2].fullDestroy();
_local2++;
};
destroyable = [];
if (!_customMouse){
setMouse(main.mouseX, main.mouseY);
};
updateMouse();
if (_simpleRender){
updateBodies();
};
dispatchEvent(render);
}
private function onUp(_arg1:MouseEvent):void{
main.removeEventListener(Event.ENTER_FRAME, onTraceMouse);
}
public function updateMouse():void{
var _local1:b2Vec2;
if (_mouseJoint){
_local1 = new b2Vec2((_mouseX / 30), (_mouseY / 30));
_mouseJoint.SetTarget(_local1);
};
}
public function addGroup(_arg1:Object):QuickObject{
return (create("group", _arg1));
}
public function setMouse(_arg1:Number, _arg2:Number):void{
_mouseX = _arg1;
_mouseY = _arg2;
}
public function traceMouse():void{
main.stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
main.stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
}
public function start():void{
_prevTime = getTimer();
main.addEventListener(Event.ENTER_FRAME, onRender);
}
public function addBox(_arg1:Object):QuickObject{
return (create("box", _arg1));
}
public function updateBodies():void{
var _local2:b2Joint;
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2XForm;
var _local6:b2XForm;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:*;
var _local12:b2PulleyJoint;
var _local13:b2Vec2;
var _local14:b2Vec2;
var _local1:b2Body = w.m_bodyList;
while (_local1) {
if ((_local1.m_userData is Sprite)){
_local1.m_userData.x = (_local1.GetPosition().x * 30);
_local1.m_userData.y = (_local1.GetPosition().y * 30);
_local1.m_userData.rotation = (_local1.GetAngle() * (180 / Math.PI));
};
_local1 = _local1.m_next;
};
if (_renderJoints){
main.graphics.clear();
_local2 = w.m_jointList;
while (_local2) {
_local3 = _local2.m_body1;
_local4 = _local2.m_body2;
_local5 = _local3.m_xf;
_local6 = _local4.m_xf;
_local7 = _local5.position;
_local8 = _local6.position;
_local9 = _local2.GetAnchor1();
_local10 = _local2.GetAnchor2();
_local11 = _local2.GetUserData();
if (!(_local2 is b2MouseJoint)){
if (_local11.skin != "none"){
if ((_local2 is b2PulleyJoint)){
main.graphics.lineStyle(_local11.lineThickness, _local11.lineColor, _local11.lineAlpha);
_local12 = (_local2 as b2PulleyJoint);
_local13 = _local12.GetGroundAnchor1();
_local14 = _local12.GetGroundAnchor2();
main.graphics.moveTo((_local13.x * 30), (_local13.y * 30));
main.graphics.lineTo((_local9.x * 30), (_local9.y * 30));
main.graphics.moveTo((_local14.x * 30), (_local14.y * 30));
main.graphics.lineTo((_local10.x * 30), (_local10.y * 30));
main.graphics.moveTo((_local13.x * 30), (_local13.y * 30));
main.graphics.lineTo((_local14.x * 30), (_local14.y * 30));
} else {
if ((_local2 is b2DistanceJoint)){
if ((_local11 is MovieClip)){
_local11.x = (_local9.x * 30);
_local11.y = (_local9.y * 30);
_local11.scaleX = (((_local10.x * 30) - _local11.x) / _local11.startWidth);
_local11.scaleY = (((_local10.y * 30) - _local11.y) / _local11.startHeight);
} else {
main.graphics.lineStyle(_local11.lineThickness, _local11.lineColor, _local11.lineAlpha);
main.graphics.moveTo((_local9.x * 30), (_local9.y * 30));
main.graphics.lineTo((_local10.x * 30), (_local10.y * 30));
};
} else {
main.graphics.lineStyle(_local11.lineThickness, _local11.lineColor, _local11.lineAlpha);
if (_local3 != w.m_groundBody){
main.graphics.moveTo((_local7.x * 30), (_local7.y * 30));
main.graphics.lineTo((_local9.x * 30), (_local9.y * 30));
};
main.graphics.moveTo((_local9.x * 30), (_local9.y * 30));
main.graphics.lineTo((_local10.x * 30), (_local10.y * 30));
if (_local4 != w.m_groundBody){
main.graphics.moveTo((_local8.x * 30), (_local8.y * 30));
main.graphics.lineTo((_local10.x * 30), (_local10.y * 30));
};
};
};
};
};
_local2 = _local2.m_next;
};
};
}
public function destroy():void{
main.stage.removeEventListener(MouseEvent.MOUSE_DOWN, createMouse);
main.stage.removeEventListener(MouseEvent.MOUSE_UP, destroyMouse);
main.removeEventListener(Event.ENTER_FRAME, onRender);
main.stage.removeEventListener(MouseEvent.MOUSE_DOWN, onDown);
main.stage.removeEventListener(MouseEvent.MOUSE_UP, onUp);
}
public function addTimeStepSequence(... _args):void{
var _local2:int;
var _local3:Function;
var _local4:Array;
var _local7:String;
var _local5:int;
var _local6:int;
while (_local6 < _args.length) {
_local5 = 0;
_local4 = [];
for (_local7 in _args[_local6]) {
if (_local7 == "time"){
_local2 = _args[_local6][_local7];
_local5++;
} else {
if (_local7 == "callback"){
_local3 = _args[_local6][_local7];
_local5++;
} else {
if (_local7 == "args"){
_local4 = _args[_local6][_local7];
_local5++;
};
};
};
if ((((_local5 == 3)) || ((((_args[_local6].args == undefined)) && ((_local5 == 2)))))){
timeStepCallbacks.push(new TimeStepCallback(_local2, _local3, _local4));
};
};
_local6++;
};
}
}
}//package com.actionsnippet.qbox
class TimeStepCallback {
public var args:Array;
public var callback:Function;
public var time:int;
private function TimeStepCallback(_arg1:int, _arg2:Function, _arg3:Array){
time = _arg1;
callback = _arg2;
args = _arg3;
}
}
Section 89
//QuickContacts (com.actionsnippet.qbox.QuickContacts)
package com.actionsnippet.qbox {
import flash.events.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class QuickContacts extends b2ContactListener implements IEventDispatcher {
private var contactRemove:Event;
private var contactPersist:Event;
public var currentPoint:b2ContactPoint;
private var contactResult:Event;
private var contactAdd:Event;
public var dispatcher:EventDispatcher;
public var currentResult:b2ContactResult;
public static const ADD:String = "add";
public static const REMOVE:String = "remove";
public static const PERSIST:String = "persist";
public static const RESULT:String = "result";
public function QuickContacts(){
contactAdd = new Event("add");
contactRemove = new Event("remove");
contactPersist = new Event("persist");
contactResult = new Event("result");
super();
dispatcher = new EventDispatcher(this);
}
public function dispatchEvent(_arg1:Event):Boolean{
return (dispatcher.dispatchEvent(_arg1));
}
override public function Add(_arg1:b2ContactPoint):void{
currentPoint = _arg1;
dispatcher.dispatchEvent(contactAdd);
}
public function hasEventListener(_arg1:String):Boolean{
return (dispatcher.hasEventListener(_arg1));
}
public function willTrigger(_arg1:String):Boolean{
return (dispatcher.willTrigger(_arg1));
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
dispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
dispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4);
}
override public function Remove(_arg1:b2ContactPoint):void{
currentPoint = _arg1;
dispatcher.dispatchEvent(contactRemove);
}
public function isCurrentContact(_arg1:QuickObject, _arg2:QuickObject):Boolean{
var _local3:b2Body = currentPoint.shape1.GetBody();
var _local4:b2Body = currentPoint.shape2.GetBody();
var _local5:b2Body = _arg1.body;
var _local6:b2Body = _arg2.body;
if (_local3 == _local5){
if (_local4 == _local6){
return (true);
};
} else {
if (_local3 == _local6){
if (_local4 == _local5){
return (true);
};
};
};
return (false);
}
override public function Persist(_arg1:b2ContactPoint):void{
currentPoint = _arg1;
dispatcher.dispatchEvent(contactPersist);
}
public function inCurrentContact(_arg1:QuickObject):Boolean{
var _local2:b2Body = currentPoint.shape1.GetBody();
var _local3:b2Body = currentPoint.shape2.GetBody();
var _local4:b2Body = _arg1.body;
if (_local4 == _local2){
return (true);
};
if (_local4 == _local3){
return (true);
};
return (false);
}
override public function Result(_arg1:b2ContactResult):void{
currentResult = _arg1;
dispatcher.dispatchEvent(contactResult);
}
}
}//package com.actionsnippet.qbox
Section 90
//QuickObject (com.actionsnippet.qbox.QuickObject)
package com.actionsnippet.qbox {
import flash.display.*;
import flash.events.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class QuickObject {
private var loc:b2Vec2;
protected var qbox:QuickBox2D;
public var bodyDef:b2BodyDef;
public var joint:b2Joint;
public var params:Object;
protected var defaults:Object;
public var shape:b2Shape;
public var body:b2Body;
public var shapeDef;
protected var w:b2World;
protected var type:String;
public function QuickObject(_arg1:QuickBox2D, _arg2:Object=null){
init(_arg1, _arg2);
}
final public function destroy():void{
qbox.destroyable.push(this);
}
final private function init(_arg1:QuickBox2D, _arg2:Object=null):void{
var _local3:b2MassData;
this.qbox = _arg1;
this.params = _arg2;
defineDefaults();
setDefaults();
if (_arg2.vecA == null){
setupBodyDef(_arg2);
};
this.w = _arg1.w;
build();
if (!_arg1.debug){
if ((userData is DisplayObject)){
userData.x = (_arg2.x * 30);
userData.y = (_arg2.y * 30);
userData.rotation = ((_arg2.angle / Math.PI) * 180);
_arg1.main.addChild(userData);
};
};
if (body != null){
if (_arg2.mass != null){
body.SetMassFromShapes();
_local3 = new b2MassData();
_local3.mass = _arg2.mass;
_local3.center = body.GetLocalCenter();
_local3.I = body.m_I;
body.SetMass(_local3);
} else {
body.SetMassFromShapes();
};
};
}
public function get angle():Number{
return (body.GetAngle());
}
public function get userData(){
return (body.m_userData);
}
final public function fullDestroy():void{
if (shape){
body.DestroyShape(shape);
w.DestroyBody(body);
};
if (joint){
w.DestroyJoint((joint as b2Joint));
};
if ((userData is DisplayObject)){
if (userData.parent){
userData.parent.removeChild(userData);
};
};
}
private function setDefaults():void{
var _local1:String;
if (params == null){
params = new Object();
};
for (_local1 in defaults) {
if (params[_local1] == null){
params[_local1] = defaults[_local1];
};
};
}
private function setupBodyDef(_arg1:Object):void{
bodyDef = new b2BodyDef();
if (!(_arg1.skin is DisplayObject)){
bodyDef.position.x = _arg1.x;
bodyDef.position.y = _arg1.y;
bodyDef.angle = _arg1.angle;
} else {
bodyDef.position.x = (_arg1.skin.x / 30);
bodyDef.position.y = (_arg1.skin.y / 30);
bodyDef.angle = ((_arg1.skin.rotation * Math.PI) / 180);
};
loc = new b2Vec2(_arg1.x, _arg1.y);
bodyDef.linearDamping = _arg1.linearDamping;
bodyDef.angularDamping = _arg1.angularDamping;
bodyDef.fixedRotation = _arg1.fixedRotation;
bodyDef.isBullet = _arg1.isBullet;
bodyDef.isSleeping = _arg1.isSleeping;
bodyDef.allowSleep = _arg1.allowSleep;
}
function handCursor():void{
if (!qbox.debug){
if ((userData is DisplayObject)){
if ((((params.draggable == true)) && (!((params.density == 0))))){
userData.buttonMode = true;
};
};
};
}
public function set angle(_arg1:Number):void{
loc = body.GetPosition();
body.SetXForm(loc, _arg1);
}
protected function defaultParams(_arg1:Object):void{
}
public function set userData(_arg1){
body.m_userData = _arg1;
}
private function defineDefaults():void{
defaults = {x:3, y:3, linearDamping:0, angularDamping:0, isBullet:false, fixedRotation:false, allowSleep:true, isSleeping:false, density:1, friction:0.5, restitution:0.2, angle:0, maskBits:0xFFFF, categoryBits:1, groupIndex:0, draggable:true, lineColor:0, lineAlpha:1, lineThickness:0, fillColor:0xCCCCCC, fillAlpha:1};
defaultParams(defaults);
qbox.defaultParams(params);
}
public function set x(_arg1:Number):void{
loc = body.GetPosition();
loc.x = _arg1;
body.SetXForm(loc, body.GetAngle());
}
public function set y(_arg1:Number):void{
loc = body.GetPosition();
loc.y = _arg1;
body.SetXForm(loc, body.GetAngle());
}
protected function build():void{
trace("You must override the build() method of QuickObject");
}
public function get x():Number{
return (body.GetPosition().x);
}
public function get y():Number{
return (body.GetPosition().y);
}
public function setLoc(_arg1:Number, _arg2:Number):void{
loc.x = _arg1;
loc.y = _arg2;
body.SetXForm(loc, body.GetAngle());
}
}
}//package com.actionsnippet.qbox
Section 91
//ArmorGamesAGI (com.chocorobokun.armorgames.ArmorGamesAGI)
package com.chocorobokun.armorgames {
import com.chocorobokun.managers.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.system.*;
import com.chocorobokun.domino.world.*;
import flash.net.*;
public class ArmorGamesAGI extends Sprite {
private const DEVELOPER_KEY:String = "a90b7480ba11663b304082310275242c";
private const AGI_URL:String = "http://agi.armorgames.com/assets/agi/AGI.swf";
private const GAME_KEY:String = "missing-mechanism";
private var main:MainStage;
public var agi;
public var selectedLevelCode:String;
public function ArmorGamesAGI(){
Security.allowDomain(AGI_URL);
var _local1:URLRequest = new URLRequest(AGI_URL);
var _local2:Loader = new Loader();
_local2.load(_local1);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
addEventListener(Event.ADDED_TO_STAGE, onStage);
}
public function testHandle(_arg1){
trace((" LEVEL NAME : " + _arg1.name));
trace((" LEVEL DATA : " + _arg1.data));
LevelManager.getInstance().setCurrentLevel(0);
if (((!((ScreenManager.getInstance().getCurrentScreenName() == "levelScreen"))) && (main.isSimulated))){
main.resetLevel();
};
selectedLevelCode = _arg1.data;
main.editorMode = false;
main.transitionGate.closeGate();
main.transitionGate.onClosed = createLevel;
main.transitionGate.nextScreen = "remove";
}
public function createLevel(){
main.createLevelFromCode(selectedLevelCode);
}
public function showGameShareList(){
stage.addChild(agi);
agi.showGameShareList(testHandle);
}
private function onComplete(_arg1:Event){
agi = _arg1.currentTarget.content;
addChild(agi);
agi.init(DEVELOPER_KEY, GAME_KEY);
trace("AGI LOADED");
}
public function submitLevel(_arg1:String){
stage.addChild(agi);
agi.showGameShareSubmit(_arg1, "", getThumbnail(), testHandle);
}
private function getThumbnail(){
var _local1:Number = (135 / stage.stageWidth);
var _local2:Matrix = new Matrix();
_local2.scale(_local1, _local1);
var _local3:BitmapData = new BitmapData(135, 90);
_local3.draw(stage, _local2);
return (new Bitmap(_local3));
}
private function onStage(_arg1:Event){
main = MainClass(root).mainStage;
}
}
}//package com.chocorobokun.armorgames
Section 92
//GSCollision (com.chocorobokun.CollisionDetection.GSCollision)
package com.chocorobokun.CollisionDetection {
import flash.display.*;
import flash.geom.*;
public class GSCollision {
public function isColliding(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Number=0):Boolean{
var _local4:Rectangle = getCollision(_arg1, _arg2, _arg3);
if (((!((_local4 == null))) && ((_local4.size.length > 0)))){
return (true);
};
return (false);
}
private function getAlphaMap(_arg1:DisplayObject, _arg2:Rectangle, _arg3:uint, _arg4:Rectangle):BitmapData{
var _local5:BitmapData = new BitmapData(_arg2.width, _arg2.height, true, 0);
var _local6:Matrix = new Matrix();
var _local7:Number = (_arg1.x - _arg4.x);
var _local8:Number = (_arg1.y - _arg4.y);
var _local9:Number = ((_arg4.x + _local7) - _arg2.x);
var _local10:Number = ((_arg4.y + _local8) - _arg2.y);
_local6.translate(_local9, _local10);
_local5.draw(_arg1, _local6);
var _local11:BitmapData = new BitmapData(_arg2.width, _arg2.height, false, 0);
_local11.copyChannel(_local5, _local5.rect, new Point(0, 0), BitmapDataChannel.ALPHA, _arg3);
return (_local11);
}
public function getCollision(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Number=0):Rectangle{
var _local4:Rectangle;
var _local5:DisplayObjectContainer;
var _local6:Rectangle;
var _local7:Rectangle;
var _local8:Boolean;
var _local9:Rectangle;
var _local10:BitmapData;
var _local11:BitmapData;
var _local12:uint;
var _local13:Number;
if (_arg1.parent == _arg2.parent){
_local5 = _arg1.parent;
_local6 = _arg1.getBounds(_local5);
_local7 = _arg2.getBounds(_local5);
_local8 = _local6.intersects(_local7);
if (_local8){
_local9 = _local6.union(_local7);
_local10 = getAlphaMap(_arg1, _local9, BitmapDataChannel.RED, _local6);
_local11 = getAlphaMap(_arg2, _local9, BitmapDataChannel.GREEN, _local7);
_local10.draw(_local11, new Matrix(), new ColorTransform(), BlendMode.LIGHTEN);
if (_arg3 > 1){
_arg3 = 1;
};
if (_arg3 < 0){
_arg3 = 0;
};
if (_arg3 == 0){
_local12 = 65792;
} else {
_local13 = Math.round((_arg3 * 0xFF));
_local12 = (((_local13 << 16) | (_local13 << 8)) | 0);
};
_local4 = _local10.getColorBoundsRect(_local12, _local12);
_local10.getColorBoundsRect(_local12, _local12).x = (_local4.x + _local9.x);
_local4.y = (_local4.y + _local9.y);
return (_local4);
};
};
return (_local4);
}
public function getCollisionPoint(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Number=0):Point{
var _local4:Point;
var _local6:Number;
var _local7:Number;
var _local5:Rectangle = getCollision(_arg1, _arg2, _arg3);
if (((!((_local5 == null))) && ((_local5.size.length > 0)))){
_local6 = ((_local5.left + _local5.right) / 2);
_local7 = ((_local5.top + _local5.bottom) / 2);
_local4 = new Point(_local6, _local7);
};
return (_local4);
}
}
}//package com.chocorobokun.CollisionDetection
Section 93
//AchievementConstant (com.chocorobokun.domino.constant.AchievementConstant)
package com.chocorobokun.domino.constant {
public class AchievementConstant {
public static const ACHIEVEMENT_WILL_OF_STEEL:int = 6;
public static const ACHIEVEMENT_THE_INVENTOR:int = 9;
public static const ACHIEVEMENT_THE_STUDENT_OF_MECHANISM:int = 2;
public static const ACHIEVEMENT_MECHANISM_SCHOLAR:int = 7;
public static const ACHIEVEMENT_MASTER_INVENTOR:int = 10;
public static const ACHIEVEMENT_PERSEVARENCE:int = 5;
public static const ACHIEVEMENT_THE_DOCTOR_OF_MECHANISM:int = 3;
public static const ACHIEVEMENT_THE_GENIUS_OF_MECHANISM:int = 4;
public static const ACHIEVEMENT_FIRST_FAIL:int = 1;
public static const ACHIEVEMENT_MECHANISM_GOD:int = 8;
}
}//package com.chocorobokun.domino.constant
Section 94
//AchievementData (com.chocorobokun.domino.data.AchievementData)
package com.chocorobokun.domino.data {
public class AchievementData {
public static var achievementArray:Array = [["ACHIEVEMENT NAME", "ACHIEVEMENT STATUS", "DESCRIPTION", "COUNTER"], ["First Fail", false, "First Fail", 1], ["The Student of Mechanism", false, "First solution", 1], ["The Doctor of Mechanism", false, "Complete 30 level", 1], ["The Genius of Mechanism", false, "Complete 60 level", 1], ["Persevarence", false, "Fail 100 times", 60], ["Will Of Steel", false, "Fail 20 times", 20], ["Mechanism Scholar", false, "Create 1 level", 1], ["Mechanism God", false, "Complete all achievement", 9], ["The Inventor", false, "create 5 level", 5], ["Master Inventor", false, "create 10 level", 10]];
}
}//package com.chocorobokun.domino.data
Section 95
//LevelData (com.chocorobokun.domino.data.LevelData)
package com.chocorobokun.domino.data {
import flash.events.*;
import flash.net.*;
public class LevelData {
public var xmlData:XML;
public var xmlLoader:URLLoader;
public var xmlLevelArray:Array;
public static var levelArray:Array = ["mb$293$91$0$s$fp$271$213$0$s$p3$291$131$163$s$p3$209$202$-164$i$", "mb$352$224$-62$s$fp$207$310$0$s$p3$584$264$0$s$p3$478$264$0$s$p3$373$264$0$s$p13$421$217$157$s$p12$336$236$0$s$p5$480$40$0$i$", "mb$269$68$-87.96634234355724$s$fp$227$285$0$s$p3$259$98$-166$s$p3$364$121$-167$s$p4$531$305$-44$s$p1$320$174$165$i$", "mb$456$76$-93$s$fp$492$305$0$s$p3$581$117$0$s$p3$475$117$0$s$p3$368$117$0$s$p3$265$130$162$s$p1$171$286$45$s$p4$376$338$0$i$p5$606$73$0$s$p5$554$73$0$s$p5$583$28$0$s$p9$505$76$-93$i$p17$65$134$0$s$p2$125$33$0$s$p16$521$239$-128$s$", "mb$79$297$54$s$fp$13$329$0$s$p3$114$321$0$s$p3$220$321$0$s$p3$326$322$0$s$p1$475$240$-66$i$p13$287$122$11$s$p3$332$154$0$s$p12$372$126$0$s$p14$358$115$0$s$p5$137$23$0$s$p3$226$154$0$s$p6$150$60$0$i$p2$34$108$15$s$p17$107$198$5$s$", "mb$402$277$-160$s$fp$133$272$0$s$p3$235$300$0$s$p3$340$300$0$s$p3$445$299$0$s$p3$128$275$90$i$p3$326$84$8$s$p3$222$64$14$s$p14$194$35$0$i$p18$406$169$0$s$", "mb$466$263$83$s$fp$257$159$0$s$p18$476$162$0$i$p3$469$289$0$s$p3$393$90$14$s$p3$289$63$15$s$p14$294$37$0$s$p1$210$199$94$i$", "mb$279$29$-38$s$fp$142$216$0$s$p5$610$168$0$s$p19$327$240$24$s$p19$251$205$26$s$p19$404$274$24$s$p19$602$205$0$s$p19$520$204$0$i$p3$150$94$33$s$p3$238$121$0$s$p3$259$63$-11$i$", "mb$452$303$-115$s$fp$465$340$0$s$p3$569$58$-16$s$p3$483$72$0$s$p3$398$83$-13$s$p3$320$92$0$s$p2$195$110$0$s$p3$412$326$0$s$p14$598$23$0$s$p2$305$222$0$s$p3$307$326$0$s$p3$202$326$0$s$p4$189$299$91$i$", "mb$142$68$119$s$fp$137$323$0$s$p3$255$303$-30$s$p3$211$263$-21$s$p3$303$228$-22$s$p3$348$259$-22$s$p3$446$224$-19$s$p1$97$219$44$s$p3$163$93$0$s$p14$556$9$0$s$p13$302$63$0$s$p12$373$77$0$i$p3$526$37$-8$s$p3$451$46$0$i$", "mb$36$183$20$s$fp$326$383$0$s$p3$61$222$22$s$p3$75$173$22$s$p4$175$308$0$s$p4$352$93$122$s$p4$424$341$-17$s$p4$546$164$-106$s$p3$266$401$0$i$p3$208$360$-59$i$", "mb$284$408$159$s$fp$298$409$0$s$p3$82$162$0$s$p3$191$162$0$s$p18$52$32$-86$s$p3$172$99$0$s$p3$281$98$0$s$p16$356$186$-84$i$p1$225$291$99$i$p3$243$431$0$s$p14$90$137$0$s$", "mb$109$96$-31$s$fp$266$373$0$s$p10$321$103$4$s$p3$371$380$-22$s$p3$358$338$-25$s$p3$463$362$0$s$p3$455$317$0$s$p3$566$362$0$i$p4$620$335$-92$s$p3$96$117$24$s$p3$194$156$19$s$", "mb$93$56$129$s$fp$94$330$0$s$p3$68$114$90$s$p3$142$261$0$s$p3$114$297$-43$s$p3$196$321$0$s$p3$301$321$0$s$p3$405$321$0$s$p18$434$194$0$s$p3$302$193$0$s$p3$334$112$0$s$p3$100$164$41$s$p3$93$192$0$s$p3$228$113$0$s$p14$219$52$0$s$p3$387$156$90$s$p6$242$82$0$i$p3$225$227$-43$s$p3$198$193$0$i$", "mb$52$32$130.92711165408565$s$fp$60$333$0$s$p10$446$187$-86$s$p10$446$228$-90$s$p3$415$203$90$s$p3$415$296$90$s$p3$85$103$0$s$p3$58$92$25$s$p3$191$103$0$s$p3$289$122$20$s$p3$373$243$0$s$p3$379$131$1$i$p3$485$132$0$i$p2$535$225$0$s$p16$595$225$-90$i$p3$532$335$-34$s$p3$620$90$-90$s$p3$597$14$54$s$p3$497$406$90$s$p17$584$390$0$s$p3$267$244$0$s$p3$181$169$90$s$p9$195$273$0$s$p9$145$272$0$s$p4$159$449$0$s$p3$442$393$0$s$p3$338$407$0$s$p3$131$387$90$s$p4$171$301$-129.86989764584402$i$p3$236$294$-89$s$p3$47$332$91$s$p3$84$391$0$s$p3$327$338$0$i$p5$304$303$0$s$p5$346$303$0$s$p3$192$341$90$s$p3$237$427$0$s$", "mb$463$331$-24$s$fp$268$175$0$s$p3$130$348$11$s$p3$226$357$0$s$p3$329$357$0$s$p3$433$357$0$s$p18$479$228$0$s$p14$404$81$0$i$p1$44$230$92$i$p0$142$232$0$s$p3$204$170$13$s$p3$404$118$22$s$p3$330$168$-89$i$", "mb$221$310$168$s$fp$230$333$0$s$p10$567$203$0$s$p14$465$50$0$s$p3$471$203$0$s$p3$257$202$0$s$p9$185$165$90$s$p3$174$341$0$s$p2$59$289$0$s$p3$224$87$-6$s$p3$331$83$0$i$p3$436$84$0$s$p3$370$273$0$s$p3$475$273$0$s$p17$34$52$-27$s$p2$18$171$16$s$p1$593$207$-56$s$p3$174$246$29$s$p9$511$49$-92$i$p3$192$281$-21$s$p12$167$268$0$s$p3$171$350$19$s$p12$222$234$0$s$p3$169$376$0$s$p3$168$395$17$s$p3$167$412$0$s$", "mb$462$95$-87$s$fp$476$295$0$s$p3$465$268$90$s$p3$537$270$90$s$p3$464$165$90$s$p3$537$165$90$s$p3$508$77$50$s$p3$419$122$0$s$p18$332$249$5$s$p3$348$375$0$s$p1$110$295$64$s$p13$186$248$0$i$p3$250$375$0$s$p7$183$125$0$s$p12$147$135$0$i$p14$171$93$0$s$p14$172$71$0$s$p14$154$89$0$s$", "mb$159$59$124.1272197245562$s$fp$557$354$0$s$p3$553$299$90$s$p3$614$300$90$s$p3$553$193$90$s$p3$614$195$90$s$p3$615$89$90$s$p3$348$309$0$s$p10$284$153$0$s$p3$443$310$0$s$p3$491$215$90$s$p3$511$343$0$s$p3$494$351$90$s$p4$524$334$0$i$p3$506$61$-36$s$p3$490$127$90$s$p3$576$39$0$s$p4$517$63$137$s$p3$121$83$0$i$p3$13$114$90$s$p3$35$39$135$s$p3$78$126$90$s$p3$13$219$90$s$p3$77$231$90$s$p3$54$347$0$s$p3$77$298$90$s$p3$13$302$90$s$p4$45$338$0$i$p14$46$306$0$s$p17$176$228$0$s$p16$122$231$90$s$", "mb$282$11$-100.07562009752655$s$fp$431$284$0$s$p3$259$74$90$s$p3$303$73$90$s$p16$255$178$-35.537677791974374$s$p1$88$246$90$s$p15$145$224$0$s$p3$202$117$0$s$p3$141$121$-18.434948822922024$s$p3$216$66$-38.42542742140421$s$p3$171$359$0$s$p3$274$359$0$s$p4$353$372$0$i$p3$318$271$89.94973161206843$s$p3$355$394$0$s$p3$321$171$91.43209618416464$s$p3$388$228$91.30195267257888$s$p3$387$332$90$s$p3$379$393$-47.792702365713296$s$p3$334$394$48.601278117223444$s$p4$342$149$119.11042615810322$i$p3$373$119$0$s$p3$478$120$0$s$p3$431$185$0$s$p16$549$200$-79.11447294534128$i$p3$456$215$-41.89397290438353$s$p3$412$351$91.19348942398203$s$p3$415$245$91.00508600525417$s$p3$307$4$92.60256220249981$s$p3$259$-4$90$s$", "mb$147$25$-78.41311487178677$s$fp$357$388$0$s$p7$302$154$0$s$p13$443$151$0$s$p13$303$227$0$s$p3$157$53$14$s$p13$165$150$0$s$p13$163$247$0$s$p13$437$252$0$s$p13$33$225$0$s$p13$570$227$0$s$p13$304$300$0$s$p13$435$345$0$s$p13$167$345$0$s$p13$30$304$0$s$p13$569$303$0$s$p14$503$20$0$s$p5$314$393$0$s$p5$444$394$0$s$p3$263$67$0$i$p3$546$40$0$i$", "mb$607$2$51.67808098789425$s$fp$584$369$0$s$p3$582$318$0.5456575934157399$s$p3$629$345$34.01934998982645$s$p3$530$381$0$s$p3$476$318$0$s$p3$372$325$-6.136358978842139$s$p3$424$381$0$s$p3$318$381$0$s$p3$268$331$0$s$p3$212$380$0$s$p3$137$353$38.92754359279229$s$p3$104$280$-90$s$p3$626$273$90.2413004056686$s$p3$626$169$89.28384005452959$s$p3$626$65$90$s$p3$587$42$-24.775140568831944$s$p3$511$60$0$s$p3$405$60$0$s$p3$299$60$0$s$p2$164$93$0$i$p3$290$130$0$s$p3$211$166$-38.25442035251717$s$p3$128$229$-37.40535663140855$s$p3$123$173$36.2538377374448$s$p3$77$100$87.87711829877074$s$p3$110$28$-34.16502166010832$s$p3$400$165$-41.49646835521554$s$p3$330$187$0$s$p3$242$206$-24.54220008053443$s$p3$395$130$0$i$p7$510$130$0$s$p7$438$220$0$s$p7$527$237$0$i$p9$78$209$27.824096384253238$s$", "mb$97$296$-63.564322565231926$s$fp$8$298$0$s$p3$115$317$0$s$p5$580$133$0$s$p18$406$150$0$s$p3$392$278$0$s$p3$318$72$5.194428907734817$s$p3$211$65$2.4366482468101367$s$p14$51$187$0$s$p19$476$275$0$i$p19$559$276$0$i$p3$-3$293$90$s$p3$36$242$0$s$p3$80$215$90$s$p3$10$195$90$s$p3$80$112$90$s$p3$11$113$91.1457628381751$s$p3$35$26$-51.11550356628538$s$p3$123$62$0$s$p3$103$7$0$s$p3$208$7$0$s$p4$50$232$0$i$p5$128$281$0$s$p2$165$149$0$s$p17$284$148$0$s$p3$165$382$-5.115406707983993$s$p3$98$359$57.468436484684844$s$p3$142$355$50.710593137499615$s$p1$281$345$-11.037921753421386$s$p3$417$353$0$s$p3$445$322$62.744671625056924$s$p3$374$323$64.78078783021067$s$p3$73$364$87.27368900609372$s$p3$110$396$-13.240519915187178$s$p3$38$356$0$s$p3$417$326$60.524110996754246$s$", "mb$537$313$-154.20645801486887$s$fp$561$326$0$s$p3$505$342$0$s$p3$87$31$90$s$p3$24$52$90$s$p6$61$111$0$i$p14$50$19$0$s$p14$64$66$0$s$p3$241$248$0$s$p3$350$238$90$s$p3$337$311$0$s$p3$288$293$90$s$p3$288$167$90$s$p3$324$149$-34.992020198558635$s$p3$333$125$0$s$p3$439$125$0$s$p3$380$309$48.419416809791755$s$p3$419$342$0$s$p3$433$149$35.049373312048374$s$p3$481$167$90$s$p3$437$216$-16.858398767738265$s$p4$320$294$0$i$p3$353$313$89.10035434928784$s$p2$112$197$0$i$", "mb$137$295$57.2596180561427$s$fp$569$299$0$s$p3$95$319$0$s$p3$199$319$0$s$p3$304$319$0$s$p3$410$319$0$s$p3$595$252$54$s$p3$529$254$51$s$p3$484$200$50$s$p3$531$166$52$s$p3$464$83$50$s$p1$353$84$162$s$p3$156$319$-19$s$p3$239$289$-19$s$p3$320$233$-51.667788055531446$i$p9$392$204$0$s$p9$283$203$0$s$p9$410$172$0$s$p9$358$253$0$s$p3$206$100$-8$i$p14$306$43$0$s$p18$125$185$0$s$p3$419$75$-15.255118703057747$s$p3$474$92$-127.56859202882748$s$", "mb$492$127$167.86507830928235$s$fp$10$324$0$s$p13$488$305$0$s$p12$502$319$0$s$p3$12$270$-90$s$p3$13$166$-89$s$p3$13$62$-90$s$p3$23$11$-66$s$p3$74$159$90$s$p3$73$251$90$s$p3$73$354$90$s$p18$328$288$0$i$p3$577$143$90$s$p3$578$95$90$s$p3$115$107$0$s$p3$141$158$91$s$p14$556$460$0$s$p4$101$343$30$i$p3$117$372$0$s$p3$219$372$0$s$p3$158$149$-14$s$p14$120$135$0$s$p3$577$248$90$s$p3$200$143$-44.86373202091289$s$p3$192$107$0$s$p3$500$198$90$s$p3$457$154$0$s$p3$350$154$0$s$p3$244$154$0$s$p3$177$176$-34$s$p6$385$130$0$i$p5$402$95$0$s$p3$30$394$0$s$p3$-11$349$110.90400540800425$s$", "mb$245$319$137.4630232249524$s$fp$278$340$0$s$p3$266$332$90$s$p3$381$339$-11$i$p3$222$374$0$s$p3$117$374$0$s$p3$266$226$90$s$p4$245$358$0$i$p3$75$331$90$s$p3$75$226$90$s$p3$117$161$0$s$p14$115$325$0$s$p14$163$346$0$s$p14$191$327$0$s$p1$318$55$176$i$p3$412$148$16$i$p3$311$184$0$s$p3$405$170$-13$s$p3$571$202$-9$s$p3$614$164$-90$s$p3$489$220$-16$s$p3$401$234$0$s$p3$310$277$13$s$p3$426$280$88$s$p2$513$301$0$s$p17$628$301$0$s$", "mb$433$226$38.68159897345299$s$fp$413$309$0$s$p3$424$273$0$s$p3$475$327$90$s$p3$326$264$0$s$p3$358$336$0$s$p3$252$332$4.969740728110281$s$p3$434$368$0$s$p3$350$355$18.004161605913396$s$p3$405$216$90$s$p3$477$220$90$s$p3$406$117$90$s$p3$477$114$90$s$p3$449$25$49.75005483314044$s$p3$363$72$0$s$p3$386$12$0$s$p3$280$12$0$s$p3$174$12$0$s$p3$138$21$-36.3268259521202$s$p3$198$79$8.402873457369196$s$p3$99$92$-90.33463537662885$s$p3$171$126$90$s$p3$98$197$90.91670037180432$s$p3$171$214$90$s$p3$103$331$43.667780146130355$s$p3$164$333$-6.709836807756915$s$p3$97$297$90$s$p2$287$180$0$s$p3$206$221$42.70622267293004$s$p3$331$83$-12.994616791916542$s$p4$451$41$-129.28940686250036$s$p4$437$259$0$i$p5$227$46$0$i$", "mb$575$296$-117$s$fp$16$339$0$s$p3$67$296$0$s$p3$4$337$89$s$p3$119$351$0$s$p3$223$351$0$s$p3$171$296$0$s$p3$318$331$-24$s$p3$267$278$-20$s$p3$365$268$-90$s$p3$312$219$90$s$p3$366$163$90$s$p3$267$178$0$s$p3$322$122$0$s$p3$216$123$0$s$p12$535$346$0$s$p12$581$346$0$s$p11$535$325$0$s$p18$409$245$3$i$p1$402$27$-178$i$p3$325$107$-17$i$p3$111$123$0$s$p3$13$124$91$s$p3$162$179$0$s$p3$57$179$0$s$p3$37$165$33$s$p14$37$236$0$s$p9$25$267$0$s$p3$78$396$89$s$p3$49$398$0$s$p3$40$417$33$s$", "mb$58$231$145$s$fp$34$337$0$s$p2$508$145$0$i$p2$566$256$0$s$p2$366$191$0$s$p2$453$309$4$s$p3$26$285$90$s$p3$67$295$0$s$p3$88$250$90$s$p3$27$181$90$s$p3$88$148$89$s$p3$26$76$89$s$p3$21$335$90$s$p3$62$397$0$s$p3$137$347$0$s$p3$96$391$90$s$p3$69$34$0$s$p4$50$60$132$s$p4$61$277$0$i$p3$133$105$0$s$p3$239$105$0$s$p3$322$89$-22$s$p3$403$80$0$s$p3$147$346$-5$s$p3$243$343$0$s$p3$332$344$0$s$", "mb$97$62$-104$s$fp$453$205$0$s$p3$132$102$4$s$p3$246$143$3$i$p3$360$176$3$i$p3$31$339$0$s$p3$334$23$0$s$p3$240$23$0$s$p3$139$22$0$s$p3$45$22$0$s$p3$340$216$0$s$p3$413$252$53$s$p3$620$23$0$s$p3$525$23$0$s$p3$431$23$0$s$p3$426$293$0$s$p3$552$247$90$s$p3$511$293$0$s$p3$598$238$0$s$p3$551$197$90$s$p3$507$150$0$s$p3$426$115$42$s$p3$343$88$0$s$p3$262$56$41$s$p3$600$150$0$s$p3$79$155$0$s$p3$159$183$37$s$p3$246$216$0$s$p3$,-4$154$0$s$p3$48$112$90$s$p3$48$69$90$s$p2$41$244$0$s$p17$152$285$0$s$p2$261$325$0$s$p3$350$256$50$s$p3$515$55$42$s$p3$551$134$90$s$p3$596$89$0$s$p3$467$337$90$s$p3$421$377$0$s$p3$514$378$0$s$p3$523$88$0$s$p3$442$88$0$s$p3$590$333$48$s$p3$117$366$34$s$p3$610$379$0$s$p3$28$438$0$s$p3$167$399$34$s$p3$335$399$-31$s$p3$255$423$0$s$p3$107$409$-41$s$p5$604$57$0$s$p5$442$55$0$s$p5$338$55$0$s$", "mb$90$28$-90$s$fp$322$332$0$s$p1$157$136$19$s$p4$304$163$0$s$p3$430$120$-52$i$p17$356$240$0$s$p16$428$234$-90$i$p0$52$322$0$s$p1$134$321$-90$s$p3$187$214$129$s$p3$45$211$0$s$p3$51$167$-54$s$p3$620$25$-137$s$p3$18$66$0$s$p3$28$20$89$s$p3$225$477$90$s$p3$226$229$72$s$p3$243$281$72$s$p3$241$384$-72$s$p3$189$417$28$s$p3$37$434$0$s$p3$217$327$4$s$p17$569$93$0$s$p16$514$90$90$s$p3$498$224$90$s$p3$572$194$34$s$p3$546$265$0$s$p3$599$263$-73$s$p3$544$313$0$s$p3$498$307$90$s$p3$586$354$90$s$p3$542$358$0$s$p3$628$312$0$s$p3$545$409$0$s$p3$499$393$90$s$p3$500$474$90$s$", "mb$152$56$-84$s$fp$277$377$0$s$p2$128$126$0$s$p2$187$244$0$s$p3$256$160$3$i$p4$343$200$0$s$p4$434$225$0$i$p1$548$289$-29$s$p3$278$258$-74$s$p3$266$345$89$s$p3$474$207$-76$s$p3$333$220$0$s$p3$422$251$0$s$p3$490$145$-76$s$p3$390$332$-38$s$p3$381$205$90$s$p2$78$320$-17$s$p1$133$44$-174$s$p3$21$124$89$s$p3$57$200$35$s$p3$225$334$146$s$p3$266$439$-90$s$p3$224$435$0$s$p3$179$412$-90$s$p3$219$367$0$s$p3$46$226$0$s$p3$573$378$-48$s$p3$485$387$89$s$p3$323$-21$90$s$p3$280$102$0$s$p3$323$56$-90$s$p3$275$59$0$s$p3$610$326$0$s$p3$649$347$0$s$p3$353$409$90$s$p3$496$411$0$s$p3$401$411$0$s$p3$485$478$90$s$", "mb$265$22$79$s$fp$427$369$0$s$p3$302$86$0$s$p3$377$122$50$s$p3$451$113$-92$s$p3$411$205$0$s$p3$274$230$-44$s$p13$173$176$74$i$p14$256$64$0$s$p3$226$112$-27$s$p3$199$276$-19$s$p5$147$256$-18$s$p13$156$339$0$s$p13$296$321$1$s$p16$536$299$-67$s$p13$423$338$0$s$p9$494$186$-90$i$p3$368$267$18$s$p3$315$206$-91$s$p3$453$291$10$s$p3$417$47$32$s$p3$498$129$0$s$p1$81$115$106$s$p3$80$259$-48$s$p3$51$336$90$s$p3$330$23$0$s$p3$198$23$0$s$p3$6$192$0$s$p3$-1$105$0$s$p3$42$32$0$s$p3$544$172$90$s$p3$368$390$0$s$p3$164$429$55$s$p3$96$390$0$s$p3$562$384$0$s$p3$299$433$-62$s$p3$408$437$90$s$p3$630$227$0$s$p3$649$384$0$s$p0$533$-14$0$s$p1$579$56$-30$s$p3$500$220$0$s$", "mb$570$62$164$s$fp$440$255$0$s$p1$518$123$-31$s$p13$269$198$4$s$p3$139$170$0$s$p8$199$168$0$i$p12$203$209$0$s$p13$127$145$0$s$p15$357$257$0$s$p16$414$262$-77$s$p13$501$29$40$s$p14$130$123$0$s$p1$45$211$62$s$p12$206$303$0$s$p13$273$318$1$s$p12$280$360$0$s$p5$205$274$0$s$p12$189$304$0$s$p4$333$413$51$i$p4$440$422$-19$i$p4$589$345$-37$i$p2$150$27$0$s$p17$261$68$0$s$p13$162$379$0$s$p13$45$346$0$s$p3$183$237$0$s$p3$116$207$52$s$p1$309$57$-91$s$p16$85$13$112$s$p3$-4$87$0$s$p3$377$35$-45$s$p3$599$179$0$s$p3$497$180$0$s$p3$618$140$49$s$p3$639$28$0$s$p3$615$218$47$s$p3$382$472$-90$s$p3$269$443$22$s$p3$179$424$0$s$p3$80$424$0$s$p3$489$411$-90$s$p3$489$453$-90$s$p3$4$424$0$s$p3$332$451$0$s$p3$592$370$-41$s$p3$642$254$0$s$p3$533$400$0$s$p3$626$301$90$s$", "mb$174$243$41$s$fp$512$324$0$s$p18$147$140$0$s$p3$225$49$-6$s$p14$266$21$0$s$p3$217$272$0$s$p1$340$179$-74$s$p4$270$75$45$s$p3$470$95$-53$s$p1$73$345$47$s$p4$346$347$41$s$p3$437$177$13$s$p3$538$204$-38$s$p3$435$282$0$s$p13$480$377$91$s$p12$553$378$0$s$p0$603$35$0$s$p1$576$391$-68$s$p3$524$95$55$s$p3$622$177$0$s$p3$578$225$90$s$p3$555$141$-124$s$p3$602$140$0$s$p2$1$14$0$s$p3$178$447$90$s$p3$-15$231$0$s$p3$334$9$0$s$p3$481$10$0$s$p3$409$9$0$s$p3$183$9$0$s$p3$130$9$0$s$p3$17$404$-49$s$p3$505$253$-39$s$p3$402$202$-26$s$p3$230$409$8$i$p3$324$430$16$i$p3$416$447$0$i$", "mb$551$19$-155$s$fp$18$346$0$s$p3$521$74$-32$s$p3$428$101$0$s$p3$323$144$0$s$p3$235$172$-34$s$p3$186$245$-90$s$p3$143$266$90$s$p3$143$175$-90$s$p4$164$304$0$i$p3$233$83$0$s$p3$153$53$-47$s$p3$227$35$0$s$p3$143$92$-90$s$p3$421$194$0$s$p3$513$212$20$s$p3$509$290$180$s$p3$594$261$-39$s$p3$286$409$0$s$p3$184$409$0$s$p3$115$398$42$s$p9$188$447$-46$i$p3$308$409$0$s$p3$383$446$51$s$p3$470$377$90$s$p3$510$325$0$s$p3$598$325$0$s$p3$426$429$0$s$p3$505$6$-36$s$p3$421$35$0$s$p3$326$35$0$s$p0$-12$170$0$s$p1$73$167$-92$s$p3$-15$281$0$s$p3$95$40$-90$s$p3$-23$54$0$s$p3$241$269$0$s$p3$336$268$0$s$p3$401$234$-57$s$p16$573$144$37$s$p3$608$13$90$s$p3$608$146$90$s$p15$607$98$0$s$p3$141$319$44$s$p3$223$349$0$s$p3$290$311$-61$s$", "mb$414$57$51$s$fp$536$288$0$s$p3$123$87$32$s$p3$216$142$-27$i$p3$117$208$29$s$p3$464$87$0$s$p14$110$45$0$s$p3$207$268$-26$i$p3$126$336$29$s$p4$230$412$14$s$p13$406$265$-90$i$p13$377$137$-89$s$p18$330$363$0$s$p3$583$130$-91$s$p3$521$134$68$s$p3$581$231$90$s$p3$538$228$90$s$p3$275$199$-90$s$p3$275$120$-90$s$p3$233$308$9$s$p3$239$46$37$s$p3$275$271$-90$s$p16$57$89$-90$s$p16$57$259$-90$s$p16$56$431$-91$s$p15$6$428$0$s$p15$6$260$0$s$p15$3$89$0$s$p3$89$16$0$s$p3$16$16$0$s$p3$153$16$0$s$p3$308$43$-38$s$p3$583$40$90$s$p3$488$16$0$s$p3$388$17$0$s$p3$589$15$0$s$p0$574$438$0$s$p2$666$300$0$s$p3$616$198$-54$s$p3$632$129$-91$s$p3$632$49$-90$s$", "mb$434$348$-143$s$fp$314$358$0$s$p18$121$129$10$s$p3$413$392$0$s$p18$123$320$0$s$p13$255$303$6$s$p12$251$315$0$s$p5$219$262$0$i$p5$363$267$0$s$p5$362$224$0$s$p5$363$179$0$s$p5$362$135$0$s$p5$361$90$0$s$p13$417$296$0$s$p5$468$262$0$s$p5$463$173$0$s$p5$466$218$0$s$p12$350$311$0$s$p12$374$311$0$s$p12$398$311$0$s$p12$314$253$0$s$p12$296$239$0$s$p12$321$285$0$s$p5$464$122$0$s$p3$194$450$0$s$p3$242$453$-47$s$p1$141$29$-179$s$p3$640$90$0$s$p3$558$62$37$s$p3$475$33$0$s$p3$381$33$0$s$p3$293$53$-28$s$p3$600$45$90$s$p3$430$-10$90$s$p3$333$-12$90$s$p3$524$-10$90$s$p1$15$315$92$s$p3$29$175$40$s$p3$-15$75$0$s$p3$99$450$0$s$p3$8$450$0$s$p3$363$420$0$s$p3$399$428$-44$s$p3$319$421$0$s$", "mb$104$283$150$s$fp$252$370$0$s$p3$569$52$147$s$p3$486$80$0$s$p3$400$81$0$i$p14$593$10$0$s$p3$225$81$0$s$p3$311$81$0$i$p3$191$130$23$s$p18$115$183$0$s$p3$137$309$0$s$p3$372$176$30$s$p3$285$151$0$s$p3$219$297$157$s$p3$488$312$136$s$p1$597$296$-109$s$p1$584$359$-59$s$p4$374$436$14$s$p3$200$343$41$s$p3$456$335$46$s$p3$421$318$-41$s$p6$12$41$0$s$p6$116$43$0$s$p5$12$0$0$s$p17$65$381$0$s$p16$115$400$-70$s$p3$500$118$47$s$p3$567$189$47$s$p3$581$149$0$s$p3$666$149$0$s$p3$661$26$0$s$p3$314$278$0$s$p3$411$279$0$s$p4$419$446$13$s$p4$325$423$17$s$", "mb$128$9$31$s$fp$3$255$0$s$p2$106$84$0$s$p17$218$166$0$s$p3$322$214$16$s$p3$289$62$0$s$p3$388$62$0$i$p3$492$99$-33$s$p14$278$12$0$s$p13$419$191$90$s$p3$279$43$32$i$p16$441$360$-53$s$p4$195$407$0$s$p4$116$364$0$s$p3$290$387$18$s$p3$509$288$18$s$p0$607$189$0$s$p1$519$190$92$s$p3$619$81$0$s$p3$605$306$0$s$p3$553$33$-63$s$p3$607$24$0$s$p3$526$388$-54$s$p3$556$352$89$s$p3$608$399$0$s$p3$405$483$90$s$p3$451$431$0$s$p3$91$190$0$s$p3$2$212$0$s$p3$19$153$56$s$p3$91$210$0$s$p3$319$241$0$s$p3$283$253$89$s$p3$325$273$-30$s$p3$-8$258$90$s$", "mb$540$178$-104$s$fp$232$221$0$s$p3$494$209$0$s$p3$67$32$18$s$p3$161$50$0$s$p3$257$62$11$s$p3$352$74$0$s$p14$52$7$0$s$p14$252$33$0$s$p3$501$100$-25$s$p3$407$127$-6$s$p3$311$153$155$s$p3$218$174$0$s$p3$126$200$-31$s$p5$222$91$0$s$p3$222$125$0$i$p4$9$274$82$s$p2$196$365$0$s$p3$319$410$4$s$p4$401$442$0$s$p4$480$412$0$s$p4$565$366$13$s$p13$578$255$-105$s$p3$403$231$-25$s$p3$337$252$0$s$p5$336$288$0$s$p3$334$322$0$i$p1$143$420$39$s$p3$75$450$0$s$p3$27$388$0$s$p3$39$316$0$s$p3$-1$451$0$s$p3$596$79$0$s$p3$53$353$-53$s$p3$54$425$-131$s$p3$112$89$-45$s$p3$345$5$16$s$p3$441$19$0$s$p0$0$104$0$s$p6$639$156$0$s$p5$616$114$0$s$p19$701$129$0$s$", "mb$497$108$-101$s$fp$530$258$0$s$p0$129$146$0$s$p3$547$144$0$s$p1$52$178$67$s$p15$227$263$0$s$p16$268$283$-68$s$p14$89$48$0$s$p1$86$217$31$s$p3$162$353$47$s$p3$185$86$3$s$p3$250$141$-25$s$p3$164$298$112$s$p3$423$419$0$s$p3$327$419$0$s$p3$244$408$17$s$p13$488$336$-90$i$p9$145$399$92$s$p13$472$193$90$i$p3$608$195$-35$s$p3$505$193$90$s$p3$524$193$90$s$p3$396$197$-89$s$p3$385$141$0$s$p3$428$100$-90$s$p3$472$54$0$s$p3$566$54$0$s$p3$641$22$-45$s$p0$308$2$0$s$p1$345$75$-27$s$p3$363$151$-90$s$p3$348$240$0$s$p3$325$201$0$s$p16$58$1$0$s$p3$190$15$0$s$p2$34$346$0$s$p17$75$453$-26$s$", "mb$524$336$-105$s$fp$581$110$0$s$p18$105$187$0$s$p18$218$184$0$s$p3$524$37$-21$s$p13$66$180$94$s$p3$116$273$0$i$p3$191$260$-19$s$p14$223$227$0$s$p18$328$187$0$s$p18$459$188$0$s$p18$379$340$0$s$p13$558$368$0$s$p12$534$382$0$s$p17$80$364$0$s$p17$201$365$0$s$p2$140$465$0$s$p3$156$52$0$s$p3$253$52$0$s$p3$344$52$0$s$p3$437$52$0$s$p3$59$52$0$s$p3$-13$52$0$s$p3$618$21$0$s$p3$627$192$-43$s$p3$636$279$0$s$p3$642$312$0$s$p3$591$273$90$s$p16$130$-1$0$s$p16$395$-1$0$s$p3$262$15$0$s$p3$0$15$0$s$p3$524$-3$-22$s$", "mb$12$15$50$s$fp$288$395$0$s$p3$53$46$8$s$p13$22$128$0$s$p13$164$144$0$s$p13$308$128$0$s$p13$451$143$0$s$p13$598$127$0$s$p13$18$243$0$s$p13$162$227$0$s$p13$306$243$0$s$p13$450$227$0$s$p13$597$243$0$s$p13$159$348$0$s$p13$303$332$0$s$p13$450$345$0$s$p13$597$329$0$s$p13$13$333$0$s$p3$151$57$0$i$p3$247$56$0$i$p3$396$408$-15$s$p5$632$29$0$s$p3$599$69$0$i$p3$513$12$-63$s$p3$469$13$63$s$p3$323$11$59$s$p3$418$7$0$s$p3$368$10$-68$s$p1$96$444$-180$s$p1$545$440$179$s$p3$421$443$-32$s$p3$224$444$30$s$p3$496$395$0$s$", "mb$119$-4$159$s$fp$78$407$0$s$p1$437$128$-76$s$p0$350$104$0$s$p3$316$225$0$s$p3$231$227$0$s$p15$175$262$0$s$p3$120$180$0$s$p3$211$180$0$s$p3$301$180$0$s$p16$112$259$91$s$p3$181$337$0$s$p3$250$329$-15$i$p9$59$312$90$s$p16$457$248$179$s$p16$517$308$-91$s$p3$221$443$0$s$p3$316$443$0$s$p3$414$443$0$s$p3$432$363$-28$s$p3$108$15$18$s$p3$203$29$0$i$p3$299$29$0$s$p4$377$383$0$s$p3$183$438$10$i$p3$625$71$0$s$p3$546$38$46$s$p3$468$4$0$s$p3$645$162$0$s$p3$598$116$90$s$p3$566$194$-49$s$p17$117$98$0$s$p2$-2$99$0$s$p3$42$182$0$s$p3$36$273$0$s$p3$268$366$33$s$p3$61$228$-60$s$p3$16$228$64$s$p15$611$249$0$s$p16$626$293$-18$s$p3$558$428$55$s$p3$584$391$0$s$p3$643$391$0$s$p3$589$335$0$s$p3$655$335$0$s$", "mb$131$10$4$s$fp$573$362$0$s$p2$107$119$5$s$p2$173$251$0$i$p2$43$230$0$s$p2$309$312$0$i$p17$102$402$0$s$p2$219$402$0$s$p3$507$379$-1$s$p3$429$373$16$s$p3$326$143$0$s$p3$603$18$0$s$p3$503$18$0$s$p3$402$18$0$s$p3$301$18$0$s$p3$200$18$0$s$p3$-34$19$0$s$p3$67$18$0$s$p3$505$298$0$s$p3$600$297$0$s$p3$407$175$41$s$p3$443$255$90$s$p0$627$146$0$s$p3$254$64$0$s$p3$293$102$0$s$p3$370$101$0$s$p3$354$65$0$s$p3$412$60$-90$s$p3$412$131$-90$s$p3$247$108$47$s$p3$194$53$46$s$p3$473$61$90$s$p3$473$156$90$s$p3$474$254$90$s$p9$516$324$0$s$p14$516$259$0$s$", "mb$57$18$10$s$fp$332$391$0$s$p3$53$60$17$s$p3$622$22$0$s$p3$520$22$0$s$p3$419$22$0$s$p3$319$22$0$s$p3$220$22$0$s$p3$125$22$0$s$p3$-7$22$0$s$p3$438$74$0$s$p3$339$74$0$s$p3$240$74$0$s$p3$144$74$0$i$p17$531$131$20$s$p16$584$132$-89$s$p3$532$211$0$s$p3$457$202$12$s$p3$379$213$-15$s$p3$291$225$0$i$p3$201$225$0$s$p3$29$249$29$s$p3$134$226$0$s$p3$19$114$0$s$p3$336$117$-90$s$p3$294$166$0$s$p3$195$166$0$s$p3$108$139$30$s$p3$240$118$-90$s$p3$287$103$0$s$p3$287$134$0$s$p3$367$134$-45$s$p3$396$92$0$s$p13$162$275$0$s$p13$306$338$5$s$p3$433$380$0$s$p3$521$369$-16$i$p5$32$150$0$s$p3$5$185$0$i$p3$516$306$0$s$p3$466$261$90$s$p3$565$264$90$s$p3$100$368$33$s$p3$273$434$89$s$p3$230$390$0$s$p3$24$343$0$s$p3$181$391$0$s$", "mb$601$12$-174$s$fp$441$420$0$s$p1$566$85$-45$s$p1$237$154$32$s$p18$404$263$0$s$p3$366$389$0$s$p3$345$245$-38$s$p3$274$268$0$s$p3$180$269$0$s$p3$23$294$39$s$p3$209$383$0$s$p5$207$349$0$s$p5$414$357$0$i$p3$106$325$0$s$p3$273$415$27$s$p3$10$410$0$s$p3$102$411$0$s$p3$147$371$90$s$p3$575$228$0$s$p3$575$197$0$s$p3$365$434$0$s$p0$27$58$0$s$p1$118$65$-87$s$p3$13$175$0$s$p3$67$196$26$s$p3$160$218$0$s$p3$241$218$0$s$p3$574$389$0$s$p3$574$357$0$s$p3$575$293$0$s$p3$575$262$0$s$p3$575$324$0$s$p3$629$197$89$s$p3$532$384$90$s$p3$532$298$90$s$p3$532$200$90$s$p3$672$147$0$s$p3$629$397$90$s$p3$629$299$90$s$p3$356$69$0$s$p3$185$16$0$s$p3$269$43$34$s$p15$513$33$0$s$p3$456$69$0$s$", "mb$93$97$-157$s$fp$32$106$0$s$p19$345$348$27$i$p19$423$367$0$s$p19$503$384$22$i$p19$581$403$0$s$p5$610$354$0$s$p19$104$328$0$s$p19$185$329$0$s$p19$268$330$0$s$p13$123$236$-91$s$p12$201$232$0$s$p5$206$197$0$s$p12$218$232$0$s$p6$515$208$0$s$p6$435$216$-12$i$p6$355$235$-17$i$p6$272$247$0$s$p13$582$113$-90$s$p6$601$210$0$s$p19$463$121$0$s$p19$380$121$0$i$p19$300$108$16$i$p19$217$96$0$s$p12$503$94$0$s$p12$492$94$0$s$p5$497$62$0$s$p3$136$123$0$s$p3$317$397$29$s$p3$225$373$0$s$p3$127$373$0$s$p3$33$372$0$s$p3$114$395$28$s$p3$205$418$0$s$p3$307$419$0$s$p3$498$442$26$s$p3$408$419$0$s$p3$594$317$0$s$p3$406$281$0$s$p3$404$265$162$s$p3$497$251$0$s$p3$599$251$0$s$p3$500$299$22$s$p3$391$12$0$s$p3$9$43$0$s$p3$103$26$-20$s$p3$197$12$0$s$p3$296$11$0$s$p3$212$123$0$s$p3$567$294$90$s$p3$587$11$0$s$p3$488$11$0$s$p3$611$284$0$s$p3$303$140$18$s$p3$196$138$18$s$p3$366$154$0$s$p3$282$154$0$s$p5$131$88$0$s$", "mb$592$14$-74$s$fp$15$335$0$s$p3$596$50$0$s$p3$620$25$-31$s$p4$515$126$-22$i$p3$4$375$90$s$p3$605$96$90$s$p3$334$442$33$s$p3$249$416$0$s$p3$149$415$0$s$p3$51$415$0$s$p3$562$340$0$s$p3$604$297$90$s$p3$605$196$90$s$p3$519$385$-90$s$", "mb$47$15$-124$s$fp$322$381$0$s$p3$66$58$-157$s$p3$157$77$0$s$p3$267$80$139$s$p3$354$82$41$s$p3$464$75$0$s$p3$550$55$-27$i$p14$555$22$0$s$p3$442$120$0$s$p3$186$119$0$s$p3$121$120$0$s$p3$529$153$-31$i$p3$41$152$35$i$p3$125$179$0$s$p3$222$179$0$s$p3$439$177$0$s$p3$316$179$90$s$p3$283$231$-38$s$p3$349$232$39$s$p3$202$258$0$s$p3$608$276$136$s$p3$512$263$0$s$p3$430$262$0$s$p3$133$257$0$s$p3$220$340$0$s$p13$348$331$8$s$p3$482$310$0$i$p3$583$310$0$s$p12$406$377$0$s$p3$35$308$39$s$p3$124$340$0$s$p3$440$356$90$s$p3$571$157$90$s$p3$46$216$-50$s$p3$-12$285$-51$s$p3$311$3$-90$s$", "mb$562$161$86$s$fp$561$282$0$s$p3$554$197$0$s$p13$435$367$0$s$p18$276$359$0$s$p13$342$287$51$s$p5$480$59$0$s$p12$499$411$0$s$p13$124$403$7$s$p12$62$411$0$s$p5$72$358$0$s$p3$613$77$55$i$p3$642$227$-38$s$p3$550$255$89$i$p0$38$60$0$s$p3$317$53$0$s$p3$215$56$0$s$p3$42$180$0$s$p3$396$18$-48$s$p3$289$6$90$s$p3$7$312$-50$s$p3$37$229$-90$s$p3$183$124$0$s$p3$261$86$-48$s$p1$116$91$-69$s$", "mb$12$6$-22$s$fp$27$382$0$s$p3$410$47$0$s$p2$147$136$0$i$p3$271$179$0$i$p3$9$33$30$s$p3$46$60$0$s$p2$397$223$0$s$p3$325$332$6$s$p3$413$337$0$s$p3$496$388$-15$s$p13$524$266$0$s$p3$218$247$-29$s$p3$206$402$0$s$p3$302$402$0$i$p3$399$402$0$i$p3$469$48$-91$s$p3$134$268$0$s$p3$40$269$0$s$p4$115$408$0$s$p3$271$217$-30$s$p3$206$57$46$s$p3$349$98$0$s$p3$431$98$0$s$p3$287$99$0$s$p3$131$16$0$s$p3$81$-30$90$s$p3$137$324$0$s$p3$225$324$0$s$p3$103$304$129$s$p3$29$337$0$s$p0$582$66$0$s$p3$356$50$90$s$p1$585$147$0$s$p5$242$290$0$s$p5$317$63$0$s$p5$272$60$0$s$p5$295$15$0$s$p1$592$276$-90$s$p16$339$119$180$s$", "mb$522$318$73$s$fp$566$358$0$s$p3$630$14$-40$s$p1$510$133$-26$s$p1$281$197$-11$s$p1$139$224$46$s$p1$345$351$18$s$p3$516$343$0$s$p14$34$4$0$s$p3$107$72$37$s$p3$115$101$0$s$p3$636$30$-91$s$p3$18$25$16$s$p3$72$38$0$s$p3$173$38$0$s$p3$275$38$0$i$p3$376$39$0$i$p3$476$40$0$i$p3$506$40$0$s$p3$265$82$-54$s$p15$209$99$0$s$p3$518$79$-53$s$p3$420$78$44$s$p15$473$85$0$s$p0$-18$117$0$s$p3$27$225$88$s$p3$63$307$44$s$p3$407$410$0$s$p3$147$342$0$s$p3$232$374$44$s$p3$309$410$0$s$p3$489$377$-45$s$p3$550$393$90$s$p3$19$410$0$s$p3$118$411$0$s$p3$211$411$0$s$p3$-20$183$0$s$p3$19$434$0$s$p3$113$390$90$s$p3$28$342$-48$s$p3$411$435$0$s$p3$310$435$0$s$p3$208$435$0$s$p3$116$434$0$s$p3$505$435$0$s$p3$538$199$0$s$p3$636$199$0$s$p3$630$171$0$s$p3$582$178$0$s$p3$389$233$42$s$p3$410$268$0$s$p3$492$235$-44$s$p3$627$283$0$s$p3$549$249$43$s$p3$472$199$0$s$p3$394$236$-47$s$", "mb$109$398$-172$s$fp$43$413$0$s$p3$63$83$0$s$p3$151$105$25$s$p3$234$117$-16$s$p8$309$109$0$s$p3$351$145$0$s$p8$396$115$0$s$p8$375$115$0$s$p8$354$115$0$s$p8$332$113$0$s$p3$-1$60$29$s$p3$554$145$0$s$p14$24$50$0$s$p3$452$145$0$i$p3$417$300$0$s$p8$502$110$0$s$p8$481$111$0$s$p8$460$112$0$s$p8$438$113$0$s$p8$418$117$0$s$p8$589$67$0$s$p8$525$111$0$s$p8$545$112$0$s$p8$565$116$0$s$p13$550$296$0$s$p14$469$264$0$s$p3$511$75$0$s$p2$303$352$0$s$p17$391$425$0$i$p3$345$181$-139$s$p3$425$211$0$s$p3$480$211$0$s$p3$558$181$-44$s$p3$189$413$-15$s$p3$160$442$0$s$p3$307$192$-90$s$p3$307$223$90$s$p3$267$155$90$s$p3$267$229$90$s$p3$108$466$90$s$p3$233$293$-43$s$p3$200$320$-41$s$p3$118$351$0$s$p3$26$352$0$s$p3$219$165$0$s$p3$219$225$0$s$p3$206$177$89$s$p3$190$285$0$s$p3$173$254$-39$s$p3$89$288$0$s$p3$4$289$0$s$p3$129$305$90$s$p3$40$308$90$s$p3$68$260$0$s$p3$145$231$-43$s$p3$176$164$-90$s$p3$2$260$0$s$p3$40$170$0$s$p3$127$195$33$s$p3$129$141$-32$s$p16$289$50$-180$s$p3$560$9$0$s$p3$479$10$0$s$p3$126$42$0$s$p3$178$42$0$s$p3$14$16$27$s$p15$73$7$0$s$p3$562$40$-43$s$p3$413$75$0$s$p3$404$41$-44$s$p3$488$39$-45$s$p3$661$8$0$s$p3$479$337$45$s$p3$421$339$44$s$p3$497$377$0$s$p3$632$340$-50$s$p3$596$377$0$s$", "mb$57$7$-29$s$fp$490$29$0$s$p0$271$149$0$s$p1$314$223$-32$s$p1$181$157$85$s$p14$364$116$0$s$p9$192$293$0$s$p9$119$215$32$s$p9$117$117$68$s$p3$437$65$38$s$p3$320$73$0$s$p3$248$34$0$i$p3$404$106$37$s$p3$349$34$0$i$p3$531$247$0$i$p3$438$270$-29$s$p3$495$138$0$s$p3$523$94$0$s$p3$523$139$0$s$p16$593$168$-91$s$p18$362$392$0$s$p13$112$399$0$s$p13$226$417$0$i$p13$55$296$-90$s$p13$80$183$-91$i$p13$40$84$89$s$p3$436$34$0$s$p3$106$34$0$s$p3$163$34$0$s$p15$558$311$0$s$p16$560$361$0$s$p3$483$299$-90$s$p3$624$289$70$s$p3$632$42$-59$s$p3$432$196$0$s$p3$524$197$0$s$p3$523$177$0$s$p3$523$157$0$s$p3$391$147$-90$s$p3$461$376$0$s$p3$458$398$28$s$p3$418$332$-91$s$p3$548$417$0$s$p3$641$418$0$s$p3$558$34$59$s$", "mb$552$349$-81$s$fp$571$384$0$s$p3$569$161$0$s$p1$90$134$37$s$p1$203$-4$-140$s$p0$148$61$0$s$p3$280$219$0$i$p3$379$229$0$i$p3$481$236$0$s$p3$573$270$-43$s$p3$496$310$0$s$p3$233$207$-128$s$p3$307$108$0$s$p3$391$134$32$s$p3$479$161$0$s$p3$395$365$0$s$p13$352$324$0$s$p5$444$278$0$s$p14$53$32$0$s$p3$218$326$0$s$p14$270$300$0$s$p2$94$365$0$i$p2$211$425$0$s$p13$470$396$-9$s$p13$336$387$0$s$p3$560$430$90$s$p3$296$278$0$s$p3$388$256$-29$s$p3$663$161$0$s$p3$463$125$-49$s$p3$541$91$0$s$p3$626$90$0$s$p3$354$42$0$s$p3$378$77$-49$s$p3$310$43$0$s$p3$448$68$31$s$p3$529$128$-134$s$p3$594$125$-47$s$p3$653$128$51$s$p3$420$98$76$s$p3$314$75$39$s$p3$85$247$0$s$p3$88$207$0$s$p3$199$279$0$s$p3$133$244$50$s$p3$8$247$0$s$p3$10$207$0$s$p3$653$239$0$s$p3$585$310$0$s$p3$663$311$0$s$p3$643$276$43$s$p3$476$342$-40$s$p3$-19$105$0$s$p3$-16$35$0$s$p3$22$156$90$s$p3$549$42$-90$s$p3$625$43$90$s$p3$410$0$90$s$", "mb$72$7$62$s$fp$565$313$0$s$p2$52$87$0$s$p3$126$173$-37$i$p3$138$381$21$s$p3$53$344$26$s$p3$52$234$27$i$p3$130$287$-37$s$p3$49$283$-39$s$p3$135$227$31$s$p3$182$445$90$s$p3$181$302$89$s$p3$222$386$90$s$p4$205$448$0$s$p3$222$193$90$s$p3$181$207$90$s$p3$222$292$-90$s$p3$181$111$90$s$p3$222$108$90$s$p3$266$65$0$s$p4$189$29$119$i$p2$380$124$0$s$p3$275$196$29$i$p3$358$259$-36$s$p3$276$329$27$s$p3$358$370$25$s$p3$269$247$-38$s$p3$262$102$-44$s$p3$402$296$90$s$p3$449$340$0$s$p3$448$392$0$s$p3$553$353$-90$s$p3$491$441$90$s$p3$490$296$-90$s$p3$586$248$0$s$p3$533$351$-91$s$p3$492$248$0$s$p3$532$395$90$s$p4$513$421$0$s$p4$505$257$134$s$p3$626$299$90$s$p3$366$-1$73$s$p3$319$10$0$s$p3$267$9$0$s$p3$446$249$0$s$p3$445$229$0$s$p0$585$67$0$s$p1$509$105$61$s$p3$425$38$0$s$p3$473$173$90$s$p3$626$219$54$s$", "mb$67$371$55$s$fp$110$408$0$s$p4$69$431$0$s$p4$52$43$131$s$p3$578$285$-90$s$p3$578$375$-90$s$p3$537$406$-91$s$p3$490$362$0$i$p4$565$26$-134$s$p3$443$133$-20$s$p3$316$103$0$s$p3$367$148$0$i$p3$324$347$90$s$p3$270$305$90$s$p3$271$90$90$s$p3$286$399$-18$i$p3$270$244$90$s$p3$324$297$-90$s$p3$171$402$90$s$p3$212$333$90$s$p3$213$468$90$s$p4$191$449$0$s$p3$259$408$-18$i$p3$171$303$90$s$p3$212$231$90$s$p3$142$186$135$s$p3$99$297$90$s$p3$99$395$90$s$p3$215$177$27$i$p3$99$202$90$s$p3$315$46$0$s$p3$324$421$90$s$p3$428$428$90$s$p3$378$433$0$s$p3$378$386$0$s$p3$352$295$53$s$p3$381$383$90$s$p3$230$46$0$s$p3$230$80$43$s$p3$359$59$-90$s$p3$414$19$0$s$p3$92$14$40$s$p3$176$46$0$s$p3$37$5$0$s$p3$18$50$89$s$p3$18$145$90$s$p3$1$176$49$s$p3$35$261$90$s$p3$36$354$90$s$p3$36$434$90$s$p3$271$452$90$s$p3$434$187$89$s$p3$479$143$0$s$p3$477$235$0$s$p3$522$189$90$s$p3$598$42$90$s$p3$614$128$69$s$p3$629$218$90$s$p3$630$308$90$s$p3$608$384$-54$s$p4$559$424$0$s$p3$393$56$-48$s$p3$271$3$-90$s$p5$475$203$0$s$p5$327$-26$0$s$p9$609$448$0$s$p6$165$44$0$s$p5$170$-57$0$s$p19$235$22$0$s$p19$394$23$0$s$p6$310$43$0$s$"];
public function LevelData(){
xmlLevelArray = [];
xmlLoader = new URLLoader();
super();
trace(",USE LEVEL XML!!!!!!");
xmlLoader.addEventListener(Event.COMPLETE, loadXML);
}
public function loadXML(_arg1:Event){
var _local2:XML;
xmlData = new XML(_arg1.target.data);
for each (_local2 in xmlData.levelcode) {
xmlLevelArray.push(String(_local2));
};
}
public function getXMLLevelArray():Array{
return (xmlLevelArray);
}
}
}//package com.chocorobokun.domino.data
Section 96
//BigCirclePartObject (com.chocorobokun.domino.partObjects.BigCirclePartObject)
package com.chocorobokun.domino.partObjects {
public class BigCirclePartObject extends PartObject implements IPart {
override public function partCreation():void{
qWorld.addCircle({skin:objectMov, density:0});
}
}
}//package com.chocorobokun.domino.partObjects
Section 97
//BigConcavePartObject (com.chocorobokun.domino.partObjects.BigConcavePartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
public class BigConcavePartObject extends PartObject implements IPart {
override public function partCreation():void{
var _local3:*;
var _local4:*;
var _local5:QuickObject;
var _local6:QuickObject;
var _local7:QuickObject;
var _local8:QuickObject;
var _local9:QuickObject;
var _local10:QuickObject;
var _local11:QuickObject;
var _local12:QuickObject;
var _local13:QuickObject;
var _local14:QuickObject;
var _local15:QuickObject;
var _local16:QuickObject;
var _local17:QuickObject;
var _local18:Array;
var _local19:*;
var _local20:QuickObject;
var _local1:Array = [0, 0, 201, 0, 221.5, 0, 188.4, 79.5, 14, 79.5, -20, 0];
var _local2:Array = [134.9, 79.5, 117.4, 88.5, 84.3, 88.5, 67.5, 79.5];
for (_local3 in _local1) {
_local1[_local3] = (_local1[_local3] / PIXEL_TO_METER);
};
for (_local4 in _local2) {
_local2[_local4] = (_local2[_local4] / PIXEL_TO_METER);
};
_local5 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(8.5 / PIXEL_TO_METER), x:(-9 / PIXEL_TO_METER), y:(-1 / PIXEL_TO_METER)});
_local6 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(8.5 / PIXEL_TO_METER), x:(210 / PIXEL_TO_METER), y:(-1 / PIXEL_TO_METER)});
_local7 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(16.9 / PIXEL_TO_METER), x:(100.9 / PIXEL_TO_METER), y:(84.1 / PIXEL_TO_METER)});
_local8 = qWorld.addBox({fillAlpha:0, lineAlpha:0, density:0, x:(6.7 / PIXEL_TO_METER), y:(29.5 / PIXEL_TO_METER), width:(17.6 / PIXEL_TO_METER), height:(57.5 / PIXEL_TO_METER), angle:((-30 * Math.PI) / 180)});
_local9 = qWorld.addBox({fillAlpha:0, lineAlpha:0, density:0, x:(24.8 / PIXEL_TO_METER), y:(49 / PIXEL_TO_METER), width:(17.6 / PIXEL_TO_METER), height:(57.5 / PIXEL_TO_METER), angle:((-45 * Math.PI) / 180)});
_local10 = qWorld.addBox({fillAlpha:0, lineAlpha:0, density:0, x:(36 / PIXEL_TO_METER), y:(59.3 / PIXEL_TO_METER), width:(22 / PIXEL_TO_METER), height:(22 / PIXEL_TO_METER), angle:((-60 * Math.PI) / 180)});
_local11 = qWorld.addBox({fillAlpha:0, lineAlpha:0, density:0, x:(77.8 / PIXEL_TO_METER), y:(74.3 / PIXEL_TO_METER), width:(17.6 / PIXEL_TO_METER), height:(57.5 / PIXEL_TO_METER), angle:((-75 * Math.PI) / 180)});
_local12 = qWorld.addBox({fillAlpha:0, lineAlpha:0, density:0, x:(196 / PIXEL_TO_METER), y:(29.5 / PIXEL_TO_METER), width:(17.6 / PIXEL_TO_METER), height:(57.5 / PIXEL_TO_METER), angle:((30 * Math.PI) / 180)});
_local13 = qWorld.addBox({fillAlpha:0, lineAlpha:0, density:0, x:(177 / PIXEL_TO_METER), y:(49 / PIXEL_TO_METER), width:(17.6 / PIXEL_TO_METER), height:(57.5 / PIXEL_TO_METER), angle:((45 * Math.PI) / 180)});
_local14 = qWorld.addBox({fillAlpha:0, lineAlpha:0, density:0, x:(165 / PIXEL_TO_METER), y:(59.3 / PIXEL_TO_METER), width:(22 / PIXEL_TO_METER), height:(22 / PIXEL_TO_METER), angle:((60 * Math.PI) / 180)});
_local15 = qWorld.addBox({fillAlpha:0, lineAlpha:0, density:0, x:(136 / PIXEL_TO_METER), y:(71.2 / PIXEL_TO_METER), width:(17.6 / PIXEL_TO_METER), height:(57.5 / PIXEL_TO_METER), angle:((69.5 * Math.PI) / 180)});
_local16 = qWorld.addPoly({density:0, fillAlpha:0, lineAlpha:0, verts:[_local2], x:(0 / PIXEL_TO_METER), y:(0 / PIXEL_TO_METER)});
_local17 = qWorld.addConcaveArc({density:0, verts:[_local1], x:(0 / PIXEL_TO_METER), y:(0 / PIXEL_TO_METER), radius:(109.5 / PIXEL_TO_METER)});
_local18 = [_local17, _local5, _local6, _local7, _local8, _local9, _local10, _local11, _local12, _local13, _local14, _local15, _local16];
for (_local19 in _local18) {
_local18[_local19].x = (_local18[_local19].x - (101 / PIXEL_TO_METER));
_local18[_local19].y = (_local18[_local19].y - (46 / PIXEL_TO_METER));
};
_local20 = qWorld.addGroup({skin:objectMov, angle:((rotation * Math.PI) / 180), objects:_local18, x:(objectMov.x / PIXEL_TO_METER), y:(objectMov.y / PIXEL_TO_METER)});
}
}
}//package com.chocorobokun.domino.partObjects
Section 98
//BigGearPartObject (com.chocorobokun.domino.partObjects.BigGearPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
public class BigGearPartObject extends PartObject implements IPart {
private var motorSpeed:Number;// = 0
override public function partCreation():void{
var _local1:QuickObject = qWorld.addCircle({radius:(49 / PIXEL_TO_METER), x:0, y:0});
var _local2:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(0 / PIXEL_TO_METER), y:(-59.2 / PIXEL_TO_METER)});
var _local3:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(0 / PIXEL_TO_METER), y:(58.8 / PIXEL_TO_METER)});
var _local4:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(34.9 / PIXEL_TO_METER), y:(-47.8 / PIXEL_TO_METER), angle:((36.3 * Math.PI) / 180)});
var _local5:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(-34.9 / PIXEL_TO_METER), y:(-47.8 / PIXEL_TO_METER), angle:((-36.3 * Math.PI) / 180)});
var _local6:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(56 / PIXEL_TO_METER), y:(-18 / PIXEL_TO_METER), angle:((72.3 * Math.PI) / 180)});
var _local7:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(-56 / PIXEL_TO_METER), y:(-18 / PIXEL_TO_METER), angle:((-72.3 * Math.PI) / 180)});
var _local8:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(56 / PIXEL_TO_METER), y:(17.7 / PIXEL_TO_METER), angle:((-72.3 * Math.PI) / 180)});
var _local9:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(-56 / PIXEL_TO_METER), y:(17.7 / PIXEL_TO_METER), angle:((72.3 * Math.PI) / 180)});
var _local10:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(34.9 / PIXEL_TO_METER), y:(47.4 / PIXEL_TO_METER), angle:((-36.3 * Math.PI) / 180)});
var _local11:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(-34.9 / PIXEL_TO_METER), y:(47.4 / PIXEL_TO_METER), angle:((36.3 * Math.PI) / 180)});
var _local12:QuickObject = qWorld.addGroup({skin:objectMov, objects:[_local1, _local2, _local3, _local4, _local5, _local6, _local7, _local8, _local9, _local10, _local11], x:(objectMov.x / PIXEL_TO_METER), y:(objectMov.y / PIXEL_TO_METER)});
var _local13:QuickObject = qWorld.addCircle({fillAlpha:0, lineAlpha:0, density:0, radius:(9 / PIXEL_TO_METER), x:(objectMov.x / PIXEL_TO_METER), y:(objectMov.y / PIXEL_TO_METER)});
var _local14:QuickObject = qWorld.addJoint({collideConnected:false, type:"revolute", a:_local13.body, b:_local12.body, enableMotor:true, motorSpeed:motorSpeed, maxMotorTorque:motorSpeed});
}
}
}//package com.chocorobokun.domino.partObjects
Section 99
//BlockPartObject (com.chocorobokun.domino.partObjects.BlockPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
public class BlockPartObject extends PartObject implements IPart {
override public function partCreation():void{
var _local1:QuickObject;
_local1 = qWorld.addBox({skin:objectMov, density:0, allowSleep:false});
}
}
}//package com.chocorobokun.domino.partObjects
Section 100
//BouncePartObject (com.chocorobokun.domino.partObjects.BouncePartObject)
package com.chocorobokun.domino.partObjects {
public class BouncePartObject extends PartObject implements IPart {
override public function partCreation():void{
qBody = qWorld.addBox({skin:objectMov, density:0, allowSleep:false, restitution:1.5});
}
}
}//package com.chocorobokun.domino.partObjects
Section 101
//ConveyorBeltPartObject (com.chocorobokun.domino.partObjects.ConveyorBeltPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
import Box2D.Common.Math.*;
public class ConveyorBeltPartObject extends PartObject implements IPart {
override public function partCreation():void{
var _local1:QuickObject = qWorld.addBox({width:(83 / PIXEL_TO_METER), height:(20 / PIXEL_TO_METER), x:0, y:0, density:0});
var _local2:QuickObject = qWorld.addCircle({radius:(10 / PIXEL_TO_METER), x:(-41.5 / PIXEL_TO_METER), y:0, density:0});
var _local3:QuickObject = qWorld.addCircle({radius:(10 / PIXEL_TO_METER), x:(41.5 / PIXEL_TO_METER), y:0, density:0});
var _local4:* = qWorld.addGroup({skin:objectMov, objects:[_local1, _local2, _local3], density:0});
_local4.body.SetLinearVelocity(new b2Vec2(2, 0));
}
}
}//package com.chocorobokun.domino.partObjects
Section 102
//CrossbarPartObject (com.chocorobokun.domino.partObjects.CrossbarPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
public class CrossbarPartObject extends PartObject implements IPart {
override public function partCreation():void{
var _local1:QuickObject = qWorld.addBox({x:(0 / PIXEL_TO_METER), y:(0 / PIXEL_TO_METER), height:(103.8 / PIXEL_TO_METER), width:(8.5 / PIXEL_TO_METER)});
var _local2:QuickObject = qWorld.addBox({x:(0 / PIXEL_TO_METER), y:(0 / PIXEL_TO_METER), height:(103.8 / PIXEL_TO_METER), width:(8.5 / PIXEL_TO_METER), angle:((90 / 180) * Math.PI)});
var _local3:QuickObject = qWorld.addGroup({skin:objectMov, objects:[_local1, _local2], x:(objectMov.x / PIXEL_TO_METER), y:(objectMov.y / PIXEL_TO_METER)});
var _local4:QuickObject = qWorld.addCircle({fillAlpha:0, lineAlpha:0, density:0, radius:(9 / PIXEL_TO_METER), x:(objectMov.x / PIXEL_TO_METER), y:(objectMov.y / PIXEL_TO_METER)});
var _local5:QuickObject = qWorld.addJoint({collideConnected:false, type:"revolute", a:_local4.body, b:_local3.body});
}
}
}//package com.chocorobokun.domino.partObjects
Section 103
//DominoPartObject (com.chocorobokun.domino.partObjects.DominoPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
import com.chocorobokun.domino.world.*;
public class DominoPartObject extends PartObject implements IPart {
private var main:MainStage;
public function setDocumentClass(_arg1:MainStage){
main = _arg1;
}
override public function partCreation():void{
var _local1:QuickObject = qWorld.addBox({skin:objectMov, density:0.1, width:(6 / PIXEL_TO_METER)});
main.movableObjects.push(_local1);
}
}
}//package com.chocorobokun.domino.partObjects
Section 104
//FanPartObject (com.chocorobokun.domino.partObjects.FanPartObject)
package com.chocorobokun.domino.partObjects {
import flash.display.*;
import com.actionsnippet.qbox.*;
import flash.events.*;
import Box2D.Common.Math.*;
import com.chocorobokun.domino.world.*;
public class FanPartObject extends PartObject implements IPart, IDestroyable {
private var main:MainStage;
private var objectMovieClip:MovieClip;
private var gravitySquare:QuickObject;
private function calculateForce(_arg1:QuickObject):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
var _local5:Number;
var _local2:QuickObject = _arg1;
var _local6:Number = Math.atan2((_arg1.body.GetPosition().y - gravitySquare.body.GetPosition().y), (_arg1.body.GetPosition().x - gravitySquare.body.GetPosition().x));
_local3 = new b2Vec2((((300 / PIXEL_TO_METER) / calculateDistance(_local2)) * Math.cos((gravitySquare.angle + ((-90 * Math.PI) / 180)))), (((300 / PIXEL_TO_METER) / calculateDistance(_local2)) * Math.sin((gravitySquare.angle + ((-90 * Math.PI) / 180)))));
return (_local3);
}
private function calculateDistance(_arg1:QuickObject):Number{
var _local2:QuickObject = _arg1;
var _local3:Number = (_local2.body.GetPosition().x - gravitySquare.body.GetPosition().x);
var _local4:Number = (_local2.body.GetPosition().y - gravitySquare.body.GetPosition().y);
var _local5:Number = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
return (_local5);
}
public function destroyPart():void{
objectMovieClip.gotoAndStop(4);
removeEventListener(Event.ENTER_FRAME, mainLoop);
}
private function calculatePosition(_arg1:QuickObject):Boolean{
var _local3:Boolean;
var _local6:Number;
var _local8:Number;
var _local2:QuickObject = _arg1;
var _local4:Number = Math.floor((calculateDistance(_local2) * PIXEL_TO_METER));
var _local5:Number = Math.atan2((_local2.body.GetPosition().y - gravitySquare.body.GetPosition().y), (_local2.body.GetPosition().x - gravitySquare.body.GetPosition().x));
var _local7:Number = Math.floor(((gravitySquare.angle * 180) / Math.PI));
if (_local7 < 270){
_local6 = _local7;
} else {
_local6 = (((_local7 + 90) % 360) - 90);
};
if (Math.floor((((_local5 * 180) / Math.PI) + 90)) > 180){
_local8 = (Math.floor((((_local5 * 180) / Math.PI) + 90)) - _local6);
} else {
_local8 = (Math.floor((((_local5 * 180) / Math.PI) + 90)) - _local6);
};
if (_local4 < 100){
if ((((((((_local8 < 60)) && ((_local8 > -60)))) || ((((_local8 < 360)) && ((_local8 > 300)))))) || ((((_local8 > -360)) && ((_local8 < -300)))))){
_local3 = true;
} else {
_local3 = false;
};
} else {
_local3 = false;
};
return (_local3);
}
override public function partCreation():void{
var _local1:QuickObject = qWorld.addBox({width:(18.5 / PIXEL_TO_METER), height:(18.5 / PIXEL_TO_METER), x:0, y:(5 / PIXEL_TO_METER), density:0});
var _local2:QuickObject = qWorld.addBox({width:(48 / PIXEL_TO_METER), height:(10.5 / PIXEL_TO_METER), x:0, y:(-10 / PIXEL_TO_METER), density:0});
gravitySquare = qWorld.addGroup({skin:objectMov, objects:[_local1, _local2]});
objectMovieClip = (objectMov as MovieClip);
}
public function setDocumentClass(_arg1:MainStage){
main = _arg1;
addEventListener(Event.ENTER_FRAME, mainLoop);
}
private function mainLoop(_arg1:Event){
var _local2:*;
for (_local2 in main.movableObjects) {
if (calculatePosition(main.movableObjects[_local2])){
main.movableObjects[_local2].body.ApplyForce(calculateForce(main.movableObjects[_local2]), main.movableObjects[_local2].body.GetWorldCenter());
};
};
if (objectMovieClip){
if (!main.isSimulated){
objectMovieClip.gotoAndStop(4);
} else {
objectMovieClip.play();
};
};
}
}
}//package com.chocorobokun.domino.partObjects
Section 105
//IDestroyable (com.chocorobokun.domino.partObjects.IDestroyable)
package com.chocorobokun.domino.partObjects {
public interface IDestroyable {
function destroyPart():void;
}
}//package com.chocorobokun.domino.partObjects
Section 106
//IPart (com.chocorobokun.domino.partObjects.IPart)
package com.chocorobokun.domino.partObjects {
import flash.display.*;
import com.actionsnippet.qbox.*;
public interface IPart {
function partInit(_arg1:QuickBox2D, _arg2:DisplayObject, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0):void;
}
}//package com.chocorobokun.domino.partObjects
Section 107
//LeftConveyorBeltPartObject (com.chocorobokun.domino.partObjects.LeftConveyorBeltPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
import Box2D.Common.Math.*;
public class LeftConveyorBeltPartObject extends PartObject implements IPart {
override public function partCreation():void{
var _local1:QuickObject = qWorld.addBox({width:(83 / PIXEL_TO_METER), height:(20 / PIXEL_TO_METER), x:0, y:0, density:0});
var _local2:QuickObject = qWorld.addCircle({radius:(10 / PIXEL_TO_METER), x:(-41.5 / PIXEL_TO_METER), y:0, density:0});
var _local3:QuickObject = qWorld.addCircle({radius:(10 / PIXEL_TO_METER), x:(41.5 / PIXEL_TO_METER), y:0, density:0});
var _local4:* = qWorld.addGroup({skin:objectMov, objects:[_local1, _local2, _local3], density:0});
_local4.body.SetLinearVelocity(new b2Vec2(-2, 0));
}
}
}//package com.chocorobokun.domino.partObjects
Section 108
//MagnetPartObject (com.chocorobokun.domino.partObjects.MagnetPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
import flash.events.*;
import Box2D.Common.Math.*;
import com.chocorobokun.domino.world.*;
public class MagnetPartObject extends PartObject implements IPart, IDestroyable {
private var contact:QuickContacts;
private var main:MainStage;
private var gravitySquare:QuickObject;
private function calculateDistance(_arg1:QuickObject):Number{
var _local2:QuickObject = _arg1;
var _local3:Number = (_local2.body.GetPosition().x - gravitySquare.body.GetPosition().x);
var _local4:Number = (_local2.body.GetPosition().y - gravitySquare.body.GetPosition().y);
var _local5:Number = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
return (_local5);
}
private function calculateForce(_arg1:QuickObject):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
var _local5:Number;
var _local2:QuickObject = _arg1;
var _local6:Number = Math.atan2((_arg1.body.GetPosition().y - gravitySquare.body.GetPosition().y), (_arg1.body.GetPosition().x - gravitySquare.body.GetPosition().x));
_local3 = new b2Vec2((((500 / PIXEL_TO_METER) / calculateDistance(_local2)) * Math.cos((_local6 - ((180 * Math.PI) / 180)))), (((500 / PIXEL_TO_METER) / calculateDistance(_local2)) * Math.sin((_local6 - ((180 * Math.PI) / 180)))));
return (_local3);
}
private function touchMagnet(_arg1:Event){
var _local2:*;
for (_local2 in main.movableObjects) {
if (contact.isCurrentContact(gravitySquare, main.movableObjects[_local2])){
main.movableObjects[_local2].body.PutToSleep();
};
};
}
public function destroyPart():void{
removeEventListener(Event.ENTER_FRAME, mainLoop);
}
private function calculatePosition(_arg1:QuickObject):Boolean{
var _local3:Boolean;
var _local6:Number;
var _local8:Number;
var _local2:QuickObject = _arg1;
var _local4:Number = Math.floor((calculateDistance(_local2) * PIXEL_TO_METER));
var _local5:Number = Math.atan2((_local2.body.GetPosition().y - gravitySquare.body.GetPosition().y), (_local2.body.GetPosition().x - gravitySquare.body.GetPosition().x));
var _local7:Number = Math.floor(((gravitySquare.angle * 180) / Math.PI));
if (_local7 < 270){
_local6 = _local7;
} else {
_local6 = (((_local7 + 90) % 360) - 90);
};
if (Math.floor((((_local5 * 180) / Math.PI) + 90)) > 180){
_local8 = (Math.floor((((_local5 * 180) / Math.PI) + 90)) - _local6);
} else {
_local8 = (Math.floor((((_local5 * 180) / Math.PI) + 90)) - _local6);
};
if (_local4 < 100){
if ((((((((_local8 < 60)) && ((_local8 > -60)))) || ((((_local8 < 360)) && ((_local8 > 300)))))) || ((((_local8 > -360)) && ((_local8 < -300)))))){
_local3 = true;
} else {
_local3 = false;
};
} else {
_local3 = false;
};
return (_local3);
}
override public function partCreation():void{
var _local1:QuickObject = qWorld.addBox({width:(32 / PIXEL_TO_METER), height:(15 / PIXEL_TO_METER), x:0, y:(-7 / PIXEL_TO_METER), density:0});
var _local2:QuickObject = qWorld.addCircle({widht:(32 / PIXEL_TO_METER), height:(32 / PIXEL_TO_METER), x:0, y:0, density:0});
gravitySquare = qWorld.addGroup({skin:objectMov, objects:[_local1, _local2]});
}
public function setDocumentClass(_arg1:MainStage){
main = _arg1;
addEventListener(Event.ENTER_FRAME, mainLoop);
}
private function mainLoop(_arg1:Event){
var _local2:*;
for (_local2 in main.movableObjects) {
if ((calculateDistance(main.movableObjects[_local2]) * PIXEL_TO_METER) < 100){
trace(("MAGNET ENGAGE :" + main.movableObjects[_local2]));
main.movableObjects[_local2].body.ApplyForce(calculateForce(main.movableObjects[_local2]), main.movableObjects[_local2].body.GetWorldCenter());
};
};
}
}
}//package com.chocorobokun.domino.partObjects
Section 109
//MainBallPartObject (com.chocorobokun.domino.partObjects.MainBallPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
import flash.events.*;
import flash.utils.*;
import com.chocorobokun.domino.world.*;
public class MainBallPartObject extends PartObject implements IPart {
private var contact:QuickContacts;
private var timer:Timer;
private var timeTick:int;
private var xVelocity:Number;
private var yVelocity:Number;
private var main:MainStage;
private var atFinishMod:Number;
override public function partCreation():void{
main.mainBall = qWorld.addCircle({skin:objectMov});
main.movableObjects.push(main.mainBall);
timeTick = 3;
timer = new Timer(1000, 0);
timer.addEventListener(TimerEvent.TIMER, function (){
timeTick--;
});
atFinishMod = 65;
contact = qWorld.addContactListener();
contact.addEventListener(QuickContacts.PERSIST, touchFinish);
contact.addEventListener(QuickContacts.REMOVE, function (){
if (contact.inCurrentContact(main.mainBall)){
main.soundDelay = 0;
trace("REMOVE");
};
if (contact.isCurrentContact(main.mainBall, main.finishPoint)){
trace("REMOVED");
timer.stop();
timeTick = 3;
};
});
contact.addEventListener(QuickContacts.ADD, function (){
var _local1:*;
xVelocity = main.mainBall.body.GetLinearVelocity().x;
yVelocity = main.mainBall.body.GetLinearVelocity().y;
if (xVelocity < 0){
xVelocity = (xVelocity * -1);
};
if (yVelocity < 0){
yVelocity = (yVelocity * -1);
};
if (contact.inCurrentContact(main.mainBall)){
for (_local1 in main.staticParts) {
if ((((main.staticParts[_local1] is BouncePartObject)) && (contact.isCurrentContact(main.mainBall, main.staticParts[_local1].qBody)))){
main.onCollide((xVelocity + yVelocity), "bounceSound");
break;
};
};
main.onCollide((xVelocity + yVelocity), "hitSound");
trace("CONTACT MAIN BALL");
};
if (contact.isCurrentContact(main.mainBall, main.finishPoint)){
trace("ADDED");
main.onCollide((xVelocity + yVelocity), "hitSound");
if (!timer.running){
timer.start();
};
};
});
}
public function destroyPart():void{
timer.stop();
removeEventListener(Event.ENTER_FRAME, mainLoop);
}
public function setDocumentClass(_arg1:MainStage){
main = _arg1;
addEventListener(Event.ENTER_FRAME, mainLoop);
}
private function mainLoop(_arg1:Event){
if ((main.mainBall.y * PIXEL_TO_METER) > 500){
main.ballOutOfBound();
};
if ((((timeTick <= 0)) && (!(main.levelComplete)))){
main.levelComplete = true;
timer.stop();
trace("MAINBALLPARTOBJECT.\"LEVEL COMPLETE!!!!\" by time tick");
main.levelWin();
};
}
private function touchFinish(_arg1:Event){
if (((main.finishPoint) && (main.mainBall))){
if (contact.isCurrentContact(main.mainBall, main.finishPoint)){
main.mainBall.body.SetAngularVelocity(0);
atFinishMod--;
if ((((atFinishMod < 0)) && ((((main.finishPoint.y - main.mainBall.y) * PIXEL_TO_METER) <= -8)))){
if (!main.levelComplete){
main.levelComplete = true;
trace("MAINBALLPARTOBJECT.\"LEVEL COMPLETE!!!!\"");
main.levelWin();
};
};
};
};
}
}
}//package com.chocorobokun.domino.partObjects
Section 110
//MovableBlockPartObject (com.chocorobokun.domino.partObjects.MovableBlockPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
public class MovableBlockPartObject extends PartObject implements IPart {
override public function partCreation():void{
var _local5:*;
var _local6:QuickObject;
var _local7:QuickObject;
var _local8:QuickObject;
var _local9:QuickObject;
var _local10:QuickObject;
var _local11:QuickObject;
var _local12:QuickObject;
var _local1:QuickObject = qWorld.addBox({x:0, y:(-4.7 / PIXEL_TO_METER), width:(124 / PIXEL_TO_METER), height:(18.7 / PIXEL_TO_METER)});
var _local2:Array = [-62.5, 0, -54, 6.2, -62.5, 14.5];
var _local3:Array = [-42.5, 6.2, -30.3, 6.2, -36.3, 14.5];
var _local4:Array = [62.5, 0, 62.5, 14.5, 53, 6.2];
for (_local5 in _local2) {
_local2[_local5] = (_local2[_local5] / PIXEL_TO_METER);
_local3[_local5] = (_local3[_local5] / PIXEL_TO_METER);
_local4[_local5] = (_local4[_local5] / PIXEL_TO_METER);
};
_local6 = qWorld.addPoly({verts:[_local2], x:(0 / PIXEL_TO_METER), y:0});
_local7 = qWorld.addPoly({verts:[_local3], x:(0 / PIXEL_TO_METER), y:0});
_local8 = qWorld.addPoly({verts:[_local3], x:(24 / PIXEL_TO_METER), y:0});
_local9 = qWorld.addPoly({verts:[_local3], x:(48 / PIXEL_TO_METER), y:0});
_local10 = qWorld.addPoly({verts:[_local3], x:(72 / PIXEL_TO_METER), y:0});
_local11 = qWorld.addPoly({verts:[_local4], x:0, y:0});
_local12 = qWorld.addGroup({skin:objectMov, objects:[_local1, _local6, _local7, _local8, _local9, _local10, _local11]});
}
}
}//package com.chocorobokun.domino.partObjects
Section 111
//PartObject (com.chocorobokun.domino.partObjects.PartObject)
package com.chocorobokun.domino.partObjects {
import flash.display.*;
import com.actionsnippet.qbox.*;
public class PartObject extends MovieClip {
protected const PIXEL_TO_METER:int = 30;
public var qWorld:QuickBox2D;
public var qBody:QuickObject;
public var objectMov:DisplayObject;
private var yPos:Number;
private var xPos:Number;
public function partInit(_arg1:QuickBox2D, _arg2:DisplayObject, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0):void{
qWorld = _arg1;
objectMov = _arg2;
partCreation();
}
public function partCreation():void{
}
}
}//package com.chocorobokun.domino.partObjects
Section 112
//PistonPartObject (com.chocorobokun.domino.partObjects.PistonPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
public class PistonPartObject extends PartObject implements IPart {
override public function partCreation():void{
var _local2:*;
var _local3:QuickObject;
var _local4:QuickObject;
var _local5:QuickObject;
var _local6:QuickObject;
var _local7:QuickObject;
var _local8:QuickObject;
var _local1:Array = [-6.8, -28.3, 6.8, -28.3, 12.3, 31.3, -12.3, 31.3];
for (_local2 in _local1) {
_local1[_local2] = (_local1[_local2] / PIXEL_TO_METER);
};
_local3 = qWorld.addBox({width:(41.7 / PIXEL_TO_METER), height:(47.6 / PIXEL_TO_METER), x:0, y:(-89 / PIXEL_TO_METER)});
_local4 = qWorld.addBox({width:(41.7 / PIXEL_TO_METER), height:(37.4 / PIXEL_TO_METER), x:0, y:(3.4 / PIXEL_TO_METER)});
_local5 = qWorld.addPoly({verts:[_local1], x:0, y:(-45 / PIXEL_TO_METER)});
_local6 = qWorld.addGroup({skin:objectMov, objects:[_local3, _local4, _local5], x:(objectMov.x / PIXEL_TO_METER), y:(objectMov.y / PIXEL_TO_METER), mass:200});
_local7 = qWorld.addCircle({fillAlpha:0, lineAlpha:0, density:0, radius:(9 / PIXEL_TO_METER), x:(objectMov.x / PIXEL_TO_METER), y:(objectMov.y / PIXEL_TO_METER)});
_local8 = qWorld.addJoint({lineAlpha:0, collideConnected:false, type:"revolute", a:_local7.body, b:_local6.body});
}
}
}//package com.chocorobokun.domino.partObjects
Section 113
//ScrewPartObject (com.chocorobokun.domino.partObjects.ScrewPartObject)
package com.chocorobokun.domino.partObjects {
public class ScrewPartObject extends PartObject implements IPart {
override public function partCreation():void{
qWorld.addCircle({skin:objectMov, density:0});
}
}
}//package com.chocorobokun.domino.partObjects
Section 114
//SeesawPartObject (com.chocorobokun.domino.partObjects.SeesawPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
import Box2D.Dynamics.*;
public class SeesawPartObject extends PartObject implements IPart {
override public function partCreation():void{
var _local1:QuickObject = qWorld.addBox({skin:objectMov});
var _local2:b2Body = _local1.body;
var _local3:QuickObject = qWorld.addCircle({fillAlpha:0, lineAlpha:0, density:0, x:_local2.GetPosition().x, y:_local2.GetPosition().y, radius:((_local2.m_userData.height / 2) / PIXEL_TO_METER)});
qWorld.addJoint({collideConnected:false, type:"revolute", a:_local3.body, b:_local2});
}
}
}//package com.chocorobokun.domino.partObjects
Section 115
//SmallBallPartObject (com.chocorobokun.domino.partObjects.SmallBallPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
import com.chocorobokun.domino.world.*;
public class SmallBallPartObject extends PartObject implements IPart {
private var main:MainStage;
public function setDocumentClass(_arg1:MainStage){
main = _arg1;
}
override public function partCreation():void{
var _local1:QuickObject = qWorld.addCircle({skin:objectMov});
main.movableObjects.push(_local1);
}
}
}//package com.chocorobokun.domino.partObjects
Section 116
//SmallBoxPartObject (com.chocorobokun.domino.partObjects.SmallBoxPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
import com.chocorobokun.domino.world.*;
public class SmallBoxPartObject extends PartObject implements IPart {
private var main:MainStage;
public function setDocumentClass(_arg1:MainStage){
main = _arg1;
}
override public function partCreation():void{
var _local1:QuickObject = qWorld.addBox({skin:objectMov});
main.movableObjects.push(_local1);
}
}
}//package com.chocorobokun.domino.partObjects
Section 117
//SmallCirclePartObject (com.chocorobokun.domino.partObjects.SmallCirclePartObject)
package com.chocorobokun.domino.partObjects {
public class SmallCirclePartObject extends PartObject implements IPart {
override public function partCreation():void{
qWorld.addCircle({skin:objectMov, density:0});
}
}
}//package com.chocorobokun.domino.partObjects
Section 118
//SmallConcavePartObject (com.chocorobokun.domino.partObjects.SmallConcavePartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
public class SmallConcavePartObject extends PartObject implements IPart {
override public function partCreation():void{
var _local2:*;
var _local3:QuickObject;
var _local4:QuickObject;
var _local5:QuickObject;
var _local6:QuickObject;
var _local7:QuickObject;
var _local8:QuickObject;
var _local1:Array = [-0.5, 0, 137.5, 0, 154, 0, 166.5, 31.5, 150.5, 51.5, -14, 51.5, -30, 31.5, -17, 0];
for (_local2 in _local1) {
_local1[_local2] = (_local1[_local2] / PIXEL_TO_METER);
};
_local3 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(8.2 / PIXEL_TO_METER), x:(-76.6 / PIXEL_TO_METER), y:(-22.3 / PIXEL_TO_METER)});
_local4 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(8.2 / PIXEL_TO_METER), x:(77 / PIXEL_TO_METER), y:(-22.3 / PIXEL_TO_METER)});
_local5 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(13.25 / PIXEL_TO_METER), x:(-85.8 / PIXEL_TO_METER), y:(17.3 / PIXEL_TO_METER)});
_local6 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(13.25 / PIXEL_TO_METER), x:(86.8 / PIXEL_TO_METER), y:(17.3 / PIXEL_TO_METER)});
_local7 = qWorld.addConcaveArc({density:0, verts:[_local1], x:(-67.7 / PIXEL_TO_METER), y:(-22 / PIXEL_TO_METER), radius:(81 / PIXEL_TO_METER)});
_local8 = qWorld.addGroup({skin:objectMov, angle:((45 * Math.PI) / 180), objects:[_local3, _local4, _local5, _local6, _local7], x:(objectMov.x / PIXEL_TO_METER), y:(objectMov.y / PIXEL_TO_METER)});
}
}
}//package com.chocorobokun.domino.partObjects
Section 119
//SmallGearPartObject (com.chocorobokun.domino.partObjects.SmallGearPartObject)
package com.chocorobokun.domino.partObjects {
import com.actionsnippet.qbox.*;
public class SmallGearPartObject extends PartObject implements IPart {
private var motorSpeed:Number;// = 4
override public function partCreation():void{
var _local10:QuickObject;
var _local11:QuickObject;
var _local1:QuickObject = qWorld.addCircle({radius:(41.5 / PIXEL_TO_METER), x:0, y:0});
var _local2:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:0, y:(-49 / PIXEL_TO_METER)});
var _local3:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:0, y:(49.6 / PIXEL_TO_METER)});
var _local4:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:(-49 / PIXEL_TO_METER), y:0, angle:((-90 * Math.PI) / 180)});
var _local5:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:(49 / PIXEL_TO_METER), y:0, angle:((-90 * Math.PI) / 180)});
var _local6:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:(-35 / PIXEL_TO_METER), y:(-34.5 / PIXEL_TO_METER), angle:((-45 * Math.PI) / 180)});
var _local7:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:(35 / PIXEL_TO_METER), y:(-34.5 / PIXEL_TO_METER), angle:((45 * Math.PI) / 180)});
var _local8:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:(-35 / PIXEL_TO_METER), y:(35 / PIXEL_TO_METER), angle:((45 * Math.PI) / 180)});
var _local9:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:(35 / PIXEL_TO_METER), y:(35 / PIXEL_TO_METER), angle:((-45 * Math.PI) / 180)});
_local10 = qWorld.addGroup({skin:objectMov, objects:[_local1, _local2, _local3, _local4, _local5, _local6, _local7, _local8, _local9], x:(objectMov.x / PIXEL_TO_METER), y:(objectMov.y / PIXEL_TO_METER)});
_local11 = qWorld.addCircle({fillAlpha:0, lineAlpha:0, density:0, radius:(9 / PIXEL_TO_METER), x:(objectMov.x / PIXEL_TO_METER), y:(objectMov.y / PIXEL_TO_METER)});
var _local12:QuickObject = qWorld.addJoint({collideConnected:false, type:"revolute", a:_local11.body, b:_local10.body, enableMotor:true, motorSpeed:motorSpeed, maxMotorTorque:motorSpeed});
}
}
}//package com.chocorobokun.domino.partObjects
Section 120
//PreloaderBikinGames (com.chocorobokun.domino.preloader.PreloaderBikinGames)
package com.chocorobokun.domino.preloader {
import flash.display.*;
import com.chocorobokun.preloader.*;
public class PreloaderBikinGames extends MovieClip implements IPreloader {
public var loaderBar:MovieClip;
public function PreloaderBikinGames(){
loaderBar.stop();
}
public function update(_arg1:int):void{
if (loaderBar.currentFrame < (_arg1 * 2)){
loaderBar.play();
} else {
loaderBar.stop();
};
}
}
}//package com.chocorobokun.domino.preloader
Section 121
//TransitionGate (com.chocorobokun.domino.screens.transition.TransitionGate)
package com.chocorobokun.domino.screens.transition {
import com.chocorobokun.managers.*;
import flash.display.*;
import flash.events.*;
import com.gskinner.motion.*;
import com.chocorobokun.domino.world.*;
import com.gskinner.motion.easing.*;
public class TransitionGate extends MovieClip {
public var gateFilter:MovieClip;
public var aboveDoor:MovieClip;
private var aboveTween:GTween;
private var underTween:GTween;
public var underDoor:MovieClip;
private var main:MainStage;
public var onClosed:Function;
public var isClosed:Boolean;
public var nextScreen:String;
public function TransitionGate(_arg1:MainStage){
main = _arg1;
gateFilter.x = 640;
aboveTween = new GTween(aboveDoor, 1, null, {ease:Circular.easeIn});
underTween = new GTween(underDoor, 1, null, {ease:Circular.easeIn});
addEventListener(Event.ADDED_TO_STAGE, onStage);
}
public function openGate(){
main.addChild(this);
aboveTween.ease = Circular.easeIn;
underTween.ease = Circular.easeIn;
aboveTween.resetValues();
underTween.resetValues();
trace(aboveDoor.y);
trace(underDoor.y);
aboveTween.delay = 0.5;
underTween.delay = 0.5;
aboveTween.setValue("y", -270);
underTween.setValue("y", 508);
isClosed = true;
aboveTween.onComplete = function (){
isClosed = false;
gateFilter.x = 640;
};
}
public function callPassedFunction(){
onClosed();
}
public function closeGate(){
aboveTween.ease = Circular.easeOut;
underTween.ease = Circular.easeOut;
gateFilter.x = 0;
main.addChild(this);
aboveTween.setValue("y", 0);
underTween.setValue("y", 240);
isClosed = true;
aboveTween.onComplete = function (){
isClosed = true;
gateFilter.x = 0;
switch (nextScreen){
case "remove":
if (ScreenManager.getInstance().getCurrentScreenName()){
ScreenManager.getInstance().removeScreen(ScreenManager.getInstance().getCurrentScreenName());
};
break;
case "custom":
trace("VOID");
break;
default:
ScreenManager.getInstance().changeToScreen(nextScreen);
break;
};
underTween.resetValues();
underDoor.y = 240;
if (onClosed != null){
callPassedFunction();
};
onClosed = null;
openGate();
};
}
private function onStage(_arg1:Event){
aboveDoor.y = -270;
underDoor.y = 508;
}
}
}//package com.chocorobokun.domino.screens.transition
Section 122
//ArmorSplashScreen (com.chocorobokun.domino.screens.ArmorSplashScreen)
package com.chocorobokun.domino.screens {
import com.chocorobokun.managers.*;
import flash.display.*;
import flash.events.*;
import com.chocorobokun.util.*;
public class ArmorSplashScreen extends MovieClip {
public var armorLogoMov:MovieClip;
public function ArmorSplashScreen(){
addEventListener(Event.ADDED_TO_STAGE, onStage);
addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(_arg1:Event){
OpenURL.callURL("http://armorgames.com");
}
private function render(_arg1:Event){
if (armorLogoMov.currentFrame == armorLogoMov.totalFrames){
removeEventListener(Event.ENTER_FRAME, render);
ScreenManager.getInstance().removeScreen("armorSplashScreen");
armorLogoMov.gotoAndStop(1);
SoundManager.getInstance().playSound("musicSound", 0.5, 0, 999);
};
}
private function onStage(_arg1:Event){
addEventListener(Event.ENTER_FRAME, render);
}
}
}//package com.chocorobokun.domino.screens
Section 123
//CodeScreen (com.chocorobokun.domino.screens.CodeScreen)
package com.chocorobokun.domino.screens {
import com.chocorobokun.managers.*;
import flash.display.*;
import flash.events.*;
import com.gskinner.motion.*;
import com.chocorobokun.domino.world.*;
import com.gskinner.motion.easing.*;
import flash.text.*;
public class CodeScreen extends MovieClip {
private var main:MainStage;
private var screenManager:ScreenManager;
public var outputDisp:TextField;
public var generateBG:MovieClip;
private var tween:GTween;
public var inputDisp:TextField;
public var playBut:MovieClip;
private var levelManager:LevelManager;
public var backBut:MovieClip;
public function CodeScreen(){
addEventListener(Event.ADDED_TO_STAGE, onStage);
}
private function onPlay(_arg1:Event){
main.transitionGate.onClosed = playLevel;
main.transitionGate.nextScreen = "remove";
main.transitionGate.closeGate();
}
private function onBack(_arg1:Event){
if (!MainClass(root).mainStage.editorMode){
} else {
MainClass(root).mainStage.levelComplete = false;
MainClass(root).mainStage.resetWorld();
MainClass(root).mainStage.addChild(MainClass(root).mainStage.marker);
MainClass(root).mainStage.isSimulated = false;
MainClass(root).mainStage.menuUI.startBut.gotoAndStop("start");
};
screenManager.removeScreen("codeScreen");
}
private function playLevel(){
main.createLevelFromCode(inputDisp.text);
main.inventoryUI.gotoAndStop("show");
levelManager.setCurrentLevel(0);
screenManager.removeScreen("levelScreen");
}
private function clearInput(_arg1:Event){
if (inputDisp.text == "insert code here....."){
inputDisp.text = "";
playBut.visible = true;
};
}
public function onStage(_arg1:Event){
this.y = -480;
tween = new GTween(this, 1, {y:0}, {ease:Bounce.easeOut});
screenManager = ScreenManager.getInstance();
main = MainClass(root).mainStage;
levelManager = LevelManager.getInstance();
playBut.visible = false;
generateBG.visible = false;
if (MainClass(root).mainStage.editorMode){
inputDisp.visible = false;
outputDisp.visible = true;
generateBG.visible = true;
outputDisp.text = MainClass(root).mainStage.generateCode();
} else {
inputDisp.text = "insert code here.....";
inputDisp.visible = true;
generateBG.visible = false;
outputDisp.visible = false;
};
inputDisp.addEventListener(MouseEvent.CLICK, clearInput);
playBut.addEventListener(MouseEvent.CLICK, onPlay);
backBut.addEventListener(MouseEvent.CLICK, onBack);
}
}
}//package com.chocorobokun.domino.screens
Section 124
//CompleteScreen (com.chocorobokun.domino.screens.CompleteScreen)
package com.chocorobokun.domino.screens {
import com.chocorobokun.managers.*;
import flash.display.*;
import flash.events.*;
import com.gskinner.motion.*;
import com.gskinner.motion.easing.*;
public class CompleteScreen extends MovieClip {
private var screenManager:ScreenManager;
private var tween:GTween;
public function CompleteScreen(){
addEventListener(Event.ADDED_TO_STAGE, onStage);
}
private function onStage(_arg1:Event){
var e = _arg1;
screenManager = ScreenManager.getInstance();
tween = new GTween(this, 1, null, {ease:Linear.easeNone});
tween.delay = 2;
tween.setValues({alpha:0});
tween.onComplete = function (){
screenManager.removeScreen("completeScreen");
alpha = 1;
};
}
}
}//package com.chocorobokun.domino.screens
Section 125
//CustomLevelScreen (com.chocorobokun.domino.screens.CustomLevelScreen)
package com.chocorobokun.domino.screens {
import com.chocorobokun.managers.*;
import flash.display.*;
import flash.events.*;
import com.chocorobokun.domino.world.*;
import rl.dev.*;
import flash.text.*;
public class CustomLevelScreen extends MovieClip {
public var labelMov:MovieClip;
public var statusDisp:TextField;
public var highestBut:SimpleButton;
public var levelBut:SimpleButton;
public var leftArrowBut:SimpleButton;
public var buttonLabel:MovieClip;
public var menuBut:SimpleButton;
private var selectedLevels:Array;
public var playBut:SimpleButton;
private var isNewest:Boolean;
private var customLevelItemArray:Array;
public var rightArrowBut:SimpleButton;
private var selectedLevelCode:String;
private var pageNum:int;
private var main:MainStage;
public var newestBut:SimpleButton;
public function CustomLevelScreen(){
addEventListener(Event.ADDED_TO_STAGE, onStage);
rightArrowBut.addEventListener(MouseEvent.CLICK, onArrow);
leftArrowBut.addEventListener(MouseEvent.CLICK, onArrow);
menuBut.addEventListener(MouseEvent.CLICK, onMenu);
levelBut.addEventListener(MouseEvent.CLICK, onLevel);
highestBut.addEventListener(MouseEvent.CLICK, onSort);
newestBut.addEventListener(MouseEvent.CLICK, onSort);
}
private function resetItem(){
var _local1:*;
for (_local1 in customLevelItemArray) {
customLevelItemArray[_local1].removeEventListener(MouseEvent.CLICK, onClick);
removeChild(customLevelItemArray[_local1]);
};
}
public function createLevel(){
main.createLevelFromCode(selectedLevelCode);
}
private function showLevel(){
main.resetWorld();
main.isSimulated = false;
main.menuUI.startBut.gotoAndStop("start");
}
public function setupItems(){
resetItem();
selectedLevels = [];
statusDisp.visible = true;
statusDisp.text = "LOADING LEVELS.....";
if (isNewest){
MainClass(root).mainStage.gamerSafe.levelVaultGetLevelsByDateCreated("2010-07-23 19:30:00", "9010-12-25 14:00:00", false, 4, ((pageNum - 1) * 4));
} else {
MainClass(root).mainStage.gamerSafe.levelVaultGetLevelsByRating(0, 10, false, 4, ((pageNum - 1) * 4));
};
MainClass(root).mainStage.gamerSafe.onLevelVaultGotLevels = function (){
var _local1:*;
if (ScreenManager.getInstance().getCurrentScreenName() == "customLevelScreen"){
SWFConsole.output("LEVELS LOADED!!!!!");
statusDisp.visible = false;
for (_local1 in MainClass(root).mainStage.gamerSafe.levelVaultGetLastSelectedLevels()) {
selectedLevels.push(MainClass(root).mainStage.gamerSafe.levelVaultGetLevelAsObject(MainClass(root).mainStage.gamerSafe.levelVaultGetLastSelectedLevels()[_local1]));
};
setCustomLevelItem();
if (MainClass(root).mainStage.gamerSafe.levelVaultGetLastSelectedLevels().length < 4){
rightArrowBut.visible = false;
};
};
};
}
private function setCustomLevelItem(){
var _local3:MovieClip;
var _local4:int;
var _local5:*;
customLevelItemArray = [];
var _local1:Number = 162;
var _local2:Number = 113.5;
for (_local5 in selectedLevels) {
_local3 = new CustomLevelItem();
_local3.x = ((_local5)<2) ? (_local1 + (_local5 * 165)) : (_local1 + ((_local5 - 2) * 165));
_local3.y = ((_local5)<2) ? _local2 : (_local2 + 135);
customLevelItemArray.push(_local3);
_local3.buttonMode = (_local3.useHandCursor = true);
_local3.addEventListener(MouseEvent.CLICK, onClick);
main.createLevelThumbnail(selectedLevels[_local5].levelProp, _local3.thumbnail);
SWFConsole.output(MainClass(root).mainStage.gamerSafe.levelVaultGetLevelRating(MainClass(root).mainStage.gamerSafe.levelVaultGetLastSelectedLevels()[_local5]));
_local4 = 1;
while (_local4 <= 5) {
if (_local4 <= Math.round((MainClass(root).mainStage.gamerSafe.levelVaultGetLevelRating(MainClass(root).mainStage.gamerSafe.levelVaultGetLastSelectedLevels()[_local5]) / 2))){
_local3[("star" + _local4)].gotoAndStop(1);
} else {
_local3[("star" + _local4)].gotoAndStop(2);
};
_local4++;
};
addChild(_local3);
if (selectedLevels[_local5].title){
_local3.titleDisp.text = selectedLevels[_local5].title;
SWFConsole.output(("LEVEL TITLE IS " + selectedLevels[_local5].title));
} else {
SWFConsole.output("THE LEVEL HAS NO TITLE");
};
};
}
private function onStage(_arg1:Event){
main = MainClass(root).mainStage;
leftArrowBut.visible = false;
rightArrowBut.visible = true;
highestBut.visible = true;
newestBut.visible = false;
isNewest = true;
pageNum = 1;
labelMov.gotoAndStop(1);
setupItems();
}
private function onMenu(_arg1:Event){
main.transitionGate.nextScreen = "menuScreen";
main.transitionGate.closeGate();
}
private function onSort(_arg1:Event){
if (statusDisp.visible){
return;
};
if (isNewest){
highestBut.visible = false;
newestBut.visible = true;
labelMov.gotoAndStop(2);
isNewest = false;
} else {
highestBut.visible = true;
newestBut.visible = false;
labelMov.gotoAndStop(1);
isNewest = true;
};
setupItems();
}
private function onLevel(_arg1:Event){
main.transitionGate.nextScreen = "levelScreen";
main.transitionGate.closeGate();
}
private function onArrow(_arg1:MouseEvent){
if (!statusDisp.visible){
if (_arg1.currentTarget == rightArrowBut){
SWFConsole.output("RIGHT ARROW CLICKED");
leftArrowBut.visible = true;
pageNum++;
} else {
SWFConsole.output("LEFT ARROW CLICKED");
pageNum--;
rightArrowBut.visible = true;
if (pageNum == 1){
_arg1.currentTarget.visible = false;
};
};
setupItems();
};
}
private function onClick(_arg1:Event){
var _local2:*;
for (_local2 in customLevelItemArray) {
if (customLevelItemArray[_local2] == _arg1.currentTarget){
LevelManager.getInstance().setCurrentLevel(0);
main.storedLevelVaultsLevel = MainClass(root).mainStage.gamerSafe.levelVaultGetLastSelectedLevels()[_local2];
selectedLevelCode = selectedLevels[_local2].levelProp;
main.transitionGate.closeGate();
main.transitionGate.onClosed = createLevel;
main.transitionGate.nextScreen = "remove";
};
};
}
}
}//package com.chocorobokun.domino.screens
Section 126
//CustomTutorialScreen (com.chocorobokun.domino.screens.CustomTutorialScreen)
package com.chocorobokun.domino.screens {
import com.chocorobokun.managers.*;
import flash.display.*;
import flash.events.*;
public class CustomTutorialScreen extends MovieClip {
public function CustomTutorialScreen(){
addEventListener(Event.ADDED_TO_STAGE, onStage);
addEventListener(MouseEvent.CLICK, onClick);
}
public function onClick(_arg1:Event){
ScreenManager.getInstance().removeScreen("customTutorialScreen");
}
private function onStage(_arg1:Event){
}
}
}//package com.chocorobokun.domino.screens
Section 127
//FailedScreen (com.chocorobokun.domino.screens.FailedScreen)
package com.chocorobokun.domino.screens {
import com.chocorobokun.managers.*;
import flash.display.*;
import flash.events.*;
import com.gskinner.motion.*;
import com.gskinner.motion.easing.*;
public class FailedScreen extends MovieClip {
private var screenManager:ScreenManager;
private var tween:GTween;
public function FailedScreen(){
addEventListener(Event.ADDED_TO_STAGE, onStage);
}
private function onStage(_arg1:Event){
var e = _arg1;
screenManager = ScreenManager.getInstance();
tween = new GTween(this, 1, {alpha:0}, {ease:Linear.easeNone});
tween.onComplete = function (){
screenManager.removeScreen("failedScreen");
alpha = 1;
};
}
}
}//package com.chocorobokun.domino.screens
Section 128
//LevelScreen (com.chocorobokun.domino.screens.LevelScreen)
package com.chocorobokun.domino.screens {
import com.chocorobokun.managers.*;
import flash.display.*;
import flash.events.*;
import com.chocorobokun.domino.world.*;
import com.chocorobokun.util.*;
import rl.dev.*;
public class LevelScreen extends MovieClip {
public var B20:MovieClip;
public var B21:MovieClip;
public var B23:MovieClip;
public var B24:MovieClip;
public var B25:MovieClip;
public var B26:MovieClip;
public var B27:MovieClip;
public var B29:MovieClip;
public var B28:MovieClip;
public var B22:MovieClip;
public var B30:MovieClip;
public var B31:MovieClip;
public var B32:MovieClip;
public var B33:MovieClip;
public var B34:MovieClip;
public var B35:MovieClip;
public var B36:MovieClip;
public var B37:MovieClip;
public var B38:MovieClip;
public var B39:MovieClip;
public var B1:MovieClip;
public var B2:MovieClip;
public var B3:MovieClip;
public var B4:MovieClip;
public var B5:MovieClip;
public var B6:MovieClip;
public var B7:MovieClip;
public var B8:MovieClip;
public var B9:MovieClip;
public var B40:MovieClip;
public var B41:MovieClip;
public var B42:MovieClip;
public var B43:MovieClip;
public var B44:MovieClip;
public var B45:MovieClip;
public var B47:MovieClip;
public var B46:MovieClip;
public var B48:MovieClip;
public var B49:MovieClip;
public var inputBut:SimpleButton;
public var B50:MovieClip;
public var B52:MovieClip;
public var B53:MovieClip;
public var B54:MovieClip;
public var B55:MovieClip;
public var B56:MovieClip;
public var B51:MovieClip;
public var B59:MovieClip;
public var B57:MovieClip;
public var B58:MovieClip;
public var hintBut:SimpleButton;
public var B60:MovieClip;
private var levelManager:LevelManager;
private var playButton:SimpleButton;
private var screenManager:ScreenManager;
public var menuBut:SimpleButton;
private var selectedLevel:int;
public var playBut:SimpleButton;
private var main:MainStage;
public var B10:MovieClip;
public var B11:MovieClip;
public var B12:MovieClip;
public var B13:MovieClip;
public var B14:MovieClip;
public var B15:MovieClip;
public var B16:MovieClip;
public var B17:MovieClip;
public var B18:MovieClip;
public var B19:MovieClip;
public function LevelScreen(){
playButton = playBut;
screenManager = ScreenManager.getInstance();
setLevelButton();
addEventListener(Event.ADDED_TO_STAGE, onStage);
}
public function setLevelButton(){
trace("LEVELSCREEN.SET LEVEL BUTTON");
var _local1 = 1;
while (_local1 <= 60) {
if (_local1 <= LevelManager.getInstance().getBestLevel()){
this[("B" + _local1)].addEventListener(MouseEvent.CLICK, onClick);
this[("B" + _local1)].gotoAndStop(2);
this[("B" + _local1)].numDisp.gotoAndStop(_local1);
this[("B" + _local1)].buttonMode = (this[("B" + _local1)].useHandCursor = true);
} else {
if (this[("B" + _local1)].hasEventListener(MouseEvent.CLICK)){
this[("B" + _local1)].removeEventListener(MouseEvent.CLICK, onClick);
};
this[("B" + _local1)].buttonMode = (this[("B" + _local1)].useHandCursor = false);
this[("B" + _local1)].gotoAndStop(1);
};
_local1++;
};
}
private function onHint(_arg1:Event){
OpenURL.callURL("http://armorgames.com/guide/missing-mechanism-game-and-video-guide");
}
private function onInput(_arg1:Event){
main.armorGamesAGI.showGameShareList();
}
public function onStage(_arg1:Event){
levelManager = LevelManager.getInstance();
inputBut.addEventListener(MouseEvent.CLICK, onInput);
menuBut.addEventListener(MouseEvent.CLICK, onMenu);
hintBut.addEventListener(MouseEvent.CLICK, onHint);
main = MainClass(root).mainStage;
if (main.armorGamesAGI){
main.armorGamesAGI.agi.closeAGUI();
};
setLevelButton();
}
private function onPlay(_arg1:Event){
trace("LEVELSCREEN.ON PLAY");
}
private function onMenu(_arg1:Event){
trace("LEVELSCREEN.ON MENU");
if (ScreenManager.getInstance().getCurrentScreenName() != "codeScreen"){
MainClass(root).mainStage.transitionGate.nextScreen = "menuScreen";
MainClass(root).mainStage.transitionGate.closeGate();
};
}
public function createLevel(){
main.createLevelFromCode(levelManager.getLevelProp(selectedLevel));
if (levelManager.getBestLevel() == 1){
screenManager.changeToScreen("tutorialScreen", false);
};
}
private function onClick(_arg1:Event){
if (((!((ScreenManager.getInstance().getCurrentScreenName() == "resultScreen"))) && (!((ScreenManager.getInstance().getCurrentScreenName() == "codeScreen"))))){
SWFConsole.output((("LEVEL " + int(_arg1.currentTarget.name.substr(1))) + " SELECTED"));
trace(int(_arg1.currentTarget.name.substr(1)));
trace(MainClass(root).mainStage.objectArray);
trace(("LEVEL SCREEN: " + MainClass(root).mainStage.inventoryUI.currentLabel));
selectedLevel = int(_arg1.currentTarget.name.substr(1));
MainClass(root).mainStage.inventoryUI.gotoAndStop("show");
LevelManager.getInstance().setCurrentLevel(selectedLevel);
MainClass(root).mainStage.transitionGate.nextScreen = "remove";
MainClass(root).mainStage.transitionGate.onClosed = createLevel;
MainClass(root).mainStage.transitionGate.closeGate();
};
}
}
}//package com.chocorobokun.domino.screens
Section 129
//MenuScreen (com.chocorobokun.domino.screens.MenuScreen)
package com.chocorobokun.domino.screens {
import flash.display.*;
import com.actionsnippet.qbox.*;
import flash.events.*;
import flash.utils.*;
import com.chocorobokun.util.*;
import SWFStats.*;
import flash.text.*;
public class MenuScreen extends MovieClip {
private const contraptionCode:String = "mb$758$338$0.5183313374811357$s$fp$734$383$0$s$p2$320$365$-16$s$p1$131$128$-90$s$p14$584$70$0$s$p3$-14$490$90$s$p3$-15$354$89$s$p3$-60$277$-90$s$p3$-60$90$89$s$p4$-38$487$0$s$p3$-60$371$90$s$p3$-60$453$90$s$p3$-38$34$137$s$p3$-60$181$90$s$p17$435$347$0$s$p3$33$19$0$s$p3$-15$266$90$s$p3$-15$167$89$s$p3$36$79$0$s$p3$-16$121$89$s$p15$70$114$0$s$p3$49$187$-59$s$p3$11$271$-72$s$p3$28$148$0$s$p4$177$392$15$s$p3$132$445$0$s$p3$214$440$-13$s$p3$631$399$-90$s$p3$586$331$-90$s$p3$538$408$20$s$p3$544$98$-7$s$p3$560$43$0$s$p3$585$144$90$s$p3$586$238$90$s$p3$637$74$-143$s$p3$632$193$89$s$p3$632$296$90$s$p3$633$89$90$s$p3$587$471$90$s$p3$632$476$90$s$p4$608$487$0$s$p3$464$138$-44$s$p16$71$298$37$s$p3$30$446$0$s$p3$431$102$-53$s$p3$488$56$-22$s$p3$449$30$90$s$p3$537$-3$102$s$p3$639$42$0$s$p3$6$183$62$s$p3$174$17$-51$s$p3$738$231$0$i$p3$740$386$0$s$";
private var playButton:SimpleButton;
public var resetSOBut:SimpleButton;
public var qWorld:QuickBox2D;
public var playBut:SimpleButton;
public var pelangMov:Pelang;
public var physicContainer:MovieClip;
public var fbBut:SimpleButton;
public var armorBut:SimpleButton;
public var artCreditBut:SimpleButton;
public var twitBut:SimpleButton;
private var contraptionCreated:Boolean;
public var codeCreditBut:SimpleButton;
public var resultDisp:TextField;
private var objectArray:Array;
public var createBut:SimpleButton;
private var cWorld:QuickBox2D;
public var moreBut:SimpleButton;
public var hintBut:SimpleButton;
static const PIXEL_TO_METER:int = 30;
public function MenuScreen(){
playButton = playBut;
addEventListener(Event.ADDED_TO_STAGE, onStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemoved);
qWorld = new QuickBox2D(this, {debug:false});
cWorld = new QuickBox2D(this.physicContainer, {debug:false});
var _local1:QuickObject = qWorld.addBox({skin:pelangMov, x:(500 / PIXEL_TO_METER), mass:10});
var _local2:QuickObject = createChain(((_local1.body.GetPosition().x * PIXEL_TO_METER) - 173), (((_local1.body.GetPosition().y * PIXEL_TO_METER) - 60) - 148.5));
var _local3:QuickObject = createChain(((_local1.body.GetPosition().x * PIXEL_TO_METER) + 173), (((_local1.body.GetPosition().y * PIXEL_TO_METER) - 60) - 148.5));
trace(_local2);
var _local4:QuickObject = qWorld.addJoint({collideConnected:false, type:"revolute", a:_local1.body, b:_local2.body, x1:(_local1.body.GetPosition().x - (173 / PIXEL_TO_METER)), y1:(_local1.body.GetPosition().y - (60 / PIXEL_TO_METER)), x2:_local3.body.GetPosition().x, y2:(_local3.body.GetPosition().y - (13.5 / PIXEL_TO_METER))});
var _local5:QuickObject = qWorld.addJoint({collideConnected:false, type:"revolute", a:_local1.body, b:_local3.body, x1:(_local1.body.GetPosition().x + (173 / PIXEL_TO_METER)), y1:(_local1.body.GetPosition().y - (60 / PIXEL_TO_METER)), x2:_local3.body.GetPosition().x, y2:(_local3.body.GetPosition().y - (13.5 / PIXEL_TO_METER))});
}
public function onRemoved(_arg1:Event){
qWorld.stop();
cWorld.stop();
}
private function simulateObject(){
var _local1:*;
for (_local1 in objectArray) {
MainClass(root).mainStage.convertManualObject(objectArray[_local1][0], cWorld);
};
}
private function onCodeCredit(_arg1:Event){
OpenURL.callURL(("mailto:" + "chocorobokun@gmail.com"));
}
private function onHint(_arg1:Event){
OpenURL.callURL("http://armorgames.com/guide/missing-mechanism-game-and-video-guide");
}
private function onTwitter(_arg1:Event){
OpenURL.callURL("http://twitter.com/armorgames");
}
private function onArtCredit(_arg1:Event){
OpenURL.callURL("http://www.fridadwi.com/");
}
private function setMenuContraption(){
MainClass(root).mainStage.createLevelFromCode(contraptionCode, false, false, true);
}
private function createChain(_arg1:Number=200, _arg2:Number=50, _arg3:int=6):QuickObject{
var _local4:QuickObject;
var _local5:QuickObject;
var _local6:QuickObject;
var _local10:*;
var _local7:Array = [];
var _local8:QuickObject = qWorld.addCircle({density:0, x:(_arg1 / PIXEL_TO_METER), y:(_arg2 / PIXEL_TO_METER), fillAlpha:0, lineAlpha:0});
var _local9:int;
while (_local9 < _arg3) {
if ((_local9 % 2) == 0){
trace("FRONT SIDE");
_local5 = qWorld.addBox({skin:ChainFront, height:(19 / PIXEL_TO_METER), width:(10 / PIXEL_TO_METER), x:(_arg1 / PIXEL_TO_METER), y:((_arg2 + (27 * _local9)) / PIXEL_TO_METER)});
} else {
trace("SIDE SIDE");
_local5 = qWorld.addBox({skin:ChainSide, height:(19 / PIXEL_TO_METER), width:(10 / PIXEL_TO_METER), x:(_arg1 / PIXEL_TO_METER), y:((_arg2 + (27 * _local9)) / PIXEL_TO_METER)});
_local7.push(_local5);
};
if (_local9 != 0){
qWorld.addJoint({lineAlpha:0, collideConnected:true, type:"revolute", a:_local5.body, b:_local4.body, x1:(_arg1 / PIXEL_TO_METER), x2:(_arg1 / PIXEL_TO_METER), y1:(((_arg2 + (27 * (_local9 - 1))) + 13.5) / PIXEL_TO_METER), y2:(((_arg2 + (27 * (_local9 - 1))) + 13.5) / PIXEL_TO_METER)});
} else {
qWorld.addJoint({lineAlpha:0, collideConnected:false, type:"revolute", a:_local5.body, b:_local8.body, x1:(_arg1 / PIXEL_TO_METER), x2:(_arg1 / PIXEL_TO_METER), y1:(_arg2 / PIXEL_TO_METER), y2:(_arg2 / PIXEL_TO_METER)});
};
if (_local9 == (_arg3 - 1)){
_local6 = _local5;
};
_local4 = _local5;
_local9++;
};
for (_local10 in _local7) {
addChild(_local7[_local10].body.GetUserData());
};
return (_local6);
}
private function onArmor(_arg1:Event){
OpenURL.callURL(MainClass(root).mainStage.ARMOR_GAMES_URL);
}
private function onReset(_arg1:Event){
MainClass(root).mainStage.resetData();
}
private function onPlay(_arg1:Event){
Log.Play();
MainClass(root).mainStage.editorMode = false;
MainClass(root).mainStage.transitionGate.nextScreen = "levelScreen";
MainClass(root).mainStage.transitionGate.closeGate();
}
private function onCreate(_arg1:Event){
MainClass(root).mainStage.createLevelFromCode("mb$293$91$0$s$fp$271$213$0$s$");
MainClass(root).mainStage.changeToEditorMode();
MainClass(root).mainStage.inventoryUI.gotoAndStop("show");
MainClass(root).mainStage.transitionGate.nextScreen = "customTutorialScreen";
MainClass(root).mainStage.transitionGate.closeGate();
}
private function storeObjectOnStage(){
var _local2:String;
var _local1:int = physicContainer.numChildren;
trace(("CHILDREN COUNT : " + _local1));
objectArray = [];
var _local3:int;
while (_local3 < _local1) {
_local2 = getQualifiedClassName(physicContainer.getChildAt(_local3));
if ((((_local2.substr((_local2.length - 6)) == "Object")) && (!((_local2 == "MainBallObject"))))){
objectArray.push([physicContainer.getChildAt(_local3), physicContainer.getChildAt(_local3).x, physicContainer.getChildAt(_local3).y, physicContainer.getChildAt(_local3).rotation]);
};
_local3++;
};
}
private function onFacebook(_arg1:Event){
OpenURL.callURL("http://www.facebook.com/pages/Armor-Games/19522089061");
}
public function onStage(_arg1:Event){
MainClass(root).mainStage.editorMode = false;
playButton.addEventListener(MouseEvent.CLICK, onPlay);
createBut.addEventListener(MouseEvent.CLICK, onCreate);
resetSOBut.addEventListener(MouseEvent.CLICK, onReset);
armorBut.addEventListener(MouseEvent.CLICK, onArmor);
moreBut.addEventListener(MouseEvent.CLICK, onArmor);
twitBut.addEventListener(MouseEvent.CLICK, onTwitter);
fbBut.addEventListener(MouseEvent.CLICK, onFacebook);
hintBut.addEventListener(MouseEvent.CLICK, onHint);
codeCreditBut.addEventListener(MouseEvent.CLICK, onCodeCredit);
artCreditBut.addEventListener(MouseEvent.CLICK, onArtCredit);
qWorld.start();
cWorld.start();
if (!contraptionCreated){
setMenuContraption();
storeObjectOnStage();
simulateObject();
contraptionCreated = true;
};
}
}
}//package com.chocorobokun.domino.screens
Section 130
//ResultScreen (com.chocorobokun.domino.screens.ResultScreen)
package com.chocorobokun.domino.screens {
import com.chocorobokun.managers.*;
import flash.display.*;
import flash.events.*;
import com.gskinner.motion.*;
import com.chocorobokun.domino.world.*;
import com.gskinner.motion.easing.*;
import com.chocorobokun.domino.ui.*;
public class ResultScreen extends MovieClip {
public var menuBut:SimpleButton;
private var playButton:MovieClip;
private var levelManager:LevelManager;
private var tween:GTween;
public var playBut:MovieClip;
public var ratingMov:RatingUI;
private var main:MainStage;
public var levelBut:SimpleButton;
public function ResultScreen(){
playButton = playBut;
addEventListener(Event.ADDED_TO_STAGE, onStage);
}
private function onLevel(_arg1:Event){
main.transitionGate.onClosed = showLevel;
main.transitionGate.nextScreen = "levelScreen";
main.transitionGate.closeGate();
}
private function showLevel(){
main.resetWorld();
main.isSimulated = false;
main.menuUI.startBut.gotoAndStop("start");
}
private function playLevel(){
main.resetWorld();
main.isSimulated = false;
main.menuUI.startBut.gotoAndStop("start");
main.createLevelFromCode(levelManager.getLevelProp(levelManager.getCurrentLevel()));
}
private function onPlay(_arg1:Event){
trace("NEXT LEVEL");
main.transitionGate.onClosed = playLevel;
main.transitionGate.nextScreen = "remove";
main.transitionGate.closeGate();
}
private function onMenu(_arg1:Event){
main.transitionGate.onClosed = showLevel;
main.transitionGate.nextScreen = "menuScreen";
main.transitionGate.closeGate();
}
public function onStage(_arg1:Event){
trace("RESULT ON STAGE");
this.y = -480;
tween = new GTween(this, 1, {y:0}, {ease:Bounce.easeOut});
playButton.addEventListener(MouseEvent.CLICK, onPlay);
levelBut.addEventListener(MouseEvent.CLICK, onLevel);
menuBut.addEventListener(MouseEvent.CLICK, onMenu);
main = MainClass(root).mainStage;
levelManager = LevelManager.getInstance();
if (LevelManager.getInstance().getCurrentLevel() == 0){
playButton.visible = false;
} else {
playButton.visible = true;
ratingMov.visible = false;
if (LevelManager.getInstance().getCurrentLevel() == MainClass(root).mainStage.MAX_LEVEL){
playButton.visible = false;
};
if (((!(main.isGameCompleted)) && ((levelManager.getCurrentLevel() == main.MAX_LEVEL)))){
ScreenManager.getInstance().changeToScreen("completeScreen", false);
main.isGameCompleted = true;
};
};
}
}
}//package com.chocorobokun.domino.screens
Section 131
//SubmitScreen (com.chocorobokun.domino.screens.SubmitScreen)
package com.chocorobokun.domino.screens {
import com.chocorobokun.managers.*;
import flash.display.*;
import flash.events.*;
import com.gskinner.motion.*;
import com.chocorobokun.domino.world.*;
import com.gskinner.motion.easing.*;
import rl.dev.*;
import flash.text.*;
public class SubmitScreen extends MovieClip {
public var menuBut:SimpleButton;
public var submitBut:SimpleButton;
private var levelCodeContainer:String;
public var noHideMov:MovieClip;
private var main:MainStage;
public var backBut:SimpleButton;
public var resultDisp:TextField;
public function SubmitScreen(){
addEventListener(Event.ADDED_TO_STAGE, onStage);
backBut.addEventListener(MouseEvent.CLICK, onBack);
submitBut.addEventListener(MouseEvent.CLICK, onSubmit);
menuBut.addEventListener(MouseEvent.CLICK, onMenu);
}
private function onMenu(_arg1:Event){
main.transitionGate.onClosed = showLevel;
main.transitionGate.nextScreen = "menuScreen";
main.transitionGate.closeGate();
}
private function onStage(_arg1:Event){
this.y = -480;
var _local2:GTween = new GTween(this, 1, {y:0}, {ease:Bounce.easeOut});
main = MainClass(root).mainStage;
if (main.hiddenObjectNum <= 0){
noHideMov.visible = true;
return;
};
resultDisp.text = "";
submitBut.visible = true;
levelCodeContainer = MainClass(root).mainStage.generateCode();
noHideMov.visible = false;
}
private function showLevel(){
main.resetWorld();
main.isSimulated = false;
main.menuUI.startBut.gotoAndStop("start");
}
private function onName(_arg1:Event){
}
private function onBack(_arg1:Event){
resetEditor();
}
private function onSubmit(_arg1:Event){
var _local2:*;
var _local3:*;
resetEditor();
trace(("INVENTORY OBJECT NUMBER : " + main.objectToInventoryArray.length));
for (_local2 in main.objectToInventoryArray) {
main.objectToInventoryArray[_local2].alpha = 0;
};
main.armorGamesAGI.submitLevel(levelCodeContainer);
for (_local3 in main.objectToInventoryArray) {
main.objectToInventoryArray[_local3].alpha = 0.5;
};
SWFConsole.output("CREATE LEVEL FROM LEVEL EDITOR SCREEN!");
}
private function resetEditor(){
MainClass(root).mainStage.levelComplete = false;
MainClass(root).mainStage.resetWorld();
MainClass(root).mainStage.addChild(MainClass(root).mainStage.marker);
MainClass(root).mainStage.isSimulated = false;
MainClass(root).mainStage.menuUI.startBut.gotoAndStop("start");
ScreenManager.getInstance().removeScreen("submitScreen");
}
}
}//package com.chocorobokun.domino.screens
Section 132
//TutorialScreen (com.chocorobokun.domino.screens.TutorialScreen)
package com.chocorobokun.domino.screens {
import com.chocorobokun.managers.*;
import flash.display.*;
import flash.events.*;
public class TutorialScreen extends MovieClip {
public function TutorialScreen(){
addEventListener(Event.ADDED_TO_STAGE, onStage);
addEventListener(MouseEvent.CLICK, onClick);
}
public function onClick(_arg1:Event){
ScreenManager.getInstance().removeScreen("tutorialScreen");
}
private function onStage(_arg1:Event){
}
}
}//package com.chocorobokun.domino.screens
Section 133
//InventoryUI (com.chocorobokun.domino.ui.InventoryUI)
package com.chocorobokun.domino.ui {
import flash.display.*;
import flash.events.*;
import com.chocorobokun.util.*;
public class InventoryUI extends MovieClip {
public var iconArray:Array;
public var container:MovieClip;
public var SBmov:MovieClip;
public var scrollBar:MakeScrollBar;
public var barBut:SimpleButton;
public var isClosed:Boolean;
public function InventoryUI(){
iconArray = [];
super();
addEventListener(Event.ENTER_FRAME, mainLoop);
scrollBar = new MakeScrollBar(SBmov, moveSB);
container.icon.useHandCursor = true;
container.icon.buttonMode = (container.icon.useHandCursor = true);
addEventListener(Event.ADDED_TO_STAGE, onStage);
}
public function closeUI(){
MainClass(root).mainStage.UIInventoryTween.setValues({y:515.4});
isClosed = true;
}
public function resetIcon(){
clearIcon();
setIcon();
trace(("INVENTORY LIST : " + MainClass(root).mainStage.inventoryList));
if (MainClass(root).mainStage.inventoryList.length == 0){
closeUI();
} else {
if (isClosed){
openUI();
};
};
}
public function clearIcon(){
var _local1:*;
if (iconArray.length > 0){
for (_local1 in iconArray) {
container.icon.removeChild(iconArray[_local1]);
};
};
iconArray = [];
}
public function moveSB(_arg1:Number){
trace(("sb ratio :" + _arg1));
var _local2:Number = ((container.icon.width - 450) * -(_arg1));
if ((container.icon.width - 450) > 0){
container.icon.x = _local2;
};
}
public function onBarBut(_arg1:Event){
if (!MainClass(root).mainStage.isSimulated){
if (!isClosed){
closeUI();
} else {
openUI();
};
};
}
public function iconClicked(_arg1:Event){
var _local2:*;
if (!MainClass(root).mainStage.isSimulated){
MainClass(root).mainStage.addObjectToStage((_arg1.currentTarget.currentLabel + "Object"));
if (!MainClass(root).mainStage.editorMode){
for (_local2 in MainClass(root).mainStage.inventoryList) {
if (MainClass(root).mainStage.inventoryList[_local2] == _arg1.currentTarget.currentLabel){
MainClass(root).mainStage.inventoryList.splice(_local2, 1);
resetIcon();
break;
};
};
};
};
}
public function showInventory(){
play();
}
public function setIcon(){
var _local1:MovieClip;
var _local2:*;
moveSB(0);
SBmov.drag_mc.x = 0;
container.icon.x = 0;
for (_local2 in MainClass(root).mainStage.inventoryList) {
_local1 = new IconUI();
container.icon.addChild(_local1);
_local1.x = (90 * _local2);
_local1.y = 0;
_local1.gotoAndStop(MainClass(root).mainStage.inventoryList[_local2]);
_local1.addEventListener(MouseEvent.CLICK, iconClicked);
iconArray.push(_local1);
};
}
public function mainLoop(_arg1:Event){
if (currentFrame == 1){
stop();
};
if (currentFrame == 10){
stop();
};
}
public function openUI(){
MainClass(root).mainStage.UIInventoryTween.setValues({y:446.4});
isClosed = false;
}
public function onStage(_arg1:Event){
setIcon();
barBut.addEventListener(MouseEvent.CLICK, onBarBut);
}
}
}//package com.chocorobokun.domino.ui
Section 134
//RatingUI (com.chocorobokun.domino.ui.RatingUI)
package com.chocorobokun.domino.ui {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class RatingUI extends MovieClip {
public var star2:MovieClip;
public var star3:MovieClip;
public var outputDisp:TextField;
public var star4:MovieClip;
public var star5:MovieClip;
private var playedLevel;
private var starNum:int;
public var star1:MovieClip;
public function RatingUI(){
var _local1 = 1;
while (_local1 <= 5) {
this[("star" + _local1)].addEventListener(MouseEvent.CLICK, onStar);
this[("star" + _local1)].buttonMode = (this[("star" + _local1)].useHandCursor = true);
_local1++;
};
}
public function getRating():Number{
return ((starNum * 2));
}
public function init(){
trace("RATING UI INIT!");
outputDisp.text = "";
starNum = 3;
setStar();
}
public function setTarget(_arg1){
playedLevel = _arg1;
}
private function onStar(_arg1:MouseEvent){
var e = _arg1;
starNum = e.currentTarget.name.substr(4);
setStar();
MainClass(root).mainStage.gamerSafe.levelVaultRateLevel(MainClass(root).mainStage.storedLevelVaultsLevel, getRating());
MainClass(root).mainStage.gamerSafe.onLevelVaultLevelRated = function (){
outputDisp.text = "level rate submitted!";
};
}
private function setStar(){
var _local1 = 1;
while (_local1 <= 5) {
if (_local1 <= starNum){
this[("star" + _local1)].gotoAndStop(1);
} else {
this[("star" + _local1)].gotoAndStop(2);
};
_local1++;
};
}
}
}//package com.chocorobokun.domino.ui
Section 135
//MainStage (com.chocorobokun.domino.world.MainStage)
package com.chocorobokun.domino.world {
import com.chocorobokun.managers.*;
import flash.display.*;
import com.actionsnippet.qbox.*;
import flash.events.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import fl.motion.*;
import com.gskinner.motion.*;
import flash.utils.*;
import com.chocorobokun.util.*;
import com.chocorobokun.CollisionDetection.*;
import com.chocorobokun.domino.data.*;
import flash.net.*;
import com.chocorobokun.domino.partObjects.*;
import com.gskinner.motion.easing.*;
import com.gamersafe.*;
import com.chocorobokun.domino.constant.*;
import com.coreyoneil.collision.*;
import rl.dev.*;
import com.chocorobokun.armorgames.*;
import flash.text.*;
import com.chocorobokun.domino.screens.*;
import com.chocorobokun.domino.ui.*;
import com.chocorobokun.domino.screens.transition.*;
public class MainStage extends MovieClip {
public const PIXEL_TO_METER:int = 30;
public const PART_LIST:Array;
public const ARMOR_GAMES_URL:String = "http://armorgames.com/";
public const MAX_LEVEL:int = 60;
public var ballIsOut:Boolean;
public var currentCode:String;
public var isCollideColor:Color;
public var staticParts:Array;
public var finishPointMov:FinishPoint;
public var inventoryList:Array;
public var isMusic:Boolean;
public var musicBut:MovieClip;
public var objectToInventoryArray:Array;
public var UIInventoryTween:GTween;
public var storedLevelVaultsLevel;
public var menuUI:MovieClip;
public var gravityParts:Array;
public var hiddenObjectNum:int;// = 0
public var marker:MovieClip;
public var notCollideColor:Color;
public var isStopped:Boolean;
public var mainBall:QuickObject;
public var objectArray:Array;
public var isMute:Boolean;
public var staticObjectSkins:Array;
public var gamerSafe:GamerSafe;
public var isGameCompleted:Boolean;
public var collisionDetection:GSCollision;
public var swfConsole:SWFConsole;
public var testStore:Array;
private var achievementManager:AchievementManager;
public var isDragging:Boolean;
public var mainBallMov:MainBallObject;
public var mainBallStoredX:Number;// = 0
private var soundManager:SoundManager;
private var screenManager:ScreenManager;
public var isRotating:Boolean;
public var mainBallStoredY:Number;// = 0
public var muteBut:MovieClip;
public var rotator:MovieClip;
public var qWorld:QuickBox2D;
public var isSimulated:Boolean;
public var isCollide:Boolean;
public var finishPoint:QuickObject;
public var transitionGate:TransitionGate;
public var mover:MovieClip;
public var sitelockMov:MovieClip;
public var soundDelay:int;// = 0
public var menuIsClosed:Boolean;
public var movableObjects:Array;
public var saveData:SharedObject;
public var editorMode:Boolean;
public var selectedObject:Object;
public var bodyArray:Array;
public var dynamicObjectSkins:Array;
public var codeInput:TextField;
public var levelProperties:Array;
public var MenuUITween:GTween;
public var armorGamesAGI:ArmorGamesAGI;
public var levelComplete:Boolean;
public var collisionList:CollisionList;
public var stageLayer:MovieClip;
public var storedAngle:Number;// = 0
public var inventoryUI:InventoryUI;
public function MainStage(){
PART_LIST = ["BigCircle", "BigConcave", "BigGear", "Block", "Bounce", "SmallBox", "ConveyorBelt", "Crossbar", "Domino", "Fan", "Magnet", "MovableBlock", "Screw", "Seesaw", "SmallBall", "SmallCircle", "SmallConcave", "SmallGear", "Piston", "LeftConveyorBelt"];
objectArray = [];
bodyArray = [];
marker = new Marker();
mover = new Mover();
rotator = new Rotator();
inventoryUI = new InventoryUI();
movableObjects = [];
dynamicObjectSkins = [];
staticObjectSkins = [];
gravityParts = [];
staticParts = [];
inventoryList = [];
levelProperties = [];
objectToInventoryArray = [];
testStore = [];
super();
addEventListener(Event.ADDED_TO_STAGE, onStage);
}
private function onMenu(){
if (!isSimulated){
storeObjectOnStage();
simulateObject();
addChild(finishPoint.userData);
resetWorld();
menuUI.startBut.gotoAndStop("start");
} else {
resetWorld();
addChild(marker);
isSimulated = false;
menuUI.startBut.gotoAndStop("start");
};
if (screenManager.getCurrentScreenName() != null){
screenManager.removeScreen(screenManager.getCurrentScreenName());
};
screenManager.changeToScreen("menuScreen", false);
}
public function generateCode():String{
var _local3:*;
var _local4:*;
var _local1 = "";
_local1 = (_local1 + (((((("mb$" + mainBallStoredX) + "$") + mainBallStoredY) + "$") + mainBallMov.rotation) + "$s$"));
_local1 = (_local1 + (((((("fp$" + finishPointMov.x) + "$") + finishPointMov.y) + "$") + finishPointMov.rotation) + "$s$"));
var _local2 = "";
for (_local3 in objectArray) {
_local2 = getQualifiedClassName(objectArray[_local3][0]);
if (_local2.length > 6){
_local2 = _local2.substr(0, (_local2.length - 6));
for (_local4 in PART_LIST) {
if (_local2 == PART_LIST[_local4]){
_local1 = (_local1 + (((((((("p" + _local4) + "$") + objectArray[_local3][1]) + "$") + objectArray[_local3][2]) + "$") + objectArray[_local3][3]) + "$"));
if (objectArray[_local3][4]){
_local1 = (_local1 + "i$");
} else {
_local1 = (_local1 + "s$");
};
};
};
};
};
return (_local1);
}
private function gotAchievement(){
if (achievementManager.setAchievement(AchievementConstant.ACHIEVEMENT_MECHANISM_GOD, 1)){
gamerSafe.bestowAchievement(GamerSafeConstants.ACHIEVEMENT_MECHANISM_GOD);
};
}
public function setBodyToDomino(_arg1:b2Body){
var _local2:b2Body = _arg1;
var _local3:QuickObject = qWorld.addCircle({allowSleep:false, fillAlpha:0, lineAlpha:0, density:0, x:_local2.GetPosition().x, y:(_local2.GetPosition().y + (((_local2.m_userData.height / 2) - (_local2.m_userData.width / 2)) / PIXEL_TO_METER)), radius:((_local2.m_userData.width / 2) / PIXEL_TO_METER)});
var _local4:b2Joint = qWorld.addJoint({collideConnected:false, type:"revolute", a:_local3.body, b:_local2, enableLimit:true, lowerAngle:0, upperAngle:((90 * Math.PI) / 180)}).joint;
}
public function init(){
var _local1:LevelData = new LevelData();
initSO();
LevelManager.getInstance().init(this, LevelData.levelArray);
LevelManager.getInstance().setLevel(saveData.data.bestLevel);
ScreenManager.getInstance().init(this, this);
ScreenManager.getInstance().addScreen(new MenuScreen(), "menuScreen");
ScreenManager.getInstance().addScreen(new LevelScreen(), "levelScreen");
ScreenManager.getInstance().addScreen(new ResultScreen(), "resultScreen");
ScreenManager.getInstance().addScreen(new CodeScreen(), "codeScreen");
ScreenManager.getInstance().addScreen(new FailedScreen(), "failedScreen");
ScreenManager.getInstance().addScreen(new SubmitScreen(), "submitScreen");
ScreenManager.getInstance().addScreen(new CustomLevelScreen(), "customLevelScreen");
ScreenManager.getInstance().addScreen(new CompleteScreen(), "completeScreen");
ScreenManager.getInstance().addScreen(new TutorialScreen(), "tutorialScreen");
ScreenManager.getInstance().addScreen(new ArmorSplashScreen(), "armorSplashScreen");
ScreenManager.getInstance().addScreen(new CustomTutorialScreen(), "customTutorialScreen");
AchievementManager.getInstance().init(AchievementData.achievementArray, 3, gotAchievement);
achievementManager = AchievementManager.getInstance();
swfConsole = new SWFConsole(640, 480, true);
addChild(swfConsole);
SWFConsole.output("Hello Worlds!!!");
collisionDetection = new GSCollision();
isCollideColor = new Color();
notCollideColor = new Color();
notCollideColor.setTint(0, 0);
isCollideColor.setTint(0xFF0000, 0.5);
collisionList = new CollisionList(mainBallMov);
editorMode = false;
storeObjectOnStage();
addChild(marker);
marker.visible = false;
mover.visible = false;
rotator.visible = false;
addChild(inventoryUI);
inventoryUI.x = 247.3;
inventoryUI.y = 446.4;
UIInventoryTween = new GTween(inventoryUI, 0.25, null, {ease:Circular.easeOut});
MenuUITween = new GTween(menuUI, 0.25, null, {ease:Circular.easeOut});
MenuUITween.setValues({y:422});
menuIsClosed = true;
soundManager = SoundManager.getInstance();
soundManager.addLibrarySound(HitSound, "hitSound");
soundManager.addLibrarySound(BounceSound, "bounceSound");
soundManager.addLibrarySound(MusicSound, "musicSound");
var _local2 = "mb$293$91$-8$s$fp$271$213$0$s$p15$311$148$0$s$p13$198$197$0$s$p12$256$225$0$s$p12$129$209$0$s$";
SWFConsole.output("brute force test 1");
menuUI.startBut.stop();
menuUI.startBut.addEventListener(MouseEvent.CLICK, onClick);
menuUI.solutionBut.addEventListener(MouseEvent.CLICK, onClick);
menuUI.hintBut.addEventListener(MouseEvent.CLICK, onClick);
menuUI.menuBut.addEventListener(MouseEvent.CLICK, onClick);
menuUI.barBut.addEventListener(MouseEvent.CLICK, onClick);
SWFConsole.output("brute force test 2");
stage.addEventListener(MouseEvent.MOUSE_UP, onMouse_Up);
stage.addEventListener(MouseEvent.MOUSE_MOVE, dragging);
stageLayer.addEventListener(MouseEvent.MOUSE_DOWN, onDrag);
marker.mover.addEventListener(MouseEvent.MOUSE_DOWN, onDrag);
marker.rotator.addEventListener(MouseEvent.MOUSE_DOWN, onDrag);
marker.rotator.addEventListener(MouseEvent.CLICK, onClick);
marker.removeBut.addEventListener(MouseEvent.CLICK, onRemove);
marker.markBut.addEventListener(MouseEvent.CLICK, onClick);
mainBallMov.addEventListener(MouseEvent.CLICK, onDrag);
finishPointMov.addEventListener(MouseEvent.CLICK, onDrag);
addEventListener(Event.ENTER_FRAME, mainLoop);
screenManager = ScreenManager.getInstance();
ScreenManager.getInstance().changeToScreen("menuScreen", false);
screenManager.changeToScreen("armorSplashScreen", false);
transitionGate = new TransitionGate(this);
addChild(transitionGate);
}
private function checkCollision(_arg1){
var _local2:Boolean;
var _local3:*;
var _local4:*;
if (checkObjectToInventory(_arg1) == null){
_arg1.transform.colorTransform = notCollideColor;
} else {
_arg1.transform.colorTransform = new Color(1, 1, 1, 0.5);
};
isCollide = false;
collisionList.swapTarget(_arg1);
for (_local3 in dynamicObjectSkins) {
if (dynamicObjectSkins[_local3] != _arg1){
collisionList.addItem(dynamicObjectSkins[_local3]);
};
if (dynamicObjectSkins[_local3] != _arg1){
if (collisionList.checkCollisions().length > 0){
_arg1.transform.colorTransform = isCollideColor;
isCollide = true;
};
} else {
for (_local4 in staticObjectSkins) {
collisionList.addItem(staticObjectSkins[_local4]);
if (collisionList.checkCollisions().length > 0){
_arg1.transform.colorTransform = isCollideColor;
isCollide = true;
};
collisionList.removeItem(staticObjectSkins[_local4]);
};
};
if (dynamicObjectSkins[_local3] != _arg1){
collisionList.removeItem(dynamicObjectSkins[_local3]);
};
};
}
public function ballOutOfBound(){
screenManager.changeToScreen("failedScreen", false);
resetLevel();
}
public function createSlot(_arg1:DisplayObject):QuickObject{
var _local2:DisplayObject = _arg1;
var _local3:Array = [];
_local3[0] = qWorld.addBox({x:0, y:((-20 * _local2.scaleY) / PIXEL_TO_METER), width:((24 * _local2.scaleX) / PIXEL_TO_METER), height:((15 * _local2.scaleY) / PIXEL_TO_METER), density:0});
_local3[1] = qWorld.addBox({x:0, y:((21 * _local2.scaleY) / PIXEL_TO_METER), width:((24 * _local2.scaleX) / PIXEL_TO_METER), height:((15 * _local2.scaleY) / PIXEL_TO_METER), density:0});
return (qWorld.addGroup({objects:_local3, skin:_local2, density:0}));
}
public function createFinishPoint(_arg1:DisplayObject){
finishPoint = qWorld.addConcaveArc({skin:FinishPointLayer, fillAlpha:0, lineAlpha:0, radius:(17 / PIXEL_TO_METER), density:0, verts:[[0, 0, (34 / PIXEL_TO_METER), 0, (17 / PIXEL_TO_METER), (17 / PIXEL_TO_METER)]], x:((_arg1.x + 7.5) / PIXEL_TO_METER), y:((_arg1.y + 23.5) / PIXEL_TO_METER)});
addChild(finishPoint.userData);
}
public function createGearSmall(_arg1:DisplayObject=null, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
var _local14:QuickObject;
var _local15:QuickObject;
var _local5:QuickObject = qWorld.addCircle({radius:(41.5 / PIXEL_TO_METER), x:0, y:0});
var _local6:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:0, y:(-49 / PIXEL_TO_METER)});
var _local7:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:0, y:(49.6 / PIXEL_TO_METER)});
var _local8:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:(-49 / PIXEL_TO_METER), y:0, angle:((-90 * Math.PI) / 180)});
var _local9:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:(49 / PIXEL_TO_METER), y:0, angle:((-90 * Math.PI) / 180)});
var _local10:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:(-35 / PIXEL_TO_METER), y:(-34.5 / PIXEL_TO_METER), angle:((-45 * Math.PI) / 180)});
var _local11:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:(35 / PIXEL_TO_METER), y:(-34.5 / PIXEL_TO_METER), angle:((45 * Math.PI) / 180)});
var _local12:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:(-35 / PIXEL_TO_METER), y:(35 / PIXEL_TO_METER), angle:((45 * Math.PI) / 180)});
var _local13:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(12.4 / PIXEL_TO_METER), height:(16.3 / PIXEL_TO_METER), x:(35 / PIXEL_TO_METER), y:(35 / PIXEL_TO_METER), angle:((-45 * Math.PI) / 180)});
if (_arg1){
_local14 = qWorld.addGroup({skin:_arg1, objects:[_local5, _local6, _local7, _local8, _local9, _local10, _local11, _local12, _local13], x:(_arg1.x / PIXEL_TO_METER), y:(_arg1.y / PIXEL_TO_METER)});
_local15 = qWorld.addCircle({fillAlpha:0, lineAlpha:0, density:0, radius:(9 / PIXEL_TO_METER), x:(_arg1.x / PIXEL_TO_METER), y:(_arg1.y / PIXEL_TO_METER)});
} else {
_local14 = qWorld.addGroup({skin:SmallGearObject, objects:[_local5, _local6, _local7, _local8, _local9, _local10, _local11, _local12, _local13], x:(_arg3 / PIXEL_TO_METER), y:(_arg4 / PIXEL_TO_METER)});
_local15 = qWorld.addCircle({fillAlpha:0, lineAlpha:0, density:0, radius:(9 / PIXEL_TO_METER), x:(_arg3 / PIXEL_TO_METER), y:(_arg4 / PIXEL_TO_METER)});
};
var _local16:QuickObject = qWorld.addJoint({collideConnected:false, type:"revolute", a:_local15.body, b:_local14.body, enableMotor:true, motorSpeed:_arg2, maxMotorTorque:_arg2});
}
public function clearLevel(){
var _local1:*;
for (_local1 in objectArray) {
if (objectArray[_local1][5]){
removePart(objectArray[_local1][0]);
};
};
staticObjectSkins = [];
dynamicObjectSkins = [];
inventoryList = [];
inventoryUI.resetIcon();
}
public function createBigConcaveArc(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0){
var _local6:*;
var _local7:*;
var _local8:QuickObject;
var _local9:QuickObject;
var _local10:QuickObject;
var _local11:QuickObject;
var _local12:QuickObject;
var _local13:QuickObject;
var _local4:Array = [0, 0, 201, 0, 221.5, 0, 188.4, 79.5, 14, 79.5, -20, 0];
var _local5:Array = [134.9, 79.5, 117.4, 88.5, 84.3, 88.5, 67.5, 79.5];
for (_local6 in _local4) {
_local4[_local6] = (_local4[_local6] / PIXEL_TO_METER);
};
for (_local7 in _local5) {
_local5[_local7] = (_local5[_local7] / PIXEL_TO_METER);
};
_local8 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(8.5 / PIXEL_TO_METER), x:(-9 / PIXEL_TO_METER), y:(-1 / PIXEL_TO_METER)});
_local9 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(8.5 / PIXEL_TO_METER), x:(210 / PIXEL_TO_METER), y:(-1 / PIXEL_TO_METER)});
_local10 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(16.9 / PIXEL_TO_METER), x:(100.9 / PIXEL_TO_METER), y:(84.1 / PIXEL_TO_METER)});
_local11 = qWorld.addPoly({density:0, fillAlpha:0, lineAlpha:0, verts:[_local5], x:(0 / PIXEL_TO_METER), y:(0 / PIXEL_TO_METER)});
_local12 = qWorld.addConcaveArc({density:0, verts:[_local4], x:(0 / PIXEL_TO_METER), y:(0 / PIXEL_TO_METER), radius:(109.5 / PIXEL_TO_METER)});
_local13 = qWorld.addGroup({skin:_arg1, angle:((rotation * Math.PI) / 180), objects:[_local12, _local8, _local9, _local10, _local11], x:(_arg1.x / PIXEL_TO_METER), y:(_arg1.y / PIXEL_TO_METER)});
}
public function dragging(_arg1:Event){
var _local2:Number;
var _local3:Number;
if (((isDragging) && (!((selectedObject == menuUI.startBut))))){
marker.x = mouseX;
marker.y = mouseY;
mover.x = mouseX;
mover.y = mouseY;
rotator.x = mover.x;
rotator.y = mover.y;
selectedObject.x = mover.x;
selectedObject.y = mover.y;
checkCollision(selectedObject);
};
if (isRotating){
if (storedAngle == 999){
storedAngle = selectedObject.rotation;
};
_local2 = Math.atan2((selectedObject.y - mouseY), (selectedObject.x - mouseX));
_local3 = selectedObject.rotation;
selectedObject.rotation = ((((_local2 * 180) / Math.PI) + 180) + storedAngle);
};
}
public function changeToEditorMode(){
hiddenObjectNum = 0;
editorMode = true;
inventoryList = PART_LIST;
inventoryUI.resetIcon();
}
private function checkObjectToInventory(_arg1){
var _local2:*;
for (_local2 in objectToInventoryArray) {
if (objectToInventoryArray[_local2] == _arg1){
return (_arg1);
};
};
return (null);
}
public function onCollide(_arg1:Number, _arg2:String){
if (isMute){
return;
};
if (soundDelay == 0){
soundManager.playSound(_arg2, (0.005 * _arg1), 1.5);
soundDelay = 60;
};
}
public function onRemove(_arg1:Event){
var _local2:String = getQualifiedClassName(selectedObject);
if ((((selectedObject.alpha <= 0.5)) && (editorMode))){
hiddenObjectNum--;
};
if (!editorMode){
inventoryList.push(_local2.substr(0, (_local2.length - 6)));
inventoryUI.resetIcon();
};
removePart(selectedObject);
marker.visible = false;
}
public function onStage(_arg1:Event){
armorGamesAGI = new ArmorGamesAGI();
addChild(armorGamesAGI);
init();
sitelockMov.visible = false;
muteBut.stop();
muteBut.buttonMode = (muteBut.useHandCursor = true);
muteBut.addEventListener(MouseEvent.CLICK, onMute);
isMusic = true;
musicBut.stop();
musicBut.buttonMode = (musicBut.useHandCursor = true);
musicBut.addEventListener(MouseEvent.CLICK, onMusic);
}
public function resetLevel(){
levelComplete = false;
resetWorld();
if (inventoryUI.currentFrame < 10){
};
addChild(marker);
isSimulated = false;
menuUI.startBut.gotoAndStop("start");
addChild(menuUI);
addChild(inventoryUI);
}
public function resetWorld(){
var _local1:*;
var _local2:*;
levelComplete = false;
removeChild(finishPoint.userData);
movableObjects = [];
staticParts = [];
for (_local1 in gravityParts) {
gravityParts[_local1].destroyPart();
};
qWorld.destroy();
marker.x = -100;
for (_local2 in objectArray) {
if (objectArray[_local2][0] != inventoryUI){
objectArray[_local2][0].x = objectArray[_local2][1];
objectArray[_local2][0].y = objectArray[_local2][2];
objectArray[_local2][0].rotation = objectArray[_local2][3];
};
};
}
public function simulateObject(){
var _local1:*;
marker.visible = false;
qWorld = new QuickBox2D(this, {debug:false});
qWorld.start();
for (_local1 in objectArray) {
convertManualObject(objectArray[_local1][0], qWorld);
};
addChild(menuUI);
addChild(inventoryUI);
}
public function onMusic(_arg1:Event){
if (isMusic){
soundManager.setSoundVolume("musicSound", 0);
_arg1.currentTarget.gotoAndStop(2);
isMusic = false;
} else {
_arg1.currentTarget.gotoAndStop(1);
soundManager.setSoundVolume("musicSound", 0.5);
isMusic = true;
};
}
private function testBed(){
SWFConsole.output("/*------------------------TEST BED-------------------*/");
}
public function onMouse_Up(_arg1:Event){
if (((selectedObject) && (!(isCollide)))){
isDragging = false;
isRotating = false;
storedAngle = 999;
};
}
public function createSmallConcaveArc(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0){
var _local5:*;
var _local6:QuickObject;
var _local7:QuickObject;
var _local8:QuickObject;
var _local9:QuickObject;
var _local10:QuickObject;
var _local11:QuickObject;
var _local4:Array = [-0.5, 0, 137.5, 0, 154, 0, 166.5, 31.5, 150.5, 51.5, -14, 51.5, -30, 31.5, -17, 0];
for (_local5 in _local4) {
_local4[_local5] = (_local4[_local5] / PIXEL_TO_METER);
};
_local6 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(8.2 / PIXEL_TO_METER), x:(-76.6 / PIXEL_TO_METER), y:(-22.3 / PIXEL_TO_METER)});
_local7 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(8.2 / PIXEL_TO_METER), x:(77 / PIXEL_TO_METER), y:(-22.3 / PIXEL_TO_METER)});
_local8 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(13.25 / PIXEL_TO_METER), x:(-85.8 / PIXEL_TO_METER), y:(17.3 / PIXEL_TO_METER)});
_local9 = qWorld.addCircle({density:0, fillAlpha:0, lineAlpha:0, radius:(13.25 / PIXEL_TO_METER), x:(86.8 / PIXEL_TO_METER), y:(17.3 / PIXEL_TO_METER)});
_local10 = qWorld.addConcaveArc({density:0, verts:[_local4], x:(-67.7 / PIXEL_TO_METER), y:(-22 / PIXEL_TO_METER), radius:(81 / PIXEL_TO_METER)});
if (_arg1){
_local11 = qWorld.addGroup({skin:_arg1, angle:((45 * Math.PI) / 180), objects:[_local6, _local7, _local8, _local9, _local10], x:(_arg1.x / PIXEL_TO_METER), y:(_arg1.y / PIXEL_TO_METER)});
} else {
_local11 = qWorld.addGroup({skin:SmallConcaveObject, angle:((45 * Math.PI) / 180), objects:[_local6, _local7, _local8, _local9, _local10], x:(_arg2 / PIXEL_TO_METER), y:(_arg3 / PIXEL_TO_METER)});
};
}
public function removePart(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
for (_local2 in dynamicObjectSkins) {
if (dynamicObjectSkins[_local2] == _arg1){
dynamicObjectSkins.splice(_local2, 1);
break;
};
};
for (_local3 in staticObjectSkins) {
if (staticObjectSkins[_local3] == _arg1){
staticObjectSkins.splice(_local3, 1);
break;
};
};
for (_local4 in objectArray) {
if (objectArray[_local4][0] == _arg1){
removeChild(objectArray[_local4][0]);
objectArray.splice(_local4, 0);
break;
};
};
}
public function onMute(_arg1:Event){
if (isMute){
_arg1.currentTarget.gotoAndStop(1);
isMute = false;
} else {
_arg1.currentTarget.gotoAndStop(2);
isMute = true;
};
}
public function createGearBig(_arg1:DisplayObject=null, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
var _local5:QuickObject = qWorld.addCircle({radius:(49 / PIXEL_TO_METER), x:0, y:0});
var _local6:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(0 / PIXEL_TO_METER), y:(-59.2 / PIXEL_TO_METER)});
var _local7:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(0 / PIXEL_TO_METER), y:(58.8 / PIXEL_TO_METER)});
var _local8:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(34.9 / PIXEL_TO_METER), y:(-47.8 / PIXEL_TO_METER), angle:((36.3 * Math.PI) / 180)});
var _local9:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(-34.9 / PIXEL_TO_METER), y:(-47.8 / PIXEL_TO_METER), angle:((-36.3 * Math.PI) / 180)});
var _local10:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(56 / PIXEL_TO_METER), y:(-18 / PIXEL_TO_METER), angle:((72.3 * Math.PI) / 180)});
var _local11:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(-56 / PIXEL_TO_METER), y:(-18 / PIXEL_TO_METER), angle:((-72.3 * Math.PI) / 180)});
var _local12:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(56 / PIXEL_TO_METER), y:(17.7 / PIXEL_TO_METER), angle:((-72.3 * Math.PI) / 180)});
var _local13:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(-56 / PIXEL_TO_METER), y:(17.7 / PIXEL_TO_METER), angle:((72.3 * Math.PI) / 180)});
var _local14:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(34.9 / PIXEL_TO_METER), y:(47.4 / PIXEL_TO_METER), angle:((-36.3 * Math.PI) / 180)});
var _local15:QuickObject = qWorld.addBox({fillAlpha:0, lineAlpha:0, width:(16.9 / PIXEL_TO_METER), height:(22.6 / PIXEL_TO_METER), x:(-34.9 / PIXEL_TO_METER), y:(47.4 / PIXEL_TO_METER), angle:((36.3 * Math.PI) / 180)});
var _local16:QuickObject = qWorld.addGroup({skin:_arg1, objects:[_local5, _local6, _local7, _local8, _local9, _local10, _local11, _local12, _local13, _local14, _local15], x:(_arg1.x / PIXEL_TO_METER), y:(_arg1.y / PIXEL_TO_METER)});
var _local17:QuickObject = qWorld.addCircle({fillAlpha:0, lineAlpha:0, density:0, radius:(9 / PIXEL_TO_METER), x:(_arg1.x / PIXEL_TO_METER), y:(_arg1.y / PIXEL_TO_METER)});
var _local18:QuickObject = qWorld.addJoint({collideConnected:false, type:"revolute", a:_local17.body, b:_local16.body, enableMotor:true, motorSpeed:_arg2, maxMotorTorque:_arg2});
}
public function resetData(){
saveData.data.bestLevel = 1;
LevelManager.getInstance().setBestLevel(saveData.data.bestLevel);
trace("DATA RESETED!!!!!!!!!!!!!!");
}
public function createBounce(_arg1:DisplayObject=null){
var _local2:QuickObject;
if (_arg1){
_local2 = qWorld.addBox({skin:_arg1, density:0, allowSleep:false, restitution:1.5});
} else {
_local2 = qWorld.addBox({skin:BlockObject, density:0, x:320, y:240});
};
}
private function initSO(){
saveData = SharedObject.getLocal("testSO5");
if (!saveData.data.bestLevel){
saveData.data.bestLevel = 1;
trace("SO CREATED!!!!!!!!!!!!!");
} else {
trace((("SO ALREADY CREATED!!!!!!!!!!!!!!!!!!!" + " BEST LEVEL : ") + saveData.data.bestLevel));
};
}
public function onDrag(_arg1:Event){
if (((((((((!(isSimulated)) && (!((_arg1.currentTarget == marker.mover))))) && (!((_arg1.currentTarget == marker.rotator))))) && (!((_arg1.currentTarget == stageLayer))))) && (!((_arg1.currentTarget == menuUI))))){
selectedObject = _arg1.currentTarget;
marker.visible = true;
marker.removeBut.visible = true;
marker.rotator.visible = true;
if (editorMode){
marker.markBut.visible = true;
if (_arg1.currentTarget.alpha == 0.5){
marker.markBut.gotoAndStop("unlock");
} else {
marker.markBut.gotoAndStop("lock");
};
};
mover.visible = true;
rotator.visible = true;
marker.x = selectedObject.x;
marker.y = selectedObject.y;
};
if ((((_arg1.currentTarget == mainBallMov)) || ((_arg1.currentTarget == finishPointMov)))){
marker.removeBut.visible = false;
marker.rotator.visible = false;
marker.markBut.visible = false;
if (!editorMode){
marker.visible = false;
};
};
if (((!(isSimulated)) && ((_arg1.currentTarget == marker.mover)))){
isDragging = true;
};
if (((!(isSimulated)) && ((_arg1.currentTarget == marker.rotator)))){
isRotating = true;
};
if (_arg1.currentTarget == stageLayer){
selectedObject = null;
marker.visible = false;
};
}
public function levelWin(){
if (!editorMode){
ScreenManager.getInstance().changeToScreen("resultScreen", false);
if (LevelManager.getInstance().getCurrentLevel() < MAX_LEVEL){
LevelManager.getInstance().setCurrentLevel((LevelManager.getInstance().getCurrentLevel() + 1));
};
if (LevelManager.getInstance().getBestLevel() < LevelManager.getInstance().getCurrentLevel()){
LevelManager.getInstance().setBestLevel(LevelManager.getInstance().getCurrentLevel());
saveData.data.bestLevel = LevelManager.getInstance().getBestLevel();
};
} else {
ScreenManager.getInstance().changeToScreen("submitScreen", false);
SWFConsole.output("CODE GENERATED");
SWFConsole.output("/------------------------------------>8--/");
SWFConsole.output(generateCode());
SWFConsole.output("/------------------------------------>8--/");
};
}
public function createLevelFromCode(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Boolean=false){
var _local5:MovieClip;
var _local12:int;
var _local13:*;
MenuUITween.setValues({y:422});
menuIsClosed = true;
objectToInventoryArray = [];
staticObjectSkins = [];
dynamicObjectSkins = [];
clearLevel();
testStore = [];
currentCode = _arg1;
var _local6:String = _arg1;
var _local7:Array = [];
var _local8 = "";
var _local9:int;
var _local10 = 1;
var _local11:int;
while (_local11 < _local6.length) {
if (_local6.charAt(_local11) != "$"){
_local8 = (_local8 + _local6.charAt(_local11));
} else {
_local7.push(_local8);
if (_local10 < 5){
_local10++;
} else {
testStore.push(_local7);
_local7 = [];
_local10 = 1;
};
_local8 = "";
};
_local11++;
};
for (_local13 in testStore) {
switch (testStore[_local13][0]){
case "mb":
mainBallMov.x = testStore[_local13][1];
mainBallMov.y = testStore[_local13][2];
dynamicObjectSkins.push(mainBallMov);
break;
case "fp":
finishPointMov.x = testStore[_local13][1];
finishPointMov.y = testStore[_local13][2];
dynamicObjectSkins.push(finishPointMov);
break;
default:
_local12 = int(testStore[_local13][0].substr(1));
if (testStore[_local13][4] != "i"){
if (_arg2){
addObjectToStage((PART_LIST[_local12] + "Object"), testStore[_local13][1], testStore[_local13][2], testStore[_local13][3]);
} else {
addObjectToStage((PART_LIST[_local12] + "Object"), testStore[_local13][1], testStore[_local13][2], testStore[_local13][3], true, 1, _arg4);
};
} else {
if (_arg2){
addObjectToStage((PART_LIST[_local12] + "Object"), testStore[_local13][1], testStore[_local13][2], testStore[_local13][3], false, 0.5);
inventoryList = PART_LIST;
inventoryUI.resetIcon();
} else {
if (!_arg3){
if (!_arg4){
inventoryList.push(PART_LIST[_local12]);
inventoryUI.resetIcon();
};
} else {
addObjectToStage((PART_LIST[_local12] + "Object"), testStore[_local13][1], testStore[_local13][2], testStore[_local13][3]);
};
};
};
break;
};
};
if (!_arg4){
addChild(inventoryUI);
};
}
public function getObjectByBodyName(_arg1:String=null):b2Body{
var _local2:Array = [];
var _local3:int = qWorld.w.Query(qWorld.worldAABB, _local2, 100);
var _local4:b2Body;
var _local5:int;
while (_local5 < _local3) {
if (_arg1 == _local2[_local5].m_body.m_userData.name){
_local4 = _local2[_local5].m_body;
break;
};
_local5++;
};
return (_local4);
}
public function addObjectToStage(_arg1:String, _arg2:int=320, _arg3:int=240, _arg4:int=0, _arg5:Boolean=false, _arg6:Number=1, _arg7:Boolean=false, _arg8:MovieClip=null, _arg9:Number=1){
var _local11:*;
var _local10:Object = getDefinitionByName(_arg1);
switch (_arg1){
case "FanObject":
_local11 = new FanObject();
_local11.gotoAndStop(4);
if (!_arg7){
dynamicObjectSkins.push(_local11);
};
break;
case "SmallBoxObject":
_local11 = new (_local10);
if (!_arg7){
dynamicObjectSkins.push(_local11);
};
break;
case "SmallBallObject":
_local11 = new (_local10);
if (!_arg7){
dynamicObjectSkins.push(_local11);
};
break;
case "CrossbarObject":
_local11 = new (_local10);
if (!_arg7){
dynamicObjectSkins.push(_local11);
};
break;
default:
_local11 = new (_local10);
if (!_arg7){
staticObjectSkins.push(_local11);
};
break;
};
if (!_arg7){
if (_arg8){
_arg8.addChild(_local11);
} else {
addChild(_local11);
};
} else {
screenManager.getScreen("menuScreen").physicContainer.addChild(_local11);
};
_local11.x = _arg2;
_local11.y = _arg3;
_local11.scaleX = (_local11.scaleY = _arg9);
if ((((_arg2 == 320)) && ((_arg3 == 240)))){
checkCollision(_local11);
};
_local11.rotation = _arg4;
_local11.alpha = _arg6;
if (_arg6 == 0.5){
objectToInventoryArray.push(_local11);
};
if (((!(_arg7)) && (!(_arg8)))){
objectArray.push([_local11, _local11.x, _local11.y, _local11.rotation, false, true]);
};
if (!_arg5){
_local11.addEventListener(MouseEvent.CLICK, onDrag);
addChild(marker);
selectedObject = _local11;
marker.visible = true;
marker.removeBut.visible = true;
marker.rotator.visible = true;
if (editorMode){
marker.markBut.visible = true;
marker.markBut.gotoAndStop("lock");
} else {
marker.markBut.visible = false;
};
marker.x = selectedObject.x;
marker.y = selectedObject.y;
};
if (((!(_arg7)) && (!(_arg8)))){
addChild(menuUI);
addChild(inventoryUI);
};
}
public function onClick(_arg1:Event){
switch (_arg1.currentTarget){
case marker.markBut:
if (((!((ScreenManager.getInstance().getCurrentScreenName() == "resultScreen"))) && (!((ScreenManager.getInstance().getCurrentScreenName() == "codeScreen"))))){
if (selectedObject.alpha == 1){
selectedObject.alpha = 0.5;
marker.markBut.gotoAndStop("unlock");
hiddenObjectNum++;
if (checkObjectToInventory(selectedObject) == null){
objectToInventoryArray.push(selectedObject);
};
} else {
selectedObject.alpha = 1;
marker.markBut.gotoAndStop("lock");
hiddenObjectNum--;
if (checkObjectToInventory(selectedObject)){
objectToInventoryArray.splice(objectToInventoryArray.indexOf(selectedObject), 1);
};
};
};
break;
case marker.rotator:
storedAngle = 999;
break;
case menuUI.barBut:
if (menuIsClosed){
MenuUITween.setValues({y:351});
menuIsClosed = false;
} else {
MenuUITween.setValues({y:422});
menuIsClosed = true;
};
break;
case menuUI.startBut:
if (((!((ScreenManager.getInstance().getCurrentScreenName() == "resultScreen"))) && (!((ScreenManager.getInstance().getCurrentScreenName() == "codeScreen"))))){
if (!isSimulated){
storeObjectOnStage();
simulateObject();
if (inventoryUI.currentFrame >= 10){
};
if (!inventoryUI.isClosed){
inventoryUI.closeUI();
};
addChild(finishPoint.userData);
isSimulated = true;
marker.visible = false;
mover.visible = false;
rotator.visible = false;
menuUI.startBut.gotoAndStop("reset");
} else {
resetLevel();
};
};
break;
case menuUI.hintBut:
case menuUI.solutionBut:
if (editorMode){
trace("HINT EDITOR");
ScreenManager.getInstance().changeToScreen("customTutorialScreen");
return;
};
if (isSimulated){
return;
};
if (LevelManager.getInstance().getCurrentLevel() != 0){
OpenURL.callURL("http://armorgames.com/guide/missing-mechanism-game-and-video-guide");
} else {
createLevelFromCode(currentCode, false, true);
};
break;
case menuUI.menuBut:
if (armorGamesAGI.agi){
armorGamesAGI.agi.closeAGUI();
};
transitionGate.nextScreen = "custom";
transitionGate.onClosed = onMenu;
transitionGate.closeGate();
break;
};
}
public function createLevelThumbnail(_arg1:String, _arg2:MovieClip){
var _local9:int;
var _local12:*;
var _local3:Array = [];
var _local4:String = _arg1;
var _local5:Array = [];
var _local6 = "";
var _local7 = 1;
var _local8:int;
while (_local8 < _local4.length) {
if (_local4.charAt(_local8) != "$"){
_local6 = (_local6 + _local4.charAt(_local8));
} else {
_local5.push(_local6);
if (_local7 < 5){
_local7++;
} else {
_local3.push(_local5);
_local5 = [];
_local7 = 1;
};
_local6 = "";
};
_local8++;
};
var _local10:MovieClip = new MainBallObject();
var _local11:MovieClip = new FinishPointObject();
for (_local12 in _local3) {
switch (_local3[_local12][0]){
case "mb":
_local10.x = (_local3[_local12][1] * 0.2);
_local10.y = (_local3[_local12][2] * 0.2);
_local10.scaleX = (_local10.scaleY = 0.2);
_arg2.addChild(_local10);
break;
case "fp":
_local11.x = (_local3[_local12][1] * 0.2);
_local11.y = (_local3[_local12][2] * 0.2);
_local11.scaleX = (_local11.scaleY = 0.2);
_arg2.addChild(_local11);
break;
default:
_local9 = int(_local3[_local12][0].substr(1));
if (_local3[_local12][4] != "i"){
addObjectToStage((PART_LIST[_local9] + "Object"), (_local3[_local12][1] * 0.2), (_local3[_local12][2] * 0.2), _local3[_local12][3], true, 1, false, _arg2, 0.2);
};
break;
};
};
}
public function storeObjectOnStage(){
var _local2:Boolean;
var _local3:String;
mainBallStoredX = mainBallMov.x;
mainBallStoredY = mainBallMov.y;
var _local1:int = numChildren;
objectArray = [];
var _local4:int;
while (_local4 < _local1) {
if (getChildAt(_local4).alpha == 0.5){
_local2 = true;
} else {
_local2 = false;
};
_local3 = getQualifiedClassName(getChildAt(_local4));
if ((((_local3.substr((_local3.length - 6)) == "Object")) && (!((_local3 == "MainBallObject"))))){
objectArray.push([getChildAt(_local4), getChildAt(_local4).x, getChildAt(_local4).y, getChildAt(_local4).rotation, _local2, true]);
} else {
objectArray.push([getChildAt(_local4), getChildAt(_local4).x, getChildAt(_local4).y, getChildAt(_local4).rotation, _local2, false]);
};
_local4++;
};
}
public function createBlock(_arg1:DisplayObject=null, _arg2:Number=0, _arg3:Number=0){
var _local4:QuickObject;
if (_arg1){
_local4 = qWorld.addBox({skin:_arg1, density:0, allowSleep:false});
} else {
_local4 = qWorld.addBox({skin:BlockObject, density:0, x:320, y:240});
};
}
public function createSeesaw(_arg1:DisplayObject):QuickObject{
var _local2:QuickObject = qWorld.addBox({skin:_arg1});
var _local3:b2Body = _local2.body;
var _local4:QuickObject = qWorld.addCircle({fillAlpha:0, lineAlpha:0, density:0, x:_local3.GetPosition().x, y:_local3.GetPosition().y, radius:((_local3.m_userData.height / 2) / PIXEL_TO_METER)});
qWorld.addJoint({collideConnected:false, type:"revolute", a:_local4.body, b:_local3});
return (_local2);
}
public function convertManualObject(_arg1:DisplayObject, _arg2:QuickBox2D){
var _local5:QuickObject;
var _local6:IPart;
var _local7:DominoPartObject;
var _local8:SmallBoxPartObject;
var _local9:SmallBallPartObject;
var _local10:FanPartObject;
var _local11:MagnetPartObject;
var _local12:MainBallPartObject;
var _local3:String = getQualifiedClassName(_arg1);
var _local4:QuickBox2D = _arg2;
switch (_local3){
case "BoxManual":
_local5 = _local4.addBox({skin:_arg1, density:0});
break;
case "Box":
_local5 = _local4.addBox({skin:_arg1});
break;
case "Circle":
_local5 = _local4.addCircle({skin:_arg1});
break;
case "BoxPulley":
break;
case "BoxRevolute":
break;
case "Slot":
createSlot(_arg1);
break;
case "BlockObject":
_local6 = new BlockPartObject();
_local6.partInit(_local4, _arg1);
break;
case "SeesawObject":
_local6 = new SeesawPartObject();
_local6.partInit(_local4, _arg1);
break;
case "MovableBlockObject":
_local6 = new MovableBlockPartObject();
_local6.partInit(_local4, _arg1);
break;
case "DominoObject":
_local7 = new DominoPartObject();
_local7.setDocumentClass(this);
_local7.partInit(_local4, _arg1);
break;
case "CrossbarObject":
_local6 = new CrossbarPartObject();
_local6.partInit(_local4, _arg1);
break;
case "BigCircleObject":
_local6 = new BigCirclePartObject();
_local6.partInit(_local4, _arg1);
break;
case "SmallBoxObject":
_local8 = new SmallBoxPartObject();
_local8.setDocumentClass(this);
_local8.partInit(_local4, _arg1);
break;
case "SmallBallObject":
_local9 = new SmallBallPartObject();
_local9.setDocumentClass(this);
_local9.partInit(_local4, _arg1);
break;
case "ScrewObject":
_local6 = new ScrewPartObject();
_local6.partInit(_local4, _arg1);
break;
case "SmallGearObject":
_local6 = new SmallGearPartObject();
_local6.partInit(_local4, _arg1);
break;
case "BigGearObject":
_local6 = new BigGearPartObject();
_local6.partInit(_local4, _arg1);
break;
case "SmallConcaveObject":
_local6 = new SmallConcavePartObject();
_local6.partInit(_local4, _arg1);
break;
case "BigConcaveObject":
_local6 = new BigConcavePartObject();
_local6.partInit(_local4, _arg1);
break;
case "BounceObject":
_local6 = new BouncePartObject();
_local6.partInit(_local4, _arg1);
staticParts.push(_local6);
break;
case "SmallCircleObject":
_local6 = new SmallCirclePartObject();
_local6.partInit(_local4, _arg1);
break;
case "ConveyorBeltObject":
_local6 = new ConveyorBeltPartObject();
_local6.partInit(_local4, _arg1);
break;
case "LeftConveyorBeltObject":
_local6 = new LeftConveyorBeltPartObject();
_local6.partInit(_local4, _arg1);
break;
case "FanObject":
_local10 = new FanPartObject();
_local10.setDocumentClass(this);
_local10.partInit(_local4, _arg1);
gravityParts.push(_local10);
break;
case "MagnetObject":
_local11 = new MagnetPartObject();
_local11.setDocumentClass(this);
_local11.partInit(_local4, _arg1);
gravityParts.push(_local11);
break;
case "PistonObject":
_local6 = new PistonPartObject();
_local6.partInit(_local4, _arg1);
break;
case "MainBallObject":
_local12 = new MainBallPartObject();
_local12.setDocumentClass(this);
_local12.partInit(_local4, _arg1);
gravityParts.push(_local12);
break;
case "FinishPoint":
createFinishPoint(_arg1);
break;
};
}
public function mainLoop(_arg1:Event){
if (screenManager.getCurrentScreenName() == "armorSplashScreen"){
return;
};
addChild(swfConsole);
addChild(muteBut);
addChild(musicBut);
menuUI.hintBut.visible = false;
menuUI.solutionBut.visible = false;
if (LevelManager.getInstance().getCurrentLevel() != 0){
menuUI.hintBut.visible = true;
} else {
menuUI.solutionBut.visible = true;
};
if (editorMode){
menuUI.hintBut.visible = true;
menuUI.solutionBut.visible = false;
};
}
}
}//package com.chocorobokun.domino.world
Section 136
//AchievementManager (com.chocorobokun.managers.AchievementManager)
package com.chocorobokun.managers {
public class AchievementManager {
private var callback:Function;
private var achievementArray:Array;
private var initiated:Boolean;
private var numIndex:int;
private static var allowInstantiation:Boolean;
private static var instance:AchievementManager;
public function AchievementManager(){
if (!allowInstantiation){
throw (new Error("Error: use AchievementManager.getInstance() instead of new"));
};
}
public function init(_arg1:Array, _arg2:int, _arg3:Function=null):void{
if (!initiated){
achievementArray = _arg1.concat();
numIndex = _arg2;
callback = _arg3;
initiated = true;
};
}
public function setAchievement(_arg1:int, _arg2:int, _arg3:Boolean=true):Boolean{
if (((!(_arg3)) && ((achievementArray[_arg1][numIndex] >= _arg2)))){
return (false);
};
if (achievementArray[_arg1][numIndex] <= 0){
return (false);
};
achievementArray[_arg1][numIndex] = (achievementArray[_arg1][numIndex] - _arg2);
if (achievementArray[_arg1][numIndex] <= 0){
if (callback != null){
callback();
};
return (true);
//unresolved jump
};
return (false);
}
public static function getInstance():AchievementManager{
if (!instance){
allowInstantiation = true;
instance = new (AchievementManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package com.chocorobokun.managers
Section 137
//LevelManager (com.chocorobokun.managers.LevelManager)
package com.chocorobokun.managers {
import flash.display.*;
public class LevelManager {
private var bestLevel:int;// = 0
private var main:Sprite;
private var currentLevel:int;// = 0
private var levelsData:Array;
private var initiated:Boolean;// = false
private static var allowInstantiation:Boolean;
private static var instance:LevelManager;
public function LevelManager(){
levelsData = [];
super();
if (!allowInstantiation){
throw (new Error("Error: use LevelManager.getInstance() instead of new"));
};
}
public function setLevel(_arg1:int){
currentLevel = _arg1;
bestLevel = _arg1;
}
public function getCurrentLevel():int{
return (currentLevel);
}
public function getBestLevel():int{
return (bestLevel);
}
public function setCurrentLevel(_arg1:int){
currentLevel = _arg1;
}
public function init(_arg1:Sprite, _arg2:Array){
if (!initiated){
main = _arg1;
levelsData = _arg2;
initiated = true;
};
}
public function getLevelProp(_arg1:int):String{
return (levelsData[(_arg1 - 1)]);
}
public function setBestLevel(_arg1:int){
bestLevel = _arg1;
}
public static function getInstance():LevelManager{
if (!instance){
allowInstantiation = true;
instance = new (LevelManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package com.chocorobokun.managers
Section 138
//ScreenManager (com.chocorobokun.managers.ScreenManager)
package com.chocorobokun.managers {
import flash.display.*;
import flash.utils.*;
public class ScreenManager {
private var screenDict:Dictionary;
private var view:DisplayObjectContainer;
private var activeScreenArray:Array;
private var initiated:Boolean;// = false
public var currentScreen:String;
private var screenArray:Array;
private var main:Sprite;
private var prevScreen:String;
private static var allowInstantiation:Boolean;
private static var instance:ScreenManager;
public function ScreenManager(){
activeScreenArray = [];
super();
screenDict = new Dictionary(true);
screenArray = [];
if (!allowInstantiation){
throw (new Error("Error: use ScreenManager.getInstance() instead of new"));
};
}
public function getCurrentScreenName():String{
return (currentScreen);
}
public function removeScreen(_arg1:String){
var _local3:*;
var _local2:Object = screenDict[_arg1];
view.removeChild(_local2.screen);
trace((_local2.name + " Removed!!"));
if (_arg1 == currentScreen){
for (_local3 in activeScreenArray) {
if (activeScreenArray[_local3] == currentScreen){
activeScreenArray.splice(_local3, 1);
break;
};
};
if (activeScreenArray[(activeScreenArray.length - 1)]){
currentScreen = activeScreenArray[(activeScreenArray.length - 1)];
} else {
currentScreen = null;
};
};
trace(("CURRENT SCREEN IS " + currentScreen));
}
public function getScreen(_arg1:String){
return (screenDict[_arg1].screen);
}
public function init(_arg1:Sprite, _arg2:DisplayObjectContainer){
if (!initiated){
main = _arg1;
view = _arg2;
initiated = true;
};
}
public function addScreen(_arg1:MovieClip, _arg2:String):Boolean{
var _local3:*;
var _local4:Object;
var _local5:MovieClip;
for (_local3 in screenArray) {
if (screenArray[_local3].name == _arg2){
return (false);
};
};
_local4 = new Object();
_local5 = _arg1;
_local4.name = _arg2;
_local4.screen = _local5;
screenDict[_arg2] = _local4;
screenArray.push(_local4);
trace((_arg2 + " Stored!"));
return (true);
}
public function changeToScreen(_arg1:String, _arg2:Boolean=true, _arg3:Number=0, _arg4:Number=0):void{
var _local5:Object;
var _local6:*;
if (((_arg2) && (currentScreen))){
trace("CURRENT SCREEN DETECTED");
_local5 = screenDict[currentScreen];
view.removeChild(_local5.screen);
for (_local6 in activeScreenArray) {
if (activeScreenArray[_local6] == currentScreen){
activeScreenArray.splice(_local6, 1);
break;
};
};
};
_local5 = screenDict[_arg1];
_local5.screen.x = _arg3;
_local5.screen.y = _arg4;
view.addChild(_local5.screen);
activeScreenArray.push(_arg1);
trace(("CURRENT SCREEN 1:" + currentScreen));
currentScreen = activeScreenArray[(activeScreenArray.length - 1)];
trace(("CURRENT SCREEN 2:" + currentScreen));
}
public static function getInstance():ScreenManager{
if (!instance){
allowInstantiation = true;
instance = new (ScreenManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package com.chocorobokun.managers
Section 139
//SoundManager (com.chocorobokun.managers.SoundManager)
package com.chocorobokun.managers {
import flash.media.*;
import flash.utils.*;
import flash.net.*;
public class SoundManager {
private var _sounds:Array;
private var _soundsDict:Dictionary;
private static var _instance:SoundManager;
private static var _allowInstance:Boolean;
public function SoundManager(){
this._soundsDict = new Dictionary(true);
this._sounds = new Array();
if (!SoundManager._allowInstance){
throw (new Error("Error: Use SoundManager.getInstance() instead of the new keyword."));
};
}
public function pauseSound(_arg1:String):void{
var _local2:Object = this._soundsDict[_arg1];
_local2.paused = true;
_local2.position = _local2.channel.position;
_local2.channel.stop();
}
public function fadeSound(_arg1:String, _arg2:Number=0, _arg3:Number=1):void{
}
public function get sounds():Array{
return (this._sounds);
}
public function setSoundVolume(_arg1:String, _arg2:Number):void{
var _local3:Object = this._soundsDict[_arg1];
var _local4:SoundTransform = _local3.channel.soundTransform;
_local4.volume = _arg2;
_local3.channel.soundTransform = _local4;
}
public function getSoundDuration(_arg1:String):Number{
return (this._soundsDict[_arg1].sound.length);
}
public function toString():String{
return (getQualifiedClassName(this));
}
public function getSoundVolume(_arg1:String):Number{
return (this._soundsDict[_arg1].channel.soundTransform.volume);
}
public function addLibrarySound(_arg1, _arg2:String):Boolean{
var _local3:int;
while (_local3 < this._sounds.length) {
if (this._sounds[_local3].name == _arg2){
return (false);
};
_local3++;
};
var _local4:Object = new Object();
var _local5:Sound = new (_arg1);
_local4.name = _arg2;
_local4.sound = _local5;
_local4.channel = new SoundChannel();
_local4.position = 0;
_local4.paused = true;
_local4.volume = 1;
_local4.startTime = 0;
_local4.loops = 0;
_local4.pausedByAll = false;
this._soundsDict[_arg2] = _local4;
this._sounds.push(_local4);
return (true);
}
public function isSoundPaused(_arg1:String):Boolean{
return (this._soundsDict[_arg1].paused);
}
public function removeAllSounds():void{
var _local1:int;
while (_local1 < this._sounds.length) {
this._sounds[_local1] = null;
_local1++;
};
this._sounds = new Array();
this._soundsDict = new Dictionary(true);
}
public function getSoundPosition(_arg1:String):Number{
return (this._soundsDict[_arg1].channel.position);
}
public function stopAllSounds(_arg1:Boolean=true):void{
var _local3:String;
var _local2:int;
while (_local2 < this._sounds.length) {
_local3 = this._sounds[_local2].name;
if (_arg1){
if (!this._soundsDict[_local3].paused){
this._soundsDict[_local3].pausedByAll = true;
this.stopSound(_local3);
};
} else {
this.stopSound(_local3);
};
_local2++;
};
}
public function removeSound(_arg1:String):void{
var _local2:int;
while (_local2 < this._sounds.length) {
if (this._sounds[_local2].name == _arg1){
this._sounds[_local2] = null;
this._sounds.splice(_local2, 1);
};
_local2++;
};
delete this._soundsDict[_arg1];
}
public function muteAllSounds():void{
var _local2:String;
var _local1:int;
while (_local1 < this._sounds.length) {
_local2 = this._sounds[_local1].name;
this.setSoundVolume(_local2, 0);
_local1++;
};
}
public function stopSound(_arg1:String):void{
var _local2:Object = this._soundsDict[_arg1];
_local2.paused = true;
_local2.channel.stop();
_local2.position = _local2.channel.position;
}
public function pauseAllSounds(_arg1:Boolean=true):void{
var _local3:String;
var _local2:int;
while (_local2 < this._sounds.length) {
_local3 = this._sounds[_local2].name;
if (_arg1){
if (!this._soundsDict[_local3].paused){
this._soundsDict[_local3].pausedByAll = true;
this.pauseSound(_local3);
};
} else {
this.pauseSound(_local3);
};
_local2++;
};
}
public function playAllSounds(_arg1:Boolean=false):void{
var _local3:String;
var _local2:int;
while (_local2 < this._sounds.length) {
_local3 = this._sounds[_local2].name;
if (_arg1){
if (this._soundsDict[_local3].pausedByAll){
this._soundsDict[_local3].pausedByAll = false;
this.playSound(_local3);
};
} else {
this.playSound(_local3);
};
_local2++;
};
}
public function addExternalSound(_arg1:String, _arg2:String, _arg3:Number=1000, _arg4:Boolean=false):Boolean{
var _local5:int;
while (_local5 < this._sounds.length) {
if (this._sounds[_local5].name == _arg2){
return (false);
};
_local5++;
};
var _local6:Object = new Object();
var _local7:Sound = new Sound(new URLRequest(_arg1), new SoundLoaderContext(_arg3, _arg4));
_local6.name = _arg2;
_local6.sound = _local7;
_local6.channel = new SoundChannel();
_local6.position = 0;
_local6.paused = true;
_local6.volume = 1;
_local6.startTime = 0;
_local6.loops = 0;
_local6.pausedByAll = false;
this._soundsDict[_arg2] = _local6;
this._sounds.push(_local6);
return (true);
}
public function unmuteAllSounds():void{
var _local2:String;
var _local3:Object;
var _local4:SoundTransform;
var _local1:int;
while (_local1 < this._sounds.length) {
_local2 = this._sounds[_local1].name;
_local3 = this._soundsDict[_local2];
_local4 = _local3.channel.soundTransform;
_local4.volume = _local3.volume;
_local3.channel.soundTransform = _local4;
_local1++;
};
}
public function isSoundPausedByAll(_arg1:String):Boolean{
return (this._soundsDict[_arg1].pausedByAll);
}
public function getSoundObject(_arg1:String):Sound{
return (this._soundsDict[_arg1].sound);
}
public function playSound(_arg1:String, _arg2:Number=1, _arg3:Number=0, _arg4:int=0):void{
var _local5:Object = this._soundsDict[_arg1];
_local5.volume = _arg2;
_local5.startTime = _arg3;
_local5.loops = _arg4;
if (_local5.paused){
_local5.channel = _local5.sound.play(_local5.position, _local5.loops, new SoundTransform(_local5.volume));
} else {
_local5.channel = _local5.sound.play(_arg3, _local5.loops, new SoundTransform(_local5.volume));
};
_local5.paused = false;
}
public static function getInstance():SoundManager{
if (SoundManager._instance == null){
SoundManager._allowInstance = true;
SoundManager._instance = new (SoundManager);
SoundManager._allowInstance = false;
};
return (SoundManager._instance);
}
}
}//package com.chocorobokun.managers
Section 140
//IPreloader (com.chocorobokun.preloader.IPreloader)
package com.chocorobokun.preloader {
public interface IPreloader {
function update(_arg1:int):void;
}
}//package com.chocorobokun.preloader
Section 141
//MakeScrollBar (com.chocorobokun.util.MakeScrollBar)
package com.chocorobokun.util {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class MakeScrollBar {
private var drag_mc:MovieClip;
private var call_back:Function;
private var track_mc:MovieClip;
private var host_mc:MovieClip;
private var scroll_rect:Rectangle;
private var range:Number;
private var upper_limit:Number;
public function MakeScrollBar(_arg1:MovieClip, _arg2:Function){
host_mc = _arg1;
call_back = _arg2;
drag_mc = host_mc.drag_mc;
drag_mc.buttonMode = true;
drag_mc.mouseChildren = false;
drag_mc.addEventListener(MouseEvent.MOUSE_DOWN, press_drag);
track_mc = host_mc.track_mc;
track_mc.buttonMode = true;
track_mc.mouseChildren = false;
track_mc.addEventListener(MouseEvent.CLICK, click_track);
set_limits();
}
private function click_track(_arg1:MouseEvent):void{
trace("Click track");
}
private function drag(_arg1:Event):void{
var _local2:* = ((drag_mc.x - track_mc.x) / range);
call_back(_local2);
}
private function set_limits():void{
scroll_rect = new Rectangle(track_mc.y, track_mc.x, (track_mc.width - drag_mc.width));
upper_limit = track_mc.x;
range = (track_mc.width - drag_mc.width);
}
private function press_drag(_arg1:MouseEvent):void{
drag_mc.stage.addEventListener(MouseEvent.MOUSE_UP, release_drag, false, 0, true);
drag_mc.startDrag(false, scroll_rect);
drag_mc.addEventListener(Event.ENTER_FRAME, drag);
}
private function release_drag(_arg1:MouseEvent):void{
drag_mc.removeEventListener(Event.ENTER_FRAME, drag);
drag_mc.stage.removeEventListener(MouseEvent.MOUSE_UP, release_drag);
drag_mc.stopDrag();
}
}
}//package com.chocorobokun.util
Section 142
//OpenURL (com.chocorobokun.util.OpenURL)
package com.chocorobokun.util {
import flash.net.*;
public class OpenURL {
public static function callURL(_arg1:String, _arg2:Function=null, _arg3:String="_blank"){
var _local4:URLRequest = new URLRequest(_arg1);
navigateToURL(_local4, _arg3);
if (_arg2 != null){
_arg2();
};
}
}
}//package com.chocorobokun.util
Section 143
//CDK (com.coreyoneil.collision.CDK)
package com.coreyoneil.collision {
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.errors.*;
public class CDK {
private var colorTransform2:ColorTransform;
private var colorTransform1:ColorTransform;
private var _returnAngleType:String;
private var pixels1:ByteArray;
private var pixels2:ByteArray;
private var bmdResample:BitmapData;
private var _returnAngle:Boolean;
private var transMatrix2:Matrix;
private var rect1:Rectangle;
private var rect2:Rectangle;
private var transMatrix1:Matrix;
protected var objectCheckArray:Array;
private var _alphaThreshold:Number;
private var item1Registration:Point;
private var bmd1:BitmapData;
private var bmd2:BitmapData;
protected var objectArray:Array;
private var item2Registration:Point;
protected var objectCollisionArray:Array;
private var _numChildren:uint;
private var colorExclusionArray:Array;
public function CDK():void{
if (getQualifiedClassName(this) == "com.coreyoneil.collision::CDK"){
throw (new Error("CDK is an abstract class and is not meant for instantiation - use CollisionGroup or CollisionList"));
};
init();
}
public function get returnAngle():Boolean{
return (_returnAngle);
}
public function set returnAngle(_arg1:Boolean):void{
_returnAngle = _arg1;
}
protected function findCollisions(_arg1, _arg2):void{
var item1xDiff:Number;
var item1yDiff:Number;
var locY:Number;
var locX:Number;
var locStage:Point;
var alpha1:uint;
var alpha2:uint;
var colorFlag:Boolean;
var red1:uint;
var red2:uint;
var green1:uint;
var green2:uint;
var blue1:uint;
var blue2:uint;
var colorObj:Object;
var aPlus:uint;
var aMinus:uint;
var rPlus:uint;
var rMinus:uint;
var gPlus:uint;
var gMinus:uint;
var bPlus:uint;
var bMinus:uint;
var item1Flags:uint;
var item2Flags:uint;
var n:uint;
var angle:Number;
var recordedCollision:Object;
var item1 = _arg1;
var item2 = _arg2;
var item1_isText:Boolean;
var item2_isText:Boolean;
if ((item1 is TextField)){
item1_isText = ((item1.antiAliasType)=="advanced") ? true : false;
item1.antiAliasType = ((item1.antiAliasType)=="advanced") ? "normal" : item1.antiAliasType;
};
if ((item2 is TextField)){
item2_isText = ((item2.antiAliasType)=="advanced") ? true : false;
item2.antiAliasType = ((item2.antiAliasType)=="advanced") ? "normal" : item2.antiAliasType;
};
colorTransform1 = item1.transform.colorTransform;
colorTransform2 = item2.transform.colorTransform;
item1Registration = new Point();
item2Registration = new Point();
item1Registration = item1.localToGlobal(item1Registration);
item2Registration = item2.localToGlobal(item2Registration);
bmd1 = new BitmapData(item1.width, item1.height, true, 0xFFFFFF);
bmd2 = new BitmapData(item1.width, item1.height, true, 0xFFFFFF);
transMatrix1 = item1.transform.matrix;
var currentObj:* = item1;
while (currentObj.parent != null) {
transMatrix1.concat(currentObj.parent.transform.matrix);
currentObj = currentObj.parent;
};
rect1 = item1.getBounds(currentObj);
if (item1 != currentObj){
rect1.x = (rect1.x + currentObj.x);
rect1.y = (rect1.y + currentObj.y);
};
var _local4 = (item1Registration.x - rect1.left);
item1xDiff = _local4;
transMatrix1.tx = _local4;
_local4 = (item1Registration.y - rect1.top);
item1yDiff = _local4;
transMatrix1.ty = _local4;
transMatrix2 = item2.transform.matrix;
currentObj = item2;
while (currentObj.parent != null) {
transMatrix2.concat(currentObj.parent.transform.matrix);
currentObj = currentObj.parent;
};
transMatrix2.tx = (item2Registration.x - rect1.left);
transMatrix2.ty = (item2Registration.y - rect1.top);
bmd1.draw(item1, transMatrix1, colorTransform1, null, null, true);
bmd2.draw(item2, transMatrix2, colorTransform2, null, null, true);
pixels1 = bmd1.getPixels(new Rectangle(0, 0, bmd1.width, bmd1.height));
pixels2 = bmd2.getPixels(new Rectangle(0, 0, bmd1.width, bmd1.height));
var k:uint;
var value1:uint;
var value2:uint;
var collisionPoint:Number = -1;
var overlap:Boolean;
var overlapping:Array = [];
var hasColors:int = colorExclusionArray.length;
pixels1.position = 0;
pixels2.position = 0;
var pixelLength:int = pixels1.length;
while (k < pixelLength) {
k = pixels1.position;
try {
value1 = pixels1.readUnsignedInt();
value2 = pixels2.readUnsignedInt();
} catch(e:EOFError) {
break;
};
alpha1 = ((value1 >> 24) & 0xFF);
alpha2 = ((value2 >> 24) & 0xFF);
if ((((alpha1 > _alphaThreshold)) && ((alpha2 > _alphaThreshold)))){
colorFlag = false;
if (hasColors){
red1 = ((value1 >> 16) & 0xFF);
red2 = ((value2 >> 16) & 0xFF);
green1 = ((value1 >> 8) & 0xFF);
green2 = ((value2 >> 8) & 0xFF);
blue1 = (value1 & 0xFF);
blue2 = (value2 & 0xFF);
n = 0;
while (n < hasColors) {
colorObj = Object(colorExclusionArray[n]);
item1Flags = 0;
item2Flags = 0;
if ((((blue1 >= colorObj.bMinus)) && ((blue1 <= colorObj.bPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((blue2 >= colorObj.bMinus)) && ((blue2 <= colorObj.bPlus)))){
item2Flags = (item2Flags + 1);
};
if ((((green1 >= colorObj.gMinus)) && ((green1 <= colorObj.gPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((green2 >= colorObj.gMinus)) && ((green2 <= colorObj.gPlus)))){
item2Flags = (item2Flags + 1);
};
if ((((red1 >= colorObj.rMinus)) && ((red1 <= colorObj.rPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((red2 >= colorObj.rMinus)) && ((red2 <= colorObj.rPlus)))){
item2Flags = (item2Flags + 1);
};
if ((((alpha1 >= colorObj.aMinus)) && ((alpha1 <= colorObj.aPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((alpha2 >= colorObj.aMinus)) && ((alpha2 <= colorObj.aPlus)))){
item2Flags = (item2Flags + 1);
};
if ((((item1Flags == 4)) || ((item2Flags == 4)))){
colorFlag = true;
};
n = (n + 1);
};
};
if (!colorFlag){
overlap = true;
collisionPoint = (k >> 2);
locY = (collisionPoint / bmd1.width);
locX = (collisionPoint % bmd1.width);
locY = (locY - item1yDiff);
locX = (locX - item1xDiff);
locStage = item1.localToGlobal(new Point(locX, locY));
overlapping.push(locStage);
};
};
};
if (overlap){
angle = (_returnAngle) ? findAngle(item1, item2) : 0;
recordedCollision = {object1:item1, object2:item2, angle:angle, overlapping:overlapping};
objectCollisionArray.push(recordedCollision);
};
if (item1_isText){
item1.antiAliasType = "advanced";
};
if (item2_isText){
item2.antiAliasType = "advanced";
};
_local4 = false;
item2_isText = _local4;
item1_isText = _local4;
}
private function init():void{
objectCheckArray = [];
objectCollisionArray = [];
objectArray = [];
colorExclusionArray = [];
_alphaThreshold = 0;
_returnAngle = true;
_returnAngleType = "RADIANS";
}
public function dispose():void{
objectArray = [];
}
public function excludeColor(_arg1:uint, _arg2:uint=0xFF, _arg3:uint=20, _arg4:uint=20, _arg5:uint=20):void{
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:uint;
var _local14:uint;
var _local15:uint;
var _local6:int = colorExclusionArray.length;
var _local7:uint;
while (_local7 < _local6) {
if (colorExclusionArray[_local7].color == _arg1){
throw (new Error((("Color could not be added - color already in the exclusion list [" + _arg1) + "]")));
};
_local7++;
};
_local8 = (((_arg1 >> 24) & 0xFF) + _arg2);
_local9 = (_local8 - (_arg2 << 1));
_local10 = (((_arg1 >> 16) & 0xFF) + _arg3);
_local11 = (_local10 - (_arg3 << 1));
_local12 = (((_arg1 >> 8) & 0xFF) + _arg4);
_local13 = (_local12 - (_arg4 << 1));
_local14 = ((_arg1 & 0xFF) + _arg5);
_local15 = (_local14 - (_arg5 << 1));
var _local16:Object = {color:_arg1, aPlus:_local8, aMinus:_local9, rPlus:_local10, rMinus:_local11, gPlus:_local12, gMinus:_local13, bPlus:_local14, bMinus:_local15};
colorExclusionArray.push(_local16);
}
public function get numChildren():uint{
return (objectArray.length);
}
public function get alphaThreshold():Number{
return (_alphaThreshold);
}
public function removeItem(_arg1):void{
var _local2:int = objectArray.indexOf(_arg1);
if (_local2 > -1){
objectArray.splice(_local2, 1);
} else {
throw (new Error((_arg1 + " could not be removed - object not found in item list.")));
};
}
public function set returnAngleType(_arg1:String):void{
_arg1 = _arg1.toUpperCase();
switch (_arg1){
case "DEGREES":
case "DEGREE":
case "DEG":
case "DEGS":
_returnAngleType = "DEGREES";
break;
case "RADIANS":
case "RADIAN":
case "RAD":
case "RADS":
_returnAngleType = "RADIANS";
break;
default:
throw (new Error("returnAngleType expects 'DEGREES' or 'RADIANS'"));
};
}
private function findAngle(_arg1:DisplayObject, _arg2:DisplayObject):Number{
var pixel:uint;
var thisAlpha:uint;
var lastAlpha:int;
var edgePoint:int;
var k:uint;
var upperLimit:int;
var colorFlag:Boolean;
var red1:uint;
var green1:uint;
var blue1:uint;
var colorObj:Object;
var a:uint;
var r:uint;
var g:uint;
var b:uint;
var item1Flags:uint;
var n:uint;
var item1 = _arg1;
var item2 = _arg2;
var center:Point = new Point((item1.width >> 1), (item1.height >> 1));
var pixels:ByteArray = pixels2;
transMatrix2.tx = (transMatrix2.tx + center.x);
transMatrix2.ty = (transMatrix2.ty + center.y);
bmdResample = new BitmapData((item1.width << 1), (item1.height << 1), true, 0xFFFFFF);
bmdResample.draw(item2, transMatrix2, colorTransform2, null, null, true);
pixels = bmdResample.getPixels(new Rectangle(0, 0, bmdResample.width, bmdResample.height));
center.x = (bmdResample.width >> 1);
center.y = (bmdResample.height >> 1);
var columnHeight:uint = Math.round(bmdResample.height);
var rowWidth:uint = Math.round(bmdResample.width);
var edgeArray:Array = [];
var hasColors:int = colorExclusionArray.length;
var j:uint;
while (j < columnHeight) {
k = ((j * rowWidth) << 2);
pixels.position = k;
lastAlpha = -1;
upperLimit = (((j + 1) * rowWidth) << 2);
while (k < upperLimit) {
k = pixels.position;
try {
pixel = pixels.readUnsignedInt();
} catch(e:EOFError) {
break;
};
thisAlpha = ((pixel >> 24) & 0xFF);
if (lastAlpha == -1){
lastAlpha = thisAlpha;
} else {
if (thisAlpha > _alphaThreshold){
colorFlag = false;
if (hasColors){
red1 = ((pixel >> 16) & 0xFF);
green1 = ((pixel >> 8) & 0xFF);
blue1 = (pixel & 0xFF);
n = 0;
while (n < hasColors) {
colorObj = Object(colorExclusionArray[n]);
item1Flags = 0;
if ((((blue1 >= colorObj.bMinus)) && ((blue1 <= colorObj.bPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((green1 >= colorObj.gMinus)) && ((green1 <= colorObj.gPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((red1 >= colorObj.rMinus)) && ((red1 <= colorObj.rPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((thisAlpha >= colorObj.aMinus)) && ((thisAlpha <= colorObj.aPlus)))){
item1Flags = (item1Flags + 1);
};
if (item1Flags == 4){
colorFlag = true;
};
n = (n + 1);
};
};
if (!colorFlag){
edgeArray.push((k >> 2));
};
};
};
};
j = (j + 1);
};
var numEdges:int = edgeArray.length;
var slopeYAvg:Number = 0;
var slopeXAvg:Number = 0;
j = 0;
while (j < numEdges) {
edgePoint = int(edgeArray[j]);
slopeYAvg = (slopeYAvg + (center.y - (edgePoint / rowWidth)));
slopeXAvg = (slopeXAvg + ((edgePoint % rowWidth) - center.x));
j = (j + 1);
};
var average:Number = -(Math.atan2(slopeYAvg, slopeXAvg));
average = ((_returnAngleType == "RADIANS")) ? average : (average * 57.2957795);
return (average);
}
public function addItem(_arg1):void{
if ((_arg1 is DisplayObject)){
objectArray.push(_arg1);
} else {
throw (new Error((("Cannot add item: " + _arg1) + " - item must be a Display Object.")));
};
}
public function get returnAngleType():String{
return (_returnAngleType);
}
public function set alphaThreshold(_arg1:Number):void{
if ((((_arg1 <= 1)) && ((_arg1 >= 0)))){
_alphaThreshold = (_arg1 * 0xFF);
} else {
throw (new Error("alphaThreshold expects a value from 0 to 1"));
};
}
public function removeExcludeColor(_arg1:uint):void{
var _local2:Boolean;
var _local3:int = colorExclusionArray.length;
var _local4:uint;
while (_local4 < _local3) {
if (colorExclusionArray[_local4].color == _arg1){
colorExclusionArray.splice(_local4, 1);
_local2 = true;
break;
};
_local4++;
};
if (!_local2){
throw (new Error((("Color could not be removed - color not found in exclusion list [" + _arg1) + "]")));
};
}
protected function clearArrays():void{
objectCheckArray = [];
objectCollisionArray = [];
}
}
}//package com.coreyoneil.collision
Section 144
//CollisionList (com.coreyoneil.collision.CollisionList)
package com.coreyoneil.collision {
import flash.display.*;
public class CollisionList extends CDK {
public function CollisionList(_arg1, ... _args):void{
addItem(_arg1);
var _local3:uint;
while (_local3 < _args.length) {
addItem(_args[_local3]);
_local3++;
};
}
public function checkCollisions():Array{
var _local3:DisplayObject;
clearArrays();
var _local1:uint = objectArray.length;
var _local2:* = DisplayObject(objectArray[0]);
var _local4:uint = 1;
while (_local4 < _local1) {
_local3 = DisplayObject(objectArray[_local4]);
if (_local2.hitTestObject(_local3)){
if ((_local3.width * _local3.height) > (_local2.width * _local2.height)){
objectCheckArray.push([_local2, _local3]);
} else {
objectCheckArray.push([_local3, _local2]);
};
};
_local4++;
};
_local1 = objectCheckArray.length;
_local4 = 0;
while (_local4 < _local1) {
findCollisions(DisplayObject(objectCheckArray[_local4][0]), DisplayObject(objectCheckArray[_local4][1]));
_local4++;
};
return (objectCollisionArray);
}
public function swapTarget(_arg1):void{
if ((_arg1 is DisplayObject)){
objectArray[0] = _arg1;
} else {
throw (new Error((("Cannot swap target: " + _arg1) + " - item must be a Display Object.")));
};
}
override public function removeItem(_arg1):void{
var _local2:int = objectArray.indexOf(_arg1);
if (_local2 > 0){
objectArray.splice(_local2, 1);
} else {
if (_local2 == 0){
throw (new Error("You cannot remove the target from CollisionList. Use swapTarget to change the target."));
};
throw (new Error((_arg1 + " could not be removed - object not found in item list.")));
};
}
}
}//package com.coreyoneil.collision
Section 145
//GamerSafeConstants (com.gamersafe.GamerSafeConstants)
package com.gamersafe {
public class GamerSafeConstants {
public static const ACHIEVEMENT_THE_STUDENT_OF_MECHANISM:int = 755;
public static const ACHIEVEMENT_MECHANISM_GOD:int = 763;
public static const ACHIEVEMENT_MASTER_INVENTOR:int = 762;
public static const SCOREBOARDGROUP_SCOREBOARDS:int = 232;
public static const ITEMGROUP_ITEMS:int = 290;
public static const ACHIEVEMENT_MECHANISM_SCHOLAR:int = 760;
public static const ACHIEVEMENTGROUP_ACHIEVEMENTS:int = 261;
public static const ACHIEVEMENT_PERSEVARENCE:int = 758;
public static const ACHIEVEMENT_THE_INVENTOR:int = 761;
public static const ACHIEVEMENT_FIRST_FAIL:int = 754;
public static const ACHIEVEMENT_WILL_OF_STEEL:int = 759;
public static const ACHIEVEMENT_THE_DOCTOR_OF_MECHANISM:int = 756;
public static const ACHIEVEMENT_THE_GENIUS_OF_MECHANISM:int = 757;
}
}//package com.gamersafe
Section 146
//Bounce (com.gskinner.motion.easing.Bounce)
package com.gskinner.motion.easing {
public class Bounce {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
if (_arg1 < (1 / 2.75)){
return (((7.5625 * _arg1) * _arg1));
};
if (_arg1 < (2 / 2.75)){
_arg1 = (_arg1 - (1.5 / 2.75));
return ((((7.5625 * _arg1) * _arg1) + 0.75));
};
if (_arg1 < (2.5 / 2.75)){
_arg1 = (_arg1 - (2.25 / 2.75));
return ((((7.5625 * _arg1) * _arg1) + 0.9375));
};
_arg1 = (_arg1 - (2.625 / 2.75));
return ((((7.5625 * _arg1) * _arg1) + 0.984375));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((1 - easeOut((1 - _arg1), 0, 0, 0)));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 * 2);
return (((_arg1)<1) ? (0.5 * easeIn(_arg1, 0, 0, 0)) : ((0.5 * easeOut((_arg1 - 1), 0, 0, 0)) + 0.5));
}
}
}//package com.gskinner.motion.easing
Section 147
//Circular (com.gskinner.motion.easing.Circular)
package com.gskinner.motion.easing {
public class Circular {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (Math.sqrt((1 - ((_arg1 - 1) * (_arg1 - 1)))));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (-((Math.sqrt((1 - (_arg1 * _arg1))) - 1)));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 * 2);
return (((_arg1)<1) ? (-0.5 * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) : _arg1 = (_arg1 - 2);
(0.5 * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)));
}
}
}//package com.gskinner.motion.easing
Section 148
//Linear (com.gskinner.motion.easing.Linear)
package com.gskinner.motion.easing {
public class Linear {
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (_arg1);
}
}
}//package com.gskinner.motion.easing
Section 149
//GTween (com.gskinner.motion.GTween)
package com.gskinner.motion {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class GTween extends EventDispatcher {
protected var _rangeValues:Object;
public var autoPlay:Boolean;// = true
protected var _delay:Number;// = 0
public var ratio:Number;
public var pluginData:Object;
public var useFrames:Boolean;
protected var _position:Number;
public var target:Object;
public var duration:Number;
public var onInit:Function;
public var calculatedPosition:Number;
public var calculatedPositionOld:Number;
public var ratioOld:Number;
public var data;
public var suppressEvents:Boolean;
public var dispatchEvents:Boolean;
public var repeatCount:int;// = 1
public var nextTween:GTween;
public var reflect:Boolean;
public var positionOld:Number;
protected var _values:Object;
public var onComplete:Function;
protected var _paused:Boolean;// = true
protected var _inited:Boolean;
public var ease:Function;
protected var _proxy:TargetProxy;
protected var _initValues:Object;
public var onChange:Function;
public var timeScale:Number;// = 1
public static var pauseAll:Boolean = false;
protected static var time:Number;
public static var defaultEase:Function = linearEase;
public static var defaultDispatchEvents:Boolean = false;
public static var version:Number = 2.01;
protected static var tickList:Dictionary = new Dictionary(true);
protected static var plugins:Object = {};
protected static var shape:Shape;
public static var timeScaleAll:Number = 1;
protected static var gcLockList:Dictionary = new Dictionary(false);
protected static var hasStarPlugins:Boolean = false;
public function GTween(_arg1:Object=null, _arg2:Number=1, _arg3:Object=null, _arg4:Object=null, _arg5:Object=null){
var _local6:Boolean;
super();
ease = defaultEase;
dispatchEvents = defaultDispatchEvents;
this.target = _arg1;
this.duration = _arg2;
this.pluginData = copy(_arg5, {});
if (_arg4){
_local6 = _arg4.swapValues;
delete _arg4.swapValues;
};
copy(_arg4, this);
resetValues(_arg3);
if (_local6){
swapValues();
};
if ((((((this.duration == 0)) && ((delay == 0)))) && (autoPlay))){
position = 0;
};
}
public function get delay():Number{
return (_delay);
}
public function getInitValue(_arg1:String):Number{
return (_initValues[_arg1]);
}
public function set delay(_arg1:Number):void{
if (_position <= 0){
_position = -(_arg1);
};
_delay = _arg1;
}
public function init():void{
var _local1:String;
var _local2:Array;
var _local3:uint;
var _local4:Number;
var _local5:uint;
_inited = true;
_initValues = {};
_rangeValues = {};
for (_local1 in _values) {
if (plugins[_local1]){
_local2 = plugins[_local1];
_local3 = _local2.length;
_local4 = ((_local1 in target)) ? target[_local1] : NaN;
_local5 = 0;
while (_local5 < _local3) {
_local4 = _local2[_local5].init(this, _local1, _local4);
_local5++;
};
if (!isNaN(_local4)){
_rangeValues[_local1] = (_values[_local1] - (_initValues[_local1] = _local4));
};
} else {
_rangeValues[_local1] = (_values[_local1] - (_initValues[_local1] = target[_local1]));
};
};
if (hasStarPlugins){
_local2 = plugins["*"];
_local3 = _local2.length;
_local5 = 0;
while (_local5 < _local3) {
_local2[_local5].init(this, "*", NaN);
_local5++;
};
};
if (!suppressEvents){
if (dispatchEvents){
dispatchEvt("init");
};
if (onInit != null){
onInit(this);
};
};
}
public function getValues():Object{
return (copy(_values, {}));
}
public function setValues(_arg1:Object):void{
copy(_arg1, _values, true);
invalidate();
}
public function get position():Number{
return (_position);
}
protected function dispatchEvt(_arg1:String):void{
if (hasEventListener(_arg1)){
dispatchEvent(new Event(_arg1));
};
}
public function swapValues():void{
var _local2:String;
var _local3:Number;
if (!_inited){
init();
};
var _local1:Object = _values;
_values = _initValues;
_initValues = _local1;
for (_local2 in _rangeValues) {
_rangeValues[_local2] = (_rangeValues[_local2] * -1);
};
if (_position < 0){
_local3 = positionOld;
position = 0;
_position = positionOld;
positionOld = _local3;
} else {
position = _position;
};
}
public function setValue(_arg1:String, _arg2:Number):void{
_values[_arg1] = _arg2;
invalidate();
}
public function get paused():Boolean{
return (_paused);
}
public function getValue(_arg1:String):Number{
return (_values[_arg1]);
}
protected function invalidate():void{
_inited = false;
if (_position > 0){
_position = 0;
};
if (autoPlay){
paused = false;
};
}
protected function copy(_arg1:Object, _arg2:Object, _arg3:Boolean=false):Object{
var _local4:String;
for (_local4 in _arg1) {
if (((_arg3) && ((_arg1[_local4] == null)))){
delete _arg2[_local4];
} else {
_arg2[_local4] = _arg1[_local4];
};
};
return (_arg2);
}
public function deleteValue(_arg1:String):Boolean{
delete _rangeValues[_arg1];
delete _initValues[_arg1];
return (delete _values[_arg1]);
}
public function resetValues(_arg1:Object=null):void{
_values = {};
setValues(_arg1);
}
public function set position(_arg1:Number):void{
var _local4:String;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Array;
var _local9:uint;
var _local10:uint;
positionOld = _position;
ratioOld = ratio;
calculatedPositionOld = calculatedPosition;
var _local2:Number = (repeatCount * duration);
var _local3:Boolean = (((_arg1 >= _local2)) && ((repeatCount > 0)));
if (_local3){
if (calculatedPositionOld == _local2){
return;
};
_position = _local2;
calculatedPosition = (((reflect) && (!((repeatCount & 1))))) ? 0 : duration;
} else {
_position = _arg1;
calculatedPosition = ((_position < 0)) ? 0 : (_position % duration);
if (((reflect) && (((_position / duration) & 1)))){
calculatedPosition = (duration - calculatedPosition);
};
};
ratio = ((((duration == 0)) && ((_position >= 0)))) ? 1 : ease((calculatedPosition / duration), 0, 1, 1);
if (((((target) && ((((_position >= 0)) || ((positionOld >= 0)))))) && (!((calculatedPosition == calculatedPositionOld))))){
if (!_inited){
init();
};
for (_local4 in _values) {
_local5 = _initValues[_local4];
_local6 = _rangeValues[_local4];
_local7 = (_local5 + (_local6 * ratio));
_local8 = plugins[_local4];
if (_local8){
_local9 = _local8.length;
_local10 = 0;
while (_local10 < _local9) {
_local7 = _local8[_local10].tween(this, _local4, _local7, _local5, _local6, ratio, _local3);
_local10++;
};
if (!isNaN(_local7)){
target[_local4] = _local7;
};
} else {
target[_local4] = _local7;
};
};
};
if (hasStarPlugins){
_local8 = plugins["*"];
_local9 = _local8.length;
_local10 = 0;
while (_local10 < _local9) {
_local8[_local10].tween(this, "*", NaN, NaN, NaN, ratio, _local3);
_local10++;
};
};
if (!suppressEvents){
if (dispatchEvents){
dispatchEvt("change");
};
if (onChange != null){
onChange(this);
};
};
if (_local3){
paused = true;
if (nextTween){
nextTween.paused = false;
};
if (!suppressEvents){
if (dispatchEvents){
dispatchEvt("complete");
};
if (onComplete != null){
onComplete(this);
};
};
};
}
public function end():void{
position = ((repeatCount)>0) ? (repeatCount * duration) : duration;
}
public function beginning():void{
position = 0;
paused = true;
}
public function set paused(_arg1:Boolean):void{
if (_arg1 == _paused){
return;
};
_paused = _arg1;
if (_paused){
delete tickList[this];
if ((target is IEventDispatcher)){
target.removeEventListener("_", invalidate);
};
delete gcLockList[this];
} else {
if (((isNaN(_position)) || (((!((repeatCount == 0))) && ((_position >= (repeatCount * duration))))))){
_inited = false;
calculatedPosition = (calculatedPositionOld = (ratio = (ratioOld = (positionOld = 0))));
_position = -(delay);
};
tickList[this] = true;
if ((target is IEventDispatcher)){
target.addEventListener("_", invalidate);
} else {
gcLockList[this] = true;
};
};
}
public function get proxy():TargetProxy{
if (_proxy == null){
_proxy = new TargetProxy(this);
};
return (_proxy);
}
protected static function staticTick(_arg1:Event):void{
var _local4:Object;
var _local5:GTween;
var _local2:Number = time;
time = (getTimer() / 1000);
if (pauseAll){
return;
};
var _local3:Number = ((time - _local2) * timeScaleAll);
for (_local4 in tickList) {
_local5 = (_local4 as GTween);
(_local4 as GTween).position = (_local5._position + ((_local5.useFrames) ? timeScaleAll : _local3 * _local5.timeScale));
};
}
protected static function staticInit():void{
(shape = new Shape()).addEventListener(Event.ENTER_FRAME, staticTick);
time = (getTimer() / 1000);
}
public static function installPlugin(_arg1:Object, _arg2:Array, _arg3:Boolean=false):void{
var _local5:String;
var _local4:uint;
while (_local4 < _arg2.length) {
_local5 = _arg2[_local4];
if (_local5 == "*"){
hasStarPlugins = true;
};
if (plugins[_local5] == null){
plugins[_local5] = [_arg1];
} else {
if (_arg3){
plugins[_local5].unshift(_arg1);
} else {
plugins[_local5].push(_arg1);
};
};
_local4++;
};
}
public static function linearEase(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (_arg1);
}
staticInit();
}
}//package com.gskinner.motion
import flash.utils.*;
dynamic class TargetProxy extends Proxy {
private var tween:GTween;
private function TargetProxy(_arg1:GTween):void{
this.tween = _arg1;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
tween.deleteValue(_arg1);
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
if ((((((_arg2 is Boolean)) || ((_arg2 is String)))) || (isNaN(_arg2)))){
tween.target[_arg1] = _arg2;
} else {
tween.setValue(String(_arg1), Number(_arg2));
};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function callProperty(_arg1, ... _args){
return (tween.target[_arg1].apply(null, _args));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
var _local2:Number = tween.getValue(_arg1);
return ((isNaN(_local2)) ? tween.target[_arg1] : _local2);
}
}
Section 150
//AssetLoader_1 (domino_fla.AssetLoader_1)
package domino_fla {
import flash.display.*;
public dynamic class AssetLoader_1 extends MovieClip {
public function AssetLoader_1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package domino_fla
Section 151
//Symbol3_37 (domino_fla.Symbol3_37)
package domino_fla {
import flash.display.*;
public dynamic class Symbol3_37 extends MovieClip {
public var numDisp:MovieClip;
public function Symbol3_37(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package domino_fla
Section 152
//Symbol5_118 (domino_fla.Symbol5_118)
package domino_fla {
import flash.display.*;
public dynamic class Symbol5_118 extends MovieClip {
public function Symbol5_118(){
addFrameScript(199, frame200);
}
function frame200(){
}
}
}//package domino_fla
Section 153
//Symbol5_70 (domino_fla.Symbol5_70)
package domino_fla {
import flash.display.*;
public dynamic class Symbol5_70 extends MovieClip {
public function Symbol5_70(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package domino_fla
Section 154
//Color (fl.motion.Color)
package fl.motion {
import flash.display.*;
import flash.geom.*;
public class Color extends ColorTransform {
private var _tintColor:Number;// = 0
private var _tintMultiplier:Number;// = 0
public function Color(_arg1:Number=1, _arg2:Number=1, _arg3:Number=1, _arg4:Number=1, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0, _arg8:Number=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
private function deriveTintColor():uint{
var _local1:Number = (1 / this.tintMultiplier);
var _local2:uint = Math.round((this.redOffset * _local1));
var _local3:uint = Math.round((this.greenOffset * _local1));
var _local4:uint = Math.round((this.blueOffset * _local1));
var _local5:uint = (((_local2 << 16) | (_local3 << 8)) | _local4);
return (_local5);
}
public function set brightness(_arg1:Number):void{
if (_arg1 > 1){
_arg1 = 1;
} else {
if (_arg1 < -1){
_arg1 = -1;
};
};
var _local2:Number = (1 - Math.abs(_arg1));
var _local3:Number = 0;
if (_arg1 > 0){
_local3 = (_arg1 * 0xFF);
};
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = _local2));
this.redOffset = (this.greenOffset = (this.blueOffset = _local3));
}
private function parseXML(_arg1:XML=null):Color{
var _local3:XML;
var _local4:String;
var _local5:uint;
if (!_arg1){
return (this);
};
var _local2:XML = _arg1.elements()[0];
if (!_local2){
return (this);
};
for each (_local3 in _local2.attributes()) {
_local4 = _local3.localName();
if (_local4 == "tintColor"){
_local5 = (Number(_local3.toString()) as uint);
this.tintColor = _local5;
} else {
this[_local4] = Number(_local3.toString());
};
};
return (this);
}
public function get tintColor():uint{
return (this._tintColor);
}
public function set tintColor(_arg1:uint):void{
this.setTint(_arg1, this.tintMultiplier);
}
public function get brightness():Number{
return ((this.redOffset) ? (1 - this.redMultiplier) : (this.redMultiplier - 1));
}
public function set tintMultiplier(_arg1:Number):void{
this.setTint(this.tintColor, _arg1);
}
public function get tintMultiplier():Number{
return (this._tintMultiplier);
}
public function setTint(_arg1:uint, _arg2:Number):void{
this._tintColor = _arg1;
this._tintMultiplier = _arg2;
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = (1 - _arg2)));
var _local3:uint = ((_arg1 >> 16) & 0xFF);
var _local4:uint = ((_arg1 >> 8) & 0xFF);
var _local5:uint = (_arg1 & 0xFF);
this.redOffset = Math.round((_local3 * _arg2));
this.greenOffset = Math.round((_local4 * _arg2));
this.blueOffset = Math.round((_local5 * _arg2));
}
public static function interpolateColor(_arg1:uint, _arg2:uint, _arg3:Number):uint{
var _local4:Number = (1 - _arg3);
var _local5:uint = ((_arg1 >> 24) & 0xFF);
var _local6:uint = ((_arg1 >> 16) & 0xFF);
var _local7:uint = ((_arg1 >> 8) & 0xFF);
var _local8:uint = (_arg1 & 0xFF);
var _local9:uint = ((_arg2 >> 24) & 0xFF);
var _local10:uint = ((_arg2 >> 16) & 0xFF);
var _local11:uint = ((_arg2 >> 8) & 0xFF);
var _local12:uint = (_arg2 & 0xFF);
var _local13:uint = ((_local5 * _local4) + (_local9 * _arg3));
var _local14:uint = ((_local6 * _local4) + (_local10 * _arg3));
var _local15:uint = ((_local7 * _local4) + (_local11 * _arg3));
var _local16:uint = ((_local8 * _local4) + (_local12 * _arg3));
var _local17:uint = ((((_local13 << 24) | (_local14 << 16)) | (_local15 << 8)) | _local16);
return (_local17);
}
public static function interpolateTransform(_arg1:ColorTransform, _arg2:ColorTransform, _arg3:Number):ColorTransform{
var _local4:Number = (1 - _arg3);
var _local5:ColorTransform = new ColorTransform(((_arg1.redMultiplier * _local4) + (_arg2.redMultiplier * _arg3)), ((_arg1.greenMultiplier * _local4) + (_arg2.greenMultiplier * _arg3)), ((_arg1.blueMultiplier * _local4) + (_arg2.blueMultiplier * _arg3)), ((_arg1.alphaMultiplier * _local4) + (_arg2.alphaMultiplier * _arg3)), ((_arg1.redOffset * _local4) + (_arg2.redOffset * _arg3)), ((_arg1.greenOffset * _local4) + (_arg2.greenOffset * _arg3)), ((_arg1.blueOffset * _local4) + (_arg2.blueOffset * _arg3)), ((_arg1.alphaOffset * _local4) + (_arg2.alphaOffset * _arg3)));
return (_local5);
}
public static function fromXML(_arg1:XML):Color{
return (Color(new (Color).parseXML(_arg1)));
}
}
}//package fl.motion
Section 155
//SWFConsole (rl.dev.SWFConsole)
package rl.dev {
import flash.display.*;
import flash.events.*;
import flash.system.*;
import flash.utils.*;
import flash.text.*;
public class SWFConsole extends Sprite {
private static const INPUT_BG_HEIGHT:int = 20;
private static const _FPS_REFRESH_RATE:uint = 1000;
private static const SCROLLHANDLE_COLOUR:int = 0xFFFFFF;
private static const HEADER_HEIGHT:int = 20;
private static const SCROLLHANDLE_WIDTH:int = 10;
private static const TEXT_COLOUR:int = 0xFFFFFF;
private static const HEADER_BG_ALPHA:Number = 0.6;
private static const SCROLLTRACK_ALPHA:Number = 0.5;
private static const SCROLLBUTTON_ALPHA:Number = 0.9;
private static const _HISTORY_STATES:uint = 20;
private static const BACKGROUND_HEIGHT:int = 200;
private static const INPUTAREA_BG_HEIGHT:int = 30;
private static const SCROLLHANDLE_HEIGHT:int = 60;
private static const UPDATE_INTERVAL:int = 1000;
private static const SCROLLTRACK_WIDTH:int = 10;
private static const SCROLLTRACK_COLOUR:int = 0;
private static const INPUT_BG_COLOUR:int = 0xFFFFFF;
private static const SCROLLHANDLE_ALPHA:Number = 0.9;
private static const VERSION:String = "1.1";
private static const INPUT_BG_ALPHA:Number = 0.2;
private static const SHADOW_COLOUR:int = 0;
private static const SCROLLBUTTON_COLOUR:int = 0xFFFFFF;
private static const INPUTAREA_BG_ALPHA:Number = 0.7;
private static const HEADER_BG_COLOUR:int = 0;
private static const WELCOME_MESSAGE:String = "============================================================
New features:
- Resource Monitor - type !resmon to activate
============================================================";
private static const BACKGROUND_ALPHA:Number = 0.7;
private static const BACKGROUND_COLOUR:int = 0;
private static const INPUTAREA_BG_COLOUR:int = 0;
private static var _scrollButtonDown:Sprite;
private static var _enabled:Boolean = false;
private static var _stageHeight:Number;
private static var _stageWidth:Number;
private static var _headerText:TextField;
private static var _percent:Number;
private static var _text:TextField;
private static var _lastcommands:Array;
private static var _avg:Number = 0;
private static var _traceEnabled:Boolean = false;
private static var _textFormat:TextFormat;
private static var _fpsBg:Shape;
private static var _fps:Sprite;
private static var _memUsage:Sprite;
private static var _outputMask:Shape;
private static var _scrollHandle:Sprite;
private static var _fpsTimer:Timer;
private static var _txt_avgfps:TextField;
private static var _timer:Timer;
private static var _txt_mem:TextField;
public static var _activated:Boolean = false;
private static var _history:Array;
private static var _headerTextFormat:TextFormat;
private static var _txt_fps:TextField;
private static var _inputAreaBg:Shape;
private static var _fpsValue:uint = 0;
private static var _inputBg:Shape;
private static var _headerTextShadow:TextField;
private static var _scrollButtonUp:Sprite;
private static var _scrollButtonDownShape:Shape;
private static var _min:Number;
private static var _max:Number;
private static var _stageFrameRate:uint;
private static var _scrollButtonUpShape:Shape;
private static var _scrollTrack:Shape;
private static var _offset:Number;
private static var _inputText:TextField;
private static var _scrollHandleShape:Shape;
private static var _headerTextShadowFormat:TextFormat;
private static var _frames:uint = 0;
private static var _bg:Shape;
private static var _headerbg:Shape;
private static var _lastcommandsindex:Number;
private static var _memBg:Shape;
public function SWFConsole(_arg1:Number, _arg2:Number, _arg3:Boolean=false){
_stageWidth = _arg1;
_stageHeight = _arg2;
_traceEnabled = _arg3;
if (stage){
_init();
} else {
addEventListener(Event.ADDED_TO_STAGE, _init, false, 0, true);
};
}
private function _removeWhitespace(_arg1:String):String{
var _local2 = "";
var _local3:* = 0;
while (_local3 < _arg1.length) {
if (_arg1.charAt(_local3) != " "){
_local2 = (_local2 + _arg1.charAt(_local3));
};
_local3++;
};
return (_local2);
}
private function _runProperty(_arg1:String):void{
var instanceSplit:Array;
var propertySplit:Array;
var instance:Object;
var command = _arg1;
if (_findChar(command, "=")){
propertySplit = command.split("=");
if (_findChar(propertySplit[0], ".")){
instanceSplit = propertySplit[0].split(".");
instance = _recurseChildren(stage, instanceSplit[0]);
if (instance){
if (instance.hasOwnProperty(instanceSplit[1])){
if (propertySplit[1] == "false"){
propertySplit[1] = false;
};
instance[instanceSplit[1]] = propertySplit[1];
} else {
output(((("Property " + instanceSplit[1]) + " not found on ") + instanceSplit[0]));
};
} else {
output("Instance not found");
};
} else {
if (stage.hasOwnProperty(propertySplit[0])){
if (propertySplit[1] == "false"){
propertySplit[1] = false;
};
try {
stage[propertySplit[0]] = propertySplit[1];
} catch(e:Error) {
output("*** ERROR: this property of stage cannot be set ***");
};
} else {
output((("Property " + propertySplit[0]) + " not found on stage"));
};
};
} else {
if (_findChar(command, ".")){
instanceSplit = command.split(".");
instance = _recurseChildren(stage, instanceSplit[0]);
if (instance){
if (instance.hasOwnProperty(instanceSplit[1])){
output(((((instance.name + ".") + instanceSplit[1]) + " = ") + instance[instanceSplit[1]]));
} else {
output(((("Property " + instanceSplit[1]) + " not found on ") + instanceSplit[0]));
};
} else {
output("Instance not found");
};
} else {
if (stage.hasOwnProperty(command)){
output(((("stage." + command) + " = ") + stage[command]));
} else {
output((("Property " + command) + " not found on stage"));
};
};
};
}
private function _scrollButtonDownDown(_arg1:MouseEvent):void{
_percent = (_percent + 0.1);
if (_percent > 1){
_percent = 1;
};
_text.y = (_headerbg.height + (-(_percent) * (_text.height - _outputMask.height)));
_scrollHandle.y = (_min + ((_max - _min) * _percent));
}
private function _createHeader():void{
_headerbg = new Shape();
_headerbg.graphics.beginFill(HEADER_BG_COLOUR, HEADER_BG_ALPHA);
_headerbg.graphics.drawRect(0, 0, stage.stageWidth, HEADER_HEIGHT);
_headerbg.graphics.endFill();
_headerbg.cacheAsBitmap = true;
addChild(_headerbg);
_headerTextShadowFormat = new TextFormat();
_headerTextShadowFormat.font = "_typewriter";
_headerTextShadowFormat.color = SHADOW_COLOUR;
_headerTextShadowFormat.italic = true;
_headerTextShadow = new TextField();
_headerTextShadow.x = 12;
_headerTextShadow.y = 2;
_headerTextShadow.height = HEADER_HEIGHT;
_headerTextShadow.autoSize = TextFieldAutoSize.LEFT;
_headerTextShadow.multiline = false;
_headerTextShadow.defaultTextFormat = _headerTextShadowFormat;
_headerTextShadow.text = ("SWFConsole v" + VERSION);
_headerTextFormat = new TextFormat();
_headerTextFormat.font = "_typewriter";
_headerTextFormat.color = TEXT_COLOUR;
_headerTextFormat.bold;
_headerTextFormat.italic = true;
_headerText = new TextField();
_headerText.x = 10;
_headerText.height = HEADER_HEIGHT;
_headerText.autoSize = TextFieldAutoSize.LEFT;
_headerText.multiline = false;
_headerText.defaultTextFormat = _headerTextFormat;
_headerText.text = ("SWFConsole v" + VERSION);
addChild(_headerTextShadow);
addChild(_headerText);
}
private function _handleUp(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, _handleMove);
}
private function _scrollButtonUpDown(_arg1:MouseEvent):void{
_percent = (_percent - 0.1);
if (_percent < 0){
_percent = 0;
};
_text.y = (_headerbg.height + (-(_percent) * (_text.height - _outputMask.height)));
_scrollHandle.y = (_min + ((_max - _min) * _percent));
}
private function _findChar(_arg1:String, _arg2:String):Boolean{
var _local3:* = 0;
while (_local3 < _arg1.length) {
if (_arg1.charAt(_local3) == _arg2){
return (true);
};
_local3++;
};
return (false);
}
private function _scrollWheel(_arg1:MouseEvent):void{
if (_scrollButtonDown.visible){
if (_arg1.delta > 0){
_percent = (_percent - 0.1);
if (_percent < 0){
_percent = 0;
};
} else {
if (_arg1.delta < 0){
_percent = (_percent + 0.1);
if (_percent > 1){
_percent = 1;
};
};
};
_text.y = (_headerbg.height + (-(_percent) * (_text.height - _outputMask.height)));
_scrollHandle.y = (_min + ((_max - _min) * _percent));
};
}
private function _createScrollHandle():void{
_scrollHandleShape = new Shape();
_scrollHandleShape.graphics.beginFill(SCROLLHANDLE_COLOUR, SCROLLHANDLE_ALPHA);
_scrollHandleShape.graphics.drawRect(0, 0, SCROLLHANDLE_WIDTH, SCROLLHANDLE_HEIGHT);
_scrollHandleShape.graphics.endFill();
_scrollHandleShape.cacheAsBitmap = true;
_scrollHandle = new Sprite();
_scrollHandle.addChild(_scrollHandleShape);
_scrollHandle.x = (_scrollTrack.x - (SCROLLHANDLE_WIDTH - SCROLLTRACK_WIDTH));
_scrollHandle.y = _scrollTrack.y;
addChild(_scrollHandle);
}
private function _calculateFPS(_arg1:TimerEvent):void{
_fpsValue = ((_frames)>_stageFrameRate) ? _stageFrameRate : _frames;
_txt_fps.text = ("FPS: " + String(_fpsValue));
_frames = 0;
_history.unshift(_fpsValue);
if (_history.length > _HISTORY_STATES){
_history.pop();
};
_avg = 0;
var _local2:uint;
while (_local2 < _history.length) {
_avg = (_avg + _history[_local2]);
_local2++;
};
_txt_avgfps.text = ("AVG: " + String(Math.round((_avg / _history.length))));
}
private function _handleDown(_arg1:MouseEvent):void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, _handleMove, false, 0, true);
_offset = (mouseY - _scrollHandle.y);
}
private function _removeChar(_arg1:String, _arg2:String):String{
var _local3 = "";
var _local4:* = 0;
while (_local4 < _arg1.length) {
if (_arg1.charAt(_local4) != _arg2){
_local3 = (_local3 + _arg1.charAt(_local4));
};
_local4++;
};
return (_local3);
}
public function hide():void{
alpha = 0;
visible = false;
}
private function _initMemUsage():void{
_memUsage = new Sprite();
stage.addChild(_memUsage);
_txt_mem = new TextField();
_txt_mem.width = 100;
_txt_mem.height = 16;
_txt_mem.border = false;
_txt_mem.selectable = false;
var _local1:TextFormat = new TextFormat();
_local1.font = "Verdana";
_local1.color = 6750054;
_local1.size = 10;
_txt_mem.defaultTextFormat = _local1;
_txt_mem.text = "MEM: 0 MB";
_memUsage.addChild(_txt_mem);
_memBg = new Shape();
_memBg.graphics.beginFill(0, 0.7);
_memBg.graphics.drawRect(0, 0, _memUsage.width, _memUsage.height);
_memBg.graphics.endFill();
_memUsage.addChildAt(_memBg, 0);
_memUsage.x = Math.ceil(((-((stage.stageWidth - _stageWidth)) * 0.5) + (stage.stageWidth - _memUsage.width)));
_memUsage.y = Math.ceil((((-((stage.stageHeight - _stageHeight)) * 0.5) + (stage.stageHeight - _memUsage.height)) - 32));
_timer = new Timer(UPDATE_INTERVAL);
_timer.addEventListener(TimerEvent.TIMER, displayUsage, false, 0, true);
_timer.start();
}
private function _createInputArea():void{
_inputAreaBg = new Shape();
_inputAreaBg.graphics.beginFill(INPUTAREA_BG_COLOUR, INPUTAREA_BG_ALPHA);
_inputAreaBg.graphics.drawRect(0, 0, stage.stageWidth, INPUTAREA_BG_HEIGHT);
_inputAreaBg.graphics.endFill();
_inputAreaBg.y = (HEADER_HEIGHT + BACKGROUND_HEIGHT);
addChild(_inputAreaBg);
_inputBg = new Shape();
_inputBg.graphics.beginFill(INPUT_BG_COLOUR, INPUT_BG_ALPHA);
_inputBg.graphics.drawRect(0, 0, (stage.stageWidth - 50), INPUT_BG_HEIGHT);
_inputBg.graphics.endFill();
_inputBg.x = 10;
_inputBg.y = (_inputAreaBg.y + 5);
addChild(_inputBg);
_inputText = new TextField();
_inputText.width = (stage.stageWidth - 50);
_inputText.x = 10;
_inputText.y = (_inputAreaBg.y + 5);
_inputText.height = INPUT_BG_HEIGHT;
_inputText.multiline = false;
_inputText.type = TextFieldType.INPUT;
_inputText.restrict = "^`";
_inputText.defaultTextFormat = _textFormat;
addChild(_inputText);
}
private function _runCommand(_arg1:String):void{
if (_arg1.substr(0, 7).toLowerCase() == "!resmon"){
if (_arg1.charAt(7) == "0"){
if (_fps != null){
_fps.visible = false;
};
if (_memUsage != null){
_memUsage.visible = false;
};
output("*** RESOURCE MONITOR DISABLED ***");
} else {
if (_fps == null){
_initFPS();
} else {
_fps.visible = true;
};
if (_memUsage == null){
_initMemUsage();
} else {
_memUsage.visible = true;
};
output("*** RESOURCE MONITOR ENABLED ***");
};
return;
};
output("Invalid command");
}
private function _createScrollButtons():void{
_scrollButtonUpShape = new Shape();
_scrollButtonDownShape = new Shape();
_createScrollButtonShape(_scrollButtonUpShape);
_createScrollButtonShape(_scrollButtonDownShape);
_scrollButtonUp = new Sprite();
_scrollButtonUp.addChild(_scrollButtonUpShape);
_scrollButtonUp.x = (stage.stageWidth - 30);
_scrollButtonUp.y = 40;
_scrollButtonUp.buttonMode = true;
_scrollButtonUp.addEventListener(MouseEvent.MOUSE_DOWN, _scrollButtonUpDown, false, 0, true);
addChild(_scrollButtonUp);
_scrollButtonDown = new Sprite();
_scrollButtonDown.addChild(_scrollButtonDownShape);
_scrollButtonDown.scaleY = -1;
_scrollButtonDown.x = (stage.stageWidth - 30);
_scrollButtonDown.y = ((_scrollTrack.y + _scrollTrack.height) + 10);
_scrollButtonDown.buttonMode = true;
_scrollButtonDown.addEventListener(MouseEvent.MOUSE_DOWN, _scrollButtonDownDown, false, 0, true);
addChild(_scrollButtonDown);
}
private function _createScrollTrack():void{
_scrollTrack = new Shape();
_scrollTrack.graphics.beginFill(SCROLLTRACK_COLOUR, SCROLLTRACK_ALPHA);
_scrollTrack.graphics.drawRect(0, 0, SCROLLTRACK_WIDTH, (BACKGROUND_HEIGHT - 60));
_scrollTrack.graphics.endFill();
_scrollTrack.x = (stage.stageWidth - 30);
_scrollTrack.y = (HEADER_HEIGHT + 30);
_scrollTrack.cacheAsBitmap = true;
addChild(_scrollTrack);
}
private function _relocate(_arg1:Event):void{
_headerbg.width = stage.stageWidth;
_bg.width = stage.stageWidth;
_text.width = (stage.stageWidth - 50);
_outputMask.width = (stage.stageWidth - 50);
_inputText.width = (stage.stageWidth - 50);
_inputAreaBg.width = stage.stageWidth;
_inputBg.width = (stage.stageWidth - 50);
_scrollTrack.x = Math.ceil((stage.stageWidth - 30));
_scrollButtonUp.x = Math.ceil((stage.stageWidth - 30));
_scrollButtonDown.x = Math.ceil((stage.stageWidth - 30));
_scrollHandle.x = Math.ceil((stage.stageWidth - 30));
x = Math.ceil((-((stage.stageWidth - _stageWidth)) * 0.5));
y = Math.ceil((-((stage.stageHeight - _stageHeight)) * 0.5));
if (_fps){
_fps.x = Math.ceil(((-((stage.stageWidth - _stageWidth)) * 0.5) + (stage.stageWidth - _fps.width)));
_fps.y = Math.ceil(((-((stage.stageHeight - _stageHeight)) * 0.5) + (stage.stageHeight - _fps.height)));
};
if (_memUsage){
_memUsage.x = Math.ceil(((-((stage.stageWidth - _stageWidth)) * 0.5) + (stage.stageWidth - _memUsage.width)));
_memUsage.y = Math.ceil((((-((stage.stageHeight - _stageHeight)) * 0.5) + (stage.stageHeight - _memUsage.height)) - 32));
};
}
private function _recurseChildren(_arg1:Object, _arg2:String):Object{
var _local3:Object;
if ((((((_arg1.hasOwnProperty("numChildren") == false)) || ((_arg1.numChildren == null)))) || ((_arg1.numChildren == 0)))){
return (_local3);
};
var _local4:* = 0;
while (_local4 < _arg1.numChildren) {
if (_arg1.getChildAt(_local4).name == _arg2){
return (_arg1.getChildAt(_local4));
};
if (_local3 == null){
_local3 = _recurseChildren((_arg1.getChildAt(_local4) as Object), _arg2);
};
_local4++;
};
return (_local3);
}
private function _createScrollButtonShape(_arg1:Shape):void{
_arg1.graphics.beginFill(SCROLLBUTTON_COLOUR, SCROLLBUTTON_ALPHA);
_arg1.graphics.moveTo(0, 0);
_arg1.graphics.lineTo(5, -8);
_arg1.graphics.lineTo(10, 0);
_arg1.graphics.lineTo(0, 0);
_arg1.graphics.endFill();
_arg1.cacheAsBitmap = true;
}
private function _createOutputArea():void{
_text = new TextField();
_text.width = (stage.stageWidth - 50);
_text.x = 10;
_text.y = HEADER_HEIGHT;
_text.height = BACKGROUND_HEIGHT;
_text.multiline = true;
_text.wordWrap = true;
_text.autoSize = TextFieldAutoSize.LEFT;
_textFormat = new TextFormat();
_textFormat.color = TEXT_COLOUR;
_textFormat.font = "_typewriter";
_text.defaultTextFormat = _textFormat;
addChild(_text);
_outputMask = new Shape();
_outputMask.graphics.beginFill(0xFF00FF);
_outputMask.graphics.drawRect(0, 0, (stage.stageWidth - 50), BACKGROUND_HEIGHT);
_outputMask.graphics.endFill();
_outputMask.x = 10;
_outputMask.y = HEADER_HEIGHT;
addChild(_outputMask);
_text.mask = _outputMask;
}
private function _createScrollBar():void{
_createScrollTrack();
_createScrollButtons();
_createScrollHandle();
_scrollTrack.visible = false;
_scrollButtonUp.visible = false;
_scrollButtonDown.visible = false;
_scrollHandle.visible = false;
_min = _scrollTrack.y;
_max = ((_scrollTrack.y + _scrollTrack.height) - _scrollHandle.height);
_scrollHandle.buttonMode = true;
_scrollHandle.addEventListener(MouseEvent.MOUSE_DOWN, _handleDown, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, _handleUp, false, 0, true);
addEventListener(MouseEvent.MOUSE_WHEEL, _scrollWheel, false, 0, true);
}
private function _updateFrames(_arg1:Event):void{
_frames++;
}
private function _init(_arg1:Event=null):void{
removeEventListener(Event.ADDED_TO_STAGE, _init);
trace("SWFConsole Initialised - ( ` ) to activate");
hide();
_createHeader();
_createBackground();
_createOutputArea();
_createScrollBar();
_createInputArea();
x = -(Math.ceil(((stage.stageWidth - _stageWidth) * 0.5)));
y = -(Math.ceil(((stage.stageHeight - _stageHeight) * 0.5)));
_activated = true;
_lastcommands = new Array();
_lastcommandsindex = 0;
output(WELCOME_MESSAGE);
stage.addEventListener(KeyboardEvent.KEY_UP, _keyListener, false, 0, true);
stage.addEventListener(Event.RESIZE, _relocate, false, 0, true);
}
private function _createBackground():void{
_bg = new Shape();
_bg.graphics.beginFill(BACKGROUND_COLOUR, BACKGROUND_ALPHA);
_bg.graphics.drawRect(0, 0, stage.stageWidth, BACKGROUND_HEIGHT);
_bg.graphics.endFill();
_bg.cacheAsBitmap = true;
_bg.y = HEADER_HEIGHT;
addChild(_bg);
}
private function _keyListener(_arg1:KeyboardEvent):void{
if (_activated){
switch (_arg1.keyCode){
case 192:
if (_enabled){
hide();
} else {
_inputText.text = "";
show();
stage.focus = _inputText;
};
_enabled = !(_enabled);
break;
case 13:
_processCommand(_inputText.text);
_inputText.text = "";
break;
case 38:
if (_lastcommands.length > 0){
_inputText.text = _lastcommands[_lastcommandsindex];
_inputText.setSelection(_inputText.length, _inputText.length);
_lastcommandsindex--;
if (_lastcommandsindex < 0){
_lastcommandsindex = 0;
};
};
break;
};
};
}
private function _runFunc(_arg1:String):void{
var instanceSplit:Array;
var functionSplit:Array;
var parametersSplit:Array;
var instance:Object;
var command = _arg1;
if (_findChar(command, ".")){
instanceSplit = command.split(".");
instance = _recurseChildren(stage, instanceSplit[0]);
functionSplit = instanceSplit[1].split("(");
parametersSplit = functionSplit[1].split(")");
if (instance){
if (instance.hasOwnProperty(functionSplit[0])){
try {
if (parametersSplit[0] == ""){
output(instance[functionSplit[0]]());
} else {
if (_findChar(parametersSplit[0], "\"")){
parametersSplit[0] = _removeChar(parametersSplit[0], "\"");
};
output(instance[functionSplit[0]](parametersSplit[0]));
};
} catch(e:Error) {
output(e);
};
} else {
output(((("Function " + functionSplit[0]) + " not found on ") + instanceSplit[0]));
};
} else {
output("Instance not found");
};
} else {
functionSplit = command.split("(");
parametersSplit = functionSplit[1].split(")");
if (stage.hasOwnProperty(functionSplit[0])){
try {
if (parametersSplit[0] == ""){
output(stage[functionSplit[0]]());
} else {
if (_findChar(parametersSplit[0], "\"")){
parametersSplit[0] = _removeChar(parametersSplit[0], "\"");
};
output(stage[functionSplit[0]](parametersSplit[0]));
};
} catch(e:Error) {
output(e);
};
} else {
output(((("Function " + functionSplit[0]) + " not found on ") + instanceSplit[0]));
};
};
}
private function _handleMove(_arg1:MouseEvent):void{
_scrollHandle.y = (mouseY - _offset);
if (_scrollHandle.y <= _min){
_scrollHandle.y = _min;
};
if (_scrollHandle.y >= _max){
_scrollHandle.y = _max;
};
_percent = ((_scrollHandle.y - _min) / (_max - _min));
if (_text.height > _outputMask.height){
_text.y = (_headerbg.height + (-(_percent) * (_text.height - _outputMask.height)));
};
_arg1.updateAfterEvent();
}
private function _initFPS(){
_fps = new Sprite();
stage.addChild(_fps);
_stageFrameRate = stage.frameRate;
_history = new Array();
_txt_fps = new TextField();
_txt_fps.width = 100;
_txt_fps.height = 16;
_txt_fps.border = false;
_txt_fps.selectable = false;
_txt_avgfps = new TextField();
_txt_avgfps.width = 100;
_txt_avgfps.height = 16;
_txt_avgfps.border = false;
_txt_avgfps.selectable = false;
var _local1:TextFormat = new TextFormat();
_local1.font = "Verdana";
_local1.color = 0xFFCC00;
_local1.size = 10;
_txt_fps.defaultTextFormat = _local1;
_txt_avgfps.defaultTextFormat = _local1;
_txt_fps.text = ("FPS: " + _stageFrameRate);
_txt_avgfps.text = ("AVG: " + _stageFrameRate);
_txt_fps.x = (_txt_fps.width - _txt_avgfps.width);
_txt_avgfps.x = 0;
_txt_avgfps.y = _txt_fps.height;
_fps.addChild(_txt_fps);
_fps.addChild(_txt_avgfps);
_fpsBg = new Shape();
_fpsBg.graphics.beginFill(0, 0.7);
_fpsBg.graphics.drawRect(0, 0, _fps.width, _fps.height);
_fpsBg.graphics.endFill();
_fps.addChildAt(_fpsBg, 0);
_fps.x = Math.ceil(((-((stage.stageWidth - _stageWidth)) * 0.5) + (stage.stageWidth - _fps.width)));
_fps.y = Math.ceil(((-((stage.stageHeight - _stageHeight)) * 0.5) + (stage.stageHeight - _fps.height)));
_fpsTimer = new Timer(_FPS_REFRESH_RATE);
_fpsTimer.addEventListener(TimerEvent.TIMER, _calculateFPS, false, 0, true);
_fpsTimer.start();
addEventListener(Event.ENTER_FRAME, _updateFrames, false, 0, true);
}
private function _processCommand(_arg1:String):void{
output(("> " + _arg1));
_lastcommands.push(_arg1);
_lastcommandsindex = (_lastcommands.length - 1);
_arg1 = _removeWhitespace(_arg1);
if (_arg1 == ""){
return;
};
if (_arg1.charAt(0) == "!"){
_runCommand(_arg1);
} else {
if (_findChar(_arg1, "(")){
_runFunc(_arg1);
} else {
_runProperty(_arg1);
};
};
}
public function show():void{
alpha = 1;
visible = true;
stage.focus = _inputText;
}
private function displayUsage(_arg1:TimerEvent):void{
_txt_mem.text = ("MEM: " + String((Number(((System.totalMemory / 0x0400) / 0x0400)).toFixed(2) + "MB")));
}
public static function init(_arg1:Object, _arg2:Boolean=false):void{
_arg1.stage.addChild(new SWFConsole(_arg1.stage.width, _arg1.stage.height, _arg2));
}
public static function output(_arg1:Object):void{
if (_activated){
_text.appendText((String(_arg1) + "\n"));
if (_text.height > _outputMask.height){
_text.y = (_headerbg.height - (_text.height - _outputMask.height));
_scrollHandle.y = _max;
_percent = 1;
if (!_scrollButtonDown.visible){
_scrollTrack.visible = true;
_scrollButtonUp.visible = true;
_scrollButtonDown.visible = true;
_scrollHandle.visible = true;
};
};
};
if (_traceEnabled){
trace(String(_arg1));
};
}
}
}//package rl.dev
Section 156
//Log (SWFStats.Log)
package SWFStats {
import flash.events.*;
import flash.system.*;
import flash.utils.*;
import flash.net.*;
import flash.external.*;
public final class Log {
private static const PingR:Timer = new Timer(30000);
private static const PingF:Timer = new Timer(60000);
public static var GUID:String = "";
private static var Plays:int = 0;
public static var Enabled:Boolean = false;
private static var Request:LogRequest = new LogRequest();
private static var Pings:int = 0;
public static var Queue:Boolean = true;
public static var SourceUrl:String;
private static var HighestGoal:int = 0;
private static var FirstPing:Boolean = true;
public static var SWFID:int = 0;
private static function SaveCookie(_arg1:String, _arg2:int):void{
var _local3:SharedObject = SharedObject.getLocal("swfstats");
_local3.data[_arg1] = _arg2.toString();
_local3.flush();
}
public static function View(_arg1:int=0, _arg2:String="", _arg3:String=""):void{
if (SWFID > 0){
return;
};
SWFID = _arg1;
GUID = _arg2;
Enabled = true;
if ((((SWFID == 0)) || ((GUID == "")))){
Enabled = false;
return;
};
if (((((!((_arg3.indexOf("http://") == 0))) && (!((Security.sandboxType == "localWithNetwork"))))) && (!((Security.sandboxType == "localTrusted"))))){
Enabled = false;
return;
};
SourceUrl = GetUrl(_arg3);
if ((((SourceUrl == null)) || ((SourceUrl == "")))){
Enabled = false;
return;
};
Security.allowDomain("http://tracker.swfstats.com/");
Security.allowInsecureDomain("http://tracker.swfstats.com/");
Security.loadPolicyFile("http://tracker.swfstats.com/crossdomain.xml");
Security.allowDomain("http://utils.swfstats.com/");
Security.allowInsecureDomain("http://utils.swfstats.com/");
Security.loadPolicyFile("http://utils.swfstats.com/crossdomain.xml");
var _local4:int = GetCookie("views");
_local4++;
SaveCookie("views", _local4);
Send(("v/" + _local4), true);
PingF.addEventListener(TimerEvent.TIMER, PingServer);
PingF.start();
}
public static function LevelCounterMetric(_arg1:String, _arg2):void{
if (!Enabled){
return;
};
Send(((("lc/" + Clean(_arg1)) + "/") + Clean(_arg2)));
}
private static function Clean(_arg1:String):String{
return (escape(_arg1.replace("/", "\\").replace("~", "-")));
}
public static function Play():void{
if (!Enabled){
return;
};
Plays++;
Send(("p/" + Plays));
}
private static function Send(_arg1:String, _arg2:Boolean=false):void{
Request.Queue(_arg1);
if (((((Request.Ready) || (_arg2))) || (!(Queue)))){
Request.Send();
Request = new LogRequest();
};
}
private static function GetUrl(_arg1:String):String{
var url:String;
var defaulturl = _arg1;
if (ExternalInterface.available){
try {
url = String(ExternalInterface.call("window.location.href.toString"));
} catch(s:Error) {
url = defaulturl;
};
} else {
if (defaulturl.indexOf("http://") == 0){
url = defaulturl;
};
};
if ((((((url == null)) || ((url == "")))) || ((url == "null")))){
if ((((Security.sandboxType == "localWithNetwork")) || ((Security.sandboxType == "localTrusted")))){
url = "http://local-testing/";
} else {
url = null;
};
};
return (escape(url));
}
public static function LevelRangedMetric(_arg1:String, _arg2, _arg3:int):void{
if (!Enabled){
return;
};
Send(((((("lr/" + Clean(_arg1)) + "/") + Clean(_arg2)) + "/") + _arg3));
}
private static function GetCookie(_arg1:String):int{
var _local2:SharedObject = SharedObject.getLocal("swfstats");
if (_local2.data[_arg1] == undefined){
return (0);
};
return (int(_local2.data[_arg1]));
}
public static function Goal(_arg1:int, _arg2:String):void{
}
private static function PingServer(... _args):void{
if (!Enabled){
return;
};
Pings++;
Send(((("t/" + (FirstPing) ? "y" : "n") + "/") + Pings), true);
if (FirstPing){
PingF.stop();
PingR.addEventListener(TimerEvent.TIMER, PingServer);
PingR.start();
FirstPing = false;
};
}
public static function LevelAverageMetric(_arg1:String, _arg2, _arg3:int):void{
if (!Enabled){
return;
};
Send(((((("la/" + Clean(_arg1)) + "/") + Clean(_arg2)) + "/") + _arg3));
}
public static function CustomMetric(_arg1:String, _arg2:String=null):void{
if (!Enabled){
return;
};
if (_arg2 == null){
_arg2 = "";
};
Send(((("c/" + Clean(_arg1)) + "/") + Clean(_arg2)));
}
}
}//package SWFStats
Section 157
//LogRequest (SWFStats.LogRequest)
package SWFStats {
import flash.events.*;
import flash.net.*;
public final class LogRequest {
private var Data:String;// = ""
public var Ready:Boolean;// = false
private var Pieces:int;
private static var Failed:int = 0;
private function IOErrorHandler(_arg1:IOErrorEvent):void{
Failed++;
}
public function Queue(_arg1:String):void{
if (Failed > 3){
return;
};
this.Pieces++;
this.Data = (this.Data + (((this.Data == "")) ? "" : "~" + _arg1));
if ((((this.Pieces == 8)) || ((this.Data.length > 300)))){
this.Ready = true;
};
}
private function SecurityErrorHandler(_arg1:SecurityErrorEvent):void{
}
private function StatusChange(_arg1:HTTPStatusEvent):void{
}
public function Send():void{
var _local1:URLLoader = new URLLoader();
_local1.addEventListener(IOErrorEvent.IO_ERROR, this.IOErrorHandler);
_local1.addEventListener(HTTPStatusEvent.HTTP_STATUS, this.StatusChange);
_local1.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.SecurityErrorHandler);
_local1.load(new URLRequest((((((((((("http://tracker.swfstats.com/Games/q.aspx?guid=" + Log.GUID) + "&swfid=") + Log.SWFID) + "&q=") + this.Data) + "&url=") + Log.SourceUrl) + "&") + Math.random()) + "z")));
trace((((((((((("http://tracker.swfstats.com/Games/q.aspx?guid=" + Log.GUID) + "&swfid=") + Log.SWFID) + "&q=") + this.Data) + "&url=") + Log.SourceUrl) + "&") + Math.random()) + "z"));
}
}
}//package SWFStats
Section 158
//BigCircleObject (BigCircleObject)
package {
import flash.display.*;
public dynamic class BigCircleObject extends MovieClip {
}
}//package
Section 159
//BigConcaveObject (BigConcaveObject)
package {
import flash.display.*;
public dynamic class BigConcaveObject extends MovieClip {
}
}//package
Section 160
//BigGearObject (BigGearObject)
package {
import flash.display.*;
public dynamic class BigGearObject extends MovieClip {
}
}//package
Section 161
//BlockObject (BlockObject)
package {
import flash.display.*;
public dynamic class BlockObject extends MovieClip {
}
}//package
Section 162
//BounceObject (BounceObject)
package {
import flash.display.*;
public dynamic class BounceObject extends MovieClip {
}
}//package
Section 163
//BounceSound (BounceSound)
package {
import flash.media.*;
public dynamic class BounceSound extends Sound {
}
}//package
Section 164
//Box (Box)
package {
import flash.display.*;
public dynamic class Box extends MovieClip {
}
}//package
Section 165
//BoxManual (BoxManual)
package {
import flash.display.*;
public dynamic class BoxManual extends MovieClip {
}
}//package
Section 166
//BoxPulley (BoxPulley)
package {
import flash.display.*;
public dynamic class BoxPulley extends MovieClip {
}
}//package
Section 167
//BoxRevolute (BoxRevolute)
package {
import flash.display.*;
public dynamic class BoxRevolute extends MovieClip {
}
}//package
Section 168
//ChainFront (ChainFront)
package {
import flash.display.*;
public dynamic class ChainFront extends MovieClip {
}
}//package
Section 169
//ChainSide (ChainSide)
package {
import flash.display.*;
public dynamic class ChainSide extends MovieClip {
}
}//package
Section 170
//Circle (Circle)
package {
import flash.display.*;
public dynamic class Circle extends MovieClip {
}
}//package
Section 171
//ConveyorBeltObject (ConveyorBeltObject)
package {
import flash.display.*;
public dynamic class ConveyorBeltObject extends MovieClip {
}
}//package
Section 172
//CrossbarObject (CrossbarObject)
package {
import flash.display.*;
public dynamic class CrossbarObject extends MovieClip {
}
}//package
Section 173
//CustomLevelItem (CustomLevelItem)
package {
import flash.display.*;
import flash.text.*;
public dynamic class CustomLevelItem extends MovieClip {
public var star2:MovieClip;
public var star3:MovieClip;
public var star5:MovieClip;
public var star4:MovieClip;
public var thumbnail:ThumbnailItem;
public var titleDisp:TextField;
public var star1:MovieClip;
}
}//package
Section 174
//DominoObject (DominoObject)
package {
import flash.display.*;
public dynamic class DominoObject extends MovieClip {
}
}//package
Section 175
//FanObject (FanObject)
package {
import flash.display.*;
public dynamic class FanObject extends MovieClip {
}
}//package
Section 176
//FinishPoint (FinishPoint)
package {
import flash.display.*;
public dynamic class FinishPoint extends MovieClip {
}
}//package
Section 177
//FinishPointLayer (FinishPointLayer)
package {
import flash.display.*;
public dynamic class FinishPointLayer extends MovieClip {
}
}//package
Section 178
//FinishPointObject (FinishPointObject)
package {
import flash.display.*;
public dynamic class FinishPointObject extends MovieClip {
}
}//package
Section 179
//GamerSafe (GamerSafe)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.system.*;
import flash.utils.*;
import flash.net.*;
public class GamerSafe extends Sprite {
private const _storedPasscode:String = "G1fc5c87d4632dc64b1324e5a6c8afdb5ca70b8881:1276365805";
private const _storedHashseed:String = "70d51326ed99a33f0b1542bcfde55b54d107c9a7";
private var _evt_onScoreSubmitted:Function;// = null
private var _stageHeight:Number;// = 400
private var _evt_onLevelVaultLevelRated:Function;// = null
private var _evt_onUnregisteredName:Function;// = null
private var _evt_onLevelVaultLevelEdited:Function;// = null
private var _evt_onOtherGameProfileReceived:Function;// = null
private var _evt_useEnded:Function;// = null
private var _evt_onMetaData:Function;// = null
private var _evt_onLevelVaultGotLevel:Function;// = null
private var _levelVaultTempAttributes:Object;
private var _evt_networkingError:Function;// = null
private var _evt_accountChange:Function;// = null
private var _evt_onRegistrationFormClosed:Function;// = null
private var _evt_apiReady:Function;// = null
private var _evt_onLevelVaultLevelCreated:Function;// = null
private var _evt_itemPurchase:Function;// = null
private var _context:LoaderContext;
private var _evt_loginFailed:Function;// = null
private var _evt_onLevelVaultGotLevels:Function;// = null
private var _evt_onLevelVaultLevelStringsSet:Function;// = null
private var _evt_login:Function;// = null
private var _evt_onScoreboardRecieved:Function;// = null
private var _evt_onScoreboardError:Function;// = null
private var _evt_beginSession:Function;// = null
private var _evt_onConsumptionCompleted:Function;// = null
private var _levelVaultLastError:String;// = ""
private var _gamerSafe:Object;// = null
private var _evt_onLevelVaultLevelNumericsIncremented:Function;// = null
private var _evt_useStarted:Function;// = null
private var _stageWidth:Number;// = 550
private var _evt_confYes:Function;// = null
private var _evt_onLevelVaultLevelNumericsSet:Function;// = null
private var _status:String;// = "Loading"
private var _inUse:Boolean;// = false
private var _loaded:Boolean;// = false
private var _evt_useChanged:Function;// = null
private var _loader:Loader;
private var _evt_onMetaDataError:Function;// = null
private var _evt_beginSessionFailed:Function;// = null
private var _request:URLRequest;
private var _evt_onLoginFormClosed:Function;// = null
private var _referrer:String;// = ""
private var _evt_confNo:Function;// = null
private var _evt_itemPurchaseFailed:Function;// = null
private var _evt_onLevelVaultLevelDeleted:Function;// = null
private var _evt_onLevelVaultLevelFlagged:Function;// = null
private var _evt_onLevelVaultLevelAttributesChanged:Function;// = null
private var _tmpSkin:Object;
private var _stage:Stage;
public static const EVT_OTHER_GAME_PROFILE_RECEIVED:String = "other_game_profile_received";
public static const EVT_LEVELVAULT_LEVEL_FLAGGED:String = "level_flagged";
public static const EVT_ITEM_PURCHASE_FAILED:String = "item_purchase_failed";
public static const EVT_LEVELVAULT_GOT_SINGLE_LEVEL:String = "got_level";
public static const EVT_BEGIN_SESSION_FAILED:String = "begin_session_failed";
public static const EVT_ACCOUNT_CHANGE:String = "account_change";
public static const EVT_SCOREBOARD_ENTRIES_RECEIVED:String = "scoreboard_entries_received";
public static const EVT_LEVELVAULT_LEVEL_NUMERICS_INCREMENTED:String = "level_numerics_incremented";
public static const EVT_LEVELVAULT_LEVEL_CREATED:String = "level_created";
public static const EVT_METADATA:String = "metadata";
public static const META_SORT_ASC:int = 1;
public static const EVT_LEVELVAULT_LEVEL_RATED:String = "level_rated";
public static const EVT_LEVELVAULT_LEVEL_STRINGS_SET:String = "level_strings_set";
public static const EVT_ITEM_PURCHASE:String = "item_purchase";
public static const EVT_LEVELVAULT_LEVEL_NUMERICS_SET:String = "level_numerics_set";
public static const EVT_REGISTRATION_FORM_CLOSED:String = "register_close";
public static const EVT_BEGIN_SESSION:String = "begin_session";
public static const EVT_LEVELVAULT_LEVEL_DELETED:String = "level_deleted";
public static const EVT_LOGIN:String = "login";
public static const EVT_LOGIN_FORM_CLOSED:String = "login_close";
public static const EVT_LEVELVAULT_GOT_LEVELS:String = "got_levels";
public static const META_SORT_DESC:int = 2;
public static const EVT_NETWORKING_ERROR:String = "networking_error";
public static const EVT_METADATA_ERROR:String = "metadata_error";
public static const version:String = "01";
public static const EVT_LEVELVAULT_LEVEL_EDITED:String = "level_edited";
public static const EVT_SCOREBOARD_ENTRIES_ERROR:String = "scoreboard_entries_error";
public static const EVT_CONSUMPTION_COMPLETED:String = "consumption_completed";
public static const EVT_LOGIN_FAILED:String = "login_failed";
public static const EVT_UNREGISTERED_NAME:String = "unregistered_name";
public static const EVT_SCOREBOARD_ENTRY_SUBMITTED:String = "scoreboard_entry_submitted";
protected static var _instance:GamerSafe = null;
public function GamerSafe(_arg1){
var parent = _arg1;
_tmpSkin = {};
_levelVaultTempAttributes = {};
_loader = new Loader();
_context = new LoaderContext(true);
_request = new URLRequest((("http://components.gamersafe.com/GamerSafe." + version) + ".swf"));
super();
if (_instance == null){
_instance = this;
} else {
trace("GamerSafe: Instance Error: The GamerSafe class is a singleton and should only be constructed once. Use Gamersafe.instance instead.");
return;
};
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_context.applicationDomain = ApplicationDomain.currentDomain;
_status = "Downloading";
try {
_loader.load(_request, _context);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadingError);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadingComplete);
} catch(s:SecurityError) {
_status = "Failed";
trace("Security error - GamerSafe library cannot load");
_loader = null;
};
addEventListener(Event.ADDED_TO_STAGE, setupStage);
if ((((((parent is Sprite)) || ((parent is MovieClip)))) || ((parent is Stage)))){
parent.addChild(this);
} else {
trace("Incompatible parent!");
};
}
public function get loaded():Boolean{
return (_loaded);
}
private function levelVaultCreateLevelFromBytes(_arg1:ByteArray):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultCreateLevel(_arg1));
}
public function flashBar():void{
if (_loaded == false){
return;
};
_gamerSafe.flashBar();
}
public function levelVaultFlagLevel(_arg1):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultFlagLevel(_arg1));
}
public function set achievementPopupPosition(_arg1:Point):void{
if (_loaded == false){
return;
};
_gamerSafe.achievementPopupPosition = _arg1;
}
public function showScoreSubmit(_arg1:Number, _arg2:String, _arg3:Boolean=false, _arg4:int=-1):void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.showScoreSubmitPrompt(_arg1, _arg2, _arg4, _arg3);
}
public function set onUnregisteredName(_arg1:Function):void{
_evt_onUnregisteredName = _arg1;
}
public function levelVaultRegisterErrorCallback(_arg1:Function, ... _args):void{
var _local4:*;
var _local3:Array = [];
_local3.push(_arg1);
for each (_local4 in _args) {
_local3.push(_local4);
};
(_gamerSafe.levelVaultRegisterErrorCallback as Function).apply(this, _local3);
}
public function levelVaultRegisterPersistentErrorCallback(_arg1:Function, ... _args):void{
var _local4:*;
var _local3:Array = [];
_local3.push(_arg1);
for each (_local4 in _args) {
_local3.push(_local4);
};
(_gamerSafe.levelVaultRegisterPersistentErrorCallback as Function).apply(this, _local3);
}
public function hideInterface():void{
if (_loaded == false){
return;
};
_gamerSafe.visible = false;
}
public function get highScore():Number{
if (_loaded == false){
return (0);
};
if (inSession == false){
return (0);
};
return (_gamerSafe.highScore);
}
public function set highScore(_arg1:Number):void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.highScore = _arg1;
}
private function e_onBeginSessionFailed(_arg1:Event):void{
if (_evt_beginSessionFailed != null){
_evt_beginSessionFailed();
};
dispatchEvent(_arg1);
}
public function levelVaultIncrementNumerics(_arg1, _arg2:Array):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultIncrementNumerics(_arg1, _arg2));
}
public function levelVaultGetLastSelectedLevel():Object{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", null));
};
return (_gamerSafe.levelVaultGetLastSelectedLevel());
}
public function levelVaultEditLevel(_arg1, _arg2:ByteArray):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
if (loggedIn == false){
return (levelVaultFail("You must be logged in to edit levels"));
};
return (_gamerSafe.levelVaultEditLevel(_arg1, _arg2));
}
public function get account():Object{
if (_loaded == false){
return (null);
};
return (_gamerSafe.account);
}
public function levelVaultSetNumericAttributes(_arg1, _arg2:Array, _arg3:Array):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultSetNumericAttributes(_arg1, _arg2, _arg3));
}
public function get inUse():Boolean{
return (_inUse);
}
public function set savedGame(_arg1:String):void{
if (_loaded == false){
return;
};
_gamerSafe.savedGame = _arg1;
}
public function levelVaultGetLevelNumRatings(_arg1:Object=null):int{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", 0));
};
return (_gamerSafe.levelVaultGetLevelNumRatings(_arg1));
}
public function get applicationDomain():ApplicationDomain{
return (_loader.contentLoaderInfo.applicationDomain);
}
public function get gamerTestMode():Boolean{
if (_loaded == false){
return (false);
};
return (_gamerSafe.gamerTestMode);
}
public function get iconUrl():String{
if (_loaded == false){
return ("");
};
return (_gamerSafe.iconUrl);
}
public function showRegistrationForm():void{
if (_loaded == false){
return;
};
_gamerSafe.showRegistrationForm();
}
private function e_onNetworkingError(_arg1:Event):void{
if (_evt_networkingError != null){
_evt_networkingError();
};
dispatchEvent(_arg1);
}
public function hasAchievement(_arg1:int):Boolean{
if (_loaded == false){
return (false);
};
if (inSession == false){
return (false);
};
return (_gamerSafe.hasAchievement(_arg1));
}
public function get failed():Boolean{
if (_loaded == false){
return (false);
};
return (_gamerSafe.failed);
}
public function get onOtherGameProfileReceived():Function{
return (_evt_onOtherGameProfileReceived);
}
public function get onUseStarted():Function{
return (_evt_useStarted);
}
private function e_onOtherGameProfileReceived(_arg1:Event):void{
if (_evt_onOtherGameProfileReceived != null){
_evt_onOtherGameProfileReceived();
};
dispatchEvent(_arg1);
}
private function e_onRegistrationFormClosed(_arg1:Event):void{
if (_evt_onRegistrationFormClosed != null){
_evt_onRegistrationFormClosed();
};
dispatchEvent(_arg1);
}
public function get loggedIn():Boolean{
if (_loaded == false){
return (false);
};
return (_gamerSafe.loggedIn);
}
public function showStatusBar(_arg1:Object=null):void{
if (_loaded == false){
return;
};
_gamerSafe.showStatusBar(_arg1);
}
private function e_onLevelVaultLevelStringsSet(_arg1:Event):void{
if (_evt_onLevelVaultLevelStringsSet != null){
_evt_onLevelVaultLevelStringsSet();
};
dispatchEvent(_arg1);
}
private function e_onBeginSession(_arg1:Event):void{
if (_evt_beginSession != null){
_evt_beginSession();
};
dispatchEvent(_arg1);
}
public function closeItemInterface():void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.closeItemInterface();
}
public function get latestItemConsumptionInfo():Object{
if (_loaded == false){
return (null);
};
return (_gamerSafe.getLatestItemConsumptionInfo());
}
private function e_onLevelVaultLevelCreated(_arg1:Event):void{
if (_evt_onLevelVaultLevelCreated != null){
_evt_onLevelVaultLevelCreated();
};
dispatchEvent(_arg1);
}
public function set onOtherGameProfileReceived(_arg1:Function):void{
_evt_onOtherGameProfileReceived = _arg1;
}
public function get onScoreSubmitted():Function{
return (_evt_onScoreSubmitted);
}
public function get onMetaDataError():Function{
return (_evt_onMetaDataError);
}
public function set onLevelVaultLevelStringsSet(_arg1:Function):void{
_evt_onLevelVaultLevelStringsSet = _arg1;
}
public function get onMetaData():Function{
return (_evt_onMetaData);
}
public function set onLevelVaultLevelFlagged(_arg1:Function):void{
_evt_onLevelVaultLevelFlagged = _arg1;
}
public function set onBeginSession(_arg1:Function):void{
_evt_beginSession = _arg1;
}
private function e_onLoginFormClosed(_arg1:Event):void{
if (_evt_onLoginFormClosed != null){
_evt_onLoginFormClosed();
};
dispatchEvent(_arg1);
}
private function e_onLevelVaultLevelEdited(_arg1:Event):void{
if (_evt_onLevelVaultLevelEdited != null){
_evt_onLevelVaultLevelEdited();
};
dispatchEvent(_arg1);
}
private function e_onMetaData(_arg1:Event):void{
if (_evt_onMetaData != null){
_evt_onMetaData();
};
dispatchEvent(_arg1);
}
public function levelVaultFetchLevelByID(_arg1:int):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultFetchLevelByID(_arg1));
}
public function get onLevelVaultLevelEdited():Function{
return (_evt_onLevelVaultLevelEdited);
}
public function showScoreboard(_arg1:int=-1):void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.showScoreboard(_arg1);
}
public function get onScoreboardRecieved():Function{
return (_evt_onScoreboardRecieved);
}
public function setStyle(_arg1:String, _arg2):void{
if (_loaded == false){
_tmpSkin[_arg1] = _arg2;
return;
};
var _local3:Object = new Object();
_local3[_arg1] = _arg2;
_gamerSafe.setSkin(_local3);
}
public function levelVaultSetStringAttribute(_arg1, _arg2:String, _arg3:String):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultSetStringAttribute(_arg1, _arg2, _arg3));
}
private function e_onLevelVaultLevelNumericsIncremented(_arg1:Event):void{
if (_evt_onLevelVaultLevelNumericsIncremented != null){
_evt_onLevelVaultLevelNumericsIncremented();
};
dispatchEvent(_arg1);
}
private function e_onItemPurchaseFailed(_arg1:Event):void{
if (_evt_itemPurchaseFailed != null){
_evt_itemPurchaseFailed();
};
dispatchEvent(_arg1);
}
public function showLogin(_arg1:Object=null):void{
if (_loaded == false){
return;
};
_gamerSafe.showLogin(_arg1);
}
private function e_onMetaDataError(_arg1:Event):void{
if (_evt_onMetaDataError != null){
_evt_onMetaDataError();
};
dispatchEvent(_arg1);
}
public function set onUseStarted(_arg1:Function):void{
_evt_useStarted = _arg1;
}
public function requestMetaDataByValue(_arg1:int, _arg2:Number, _arg3:Number, _arg4:int=-1, _arg5:int=1):void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.requestMetaDataByValue(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function get onUseChanged():Function{
return (_evt_useChanged);
}
public function set onLevelVaultLevelEdited(_arg1:Function):void{
_evt_onLevelVaultLevelEdited = _arg1;
}
private function setupStage(_arg1:Event):void{
if (stage == null){
return;
};
_stage = stage;
_stage.addEventListener(Event.RESIZE, resizeStage);
_stageWidth = stage.stageWidth;
_stageHeight = stage.stageHeight;
if (root != null){
_referrer = root.loaderInfo.loaderURL;
};
if (loaded){
_gamerSafe.componentWidth = _stageWidth;
_gamerSafe.componentHeight = _stageHeight;
_stage.addChild((_gamerSafe as Sprite));
};
}
public function get onBeginSessionFailed():Function{
return (_evt_beginSessionFailed);
}
private function get levelVaultEventObject():EventDispatcher{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", null));
};
return (_gamerSafe.levelVaultEventObject);
}
public function saveToScoreboard(_arg1:Number, _arg2:String, _arg3:int=-1, _arg4:String=""):void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.saveToScoreboard(_arg1, _arg2, _arg3, _arg4);
}
public function get onLevelVaultLevelRated():Function{
return (_evt_onLevelVaultLevelRated);
}
public function set onScoreSubmitted(_arg1:Function):void{
_evt_onScoreSubmitted = _arg1;
}
public function get levelVaultLastSelectedLevelsReceipt():int{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", 0));
};
return (_gamerSafe.levelVaultLastSelectedLevelsReceipt);
}
public function bestowFreeItem(_arg1:int):Boolean{
if (_loaded == false){
return (false);
};
_gamerSafe.bestowFreeItem(_arg1);
return (true);
}
public function set onConfirmYes(_arg1:Function):void{
_evt_confYes = _arg1;
}
public function get onUseEnded():Function{
return (_evt_useEnded);
}
private function e_onConsumptionCompleted(_arg1:Event):void{
if (_evt_onConsumptionCompleted != null){
_evt_onConsumptionCompleted();
};
dispatchEvent(_arg1);
}
private function e_onUseEnded(_arg1):void{
if (_inUse == false){
return;
};
_inUse = false;
if (_evt_useChanged != null){
_evt_useChanged();
};
if (_evt_useEnded != null){
_evt_useEnded();
};
dispatchEvent(new Event("inUseEnded"));
dispatchEvent(new Event("inUseChanged"));
}
public function set onMetaData(_arg1:Function):void{
_evt_onMetaData = _arg1;
}
public function get onAccountChange():Function{
return (_evt_accountChange);
}
public function get FAQUrl():String{
if (_loaded == false){
return ("");
};
return (_gamerSafe.FAQUrl);
}
public function get countryCode():String{
if (_loaded == false){
return ("");
};
if (inSession == false){
return ("");
};
return (_gamerSafe.countryCode);
}
public function get onApiReady():Function{
return (_evt_apiReady);
}
public function levelVaultSetNumericAttribute(_arg1, _arg2:String, _arg3:Number):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultSetNumericAttribute(_arg1, _arg2, _arg3));
}
public function levelVaultDeleteLevel(_arg1):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultDeleteLevel(_arg1));
}
private function e_onConfirmNo(_arg1:Event):void{
if (_evt_confNo != null){
_evt_confNo();
};
dispatchEvent(new Event("confirmedNo"));
}
public function get onLevelVaultLevelNumericsIncremented():Function{
return (_evt_onLevelVaultLevelNumericsIncremented);
}
public function get onItemPurchase():Function{
return (_evt_itemPurchase);
}
public function set onMetaDataError(_arg1:Function):void{
_evt_onMetaDataError = _arg1;
}
private function onLoadingComplete(_arg1:Event):void{
_status = "Ready";
_loaded = true;
_gamerSafe = (_loader.content as Object);
_gamerSafe.componentWidth = _stageWidth;
_gamerSafe.componentHeight = _stageHeight;
_gamerSafe.setSkin(_tmpSkin);
_gamerSafe.addEventListener(EVT_NETWORKING_ERROR, e_onNetworkingError);
_gamerSafe.addEventListener(EVT_ACCOUNT_CHANGE, e_onAccountChange);
_gamerSafe.addEventListener(EVT_LOGIN, e_onLogin);
_gamerSafe.addEventListener(EVT_LOGIN_FAILED, e_onLoginFailed);
_gamerSafe.addEventListener(EVT_BEGIN_SESSION, e_onBeginSession);
_gamerSafe.addEventListener(EVT_BEGIN_SESSION_FAILED, e_onBeginSessionFailed);
_gamerSafe.addEventListener(EVT_ITEM_PURCHASE, e_onItemPurchase);
_gamerSafe.addEventListener(EVT_ITEM_PURCHASE_FAILED, e_onItemPurchaseFailed);
_gamerSafe.addEventListener("yes", e_onConfirmYes);
_gamerSafe.addEventListener("no", e_onConfirmNo);
_gamerSafe.addEventListener("dialog_begin", e_onUseStarted);
_gamerSafe.addEventListener("dialog_end", e_onUseEnded);
_gamerSafe.addEventListener(EVT_SCOREBOARD_ENTRIES_ERROR, e_onScoreboardError);
_gamerSafe.addEventListener(EVT_SCOREBOARD_ENTRIES_RECEIVED, e_onScoreboardRecieved);
_gamerSafe.addEventListener(EVT_SCOREBOARD_ENTRY_SUBMITTED, e_onScoreSubmitted);
_gamerSafe.addEventListener(EVT_METADATA, e_onMetaData);
_gamerSafe.addEventListener(EVT_METADATA_ERROR, e_onMetaDataError);
_gamerSafe.addEventListener(EVT_UNREGISTERED_NAME, e_onUnregisteredName);
_gamerSafe.addEventListener(EVT_CONSUMPTION_COMPLETED, e_onConsumptionCompleted);
_gamerSafe.addEventListener(EVT_REGISTRATION_FORM_CLOSED, e_onRegistrationFormClosed);
_gamerSafe.addEventListener(EVT_LOGIN_FORM_CLOSED, e_onLoginFormClosed);
_gamerSafe.addEventListener(EVT_OTHER_GAME_PROFILE_RECEIVED, e_onOtherGameProfileReceived);
var _local2:EventDispatcher = levelVaultEventObject;
_local2.addEventListener(EVT_LEVELVAULT_GOT_LEVELS, e_onLevelVaultGotLevels);
_local2.addEventListener(EVT_LEVELVAULT_GOT_SINGLE_LEVEL, e_onLevelVaultGotLevel);
_local2.addEventListener(EVT_LEVELVAULT_LEVEL_CREATED, e_onLevelVaultLevelCreated);
_local2.addEventListener(EVT_LEVELVAULT_LEVEL_DELETED, e_onLevelVaultLevelDeleted);
_local2.addEventListener(EVT_LEVELVAULT_LEVEL_EDITED, e_onLevelVaultLevelEdited);
_local2.addEventListener(EVT_LEVELVAULT_LEVEL_FLAGGED, e_onLevelVaultLevelFlagged);
_local2.addEventListener(EVT_LEVELVAULT_LEVEL_RATED, e_onLevelVaultLevelRated);
_local2.addEventListener(EVT_LEVELVAULT_LEVEL_NUMERICS_SET, e_onLevelVaultLevelNumericsSet);
_local2.addEventListener(EVT_LEVELVAULT_LEVEL_STRINGS_SET, e_onLevelVaultLevelStringsSet);
_local2.addEventListener(EVT_LEVELVAULT_LEVEL_NUMERICS_INCREMENTED, e_onLevelVaultLevelNumericsIncremented);
_local2.addEventListener(EVT_LEVELVAULT_LEVEL_NUMERICS_SET, e_onLevelVaultLevelAttributesChanged);
_local2.addEventListener(EVT_LEVELVAULT_LEVEL_STRINGS_SET, e_onLevelVaultLevelAttributesChanged);
_local2.addEventListener(EVT_LEVELVAULT_LEVEL_NUMERICS_INCREMENTED, e_onLevelVaultLevelAttributesChanged);
if (_stage != null){
_stage.addChild((_gamerSafe as Sprite));
};
if (root != null){
_referrer = root.loaderInfo.loaderURL;
};
if (_storedPasscode != ""){
beginSession(_storedPasscode, _storedHashseed);
};
showStatusBar();
e_onApiReady(new Event("apiReady"));
}
public function set onScoreboardRecieved(_arg1:Function):void{
_evt_onScoreboardRecieved = _arg1;
}
private function resizeStage(_arg1:Event):void{
if (loaded == false){
return;
};
_stageWidth = _stage.stageWidth;
_stageHeight = _stage.stageHeight;
_gamerSafe.componentWidth = _stageWidth;
_gamerSafe.componentHeight = _stageHeight;
}
public function levelVaultSetExpiringStringAttribute(_arg1, _arg2:String, _arg3:String, _arg4:String):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (levelVaultSetExpiringStringAttributes(_arg1, [_arg2], [_arg3], [_arg4]));
}
public function showAchievements(_arg1:Object=null):void{
if (_loaded == false){
return;
};
_gamerSafe.showAchievements(_arg1);
}
public function requestMetaDataForAccount(_arg1:int=-1):void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.requestMetaDataForAccount(_arg1);
}
public function bestowAchievement(_arg1:uint):Boolean{
if (_loaded == false){
return (false);
};
_gamerSafe.bestowAchievement(_arg1);
return (true);
}
private function get sprite():Sprite{
if (_loaded == false){
return (null);
};
return (_gamerSafe.sprite);
}
private function e_onApiReady(_arg1:Event):void{
if (_evt_apiReady != null){
_evt_apiReady();
};
dispatchEvent(_arg1);
}
public function get onLogin():Function{
return (_evt_login);
}
private function e_onAccountChange(_arg1:Event):void{
if (_evt_accountChange != null){
_evt_accountChange();
};
dispatchEvent(_arg1);
}
public function levelVaultGetLevelsByDateCreated(_arg1:String, _arg2:String, _arg3:Boolean=true, _arg4:uint=20, _arg5:uint=0):int{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", 0));
};
return (_gamerSafe.levelVaultGetLevelsByDateCreated(_arg1, _arg2, _arg3, _arg4, _arg5));
}
public function hasItem(_arg1:int):Boolean{
if (_loaded == false){
return (false);
};
if (inSession == false){
return (false);
};
return (_gamerSafe.hasItem(_arg1));
}
public function requestMetaDataByType(_arg1:int, _arg2:int=1000):void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.requestMetaDataByType(_arg1, _arg2);
}
public function get onItemPurchaseFailed():Function{
return (_evt_itemPurchaseFailed);
}
public function get levelVaultLastEditedLevelID():uint{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", 0));
};
return (_gamerSafe.levelVaultGetLastEditedLevelID());
}
public function levelVaultGetLevelData(_arg1:Object=null):ByteArray{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", null));
};
return (_gamerSafe.levelVaultGetLevelData(_arg1));
}
public function requestOtherGameProfile(_arg1:String):void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.requestOtherGameProfile(_arg1);
}
public function levelVaultSetStringAttributes(_arg1, _arg2:Array, _arg3:Array):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultSetStringAttributes(_arg1, _arg2, _arg3));
}
public function levelVaultSetExpiringNumericAttribute(_arg1, _arg2:String, _arg3:Number, _arg4:String):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (levelVaultSetExpiringNumericAttributes(_arg1, [_arg2], [_arg3], [_arg4]));
}
private function e_onScoreSubmitted(_arg1:Event):void{
if (_evt_onScoreSubmitted != null){
_evt_onScoreSubmitted();
};
dispatchEvent(_arg1);
}
public function set onUseEnded(_arg1:Function):void{
_evt_useEnded = _arg1;
}
public function get username():String{
if (_loaded == false){
return ("GamerSafe");
};
return (_gamerSafe.username);
}
private function e_onConfirmYes(_arg1:Event):void{
if (_evt_confYes != null){
_evt_confYes();
};
dispatchEvent(new Event("confirmedYes"));
}
public function get onLevelVaultLevelDeleted():Function{
return (_evt_onLevelVaultLevelDeleted);
}
public function levelVaultSetAttributes(_arg1, _arg2:Object):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultSetAttributes(_arg1, _arg2));
}
public function set onConsumptionCompleted(_arg1:Function):void{
_evt_onConsumptionCompleted = _arg1;
}
public function disable():void{
if (_status == "Ready"){
_status = "Disabled";
_loaded = false;
};
}
private function e_onLogin(_arg1:Event):void{
if (_evt_login != null){
_evt_login();
};
flashBar();
dispatchEvent(_arg1);
}
public function levelVaultGetLevelsByRating(_arg1:Number, _arg2:Number, _arg3:Boolean=true, _arg4:uint=20, _arg5:uint=0):int{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", 0));
};
return (_gamerSafe.levelVaultGetLevelsByRating(_arg1, _arg2, _arg3, _arg4, _arg5));
}
private function e_onLevelVaultGotLevels(_arg1:Event):void{
if (_evt_onLevelVaultGotLevels != null){
_evt_onLevelVaultGotLevels();
};
dispatchEvent(_arg1);
}
public function set wantsNewsletter(_arg1:Boolean):void{
if (_loaded == true){
_gamerSafe.wantsNewsletter = _arg1;
};
}
public function get autoLogin():Boolean{
if (_loaded == false){
return (false);
};
return (_gamerSafe.autoLogin);
}
public function getItemById(_arg1:int):Object{
var _local3:Object;
if (_loaded == false){
return (null);
};
if (inSession == false){
return (null);
};
var _local2:Array = items;
for each (_local3 in _local2) {
if (_local3.id == _arg1){
return (_local3);
};
};
return (null);
}
public function get onLevelVaultLevelAttributesChanged():Function{
return (_evt_onLevelVaultLevelAttributesChanged);
}
public function set onConfirmNo(_arg1:Function):void{
_evt_confNo = _arg1;
}
public function set onUseChanged(_arg1:Function):void{
_evt_useChanged = _arg1;
}
public function get unregisteredName():String{
if (_loaded == false){
return ("");
};
return (_gamerSafe.unregisteredName);
}
public function get onUnregisteredName():Function{
return (_evt_onUnregisteredName);
}
public function get achievementPopupPosition():Point{
if (_loaded == false){
return (new Point(0, 0));
};
return (_gamerSafe.achievementPopupPosition);
}
public function set onBeginSessionFailed(_arg1:Function):void{
_evt_beginSessionFailed = _arg1;
}
public function levelVaultRateLevel(_arg1, _arg2:uint):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultRateLevel(_arg1, _arg2));
}
public function levelVaultGetLevelID(_arg1:Object=null):uint{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", null));
};
return (_gamerSafe.levelVaultGetLevelID(_arg1));
}
public function get savedGame():String{
if (_loaded == false){
return ("");
};
if (_gamerSafe.savedGame == null){
return ("");
};
return (_gamerSafe.savedGame);
}
public function set onLevelVaultLevelRated(_arg1:Function):void{
_evt_onLevelVaultLevelRated = _arg1;
}
public function get onLevelVaultLevelStringsSet():Function{
return (_evt_onLevelVaultLevelStringsSet);
}
public function levelVaultSetExpiringStringAttributes(_arg1, _arg2:Array, _arg3:Array, _arg4:Array):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultSetExpiringStringAttributes(_arg1, _arg2, _arg3, _arg4));
}
public function set onLevelVaultGotLevels(_arg1:Function):void{
_evt_onLevelVaultGotLevels = _arg1;
}
public function showMessageBox(_arg1:String, _arg2:String, _arg3:Boolean=true):void{
if (_loaded == false){
return;
};
_gamerSafe.messageBox(_arg1, _arg2, _arg3);
}
public function get onScoreboardError():Function{
return (_evt_onScoreboardError);
}
private function e_onUnregisteredName(_arg1:Event):void{
if (_evt_onUnregisteredName != null){
_evt_onUnregisteredName();
};
dispatchEvent(_arg1);
}
private function levelVaultCreateLevelFromObject(_arg1:Object):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultCreateLevelFromObject(_arg1));
}
public function get achievements():Array{
if (_loaded == false){
return ([]);
};
if (inSession == false){
return ([]);
};
return (_gamerSafe.achievementList);
}
public function get onBeginSession():Function{
return (_evt_beginSession);
}
public function get startingTime():Date{
if (_loaded == false){
return (null);
};
if (inSession == false){
return (null);
};
return (_gamerSafe.startingTime);
}
public function consumeItem(_arg1:int, _arg2:int):void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.consumeItem(_arg1, _arg2);
}
public function set onNetworkingError(_arg1:Function):void{
_evt_networkingError = _arg1;
}
public function get levelVaultReady():Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultReady);
}
public function levelVaultRegisterCallback(_arg1:Function, ... _args):void{
var _local4:*;
var _local3:Array = [];
_local3.push(_arg1);
for each (_local4 in _args) {
_local3.push(_local4);
};
(_gamerSafe.levelVaultRegisterCallback as Function).apply(this, _local3);
}
public function get signupUrl():String{
if (_loaded == false){
return ("");
};
return (_gamerSafe.signupUrl);
}
private function e_onLevelVaultLevelAttributesChanged(_arg1:Event):void{
if (_evt_onLevelVaultLevelAttributesChanged != null){
_evt_onLevelVaultLevelAttributesChanged();
};
dispatchEvent(_arg1);
}
public function get onLevelVaultLevelFlagged():Function{
return (_evt_onLevelVaultLevelFlagged);
}
public function get levelVaultShareCookie():String{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", null));
};
return (_gamerSafe.levelVaultShareCookie);
}
public function get gamerGold():uint{
if (_loaded == false){
return (0);
};
return (_gamerSafe.gamerGold);
}
public function set onAccountChange(_arg1:Function):void{
_evt_accountChange = _arg1;
}
public function get onConfirmYes():Function{
return (_evt_confYes);
}
public function levelVaultFail(_arg1:String, _arg2=false){
trace("[ LevelVault Error:", _arg1, "]");
_levelVaultLastError = _arg1;
return (_arg2);
}
private function e_onLoginFailed(_arg1:Event):void{
if (_evt_loginFailed != null){
_evt_loginFailed();
};
dispatchEvent(_arg1);
}
public function set onLoginFailed(_arg1:Function):void{
_evt_loginFailed = _arg1;
}
public function levelVaultGetLevelAsObject(_arg1:Object=null):Object{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", null));
};
return (_gamerSafe.levelVaultGetLevelAsObject(_arg1));
}
public function get onLevelVaultGotLevels():Function{
return (_evt_onLevelVaultGotLevels);
}
public function levelVaultCreateLevelWithAttributes(_arg1, _arg2:Object):Boolean{
if (levelVaultCreateLevel(_arg1)){
_levelVaultTempAttributes = _arg2;
addEventListener(GamerSafe.EVT_LEVELVAULT_LEVEL_CREATED, levelVaultSetTempAttributes);
return (true);
};
return (levelVaultFail(_levelVaultLastError));
}
public function set onLevelVaultLevelCreated(_arg1:Function):void{
_evt_onLevelVaultLevelCreated = _arg1;
}
public function levelVaultGetLevelsByDateModified(_arg1:String, _arg2:String, _arg3:Boolean=true, _arg4:uint=20, _arg5:uint=0):int{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", 0));
};
return (_gamerSafe.levelVaultGetLevelsByDateModified(_arg1, _arg2, _arg3, _arg4, _arg5));
}
public function set onItemPurchase(_arg1:Function):void{
_evt_itemPurchase = _arg1;
}
public function set onApiReady(_arg1:Function):void{
_evt_apiReady = _arg1;
}
public function login(_arg1:String, _arg2:String, _arg3:Boolean=false):void{
if (_loaded == false){
return;
};
_gamerSafe.login(_arg1, _arg2, _arg3);
}
private function e_onLevelVaultGotLevel(_arg1:Event):void{
if (_evt_onLevelVaultGotLevel != null){
_evt_onLevelVaultGotLevel();
};
dispatchEvent(_arg1);
}
public function get onConsumptionCompleted():Function{
return (_evt_onConsumptionCompleted);
}
public function set onLevelVaultLevelNumericsIncremented(_arg1:Function):void{
_evt_onLevelVaultLevelNumericsIncremented = _arg1;
}
public function set onRegistrationFormClosed(_arg1:Function):void{
_evt_onRegistrationFormClosed = _arg1;
}
public function levelVaultGetLevelAttributes(_arg1:Object=null):Array{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", []));
};
return (_gamerSafe.levelVaultGetLevelAttributes(_arg1));
}
public function levelVaultSetExpiringNumericAttributes(_arg1, _arg2:Array, _arg3:Array, _arg4:Array):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultSetExpiringNumericAttributes(_arg1, _arg2, _arg3, _arg4));
}
private function e_onLevelVaultLevelNumericsSet(_arg1:Event):void{
if (_evt_onLevelVaultLevelNumericsSet != null){
_evt_onLevelVaultLevelNumericsSet();
};
dispatchEvent(_arg1);
}
public function get levelVaultLastCreatedLevelID():uint{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", 0));
};
return (_gamerSafe.levelVaultGetLastCreatedLevelID());
}
public function get wantsNewsletter():Boolean{
if (_loaded == false){
return (false);
};
return (_gamerSafe.wantsNewsletter);
}
public function tryAutoLogin():void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.tryAutoLogin();
}
public function get onConfirmNo():Function{
return (_evt_confNo);
}
public function set onLoginFormClosed(_arg1:Function):void{
_evt_onLoginFormClosed = _arg1;
}
public function levelVaultGetLevelAsCustomObject(_arg1:Class, _arg2:Object=null){
if (_loaded == false){
return (levelVaultFail("API not yet loaded", null));
};
return (_gamerSafe.levelVaultGetLevelAsCustomObject(_arg1, _arg2));
}
public function get paymentUrl():String{
if (_loaded == false){
return ("");
};
return (_gamerSafe.paymentUrl);
}
public function logout():void{
if (_loaded == false){
return;
};
_gamerSafe.logout();
}
private function e_onLevelVaultLevelDeleted(_arg1:Event):void{
if (_evt_onLevelVaultLevelDeleted != null){
_evt_onLevelVaultLevelDeleted();
};
dispatchEvent(_arg1);
}
public function requestScoreboardEntries(_arg1:int=-1):void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.requestScoreboardEntries(_arg1);
}
public function set partner(_arg1:String):void{
if (_loaded == false){
return;
};
_gamerSafe.setPartner(_arg1);
}
public function set onLevelVaultGotLevel(_arg1:Function):void{
_evt_onLevelVaultGotLevel = _arg1;
}
public function enable():void{
if (_status == "Disabled"){
_status = "Ready";
_loaded = true;
};
}
public function showShop(_arg1:Object=null):void{
if (_loaded == false){
return;
};
_gamerSafe.showShop(_arg1);
}
public function set onLogin(_arg1:Function):void{
_evt_login = _arg1;
}
public function get latestScoreboardEntries():Object{
if (_loaded == false){
return (null);
};
return (_gamerSafe.getLatestScoreboardEntries());
}
public function set onLevelVaultLevelNumericsSet(_arg1:Function):void{
_evt_onLevelVaultLevelNumericsSet = _arg1;
}
private function e_onScoreboardError(_arg1:Event):void{
if (_evt_onScoreboardError != null){
_evt_onScoreboardError();
};
dispatchEvent(_arg1);
}
public function get onNetworkingError():Function{
return (_evt_networkingError);
}
public function hideStatusBar():void{
if (_loaded == false){
return;
};
_gamerSafe.hideStatusBar();
}
public function set onItemPurchaseFailed(_arg1:Function):void{
_evt_itemPurchaseFailed = _arg1;
}
public function get levelVaultLastError():String{
return (_levelVaultLastError);
}
public function get onLoginFailed():Function{
return (_evt_loginFailed);
}
public function levelVaultGetLastSelectedLevels():Array{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", []));
};
return (_gamerSafe.levelVaultGetLastSelectedLevels());
}
public function get latestItemPurchaseInfo():Object{
if (_loaded == false){
return (null);
};
return (_gamerSafe.getLatestItemPurchaseInfo());
}
private function onLoadingError(_arg1:IOErrorEvent):void{
_loaded = false;
_status = "Failed";
trace("Failed to load GamerSafe");
}
public function closeScoreboard():void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.closeScoreboard();
}
private function beginSession(_arg1:String, _arg2:String):Boolean{
if (_loaded == false){
return (false);
};
_gamerSafe.beginSession(_arg1, _arg2, _referrer);
return (true);
}
private function e_onLevelVaultLevelRated(_arg1:Event):void{
if (_evt_onLevelVaultLevelStringsSet != null){
_evt_onLevelVaultLevelStringsSet();
};
dispatchEvent(_arg1);
}
public function showPopup(_arg1:String, _arg2:Object=null):void{
if (_loaded == false){
return;
};
_gamerSafe.showPopup(_arg1, _arg2);
}
public function levelVaultGetLevelsByStringData(_arg1:String, _arg2:String, _arg3:Boolean=true, _arg4:uint=20, _arg5:uint=0):int{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", 0));
};
return (_gamerSafe.levelVaultGetLevelsByStringData(_arg1, _arg2, _arg3, _arg4, _arg5));
}
public function get inSession():Boolean{
if (_loaded == false){
return (false);
};
return (_gamerSafe.inSession);
}
public function get latestMetaDataResult():Array{
if (_loaded == false){
return ([]);
};
return (_gamerSafe.metaData);
}
public function purchaseItem(_arg1:int, _arg2:int=0):Boolean{
if (_loaded == false){
return (false);
};
return (_gamerSafe.purchaseItem(_arg1, _arg2));
}
public function requestUnregisteredName():void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.requestUnregisteredUserName();
}
public function get onRegistrationFormClosed():Function{
return (_evt_onRegistrationFormClosed);
}
public function get gamerXP():uint{
if (_loaded == false){
return (0);
};
return (_gamerSafe.gamerXP);
}
public function levelVaultGetLevelRating(_arg1:Object=null):Number{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", 0));
};
return (_gamerSafe.levelVaultGetLevelRating(_arg1));
}
public function get onLoginFormClosed():Function{
return (_evt_onLoginFormClosed);
}
public function getConsumptionsAvailable(_arg1:int):int{
if (_loaded == false){
return (0);
};
if (inSession == false){
return (0);
};
return (_gamerSafe.getConsumptionsAvailable(_arg1));
}
private function e_onLevelVaultLevelFlagged(_arg1:Event):void{
if (_evt_onLevelVaultLevelFlagged != null){
_evt_onLevelVaultLevelFlagged();
};
dispatchEvent(_arg1);
}
public function get items():Array{
if (_loaded == false){
return ([]);
};
if (inSession == false){
return ([]);
};
return (_gamerSafe.itemList);
}
public function get gamerPoints():uint{
if (_loaded == false){
return (0);
};
return (_gamerSafe.gamerPoints);
}
public function set onLevelVaultLevelDeleted(_arg1:Function):void{
_evt_onLevelVaultLevelDeleted = _arg1;
}
public function setRegistrationDefaults(_arg1:Object):void{
if (_loaded == false){
return;
};
_gamerSafe.setRegisterDefaults(_arg1);
}
public function levelVaultGetLevelsByNumericData(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=true, _arg5:uint=20, _arg6:uint=0):int{
if (_loaded == false){
return (levelVaultFail("API not yet loaded", 0));
};
return (_gamerSafe.levelVaultGetLevelsByNumericData(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6));
}
public function levelVaultIncrementNumeric(_arg1, _arg2:String):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
return (_gamerSafe.levelVaultIncrementNumeric(_arg1, _arg2));
}
private function e_onItemPurchase(_arg1:Event):void{
if (_evt_itemPurchase != null){
_evt_itemPurchase();
};
dispatchEvent(_arg1);
}
public function get latestOtherGameProfile():Object{
if (_loaded == false){
return (null);
};
return (_gamerSafe.getLatestOtherGameProfile());
}
public function setMetaData(_arg1:int, _arg2:Number):void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
if (!loggedIn){
return;
};
_gamerSafe.setMetaData(_arg1, _arg2);
}
private function e_onUseStarted(_arg1):void{
if (_inUse == true){
return;
};
_inUse = true;
if (_evt_useChanged != null){
_evt_useChanged();
};
if (_evt_useStarted != null){
_evt_useStarted();
};
dispatchEvent(new Event("inUseStarted"));
dispatchEvent(new Event("inUseChanged"));
}
public function set onLevelVaultLevelAttributesChanged(_arg1:Function):void{
_evt_onLevelVaultLevelAttributesChanged = _arg1;
}
public function get onLevelVaultGotLevel():Function{
return (_evt_onLevelVaultGotLevel);
}
private function levelVaultSetTempAttributes(_arg1:Event):void{
removeEventListener(GamerSafe.EVT_LEVELVAULT_LEVEL_CREATED, levelVaultSetTempAttributes);
levelVaultSetAttributes(levelVaultLastCreatedLevelID, _levelVaultTempAttributes);
_levelVaultTempAttributes = {};
}
public function purchaseItemInterface(_arg1:int, _arg2:int=0):void{
if (_loaded == false){
return;
};
if (inSession == false){
return;
};
_gamerSafe.purchaseItemInterface(_arg1, _arg2);
}
public function get onLevelVaultLevelNumericsSet():Function{
return (_evt_onLevelVaultLevelNumericsSet);
}
public function get status():String{
return (_status);
}
public function get isGamerGoldPurchaseDisabled():Boolean{
if (_loaded == false){
return (true);
};
return (_gamerSafe.isGamerGoldPurchasingDisabled);
}
public function set autoLogin(_arg1:Boolean):void{
if (_loaded == false){
return;
};
_gamerSafe.autoLogin = _arg1;
}
private function e_onScoreboardRecieved(_arg1:Event):void{
if (_evt_onScoreboardRecieved != null){
_evt_onScoreboardRecieved();
};
dispatchEvent(_arg1);
}
public function get onLevelVaultLevelCreated():Function{
return (_evt_onLevelVaultLevelCreated);
}
public function set onScoreboardError(_arg1:Function):void{
_evt_onScoreboardError = _arg1;
}
public function levelVaultCreateLevel(_arg1):Boolean{
if (_loaded == false){
return (levelVaultFail("API not yet loaded"));
};
if (loggedIn == false){
return (levelVaultFail("You must be logged in to create levels"));
};
if ((_arg1 is ByteArray)){
return (levelVaultCreateLevelFromBytes(_arg1));
};
return (levelVaultCreateLevelFromObject(_arg1));
}
public function setShopCategoryVisible(_arg1:int, _arg2:Boolean):void{
if (_loaded == false){
return;
};
_gamerSafe.setShopCategoryVisible(_arg1, _arg2);
}
public static function get api():GamerSafe{
if (_instance == null){
trace("GamerSafe: Instance Error: Attempted to get instance before initial construction.");
return (null);
};
return (_instance);
}
public static function get apiLoaded():Boolean{
return (!((_instance == null)));
}
}
}//package
Section 180
//GameShareThumbnailMC (GameShareThumbnailMC)
package {
import flash.display.*;
public dynamic class GameShareThumbnailMC extends MovieClip {
}
}//package
Section 181
//Ground (Ground)
package {
import flash.display.*;
public dynamic class Ground extends MovieClip {
}
}//package
Section 182
//HitSound (HitSound)
package {
import flash.media.*;
public dynamic class HitSound extends Sound {
}
}//package
Section 183
//IconUI (IconUI)
package {
import flash.display.*;
public dynamic class IconUI extends MovieClip {
}
}//package
Section 184
//LeftConveyorBeltObject (LeftConveyorBeltObject)
package {
import flash.display.*;
public dynamic class LeftConveyorBeltObject extends MovieClip {
}
}//package
Section 185
//MagnetObject (MagnetObject)
package {
import flash.display.*;
public dynamic class MagnetObject extends MovieClip {
}
}//package
Section 186
//MainBallObject (MainBallObject)
package {
import flash.display.*;
public dynamic class MainBallObject extends MovieClip {
}
}//package
Section 187
//MainClass (MainClass)
package {
import flash.display.*;
import flash.events.*;
import com.chocorobokun.domino.world.*;
import SWFStats.*;
import com.chocorobokun.domino.preloader.*;
public class MainClass extends MovieClip {
public var loadingStarted:Boolean;
public var percentLoaded:int;
public var preloaderBikinGames:PreloaderBikinGames;
public var state:int;// = 0
public var siteStarted:Boolean;
public var mainStage:MainStage;
public static const STATE_SYSTEM_LOADING:int = 0;
public static const STATE_SYSTEM_LOADED:int = 1;
public function MainClass(){
addFrameScript(0, frame1, 2, frame3);
Log.View(1116, "6fe8d409a205", root.loaderInfo.loaderURL);
addEventListener(Event.ENTER_FRAME, mainLoop);
}
public function mainLoop(_arg1:Event){
switch (state){
case STATE_SYSTEM_LOADING:
onLoading();
break;
case STATE_SYSTEM_LOADED:
loaded();
break;
};
}
function frame3(){
stop();
}
public function loaded(){
if (((!(siteStarted)) && ((currentFrame == 3)))){
mainStage = new MainStage();
addChild(mainStage);
siteStarted = true;
};
}
function frame1(){
stop();
}
public function onLoading(){
trace(((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100));
if (!loadingStarted){
if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal){
finishPreload();
} else {
loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadingProgress);
loaderInfo.addEventListener(Event.COMPLETE, onLoadingComplete);
preloaderBikinGames = new PreloaderBikinGames();
addChild(preloaderBikinGames);
loadingStarted = true;
};
};
}
public function onLoadingComplete(_arg1:Event){
this.loaderInfo.removeEventListener(Event.INIT, onLoadingComplete);
this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onLoadingProgress);
finishPreload();
}
public function onLoadingProgress(_arg1:Event){
percentLoaded = ((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100);
preloaderBikinGames.update(percentLoaded);
}
public function finishPreload(){
this.play();
state = STATE_SYSTEM_LOADED;
}
}
}//package
Section 188
//Marker (Marker)
package {
import flash.display.*;
public dynamic class Marker extends MovieClip {
public var mover:SimpleButton;
public var markBut:MovieClip;
public var removeBut:SimpleButton;
public var rotator:SimpleButton;
}
}//package
Section 189
//MovableBlockObject (MovableBlockObject)
package {
import flash.display.*;
public dynamic class MovableBlockObject extends MovieClip {
}
}//package
Section 190
//Mover (Mover)
package {
import flash.display.*;
public dynamic class Mover extends MovieClip {
}
}//package
Section 191
//MusicSound (MusicSound)
package {
import flash.media.*;
public dynamic class MusicSound extends Sound {
}
}//package
Section 192
//Pelang (Pelang)
package {
import flash.display.*;
public dynamic class Pelang extends MovieClip {
}
}//package
Section 193
//PistonObject (PistonObject)
package {
import flash.display.*;
public dynamic class PistonObject extends MovieClip {
}
}//package
Section 194
//Rotator (Rotator)
package {
import flash.display.*;
public dynamic class Rotator extends MovieClip {
}
}//package
Section 195
//ScrewObject (ScrewObject)
package {
import flash.display.*;
public dynamic class ScrewObject extends MovieClip {
}
}//package
Section 196
//Seesaw (Seesaw)
package {
import flash.display.*;
public dynamic class Seesaw extends MovieClip {
}
}//package
Section 197
//SeesawObject (SeesawObject)
package {
import flash.display.*;
public dynamic class SeesawObject extends MovieClip {
}
}//package
Section 198
//Slot (Slot)
package {
import flash.display.*;
public dynamic class Slot extends MovieClip {
}
}//package
Section 199
//SmallBallObject (SmallBallObject)
package {
import flash.display.*;
public dynamic class SmallBallObject extends MovieClip {
}
}//package
Section 200
//SmallBoxObject (SmallBoxObject)
package {
import flash.display.*;
public dynamic class SmallBoxObject extends MovieClip {
}
}//package
Section 201
//SmallCircleObject (SmallCircleObject)
package {
import flash.display.*;
public dynamic class SmallCircleObject extends MovieClip {
}
}//package
Section 202
//SmallConcaveObject (SmallConcaveObject)
package {
import flash.display.*;
public dynamic class SmallConcaveObject extends MovieClip {
}
}//package
Section 203
//SmallGearObject (SmallGearObject)
package {
import flash.display.*;
public dynamic class SmallGearObject extends MovieClip {
}
}//package
Section 204
//ThumbnailItem (ThumbnailItem)
package {
import flash.display.*;
public dynamic class ThumbnailItem extends MovieClip {
}
}//package