Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2CircleDef extends b2ShapeDef {
public var localPosition:b2Vec2;
public var radius:Number;
public function b2CircleDef(){
localPosition = new b2Vec2(0, 0);
super();
type = b2Shape.e_circleShape;
radius = 1;
}
}
}//package Box2D.Collision.Shapes
Section 2
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Collision.*;
public class b2CircleShape extends b2Shape {
public var m_radius:Number;
public var m_localPosition:b2Vec2;
public function b2CircleShape(_arg1:b2ShapeDef){
var _local2:b2CircleDef;
m_localPosition = new b2Vec2();
super(_arg1);
_local2 = (_arg1 as b2CircleDef);
m_type = e_circleShape;
m_localPosition.SetV(_local2.localPosition);
m_radius = _local2.radius;
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
_local3 = _arg1.R;
_local4 = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
_local5 = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_local4 = (_arg2.x - _local4);
_local5 = (_arg2.y - _local5);
return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius)));
}
public function GetLocalPosition():b2Vec2{
return (m_localPosition);
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local6 = _arg1.R;
_local7 = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y)));
_local8 = (_arg1.position.x + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y)));
_local9 = (_arg4.p1.x - _local7);
_local10 = (_arg4.p1.y - _local8);
_local11 = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius));
if (_local11 < 0){
return (false);
};
_local12 = (_arg4.p2.x - _arg4.p1.x);
_local13 = (_arg4.p2.y - _arg4.p1.y);
_local14 = ((_local9 * _local12) + (_local10 * _local13));
_local15 = ((_local12 * _local12) + (_local13 * _local13));
_local16 = ((_local14 * _local14) - (_local15 * _local11));
if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){
return (false);
};
_local17 = -((_local14 + Math.sqrt(_local16)));
if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){
_local17 = (_local17 / _local15);
_arg2[0] = _local17;
_arg3.x = (_local9 + (_local17 * _local12));
_arg3.y = (_local10 + (_local17 * _local13));
_arg3.Normalize();
return (true);
};
return (false);
}
override public function ComputeMass(_arg1:b2MassData):void{
_arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius);
_arg1.center.SetV(m_localPosition);
_arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y))));
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = _arg2.R;
_local5 = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
_local6 = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_local4 = _arg3.R;
_local7 = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
_local8 = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius));
_arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius));
}
public function GetRadius():Number{
return (m_radius);
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:Number;
var _local3:Number;
_local2 = (m_localPosition.x - _arg1.x);
_local3 = (m_localPosition.y - _arg1.y);
_local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.R;
_local4 = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
_local5 = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius));
_arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius));
}
}
}//package Box2D.Collision.Shapes
Section 3
//b2FilterData (Box2D.Collision.Shapes.b2FilterData)
package Box2D.Collision.Shapes {
public class b2FilterData {
public var maskBits:uint;// = 0xFFFF
public var groupIndex:int;// = 0
public var categoryBits:uint;// = 1
public function b2FilterData(){
categoryBits = 1;
maskBits = 0xFFFF;
groupIndex = 0;
super();
}
public function Copy():b2FilterData{
var _local1:b2FilterData;
_local1 = new b2FilterData();
_local1.categoryBits = categoryBits;
_local1.maskBits = maskBits;
_local1.groupIndex = groupIndex;
return (_local1);
}
}
}//package Box2D.Collision.Shapes
Section 4
//b2MassData (Box2D.Collision.Shapes.b2MassData)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2MassData {
public var mass:Number;// = 0
public var center:b2Vec2;
public var I:Number;// = 0
public function b2MassData(){
mass = 0;
center = new b2Vec2(0, 0);
I = 0;
super();
}
}
}//package Box2D.Collision.Shapes
Section 5
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PolygonDef extends b2ShapeDef {
public var vertexCount:int;
public var vertices:Array;
private static var s_mat:b2Mat22 = new b2Mat22();
public function b2PolygonDef(){
var _local1:int;
vertices = new Array(b2Settings.b2_maxPolygonVertices);
super();
type = b2Shape.e_polygonShape;
vertexCount = 0;
_local1 = 0;
while (_local1 < b2Settings.b2_maxPolygonVertices) {
vertices[_local1] = new b2Vec2();
_local1++;
};
}
public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{
var _local5:b2Vec2;
var _local6:b2Mat22;
var _local7:int;
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
if (_arg3){
_local5 = _arg3;
_local6 = s_mat;
_local6.Set(_arg4);
_local7 = 0;
while (_local7 < vertexCount) {
_arg3 = vertices[_local7];
_arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y)));
_arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y)));
_arg3.x = _arg1;
_local7++;
};
};
}
public function SetAsBox(_arg1:Number, _arg2:Number):void{
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
}
}
}//package Box2D.Collision.Shapes
Section 6
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
import Box2D.Collision.*;
public class b2PolygonShape extends b2Shape {
public var m_vertices:Array;
public var m_normals:Array;
private var s_supportVec:b2Vec2;
public var m_obb:b2OBB;
public var m_coreVertices:Array;
public var m_centroid:b2Vec2;
public var m_vertexCount:int;
private static var s_computeMat:b2Mat22 = new b2Mat22();
private static var s_sweptAABB1:b2AABB = new b2AABB();
private static var s_sweptAABB2:b2AABB = new b2AABB();
public function b2PolygonShape(_arg1:b2ShapeDef){
var _local2:b2PolygonDef;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
s_supportVec = new b2Vec2();
m_obb = new b2OBB();
m_vertices = new Array(b2Settings.b2_maxPolygonVertices);
m_normals = new Array(b2Settings.b2_maxPolygonVertices);
m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices);
super(_arg1);
m_type = e_polygonShape;
_local2 = (_arg1 as b2PolygonDef);
m_vertexCount = _local2.vertexCount;
_local4 = _local3;
_local5 = _local3;
_local3 = 0;
while (_local3 < m_vertexCount) {
m_vertices[_local3] = _local2.vertices[_local3].Copy();
_local3++;
};
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = _local3;
_local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0;
_local6 = (m_vertices[_local5].x - m_vertices[_local4].x);
_local7 = (m_vertices[_local5].y - m_vertices[_local4].y);
_local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8));
_local3++;
};
m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount);
ComputeOBB(m_obb, m_vertices, m_vertexCount);
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1);
_local5 = _local3;
_local9 = m_normals[_local4].x;
_local10 = m_normals[_local4].y;
_local11 = m_normals[_local5].x;
_local12 = m_normals[_local5].y;
_local13 = (m_vertices[_local3].x - m_centroid.x);
_local14 = (m_vertices[_local3].y - m_centroid.y);
_local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop);
_local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop);
_local17 = (1 / ((_local9 * _local12) - (_local10 * _local11)));
m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y));
_local3++;
};
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
var _local10:Number;
_local4 = _arg1.R;
_local5 = (_arg2.x - _arg1.position.x);
_local6 = (_arg2.y - _arg1.position.y);
_local7 = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y));
_local8 = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y));
_local9 = 0;
while (_local9 < m_vertexCount) {
_local3 = m_vertices[_local9];
_local5 = (_local7 - _local3.x);
_local6 = (_local8 - _local3.y);
_local3 = m_normals[_local9];
_local10 = ((_local3.x * _local5) + (_local3.y * _local6));
if (_local10 > 0){
return (false);
};
_local9++;
};
return (true);
}
public function GetCoreVertices():Array{
return (m_coreVertices);
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:Number;
var _local21:Number;
_local6 = 0;
_local7 = _arg5;
_local8 = (_arg4.p1.x - _arg1.position.x);
_local9 = (_arg4.p1.y - _arg1.position.y);
_local10 = _arg1.R;
_local12 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local13 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local8 = (_arg4.p2.x - _arg1.position.x);
_local9 = (_arg4.p2.y - _arg1.position.y);
_local10 = _arg1.R;
_local14 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local15 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local16 = (_local14 - _local12);
_local17 = (_local15 - _local13);
_local18 = -1;
_local19 = 0;
while (_local19 < m_vertexCount) {
_local11 = m_vertices[_local19];
_local8 = (_local11.x - _local12);
_local9 = (_local11.y - _local13);
_local11 = m_normals[_local19];
_local20 = ((_local11.x * _local8) + (_local11.y * _local9));
_local21 = ((_local11.x * _local16) + (_local11.y * _local17));
if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){
_local6 = (_local20 / _local21);
_local18 = _local19;
} else {
if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){
_local7 = (_local20 / _local21);
};
};
if (_local7 < _local6){
return (false);
};
_local19++;
};
if (_local18 >= 0){
_arg2[0] = _local6;
_local10 = _arg1.R;
_local11 = m_normals[_local18];
_arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
return (true);
};
return (false);
}
public function GetCentroid():b2Vec2{
return (m_centroid);
}
override public function ComputeMass(_arg1:b2MassData):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = (1 / 3);
_local9 = 0;
while (_local9 < m_vertexCount) {
_local10 = m_vertices[_local9];
_local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0];
_local12 = (_local10.x - _local6);
_local13 = (_local10.y - _local7);
_local14 = (_local11.x - _local6);
_local15 = (_local11.y - _local7);
_local16 = ((_local12 * _local15) - (_local13 * _local14));
_local17 = (0.5 * _local16);
_local4 = (_local4 + _local17);
_local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x)));
_local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y)));
_local18 = _local6;
_local19 = _local7;
_local20 = _local12;
_local21 = _local13;
_local22 = _local14;
_local23 = _local15;
_local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18));
_local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19));
_local5 = (_local5 + (_local16 * (_local24 + _local25)));
_local9++;
};
_arg1.mass = (m_density * _local4);
_local2 = (_local2 * (1 / _local4));
_local3 = (_local3 * (1 / _local4));
_arg1.center.Set(_local2, _local3);
_arg1.I = (m_density * _local5);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:int;
var _local11:Number;
_local5 = _arg1.R;
_local6 = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y));
_local7 = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y));
_local8 = 0;
_local4 = m_coreVertices[0];
_local9 = ((_local4.x * _local6) + (_local4.y * _local7));
_local10 = 1;
while (_local10 < m_vertexCount) {
_local4 = m_coreVertices[_local10];
_local11 = ((_local4.x * _local6) + (_local4.y * _local7));
if (_local11 > _local9){
_local8 = _local10;
_local9 = _local11;
};
_local10++;
};
_local5 = _arg1.R;
_local4 = m_coreVertices[_local8];
s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y)));
s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y)));
return (s_supportVec);
}
public function GetVertexCount():int{
return (m_vertexCount);
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2AABB;
var _local5:b2AABB;
_local4 = s_sweptAABB1;
_local5 = s_sweptAABB2;
ComputeAABB(_local4, _arg2);
ComputeAABB(_local5, _arg3);
_arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y);
_arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y);
}
public function GetVertices():Array{
return (m_vertices);
}
public function GetNormals():Array{
return (m_normals);
}
public function GetOBB():b2OBB{
return (m_obb);
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_coreVertices[0]));
}
public function Centroid(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_centroid));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:b2Vec2;
var _local3:int;
var _local4:Number;
var _local5:Number;
m_sweepRadius = 0;
_local3 = 0;
while (_local3 < m_vertexCount) {
_local2 = m_coreVertices[_local3];
_local4 = (_local2.x - _arg1.x);
_local5 = (_local2.y - _arg1.y);
_local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
if (_local4 > m_sweepRadius){
m_sweepRadius = _local4;
};
_local3++;
};
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local5 = s_computeMat;
_local3 = _arg2.R;
_local4 = m_obb.R.col1;
_local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local4 = m_obb.R.col2;
_local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local5.Abs();
_local6 = _local5;
_local4 = m_obb.extents;
_local7 = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y));
_local8 = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y));
_local3 = _arg2.R;
_local4 = m_obb.center;
_local9 = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)));
_local10 = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)));
_arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8));
_arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8));
}
public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local3 = new b2Vec2();
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = (1 / 3);
_local8 = 0;
while (_local8 < _arg2) {
_local9 = _arg1[_local8];
_local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0];
_local11 = (_local9.x - _local5);
_local12 = (_local9.y - _local6);
_local13 = (_local10.x - _local5);
_local14 = (_local10.y - _local6);
_local15 = ((_local11 * _local14) - (_local12 * _local13));
_local16 = (0.5 * _local15);
_local4 = (_local4 + _local16);
_local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x)));
_local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y)));
_local8++;
};
_local3.x = (_local3.x * (1 / _local4));
_local3.y = (_local3.y * (1 / _local4));
return (_local3);
}
public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{
var _local4:int;
var _local5:Array;
var _local6:Number;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:b2Mat22;
_local5 = new Array((b2Settings.b2_maxPolygonVertices + 1));
_local4 = 0;
while (_local4 < _arg3) {
_local5[_local4] = _arg2[_local4];
_local4++;
};
_local5[_arg3] = _local5[0];
_local6 = Number.MAX_VALUE;
_local4 = 1;
while (_local4 <= _arg3) {
_local7 = _local5[int((_local4 - 1))];
_local8 = (_local5[_local4].x - _local7.x);
_local9 = (_local5[_local4].y - _local7.y);
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local8 = (_local8 / _local10);
_local9 = (_local9 / _local10);
_local11 = -(_local9);
_local12 = _local8;
_local13 = Number.MAX_VALUE;
_local14 = Number.MAX_VALUE;
_local15 = -(Number.MAX_VALUE);
_local16 = -(Number.MAX_VALUE);
_local17 = 0;
while (_local17 < _arg3) {
_local19 = (_local5[_local17].x - _local7.x);
_local20 = (_local5[_local17].y - _local7.y);
_local21 = ((_local8 * _local19) + (_local9 * _local20));
_local22 = ((_local11 * _local19) + (_local12 * _local20));
if (_local21 < _local13){
_local13 = _local21;
};
if (_local22 < _local14){
_local14 = _local22;
};
if (_local21 > _local15){
_local15 = _local21;
};
if (_local22 > _local16){
_local16 = _local22;
};
_local17++;
};
_local18 = ((_local15 - _local13) * (_local16 - _local14));
if (_local18 < (0.95 * _local6)){
_local6 = _local18;
_arg1.R.col1.x = _local8;
_arg1.R.col1.y = _local9;
_arg1.R.col2.x = _local11;
_arg1.R.col2.y = _local12;
_local23 = (0.5 * (_local13 + _local15));
_local24 = (0.5 * (_local14 + _local16));
_local25 = _arg1.R;
_arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24)));
_arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24)));
_arg1.extents.x = (0.5 * (_local15 - _local13));
_arg1.extents.y = (0.5 * (_local16 - _local14));
};
_local4++;
};
}
}
}//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class b2Shape {
public var m_type:int;
public var m_sweepRadius:Number;
public var m_density:Number;
public var m_filter:b2FilterData;
public var m_friction:Number;
public var m_next:b2Shape;
public var m_restitution:Number;
public var m_userData;
public var m_isSensor:Boolean;
public var m_proxyId:uint;
public var m_body:b2Body;
public static const e_polygonShape:int = 1;
public static const e_unknownShape:int = -1;
public static const e_circleShape:int = 0;
public static const e_shapeTypeCount:int = 2;
private static var s_resetAABB:b2AABB = new b2AABB();
private static var s_syncAABB:b2AABB = new b2AABB();
private static var s_proxyAABB:b2AABB = new b2AABB();
public function b2Shape(_arg1:b2ShapeDef){
m_userData = _arg1.userData;
m_friction = _arg1.friction;
m_restitution = _arg1.restitution;
m_density = _arg1.density;
m_body = null;
m_sweepRadius = 0;
m_next = null;
m_proxyId = b2Pair.b2_nullProxy;
m_filter = _arg1.filter.Copy();
m_isSensor = _arg1.isSensor;
}
public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
return (false);
}
public function GetSweepRadius():Number{
return (m_sweepRadius);
}
public function GetNext():b2Shape{
return (m_next);
}
public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
}
public function GetType():int{
return (m_type);
}
public function GetRestitution():Number{
return (m_restitution);
}
public function GetFriction():Number{
return (m_friction);
}
public function GetFilterData():b2FilterData{
return (m_filter.Copy());
}
public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
return (false);
}
public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB;
var _local4:Boolean;
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
_arg1.DestroyProxy(m_proxyId);
_local3 = s_resetAABB;
ComputeAABB(_local3, _arg2);
_local4 = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetFilterData(_arg1:b2FilterData):void{
m_filter = _arg1.Copy();
}
public function GetUserData(){
return (m_userData);
}
public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{
var _local4:b2AABB;
if (m_proxyId == b2Pair.b2_nullProxy){
return (false);
};
_local4 = s_syncAABB;
ComputeSweptAABB(_local4, _arg2, _arg3);
if (_arg1.InRange(_local4)){
_arg1.MoveProxy(m_proxyId, _local4);
return (true);
};
return (false);
}
public function ComputeMass(_arg1:b2MassData):void{
}
public function IsSensor():Boolean{
return (m_isSensor);
}
public function DestroyProxy(_arg1:b2BroadPhase):void{
if (m_proxyId != b2Pair.b2_nullProxy){
_arg1.DestroyProxy(m_proxyId);
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function UpdateSweepRadius(_arg1:b2Vec2):void{
}
public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
}
public function GetBody():b2Body{
return (m_body);
}
public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB;
var _local4:Boolean;
_local3 = s_proxyAABB;
ComputeAABB(_local3, _arg2);
_local4 = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public static function Destroy(_arg1:b2Shape, _arg2):void{
}
public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{
switch (_arg1.type){
case e_circleShape:
return (new b2CircleShape(_arg1));
case e_polygonShape:
return (new b2PolygonShape(_arg1));
default:
return (null);
};
}
}
}//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef)
package Box2D.Collision.Shapes {
public class b2ShapeDef {
public var isSensor:Boolean;// = false
public var density:Number;// = 0
public var type:int;
public var restitution:Number;// = 0
public var userData;// = null
public var filter:b2FilterData;
public var friction:Number;// = 0.2
public function b2ShapeDef(){
type = b2Shape.e_unknownShape;
userData = null;
friction = 0.2;
restitution = 0;
density = 0;
isSensor = false;
filter = new b2FilterData();
super();
}
}
}//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2AABB {
public var upperBound:b2Vec2;
public var lowerBound:b2Vec2;
public function b2AABB(){
lowerBound = new b2Vec2();
upperBound = new b2Vec2();
super();
}
public function IsValid():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:Boolean;
_local1 = (upperBound.x - lowerBound.x);
_local2 = (upperBound.y - lowerBound.y);
_local3 = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid()));
return (_local3);
}
}
}//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound)
package Box2D.Collision {
public class b2Bound {
public var proxyId:uint;
public var stabbingCount:uint;
public var value:uint;
public function Swap(_arg1:b2Bound):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
_local2 = value;
_local3 = proxyId;
_local4 = stabbingCount;
value = _arg1.value;
proxyId = _arg1.proxyId;
stabbingCount = _arg1.stabbingCount;
_arg1.value = _local2;
_arg1.proxyId = _local3;
_arg1.stabbingCount = _local4;
}
public function IsLower():Boolean{
return (((value & 1) == 0));
}
public function IsUpper():Boolean{
return (((value & 1) == 1));
}
}
}//package Box2D.Collision
Section 11
//b2BoundValues (Box2D.Collision.b2BoundValues)
package Box2D.Collision {
public class b2BoundValues {
public var lowerValues:Array;
public var upperValues:Array;
public function b2BoundValues(){
lowerValues = [0, 0];
upperValues = [0, 0];
super();
}
}
}//package Box2D.Collision
Section 12
//b2BroadPhase (Box2D.Collision.b2BroadPhase)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2BroadPhase {
public var m_quantizationFactor:b2Vec2;
public var m_worldAABB:b2AABB;
public var m_bounds:Array;
public var m_freeProxy:uint;
public var m_proxyCount:int;
public var m_proxyPool:Array;
public var m_queryResultCount:int;
public var m_pairManager:b2PairManager;
public var m_timeStamp:uint;
public var m_queryResults:Array;
public static const b2_nullEdge:uint = b2Settings.USHRT_MAX;
public static const b2_invalid:uint = b2Settings.USHRT_MAX;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:b2Proxy;
var _local7:int;
m_pairManager = new b2PairManager();
m_proxyPool = new Array(b2Settings.b2_maxPairs);
m_bounds = new Array((2 * b2Settings.b2_maxProxies));
m_queryResults = new Array(b2Settings.b2_maxProxies);
m_quantizationFactor = new b2Vec2();
super();
m_pairManager.Initialize(this, _arg2);
m_worldAABB = _arg1;
m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
m_queryResults[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
_local4 = (_arg1.upperBound.x - _arg1.lowerBound.x);
_local5 = (_arg1.upperBound.y - _arg1.lowerBound.y);
m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4);
m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5);
_local3 = 0;
while (_local3 < (b2Settings.b2_maxProxies - 1)) {
_local6 = new b2Proxy();
m_proxyPool[_local3] = _local6;
_local6.SetNext((_local3 + 1));
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
_local3++;
};
_local6 = new b2Proxy();
m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6;
_local6.SetNext(b2Pair.b2_nullProxy);
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
m_freeProxy = 0;
m_timeStamp = 1;
m_queryResultCount = 0;
}
public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{
var _local4:Array;
var _local5:Array;
var _local6:uint;
var _local7:uint;
var _local8:Array;
var _local9:Array;
var _local10:int;
var _local11:int;
var _local12:b2Proxy;
_local4 = new Array();
_local5 = new Array();
ComputeBounds(_local4, _local5, _arg1);
_local8 = [_local6];
_local9 = [_local7];
Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0);
Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1);
_local10 = 0;
_local11 = 0;
while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) {
_local12 = m_proxyPool[m_queryResults[_local11]];
_arg2[_local11] = _local12.userData;
_local11++;
_local10++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local10);
}
public function Commit():void{
m_pairManager.Commit();
}
public function GetProxy(_arg1:int):b2Proxy{
var _local2:b2Proxy;
_local2 = m_proxyPool[_arg1];
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){
return (null);
};
return (_local2);
}
private function IncrementTimeStamp():void{
var _local1:uint;
if (m_timeStamp == b2Settings.USHRT_MAX){
_local1 = 0;
while (_local1 < b2Settings.b2_maxProxies) {
(m_proxyPool[_local1] as b2Proxy).timeStamp = 0;
_local1++;
};
m_timeStamp = 1;
} else {
m_timeStamp++;
};
}
private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
var _local11:uint;
var _local12:int;
var _local13:int;
var _local14:b2Proxy;
_local8 = BinarySearch(_arg5, _arg6, _arg3);
_local9 = BinarySearch(_arg5, _arg6, _arg4);
_local11 = _local8;
while (_local11 < _local9) {
_local10 = _arg5[_local11];
if (_local10.IsLower()){
IncrementOverlapCount(_local10.proxyId);
};
_local11++;
};
if (_local8 > 0){
_local12 = (_local8 - 1);
_local10 = _arg5[_local12];
_local13 = _local10.stabbingCount;
while (_local13) {
_local10 = _arg5[_local12];
if (_local10.IsLower()){
_local14 = m_proxyPool[_local10.proxyId];
if (_local8 <= _local14.upperBounds[_arg7]){
IncrementOverlapCount(_local10.proxyId);
_local13--;
};
};
_local12--;
};
};
_arg1[0] = _local8;
_arg2[0] = _local9;
}
private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{
var _local3:int;
var _local4:Array;
var _local5:b2Bound;
var _local6:b2Bound;
_local3 = 0;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg1.lowerBounds[_local3]];
_local6 = _local4[_arg2.upperBounds[_local3]];
if (_local5.value > _local6.value){
return (false);
};
_local5 = _local4[_arg1.upperBounds[_local3]];
_local6 = _local4[_arg2.lowerBounds[_local3]];
if (_local5.value < _local6.value){
return (false);
};
_local3++;
};
return (true);
}
private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local4 = _arg3.lowerBound.x;
_local5 = _arg3.lowerBound.y;
_local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x);
_local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y);
_local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x);
_local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y);
_local6 = _arg3.upperBound.x;
_local7 = _arg3.upperBound.y;
_local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x);
_local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y);
_local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x);
_local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y);
_arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1));
_arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1);
_arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1));
_arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1);
}
public function CreateProxy(_arg1:b2AABB, _arg2):uint{
var _local3:uint;
var _local4:b2Proxy;
var _local5:uint;
var _local6:uint;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:int;
var _local11:Array;
var _local12:uint;
var _local13:uint;
var _local14:Array;
var _local15:Array;
var _local16:Array;
var _local17:int;
var _local18:int;
var _local19:b2Bound;
var _local20:b2Bound;
var _local21:b2Bound;
var _local22:int;
var _local23:b2Proxy;
_local5 = m_freeProxy;
_local4 = m_proxyPool[_local5];
m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
_local6 = (2 * m_proxyCount);
_local7 = new Array();
_local8 = new Array();
ComputeBounds(_local7, _local8, _arg1);
_local9 = 0;
while (_local9 < 2) {
_local11 = m_bounds[_local9];
_local14 = [_local12];
_local15 = [_local13];
Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9);
_local12 = _local14[0];
_local13 = _local15[0];
_local16 = new Array();
_local18 = (_local6 - _local13);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local13 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local13 + 2);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local16 = new Array();
_local18 = (_local13 - _local12);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local12 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local12 + 1);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local13++;
_local19 = _local11[_local12];
_local20 = _local11[_local13];
_local19.value = _local7[_local9];
_local19.proxyId = _local5;
_local20.value = _local8[_local9];
_local20.proxyId = _local5;
_local21 = _local11[int((_local12 - 1))];
_local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount;
_local21 = _local11[int((_local13 - 1))];
_local20.stabbingCount = _local21.stabbingCount;
_local3 = _local12;
while (_local3 < _local13) {
_local21 = _local11[_local3];
_local21.stabbingCount++;
_local3++;
};
_local3 = _local12;
while (_local3 < (_local6 + 2)) {
_local19 = _local11[_local3];
_local23 = m_proxyPool[_local19.proxyId];
if (_local19.IsLower()){
_local23.lowerBounds[_local9] = _local3;
} else {
_local23.upperBounds[_local9] = _local3;
};
_local3++;
};
_local9++;
};
m_proxyCount++;
_local10 = 0;
while (_local10 < m_queryResultCount) {
m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]);
_local10++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local5);
}
public function DestroyProxy(_arg1:uint):void{
var _local2:b2Bound;
var _local3:b2Bound;
var _local4:b2Proxy;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Array;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:Array;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:uint;
var _local18:int;
var _local19:b2Proxy;
_local4 = m_proxyPool[_arg1];
_local5 = (2 * m_proxyCount);
_local6 = 0;
while (_local6 < 2) {
_local8 = m_bounds[_local6];
_local9 = _local4.lowerBounds[_local6];
_local10 = _local4.upperBounds[_local6];
_local2 = _local8[_local9];
_local11 = _local2.value;
_local3 = _local8[_local10];
_local12 = _local3.value;
_local13 = new Array();
_local15 = ((_local10 - _local9) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local9 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = _local9;
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local13 = new Array();
_local15 = ((_local5 - _local10) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local10 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = (_local10 - 1);
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = (_local5 - 2);
_local17 = _local9;
while (_local17 < _local15) {
_local2 = _local8[_local17];
_local19 = m_proxyPool[_local2.proxyId];
if (_local2.IsLower()){
_local19.lowerBounds[_local6] = _local17;
} else {
_local19.upperBounds[_local6] = _local17;
};
_local17++;
};
_local15 = (_local10 - 1);
_local18 = _local9;
while (_local18 < _local15) {
_local2 = _local8[_local18];
_local2.stabbingCount--;
_local18++;
};
Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6);
_local6++;
};
_local7 = 0;
while (_local7 < m_queryResultCount) {
m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]);
_local7++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
_local4.userData = null;
_local4.overlapCount = b2_invalid;
_local4.lowerBounds[0] = b2_invalid;
_local4.lowerBounds[1] = b2_invalid;
_local4.upperBounds[0] = b2_invalid;
_local4.upperBounds[1] = b2_invalid;
_local4.SetNext(m_freeProxy);
m_freeProxy = _arg1;
m_proxyCount--;
}
public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{
var _local3:int;
var _local4:Array;
var _local5:b2Bound;
_local3 = 0;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg2.upperBounds[_local3]];
if (_arg1.lowerValues[_local3] > _local5.value){
return (false);
};
_local5 = _local4[_arg2.lowerBounds[_local3]];
if (_arg1.upperValues[_local3] < _local5.value){
return (false);
};
_local3++;
};
return (true);
}
public function Validate():void{
var _local1:b2Pair;
var _local2:b2Proxy;
var _local3:b2Proxy;
var _local4:Boolean;
var _local5:int;
var _local6:b2Bound;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
_local5 = 0;
while (_local5 < 2) {
_local6 = m_bounds[_local5];
_local7 = (2 * m_proxyCount);
_local8 = 0;
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local6[_local9];
if (_local10.IsLower() == true){
_local8++;
} else {
_local8--;
};
_local9++;
};
_local5++;
};
}
private function IncrementOverlapCount(_arg1:uint):void{
var _local2:b2Proxy;
_local2 = m_proxyPool[_arg1];
if (_local2.timeStamp < m_timeStamp){
_local2.timeStamp = m_timeStamp;
_local2.overlapCount = 1;
} else {
_local2.overlapCount = 2;
m_queryResults[m_queryResultCount] = _arg1;
m_queryResultCount++;
};
}
public function InRange(_arg1:b2AABB):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = _arg1.lowerBound.x;
_local3 = _arg1.lowerBound.y;
_local2 = (_local2 - m_worldAABB.upperBound.x);
_local3 = (_local3 - m_worldAABB.upperBound.y);
_local4 = m_worldAABB.lowerBound.x;
_local5 = m_worldAABB.lowerBound.y;
_local4 = (_local4 - _arg1.upperBound.x);
_local5 = (_local5 - _arg1.upperBound.y);
_local2 = b2Math.b2Max(_local2, _local4);
_local3 = b2Math.b2Max(_local3, _local5);
return ((b2Math.b2Max(_local2, _local3) < 0));
}
public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{
var _local3:Array;
var _local4:int;
var _local5:uint;
var _local6:uint;
var _local7:b2Bound;
var _local8:b2Bound;
var _local9:b2Bound;
var _local10:uint;
var _local11:b2Proxy;
var _local12:uint;
var _local13:b2Proxy;
var _local14:b2BoundValues;
var _local15:b2BoundValues;
var _local16:Array;
var _local17:uint;
var _local18:uint;
var _local19:uint;
var _local20:uint;
var _local21:int;
var _local22:int;
var _local23:uint;
var _local24:b2Proxy;
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){
return;
};
if (_arg2.IsValid() == false){
return;
};
_local12 = (2 * m_proxyCount);
_local13 = m_proxyPool[_arg1];
_local14 = new b2BoundValues();
ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2);
_local15 = new b2BoundValues();
_local5 = 0;
while (_local5 < 2) {
_local7 = m_bounds[_local5][_local13.lowerBounds[_local5]];
_local15.lowerValues[_local5] = _local7.value;
_local7 = m_bounds[_local5][_local13.upperBounds[_local5]];
_local15.upperValues[_local5] = _local7.value;
_local5++;
};
_local5 = 0;
while (_local5 < 2) {
_local16 = m_bounds[_local5];
_local17 = _local13.lowerBounds[_local5];
_local18 = _local13.upperBounds[_local5];
_local19 = _local14.lowerValues[_local5];
_local20 = _local14.upperValues[_local5];
_local7 = _local16[_local17];
_local21 = (_local19 - _local7.value);
_local7.value = _local19;
_local7 = _local16[_local18];
_local22 = (_local20 - _local7.value);
_local7.value = _local20;
if (_local21 < 0){
_local6 = _local17;
while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local8.proxyId];
_local8.stabbingCount++;
if (_local8.IsUpper() == true){
if (TestOverlap(_local14, _local24)){
m_pairManager.AddBufferedPair(_arg1, _local23);
};
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
if (_local22 > 0){
_local6 = _local18;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount++;
if (_local9.IsLower() == true){
if (TestOverlap(_local14, _local11)){
m_pairManager.AddBufferedPair(_arg1, _local10);
};
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local21 > 0){
_local6 = _local17;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount--;
if (_local9.IsUpper()){
if (TestOverlap(_local15, _local11)){
m_pairManager.RemoveBufferedPair(_arg1, _local10);
};
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local22 < 0){
_local6 = _local18;
while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local23];
_local8.stabbingCount--;
if (_local8.IsLower() == true){
if (TestOverlap(_local15, _local24)){
m_pairManager.RemoveBufferedPair(_arg1, _local23);
};
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
_local5++;
};
}
public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:b2Bound;
_local4 = 0;
_local5 = (_arg2 - 1);
while (_local4 <= _local5) {
_local6 = ((_local4 + _local5) / 2);
_local7 = _arg1[_local6];
if (_local7.value > _arg3){
_local5 = (_local6 - 1);
} else {
if (_local7.value < _arg3){
_local4 = (_local6 + 1);
} else {
return (uint(_local6));
};
};
};
return (uint(_local4));
}
}
}//package Box2D.Collision
Section 13
//b2BufferedPair (Box2D.Collision.b2BufferedPair)
package Box2D.Collision {
public class b2BufferedPair {
public var proxyId1:uint;
public var proxyId2:uint;
}
}//package Box2D.Collision
Section 14
//b2Collision (Box2D.Collision.b2Collision)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Collision {
public static const b2_nullFeature:uint = 0xFF;
private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2();
public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local6:int;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:Array;
var _local11:b2Mat22;
var _local12:b2Vec2;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:int;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_local6 = _arg1.m_vertexCount;
_local7 = _arg1.m_vertices;
_local8 = _arg1.m_normals;
_local9 = _arg4.m_vertexCount;
_local10 = _arg4.m_vertices;
_local11 = _arg2.R;
_local12 = _local8[_arg3];
_local13 = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y));
_local14 = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y));
_local11 = _arg5.R;
_local15 = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14));
_local16 = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14));
_local17 = 0;
_local18 = Number.MAX_VALUE;
_local19 = 0;
while (_local19 < _local9) {
_local12 = _local10[_local19];
_local25 = ((_local12.x * _local15) + (_local12.y * _local16));
if (_local25 < _local18){
_local18 = _local25;
_local17 = _local19;
};
_local19++;
};
_local12 = _local7[_arg3];
_local11 = _arg2.R;
_local20 = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
_local21 = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local12 = _local10[_local17];
_local11 = _arg5.R;
_local22 = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
_local23 = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local22 = (_local22 - _local20);
_local23 = (_local23 - _local21);
_local24 = ((_local22 * _local13) + (_local23 * _local14));
return (_local24);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = _arg2.lowerBound;
_local4 = _arg1.upperBound;
_local5 = (_local3.x - _local4.x);
_local6 = (_local3.y - _local4.y);
_local3 = _arg1.lowerBound;
_local4 = _arg2.upperBound;
_local7 = (_local3.x - _local4.x);
_local8 = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{
var _local7:int;
var _local8:Array;
var _local9:int;
var _local10:Array;
var _local11:Array;
var _local12:b2Mat22;
var _local13:b2Vec2;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:int;
var _local20:ClipVertex;
var _local21:int;
var _local22:int;
var _local23:Number;
_local7 = _arg2.m_vertexCount;
_local8 = _arg2.m_normals;
_local9 = _arg5.m_vertexCount;
_local10 = _arg5.m_vertices;
_local11 = _arg5.m_normals;
_local12 = _arg3.R;
_local13 = _local8[_arg4];
_local14 = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y));
_local15 = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y));
_local12 = _arg6.R;
_local16 = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15));
_local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15));
_local14 = _local16;
_local17 = 0;
_local18 = Number.MAX_VALUE;
_local19 = 0;
while (_local19 < _local9) {
_local13 = _local11[_local19];
_local23 = ((_local14 * _local13.x) + (_local15 * _local13.y));
if (_local23 < _local18){
_local18 = _local23;
_local17 = _local19;
};
_local19++;
};
_local21 = _local17;
_local22 = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0;
_local20 = _arg1[0];
_local13 = _local10[_local21];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local21;
_local20.id.features.incidentVertex = 0;
_local20 = _arg1[1];
_local13 = _local10[_local22];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local22;
_local20.id.features.incidentVertex = 1;
}
public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{
var _local6:ClipVertex;
var _local7:int;
var _local8:Array;
var _local9:Number;
var _local10:int;
var _local11:Array;
var _local12:Number;
var _local13:b2PolygonShape;
var _local14:b2PolygonShape;
var _local15:b2XForm;
var _local16:b2XForm;
var _local17:int;
var _local18:uint;
var _local19:Number;
var _local20:Number;
var _local21:Array;
var _local22:int;
var _local23:Array;
var _local24:b2Vec2;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:b2Vec2;
var _local28:b2Vec2;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Array;
var _local33:Array;
var _local34:int;
var _local35:int;
var _local36:int;
var _local37:b2Vec2;
var _local38:Number;
var _local39:b2ManifoldPoint;
_arg1.pointCount = 0;
_local7 = 0;
_local8 = [_local7];
_local9 = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5);
_local7 = _local8[0];
if (_local9 > 0){
return;
};
_local10 = 0;
_local11 = [_local10];
_local12 = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3);
_local10 = _local11[0];
if (_local12 > 0){
return;
};
_local15 = new b2XForm();
_local16 = new b2XForm();
_local19 = 0.98;
_local20 = 0.001;
if (_local12 > ((_local19 * _local9) + _local20)){
_local13 = _arg4;
_local14 = _arg2;
_local15.Set(_arg5);
_local16.Set(_arg3);
_local17 = _local10;
_local18 = 1;
} else {
_local13 = _arg2;
_local14 = _arg4;
_local15.Set(_arg3);
_local16.Set(_arg5);
_local17 = _local7;
_local18 = 0;
};
_local21 = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16);
_local22 = _local13.m_vertexCount;
_local23 = _local13.m_vertices;
_local24 = _local23[_local17];
_local25 = _local24.Copy();
if ((_local17 + 1) < _local22){
_local24 = _local23[int((_local17 + 1))];
_local37 = _local24.Copy();
} else {
_local24 = _local23[0];
_local37 = _local24.Copy();
};
_local26 = b2Math.SubtractVV(_local37, _local25);
_local27 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25));
_local27.Normalize();
_local28 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local37 = b2Math.b2MulX(_local15, _local37);
_local29 = b2Math.b2Dot(_local28, _local25);
_local30 = -(b2Math.b2Dot(_local27, _local25));
_local31 = b2Math.b2Dot(_local27, _local37);
_local32 = [new ClipVertex(), new ClipVertex()];
_local33 = [new ClipVertex(), new ClipVertex()];
_local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30);
if (_local34 < 2){
return;
};
_local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31);
if (_local34 < 2){
return;
};
_arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy();
_local35 = 0;
_local36 = 0;
while (_local36 < b2Settings.b2_maxManifoldPoints) {
_local6 = _local33[_local36];
_local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29);
if (_local38 <= 0){
_local39 = _arg1.points[_local35];
_local39.separation = _local38;
_local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local39.id.key = _local6.id._key;
_local39.id.features.flip = _local18;
_local35++;
};
_local36++;
};
_arg1.pointCount = _local35;
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local6:int;
var _local7:Array;
var _local8:b2Vec2;
var _local9:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:int;
var _local15:Number;
var _local16:int;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:int;
var _local21:Number;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:Number;
_local6 = _arg2.m_vertexCount;
_local7 = _arg2.m_normals;
_local9 = _arg5.R;
_local8 = _arg4.m_centroid;
_local10 = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)));
_local11 = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)));
_local9 = _arg3.R;
_local8 = _arg2.m_centroid;
_local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))));
_local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))));
_local12 = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y));
_local13 = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y));
_local14 = 0;
_local15 = -(Number.MAX_VALUE);
_local16 = 0;
while (_local16 < _local6) {
_local8 = _local7[_local16];
_local25 = ((_local8.x * _local12) + (_local8.y * _local13));
if (_local25 > _local15){
_local15 = _local25;
_local14 = _local16;
};
_local16++;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
_local18 = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1);
_local19 = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5);
if (_local19 > 0){
return (_local19);
};
_local20 = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0;
_local21 = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5);
if (_local21 > 0){
return (_local21);
};
if ((((_local19 > _local17)) && ((_local19 > _local21)))){
_local24 = -1;
_local22 = _local18;
_local23 = _local19;
} else {
if (_local21 > _local17){
_local24 = 1;
_local22 = _local20;
_local23 = _local21;
} else {
_arg1[0] = _local14;
return (_local17);
};
};
while (true) {
if (_local24 == -1){
_local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1);
} else {
_local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
if (_local17 > _local23){
_local22 = _local14;
_local23 = _local17;
} else {
break;
};
};
_arg1[0] = _local22;
return (_local23);
}
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:ClipVertex;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:b2Vec2;
var _local13:ClipVertex;
_local6 = 0;
_local5 = _arg2[0];
_local7 = _local5.v;
_local5 = _arg2[1];
_local8 = _local5.v;
_local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4);
_local10 = (b2Math.b2Dot(_arg3, _local8) - _arg4);
if (_local9 <= 0){
var _temp1 = _local6;
_local6 = (_local6 + 1);
var _local14 = _temp1;
_arg1[_local14] = _arg2[0];
};
if (_local10 <= 0){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_local14 = _temp2;
_arg1[_local14] = _arg2[1];
};
if ((_local9 * _local10) < 0){
_local11 = (_local9 / (_local9 - _local10));
_local5 = _arg1[_local6];
_local12 = _local5.v;
_local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x)));
_local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y)));
_local5 = _arg1[_local6];
if (_local9 > 0){
_local13 = _arg2[0];
_local5.id = _local13.id;
} else {
_local13 = _arg2[1];
_local5.id = _local13.id;
};
_local6++;
};
return (_local6);
}
public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2Mat22;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:b2ManifoldPoint;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_arg1.pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_localPosition;
_local8 = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
_local9 = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_localPosition;
_local10 = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
_local11 = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local12 = (_local10 - _local8);
_local13 = (_local11 - _local9);
_local14 = ((_local12 * _local12) + (_local13 * _local13));
_local15 = _arg2.m_radius;
_local16 = _arg4.m_radius;
_local17 = (_local15 + _local16);
if (_local14 > (_local17 * _local17)){
return;
};
if (_local14 < Number.MIN_VALUE){
_local18 = -(_local17);
_arg1.normal.Set(0, 1);
} else {
_local24 = Math.sqrt(_local14);
_local18 = (_local24 - _local17);
_local25 = (1 / _local24);
_arg1.normal.x = (_local25 * _local12);
_arg1.normal.y = (_local25 * _local13);
};
_arg1.pointCount = 1;
_local19 = _arg1.points[0];
_local19.id.key = 0;
_local19.separation = _local18;
_local8 = (_local8 + (_local15 * _arg1.normal.x));
_local9 = (_local9 + (_local15 * _arg1.normal.y));
_local10 = (_local10 - (_local16 * _arg1.normal.x));
_local11 = (_local11 - (_local16 * _arg1.normal.y));
_local20 = (0.5 * (_local8 + _local10));
_local21 = (0.5 * (_local9 + _local11));
_local22 = (_local20 - _arg3.position.x);
_local23 = (_local21 - _arg3.position.y);
_local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y));
_local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y));
_local22 = (_local20 - _arg5.position.x);
_local23 = (_local21 - _arg5.position.y);
_local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y));
_local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y));
}
public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2ManifoldPoint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local12:b2Mat22;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:Number;
var _local21:int;
var _local22:Array;
var _local23:Array;
var _local24:int;
var _local25:int;
var _local26:int;
var _local27:b2Vec2;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_arg1.pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_localPosition;
_local13 = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
_local14 = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)));
_local7 = (_local13 - _arg3.position.x);
_local8 = (_local14 - _arg3.position.y);
_local12 = _arg3.R;
_local15 = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local16 = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local18 = 0;
_local19 = -(Number.MAX_VALUE);
_local20 = _arg4.m_radius;
_local21 = _arg2.m_vertexCount;
_local22 = _arg2.m_vertices;
_local23 = _arg2.m_normals;
_local24 = 0;
while (_local24 < _local21) {
_local11 = _local22[_local24];
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local11 = _local23[_local24];
_local34 = ((_local11.x * _local7) + (_local11.y * _local8));
if (_local34 > _local20){
return;
};
if (_local34 > _local19){
_local19 = _local34;
_local18 = _local24;
};
_local24++;
};
if (_local19 < Number.MIN_VALUE){
_arg1.pointCount = 1;
_local11 = _local23[_local18];
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y));
_arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y));
_local6 = _arg1.points[0];
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local19 - _local20);
return;
};
_local25 = _local18;
_local26 = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
_local11 = _local22[_local25];
_local27 = _local22[_local26];
_local28 = (_local27.x - _local11.x);
_local29 = (_local27.y - _local11.y);
_local30 = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local31 = ((_local7 * _local28) + (_local8 * _local29));
_local6 = _arg1.points[0];
if (_local31 <= 0){
_local32 = _local11.x;
_local33 = _local11.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local25;
} else {
if (_local31 >= _local30){
_local32 = _local27.x;
_local33 = _local27.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local26;
} else {
_local32 = ((_local28 * _local31) + _local11.x);
_local33 = ((_local29 * _local31) + _local11.y);
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = 0;
};
};
_local7 = (_local15 - _local32);
_local8 = (_local16 - _local33);
_local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local7 / _local17);
_local8 = (_local8 / _local17);
if (_local17 > _local20){
return;
};
_arg1.pointCount = 1;
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8));
_arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8));
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local17 - _local20);
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
}
}
}//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID)
package Box2D.Collision {
public class b2ContactID {
public var _key:uint;
public var features:Features;
public function b2ContactID(){
features = new Features();
super();
features._m_id = this;
}
public function Set(_arg1:b2ContactID):void{
key = _arg1._key;
}
public function Copy():b2ContactID{
var _local1:b2ContactID;
_local1 = new b2ContactID();
_local1.key = key;
return (_local1);
}
public function get key():uint{
return (_key);
}
public function set key(_arg1:uint):void{
_key = _arg1;
features._referenceEdge = (_key & 0xFF);
features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF);
features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF);
features._flip = (((_key & 4278190080) >> 24) & 0xFF);
}
}
}//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2ContactPoint {
public var separation:Number;
public var normal:b2Vec2;
public var position:b2Vec2;
public var restitution:Number;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var id:b2ContactID;
public var friction:Number;
public var velocity:b2Vec2;
public function b2ContactPoint(){
position = new b2Vec2();
velocity = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Distance {
private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var gPoint:b2Point = new b2Point();
public static var g_GJK_Iterations:int = 0;
public static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{
var _local4:Number;
var _local5:int;
var _local6:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local4 = (100 * Number.MIN_VALUE);
_local5 = 0;
while (_local5 < _arg3) {
_local6 = _arg2[_local5];
_local7 = Math.abs((_arg1.x - _local6.x));
_local8 = Math.abs((_arg1.y - _local6.y));
_local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x));
_local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y));
if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){
return (true);
};
_local5++;
};
return (false);
}
public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{
var _local7:b2Vec2;
var _local8:Array;
var _local9:Array;
var _local10:Array;
var _local11:int;
var _local12:Number;
var _local13:int;
var _local14:int;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:int;
_local8 = s_p1s;
_local9 = s_p2s;
_local10 = s_points;
_local11 = 0;
_arg1.SetV(_arg3.GetFirstVertex(_arg4));
_arg2.SetV(_arg5.GetFirstVertex(_arg6));
_local12 = 0;
_local13 = 20;
_local14 = 0;
while (_local14 < _local13) {
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local17 = _arg3.Support(_arg4, _local15, _local16);
_local18 = _arg5.Support(_arg6, -(_local15), -(_local16));
_local12 = ((_local15 * _local15) + (_local16 * _local16));
_local19 = (_local18.x - _local17.x);
_local20 = (_local18.y - _local17.y);
_local21 = ((_local15 * _local19) + (_local16 * _local20));
if ((_local12 - ((_local15 * _local19) + (_local16 * _local20))) <= (0.01 * _local12)){
if (_local11 == 0){
_arg1.SetV(_local17);
_arg2.SetV(_local18);
};
g_GJK_Iterations = _local14;
return (Math.sqrt(_local12));
};
switch (_local11){
case 0:
_local7 = _local8[0];
_local7.SetV(_local17);
_local7 = _local9[0];
_local7.SetV(_local18);
_local7 = _local10[0];
_local7.x = _local19;
_local7.y = _local20;
_arg1.SetV(_local8[0]);
_arg2.SetV(_local9[0]);
_local11++;
break;
case 1:
_local7 = _local8[1];
_local7.SetV(_local17);
_local7 = _local9[1];
_local7.SetV(_local18);
_local7 = _local10[1];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessTwo(_arg1, _arg2, _local8, _local9, _local10);
break;
case 2:
_local7 = _local8[2];
_local7.SetV(_local17);
_local7 = _local9[2];
_local7.SetV(_local18);
_local7 = _local10[2];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessThree(_arg1, _arg2, _local8, _local9, _local10);
break;
};
if (_local11 == 3){
g_GJK_Iterations = _local14;
return (0);
};
_local22 = -(Number.MAX_VALUE);
_local23 = 0;
while (_local23 < _local11) {
_local7 = _local10[_local23];
_local22 = b2Math.b2Max(_local22, ((_local7.x * _local7.x) + (_local7.y * _local7.y)));
_local23++;
};
if ((((_local11 == 3)) || ((_local12 <= ((100 * Number.MIN_VALUE) * _local22))))){
g_GJK_Iterations = _local14;
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local12 = ((_local15 * _local15) + (_local16 * _local16));
return (Math.sqrt(_local12));
};
_local14++;
};
g_GJK_Iterations = _local13;
return (Math.sqrt(_local12));
}
public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local7 = _arg4.R;
_local8 = _arg3.m_localPosition;
_local9 = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local10 = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local7 = _arg6.R;
_local8 = _arg5.m_localPosition;
_local11 = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local12 = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local13 = (_local11 - _local9);
_local14 = (_local12 - _local10);
_local15 = ((_local13 * _local13) + (_local14 * _local14));
_local16 = (_arg3.m_radius - b2Settings.b2_toiSlop);
_local17 = (_arg5.m_radius - b2Settings.b2_toiSlop);
_local18 = (_local16 + _local17);
if (_local15 > (_local18 * _local18)){
_local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14)));
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_local20 = (_local19 - _local18);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = (_local11 - (_local17 * _local13));
_arg2.y = (_local12 - (_local17 * _local14));
return (_local20);
};
if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){
_local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14)));
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
};
_arg1.x = _local9;
_arg1.y = _local10;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
}
public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local14:b2Vec2;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg5[2];
_local9 = _arg3[0];
_local10 = _arg3[1];
_local11 = _arg3[2];
_local12 = _arg4[0];
_local13 = _arg4[1];
_local14 = _arg4[2];
_local15 = _local6.x;
_local16 = _local6.y;
_local17 = _local7.x;
_local18 = _local7.y;
_local19 = _local8.x;
_local20 = _local8.y;
_local21 = (_local17 - _local15);
_local22 = (_local18 - _local16);
_local23 = (_local19 - _local15);
_local24 = (_local20 - _local16);
_local25 = (_local19 - _local17);
_local26 = (_local20 - _local18);
_local27 = -(((_local15 * _local21) + (_local16 * _local22)));
_local28 = ((_local17 * _local21) + (_local18 * _local22));
_local29 = -(((_local15 * _local23) + (_local16 * _local24)));
_local30 = ((_local19 * _local23) + (_local20 * _local24));
_local31 = -(((_local17 * _local25) + (_local18 * _local26)));
_local32 = ((_local19 * _local25) + (_local20 * _local26));
if ((((_local30 <= 0)) && ((_local32 <= 0)))){
_arg1.SetV(_local11);
_arg2.SetV(_local14);
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (1);
};
_local33 = ((_local21 * _local24) - (_local22 * _local23));
_local34 = (_local33 * ((_local15 * _local18) - (_local16 * _local17)));
_local36 = (_local33 * ((_local17 * _local20) - (_local18 * _local19)));
if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){
_local35 = (_local31 / (_local31 + _local32));
_arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x)));
_arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y)));
_arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x)));
_arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y)));
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (2);
};
_local37 = (_local33 * ((_local19 * _local16) - (_local20 * _local15)));
if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){
_local35 = (_local29 / (_local29 + _local30));
_arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x)));
_arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y)));
_arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x)));
_arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y)));
_local10.SetV(_local11);
_local13.SetV(_local14);
_local7.SetV(_local8);
return (2);
};
_local38 = ((_local36 + _local37) + _local34);
_local38 = (1 / _local38);
_local39 = (_local36 * _local38);
_local40 = (_local37 * _local38);
_local41 = ((1 - _local39) - _local40);
_arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x));
_arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y));
_arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x));
_arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y));
return (3);
}
public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local9:b2Point;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local9 = gPoint;
_local8 = _arg5.m_localPosition;
_local7 = _arg6.R;
_local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local10 = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity);
_local11 = (_arg5.m_radius - b2Settings.b2_toiSlop);
if (_local10 > _local11){
_local10 = (_local10 - _local11);
_local12 = (_arg2.x - _arg1.x);
_local13 = (_arg2.y - _arg1.y);
_local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13)));
_local12 = (_local12 / _local14);
_local13 = (_local13 / _local14);
_arg2.x = (_arg2.x - (_local11 * _local12));
_arg2.y = (_arg2.y - (_local11 * _local13));
} else {
_local10 = 0;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
};
return (_local10);
}
public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{
var _local7:int;
var _local8:int;
_local7 = _arg3.m_type;
_local8 = _arg5.m_type;
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6));
};
return (0);
}
public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg3[0];
_local9 = _arg3[1];
_local10 = _arg4[0];
_local11 = _arg4[1];
_local12 = -(_local7.x);
_local13 = -(_local7.y);
_local14 = (_local6.x - _local7.x);
_local15 = (_local6.y - _local7.y);
_local16 = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
_local14 = (_local14 / _local16);
_local15 = (_local15 / _local16);
_local17 = ((_local12 * _local14) + (_local13 * _local15));
if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){
_arg1.SetV(_local9);
_arg2.SetV(_local11);
_local8.SetV(_local9);
_local10.SetV(_local11);
_local6.SetV(_local7);
return (1);
};
_local17 = (_local17 / _local16);
_arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x)));
_arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y)));
_arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x)));
_arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y)));
return (2);
}
}
}//package Box2D.Collision
Section 18
//b2Manifold (Box2D.Collision.b2Manifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Manifold {
public var points:Array;
public var pointCount:int;// = 0
public var normal:b2Vec2;
public function b2Manifold(){
var _local1:int;
pointCount = 0;
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ManifoldPoint();
_local1++;
};
normal = new b2Vec2();
}
public function Set(_arg1:b2Manifold):void{
var _local2:int;
pointCount = _arg1.pointCount;
_local2 = 0;
while (_local2 < b2Settings.b2_maxManifoldPoints) {
(points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]);
_local2++;
};
normal.SetV(_arg1.normal);
}
public function Reset():void{
var _local1:int;
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
normal.SetZero();
pointCount = 0;
}
}
}//package Box2D.Collision
Section 19
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2ManifoldPoint {
public var separation:Number;
public var localPoint2:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var localPoint1:b2Vec2;
public var id:b2ContactID;
public function b2ManifoldPoint(){
localPoint1 = new b2Vec2();
localPoint2 = new b2Vec2();
id = new b2ContactID();
super();
}
public function Set(_arg1:b2ManifoldPoint):void{
localPoint1.SetV(_arg1.localPoint1);
localPoint2.SetV(_arg1.localPoint2);
separation = _arg1.separation;
normalImpulse = _arg1.normalImpulse;
tangentImpulse = _arg1.tangentImpulse;
id.key = _arg1.id.key;
}
public function Reset():void{
localPoint1.SetZero();
localPoint2.SetZero();
separation = 0;
normalImpulse = 0;
tangentImpulse = 0;
id.key = 0;
}
}
}//package Box2D.Collision
Section 20
//b2OBB (Box2D.Collision.b2OBB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2OBB {
public var R:b2Mat22;
public var center:b2Vec2;
public var extents:b2Vec2;
public function b2OBB(){
R = new b2Mat22();
center = new b2Vec2();
extents = new b2Vec2();
super();
}
}
}//package Box2D.Collision
Section 21
//b2Pair (Box2D.Collision.b2Pair)
package Box2D.Collision {
import Box2D.Common.*;
public class b2Pair {
public var userData;// = null
public var proxyId1:uint;
public var proxyId2:uint;
public var status:uint;
public var next:uint;
public static var e_pairFinal:uint = 4;
public static var b2_tableMask:int = (b2_tableCapacity - 1);
public static var e_pairRemoved:uint = 2;
public static var b2_nullPair:uint = b2Settings.USHRT_MAX;
public static var e_pairBuffered:uint = 1;
public static var b2_nullProxy:uint = b2Settings.USHRT_MAX;
public static var b2_tableCapacity:int = b2Settings.b2_maxPairs;
public function b2Pair(){
userData = null;
super();
}
public function SetBuffered():void{
status = (status | e_pairBuffered);
}
public function IsBuffered():Boolean{
return (((status & e_pairBuffered) == e_pairBuffered));
}
public function IsFinal():Boolean{
return (((status & e_pairFinal) == e_pairFinal));
}
public function ClearRemoved():void{
status = (status & ~(e_pairRemoved));
}
public function SetFinal():void{
status = (status | e_pairFinal);
}
public function IsRemoved():Boolean{
return (((status & e_pairRemoved) == e_pairRemoved));
}
public function ClearBuffered():void{
status = (status & ~(e_pairBuffered));
}
public function SetRemoved():void{
status = (status | e_pairRemoved);
}
}
}//package Box2D.Collision
Section 22
//b2PairCallback (Box2D.Collision.b2PairCallback)
package Box2D.Collision {
public class b2PairCallback {
public function PairRemoved(_arg1, _arg2, _arg3):void{
}
public function PairAdded(_arg1, _arg2){
return (null);
}
}
}//package Box2D.Collision
Section 23
//b2PairManager (Box2D.Collision.b2PairManager)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PairManager {
public var m_pairCount:int;
public var m_pairBuffer:Array;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_pairBufferCount:int;
public var m_hashTable:Array;
public var m_broadPhase:b2BroadPhase;
public var m_freePair:uint;
public function b2PairManager(){
var _local1:uint;
super();
m_hashTable = new Array(b2Pair.b2_tableCapacity);
_local1 = 0;
while (_local1 < b2Pair.b2_tableCapacity) {
m_hashTable[_local1] = b2Pair.b2_nullPair;
_local1++;
};
m_pairs = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1] = new b2Pair();
_local1++;
};
m_pairBuffer = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairBuffer[_local1] = new b2BufferedPair();
_local1++;
};
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy;
m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy;
m_pairs[_local1].userData = null;
m_pairs[_local1].status = 0;
m_pairs[_local1].next = (_local1 + 1);
_local1++;
};
m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair;
m_pairCount = 0;
m_pairBufferCount = 0;
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:b2Pair;
var _local5:uint;
_local5 = m_hashTable[_arg3];
_local4 = m_pairs[_local5];
while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) {
_local5 = _local4.next;
_local4 = m_pairs[_local5];
};
if (_local5 == b2Pair.b2_nullPair){
return (null);
};
return (_local4);
}
private function Find(_arg1:uint, _arg2:uint):b2Pair{
var _local3:uint;
var _local4:uint;
if (_arg1 > _arg2){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
return (FindHash(_arg1, _arg2, _local3));
}
private function ValidateBuffer():void{
}
public function Commit():void{
var _local1:b2BufferedPair;
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:b2Pair;
var _local6:b2Proxy;
var _local7:b2Proxy;
_local3 = 0;
_local4 = m_broadPhase.m_proxyPool;
_local2 = 0;
while (_local2 < m_pairBufferCount) {
_local1 = m_pairBuffer[_local2];
_local5 = Find(_local1.proxyId1, _local1.proxyId2);
_local5.ClearBuffered();
_local6 = _local4[_local5.proxyId1];
_local7 = _local4[_local5.proxyId2];
if (_local5.IsRemoved()){
if (_local5.IsFinal() == true){
m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData);
};
_local1 = m_pairBuffer[_local3];
_local1.proxyId1 = _local5.proxyId1;
_local1.proxyId2 = _local5.proxyId2;
_local3++;
} else {
if (_local5.IsFinal() == false){
_local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData);
_local5.SetFinal();
};
};
_local2++;
};
_local2 = 0;
while (_local2 < _local3) {
_local1 = m_pairBuffer[_local2];
RemovePair(_local1.proxyId1, _local1.proxyId2);
_local2++;
};
m_pairBufferCount = 0;
if (b2BroadPhase.s_validate){
ValidateTable();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair;
_local4 = Find(_arg1, _arg2);
if (_local4 == null){
return;
};
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.SetRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function RemovePair(_arg1:uint, _arg2:uint){
var _local3:b2Pair;
var _local4:uint;
var _local5:uint;
var _local6:b2Pair;
var _local7:uint;
var _local8:uint;
var _local9:*;
if (_arg1 > _arg2){
_local7 = _arg1;
_arg1 = _arg2;
_arg2 = _local7;
};
_local4 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
_local5 = m_hashTable[_local4];
_local6 = null;
while (_local5 != b2Pair.b2_nullPair) {
if (Equals(m_pairs[_local5], _arg1, _arg2)){
_local8 = _local5;
_local3 = m_pairs[_local5];
if (_local6){
_local6.next = _local3.next;
} else {
m_hashTable[_local4] = _local3.next;
};
_local3 = m_pairs[_local8];
_local9 = _local3.userData;
_local3.next = m_freePair;
_local3.proxyId1 = b2Pair.b2_nullProxy;
_local3.proxyId2 = b2Pair.b2_nullProxy;
_local3.userData = null;
_local3.status = 0;
m_freePair = _local8;
m_pairCount--;
return (_local9);
} else {
_local6 = m_pairs[_local5];
_local5 = _local6.next;
};
};
return (null);
}
public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{
m_broadPhase = _arg1;
m_callback = _arg2;
}
public function AddBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair;
_local4 = AddPair(_arg1, _arg2);
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.ClearRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function AddPair(_arg1:uint, _arg2:uint):b2Pair{
var _local3:uint;
var _local4:b2Pair;
var _local5:uint;
var _local6:uint;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
_local4 = FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
_local5 = m_freePair;
_local4 = m_pairs[_local5];
m_freePair = _local4.next;
_local4.proxyId1 = _arg1;
_local4.proxyId2 = _arg2;
_local4.status = 0;
_local4.userData = null;
_local4.next = m_hashTable[_local3];
m_hashTable[_local3] = _local5;
m_pairCount++;
return (_local4);
}
private function ValidateTable():void{
}
public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{
return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2))));
}
public static function Hash(_arg1:uint, _arg2:uint):uint{
var _local3:uint;
_local3 = (((_arg2 << 16) & 4294901760) | _arg1);
_local3 = (~(_local3) + ((_local3 << 15) & 4294934528));
_local3 = (_local3 ^ ((_local3 >> 12) & 1048575));
_local3 = (_local3 + ((_local3 << 2) & 4294967292));
_local3 = (_local3 ^ ((_local3 >> 4) & 268435455));
_local3 = (_local3 * 2057);
_local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF));
return (_local3);
}
public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{
return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3))));
}
}
}//package Box2D.Collision
Section 24
//b2Point (Box2D.Collision.b2Point)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2Point {
public var p:b2Vec2;
public function b2Point(){
p = new b2Vec2();
super();
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (p);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
return (p);
}
}
}//package Box2D.Collision
Section 25
//b2Proxy (Box2D.Collision.b2Proxy)
package Box2D.Collision {
public class b2Proxy {
public var overlapCount:uint;
public var lowerBounds:Array;
public var upperBounds:Array;
public var userData;// = null
public var timeStamp:uint;
public function b2Proxy(){
lowerBounds = [uint(0), uint(0)];
upperBounds = [uint(0), uint(0)];
userData = null;
super();
}
public function GetNext():uint{
return (lowerBounds[0]);
}
public function IsValid():Boolean{
return (!((overlapCount == b2BroadPhase.b2_invalid)));
}
public function SetNext(_arg1:uint):void{
lowerBounds[0] = (_arg1 & 0xFFFF);
}
}
}//package Box2D.Collision
Section 26
//b2Segment (Box2D.Collision.b2Segment)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2Segment {
public var p1:b2Vec2;
public var p2:b2Vec2;
public function b2Segment(){
p1 = new b2Vec2();
p2 = new b2Vec2();
super();
}
public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
_local5 = _arg3.p1;
_local6 = (_arg3.p2.x - _local5.x);
_local7 = (_arg3.p2.y - _local5.y);
_local8 = (p2.x - p1.x);
_local9 = (p2.y - p1.y);
_local10 = _local9;
_local11 = -(_local8);
_local12 = (100 * Number.MIN_VALUE);
_local13 = -(((_local6 * _local10) + (_local7 * _local11)));
if (_local13 > _local12){
_local14 = (_local5.x - p1.x);
_local15 = (_local5.y - p1.y);
_local16 = ((_local14 * _local10) + (_local15 * _local11));
if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){
_local17 = ((-(_local7) * _local15) + (_local7 * _local14));
if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){
_local16 = (_local16 / _local13);
_local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
_local10 = (_local10 / _local18);
_local11 = (_local11 / _local18);
_arg1[0] = _local16;
_arg2.Set(_local10, _local11);
return (true);
};
};
};
return (false);
}
}
}//package Box2D.Collision
Section 27
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2TimeOfImpact {
public static var s_xf1:b2XForm = new b2XForm();
public static var s_xf2:b2XForm = new b2XForm();
public static var s_p1:b2Vec2 = new b2Vec2();
public static var s_p2:b2Vec2 = new b2Vec2();
public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:int;
var _local20:int;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:b2XForm;
var _local27:b2XForm;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
_local7 = _arg1.m_sweepRadius;
_local8 = _arg3.m_sweepRadius;
_local9 = _arg2.t0;
_local10 = (_arg2.c.x - _arg2.c0.x);
_local11 = (_arg2.c.y - _arg2.c0.y);
_local12 = (_arg4.c.x - _arg4.c0.x);
_local13 = (_arg4.c.y - _arg4.c0.y);
_local14 = (_arg2.a - _arg2.a0);
_local15 = (_arg4.a - _arg4.a0);
_local16 = 0;
_local17 = s_p1;
_local18 = s_p2;
_local19 = 20;
_local20 = 0;
_local21 = 0;
_local22 = 0;
_local23 = 0;
_local24 = 0;
while (true) {
_local25 = (((1 - _local16) * _local9) + _local16);
_local26 = s_xf1;
_local27 = s_xf2;
_arg2.GetXForm(_local26, _local25);
_arg4.GetXForm(_local27, _local25);
_local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27);
if (_local20 == 0){
if (_local23 > (2 * b2Settings.b2_toiSlop)){
_local24 = (1.5 * b2Settings.b2_toiSlop);
} else {
_local5 = (0.05 * b2Settings.b2_toiSlop);
_local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop));
_local24 = ((_local5 > _local6)) ? _local5 : _local6;
};
};
if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){
break;
};
_local21 = (_local18.x - _local17.x);
_local22 = (_local18.y - _local17.y);
_local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22)));
_local21 = (_local21 / _local28);
_local22 = (_local22 / _local28);
_local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8));
if (_local29 == 0){
_local16 = 1;
break;
};
_local30 = ((_local23 - _local24) / _local29);
_local31 = (_local16 + _local30);
if ((((_local31 < 0)) || ((1 < _local31)))){
_local16 = 1;
break;
};
if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){
break;
};
_local16 = _local31;
_local20++;
};
return (_local16);
}
}
}//package Box2D.Collision
Section 28
//ClipVertex (Box2D.Collision.ClipVertex)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class ClipVertex {
public var v:b2Vec2;
public var id:b2ContactID;
public function ClipVertex(){
v = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features)
package Box2D.Collision {
public class Features {
public var _referenceEdge:int;
public var _incidentEdge:int;
public var _flip:int;
public var _incidentVertex:int;
public var _m_id:b2ContactID;
public function get referenceEdge():int{
return (_referenceEdge);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
public function get flip():int{
return (_flip);
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set referenceEdge(_arg1:int):void{
_referenceEdge = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF));
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
}
}//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22)
package Box2D.Common.Math {
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){
var _local4:Number;
var _local5:Number;
col1 = new b2Vec2();
col2 = new b2Vec2();
super();
if (((!((_arg2 == null))) && (!((_arg3 == null))))){
col1.SetV(_arg2);
col2.SetV(_arg3);
} else {
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
col1.x = _local4;
col2.x = -(_local5);
col1.y = _local5;
col2.y = _local4;
};
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function Set(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function SetM(_arg1:b2Mat22):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = col1.x;
_local3 = col2.x;
_local4 = col1.y;
_local5 = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
_local6 = (1 / _local6);
_arg1.col1.x = (_local6 * _local5);
_arg1.col2.x = (-(_local6) * _local3);
_arg1.col1.y = (-(_local6) * _local4);
_arg1.col2.y = (_local6 * _local2);
return (_arg1);
}
public function GetAngle():Number{
return (Math.atan2(col1.y, col1.x));
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = col1.x;
_local5 = col2.x;
_local6 = col1.y;
_local7 = col2.y;
_local8 = ((_local4 * _local7) - (_local5 * _local6));
_local8 = (1 / _local8);
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
}
}//package Box2D.Common.Math
Section 31
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1));
public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity);
public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0);
public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = b2MulMV(_arg1.R, _arg2);
_local3.x = (_local3.x + _arg1.position.x);
_local3.y = (_local3.y + _arg1.position.y);
return (_local3);
}
public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:*;
_local3 = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22;
_local2 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
_local3 = SubtractVV(_arg2, _arg1.position);
_local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y));
_local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y));
_local3.x = _local4;
return (_local3);
}
public static function b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2;
_local2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2Mat22;
_local3 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
_local4 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
_local5 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean;
_local2 = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2NextPowerOfTwo(_arg1:uint):uint{
_arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647));
_arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823));
_arg1 = (_arg1 | ((_arg1 >> 4) & 268435455));
_arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF));
_arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF));
return ((_arg1 + 1));
}
public static function b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
}
}//package Box2D.Common.Math
Section 32
//b2Sweep (Box2D.Common.Math.b2Sweep)
package Box2D.Common.Math {
public class b2Sweep {
public var localCenter:b2Vec2;
public var c:b2Vec2;
public var a:Number;
public var c0:b2Vec2;
public var a0:Number;
public var t0:Number;
public function b2Sweep(){
localCenter = new b2Vec2();
c0 = new b2Vec2();
c = new b2Vec2();
super();
}
public function Advance(_arg1:Number):void{
var _local2:Number;
if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){
_local2 = ((_arg1 - t0) / (1 - t0));
c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x));
c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y));
a0 = (((1 - _local2) * a0) + (_local2 * a));
t0 = _arg1;
};
}
public function GetXForm(_arg1:b2XForm, _arg2:Number):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
if ((1 - t0) > Number.MIN_VALUE){
_local4 = ((_arg2 - t0) / (1 - t0));
_arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x));
_arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y));
_local5 = (((1 - _local4) * a0) + (_local4 * a));
_arg1.R.Set(_local5);
} else {
_arg1.position.SetV(c);
_arg1.R.Set(a);
};
_local3 = _arg1.R;
_arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y)));
_arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y)));
}
}
}//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2)
package Box2D.Common.Math {
public class b2Vec2 {
public var x:Number;
public var y:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function LengthSquared():Number{
return (((x * x) + (y * y)));
}
public function SetZero():void{
x = 0;
y = 0;
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function CrossVF(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function Normalize():Number{
var _local1:Number;
var _local2:Number;
_local1 = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
_local2 = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm)
package Box2D.Common.Math {
public class b2XForm {
public var R:b2Mat22;
public var position:b2Vec2;
public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{
position = new b2Vec2();
R = new b2Mat22();
super();
if (_arg1){
position.SetV(_arg1);
R.SetM(_arg2);
};
}
public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{
position.SetV(_arg1);
R.SetM(_arg2);
}
public function Set(_arg1:b2XForm):void{
position.SetV(_arg1.position);
R.SetM(_arg1.R);
}
public function SetIdentity():void{
position.SetZero();
R.SetIdentity();
}
}
}//package Box2D.Common.Math
Section 35
//b2Color (Box2D.Common.b2Color)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Color {
private var _g:uint;// = 0
private var _b:uint;// = 0
private var _r:uint;// = 0
public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){
_r = 0;
_g = 0;
_b = 0;
super();
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function get color():uint{
return (((_r | (_g << 8)) | (_b << 16)));
}
public function set r(_arg1:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set b(_arg1:Number):void{
_b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set g(_arg1:Number):void{
_g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
}
}//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static const b2_linearSleepTolerance:Number = 0.01;
public static const b2_angularSlop:Number = 0.0349065850398866;
public static const b2_linearSlop:Number = 0.005;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_maxProxies:int = 0x0200;
public static const b2_maxAngularVelocitySquared:Number = 62500;
public static const b2_maxPolygonVertices:int = 8;
public static const b2_velocityThreshold:Number = 1;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_maxPairs:int = 4096;
public static const b2_maxTOIContactsPerIsland:int = 32;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_maxAngularVelocity:Number = 250;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_maxLinearVelocity:Number = 200;
public static const b2_maxLinearCorrection:Number = 0.2;
public static const b2_toiSlop:Number = 0.04;
public static const b2_maxLinearVelocitySquared:Number = 40000;
public static function b2Assert(_arg1:Boolean):void{
var _local2:b2Vec2;
if (!_arg1){
_local2.x++;
};
}
}
}//package Box2D.Common
Section 37
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class b2CircleContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
var _local3:b2ManifoldPoint;
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
_local3 = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactPoint;
var _local8:b2ManifoldPoint;
_local5 = m_shape1.m_body;
_local6 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf);
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
m_manifoldCount = 1;
_local8 = m_manifold.points[0];
if (m0.pointCount == 0){
_local8.normalImpulse = 0;
_local8.tangentImpulse = 0;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Add(_local7);
};
} else {
_local4 = m0.points[0];
_local8.normalImpulse = _local4.normalImpulse;
_local8.tangentImpulse = _local4.tangentImpulse;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Persist(_local7);
};
};
} else {
m_manifoldCount = 0;
if ((((m0.pointCount > 0)) && (_arg1))){
_local4 = m0.points[0];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2CircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
import Box2D.Collision.*;
public class b2Contact {
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_prev:b2Contact;
public var m_toi:Number;
public var m_next:b2Contact;
public var m_friction:Number;
public var m_manifoldCount:int;
public var m_node1:b2ContactEdge;
public var m_node2:b2ContactEdge;
public var m_restitution:Number;
public var m_flags:uint;
public static var e_toiFlag:uint = 8;
public static var e_nonSolidFlag:uint = 1;
public static var e_slowFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var s_registers:Array;
public static var s_initialized:Boolean = false;
public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){
m_node1 = new b2ContactEdge();
m_node2 = new b2ContactEdge();
super();
m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
m_shape1 = null;
m_shape2 = null;
return;
};
if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){
m_flags = (m_flags | e_nonSolidFlag);
};
m_shape1 = _arg1;
m_shape2 = _arg2;
m_manifoldCount = 0;
m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction));
m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution);
m_prev = null;
m_next = null;
m_node1.contact = null;
m_node1.prev = null;
m_node1.next = null;
m_node1.other = null;
m_node2.contact = null;
m_node2.prev = null;
m_node2.next = null;
m_node2.other = null;
}
public function GetShape1():b2Shape{
return (m_shape1);
}
public function IsSolid():Boolean{
return (((m_flags & e_nonSolidFlag) == 0));
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetManifolds():Array{
return (null);
}
public function GetShape2():b2Shape{
return (m_shape2);
}
public function GetManifoldCount():int{
return (m_manifoldCount);
}
public function Update(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:int;
var _local4:b2Body;
var _local5:b2Body;
_local2 = m_manifoldCount;
Evaluate(_arg1);
_local3 = m_manifoldCount;
_local4 = m_shape1.m_body;
_local5 = m_shape2.m_body;
if ((((_local3 == 0)) && ((_local2 > 0)))){
_local4.WakeUp();
_local5.WakeUp();
};
if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){
m_flags = (m_flags & ~(e_slowFlag));
} else {
m_flags = (m_flags | e_slowFlag);
};
}
public function Evaluate(_arg1:b2ContactListener):void{
}
public static function InitializeRegisters():void{
var _local1:int;
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
_local1 = 0;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_registers[_local1][_local2] = new b2ContactRegister();
_local2++;
};
_local1++;
};
AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape);
AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape);
AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
var _local3:int;
var _local4:int;
var _local5:b2ContactRegister;
var _local6:Function;
if (_arg1.m_manifoldCount > 0){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
_local3 = _arg1.m_shape1.m_type;
_local4 = _arg1.m_shape2.m_type;
_local5 = s_registers[_local3][_local4];
_local6 = _local5.destroyFcn;
_local6(_arg1, _arg2);
}
public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{
s_registers[_arg3][_arg4].createFcn = _arg1;
s_registers[_arg3][_arg4].destroyFcn = _arg2;
s_registers[_arg3][_arg4].primary = true;
if (_arg3 != _arg4){
s_registers[_arg4][_arg3].createFcn = _arg1;
s_registers[_arg4][_arg3].destroyFcn = _arg2;
s_registers[_arg4][_arg3].primary = false;
};
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local4:int;
var _local5:int;
var _local6:b2ContactRegister;
var _local7:Function;
var _local8:b2Contact;
var _local9:int;
var _local10:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
_local4 = _arg1.m_type;
_local5 = _arg2.m_type;
_local6 = s_registers[_local4][_local5];
_local7 = _local6.createFcn;
if (_local7 != null){
if (_local6.primary){
return (_local7(_arg1, _arg2, _arg3));
};
_local8 = _local7(_arg2, _arg1, _arg3);
_local9 = 0;
while (_local9 < _local8.m_manifoldCount) {
_local10 = _local8.GetManifolds()[_local9];
_local8.GetManifolds()[_local9].normal = _local10.normal.Negative();
_local9++;
};
return (_local8);
//unresolved jump
};
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 39
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
import Box2D.Collision.*;
public class b2ContactConstraint {
public var points:Array;
public var restitution:Number;
public var body1:b2Body;
public var manifold:b2Manifold;
public var normal:b2Vec2;
public var body2:b2Body;
public var friction:Number;
public var pointCount:int;
public function b2ContactConstraint(){
var _local1:int;
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var r2:b2Vec2;
public var separation:Number;
public var positionImpulse:Number;
public var normalImpulse:Number;
public var equalizedMass:Number;
public var tangentMass:Number;
public var tangentImpulse:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var normalMass:Number;
public var velocityBias:Number;
public var r1:b2Vec2;
public function b2ContactConstraintPoint(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
r1 = new b2Vec2();
r2 = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2ContactEdge {
public var next:b2ContactEdge;
public var other:b2Body;
public var contact:b2Contact;
public var prev:b2ContactEdge;
}
}//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var primary:Boolean;
public var createFcn:Function;
public var destroyFcn:Function;
}
}//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
public class b2ContactResult {
public var normal:b2Vec2;
public var position:b2Vec2;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ContactResult(){
position = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
import Box2D.Collision.*;
public class b2ContactSolver {
public var m_constraintCount:int;
public var m_constraints:Array;
public var m_allocator;
public var m_step:b2TimeStep;
public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){
var _local5:b2Contact;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _local9:int;
var _local10:b2Body;
var _local11:b2Body;
var _local12:int;
var _local13:Array;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:int;
var _local23:b2Manifold;
var _local24:Number;
var _local25:Number;
var _local26:b2ContactConstraint;
var _local27:uint;
var _local28:b2ManifoldPoint;
var _local29:b2ContactConstraintPoint;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:Number;
var _local44:Number;
var _local45:Number;
var _local46:Number;
var _local47:Number;
m_step = new b2TimeStep();
m_constraints = new Array();
super();
m_step.dt = _arg1.dt;
m_step.inv_dt = _arg1.inv_dt;
m_step.maxIterations = _arg1.maxIterations;
m_allocator = _arg4;
m_constraintCount = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
m_constraintCount = (m_constraintCount + _local5.m_manifoldCount);
_local6++;
};
_local6 = 0;
while (_local6 < m_constraintCount) {
m_constraints[_local6] = new b2ContactConstraint();
_local6++;
};
_local9 = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
_local10 = _local5.m_shape1.m_body;
_local11 = _local5.m_shape2.m_body;
_local12 = _local5.m_manifoldCount;
_local13 = _local5.GetManifolds();
_local14 = _local5.m_friction;
_local15 = _local5.m_restitution;
_local16 = _local10.m_linearVelocity.x;
_local17 = _local10.m_linearVelocity.y;
_local18 = _local11.m_linearVelocity.x;
_local19 = _local11.m_linearVelocity.y;
_local20 = _local10.m_angularVelocity;
_local21 = _local11.m_angularVelocity;
_local22 = 0;
while (_local22 < _local12) {
_local23 = _local13[_local22];
_local24 = _local23.normal.x;
_local25 = _local23.normal.y;
_local26 = m_constraints[_local9];
_local26.body1 = _local10;
_local26.body2 = _local11;
_local26.manifold = _local23;
_local26.normal.x = _local24;
_local26.normal.y = _local25;
_local26.pointCount = _local23.pointCount;
_local26.friction = _local14;
_local26.restitution = _local15;
_local27 = 0;
while (_local27 < _local26.pointCount) {
_local28 = _local23.points[_local27];
_local29 = _local26.points[_local27];
_local29.normalImpulse = _local28.normalImpulse;
_local29.tangentImpulse = _local28.tangentImpulse;
_local29.separation = _local28.separation;
_local29.positionImpulse = 0;
_local29.localAnchor1.SetV(_local28.localPoint1);
_local29.localAnchor2.SetV(_local28.localPoint2);
_local8 = _local10.m_xf.R;
_local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x);
_local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33));
_local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33));
_local32 = _local30;
_local29.r1.Set(_local32, _local33);
_local8 = _local11.m_xf.R;
_local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x);
_local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35));
_local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35));
_local34 = _local30;
_local29.r2.Set(_local34, _local35);
_local36 = ((_local32 * _local32) + (_local33 * _local33));
_local37 = ((_local34 * _local34) + (_local35 * _local35));
_local38 = ((_local32 * _local24) + (_local33 * _local25));
_local39 = ((_local34 * _local24) + (_local35 * _local25));
_local40 = (_local10.m_invMass + _local11.m_invMass);
_local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39)))));
_local29.normalMass = (1 / _local40);
_local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass));
_local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39)))));
_local29.equalizedMass = (1 / _local41);
_local42 = _local25;
_local43 = -(_local24);
_local44 = ((_local32 * _local42) + (_local33 * _local43));
_local45 = ((_local34 * _local42) + (_local35 * _local43));
_local46 = (_local10.m_invMass + _local11.m_invMass);
_local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45)))));
_local29.tangentMass = (1 / _local46);
_local29.velocityBias = 0;
if (_local29.separation > 0){
_local29.velocityBias = (-60 * _local29.separation);
};
_local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33));
_local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32));
_local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31));
if (_local47 < -(b2Settings.b2_velocityThreshold)){
_local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47));
};
_local27++;
};
_local9++;
_local22++;
};
_local6++;
};
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local5:int;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:b2ContactConstraintPoint;
var _local21:Number;
var _local22:Number;
var _local23:b2ContactConstraintPoint;
_local5 = 0;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_invMass;
_local10 = _local7.m_invI;
_local11 = _local8.m_invMass;
_local12 = _local8.m_invI;
_local13 = _local6.normal.x;
_local14 = _local6.normal.y;
_local15 = _local14;
_local16 = -(_local13);
if (_arg1.warmStarting){
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local20 = _local6.points[_local18];
_local6.points[_local18].normalImpulse = (_local20.normalImpulse * _arg1.dtRatio);
_local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio);
_local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15));
_local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16));
_local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.r1.x * _local22) - (_local20.r1.y * _local21))));
_local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21));
_local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22));
_local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.r2.x * _local22) - (_local20.r2.y * _local21))));
_local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21));
_local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22));
_local18++;
};
} else {
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local23 = _local6.points[_local18];
_local23.normalImpulse = 0;
_local23.tangentImpulse = 0;
_local18++;
};
};
_local5++;
};
}
public function SolvePositionConstraints(_arg1:Number):Boolean{
var _local2:Number;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:int;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:b2Vec2;
var _local10:Number;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:int;
var _local20:int;
var _local21:b2ContactConstraintPoint;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
_local2 = 0;
_local5 = 0;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_sweep.c;
_local10 = _local7.m_sweep.a;
_local11 = _local8.m_sweep.c;
_local12 = _local8.m_sweep.a;
_local13 = (_local7.m_mass * _local7.m_invMass);
_local14 = (_local7.m_mass * _local7.m_invI);
_local15 = (_local8.m_mass * _local8.m_invMass);
_local16 = (_local8.m_mass * _local8.m_invI);
_local17 = _local6.normal.x;
_local18 = _local6.normal.y;
_local19 = _local6.pointCount;
_local20 = 0;
while (_local20 < _local19) {
_local21 = _local6.points[_local20];
_local3 = _local7.m_xf.R;
_local4 = _local7.m_sweep.localCenter;
_local22 = (_local21.localAnchor1.x - _local4.x);
_local23 = (_local21.localAnchor1.y - _local4.y);
_local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23));
_local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23));
_local22 = _local26;
_local3 = _local8.m_xf.R;
_local4 = _local8.m_sweep.localCenter;
_local24 = (_local21.localAnchor2.x - _local4.x);
_local25 = (_local21.localAnchor2.y - _local4.y);
_local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25));
_local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25));
_local24 = _local26;
_local27 = (_local9.x + _local22);
_local28 = (_local9.y + _local23);
_local29 = (_local11.x + _local24);
_local30 = (_local11.y + _local25);
_local31 = (_local29 - _local27);
_local32 = (_local30 - _local28);
_local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation);
_local2 = b2Math.b2Min(_local2, _local33);
_local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0));
_local35 = (-(_local21.equalizedMass) * _local34);
_local36 = _local21.positionImpulse;
_local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0);
_local35 = (_local21.positionImpulse - _local36);
_local37 = (_local35 * _local17);
_local38 = (_local35 * _local18);
_local9.x = (_local9.x - (_local13 * _local37));
_local9.y = (_local9.y - (_local13 * _local38));
_local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37))));
_local7.m_sweep.a = _local10;
_local7.SynchronizeTransform();
_local11.x = (_local11.x + (_local15 * _local37));
_local11.y = (_local11.y + (_local15 * _local38));
_local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37))));
_local8.m_sweep.a = _local12;
_local8.SynchronizeTransform();
_local20++;
};
_local5++;
};
return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop)));
}
public function SolveVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraintPoint;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:b2Mat22;
var _local18:b2Vec2;
var _local19:int;
var _local20:b2ContactConstraint;
var _local21:b2Body;
var _local22:b2Body;
var _local23:Number;
var _local24:Number;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:int;
var _local38:Number;
_local19 = 0;
while (_local19 < m_constraintCount) {
_local20 = m_constraints[_local19];
_local21 = _local20.body1;
_local22 = _local20.body2;
_local23 = _local21.m_angularVelocity;
_local24 = _local22.m_angularVelocity;
_local25 = _local21.m_linearVelocity;
_local26 = _local22.m_linearVelocity;
_local27 = _local21.m_invMass;
_local28 = _local21.m_invI;
_local29 = _local22.m_invMass;
_local30 = _local22.m_invI;
_local31 = _local20.normal.x;
_local32 = _local20.normal.y;
_local33 = _local32;
_local34 = -(_local31);
_local35 = _local20.friction;
_local37 = _local20.pointCount;
_local1 = 0;
while (_local1 < _local37) {
_local2 = _local20.points[_local1];
_local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y));
_local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x));
_local9 = ((_local7 * _local31) + (_local8 * _local32));
_local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias));
_local10 = ((_local7 * _local33) + (_local8 * _local34));
_local12 = (_local2.tangentMass * -(_local10));
_local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0);
_local11 = (_local13 - _local2.normalImpulse);
_local38 = (_local35 * _local2.normalImpulse);
_local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38);
_local12 = (_local14 - _local2.tangentImpulse);
_local15 = ((_local11 * _local31) + (_local12 * _local33));
_local16 = ((_local11 * _local32) + (_local12 * _local34));
_local25.x = (_local25.x - (_local27 * _local15));
_local25.y = (_local25.y - (_local27 * _local16));
_local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15))));
_local26.x = (_local26.x + (_local29 * _local15));
_local26.y = (_local26.y + (_local29 * _local16));
_local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15))));
_local2.normalImpulse = _local13;
_local2.tangentImpulse = _local14;
_local1++;
};
_local21.m_angularVelocity = _local23;
_local22.m_angularVelocity = _local24;
_local19++;
};
}
public function FinalizeVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
_local1 = 0;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2NullContact extends b2Contact {
override public function GetManifolds():Array{
return (null);
}
override public function Evaluate(_arg1:b2ContactListener):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
import Box2D.Collision.*;
public class b2PolyAndCircleContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
var _local3:b2ManifoldPoint;
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape));
b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape));
m_manifold.pointCount = 0;
_local3 = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2ManifoldPoint;
var _local6:b2Body;
var _local7:b2Body;
var _local8:Array;
var _local9:b2ContactPoint;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
_local6 = m_shape1.m_body;
_local7 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf);
_local8 = [false, false];
_local9 = s_evalCP;
_local9.shape1 = m_shape1;
_local9.shape2 = m_shape2;
_local9.friction = m_friction;
_local9.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local2 = 0;
while (_local2 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local2];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local8[_local13] == true){
} else {
_local5 = m0.points[_local13];
if (_local5.id._key == _local12){
_local8[_local13] = true;
_local10.normalImpulse = _local5.normalImpulse;
_local10.tangentImpulse = _local5.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Persist(_local9);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Add(_local9);
};
_local2++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local2 = 0;
while (_local2 < m0.pointCount) {
if (_local8[_local2]){
} else {
_local5 = m0.points[_local2];
_local9.position = _local6.GetWorldPoint(_local5.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m0.normal);
_local9.separation = _local5.separation;
_local9.id.key = _local5.id._key;
_arg1.Remove(_local9);
};
_local2++;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndCircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class b2PolygonContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{
m0 = new b2Manifold();
m_manifolds = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactPoint;
var _local8:int;
var _local9:Array;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
_local5 = m_shape1.m_body;
_local6 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf);
_local9 = [false, false];
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local8 = 0;
while (_local8 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local8];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local9[_local13] == true){
} else {
_local4 = m0.points[_local13];
if (_local4.id._key == _local12){
_local9[_local13] = true;
_local10.normalImpulse = _local4.normalImpulse;
_local10.tangentImpulse = _local4.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Persist(_local7);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Add(_local7);
};
_local8++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local8 = 0;
while (_local8 < m0.pointCount) {
if (_local9[_local8]){
} else {
_local4 = m0.points[_local8];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
_local8++;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolygonContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2DistanceJoint extends b2Joint {
public var m_mass:Number;
public var m_u:b2Vec2;
public var m_impulse:Number;
public var m_dampingRatio:Number;
public var m_frequencyHz:Number;
public var m_localAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_bias:Number;
public var m_gamma:Number;
public var m_length:Number;
public function b2DistanceJoint(_arg1:b2DistanceJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u = new b2Vec2();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_length = _arg1.length;
m_frequencyHz = _arg1.frequencyHz;
m_dampingRatio = _arg1.dampingRatio;
m_impulse = 0;
m_gamma = 0;
m_bias = 0;
m_inv_dt = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2;
_local1 = new b2Vec2();
_local1.SetV(m_u);
_local1.Multiply((m_inv_dt * m_impulse));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
if (m_frequencyHz > 0){
return (true);
};
_local2 = m_body1;
_local3 = m_body2;
_local1 = _local2.m_xf.R;
_local4 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5));
_local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5));
_local4 = _local6;
_local1 = _local3.m_xf.R;
_local7 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local8 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8));
_local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8));
_local7 = _local6;
_local9 = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4);
_local10 = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5);
_local11 = Math.sqrt(((_local9 * _local9) + (_local10 * _local10)));
_local9 = (_local9 / _local11);
_local10 = (_local10 / _local11);
_local12 = (_local11 - m_length);
_local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local13 = (-(m_mass) * _local12);
m_u.Set(_local9, _local10);
_local14 = (_local13 * m_u.x);
_local15 = (_local13 * m_u.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14))));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15));
_local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14))));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
m_inv_dt = _arg1.inv_dt;
_local4 = m_body1;
_local5 = m_body2;
_local2 = _local4.m_xf.R;
_local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7));
_local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7));
_local6 = _local3;
_local2 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6);
m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7);
_local10 = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y)));
if (_local10 > b2Settings.b2_linearSlop){
m_u.Multiply((1 / _local10));
} else {
m_u.SetZero();
};
_local11 = ((_local6 * m_u.y) - (_local7 * m_u.x));
_local12 = ((_local8 * m_u.y) - (_local9 * m_u.x));
_local13 = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12));
m_mass = (1 / _local13);
if (m_frequencyHz > 0){
_local14 = (_local10 - m_length);
_local15 = ((2 * Math.PI) * m_frequencyHz);
_local16 = (((2 * m_mass) * m_dampingRatio) * _local15);
_local17 = ((m_mass * _local15) * _local15);
m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17))));
m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma);
m_mass = (1 / (_local13 + m_gamma));
};
if (_arg1.warmStarting){
m_impulse = (m_impulse * _arg1.dtRatio);
_local18 = (m_impulse * m_u.x);
_local19 = (m_impulse * m_u.y);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19));
_local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18))));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19));
_local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18))));
} else {
m_impulse = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local3 = m_body1;
_local4 = m_body2;
_local2 = _local3.m_xf.R;
_local5 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6));
_local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6));
_local5 = _local7;
_local2 = _local4.m_xf.R;
_local8 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local7;
_local10 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6));
_local11 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5));
_local12 = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9));
_local13 = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8));
_local14 = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11)));
_local15 = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse)));
m_impulse = (m_impulse + _local15);
_local16 = (_local15 * m_u.x);
_local17 = (_local15 * m_u.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16))));
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17));
_local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
}
}
}//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2DistanceJointDef extends b2JointDef {
public var length:Number;
public var dampingRatio:Number;
public var frequencyHz:Number;
public var localAnchor2:b2Vec2;
public var localAnchor1:b2Vec2;
public function b2DistanceJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_distanceJoint;
length = 1;
frequencyHz = 0;
dampingRatio = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
var _local5:Number;
var _local6:Number;
body1 = _arg1;
body2 = _arg2;
localAnchor1.SetV(body1.GetLocalPoint(_arg3));
localAnchor2.SetV(body2.GetLocalPoint(_arg4));
_local5 = (_arg4.x - _arg3.x);
_local6 = (_arg4.y - _arg3.y);
length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
frequencyHz = 0;
dampingRatio = 0;
}
}
}//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2GearJoint extends b2Joint {
public var m_force:Number;
public var m_mass:Number;
public var m_prismatic1:b2PrismaticJoint;
public var m_prismatic2:b2PrismaticJoint;
public var m_ground1:b2Body;
public var m_ground2:b2Body;
public var m_constant:Number;
public var m_revolute1:b2RevoluteJoint;
public var m_revolute2:b2RevoluteJoint;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_ratio:Number;
public var m_J:b2Jacobian;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_J = new b2Jacobian();
super(_arg1);
_local2 = _arg1.joint1.m_type;
_local3 = _arg1.joint2.m_type;
m_revolute1 = null;
m_prismatic1 = null;
m_revolute2 = null;
m_prismatic2 = null;
m_ground1 = _arg1.joint1.m_body1;
m_body1 = _arg1.joint1.m_body2;
if (_local2 == b2Joint.e_revoluteJoint){
m_revolute1 = (_arg1.joint1 as b2RevoluteJoint);
m_groundAnchor1.SetV(m_revolute1.m_localAnchor1);
m_localAnchor1.SetV(m_revolute1.m_localAnchor2);
_local4 = m_revolute1.GetJointAngle();
} else {
m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint);
m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1);
m_localAnchor1.SetV(m_prismatic1.m_localAnchor2);
_local4 = m_prismatic1.GetJointTranslation();
};
m_ground2 = _arg1.joint2.m_body1;
m_body2 = _arg1.joint2.m_body2;
if (_local3 == b2Joint.e_revoluteJoint){
m_revolute2 = (_arg1.joint2 as b2RevoluteJoint);
m_groundAnchor2.SetV(m_revolute2.m_localAnchor1);
m_localAnchor2.SetV(m_revolute2.m_localAnchor2);
_local5 = m_revolute2.GetJointAngle();
} else {
m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint);
m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1);
m_localAnchor2.SetV(m_prismatic2.m_localAnchor2);
_local5 = m_prismatic2.GetJointTranslation();
};
m_ratio = _arg1.ratio;
m_constant = (_local4 + (m_ratio * _local5));
m_force = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2;
_local1 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = 0;
_local2 = m_body1;
_local3 = m_body2;
if (m_revolute1){
_local4 = m_revolute1.GetJointAngle();
} else {
_local4 = m_prismatic1.GetJointTranslation();
};
if (m_revolute2){
_local5 = m_revolute2.GetJointAngle();
} else {
_local5 = m_prismatic2.GetJointTranslation();
};
_local6 = (m_constant - (_local4 + (m_ratio * _local5)));
_local7 = (-(m_mass) * _local6);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y));
_local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((_local1 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local2 = m_ground1;
_local3 = m_ground2;
_local4 = m_body1;
_local5 = m_body2;
_local14 = 0;
m_J.SetZero();
if (m_revolute1){
m_J.angular1 = -1;
_local14 = (_local14 + _local4.m_invI);
} else {
_local10 = _local2.m_xf.R;
_local11 = m_prismatic1.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local4.m_xf.R;
_local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear1.Set(-(_local6), -(_local7));
m_J.angular1 = -(_local12);
_local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12)));
};
if (m_revolute2){
m_J.angular2 = -(m_ratio);
_local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI));
} else {
_local10 = _local3.m_xf.R;
_local11 = m_prismatic2.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7));
m_J.angular2 = (-(m_ratio) * _local12);
_local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12))));
};
m_mass = (1 / _local14);
if (_arg1.warmStarting){
_local15 = (_arg1.dt * m_force);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2));
} else {
m_force = 0;
};
}
override public function GetReactionTorque():Number{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = m_body2.m_xf.R;
_local2 = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x);
_local3 = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y);
_local4 = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3));
_local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3));
_local2 = _local4;
_local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x))));
return (_local4);
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local5 = ((-(_arg1.inv_dt) * m_mass) * _local4);
m_force = (m_force + _local5);
_local6 = (_arg1.dt * _local5);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2));
}
}
}//package Box2D.Dynamics.Joints
Section 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef)
package Box2D.Dynamics.Joints {
public class b2GearJointDef extends b2JointDef {
public var joint2:b2Joint;
public var joint1:b2Joint;
public var ratio:Number;
public function b2GearJointDef(){
type = b2Joint.e_gearJoint;
joint1 = null;
joint2 = null;
ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2Jacobian {
public var linear1:b2Vec2;
public var linear2:b2Vec2;
public var angular2:Number;
public var angular1:Number;
public function b2Jacobian(){
linear1 = new b2Vec2();
linear2 = new b2Vec2();
super();
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linear1.SetV(_arg1);
angular1 = _arg2;
linear2.SetV(_arg3);
angular2 = _arg4;
}
public function SetZero():void{
linear1.SetZero();
angular1 = 0;
linear2.SetZero();
angular2 = 0;
}
public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{
return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4)));
}
}
}//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2Joint {
public var m_islandFlag:Boolean;
public var m_body1:b2Body;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_type:int;
public var m_collideConnected:Boolean;
public var m_node1:b2JointEdge;
public var m_node2:b2JointEdge;
public var m_inv_dt:Number;
public var m_userData;
public var m_body2:b2Body;
public static const e_unknownJoint:int = 0;
public static const e_inactiveLimit:int = 0;
public static const e_atUpperLimit:int = 2;
public static const e_atLowerLimit:int = 1;
public static const e_gearJoint:int = 6;
public static const e_revoluteJoint:int = 1;
public static const e_equalLimits:int = 3;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_prismaticJoint:int = 2;
public static const e_mouseJoint:int = 5;
public function b2Joint(_arg1:b2JointDef){
m_node1 = new b2JointEdge();
m_node2 = new b2JointEdge();
super();
m_type = _arg1.type;
m_prev = null;
m_next = null;
m_body1 = _arg1.body1;
m_body2 = _arg1.body2;
m_collideConnected = _arg1.collideConnected;
m_islandFlag = false;
m_userData = _arg1.userData;
}
public function GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
}
public function GetType():int{
return (m_type);
}
public function GetBody2():b2Body{
return (m_body2);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetReactionTorque():Number{
return (0);
}
public function GetUserData(){
return (m_userData);
}
public function GetReactionForce():b2Vec2{
return (null);
}
public function SolvePositionConstraints():Boolean{
return (false);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetBody1():b2Body{
return (m_body1);
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function InitPositionConstraints():void{
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
_local3 = null;
switch (_arg1.type){
case e_distanceJoint:
_local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef));
break;
case e_mouseJoint:
_local3 = new b2MouseJoint((_arg1 as b2MouseJointDef));
break;
case e_prismaticJoint:
_local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef));
break;
case e_revoluteJoint:
_local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef));
break;
case e_pulleyJoint:
_local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef));
break;
case e_gearJoint:
_local3 = new b2GearJoint((_arg1 as b2GearJointDef));
break;
default:
break;
};
return (_local3);
}
}
}//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointDef {
public var collideConnected:Boolean;
public var body1:b2Body;
public var body2:b2Body;
public var userData;
public var type:int;
public function b2JointDef(){
type = b2Joint.e_unknownJoint;
userData = null;
body1 = null;
body2 = null;
collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointEdge {
public var joint:b2Joint;
public var other:b2Body;
public var next:b2JointEdge;
public var prev:b2JointEdge;
}
}//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2MouseJoint extends b2Joint {
public var m_beta:Number;
public var m_mass:b2Mat22;
public var m_target:b2Vec2;
public var m_impulse:b2Vec2;
public var m_localAnchor:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K:b2Mat22;
public var m_gamma:Number;
public var m_C:b2Vec2;
public var m_maxForce:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
var _local2:Number;
var _local3:Number;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
m_localAnchor = new b2Vec2();
m_target = new b2Vec2();
m_impulse = new b2Vec2();
m_mass = new b2Mat22();
m_C = new b2Vec2();
super(_arg1);
m_target.SetV(_arg1.target);
_local2 = (m_target.x - m_body2.m_xf.position.x);
_local3 = (m_target.y - m_body2.m_xf.position.y);
_local4 = m_body2.m_xf.R;
m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y));
m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y));
m_maxForce = _arg1.maxForce;
m_impulse.SetZero();
_local5 = m_body2.m_mass;
_local6 = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
_local7 = (((2 * _local5) * _arg1.dampingRatio) * _local6);
_local8 = ((_arg1.timeStep * _local5) * (_local6 * _local6));
m_gamma = (1 / (_local7 + _local8));
m_beta = (_local8 / (_local7 + _local8));
}
override public function GetAnchor1():b2Vec2{
return (m_target);
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor));
}
override public function GetReactionForce():b2Vec2{
return (m_impulse);
}
override public function SolvePositionConstraints():Boolean{
return (true);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local7 = _local2.m_invMass;
_local8 = _local2.m_invI;
K1.col1.x = _local7;
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = _local7;
K2.col1.x = ((_local8 * _local5) * _local5);
K2.col2.x = ((-(_local8) * _local4) * _local5);
K2.col1.y = ((-(_local8) * _local4) * _local5);
K2.col2.y = ((_local8 * _local4) * _local4);
K.SetM(K1);
K.AddM(K2);
K.col1.x = (K.col1.x + m_gamma);
K.col2.y = (K.col2.y + m_gamma);
K.Invert(m_mass);
m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x);
m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y);
_local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98);
_local9 = (_arg1.dt * m_impulse.x);
_local10 = (_arg1.dt * m_impulse.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9))));
}
override public function GetReactionTorque():Number{
return (0);
}
public function SetTarget(_arg1:b2Vec2):void{
if (m_body2.IsSleeping()){
m_body2.WakeUp();
};
m_target = _arg1;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local6 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7));
_local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7));
_local6 = _local4;
_local8 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7));
_local9 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6));
_local3 = m_mass;
_local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x));
_local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y));
_local10 = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)));
_local11 = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)));
_local12 = m_impulse.x;
_local13 = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
_local14 = m_impulse.Length();
if (_local14 > m_maxForce){
m_impulse.Multiply((m_maxForce / _local14));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
_local15 = (_arg1.dt * _local10);
_local16 = (_arg1.dt * _local11);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
}
}
}//package Box2D.Dynamics.Joints
Section 57
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2MouseJointDef extends b2JointDef {
public var frequencyHz:Number;
public var dampingRatio:Number;
public var maxForce:Number;
public var target:b2Vec2;
public var timeStep:Number;
public function b2MouseJointDef(){
target = new b2Vec2();
super();
type = b2Joint.e_mouseJoint;
maxForce = 0;
frequencyHz = 5;
dampingRatio = 0.7;
timeStep = (1 / 60);
}
}
}//package Box2D.Dynamics.Joints
Section 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PrismaticJoint extends b2Joint {
public var m_limitForce:Number;
public var m_refAngle:Number;
public var m_lowerTranslation:Number;
public var m_localXAxis1:b2Vec2;
public var m_torque:Number;
public var m_enableLimit:Boolean;
public var m_motorForce:Number;
public var m_force:Number;
public var m_localYAxis1:b2Vec2;
public var m_motorMass:Number;
public var m_maxMotorForce:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_angularMass:Number;
public var m_limitState:int;
public var m_linearMass:Number;
public var m_upperTranslation:Number;
public var m_motorJacobian:b2Jacobian;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_linearJacobian:b2Jacobian;
public var m_enableMotor:Boolean;
public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_localXAxis1 = new b2Vec2();
m_localYAxis1 = new b2Vec2();
m_linearJacobian = new b2Jacobian();
m_motorJacobian = new b2Jacobian();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_localXAxis1.SetV(_arg1.localAxis1);
m_localYAxis1.x = -(m_localXAxis1.y);
m_localYAxis1.y = m_localXAxis1.x;
m_refAngle = _arg1.referenceAngle;
m_linearJacobian.SetZero();
m_linearMass = 0;
m_force = 0;
m_angularMass = 0;
m_torque = 0;
m_motorJacobian.SetZero();
m_motorMass = 0;
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerTranslation = _arg1.lowerTranslation;
m_upperTranslation = _arg1.upperTranslation;
m_maxMotorForce = _arg1.maxMotorForce;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetUpperLimit():Number{
return (m_upperTranslation);
}
public function GetLowerLimit():Number{
return (m_lowerTranslation);
}
public function GetJointTranslation():Number{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:b2Vec2;
var _local9:Number;
_local1 = m_body1;
_local2 = m_body2;
_local4 = _local1.GetWorldPoint(m_localAnchor1);
_local5 = _local2.GetWorldPoint(m_localAnchor2);
_local6 = (_local5.x - _local4.x);
_local7 = (_local5.y - _local4.y);
_local8 = _local1.GetWorldVector(m_localXAxis1);
_local9 = ((_local8.x * _local6) + (_local8.y * _local7));
return (_local9);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerTranslation = _arg1;
m_upperTranslation = _arg2;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body1.m_xf.R;
_local2 = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y)));
_local3 = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y)));
_local4 = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y)));
_local5 = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y)));
return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5))));
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
_local3 = m_body1;
_local4 = m_body2;
_local5 = _local3.m_invMass;
_local6 = _local4.m_invMass;
_local7 = _local3.m_invI;
_local8 = _local4.m_invI;
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local21 = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
_local22 = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
_local23 = ((_local21 * _local19) + (_local22 * _local20));
_local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local24 = (-(m_linearMass) * _local23);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2));
_local25 = b2Math.b2Abs(_local23);
_local26 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle);
_local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local27 = (-(m_angularMass) * _local26);
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
_local28 = b2Math.b2Abs(_local26);
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y));
_local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y));
_local31 = ((_local29 * _local19) + (_local30 * _local20));
_local32 = 0;
if (m_limitState == e_equalLimits){
_local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26));
} else {
if (m_limitState == e_atLowerLimit){
_local1 = (_local31 - m_lowerTranslation);
_local25 = b2Math.b2Max(_local25, -(_local1));
_local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
} else {
if (m_limitState == e_atUpperLimit){
_local1 = (_local31 - m_upperTranslation);
_local25 = b2Math.b2Max(_local25, _local1);
_local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
};
};
};
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop))));
}
public function GetJointSpeed():Number{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:b2Vec2;
var _local16:b2Vec2;
var _local17:b2Vec2;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local1 = m_body1;
_local2 = m_body2;
_local3 = _local1.m_xf.R;
_local4 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local5 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local3 = _local2.m_xf.R;
_local7 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local8 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8));
_local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8));
_local7 = _local6;
_local9 = (_local1.m_sweep.c.x + _local4);
_local10 = (_local1.m_sweep.c.y + _local5);
_local11 = (_local2.m_sweep.c.x + _local7);
_local12 = (_local2.m_sweep.c.y + _local8);
_local13 = (_local11 - _local9);
_local14 = (_local12 - _local10);
_local15 = _local1.GetWorldVector(m_localXAxis1);
_local16 = _local1.m_linearVelocity;
_local17 = _local2.m_linearVelocity;
_local18 = _local1.m_angularVelocity;
_local19 = _local2.m_angularVelocity;
_local20 = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4)))));
return (_local20);
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
_local10 = _local2.m_invMass;
_local11 = _local3.m_invMass;
_local12 = _local2.m_invI;
_local13 = _local3.m_invI;
_local4 = _local2.m_xf.R;
_local14 = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y));
_local15 = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y));
_local16 = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x);
_local17 = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y);
m_linearJacobian.linear1.x = -(_local14);
m_linearJacobian.linear1.y = -(_local15);
m_linearJacobian.linear2.x = _local14;
m_linearJacobian.linear2.y = _local15;
m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14)));
m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14));
m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2));
m_linearMass = (1 / m_linearMass);
m_angularMass = (_local12 + _local13);
if (m_angularMass > Number.MIN_VALUE){
m_angularMass = (1 / m_angularMass);
};
if (((m_enableLimit) || (m_enableMotor))){
_local4 = _local2.m_xf.R;
_local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y));
_local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y));
m_motorJacobian.linear1.x = -(_local18);
m_motorJacobian.linear1.y = -(_local19);
m_motorJacobian.linear2.x = _local18;
m_motorJacobian.linear2.y = _local19;
m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18)));
m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18));
m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2));
m_motorMass = (1 / m_motorMass);
if (m_enableLimit){
_local20 = (_local16 - _local6);
_local21 = (_local17 - _local7);
_local22 = ((_local18 * _local20) + (_local19 * _local21));
if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local22 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local22 >= m_upperTranslation){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
};
};
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit == false){
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x)));
_local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y)));
_local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x)));
_local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y)));
_local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1)));
_local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2)));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28));
} else {
m_force = 0;
m_torque = 0;
m_limitForce = 0;
m_motorForce = 0;
};
m_limitPositionImpulse = 0;
}
public function GetMotorForce():Number{
return (m_motorForce);
}
public function SetMaxMotorForce(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
override public function GetReactionTorque():Number{
return (m_torque);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_invMass;
_local5 = _local3.m_invMass;
_local6 = _local2.m_invI;
_local7 = _local3.m_invI;
_local9 = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local10 = ((-(_arg1.inv_dt) * m_linearMass) * _local9);
m_force = (m_force + _local10);
_local11 = (_arg1.dt * _local10);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2));
_local12 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local13 = ((-(_arg1.inv_dt) * m_angularMass) * _local12);
m_torque = (m_torque + _local13);
_local14 = (_arg1.dt * _local13);
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed);
_local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15);
_local17 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce);
_local16 = (m_motorForce - _local17);
_local11 = (_arg1.dt * _local16);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local19);
} else {
if (m_limitState == e_atLowerLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
} else {
if (m_limitState == e_atUpperLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
};
};
};
_local11 = (_arg1.dt * _local19);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
}
}
}//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PrismaticJointDef extends b2JointDef {
public var localAxis1:b2Vec2;
public var referenceAngle:Number;
public var maxMotorForce:Number;
public var motorSpeed:Number;
public var upperTranslation:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public var lowerTranslation:Number;
public function b2PrismaticJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
localAxis1 = new b2Vec2();
super();
type = b2Joint.e_prismaticJoint;
localAxis1.Set(1, 0);
referenceAngle = 0;
enableLimit = false;
lowerTranslation = 0;
upperTranslation = 0;
enableMotor = false;
maxMotorForce = 0;
motorSpeed = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
localAxis1 = body1.GetLocalVector(_arg4);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PulleyJoint extends b2Joint {
public var m_ground:b2Body;
public var m_maxLength2:Number;
public var m_limitForce1:Number;
public var m_maxLength1:Number;
public var m_limitState1:int;
public var m_limitState2:int;
public var m_limitPositionImpulse2:Number;
public var m_force:Number;
public var m_limitPositionImpulse1:Number;
public var m_constant:Number;
public var m_state:int;
public var m_ratio:Number;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_positionImpulse:Number;
public var m_limitMass2:Number;
public var m_limitMass1:Number;
public var m_pulleyMass:Number;
public var m_u1:b2Vec2;
public var m_u2:b2Vec2;
public var m_limitForce2:Number;
public static const b2_minPulleyLength:Number = 2;
public function b2PulleyJoint(_arg1:b2PulleyJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u1 = new b2Vec2();
m_u2 = new b2Vec2();
super(_arg1);
m_ground = m_body1.m_world.m_groundBody;
m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x);
m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y);
m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x);
m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_ratio = _arg1.ratio;
m_constant = (_arg1.length1 + (m_ratio * _arg1.length2));
m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength)));
m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio));
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
}
public function GetGroundAnchor2():b2Vec2{
var _local1:b2Vec2;
_local1 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor2);
return (_local1);
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2;
_local1 = m_u2.Copy();
_local1.Multiply(m_force);
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
_local1 = m_body1;
_local2 = m_body2;
_local4 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local5 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local6 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local7 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
_local23 = 0;
if (m_state == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local16 = m_u1.Length();
_local17 = m_u2.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local16));
} else {
m_u1.SetZero();
};
if (_local17 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = ((m_constant - _local16) - (m_ratio * _local17));
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_pulleyMass) * _local18);
_local20 = m_positionImpulse;
m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19));
_local19 = (m_positionImpulse - _local20);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local14 = ((-(m_ratio) * _local19) * m_u2.x);
_local15 = ((-(m_ratio) * _local19) * m_u2.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local1.SynchronizeTransform();
_local2.SynchronizeTransform();
};
if (m_limitState1 == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
_local16 = m_u1.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.x = (m_u1.x * (1 / _local16));
m_u1.y = (m_u1.y * (1 / _local16));
} else {
m_u1.SetZero();
};
_local18 = (m_maxLength1 - _local16);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass1) * _local18);
_local21 = m_limitPositionImpulse1;
m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19));
_local19 = (m_limitPositionImpulse1 - _local21);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local1.SynchronizeTransform();
};
if (m_limitState2 == e_atUpperLimit){
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local17 = m_u2.Length();
if (_local17 > b2Settings.b2_linearSlop){
m_u2.x = (m_u2.x * (1 / _local17));
m_u2.y = (m_u2.y * (1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = (m_maxLength2 - _local17);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass2) * _local18);
_local21 = m_limitPositionImpulse2;
m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19));
_local19 = (m_limitPositionImpulse2 - _local21);
_local14 = (-(_local19) * m_u2.x);
_local15 = (-(_local19) * m_u2.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local2.SynchronizeTransform();
};
return ((_local23 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local5 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
_local10 = (_local2.m_sweep.c.x + _local5);
_local11 = (_local2.m_sweep.c.y + _local6);
_local12 = (_local3.m_sweep.c.x + _local8);
_local13 = (_local3.m_sweep.c.y + _local9);
_local14 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local15 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local16 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local17 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
m_u1.Set((_local10 - _local14), (_local11 - _local15));
m_u2.Set((_local12 - _local16), (_local13 - _local17));
_local18 = m_u1.Length();
_local19 = m_u2.Length();
if (_local18 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local18));
} else {
m_u1.SetZero();
};
if (_local19 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local19));
} else {
m_u2.SetZero();
};
_local20 = ((m_constant - _local18) - (m_ratio * _local19));
if (_local20 > 0){
m_state = e_inactiveLimit;
m_force = 0;
} else {
m_state = e_atUpperLimit;
m_positionImpulse = 0;
};
if (_local18 < m_maxLength1){
m_limitState1 = e_inactiveLimit;
m_limitForce1 = 0;
} else {
m_limitState1 = e_atUpperLimit;
m_limitPositionImpulse1 = 0;
};
if (_local19 < m_maxLength2){
m_limitState2 = e_inactiveLimit;
m_limitForce2 = 0;
} else {
m_limitState2 = e_atUpperLimit;
m_limitPositionImpulse2 = 0;
};
_local21 = ((_local5 * m_u1.y) - (_local6 * m_u1.x));
_local22 = ((_local8 * m_u2.y) - (_local9 * m_u2.x));
m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21));
m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22));
m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2));
m_limitMass1 = (1 / m_limitMass1);
m_limitMass2 = (1 / m_limitMass2);
m_pulleyMass = (1 / m_pulleyMass);
if (_arg1.warmStarting){
_local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x);
_local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y);
_local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x);
_local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25))));
} else {
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
public function GetRatio():Number{
return (m_ratio);
}
public function GetLength2():Number{
var _local1:b2Vec2;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body2.GetWorldPoint(m_localAnchor2);
_local2 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local3 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
_local4 = (_local1.x - _local2);
_local5 = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local5 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
if (m_state == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13))));
_local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18);
_local20 = m_force;
m_force = b2Math.b2Max(0, (m_force + _local19));
_local19 = (m_force - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x);
_local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
if (m_limitState1 == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18);
_local20 = m_limitForce1;
m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19));
_local19 = (m_limitForce1 - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
};
if (m_limitState2 == e_atUpperLimit){
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18);
_local20 = m_limitForce2;
m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19));
_local19 = (m_limitForce2 - _local20);
_local16 = ((-(_arg1.dt) * _local19) * m_u2.x);
_local17 = ((-(_arg1.dt) * _local19) * m_u2.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
}
public function GetLength1():Number{
var _local1:b2Vec2;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body1.GetWorldPoint(m_localAnchor1);
_local2 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local3 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local4 = (_local1.x - _local2);
_local5 = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetGroundAnchor1():b2Vec2{
var _local1:b2Vec2;
_local1 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor1);
return (_local1);
}
}
}//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PulleyJointDef extends b2JointDef {
public var maxLength2:Number;
public var length1:Number;
public var length2:Number;
public var maxLength1:Number;
public var ratio:Number;
public var groundAnchor1:b2Vec2;
public var groundAnchor2:b2Vec2;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public function b2PulleyJointDef(){
groundAnchor1 = new b2Vec2();
groundAnchor2 = new b2Vec2();
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_pulleyJoint;
groundAnchor1.Set(-1, 1);
groundAnchor2.Set(1, 1);
localAnchor1.Set(-1, 0);
localAnchor2.Set(1, 0);
length1 = 0;
maxLength1 = 0;
length2 = 0;
maxLength2 = 0;
ratio = 1;
collideConnected = true;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
body1 = _arg1;
body2 = _arg2;
groundAnchor1.SetV(_arg3);
groundAnchor2.SetV(_arg4);
localAnchor1 = body1.GetLocalPoint(_arg5);
localAnchor2 = body2.GetLocalPoint(_arg6);
_local8 = (_arg5.x - _arg3.x);
_local9 = (_arg5.y - _arg3.y);
length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local10 = (_arg6.x - _arg4.x);
_local11 = (_arg6.y - _arg4.y);
length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
ratio = _arg7;
_local12 = (length1 + (ratio * length2));
maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength));
maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio);
}
}
}//package Box2D.Dynamics.Joints
Section 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2RevoluteJoint extends b2Joint {
public var m_limitForce:Number;
public var m_motorForce:Number;
public var m_pivotMass:b2Mat22;
public var m_enableLimit:Boolean;
public var m_limitState:int;
public var m_motorMass:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K3:b2Mat22;
private var K:b2Mat22;
public var m_pivotForce:b2Vec2;
public var m_motorSpeed:Number;
public var m_enableMotor:Boolean;
public var m_limitPositionImpulse:Number;
public var m_maxMotorTorque:Number;
public var m_referenceAngle:Number;
public var m_lowerAngle:Number;
public var m_upperAngle:Number;
public static var tImpulse:b2Vec2 = new b2Vec2();
public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
K3 = new b2Mat22();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_pivotForce = new b2Vec2();
m_pivotMass = new b2Mat22();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_referenceAngle = _arg1.referenceAngle;
m_pivotForce.Set(0, 0);
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerAngle = _arg1.lowerAngle;
m_upperAngle = _arg1.upperAngle;
m_maxMotorTorque = _arg1.maxMotorTorque;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetUpperLimit():Number{
return (m_upperAngle);
}
public function GetLowerLimit():Number{
return (m_lowerAngle);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerAngle = _arg1;
m_upperAngle = _arg2;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
return (m_pivotForce);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local3 = m_body1;
_local4 = m_body2;
_local5 = 0;
_local6 = _local3.m_xf.R;
_local7 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local8 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8));
_local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8));
_local7 = _local9;
_local6 = _local4.m_xf.R;
_local10 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11));
_local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11));
_local10 = _local9;
_local12 = (_local3.m_sweep.c.x + _local7);
_local13 = (_local3.m_sweep.c.y + _local8);
_local14 = (_local4.m_sweep.c.x + _local10);
_local15 = (_local4.m_sweep.c.y + _local11);
_local16 = (_local14 - _local12);
_local17 = (_local15 - _local13);
_local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17)));
_local18 = _local3.m_invMass;
_local19 = _local4.m_invMass;
_local20 = _local3.m_invI;
_local21 = _local4.m_invI;
K1.col1.x = (_local18 + _local19);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local18 + _local19);
K2.col1.x = ((_local20 * _local8) * _local8);
K2.col2.x = ((-(_local20) * _local7) * _local8);
K2.col1.y = ((-(_local20) * _local7) * _local8);
K2.col2.y = ((_local20 * _local7) * _local7);
K3.col1.x = ((_local21 * _local11) * _local11);
K3.col2.x = ((-(_local21) * _local10) * _local11);
K3.col1.y = ((-(_local21) * _local10) * _local11);
K3.col2.y = ((_local21 * _local10) * _local10);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Solve(tImpulse, -(_local16), -(_local17));
_local22 = tImpulse.x;
_local23 = tImpulse.y;
_local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23));
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22))));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22))));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
_local24 = 0;
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle);
_local26 = 0;
if (m_limitState == e_equalLimits){
_local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local24 = b2Math.b2Abs(_local2);
} else {
if (m_limitState == e_atLowerLimit){
_local2 = (_local25 - m_lowerAngle);
_local24 = b2Math.b2Max(0, -(_local2));
_local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
} else {
if (m_limitState == e_atUpperLimit){
_local2 = (_local25 - m_upperAngle);
_local24 = b2Math.b2Max(0, _local2);
_local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
};
};
};
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop))));
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function SetMaxMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
public function GetJointAngle():Number{
return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
_local10 = _local2.m_invMass;
_local11 = _local3.m_invMass;
_local12 = _local2.m_invI;
_local13 = _local3.m_invI;
K1.col1.x = (_local10 + _local11);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local10 + _local11);
K2.col1.x = ((_local12 * _local7) * _local7);
K2.col2.x = ((-(_local12) * _local6) * _local7);
K2.col1.y = ((-(_local12) * _local6) * _local7);
K2.col2.y = ((_local12 * _local6) * _local6);
K3.col1.x = ((_local13 * _local9) * _local9);
K3.col2.x = ((-(_local13) * _local8) * _local9);
K3.col1.y = ((-(_local13) * _local8) * _local9);
K3.col2.y = ((_local13 * _local8) * _local8);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Invert(m_pivotMass);
m_motorMass = (1 / (_local12 + _local13));
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit){
_local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle);
if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
m_limitState = e_equalLimits;
} else {
if (_local14 <= m_lowerAngle){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local14 >= m_upperAngle){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
} else {
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
} else {
m_pivotForce.SetZero();
m_motorForce = 0;
m_limitForce = 0;
};
m_limitPositionImpulse = 0;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
public function GetMotorTorque():Number{
return (m_motorForce);
}
override public function GetReactionTorque():Number{
return (m_limitForce);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
_local11 = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7));
_local12 = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6));
_local13 = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12)));
_local14 = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12)));
m_pivotForce.x = (m_pivotForce.x + _local13);
m_pivotForce.y = (m_pivotForce.y + _local14);
_local15 = (_arg1.dt * _local13);
_local16 = (_arg1.dt * _local14);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15))));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed);
_local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17);
_local19 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque);
_local18 = (m_motorForce - _local19);
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local21);
} else {
if (m_limitState == e_atLowerLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
} else {
if (m_limitState == e_atUpperLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
};
};
};
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21));
};
}
}
}//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2RevoluteJointDef extends b2JointDef {
public var referenceAngle:Number;
public var upperAngle:Number;
public var lowerAngle:Number;
public var motorSpeed:Number;
public var maxMotorTorque:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public function b2RevoluteJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_revoluteJoint;
localAnchor1.Set(0, 0);
localAnchor2.Set(0, 0);
referenceAngle = 0;
lowerAngle = 0;
upperAngle = 0;
maxMotorTorque = 0;
motorSpeed = 0;
enableLimit = false;
enableMotor = false;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 64
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
public class b2Body {
public var m_next:b2Body;
public var m_contactList:b2ContactEdge;
public var m_angularVelocity:Number;
public var m_shapeList:b2Shape;
public var m_force:b2Vec2;
public var m_mass:Number;
public var m_sweep:b2Sweep;
public var m_xf:b2XForm;
public var m_torque:Number;
public var m_userData;
public var m_flags:uint;
public var m_world:b2World;
public var m_prev:b2Body;
public var m_invMass:Number;
public var m_type:int;
public var m_linearDamping:Number;
public var m_angularDamping:Number;
public var m_invI:Number;
public var m_linearVelocity:b2Vec2;
public var m_sleepTime:Number;
public var m_shapeCount:int;
public var m_jointList:b2JointEdge;
public var m_I:Number;
public static var e_fixedRotationFlag:uint = 64;
public static var e_frozenFlag:uint = 2;
public static var e_maxTypes:uint = 3;
public static var e_sleepFlag:uint = 8;
private static var s_massData:b2MassData = new b2MassData();
public static var e_bulletFlag:uint = 32;
public static var e_staticType:uint = 1;
public static var e_islandFlag:uint = 4;
public static var e_allowSleepFlag:uint = 16;
private static var s_xf1:b2XForm = new b2XForm();
public static var e_dynamicType:uint = 2;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
var _local3:b2Mat22;
var _local4:b2Vec2;
m_xf = new b2XForm();
m_sweep = new b2Sweep();
m_linearVelocity = new b2Vec2();
m_force = new b2Vec2();
super();
m_flags = 0;
if (_arg1.isBullet){
m_flags = (m_flags | e_bulletFlag);
};
if (_arg1.fixedRotation){
m_flags = (m_flags | e_fixedRotationFlag);
};
if (_arg1.allowSleep){
m_flags = (m_flags | e_allowSleepFlag);
};
if (_arg1.isSleeping){
m_flags = (m_flags | e_sleepFlag);
};
m_world = _arg2;
m_xf.position.SetV(_arg1.position);
m_xf.R.Set(_arg1.angle);
m_sweep.localCenter.SetV(_arg1.massData.center);
m_sweep.t0 = 1;
m_sweep.a0 = (m_sweep.a = _arg1.angle);
_local3 = m_xf.R;
_local4 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_jointList = null;
m_contactList = null;
m_prev = null;
m_next = null;
m_linearDamping = _arg1.linearDamping;
m_angularDamping = _arg1.angularDamping;
m_force.Set(0, 0);
m_torque = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_sleepTime = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.massData.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.massData.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
m_userData = _arg1.userData;
m_shapeList = null;
m_shapeCount = 0;
}
public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_arg1.x - m_sweep.c.x)))));
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function WakeUp():void{
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 0;
}
public function GetLocalCenter():b2Vec2{
return (m_sweep.localCenter);
}
public function ApplyTorque(_arg1:Number):void{
if (IsSleeping()){
WakeUp();
};
m_torque = (m_torque + _arg1);
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsDynamic():Boolean{
return ((m_type == e_dynamicType));
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
public function SynchronizeTransform():void{
var _local1:b2Mat22;
var _local2:b2Vec2;
m_xf.R.Set(m_sweep.a);
_local1 = m_xf.R;
_local2 = m_sweep.localCenter;
m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y)));
m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y)));
}
public function GetInertia():Number{
return (m_I);
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function SetMassFromShapes():void{
var _local1:b2Shape;
var _local2:Number;
var _local3:Number;
var _local4:b2MassData;
var _local5:b2Mat22;
var _local6:b2Vec2;
var _local7:int;
if (m_world.m_lock == true){
return;
};
m_mass = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
_local2 = 0;
_local3 = 0;
_local4 = s_massData;
_local1 = m_shapeList;
while (_local1) {
_local1.ComputeMass(_local4);
m_mass = (m_mass + _local4.mass);
_local2 = (_local2 + (_local4.mass * _local4.center.x));
_local3 = (_local3 + (_local4.mass * _local4.center.y));
m_I = (m_I + _local4.I);
_local1 = _local1.m_next;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
_local2 = (_local2 * m_invMass);
_local3 = (_local3 * m_invMass);
};
if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){
m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3))));
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
m_sweep.localCenter.Set(_local2, _local3);
_local5 = m_xf.R;
_local6 = m_sweep.localCenter;
m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local1 = m_shapeList;
while (_local1) {
_local1.UpdateSweepRadius(m_sweep.localCenter);
_local1 = _local1.m_next;
};
_local7 = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local7 != m_type){
_local1 = m_shapeList;
while (_local1) {
_local1.RefilterProxy(m_world.m_broadPhase, m_xf);
_local1 = _local1.m_next;
};
};
}
public function PutToSleep():void{
m_flags = (m_flags | e_sleepFlag);
m_sleepTime = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_force.SetZero();
m_torque = 0;
}
public function GetJointList():b2JointEdge{
return (m_jointList);
}
public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{
var _local3:b2Shape;
var _local4:b2Mat22;
var _local5:b2Vec2;
var _local6:Boolean;
var _local7:Boolean;
if (m_world.m_lock == true){
return (true);
};
if (IsFrozen()){
return (false);
};
m_xf.R.Set(_arg2);
m_xf.position.SetV(_arg1);
_local4 = m_xf.R;
_local5 = m_sweep.localCenter;
m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y));
m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_sweep.a0 = (m_sweep.a = _arg2);
_local6 = false;
_local3 = m_shapeList;
while (_local3) {
_local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf);
if (_local7 == false){
_local6 = true;
break;
};
_local3 = _local3.m_next;
};
if (_local6 == true){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local3 = m_shapeList;
while (_local3) {
_local3.DestroyProxy(m_world.m_broadPhase);
_local3 = _local3.m_next;
};
return (false);
};
m_world.m_broadPhase.Commit();
return (true);
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(m_xf, _arg1));
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_force.x = (m_force.x + _arg1.x);
m_force.y = (m_force.y + _arg1.y);
m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)));
}
public function SynchronizeShapes():Boolean{
var _local1:b2XForm;
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local4:b2Shape;
var _local5:Boolean;
_local1 = s_xf1;
_local1.R.Set(m_sweep.a0);
_local2 = _local1.R;
_local3 = m_sweep.localCenter;
_local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y)));
_local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y)));
_local5 = true;
_local4 = m_shapeList;
while (_local4) {
_local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf);
if (_local5 == false){
break;
};
_local4 = _local4.m_next;
};
if (_local5 == false){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local4 = m_shapeList;
while (_local4) {
_local4.DestroyProxy(m_world.m_broadPhase);
_local4 = _local4.m_next;
};
return (false);
};
return (true);
}
public function GetAngle():Number{
return (m_sweep.a);
}
public function GetXForm():b2XForm{
return (m_xf);
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x));
m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y));
m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))));
}
public function GetNext():b2Body{
return (m_next);
}
public function GetMass():Number{
return (m_mass);
}
public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22;
var _local3:b2Vec2;
_local2 = m_xf.R;
_local3 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x)))));
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SetMass(_arg1:b2MassData):void{
var _local2:b2Shape;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:int;
if (m_world.m_lock == true){
return;
};
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
m_sweep.localCenter.SetV(_arg1.center);
_local3 = m_xf.R;
_local4 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local2 = m_shapeList;
while (_local2) {
_local2.UpdateSweepRadius(m_sweep.localCenter);
_local2 = _local2.m_next;
};
_local5 = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local5 != m_type){
_local2 = m_shapeList;
while (_local2) {
_local2.RefilterProxy(m_world.m_broadPhase, m_xf);
_local2 = _local2.m_next;
};
};
}
public function IsStatic():Boolean{
return ((m_type == e_staticType));
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_xf.R, _arg1));
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function Advance(_arg1:Number):void{
m_sweep.Advance(_arg1);
m_sweep.c.SetV(m_sweep.c0);
m_sweep.a = m_sweep.a0;
SynchronizeTransform();
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_bulletFlag);
} else {
m_flags = (m_flags & ~(e_bulletFlag));
};
}
public function CreateShape(_arg1:b2ShapeDef):b2Shape{
var _local2:b2Shape;
if (m_world.m_lock == true){
return (null);
};
_local2 = b2Shape.Create(_arg1, m_world.m_blockAllocator);
_local2.m_next = m_shapeList;
m_shapeList = _local2;
m_shapeCount++;
_local2.m_body = this;
_local2.CreateProxy(m_world.m_broadPhase, m_xf);
_local2.UpdateSweepRadius(m_sweep.localCenter);
return (_local2);
}
public function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointEdge;
_local2 = m_jointList;
while (_local2) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
public function DestroyShape(_arg1:b2Shape):void{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:Boolean;
if (m_world.m_lock == true){
return;
};
_arg1.DestroyProxy(m_world.m_broadPhase);
_local2 = m_shapeList;
_local3 = null;
_local4 = false;
while (_local2 != null) {
if (_local2 == _arg1){
if (_local3){
_local3.m_next = _arg1.m_next;
} else {
m_shapeList = _arg1.m_next;
};
_local4 = true;
break;
};
_local3 = _local2;
_local2 = _local2.m_next;
};
_arg1.m_body = null;
_arg1.m_next = null;
m_shapeCount--;
b2Shape.Destroy(_arg1, m_world.m_blockAllocator);
}
public function GetUserData(){
return (m_userData);
}
public function IsBullet():Boolean{
return (((m_flags & e_bulletFlag) == e_bulletFlag));
}
public function GetWorldCenter():b2Vec2{
return (m_sweep.c);
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_xf.R, _arg1));
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22;
var _local3:b2Vec2;
_local2 = m_xf.R;
_local3 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (_local3);
}
public function GetWorld():b2World{
return (m_world);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
}
}//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2BodyDef {
public var isSleeping:Boolean;
public var position:b2Vec2;
public var isBullet:Boolean;
public var allowSleep:Boolean;
public var userData;
public var angularDamping:Number;
public var fixedRotation:Boolean;
public var angle:Number;
public var linearDamping:Number;
public var massData:b2MassData;
public function b2BodyDef(){
massData = new b2MassData();
position = new b2Vec2();
super();
massData.center.SetZero();
massData.mass = 0;
massData.I = 0;
userData = null;
position.Set(0, 0);
angle = 0;
linearDamping = 0;
angularDamping = 0;
allowSleep = true;
isSleeping = false;
fixedRotation = false;
isBullet = false;
}
}
}//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
public class b2ContactFilter {
public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter);
;
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData;
var _local4:b2FilterData;
var _local5:Boolean;
_local3 = _arg1.GetFilterData();
_local4 = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
_local5 = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
}
}//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactListener {
public function Add(_arg1:b2ContactPoint):void{
}
public function Remove(_arg1:b2ContactPoint):void{
}
public function Persist(_arg1:b2ContactPoint):void{
}
public function Result(_arg1:b2ContactResult):void{
}
}
}//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactManager extends b2PairCallback {
public var m_world:b2World;
public var m_destroyImmediate:Boolean;
public var m_nullContact:b2NullContact;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2ContactManager(){
m_nullContact = new b2NullContact();
super();
m_world = null;
m_destroyImmediate = false;
}
override public function PairAdded(_arg1, _arg2){
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2Contact;
_local3 = (_arg1 as b2Shape);
_local4 = (_arg2 as b2Shape);
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (m_nullContact);
};
if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){
return (m_nullContact);
};
_local7 = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator);
if (_local7 == null){
return (m_nullContact);
};
_local3 = _local7.m_shape1;
_local4 = _local7.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local7.m_prev = null;
_local7.m_next = m_world.m_contactList;
if (m_world.m_contactList != null){
m_world.m_contactList.m_prev = _local7;
};
m_world.m_contactList = _local7;
_local7.m_node1.contact = _local7;
_local7.m_node1.other = _local6;
_local7.m_node1.prev = null;
_local7.m_node1.next = _local5.m_contactList;
if (_local5.m_contactList != null){
_local5.m_contactList.prev = _local7.m_node1;
};
_local5.m_contactList = _local7.m_node1;
_local7.m_node2.contact = _local7;
_local7.m_node2.other = _local5;
_local7.m_node2.prev = null;
_local7.m_node2.next = _local6.m_contactList;
if (_local6.m_contactList != null){
_local6.m_contactList.prev = _local7.m_node2;
};
_local6.m_contactList = _local7.m_node2;
m_world.m_contactCount++;
return (_local7);
}
override public function PairRemoved(_arg1, _arg2, _arg3):void{
var _local4:b2Contact;
if (_arg3 == null){
return;
};
_local4 = (_arg3 as b2Contact);
if (_local4 == m_nullContact){
return;
};
Destroy(_local4);
}
public function Destroy(_arg1:b2Contact):void{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:int;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Array;
var _local10:b2ContactPoint;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2Vec2;
var _local16:b2Vec2;
_local2 = _arg1.m_shape1;
_local3 = _arg1.m_shape2;
_local4 = _arg1.m_manifoldCount;
if ((((_local4 > 0)) && (m_world.m_contactListener))){
_local7 = _local2.m_body;
_local8 = _local3.m_body;
_local9 = _arg1.GetManifolds();
_local10 = s_evalCP;
_local10.shape1 = _arg1.m_shape1;
_local10.shape2 = _arg1.m_shape1;
_local10.friction = _arg1.m_friction;
_local10.restitution = _arg1.m_restitution;
_local11 = 0;
while (_local11 < _local4) {
_local12 = _local9[_local11];
_local10.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local10.position = _local7.GetWorldPoint(_local14.localPoint1);
_local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1);
_local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2);
_local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y));
_local10.separation = _local14.separation;
_local10.id.key = _local14.id._key;
m_world.m_contactListener.Remove(_local10);
_local13++;
};
_local11++;
};
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_world.m_contactList){
m_world.m_contactList = _arg1.m_next;
};
_local5 = _local2.m_body;
_local6 = _local3.m_body;
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local5.m_contactList){
_local5.m_contactList = _arg1.m_node1.next;
};
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local6.m_contactList){
_local6.m_contactList = _arg1.m_node2.next;
};
b2Contact.Destroy(_arg1, m_world.m_blockAllocator);
m_world.m_contactCount--;
}
public function Collide():void{
var _local1:b2Contact;
var _local2:b2Body;
var _local3:b2Body;
_local1 = m_world.m_contactList;
while (_local1) {
_local2 = _local1.m_shape1.m_body;
_local3 = _local1.m_shape2.m_body;
if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){
} else {
_local1.Update(m_world.m_contactListener);
};
_local1 = _local1.m_next;
};
}
}
}//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
import flash.display.*;
public class b2DebugDraw {
public var m_xformScale:Number;// = 1
public var m_fillAlpha:Number;// = 1
public var m_alpha:Number;// = 1
public var m_lineThickness:Number;// = 1
public var m_drawFlags:uint;
public var m_sprite:Sprite;
public var m_drawScale:Number;// = 1
public static var e_coreShapeBit:uint = 4;
public static var e_shapeBit:uint = 1;
public static var e_centerOfMassBit:uint = 64;
public static var e_aabbBit:uint = 8;
public static var e_obbBit:uint = 16;
public static var e_pairBit:uint = 32;
public static var e_jointBit:uint = 2;
public function b2DebugDraw(){
m_drawScale = 1;
m_lineThickness = 1;
m_alpha = 1;
m_fillAlpha = 1;
m_xformScale = 1;
super();
m_drawFlags = 0;
}
public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
var _local4:int;
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha);
_local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.endFill();
}
public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
}
public function DrawXForm(_arg1:b2XForm):void{
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale));
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale));
}
public function ClearFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags & ~(_arg1));
}
public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha);
m_sprite.graphics.moveTo(0, 0);
m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
m_sprite.graphics.endFill();
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale));
}
public function SetFlags(_arg1:uint):void{
m_drawFlags = _arg1;
}
public function AppendFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags | _arg1);
}
public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale));
}
public function GetFlags():uint{
return (m_drawFlags);
}
public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
var _local4:int;
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
_local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
}
}
}//package Box2D.Dynamics
Section 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Joints.*;
public class b2DestructionListener {
public function SayGoodbyeJoint(_arg1:b2Joint):void{
}
public function SayGoodbyeShape(_arg1:b2Shape):void{
}
}
}//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Common.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2Island {
public var m_joints:Array;
public var m_listener:b2ContactListener;
public var m_positionIterationCount:int;
public var m_bodyCapacity:int;
public var m_bodies:Array;
public var m_jointCapacity:int;
public var m_contactCount:int;
public var m_contacts:Array;
public var m_contactCapacity:int;
public var m_jointCount:int;
public var m_allocator;
public var m_bodyCount:int;
private static var s_reportCR:b2ContactResult = new b2ContactResult();
public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){
var _local6:int;
super();
m_bodyCapacity = _arg1;
m_contactCapacity = _arg2;
m_jointCapacity = _arg3;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_allocator = _arg4;
m_listener = _arg5;
m_bodies = new Array(_arg1);
_local6 = 0;
while (_local6 < _arg1) {
m_bodies[_local6] = null;
_local6++;
};
m_contacts = new Array(_arg2);
_local6 = 0;
while (_local6 < _arg2) {
m_contacts[_local6] = null;
_local6++;
};
m_joints = new Array(_arg3);
_local6 = 0;
while (_local6 < _arg3) {
m_joints[_local6] = null;
_local6++;
};
m_positionIterationCount = 0;
}
public function AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
public function Report(_arg1:Array):void{
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local4:int;
var _local5:b2Contact;
var _local6:b2ContactConstraint;
var _local7:b2ContactResult;
var _local8:b2Body;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2ContactConstraintPoint;
if (m_listener == null){
return;
};
_local4 = 0;
while (_local4 < m_contactCount) {
_local5 = m_contacts[_local4];
_local6 = _arg1[_local4];
_local7 = s_reportCR;
_local7.shape1 = _local5.m_shape1;
_local7.shape2 = _local5.m_shape2;
_local8 = _local7.shape1.m_body;
_local9 = _local5.m_manifoldCount;
_local10 = _local5.GetManifolds();
_local11 = 0;
while (_local11 < _local9) {
_local12 = _local10[_local11];
_local7.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local15 = _local6.points[_local13];
_local7.position = _local8.GetWorldPoint(_local14.localPoint1);
_local7.normalImpulse = _local15.normalImpulse;
_local7.tangentImpulse = _local15.tangentImpulse;
_local7.id.key = _local14.id.key;
m_listener.Result(_local7);
_local13++;
};
_local11++;
};
_local4++;
};
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{
var _local5:int;
var _local6:b2Body;
var _local7:b2Joint;
var _local8:b2ContactSolver;
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y))));
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_force.SetZero();
_local6.m_torque = 0;
_local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity);
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity);
};
if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity);
} else {
_local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity;
};
};
};
_local5++;
};
_local8 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local8.InitVelocityConstraints(_arg1);
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitVelocityConstraints(_arg1);
_local5++;
};
_local5 = 0;
while (_local5 < _arg1.maxIterations) {
_local8.SolveVelocityConstraints();
_local9 = 0;
while (_local9 < m_jointCount) {
_local7 = m_joints[_local9];
_local7.SolveVelocityConstraints(_arg1);
_local9++;
};
_local5++;
};
_local8.FinalizeVelocityConstraints();
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_sweep.c0.SetV(_local6.m_sweep.c);
_local6.m_sweep.a0 = _local6.m_sweep.a;
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y));
_local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity));
_local6.SynchronizeTransform();
};
_local5++;
};
if (_arg3){
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitPositionConstraints();
_local5++;
};
m_positionIterationCount = 0;
while (m_positionIterationCount < _arg1.maxIterations) {
_local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local11 = true;
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local12 = _local7.SolvePositionConstraints();
_local11 = ((_local11) && (_local12));
_local5++;
};
if (((_local10) && (_local11))){
break;
};
m_positionIterationCount++;
};
};
Report(_local8.m_constraints);
if (_arg4){
_local13 = Number.MAX_VALUE;
_local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.m_invMass == 0){
} else {
if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){
_local6.m_sleepTime = 0;
_local13 = 0;
};
if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){
_local6.m_sleepTime = 0;
_local13 = 0;
} else {
_local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt);
_local13 = b2Math.b2Min(_local13, _local6.m_sleepTime);
};
};
_local5++;
};
if (_local13 >= b2Settings.b2_timeToSleep){
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag);
_local6.m_linearVelocity.SetZero();
_local6.m_angularVelocity = 0;
_local5++;
};
};
};
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:int;
var _local3:b2ContactSolver;
var _local4:Number;
var _local5:b2Body;
var _local6:Boolean;
_local3 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local3.SolveVelocityConstraints();
_local2++;
};
_local2 = 0;
while (_local2 < m_bodyCount) {
_local5 = m_bodies[_local2];
if (_local5.IsStatic()){
} else {
_local5.m_sweep.c0.SetV(_local5.m_sweep.c);
_local5.m_sweep.a0 = _local5.m_sweep.a;
_local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y));
_local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity));
_local5.SynchronizeTransform();
};
_local2++;
};
_local4 = 0.75;
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local6 = _local3.SolvePositionConstraints(_local4);
if (_local6){
break;
};
_local2++;
};
Report(_local3.m_constraints);
}
}
}//package Box2D.Dynamics
Section 73
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var warmStarting:Boolean;
public var positionCorrection:Boolean;
public var dt:Number;
public var maxIterations:int;
public var dtRatio:Number;
public var inv_dt:Number;
}
}//package Box2D.Dynamics
Section 74
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Common.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2World {
public var m_inv_dt0:Number;
public var m_boundaryListener:b2BoundaryListener;
public var m_contactList:b2Contact;
public var m_blockAllocator;
public var m_contactListener:b2ContactListener;
public var m_allowSleep:Boolean;
public var m_broadPhase:b2BroadPhase;
public var m_destructionListener:b2DestructionListener;
public var m_jointCount:int;
public var m_bodyCount:int;
public var m_lock:Boolean;
public var m_positionIterationCount:int;
public var m_groundBody:b2Body;
public var m_contactCount:int;
public var m_debugDraw:b2DebugDraw;
public var m_contactFilter:b2ContactFilter;
public var m_bodyList:b2Body;
public var m_stackAllocator;
public var m_jointList:b2Joint;
public var m_gravity:b2Vec2;
public var m_contactManager:b2ContactManager;
private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8);
public static var m_continuousPhysics:Boolean;
public static var m_warmStarting:Boolean;
private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6);
public static var m_positionCorrection:Boolean;
private static var s_xf:b2XForm = new b2XForm();
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
var _local4:b2BodyDef;
m_contactManager = new b2ContactManager();
super();
m_destructionListener = null;
m_boundaryListener = null;
m_contactFilter = b2ContactFilter.b2_defaultFilter;
m_contactListener = null;
m_debugDraw = null;
m_bodyList = null;
m_contactList = null;
m_jointList = null;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_positionCorrection = true;
m_warmStarting = true;
m_continuousPhysics = true;
m_allowSleep = _arg3;
m_gravity = _arg2;
m_lock = false;
m_inv_dt0 = 0;
m_contactManager.m_world = this;
m_broadPhase = new b2BroadPhase(_arg1, m_contactManager);
_local4 = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function DrawJoint(_arg1:b2Joint):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2XForm;
var _local5:b2XForm;
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Color;
var _local11:b2PulleyJoint;
var _local12:b2Vec2;
var _local13:b2Vec2;
_local2 = _arg1.m_body1;
_local3 = _arg1.m_body2;
_local4 = _local2.m_xf;
_local5 = _local3.m_xf;
_local6 = _local4.position;
_local7 = _local5.position;
_local8 = _arg1.GetAnchor1();
_local9 = _arg1.GetAnchor2();
_local10 = s_jointColor;
switch (_arg1.m_type){
case b2Joint.e_distanceJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
case b2Joint.e_pulleyJoint:
_local11 = (_arg1 as b2PulleyJoint);
_local12 = _local11.GetGroundAnchor1();
_local13 = _local11.GetGroundAnchor2();
m_debugDraw.DrawSegment(_local12, _local8, _local10);
m_debugDraw.DrawSegment(_local13, _local9, _local10);
m_debugDraw.DrawSegment(_local12, _local13, _local10);
break;
case b2Joint.e_mouseJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
default:
if (_local2 != m_groundBody){
m_debugDraw.DrawSegment(_local6, _local8, _local10);
};
m_debugDraw.DrawSegment(_local8, _local9, _local10);
if (_local3 != m_groundBody){
m_debugDraw.DrawSegment(_local7, _local9, _local10);
};
};
}
public function Refilter(_arg1:b2Shape):void{
_arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf);
}
public function SetDebugDraw(_arg1:b2DebugDraw):void{
m_debugDraw = _arg1;
}
public function SetContinuousPhysics(_arg1:Boolean):void{
m_continuousPhysics = _arg1;
}
public function GetProxyCount():int{
return (m_broadPhase.m_proxyCount);
}
public function DrawDebugData():void{
var _local1:uint;
var _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
var _local5:b2Joint;
var _local6:b2BroadPhase;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Color;
var _local11:b2XForm;
var _local12:b2AABB;
var _local13:b2AABB;
var _local14:Array;
var _local15:Boolean;
var _local16:uint;
var _local17:b2Pair;
var _local18:b2Proxy;
var _local19:b2Proxy;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:b2Proxy;
var _local23:b2PolygonShape;
var _local24:b2OBB;
var _local25:b2Vec2;
var _local26:b2Mat22;
var _local27:b2Vec2;
var _local28:Number;
if (m_debugDraw == null){
return;
};
m_debugDraw.m_sprite.graphics.clear();
_local1 = m_debugDraw.GetFlags();
_local7 = new b2Vec2();
_local8 = new b2Vec2();
_local9 = new b2Vec2();
_local10 = new b2Color(0, 0, 0);
_local12 = new b2AABB();
_local13 = new b2AABB();
_local14 = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
if ((_local1 & b2DebugDraw.e_shapeBit)){
_local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local3.IsStatic()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15);
} else {
if (_local3.IsSleeping()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15);
} else {
DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15);
};
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_jointBit)){
_local5 = m_jointList;
while (_local5) {
DrawJoint(_local5);
_local5 = _local5.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local6 = m_broadPhase;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.9, 0.3);
_local2 = 0;
while (_local2 < b2Pair.b2_tableCapacity) {
_local16 = _local6.m_pairManager.m_hashTable[_local2];
while (_local16 != b2Pair.b2_nullPair) {
_local17 = _local6.m_pairManager.m_pairs[_local16];
_local18 = _local6.m_proxyPool[_local17.proxyId1];
_local19 = _local6.m_proxyPool[_local17.proxyId2];
_local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value));
_local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value));
_local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value));
_local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value));
_local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value));
_local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value));
_local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value));
_local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value));
_local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x));
_local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y));
_local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x));
_local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y));
m_debugDraw.DrawSegment(_local8, _local9, _local10);
_local16 = _local17.next;
};
_local2++;
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local6 = m_broadPhase;
_local20 = _local6.m_worldAABB.lowerBound;
_local21 = _local6.m_worldAABB.upperBound;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.3, 0.9);
_local2 = 0;
while (_local2 < b2Settings.b2_maxProxies) {
_local22 = _local6.m_proxyPool[_local2];
if (_local22.IsValid() == false){
} else {
_local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value));
_local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value));
_local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value));
_local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value));
_local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y);
_local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y);
_local14[2].Set(_local12.upperBound.x, _local12.upperBound.y);
_local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y);
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local2++;
};
_local14[0].Set(_local20.x, _local20.y);
_local14[1].Set(_local21.x, _local20.y);
_local14[2].Set(_local21.x, _local21.y);
_local14[3].Set(_local20.x, _local21.y);
m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9));
};
if ((_local1 & b2DebugDraw.e_obbBit)){
_local10.Set(0.5, 0.3, 0.5);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local4.m_type != b2Shape.e_polygonShape){
} else {
_local23 = (_local4 as b2PolygonShape);
_local24 = _local23.GetOBB();
_local25 = _local24.extents;
_local14[0].Set(-(_local25.x), -(_local25.y));
_local14[1].Set(_local25.x, -(_local25.y));
_local14[2].Set(_local25.x, _local25.y);
_local14[3].Set(-(_local25.x), _local25.y);
_local2 = 0;
while (_local2 < 4) {
_local26 = _local24.R;
_local27 = _local14[_local2];
_local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local26 = _local11.R;
_local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local2++;
};
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_centerOfMassBit)){
_local3 = m_bodyList;
while (_local3) {
_local11 = s_xf;
_local11.R = _local3.m_xf.R;
_local11.position = _local3.GetWorldCenter();
m_debugDraw.DrawXForm(_local11);
_local3 = _local3.m_next;
};
};
}
public function DestroyBody(_arg1:b2Body):void{
var _local2:b2JointEdge;
var _local3:b2Shape;
var _local4:b2JointEdge;
var _local5:b2Shape;
if (m_lock == true){
return;
};
_local2 = _arg1.m_jointList;
while (_local2) {
_local4 = _local2;
_local2 = _local2.next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeJoint(_local4.joint);
};
DestroyJoint(_local4.joint);
};
_local3 = _arg1.m_shapeList;
while (_local3) {
_local5 = _local3;
_local3 = _local3.m_next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeShape(_local5);
};
_local5.DestroyProxy(m_broadPhase);
b2Shape.Destroy(_local5, m_blockAllocator);
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_bodyList){
m_bodyList = _arg1.m_next;
};
m_bodyCount--;
}
public function SetContactFilter(_arg1:b2ContactFilter):void{
m_contactFilter = _arg1;
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{
var _local5:b2Color;
var _local6:b2CircleShape;
var _local7:b2Vec2;
var _local8:Number;
var _local9:b2Vec2;
var _local10:int;
var _local11:b2PolygonShape;
var _local12:int;
var _local13:Array;
var _local14:Array;
var _local15:Array;
_local5 = s_coreColor;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local6 = (_arg1 as b2CircleShape);
_local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition);
_local8 = _local6.m_radius;
_local9 = _arg2.R.col1;
m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3);
if (_arg4){
m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5);
};
break;
case b2Shape.e_polygonShape:
_local11 = (_arg1 as b2PolygonShape);
_local12 = _local11.GetVertexCount();
_local13 = _local11.GetVertices();
_local14 = new Array(b2Settings.b2_maxPolygonVertices);
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]);
_local10++;
};
m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3);
if (_arg4){
_local15 = _local11.GetCoreVertices();
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]);
_local10++;
};
m_debugDraw.DrawPolygon(_local14, _local12, _local5);
};
break;
};
}
public function GetContactCount():int{
return (m_contactCount);
}
public function Solve(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Island;
var _local4:b2Contact;
var _local5:b2Joint;
var _local6:int;
var _local7:Array;
var _local8:b2Body;
var _local9:int;
var _local10:int;
var _local11:b2Body;
var _local12:b2ContactEdge;
var _local13:b2JointEdge;
var _local14:Boolean;
m_positionIterationCount = 0;
_local3 = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2 = _local2.m_next;
};
_local4 = m_contactList;
while (_local4) {
_local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag));
_local4 = _local4.m_next;
};
_local5 = m_jointList;
while (_local5) {
_local5.m_islandFlag = false;
_local5 = _local5.m_next;
};
_local6 = m_bodyCount;
_local7 = new Array(_local6);
_local8 = m_bodyList;
while (_local8) {
if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){
} else {
if (_local8.IsStatic()){
} else {
_local3.Clear();
_local9 = 0;
var _temp1 = _local9;
_local9 = (_local9 + 1);
var _local15 = _temp1;
_local7[_local15] = _local8;
_local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag);
while (_local9 > 0) {
--_local9;
_local2 = _local7[_local9];
_local3.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local12 = _local2.m_contactList;
while (_local12) {
if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){
} else {
if (_local12.contact.m_manifoldCount == 0){
} else {
_local3.AddContact(_local12.contact);
_local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag);
_local11 = _local12.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local9;
_local9 = (_local9 + 1);
var _local16 = _temp2;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
};
_local12 = _local12.next;
};
_local13 = _local2.m_jointList;
while (_local13) {
if (_local13.joint.m_islandFlag == true){
} else {
_local3.AddJoint(_local13.joint);
_local13.joint.m_islandFlag = true;
_local11 = _local13.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local9;
_local9 = (_local9 + 1);
_local16 = _temp3;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
_local13 = _local13.next;
};
};
};
_local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep);
if (_local3.m_positionIterationCount > m_positionIterationCount){
m_positionIterationCount = _local3.m_positionIterationCount;
};
_local10 = 0;
while (_local10 < _local3.m_bodyCount) {
_local2 = _local3.m_bodies[_local10];
if (_local2.IsStatic()){
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
};
_local10++;
};
};
};
_local8 = _local8.m_next;
};
_local2 = m_bodyList;
while (_local2) {
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local14 = _local2.SynchronizeShapes();
if ((((_local14 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
};
};
_local2 = _local2.m_next;
};
m_broadPhase.Commit();
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array;
var _local5:int;
var _local6:int;
_local4 = new Array(_arg3);
_local5 = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
_local6 = 0;
while (_local6 < _local5) {
_arg2[_local6] = _local4[_local6];
_local6++;
};
return (_local5);
}
public function SetGravity(_arg1:b2Vec2):void{
m_gravity = _arg1;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local8:b2Island;
var _local9:int;
var _local10:Array;
var _local11:b2Contact;
var _local12:b2Contact;
var _local13:Number;
var _local14:b2Body;
var _local15:int;
var _local16:b2TimeStep;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:b2Body;
var _local21:Boolean;
_local8 = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener);
_local9 = m_bodyCount;
_local10 = new Array(_local9);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2.m_sweep.t0 = 0;
_local2 = _local2.m_next;
};
_local11 = m_contactList;
while (_local11) {
_local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local11 = _local11.m_next;
};
while (true) {
_local12 = null;
_local13 = 1;
_local11 = m_contactList;
for (;_local11;(_local11 = _local11.m_next)) {
if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){
} else {
_local18 = 1;
if ((_local11.m_flags & b2Contact.e_toiFlag)){
_local18 = _local11.m_toi;
} else {
_local3 = _local11.m_shape1;
_local4 = _local11.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){
continue;
};
_local19 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local19 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local19);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local19 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local19);
};
};
_local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep);
if ((((_local18 > 0)) && ((_local18 < 1)))){
_local18 = (((1 - _local18) * _local19) + _local18);
if (_local18 > 1){
_local18 = 1;
};
};
_local11.m_toi = _local18;
_local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){
_local12 = _local11;
_local13 = _local18;
};
};
};
if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){
break;
};
_local3 = _local12.m_shape1;
_local4 = _local12.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local5.Advance(_local13);
_local6.Advance(_local13);
_local12.Update(m_contactListener);
_local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag));
if (_local12.m_manifoldCount == 0){
} else {
_local14 = _local5;
if (_local14.IsStatic()){
_local14 = _local6;
};
_local8.Clear();
_local15 = 0;
var _temp1 = _local15;
_local15 = (_local15 + 1);
var _local22 = _temp1;
_local10[_local22] = _local14;
_local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag);
while (_local15 > 0) {
--_local15;
_local2 = _local10[_local15];
_local8.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local8.m_contactCount == _local8.m_contactCapacity){
} else {
if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){
} else {
if (_local7.contact.m_manifoldCount == 0){
} else {
_local8.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local20 = _local7.other;
if ((_local20.m_flags & b2Body.e_islandFlag)){
} else {
if (_local20.IsStatic() == false){
_local20.Advance(_local13);
_local20.WakeUp();
};
var _temp2 = _local15;
_local15 = (_local15 + 1);
var _local23 = _temp2;
_local10[_local23] = _local20;
_local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local7 = _local7.next;
};
};
};
_local16 = new b2TimeStep();
_local16.dt = ((1 - _local13) * _arg1.dt);
_local16.inv_dt = (1 / _local16.dt);
_local16.maxIterations = _arg1.maxIterations;
_local8.SolveTOI(_local16);
_local17 = 0;
while (_local17 < _local8.m_bodyCount) {
_local2 = _local8.m_bodies[_local17];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local21 = _local2.SynchronizeShapes();
if ((((_local21 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
_local7 = _local2.m_contactList;
while (_local7) {
_local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag));
_local7 = _local7.next;
};
};
};
_local17++;
};
_local17 = 0;
while (_local17 < _local8.m_contactCount) {
_local11 = _local8.m_contacts[_local17];
_local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local17++;
};
m_broadPhase.Commit();
};
};
}
public function GetJointList():b2Joint{
return (m_jointList);
}
public function Validate():void{
m_broadPhase.Validate();
}
public function GetPairCount():int{
return (m_broadPhase.m_pairManager.m_pairCount);
}
public function GetBodyList():b2Body{
return (m_bodyList);
}
public function SetWarmStarting(_arg1:Boolean):void{
m_warmStarting = _arg1;
}
public function SetPositionCorrection(_arg1:Boolean):void{
m_positionCorrection = _arg1;
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local2:b2Joint;
var _local3:b2Body;
var _local4:b2Shape;
_local2 = b2Joint.Create(_arg1, m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_node1.joint = _local2;
_local2.m_node1.other = _local2.m_body2;
_local2.m_node1.prev = null;
_local2.m_node1.next = _local2.m_body1.m_jointList;
if (_local2.m_body1.m_jointList){
_local2.m_body1.m_jointList.prev = _local2.m_node1;
};
_local2.m_body1.m_jointList = _local2.m_node1;
_local2.m_node2.joint = _local2;
_local2.m_node2.other = _local2.m_body1;
_local2.m_node2.prev = null;
_local2.m_node2.next = _local2.m_body2.m_jointList;
if (_local2.m_body2.m_jointList){
_local2.m_body2.m_jointList.prev = _local2.m_node2;
};
_local2.m_body2.m_jointList = _local2.m_node2;
if (_arg1.collideConnected == false){
_local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.RefilterProxy(m_broadPhase, _local3.m_xf);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local2:Boolean;
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Body;
var _local6:b2Shape;
_local2 = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_jointList){
m_jointList = _arg1.m_next;
};
_local3 = _arg1.m_body1;
_local4 = _arg1.m_body2;
_local3.WakeUp();
_local4.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local4.m_jointList){
_local4.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, m_blockAllocator);
m_jointCount--;
if (_local2 == false){
_local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.RefilterProxy(m_broadPhase, _local5.m_xf);
_local6 = _local6.m_next;
};
};
}
public function SetContactListener(_arg1:b2ContactListener):void{
m_contactListener = _arg1;
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
var _local2:b2Body;
if (m_lock == true){
return (null);
};
_local2 = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
public function SetBoundaryListener(_arg1:b2BoundaryListener):void{
m_boundaryListener = _arg1;
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function Step(_arg1:Number, _arg2:int):void{
var _local3:b2TimeStep;
m_lock = true;
_local3 = new b2TimeStep();
_local3.dt = _arg1;
_local3.maxIterations = _arg2;
if (_arg1 > 0){
_local3.inv_dt = (1 / _arg1);
} else {
_local3.inv_dt = 0;
};
_local3.dtRatio = (m_inv_dt0 * _arg1);
_local3.positionCorrection = m_positionCorrection;
_local3.warmStarting = m_warmStarting;
m_contactManager.Collide();
if (_local3.dt > 0){
Solve(_local3);
};
if (((m_continuousPhysics) && ((_local3.dt > 0)))){
SolveTOI(_local3);
};
DrawDebugData();
m_inv_dt0 = _local3.inv_dt;
m_lock = false;
}
public function GetBodyCount():int{
return (m_bodyCount);
}
public function GetJointCount():int{
return (m_jointCount);
}
}
}//package Box2D.Dynamics
Section 75
//ag_intro_mc_41 (SWAIN_TheGreaterGood8_fla.ag_intro_mc_41)
package SWAIN_TheGreaterGood8_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class ag_intro_mc_41 extends MovieClip {
public function ag_intro_mc_41(){
addFrameScript(0, frame1, 160, frame161);
}
function frame161(){
MovieClip(parent).gotoFrame(MovieClip(parent), "TITLE");
stop();
}
function frame1(){
MovieClip(parent).stop();
gotoAndPlay(2);
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 76
//CREDITSMASK_95 (SWAIN_TheGreaterGood8_fla.CREDITSMASK_95)
package SWAIN_TheGreaterGood8_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class CREDITSMASK_95 extends MovieClip {
public function CREDITSMASK_95(){
addFrameScript(842, frame843);
}
function frame843(){
stop();
stop();
MovieClip(parent.parent).gotoMap = false;
MovieClip(parent.parent).gotoFrame(MovieClip(parent.parent), "TITLE");
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 77
//CreditsScreen_69 (SWAIN_TheGreaterGood8_fla.CreditsScreen_69)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class CreditsScreen_69 extends MovieClip {
public var dateString:String;
public var date:Date;
public function CreditsScreen_69(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
date = new Date();
dateString = "";
dateString = (dateString + date.fullYear);
if (date.month < 10){
dateString = (dateString + "0");
};
dateString = (dateString + date.month);
if (Number(dateString) > 200902){
gotoAndStop(2);
};
trace(dateString);
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 78
//CultCloak_10 (SWAIN_TheGreaterGood8_fla.CultCloak_10)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class CultCloak_10 extends MovieClip {
public var sprite:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 79
//CultCloak_title_53 (SWAIN_TheGreaterGood8_fla.CultCloak_title_53)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class CultCloak_title_53 extends MovieClip {
public var sprite:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 80
//CultHead_12 (SWAIN_TheGreaterGood8_fla.CultHead_12)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class CultHead_12 extends MovieClip {
public var sprite:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 81
//Culthead_Sprite_13 (SWAIN_TheGreaterGood8_fla.Culthead_Sprite_13)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class Culthead_Sprite_13 extends MovieClip {
public var sprite:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 82
//Culthead_Sprite_title_56 (SWAIN_TheGreaterGood8_fla.Culthead_Sprite_title_56)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class Culthead_Sprite_title_56 extends MovieClip {
public var sprite:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 83
//CultHead_title_55 (SWAIN_TheGreaterGood8_fla.CultHead_title_55)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class CultHead_title_55 extends MovieClip {
public var sprite:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 84
//ENGINE_BASE_137 (SWAIN_TheGreaterGood8_fla.ENGINE_BASE_137)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class ENGINE_BASE_137 extends MovieClip {
public var WATER:MovieClip;
public var DYNAMICS:MovieClip;
public var TERRAIN:MovieClip;
public var SPIKES:MovieClip;
public var KEYS:MovieClip;
public var startPoint:ENGINE_CULTCROWD;
public var BODYPARTS:MovieClip;
public var MAN:MovieClip;
public var BGPART:MovieClip;
public var DRAWLINKS:MovieClip;
public var LAVA:MovieClip;
public var COINS:MovieClip;
public var BMPIMAGE:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 85
//ENGINE_BG_46 (SWAIN_TheGreaterGood8_fla.ENGINE_BG_46)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class ENGINE_BG_46 extends MovieClip {
public function ENGINE_BG_46(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 86
//ENGINE_EndingLevel_152 (SWAIN_TheGreaterGood8_fla.ENGINE_EndingLevel_152)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class ENGINE_EndingLevel_152 extends MovieClip {
public function ENGINE_EndingLevel_152(){
addFrameScript(0, frame1);
}
function frame1(){
visible = false;
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 87
//ENGINE_HUD_142 (SWAIN_TheGreaterGood8_fla.ENGINE_HUD_142)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
import flash.text.*;
public dynamic class ENGINE_HUD_142 extends MovieClip {
public var slot3:MovieClip;
public var slot1:MovieClip;
public var CText:TextField;
public var backBut:SimpleButton;
public var data2Text:TextField;
public var EXIT:MovieClip;
public var slot2:MovieClip;
public var codeOut:TextField;
public var MESSAGEBOX:MovieClip;
public var SAVE:MovieClip;
public var DText:TextField;
public var LText:TextField;
public var data3Text:TextField;
public var TText:TextField;
public var EL:MovieClip;
public var muteBut:SimpleButton;
public var data1Text:TextField;
public var EOL:MovieClip;
public var RESTART:MovieClip;
public var restartBut:SimpleButton;
}
}//package SWAIN_TheGreaterGood8_fla
Section 88
//ENGINE_HUD_SAVE_147 (SWAIN_TheGreaterGood8_fla.ENGINE_HUD_SAVE_147)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
import flash.text.*;
public dynamic class ENGINE_HUD_SAVE_147 extends MovieClip {
public var sCon:MovieClip;
public var codeName:TextField;
public var sCan:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 89
//EOL_144 (SWAIN_TheGreaterGood8_fla.EOL_144)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
import flash.text.*;
public dynamic class EOL_144 extends MovieClip {
public var CText:TextField;
public var CTText:TextField;
public var DRANK:TextField;
public var LC:MovieClip;
public var TRANK:TextField;
public var DText:TextField;
public var PText:TextField;
public var PSTC:MovieClip;
public var CRANK:TextField;
}
}//package SWAIN_TheGreaterGood8_fla
Section 90
//GAME_Cultee_9 (SWAIN_TheGreaterGood8_fla.GAME_Cultee_9)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class GAME_Cultee_9 extends MovieClip {
public var Head:MovieClip;
public var hit:MovieClip;
public var Body:MovieClip;
public var Treasure:MovieClip;
public function GAME_Cultee_9(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 91
//GAME_Cultee_Body_11 (SWAIN_TheGreaterGood8_fla.GAME_Cultee_Body_11)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class GAME_Cultee_Body_11 extends MovieClip {
public function GAME_Cultee_Body_11(){
addFrameScript(0, frame1, 7, frame8);
}
function frame1(){
stop();
}
function frame8(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 92
//GAME_Cultee_Body_title_54 (SWAIN_TheGreaterGood8_fla.GAME_Cultee_Body_title_54)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class GAME_Cultee_Body_title_54 extends MovieClip {
public function GAME_Cultee_Body_title_54(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 93
//GAME_Cultee_title_52 (SWAIN_TheGreaterGood8_fla.GAME_Cultee_title_52)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class GAME_Cultee_title_52 extends MovieClip {
public var Head:MovieClip;
public var hit:MovieClip;
public var Body:MovieClip;
public function GAME_Cultee_title_52(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 94
//GAME_ENGINE_WHOLE_136 (SWAIN_TheGreaterGood8_fla.GAME_ENGINE_WHOLE_136)
package SWAIN_TheGreaterGood8_fla {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class GAME_ENGINE_WHOLE_136 extends MovieClip {
public var manScale;
public var terrainArray:Array;
public var leftKeyPressed:Boolean;
public var OOLTimer:int;
public var BG:MovieClip;
public var m_iterations:int;
public var ZNumToChar:Array;
public var P:Number;
public var keyTarg:Array;
public var tombStoneActive:Boolean;
public var CF:Number;
public var deathCircle:Array;
public var doorGraphics:Array;
public var CL:Number;
public var dead:Boolean;
public var suicidePause:Number;
public var i:int;
public var manualGraphics:Array;
public var dbgDraw:b2DebugDraw;
public var slotSelect:Number;
public var xPosTemp:Number;
public var linkIDArray:Array;
public var blockDest;
public var drawLinks:Array;
public var doorSize:Array;
public var HUD:MovieClip;
public var currentAnimal:Number;
public var checkCount:Number;
public var accel:Number;
public var coinCount:Number;
public var lives:int;
public var deccel:Number;
public var doorSpin:Array;
public var doSleep:Boolean;
public var circleDef:b2CircleDef;
public var LevelOffset:Number;
public var physicsBlockLength:Number;
public var ii:Number;
public var link1Array:Array;
public var coinMax;
public var terrainPar:Number;
public var codeSplit:Array;
public var codePos:Number;
public var drag:Number;
public var engineArray:Array;
public var deadTimer:Number;
public var m_world:b2World;
public var convertTimer:Number;
public var doorSpinDir:Array;
public var translate:Point;
public var endPoint:MovieClip;
public var link1TypeArray:Array;
public var playerArrow:MovieClip;
public var body:b2Body;
public var doorSpinStore:Array;
public var destroyDest:String;
public var animalArray:Array;
public var upKeyPressed:Boolean;
public var link2Array:Array;
public var lineAlpha:Number;
public var deadBuffer:Number;
public var rot:Number;
public var BGStop:Number;
public var PC:Number;
public var spikeArray:Array;
public var userDataSplit;
public var keyGraphics:Array;
public var joinCount:Number;
public var jumpBuffer:Number;
public var EOLPos:Number;
public var radian:Number;
public var doorTarg:Array;
public var blockSize:Number;
public var coinArray:Array;
public var boxDef:b2PolygonDef;
public var userDataName:Array;
public var startPoint:MovieClip;
public var buttonArray:Array;
public var gravity:b2Vec2;
public var bodyParts:Array;
public var link3Array:Array;
public var lastTimer:Number;
public var userDataLevel:Array;
public var levelWon:Boolean;
public var TG:MovieClip;
public var linkArray:Array;
public var bodyPartsArray:Array;
public var graphicsArray:Array;
public var MANSHAPE;
public var link2TypeArray:Array;
public var foundCount:Number;
public var xSpeed:Number;
public var Ui:Number;
public var animalHeadPos:Point;
public var levelGraphic:Number;
public var m_timeStep:Number;
public var degree:Number;
public var BASE:MovieClip;
public var _keys:Array;
public var m_sprite;
public var suicideActive:Boolean;
public var xPos:Number;
public var EOLVar:Number;
public var tombArray:Array;
public var worldAABB:b2AABB;
public var downKeyPressed:Boolean;
public var deadCount:Number;
public var bodyDef:b2BodyDef;
public var levelWonSpaceBuffer:Boolean;
public var terrainReset:Boolean;
public var yPos:Number;
public var waterHit:Boolean;
public var engineArray_Speed:Array;
public var animalLimit:Number;
public var keyArray:Array;
public var runAnim:Number;
public var object:MovieClip;
public var physicsScale:Number;
public var timer:Number;
public var doorRot:Array;
public var doorArray:Array;
public var ySpeed:Number;
public var levelSizeX:Number;
public var levelSizeY:Number;
public var lavaArray:Array;
public var endLevel:Boolean;
public var cutScene:Boolean;
public var coinArrayActive:Array;
public var xTerrainCount:Number;
public var waterArray:Array;
public var circFix;
public var xDrop:Number;
public var MANSHAPEHIT;
public var runAnimRound:Number;
public var userString:String;
public var constantLives:int;
public var link3TypeArray:Array;
public var dbgSprite:Sprite;
public var jumpSwitchBuffer:Number;
public var jointArray:Array;
public var rightKeyPressed:Boolean;
public function GAME_ENGINE_WHOLE_136(){
addFrameScript(0, frame1);
}
public function manHitTest(_arg1, _arg2){
var _local3:Point;
_local3 = new Point((BASE.MAN.x + _arg1), (BASE.MAN.y + _arg2));
return (((colTest(BASE.TERRAIN, _local3.x, _local3.y)) || (colTest(BASE.DYNAMICS, _local3.x, _local3.y))));
}
public function manageDeath(){
var _local1:Point;
var _local2:b2Vec2;
var _local3:b2Vec2;
if ((((downKeyPressed == false)) && ((BASE.MAN.scaleY > 0)))){
deadBuffer++;
};
if (dead == true){
dead = false;
if (deadBuffer > 10){
deadBuffer = 0;
_local1 = new Point(BASE.MAN.x, BASE.MAN.y);
if ((((cutScene == false)) || ((lives == 0)))){
constantLives++;
if ((MovieClip(parent).animalStore - constantLives) < 7){
lives++;
if (lives <= animalLimit){
currentAnimal = animalArray[lives];
} else {
BASE.MAN.visible = false;
BASE.MAN.scaleY = 0;
};
if (((!((startPoint[("C" + (1 + lives))] == null))) && (!((startPoint[("C" + (1 + lives))] == undefined))))){
startPoint[("C" + (1 + lives))].visible = false;
};
} else {
currentAnimal = Math.round(((Math.random() * 5) + 1));
};
HUD.MESSAGEBOX.sprite.gotoAndStop(currentAnimal);
newBodyParts(BASE.MAN.x, BASE.MAN.y);
_local2 = new b2Vec2();
_local2.x = (startPoint.x / 30);
_local2.y = ((startPoint.y - 40) / 30);
newTombStone(_local1.x, _local1.y, MANSHAPE.GetLinearVelocity());
_local3 = new b2Vec2(-2, 0);
MANSHAPE.SetLinearVelocity(_local3);
MANSHAPE.SetXForm(_local2, 0);
} else {
BASE.MAN.visible = false;
};
};
};
}
public function handleKeyUp(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = _keys.indexOf(_arg1.keyCode);
if (_local2 > -1){
_keys.splice(_local2, 1);
};
}
public function convertBacktoBMP(){
var _local1:GlowFilter;
var _local2:DropShadowFilter;
var _local3:GlowFilter;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Matrix;
var _local8:BitmapData;
var _local9:Bitmap;
_local1 = new GlowFilter();
_local2 = new DropShadowFilter();
_local1.color = 0;
_local1.blurX = 3;
_local1.blurY = 3;
_local1.strength = 8;
_local1.quality = 1;
_local2.blurX = 5;
_local2.blurY = 5;
_local2.alpha = 0.5;
BASE.TERRAIN.filters = [_local1, _local2];
_local3 = new GlowFilter();
_local3.color = 0xFFFF00;
_local3.blurX = 25;
_local3.blurY = 25;
_local3.strength = 2;
_local3.alpha = 0.5;
BASE.LAVA.filters = [_local3];
_local4 = 640;
_local5 = 400;
_local6 = 1;
_local7 = new Matrix();
_local7.scale((1 / _local6), (1 / _local6));
BASE.BMPIMAGE.scaleX = _local6;
BASE.BMPIMAGE.scaleY = _local6;
_local8 = new BitmapData((_local4 / _local6), (_local5 / _local6), true, 0);
_local9 = new Bitmap(_local8);
_local9.x = 0;
_local9.y = 0;
BASE.BMPIMAGE.addChild(_local9);
_local8.draw(BG, _local7, null, null);
_local8.draw(BASE.LAVA, _local7, null, null);
_local8.draw(BASE.TERRAIN, _local7, null, null);
BASE.TERRAIN.filters = null;
BASE.LAVA.filters = null;
BASE.TERRAIN.visible = false;
BASE.LAVA.visible = false;
removeChild(BG);
BG = null;
}
public function manageDoors(){
var _local1:Number;
var _local2:Object;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:Number;
_local1 = 0;
while (_local1 < doorArray.length) {
doorGraphics[_local1].sprite.light.gotoAndStop(Number((doorTarg[_local1] / 10)));
if (doorSpin[_local1] > 0){
wakeUpAll(doorArray[_local1]);
doorSpin[_local1] = (doorSpin[_local1] - 9);
doorSpinStore[_local1] = (doorSpinStore[_local1] + 0.5);
_local2 = calcSpeed(doorRot[_local1], 0.5);
_local3 = new b2Vec2(_local2.x, _local2.y);
_local4 = doorArray[_local1].GetPosition();
_local5 = doorArray[_local1].GetAngle();
_local4.y = (_local4.y - ((((doorSize[_local1] / 5) * _local3.x) * doorSpinDir[_local1]) / physicsScale));
_local4.x = (_local4.x + ((((doorSize[_local1] / 5) * _local3.y) * doorSpinDir[_local1]) / physicsScale));
doorArray[_local1].SetXForm(_local4, _local5);
if (doorSpinStore[_local1] == 10){
doorSpinStore[_local1] = 0;
doorSpinDir[_local1] = (doorSpinDir[_local1] * -1);
};
};
_local1++;
};
}
public function newDynamicCircle(_arg1, _arg2, _arg3, _arg4, _arg5){
var _local6:b2CircleDef;
if (_arg4 == 2){
_arg3 = (_arg3 / physicsScale);
_arg1 = (_arg1 / physicsScale);
_arg2 = (_arg2 / physicsScale);
bodyDef = new b2BodyDef();
bodyDef.position.x = (_arg1 + ((blockSize / 2) / physicsScale));
bodyDef.position.y = (_arg2 - ((blockSize / 2) / physicsScale));
graphicsArray.push((bodyDef.userData = new LE_OBJECT_SPRITE()));
bodyDef.userData.gotoAndStop(_arg5);
if ((((cutScene == false)) || ((_arg5 > 3)))){
bodyDef.userData.width = ((_arg3 * 2) * physicsScale);
bodyDef.userData.height = ((_arg3 * 2) * physicsScale);
} else {
bodyDef.userData.width = (_arg3 * 2);
bodyDef.userData.height = (_arg3 * 2);
};
_local6 = new b2CircleDef();
_local6.radius = (_arg3 - 0.01);
_local6.density = 1;
trace(("OBJECT FIX:" + _arg4));
circFix = true;
_local6.friction = 0.4;
_local6.restitution = 0.4;
body = m_world.CreateBody(bodyDef);
body.CreateShape(_local6);
body.SetMassFromShapes();
BASE.DYNAMICS.addChild(graphicsArray[(graphicsArray.length - 1)]);
linkArray.push(body);
if (_arg5 == 4){
deathCircle.push(bodyDef.userData);
};
} else {
_arg3 = (_arg3 / physicsScale);
_arg1 = (_arg1 / physicsScale);
_arg2 = (_arg2 / physicsScale);
bodyDef = new b2BodyDef();
bodyDef.position.x = (_arg1 + ((blockSize / 2) / physicsScale));
bodyDef.position.y = (_arg2 - ((blockSize / 2) / physicsScale));
_local6 = new b2CircleDef();
_local6.radius = (_arg3 - 0.01);
_local6.density = 0;
trace(("OBJECT FIX:" + _arg4));
circFix = true;
_local6.friction = 0.4;
_local6.restitution = 0.4;
body = m_world.CreateBody(bodyDef);
body.CreateShape(_local6);
body.SetMassFromShapes();
linkArray.push(body);
};
}
public function backToMap(){
if (cutScene == true){
MovieClip(parent).activeLevel = 0;
} else {
MovieClip(parent).activeLevel--;
MovieClip(parent).gotoMap = true;
};
endLevel = true;
if (MovieClip(parent).previewMode == false){
MovieClip(parent).destroyDest = "TITLE";
} else {
MovieClip(parent).destroyDest = "EDITORTITLE";
};
}
public function setStartPoint(_arg1, _arg2){
startPoint.x = _arg1;
_arg2 = (_arg2 + 12);
startPoint.y = _arg2;
if (cutScene == true){
startPoint.visible = false;
};
}
public function handleKeyDown(_arg1:KeyboardEvent):void{
if (_keys.indexOf(_arg1.keyCode) == -1){
_keys.push(_arg1.keyCode);
};
}
public function updateControl(){
var _local1:b2Vec2;
var _local2:Number;
var _local3:*;
var _local4:b2Vec2;
var _local5:b2Vec2;
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:Array;
var _local10:Point;
BASE.MAN.Head.sprite.sprite.gotoAndStop(currentAnimal);
runAnim = (runAnim + 0.5);
if (runAnim > 4){
runAnim = 1;
};
runAnimRound = Math.floor(runAnim);
BASE.MAN.alpha = 1;
waterHit = false;
if (colTest(BASE.WATER, BASE.MAN.x, (BASE.MAN.y - 10))){
waterHit = true;
};
if (rightKeyPressed == true){
BASE.MAN.Head.x = (BASE.MAN.Head.x + (runAnim * 2));
BASE.MAN.Head.y = (BASE.MAN.Head.y + (runAnim * 2));
BASE.MAN.Body.sprite.gotoAndStop(((runAnimRound + 7) + ((4 * currentAnimal) - 4)));
BASE.MAN.scaleX = -(manScale);
xSpeed = (xSpeed - accel);
if (xSpeed > (0 + 0.5)){
drag = 4;
} else {
drag = 1.3;
};
} else {
if (leftKeyPressed == true){
BASE.MAN.Head.x = (BASE.MAN.Head.x + (runAnim * 2));
BASE.MAN.Head.y = (BASE.MAN.Head.y + (runAnim * 2));
BASE.MAN.Body.sprite.gotoAndStop(((runAnimRound + 7) + ((4 * currentAnimal) - 4)));
BASE.MAN.scaleX = manScale;
xSpeed = (xSpeed + accel);
if (xSpeed < (0 - 0.5)){
drag = 4;
} else {
drag = 1.3;
};
} else {
BASE.MAN.Body.sprite.gotoAndStop(currentAnimal);
drag = 4;
};
};
BASE.MAN.Head.x = (BASE.MAN.Head.x + ((animalHeadPos.x - BASE.MAN.Head.x) / 3));
BASE.MAN.Head.y = (BASE.MAN.Head.y + ((animalHeadPos.y - BASE.MAN.Head.y) / 3));
if (waterHit == true){
drag = 5;
};
_local1 = MANSHAPE.GetLinearVelocity();
_local2 = 0;
jumpBuffer--;
if (((((manHitTest(6, 12)) || (manHitTest((0 - 6), 12)))) || (manHitTest(0, 12)))){
jumpBuffer = 3;
} else {
BASE.MAN.Head.x = animalHeadPos.x;
BASE.MAN.Head.y = animalHeadPos.y;
BASE.MAN.Body.sprite.gotoAndStop(((2 + 7) + ((4 * currentAnimal) - 4)));
};
_local3 = MANSHAPE.GetPosition();
_local4 = new b2Vec2(0, -2);
_local5 = new b2Vec2(_local3.x, _local3.y);
if ((((upKeyPressed == true)) && ((jumpSwitchBuffer == 0)))){
jumpSwitchBuffer = 3;
if (jumpBuffer > 0){
if (waterHit == true){
_local4.y = (_local4.y / 1.2);
};
_local7 = _local1;
_local7.y = 0;
MovieClip(parent).playJump();
MANSHAPE.SetLinearVelocity(_local7);
MANSHAPE.ApplyImpulse(_local4, _local5);
jumpBuffer = 0;
};
} else {
if ((((upKeyPressed == false)) && ((jumpSwitchBuffer > 0)))){
jumpSwitchBuffer--;
};
};
if ((((((upKeyPressed == false)) && ((_local1.y < 0)))) && ((jumpBuffer < 0)))){
_local8 = new b2Vec2(0, 0.2);
MANSHAPE.ApplyImpulse(_local8, _local5);
};
xSpeed = (xSpeed / deccel);
_local4 = new b2Vec2(xSpeed, 0);
MANSHAPE.ApplyForce(_local4, _local5);
_local6 = new b2Vec2((_local1.x / drag), _local1.y);
if ((((((((_local5.y > (440 / physicsScale))) || ((_local5.x < (0 - (40 / physicsScale)))))) || ((_local5.x > (680 / physicsScale))))) || ((_local5.y < (0 - (80 / physicsScale)))))){
die();
} else {
_local9 = new Array();
while (((manHitTest(4, -30)) && (manHitTest(-4, -30)))) {
_local9[0] = true;
BASE.MAN.y++;
_local6.y = 2;
};
_local10 = new Point(BASE.MAN.x, BASE.MAN.y);
while (manHitTest(8, -15)) {
_local9[1] = true;
BASE.MAN.x--;
xSpeed = 0;
_local6.x = -1;
};
BASE.MAN.x = _local10.x;
BASE.MAN.y = _local10.y;
while (manHitTest(-8, -15)) {
_local9[2] = true;
BASE.MAN.x++;
xSpeed = 0;
_local6.x = 1;
};
if ((((((_local9[0] == true)) && ((_local9[1] == true)))) && ((_local9[2] == true)))){
die();
};
};
MANSHAPE.SetLinearVelocity(_local6);
MANSHAPE.SetXForm(_local5, 0);
MANSHAPEHIT.SetXForm(_local5, 0);
BASE.MAN.x = ((_local3.x * physicsScale) - (blockSize / 2));
BASE.MAN.y = (((_local3.y * 30) + 1) + blockSize);
if (waterHit == true){
BASE.MAN.alpha = 0.5;
};
if (((((manHitTest(0, -20)) && (manHitTest(0, 5)))) || (((manHitTest(-8, -8)) && (manHitTest(8, -8)))))){
die();
};
BASE.MAN.alpha = 1;
}
function frame1(){
cutScene = false;
CL = MovieClip(parent).activeLevel;
CF = 21;
if (CL == CF){
cutScene = true;
};
startPoint = BASE.startPoint;
HUD.MESSAGEBOX.visible = false;
stop();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
xDrop = 0;
LevelOffset = 10;
physicsScale = 30;
terrainReset = false;
keyArray = new Array();
keyTarg = new Array();
spikeArray = new Array();
waterArray = new Array();
lavaArray = new Array();
coinArray = new Array();
coinArrayActive = new Array();
tombArray = new Array();
drawLinks = new Array();
doorArray = new Array();
doorTarg = new Array();
doorSpin = new Array();
doorRot = new Array();
doorSpinStore = new Array();
doorSpinDir = new Array();
doorSize = new Array();
manualGraphics = new Array();
linkArray = new Array();
linkIDArray = new Array();
link1Array = new Array();
link2Array = new Array();
link3Array = new Array();
link1TypeArray = new Array();
link2TypeArray = new Array();
link3TypeArray = new Array();
_keys = new Array();
stage.addEventListener(KeyboardEvent.KEY_DOWN, this.handleKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, this.handleKeyUp);
worldAABB = new b2AABB();
worldAABB.lowerBound.Set((-100 / 30), (-100 / 30));
worldAABB.upperBound.Set((740 / 30), (600 / 30));
gravity = new b2Vec2(0, (600 / physicsScale));
doSleep = true;
m_world = new b2World(worldAABB, gravity, doSleep);
if (MovieClip(parent).debugMode == true){
m_sprite = new Sprite();
m_sprite.x = -10;
m_sprite.y = 20;
addChild(m_sprite);
dbgDraw = new b2DebugDraw();
dbgSprite = new Sprite();
m_sprite.addChild(dbgSprite);
dbgDraw.m_sprite = m_sprite;
dbgDraw.m_drawScale = 30;
dbgDraw.m_fillAlpha = 0.3;
dbgDraw.m_lineThickness = 1;
dbgDraw.m_drawFlags = (b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit);
m_world.SetDebugDraw(dbgDraw);
};
keyGraphics = new Array();
circFix = false;
deathCircle = new Array();
jointArray = new Array();
engineArray = new Array();
engineArray_Speed = new Array();
m_iterations = MovieClip(parent).physicsAccuracy;
m_timeStep = (1 / 30);
graphicsArray = new Array();
terrainArray = new Array();
doorGraphics = new Array();
buttonArray = new Array();
ZNumToChar = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K");
if (MovieClip(parent).previewMode == true){
setupGameHud();
} else {
setupGameHud();
};
if (MovieClip(parent).audioActive == true){
HUD.muteBut.alpha = 0.8;
};
OOLTimer = 0;
slotSelect = 0;
endLevel = false;
codeSplit = MovieClip(parent).levelCode.split("X");
codeSplit[0] = ZCompile(codeSplit[0]);
codeSplit[1] = ZNumCompile(codeSplit[1]);
MovieClip(parent).userData = codeSplit[3];
if (MovieClip(parent).previewMode == true){
userDataSplit = MovieClip(parent).userData.split("@");
userDataLevel = userDataSplit[0].split("#");
userDataName = userDataSplit[1].split("#");
userString = "This Level is ";
Ui = 0;
while (Ui < userDataLevel.length) {
userString = (userString + userDataLevel[Ui]);
userString = (userString + " ");
Ui++;
};
userString = (userString + "by ");
Ui = 0;
while (Ui < userDataName.length) {
userString = (userString + userDataName[Ui]);
userString = (userString + " ");
Ui++;
};
HUD.MESSAGEBOX.userData.text = userString;
};
blockSize = 20;
levelSizeX = MovieClip(parent).levelSizeX;
levelSizeY = MovieClip(parent).levelSizeY;
codePos = 0;
xPos = 0;
xTerrainCount = 0;
physicsBlockLength = 0;
yPos = 0;
P = 0;
rightKeyPressed = false;
leftKeyPressed = false;
upKeyPressed = false;
downKeyPressed = false;
ii = 0;
while (ii < codeSplit[0].length) {
translate = codeDecrypt(codeSplit[0].charAt(ii));
if (translate.x == 2){
P++;
TG = terrainGraphic(new TerrainSquare(), ((xPos * blockSize) + (blockSize / 2)), ((yPos * blockSize) + blockSize), 0, true);
TG.rotation = (Math.round((Math.random() * 4)) * 90);
} else {
if (translate.x == 6){
if (codeSplit[0].charAt(ii) == "I"){
rot = 180;
} else {
if (codeSplit[0].charAt(ii) == "J"){
rot = 270;
} else {
if (codeSplit[0].charAt(ii) == "K"){
rot = 0;
} else {
if (codeSplit[0].charAt(ii) == "L"){
rot = 90;
};
};
};
};
P++;
blockDest = BASE.SPIKES;
object = terrainGraphic(new SpikeSquare(), ((xPos * blockSize) + (blockSize / 2)), ((yPos * blockSize) + blockSize), rot, false);
spikeArray.push(object);
} else {
if (translate.x == 4){
blockDest = BASE.WATER;
object = terrainGraphic(new WaterSquare(), ((xPos * blockSize) + (blockSize / 2)), ((yPos * blockSize) + blockSize), rot, false);
waterArray.push(object);
} else {
if (translate.x == 5){
blockDest = BASE.LAVA;
object = terrainGraphic(new LavaSquare(), ((xPos * blockSize) + (blockSize / 2)), ((yPos * blockSize) + blockSize), rot, false);
} else {
if (translate.x == 7){
blockDest = BASE.COINS;
object = terrainGraphic(new CoinSquare(), ((xPos * blockSize) + (blockSize / 2)), ((yPos * blockSize) + blockSize), rot, false);
coinArray.push(object);
coinArrayActive.push(false);
};
};
};
};
};
xPos++;
if (xPos > (levelSizeX - 1)){
xPos = 0;
yPos++;
};
terrainArray[0].x = -1000;
ii++;
};
xPos = 0;
yPos = 0;
P = 0;
PC = 0;
ii = 0;
while (ii < codeSplit[0].length) {
if (codeSplit[0].charAt(ii) == "B"){
PC = 0;
xPosTemp = xPos;
while (codeSplit[0].charAt((ii + PC)) == "B") {
PC++;
xPosTemp++;
if (xPosTemp > (levelSizeX - 1)){
break;
};
};
if (PC > 0){
P++;
newGroundTile((xPos * blockSize), (yPos * blockSize), (blockSize * PC), blockSize);
ii = (ii + PC);
xPos = (xPos + PC);
};
};
if ((((((((codeSplit[0].charAt(ii) == "C")) || ((codeSplit[0].charAt(ii) == "D")))) || ((codeSplit[0].charAt(ii) == "E")))) || ((codeSplit[0].charAt(ii) == "F")))){
if (codeSplit[0].charAt(ii) == "C"){
degree = 0;
} else {
if (codeSplit[0].charAt(ii) == "D"){
degree = 90;
} else {
if (codeSplit[0].charAt(ii) == "E"){
degree = 180;
} else {
if (codeSplit[0].charAt(ii) == "F"){
degree = 270;
};
};
};
};
radian = ((degree + 45) / 57.2957795);
newSlopeTile((xPos * blockSize), (yPos * blockSize), radian);
terrainGraphic(new SlopeSquare(), ((xPos * blockSize) + (blockSize / 2)), ((yPos * blockSize) + blockSize), degree, true);
};
xPos++;
if (xPos > (levelSizeX - 1)){
xPos = 0;
yPos++;
};
ii++;
};
loadObjects(codeSplit[1]);
playerArrow.alpha = 0;
levelWon = false;
levelWonSpaceBuffer = false;
suicidePause = 0;
EOLVar = 0;
EOLPos = 0;
xSpeed = 0;
ySpeed = 0;
accel = 3;
deccel = 1.5;
drag = 1.25;
jumpSwitchBuffer = 0;
manScale = BASE.MAN.scaleX;
BASE.MAN.alpha = 0;
deadTimer = 0;
jumpBuffer = 0;
deadCount = 0;
waterHit = false;
runAnim = 1;
runAnimRound = 1;
animalLimit = MovieClip(parent).animalStore;
animalHeadPos = new Point((BASE.MAN.Head.x - 5), (BASE.MAN.Head.y - 5));
animalArray = new Array(1, 2, 3, 4, 5, 6, 7);
animalArray = shuffleArray(animalArray);
currentAnimal = animalArray[0];
trace(("AA" + animalArray));
checkCount = 0;
foundCount = 0;
joinCount = 0;
linkShapes();
suicideActive = false;
dead = false;
deadBuffer = 0;
tombStoneActive = false;
lives = 0;
constantLives = 0;
link1Array = null;
link2Array = null;
link3Array = null;
link1TypeArray = null;
link2TypeArray = null;
link3TypeArray = null;
linkIDArray = null;
lineAlpha = 1;
if (cutScene == true){
lineAlpha = 0;
};
bodyPartsArray = new Array(1, 1, 1, 1, 2, 2, 3, 3, 4, 5);
bodyParts = new Array();
convertTimer = 0;
addEventListener(Event.ENTER_FRAME, convertBMP);
timer = 0;
lastTimer = 0;
coinCount = 0;
coinMax = coinArray.length;
HUD.TText.text = Math.round((timer / 35));
HUD.LText.text = ("Level " + (MovieClip(parent).activeLevel + 1));
HUD.DText.text = deadCount;
BASE.startPoint.SIGN.sprite.animalLimit.text = MovieClip(parent).animalStore;
BASE.startPoint.SIGN.sprite.ST.gotoAndStop("blank");
i = 1;
while (i < 8) {
if (i > MovieClip(parent).animalStore){
BASE.startPoint[("C" + i)].visible = false;
BASE.startPoint[("C" + i)].alpha = 0;
};
BASE.startPoint[("C" + i)].Head.sprite.sprite.gotoAndStop(animalArray[(i - 1)]);
BASE.startPoint[("C" + i)].Body.sprite.gotoAndStop(animalArray[(i - 1)]);
i++;
};
i = 0;
while (i < coinArray.length) {
coinArray[i].rotation = 0;
i++;
};
setUpMan();
HUD.MESSAGEBOX.sprite.gotoAndStop(animalArray[0]);
}
public function newDynamicSquare(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
if (_arg5 == 2){
_arg3 = (_arg3 / physicsScale);
_arg4 = (_arg4 / physicsScale);
_arg1 = (_arg1 / physicsScale);
_arg2 = (_arg2 / physicsScale);
bodyDef = new b2BodyDef();
bodyDef.position.x = _arg1;
bodyDef.position.y = (_arg2 - ((blockSize / 2) / physicsScale));
if (cutScene == false){
graphicsArray.push((bodyDef.userData = new LE_OBJECT_SPRITE()));
bodyDef.userData.gotoAndStop("sizeSet");
bodyDef.userData.width = ((_arg3 * 2) * physicsScale);
bodyDef.userData.height = ((_arg4 * 2) * physicsScale);
bodyDef.userData.gotoAndStop(_arg6);
} else {
graphicsArray.push((bodyDef.userData = new UFO()));
};
boxDef = new b2PolygonDef();
boxDef.SetAsBox((_arg3 - 0.0002), (_arg4 - 0.0002));
boxDef.density = 1;
boxDef.friction = 0.5;
boxDef.restitution = 0.3;
body = m_world.CreateBody(bodyDef);
body.CreateShape(boxDef);
body.SetMassFromShapes();
BASE.DYNAMICS.addChild(graphicsArray[(graphicsArray.length - 1)]);
linkArray.push(body);
} else {
_arg3 = (_arg3 / physicsScale);
_arg4 = (_arg4 / physicsScale);
_arg1 = (_arg1 / physicsScale);
_arg2 = (_arg2 / physicsScale);
bodyDef = new b2BodyDef();
bodyDef.position.x = _arg1;
bodyDef.position.y = (_arg2 - ((blockSize / 2) / physicsScale));
boxDef = new b2PolygonDef();
boxDef.SetAsBox((_arg3 - 0.0001), (_arg4 - 0.0001));
boxDef.density = 0;
boxDef.friction = 0.5;
boxDef.restitution = 0.2;
body = m_world.CreateBody(bodyDef);
body.CreateShape(boxDef);
body.SetMassFromShapes();
linkArray.push(body);
};
}
public function die(){
if ((((dead == false)) && ((deadBuffer > 10)))){
if (cutScene == false){
MovieClip(parent).REDFADE.alpha = 0.8;
};
deadCount++;
dead = true;
};
}
public function ZCompile(_arg1){
var _local2:String;
var _local3:String;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = "";
_local3 = "";
_local4 = 0;
while (_local4 < _arg1.length) {
_local5 = Number(_arg1.charAt(_local4));
if (!isNaN(_local5)){
_local3 = (_local3 + _arg1.charAt(_local4));
} else {
if (_local3 == ""){
_local3 = "1";
_local4--;
} else {
_local6 = 0;
while (_local6 < Number(_local3)) {
_local2 = (_local2 + _arg1.charAt(_local4));
_local6++;
};
_local3 = "";
};
};
_local4++;
};
return (_local2);
}
public function newKey(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
_arg3 = (_arg3 / physicsScale);
_arg4 = (_arg4 / physicsScale);
_arg1 = (_arg1 / physicsScale);
_arg2 = (_arg2 / physicsScale);
bodyDef = new b2BodyDef();
bodyDef.position.x = _arg1;
bodyDef.position.y = (_arg2 - ((blockSize / 2) / physicsScale));
bodyDef.userData = new LE_OBJECT_SPRITE();
bodyDef.userData.gotoAndStop(_arg6);
bodyDef.userData.width = ((_arg3 * 2) * physicsScale);
bodyDef.userData.height = ((_arg4 * 2) * physicsScale);
boxDef = new b2PolygonDef();
boxDef.SetAsBox((_arg3 - 0.001), (_arg4 - 0.001));
boxDef.density = 1;
if (_arg5 == true){
boxDef.density = 0;
};
boxDef.friction = 0.5;
boxDef.restitution = 0.3;
body = m_world.CreateBody(bodyDef);
body.CreateShape(boxDef);
body.SetMassFromShapes();
BASE.KEYS.addChild(bodyDef.userData);
keyGraphics.push(bodyDef.userData);
linkArray.push(body);
}
public function newBodyParts(_arg1, _arg2){
var _local3:Number;
var _local4:MovieClip;
MovieClip(parent).playDie();
_local3 = 0;
while (_local3 < bodyPartsArray.length) {
_local4 = new BODYPARTS();
_local4.gotoAndStop(bodyPartsArray[_local3]);
_local4.rotation = (Math.random() * 360);
_local4.x = _arg1;
_local4.y = _arg2;
_local4.xSpeed = ((Math.random() * 10) - 5);
_local4.ySpeed = ((Math.random() * 5) - 10);
BASE.BODYPARTS.addChild(_local4);
bodyParts.push(_local4);
_local3++;
};
}
public function manageBody(){
var _local1:Number;
var _local2:MovieClip;
_local1 = 0;
while (_local1 < bodyParts.length) {
_local2 = bodyParts[_local1];
_local2.x = (_local2.x + _local2.xSpeed);
_local2.y = (_local2.y + _local2.ySpeed);
_local2.ySpeed = (_local2.ySpeed + 0.5);
if ((((_local2.y > 400)) || ((endLevel == true)))){
BASE.BODYPARTS.removeChild(_local2);
delete bodyParts[_local1];
bodyParts.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
public function GH_restart(_arg1){
if (cutScene == true){
MovieClip(parent).activeLevel = 0;
};
endLevel = true;
MovieClip(parent).destroyDest = "ENGINE";
}
public function onEnterFrame(_arg1){
var _local2:Number;
var _local3:Number;
if (coinMax == 0){
HUD.CText.text = "N/A";
} else {
HUD.CText.text = ((coinCount + "/") + coinMax);
};
if (pythag(endPoint.x, endPoint.y, BASE.MAN.x, BASE.MAN.y) < 15){
if (levelWon == false){
MovieClip(parent).WHITEFADE.alpha = 1;
HUD.MESSAGEBOX.visible = false;
HUD.gotoAndStop("END");
HUD.EOL.x = 0;
HUD.EOL.LC.EOLText.text = (("LEVEL " + (CL + 1)) + " COMPLETE!");
HUD.EOL.DText.text = "0";
HUD.EOL.CText.text = "0";
HUD.EOL.DRANK.text = "";
HUD.EOL.CRANK.text = "";
HUD.EOL.TRANK.text = "";
HUD.EOL.PText.text = terrainPar;
HUD.EOL.CTText.text = coinMax;
HUD.EOL.PSTC.alpha = -3;
HUD.EOL.LC.scaleX = 3;
HUD.EOL.LC.scaleY = 3;
MovieClip(parent).playLevelEnd();
};
levelWon = true;
if (CL == CF){
BASE.MAN.gotoAndStop("TREASURE");
} else {
BASE.MAN.gotoAndStop("WIN");
};
endPoint.visible = false;
};
manageBody();
if (levelWon == false){
if (suicidePause > 0){
suicidePause--;
} else {
handleTombMelt();
updateTimer();
if (cutScene == false){
checkKeyPresses();
};
if ((((suicideActive == false)) && ((lives < MovieClip(parent).animalStore)))){
updateControl();
};
manageKeys();
manageDoors();
crowdControl();
handleDeathCircle();
suicide();
UpdateBox2D();
};
manageCoins();
if (waterHit == true){
BASE.MAN.alpha = 0.5;
};
if (colTest(BASE.LAVA, BASE.MAN.x, (BASE.MAN.y - 10))){
die();
BASE.MAN.alpha = 0.3;
};
if (colTest(BASE.SPIKES, BASE.MAN.x, (BASE.MAN.y - 10))){
tombStoneActive = true;
die();
};
manageDeath();
manageDrawLinks();
} else {
if (isKeyPressed(32)){
EOLVar = (EOLVar + 15);
};
if (HUD.EOL.LC.scaleX > 1){
HUD.EOL.LC.scaleX = (HUD.EOL.LC.scaleX - 0.2);
HUD.EOL.LC.scaleY = (HUD.EOL.LC.scaleY - 0.2);
};
if (EOLPos == 0){
if (EOLVar < 30){
EOLVar++;
} else {
EOLVar = 0;
EOLPos++;
};
} else {
if (EOLPos == 1){
EOLVar = (EOLVar + 0.2);
MovieClip(parent).playJump();
HUD.EOL.DText.text = Math.round(EOLVar);
if (EOLVar > deadCount){
HUD.EOL.DText.text = deadCount;
EOLVar = 0;
EOLPos++;
};
} else {
if (EOLPos == 2){
if (EOLVar < 20){
EOLVar++;
} else {
EOLVar = 0;
EOLPos++;
};
} else {
if (EOLPos == 3){
if (deadCount > (Number(terrainPar) + 2)){
HUD.EOL.DRANK.text = "D";
} else {
if (deadCount > (Number(terrainPar) + 1)){
HUD.EOL.DRANK.text = "C";
} else {
if (deadCount > Number(terrainPar)){
HUD.EOL.DRANK.text = "B";
} else {
if (deadCount <= Number(terrainPar)){
HUD.EOL.DRANK.text = "A";
} else {
HUD.EOL.DRANK.text = "D";
};
};
};
};
MovieClip(parent).playCoin();
EOLPos++;
} else {
if (EOLPos == 4){
if (EOLVar < 20){
EOLVar++;
} else {
EOLVar = 0;
EOLPos++;
};
} else {
if (EOLPos == 5){
EOLVar = (EOLVar + 0.4);
MovieClip(parent).playJump();
HUD.EOL.CText.text = Math.round(EOLVar);
if (EOLVar > coinCount){
HUD.EOL.CText.text = coinCount;
EOLVar = 0;
EOLPos++;
};
} else {
if (EOLPos == 6){
if (EOLVar < 20){
EOLVar++;
} else {
EOLVar = 0;
EOLPos++;
};
} else {
if (EOLPos == 7){
if (coinMax != 0){
_local2 = Math.ceil(((100 / coinMax) * coinCount));
if (_local2 >= 100){
HUD.EOL.CRANK.text = "A";
} else {
if (_local2 > 60){
HUD.EOL.CRANK.text = "B";
} else {
if (_local2 > 30){
HUD.EOL.CRANK.text = "C";
} else {
HUD.EOL.CRANK.text = "D";
};
};
};
} else {
HUD.EOL.CRANK.text = "A";
};
MovieClip(parent).playCoin();
EOLPos++;
EOLVar = 0;
} else {
if (EOLPos == 8){
if (EOLVar < 20){
EOLVar++;
} else {
EOLVar = 0;
EOLPos++;
};
} else {
if (EOLPos == 9){
_local3 = 0;
if (HUD.EOL.DRANK.text == "A"){
_local3 = (_local3 + 3);
} else {
if (HUD.EOL.DRANK.text == "B"){
_local3 = (_local3 + 2);
} else {
if (HUD.EOL.DRANK.text == "C"){
_local3 = (_local3 + 1);
};
};
};
if (HUD.EOL.CRANK.text == "A"){
_local3 = (_local3 + 3);
} else {
if (HUD.EOL.CRANK.text == "B"){
_local3 = (_local3 + 2);
} else {
if (HUD.EOL.CRANK.text == "C"){
_local3 = (_local3 + 1);
};
};
};
if (_local3 < 2){
HUD.EOL.TRANK.text = "D";
} else {
if (_local3 < 4){
HUD.EOL.TRANK.text = "C";
} else {
if (_local3 < 6){
HUD.EOL.TRANK.text = "B";
} else {
HUD.EOL.TRANK.text = "A";
};
};
};
MovieClip(parent).playCoin();
MovieClip(parent).newMedal(MovieClip(parent).activeLevel);
if ((((MovieClip(parent).savefile.data.medalsT[MovieClip(parent).activeLevel] == undefined)) || ((MovieClip(parent).savefile.data.medalsT[MovieClip(parent).activeLevel] < _local3)))){
MovieClip(parent).savefile.data.medalsT[MovieClip(parent).activeLevel] = _local3;
};
if ((((MovieClip(parent).savefile.data.medalsL[MovieClip(parent).activeLevel] == undefined)) || ((MovieClip(parent).savefile.data.medalsT[MovieClip(parent).activeLevel] > deadCount)))){
MovieClip(parent).savefile.data.medalsL[MovieClip(parent).activeLevel] = deadCount;
};
if (_local3 == 6){
MovieClip(parent).checkLevelMedal(MovieClip(parent).activeLevel);
};
EOLPos++;
EOLVar = 0;
} else {
if (EOLPos == 10){
EOLVar++;
if ((((EOLVar > 130)) && (!((endLevel == true))))){
if (MovieClip(parent).previewMode == false){
endLevel = true;
MovieClip(parent).gotoMap = true;
MovieClip(parent).destroyDest = "TITLE";
} else {
endLevel = true;
MovieClip(parent).destroyDest = "ENGINE";
};
if (MovieClip(parent).activeLevel == 20){
MovieClip(parent).gotoMap = false;
MovieClip(parent).destroyDest = "OUTRO";
stop();
if ((MovieClip(parent).animalStore - constantLives) >= 25){
MovieClip(parent).newPaw(8);
};
if ((MovieClip(parent).animalStore - constantLives) >= 18){
MovieClip(parent).newPaw(7);
};
if ((MovieClip(parent).animalStore - constantLives) >= 12){
MovieClip(parent).newPaw(6);
};
if ((MovieClip(parent).animalStore - constantLives) >= 6){
MovieClip(parent).newPaw(5);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
if (endLevel == true){
HUD.EL.visible = true;
if (bodyParts.length == 0){
endSim();
MovieClip(parent).gotoFrame(MovieClip(parent), "LOADER");
};
};
outOfLives();
}
public function exitPreview(_arg1){
endLevel = true;
MovieClip(parent).destroyDest = "EDITOR";
}
public function angle(_arg1, _arg2, _arg3, _arg4){
return ((Math.round(((Math.atan2((_arg4 - _arg2), (_arg3 - _arg1)) / 3.141593) * 180)) + 90));
}
public function destroyAS3Key(){
stage.removeEventListener(KeyboardEvent.KEY_DOWN, this.handleKeyDown);
stage.removeEventListener(KeyboardEvent.KEY_UP, this.handleKeyUp);
}
public function handleTombMelt(){
var _local1:Number;
var _local2:*;
var _local3:b2Vec2;
_local1 = 0;
while (_local1 < tombArray.length) {
_local2 = tombArray[_local1].m_userData;
if (colTest(BASE.LAVA, _local2.x, _local2.y)){
_local3 = new b2Vec2(-1000, -1000);
tombArray[_local1].SetXForm(_local3, 0);
};
_local1++;
};
}
public function manageDrawLinks(){
var _local1:Number;
var _local2:b2Vec2;
BASE.DRAWLINKS.graphics.clear();
BASE.DRAWLINKS.graphics.lineStyle(1, 0, lineAlpha);
_local1 = 0;
while (_local1 < drawLinks.length) {
_local2 = drawLinks[_local1].GetPosition();
BASE.DRAWLINKS.graphics.moveTo(((_local2.x * physicsScale) - 10), ((_local2.y * physicsScale) + 20));
_local1++;
_local2 = drawLinks[_local1].GetPosition();
BASE.DRAWLINKS.graphics.lineTo(((_local2.x * physicsScale) - 10), ((_local2.y * physicsScale) + 20));
_local1++;
};
}
public function manageKeys(){
var _local1:Number;
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:Number;
var _local5:Number;
_local1 = 0;
while (_local1 < keyArray.length) {
keyGraphics[_local1].key.light.gotoAndStop(Number((keyTarg[_local1] / 10)));
_local2 = keyArray[_local1].GetPosition();
_local3 = MANSHAPE.GetPosition();
_local4 = pythag(_local2.x, _local2.y, _local3.x, _local3.y);
if (_local4 < 0.75){
MovieClip(parent).playDoor();
_local2.y = (_local2.y + 1000);
keyArray[_local1].SetXForm(_local2, 0);
_local5 = 0;
while (_local5 < doorArray.length) {
if (doorTarg[_local5] == keyTarg[_local1]){
doorSpin[_local5] = (doorSpin[_local5] + 180);
};
_local5++;
};
};
_local1++;
};
}
public function setupSaveHud(_arg1){
slotSelect = _arg1;
HUD.SAVE.codeName.text = MovieClip(parent).savefile.data[(("editor_slot" + _arg1) + "_name")];
HUD.SAVE.y = 0;
}
public function newObject(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12){
var _local13:Number;
var _local14:MovieClip;
_local13 = ((18 * _arg7) * 0.0174532925);
_arg5 = (_arg5 * 10);
_arg6 = (_arg6 * 10);
if (_arg1 == 2){
newDynamicSquare((_arg3 + (blockSize / 2)), _arg4, _arg5, _arg6, _arg8, MovieClip(parent).graphics_Squares[_arg2]);
if (_arg8 == true){
_local14 = terrainGraphic(new LE_OBJECT_SPRITE(), _arg3, _arg4, 0, false);
_local14.gotoAndStop("sizeSet");
_local14.width = (_arg5 * 2);
_local14.height = (_arg6 * 2);
_local14.rotation = (18 * _arg7);
_local14.gotoAndStop(MovieClip(parent).graphics_Squares[_arg2]);
_local14.y = (_local14.y + (blockSize / 2));
BASE.TERRAIN.removeChild(_local14);
BASE.DYNAMICS.addChild(_local14);
manualGraphics.push(_local14);
};
} else {
if (_arg1 == 3){
newKey((_arg3 + (blockSize / 2)), _arg4, (blockSize / 2), (blockSize / 2), _arg8, 10);
keyArray.push(linkArray[(linkArray.length - 1)]);
keyTarg.push(_arg5);
} else {
if (_arg1 == 1){
newDynamicCircle(_arg3, _arg4, _arg5, _arg8, MovieClip(parent).graphics_Circles[_arg2]);
if (_arg8 == true){
_local14 = terrainGraphic(new LE_OBJECT_SPRITE(), _arg3, _arg4, 0, false);
_local14.gotoAndStop(MovieClip(parent).graphics_Circles[_arg2]);
_local14.width = (_arg5 * 2);
_local14.height = (_arg6 * 2);
_local14.rotation = (18 * _arg7);
_local14.y = (_local14.y + (blockSize / 2));
BASE.TERRAIN.removeChild(_local14);
BASE.DYNAMICS.addChild(_local14);
manualGraphics.push(_local14);
};
} else {
if (_arg1 == 4){
newDoor((_arg3 + (blockSize / 2)), _arg4, (blockSize / 2), _arg6, _arg8, 11);
doorArray.push(linkArray[(linkArray.length - 1)]);
doorTarg.push(_arg5);
doorSpin.push(0);
doorSpinStore.push(0);
doorSpinDir.push(1);
doorRot.push((_arg7 * 18));
doorSize.push(_arg6);
};
};
};
};
linkArray[(linkArray.length - 1)].SetXForm(linkArray[(linkArray.length - 1)].GetPosition(), _local13);
link1Array.push(Number((String(_arg10.charAt(0)) + String(_arg10.charAt(1)))));
link2Array.push(Number((String(_arg11.charAt(0)) + String(_arg11.charAt(1)))));
link3Array.push(Number((String(_arg12.charAt(0)) + String(_arg12.charAt(1)))));
link1TypeArray.push(Number(_arg10.charAt(2)));
link2TypeArray.push(Number(_arg11.charAt(2)));
link3TypeArray.push(Number(_arg12.charAt(2)));
linkIDArray.push(Number(_arg9));
}
public function handleDeathCircle(){
var _local1:Number;
_local1 = 0;
while (_local1 < deathCircle.length) {
if (deathCircle[_local1].hitTestObject(BASE.MAN.hit)){
die();
};
_local1++;
};
}
public function newSlopeTile(_arg1, _arg2, _arg3){
var _local4:*;
_local4 = blockSize;
_local4 = (_local4 / physicsScale);
_arg1 = (_arg1 / physicsScale);
_arg2 = (_arg2 / physicsScale);
bodyDef = new b2BodyDef();
bodyDef.position.x = ((_arg1 + (_local4 / 2)) + (10 / 30));
bodyDef.position.y = _arg2;
bodyDef.angle = _arg3;
boxDef = new b2PolygonDef();
boxDef.SetAsBox((28.28427 / (physicsScale * 2)), (1 / (physicsScale * 2)));
boxDef.density = 0;
boxDef.friction = 0.5;
boxDef.restitution = 0.2;
body = m_world.CreateBody(bodyDef);
body.CreateShape(boxDef);
body.SetMassFromShapes();
}
public function ZNumCrush(_arg1){
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + ZNumToChar[Number(_arg1.charAt(_local3))]);
_local3++;
};
return (ZCrush(_local2));
}
public function loadObjects(_arg1){
var _local2:*;
var _local3:String;
var _local4:String;
var _local5:String;
var _local6:String;
var _local7:Number;
var _local8:*;
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:String;
var _local18:String;
var _local19:String;
var _local20:String;
var _local21:Number;
if (((!((_arg1 == null))) && (!((_arg1 == undefined))))){
_local2 = codeSplit[2];
_local3 = "";
_local4 = "";
_local5 = "";
_local6 = "";
_local7 = 0;
while (_local7 < 3) {
_local3 = (_local3 + String(_local2.charAt(_local7)));
_local7++;
};
_local7 = 3;
while (_local7 < 6) {
_local4 = (_local4 + String(_local2.charAt(_local7)));
_local7++;
};
_local7 = 6;
while (_local7 < 9) {
_local5 = (_local5 + _local2.charAt(_local7));
_local7++;
};
_local7 = 9;
while (_local7 < 12) {
_local6 = (_local6 + _local2.charAt(_local7));
_local7++;
};
setStartPoint(Number(_local3), Number(_local4));
setEndPoint(Number(_local5), Number(_local6));
BGStop = Number(_local2.charAt(_local7));
levelGraphic = BGStop;
BG.gotoAndStop(Number(BGStop));
terrainPar = Number(_local2.charAt((_local7 + 1)));
_local2 = codeSplit[1];
_local8 = new Array("SQUARE", "CIRCLE");
_local9 = 0;
_local7 = 0;
while (_local7 < ((_local2.length / 23) - 1)) {
_local10 = Number(_local2.charAt((_local9 + _local7)));
_local11 = Number(_local2.charAt(((_local9 + _local7) + 1)));
_local12 = (Number(((_local2.charAt(((_local9 + _local7) + 2)) + _local2.charAt(((_local9 + _local7) + 3))) + _local2.charAt(((_local9 + _local7) + 4)))) - 180);
_local13 = (Number(((_local2.charAt(((_local9 + _local7) + 5)) + _local2.charAt(((_local9 + _local7) + 6))) + _local2.charAt(((_local9 + _local7) + 7)))) - 180);
_local14 = Number(_local2.charAt(((_local9 + _local7) + 8)));
_local15 = Number(_local2.charAt(((_local9 + _local7) + 9)));
_local16 = Number((String(_local2.charAt(((_local9 + _local7) + 10))) + String(_local2.charAt(((_local9 + _local7) + 11)))));
_local17 = (_local2.charAt(((_local9 + _local7) + 12)) + _local2.charAt(((_local9 + _local7) + 13)));
_local18 = ((_local2.charAt(((_local9 + _local7) + 14)) + _local2.charAt(((_local9 + _local7) + 15))) + _local2.charAt(((_local9 + _local7) + 16)));
_local19 = ((_local2.charAt(((_local9 + _local7) + 17)) + _local2.charAt(((_local9 + _local7) + 18))) + _local2.charAt(((_local9 + _local7) + 19)));
_local20 = ((_local2.charAt(((_local9 + _local7) + 20)) + _local2.charAt(((_local9 + _local7) + 21))) + _local2.charAt(((_local9 + _local7) + 22)));
_local21 = Number(_local2.charAt(((_local9 + _local7) + 23)));
newObject(_local10, _local11, _local12, _local13, _local14, _local15, _local16, _local21, _local17, _local18, _local19, _local20);
_local9 = (_local9 + 23);
_local7++;
};
};
}
public function destroyMovieClips(_arg1, _arg2){
var _local3:Number;
_local3 = 0;
while (_local3 < _arg1.length) {
_arg2.removeChild(_arg1[_local3]);
delete _arg1[_local3];
_arg1.splice(_local3, 1);
_local3--;
_local3++;
};
}
public function newDoor(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
var _local7:Number;
_local7 = (_arg4 / 10);
_arg3 = (_arg3 / physicsScale);
_arg4 = (_arg4 / physicsScale);
_arg1 = (_arg1 / physicsScale);
_arg2 = (_arg2 / physicsScale);
bodyDef = new b2BodyDef();
bodyDef.position.x = _arg1;
bodyDef.position.y = (_arg2 - ((blockSize / 2) / physicsScale));
graphicsArray.push((bodyDef.userData = new LE_OBJECT_SPRITE()));
bodyDef.userData.gotoAndStop(11);
bodyDef.userData.width = blockSize;
bodyDef.userData.height = blockSize;
bodyDef.userData.sprite.gotoAndStop(_local7);
bodyDef.allowSleep = false;
doorGraphics.push(bodyDef.userData);
boxDef = new b2PolygonDef();
boxDef.SetAsBox((_arg3 - 0.0001), (_arg4 - 0.0001));
boxDef.density = 0;
boxDef.friction = 0.5;
boxDef.restitution = 0.3;
body = m_world.CreateBody(bodyDef);
body.CreateShape(boxDef);
body.SetMassFromShapes();
BASE.DYNAMICS.addChild(graphicsArray[(graphicsArray.length - 1)]);
linkArray.push(body);
}
public function setUpMan(){
MANSHAPE = newMan((startPoint.x + 10), (startPoint.y - 30), 0, 0.1);
MANSHAPEHIT = newMan((startPoint.x + 10), (startPoint.y - 30), 3, 100);
BASE.MAN.x = startPoint.x;
BASE.MAN.y = startPoint.y;
BASE.MAN.alpha = 0;
}
public function slot3Code(_arg1){
if (HUD.slot3.alpha == 1){
setupSaveHud(3);
};
}
public function destroyBox2D(){
var _local1:Number;
m_world.DestroyBody(MANSHAPE);
m_world.DestroyBody(MANSHAPEHIT);
drawLinks = null;
deathCircle = null;
_local1 = 0;
while (_local1 < bodyParts.length) {
if (bodyParts[_local1] != null){
BASE.BODYPARTS.removeChild(graphicsArray[_local1]);
delete bodyParts[_local1];
};
_local1++;
};
bodyParts = null;
_local1 = 0;
while (_local1 < jointArray.length) {
if (jointArray[_local1] != null){
m_world.DestroyJoint(jointArray[_local1]);
};
_local1++;
};
jointArray = null;
_local1 = 0;
while (_local1 < linkArray.length) {
if (linkArray[_local1] != null){
m_world.DestroyBody(linkArray[_local1]);
};
_local1++;
};
linkArray = null;
doorGraphics = null;
_local1 = 0;
while (_local1 < graphicsArray.length) {
if (graphicsArray[_local1] != null){
BASE.DYNAMICS.removeChild(graphicsArray[_local1]);
delete graphicsArray[_local1];
};
_local1++;
};
graphicsArray = null;
_local1 = 0;
while (_local1 < keyGraphics.length) {
if (keyGraphics[_local1] != null){
BASE.KEYS.removeChild(keyGraphics[_local1]);
delete keyGraphics[_local1];
};
_local1++;
};
keyGraphics = null;
_local1 = 0;
while (_local1 < terrainArray.length) {
if (terrainArray[_local1] != null){
BASE.TERRAIN.removeChild(terrainArray[_local1]);
delete terrainArray[_local1];
};
_local1++;
};
terrainArray = null;
_local1 = 0;
while (_local1 < manualGraphics.length) {
if (manualGraphics[_local1] != null){
BASE.DYNAMICS.removeChild(manualGraphics[_local1]);
delete manualGraphics[_local1];
};
_local1++;
};
manualGraphics = null;
startPoint = null;
BASE.removeChild(endPoint);
endPoint = null;
}
public function GH_back(_arg1){
backToMap();
}
public function linkShapes(){
var _local1:Number;
var _local2:Number;
var _local3:*;
var _local4:*;
_local1 = 0;
while (_local1 < linkArray.length) {
_local2 = 1;
while (_local2 < 4) {
checkCount++;
_local3 = this[(("link" + _local2) + "Array")][_local1];
if (_local3 != 0){
foundCount++;
_local4 = linkIDToBody(_local3);
if (_local4 != undefined){
joinCount++;
joinShapes(linkArray[_local1], linkArray[_local4], this[(("link" + _local2) + "TypeArray")][_local1]);
drawLinks.push(linkArray[_local1]);
drawLinks.push(linkArray[_local4]);
};
};
_local2++;
};
_local1++;
};
}
public function isKeyPressed(_arg1:int):Boolean{
return ((_keys.indexOf(_arg1) > -1));
}
public function manageCoins(){
var _local1:Number;
_local1 = 0;
while (_local1 < coinArray.length) {
if (coinArrayActive[_local1] == true){
coinArray[_local1].scaleX = (coinArray[_local1].scaleX + 0.03);
coinArray[_local1].scaleY = (coinArray[_local1].scaleY + 0.03);
coinArray[_local1].alpha = (coinArray[_local1].alpha - 0.15);
if (coinArray[_local1].alpha < 0){
BASE.COINS.removeChild(coinArray[_local1]);
delete coinArray[_local1];
coinArray.splice(_local1, 1);
coinArrayActive.splice(_local1, 1);
_local1--;
};
} else {
if (pythag(coinArray[_local1].x, coinArray[_local1].y, BASE.MAN.x, (BASE.MAN.y - 10)) < 20){
MovieClip(parent).playCoin();
coinCount++;
coinArrayActive[_local1] = true;
};
};
_local1++;
};
}
public function linkIDToBody(_arg1){
var _local2:Number;
_local2 = 0;
while (_local2 < linkArray.length) {
if (linkIDArray[_local2] == _arg1){
return (_local2);
};
_local2++;
};
return (undefined);
}
public function wakeUpAll(_arg1){
var _local2:Number;
var _local3:b2Vec2;
var _local4:b2Vec2;
_local2 = 0;
while (_local2 < linkArray.length) {
_local3 = linkArray[_local2].GetPosition();
_local4 = _arg1.GetPosition();
if (pythag(_local3.x, _local3.y, _local4.x, _local4.y) < 3){
linkArray[_local2].WakeUp();
};
_local2++;
};
}
public function UpdateBox2D(){
var _local1:b2Body;
m_world.Step(m_timeStep, m_iterations);
_local1 = m_world.m_bodyList;
while (_local1) {
if ((_local1.m_userData is Sprite)){
_local1.m_userData.x = ((_local1.GetPosition().x - (blockSize / 60)) * physicsScale);
_local1.m_userData.y = ((_local1.GetPosition().y + (blockSize / 30)) * physicsScale);
_local1.m_userData.rotation = ((_local1.GetAngle() * 180) / Math.PI);
};
_local1 = _local1.m_next;
};
}
public function endSim(){
if (MovieClip(parent).previewMode == false){
HUD.backBut.removeEventListener(MouseEvent.MOUSE_UP, GH_back);
HUD.muteBut.removeEventListener(MouseEvent.MOUSE_UP, GH_mute);
HUD.restartBut.removeEventListener(MouseEvent.MOUSE_UP, GH_restart);
};
spikeArray = null;
waterArray = null;
lavaArray = null;
coinArray = null;
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, this.handleKeyDown);
stage.removeEventListener(KeyboardEvent.KEY_UP, this.handleKeyUp);
destroyBox2D();
removeAllButtons();
}
public function slot2Code(_arg1){
if (HUD.slot2.alpha == 1){
setupSaveHud(2);
};
}
public function terrainGraphic(_arg1, _arg2, _arg3, _arg4, _arg5){
var _local6:MovieClip;
_local6 = _arg1;
_local6.x = _arg2;
_local6.y = _arg3;
_local6.width = (blockSize + 0.5);
_local6.scaleY = _local6.scaleX;
_local6.rotation = _arg4;
if (blockDest == undefined){
BASE.TERRAIN.addChild(_local6);
} else {
blockDest.addChild(_local6);
blockDest = undefined;
};
if (_arg5 == true){
terrainArray.push(_local6);
};
return (_local6);
}
public function removeButtonListeners(_arg1){
var _local2:*;
if (_arg1.sprite != undefined){
_local2 = _arg1.sprite;
} else {
_local2 = _arg1;
};
if (_arg1.pressVar != ""){
_local2.removeEventListener(MouseEvent.MOUSE_DOWN, this[_arg1.pressVar]);
};
if (_arg1.releaseVar != ""){
_local2.removeEventListener(MouseEvent.MOUSE_UP, this[_arg1.releaseVar]);
};
if (_arg1.rollVar != ""){
_local2.removeEventListener(MouseEvent.MOUSE_OVER, this[_arg1.rollVar]);
};
if (_arg1.outVar != ""){
_local2.removeEventListener(MouseEvent.MOUSE_OUT, this[_arg1.outVar]);
};
}
public function slotCancel(_arg1){
HUD.SAVE.y = 125;
}
public function colTest(_arg1, _arg2, _arg3){
return (_arg1.hitTestPoint(_arg2, _arg3, true));
}
public function suicide(){
if (suicideActive == true){
tombStoneActive = true;
BASE.MAN.gotoAndStop(1);
die();
suicideActive = false;
};
if (downKeyPressed == true){
suicidePause = 50;
BASE.MAN.gotoAndStop("SUICIDE");
suicideActive = true;
};
}
public function removeAllButtons(){
var _local1:Number;
var _local2:MovieClip;
_local1 = 0;
while (_local1 < buttonArray.length) {
_local2 = buttonArray[_local1];
removeButtonListeners(_local2);
buttonArray.splice(_local1, 1);
_local1--;
_local1++;
};
}
public function setupGameHud(){
HUD.gotoAndStop("GAME");
HUD.MESSAGEBOX.visible = true;
HUD.backBut.addEventListener(MouseEvent.MOUSE_UP, GH_back);
HUD.muteBut.addEventListener(MouseEvent.MOUSE_UP, GH_mute);
HUD.restartBut.addEventListener(MouseEvent.MOUSE_UP, GH_restart);
HUD.MESSAGEBOX.gotoAndStop((MovieClip(parent).activeLevel + 2));
}
public function setupPreviewHud(){
HUD.gotoAndStop("PREVIEW");
addButton(HUD.EXIT, "exitPreview", "", "", "");
addButton(HUD.RESTART, "restartPreview", "", "", "");
HUD.RESTART.sprite.gotoAndStop("RESTART");
HUD.EXIT.sprite.gotoAndStop("TOEDITOR");
addButton(HUD.slot1, "slot1Code", "", "", "");
addButton(HUD.slot2, "slot2Code", "", "", "");
addButton(HUD.slot3, "slot3Code", "", "", "");
HUD.slot1.sprite.gotoAndStop("saveSlot1");
HUD.slot2.sprite.gotoAndStop("saveSlot2");
HUD.slot3.sprite.gotoAndStop("saveSlot3");
HUD.data1Text.text = MovieClip(parent).savefile.data.editor_slot1_name;
HUD.data2Text.text = MovieClip(parent).savefile.data.editor_slot2_name;
HUD.data3Text.text = MovieClip(parent).savefile.data.editor_slot3_name;
HUD.codeOut.text = MovieClip(parent).levelCode;
HUD.SAVE.codeName.text = "";
addButton(HUD.SAVE.sCan, "slotConfirm", "", "", "");
addButton(HUD.SAVE.sCon, "slotCancel", "", "", "");
HUD.SAVE.sCan.sprite.gotoAndStop("saveSlotConfirm");
HUD.SAVE.sCon.sprite.gotoAndStop("saveSlotCancel");
}
public function outOfLives(){
if (lives >= MovieClip(parent).animalStore){
BASE.MAN.scaleY = 0;
OOLTimer++;
if (OOLTimer == 25){
} else {
if (OOLTimer == 80){
backToMap();
};
};
};
}
public function ZCrush(_arg1){
var _local2:String;
var _local3:int;
var _local4:Number;
var _local5:String;
var _local6:Number;
var _local7:Number;
_local2 = "";
_local3 = 0;
_local4 = 0;
while (_local4 < _arg1.length) {
_local5 = _arg1.charAt(_local4);
_local3 = 0;
while (_arg1.charAt((_local4 + _local3)) == _local5) {
_local3++;
};
_local4 = (_local4 + (_local3 - 1));
_local6 = 0;
_local7 = 0;
if (_local3 > 1){
_local2 = (_local2 + _local3);
};
_local2 = (_local2 + _local5);
_local4++;
};
return (_local2);
}
public function slot1Code(_arg1){
if (HUD.slot1.alpha == 1){
setupSaveHud(1);
};
}
public function newGroundTile(_arg1, _arg2, _arg3, _arg4){
_arg3 = (_arg3 / physicsScale);
_arg4 = (_arg4 / physicsScale);
_arg1 = (_arg1 / physicsScale);
_arg2 = (_arg2 / physicsScale);
bodyDef = new b2BodyDef();
bodyDef.position.x = ((_arg1 + (_arg3 / 2)) + (10 / 30));
bodyDef.position.y = _arg2;
boxDef = new b2PolygonDef();
boxDef.SetAsBox((_arg3 / 2), (_arg4 / 2));
boxDef.density = 0;
boxDef.friction = 0.5;
boxDef.restitution = 0.2;
body = m_world.CreateBody(bodyDef);
body.CreateShape(boxDef);
body.SetMassFromShapes();
}
public function GH_mute(_arg1){
if (MovieClip(parent).audioActive == false){
HUD.muteBut.alpha = 0.8;
MovieClip(parent).audioActive = true;
MovieClip(parent).savefile.data.AA = true;
MovieClip(parent).playGameMusic(MovieClip(parent).activeLevel);
} else {
MovieClip(parent).savefile.data.AA = false;
MovieClip(parent).audioActive = false;
SoundMixer.stopAll();
HUD.muteBut.alpha = 1;
};
}
public function restartPreview(_arg1){
endLevel = true;
MovieClip(parent).destroyDest = "ENGINE";
}
public function joinShapes(_arg1, _arg2, _arg3){
var _local4:Boolean;
var _local5:*;
var _local6:*;
var _local7:*;
_local4 = false;
if (_arg3 > 2){
_local4 = true;
_arg3 = (_arg3 - 2);
};
if (_arg3 == 1){
_local6 = _arg1.GetWorldCenter();
_local7 = _arg2.GetWorldCenter();
_local5 = new b2DistanceJointDef();
_local5.Initialize(_arg1, _arg2, _arg1.GetWorldCenter(), _arg2.GetWorldCenter());
_local5.collideConnected = _local4;
jointArray.push(m_world.CreateJoint(_local5));
} else {
if (_arg3 == 2){
_local5 = new b2RevoluteJointDef();
_local5.Initialize(_arg1, _arg2, _arg1.GetWorldCenter());
_local5.collideConnected = _local4;
jointArray.push(m_world.CreateJoint(_local5));
_local5 = new b2RevoluteJointDef();
_local5.Initialize(_arg1, _arg2, _arg2.GetWorldCenter());
_local5.collideConnected = _local4;
jointArray.push(m_world.CreateJoint(_local5));
};
};
}
public function convertBMP(_arg1){
var _local2:Number;
var _local3:MovieClip;
convertTimer++;
if (convertTimer == 3){
convertBacktoBMP();
_local2 = 0;
while (_local2 < BASE.TERRAIN.numChildren) {
_local3 = BASE.TERRAIN.getChildAt(_local2);
_local3.sprite.gotoAndStop(1);
trace("JUMHUM");
_local2++;
};
removeEventListener(Event.ENTER_FRAME, convertBMP);
};
}
public function codeDecrypt(_arg1){
var _local2:Point;
_local2 = new Point();
_local2.x = 0;
_local2.y = 0;
if (_arg1 == "A"){
_local2.x = 1;
} else {
if (_arg1 == "B"){
_local2.x = 2;
} else {
if ((((((((_arg1 == "C")) || ((_arg1 == "D")))) || ((_arg1 == "E")))) || ((_arg1 == "F")))){
_local2.x = 3;
if (_arg1 == "D"){
_local2.y = 90;
} else {
if (_arg1 == "E"){
_local2.y = 180;
} else {
if (_arg1 == "F"){
_local2.y = -90;
};
};
};
} else {
if (_arg1 == "G"){
_local2.x = 4;
} else {
if (_arg1 == "H"){
_local2.x = 5;
} else {
if ((((((((_arg1 == "I")) || ((_arg1 == "J")))) || ((_arg1 == "K")))) || ((_arg1 == "L")))){
_local2.x = 6;
if (_arg1 == "J"){
_local2.y = 90;
} else {
if (_arg1 == "K"){
_local2.y = 180;
} else {
if (_arg1 == "L"){
_local2.y = -90;
};
};
};
} else {
if (_arg1 == "M"){
_local2.x = 7;
};
};
};
};
};
};
};
return (_local2);
}
public function slotConfirm(_arg1){
var _local2:Number;
_local2 = slotSelect;
if (((((((((((!((HUD.SAVE.codeName.text == ""))) && (!((HUD.SAVE.codeName.text == " "))))) && (!((HUD.SAVE.codeName.text == " "))))) && (!((HUD.SAVE.codeName.text == " "))))) && (!((HUD.SAVE.codeName.text == "Slot Name Required"))))) && (!((HUD.SAVE.codeName.text == "No Data"))))){
MovieClip(parent).savefile.data[(("editor_slot" + _local2) + "_name")] = HUD.SAVE.codeName.text;
MovieClip(parent).savefile.data[("editor_slot" + _local2)] = MovieClip(parent).levelCode;
HUD[(("data" + _local2) + "Text")].text = MovieClip(parent).savefile.data[(("editor_slot" + _local2) + "_name")];
HUD.SAVE.y = 125;
} else {
HUD.SAVE.codeName.text = "Slot Name Required";
};
}
public function shuffleArray(_arg1){
var _local2:Array;
var _local3:Array;
var _local4:int;
_local2 = new Array();
_local3 = _arg1;
while (_local3.length > 0) {
_local4 = (Math.random() * _local3.length);
_local2.push(_local3[_local4]);
_local3.splice(_local4, 1);
};
return (_local2);
}
public function calcSpeed(_arg1, _arg2){
var _local3:Number;
var _local4:Object;
_local3 = (_arg1 * 0.01745329);
_local4 = new Object();
_local4.x = (_arg2 * Math.cos(_local3));
_local4.y = (_arg2 * Math.sin(_local3));
return (_local4);
}
public function pythag(_arg1, _arg2, _arg3, _arg4){
return (Math.sqrt((Math.pow((_arg2 - _arg4), 2) + Math.pow((_arg1 - _arg3), 2))));
}
public function rotatedXY(_arg1, _arg2, _arg3){
var _local4:Object;
var _local5:*;
var _local6:*;
var _local7:*;
_local4 = new Object();
_local5 = ((6.28 / 360) * _arg3);
_local6 = Math.sin(_local5);
_local7 = Math.cos(_local5);
_local4.x = ((_arg1 * _local7) - (_arg2 * _local6));
_local4.y = ((_arg1 * _local6) + (_arg2 * _local7));
return (_local4);
}
public function addButton(_arg1, _arg2:String, _arg3:String, _arg4:String, _arg5:String){
var _local6:*;
_arg1.pressVar = _arg2;
_arg1.releaseVar = _arg3;
_arg1.rollVar = _arg4;
_arg1.outVar = _arg5;
_local6 = _arg1;
if (_arg1.pressVar != ""){
_local6.addEventListener(MouseEvent.MOUSE_DOWN, this[_arg2]);
};
if (_arg1.releaseVar != ""){
_local6.addEventListener(MouseEvent.MOUSE_UP, this[_arg3]);
};
if (_arg1.rollVar != ""){
_local6.addEventListener(MouseEvent.MOUSE_OVER, this[_arg4]);
};
if (_arg1.outVar != ""){
_local6.addEventListener(MouseEvent.MOUSE_OUT, this[_arg5]);
};
buttonArray.push(_arg1);
}
public function newTombStone(_arg1, _arg2, _arg3){
var _local4:*;
var _local5:*;
var _local6:*;
if (tombStoneActive == true){
tombStoneActive = false;
newDynamicSquare((_arg1 + (blockSize / 2)), (_arg2 - 10), 10, 10, 2, 14);
_local4 = linkArray[(linkArray.length - 1)];
_local5 = _local4.GetPosition();
tombArray.push(_local4);
_local4.SetLinearVelocity(_arg3);
_local6 = new b2Vec2(0, -2);
_local5.y = (_local5.y + 10);
_local4.ApplyImpulse(_local6, _local5);
};
}
public function newMan(_arg1, _arg2, _arg3, _arg4){
var _local5:Number;
var _local6:Number;
var _local7:b2CircleDef;
_local5 = 6;
_local6 = (10 + _arg3);
_arg3 = (_arg3 / physicsScale);
_arg1 = (_arg1 - 10);
_local5 = (_local5 / physicsScale);
_local6 = (_local6 / physicsScale);
_arg1 = (_arg1 / physicsScale);
_arg2 = (_arg2 / physicsScale);
bodyDef = new b2BodyDef();
bodyDef.position.x = _arg1;
bodyDef.position.y = _arg2;
bodyDef.allowSleep = false;
bodyDef.linearDamping = (0 + _arg4);
_local7 = new b2CircleDef();
_local7.radius = ((_local5 + 0.05) + _arg3);
_local7.density = 1;
_local7.friction = 0;
_local7.restitution = 0;
_local7.filter.groupIndex = -2;
body = m_world.CreateBody(bodyDef);
body.CreateShape(_local7);
bodyDef.massData.mass = 0.2;
body.SetMass(bodyDef.massData);
return (body);
}
public function ZNumCompile(_arg1){
var _local2:String;
var _local3:Number;
var _local4:Number;
_arg1 = ZCompile(_arg1);
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = 0;
while (_local4 < ZNumToChar.length) {
if (_arg1.charAt(_local3) == ZNumToChar[_local4]){
_local2 = (_local2 + String(_local4));
};
_local4++;
};
_local3++;
};
return (_local2);
}
public function crowdControl(){
var _local1:Number;
var _local2:*;
var _local3:Number;
_local2 = angle(startPoint.x, startPoint.y, BASE.MAN.x, (BASE.MAN.y + 10));
if (BASE.MAN.x > (startPoint.x + 20)){
_local1 = 1;
} else {
if (BASE.MAN.x < (startPoint.x - 20)){
_local1 = -1;
} else {
_local2 = undefined;
_local1 = startPoint[("C" + 1)].Body.scaleX;
};
};
if (_local1 > 0){
if (_local2 < 45){
_local2 = 45;
} else {
if (_local2 > 135){
_local2 = 135;
};
};
} else {
if (_local2 < 0){
_local2 = (_local2 + 360);
};
if (_local2 > 315){
_local2 = 315;
} else {
if (_local2 < 225){
_local2 = 225;
};
};
};
_local3 = 1;
while (_local3 < 8) {
startPoint[("C" + _local3)].Body.scaleX = _local1;
startPoint[("C" + _local3)].Head.scaleX = _local1;
if (_local2 != undefined){
startPoint[("C" + _local3)].Head.rotation = ((_local2 - (90 * _local1)) - (startPoint[("C" + _local3)].rotation * _local1));
} else {
startPoint[("C" + _local3)].Head.rotation = (startPoint[("C" + _local3)].Head.rotation / 1.05);
};
_local3++;
};
}
public function setEndPoint(_arg1, _arg2){
endPoint = new ENGINE_ENDPOINT();
endPoint.x = _arg1;
endPoint.y = _arg2;
BASE.addChild(endPoint);
if (cutScene == true){
endPoint.visible = false;
} else {
if (MovieClip(parent).activeLevel == CF){
endPoint.gotoAndStop("TREASURE");
};
};
}
public function checkKeyPresses(){
rightKeyPressed = ((isKeyPressed(65)) || (isKeyPressed(37)));
leftKeyPressed = ((isKeyPressed(68)) || (isKeyPressed(39)));
upKeyPressed = ((isKeyPressed(87)) || (isKeyPressed(38)));
downKeyPressed = isKeyPressed(16);
}
public function updateTimer(){
timer++;
if (timer > (lastTimer + 35)){
lastTimer = timer;
BASE.startPoint.SIGN.sprite.animalLimit.text = (MovieClip(parent).animalStore - constantLives);
HUD.DText.text = deadCount;
HUD.TText.text = Math.round((timer / 35));
};
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 95
//Killself_33 (SWAIN_TheGreaterGood8_fla.Killself_33)
package SWAIN_TheGreaterGood8_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class Killself_33 extends MovieClip {
public var Head:MovieClip;
public var Body:MovieClip;
public function Killself_33(){
addFrameScript(0, frame1, 49, frame50);
}
function frame1(){
Head.sprite.sprite.gotoAndStop(MovieClip(parent.parent.parent).currentAnimal);
Body.sprite.gotoAndStop(MovieClip(parent.parent.parent).currentAnimal);
}
function frame50(){
MovieClip(parent.parent.parent.parent).REDFADE.alpha = 80;
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 96
//LE_BLOCK_Light_172 (SWAIN_TheGreaterGood8_fla.LE_BLOCK_Light_172)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class LE_BLOCK_Light_172 extends MovieClip {
public function LE_BLOCK_Light_172(){
addFrameScript(0, frame1);
}
function frame1(){
alpha = 0;
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 97
//LE_BLOCK_Sprite_99 (SWAIN_TheGreaterGood8_fla.LE_BLOCK_Sprite_99)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class LE_BLOCK_Sprite_99 extends MovieClip {
public var doorSprite:MovieClip;
public function LE_BLOCK_Sprite_99(){
addFrameScript(0, frame1, 25, frame26);
}
function frame1(){
stop();
}
function frame26(){
doorSprite.gotoAndStop(2);
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 98
//LE_KeyGraphic_105 (SWAIN_TheGreaterGood8_fla.LE_KeyGraphic_105)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class LE_KeyGraphic_105 extends MovieClip {
public var light:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 99
//LE_LINKAGE_TYPESCREEN_126 (SWAIN_TheGreaterGood8_fla.LE_LINKAGE_TYPESCREEN_126)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class LE_LINKAGE_TYPESCREEN_126 extends MovieClip {
public var B_T_SOLID:MovieClip;
public var B_T_LOOSEC:MovieClip;
public var B_T_SOLIDC:MovieClip;
public var B_T_LOOSE:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 100
//LE_LINKAGESCREEN_124 (SWAIN_TheGreaterGood8_fla.LE_LINKAGESCREEN_124)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LE_LINKAGESCREEN_124 extends MovieClip {
public var BUTRING:MovieClip;
public var LINKRING:MovieClip;
public var B_T_CANCEL:MovieClip;
public var B_T_DELETE:MovieClip;
public var descText:TextField;
public var TS:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 101
//le_lOADdELAY_96 (SWAIN_TheGreaterGood8_fla.le_lOADdELAY_96)
package SWAIN_TheGreaterGood8_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class le_lOADdELAY_96 extends MovieClip {
public var LCKTrashCheckCount:Number;
public function le_lOADdELAY_96(){
addFrameScript(0, frame1);
}
function frame1(){
addEventListener(Event.ENTER_FRAME, LCKTrashCheck);
LCKTrashCheckCount = 0;
}
public function LCKTrashCheck(_arg1){
if (LCKTrashCheckCount < 75){
LCKTrashCheckCount++;
} else {
removeEventListener(Event.ENTER_FRAME, LCKTrashCheck);
MovieClip(parent).gotoFrame(MovieClip(parent), "EDITORTITLE");
};
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 102
//LE_MENU_97 (SWAIN_TheGreaterGood8_fla.LE_MENU_97)
package SWAIN_TheGreaterGood8_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class LE_MENU_97 extends MovieClip {
public var loadFriend:MovieClip;
public var loadText:TextField;
public var BG:MovieClip;
public var backLoad:MovieClip;
public var backArmor:MovieClip;
public function LE_MENU_97(){
addFrameScript(0, frame1);
}
public function backLoadCode(_arg1){
destroyListenersLoad();
MovieClip(parent).gotoFrame(MovieClip(parent), "TITLE");
}
public function destroyListenersLoad(){
backArmor.removeEventListener(MouseEvent.MOUSE_DOWN, backArmorCode);
backLoad.removeEventListener(MouseEvent.MOUSE_DOWN, backLoadCode);
loadFriend.removeEventListener(MouseEvent.MOUSE_DOWN, loadFriendCode);
}
public function loadFriendCode(_arg1){
var _local2:String;
var _local3:Number;
var _local4:Array;
if (loadText.text != ""){
_local2 = "";
_local3 = 0;
while (_local3 < loadText.text.length) {
if (loadText.text.charAt(_local3) != " "){
_local2 = (_local2 + loadText.text.charAt(_local3));
};
_local3++;
};
MovieClip(parent).levelCode = _local2;
destroyListenersLoad();
_local4 = MovieClip(parent).levelCode.split("X");
if (_local4[3] != undefined){
MovieClip(parent).userData = _local4[3];
};
MovieClip(parent).friendMode = true;
MovieClip(parent).gotoFrame(MovieClip(parent), "ENGINE");
};
}
function frame1(){
stop();
loadFriend.sprite.gotoAndStop("load");
backLoad.sprite.gotoAndStop("back");
backArmor.sprite.gotoAndStop("Editor");
loadFriend.addEventListener(MouseEvent.MOUSE_DOWN, loadFriendCode);
backLoad.addEventListener(MouseEvent.MOUSE_DOWN, backLoadCode);
backArmor.addEventListener(MouseEvent.MOUSE_DOWN, backArmorCode);
}
public function backArmorCode(_arg1){
var url:String;
var request:URLRequest;
var event = _arg1;
url = "http://armorgames.com/play/2564/seppukuties-level-builder";
request = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
};
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 103
//LE_OBJECT_DOORSPRITE_108 (SWAIN_TheGreaterGood8_fla.LE_OBJECT_DOORSPRITE_108)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class LE_OBJECT_DOORSPRITE_108 extends MovieClip {
public var light:MovieClip;
public function LE_OBJECT_DOORSPRITE_108(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 104
//LE_OBJECT_DOORSPRITE_LIGHT_107 (SWAIN_TheGreaterGood8_fla.LE_OBJECT_DOORSPRITE_LIGHT_107)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class LE_OBJECT_DOORSPRITE_LIGHT_107 extends MovieClip {
public function LE_OBJECT_DOORSPRITE_LIGHT_107(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 105
//LE_SIZEEDITOR_122 (SWAIN_TheGreaterGood8_fla.LE_SIZEEDITOR_122)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LE_SIZEEDITOR_122 extends MovieClip {
public var doorLinkText:TextField;
public var B_TARG:MovieClip;
public var B_SIZE:MovieClip;
public function LE_SIZEEDITOR_122(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 106
//LE_SLIDE_OBJECTS_PHYSICS_117 (SWAIN_TheGreaterGood8_fla.LE_SLIDE_OBJECTS_PHYSICS_117)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LE_SLIDE_OBJECTS_PHYSICS_117 extends MovieClip {
public var B_T_LINK1TICK:MovieClip;
public var propImageText:TextField;
public var LE_SIZE:MovieClip;
public var levelCapNum:TextField;
public var B_FIXED:MovieClip;
public var dynamicText:TextField;
public var B_DYNAMIC:MovieClip;
public var B_FIXEDTICK:MovieClip;
public var B_RL:MovieClip;
public var levelCapWarn:MovieClip;
public var B_RR:MovieClip;
public var B_T_LINK2TICK:MovieClip;
public var B_T_CIRCLE:MovieClip;
public var B_T_DOOR:MovieClip;
public var B_T_KEY:MovieClip;
public var B_IR:MovieClip;
public var B_IL:MovieClip;
public var levelCap:MovieClip;
public var fixedText:TextField;
public var B_T_SQUARE:MovieClip;
public var sizeBlock:MovieClip;
public var B_T_EXIT:MovieClip;
public var linkageBlock:MovieClip;
public var B_T_LINK2:MovieClip;
public var B_T_LINK3:MovieClip;
public var B_T_LINK1:MovieClip;
public var B_T_LINK3TICK:MovieClip;
public var propsBlock:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 107
//LE_SLIDE_TERRAIN_110 (SWAIN_TheGreaterGood8_fla.LE_SLIDE_TERRAIN_110)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class LE_SLIDE_TERRAIN_110 extends MovieClip {
public var EXTRAS_F:MovieClip;
public var EXTRAS_S:MovieClip;
public var B_T_I:MovieClip;
public var B_T_F:MovieClip;
public var B_T_W:MovieClip;
public var B_T_X:MovieClip;
public var B_T_L:MovieClip;
public var B_T_S:MovieClip;
public var BSelect:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 108
//LE_SLIDE_TERRAIN_ERASER_116 (SWAIN_TheGreaterGood8_fla.LE_SLIDE_TERRAIN_ERASER_116)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class LE_SLIDE_TERRAIN_ERASER_116 extends MovieClip {
public var B3:MovieClip;
public var B5:MovieClip;
public var B1:MovieClip;
public var BSelect:MovieClip;
public function LE_SLIDE_TERRAIN_ERASER_116(){
addFrameScript(0, frame1);
}
function frame1(){
B1.gotoAndStop("size1");
B3.gotoAndStop("size2");
B5.gotoAndStop("size3");
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 109
//LE_SLIDE_TERRAIN_FILL_113 (SWAIN_TheGreaterGood8_fla.LE_SLIDE_TERRAIN_FILL_113)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class LE_SLIDE_TERRAIN_FILL_113 extends MovieClip {
public var B2:MovieClip;
public var B3:MovieClip;
public var B4:MovieClip;
public var B5:MovieClip;
public var B1:MovieClip;
public var BG:MovieClip;
public var BSelect:MovieClip;
public function LE_SLIDE_TERRAIN_FILL_113(){
addFrameScript(0, frame1);
}
function frame1(){
B1.gotoAndStop(2);
B2.gotoAndStop(3);
B3.gotoAndStop(3);
B4.gotoAndStop(3);
B5.gotoAndStop(3);
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 110
//LE_SLIDE_TERRAIN_SPIKES_114 (SWAIN_TheGreaterGood8_fla.LE_SLIDE_TERRAIN_SPIKES_114)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class LE_SLIDE_TERRAIN_SPIKES_114 extends MovieClip {
public var B2:MovieClip;
public var B3:MovieClip;
public var B4:MovieClip;
public var B1:MovieClip;
public var BG:MovieClip;
public var BSelect:MovieClip;
public function LE_SLIDE_TERRAIN_SPIKES_114(){
addFrameScript(0, frame1);
}
function frame1(){
B1.gotoAndStop(6);
B2.gotoAndStop(6);
B3.gotoAndStop(6);
B4.gotoAndStop(6);
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 111
//LE_SLIDE_TOOLS_115 (SWAIN_TheGreaterGood8_fla.LE_SLIDE_TOOLS_115)
package SWAIN_TheGreaterGood8_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class LE_SLIDE_TOOLS_115 extends MovieClip {
public var B_T_LS:MovieClip;
public var EXTRAS_PSHAPES:MovieClip;
public var parScore:TextField;
public var B_T_TGB:MovieClip;
public var B_T_TGL:MovieClip;
public var B_T_TGR:MovieClip;
public var B_T_OUTPUT:MovieClip;
public var EXTRAS_BS:MovieClip;
public var B_T_PS:MovieClip;
public var B_T_BS:MovieClip;
public function LE_SLIDE_TOOLS_115(){
addFrameScript(0, frame1);
}
function frame1(){
B_T_BS.sprite.gotoAndStop("size1");
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 112
//LE_SMOOTHUNDO_128 (SWAIN_TheGreaterGood8_fla.LE_SMOOTHUNDO_128)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class LE_SMOOTHUNDO_128 extends MovieClip {
public var BCONFIRM:MovieClip;
public var BUNDO:MovieClip;
public var smoothUndo:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 113
//LE_TerrainButton_98 (SWAIN_TheGreaterGood8_fla.LE_TerrainButton_98)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LE_TerrainButton_98 extends MovieClip {
public var descText:TextField;
public var sprite:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 114
//LE_WHOLE_109 (SWAIN_TheGreaterGood8_fla.LE_WHOLE_109)
package SWAIN_TheGreaterGood8_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class LE_WHOLE_109 extends MovieClip {
public var basePressed:Boolean;
public var currentDraggable;
public var linkageActive:Boolean;
public var blockSize:Number;
public var linkTarget;
public var BG;
public var pos:Number;
public var ZNumToChar:Array;
public var buttonArray:Array;
public var baseMouse:Point;
public var curSize:Number;
public var objectArray:Array;
public var linkageObject:MovieClip;
public var startPoint:MovieClip;
public var mouseClickFreeze:Boolean;
public var PFixSet:Number;
public var PCurSizeX:Number;
public var PCurSizeY:Number;
public var rotStore_F:Number;
public var but:MovieClip;
public var PCurR:Number;
public var rotStore_S:Number;
public var FPSOld:uint;
public var everything:Array;
public var usedLinkID:Array;
public var levelGraphic:Number;
public var BASE:MovieClip;
public var linkageNum:Number;
public var typeSelect:Number;
public var graphicStore:Number;
public var linkColArray:Array;
public var titleScreen:Boolean;
public var autoSaveTimer:Number;
public var OBJECTS:MovieClip;
public var autoSaveCodePosistion:Number;
public var linkStore:Number;
public var SLIDE_B:MovieClip;
public var autoSaveCodeSegment:String;
public var SLIDE_L:MovieClip;
public var SLIDE_T:MovieClip;
public var terrainPar:Number;
public var codeSplit:Array;
public var doorRotStore:Number;
public var baseActive:Boolean;
public var FPSTicker:Number;
public var autoSavePassiveSpeed:Number;
public var doorSizeStore:Number;
public var rotStore:Number;
public var TITLEBUTTON:MovieClip;
public var activeShapeOffsetY:Number;
public var activeShapeOffsetX:Number;
public var sizeButOffset;
public var endPoint:MovieClip;
public var levelCode:String;
public var LINKS:MovieClip;
public var objectEditor:Boolean;
public var linkageType:Number;
public var buildTerrainCodeActive:Number;
public var undoPointPos;
public var firstTileOffset:Boolean;
public var rotSelect:Number;
public var baseBlocks:Array;
public var linkPosArrayY:Array;
public var mousePressed:Boolean;
public var typeStore_E:Number;
public var SLIDE_SU:MovieClip;
public var typeStore_F:Number;
public var typeStore_S:Number;
public var levelCapOffset:Number;
public var activeObject;
public var linkPosArrayX:Array;
public var BGStop:Number;
public var smoothUndoArray:Array;
public var terrainGraphic:Number;
public function LE_WHOLE_109(){
addFrameScript(0, frame1);
}
public function MouseUp(_arg1:Event){
mousePressed = (basePressed = false);
if (currentDraggable != undefined){
if (currentDraggable.ID == 9){
if (currentDraggable.alpha != 1){
currentDraggable.alpha = 1;
if (undoPointPos.x != undefined){
currentDraggable.x = undoPointPos.x;
currentDraggable.y = undoPointPos.y;
};
};
currentDraggable = undefined;
} else {
currentDraggable = undefined;
};
};
SLIDE_T.EXTRAS_BS.y = 400;
SLIDE_B.EXTRAS_F.x = -400;
SLIDE_B.EXTRAS_S.x = -400;
}
public function setLinkage(_arg1){
linkageObject = activeObject;
linkageNum = _arg1;
linkageActive = true;
linkageType = 0;
linkTarget = undefined;
}
public function setBrush_F(_arg1){
SLIDE_B.EXTRAS_F.x = 0;
SLIDE_B.EXTRAS_F.y = 0;
SLIDE_B.BSelect.x = SLIDE_B.B_T_F.x;
SLIDE_B.BSelect.y = SLIDE_B.B_T_F.y;
typeSelect = typeStore_F;
}
public function removeButtonListeners(_arg1){
var _local2:*;
if (_arg1.sprite != undefined){
_local2 = _arg1.sprite;
} else {
_local2 = _arg1;
};
if (_arg1.pressVar != ""){
_local2.removeEventListener(MouseEvent.MOUSE_DOWN, this[_arg1.pressVar]);
};
if (_arg1.releaseVar != ""){
_local2.removeEventListener(MouseEvent.MOUSE_UP, this[_arg1.releaseVar]);
};
if (_arg1.rollVar != ""){
_local2.removeEventListener(MouseEvent.MOUSE_OVER, this[_arg1.rollVar]);
};
if (_arg1.outVar != ""){
_local2.removeEventListener(MouseEvent.MOUSE_OUT, this[_arg1.outVar]);
};
}
public function lightTiles(){
var _local1:Number;
var _local2:MovieClip;
var _local3:Boolean;
_local1 = 0;
while (_local1 < baseBlocks.length) {
_local2 = baseBlocks[_local1];
_local2.light.alpha = 0;
_local3 = false;
if (pythag(_local2.x, _local2.y, baseBlocks[pos].x, baseBlocks[pos].y) < curSize){
_local3 = true;
if (baseActive == true){
if ((((((((basePressed == true)) && (((!((_local2.sprite.currentFrame == typeSelect))) || (!((_local2.sprite.rotation == rotSelect))))))) && ((_local2.x > 10)))) && ((_local2.x < ((MovieClip(parent).levelSizeX * 20) - 20))))){
_local2.sprite.gotoAndStop(typeSelect);
move_to_top(_local2);
_local2.sprite.rotation = rotSelect;
};
};
};
if (_local3 == true){
_local2.light.alpha = 1;
};
_local1++;
};
}
public function move_to_top(_arg1){
}
public function freeLinkID(_arg1){
var _local2:Number;
_local2 = 0;
while (_local2 < usedLinkID.length) {
if (_arg1 == usedLinkID[_local2]){
usedLinkID.splice(_local2, 1);
_local2--;
};
_local2++;
};
}
public function looseLinkageText(_arg1){
SLIDE_L.descText.text = "CREATE A LOOSE LINK BETWEEN THE TWO SHAPES. THIS ALLOWS THE SHAPES TO ROTATE INDEPENDANTLY WHILE STILL KEEPING THEM CONNECTED.";
}
public function solidLinkType(_arg1){
linkageType = 2;
finishLink();
}
public function PROPS_DYNAMIC(_arg1){
if (!checkLevelLimit()){
if (activeObject.type != 3){
levelCapOffset++;
};
activeObject.fixed = 2;
PFixSet = 2;
SLIDE_T.EXTRAS_PSHAPES.B_FIXEDTICK.y = (SLIDE_T.EXTRAS_PSHAPES.B_DYNAMIC.y - 5);
};
}
public function removeAllButtons(){
var _local1:Number;
var _local2:MovieClip;
_local1 = 0;
while (_local1 < buttonArray.length) {
_local2 = buttonArray[_local1];
removeButtonListeners(_local2);
buttonArray.splice(_local1, 1);
_local1--;
_local1++;
};
}
public function terrainParRight(_arg1){
terrainPar++;
if (terrainPar == 10){
terrainPar = 1;
};
SLIDE_T.parScore.text = terrainPar;
}
public function deleteLinkPoint(_arg1){
activeObject[("link" + linkageNum)] = 0;
activeObject[("linkTarg" + linkageNum)] = undefined;
linkageNum = 0;
linkageActive = false;
linkageType = 0;
SLIDE_L.TS.y = (SLIDE_L.TS.y + 100);
if (linkTarget != undefined){
linkTarget.LINKS.visible = false;
};
SLIDE_L.LINKRING.x = -2000;
}
public function setStartPoint(_arg1, _arg2){
startPoint = new LE_STARTPOINT();
startPoint.x = _arg1;
startPoint.ID = 9;
startPoint.y = _arg2;
OBJECTS.addChild(startPoint);
}
public function buildShapeCode(){
var _local1:String;
var _local2:Number;
var _local3:MovieClip;
var _local4:String;
_local1 = "";
firstTileOffset = true;
_local2 = 0;
while (_local2 < objectArray.length) {
_local3 = objectArray[_local2];
_local1 = (_local1 + _local3.type);
_local1 = (_local1 + _local3.graphic);
_local4 = "";
_local4 = (_local4 + (_local3.x + 180));
if (_local4.length == 1){
_local1 = (_local1 + "00");
} else {
if (_local4.length == 2){
_local1 = (_local1 + "0");
};
};
_local1 = (_local1 + _local4);
_local4 = "";
_local4 = (_local4 + (_local3.y + 180));
if (_local4.length == 1){
_local1 = (_local1 + "00");
} else {
if (_local4.length == 2){
_local1 = (_local1 + "0");
};
};
_local1 = (_local1 + _local4);
_local1 = (_local1 + _local3.sizeX);
_local1 = (_local1 + _local3.sizeY);
_local4 = "";
_local4 = (_local4 + _local3.rot);
if (_local4.length == 1){
_local1 = (_local1 + "0");
};
_local1 = (_local1 + _local4);
_local4 = "";
_local1 = (_local1 + _local3.linkID);
_local4 = "";
_local4 = (_local4 + _local3.link1);
if (_local4.length == 1){
_local1 = (_local1 + "0");
};
_local1 = (_local1 + _local4);
_local4 = "";
_local4 = (_local4 + _local3.link1Type);
_local1 = (_local1 + _local4);
_local4 = "";
_local4 = (_local4 + _local3.link2);
if (_local4.length == 1){
_local1 = (_local1 + "0");
};
_local1 = (_local1 + _local4);
_local4 = "";
_local4 = (_local4 + _local3.link2Type);
_local1 = (_local1 + _local4);
_local4 = "";
_local4 = (_local4 + _local3.link3);
if (_local4.length == 1){
_local1 = (_local1 + "0");
};
_local1 = (_local1 + _local4);
_local4 = "";
_local4 = (_local4 + _local3.link3Type);
_local1 = (_local1 + _local4);
_local1 = (_local1 + _local3.fixed);
_local2++;
};
_local1 = ("X" + ZNumCrush(_local1));
_local1 = (_local1 + "X");
_local4 = "";
_local4 = (_local4 + startPoint.x);
if (_local4.length == 1){
_local1 = (_local1 + "00");
} else {
if (_local4.length == 2){
_local1 = (_local1 + "0");
};
};
_local1 = (_local1 + _local4);
_local4 = "";
_local4 = (_local4 + startPoint.y);
if (_local4.length == 1){
_local1 = (_local1 + "00");
} else {
if (_local4.length == 2){
_local1 = (_local1 + "0");
};
};
_local1 = (_local1 + _local4);
_local4 = "";
_local4 = (_local4 + endPoint.x);
if (_local4.length == 1){
_local1 = (_local1 + "00");
} else {
if (_local4.length == 2){
_local1 = (_local1 + "0");
};
};
_local1 = (_local1 + _local4);
_local4 = "";
_local4 = (_local4 + endPoint.y);
if (_local4.length == 1){
_local1 = (_local1 + "00");
} else {
if (_local4.length == 2){
_local1 = (_local1 + "0");
};
};
_local1 = (_local1 + _local4);
_local1 = (_local1 + BG.currentFrame);
_local1 = (_local1 + terrainPar);
return (_local1);
}
function frame1(){
titleScreen = false;
BG = SLIDE_T.B_T_TGB;
BG.gotoAndStop(3);
doorRotStore = 0;
doorSizeStore = 5;
linkStore = 1;
buttonArray = new Array();
ZNumToChar = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K");
codeSplit = MovieClip(parent).levelCode.split("X");
codeSplit[1] = ZNumCompile(codeSplit[1]);
levelCode = ZCompile(codeSplit[0]);
usedLinkID = new Array();
baseBlocks = new Array();
objectArray = new Array();
everything = new Array(baseBlocks, objectArray);
mousePressed = false;
objectEditor = false;
blockSize = 20;
baseActive = false;
basePressed = false;
pos = 0;
baseMouse = new Point();
baseMouse.x = BASE.mouseX;
baseMouse.y = BASE.mouseY;
curSize = 1;
typeSelect = 2;
typeStore_F = 2;
typeStore_S = 6;
typeStore_E = 1;
rotSelect = 0;
rotStore_F = 0;
rotStore_S = 0;
buildTerrainCodeActive = 0;
activeShapeOffsetX = 0;
activeShapeOffsetY = 0;
SLIDE_T.EXTRAS_PSHAPES.propsBlock.alpha = 0.75;
PCurSizeX = 4;
PCurSizeY = 4;
PCurR = 0;
linkageActive = false;
levelCapOffset = 0;
populateBase();
clearFakeBlocks();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(MouseEvent.MOUSE_DOWN, MouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP, MouseUp);
mouseClickFreeze = false;
SLIDE_T.B_T_BS.descText.text = "Size";
SLIDE_T.B_T_BS.sprite.gotoAndStop((SLIDE_T.B_T_BS.descText.text + typeStore_E));
SLIDE_B.B_T_F.descText.text = "Terrain";
SLIDE_B.B_T_F.sprite.gotoAndStop(SLIDE_B.B_T_F.descText.text);
SLIDE_B.B_T_W.descText.text = "Water";
SLIDE_B.B_T_W.sprite.gotoAndStop(SLIDE_B.B_T_W.descText.text);
SLIDE_B.B_T_L.descText.text = "Lava";
SLIDE_B.B_T_L.sprite.gotoAndStop(SLIDE_B.B_T_L.descText.text);
SLIDE_B.B_T_S.descText.text = "Spikes";
SLIDE_B.B_T_S.sprite.gotoAndStop(SLIDE_B.B_T_S.descText.text);
SLIDE_B.B_T_I.descText.text = "Coin";
SLIDE_B.B_T_I.sprite.gotoAndStop("COIN");
SLIDE_B.B_T_X.descText.text = "Eraser";
SLIDE_B.B_T_X.sprite.gotoAndStop(SLIDE_B.B_T_X.descText.text);
SLIDE_T.B_T_LS.sprite.gotoAndStop("SMOOTH");
SLIDE_T.B_T_OUTPUT.sprite.gotoAndStop("PREVIEW");
SLIDE_T.EXTRAS_PSHAPES.B_T_CIRCLE.descText.text = "Circle";
SLIDE_T.EXTRAS_PSHAPES.B_T_CIRCLE.sprite.gotoAndStop(SLIDE_T.EXTRAS_PSHAPES.B_T_CIRCLE.descText.text);
SLIDE_T.EXTRAS_PSHAPES.B_T_SQUARE.descText.text = "Square";
SLIDE_T.EXTRAS_PSHAPES.B_T_SQUARE.sprite.gotoAndStop(SLIDE_T.EXTRAS_PSHAPES.B_T_SQUARE.descText.text);
SLIDE_T.B_T_PS.sprite.gotoAndStop("BOX2D");
SLIDE_T.EXTRAS_PSHAPES.B_T_EXIT.sprite.gotoAndStop("LE_EXIT");
addButton(SLIDE_T.B_T_BS, "setBrush_BS", "", "", "");
addButton(SLIDE_T.EXTRAS_BS.B1, "", "", "setBrushSizeS", "");
addButton(SLIDE_T.EXTRAS_BS.B3, "", "", "setBrushSizeM", "");
addButton(SLIDE_T.EXTRAS_BS.B5, "", "", "setBrushSizeL", "");
addButton(SLIDE_B.B_T_F, "setBrush_F", "", "", "");
addButton(SLIDE_B.EXTRAS_F.B1, "", "", "setLandTypeF", "");
addButton(SLIDE_B.EXTRAS_F.B2, "", "", "setLandTypeR0", "");
addButton(SLIDE_B.EXTRAS_F.B3, "", "", "setLandTypeR1", "");
addButton(SLIDE_B.EXTRAS_F.B4, "", "", "setLandTypeR2", "");
addButton(SLIDE_B.EXTRAS_F.B5, "", "", "setLandTypeR3", "");
addButton(SLIDE_B.B_T_S, "setBrush_S", "", "", "");
addButton(SLIDE_B.EXTRAS_S.B1, "", "", "setSpikeTypeR0", "");
addButton(SLIDE_B.EXTRAS_S.B2, "", "", "setSpikeTypeR1", "");
addButton(SLIDE_B.EXTRAS_S.B3, "", "", "setSpikeTypeR2", "");
addButton(SLIDE_B.EXTRAS_S.B4, "", "", "setSpikeTypeR3", "");
addButton(SLIDE_B.B_T_X, "setBrush_X", "", "", "");
addButton(SLIDE_B.B_T_W, "setBrush_W", "", "", "");
addButton(SLIDE_B.B_T_L, "setBrush_L", "", "", "");
addButton(SLIDE_B.B_T_I, "setBrush_I", "", "", "");
addButton(SLIDE_T.B_T_LS, "smoothLevel", "", "", "");
addButton(SLIDE_SU.BCONFIRM, "smoothConfirm", "", "", "");
addButton(SLIDE_SU.BUNDO, "smoothUndo", "", "", "");
SLIDE_SU.BUNDO.gotoAndStop("BUNDO");
SLIDE_SU.BCONFIRM.gotoAndStop("BCONFIRM");
addButton(SLIDE_T.B_T_OUTPUT, "previewLevel", "", "", "");
addButton(SLIDE_T.B_T_PS, "objectMode", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_T_EXIT, "objectModeExit", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_T_CIRCLE, "objectCircle", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_T_SQUARE, "objectSquare", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_T_KEY, "objectKey", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_T_DOOR, "objectDoor", "", "", "");
SLIDE_T.EXTRAS_PSHAPES.B_T_KEY.sprite.gotoAndStop("KEY");
SLIDE_T.EXTRAS_PSHAPES.B_T_DOOR.sprite.gotoAndStop("DOOR");
SLIDE_T.EXTRAS_PSHAPES.B_T_DOOR.descText.text = "DOOR";
SLIDE_T.EXTRAS_PSHAPES.B_T_KEY.descText.text = "KEY";
SLIDE_T.B_T_TGL.sprite.gotoAndStop("ARROW_L");
SLIDE_T.B_T_TGR.sprite.gotoAndStop("ARROW_R");
addButton(SLIDE_T.B_T_TGL, "terrainParLeft", "", "", "");
addButton(SLIDE_T.B_T_TGR, "terrainParRight", "", "", "");
addButton(SLIDE_T.B_T_TGB, "terrainGraphicRight", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.B_SIZE, "object_SIZE", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_T_LINK1, "linkageSetup1", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_T_LINK2, "linkageSetup2", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_T_LINK3, "linkageSetup3", "", "", "");
addButton(SLIDE_L.B_T_DELETE, "deleteLinkPoint", "", "deleteLinkageText", "resetLinkageText");
addButton(SLIDE_L.B_T_CANCEL, "deleteLinkPoint", "", "cancelLinkageText", "resetLinkageText");
addButton(SLIDE_L.TS.B_T_LOOSE, "looseLinkType", "", "looseLinkageText", "resetLinkageText");
addButton(SLIDE_L.TS.B_T_LOOSEC, "looseCLinkType", "", "looseCLinkageText", "resetLinkageText");
addButton(SLIDE_L.TS.B_T_SOLID, "solidLinkType", "", "solidLinkageText", "resetLinkageText");
addButton(SLIDE_L.TS.B_T_SOLIDC, "solidCLinkType", "", "solidCLinkageText", "resetLinkageText");
SLIDE_L.TS.B_T_LOOSE.descText.text = "LOOSE LINK";
SLIDE_L.TS.B_T_LOOSE.sprite.gotoAndStop("LINKL");
SLIDE_L.TS.B_T_LOOSEC.descText.text = "LOOSE LINK W/Col";
SLIDE_L.TS.B_T_LOOSEC.sprite.gotoAndStop("LINKLC");
SLIDE_L.TS.B_T_SOLID.descText.text = "SOLID LINK";
SLIDE_L.TS.B_T_SOLID.sprite.gotoAndStop("LINKS");
SLIDE_L.TS.B_T_SOLIDC.descText.text = "SOLID LINK W/Col";
SLIDE_L.TS.B_T_SOLIDC.sprite.gotoAndStop("LINKSC");
SLIDE_L.B_T_CANCEL.descText.text = "BACK";
SLIDE_L.B_T_CANCEL.sprite.gotoAndStop("LINKCAN");
SLIDE_L.B_T_DELETE.descText.text = "CLEAR";
SLIDE_L.B_T_DELETE.sprite.gotoAndStop("LINKDEL");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_FIXED, "PROPS_FIXED", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_DYNAMIC, "PROPS_DYNAMIC", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_RR, "PROPS_RR", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_RL, "PROPS_RL", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_IR, "PROPS_IR", "", "", "");
addButton(SLIDE_T.EXTRAS_PSHAPES.B_IL, "PROPS_IL", "", "", "");
addButton(TITLEBUTTON, "TOTITLE", "", "", "");
TITLEBUTTON.sprite.gotoAndStop("BUNDO");
SLIDE_T.parScore.text = terrainPar;
graphicStore = 1;
rotStore = 0;
PFixSet = 2;
sizeButOffset = new Point(0, 0);
but = SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.B_SIZE;
FPSTicker = 0;
FPSOld = 0;
smoothUndoArray = new Array();
firstTileOffset = false;
autoSaveCodeSegment = "";
autoSaveCodePosistion = 0;
autoSavePassiveSpeed = 5;
autoSaveTimer = 0;
SLIDE_T.EXTRAS_PSHAPES.sizeBlock.alpha = 0.75;
SLIDE_T.EXTRAS_PSHAPES.linkageBlock.alpha = 0.75;
undoPointPos = new Point(0, 0);
linkageNum = 1;
linkageType = 0;
setLinks();
linkColArray = new Array(0xFF0000, 1722623, 16776986);
linkPosArrayX = new Array(0, -2, 2);
linkPosArrayY = new Array(-2, 2, 2);
terrainGraphic = BG.currentFrame;
}
public function cancelLinkPoint(_arg1){
linkageNum = 0;
linkageActive = false;
linkageType = 0;
if (linkTarget != undefined){
linkTarget.LINKS.visible = false;
};
SLIDE_L.TS.y = (SLIDE_L.TS.y + 100);
SLIDE_L.LINKRING.x = -2000;
}
public function smoothLevel(_arg1){
var _local2:Boolean;
var _local3:Number;
var _local4:Boolean;
var _local5:Boolean;
var _local6:Boolean;
var _local7:Boolean;
var _local8:Number;
_local2 = false;
_local3 = 0;
while (_local3 < baseBlocks.length) {
_local4 = false;
_local5 = false;
_local6 = false;
_local7 = false;
_local8 = 0;
if (baseBlocks[_local3].sprite.currentFrame == 1){
if (baseBlocks[(_local3 + 1)] != undefined){
if ((((baseBlocks[(_local3 + 1)].sprite.currentFrame == 2)) && ((baseBlocks[(_local3 + 1)].x > baseBlocks[_local3].x)))){
_local4 = true;
_local8++;
};
};
if (baseBlocks[(_local3 + MovieClip(parent).levelSizeX)] != undefined){
if ((((baseBlocks[(_local3 + MovieClip(parent).levelSizeX)].sprite.currentFrame == 2)) && ((baseBlocks[(_local3 + MovieClip(parent).levelSizeX)].y > baseBlocks[_local3].y)))){
_local5 = true;
_local8++;
};
};
if (baseBlocks[(_local3 - 1)] != undefined){
if ((((baseBlocks[(_local3 - 1)].sprite.currentFrame == 2)) && ((baseBlocks[(_local3 - 1)].x < baseBlocks[_local3].x)))){
_local6 = true;
_local8++;
};
};
if (baseBlocks[(_local3 - MovieClip(parent).levelSizeX)] != undefined){
if ((((baseBlocks[(_local3 - MovieClip(parent).levelSizeX)].sprite.currentFrame == 2)) && ((baseBlocks[(_local3 - MovieClip(parent).levelSizeX)].y < baseBlocks[_local3].y)))){
_local7 = true;
_local8++;
};
};
if (_local8 == 2){
if ((((_local4 == true)) && ((_local5 == true)))){
setBlockSmooth(270, _local3);
_local2 = true;
} else {
if ((((_local5 == true)) && ((_local6 == true)))){
setBlockSmooth(0, _local3);
_local2 = true;
} else {
if ((((_local6 == true)) && ((_local7 == true)))){
setBlockSmooth(90, _local3);
_local2 = true;
} else {
if ((((_local7 == true)) && ((_local4 == true)))){
setBlockSmooth(180, _local3);
_local2 = true;
};
};
};
};
};
};
_local3++;
};
if (_local2 == true){
SLIDE_SU.y = 360;
mouseClickFreeze = true;
};
}
public function setLinks(){
var _local1:Number;
_local1 = 0;
while (_local1 < objectArray.length) {
objectArray[_local1].linkTarg1 = linkIDtoShape(objectArray[_local1].link1);
objectArray[_local1].linkTarg2 = linkIDtoShape(objectArray[_local1].link2);
objectArray[_local1].linkTarg3 = linkIDtoShape(objectArray[_local1].link3);
_local1++;
};
}
public function linkageSetup3(_arg1){
setLinkage(3);
}
public function PROPS_IR(_arg1){
if (activeObject.type != 4){
activeObject.graphic++;
if (activeObject.graphic == 5){
activeObject.graphic = 1;
};
graphicStore = activeObject.graphic;
} else {
activeObject.sizeY++;
if (activeObject.sizeY == 10){
activeObject.sizeY = 9;
};
doorSizeStore = activeObject.sizeY;
};
}
public function ZCompile(_arg1){
var _local2:String;
var _local3:String;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = "";
_local3 = "";
_local4 = 0;
while (_local4 < _arg1.length) {
_local5 = Number(_arg1.charAt(_local4));
if (!isNaN(_local5)){
_local3 = (_local3 + _arg1.charAt(_local4));
} else {
if (_local3 == ""){
_local3 = "1";
_local4--;
} else {
_local6 = 0;
while (_local6 < Number(_local3)) {
_local2 = (_local2 + _arg1.charAt(_local4));
_local6++;
};
_local3 = "";
};
};
_local4++;
};
return (_local2);
}
public function ZCrush(_arg1){
var _local2:String;
var _local3:int;
var _local4:Number;
var _local5:String;
var _local6:Number;
var _local7:Number;
_local2 = "";
_local3 = 0;
_local4 = 0;
while (_local4 < _arg1.length) {
_local5 = _arg1.charAt(_local4);
_local3 = 0;
while (_arg1.charAt((_local4 + _local3)) == _local5) {
_local3++;
};
_local4 = (_local4 + (_local3 - 1));
_local6 = 0;
_local7 = 0;
if (_local3 > 1){
_local2 = (_local2 + _local3);
};
_local2 = (_local2 + _local5);
_local4++;
};
return (_local2);
}
public function PROPS_IL(_arg1){
if (activeObject.type != 4){
activeObject.graphic--;
if (activeObject.graphic == 0){
activeObject.graphic = 4;
};
graphicStore = activeObject.graphic;
} else {
activeObject.sizeY--;
if (activeObject.sizeY == 0){
activeObject.sizeY = 1;
};
doorSizeStore = activeObject.sizeY;
};
}
public function TOTITLE(_arg1){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.removeEventListener(MouseEvent.MOUSE_DOWN, MouseDown);
stage.removeEventListener(MouseEvent.MOUSE_UP, MouseUp);
removeAllButtons();
saveCode(ZCrush(buildTerrainCode(0, (MovieClip(parent).levelSizeX * MovieClip(parent).levelSizeY))));
destroyMovieClips(baseBlocks, BASE);
destroyMovieClips(objectArray, OBJECTS);
MovieClip(parent).gotoFrame(MovieClip(parent), "EDITORTITLE");
}
public function previewLevel(_arg1){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.removeEventListener(MouseEvent.MOUSE_DOWN, MouseDown);
stage.removeEventListener(MouseEvent.MOUSE_UP, MouseUp);
removeAllButtons();
saveCode(ZCrush(buildTerrainCode(0, (MovieClip(parent).levelSizeX * MovieClip(parent).levelSizeY))));
destroyMovieClips(baseBlocks, BASE);
destroyMovieClips(objectArray, OBJECTS);
MovieClip(parent).gotoFrame(MovieClip(parent), "ENGINE");
}
public function setLandTypeR1(_arg1){
SLIDE_B.EXTRAS_F.BSelect.x = SLIDE_B.EXTRAS_F.B3.x;
SLIDE_B.EXTRAS_F.BSelect.y = SLIDE_B.EXTRAS_F.B3.y;
typeSelect = 3;
rotSelect = 90;
SLIDE_B.B_T_F.sprite.gotoAndStop(typeSelect);
SLIDE_B.B_T_F.sprite.rotation = rotSelect;
typeStore_F = typeSelect;
rotStore_F = rotSelect;
}
public function objectKey(_arg1){
if (!checkLevelLimit()){
setActiveObject(newObject(3, graphicStore, OBJECTS.mouseX, OBJECTS.mouseY, linkStore, 1, 0, PFixSet, findLinkID(), "000", "000", "000"));
};
}
public function setLandTypeR0(_arg1){
SLIDE_B.EXTRAS_F.BSelect.x = SLIDE_B.EXTRAS_F.B2.x;
SLIDE_B.EXTRAS_F.BSelect.y = SLIDE_B.EXTRAS_F.B2.y;
typeSelect = 3;
rotSelect = 0;
SLIDE_B.B_T_F.sprite.gotoAndStop(typeSelect);
SLIDE_B.B_T_F.sprite.rotation = rotSelect;
typeStore_F = typeSelect;
rotStore_F = rotSelect;
}
public function setLandTypeR2(_arg1){
SLIDE_B.EXTRAS_F.BSelect.x = SLIDE_B.EXTRAS_F.B4.x;
SLIDE_B.EXTRAS_F.BSelect.y = SLIDE_B.EXTRAS_F.B4.y;
typeSelect = 3;
rotSelect = 180;
SLIDE_B.B_T_F.sprite.gotoAndStop(typeSelect);
SLIDE_B.B_T_F.sprite.rotation = rotSelect;
typeStore_F = typeSelect;
rotStore_F = rotSelect;
}
public function outputCode(_arg1){
buildTerrainCodeActive = 3;
}
public function setLandTypeR3(_arg1){
SLIDE_B.EXTRAS_F.BSelect.x = SLIDE_B.EXTRAS_F.B5.x;
SLIDE_B.EXTRAS_F.BSelect.y = SLIDE_B.EXTRAS_F.B5.y;
typeSelect = 3;
rotSelect = 270;
SLIDE_B.B_T_F.sprite.gotoAndStop(typeSelect);
SLIDE_B.B_T_F.sprite.rotation = rotSelect;
typeStore_F = typeSelect;
rotStore_F = rotSelect;
}
public function cancelLinkageText(_arg1){
SLIDE_L.descText.text = "RETURN TO THE SHAPE EDITOR WITHOUT SETTING A NEW ATTACHEMENT TYPE. (If you have already set a new shape to attach to this will be retained)";
}
public function setSpikeTypeR1(_arg1){
rotSelect = 90;
SLIDE_B.B_T_S.sprite.rotation = rotSelect;
SLIDE_B.EXTRAS_S.BSelect.x = SLIDE_B.EXTRAS_S.B2.x;
SLIDE_B.EXTRAS_S.BSelect.y = SLIDE_B.EXTRAS_S.B2.y;
}
public function setSpikeTypeR2(_arg1){
rotSelect = 180;
SLIDE_B.B_T_S.sprite.rotation = rotSelect;
SLIDE_B.EXTRAS_S.BSelect.x = SLIDE_B.EXTRAS_S.B3.x;
SLIDE_B.EXTRAS_S.BSelect.y = SLIDE_B.EXTRAS_S.B3.y;
}
public function setSpikeTypeR3(_arg1){
rotSelect = 270;
SLIDE_B.B_T_S.sprite.rotation = rotSelect;
SLIDE_B.EXTRAS_S.BSelect.x = SLIDE_B.EXTRAS_S.B4.x;
SLIDE_B.EXTRAS_S.BSelect.y = SLIDE_B.EXTRAS_S.B4.y;
}
public function MouseDown(_arg1:Event){
if (mouseClickFreeze == false){
mousePressed = true;
basePressed = baseActive;
};
}
public function deleteObject(_arg1, _arg2){
freeLinkID(_arg1.linkID);
activeObject = undefined;
currentDraggable = undefined;
linkageObject = undefined;
if (_arg1.fixed == 1){
if (_arg1.type != 3){
levelCapOffset++;
};
};
OBJECTS.removeChild(_arg1);
_arg1.destroyed = true;
_arg1.removeEventListener(MouseEvent.MOUSE_DOWN, MouseDown);
_arg1 = null;
objectArray.splice(_arg2, 1);
}
public function setSpikeTypeR0(_arg1){
rotSelect = 0;
SLIDE_B.B_T_S.sprite.rotation = 0;
SLIDE_B.EXTRAS_S.BSelect.x = SLIDE_B.EXTRAS_S.B1.x;
SLIDE_B.EXTRAS_S.BSelect.y = SLIDE_B.EXTRAS_S.B1.y;
}
public function onEnterFrame(_arg1:Event){
if (currentDraggable != undefined){
if (linkageActive == false){
if ((((((((OBJECTS.mouseY > 360)) || ((OBJECTS.mouseY < 20)))) || ((OBJECTS.mouseX > 600)))) || ((OBJECTS.mouseX < 40)))){
currentDraggable.alpha = 0.3;
} else {
currentDraggable.alpha = 1;
};
if (currentDraggable.ID == 9){
activeShapeOffsetX = 0;
activeShapeOffsetY = 0;
};
currentDraggable.x = (Math.round(((OBJECTS.mouseX - activeShapeOffsetX) / 10)) * 10);
currentDraggable.y = (Math.round(((OBJECTS.mouseY - activeShapeOffsetY) / 10)) * 10);
};
};
manageLinkage();
drawLinks();
manageObjects();
autoSave();
baseMouse.x = (baseMouse.x + ((BASE.mouseX - baseMouse.x) / 1));
baseMouse.y = (baseMouse.y + ((BASE.mouseY - baseMouse.y) / 1));
FPSCounter();
inBaseBounds();
if (objectEditor == false){
playMouseTouch();
lightTiles();
};
if (buildTerrainCodeActive > 0){
buildTerrainCodeActive--;
if (buildTerrainCodeActive == 2){
} else {
if (buildTerrainCodeActive == 1){
buildTerrainCode(0, (MovieClip(parent).levelSizeX * MovieClip(parent).levelSizeY));
};
};
};
}
public function linkageSetup1(_arg1){
setLinkage(1);
}
public function linkageSetup2(_arg1){
setLinkage(2);
}
public function resetLinkageText(_arg1){
SLIDE_L.descText.text = "CLICK THE SHAPE YOU WOULD LIKE TO ATTACH TO THE CURRENT SHAPE, THEN SELECT WHICH TYPE OF ATTACHMENT YOU WOULD LIKE.";
}
public function angle(_arg1, _arg2, _arg3, _arg4){
return ((Math.round(((Math.atan2((_arg4 - _arg2), (_arg3 - _arg1)) / 3.141593) * 180)) + 90));
}
public function codeDecrypt(_arg1){
var _local2:Point;
_local2 = new Point();
_local2.x = 0;
_local2.y = 0;
if (_arg1 == "A"){
_local2.x = 1;
} else {
if (_arg1 == "B"){
_local2.x = 2;
} else {
if ((((((((_arg1 == "C")) || ((_arg1 == "D")))) || ((_arg1 == "E")))) || ((_arg1 == "F")))){
_local2.x = 3;
if (_arg1 == "D"){
_local2.y = 90;
} else {
if (_arg1 == "E"){
_local2.y = 180;
} else {
if (_arg1 == "F"){
_local2.y = -90;
};
};
};
} else {
if (_arg1 == "G"){
_local2.x = 4;
} else {
if (_arg1 == "H"){
_local2.x = 5;
} else {
if ((((((((_arg1 == "I")) || ((_arg1 == "J")))) || ((_arg1 == "K")))) || ((_arg1 == "L")))){
_local2.x = 6;
if (_arg1 == "J"){
_local2.y = 90;
} else {
if (_arg1 == "K"){
_local2.y = 180;
} else {
if (_arg1 == "L"){
_local2.y = -90;
};
};
};
} else {
if (_arg1 == "M"){
_local2.x = 7;
};
};
};
};
};
};
};
return (_local2);
}
public function deleteLinkageText(_arg1){
SLIDE_L.descText.text = "DELETE THE CURRENT SHAPE ATTACHMENT SELECTION AND RETURN TO THE SHAPE EDITOR.";
}
public function setBlockSmooth(_arg1, _arg2){
smoothUndoArray.push(_arg2);
baseBlocks[_arg2].sprite.rotation = _arg1;
baseBlocks[_arg2].sprite.gotoAndStop(3);
}
public function populateBase(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:MovieClip;
_local1 = 0;
_local2 = 0;
_local3 = 0;
while (_local3 < (MovieClip(parent).levelSizeX * MovieClip(parent).levelSizeY)) {
_local4 = new LE_BLOCK();
_local4.x = (blockSize * _local1);
_local4.y = (blockSize * _local2);
_local4.width = blockSize;
_local4.height = blockSize;
BASE.addChild(_local4);
baseBlocks.push(_local4);
_local1++;
if (_local1 == MovieClip(parent).levelSizeX){
_local1 = 0;
_local2++;
};
_local3++;
};
loadCode(levelCode.charAt(_local3));
loadObjects(codeSplit[1]);
}
public function looseCLinkageText(_arg1){
SLIDE_L.descText.text = "CREATE A LOOSE LINK BETWEEN THE SHAPES THAT ALSO PREVENTS COLLISION BETWEEN THE TWO SHAPES.";
}
public function setLandTypeF(_arg1){
SLIDE_B.EXTRAS_F.BSelect.x = SLIDE_B.EXTRAS_F.B1.x;
SLIDE_B.EXTRAS_F.BSelect.y = SLIDE_B.EXTRAS_F.B1.y;
typeSelect = 2;
rotSelect = 0;
SLIDE_B.B_T_F.sprite.gotoAndStop(typeSelect);
SLIDE_B.B_T_F.sprite.rotation = rotSelect;
typeStore_F = typeSelect;
rotStore_F = rotSelect;
}
public function objectCircle(_arg1){
var _local2:Number;
if (checkLevelLimit()){
PFixSet = 1;
};
if (PCurSizeX > PCurSizeY){
_local2 = PCurSizeX;
} else {
_local2 = PCurSizeY;
};
setActiveObject(newObject(1, graphicStore, OBJECTS.mouseX, OBJECTS.mouseY, _local2, _local2, rotStore, PFixSet, findLinkID(), "000", "000", "000"));
}
public function FPSCounter(){
}
public function drawLinks(){
var _local1:Number;
var _local2:Number;
if (linkageActive == false){
LINKS.graphics.clear();
_local1 = 0;
while (_local1 < objectArray.length) {
_local2 = 1;
while (_local2 < 4) {
if (((!((objectArray[_local1] == undefined))) && (!((objectArray[_local1][("linkTarg" + _local2)] == undefined))))){
if (objectArray[_local1][("linkTarg" + _local2)].destroyed == true){
objectArray[_local1][("linkTarg" + _local2)] = undefined;
};
};
LINKS.graphics.lineStyle(5, linkColArray[(_local2 - 1)], 1);
if (((!((objectArray[_local1] == undefined))) && (!((objectArray[_local1][("linkTarg" + _local2)] == undefined))))){
LINKS.graphics.moveTo((objectArray[_local1].x + linkPosArrayX[(_local2 - 1)]), (objectArray[_local1].y + linkPosArrayY[(_local2 - 1)]));
LINKS.graphics.lineTo((objectArray[_local1][("linkTarg" + _local2)].x + linkPosArrayX[(_local2 - 1)]), (objectArray[_local1][("linkTarg" + _local2)].y + linkPosArrayY[(_local2 - 1)]));
};
_local2++;
};
_local1++;
};
};
}
public function calcSpeed(_arg1, _arg2){
var _local3:Number;
var _local4:Object;
_local3 = (_arg1 * 0.01745329);
_local4 = new Object();
_local4.x = (_arg2 * Math.cos(_local3));
_local4.y = (_arg2 * Math.sin(_local3));
return (_local4);
}
public function newObject(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12){
var _local13:MovieClip;
var _local14:Number;
_local13 = new LE_OBJECT();
if (_arg1 != undefined){
_local13.type = _arg1;
};
_local13.LINKS.visible = false;
_local13.graphic = _arg2;
if (_arg1 == 1){
_local14 = MovieClip(parent).graphics_Circles[_arg2];
} else {
if (_arg1 == 2){
_local14 = MovieClip(parent).graphics_Squares[_arg2];
} else {
if (_arg1 == 4){
_local14 = 9;
_local13.ID = 8;
_local13.graphic = 9;
} else {
if (_arg1 == 3){
_local14 = 10;
_local13.ID = 3;
};
};
};
};
_local13.sizeX = _arg5;
_local13.sizeY = _arg6;
_local13.SPRITE.gotoAndStop(_local14);
_local13.SHAPE.gotoAndStop(_local14);
_local13.LINKS.gotoAndStop(_local14);
_local13.staticLock.gotoAndStop(_local14);
if (_local13.type == 4){
_local13.SPRITE.sprite.gotoAndStop(_arg6);
_local13.SHAPE.sprite.gotoAndStop(_arg6);
_local13.staticLock.sprite.gotoAndStop(_arg6);
_local13.LINKS.sprite.gotoAndStop(_arg6);
};
_local13.x = _arg3;
_local13.y = _arg4;
_local13.rot = Number(_arg7);
_local13.fixed = _arg8;
if (_arg8 == 1){
if (_local13.type != 3){
levelCapOffset--;
};
};
_local13.linkID = Number(_arg9);
usedLinkID.push(_local13.linkID);
_local13.link1 = Number((String(_arg10.charAt(0)) + String(_arg10.charAt(1))));
_local13.link2 = Number((String(_arg11.charAt(0)) + String(_arg11.charAt(1))));
_local13.link3 = Number((String(_arg12.charAt(0)) + String(_arg12.charAt(1))));
_local13.link1Type = Number(_arg10.charAt(2));
_local13.link2Type = Number(_arg11.charAt(2));
_local13.link3Type = Number(_arg12.charAt(2));
_local13.destroyed = false;
OBJECTS.addChild(_local13);
objectArray.push(_local13);
return (_local13);
}
public function object_SIZE(_arg1){
if (SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.alpha == 1){
sizeButOffset.x = (SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.mouseX - but.x);
sizeButOffset.y = (SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.mouseY - but.y);
addEventListener(Event.ENTER_FRAME, SIZEMM);
stage.addEventListener(MouseEvent.MOUSE_UP, SIZEMMU);
};
}
public function looseLinkType(_arg1){
linkageType = 1;
finishLink();
}
public function saveCode(_arg1){
var _local2:String;
var _local3:Date;
_local2 = (_arg1 + buildShapeCode());
trace(_local2);
MovieClip(parent).savefile.data.editor_tempSave = _local2;
MovieClip(parent).levelCode = _local2;
_local3 = new Date();
MovieClip(parent).savefile.data.editor_tempSave_name = ((((((((("" + _local3.getHours()) + ":") + _local3.getMinutes()) + " ") + _local3.getDate()) + "/") + (_local3.getMonth() + 1)) + "/") + _local3.getFullYear());
MovieClip(parent).savefile.flush();
}
public function SIZEMMU(_arg1){
removeEventListener(Event.ENTER_FRAME, SIZEMM);
stage.removeEventListener(MouseEvent.MOUSE_UP, SIZEMMU);
}
public function pythag(_arg1, _arg2, _arg3, _arg4){
return (Math.sqrt((Math.pow((_arg2 - _arg4), 2) + Math.pow((_arg1 - _arg3), 2))));
}
public function rotatedXY(_arg1, _arg2, _arg3){
var _local4:Object;
var _local5:*;
var _local6:*;
var _local7:*;
_local4 = new Object();
_local5 = ((6.28 / 360) * _arg3);
_local6 = Math.sin(_local5);
_local7 = Math.cos(_local5);
_local4.x = ((_arg1 * _local7) - (_arg2 * _local6));
_local4.y = ((_arg1 * _local6) + (_arg2 * _local7));
return (_local4);
}
public function addButton(_arg1, _arg2:String, _arg3:String, _arg4:String, _arg5:String){
var _local6:*;
_arg1.pressVar = _arg2;
_arg1.releaseVar = _arg3;
_arg1.rollVar = _arg4;
_arg1.outVar = _arg5;
_local6 = _arg1;
if (_arg1.pressVar != ""){
_local6.addEventListener(MouseEvent.MOUSE_DOWN, this[_arg2]);
};
if (_arg1.releaseVar != ""){
_local6.addEventListener(MouseEvent.MOUSE_UP, this[_arg3]);
};
if (_arg1.rollVar != ""){
_local6.addEventListener(MouseEvent.MOUSE_OVER, this[_arg4]);
};
if (_arg1.outVar != ""){
_local6.addEventListener(MouseEvent.MOUSE_OUT, this[_arg5]);
};
buttonArray.push(_arg1);
}
public function smoothConfirm(_arg1){
mouseClickFreeze = false;
SLIDE_SU.y = 2000;
smoothUndoArray.splice(0, smoothUndoArray.length);
}
public function objectSquare(_arg1){
if (checkLevelLimit()){
PFixSet = 1;
};
setActiveObject(newObject(2, graphicStore, OBJECTS.mouseX, OBJECTS.mouseY, PCurSizeX, PCurSizeY, rotStore, PFixSet, findLinkID(), "000", "000", "000"));
}
public function loadObjects(_arg1){
var _local2:*;
var _local3:String;
var _local4:String;
var _local5:String;
var _local6:String;
var _local7:Number;
var _local8:*;
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:String;
var _local18:String;
var _local19:String;
var _local20:String;
var _local21:Number;
if (((!((_arg1 == null))) && (!((_arg1 == undefined))))){
_local2 = codeSplit[2];
_local3 = "";
_local4 = "";
_local5 = "";
_local6 = "";
_local7 = 0;
while (_local7 < 3) {
_local3 = (_local3 + String(_local2.charAt(_local7)));
_local7++;
};
_local7 = 3;
while (_local7 < 6) {
_local4 = (_local4 + String(_local2.charAt(_local7)));
_local7++;
};
_local7 = 6;
while (_local7 < 9) {
_local5 = (_local5 + _local2.charAt(_local7));
_local7++;
};
_local7 = 9;
while (_local7 < 12) {
_local6 = (_local6 + _local2.charAt(_local7));
_local7++;
};
setStartPoint(Number(_local3), Number(_local4));
setEndPoint(Number(_local5), Number(_local6));
BGStop = Number(_local2.charAt(_local7));
levelGraphic = BGStop;
BG.gotoAndStop(Number(BGStop));
terrainPar = Number(_local2.charAt((_local7 + 1)));
_local2 = codeSplit[1];
_local8 = new Array("SQUARE", "CIRCLE");
_local9 = 0;
_local7 = 0;
while (_local7 < ((_local2.length / 23) - 1)) {
_local10 = Number(_local2.charAt((_local9 + _local7)));
_local11 = Number(_local2.charAt(((_local9 + _local7) + 1)));
_local12 = (Number(((_local2.charAt(((_local9 + _local7) + 2)) + _local2.charAt(((_local9 + _local7) + 3))) + _local2.charAt(((_local9 + _local7) + 4)))) - 180);
_local13 = (Number(((_local2.charAt(((_local9 + _local7) + 5)) + _local2.charAt(((_local9 + _local7) + 6))) + _local2.charAt(((_local9 + _local7) + 7)))) - 180);
_local14 = Number(_local2.charAt(((_local9 + _local7) + 8)));
_local15 = Number(_local2.charAt(((_local9 + _local7) + 9)));
_local16 = Number((String(_local2.charAt(((_local9 + _local7) + 10))) + String(_local2.charAt(((_local9 + _local7) + 11)))));
_local17 = (_local2.charAt(((_local9 + _local7) + 12)) + _local2.charAt(((_local9 + _local7) + 13)));
_local18 = ((_local2.charAt(((_local9 + _local7) + 14)) + _local2.charAt(((_local9 + _local7) + 15))) + _local2.charAt(((_local9 + _local7) + 16)));
_local19 = ((_local2.charAt(((_local9 + _local7) + 17)) + _local2.charAt(((_local9 + _local7) + 18))) + _local2.charAt(((_local9 + _local7) + 19)));
_local20 = ((_local2.charAt(((_local9 + _local7) + 20)) + _local2.charAt(((_local9 + _local7) + 21))) + _local2.charAt(((_local9 + _local7) + 22)));
_local21 = Number(_local2.charAt(((_local9 + _local7) + 23)));
newObject(_local10, _local11, _local12, _local13, _local14, _local15, _local16, _local21, _local17, _local18, _local19, _local20);
_local9 = (_local9 + 23);
_local7++;
};
};
}
public function ZNumCrush(_arg1){
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + ZNumToChar[Number(_arg1.charAt(_local3))]);
_local3++;
};
return (ZCrush(_local2));
}
public function terrainParLeft(_arg1){
terrainPar--;
if (terrainPar == 0){
terrainPar = 9;
};
SLIDE_T.parScore.text = terrainPar;
}
public function setBrushSizeM(_arg1){
SLIDE_T.EXTRAS_BS.BSelect.x = SLIDE_T.EXTRAS_BS.B3.x;
curSize = 40;
SLIDE_T.B_T_BS.sprite.gotoAndStop("size2");
}
public function setBrushSizeS(_arg1){
SLIDE_T.EXTRAS_BS.BSelect.x = SLIDE_T.EXTRAS_BS.B1.x;
curSize = 10;
SLIDE_T.B_T_BS.sprite.gotoAndStop("size1");
}
public function looseCLinkType(_arg1){
linkageType = 3;
finishLink();
}
public function destroyMovieClips(_arg1, _arg2){
var _local3:Number;
_local3 = 0;
while (_local3 < _arg1.length) {
_arg2.removeChild(_arg1[_local3]);
delete _arg1[_local3];
_arg1.splice(_local3, 1);
_local3--;
_local3++;
};
}
public function clearFakeBlocks(){
var _local1:Number;
var _local2:MovieClip;
_local1 = 0;
while (_local1 < baseBlocks.length) {
_local2 = baseBlocks[_local1];
if ((((_local2.x < 10)) || ((_local2.x >= ((MovieClip(parent).levelSizeX * 20) - 20))))){
_local2.sprite.gotoAndStop(1);
};
_local1++;
};
baseBlocks[0].sprite.gotoAndStop(2);
baseBlocks[(baseBlocks.length - 30)].sprite.gotoAndStop(2);
}
public function SIZEMM(_arg1){
var _local2:Number;
var _local3:Number;
SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.B_TARG.x = SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.mouseX;
SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.B_TARG.y = SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.mouseY;
_local2 = (Math.round((SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.mouseX / 12)) * 12);
_local3 = (Math.round((SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.mouseY / 12)) * 12);
if (activeObject.type == 1){
_local3 = (_local3 - sizeButOffset.y);
_local2 = (120 - _local3);
} else {
if (activeObject.type == 2){
_local2 = (_local2 - sizeButOffset.x);
_local3 = (_local3 - sizeButOffset.y);
} else {
if ((((activeObject.type == 3)) || ((activeObject.type == 4)))){
_local3 = (_local3 - sizeButOffset.y);
_local2 = (120 - _local3);
};
};
};
but.x = _local2;
but.y = _local3;
if (but.x < 15){
but.x = 15;
} else {
if (but.x > 105){
but.x = 105;
};
};
if (but.y < 15){
but.y = 15;
} else {
if (but.y > 105){
but.y = 105;
};
};
if (((!((activeObject.type == 3))) && (!((activeObject.type == 4))))){
activeObject.sizeX = Math.round((but.x / 12));
activeObject.sizeY = (10 - Math.round((but.y / 12)));
PCurSizeX = activeObject.sizeX;
PCurSizeY = activeObject.sizeY;
} else {
activeObject.sizeX = Math.round((but.x / 12));
linkStore = activeObject.sizeX;
};
}
public function setActiveObject(_arg1){
if (objectEditor == true){
currentDraggable = _arg1;
activeObject = _arg1;
if (_arg1.ID != 9){
undoPointPos.x = undefined;
if (_arg1.fixed == 1){
PFixSet = 1;
SLIDE_T.EXTRAS_PSHAPES.B_FIXEDTICK.y = (SLIDE_T.EXTRAS_PSHAPES.B_FIXED.y - 5);
} else {
PFixSet = 2;
SLIDE_T.EXTRAS_PSHAPES.B_FIXEDTICK.y = (SLIDE_T.EXTRAS_PSHAPES.B_DYNAMIC.y - 5);
};
if ((((_arg1.type == 3)) || ((_arg1.type == 4)))){
SLIDE_T.EXTRAS_PSHAPES.propImageText.text = "SIZE";
} else {
SLIDE_T.EXTRAS_PSHAPES.propImageText.text = "IMAGE";
};
if (((!((_arg1.type == 3))) && (!((_arg1.type == 4))))){
but.x = (_arg1.sizeX * 12);
but.y = (120 - (_arg1.sizeY * 12));
activeShapeOffsetX = (OBJECTS.mouseX - _arg1.x);
activeShapeOffsetY = (OBJECTS.mouseY - _arg1.y);
} else {
but.x = (_arg1.sizeX * 12);
but.y = (120 - (_arg1.sizeX * 12));
activeShapeOffsetX = (OBJECTS.mouseX - _arg1.x);
activeShapeOffsetY = (OBJECTS.mouseY - _arg1.y);
};
} else {
undoPointPos.x = _arg1.x;
undoPointPos.y = _arg1.y;
};
return (_arg1);
};
}
public function buildTerrainCode(_arg1, _arg2){
var _local3:String;
var _local4:Number;
var _local5:*;
_local3 = "";
_local4 = _arg1;
while (_local4 < _arg2) {
_local5 = codeEncrypt(baseBlocks[_local4].sprite.currentFrame, baseBlocks[_local4].sprite.rotation);
_local3 = (_local3 + _local5);
_local4++;
};
return (_local3);
}
public function finishLink(){
activeObject[("link" + linkageNum)] = linkTarget.linkID;
activeObject[(("link" + linkageNum) + "Type")] = linkageType;
activeObject[("linkTarg" + linkageNum)] = linkTarget;
linkageActive = false;
SLIDE_L.TS.y = (SLIDE_L.TS.y + 100);
if (linkTarget != undefined){
linkTarget.LINKS.visible = false;
};
linkTarget = undefined;
linkageType = 0;
}
public function objectMode(_arg1){
activeObject = undefined;
currentDraggable = undefined;
linkageObject = undefined;
objectEditor = true;
SLIDE_T.EXTRAS_PSHAPES.y = 0;
}
public function PROPS_RL(_arg1){
activeObject.rot--;
if (activeObject.rot < 0){
activeObject.rot = 19;
};
rotStore = activeObject.rot;
doorRotStore = activeObject.rot;
}
public function solidCLinkageText(_arg1){
SLIDE_L.descText.text = "CREATE A SOLID LINK BETWEEN THE TWO SHAPES WHICH ALSO CHECK FOR COLLISION.";
}
public function PROPS_RR(_arg1){
activeObject.rot++;
if (activeObject.rot == 20){
activeObject.rot = 0;
};
rotStore = activeObject.rot;
doorRotStore = activeObject.rot;
}
public function setBrushSizeL(_arg1){
SLIDE_T.EXTRAS_BS.BSelect.x = SLIDE_T.EXTRAS_BS.B5.x;
curSize = 90;
SLIDE_T.B_T_BS.sprite.gotoAndStop("size3");
}
public function objectDoor(_arg1){
if (!checkLevelLimit()){
setActiveObject(newObject(4, graphicStore, OBJECTS.mouseX, OBJECTS.mouseY, linkStore, doorSizeStore, doorRotStore, 2, findLinkID(), "000", "000", "000"));
};
}
public function PROPS_FIXED(_arg1){
if (activeObject.fixed != 1){
activeObject.fixed = 1;
if (activeObject.type != 3){
levelCapOffset--;
};
PFixSet = 1;
SLIDE_T.EXTRAS_PSHAPES.B_FIXEDTICK.y = (SLIDE_T.EXTRAS_PSHAPES.B_FIXED.y - 5);
};
}
public function findLinkID(){
var _local1:Number;
var _local2:Boolean;
var _local3:Number;
_local1 = 9;
_local2 = false;
while (_local2 == false) {
_local2 = true;
_local1++;
_local3 = 0;
while (_local3 < usedLinkID.length) {
if (_local1 == usedLinkID[_local3]){
_local2 = false;
};
_local3++;
};
};
usedLinkID.push(_local1);
return (("" + _local1));
}
public function smoothUndo(_arg1){
var _local2:Number;
_local2 = 0;
while (_local2 < smoothUndoArray.length) {
baseBlocks[smoothUndoArray[_local2]].sprite.gotoAndStop(1);
_local2++;
};
smoothUndoArray.splice(0, smoothUndoArray.length);
mouseClickFreeze = false;
SLIDE_SU.y = 2000;
}
public function objectModeExit(_arg1){
objectEditor = false;
activeObject = undefined;
SLIDE_T.EXTRAS_PSHAPES.y = 2000;
}
public function setBrush_L(_arg1){
SLIDE_B.BSelect.x = SLIDE_B.B_T_L.x;
SLIDE_B.BSelect.y = SLIDE_B.B_T_L.y;
typeSelect = 5;
rotSelect = 0;
}
public function setBrush_I(_arg1){
SLIDE_B.BSelect.x = SLIDE_B.B_T_I.x;
SLIDE_B.BSelect.y = SLIDE_B.B_T_I.y;
typeSelect = 7;
rotSelect = 0;
}
public function setBrush_S(_arg1){
SLIDE_B.BSelect.x = SLIDE_B.B_T_S.x;
SLIDE_B.BSelect.y = SLIDE_B.B_T_S.y;
SLIDE_B.EXTRAS_S.x = 0;
SLIDE_B.EXTRAS_S.y = 0;
typeSelect = typeStore_S;
}
public function solidCLinkType(_arg1){
linkageType = 4;
finishLink();
}
public function setBrush_X(_arg1){
typeSelect = 1;
SLIDE_B.BSelect.y = SLIDE_B.B_T_X.y;
}
public function autoSave(){
if (mouseClickFreeze == false){
if (autoSaveTimer > 10){
if ((autoSaveCodePosistion + autoSavePassiveSpeed) > (MovieClip(parent).levelSizeX * MovieClip(parent).levelSizeY)){
autoSaveCodeSegment = (autoSaveCodeSegment + buildTerrainCode(autoSaveCodePosistion, (MovieClip(parent).levelSizeX * MovieClip(parent).levelSizeY)));
autoSaveCodeSegment = ZCrush(autoSaveCodeSegment);
saveCode(autoSaveCodeSegment);
autoSaveCodeSegment = "";
autoSaveCodePosistion = 0;
autoSaveTimer = 0;
} else {
autoSaveCodeSegment = (autoSaveCodeSegment + buildTerrainCode(autoSaveCodePosistion, (autoSaveCodePosistion + autoSavePassiveSpeed)));
autoSaveCodePosistion = (autoSaveCodePosistion + autoSavePassiveSpeed);
};
} else {
autoSaveTimer++;
};
};
}
public function ZNumCompile(_arg1){
var _local2:String;
var _local3:Number;
var _local4:Number;
_arg1 = ZCompile(_arg1);
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = 0;
while (_local4 < ZNumToChar.length) {
if (_arg1.charAt(_local3) == ZNumToChar[_local4]){
_local2 = (_local2 + String(_local4));
};
_local4++;
};
_local3++;
};
return (_local2);
}
public function checkLevelLimit(){
var _local1:Boolean;
_local1 = ((objectArray.length + levelCapOffset) >= 22);
if (_local1){
SLIDE_T.EXTRAS_PSHAPES.levelCapWarn.alpha = 2;
};
return (_local1);
}
public function manageLinkage(){
if ((((linkageActive == true)) && ((linkageType == 0)))){
SLIDE_L.y = 0;
SLIDE_L.visible = true;
if (activeObject != linkageObject){
if (((((((((((!((activeObject.type == 3))) && (!((activeObject.type == 4))))) && (!((activeObject.ID == 9))))) && (!((activeObject.linkTarg1 == linkageObject))))) && (!((activeObject.linkTarg2 == linkageObject))))) && (!((activeObject.linkTarg3 == linkageObject))))){
if (linkTarget != undefined){
linkTarget.LINKS.visible = false;
};
linkTarget = activeObject;
SLIDE_L.TS.y = 438;
setActiveObject(linkageObject);
} else {
setActiveObject(linkageObject);
};
};
if (linkTarget != undefined){
linkTarget.LINKS.visible = true;
};
} else {
SLIDE_L.y = -2000;
SLIDE_L.visible = false;
};
}
public function codeEncrypt(_arg1, _arg2){
if (_arg1 == 1){
return ("A");
};
if (_arg1 == 2){
return ("B");
};
if (_arg1 == 3){
if (_arg2 == 0){
return ("C");
};
if (_arg2 == 90){
return ("D");
};
if (_arg2 == 180){
return ("E");
};
if (_arg2 == -90){
return ("F");
};
} else {
if (_arg1 == 4){
return ("G");
};
if (_arg1 == 5){
return ("H");
};
if (_arg1 == 6){
if ((((_arg2 == 0)) || ((_arg2 == 360)))){
return ("I");
};
if (_arg2 == 90){
trace("SPIKE LEFT RIGHT");
return ("J");
};
if (_arg2 == 180){
return ("K");
};
if ((((_arg2 == -90)) || ((_arg2 == 270)))){
trace("SPIKE LEFT FOUND");
return ("L");
};
} else {
if (_arg1 == 7){
return ("M");
};
};
};
}
public function linkIDtoShape(_arg1){
var _local2:Number;
if (_arg1 != 0){
_local2 = 0;
while (_local2 < usedLinkID.length) {
if (_arg1 == usedLinkID[_local2]){
return (objectArray[_local2]);
};
_local2++;
};
};
}
public function terrainGraphicRight(_arg1){
terrainGraphic++;
if (terrainGraphic == 6){
terrainGraphic = 1;
};
BG.gotoAndStop(terrainGraphic);
}
public function inBaseBounds(){
baseActive = (((((((baseMouse.x > 0)) && ((baseMouse.y > 0)))) && ((baseMouse.x < (BASE.width - 1))))) && ((baseMouse.y < (BASE.height - 1))));
}
public function playMouseTouch(){
var _local1:Number;
if (baseActive == true){
_local1 = (Math.floor((baseMouse.x / blockSize)) + (Math.floor((baseMouse.y / blockSize)) * MovieClip(parent).levelSizeX));
if (baseBlocks[_local1] != undefined){
pos = _local1;
};
};
}
public function manageObjects(){
var i:Number;
var object:MovieClip;
var graphicDest:Number;
SLIDE_T.EXTRAS_PSHAPES.linkageBlock.y = 0;
SLIDE_T.EXTRAS_PSHAPES.sizeBlock.y = 0;
SLIDE_T.EXTRAS_PSHAPES.propsBlock.y = 155;
if (objectEditor == true){
OBJECTS.alpha = 0.8;
SLIDE_T.EXTRAS_PSHAPES.levelCap.width = ((125 / 22) * (objectArray.length + levelCapOffset));
SLIDE_T.EXTRAS_PSHAPES.levelCapWarn.alpha = (SLIDE_T.EXTRAS_PSHAPES.levelCapWarn.alpha / 1.1);
SLIDE_T.EXTRAS_PSHAPES.levelCapNum.text = (objectArray.length + levelCapOffset);
} else {
OBJECTS.alpha = 0.3;
};
i = 0;
while (i < objectArray.length) {
object = objectArray[i];
if (object.ID != 9){
if (object.fixed == 1){
object.staticLock.visible = true;
} else {
object.staticLock.visible = false;
};
if (object.type != 3){
object.rotation = 0;
if (object.type != 4){
object.width = (20 * object.sizeX);
object.height = (20 * object.sizeY);
} else {
object.SPRITE.sprite.light.gotoAndStop(object.sizeX);
object.width = 20;
};
object.rotation = (18 * object.rot);
} else {
object.SPRITE.key.light.gotoAndStop(object.sizeX);
object.width = 20;
object.height = 20;
};
if (object.type == 1){
graphicDest = MovieClip(parent).graphics_Circles[object.graphic];
} else {
if (object.type == 2){
graphicDest = MovieClip(parent).graphics_Squares[object.graphic];
} else {
if (object.type == 4){
graphicDest = 11;
} else {
if (object.type == 3){
graphicDest = 10;
};
};
};
};
object.SPRITE.gotoAndStop(graphicDest);
object.staticLock.gotoAndStop(graphicDest);
object.SHAPE.gotoAndStop(graphicDest);
object.LINKS.gotoAndStop(graphicDest);
object.SHAPE.visible = false;
if (((!((currentDraggable == object))) && (!((object.alpha == 1))))){
deleteObject(object, i);
i = (i - 1);
};
};
i = (i + 1);
};
SLIDE_T.EXTRAS_PSHAPES.fixedText.text = "STATIC";
SLIDE_T.EXTRAS_PSHAPES.dynamicText.text = "DYNAMIC";
if (activeObject != undefined){
SLIDE_T.EXTRAS_PSHAPES.propsBlock.scaleY = 1;
SLIDE_T.EXTRAS_PSHAPES.propsBlock.y = 180;
SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.doorLinkText.text = "";
if (activeObject.type == 3){
SLIDE_T.EXTRAS_PSHAPES.fixedText.text = "NO PHYSICS";
SLIDE_T.EXTRAS_PSHAPES.dynamicText.text = "PHYSICS";
SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.doorLinkText.text = activeObject.sizeX;
SLIDE_T.EXTRAS_PSHAPES.propsBlock.scaleY = 0.4;
SLIDE_T.EXTRAS_PSHAPES.propsBlock.y = (SLIDE_T.EXTRAS_PSHAPES.propsBlock.y - 100);
SLIDE_T.EXTRAS_PSHAPES.sizeBlock.y = 2000;
} else {
if (activeObject.type == 4){
if (((!((activeObject.SPRITE.sprite.light == null))) && (!((activeObject.sizeX == null))))){
activeObject.SPRITE.sprite.light.gotoAndStop(activeObject.sizeX);
};
SLIDE_T.EXTRAS_PSHAPES.LE_SIZE.doorLinkText.text = activeObject.sizeX;
SLIDE_T.EXTRAS_PSHAPES.propsBlock.y = 230;
SLIDE_T.EXTRAS_PSHAPES.sizeBlock.y = 2000;
} else {
if (activeObject.ID == 8){
SLIDE_T.EXTRAS_PSHAPES.linkageBlock.y = 2000;
SLIDE_T.EXTRAS_PSHAPES.propsBlock.y = 205;
SLIDE_T.EXTRAS_PSHAPES.sizeBlock.y = 2000;
} else {
if ((((activeObject.ID == 3)) || ((activeObject.ID == 4)))){
SLIDE_T.EXTRAS_PSHAPES.sizeBlock.y = 2000;
} else {
if (activeObject.ID != 9){
SLIDE_T.EXTRAS_PSHAPES.linkageBlock.y = 2000;
SLIDE_T.EXTRAS_PSHAPES.propsBlock.y = 2000;
SLIDE_T.EXTRAS_PSHAPES.sizeBlock.y = 2000;
};
};
};
};
};
};
if (((!((activeObject == undefined))) && (!((activeObject.ID == 9))))){
if (activeObject.type == 4){
activeObject.SPRITE.sprite.gotoAndStop(activeObject.sizeY);
activeObject.SHAPE.sprite.gotoAndStop(activeObject.sizeY);
activeObject.staticLock.sprite.gotoAndStop(activeObject.sizeY);
activeObject.LINKS.sprite.gotoAndStop(activeObject.sizeY);
};
var _local2 = but;
with (_local2) {
MovieClip(parent).alpha = 1;
if (activeObject.SHAPE != undefined){
if (activeObject.type == 2){
MovieClip(parent).gotoAndStop(1);
} else {
if ((((activeObject.type == 3)) || ((activeObject.type == 4)))){
MovieClip(parent).gotoAndStop(3);
} else {
MovieClip(parent).gotoAndStop(2);
};
};
};
};
if (activeObject.SHAPE != undefined){
activeObject.SHAPE.visible = true;
};
i = 1;
while (i < 4) {
if (activeObject[("linkTarg" + i)] == undefined){
SLIDE_T.EXTRAS_PSHAPES[(("B_T_LINK" + i) + "TICK")].visible = false;
} else {
SLIDE_T.EXTRAS_PSHAPES[(("B_T_LINK" + i) + "TICK")].visible = true;
};
i = (i + 1);
};
};
}
public function setBrush_W(_arg1){
SLIDE_B.BSelect.x = SLIDE_B.B_T_W.x;
SLIDE_B.BSelect.y = SLIDE_B.B_T_W.y;
typeSelect = 4;
rotSelect = 0;
}
public function loadCode(_arg1){
var _local2:Number;
var _local3:MovieClip;
var _local4:String;
var _local5:Point;
_local2 = 0;
while (_local2 < baseBlocks.length) {
_local3 = baseBlocks[_local2];
_local4 = levelCode.charAt(_local2);
_local5 = codeDecrypt(_local4);
_local3.sprite.gotoAndStop(_local5.x);
_local3.sprite.rotation = _local5.y;
_local2++;
};
}
public function setEndPoint(_arg1, _arg2){
endPoint = new LE_ENDPOINT();
endPoint.x = _arg1;
endPoint.ID = 9;
endPoint.y = _arg2;
OBJECTS.addChild(endPoint);
}
public function setBrush_BS(_arg1){
SLIDE_T.EXTRAS_BS.x = 0;
SLIDE_T.EXTRAS_BS.y = 0;
}
public function solidLinkageText(_arg1){
SLIDE_L.descText.text = "CREATE A SOLID LINK BETWEEN THE TWO SHAPES. THIS CONNECTION FIXES THE RELETIVE ROTATION OF THE SHAPES INVOLVED, ALTHOUGH WILL BUCKLE UNDER EXTREME PRESSURE TO PREVENT GAME CRASHES.";
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 115
//LEVELCOMPLETE_146 (SWAIN_TheGreaterGood8_fla.LEVELCOMPLETE_146)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LEVELCOMPLETE_146 extends MovieClip {
public var EOLText:TextField;
}
}//package SWAIN_TheGreaterGood8_fla
Section 116
//LG_Extras_BG_111 (SWAIN_TheGreaterGood8_fla.LG_Extras_BG_111)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class LG_Extras_BG_111 extends MovieClip {
public function LG_Extras_BG_111(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 117
//MainTimeline (SWAIN_TheGreaterGood8_fla.MainTimeline)
package SWAIN_TheGreaterGood8_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var WHITEFADE:MovieClip;
public var A1:MovieClip;
public var A3:MovieClip;
public var A4:MovieClip;
public var A7:MovieClip;
public var A2:MovieClip;
public var A5:MovieClip;
public var A6:MovieClip;
public var activeLevel:Number;
public var checkArray2:Array;
public var checkArray4:Array;
public var checkArray1:Array;
public var checkArray3:Array;
public var userData:String;
public var checkArray0:Array;
public var urlStart:Number;
public var animalStore:int;
public var gotoMC;
public var initialLoad:Boolean;
public var domEnd:Number;
public var physicsAccuracy:Number;
public var myContextMenu:ContextMenu;
public var REDFADE:MovieClip;
public var audioActive:Boolean;
public var savefile:SharedObject;
public var blankLevel:String;
public var stickTimer:Number;
public var debugMode:Boolean;
public var LastDot:Number;
public var domain:String;
public var BLACKFADE:MovieClip;
public var urlEnd:Number;
public var gotoMap:Boolean;
public var MEDALPROMPT:MovieClip;
public var graphics_Squares:Array;
public var levelSizeX:Number;
public var levelSizeY:Number;
public var gotoTarg;
public var url:String;
public var slider1:MovieClip;
public var slider2:MovieClip;
public var friendMode:Boolean;
public var previewMode:Boolean;
public var playB:MovieClip;
public var levelCode:String;
public var FArray:Array;
public var destroyDest:String;
public var graphics_Circles:Array;
public var PLR:int;
public var sliderSpeed:int;
public var plb:MovieClip;
public var GAME:MovieClip;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 4, frame5, 11, frame12, 12, frame13, 19, frame20, 20, frame21);
}
public function playLevelEnd(){
var _local1:Sound;
var _local2:SoundChannel;
if (audioActive == true){
SoundMixer.stopAll();
_local1 = new SND_Fanfare();
_local2 = new SoundChannel();
_local2 = _local1.play();
};
}
public function constantFrame(_arg1){
var i:int;
var event = _arg1;
if (MEDALPROMPT.alpha > 0){
MEDALPROMPT.y = (MEDALPROMPT.y - 10);
if (MEDALPROMPT.y < 480){
MEDALPROMPT.y = 480;
};
MEDALPROMPT.alpha = (MEDALPROMPT.alpha - 0.05);
} else {
MEDALPROMPT.y = 600;
};
i = 0;
while (i < FArray.length) {
var _local3 = FArray[i];
with (_local3) {
width = 0;
if (alpha > 0){
width = 640;
alpha = (alpha - 0.1);
};
};
i = (i + 1);
};
if (gotoTarg != undefined){
if (slider1.y < 320){
BLACKFADE.alpha = (BLACKFADE.alpha + 0.2);
slider1.y = (slider1.y + sliderSpeed);
slider2.y = (slider2.y - sliderSpeed);
} else {
gotoMC.gotoAndStop(gotoTarg);
gotoTarg = undefined;
gotoMC = undefined;
stickTimer = 3;
};
} else {
if ((((slider1.y > 0)) && ((stickTimer < 0)))){
slider1.y = (slider1.y - sliderSpeed);
slider2.y = (slider2.y + sliderSpeed);
};
};
stickTimer--;
}
function frame12(){
animalStore = 10;
previewMode = true;
friendMode = false;
playTitleMusic();
activeLevel = 25;
stop();
}
function frame2(){
stop();
playTitleMusic();
}
function frame13(){
stop();
SoundMixer.stopAll();
}
function frame5(){
playTitleMusic();
}
function frame1(){
addEventListener(Event.ENTER_FRAME, constantFrame);
REDFADE.alpha = 0;
WHITEFADE.alpha = 0;
BLACKFADE.alpha = 0;
FArray = new Array(REDFADE, WHITEFADE, BLACKFADE);
stickTimer = 0;
MEDALPROMPT.alpha = 0;
checkArray0 = new Array(0, 1, 2, 3);
checkArray1 = new Array(4, 5, 6, 7);
checkArray2 = new Array(8, 9, 10, 11);
checkArray3 = new Array(12, 13, 14, 15);
checkArray4 = new Array(16, 17, 18, 19, 20);
sliderSpeed = 40;
userData = "Jump#Spikes@Robert#Redford";
animalStore = 10;
initialLoad = true;
stage.quality = StageQuality.HIGH;
debugMode = false;
levelCode = "";
levelSizeX = 32;
levelSizeY = 18;
physicsAccuracy = 15;
graphics_Squares = new Array(null, 5, 6, 7, 8);
graphics_Circles = new Array(null, 1, 2, 3, 4);
friendMode = false;
gotoMap = false;
previewMode = false;
activeLevel = 0;
blankLevel = "31B2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2A30BAXX13034053034015";
savefile = SharedObject.getLocal("GREATERGOODS");
if (savefile.data.editor_tempSave == undefined){
savefile.data.medals = new Array();
savefile.data.medalsT = new Array();
savefile.data.medalsL = new Array();
savefile.data.medalsP = new Array();
savefile.data.AA = true;
savefile.data.editor_tempSave_name = "No Data";
savefile.data.editor_tempSave = blankLevel;
};
if (savefile.data.editor_slot1 == undefined){
savefile.data.editor_slot1_name = "No Data";
savefile.data.editor_slot1 = blankLevel;
};
if (savefile.data.editor_slot2 == undefined){
savefile.data.editor_slot2_name = "No Data";
savefile.data.editor_slot2 = blankLevel;
};
if (savefile.data.editor_slot3 == undefined){
savefile.data.editor_slot3_name = "No Data";
savefile.data.editor_slot3 = blankLevel;
};
if (savefile.data.AA == true){
audioActive = true;
} else {
audioActive = false;
};
url = stage.loaderInfo.url;
urlStart = (url.indexOf("://") + 3);
urlEnd = url.indexOf("/", urlStart);
domain = url.substring(urlStart, urlEnd);
LastDot = (domain.lastIndexOf(".") - 1);
domEnd = (domain.lastIndexOf(".", LastDot) + 1);
domain = domain.substring(domEnd, domain.length);
stop();
playB.visible = false;
addEventListener(Event.ENTER_FRAME, preLoader);
myContextMenu = new ContextMenu();
myContextMenu.hideBuiltInItems();
contextMenu = myContextMenu;
PLR = 0;
playB.addEventListener(MouseEvent.CLICK, clickHandler);
}
function frame21(){
gotoAndStop(destroyDest);
}
function frame3(){
if (initialLoad == true){
initialLoad = false;
} else {
playTitleMusic();
};
}
public function playGameMusic(_arg1){
var _local2:Sound;
var _local3:SoundChannel;
var _local4:SoundTransform;
if (audioActive == true){
savefile.data.AA = true;
SoundMixer.stopAll();
trace(_arg1);
_arg1 = Math.ceil(((_arg1 + 1) / 4));
if (_arg1 == 1){
_local2 = new SND_GRASS();
} else {
if (_arg1 == 2){
_local2 = new SND_SNOW();
} else {
if (_arg1 == 3){
_local2 = new SND_CAVE();
} else {
if (_arg1 == 4){
_local2 = new SND_FOREST();
} else {
_local2 = new SND_SPOOKY();
};
};
};
};
_local3 = new SoundChannel();
_local4 = new SoundTransform();
_local4.volume = 0.25;
_local3.soundTransform = _local4;
_local3 = _local2.play(0, 999);
} else {
savefile.data.AA = false;
};
}
function frame20(){
stage.quality = StageQuality.HIGH;
playGameMusic(activeLevel);
}
public function preLoader(_arg1:Event){
var _local2:int;
var _local3:*;
var _local4:*;
PLR++;
if (PLR > 4){
PLR = 1;
};
_local2 = 1;
while (_local2 < 8) {
this[("A" + _local2)].x = (this[("A" + _local2)].x + 10);
this[("A" + _local2)].Head.sprite.sprite.gotoAndStop(_local2);
this[("A" + _local2)].Body.sprite.gotoAndStop(((PLR + 7) + ((4 * _local2) - 4)));
if (this[("A" + _local2)].x > 700){
this[("A" + _local2)].x = -50;
};
_local2++;
};
_local3 = stage.loaderInfo.bytesTotal;
_local4 = stage.loaderInfo.bytesLoaded;
plb.scaleX = ((1 / _local3) * _local4);
if (_local4 >= _local3){
removeEventListener(Event.ENTER_FRAME, preLoader);
play();
playB.removeEventListener(MouseEvent.CLICK, clickHandler);
};
}
public function clickHandler(_arg1:Event):void{
}
public function playDie(){
var _local1:Sound;
var _local2:SoundChannel;
if (audioActive == true){
_local1 = new SND_SQUISH();
_local2 = new SoundChannel();
_local2 = _local1.play();
};
}
public function newPaw(_arg1){
if (savefile.data.medalsP[_arg1] != true){
savefile.data.medalsP[_arg1] = true;
MEDALPROMPT.MED.gotoAndStop(_arg1);
MEDALPROMPT.alpha = 5;
};
}
public function playTitleMusic(){
var _local1:Sound;
var _local2:SoundChannel;
if (audioActive == true){
SoundMixer.stopAll();
_local1 = new SND_TITLE();
_local2 = new SoundChannel();
_local2 = _local1.play(0, 999);
};
}
public function playDoor(){
var _local1:Sound;
var _local2:SoundChannel;
if (audioActive == true){
_local1 = new SND_Door();
_local2 = new SoundChannel();
_local2 = _local1.play();
};
}
public function newMedal(_arg1){
if (savefile.data.medals[_arg1] != true){
savefile.data.medals[_arg1] = true;
};
}
public function checkLevelMedal(_arg1){
var _local2:int;
var _local3:int;
var _local4:Boolean;
var _local5:int;
var _local6:int;
trace(("TARG" + _arg1));
_local2 = 0;
_local3 = 0;
while (_local3 < 5) {
trace(("SEARCH GROUP:" + _local3));
_local6 = 0;
while (_local6 < this[("checkArray" + _local3)].length) {
if (_arg1 == this[("checkArray" + _local3)][_local6]){
_local2 = _local3;
trace(("FOUND GROUP:" + _local3));
};
_local6++;
};
_local3++;
};
_local4 = false;
_local5 = this[("checkArray" + _local2)][0];
_local3 = _local5;
while (_local3 < (this[("checkArray" + _local2)].length + _local5)) {
trace(("CHECK LEVEL" + _local3));
trace(("MEDARRAY = " + savefile.data.medals[_local3]));
if (savefile.data.medalsT[_local3] != 6){
trace(("CHECK LEVEL FAIL:" + _local3));
_local4 = true;
};
_local3++;
};
if (_local4 == false){
newPaw(_local2);
};
}
public function playJump(){
var _local1:Sound;
var _local2:SoundChannel;
if (audioActive == true){
_local1 = new SND_Jump();
_local2 = new SoundChannel();
_local2 = _local1.play();
};
}
public function gotoFrame(_arg1, _arg2){
BLACKFADE.alpha = 0.2;
gotoMC = _arg1;
gotoTarg = _arg2;
}
public function playCoin(){
var _local1:Sound;
var _local2:SoundChannel;
if (audioActive == true){
_local1 = new SND_Coin();
_local2 = new SoundChannel();
_local2 = _local1.play();
};
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 118
//MAP_Button_small_75 (SWAIN_TheGreaterGood8_fla.MAP_Button_small_75)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
import flash.text.*;
public dynamic class MAP_Button_small_75 extends MovieClip {
public var lifeText:TextField;
public var fader:MovieClip;
public var rankText:TextField;
public var sprite:MovieClip;
public function MAP_Button_small_75(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 119
//MedalHolder_38 (SWAIN_TheGreaterGood8_fla.MedalHolder_38)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class MedalHolder_38 extends MovieClip {
public var MED:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 120
//MEDALSCREEN_68 (SWAIN_TheGreaterGood8_fla.MEDALSCREEN_68)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class MEDALSCREEN_68 extends MovieClip {
public var M10:MovieClip;
public var M11:MovieClip;
public var M0:MovieClip;
public var M1:MovieClip;
public var M4:MovieClip;
public var M7:MovieClip;
public var M6:MovieClip;
public var M3:MovieClip;
public var M5:MovieClip;
public var M8:MovieClip;
public var M2:MovieClip;
public var M9:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 121
//MENU_44 (SWAIN_TheGreaterGood8_fla.MENU_44)
package SWAIN_TheGreaterGood8_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MENU_44 extends MovieClip {
public var levelCount:Number;
public var levelTextArray:Array;
public var backBut:SimpleButton;
public var leftKeyPressed:Boolean;
public var AW:MovieClip;
public var LCode10:String;
public var LCode13:String;
public var LCode14:String;
public var LCode16:String;
public var LCode17:String;
public var BG:MovieClip;
public var LCode11:String;
public var LCode12:String;
public var LCode15:String;
public var LCode19:String;
public var RTT:String;
public var LCode20:String;
public var sfP;
public var buttonArray:Array;
public var LCode21:String;
public var i:Number;
public var LCode18:String;
public var sfL;
public var introBut:SimpleButton;
public var sfT;
public var sf;
public var signText:Array;
public var level11:MovieClip;
public var level12:MovieClip;
public var level13:MovieClip;
public var level14:MovieClip;
public var level15:MovieClip;
public var level16:MovieClip;
public var level18:MovieClip;
public var level19:MovieClip;
public var BGS:MovieClip;
public var level17:MovieClip;
public var level10:MovieClip;
public var level20:MovieClip;
public var animalsLeft:Number;
public var levelStartSpaceBuffer:Boolean;
public var levelText:TextField;
public var signSave;
public var _keys:Array;
public var LCode0:String;
public var LCode6:String;
public var LCode1:String;
public var LCode2:String;
public var LCode3:String;
public var LCode7:String;
public var LCode8:String;
public var LCode5:String;
public var animType:int;
public var animalsLeftStore:Number;
public var LCode4:String;
public var ii:Number;
public var LCode9:String;
public var curLevel:Number;
public var level0:MovieClip;
public var level1:MovieClip;
public var level2:MovieClip;
public var level3:MovieClip;
public var level4:MovieClip;
public var level5:MovieClip;
public var level6:MovieClip;
public var level7:MovieClip;
public var level9:MovieClip;
public var level8:MovieClip;
public var downKeyPressed:Boolean;
public var CRED:MovieClip;
public var selectedMapButton;
public var CHAR:MovieClip;
public var arrowMC:MovieClip;
public var parText:TextField;
public var keyBuffer:Number;
public var parTextArray:Array;
public var MED:MovieClip;
public var totalScore:Number;
public var worldTextArray:Array;
public var SIGN:MovieClip;
public var upKeyPressed:Boolean;
public var worldText:TextField;
public var butA:SimpleButton;
public var butB:SimpleButton;
public var butC:SimpleButton;
public var butD:SimpleButton;
public var sfT2;
public var butS:GenBut;
public var butM:SimpleButton;
public var butU:SimpleButton;
public var rightKeyPressed:Boolean;
public function MENU_44(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function butUCode(_arg1){
mainListeners();
MovieClip(parent).gotoFrame(MovieClip(parent), "EDITORTITLE");
}
public function gotoLink(_arg1){
var url:String;
var request:URLRequest;
var targ = _arg1;
url = targ;
request = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
};
}
public function GL3(_arg1){
loadLevelSet(3);
}
public function OL5(_arg1){
selectMapButton(5);
}
public function butMCode(_arg1){
MED.y = 0;
}
public function removeButtonListeners(_arg1){
var _local2:*;
if (_arg1.sprite != undefined){
_local2 = _arg1.sprite;
} else {
_local2 = _arg1;
};
if (_arg1.pressVar != ""){
_local2.removeEventListener(MouseEvent.MOUSE_DOWN, this[_arg1.pressVar]);
};
if (_arg1.releaseVar != ""){
_local2.removeEventListener(MouseEvent.MOUSE_UP, this[_arg1.releaseVar]);
};
if (_arg1.rollVar != ""){
_local2.removeEventListener(MouseEvent.MOUSE_OVER, this[_arg1.rollVar]);
};
if (_arg1.outVar != ""){
_local2.removeEventListener(MouseEvent.MOUSE_OUT, this[_arg1.outVar]);
};
}
public function GL8(_arg1){
loadLevelSet(8);
}
public function GL9(_arg1){
loadLevelSet(9);
}
public function GL1(_arg1){
loadLevelSet(1);
}
public function handleKeyUp(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = _keys.indexOf(_arg1.keyCode);
if (_local2 > -1){
_keys.splice(_local2, 1);
};
}
public function GL6(_arg1){
loadLevelSet(6);
}
public function OL1(_arg1){
selectMapButton(1);
}
public function OL2(_arg1){
selectMapButton(2);
}
public function butMEDCode(_arg1){
MED.y = 500;
}
public function mainClear(_arg1){
newSignText((Math.round((Math.random() * 10)) + 1));
}
public function checkKeyPresses(){
rightKeyPressed = ((isKeyPressed(65)) || (isKeyPressed(37)));
leftKeyPressed = ((isKeyPressed(68)) || (isKeyPressed(39)));
upKeyPressed = ((isKeyPressed(32)) || (isKeyPressed(13)));
downKeyPressed = isKeyPressed(16);
}
public function GL5(_arg1){
loadLevelSet(5);
}
public function OL9(_arg1){
selectMapButton(9);
}
public function OL0(_arg1){
selectMapButton(0);
}
public function selectMapButton(_arg1){
if (this[("level" + _arg1)].fader.alpha == 0){
worldText.text = ("World " + worldTextArray[_arg1]);
levelText.text = ("Level " + levelTextArray[_arg1]);
parText.text = ("Par Lives: " + parTextArray[_arg1]);
curLevel = _arg1;
selectedMapButton = this[("level" + _arg1)];
BGS.BG1.gotoAndStop(Math.ceil(((_arg1 + 1) / 4)));
} else {
worldText.text = "";
levelText.text = "";
parText.text = "";
BGS.BG1.gotoAndStop("blank");
};
}
public function removeListeners(){
AW.removeEventListener(MouseEvent.MOUSE_UP, AWC);
introBut.removeEventListener(MouseEvent.MOUSE_UP, introButC);
removeAllButtons();
removeEventListener(Event.ENTER_FRAME, mapEnterFrame);
backBut.removeEventListener(MouseEvent.MOUSE_UP, backButC);
}
public function OL3(_arg1){
selectMapButton(3);
}
public function butACodeO(_arg1){
newSignText("ARMOR");
}
public function GL2(_arg1){
loadLevelSet(2);
}
public function GL10(_arg1){
loadLevelSet(10);
}
public function OL8(_arg1){
selectMapButton(8);
}
public function GL12(_arg1){
loadLevelSet(12);
}
public function GL7(_arg1){
loadLevelSet(7);
}
public function OL4(_arg1){
selectMapButton(4);
}
public function OL6(_arg1){
selectMapButton(6);
}
public function OL7(_arg1){
selectMapButton(7);
}
public function GL20(_arg1){
loadLevelSet(20);
}
public function removeAllButtons(){
var _local1:Number;
var _local2:MovieClip;
_local1 = 0;
while (_local1 < buttonArray.length) {
_local2 = buttonArray[_local1];
removeButtonListeners(_local2);
buttonArray.splice(_local1, 1);
_local1--;
_local1++;
};
}
public function newSignText(_arg1){
SIGN.sprite.ST.gotoAndStop(_arg1);
}
public function handleKeyDown(_arg1:KeyboardEvent):void{
if (_keys.indexOf(_arg1.keyCode) == -1){
_keys.push(_arg1.keyCode);
};
}
public function butUCodeO(_arg1){
newSignText("USER");
}
public function butDCode(_arg1){
MovieClip(parent).newPaw(10);
gotoLink("http://www.armorblog.com");
}
public function mainListeners(){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
butS.removeEventListener(MouseEvent.MOUSE_UP, butSCode);
butU.removeEventListener(MouseEvent.MOUSE_UP, butUCode);
butB.removeEventListener(MouseEvent.MOUSE_UP, butBCode);
butM.removeEventListener(MouseEvent.MOUSE_UP, butMCode);
butS.removeEventListener(MouseEvent.MOUSE_OVER, butSCodeO);
butU.removeEventListener(MouseEvent.MOUSE_OVER, butUCodeO);
butB.removeEventListener(MouseEvent.MOUSE_OVER, butBCodeO);
butM.removeEventListener(MouseEvent.MOUSE_OVER, butMCodeO);
butS.removeEventListener(MouseEvent.MOUSE_OUT, mainClear);
butU.removeEventListener(MouseEvent.MOUSE_OUT, mainClear);
butB.removeEventListener(MouseEvent.MOUSE_OUT, mainClear);
butM.removeEventListener(MouseEvent.MOUSE_OUT, mainClear);
butC.removeEventListener(MouseEvent.MOUSE_OUT, mainClear);
butA.removeEventListener(MouseEvent.MOUSE_OUT, mainClear);
butD.removeEventListener(MouseEvent.MOUSE_OUT, mainClear);
butC.removeEventListener(MouseEvent.MOUSE_UP, butCCode);
butA.removeEventListener(MouseEvent.MOUSE_UP, butACode);
butD.removeEventListener(MouseEvent.MOUSE_UP, butDCode);
CRED.removeEventListener(MouseEvent.MOUSE_UP, butCREDCode);
CRED.removeEventListener(MouseEvent.MOUSE_UP, butMEDCode);
butC.removeEventListener(MouseEvent.MOUSE_OVER, butCCodeO);
butA.removeEventListener(MouseEvent.MOUSE_OVER, butACodeO);
butD.removeEventListener(MouseEvent.MOUSE_OVER, butDCodeO);
}
public function mapEnterFrame(_arg1){
checkKeyPresses();
keyBuffer--;
if ((((rightKeyPressed == false)) && ((leftKeyPressed == false)))){
keyBuffer = -5;
};
if (keyBuffer < 0){
if (leftKeyPressed == true){
if (((!((this[("level" + (curLevel + 1))] == undefined))) && ((this[("level" + (curLevel + 1))].fader.alpha == 0)))){
curLevel++;
selectMapButton(curLevel);
};
keyBuffer = 5;
} else {
if (rightKeyPressed == true){
if (((!((this[("level" + (curLevel - 1))] == undefined))) && ((this[("level" + (curLevel - 1))].fader.alpha == 0)))){
curLevel--;
selectMapButton(curLevel);
};
keyBuffer = 5;
};
};
};
arrowMC.x = (arrowMC.x + ((this[("level" + curLevel)].x - arrowMC.x) / 5));
arrowMC.y = (arrowMC.y + ((this[("level" + curLevel)].y - arrowMC.y) / 5));
if (selectedMapButton != undefined){
selectedMapButton.gotoAndPlay(2);
} else {
selectedMapButton = this[("level" + MovieClip(parent).curLevel)];
};
if (upKeyPressed == false){
levelStartSpaceBuffer = true;
} else {
if ((((upKeyPressed == true)) && ((levelStartSpaceBuffer == true)))){
loadLevelSet(curLevel);
};
};
}
public function introButC(_arg1){
removeListeners();
MovieClip(parent).gotoFrame(MovieClip(parent), "INTRO");
}
function frame1(){
buttonArray = new Array();
LCode0 = "31B2ABD26AEB2AB28AB2AB28AB2AB28AB2AB28AB2AB7A3M3A3M3A3M5AFB2AB7A3B3A3B3A3B3A4B2ABC6AEBD3AEBD3AEBD3AE3B2A6B20AF3B2A6BC2A3M13AF4B2A11B14A5B2A11BC3M10A5B2A14B14AEB2A14BC3M11AB2A17B12AB2A17BC10AFB2A30BAXEJHBAEIABE2AB10ACDBHEAD2A2B2A2B9ABEJHFA2DABDBFBC9ACEJGDA2DABDBFBD9ACEJFBA2DABDBFBE9ACX11018057034010";
LCode1 = "31B2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB23A6B2AB23A6B2AB23A6B2AB23A6B2AB12A4B7A6B2AB12A4B7A6B2AB10A6B7A6B2AB10A6B7A6B2AB8A8B7A6B2AB10AM2AM2AM2AM2AM2A4B2AB25A4B2A30BAXCBGBADJAHJ2AB10A2CB2GAF2A2C2A2B9ACX10034055012011";
LCode2 = "31B2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB24A5B2AB28AB2AB28AB2A4B4AM2AM2AM2AM2AM2AM5AB2AB28AB2AB28AB2A7B18A5B2A7B18I5B2A30B2A30B2A30B2A30BAXEJHBADJABHBAB10ACEJEDAEFABJBF2B9ACEJGBAEFABJAFBC9ACDBFCADHA2B2ABD9ABEJ2DADJACHBABE9ACEJEDADBABJBFBF9ACEJGBADBABJAFBG9ACDBHFACJACB2ABI9ACX07024058024013";
LCode3 = "31B2AB24A5B2AB24A5B2AB24A5B2AB24A5B2AB24A5B2AB11A4M9A5B2AB24A5B2AB24A5B2AB24A5B2AB20AF8B2AB19AF9B2AB18AF10B2A9B10A11B2AB18A11B2AB28AB2AB28AB2A30BAXEJDBAEIABE2AB10ACBDEHACBA2B2A2B9A2BCD2AD2A2E2ABC3B6A3CGFADFABD2ABD9A3CGFACJABD2ABE9ACDCGFACFA2B2ABF9ACEJDGADFADJ2ABG9ACDB2HAFBADB2ABI9ACEJ2HACFADJBABJ9ACEJHFADBADHBAC10ACEJHDADHADFBACB9ACEJHBAEDA2DBA2C9ACEJGJAEGADCBACD9ACX32034009034011";
LCode4 = "31B2AB28AB2AB28AB2AB23A6B2AB23AB4AB2AB23AB4AB2AB18AB9AB2ABA3M20A3MAB2AB28AB2A13BAM9A6B2AB11AB16AB2AB11AB3AB12AB2AB11A5B7AB4AB2AB6AM2AM2AM2AM7AB4AB2AB23AB4AB2AB23AB4AB2AB23AB4AB2A6B16H8BAX2BDIADEA2C2ABA2BC6A2CBDIAEJAFB2A2B9A2CBDEAEHA2B2ABC2BC6A2CBECAEHA2B2ABD2BC6ACDBEFADFA2B2ABE9ACEJGJAE2ABC2ABF9ACDBGHAFBACB2ABG9ACEJGBADHACHAFBH9ACEJGJAFDACFBFBJ9A3CGBADFAHB2ACB9A3CGEADCAEC2ACACBC6A3C2GACIA2C2ABICAC6ACEJGJACHABDBA2C9ACX08034057034022";
LCode5 = "2B2A27B2AB2AB2AB20ABAB2AB2MB2A22BAB2AB2M26AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB2A8B15A3MB2AB2A8B14AF4B2AB2A8B14ABD2AB2A11B18AB2A11BA8B9AB2A11BA8B9AB2A30BAXDBEDAFBA2B2ABD9ABEJEDADHABFBAB10ACEJHBAFDADH2ACD9A3CDGADBAFB2ABC9ACDBCDAEFACB2ABF9ACEJCGADBACFBFBG9A4CEACEACG2ABH9ACBEDGACBA2B2A3BCB6A3C2DACJA2B2ABEB2C6A3CDJACJA2B2ABIB2C6ACBEHBACBA2B2ABJCAB6A3CHBACJADB2AC10ACDBHBACHADB2ACB9ACX37030058034022";
LCode6 = "31B2A8BD11AE9B2A7BD13AE8B2A6BD15AE7B2A6B2AFAC7AFAC2AE6B2AB4ABAFBABC5AFBABC2AB4AB2AB4AB18AB4AB2AB4AB7AFC9AB4AB2AB4ABC2AC2AF2BC7AFB4AB2AB2A3B3ABC13AB2A3B2AB23AB3AEB2AB6AC4AF3AF2AC4AB4AB2A4B20A2B3AB2A4B24AFB2A4B23AF2B2A4B22AF3B2A4B2A2B2A2B2A2B2A2B2A8B2AHB28HAXBEDHACDA2B2AB10ACB2EDACDA2B2A2B9ACB2EBACDA2B2ABF9ACB2EHACDA2B2ABG9ACB2EJACDA2B2ABH9ACBEFBACDA2B2ABI9ACEJEBACHABJBFCD9ACDBDEAEJA2B2ABJ9ACB2EFACDA3BJBC9ACEJFJACHABJAFBD9ACBEDJACDA3BJC10ACBEFDACDA3BJCB9ACBE2FACDA3BJ2C9ACBEFHACDA3BJCE9ACBEFJACDA3BJCF9ACBEGBACDA3BJCG9ACEJGJAEIABE2ACH9ACX10018058018020XSpike#TASM@John#Jones#J";
LCode7 = "31B2ABDAEB2ABAB2ABD6AEBD5AEB2AB3AB2ABAB2AB15AFB2AB3A4BA4B14AF2B2AB25AF3B2AB14A7B3AF4B2AB14A7B3A5B2AB14AE6B5AE2B2AB15A6BC5A2B2AB15A7BC4A2B2AB15AE7BC3A2B2AB16A7B4A2B2AB16AE5BD3AF2B2AB17A4BD3AF3B2AB17AB6AF4B2AB17AB5AF5B2ABC21AF6B2A10B8A12BAX2BHGA2CA2C2AB10ACEJHDACEABE2A2B9ACDBFJAFBACB2ABD9ACEJGDACFACD2ABE9ACDBFEACHA2B2ABH9A2CBDCADHADB2ABFBGC6A2CBDCAEFADB2ABG9A2CBECA2DADB2ABJCAB6A2CBECAEBADB2ACACBC6A2CBECAEJADB2ACB9AC2BDCA2CA2C2ABCBFB6AC2BECA2CA2C2ABIBJC6ACEJEIAFDACIBF2C9ACX09034046034021";
LCode8 = "6B24AB2AB28AB2AB28AB2AB28AB2AB28AB2A8B3A4B7AB6AB2A15B7A5B2AB2AB28AB2AB28AB2AB28AB2A3B26AB2AB28AB2AB28AB2AB28AB2A3B3I23AB2A6B23AB2A7B22AB2A30BAXDBCEADHA2B2ABC9A2CBG2ACHAGB2ABDBAC6AC2BEDACHA2B2ABABDC6A2CBGCACFAEB2ABEBDC6A2CBGFACDA2B2ABFBEC6ACDBCDAEFACB2A2B9ACEJ2HAGBACJ2ABG9ACEJHFAFIACG2ABH9ACEJHDA2FACD2ABI9A2CB2FAD2ABC2ABJBDC6ACDBDBACHADB2AC10ACEJF2ADBADEBFCB9ACEJCJACEABE2A2C9ACEJGJADBABFBFCD9ACX30034007010031";
LCode9 = "31B2AB19AB8AB2AB15AM3AB8AB2AB15AM3AB8AB2AB10A10B8AB2AB10AB17AB2AB8A2MB17AB2AB8A3B17AB2AB28AB2AB21AM6AB2AB17AM3AB6AB2AB5A2I10AB3AB6AB2AB5A4B8AB3AB6AB2AB17AB3AB6AB2AB17AB3AB6AB2AB6A3B8AB3AB6AB2AB5A2B10HB3IB6AB2A30BAXCBF2ACDA2D2A2B2AD6A2CBCIACDA2C2ABA3B6ACDBEJAFBA2B2ABD9A2CBDIAE2A2C2ABE9ACEJCGACGA3BFBC9ACX09034053034031";
LCode10 = "31B2ABD7AB6A9BD2AEB2AB4AMAMAB6A9B4AB2AB8AB6A9B4AB2AB8ABC5A9B4AB2AB8A2BC4A8BD4AB2AB26AMAB2AB28AB2AB2A9BC14AMAB2AB2A10BC15AB2AB2AE10BC6A5B3AB2AB10AE3BC5A5B3AB2AB3AM8AE2BC4A3KEB3HB2AB13AE2BC6ALB3HB2AB3AM10AE2BC5ALB3HB2AB16AE8B3HB2AB4I13AE7B3HB2A30BAXEJCEADFABCAFB10ACDBHBACJA2B2A2B9ACBCECA2CA2CAFBD9ACEJEHACJACFBFBH9ACDBGHAEHACB2ABI9ACBCF2ACGA2CBHCB9ACBCEGA2CA2C2ABC9ACBCF2A2CA2CADBE9ACBCEGACGA2CBCBF9A3CGJADEADE2ABG9ACEJGDADEACE2ABJ9ACEJBHACJABFAFC10ACX23016033034033";
LCode11 = "31B2AB27AEB2A2BC23AF3B2A3BC18A8B2A4BC23AEB2A5BC23AB2A6BC21AFB2A23BC3AF2B2A2B24AF3B2A2B23AF4B2A2BC21AF5B2A6B12AF6BD2AEB2ABD12AF8BD5AB2AB7AF13BD6AB2ABC5AF13BD7AB2A2BC26AB2A3BC24AFB2A18BCF10BAXBECHA2CA2CAGB10ACEJD2ACDABEAD2B9ACEJGBAF2A2C2ABC9ACDBFBACGA2B2ABD9ACDBCHADIACB2ABF9ACEJCJADHABD2ABG9ACX54006058034030";
LCode12 = "31B2AB6AB2AB2AB2AB2AB2AB6AB2AB6A4B2A4B2A4B6AB2AB28AB2AB2AB25AB2AB28AB2AB25A4B2AB28AB2AB28AB2AB28AB2A6B18A6B2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28IB2A30BAXCBDIADJAGBAFB10A2CBF2ADJAGBAF2B9A2CBGCADJAGBAFBC9AC2BDIACBA2B2ABDBAB6AC2BF2ACBA2B2ABE3B6AC2BGCACBA2B2ABFBCB6ACEJHDADFACD2ABG9ACDBGJADHA2B2ABH9ACEJCDADBA3BABI9ACDBCHACFACB2ABJ9ACX09020058020041";
LCode13 = "31B2ABABAE9BAB13AB2ABAEC6A4BAB13AB2ABCAE4BCAE3BAB13AB2ABECAE2AEB3AEBAE10B3AB2ABAEC4ABC6AED7AB3AB2AB2AE2B2AE3B13A2B2AB2AB13AC14AB2AB13A3B11A2B2AB28AB2AB28AB2AB21A8B2ABC20A8B2A2BC19A8B2A3BC18A8B2A4BC17A8B2AB21H8B2A30BAXDBDBACJAGB2AB10AC2BCDACBA2B2A2B9ACEJCDACDA3BFBC9ACDB2HADJA2B2ABD9AC2BCHACBA3BFBE9ACEJCJACBACBAFBF9ACDBEDACJAHB2ABH9AC2BEJACBA2B2ABI9ACEJEJACDAD2BFC10ACDBGFADJADB2ABJ9ACEJGDACDAJD2ACB9ACEJGBACDAHD2A2C9ACEJFJACDAGD2ACD9ACDBFDA2DAJB2ACE9ACEJ2DAEFAEFB2CF9ACDBGJADJAEB2ACG9AC2BCEADJA2C2ACHCJD6AC2BD2ADJA2C2ACICJD6A2CBCHADFAFB2ACJ6ADA3CBDBA2DA2B2ADACID6A2CBCDA2DA2B2ADBCHD3ACJ2CDBHDADJACB2ABG9ACX51008038008040";
LCode14 = "31B2AB3AB5A3M5AB10AB2AB3AB13AB10AB2AB3AB13AB10AB2AB3AB13AB10AB2AB16A6B6AB2AB16AB11AB2AB12A12B4AB2AB3A4B10A7B4AB2AB3A4B10A9B2AB2AB3A4B21AB2A10B19AB2AB25A4B2AB15A14B2AB7A4B7A4M7B2AB2A2B3A4B7A4M7B2A12B5H13B2A30BAXDBCFADJA2B2ABC9A2CBHBADBAHB2ABE9A2CBEIADBACB2ABFBEB6ACEJCFACHABDBFBJ9ACEJEDA2DACDAFB10ACDBCIAEHACB2ABG9A2CDCFACDA2D2A2B9ACEJDJA2EABCBABD9ACX47026043010040";
LCode15 = "31B2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB26A3B2AB28AB2AB28AB2A4B23H3B2A4B23H3B2A4B23H3B2A30BAXCBDGAEHADC2ABG9AC2BDEAFBA2B2ABH3ACADBGDC2BDJAFBA2B2ABI3ABJDBGD2CBEBAEGA2C2ABJBGC5AD2CBDCAEGA2C2ACABGC5AD2CBEFA2EACB2AB7ABJ3CBD2AECA2C2A2B6ACA4CDFADJABG2ABC6ABG3C2DIADJADE2ABD6AB5C2DAEBABD2ABE6ABG2CDBECAECA2B2ABF9ACEJEBAFDABCBACB9ACEJFJAFDADB2A2C9ACDBH2AEDADB2ACD9ABX08028058022040";
LCode16 = "31B2AB16AB11AB2AB16AB11AB2A4BC12A7B5AB2AB28AB2AB28AB2AB7A2M6A7B3A4B2AB7A3B11AB6AB2ABA2M14A2MAFB3A3MB2A3B15A2MF9B2AB7A2M9AF10B2AB6A5B4A14B2ABA2M25AB2A4B25AB2AB28AB2AB5A4BC18AB2AB5A5B8HB3HBC4AB2A30BAXEJFDADGABEBA2B9ACDBFIACDA2B2ABD9ACDBCFACDA2B2ABC9ACBCFGADIA2C2AB10ACBCG2ADEA2C2ABF9ACBCFGADEA2C2ABG9ACBCFJADGA2CBIBH9ACEJ2GAEHACF2ABE9ACDBGEAEHACB2ABI9ABX08034056034052";
LCode17 = "31B2A5BD9AB13AB2ABD13AB3AMAMAMAM3AB2AB14AB13AB2AB2AF3B8AB13AB2AB2AE2B9A11B3AB2AB4AB23AB2A2B3AB23AB2A2B3AB23AB2A3B2AB23AB2A2BD2AB23AB2ABD3AB23AB2AB3A2B26AB3A2BC25AB2A4BC24AB15A2M14AB8AF6B2I12B2A30BAXB2EIADIA2E2ABABGD6ACBEDGADIA2E2A3BGD6A3CECAD2ADIAFBC2BDBADBG4CEJACFAC2BFBD6AB5CEFACGA2BAFBF6AB5CECADEACB2ABG9A3CDFACGA2B2ABHB2C6ACEJEBAEDABJBFCH9ACDBEHACGA2B2ACI9ACX08034038010052";
LCode18 = "31B2AB10AB5AB11AB2AB10A7B11AB2AB28AB2AB20A6M2AB2AB28AB2AB28AB2AB3AB24AB2AB28AB2AB20A9B2AB28AB2AB28AB2AB6AM2AM2AM2AM2AM9AB2A8B2AB2AB2AB2A11B2AB28AB2AB28AB2AB28IB2A30BAX2BEJACBA2B2AB10A2CBEJADFAHB2A3BAB6ACEJHBAEBAFD2ABC9ACEJGJAEBAED2ABD9ACEJGHAEBA2D2ABE9ACEJGFAEBACD2ABF9ACEJGDAEBABD2ABG9ACDBEFA2DA2B2ABH9ACDBEJA2DACB2ABI9ACDBFDA2DAEB2ABJ9ACDBFBA2DADB2AC10ACDBEHA2DAFB2ACB9ACEJCDADEABEBA2C9ACEJHDAEBAGD2ACD9ACDBCJADBAGB2ACE9ACX08026058026052";
LCode19 = "31B2AB6AEDEDEDEDED7ABD2AEB2AB20AB2AD4AB2ABC16AF2AB6AFB2A2BC4A12B2AB6ALB2A3BC3AE3BD12ACAFALB2A4BC3AE2B8AF2A5BALB2A5BC3AEB3A6B8ALB2A6BC3AEC16ALB2A2BFBC2BC3AE2B14ALB2A8BC19ALB2A3B2A4BC18ALB2A10BC17ALB2A11BC2AFBABC7A4B2AB7A7B2A2B7A4B2AB16A2B2A2B3A4B2AB16A2BCF2B3A4B2A12BCF16BAXBECEA2CA2C2AB10A2CBGBADBABJ2A2B9AC2BFIA2CA2C2ABC9A2CBH2ADBA3BFBD9ABEJGEAEHABCBFBG9ACDBCJAEHA2B2ABJ9ABCBHFADFABJ2ABH9ACDBDEAEHA2B2AC10ABEJGBAEBA2B2ACB9A2CBH2ADJACB2A2CBDB6AC2BHFACEA2C2ACD9A2CBGFADJABH2ABE9AC2BGDACBA2B2ABF9ACEJFGACJABEBFCE9ACEJGDACGABEBACF9A2CE2GACBACB2ABICHC6A2CEGHACGAEBAFCH9ACDBCEAEHA2B2ACG9A3BEFADFA2B2ACJ9AC92AX13034026008050";
LCode20 = "31B2AB28AB2AB28AB2AB28AB2A4B25AL2AB28AL2AB28AL2AB28AL2AB28AL2AB28AB2AB12I5A8I3AB2A13BJ3AL8B3AB2AB11ABJ3ALB10AB2AB11AE5BD10AB2AB28AB2AB28AB2AB5A4B11A4B4AB2A4B8H7B8H3BAX2BDIACFA2B2A2B2AD6ABCBEIACFABD2ABD9A2CBFHACFABDBABI9AC2BGHACFA2BAFBJ2AB6ABEJHFAEBA2DAFC10ACDBFBAEDADB2A2C9A2CBFHACDA2B2ABCBICBJD3A2CBFHACHA2B2ABFBICBJD3A2CBEIACHA2B2ACGBDC3B3A2CBEIACDA2B2ACHBDC3B3AC2BFCACBA2B2ACI9ABCBFCADFAGB2ACJCIB6ACX08008008034013";
LCode21 = "31B2AB28AB2A22BA5BAB2AB28AB30AFB4AF9B9A9B2AC28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB28AB2AB2AF25AB2AB2AB25AB2AB28AB2AB28AB2ABCFB25AB2A20B9ABAXBDCHACBA2B2A3BA2BCB3ACB2DJACBA2B2ABCBAB6ACEJFDACJACJBFBF9ACDBCDACFA2B2ABG9A2CB2DADEAJB2ABEBAC6AC2B2DADBA2B2AB10AC2BD2ADHA2B2ABDBA2BHB3AC2BDGADHA2B2ABHBAB6ACDBCGACHACB2ABI9ACBECIACHA2B2ACB9ACEJCDACBABDAF2C9ACBED2ACHA2B2ABJ9ACEJBJAEDACDAFC10ACDBCHAEIADB2ACE9ACEJCDAFHADF2ACF9ACEJCFAFHADF2ACG9ACEJBIAEIADEAFCD9ACX05034015002050";
signText = new Array();
if (MovieClip(parent).gotoMap == true){
MovieClip(parent).gotoMap = false;
gotoAndStop("MAP");
} else {
nextFrame();
};
}
function frame3(){
_keys = new Array();
stage.addEventListener(KeyboardEvent.KEY_DOWN, this.handleKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, this.handleKeyUp);
curLevel = 0;
rightKeyPressed = false;
leftKeyPressed = false;
upKeyPressed = false;
downKeyPressed = false;
levelStartSpaceBuffer = false;
animalsLeftStore = 30;
animalsLeft = animalsLeftStore;
worldTextArray = new Array(1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5);
levelTextArray = new Array(1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 5);
parTextArray = new Array(0, 1, 3, 1, 2, 2, 0, 1, 1, 1, 3, 0, 1, 0, 0, 0, 2, 2, 2, 0, 3);
MovieClip(parent).previewMode = false;
sf = MovieClip(parent).savefile.data.medals;
sfT = MovieClip(parent).savefile.data.medalsT;
sfL = MovieClip(parent).savefile.data.medalsL;
arrowMC.x = level0.x;
arrowMC.y = level0.y;
i = 0;
while (i < 21) {
this[("level" + i)].fader.alpha = 1;
this[("level" + i)].alpha = 0.5;
if ((((i == 0)) || (!((sfT[(i - 1)] == undefined))))){
if (sfT[i] == undefined){
this[("level" + i)].rankText.text = "";
this[("level" + i)].lifeText.text = "";
} else {
totalScore = sfT[i];
RTT = "";
if (totalScore < 2){
RTT = "D";
} else {
if (totalScore < 4){
RTT = "C";
} else {
if (totalScore < 6){
RTT = "B";
} else {
RTT = "A";
};
};
};
this[("level" + i)].rankText.text = ("Rank " + RTT);
if (((!((sfL[i] == undefined))) && (!((i == 20))))){
this[("level" + i)].lifeText.text = (sfL[i] + " Died");
animalsLeft = (animalsLeft - sfL[i]);
};
};
this[("level" + i)].fader.alpha = 0;
this[("level" + i)].alpha = 1;
curLevel++;
};
addButton(this[("level" + i)], "", ("GL" + i), ("OL" + i), "");
i++;
};
SIGN.x = this[("level" + (curLevel - 1))].x;
SIGN.y = (this[("level" + (curLevel - 1))].y - 10);
SIGN.ST.gotoAndStop("blank");
SIGN.animalLimit.text = animalsLeft;
animalsLeft = animalsLeftStore;
level0.fader.alpha = 0;
if (MovieClip(parent).activeLevel == 0){
selectMapButton(MovieClip(parent).activeLevel);
} else {
selectMapButton((MovieClip(parent).activeLevel + 1));
};
AW.addEventListener(MouseEvent.MOUSE_UP, AWC);
addEventListener(Event.ENTER_FRAME, mapEnterFrame);
keyBuffer = 0;
backBut.addEventListener(MouseEvent.MOUSE_UP, backButC);
introBut.addEventListener(MouseEvent.MOUSE_UP, introButC);
}
public function butBCodeO(_arg1){
newSignText("BUILD");
}
public function GL0(_arg1){
loadLevelSet(0);
}
public function OL13(_arg1){
selectMapButton(13);
}
public function OL15(_arg1){
selectMapButton(15);
}
public function onEnterFrame(_arg1){
var _local2:*;
var _local3:*;
_local2 = 0;
while (_local2 < 12) {
_local3 = MovieClip(parent).savefile.data.medalsP;
if (_local3[_local2] != true){
MED[("M" + _local2)].alpha = 0.1;
} else {
MED[("M" + _local2)].alpha = 1;
};
_local2++;
};
}
public function OL12(_arg1){
selectMapButton(12);
}
public function OL14(_arg1){
selectMapButton(14);
}
public function OL17(_arg1){
selectMapButton(17);
}
public function AWC(_arg1){
AW.y = 1000;
}
public function angle(_arg1, _arg2, _arg3, _arg4){
return ((Math.round(((Math.atan2((_arg4 - _arg2), (_arg3 - _arg1)) / 3.141593) * 180)) + 90));
}
public function OL10(_arg1){
selectMapButton(10);
}
public function OL11(_arg1){
selectMapButton(11);
}
public function OL20(_arg1){
selectMapButton(20);
}
public function OL19(_arg1){
selectMapButton(19);
}
public function OL18(_arg1){
selectMapButton(18);
}
public function destroyAS3Key(){
stage.removeEventListener(KeyboardEvent.KEY_DOWN, this.handleKeyDown);
stage.removeEventListener(KeyboardEvent.KEY_UP, this.handleKeyUp);
}
function frame2(){
addEventListener(Event.ENTER_FRAME, onEnterFrame);
animType = Math.round(((Math.random() * 6) + 1));
CHAR.Head.sprite.sprite.gotoAndStop(animType);
CHAR.Body.sprite.gotoAndStop(animType);
newSignText(1);
BG.BG1.gotoAndStop((Math.round((Math.random() * 5)) + 1));
arrowMC.x = -4000;
butS.addEventListener(MouseEvent.MOUSE_UP, butSCode);
butU.addEventListener(MouseEvent.MOUSE_UP, butUCode);
butB.addEventListener(MouseEvent.MOUSE_UP, butBCode);
butM.addEventListener(MouseEvent.MOUSE_UP, butMCode);
butC.addEventListener(MouseEvent.MOUSE_UP, butCCode);
butA.addEventListener(MouseEvent.MOUSE_UP, butACode);
butD.addEventListener(MouseEvent.MOUSE_UP, butDCode);
CRED.addEventListener(MouseEvent.MOUSE_UP, butCREDCode);
MED.addEventListener(MouseEvent.MOUSE_UP, butMEDCode);
butS.addEventListener(MouseEvent.MOUSE_OVER, butSCodeO);
butU.addEventListener(MouseEvent.MOUSE_OVER, butUCodeO);
butB.addEventListener(MouseEvent.MOUSE_OVER, butBCodeO);
butM.addEventListener(MouseEvent.MOUSE_OVER, butMCodeO);
butC.addEventListener(MouseEvent.MOUSE_OVER, butCCodeO);
butA.addEventListener(MouseEvent.MOUSE_OVER, butACodeO);
butD.addEventListener(MouseEvent.MOUSE_OVER, butDCodeO);
butS.addEventListener(MouseEvent.MOUSE_OUT, mainClear);
butU.addEventListener(MouseEvent.MOUSE_OUT, mainClear);
butB.addEventListener(MouseEvent.MOUSE_OUT, mainClear);
butM.addEventListener(MouseEvent.MOUSE_OUT, mainClear);
butC.addEventListener(MouseEvent.MOUSE_OUT, mainClear);
butA.addEventListener(MouseEvent.MOUSE_OUT, mainClear);
butD.addEventListener(MouseEvent.MOUSE_OUT, mainClear);
levelCount = 21;
ii = 0;
while (ii < 26) {
sfT2 = MovieClip(parent).savefile.data.medalsT;
if (sfT2[ii] != 6){
if (ii < 21){
levelCount--;
};
};
ii++;
};
if (levelCount == 0){
};
ii = 0;
while (ii < 12) {
sfP = MovieClip(parent).savefile.data.medalsP;
if (sfP[ii] != true){
MED[("M" + ii)].alpha = 0.1;
};
ii++;
};
}
public function butCCode(_arg1){
CRED.y = 0;
}
public function calcSpeed(_arg1, _arg2){
var _local3:Number;
var _local4:Object;
_local3 = (_arg1 * 0.01745329);
_local4 = new Object();
_local4.x = (_arg2 * Math.cos(_local3));
_local4.y = (_arg2 * Math.sin(_local3));
return (_local4);
}
public function OL16(_arg1){
selectMapButton(16);
}
public function butSCode(_arg1){
mainListeners();
if (MovieClip(parent).savefile.data.medals[0] != true){
MovieClip(parent).gotoFrame(MovieClip(parent), "INTRO");
} else {
gotoFrame("MAP");
};
}
public function pythag(_arg1, _arg2, _arg3, _arg4){
return (Math.sqrt((Math.pow((_arg2 - _arg4), 2) + Math.pow((_arg1 - _arg3), 2))));
}
public function rotatedXY(_arg1, _arg2, _arg3){
var _local4:Object;
var _local5:*;
var _local6:*;
var _local7:*;
_local4 = new Object();
_local5 = ((6.28 / 360) * _arg3);
_local6 = Math.sin(_local5);
_local7 = Math.cos(_local5);
_local4.x = ((_arg1 * _local7) - (_arg2 * _local6));
_local4.y = ((_arg1 * _local6) + (_arg2 * _local7));
return (_local4);
}
public function addButton(_arg1, _arg2:String, _arg3:String, _arg4:String, _arg5:String){
var _local6:*;
_arg1.pressVar = _arg2;
_arg1.releaseVar = _arg3;
_arg1.rollVar = _arg4;
_arg1.outVar = _arg5;
_local6 = _arg1;
if (_arg1.pressVar != ""){
_local6.addEventListener(MouseEvent.MOUSE_DOWN, this[_arg2]);
};
if (_arg1.releaseVar != ""){
_local6.addEventListener(MouseEvent.MOUSE_UP, this[_arg3]);
};
if (_arg1.rollVar != ""){
_local6.addEventListener(MouseEvent.MOUSE_OVER, this[_arg4]);
};
if (_arg1.outVar != ""){
_local6.addEventListener(MouseEvent.MOUSE_OUT, this[_arg5]);
};
buttonArray.push(_arg1);
}
public function butSCodeO(_arg1){
newSignText("START");
}
public function butCCodeO(_arg1){
newSignText("CREDITS");
}
public function loadLevelSet(_arg1){
var _local2:Number;
MovieClip(parent).activeLevel = _arg1;
if (this[("level" + _arg1)].fader.alpha == 0){
if ((((animalsLeft > 0)) || (!((this[("level" + _arg1)].rankText.text == ""))))){
_local2 = 0;
while (_local2 < _arg1) {
animalsLeft = (animalsLeft - sfL[_local2]);
_local2++;
};
MovieClip(parent).animalStore = animalsLeft;
removeListeners();
MovieClip(parent).levelCode = this[("LCode" + _arg1)];
MovieClip(parent).gotoFrame(MovieClip(parent), "ENGINE");
} else {
AW.y = 0;
};
};
}
public function backButC(_arg1){
setupEF();
removeListeners();
gotoFrame("TITLE");
}
public function butBCode(_arg1){
mainListeners();
MovieClip(parent).gotoFrame(MovieClip(parent), "EDITORTITLE");
}
public function butMCodeO(_arg1){
newSignText("MEDAL");
}
public function isKeyPressed(_arg1:int):Boolean{
return ((_keys.indexOf(_arg1) > -1));
}
public function GL14(_arg1){
loadLevelSet(14);
}
public function GL15(_arg1){
loadLevelSet(15);
}
public function gotoFrame(_arg1){
MovieClip(parent).gotoFrame(this, _arg1);
}
public function GL11(_arg1){
loadLevelSet(11);
}
public function GL13(_arg1){
loadLevelSet(13);
}
public function GL16(_arg1){
loadLevelSet(16);
}
public function GL17(_arg1){
loadLevelSet(17);
}
public function GL19(_arg1){
loadLevelSet(19);
}
public function GL18(_arg1){
loadLevelSet(18);
}
public function setupEF(){
}
public function butDCodeO(_arg1){
newSignText("ARMORBLOG");
}
public function butCREDCode(_arg1){
MovieClip(parent).newPaw(11);
CRED.y = 500;
}
public function butACode(_arg1){
MovieClip(parent).newPaw(9);
gotoLink("http://www.armorgames.com");
}
public function GL4(_arg1){
loadLevelSet(4);
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 122
//MENU_BGScroll_45 (SWAIN_TheGreaterGood8_fla.MENU_BGScroll_45)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class MENU_BGScroll_45 extends MovieClip {
public var BG1:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 123
//MENU_SignPost_47 (SWAIN_TheGreaterGood8_fla.MENU_SignPost_47)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class MENU_SignPost_47 extends MovieClip {
public var sprite:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 124
//MENU_SignPost_Sprite_48 (SWAIN_TheGreaterGood8_fla.MENU_SignPost_Sprite_48)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
import flash.text.*;
public dynamic class MENU_SignPost_Sprite_48 extends MovieClip {
public var animalLimit:TextField;
public var ST:MovieClip;
}
}//package SWAIN_TheGreaterGood8_fla
Section 125
//MENU_SignText_51 (SWAIN_TheGreaterGood8_fla.MENU_SignText_51)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class MENU_SignText_51 extends MovieClip {
public function MENU_SignText_51(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 126
//Messagebox_148 (SWAIN_TheGreaterGood8_fla.Messagebox_148)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Messagebox_148 extends MovieClip {
public var userData:TextField;
public var sprite:MovieClip;
public function Messagebox_148(){
addFrameScript(0, frame1, 23, frame24);
}
function frame1(){
stop();
}
function frame24(){
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 127
//playB_7 (SWAIN_TheGreaterGood8_fla.playB_7)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class playB_7 extends MovieClip {
public var playB:SimpleButton;
}
}//package SWAIN_TheGreaterGood8_fla
Section 128
//SQ_Terrainsquare_Sprite_164 (SWAIN_TheGreaterGood8_fla.SQ_Terrainsquare_Sprite_164)
package SWAIN_TheGreaterGood8_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class SQ_Terrainsquare_Sprite_164 extends MovieClip {
public function SQ_Terrainsquare_Sprite_164(){
addFrameScript(1, frame2);
}
function frame2(){
gotoAndStop((MovieClip(parent.parent.parent.parent).levelGraphic + 1));
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 129
//SQ_Terrainsquare_Sprite_slope_168 (SWAIN_TheGreaterGood8_fla.SQ_Terrainsquare_Sprite_slope_168)
package SWAIN_TheGreaterGood8_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class SQ_Terrainsquare_Sprite_slope_168 extends MovieClip {
public function SQ_Terrainsquare_Sprite_slope_168(){
addFrameScript(1, frame2);
}
function frame2(){
gotoAndStop((MovieClip(parent.parent.parent.parent).levelGraphic + 1));
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 130
//Swain_Cut_End_87 (SWAIN_TheGreaterGood8_fla.Swain_Cut_End_87)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class Swain_Cut_End_87 extends MovieClip {
public var CBOX:MovieClip;
public var CMASK:MovieClip;
public function Swain_Cut_End_87(){
addFrameScript(237, frame238);
}
function frame238(){
stop();
CBOX.mask = CMASK;
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 131
//Swain_Cut_Intro_79 (SWAIN_TheGreaterGood8_fla.Swain_Cut_Intro_79)
package SWAIN_TheGreaterGood8_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class Swain_Cut_Intro_79 extends MovieClip {
public function Swain_Cut_Intro_79(){
addFrameScript(248, frame249);
}
function frame249(){
stop();
MovieClip(parent).gotoMap = true;
MovieClip(parent).gotoFrame(MovieClip(parent), "TITLE");
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 132
//Swain_Tile4_14 (SWAIN_TheGreaterGood8_fla.Swain_Tile4_14)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class Swain_Tile4_14 extends MovieClip {
public function Swain_Tile4_14(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 133
//Swain_Tile4_title_57 (SWAIN_TheGreaterGood8_fla.Swain_Tile4_title_57)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class Swain_Tile4_title_57 extends MovieClip {
public function Swain_Tile4_title_57(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 134
//TREASURE_32 (SWAIN_TheGreaterGood8_fla.TREASURE_32)
package SWAIN_TheGreaterGood8_fla {
import flash.display.*;
public dynamic class TREASURE_32 extends MovieClip {
public function TREASURE_32(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package SWAIN_TheGreaterGood8_fla
Section 135
//BGPart (BGPart)
package {
import flash.display.*;
public dynamic class BGPart extends MovieClip {
public function BGPart(){
addFrameScript(0, frame1, 3, frame4);
}
function frame1(){
stop();
}
function frame4(){
stop();
}
}
}//package
Section 136
//BODYPARTS (BODYPARTS)
package {
import flash.display.*;
public dynamic class BODYPARTS extends MovieClip {
public function BODYPARTS(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 137
//CoinSquare (CoinSquare)
package {
import flash.display.*;
public dynamic class CoinSquare extends MovieClip {
}
}//package
Section 138
//ENGINE_CULTCROWD (ENGINE_CULTCROWD)
package {
import flash.display.*;
public dynamic class ENGINE_CULTCROWD extends MovieClip {
public var C3:MovieClip;
public var C7:MovieClip;
public var C1:MovieClip;
public var C4:MovieClip;
public var C5:MovieClip;
public var C6:MovieClip;
public var C2:MovieClip;
public var SIGN:MovieClip;
}
}//package
Section 139
//ENGINE_ENDPOINT (ENGINE_ENDPOINT)
package {
import flash.display.*;
public dynamic class ENGINE_ENDPOINT extends MovieClip {
}
}//package
Section 140
//GenBut (GenBut)
package {
import flash.display.*;
public dynamic class GenBut extends SimpleButton {
}
}//package
Section 141
//LavaSquare (LavaSquare)
package {
import flash.display.*;
public dynamic class LavaSquare extends MovieClip {
}
}//package
Section 142
//LE_BLOCK (LE_BLOCK)
package {
import flash.display.*;
public dynamic class LE_BLOCK extends MovieClip {
public var setActive:Boolean;
public var tileType:Number;
public var light:MovieClip;
public var sprite:MovieClip;
public function LE_BLOCK(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
setActive = false;
tileType = 1;
}
}
}//package
Section 143
//LE_ENDPOINT (LE_ENDPOINT)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class LE_ENDPOINT extends MovieClip {
public function LE_ENDPOINT(){
addFrameScript(0, frame1);
}
function frame1(){
addEventListener(MouseEvent.MOUSE_DOWN, MouseDown);
}
public function MouseDown(_arg1){
MovieClip(parent.parent).setActiveObject(this);
}
}
}//package
Section 144
//LE_OBJECT (LE_OBJECT)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class LE_OBJECT extends MovieClip {
public var SHAPE:LE_OBJECT_SPRITE;
public var LINKS:LE_OBJECT_SPRITE;
public var staticLock:LE_OBJECT_SPRITE;
public var SPRITE:LE_OBJECT_SPRITE;
public function LE_OBJECT(){
addFrameScript(0, frame1);
}
function frame1(){
addEventListener(MouseEvent.MOUSE_DOWN, MouseDown);
}
public function MouseDown(_arg1){
MovieClip(parent.parent).setActiveObject(this);
}
}
}//package
Section 145
//LE_OBJECT_SPRITE (LE_OBJECT_SPRITE)
package {
import flash.display.*;
public dynamic class LE_OBJECT_SPRITE extends MovieClip {
public var key:MovieClip;
public var sprite:MovieClip;
public function LE_OBJECT_SPRITE(){
addFrameScript(0, frame1, 9, frame10, 10, frame11);
}
function frame10(){
key.alpha = 1;
}
function frame1(){
stop();
}
function frame11(){
sprite.alpha = 1;
}
}
}//package
Section 146
//LE_STARTPOINT (LE_STARTPOINT)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.system.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class LE_STARTPOINT extends MovieClip {
public function LE_STARTPOINT(){
addFrameScript(0, frame1);
}
function frame1(){
addEventListener(MouseEvent.MOUSE_DOWN, MouseDown);
}
public function MouseDown(_arg1){
MovieClip(parent.parent).setActiveObject(this);
}
}
}//package
Section 147
//PhysBox (PhysBox)
package {
import flash.display.*;
public dynamic class PhysBox extends MovieClip {
}
}//package
Section 148
//PhysCircle (PhysCircle)
package {
import flash.display.*;
public dynamic class PhysCircle extends MovieClip {
}
}//package
Section 149
//PhysGround (PhysGround)
package {
import flash.display.*;
public dynamic class PhysGround extends MovieClip {
}
}//package
Section 150
//SlopeSquare (SlopeSquare)
package {
import flash.display.*;
public dynamic class SlopeSquare extends MovieClip {
public var sprite:MovieClip;
}
}//package
Section 151
//SND_CAVE (SND_CAVE)
package {
import flash.media.*;
public dynamic class SND_CAVE extends Sound {
}
}//package
Section 152
//SND_Coin (SND_Coin)
package {
import flash.media.*;
public dynamic class SND_Coin extends Sound {
}
}//package
Section 153
//SND_Die (SND_Die)
package {
import flash.media.*;
public dynamic class SND_Die extends Sound {
}
}//package
Section 154
//SND_Door (SND_Door)
package {
import flash.media.*;
public dynamic class SND_Door extends Sound {
}
}//package
Section 155
//SND_Fanfare (SND_Fanfare)
package {
import flash.media.*;
public dynamic class SND_Fanfare extends Sound {
}
}//package
Section 156
//SND_FOREST (SND_FOREST)
package {
import flash.media.*;
public dynamic class SND_FOREST extends Sound {
}
}//package
Section 157
//SND_GRASS (SND_GRASS)
package {
import flash.media.*;
public dynamic class SND_GRASS extends Sound {
}
}//package
Section 158
//SND_Jump (SND_Jump)
package {
import flash.media.*;
public dynamic class SND_Jump extends Sound {
}
}//package
Section 159
//SND_SNOW (SND_SNOW)
package {
import flash.media.*;
public dynamic class SND_SNOW extends Sound {
}
}//package
Section 160
//SND_SPOOKY (SND_SPOOKY)
package {
import flash.media.*;
public dynamic class SND_SPOOKY extends Sound {
}
}//package
Section 161
//SND_SQUISH (SND_SQUISH)
package {
import flash.media.*;
public dynamic class SND_SQUISH extends Sound {
}
}//package
Section 162
//SND_TITLE (SND_TITLE)
package {
import flash.media.*;
public dynamic class SND_TITLE extends Sound {
}
}//package
Section 163
//SpikeSquare (SpikeSquare)
package {
import flash.display.*;
public dynamic class SpikeSquare extends MovieClip {
}
}//package
Section 164
//TerrainSquare (TerrainSquare)
package {
import flash.display.*;
public dynamic class TerrainSquare extends MovieClip {
public var sprite:MovieClip;
}
}//package
Section 165
//Tombstone (Tombstone)
package {
import flash.display.*;
public dynamic class Tombstone extends MovieClip {
}
}//package
Section 166
//UFO (UFO)
package {
import flash.display.*;
public dynamic class UFO extends MovieClip {
}
}//package
Section 167
//WaterSquare (WaterSquare)
package {
import flash.display.*;
public dynamic class WaterSquare extends MovieClip {
}
}//package