Section 1
//b2BoxDef (Box2D.Collision.Shapes.b2BoxDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2BoxDef extends b2ShapeDef {
public var extents:b2Vec2;
public function b2BoxDef(){
type = b2Shape.e_boxShape;
extents = new b2Vec2(1, 1);
}
}
}//package Box2D.Collision.Shapes
Section 2
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef)
package Box2D.Collision.Shapes {
public class b2CircleDef extends b2ShapeDef {
public var radius:Number;
public function b2CircleDef(){
type = b2Shape.e_circleShape;
radius = 1;
}
}
}//package Box2D.Collision.Shapes
Section 3
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class b2CircleShape extends b2Shape {
public var m_localPosition:b2Vec2;
public var m_radius:Number;
public function b2CircleShape(_arg1:b2ShapeDef, _arg2:b2Body, _arg3:b2Vec2){
var _local5:Number;
var _local6:Number;
m_localPosition = new b2Vec2();
super(_arg1, _arg2);
var _local4:b2CircleDef = (_arg1 as b2CircleDef);
m_localPosition.Set((_arg1.localPosition.x - _arg3.x), (_arg1.localPosition.y - _arg3.y));
m_type = b2Shape.e_circleShape;
m_radius = _local4.radius;
m_R.SetM(m_body.m_R);
_local5 = ((m_R.col1.x * m_localPosition.x) + (m_R.col2.x * m_localPosition.y));
_local6 = ((m_R.col1.y * m_localPosition.x) + (m_R.col2.y * m_localPosition.y));
m_position.x = (m_body.m_position.x + _local5);
m_position.y = (m_body.m_position.y + _local6);
m_maxRadius = (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))) + m_radius);
var _local7:b2AABB = new b2AABB();
_local7.minVertex.Set((m_position.x - m_radius), (m_position.y - m_radius));
_local7.maxVertex.Set((m_position.x + m_radius), (m_position.y + m_radius));
var _local8:b2BroadPhase = m_body.m_world.m_broadPhase;
if (_local8.InRange(_local7)){
m_proxyId = _local8.CreateProxy(_local7, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
if (m_proxyId == b2Pair.b2_nullProxy){
m_body.Freeze();
};
}
override public function TestPoint(_arg1:b2Vec2):Boolean{
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(_arg1);
_local2.Subtract(m_position);
return ((b2Math.b2Dot(_local2, _local2) <= (m_radius * m_radius)));
}
override public function Synchronize(_arg1:b2Vec2, _arg2:b2Mat22, _arg3:b2Vec2, _arg4:b2Mat22):void{
m_R.SetM(_arg4);
m_position.x = (((_arg4.col1.x * m_localPosition.x) + (_arg4.col2.x * m_localPosition.y)) + _arg3.x);
m_position.y = (((_arg4.col1.y * m_localPosition.x) + (_arg4.col2.y * m_localPosition.y)) + _arg3.y);
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
var _local5:Number = (_arg1.x + ((_arg2.col1.x * m_localPosition.x) + (_arg2.col2.x * m_localPosition.y)));
var _local6:Number = (_arg1.y + ((_arg2.col1.y * m_localPosition.x) + (_arg2.col2.y * m_localPosition.y)));
var _local7:Number = Math.min(_local5, m_position.x);
var _local8:Number = Math.min(_local6, m_position.y);
var _local9:Number = Math.max(_local5, m_position.x);
var _local10:Number = Math.max(_local6, m_position.y);
var _local11:b2AABB = new b2AABB();
_local11.minVertex.Set((_local7 - m_radius), (_local8 - m_radius));
_local11.maxVertex.Set((_local9 + m_radius), (_local10 + m_radius));
var _local12:b2BroadPhase = m_body.m_world.m_broadPhase;
if (_local12.InRange(_local11)){
_local12.MoveProxy(m_proxyId, _local11);
} else {
m_body.Freeze();
};
}
override public function QuickSync(_arg1:b2Vec2, _arg2:b2Mat22):void{
m_R.SetM(_arg2);
m_position.x = (((_arg2.col1.x * m_localPosition.x) + (_arg2.col2.x * m_localPosition.y)) + _arg1.x);
m_position.y = (((_arg2.col1.y * m_localPosition.x) + (_arg2.col2.y * m_localPosition.y)) + _arg1.y);
}
override public function ResetProxy(_arg1:b2BroadPhase):void{
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
var _local2:b2Proxy = _arg1.GetProxy(m_proxyId);
_arg1.DestroyProxy(m_proxyId);
_local2 = null;
var _local3:b2AABB = new b2AABB();
_local3.minVertex.Set((m_position.x - m_radius), (m_position.y - m_radius));
_local3.maxVertex.Set((m_position.x + m_radius), (m_position.y + m_radius));
if (_arg1.InRange(_local3)){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
if (m_proxyId == b2Pair.b2_nullProxy){
m_body.Freeze();
};
}
override public function Support(_arg1:Number, _arg2:Number, _arg3:b2Vec2):void{
var _local4:Number = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
_arg1 = (_arg1 / _local4);
_arg2 = (_arg2 / _local4);
_arg3.Set((m_position.x + (m_radius * _arg1)), (m_position.y + (m_radius * _arg2)));
}
}
}//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(){
center = new b2Vec2(0, 0);
super();
}
}
}//package Box2D.Collision.Shapes
Section 5
//b2PolyDef (Box2D.Collision.Shapes.b2PolyDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PolyDef extends b2ShapeDef {
public var vertices:Array;
public var vertexCount:int;
public function b2PolyDef(){
vertices = new Array(b2Settings.b2_maxPolyVertices);
super();
type = b2Shape.e_polyShape;
vertexCount = 0;
var _local1:int;
while (_local1 < b2Settings.b2_maxPolyVertices) {
vertices[_local1] = new b2Vec2();
_local1++;
};
}
}
}//package Box2D.Collision.Shapes
Section 6
//b2PolyShape (Box2D.Collision.Shapes.b2PolyShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolyShape extends b2Shape {
private var syncAABB:b2AABB;
private var syncMat:b2Mat22;
public var m_localCentroid:b2Vec2;
public var m_localOBB:b2OBB;
public var m_vertices:Array;
public var m_coreVertices:Array;
public var m_vertexCount:int;
public var m_normals:Array;
private static var tempVec:b2Vec2 = new b2Vec2();
private static var tAbsR:b2Mat22 = new b2Mat22();
public function b2PolyShape(_arg1:b2ShapeDef, _arg2:b2Body, _arg3:b2Vec2){
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:b2Vec2;
var _local8:b2AABB;
var _local9:b2Mat22;
var _local14:int;
var _local15:int;
var _local19:b2BoxDef;
var _local20:Number;
var _local21:Number;
var _local22:b2PolyDef;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:b2Vec2;
syncAABB = new b2AABB();
syncMat = new b2Mat22();
m_localCentroid = new b2Vec2();
m_localOBB = new b2OBB();
super(_arg1, _arg2);
_local8 = new b2AABB();
m_vertices = new Array(b2Settings.b2_maxPolyVertices);
m_coreVertices = new Array(b2Settings.b2_maxPolyVertices);
m_normals = new Array(b2Settings.b2_maxPolyVertices);
m_type = b2Shape.e_polyShape;
_local9 = new b2Mat22(_arg1.localRotation);
if (_arg1.type == b2Shape.e_boxShape){
m_localCentroid.x = (_arg1.localPosition.x - _arg3.x);
m_localCentroid.y = (_arg1.localPosition.y - _arg3.y);
_local19 = (_arg1 as b2BoxDef);
m_vertexCount = 4;
_local5 = _local19.extents.x;
_local6 = _local19.extents.y;
_local20 = Math.max(0, (_local5 - (2 * b2Settings.b2_linearSlop)));
_local21 = Math.max(0, (_local6 - (2 * b2Settings.b2_linearSlop)));
_local7 = (m_vertices[0] = new b2Vec2());
_local7.x = ((_local9.col1.x * _local5) + (_local9.col2.x * _local6));
_local7.y = ((_local9.col1.y * _local5) + (_local9.col2.y * _local6));
_local7 = (m_vertices[1] = new b2Vec2());
_local7.x = ((_local9.col1.x * -(_local5)) + (_local9.col2.x * _local6));
_local7.y = ((_local9.col1.y * -(_local5)) + (_local9.col2.y * _local6));
_local7 = (m_vertices[2] = new b2Vec2());
_local7.x = ((_local9.col1.x * -(_local5)) + (_local9.col2.x * -(_local6)));
_local7.y = ((_local9.col1.y * -(_local5)) + (_local9.col2.y * -(_local6)));
_local7 = (m_vertices[3] = new b2Vec2());
_local7.x = ((_local9.col1.x * _local5) + (_local9.col2.x * -(_local6)));
_local7.y = ((_local9.col1.y * _local5) + (_local9.col2.y * -(_local6)));
_local7 = (m_coreVertices[0] = new b2Vec2());
_local7.x = ((_local9.col1.x * _local20) + (_local9.col2.x * _local21));
_local7.y = ((_local9.col1.y * _local20) + (_local9.col2.y * _local21));
_local7 = (m_coreVertices[1] = new b2Vec2());
_local7.x = ((_local9.col1.x * -(_local20)) + (_local9.col2.x * _local21));
_local7.y = ((_local9.col1.y * -(_local20)) + (_local9.col2.y * _local21));
_local7 = (m_coreVertices[2] = new b2Vec2());
_local7.x = ((_local9.col1.x * -(_local20)) + (_local9.col2.x * -(_local21)));
_local7.y = ((_local9.col1.y * -(_local20)) + (_local9.col2.y * -(_local21)));
_local7 = (m_coreVertices[3] = new b2Vec2());
_local7.x = ((_local9.col1.x * _local20) + (_local9.col2.x * -(_local21)));
_local7.y = ((_local9.col1.y * _local20) + (_local9.col2.y * -(_local21)));
} else {
_local22 = (_arg1 as b2PolyDef);
m_vertexCount = _local22.vertexCount;
PolyCentroid(_local22.vertices, _local22.vertexCount, tempVec);
_local23 = tempVec.x;
_local24 = tempVec.y;
m_localCentroid.x = ((_arg1.localPosition.x + ((_local9.col1.x * _local23) + (_local9.col2.x * _local24))) - _arg3.x);
m_localCentroid.y = ((_arg1.localPosition.y + ((_local9.col1.y * _local23) + (_local9.col2.y * _local24))) - _arg3.y);
_local4 = 0;
while (_local4 < m_vertexCount) {
m_vertices[_local4] = new b2Vec2();
m_coreVertices[_local4] = new b2Vec2();
_local5 = (_local22.vertices[_local4].x - _local23);
_local6 = (_local22.vertices[_local4].y - _local24);
m_vertices[_local4].x = ((_local9.col1.x * _local5) + (_local9.col2.x * _local6));
m_vertices[_local4].y = ((_local9.col1.y * _local5) + (_local9.col2.y * _local6));
_local25 = m_vertices[_local4].x;
_local26 = m_vertices[_local4].y;
_local27 = Math.sqrt(((_local25 * _local25) + (_local26 * _local26)));
if (_local27 > Number.MIN_VALUE){
_local25 = (_local25 * (1 / _local27));
_local26 = (_local26 * (1 / _local27));
};
m_coreVertices[_local4].x = (m_vertices[_local4].x - ((2 * b2Settings.b2_linearSlop) * _local25));
m_coreVertices[_local4].y = (m_vertices[_local4].y - ((2 * b2Settings.b2_linearSlop) * _local26));
_local4++;
};
};
var _local10:Number = Number.MAX_VALUE;
var _local11:Number = Number.MAX_VALUE;
var _local12:Number = -(Number.MAX_VALUE);
var _local13:Number = -(Number.MAX_VALUE);
m_maxRadius = 0;
_local4 = 0;
while (_local4 < m_vertexCount) {
_local28 = m_vertices[_local4];
_local10 = Math.min(_local10, _local28.x);
_local11 = Math.min(_local11, _local28.y);
_local12 = Math.max(_local12, _local28.x);
_local13 = Math.max(_local13, _local28.y);
m_maxRadius = Math.max(m_maxRadius, _local28.Length());
_local4++;
};
m_localOBB.R.SetIdentity();
m_localOBB.center.Set(((_local10 + _local12) * 0.5), ((_local11 + _local13) * 0.5));
m_localOBB.extents.Set(((_local12 - _local10) * 0.5), ((_local13 - _local11) * 0.5));
_local4 = 0;
while (_local4 < m_vertexCount) {
m_normals[_local4] = new b2Vec2();
_local14 = _local4;
_local15 = (((_local4 + 1) < m_vertexCount)) ? (_local4 + 1) : 0;
m_normals[_local4].x = (m_vertices[_local15].y - m_vertices[_local14].y);
m_normals[_local4].y = -((m_vertices[_local15].x - m_vertices[_local14].x));
m_normals[_local4].Normalize();
_local4++;
};
_local4 = 0;
while (_local4 < m_vertexCount) {
_local14 = _local4;
_local15 = (((_local4 + 1) < m_vertexCount)) ? (_local4 + 1) : 0;
_local4++;
};
m_R.SetM(m_body.m_R);
m_position.x = (m_body.m_position.x + ((m_R.col1.x * m_localCentroid.x) + (m_R.col2.x * m_localCentroid.y)));
m_position.y = (m_body.m_position.y + ((m_R.col1.y * m_localCentroid.x) + (m_R.col2.y * m_localCentroid.y)));
tAbsR.col1.x = ((m_R.col1.x * m_localOBB.R.col1.x) + (m_R.col2.x * m_localOBB.R.col1.y));
tAbsR.col1.y = ((m_R.col1.y * m_localOBB.R.col1.x) + (m_R.col2.y * m_localOBB.R.col1.y));
tAbsR.col2.x = ((m_R.col1.x * m_localOBB.R.col2.x) + (m_R.col2.x * m_localOBB.R.col2.y));
tAbsR.col2.y = ((m_R.col1.y * m_localOBB.R.col2.x) + (m_R.col2.y * m_localOBB.R.col2.y));
tAbsR.Abs();
_local5 = ((tAbsR.col1.x * m_localOBB.extents.x) + (tAbsR.col2.x * m_localOBB.extents.y));
_local6 = ((tAbsR.col1.y * m_localOBB.extents.x) + (tAbsR.col2.y * m_localOBB.extents.y));
var _local16:Number = (m_position.x + ((m_R.col1.x * m_localOBB.center.x) + (m_R.col2.x * m_localOBB.center.y)));
var _local17:Number = (m_position.y + ((m_R.col1.y * m_localOBB.center.x) + (m_R.col2.y * m_localOBB.center.y)));
_local8.minVertex.x = (_local16 - _local5);
_local8.minVertex.y = (_local17 - _local6);
_local8.maxVertex.x = (_local16 + _local5);
_local8.maxVertex.y = (_local17 + _local6);
var _local18:b2BroadPhase = m_body.m_world.m_broadPhase;
if (_local18.InRange(_local8)){
m_proxyId = _local18.CreateProxy(_local8, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
if (m_proxyId == b2Pair.b2_nullProxy){
m_body.Freeze();
};
}
override public function TestPoint(_arg1:b2Vec2):Boolean{
var _local4:b2Vec2;
var _local5:Number;
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(_arg1);
_local2.Subtract(m_position);
_local2.MulTM(m_R);
var _local3:int;
while (_local3 < m_vertexCount) {
_local4 = new b2Vec2();
_local4.SetV(_local2);
_local4.Subtract(m_vertices[_local3]);
_local5 = b2Math.b2Dot(m_normals[_local3], _local4);
if (_local5 > 0){
return (false);
};
_local3++;
};
return (true);
}
override public function Synchronize(_arg1:b2Vec2, _arg2:b2Mat22, _arg3:b2Vec2, _arg4:b2Mat22):void{
var _local5:Number;
var _local6:Number;
m_R.SetM(_arg4);
m_position.x = (m_body.m_position.x + ((_arg4.col1.x * m_localCentroid.x) + (_arg4.col2.x * m_localCentroid.y)));
m_position.y = (m_body.m_position.y + ((_arg4.col1.y * m_localCentroid.x) + (_arg4.col2.y * m_localCentroid.y)));
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
var _local7:b2Vec2 = _arg2.col1;
var _local8:b2Vec2 = _arg2.col2;
var _local9:b2Vec2 = m_localOBB.R.col1;
var _local10:b2Vec2 = m_localOBB.R.col2;
syncMat.col1.x = ((_local7.x * _local9.x) + (_local8.x * _local9.y));
syncMat.col1.y = ((_local7.y * _local9.x) + (_local8.y * _local9.y));
syncMat.col2.x = ((_local7.x * _local10.x) + (_local8.x * _local10.y));
syncMat.col2.y = ((_local7.y * _local10.x) + (_local8.y * _local10.y));
syncMat.Abs();
_local5 = (m_localCentroid.x + m_localOBB.center.x);
_local6 = (m_localCentroid.y + m_localOBB.center.y);
var _local11:Number = (_arg1.x + ((_arg2.col1.x * _local5) + (_arg2.col2.x * _local6)));
var _local12:Number = (_arg1.y + ((_arg2.col1.y * _local5) + (_arg2.col2.y * _local6)));
_local5 = ((syncMat.col1.x * m_localOBB.extents.x) + (syncMat.col2.x * m_localOBB.extents.y));
_local6 = ((syncMat.col1.y * m_localOBB.extents.x) + (syncMat.col2.y * m_localOBB.extents.y));
syncAABB.minVertex.x = (_local11 - _local5);
syncAABB.minVertex.y = (_local12 - _local6);
syncAABB.maxVertex.x = (_local11 + _local5);
syncAABB.maxVertex.y = (_local12 + _local6);
_local7 = _arg4.col1;
_local8 = _arg4.col2;
_local9 = m_localOBB.R.col1;
_local10 = m_localOBB.R.col2;
syncMat.col1.x = ((_local7.x * _local9.x) + (_local8.x * _local9.y));
syncMat.col1.y = ((_local7.y * _local9.x) + (_local8.y * _local9.y));
syncMat.col2.x = ((_local7.x * _local10.x) + (_local8.x * _local10.y));
syncMat.col2.y = ((_local7.y * _local10.x) + (_local8.y * _local10.y));
syncMat.Abs();
_local5 = (m_localCentroid.x + m_localOBB.center.x);
_local6 = (m_localCentroid.y + m_localOBB.center.y);
_local11 = (_arg3.x + ((_arg4.col1.x * _local5) + (_arg4.col2.x * _local6)));
_local12 = (_arg3.y + ((_arg4.col1.y * _local5) + (_arg4.col2.y * _local6)));
_local5 = ((syncMat.col1.x * m_localOBB.extents.x) + (syncMat.col2.x * m_localOBB.extents.y));
_local6 = ((syncMat.col1.y * m_localOBB.extents.x) + (syncMat.col2.y * m_localOBB.extents.y));
syncAABB.minVertex.x = Math.min(syncAABB.minVertex.x, (_local11 - _local5));
syncAABB.minVertex.y = Math.min(syncAABB.minVertex.y, (_local12 - _local6));
syncAABB.maxVertex.x = Math.max(syncAABB.maxVertex.x, (_local11 + _local5));
syncAABB.maxVertex.y = Math.max(syncAABB.maxVertex.y, (_local12 + _local6));
var _local13:b2BroadPhase = m_body.m_world.m_broadPhase;
if (_local13.InRange(syncAABB)){
_local13.MoveProxy(m_proxyId, syncAABB);
} else {
m_body.Freeze();
};
}
override public function QuickSync(_arg1:b2Vec2, _arg2:b2Mat22):void{
m_R.SetM(_arg2);
m_position.x = (_arg1.x + ((_arg2.col1.x * m_localCentroid.x) + (_arg2.col2.x * m_localCentroid.y)));
m_position.y = (_arg1.y + ((_arg2.col1.y * m_localCentroid.x) + (_arg2.col2.y * m_localCentroid.y)));
}
override public function ResetProxy(_arg1:b2BroadPhase):void{
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
var _local2:b2Proxy = _arg1.GetProxy(m_proxyId);
_arg1.DestroyProxy(m_proxyId);
_local2 = null;
var _local3:b2Mat22 = b2Math.b2MulMM(m_R, m_localOBB.R);
var _local4:b2Mat22 = b2Math.b2AbsM(_local3);
var _local5:b2Vec2 = b2Math.b2MulMV(_local4, m_localOBB.extents);
var _local6:b2Vec2 = b2Math.b2MulMV(m_R, m_localOBB.center);
_local6.Add(m_position);
var _local7:b2AABB = new b2AABB();
_local7.minVertex.SetV(_local6);
_local7.minVertex.Subtract(_local5);
_local7.maxVertex.SetV(_local6);
_local7.maxVertex.Add(_local5);
if (_arg1.InRange(_local7)){
m_proxyId = _arg1.CreateProxy(_local7, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
if (m_proxyId == b2Pair.b2_nullProxy){
m_body.Freeze();
};
}
override public function Support(_arg1:Number, _arg2:Number, _arg3:b2Vec2):void{
var _local9:Number;
var _local4:Number = ((_arg1 * m_R.col1.x) + (_arg2 * m_R.col1.y));
var _local5:Number = ((_arg1 * m_R.col2.x) + (_arg2 * m_R.col2.y));
var _local6:int;
var _local7:Number = ((m_coreVertices[0].x * _local4) + (m_coreVertices[0].y * _local5));
var _local8 = 1;
while (_local8 < m_vertexCount) {
_local9 = ((m_coreVertices[_local8].x * _local4) + (m_coreVertices[_local8].y * _local5));
if (_local9 > _local7){
_local6 = _local8;
_local7 = _local9;
};
_local8++;
};
_arg3.Set((m_position.x + ((m_R.col1.x * m_coreVertices[_local6].x) + (m_R.col2.x * m_coreVertices[_local6].y))), (m_position.y + ((m_R.col1.y * m_coreVertices[_local6].x) + (m_R.col2.y * m_coreVertices[_local6].y))));
}
}
}//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.*;
import Box2D.Common.*;
public class b2Shape {
public var m_next:b2Shape;
public var m_R:b2Mat22;
public var m_position:b2Vec2;
public var m_type:int;
public var m_userData;// = null
public var m_body:b2Body;
public var m_friction:Number;
public var m_restitution:Number;
public var m_maxRadius:Number;
public var m_proxyId:uint;
public var m_categoryBits:uint;
public var m_maskBits:uint;
public var m_groupIndex:int;
public static const e_unknownShape:int = -1;
public static const e_circleShape:int = 0;
public static const e_boxShape:int = 1;
public static const e_polyShape:int = 2;
public static const e_meshShape:int = 3;
public static const e_shapeTypeCount:int = 4;
public function b2Shape(_arg1:b2ShapeDef, _arg2:b2Body){
m_R = new b2Mat22();
m_position = new b2Vec2();
super();
m_userData = _arg1.userData;
m_friction = _arg1.friction;
m_restitution = _arg1.restitution;
m_body = _arg2;
m_proxyId = b2Pair.b2_nullProxy;
m_maxRadius = 0;
m_categoryBits = _arg1.categoryBits;
m_maskBits = _arg1.maskBits;
m_groupIndex = _arg1.groupIndex;
}
public function TestPoint(_arg1:b2Vec2):Boolean{
return (false);
}
public function GetUserData(){
return (m_userData);
}
public function GetType():int{
return (m_type);
}
public function GetBody():b2Body{
return (m_body);
}
public function GetPosition():b2Vec2{
return (m_position);
}
public function GetRotationMatrix():b2Mat22{
return (m_R);
}
public function ResetProxy(_arg1:b2BroadPhase):void{
}
public function GetNext():b2Shape{
return (m_next);
}
public function DestroyProxy():void{
if (m_proxyId != b2Pair.b2_nullProxy){
m_body.m_world.m_broadPhase.DestroyProxy(m_proxyId);
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function Synchronize(_arg1:b2Vec2, _arg2:b2Mat22, _arg3:b2Vec2, _arg4:b2Mat22):void{
}
public function QuickSync(_arg1:b2Vec2, _arg2:b2Mat22):void{
}
public function Support(_arg1:Number, _arg2:Number, _arg3:b2Vec2):void{
}
public function GetMaxRadius():Number{
return (m_maxRadius);
}
public static function Create(_arg1:b2ShapeDef, _arg2:b2Body, _arg3:b2Vec2):b2Shape{
switch (_arg1.type){
case e_circleShape:
return (new b2CircleShape(_arg1, _arg2, _arg3));
case e_boxShape:
case e_polyShape:
return (new b2PolyShape(_arg1, _arg2, _arg3));
};
return (null);
}
public static function Destroy(_arg1:b2Shape):void{
if (_arg1.m_proxyId != b2Pair.b2_nullProxy){
_arg1.m_body.m_world.m_broadPhase.DestroyProxy(_arg1.m_proxyId);
};
}
public static function PolyMass(_arg1:b2MassData, _arg2:Array, _arg3:int, _arg4:Number):void{
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local14:b2Vec2;
var _local15:b2Vec2;
var _local16:Number;
var _local17:Number;
var _local18:b2Vec2;
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 _local5:b2Vec2 = new b2Vec2();
_local5.SetZero();
var _local6:Number = 0;
var _local7:Number = 0;
var _local8:b2Vec2 = new b2Vec2(0, 0);
var _local9:Number = (1 / 3);
var _local10:int;
while (_local10 < _arg3) {
_local11 = _local8;
_local12 = _arg2[_local10];
_local13 = (((_local10 + 1) < _arg3)) ? _arg2[(_local10 + 1)] : _arg2[0];
_local14 = b2Math.SubtractVV(_local12, _local11);
_local15 = b2Math.SubtractVV(_local13, _local11);
_local16 = b2Math.b2CrossVV(_local14, _local15);
_local17 = (0.5 * _local16);
_local6 = (_local6 + _local17);
_local18 = new b2Vec2();
_local18.SetV(_local11);
_local18.Add(_local12);
_local18.Add(_local13);
_local18.Multiply((_local9 * _local17));
_local5.Add(_local18);
_local19 = _local11.x;
_local20 = _local11.y;
_local21 = _local14.x;
_local22 = _local14.y;
_local23 = _local15.x;
_local24 = _local15.y;
_local25 = ((_local9 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19));
_local26 = ((_local9 * ((0.25 * (((_local22 * _local22) + (_local24 * _local22)) + (_local24 * _local24))) + ((_local20 * _local22) + (_local20 * _local24)))) + ((0.5 * _local20) * _local20));
_local7 = (_local7 + (_local16 * (_local25 + _local26)));
_local10++;
};
_arg1.mass = (_arg4 * _local6);
_local5.Multiply((1 / _local6));
_arg1.center = _local5;
_local7 = (_arg4 * (_local7 - (_local6 * b2Math.b2Dot(_local5, _local5))));
_arg1.I = _local7;
}
public static function PolyCentroid(_arg1:Array, _arg2:int, _arg3:b2Vec2):void{
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 _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
var _local7:Number = 0;
var _local8:Number = 0;
var _local9:Number = (1 / 3);
var _local10:int;
while (_local10 < _arg2) {
_local11 = _local7;
_local12 = _local8;
_local13 = _arg1[_local10].x;
_local14 = _arg1[_local10].y;
_local15 = (((_local10 + 1) < _arg2)) ? _arg1[(_local10 + 1)].x : _arg1[0].x;
_local16 = (((_local10 + 1) < _arg2)) ? _arg1[(_local10 + 1)].y : _arg1[0].y;
_local17 = (_local13 - _local11);
_local18 = (_local14 - _local12);
_local19 = (_local15 - _local11);
_local20 = (_local16 - _local12);
_local21 = ((_local17 * _local20) - (_local18 * _local19));
_local22 = (0.5 * _local21);
_local6 = (_local6 + _local22);
_local4 = (_local4 + ((_local22 * _local9) * ((_local11 + _local13) + _local15)));
_local5 = (_local5 + ((_local22 * _local9) * ((_local12 + _local14) + _local16)));
_local10++;
};
_local4 = (_local4 * (1 / _local6));
_local5 = (_local5 * (1 / _local6));
_arg3.Set(_local4, _local5);
}
}
}//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2ShapeDef {
public var type:int;
public var userData;// = null
public var localPosition:b2Vec2;
public var localRotation:Number;
public var friction:Number;
public var restitution:Number;
public var density:Number;
public var categoryBits:int;
public var maskBits:int;
public var groupIndex:int;
public function b2ShapeDef(){
type = b2Shape.e_unknownShape;
userData = null;
localPosition = new b2Vec2(0, 0);
localRotation = 0;
friction = 0.2;
restitution = 0;
density = 0;
categoryBits = 1;
maskBits = 0xFFFF;
groupIndex = 0;
}
public function ComputeMass(_arg1:b2MassData):void{
var _local2:b2CircleDef;
var _local3:b2BoxDef;
var _local4:b2PolyDef;
_arg1.center = new b2Vec2(0, 0);
if (density == 0){
_arg1.mass = 0;
_arg1.center.Set(0, 0);
_arg1.I = 0;
};
switch (type){
case b2Shape.e_circleShape:
_local2 = (this as b2CircleDef);
_arg1.mass = (((density * b2Settings.b2_pi) * _local2.radius) * _local2.radius);
_arg1.center.Set(0, 0);
_arg1.I = (((0.5 * _arg1.mass) * _local2.radius) * _local2.radius);
break;
case b2Shape.e_boxShape:
_local3 = (this as b2BoxDef);
_arg1.mass = (((4 * density) * _local3.extents.x) * _local3.extents.y);
_arg1.center.Set(0, 0);
_arg1.I = ((_arg1.mass / 3) * b2Math.b2Dot(_local3.extents, _local3.extents));
break;
case b2Shape.e_polyShape:
_local4 = (this as b2PolyDef);
b2Shape.PolyMass(_arg1, _local4.vertices, _local4.vertexCount, density);
break;
default:
_arg1.mass = 0;
_arg1.center.Set(0, 0);
_arg1.I = 0;
break;
};
}
}
}//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2AABB {
public var minVertex:b2Vec2;
public var maxVertex:b2Vec2;
public function b2AABB(){
minVertex = new b2Vec2();
maxVertex = new b2Vec2();
super();
}
public function IsValid():Boolean{
var _local1:Number = maxVertex.x;
var _local2:Number = maxVertex.y;
_local1 = maxVertex.x;
_local2 = maxVertex.y;
_local1 = (_local1 - minVertex.x);
_local2 = (_local2 - minVertex.y);
var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (minVertex.IsValid()))) && (maxVertex.IsValid()));
return (_local3);
}
}
}//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound)
package Box2D.Collision {
public class b2Bound {
public var value:uint;
public var proxyId:uint;
public var stabbingCount:uint;
public function IsLower():Boolean{
return (((value & 1) == 0));
}
public function IsUpper():Boolean{
return (((value & 1) == 1));
}
public function Swap(_arg1:b2Bound):void{
var _local2:uint = value;
var _local3:uint = proxyId;
var _local4:uint = stabbingCount;
value = _arg1.value;
proxyId = _arg1.proxyId;
stabbingCount = _arg1.stabbingCount;
_arg1.value = _local2;
_arg1.proxyId = _local3;
_arg1.stabbingCount = _local4;
}
}
}//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_pairManager:b2PairManager;
public var m_proxyPool:Array;
public var m_freeProxy:uint;
public var m_bounds:Array;
public var m_queryResults:Array;
public var m_queryResultCount:int;
public var m_worldAABB:b2AABB;
public var m_quantizationFactor:b2Vec2;
public var m_proxyCount:int;
public var m_timeStamp:uint;
public static const b2_invalid:uint = b2Settings.USHRT_MAX;
public static const b2_nullEdge:uint = b2Settings.USHRT_MAX;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local6:b2Proxy;
var _local7:int;
m_pairManager = new b2PairManager();
m_proxyPool = new Array(b2Settings.b2_maxPairs);
m_bounds = new Array((2 * b2Settings.b2_maxProxies));
m_queryResults = new Array(b2Settings.b2_maxProxies);
m_quantizationFactor = new b2Vec2();
super();
m_pairManager.Initialize(this, _arg2);
m_worldAABB = _arg1;
m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
m_queryResults[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
var _local4:Number = _arg1.maxVertex.x;
var _local5:Number = _arg1.maxVertex.y;
_local4 = (_local4 - _arg1.minVertex.x);
_local5 = (_local5 - _arg1.minVertex.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[(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 InRange(_arg1:b2AABB):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = _arg1.minVertex.x;
_local3 = _arg1.minVertex.y;
_local2 = (_local2 - m_worldAABB.maxVertex.x);
_local3 = (_local3 - m_worldAABB.maxVertex.y);
_local4 = m_worldAABB.minVertex.x;
_local5 = m_worldAABB.minVertex.y;
_local4 = (_local4 - _arg1.maxVertex.x);
_local5 = (_local5 - _arg1.maxVertex.y);
_local2 = b2Math.b2Max(_local2, _local4);
_local3 = b2Math.b2Max(_local3, _local5);
return ((b2Math.b2Max(_local2, _local3) < 0));
}
public function GetProxy(_arg1:int):b2Proxy{
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((m_proxyPool[_arg1].IsValid() == false)))){
return (null);
};
return (m_proxyPool[_arg1]);
}
public function CreateProxy(_arg1:b2AABB, _arg2):uint{
var _local3:uint;
var _local4:b2Proxy;
var _local11:Array;
var _local12:uint;
var _local13:uint;
var _local14:Array;
var _local15:Array;
var _local16:Array;
var _local17:int;
var _local18:int;
var _local19:b2Bound;
var _local20:b2Bound;
var _local21:int;
var _local22:b2Proxy;
var _local5:uint = m_freeProxy;
_local4 = m_proxyPool[_local5];
m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
var _local6:uint = (2 * m_proxyCount);
var _local7:Array = new Array();
var _local8:Array = new Array();
ComputeBounds(_local7, _local8, _arg1);
var _local9:int;
while (_local9 < 2) {
_local11 = m_bounds[_local9];
_local14 = [_local12];
_local15 = [_local13];
Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9);
_local12 = _local14[0];
_local13 = _local15[0];
_local16 = new Array();
_local18 = (_local6 - _local13);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[(_local13 + _local17)];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local21 = (_local13 + 2);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[(_local21 + _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[(_local12 + _local17)];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local21 = (_local12 + 1);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[(_local21 + _local17)];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local13++;
_local11[_local12].value = _local7[_local9];
_local11[_local12].proxyId = _local5;
_local11[_local13].value = _local8[_local9];
_local11[_local13].proxyId = _local5;
_local11[_local12].stabbingCount = ((_local12 == 0)) ? 0 : _local11[(_local12 - 1)].stabbingCount;
_local11[_local13].stabbingCount = _local11[(_local13 - 1)].stabbingCount;
_local3 = _local12;
while (_local3 < _local13) {
_local11[_local3].stabbingCount++;
_local3++;
};
_local3 = _local12;
while (_local3 < (_local6 + 2)) {
_local22 = m_proxyPool[_local11[_local3].proxyId];
if (_local11[_local3].IsLower()){
_local22.lowerBounds[_local9] = _local3;
} else {
_local22.upperBounds[_local9] = _local3;
};
_local3++;
};
_local9++;
};
m_proxyCount++;
var _local10:int;
while (_local10 < m_queryResultCount) {
m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]);
_local10++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local5);
}
public function DestroyProxy(_arg1:uint):void{
var _local6:Array;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:Array;
var _local12:int;
var _local13:int;
var _local14:b2Bound;
var _local15:b2Bound;
var _local16:int;
var _local17:uint;
var _local18:int;
var _local19:b2Proxy;
var _local2:b2Proxy = m_proxyPool[_arg1];
var _local3:int = (2 * m_proxyCount);
var _local4:int;
while (_local4 < 2) {
_local6 = m_bounds[_local4];
_local7 = _local2.lowerBounds[_local4];
_local8 = _local2.upperBounds[_local4];
_local9 = _local6[_local7].value;
_local10 = _local6[_local8].value;
_local11 = new Array();
_local13 = ((_local8 - _local7) - 1);
_local12 = 0;
while (_local12 < _local13) {
_local11[_local12] = new b2Bound();
_local14 = _local11[_local12];
_local15 = _local6[((_local7 + 1) + _local12)];
_local14.value = _local15.value;
_local14.proxyId = _local15.proxyId;
_local14.stabbingCount = _local15.stabbingCount;
_local12++;
};
_local13 = _local11.length;
_local16 = _local7;
_local12 = 0;
while (_local12 < _local13) {
_local15 = _local11[_local12];
_local14 = _local6[(_local16 + _local12)];
_local14.value = _local15.value;
_local14.proxyId = _local15.proxyId;
_local14.stabbingCount = _local15.stabbingCount;
_local12++;
};
_local11 = new Array();
_local13 = ((_local3 - _local8) - 1);
_local12 = 0;
while (_local12 < _local13) {
_local11[_local12] = new b2Bound();
_local14 = _local11[_local12];
_local15 = _local6[((_local8 + 1) + _local12)];
_local14.value = _local15.value;
_local14.proxyId = _local15.proxyId;
_local14.stabbingCount = _local15.stabbingCount;
_local12++;
};
_local13 = _local11.length;
_local16 = (_local8 - 1);
_local12 = 0;
while (_local12 < _local13) {
_local15 = _local11[_local12];
_local14 = _local6[(_local16 + _local12)];
_local14.value = _local15.value;
_local14.proxyId = _local15.proxyId;
_local14.stabbingCount = _local15.stabbingCount;
_local12++;
};
_local13 = (_local3 - 2);
_local17 = _local7;
while (_local17 < _local13) {
_local19 = m_proxyPool[_local6[_local17].proxyId];
if (_local6[_local17].IsLower()){
_local19.lowerBounds[_local4] = _local17;
} else {
_local19.upperBounds[_local4] = _local17;
};
_local17++;
};
_local13 = (_local8 - 1);
_local18 = _local7;
while (_local18 < _local13) {
_local6[_local18].stabbingCount--;
_local18++;
};
Query([0], [0], _local9, _local10, _local6, (_local3 - 2), _local4);
_local4++;
};
var _local5:int;
while (_local5 < m_queryResultCount) {
m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local5]);
_local5++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
_local2.userData = null;
_local2.overlapCount = b2_invalid;
_local2.lowerBounds[0] = b2_invalid;
_local2.lowerBounds[1] = b2_invalid;
_local2.upperBounds[0] = b2_invalid;
_local2.upperBounds[1] = b2_invalid;
_local2.SetNext(m_freeProxy);
m_freeProxy = _arg1;
m_proxyCount--;
}
public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{
var _local3:uint;
var _local4:uint;
var _local5:b2Bound;
var _local6:b2Bound;
var _local7:b2Bound;
var _local8:uint;
var _local9:b2Proxy;
var _local14:Array;
var _local15:uint;
var _local16:uint;
var _local17:uint;
var _local18:uint;
var _local19:int;
var _local20:int;
var _local21:uint;
var _local22:b2Proxy;
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){
return;
};
if (_arg2.IsValid() == false){
return;
};
var _local10:uint = (2 * m_proxyCount);
var _local11:b2Proxy = m_proxyPool[_arg1];
var _local12:b2BoundValues = new b2BoundValues();
ComputeBounds(_local12.lowerValues, _local12.upperValues, _arg2);
var _local13:b2BoundValues = new b2BoundValues();
_local3 = 0;
while (_local3 < 2) {
_local13.lowerValues[_local3] = m_bounds[_local3][_local11.lowerBounds[_local3]].value;
_local13.upperValues[_local3] = m_bounds[_local3][_local11.upperBounds[_local3]].value;
_local3++;
};
_local3 = 0;
while (_local3 < 2) {
_local14 = m_bounds[_local3];
_local15 = _local11.lowerBounds[_local3];
_local16 = _local11.upperBounds[_local3];
_local17 = _local12.lowerValues[_local3];
_local18 = _local12.upperValues[_local3];
_local19 = (_local17 - _local14[_local15].value);
_local20 = (_local18 - _local14[_local16].value);
_local14[_local15].value = _local17;
_local14[_local16].value = _local18;
if (_local19 < 0){
_local4 = _local15;
while ((((_local4 > 0)) && ((_local17 < _local14[(_local4 - 1)].value)))) {
_local5 = _local14[_local4];
_local6 = _local14[(_local4 - 1)];
_local21 = _local6.proxyId;
_local22 = m_proxyPool[_local6.proxyId];
_local6.stabbingCount++;
if (_local6.IsUpper() == true){
if (TestOverlap(_local12, _local22)){
m_pairManager.AddBufferedPair(_arg1, _local21);
};
var _local23 = _local22.upperBounds;
var _local24 = _local3;
var _local25 = (_local23[_local24] + 1);
_local23[_local24] = _local25;
_local5.stabbingCount++;
} else {
_local23 = _local22.lowerBounds;
_local24 = _local3;
_local25 = (_local23[_local24] + 1);
_local23[_local24] = _local25;
_local5.stabbingCount--;
};
_local23 = _local11.lowerBounds;
_local24 = _local3;
_local25 = (_local23[_local24] - 1);
_local23[_local24] = _local25;
_local5.Swap(_local6);
_local4--;
};
};
if (_local20 > 0){
_local4 = _local16;
while ((((_local4 < (_local10 - 1))) && ((_local14[(_local4 + 1)].value <= _local18)))) {
_local5 = _local14[_local4];
_local7 = _local14[(_local4 + 1)];
_local8 = _local7.proxyId;
_local9 = m_proxyPool[_local8];
_local7.stabbingCount++;
if (_local7.IsLower() == true){
if (TestOverlap(_local12, _local9)){
m_pairManager.AddBufferedPair(_arg1, _local8);
};
_local23 = _local9.lowerBounds;
_local24 = _local3;
_local25 = (_local23[_local24] - 1);
_local23[_local24] = _local25;
_local5.stabbingCount++;
} else {
_local23 = _local9.upperBounds;
_local24 = _local3;
_local25 = (_local23[_local24] - 1);
_local23[_local24] = _local25;
_local5.stabbingCount--;
};
_local23 = _local11.upperBounds;
_local24 = _local3;
_local25 = (_local23[_local24] + 1);
_local23[_local24] = _local25;
_local5.Swap(_local7);
_local4++;
};
};
if (_local19 > 0){
_local4 = _local15;
while ((((_local4 < (_local10 - 1))) && ((_local14[(_local4 + 1)].value <= _local17)))) {
_local5 = _local14[_local4];
_local7 = _local14[(_local4 + 1)];
_local8 = _local7.proxyId;
_local9 = m_proxyPool[_local8];
_local7.stabbingCount--;
if (_local7.IsUpper()){
if (TestOverlap(_local13, _local9)){
m_pairManager.RemoveBufferedPair(_arg1, _local8);
};
_local23 = _local9.upperBounds;
_local24 = _local3;
_local25 = (_local23[_local24] - 1);
_local23[_local24] = _local25;
_local5.stabbingCount--;
} else {
_local23 = _local9.lowerBounds;
_local24 = _local3;
_local25 = (_local23[_local24] - 1);
_local23[_local24] = _local25;
_local5.stabbingCount++;
};
_local23 = _local11.lowerBounds;
_local24 = _local3;
_local25 = (_local23[_local24] + 1);
_local23[_local24] = _local25;
_local5.Swap(_local7);
_local4++;
};
};
if (_local20 < 0){
_local4 = _local16;
while ((((_local4 > 0)) && ((_local18 < _local14[(_local4 - 1)].value)))) {
_local5 = _local14[_local4];
_local6 = _local14[(_local4 - 1)];
_local21 = _local6.proxyId;
_local22 = m_proxyPool[_local21];
_local6.stabbingCount--;
if (_local6.IsLower() == true){
if (TestOverlap(_local13, _local22)){
m_pairManager.RemoveBufferedPair(_arg1, _local21);
};
_local23 = _local22.lowerBounds;
_local24 = _local3;
_local25 = (_local23[_local24] + 1);
_local23[_local24] = _local25;
_local5.stabbingCount--;
} else {
_local23 = _local22.upperBounds;
_local24 = _local3;
_local25 = (_local23[_local24] + 1);
_local23[_local24] = _local25;
_local5.stabbingCount++;
};
_local23 = _local11.upperBounds;
_local24 = _local3;
_local25 = (_local23[_local24] - 1);
_local23[_local24] = _local25;
_local5.Swap(_local6);
_local4--;
};
};
_local3++;
};
}
public function Commit():void{
m_pairManager.Commit();
}
public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{
var _local6:uint;
var _local7:uint;
var _local12:b2Proxy;
var _local4:Array = new Array();
var _local5:Array = new Array();
ComputeBounds(_local4, _local5, _arg1);
var _local8:Array = [_local6];
var _local9:Array = [_local7];
Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0);
Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1);
var _local10:int;
var _local11:int;
while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) {
_local12 = m_proxyPool[m_queryResults[_local11]];
_arg2[_local11] = _local12.userData;
_local11++;
_local10++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local10);
}
public function Validate():void{
var _local1:b2Pair;
var _local2:b2Proxy;
var _local3:b2Proxy;
var _local4:Boolean;
var _local6:b2Bound;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
var _local5:int;
while (_local5 < 2) {
_local6 = m_bounds[_local5];
_local7 = (2 * m_proxyCount);
_local8 = 0;
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local6[_local9];
if (_local10.IsLower() == true){
_local8++;
} else {
_local8--;
};
_local9++;
};
_local5++;
};
}
private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{
var _local4:Number = _arg3.minVertex.x;
var _local5:Number = _arg3.minVertex.y;
_local4 = b2Math.b2Min(_local4, m_worldAABB.maxVertex.x);
_local5 = b2Math.b2Min(_local5, m_worldAABB.maxVertex.y);
_local4 = b2Math.b2Max(_local4, m_worldAABB.minVertex.x);
_local5 = b2Math.b2Max(_local5, m_worldAABB.minVertex.y);
var _local6:Number = _arg3.maxVertex.x;
var _local7:Number = _arg3.maxVertex.y;
_local6 = b2Math.b2Min(_local6, m_worldAABB.maxVertex.x);
_local7 = b2Math.b2Min(_local7, m_worldAABB.maxVertex.y);
_local6 = b2Math.b2Max(_local6, m_worldAABB.minVertex.x);
_local7 = b2Math.b2Max(_local7, m_worldAABB.minVertex.y);
_arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.minVertex.x))) & (b2Settings.USHRT_MAX - 1));
_arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.minVertex.x))) & 0xFFFF) | 1);
_arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.minVertex.y))) & (b2Settings.USHRT_MAX - 1));
_arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.minVertex.y))) & 0xFFFF) | 1);
}
private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{
var _local4:Array;
var _local3:int;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
if (_local4[_arg1.lowerBounds[_local3]].value > _local4[_arg2.upperBounds[_local3]].value){
return (false);
};
if (_local4[_arg1.upperBounds[_local3]].value < _local4[_arg2.lowerBounds[_local3]].value){
return (false);
};
_local3++;
};
return (true);
}
public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{
var _local4:Array;
var _local3:int;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
if (_arg1.lowerValues[_local3] > _local4[_arg2.upperBounds[_local3]].value){
return (false);
};
if (_arg1.upperValues[_local3] < _local4[_arg2.lowerBounds[_local3]].value){
return (false);
};
_local3++;
};
return (true);
}
private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{
var _local11:int;
var _local12:int;
var _local13:b2Proxy;
var _local8:uint = BinarySearch(_arg5, _arg6, _arg3);
var _local9:uint = BinarySearch(_arg5, _arg6, _arg4);
var _local10:uint = _local8;
while (_local10 < _local9) {
if (_arg5[_local10].IsLower()){
IncrementOverlapCount(_arg5[_local10].proxyId);
};
_local10++;
};
if (_local8 > 0){
_local11 = (_local8 - 1);
_local12 = _arg5[_local11].stabbingCount;
while (_local12) {
if (_arg5[_local11].IsLower()){
_local13 = m_proxyPool[_arg5[_local11].proxyId];
if (_local8 <= _local13.upperBounds[_arg7]){
IncrementOverlapCount(_arg5[_local11].proxyId);
_local12--;
};
};
_local11--;
};
};
_arg1[0] = _local8;
_arg2[0] = _local9;
}
private function IncrementOverlapCount(_arg1:uint):void{
var _local2:b2Proxy = m_proxyPool[_arg1];
if (_local2.timeStamp < m_timeStamp){
_local2.timeStamp = m_timeStamp;
_local2.overlapCount = 1;
} else {
_local2.overlapCount = 2;
m_queryResults[m_queryResultCount] = _arg1;
m_queryResultCount++;
};
}
private function IncrementTimeStamp():void{
var _local1:uint;
if (m_timeStamp == b2Settings.USHRT_MAX){
_local1 = 0;
while (_local1 < b2Settings.b2_maxProxies) {
m_proxyPool[_local1].timeStamp = 0;
_local1++;
};
m_timeStamp = 1;
} else {
m_timeStamp++;
};
}
public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{
var _local6:int;
var _local4:int;
var _local5:int = (_arg2 - 1);
while (_local4 <= _local5) {
_local6 = ((_local4 + _local5) / 2);
if (_arg1[_local6].value > _arg3){
_local5 = (_local6 - 1);
} else {
if (_arg1[_local6].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 ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local7:b2Vec2;
var _local8:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local5:int;
var _local6:b2Vec2 = _arg2[0].v;
_local7 = _arg2[1].v;
_local8 = (b2Math.b2Dot(_arg3, _arg2[0].v) - _arg4);
var _local9:Number = (b2Math.b2Dot(_arg3, _arg2[1].v) - _arg4);
if (_local8 <= 0){
var _temp1 = _local5;
_local5 = (_local5 + 1);
var _local12 = _temp1;
_arg1[_local12] = _arg2[0];
};
if (_local9 <= 0){
var _temp2 = _local5;
_local5 = (_local5 + 1);
_local12 = _temp2;
_arg1[_local12] = _arg2[1];
};
if ((_local8 * _local9) < 0){
_local10 = (_local8 / (_local8 - _local9));
_local11 = _arg1[_local5].v;
_local11.x = (_local6.x + (_local10 * (_local7.x - _local6.x)));
_local11.y = (_local6.y + (_local10 * (_local7.y - _local6.y)));
if (_local8 > 0){
_arg1[_local5].id = _arg2[0].id;
} else {
_arg1[_local5].id = _arg2[1].id;
};
_local5++;
};
return (_local5);
}
public static function EdgeSeparation(_arg1:b2PolyShape, _arg2:int, _arg3:b2PolyShape):Number{
var _local21:b2Vec2;
var _local22:Number;
var _local4:Array = _arg1.m_vertices;
var _local5:int = _arg3.m_vertexCount;
var _local6:Array = _arg3.m_vertices;
var _local7:Number = _arg1.m_normals[_arg2].x;
var _local8:Number = _arg1.m_normals[_arg2].y;
var _local9:Number = _local7;
var _local10:b2Mat22 = _arg1.m_R;
_local7 = ((_local10.col1.x * _local9) + (_local10.col2.x * _local8));
_local8 = ((_local10.col1.y * _local9) + (_local10.col2.y * _local8));
var _local11:Number = _local7;
var _local12:Number = _local8;
_local10 = _arg3.m_R;
_local9 = ((_local11 * _local10.col1.x) + (_local12 * _local10.col1.y));
_local12 = ((_local11 * _local10.col2.x) + (_local12 * _local10.col2.y));
_local11 = _local9;
var _local13:int;
var _local14:Number = Number.MAX_VALUE;
var _local15:int;
while (_local15 < _local5) {
_local21 = _local6[_local15];
_local22 = ((_local21.x * _local11) + (_local21.y * _local12));
if (_local22 < _local14){
_local14 = _local22;
_local13 = _local15;
};
_local15++;
};
_local10 = _arg1.m_R;
var _local16:Number = (_arg1.m_position.x + ((_local10.col1.x * _local4[_arg2].x) + (_local10.col2.x * _local4[_arg2].y)));
var _local17:Number = (_arg1.m_position.y + ((_local10.col1.y * _local4[_arg2].x) + (_local10.col2.y * _local4[_arg2].y)));
_local10 = _arg3.m_R;
var _local18:Number = (_arg3.m_position.x + ((_local10.col1.x * _local6[_local13].x) + (_local10.col2.x * _local6[_local13].y)));
var _local19:Number = (_arg3.m_position.y + ((_local10.col1.y * _local6[_local13].x) + (_local10.col2.y * _local6[_local13].y)));
_local18 = (_local18 - _local16);
_local19 = (_local19 - _local17);
var _local20:Number = ((_local18 * _local7) + (_local19 * _local8));
return (_local20);
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolyShape, _arg3:b2PolyShape, _arg4:Boolean):Number{
var _local18:int;
var _local19:Number;
var _local20:int;
var _local21:Number;
var _local5:int = _arg2.m_vertexCount;
var _local6:Number = (_arg3.m_position.x - _arg2.m_position.x);
var _local7:Number = (_arg3.m_position.y - _arg2.m_position.y);
var _local8:Number = ((_local6 * _arg2.m_R.col1.x) + (_local7 * _arg2.m_R.col1.y));
var _local9:Number = ((_local6 * _arg2.m_R.col2.x) + (_local7 * _arg2.m_R.col2.y));
var _local10:int;
var _local11:Number = -(Number.MAX_VALUE);
var _local12:int;
while (_local12 < _local5) {
_local21 = ((_arg2.m_normals[_local12].x * _local8) + (_arg2.m_normals[_local12].y * _local9));
if (_local21 > _local11){
_local11 = _local21;
_local10 = _local12;
};
_local12++;
};
var _local13:Number = EdgeSeparation(_arg2, _local10, _arg3);
if ((((_local13 > 0)) && ((_arg4 == false)))){
return (_local13);
};
var _local14:int = (((_local10 - 1) >= 0)) ? (_local10 - 1) : (_local5 - 1);
var _local15:Number = EdgeSeparation(_arg2, _local14, _arg3);
if ((((_local15 > 0)) && ((_arg4 == false)))){
return (_local15);
};
var _local16:int = (((_local10 + 1) < _local5)) ? (_local10 + 1) : 0;
var _local17:Number = EdgeSeparation(_arg2, _local16, _arg3);
if ((((_local17 > 0)) && ((_arg4 == false)))){
return (_local17);
};
if ((((_local15 > _local13)) && ((_local15 > _local17)))){
_local20 = -1;
_local18 = _local14;
_local19 = _local15;
} else {
if (_local17 > _local13){
_local20 = 1;
_local18 = _local16;
_local19 = _local17;
} else {
_arg1[0] = _local10;
return (_local13);
};
};
while (true) {
if (_local20 == -1){
_local10 = (((_local18 - 1) >= 0)) ? (_local18 - 1) : (_local5 - 1);
} else {
_local10 = (((_local18 + 1) < _local5)) ? (_local18 + 1) : 0;
};
_local13 = EdgeSeparation(_arg2, _local10, _arg3);
if ((((_local13 > 0)) && ((_arg4 == false)))){
return (_local13);
};
if (_local13 > _local19){
_local18 = _local10;
_local19 = _local13;
} else {
break;
};
};
_arg1[0] = _local18;
return (_local19);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolyShape, _arg3:int, _arg4:b2PolyShape):void{
var _local21:int;
var _local22:int;
var _local25:ClipVertex;
var _local26:int;
var _local27:int;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local5:int = _arg2.m_vertexCount;
var _local6:Array = _arg2.m_vertices;
var _local7:int = _arg4.m_vertexCount;
var _local8:Array = _arg4.m_vertices;
var _local9:int = _arg3;
var _local10:int = (((_arg3 + 1) == _local5)) ? 0 : (_arg3 + 1);
var _local11:b2Vec2 = _local6[_local10];
var _local12:Number = _local11.x;
var _local13:Number = _local11.y;
_local11 = _local6[_local9];
_local12 = (_local12 - _local11.x);
_local13 = (_local13 - _local11.y);
var _local14:Number = _local12;
_local12 = _local13;
_local13 = -(_local14);
var _local15:Number = (1 / Math.sqrt(((_local12 * _local12) + (_local13 * _local13))));
_local12 = (_local12 * _local15);
_local13 = (_local13 * _local15);
var _local16:Number = _local12;
var _local17:Number = _local13;
_local14 = _local16;
var _local18:b2Mat22 = _arg2.m_R;
_local16 = ((_local18.col1.x * _local14) + (_local18.col2.x * _local17));
_local17 = ((_local18.col1.y * _local14) + (_local18.col2.y * _local17));
var _local19:Number = _local16;
var _local20:Number = _local17;
_local18 = _arg4.m_R;
_local14 = ((_local19 * _local18.col1.x) + (_local20 * _local18.col1.y));
_local20 = ((_local19 * _local18.col2.x) + (_local20 * _local18.col2.y));
_local19 = _local14;
var _local23:Number = Number.MAX_VALUE;
var _local24:int;
while (_local24 < _local7) {
_local26 = _local24;
_local27 = (((_local24 + 1) < _local7)) ? (_local24 + 1) : 0;
_local11 = _local8[_local27];
_local28 = _local11.x;
_local29 = _local11.y;
_local11 = _local8[_local26];
_local28 = (_local28 - _local11.x);
_local29 = (_local29 - _local11.y);
_local14 = _local28;
_local28 = _local29;
_local29 = -(_local14);
_local15 = (1 / Math.sqrt(((_local28 * _local28) + (_local29 * _local29))));
_local28 = (_local28 * _local15);
_local29 = (_local29 * _local15);
_local30 = ((_local28 * _local19) + (_local29 * _local20));
if (_local30 < _local23){
_local23 = _local30;
_local21 = _local26;
_local22 = _local27;
};
_local24++;
};
_local25 = _arg1[0];
_local11 = _local25.v;
_local11.SetV(_local8[_local21]);
_local11.MulM(_arg4.m_R);
_local11.Add(_arg4.m_position);
_local25.id.features.referenceFace = _arg3;
_local25.id.features.incidentEdge = _local21;
_local25.id.features.incidentVertex = _local21;
_local25 = _arg1[1];
_local11 = _local25.v;
_local11.SetV(_local8[_local22]);
_local11.MulM(_arg4.m_R);
_local11.Add(_arg4.m_position);
_local25.id.features.referenceFace = _arg3;
_local25.id.features.incidentEdge = _local21;
_local25.id.features.incidentVertex = _local22;
}
public static function b2CollidePoly(_arg1:b2Manifold, _arg2:b2PolyShape, _arg3:b2PolyShape, _arg4:Boolean):void{
var _local11:b2PolyShape;
var _local12:b2PolyShape;
var _local13:int;
var _local14:int;
var _local40:int;
var _local43:b2Vec2;
var _local44:Number;
var _local45:b2ContactPoint;
_arg1.pointCount = 0;
var _local5:int;
var _local6:Array = [_local5];
var _local7:Number = FindMaxSeparation(_local6, _arg2, _arg3, _arg4);
_local5 = _local6[0];
if ((((_local7 > 0)) && ((_arg4 == false)))){
return;
};
var _local8:int;
var _local9:Array = [_local8];
var _local10:Number = FindMaxSeparation(_local9, _arg3, _arg2, _arg4);
_local8 = _local9[0];
if ((((_local10 > 0)) && ((_arg4 == false)))){
return;
};
var _local15:Number = 0.98;
var _local16:Number = 0.001;
if (_local10 > ((_local15 * _local7) + _local16)){
_local11 = _arg3;
_local12 = _arg2;
_local13 = _local8;
_local14 = 1;
} else {
_local11 = _arg2;
_local12 = _arg3;
_local13 = _local5;
_local14 = 0;
};
var _local17:Array = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local17, _local11, _local13, _local12);
var _local18:int = _local11.m_vertexCount;
var _local19:Array = _local11.m_vertices;
var _local20:b2Vec2 = _local19[_local13];
var _local21:b2Vec2 = (((_local13 + 1) < _local18)) ? _local19[(_local13 + 1)] : _local19[0];
var _local22:Number = (_local21.x - _local20.x);
var _local23:Number = (_local21.y - _local20.y);
var _local24:Number = (_local21.x - _local20.x);
var _local25:Number = (_local21.y - _local20.y);
var _local26:Number = _local24;
var _local27:b2Mat22 = _local11.m_R;
_local24 = ((_local27.col1.x * _local26) + (_local27.col2.x * _local25));
_local25 = ((_local27.col1.y * _local26) + (_local27.col2.y * _local25));
var _local28:Number = (1 / Math.sqrt(((_local24 * _local24) + (_local25 * _local25))));
_local24 = (_local24 * _local28);
_local25 = (_local25 * _local28);
var _local29:Number = _local24;
var _local30:Number = _local25;
_local26 = _local29;
_local29 = _local30;
_local30 = -(_local26);
var _local31:Number = _local20.x;
var _local32:Number = _local20.y;
_local26 = _local31;
_local27 = _local11.m_R;
_local31 = ((_local27.col1.x * _local26) + (_local27.col2.x * _local32));
_local32 = ((_local27.col1.y * _local26) + (_local27.col2.y * _local32));
_local31 = (_local31 + _local11.m_position.x);
_local32 = (_local32 + _local11.m_position.y);
var _local33:Number = _local21.x;
var _local34:Number = _local21.y;
_local26 = _local33;
_local27 = _local11.m_R;
_local33 = ((_local27.col1.x * _local26) + (_local27.col2.x * _local34));
_local34 = ((_local27.col1.y * _local26) + (_local27.col2.y * _local34));
_local33 = (_local33 + _local11.m_position.x);
_local34 = (_local34 + _local11.m_position.y);
var _local35:Number = ((_local29 * _local31) + (_local30 * _local32));
var _local36:Number = -(((_local24 * _local31) + (_local25 * _local32)));
var _local37:Number = ((_local24 * _local33) + (_local25 * _local34));
var _local38:Array = [new ClipVertex(), new ClipVertex()];
var _local39:Array = [new ClipVertex(), new ClipVertex()];
b2CollidePolyTempVec.Set(-(_local24), -(_local25));
_local40 = ClipSegmentToLine(_local38, _local17, b2CollidePolyTempVec, _local36);
if (_local40 < 2){
return;
};
b2CollidePolyTempVec.Set(_local24, _local25);
_local40 = ClipSegmentToLine(_local39, _local38, b2CollidePolyTempVec, _local37);
if (_local40 < 2){
return;
};
if (_local14){
_arg1.normal.Set(-(_local29), -(_local30));
} else {
_arg1.normal.Set(_local29, _local30);
};
var _local41:int;
var _local42:int;
while (_local42 < b2Settings.b2_maxManifoldPoints) {
_local43 = _local39[_local42].v;
_local44 = (((_local29 * _local43.x) + (_local30 * _local43.y)) - _local35);
if ((((_local44 <= 0)) || ((_arg4 == true)))){
_local45 = _arg1.points[_local41];
_local45.separation = _local44;
_local45.position.SetV(_local39[_local42].v);
_local45.id.Set(_local39[_local42].id);
_local45.id.features.flip = _local14;
_local41++;
};
_local42++;
};
_arg1.pointCount = _local41;
}
public static function b2CollideCircle(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2CircleShape, _arg4:Boolean):void{
var _local9:Number;
var _local11:Number;
var _local12:Number;
_arg1.pointCount = 0;
var _local5:Number = (_arg3.m_position.x - _arg2.m_position.x);
var _local6:Number = (_arg3.m_position.y - _arg2.m_position.y);
var _local7:Number = ((_local5 * _local5) + (_local6 * _local6));
var _local8:Number = (_arg2.m_radius + _arg3.m_radius);
if ((((_local7 > (_local8 * _local8))) && ((_arg4 == false)))){
return;
};
if (_local7 < Number.MIN_VALUE){
_local9 = -(_local8);
_arg1.normal.Set(0, 1);
} else {
_local11 = Math.sqrt(_local7);
_local9 = (_local11 - _local8);
_local12 = (1 / _local11);
_arg1.normal.x = (_local12 * _local5);
_arg1.normal.y = (_local12 * _local6);
};
_arg1.pointCount = 1;
var _local10:b2ContactPoint = _arg1.points[0];
_local10.id.key = 0;
_local10.separation = _local9;
_local10.position.x = (_arg3.m_position.x - (_arg3.m_radius * _arg1.normal.x));
_local10.position.y = (_arg3.m_position.y - (_arg3.m_radius * _arg1.normal.y));
}
public static function b2CollidePolyAndCircle(_arg1:b2Manifold, _arg2:b2PolyShape, _arg3:b2CircleShape, _arg4:Boolean):void{
var _local5:b2ContactPoint;
var _local6:Number;
var _local7:Number;
var _local12:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:b2Vec2;
_arg1.pointCount = 0;
var _local8:Number = (_arg3.m_position.x - _arg2.m_position.x);
var _local9:Number = (_arg3.m_position.y - _arg2.m_position.y);
var _local10:b2Mat22 = _arg2.m_R;
var _local11:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local9 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local8 = _local11;
var _local13:int;
var _local14:Number = -(Number.MAX_VALUE);
var _local15:Number = _arg3.m_radius;
var _local16:int;
while (_local16 < _arg2.m_vertexCount) {
_local25 = ((_arg2.m_normals[_local16].x * (_local8 - _arg2.m_vertices[_local16].x)) + (_arg2.m_normals[_local16].y * (_local9 - _arg2.m_vertices[_local16].y)));
if (_local25 > _local15){
return;
};
if (_local25 > _local14){
_local14 = _local25;
_local13 = _local16;
};
_local16++;
};
if (_local14 < Number.MIN_VALUE){
_arg1.pointCount = 1;
_local26 = _arg2.m_normals[_local13];
_arg1.normal.x = ((_local10.col1.x * _local26.x) + (_local10.col2.x * _local26.y));
_arg1.normal.y = ((_local10.col1.y * _local26.x) + (_local10.col2.y * _local26.y));
_local5 = _arg1.points[0];
_local5.id.features.incidentEdge = _local13;
_local5.id.features.incidentVertex = b2_nullFeature;
_local5.id.features.referenceFace = b2_nullFeature;
_local5.id.features.flip = 0;
_local5.position.x = (_arg3.m_position.x - (_local15 * _arg1.normal.x));
_local5.position.y = (_arg3.m_position.y - (_local15 * _arg1.normal.y));
_local5.separation = (_local14 - _local15);
return;
};
var _local17:int = _local13;
var _local18:int = (((_local17 + 1) < _arg2.m_vertexCount)) ? (_local17 + 1) : 0;
var _local19:Number = (_arg2.m_vertices[_local18].x - _arg2.m_vertices[_local17].x);
var _local20:Number = (_arg2.m_vertices[_local18].y - _arg2.m_vertices[_local17].y);
var _local21:Number = Math.sqrt(((_local19 * _local19) + (_local20 * _local20)));
_local19 = (_local19 / _local21);
_local20 = (_local20 / _local21);
if (_local21 < Number.MIN_VALUE){
_local6 = (_local8 - _arg2.m_vertices[_local17].x);
_local7 = (_local9 - _arg2.m_vertices[_local17].y);
_local12 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
_local6 = (_local6 / _local12);
_local7 = (_local7 / _local12);
if (_local12 > _local15){
return;
};
_arg1.pointCount = 1;
_arg1.normal.Set(((_local10.col1.x * _local6) + (_local10.col2.x * _local7)), ((_local10.col1.y * _local6) + (_local10.col2.y * _local7)));
_local5 = _arg1.points[0];
_local5.id.features.incidentEdge = b2_nullFeature;
_local5.id.features.incidentVertex = _local17;
_local5.id.features.referenceFace = b2_nullFeature;
_local5.id.features.flip = 0;
_local5.position.x = (_arg3.m_position.x - (_local15 * _arg1.normal.x));
_local5.position.y = (_arg3.m_position.y - (_local15 * _arg1.normal.y));
_local5.separation = (_local12 - _local15);
return;
};
var _local22:Number = (((_local8 - _arg2.m_vertices[_local17].x) * _local19) + ((_local9 - _arg2.m_vertices[_local17].y) * _local20));
_local5 = _arg1.points[0];
_local5.id.features.incidentEdge = b2_nullFeature;
_local5.id.features.incidentVertex = b2_nullFeature;
_local5.id.features.referenceFace = b2_nullFeature;
_local5.id.features.flip = 0;
if (_local22 <= 0){
_local23 = _arg2.m_vertices[_local17].x;
_local24 = _arg2.m_vertices[_local17].y;
_local5.id.features.incidentVertex = _local17;
} else {
if (_local22 >= _local21){
_local23 = _arg2.m_vertices[_local18].x;
_local24 = _arg2.m_vertices[_local18].y;
_local5.id.features.incidentVertex = _local18;
} else {
_local23 = ((_local19 * _local22) + _arg2.m_vertices[_local17].x);
_local24 = ((_local20 * _local22) + _arg2.m_vertices[_local17].y);
_local5.id.features.incidentEdge = _local17;
};
};
_local6 = (_local8 - _local23);
_local7 = (_local9 - _local24);
_local12 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
_local6 = (_local6 / _local12);
_local7 = (_local7 / _local12);
if (_local12 > _local15){
return;
};
_arg1.pointCount = 1;
_arg1.normal.Set(((_local10.col1.x * _local6) + (_local10.col2.x * _local7)), ((_local10.col1.y * _local6) + (_local10.col2.y * _local7)));
_local5.position.x = (_arg3.m_position.x - (_local15 * _arg1.normal.x));
_local5.position.y = (_arg3.m_position.y - (_local15 * _arg1.normal.y));
_local5.separation = (_local12 - _local15);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2 = _arg2.minVertex;
var _local4:b2Vec2 = _arg1.maxVertex;
var _local5:Number = (_local3.x - _local4.x);
var _local6:Number = (_local3.y - _local4.y);
_local3 = _arg1.minVertex;
_local4 = _arg2.maxVertex;
var _local7:Number = (_local3.x - _local4.x);
var _local8:Number = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
}
}//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID)
package Box2D.Collision {
public class b2ContactID {
public var features:Features;
public var _key:uint;
public function b2ContactID(){
features = new Features();
super();
features._m_id = this;
}
public function Set(_arg1:b2ContactID):void{
key = _arg1._key;
}
public function Copy():b2ContactID{
var _local1:b2ContactID = new b2ContactID();
_local1.key = key;
return (_local1);
}
public function get key():uint{
return (_key);
}
public function set key(_arg1:uint):void{
_key = _arg1;
features._referenceFace = (_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.*;
public class b2ContactPoint {
public var position:b2Vec2;
public var separation:Number;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ContactPoint(){
position = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 17
//b2Manifold (Box2D.Collision.b2Manifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Manifold {
public var points:Array;
public var normal:b2Vec2;
public var pointCount:int;
public function b2Manifold(){
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactPoint();
_local1++;
};
normal = new b2Vec2();
}
}
}//package Box2D.Collision
Section 18
//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 19
//b2Pair (Box2D.Collision.b2Pair)
package Box2D.Collision {
public class b2Pair {
public var userData;// = null
public var proxyId1:uint;
public var proxyId2:uint;
public var next:uint;
public var status:uint;
public static var b2_nullPair:uint = 0xFFFF;
public static var b2_nullProxy:uint = 0xFFFF;
public static var b2_tableCapacity:int = 8192;
public static var b2_tableMask:int = (b2_tableCapacity - 1);
public static var e_pairBuffered:uint = 1;
public static var e_pairRemoved:uint = 2;
public static var e_pairFinal:uint = 4;
public function SetBuffered():void{
status = (status | e_pairBuffered);
}
public function ClearBuffered():void{
status = (status & ~(e_pairBuffered));
}
public function IsBuffered():Boolean{
return (((status & e_pairBuffered) == e_pairBuffered));
}
public function SetRemoved():void{
status = (status | e_pairRemoved);
}
public function ClearRemoved():void{
status = (status & ~(e_pairRemoved));
}
public function IsRemoved():Boolean{
return (((status & e_pairRemoved) == e_pairRemoved));
}
public function SetFinal():void{
status = (status | e_pairFinal);
}
public function IsFinal():Boolean{
return (((status & e_pairFinal) == e_pairFinal));
}
}
}//package Box2D.Collision
Section 20
//b2PairCallback (Box2D.Collision.b2PairCallback)
package Box2D.Collision {
public class b2PairCallback {
public function PairAdded(_arg1, _arg2){
return (null);
}
public function PairRemoved(_arg1, _arg2, _arg3):void{
}
}
}//package Box2D.Collision
Section 21
//b2PairManager (Box2D.Collision.b2PairManager)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PairManager {
public var m_broadPhase:b2BroadPhase;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_freePair:uint;
public var m_pairCount:int;
public var m_pairBuffer:Array;
public var m_pairBufferCount:int;
public var m_hashTable:Array;
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[(b2Settings.b2_maxPairs - 1)].next = b2Pair.b2_nullPair;
m_pairCount = 0;
}
public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{
m_broadPhase = _arg1;
m_callback = _arg2;
}
public function AddBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2Pair = AddPair(_arg1, _arg2);
if (_local3.IsBuffered() == false){
_local3.SetBuffered();
m_pairBuffer[m_pairBufferCount].proxyId1 = _local3.proxyId1;
m_pairBuffer[m_pairBufferCount].proxyId2 = _local3.proxyId2;
m_pairBufferCount++;
};
_local3.ClearRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2Pair = Find(_arg1, _arg2);
if (_local3 == null){
return;
};
if (_local3.IsBuffered() == false){
_local3.SetBuffered();
m_pairBuffer[m_pairBufferCount].proxyId1 = _local3.proxyId1;
m_pairBuffer[m_pairBufferCount].proxyId2 = _local3.proxyId2;
m_pairBufferCount++;
};
_local3.SetRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
public function Commit():void{
var _local1:int;
var _local4:b2Pair;
var _local5:b2Proxy;
var _local6:b2Proxy;
var _local2:int;
var _local3:Array = m_broadPhase.m_proxyPool;
_local1 = 0;
while (_local1 < m_pairBufferCount) {
_local4 = Find(m_pairBuffer[_local1].proxyId1, m_pairBuffer[_local1].proxyId2);
_local4.ClearBuffered();
_local5 = _local3[_local4.proxyId1];
_local6 = _local3[_local4.proxyId2];
if (_local4.IsRemoved()){
if (_local4.IsFinal() == true){
m_callback.PairRemoved(_local5.userData, _local6.userData, _local4.userData);
};
m_pairBuffer[_local2].proxyId1 = _local4.proxyId1;
m_pairBuffer[_local2].proxyId2 = _local4.proxyId2;
_local2++;
} else {
if (_local4.IsFinal() == false){
_local4.userData = m_callback.PairAdded(_local5.userData, _local6.userData);
_local4.SetFinal();
};
};
_local1++;
};
_local1 = 0;
while (_local1 < _local2) {
RemovePair(m_pairBuffer[_local1].proxyId1, m_pairBuffer[_local1].proxyId2);
_local1++;
};
m_pairBufferCount = 0;
if (b2BroadPhase.s_validate){
ValidateTable();
};
}
private function AddPair(_arg1:uint, _arg2:uint):b2Pair{
var _local6:uint;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local4 = FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
var _local5:uint = m_freePair;
_local4 = m_pairs[_local5];
m_freePair = _local4.next;
_local4.proxyId1 = _arg1;
_local4.proxyId2 = _arg2;
_local4.status = 0;
_local4.userData = null;
_local4.next = m_hashTable[_local3];
m_hashTable[_local3] = _local5;
m_pairCount++;
return (_local4);
}
private function RemovePair(_arg1:uint, _arg2:uint){
var _local6:uint;
var _local7:uint;
var _local8:b2Pair;
var _local9:*;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local4:uint = m_hashTable[_local3];
var _local5:b2Pair;
while (_local4 != b2Pair.b2_nullPair) {
if (Equals(m_pairs[_local4], _arg1, _arg2)){
_local7 = _local4;
if (_local5){
_local5.next = m_pairs[_local4].next;
} else {
m_hashTable[_local3] = m_pairs[_local4].next;
};
_local8 = m_pairs[_local7];
_local9 = _local8.userData;
_local8.next = m_freePair;
_local8.proxyId1 = b2Pair.b2_nullProxy;
_local8.proxyId2 = b2Pair.b2_nullProxy;
_local8.userData = null;
_local8.status = 0;
m_freePair = _local7;
m_pairCount--;
return (_local9);
} else {
_local5 = m_pairs[_local4];
_local4 = _local5.next;
};
};
return (null);
}
private function Find(_arg1:uint, _arg2:uint):b2Pair{
var _local4:uint;
if (_arg1 > _arg2){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
return (FindHash(_arg1, _arg2, _local3));
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:uint = m_hashTable[_arg3];
while (((!((_local4 == b2Pair.b2_nullPair))) && ((Equals(m_pairs[_local4], _arg1, _arg2) == false)))) {
_local4 = m_pairs[_local4].next;
};
if (_local4 == b2Pair.b2_nullPair){
return (null);
};
return (m_pairs[_local4]);
}
private function ValidateBuffer():void{
}
private function ValidateTable():void{
}
public static function Hash(_arg1:uint, _arg2:uint):uint{
var _local3:uint = (((_arg2 << 16) & 4294901760) | _arg1);
_local3 = (~(_local3) + ((_local3 << 15) & 4294934528));
_local3 = (_local3 ^ ((_local3 >> 12) & 1048575));
_local3 = (_local3 + ((_local3 << 2) & 4294967292));
_local3 = (_local3 ^ ((_local3 >> 4) & 268435455));
_local3 = (_local3 * 2057);
_local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF));
return (_local3);
}
public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{
return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3))));
}
public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{
return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2))));
}
}
}//package Box2D.Collision
Section 22
//b2Proxy (Box2D.Collision.b2Proxy)
package Box2D.Collision {
public class b2Proxy {
public var lowerBounds:Array;
public var upperBounds:Array;
public var overlapCount:uint;
public var timeStamp:uint;
public var userData;// = null
public function b2Proxy(){
lowerBounds = [uint(0), uint(0)];
upperBounds = [uint(0), uint(0)];
super();
}
public function GetNext():uint{
return (lowerBounds[0]);
}
public function SetNext(_arg1:uint):void{
lowerBounds[0] = (_arg1 & 0xFFFF);
}
public function IsValid():Boolean{
return (!((overlapCount == b2BroadPhase.b2_invalid)));
}
}
}//package Box2D.Collision
Section 23
//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 24
//Features (Box2D.Collision.Features)
package Box2D.Collision {
public class Features {
public var _referenceFace:int;
public var _incidentEdge:int;
public var _incidentVertex:int;
public var _flip:int;
public var _m_id:b2ContactID;
public function set referenceFace(_arg1:int):void{
_referenceFace = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceFace & 0xFF));
}
public function get referenceFace():int{
return (_referenceFace);
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function get flip():int{
return (_flip);
}
}
}//package Box2D.Collision
Section 25
//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 Set(_arg1:Number):void{
var _local2:Number;
_local2 = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
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 SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local4:Number;
var _local6:Number;
_local2 = col1.x;
var _local3:Number = col2.x;
_local4 = col1.y;
var _local5:Number = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
_local6 = (1 / _local6);
_arg1.col1.x = (_local6 * _local5);
_arg1.col2.x = (-(_local6) * _local3);
_arg1.col1.y = (-(_local6) * _local4);
_arg1.col2.y = (_local6 * _local2);
return (_arg1);
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number = col1.x;
var _local5:Number = col2.x;
var _local6:Number = col1.y;
var _local7:Number = col2.y;
var _local8:Number = ((_local4 * _local7) - (_local5 * _local6));
_local8 = (1 / _local8);
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
}
}//package Box2D.Common.Math
Section 26
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
var _local4:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
var _local5:b2Mat22 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:* = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
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 b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
}
}//package Box2D.Common.Math
Section 27
//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 SetZero():void{
x = 0;
y = 0;
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function CrossVF(_arg1:Number):void{
var _local2:Number = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.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 Abs():void{
x = Math.abs(x);
y = Math.abs(y);
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function Normalize():Number{
var _local1:Number = Length();
if (_local1 < Number.MIN_VALUE){
return (0);
};
var _local2:Number = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 28
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_massUnitsPerKilogram:Number = 1;
public static const b2_timeUnitsPerSecond:Number = 1;
public static const b2_lengthUnitsPerMeter:Number = 30;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_maxShapesPerBody:int = 64;
public static const b2_maxPolyVertices:int = 8;
public static const b2_maxProxies:int = 0x0400;
public static const b2_maxPairs:int = 8192;
public static const b2_linearSlop:Number = 0.15;
public static const b2_angularSlop:Number = 0.0349065850398866;
public static const b2_velocityThreshold:Number = 30;
public static const b2_maxLinearCorrection:Number = 6;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_linearSleepTolerance:Number = 0.3;
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static function b2Assert(_arg1:Boolean):void{
var _local2:b2Vec2;
if (!_arg1){
_local2.x++;
};
}
}
}//package Box2D.Common
Section 29
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2CircleContact extends b2Contact {
public var m_manifold:Array;
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifold = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold[0].pointCount = 0;
m_manifold[0].points[0].normalImpulse = 0;
m_manifold[0].points[0].tangentImpulse = 0;
}
override public function Evaluate():void{
b2Collision.b2CollideCircle(m_manifold[0], (m_shape1 as b2CircleShape), (m_shape2 as b2CircleShape), false);
if (m_manifold[0].pointCount > 0){
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
}
override public function GetManifolds():Array{
return (m_manifold);
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2CircleContact(_arg1, _arg2));
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 30
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2Contact {
public var m_flags:uint;
public var m_prev:b2Contact;
public var m_next:b2Contact;
public var m_node1:b2ContactNode;
public var m_node2:b2ContactNode;
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_manifoldCount:int;
public var m_friction:Number;
public var m_restitution:Number;
public static var e_islandFlag:uint = 1;
public static var e_destroyFlag:uint = 2;
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 b2ContactNode();
m_node2 = new b2ContactNode();
super();
m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
m_shape1 = null;
m_shape2 = null;
return;
};
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 GetManifolds():Array{
return (null);
}
public function GetManifoldCount():int{
return (m_manifoldCount);
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetShape1():b2Shape{
return (m_shape1);
}
public function GetShape2():b2Shape{
return (m_shape2);
}
public function Evaluate():void{
}
public static function AddType(_arg1, _arg2, _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 InitializeRegisters():void{
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
var _local1:int;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_registers[_local1][_local2] = new b2ContactRegister();
_local2++;
};
_local1++;
};
AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape);
AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polyShape, b2Shape.e_circleShape);
AddType(b2PolyContact.Create, b2PolyContact.Destroy, b2Shape.e_polyShape, b2Shape.e_polyShape);
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local7:b2Contact;
var _local8:int;
var _local9:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
var _local4:int = _arg1.m_type;
var _local5:int = _arg2.m_type;
var _local6:* = s_registers[_local4][_local5].createFcn;
if (_local6){
if (s_registers[_local4][_local5].primary){
return (_local6(_arg1, _arg2, _arg3));
};
_local7 = _local6(_arg2, _arg1, _arg3);
_local8 = 0;
while (_local8 < _local7.GetManifoldCount()) {
_local9 = _local7.GetManifolds()[_local8];
_local7.GetManifolds()[_local8].normal = _local9.normal.Negative();
_local8++;
};
return (_local7);
//unresolved jump
};
return (null);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
if (_arg1.GetManifoldCount() > 0){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
var _local3:int = _arg1.m_shape1.m_type;
var _local4:int = _arg1.m_shape2.m_type;
var _local5:* = s_registers[_local3][_local4].destroyFcn;
_local5(_arg1, _arg2);
}
}
}//package Box2D.Dynamics.Contacts
Section 31
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var normal:b2Vec2;
public var manifold:b2Manifold;
public var body1:b2Body;
public var body2:b2Body;
public var friction:Number;
public var restitution:Number;
public var pointCount:int;
public function b2ContactConstraint(){
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 32
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var positionImpulse:Number;
public var normalMass:Number;
public var tangentMass:Number;
public var separation:Number;
public var velocityBias:Number;
public function b2ContactConstraintPoint(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 33
//b2ContactNode (Box2D.Dynamics.Contacts.b2ContactNode)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2ContactNode {
public var other:b2Body;
public var contact:b2Contact;
public var prev:b2ContactNode;
public var next:b2ContactNode;
}
}//package Box2D.Dynamics.Contacts
Section 34
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var createFcn;
public var destroyFcn;
public var primary:Boolean;
}
}//package Box2D.Dynamics.Contacts
Section 35
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactSolver {
public var m_allocator;
public var m_constraints:Array;
public var m_constraintCount:int;
public function b2ContactSolver(_arg1:Array, _arg2:int, _arg3){
var _local4:int;
var _local5:b2Vec2;
var _local6:b2Mat22;
var _local8:b2Contact;
var _local9:b2Body;
var _local10:b2Body;
var _local11:int;
var _local12:Array;
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:int;
var _local22:b2Manifold;
var _local23:Number;
var _local24:Number;
var _local25:b2ContactConstraint;
var _local26:uint;
var _local27:b2ContactPoint;
var _local28:b2ContactConstraintPoint;
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;
var _local42:Number;
var _local43:Number;
var _local44:Number;
var _local45:Number;
m_constraints = new Array();
super();
m_allocator = _arg3;
m_constraintCount = 0;
_local4 = 0;
while (_local4 < _arg2) {
m_constraintCount = (m_constraintCount + _arg1[_local4].GetManifoldCount());
_local4++;
};
_local4 = 0;
while (_local4 < m_constraintCount) {
m_constraints[_local4] = new b2ContactConstraint();
_local4++;
};
var _local7:int;
_local4 = 0;
while (_local4 < _arg2) {
_local8 = _arg1[_local4];
_local9 = _local8.m_shape1.m_body;
_local10 = _local8.m_shape2.m_body;
_local11 = _local8.GetManifoldCount();
_local12 = _local8.GetManifolds();
_local13 = _local8.m_friction;
_local14 = _local8.m_restitution;
_local15 = _local9.m_linearVelocity.x;
_local16 = _local9.m_linearVelocity.y;
_local17 = _local10.m_linearVelocity.x;
_local18 = _local10.m_linearVelocity.y;
_local19 = _local9.m_angularVelocity;
_local20 = _local10.m_angularVelocity;
_local21 = 0;
while (_local21 < _local11) {
_local22 = _local12[_local21];
_local23 = _local22.normal.x;
_local24 = _local22.normal.y;
_local25 = m_constraints[_local7];
_local25.body1 = _local9;
_local25.body2 = _local10;
_local25.manifold = _local22;
_local25.normal.x = _local23;
_local25.normal.y = _local24;
_local25.pointCount = _local22.pointCount;
_local25.friction = _local13;
_local25.restitution = _local14;
_local26 = 0;
while (_local26 < _local25.pointCount) {
_local27 = _local22.points[_local26];
_local28 = _local25.points[_local26];
_local28.normalImpulse = _local27.normalImpulse;
_local28.tangentImpulse = _local27.tangentImpulse;
_local28.separation = _local27.separation;
_local29 = (_local27.position.x - _local9.m_position.x);
_local30 = (_local27.position.y - _local9.m_position.y);
_local31 = (_local27.position.x - _local10.m_position.x);
_local32 = (_local27.position.y - _local10.m_position.y);
_local5 = _local28.localAnchor1;
_local6 = _local9.m_R;
_local5.x = ((_local29 * _local6.col1.x) + (_local30 * _local6.col1.y));
_local5.y = ((_local29 * _local6.col2.x) + (_local30 * _local6.col2.y));
_local5 = _local28.localAnchor2;
_local6 = _local10.m_R;
_local5.x = ((_local31 * _local6.col1.x) + (_local32 * _local6.col1.y));
_local5.y = ((_local31 * _local6.col2.x) + (_local32 * _local6.col2.y));
_local33 = ((_local29 * _local29) + (_local30 * _local30));
_local34 = ((_local31 * _local31) + (_local32 * _local32));
_local35 = ((_local29 * _local23) + (_local30 * _local24));
_local36 = ((_local31 * _local23) + (_local32 * _local24));
_local37 = (_local9.m_invMass + _local10.m_invMass);
_local37 = (_local37 + ((_local9.m_invI * (_local33 - (_local35 * _local35))) + (_local10.m_invI * (_local34 - (_local36 * _local36)))));
_local28.normalMass = (1 / _local37);
_local38 = _local24;
_local39 = -(_local23);
_local40 = ((_local29 * _local38) + (_local30 * _local39));
_local41 = ((_local31 * _local38) + (_local32 * _local39));
_local42 = (_local9.m_invMass + _local10.m_invMass);
_local42 = (_local42 + ((_local9.m_invI * (_local33 - (_local40 * _local40))) + (_local10.m_invI * (_local34 - (_local41 * _local41)))));
_local28.tangentMass = (1 / _local42);
_local28.velocityBias = 0;
if (_local28.separation > 0){
_local28.velocityBias = (-60 * _local28.separation);
};
_local43 = (((_local17 + (-(_local20) * _local32)) - _local15) - (-(_local19) * _local30));
_local44 = (((_local18 + (_local20 * _local31)) - _local16) - (_local19 * _local29));
_local45 = ((_local25.normal.x * _local43) + (_local25.normal.y * _local44));
if (_local45 < -(b2Settings.b2_velocityThreshold)){
_local28.velocityBias = (_local28.velocityBias + (-(_local25.restitution) * _local45));
};
_local26++;
};
_local7++;
_local21++;
};
_local4++;
};
}
public function PreSolve():void{
var _local1:b2Vec2;
var _local2:b2Vec2;
var _local3:b2Mat22;
var _local5:b2ContactConstraint;
var _local6:b2Body;
var _local7:b2Body;
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:int;
var _local17:int;
var _local18:b2ContactConstraintPoint;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:b2ContactConstraintPoint;
var _local4:int;
while (_local4 < m_constraintCount) {
_local5 = m_constraints[_local4];
_local6 = _local5.body1;
_local7 = _local5.body2;
_local8 = _local6.m_invMass;
_local9 = _local6.m_invI;
_local10 = _local7.m_invMass;
_local11 = _local7.m_invI;
_local12 = _local5.normal.x;
_local13 = _local5.normal.y;
_local14 = _local13;
_local15 = -(_local12);
if (b2World.s_enableWarmStarting){
_local17 = _local5.pointCount;
_local16 = 0;
while (_local16 < _local17) {
_local18 = _local5.points[_local16];
_local19 = ((_local18.normalImpulse * _local12) + (_local18.tangentImpulse * _local14));
_local20 = ((_local18.normalImpulse * _local13) + (_local18.tangentImpulse * _local15));
_local3 = _local6.m_R;
_local1 = _local18.localAnchor1;
_local21 = ((_local3.col1.x * _local1.x) + (_local3.col2.x * _local1.y));
_local22 = ((_local3.col1.y * _local1.x) + (_local3.col2.y * _local1.y));
_local3 = _local7.m_R;
_local1 = _local18.localAnchor2;
_local23 = ((_local3.col1.x * _local1.x) + (_local3.col2.x * _local1.y));
_local24 = ((_local3.col1.y * _local1.x) + (_local3.col2.y * _local1.y));
_local6.m_angularVelocity = (_local6.m_angularVelocity - (_local9 * ((_local21 * _local20) - (_local22 * _local19))));
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x - (_local8 * _local19));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y - (_local8 * _local20));
_local7.m_angularVelocity = (_local7.m_angularVelocity + (_local11 * ((_local23 * _local20) - (_local24 * _local19))));
_local7.m_linearVelocity.x = (_local7.m_linearVelocity.x + (_local10 * _local19));
_local7.m_linearVelocity.y = (_local7.m_linearVelocity.y + (_local10 * _local20));
_local18.positionImpulse = 0;
_local16++;
};
} else {
_local17 = _local5.pointCount;
_local16 = 0;
while (_local16 < _local17) {
_local25 = _local5.points[_local16];
_local25.normalImpulse = 0;
_local25.tangentImpulse = 0;
_local25.positionImpulse = 0;
_local16++;
};
};
_local4++;
};
}
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:b2Mat22;
var _local14:b2Vec2;
var _local16:b2ContactConstraint;
var _local17:b2Body;
var _local18:b2Body;
var _local19:Number;
var _local20:b2Vec2;
var _local21:Number;
var _local22:b2Vec2;
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:int;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local15:int;
while (_local15 < m_constraintCount) {
_local16 = m_constraints[_local15];
_local17 = _local16.body1;
_local18 = _local16.body2;
_local19 = _local17.m_angularVelocity;
_local20 = _local17.m_linearVelocity;
_local21 = _local18.m_angularVelocity;
_local22 = _local18.m_linearVelocity;
_local23 = _local17.m_invMass;
_local24 = _local17.m_invI;
_local25 = _local18.m_invMass;
_local26 = _local18.m_invI;
_local27 = _local16.normal.x;
_local28 = _local16.normal.y;
_local29 = _local28;
_local30 = -(_local27);
_local31 = _local16.pointCount;
_local1 = 0;
while (_local1 < _local31) {
_local2 = _local16.points[_local1];
_local13 = _local17.m_R;
_local14 = _local2.localAnchor1;
_local3 = ((_local13.col1.x * _local14.x) + (_local13.col2.x * _local14.y));
_local4 = ((_local13.col1.y * _local14.x) + (_local13.col2.y * _local14.y));
_local13 = _local18.m_R;
_local14 = _local2.localAnchor2;
_local5 = ((_local13.col1.x * _local14.x) + (_local13.col2.x * _local14.y));
_local6 = ((_local13.col1.y * _local14.x) + (_local13.col2.y * _local14.y));
_local7 = (((_local22.x + (-(_local21) * _local6)) - _local20.x) - (-(_local19) * _local4));
_local8 = (((_local22.y + (_local21 * _local5)) - _local20.y) - (_local19 * _local3));
_local32 = ((_local7 * _local27) + (_local8 * _local28));
_local9 = (-(_local2.normalMass) * (_local32 - _local2.velocityBias));
_local10 = b2Math.b2Max((_local2.normalImpulse + _local9), 0);
_local9 = (_local10 - _local2.normalImpulse);
_local11 = (_local9 * _local27);
_local12 = (_local9 * _local28);
_local20.x = (_local20.x - (_local23 * _local11));
_local20.y = (_local20.y - (_local23 * _local12));
_local19 = (_local19 - (_local24 * ((_local3 * _local12) - (_local4 * _local11))));
_local22.x = (_local22.x + (_local25 * _local11));
_local22.y = (_local22.y + (_local25 * _local12));
_local21 = (_local21 + (_local26 * ((_local5 * _local12) - (_local6 * _local11))));
_local2.normalImpulse = _local10;
_local7 = (((_local22.x + (-(_local21) * _local6)) - _local20.x) - (-(_local19) * _local4));
_local8 = (((_local22.y + (_local21 * _local5)) - _local20.y) - (_local19 * _local3));
_local33 = ((_local7 * _local29) + (_local8 * _local30));
_local9 = (_local2.tangentMass * -(_local33));
_local34 = (_local16.friction * _local2.normalImpulse);
_local10 = b2Math.b2Clamp((_local2.tangentImpulse + _local9), -(_local34), _local34);
_local9 = (_local10 - _local2.tangentImpulse);
_local11 = (_local9 * _local29);
_local12 = (_local9 * _local30);
_local20.x = (_local20.x - (_local23 * _local11));
_local20.y = (_local20.y - (_local23 * _local12));
_local19 = (_local19 - (_local24 * ((_local3 * _local12) - (_local4 * _local11))));
_local22.x = (_local22.x + (_local25 * _local11));
_local22.y = (_local22.y + (_local25 * _local12));
_local21 = (_local21 + (_local26 * ((_local5 * _local12) - (_local6 * _local11))));
_local2.tangentImpulse = _local10;
_local1++;
};
_local17.m_angularVelocity = _local19;
_local18.m_angularVelocity = _local21;
_local15++;
};
}
public function SolvePositionConstraints(_arg1:Number):Boolean{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:b2Vec2;
var _local10:Number;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:int;
var _local22:int;
var _local23:b2ContactConstraintPoint;
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 _local2:Number = 0;
var _local5:int;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_position;
_local10 = _local7.m_rotation;
_local11 = _local8.m_position;
_local12 = _local8.m_rotation;
_local13 = _local7.m_invMass;
_local14 = _local7.m_invI;
_local15 = _local8.m_invMass;
_local16 = _local8.m_invI;
_local17 = _local6.normal.x;
_local18 = _local6.normal.y;
_local19 = _local18;
_local20 = -(_local17);
_local21 = _local6.pointCount;
_local22 = 0;
while (_local22 < _local21) {
_local23 = _local6.points[_local22];
_local3 = _local7.m_R;
_local4 = _local23.localAnchor1;
_local24 = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local25 = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local3 = _local8.m_R;
_local4 = _local23.localAnchor2;
_local26 = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local27 = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local28 = (_local9.x + _local24);
_local29 = (_local9.y + _local25);
_local30 = (_local11.x + _local26);
_local31 = (_local11.y + _local27);
_local32 = (_local30 - _local28);
_local33 = (_local31 - _local29);
_local34 = (((_local32 * _local17) + (_local33 * _local18)) + _local23.separation);
_local2 = b2Math.b2Min(_local2, _local34);
_local35 = (_arg1 * b2Math.b2Clamp((_local34 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0));
_local36 = (-(_local23.normalMass) * _local35);
_local37 = _local23.positionImpulse;
_local23.positionImpulse = b2Math.b2Max((_local37 + _local36), 0);
_local36 = (_local23.positionImpulse - _local37);
_local38 = (_local36 * _local17);
_local39 = (_local36 * _local18);
_local9.x = (_local9.x - (_local13 * _local38));
_local9.y = (_local9.y - (_local13 * _local39));
_local10 = (_local10 - (_local14 * ((_local24 * _local39) - (_local25 * _local38))));
_local7.m_R.Set(_local10);
_local11.x = (_local11.x + (_local15 * _local38));
_local11.y = (_local11.y + (_local15 * _local39));
_local12 = (_local12 + (_local16 * ((_local26 * _local39) - (_local27 * _local38))));
_local8.m_R.Set(_local12);
_local22++;
};
_local7.m_rotation = _local10;
_local8.m_rotation = _local12;
_local5++;
};
return ((_local2 >= -(b2Settings.b2_linearSlop)));
}
public function PostSolve():void{
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ContactPoint;
var _local6:b2ContactConstraintPoint;
var _local1:int;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 36
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
public class b2NullContact extends b2Contact {
public function b2NullContact():void{
}
override public function Evaluate():void{
}
override public function GetManifolds():Array{
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 37
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolyAndCircleContact extends b2Contact {
public var m_manifold:Array;
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifold = [new b2Manifold()];
super(_arg1, _arg2);
b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polyShape));
b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape));
m_manifold[0].pointCount = 0;
m_manifold[0].points[0].normalImpulse = 0;
m_manifold[0].points[0].tangentImpulse = 0;
}
override public function Evaluate():void{
b2Collision.b2CollidePolyAndCircle(m_manifold[0], (m_shape1 as b2PolyShape), (m_shape2 as b2CircleShape), false);
if (m_manifold[0].pointCount > 0){
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
}
override public function GetManifolds():Array{
return (m_manifold);
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndCircleContact(_arg1, _arg2));
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 38
//b2PolyContact (Box2D.Dynamics.Contacts.b2PolyContact)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolyContact extends b2Contact {
private var m0:b2Manifold;
public var m_manifold:Array;
public function b2PolyContact(_arg1:b2Shape, _arg2:b2Shape):void{
m0 = new b2Manifold();
m_manifold = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold[0].pointCount = 0;
}
override public function Evaluate():void{
var _local4:b2ContactPoint;
var _local5:b2ContactPoint;
var _local6:Array;
var _local7:int;
var _local8:b2ContactPoint;
var _local9:uint;
var _local10:int;
var _local11:b2ContactPoint;
var _local12:b2ContactID;
var _local1:b2Manifold = m_manifold[0];
var _local2:Array = m0.points;
var _local3:int;
while (_local3 < _local1.pointCount) {
_local4 = _local2[_local3];
_local5 = _local1.points[_local3];
_local4.normalImpulse = _local5.normalImpulse;
_local4.tangentImpulse = _local5.tangentImpulse;
_local4.id = _local5.id.Copy();
_local3++;
};
m0.pointCount = _local1.pointCount;
b2Collision.b2CollidePoly(_local1, (m_shape1 as b2PolyShape), (m_shape2 as b2PolyShape), false);
if (_local1.pointCount > 0){
_local6 = [false, false];
_local7 = 0;
while (_local7 < _local1.pointCount) {
_local8 = _local1.points[_local7];
_local8.normalImpulse = 0;
_local8.tangentImpulse = 0;
_local9 = _local8.id.key;
_local10 = 0;
while (_local10 < m0.pointCount) {
if (_local6[_local10] == true){
} else {
_local11 = m0.points[_local10];
_local12 = _local11.id;
if (_local12.key == _local9){
_local6[_local10] = true;
_local8.normalImpulse = _local11.normalImpulse;
_local8.tangentImpulse = _local11.tangentImpulse;
break;
};
};
_local10++;
};
_local7++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
}
override public function GetManifolds():Array{
return (m_manifold);
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyContact(_arg1, _arg2));
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 39
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2DistanceJoint extends b2Joint {
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_u:b2Vec2;
public var m_impulse:Number;
public var m_mass: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);
_local2 = m_body1.m_R;
_local3 = (_arg1.anchorPoint1.x - m_body1.m_position.x);
_local4 = (_arg1.anchorPoint1.y - m_body1.m_position.y);
m_localAnchor1.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y));
m_localAnchor1.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y));
_local2 = m_body2.m_R;
_local3 = (_arg1.anchorPoint2.x - m_body2.m_position.x);
_local4 = (_arg1.anchorPoint2.y - m_body2.m_position.y);
m_localAnchor2.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y));
m_localAnchor2.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y));
_local3 = (_arg1.anchorPoint2.x - _arg1.anchorPoint1.x);
_local4 = (_arg1.anchorPoint2.y - _arg1.anchorPoint1.y);
m_length = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
m_impulse = 0;
}
override public function PrepareVelocitySolver():void{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local9:Number;
var _local10:Number;
_local1 = m_body1.m_R;
_local2 = ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y));
_local3 = ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y));
_local1 = m_body2.m_R;
_local4 = ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y));
_local5 = ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y));
m_u.x = (((m_body2.m_position.x + _local4) - m_body1.m_position.x) - _local2);
m_u.y = (((m_body2.m_position.y + _local5) - m_body1.m_position.y) - _local3);
var _local6:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y)));
if (_local6 > b2Settings.b2_linearSlop){
m_u.Multiply((1 / _local6));
} else {
m_u.SetZero();
};
var _local7:Number = ((_local2 * m_u.y) - (_local3 * m_u.x));
var _local8:Number = ((_local4 * m_u.y) - (_local5 * m_u.x));
m_mass = (((m_body1.m_invMass + ((m_body1.m_invI * _local7) * _local7)) + m_body2.m_invMass) + ((m_body2.m_invI * _local8) * _local8));
m_mass = (1 / m_mass);
if (b2World.s_enableWarmStarting){
_local9 = (m_impulse * m_u.x);
_local10 = (m_impulse * m_u.y);
m_body1.m_linearVelocity.x = (m_body1.m_linearVelocity.x - (m_body1.m_invMass * _local9));
m_body1.m_linearVelocity.y = (m_body1.m_linearVelocity.y - (m_body1.m_invMass * _local10));
m_body1.m_angularVelocity = (m_body1.m_angularVelocity - (m_body1.m_invI * ((_local2 * _local10) - (_local3 * _local9))));
m_body2.m_linearVelocity.x = (m_body2.m_linearVelocity.x + (m_body2.m_invMass * _local9));
m_body2.m_linearVelocity.y = (m_body2.m_linearVelocity.y + (m_body2.m_invMass * _local10));
m_body2.m_angularVelocity = (m_body2.m_angularVelocity + (m_body2.m_invI * ((_local4 * _local10) - (_local5 * _local9))));
} else {
m_impulse = 0;
};
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
_local2 = m_body1.m_R;
var _local3:Number = ((_local2.col1.x * m_localAnchor1.x) + (_local2.col2.x * m_localAnchor1.y));
var _local4:Number = ((_local2.col1.y * m_localAnchor1.x) + (_local2.col2.y * m_localAnchor1.y));
_local2 = m_body2.m_R;
var _local5:Number = ((_local2.col1.x * m_localAnchor2.x) + (_local2.col2.x * m_localAnchor2.y));
var _local6:Number = ((_local2.col1.y * m_localAnchor2.x) + (_local2.col2.y * m_localAnchor2.y));
var _local7:Number = (m_body1.m_linearVelocity.x + (-(m_body1.m_angularVelocity) * _local4));
var _local8:Number = (m_body1.m_linearVelocity.y + (m_body1.m_angularVelocity * _local3));
var _local9:Number = (m_body2.m_linearVelocity.x + (-(m_body2.m_angularVelocity) * _local6));
var _local10:Number = (m_body2.m_linearVelocity.y + (m_body2.m_angularVelocity * _local5));
var _local11:Number = ((m_u.x * (_local9 - _local7)) + (m_u.y * (_local10 - _local8)));
var _local12:Number = (-(m_mass) * _local11);
m_impulse = (m_impulse + _local12);
var _local13:Number = (_local12 * m_u.x);
var _local14:Number = (_local12 * m_u.y);
m_body1.m_linearVelocity.x = (m_body1.m_linearVelocity.x - (m_body1.m_invMass * _local13));
m_body1.m_linearVelocity.y = (m_body1.m_linearVelocity.y - (m_body1.m_invMass * _local14));
m_body1.m_angularVelocity = (m_body1.m_angularVelocity - (m_body1.m_invI * ((_local3 * _local14) - (_local4 * _local13))));
m_body2.m_linearVelocity.x = (m_body2.m_linearVelocity.x + (m_body2.m_invMass * _local13));
m_body2.m_linearVelocity.y = (m_body2.m_linearVelocity.y + (m_body2.m_invMass * _local14));
m_body2.m_angularVelocity = (m_body2.m_angularVelocity + (m_body2.m_invI * ((_local5 * _local14) - (_local6 * _local13))));
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
_local1 = m_body1.m_R;
var _local2:Number = ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y));
var _local3:Number = ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y));
_local1 = m_body2.m_R;
var _local4:Number = ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y));
var _local5:Number = ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y));
var _local6:Number = (((m_body2.m_position.x + _local4) - m_body1.m_position.x) - _local2);
var _local7:Number = (((m_body2.m_position.y + _local5) - m_body1.m_position.y) - _local3);
var _local8:Number = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
_local6 = (_local6 / _local8);
_local7 = (_local7 / _local8);
var _local9:Number = (_local8 - m_length);
_local9 = b2Math.b2Clamp(_local9, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local10:Number = (-(m_mass) * _local9);
m_u.Set(_local6, _local7);
var _local11:Number = (_local10 * m_u.x);
var _local12:Number = (_local10 * m_u.y);
m_body1.m_position.x = (m_body1.m_position.x - (m_body1.m_invMass * _local11));
m_body1.m_position.y = (m_body1.m_position.y - (m_body1.m_invMass * _local12));
m_body1.m_rotation = (m_body1.m_rotation - (m_body1.m_invI * ((_local2 * _local12) - (_local3 * _local11))));
m_body2.m_position.x = (m_body2.m_position.x + (m_body2.m_invMass * _local11));
m_body2.m_position.y = (m_body2.m_position.y + (m_body2.m_invMass * _local12));
m_body2.m_rotation = (m_body2.m_rotation + (m_body2.m_invI * ((_local4 * _local12) - (_local5 * _local11))));
m_body1.m_R.Set(m_body1.m_rotation);
m_body2.m_R.Set(m_body2.m_rotation);
return ((b2Math.b2Abs(_local9) < b2Settings.b2_linearSlop));
}
override public function GetAnchor1():b2Vec2{
return (b2Math.AddVV(m_body1.m_position, b2Math.b2MulMV(m_body1.m_R, m_localAnchor1)));
}
override public function GetAnchor2():b2Vec2{
return (b2Math.AddVV(m_body2.m_position, b2Math.b2MulMV(m_body2.m_R, m_localAnchor2)));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(m_u);
_local2.Multiply((m_impulse * _arg1));
return (_local2);
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
}
}//package Box2D.Dynamics.Joints
Section 40
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2DistanceJointDef extends b2JointDef {
public var anchorPoint1:b2Vec2;
public var anchorPoint2:b2Vec2;
public function b2DistanceJointDef(){
anchorPoint1 = new b2Vec2();
anchorPoint2 = new b2Vec2();
super();
type = b2Joint.e_distanceJoint;
}
}
}//package Box2D.Dynamics.Joints
Section 41
//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_ground1:b2Body;
public var m_ground2:b2Body;
public var m_revolute1:b2RevoluteJoint;
public var m_prismatic1:b2PrismaticJoint;
public var m_revolute2:b2RevoluteJoint;
public var m_prismatic2:b2PrismaticJoint;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_J:b2Jacobian;
public var m_constant:Number;
public var m_ratio:Number;
public var m_mass:Number;
public var m_impulse:Number;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local2:Number;
var _local3:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_J = new b2Jacobian();
super(_arg1);
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 (_arg1.joint1.m_type == b2Joint.e_revoluteJoint){
m_revolute1 = (_arg1.joint1 as b2RevoluteJoint);
m_groundAnchor1.SetV(m_revolute1.m_localAnchor1);
m_localAnchor1.SetV(m_revolute1.m_localAnchor2);
_local2 = m_revolute1.GetJointAngle();
} else {
m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint);
m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1);
m_localAnchor1.SetV(m_prismatic1.m_localAnchor2);
_local2 = m_prismatic1.GetJointTranslation();
};
m_ground2 = _arg1.joint2.m_body1;
m_body2 = _arg1.joint2.m_body2;
if (_arg1.joint2.m_type == b2Joint.e_revoluteJoint){
m_revolute2 = (_arg1.joint2 as b2RevoluteJoint);
m_groundAnchor2.SetV(m_revolute2.m_localAnchor1);
m_localAnchor2.SetV(m_revolute2.m_localAnchor2);
_local3 = m_revolute2.GetJointAngle();
} else {
m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint);
m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1);
m_localAnchor2.SetV(m_prismatic2.m_localAnchor2);
_local3 = m_prismatic2.GetJointTranslation();
};
m_ratio = _arg1.ratio;
m_constant = (_local2 + (m_ratio * _local3));
m_impulse = 0;
}
override public function GetAnchor1():b2Vec2{
var _local1:b2Mat22 = m_body1.m_R;
return (new b2Vec2((m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y))), (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y)))));
}
override public function GetAnchor2():b2Vec2{
var _local1:b2Mat22 = m_body2.m_R;
return (new b2Vec2((m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y))), (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y)))));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2());
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function GetRatio():Number{
return (m_ratio);
}
override public function PrepareVelocitySolver():void{
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:b2Mat22;
var _local10:b2Vec2;
var _local11:Number;
var _local1:b2Body = m_ground1;
var _local2:b2Body = m_ground2;
_local3 = m_body1;
_local4 = m_body2;
var _local12:Number = 0;
m_J.SetZero();
if (m_revolute1){
m_J.angular1 = -1;
_local12 = (_local12 + _local3.m_invI);
} else {
_local9 = _local1.m_R;
_local10 = m_prismatic1.m_localXAxis1;
_local5 = ((_local9.col1.x * _local10.x) + (_local9.col2.x * _local10.y));
_local6 = ((_local9.col1.y * _local10.x) + (_local9.col2.y * _local10.y));
_local9 = _local3.m_R;
_local7 = ((_local9.col1.x * m_localAnchor1.x) + (_local9.col2.x * m_localAnchor1.y));
_local8 = ((_local9.col1.y * m_localAnchor1.x) + (_local9.col2.y * m_localAnchor1.y));
_local11 = ((_local7 * _local6) - (_local8 * _local5));
m_J.linear1.Set(-(_local5), -(_local6));
m_J.angular1 = -(_local11);
_local12 = (_local12 + (_local3.m_invMass + ((_local3.m_invI * _local11) * _local11)));
};
if (m_revolute2){
m_J.angular2 = -(m_ratio);
_local12 = (_local12 + ((m_ratio * m_ratio) * _local4.m_invI));
} else {
_local9 = _local2.m_R;
_local10 = m_prismatic2.m_localXAxis1;
_local5 = ((_local9.col1.x * _local10.x) + (_local9.col2.x * _local10.y));
_local6 = ((_local9.col1.y * _local10.x) + (_local9.col2.y * _local10.y));
_local9 = _local4.m_R;
_local7 = ((_local9.col1.x * m_localAnchor2.x) + (_local9.col2.x * m_localAnchor2.y));
_local8 = ((_local9.col1.y * m_localAnchor2.x) + (_local9.col2.y * m_localAnchor2.y));
_local11 = ((_local7 * _local6) - (_local8 * _local5));
m_J.linear2.Set((-(m_ratio) * _local5), (-(m_ratio) * _local6));
m_J.angular2 = (-(m_ratio) * _local11);
_local12 = (_local12 + ((m_ratio * m_ratio) * (_local4.m_invMass + ((_local4.m_invI * _local11) * _local11))));
};
m_mass = (1 / _local12);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * m_impulse) * m_J.linear1.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * m_impulse) * m_J.linear1.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * m_impulse) * m_J.angular1));
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * m_impulse) * m_J.linear2.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * m_impulse) * m_J.linear2.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * m_impulse) * m_J.angular2));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local5:Number = (-(m_mass) * _local4);
m_impulse = (m_impulse + _local5);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local5) * m_J.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local5) * m_J.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local5) * m_J.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local5) * m_J.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local5) * m_J.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local5) * m_J.angular2));
}
override public function SolvePositionConstraints():Boolean{
var _local4:Number;
var _local5:Number;
var _local1:Number = 0;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
if (m_revolute1){
_local4 = m_revolute1.GetJointAngle();
} else {
_local4 = m_prismatic1.GetJointTranslation();
};
if (m_revolute2){
_local5 = m_revolute2.GetJointAngle();
} else {
_local5 = m_prismatic2.GetJointTranslation();
};
var _local6:Number = (m_constant - (_local4 + (m_ratio * _local5)));
var _local7:Number = (-(m_mass) * _local6);
_local2.m_position.x = (_local2.m_position.x + ((_local2.m_invMass * _local7) * m_J.linear1.x));
_local2.m_position.y = (_local2.m_position.y + ((_local2.m_invMass * _local7) * m_J.linear1.y));
_local2.m_rotation = (_local2.m_rotation + ((_local2.m_invI * _local7) * m_J.angular1));
_local3.m_position.x = (_local3.m_position.x + ((_local3.m_invMass * _local7) * m_J.linear2.x));
_local3.m_position.y = (_local3.m_position.y + ((_local3.m_invMass * _local7) * m_J.linear2.y));
_local3.m_rotation = (_local3.m_rotation + ((_local3.m_invI * _local7) * m_J.angular2));
_local2.m_R.Set(_local2.m_rotation);
_local3.m_R.Set(_local3.m_rotation);
return ((_local1 < b2Settings.b2_linearSlop));
}
}
}//package Box2D.Dynamics.Joints
Section 42
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef)
package Box2D.Dynamics.Joints {
public class b2GearJointDef extends b2JointDef {
public var joint1:b2Joint;
public var joint2:b2Joint;
public var ratio:Number;
public function b2GearJointDef(){
type = b2Joint.e_gearJoint;
joint1 = null;
joint2 = null;
ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 43
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2Jacobian {
public var linear1:b2Vec2;
public var angular1:Number;
public var linear2:b2Vec2;
public var angular2:Number;
public function b2Jacobian(){
linear1 = new b2Vec2();
linear2 = new b2Vec2();
super();
}
public function SetZero():void{
linear1.SetZero();
angular1 = 0;
linear2.SetZero();
angular2 = 0;
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linear1.SetV(_arg1);
angular1 = _arg2;
linear2.SetV(_arg3);
angular2 = _arg4;
}
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 44
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2Joint {
public var m_type:int;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_node1:b2JointNode;
public var m_node2:b2JointNode;
public var m_body1:b2Body;
public var m_body2:b2Body;
public var m_islandFlag:Boolean;
public var m_collideConnected:Boolean;
public var m_userData;
public static const e_unknownJoint:int = 0;
public static const e_revoluteJoint:int = 1;
public static const e_prismaticJoint:int = 2;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_mouseJoint:int = 5;
public static const e_gearJoint:int = 6;
public static const e_inactiveLimit:int = 0;
public static const e_atLowerLimit:int = 1;
public static const e_atUpperLimit:int = 2;
public static const e_equalLimits:int = 3;
public function b2Joint(_arg1:b2JointDef){
m_node1 = new b2JointNode();
m_node2 = new b2JointNode();
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 GetType():int{
return (m_type);
}
public function GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function GetReactionForce(_arg1:Number):b2Vec2{
return (null);
}
public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function GetBody1():b2Body{
return (m_body1);
}
public function GetBody2():b2Body{
return (m_body2);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetUserData(){
return (m_userData);
}
public function PrepareVelocitySolver():void{
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function PreparePositionSolver():void{
}
public function SolvePositionConstraints():Boolean{
return (false);
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
switch (_arg1.type){
case e_distanceJoint:
_local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef));
break;
case e_mouseJoint:
_local3 = new b2MouseJoint((_arg1 as b2MouseJointDef));
break;
case e_prismaticJoint:
_local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef));
break;
case e_revoluteJoint:
_local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef));
break;
case e_pulleyJoint:
_local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef));
break;
case e_gearJoint:
_local3 = new b2GearJoint((_arg1 as b2GearJointDef));
break;
default:
break;
};
return (_local3);
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
}
}//package Box2D.Dynamics.Joints
Section 45
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointDef {
public var type:int;
public var userData;
public var body1:b2Body;
public var body2:b2Body;
public var collideConnected:Boolean;
public function b2JointDef(){
type = b2Joint.e_unknownJoint;
userData = null;
body1 = null;
body2 = null;
collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 46
//b2JointNode (Box2D.Dynamics.Joints.b2JointNode)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointNode {
public var other:b2Body;
public var joint:b2Joint;
public var prev:b2JointNode;
public var next:b2JointNode;
}
}//package Box2D.Dynamics.Joints
Section 47
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2MouseJoint extends b2Joint {
private var K:b2Mat22;
private var K1:b2Mat22;
private var K2:b2Mat22;
public var m_localAnchor:b2Vec2;
public var m_target:b2Vec2;
public var m_impulse:b2Vec2;
public var m_ptpMass:b2Mat22;
public var m_C:b2Vec2;
public var m_maxForce:Number;
public var m_beta:Number;
public var m_gamma:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
var _local3:Number;
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
m_localAnchor = new b2Vec2();
m_target = new b2Vec2();
m_impulse = new b2Vec2();
m_ptpMass = new b2Mat22();
m_C = new b2Vec2();
super(_arg1);
m_target.SetV(_arg1.target);
var _local2:Number = (m_target.x - m_body2.m_position.x);
_local3 = (m_target.y - m_body2.m_position.y);
m_localAnchor.x = ((_local2 * m_body2.m_R.col1.x) + (_local3 * m_body2.m_R.col1.y));
m_localAnchor.y = ((_local2 * m_body2.m_R.col2.x) + (_local3 * m_body2.m_R.col2.y));
m_maxForce = _arg1.maxForce;
m_impulse.SetZero();
var _local4:Number = m_body2.m_mass;
var _local5:Number = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
var _local6:Number = (((2 * _local4) * _arg1.dampingRatio) * _local5);
var _local7:Number = ((_local4 * _local5) * _local5);
m_gamma = (1 / (_local6 + (_arg1.timeStep * _local7)));
m_beta = ((_arg1.timeStep * _local7) / (_local6 + (_arg1.timeStep * _local7)));
}
override public function GetAnchor1():b2Vec2{
return (m_target);
}
override public function GetAnchor2():b2Vec2{
var _local1:b2Vec2 = b2Math.b2MulMV(m_body2.m_R, m_localAnchor);
_local1.Add(m_body2.m_position);
return (_local1);
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(m_impulse);
_local2.Multiply(_arg1);
return (_local2);
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function SetTarget(_arg1:b2Vec2):void{
m_body2.WakeUp();
m_target = _arg1;
}
override public function PrepareVelocitySolver():void{
var _local1:b2Body;
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local1 = m_body2;
_local2 = _local1.m_R;
_local3 = ((_local2.col1.x * m_localAnchor.x) + (_local2.col2.x * m_localAnchor.y));
_local4 = ((_local2.col1.y * m_localAnchor.x) + (_local2.col2.y * m_localAnchor.y));
_local5 = _local1.m_invMass;
_local6 = _local1.m_invI;
K1.col1.x = _local5;
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = _local5;
K2.col1.x = ((_local6 * _local4) * _local4);
K2.col2.x = ((-(_local6) * _local3) * _local4);
K2.col1.y = ((-(_local6) * _local3) * _local4);
K2.col2.y = ((_local6 * _local3) * _local3);
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_ptpMass);
m_C.x = ((_local1.m_position.x + _local3) - m_target.x);
m_C.y = ((_local1.m_position.y + _local4) - m_target.y);
_local1.m_angularVelocity = (_local1.m_angularVelocity * 0.98);
var _local7:Number = m_impulse.x;
var _local8:Number = m_impulse.y;
_local1.m_linearVelocity.x = (_local1.m_linearVelocity.x + (_local5 * _local7));
_local1.m_linearVelocity.y = (_local1.m_linearVelocity.y + (_local5 * _local8));
_local1.m_angularVelocity = (_local1.m_angularVelocity + (_local6 * ((_local3 * _local8) - (_local4 * _local7))));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local3:b2Mat22;
var _local2:b2Body = m_body2;
_local3 = _local2.m_R;
var _local4:Number = ((_local3.col1.x * m_localAnchor.x) + (_local3.col2.x * m_localAnchor.y));
var _local5:Number = ((_local3.col1.y * m_localAnchor.x) + (_local3.col2.y * m_localAnchor.y));
var _local6:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local5));
var _local7:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local4));
_local3 = m_ptpMass;
var _local8:Number = ((_local6 + ((m_beta * _arg1.inv_dt) * m_C.x)) + (m_gamma * m_impulse.x));
var _local9:Number = ((_local7 + ((m_beta * _arg1.inv_dt) * m_C.y)) + (m_gamma * m_impulse.y));
var _local10:Number = -(((_local3.col1.x * _local8) + (_local3.col2.x * _local9)));
var _local11:Number = -(((_local3.col1.y * _local8) + (_local3.col2.y * _local9)));
var _local12:Number = m_impulse.x;
var _local13:Number = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
var _local14:Number = m_impulse.Length();
if (_local14 > (_arg1.dt * m_maxForce)){
m_impulse.Multiply(((_arg1.dt * m_maxForce) / _local14));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local10));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local11));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local4 * _local11) - (_local5 * _local10))));
}
override public function SolvePositionConstraints():Boolean{
return (true);
}
}
}//package Box2D.Dynamics.Joints
Section 48
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2MouseJointDef extends b2JointDef {
public var target:b2Vec2;
public var maxForce:Number;
public var frequencyHz:Number;
public var dampingRatio:Number;
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 49
//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_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_localXAxis1:b2Vec2;
public var m_localYAxis1:b2Vec2;
public var m_initialAngle:Number;
public var m_linearJacobian:b2Jacobian;
public var m_linearMass:Number;
public var m_linearImpulse:Number;
public var m_angularMass:Number;
public var m_angularImpulse:Number;
public var m_motorJacobian:b2Jacobian;
public var m_motorMass:Number;
public var m_motorImpulse:Number;
public var m_limitImpulse:Number;
public var m_limitPositionImpulse:Number;
public var m_lowerTranslation:Number;
public var m_upperTranslation:Number;
public var m_maxMotorForce:Number;
public var m_motorSpeed:Number;
public var m_enableLimit:Boolean;
public var m_enableMotor:Boolean;
public var m_limitState:int;
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);
_local2 = m_body1.m_R;
_local3 = (_arg1.anchorPoint.x - m_body1.m_position.x);
_local4 = (_arg1.anchorPoint.y - m_body1.m_position.y);
m_localAnchor1.Set(((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)), ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y)));
_local2 = m_body2.m_R;
_local3 = (_arg1.anchorPoint.x - m_body2.m_position.x);
_local4 = (_arg1.anchorPoint.y - m_body2.m_position.y);
m_localAnchor2.Set(((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)), ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y)));
_local2 = m_body1.m_R;
_local3 = _arg1.axis.x;
_local4 = _arg1.axis.y;
m_localXAxis1.Set(((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)), ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y)));
m_localYAxis1.x = -(m_localXAxis1.y);
m_localYAxis1.y = m_localXAxis1.x;
m_initialAngle = (m_body2.m_rotation - m_body1.m_rotation);
m_linearJacobian.SetZero();
m_linearMass = 0;
m_linearImpulse = 0;
m_angularMass = 0;
m_angularImpulse = 0;
m_motorJacobian.SetZero();
m_motorMass = 0;
m_motorImpulse = 0;
m_limitImpulse = 0;
m_limitPositionImpulse = 0;
m_lowerTranslation = _arg1.lowerTranslation;
m_upperTranslation = _arg1.upperTranslation;
m_maxMotorForce = _arg1.motorForce;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function GetAnchor1():b2Vec2{
var _local1:b2Body = m_body1;
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(m_localAnchor1);
_local2.MulM(_local1.m_R);
_local2.Add(_local1.m_position);
return (_local2);
}
override public function GetAnchor2():b2Vec2{
var _local1:b2Body = m_body2;
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(m_localAnchor2);
_local2.MulM(_local1.m_R);
_local2.Add(_local1.m_position);
return (_local2);
}
public function GetJointTranslation():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_R;
var _local4:Number = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
var _local5:Number = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
var _local6:Number = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
var _local7:Number = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
var _local8:Number = (_local1.m_position.x + _local4);
var _local9:Number = (_local1.m_position.y + _local5);
var _local10:Number = (_local2.m_position.x + _local6);
var _local11:Number = (_local2.m_position.y + _local7);
var _local12:Number = (_local10 - _local8);
var _local13:Number = (_local11 - _local9);
_local3 = _local1.m_R;
var _local14:Number = ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y));
var _local15:Number = ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y));
var _local16:Number = ((_local14 * _local12) + (_local15 * _local13));
return (_local16);
}
public function GetJointSpeed():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_R;
var _local4:Number = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
var _local5:Number = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
var _local6:Number = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
var _local7:Number = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
var _local8:Number = (_local1.m_position.x + _local4);
var _local9:Number = (_local1.m_position.y + _local5);
var _local10:Number = (_local2.m_position.x + _local6);
var _local11:Number = (_local2.m_position.y + _local7);
var _local12:Number = (_local10 - _local8);
var _local13:Number = (_local11 - _local9);
_local3 = _local1.m_R;
var _local14:Number = ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y));
var _local15:Number = ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y));
var _local16:b2Vec2 = _local1.m_linearVelocity;
var _local17:b2Vec2 = _local2.m_linearVelocity;
var _local18:Number = _local1.m_angularVelocity;
var _local19:Number = _local2.m_angularVelocity;
var _local20:Number = (((_local12 * (-(_local18) * _local15)) + (_local13 * (_local18 * _local14))) + ((_local14 * (((_local17.x + (-(_local19) * _local7)) - _local16.x) - (-(_local18) * _local5))) + (_local15 * (((_local17.y + (_local19 * _local6)) - _local16.y) - (_local18 * _local4)))));
return (_local20);
}
public function GetMotorForce(_arg1:Number):Number{
return ((_arg1 * m_motorImpulse));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function SetMotorForce(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
var _local3:b2Mat22;
var _local2:Number = (_arg1 * m_limitImpulse);
_local3 = m_body1.m_R;
var _local4:Number = (_local2 * ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y)));
var _local5:Number = (_local2 * ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y)));
var _local6:Number = (_local2 * ((_local3.col1.x * m_localYAxis1.x) + (_local3.col2.x * m_localYAxis1.y)));
var _local7:Number = (_local2 * ((_local3.col1.y * m_localYAxis1.x) + (_local3.col2.y * m_localYAxis1.y)));
return (new b2Vec2((_local4 + _local6), (_local5 + _local7)));
}
override public function GetReactionTorque(_arg1:Number):Number{
return ((_arg1 * m_angularImpulse));
}
override public function PrepareVelocitySolver():void{
var _local3:b2Mat22;
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 _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_R;
var _local4:Number = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
var _local5:Number = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
var _local6:Number = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
var _local7:Number = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
var _local8:Number = _local1.m_invMass;
var _local9:Number = _local2.m_invMass;
var _local10:Number = _local1.m_invI;
var _local11:Number = _local2.m_invI;
_local3 = _local1.m_R;
var _local12:Number = ((_local3.col1.x * m_localYAxis1.x) + (_local3.col2.x * m_localYAxis1.y));
var _local13:Number = ((_local3.col1.y * m_localYAxis1.x) + (_local3.col2.y * m_localYAxis1.y));
var _local14:Number = ((_local2.m_position.x + _local6) - _local1.m_position.x);
var _local15:Number = ((_local2.m_position.y + _local7) - _local1.m_position.y);
m_linearJacobian.linear1.x = -(_local12);
m_linearJacobian.linear1.y = -(_local13);
m_linearJacobian.linear2.x = _local12;
m_linearJacobian.linear2.y = _local13;
m_linearJacobian.angular1 = -(((_local14 * _local13) - (_local15 * _local12)));
m_linearJacobian.angular2 = ((_local6 * _local13) - (_local7 * _local12));
m_linearMass = (((_local8 + ((_local10 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local9) + ((_local11 * m_linearJacobian.angular2) * m_linearJacobian.angular2));
m_linearMass = (1 / m_linearMass);
m_angularMass = (1 / (_local10 + _local11));
if (((m_enableLimit) || (m_enableMotor))){
_local3 = _local1.m_R;
_local16 = ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y));
_local17 = ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y));
m_motorJacobian.linear1.x = -(_local16);
m_motorJacobian.linear1.y = -(_local17);
m_motorJacobian.linear2.x = _local16;
m_motorJacobian.linear2.y = _local17;
m_motorJacobian.angular1 = -(((_local14 * _local17) - (_local15 * _local16)));
m_motorJacobian.angular2 = ((_local6 * _local17) - (_local7 * _local16));
m_motorMass = (((_local8 + ((_local10 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local9) + ((_local11 * m_motorJacobian.angular2) * m_motorJacobian.angular2));
m_motorMass = (1 / m_motorMass);
if (m_enableLimit){
_local18 = (_local14 - _local4);
_local19 = (_local15 - _local5);
_local20 = ((_local16 * _local18) + (_local17 * _local19));
if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local20 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitImpulse = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local20 >= m_upperTranslation){
if (m_limitState != e_atUpperLimit){
m_limitImpulse = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitImpulse = 0;
};
};
};
};
};
if (m_enableMotor == false){
m_motorImpulse = 0;
};
if (m_enableLimit == false){
m_limitImpulse = 0;
};
if (b2World.s_enableWarmStarting){
_local21 = ((m_linearImpulse * m_linearJacobian.linear1.x) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.linear1.x));
_local22 = ((m_linearImpulse * m_linearJacobian.linear1.y) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.linear1.y));
_local23 = ((m_linearImpulse * m_linearJacobian.linear2.x) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.linear2.x));
_local24 = ((m_linearImpulse * m_linearJacobian.linear2.y) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.linear2.y));
_local25 = (((m_linearImpulse * m_linearJacobian.angular1) - m_angularImpulse) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.angular1));
_local26 = (((m_linearImpulse * m_linearJacobian.angular2) + m_angularImpulse) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.angular2));
_local1.m_linearVelocity.x = (_local1.m_linearVelocity.x + (_local8 * _local21));
_local1.m_linearVelocity.y = (_local1.m_linearVelocity.y + (_local8 * _local22));
_local1.m_angularVelocity = (_local1.m_angularVelocity + (_local10 * _local25));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local9 * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local9 * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local11 * _local26));
} else {
m_linearImpulse = 0;
m_angularImpulse = 0;
m_limitImpulse = 0;
m_motorImpulse = 0;
};
m_limitPositionImpulse = 0;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local8:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = _local2.m_invMass;
var _local5:Number = _local3.m_invMass;
var _local6:Number = _local2.m_invI;
var _local7:Number = _local3.m_invI;
var _local9:Number = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local10:Number = (-(m_linearMass) * _local9);
m_linearImpulse = (m_linearImpulse + _local10);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local10) * m_linearJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local10) * m_linearJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local10) * m_linearJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local10) * m_linearJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local10) * m_linearJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local10) * m_linearJacobian.angular2));
var _local11:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity);
var _local12:Number = (-(m_angularMass) * _local11);
m_angularImpulse = (m_angularImpulse + _local12);
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local12));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local12));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local13 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed);
_local14 = (-(m_motorMass) * _local13);
_local15 = m_motorImpulse;
m_motorImpulse = b2Math.b2Clamp((m_motorImpulse + _local14), (-(_arg1.dt) * m_maxMotorForce), (_arg1.dt * m_maxMotorForce));
_local14 = (m_motorImpulse - _local15);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local14) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local14) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local14) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local14) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local14) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local14) * m_motorJacobian.angular2));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local16 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local17 = (-(m_motorMass) * _local16);
if (m_limitState == e_equalLimits){
m_limitImpulse = (m_limitImpulse + _local17);
} else {
if (m_limitState == e_atLowerLimit){
_local8 = m_limitImpulse;
m_limitImpulse = b2Math.b2Max((m_limitImpulse + _local17), 0);
_local17 = (m_limitImpulse - _local8);
} else {
if (m_limitState == e_atUpperLimit){
_local8 = m_limitImpulse;
m_limitImpulse = b2Math.b2Min((m_limitImpulse + _local17), 0);
_local17 = (m_limitImpulse - _local8);
};
};
};
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local17) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local17) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local17) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local17) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local17) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local17) * m_motorJacobian.angular2));
};
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local9:b2Mat22;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = _local3.m_invMass;
var _local6:Number = _local4.m_invMass;
var _local7:Number = _local3.m_invI;
var _local8:Number = _local4.m_invI;
_local9 = _local3.m_R;
var _local10:Number = ((_local9.col1.x * m_localAnchor1.x) + (_local9.col2.x * m_localAnchor1.y));
var _local11:Number = ((_local9.col1.y * m_localAnchor1.x) + (_local9.col2.y * m_localAnchor1.y));
_local9 = _local4.m_R;
var _local12:Number = ((_local9.col1.x * m_localAnchor2.x) + (_local9.col2.x * m_localAnchor2.y));
var _local13:Number = ((_local9.col1.y * m_localAnchor2.x) + (_local9.col2.y * m_localAnchor2.y));
var _local14:Number = (_local3.m_position.x + _local10);
var _local15:Number = (_local3.m_position.y + _local11);
var _local16:Number = (_local4.m_position.x + _local12);
var _local17:Number = (_local4.m_position.y + _local13);
var _local18:Number = (_local16 - _local14);
var _local19:Number = (_local17 - _local15);
_local9 = _local3.m_R;
var _local20:Number = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
var _local21:Number = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
var _local22:Number = ((_local20 * _local18) + (_local21 * _local19));
_local22 = b2Math.b2Clamp(_local22, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local23:Number = (-(m_linearMass) * _local22);
_local3.m_position.x = (_local3.m_position.x + ((_local5 * _local23) * m_linearJacobian.linear1.x));
_local3.m_position.y = (_local3.m_position.y + ((_local5 * _local23) * m_linearJacobian.linear1.y));
_local3.m_rotation = (_local3.m_rotation + ((_local7 * _local23) * m_linearJacobian.angular1));
_local4.m_position.x = (_local4.m_position.x + ((_local6 * _local23) * m_linearJacobian.linear2.x));
_local4.m_position.y = (_local4.m_position.y + ((_local6 * _local23) * m_linearJacobian.linear2.y));
_local4.m_rotation = (_local4.m_rotation + ((_local8 * _local23) * m_linearJacobian.angular2));
var _local24:Number = b2Math.b2Abs(_local22);
var _local25:Number = ((_local4.m_rotation - _local3.m_rotation) - m_initialAngle);
_local25 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
var _local26:Number = (-(m_angularMass) * _local25);
_local3.m_rotation = (_local3.m_rotation - (_local3.m_invI * _local26));
_local3.m_R.Set(_local3.m_rotation);
_local4.m_rotation = (_local4.m_rotation + (_local4.m_invI * _local26));
_local4.m_R.Set(_local4.m_rotation);
var _local27:Number = b2Math.b2Abs(_local25);
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local9 = _local3.m_R;
_local10 = ((_local9.col1.x * m_localAnchor1.x) + (_local9.col2.x * m_localAnchor1.y));
_local11 = ((_local9.col1.y * m_localAnchor1.x) + (_local9.col2.y * m_localAnchor1.y));
_local9 = _local4.m_R;
_local12 = ((_local9.col1.x * m_localAnchor2.x) + (_local9.col2.x * m_localAnchor2.y));
_local13 = ((_local9.col1.y * m_localAnchor2.x) + (_local9.col2.y * m_localAnchor2.y));
_local14 = (_local3.m_position.x + _local10);
_local15 = (_local3.m_position.y + _local11);
_local16 = (_local4.m_position.x + _local12);
_local17 = (_local4.m_position.y + _local13);
_local18 = (_local16 - _local14);
_local19 = (_local17 - _local15);
_local9 = _local3.m_R;
_local28 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y));
_local29 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y));
_local30 = ((_local28 * _local18) + (_local29 * _local19));
_local31 = 0;
if (m_limitState == e_equalLimits){
_local1 = b2Math.b2Clamp(_local30, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local31 = (-(m_motorMass) * _local1);
_local24 = b2Math.b2Max(_local24, b2Math.b2Abs(_local25));
} else {
if (m_limitState == e_atLowerLimit){
_local1 = (_local30 - m_lowerTranslation);
_local24 = b2Math.b2Max(_local24, -(_local1));
_local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local31 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local31), 0);
_local31 = (m_limitPositionImpulse - _local2);
} else {
if (m_limitState == e_atUpperLimit){
_local1 = (_local30 - m_upperTranslation);
_local24 = b2Math.b2Max(_local24, _local1);
_local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local31 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local31), 0);
_local31 = (m_limitPositionImpulse - _local2);
};
};
};
_local3.m_position.x = (_local3.m_position.x + ((_local5 * _local31) * m_motorJacobian.linear1.x));
_local3.m_position.y = (_local3.m_position.y + ((_local5 * _local31) * m_motorJacobian.linear1.y));
_local3.m_rotation = (_local3.m_rotation + ((_local7 * _local31) * m_motorJacobian.angular1));
_local3.m_R.Set(_local3.m_rotation);
_local4.m_position.x = (_local4.m_position.x + ((_local6 * _local31) * m_motorJacobian.linear2.x));
_local4.m_position.y = (_local4.m_position.y + ((_local6 * _local31) * m_motorJacobian.linear2.y));
_local4.m_rotation = (_local4.m_rotation + ((_local8 * _local31) * m_motorJacobian.angular2));
_local4.m_R.Set(_local4.m_rotation);
};
return ((((_local24 <= b2Settings.b2_linearSlop)) && ((_local27 <= b2Settings.b2_angularSlop))));
}
}
}//package Box2D.Dynamics.Joints
Section 50
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2PrismaticJointDef extends b2JointDef {
public var anchorPoint:b2Vec2;
public var axis:b2Vec2;
public var lowerTranslation:Number;
public var upperTranslation:Number;
public var motorForce:Number;
public var motorSpeed:Number;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public function b2PrismaticJointDef(){
type = b2Joint.e_prismaticJoint;
anchorPoint = new b2Vec2(0, 0);
axis = new b2Vec2(0, 0);
lowerTranslation = 0;
upperTranslation = 0;
motorForce = 0;
motorSpeed = 0;
enableLimit = false;
enableMotor = false;
}
}
}//package Box2D.Dynamics.Joints
Section 51
//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_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_u1:b2Vec2;
public var m_u2:b2Vec2;
public var m_constant:Number;
public var m_ratio:Number;
public var m_maxLength1:Number;
public var m_maxLength2:Number;
public var m_pulleyMass:Number;
public var m_limitMass1:Number;
public var m_limitMass2:Number;
public var m_pulleyImpulse:Number;
public var m_limitImpulse1:Number;
public var m_limitImpulse2:Number;
public var m_limitPositionImpulse1:Number;
public var m_limitPositionImpulse2:Number;
public var m_limitState1:int;
public var m_limitState2:int;
public static var b2_minPulleyLength:Number = 30;
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.groundPoint1.x - m_ground.m_position.x);
m_groundAnchor1.y = (_arg1.groundPoint1.y - m_ground.m_position.y);
m_groundAnchor2.x = (_arg1.groundPoint2.x - m_ground.m_position.x);
m_groundAnchor2.y = (_arg1.groundPoint2.y - m_ground.m_position.y);
_local2 = m_body1.m_R;
_local3 = (_arg1.anchorPoint1.x - m_body1.m_position.x);
_local4 = (_arg1.anchorPoint1.y - m_body1.m_position.y);
m_localAnchor1.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y));
m_localAnchor1.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y));
_local2 = m_body2.m_R;
_local3 = (_arg1.anchorPoint2.x - m_body2.m_position.x);
_local4 = (_arg1.anchorPoint2.y - m_body2.m_position.y);
m_localAnchor2.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y));
m_localAnchor2.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y));
m_ratio = _arg1.ratio;
_local3 = (_arg1.groundPoint1.x - _arg1.anchorPoint1.x);
_local4 = (_arg1.groundPoint1.y - _arg1.anchorPoint1.y);
var _local5:Number = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
_local3 = (_arg1.groundPoint2.x - _arg1.anchorPoint2.x);
_local4 = (_arg1.groundPoint2.y - _arg1.anchorPoint2.y);
var _local6:Number = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
var _local7:Number = b2Math.b2Max((0.5 * b2_minPulleyLength), _local5);
var _local8:Number = b2Math.b2Max((0.5 * b2_minPulleyLength), _local6);
m_constant = (_local7 + (m_ratio * _local8));
m_maxLength1 = b2Math.b2Clamp(_arg1.maxLength1, _local7, (m_constant - (m_ratio * b2_minPulleyLength)));
m_maxLength2 = b2Math.b2Clamp(_arg1.maxLength2, _local8, ((m_constant - b2_minPulleyLength) / m_ratio));
m_pulleyImpulse = 0;
m_limitImpulse1 = 0;
m_limitImpulse2 = 0;
}
override public function GetAnchor1():b2Vec2{
var _local1:b2Mat22 = m_body1.m_R;
return (new b2Vec2((m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y))), (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y)))));
}
override public function GetAnchor2():b2Vec2{
var _local1:b2Mat22 = m_body2.m_R;
return (new b2Vec2((m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y))), (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y)))));
}
public function GetGroundPoint1():b2Vec2{
return (new b2Vec2((m_ground.m_position.x + m_groundAnchor1.x), (m_ground.m_position.y + m_groundAnchor1.y)));
}
public function GetGroundPoint2():b2Vec2{
return (new b2Vec2((m_ground.m_position.x + m_groundAnchor2.x), (m_ground.m_position.y + m_groundAnchor2.y)));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2());
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function GetLength1():Number{
var _local1:b2Mat22;
_local1 = m_body1.m_R;
var _local2:Number = (m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y)));
var _local3:Number = (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y)));
var _local4:Number = (_local2 - (m_ground.m_position.x + m_groundAnchor1.x));
var _local5:Number = (_local3 - (m_ground.m_position.y + m_groundAnchor1.y));
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetLength2():Number{
var _local1:b2Mat22;
_local1 = m_body2.m_R;
var _local2:Number = (m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y)));
var _local3:Number = (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y)));
var _local4:Number = (_local2 - (m_ground.m_position.x + m_groundAnchor2.x));
var _local5:Number = (_local3 - (m_ground.m_position.y + m_groundAnchor2.y));
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetRatio():Number{
return (m_ratio);
}
override public function PrepareVelocitySolver():void{
var _local3:b2Mat22;
var _local23:Number;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_R;
var _local4:Number = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
var _local5:Number = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
var _local6:Number = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
var _local7:Number = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
var _local8:Number = (_local1.m_position.x + _local4);
var _local9:Number = (_local1.m_position.y + _local5);
var _local10:Number = (_local2.m_position.x + _local6);
var _local11:Number = (_local2.m_position.y + _local7);
var _local12:Number = (m_ground.m_position.x + m_groundAnchor1.x);
var _local13:Number = (m_ground.m_position.y + m_groundAnchor1.y);
var _local14:Number = (m_ground.m_position.x + m_groundAnchor2.x);
var _local15:Number = (m_ground.m_position.y + m_groundAnchor2.y);
m_u1.Set((_local8 - _local12), (_local9 - _local13));
m_u2.Set((_local10 - _local14), (_local11 - _local15));
var _local16:Number = m_u1.Length();
var _local17:Number = 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();
};
if (_local16 < m_maxLength1){
m_limitState1 = e_inactiveLimit;
m_limitImpulse1 = 0;
} else {
m_limitState1 = e_atUpperLimit;
m_limitPositionImpulse1 = 0;
};
if (_local17 < m_maxLength2){
m_limitState2 = e_inactiveLimit;
m_limitImpulse2 = 0;
} else {
m_limitState2 = e_atUpperLimit;
m_limitPositionImpulse2 = 0;
};
var _local18:Number = ((_local4 * m_u1.y) - (_local5 * m_u1.x));
var _local19:Number = ((_local6 * m_u2.y) - (_local7 * m_u2.x));
m_limitMass1 = (_local1.m_invMass + ((_local1.m_invI * _local18) * _local18));
m_limitMass2 = (_local2.m_invMass + ((_local2.m_invI * _local19) * _local19));
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);
var _local20:Number = ((-(m_pulleyImpulse) - m_limitImpulse1) * m_u1.x);
var _local21:Number = ((-(m_pulleyImpulse) - m_limitImpulse1) * m_u1.y);
var _local22:Number = (((-(m_ratio) * m_pulleyImpulse) - m_limitImpulse2) * m_u2.x);
_local23 = (((-(m_ratio) * m_pulleyImpulse) - m_limitImpulse2) * m_u2.y);
_local1.m_linearVelocity.x = (_local1.m_linearVelocity.x + (_local1.m_invMass * _local20));
_local1.m_linearVelocity.y = (_local1.m_linearVelocity.y + (_local1.m_invMass * _local21));
_local1.m_angularVelocity = (_local1.m_angularVelocity + (_local1.m_invI * ((_local4 * _local21) - (_local5 * _local20))));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local22));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local23));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local23) - (_local7 * _local22))));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
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 _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_R;
var _local5:Number = ((_local4.col1.x * m_localAnchor1.x) + (_local4.col2.x * m_localAnchor1.y));
var _local6:Number = ((_local4.col1.y * m_localAnchor1.x) + (_local4.col2.y * m_localAnchor1.y));
_local4 = _local3.m_R;
var _local7:Number = ((_local4.col1.x * m_localAnchor2.x) + (_local4.col2.x * m_localAnchor2.y));
var _local8:Number = ((_local4.col1.y * m_localAnchor2.x) + (_local4.col2.y * m_localAnchor2.y));
_local9 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local10 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local11 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local8));
_local12 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local7));
_local17 = (-(((m_u1.x * _local9) + (m_u1.y * _local10))) - (m_ratio * ((m_u2.x * _local11) + (m_u2.y * _local12))));
_local18 = (-(m_pulleyMass) * _local17);
m_pulleyImpulse = (m_pulleyImpulse + _local18);
_local13 = (-(_local18) * m_u1.x);
_local14 = (-(_local18) * m_u1.y);
_local15 = ((-(m_ratio) * _local18) * m_u2.x);
_local16 = ((-(m_ratio) * _local18) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local13));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local14));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local14) - (_local6 * _local13))));
_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 * ((_local7 * _local16) - (_local8 * _local15))));
if (m_limitState1 == e_atUpperLimit){
_local9 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local10 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local17 = -(((m_u1.x * _local9) + (m_u1.y * _local10)));
_local18 = (-(m_limitMass1) * _local17);
_local19 = m_limitImpulse1;
m_limitImpulse1 = b2Math.b2Max(0, (m_limitImpulse1 + _local18));
_local18 = (m_limitImpulse1 - _local19);
_local13 = (-(_local18) * m_u1.x);
_local14 = (-(_local18) * m_u1.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local13));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local14));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local14) - (_local6 * _local13))));
};
if (m_limitState2 == e_atUpperLimit){
_local11 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local8));
_local12 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local7));
_local17 = -(((m_u2.x * _local11) + (m_u2.y * _local12)));
_local18 = (-(m_limitMass2) * _local17);
_local19 = m_limitImpulse2;
m_limitImpulse2 = b2Math.b2Max(0, (m_limitImpulse2 + _local18));
_local18 = (m_limitImpulse2 - _local19);
_local15 = (-(_local18) * m_u2.x);
_local16 = (-(_local18) * m_u2.y);
_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 * ((_local7 * _local16) - (_local8 * _local15))));
};
}
override public function SolvePositionConstraints():Boolean{
var _local3:b2Mat22;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
var _local4:Number = (m_ground.m_position.x + m_groundAnchor1.x);
var _local5:Number = (m_ground.m_position.y + m_groundAnchor1.y);
var _local6:Number = (m_ground.m_position.x + m_groundAnchor2.x);
var _local7:Number = (m_ground.m_position.y + m_groundAnchor2.y);
var _local21:Number = 0;
_local3 = _local1.m_R;
_local8 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
_local9 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
_local10 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
_local11 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
_local12 = (_local1.m_position.x + _local8);
_local13 = (_local1.m_position.y + _local9);
_local14 = (_local2.m_position.x + _local10);
_local15 = (_local2.m_position.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));
_local21 = b2Math.b2Max(_local21, Math.abs(_local18));
_local18 = b2Math.b2Clamp(_local18, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local19 = (-(m_pulleyMass) * _local18);
_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_position.x = (_local1.m_position.x + (_local1.m_invMass * _local12));
_local1.m_position.y = (_local1.m_position.y + (_local1.m_invMass * _local13));
_local1.m_rotation = (_local1.m_rotation + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local2.m_position.x = (_local2.m_position.x + (_local2.m_invMass * _local14));
_local2.m_position.y = (_local2.m_position.y + (_local2.m_invMass * _local15));
_local2.m_rotation = (_local2.m_rotation + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local1.m_R.Set(_local1.m_rotation);
_local2.m_R.Set(_local2.m_rotation);
if (m_limitState1 == e_atUpperLimit){
_local3 = _local1.m_R;
_local8 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
_local9 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local12 = (_local1.m_position.x + _local8);
_local13 = (_local1.m_position.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);
_local21 = b2Math.b2Max(_local21, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass1) * _local18);
_local20 = m_limitPositionImpulse1;
m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19));
_local19 = (m_limitPositionImpulse1 - _local20);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local1.m_position.x = (_local1.m_position.x + (_local1.m_invMass * _local12));
_local1.m_position.y = (_local1.m_position.y + (_local1.m_invMass * _local13));
_local1.m_rotation = (_local1.m_rotation + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local1.m_R.Set(_local1.m_rotation);
};
if (m_limitState2 == e_atUpperLimit){
_local3 = _local2.m_R;
_local10 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
_local11 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
_local14 = (_local2.m_position.x + _local10);
_local15 = (_local2.m_position.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);
_local21 = b2Math.b2Max(_local21, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass2) * _local18);
_local20 = m_limitPositionImpulse2;
m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19));
_local19 = (m_limitPositionImpulse2 - _local20);
_local14 = (-(_local19) * m_u2.x);
_local15 = (-(_local19) * m_u2.y);
_local2.m_position.x = (_local2.m_position.x + (_local2.m_invMass * _local14));
_local2.m_position.y = (_local2.m_position.y + (_local2.m_invMass * _local15));
_local2.m_rotation = (_local2.m_rotation + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local2.m_R.Set(_local2.m_rotation);
};
return ((_local21 < b2Settings.b2_linearSlop));
}
}
}//package Box2D.Dynamics.Joints
Section 52
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2PulleyJointDef extends b2JointDef {
public var groundPoint1:b2Vec2;
public var groundPoint2:b2Vec2;
public var anchorPoint1:b2Vec2;
public var anchorPoint2:b2Vec2;
public var maxLength1:Number;
public var maxLength2:Number;
public var ratio:Number;
public function b2PulleyJointDef(){
groundPoint1 = new b2Vec2();
groundPoint2 = new b2Vec2();
anchorPoint1 = new b2Vec2();
anchorPoint2 = new b2Vec2();
super();
type = b2Joint.e_pulleyJoint;
groundPoint1.Set(-1, 1);
groundPoint2.Set(1, 1);
anchorPoint1.Set(-1, 0);
anchorPoint2.Set(1, 0);
maxLength1 = (0.5 * b2PulleyJoint.b2_minPulleyLength);
maxLength2 = (0.5 * b2PulleyJoint.b2_minPulleyLength);
ratio = 1;
collideConnected = true;
}
}
}//package Box2D.Dynamics.Joints
Section 53
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2RevoluteJoint extends b2Joint {
private var K:b2Mat22;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K3:b2Mat22;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_ptpImpulse:b2Vec2;
public var m_motorImpulse:Number;
public var m_limitImpulse:Number;
public var m_limitPositionImpulse:Number;
public var m_ptpMass:b2Mat22;
public var m_motorMass:Number;
public var m_intialAngle:Number;
public var m_lowerAngle:Number;
public var m_upperAngle:Number;
public var m_maxMotorTorque:Number;
public var m_motorSpeed:Number;
public var m_enableLimit:Boolean;
public var m_enableMotor:Boolean;
public var m_limitState:int;
public static var tImpulse:b2Vec2 = new b2Vec2();
public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
K3 = new b2Mat22();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_ptpImpulse = new b2Vec2();
m_ptpMass = new b2Mat22();
super(_arg1);
_local2 = m_body1.m_R;
_local3 = (_arg1.anchorPoint.x - m_body1.m_position.x);
_local4 = (_arg1.anchorPoint.y - m_body1.m_position.y);
m_localAnchor1.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y));
m_localAnchor1.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y));
_local2 = m_body2.m_R;
_local3 = (_arg1.anchorPoint.x - m_body2.m_position.x);
_local4 = (_arg1.anchorPoint.y - m_body2.m_position.y);
m_localAnchor2.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y));
m_localAnchor2.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y));
m_intialAngle = (m_body2.m_rotation - m_body1.m_rotation);
m_ptpImpulse.Set(0, 0);
m_motorImpulse = 0;
m_limitImpulse = 0;
m_limitPositionImpulse = 0;
m_lowerAngle = _arg1.lowerAngle;
m_upperAngle = _arg1.upperAngle;
m_maxMotorTorque = _arg1.motorTorque;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function GetAnchor1():b2Vec2{
var _local1:b2Mat22 = m_body1.m_R;
return (new b2Vec2((m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y))), (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y)))));
}
override public function GetAnchor2():b2Vec2{
var _local1:b2Mat22 = m_body2.m_R;
return (new b2Vec2((m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y))), (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y)))));
}
public function GetJointAngle():Number{
return ((m_body2.m_rotation - m_body1.m_rotation));
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function GetMotorTorque(_arg1:Number):Number{
return ((_arg1 * m_motorImpulse));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function SetMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
var _local2:b2Vec2 = m_ptpImpulse.Copy();
_local2.Multiply(_arg1);
return (_local2);
}
override public function GetReactionTorque(_arg1:Number):Number{
return ((_arg1 * m_limitImpulse));
}
override public function PrepareVelocitySolver():void{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local12:Number;
_local1 = m_body1;
_local2 = m_body2;
_local3 = _local1.m_R;
var _local4:Number = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
var _local5:Number = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
var _local6:Number = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
var _local7:Number = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
var _local8:Number = _local1.m_invMass;
var _local9:Number = _local2.m_invMass;
var _local10:Number = _local1.m_invI;
var _local11:Number = _local2.m_invI;
K1.col1.x = (_local8 + _local9);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local8 + _local9);
K2.col1.x = ((_local10 * _local5) * _local5);
K2.col2.x = ((-(_local10) * _local4) * _local5);
K2.col1.y = ((-(_local10) * _local4) * _local5);
K2.col2.y = ((_local10 * _local4) * _local4);
K3.col1.x = ((_local11 * _local7) * _local7);
K3.col2.x = ((-(_local11) * _local6) * _local7);
K3.col1.y = ((-(_local11) * _local6) * _local7);
K3.col2.y = ((_local11 * _local6) * _local6);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Invert(m_ptpMass);
m_motorMass = (1 / (_local10 + _local11));
if (m_enableMotor == false){
m_motorImpulse = 0;
};
if (m_enableLimit){
_local12 = ((_local2.m_rotation - _local1.m_rotation) - m_intialAngle);
if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
m_limitState = e_equalLimits;
} else {
if (_local12 <= m_lowerAngle){
if (m_limitState != e_atLowerLimit){
m_limitImpulse = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local12 >= m_upperAngle){
if (m_limitState != e_atUpperLimit){
m_limitImpulse = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitImpulse = 0;
};
};
};
} else {
m_limitImpulse = 0;
};
if (b2World.s_enableWarmStarting){
_local1.m_linearVelocity.x = (_local1.m_linearVelocity.x - (_local8 * m_ptpImpulse.x));
_local1.m_linearVelocity.y = (_local1.m_linearVelocity.y - (_local8 * m_ptpImpulse.y));
_local1.m_angularVelocity = (_local1.m_angularVelocity - (_local10 * ((((_local4 * m_ptpImpulse.y) - (_local5 * m_ptpImpulse.x)) + m_motorImpulse) + m_limitImpulse)));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local9 * m_ptpImpulse.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local9 * m_ptpImpulse.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local11 * ((((_local6 * m_ptpImpulse.y) - (_local7 * m_ptpImpulse.x)) + m_motorImpulse) + m_limitImpulse)));
} else {
m_ptpImpulse.SetZero();
m_motorImpulse = 0;
m_limitImpulse = 0;
};
m_limitPositionImpulse = 0;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local9:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_R;
var _local5:Number = ((_local4.col1.x * m_localAnchor1.x) + (_local4.col2.x * m_localAnchor1.y));
var _local6:Number = ((_local4.col1.y * m_localAnchor1.x) + (_local4.col2.y * m_localAnchor1.y));
_local4 = _local3.m_R;
var _local7:Number = ((_local4.col1.x * m_localAnchor2.x) + (_local4.col2.x * m_localAnchor2.y));
var _local8:Number = ((_local4.col1.y * m_localAnchor2.x) + (_local4.col2.y * m_localAnchor2.y));
var _local10:Number = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local8)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local6));
var _local11:Number = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local7)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local5));
var _local12:Number = -(((m_ptpMass.col1.x * _local10) + (m_ptpMass.col2.x * _local11)));
var _local13:Number = -(((m_ptpMass.col1.y * _local10) + (m_ptpMass.col2.y * _local11)));
m_ptpImpulse.x = (m_ptpImpulse.x + _local12);
m_ptpImpulse.y = (m_ptpImpulse.y + _local13);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local12));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local13));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local5 * _local13) - (_local6 * _local12))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local12));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local13));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local7 * _local13) - (_local8 * _local12))));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local14 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed);
_local15 = (-(m_motorMass) * _local14);
_local16 = m_motorImpulse;
m_motorImpulse = b2Math.b2Clamp((m_motorImpulse + _local15), (-(_arg1.dt) * m_maxMotorTorque), (_arg1.dt * m_maxMotorTorque));
_local15 = (m_motorImpulse - _local16);
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * _local15));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * _local15));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local17 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local18 = (-(m_motorMass) * _local17);
if (m_limitState == e_equalLimits){
m_limitImpulse = (m_limitImpulse + _local18);
} else {
if (m_limitState == e_atLowerLimit){
_local9 = m_limitImpulse;
m_limitImpulse = b2Math.b2Max((m_limitImpulse + _local18), 0);
_local18 = (m_limitImpulse - _local9);
} else {
if (m_limitState == e_atUpperLimit){
_local9 = m_limitImpulse;
m_limitImpulse = b2Math.b2Min((m_limitImpulse + _local18), 0);
_local18 = (m_limitImpulse - _local9);
};
};
};
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * _local18));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * _local18));
};
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local6:b2Mat22;
var _local24:Number;
var _local25:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = 0;
_local6 = _local3.m_R;
var _local7:Number = ((_local6.col1.x * m_localAnchor1.x) + (_local6.col2.x * m_localAnchor1.y));
var _local8:Number = ((_local6.col1.y * m_localAnchor1.x) + (_local6.col2.y * m_localAnchor1.y));
_local6 = _local4.m_R;
var _local9:Number = ((_local6.col1.x * m_localAnchor2.x) + (_local6.col2.x * m_localAnchor2.y));
var _local10:Number = ((_local6.col1.y * m_localAnchor2.x) + (_local6.col2.y * m_localAnchor2.y));
var _local11:Number = (_local3.m_position.x + _local7);
var _local12:Number = (_local3.m_position.y + _local8);
var _local13:Number = (_local4.m_position.x + _local9);
var _local14:Number = (_local4.m_position.y + _local10);
var _local15:Number = (_local13 - _local11);
var _local16:Number = (_local14 - _local12);
_local5 = Math.sqrt(((_local15 * _local15) + (_local16 * _local16)));
var _local17:Number = _local3.m_invMass;
var _local18:Number = _local4.m_invMass;
var _local19:Number = _local3.m_invI;
var _local20:Number = _local4.m_invI;
K1.col1.x = (_local17 + _local18);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local17 + _local18);
K2.col1.x = ((_local19 * _local8) * _local8);
K2.col2.x = ((-(_local19) * _local7) * _local8);
K2.col1.y = ((-(_local19) * _local7) * _local8);
K2.col2.y = ((_local19 * _local7) * _local7);
K3.col1.x = ((_local20 * _local10) * _local10);
K3.col2.x = ((-(_local20) * _local9) * _local10);
K3.col1.y = ((-(_local20) * _local9) * _local10);
K3.col2.y = ((_local20 * _local9) * _local9);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Solve(tImpulse, -(_local15), -(_local16));
var _local21:Number = tImpulse.x;
var _local22:Number = tImpulse.y;
_local3.m_position.x = (_local3.m_position.x - (_local3.m_invMass * _local21));
_local3.m_position.y = (_local3.m_position.y - (_local3.m_invMass * _local22));
_local3.m_rotation = (_local3.m_rotation - (_local3.m_invI * ((_local7 * _local22) - (_local8 * _local21))));
_local3.m_R.Set(_local3.m_rotation);
_local4.m_position.x = (_local4.m_position.x + (_local4.m_invMass * _local21));
_local4.m_position.y = (_local4.m_position.y + (_local4.m_invMass * _local22));
_local4.m_rotation = (_local4.m_rotation + (_local4.m_invI * ((_local9 * _local22) - (_local10 * _local21))));
_local4.m_R.Set(_local4.m_rotation);
var _local23:Number = 0;
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local24 = ((_local4.m_rotation - _local3.m_rotation) - m_intialAngle);
_local25 = 0;
if (m_limitState == e_equalLimits){
_local2 = b2Math.b2Clamp(_local24, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local25 = (-(m_motorMass) * _local2);
_local23 = b2Math.b2Abs(_local2);
} else {
if (m_limitState == e_atLowerLimit){
_local2 = (_local24 - m_lowerAngle);
_local23 = b2Math.b2Max(0, -(_local2));
_local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local25 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local25), 0);
_local25 = (m_limitPositionImpulse - _local1);
} else {
if (m_limitState == e_atUpperLimit){
_local2 = (_local24 - m_upperAngle);
_local23 = b2Math.b2Max(0, _local2);
_local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local25 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local25), 0);
_local25 = (m_limitPositionImpulse - _local1);
};
};
};
_local3.m_rotation = (_local3.m_rotation - (_local3.m_invI * _local25));
_local3.m_R.Set(_local3.m_rotation);
_local4.m_rotation = (_local4.m_rotation + (_local4.m_invI * _local25));
_local4.m_R.Set(_local4.m_rotation);
};
return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local23 <= b2Settings.b2_angularSlop))));
}
}
}//package Box2D.Dynamics.Joints
Section 54
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2RevoluteJointDef extends b2JointDef {
public var anchorPoint:b2Vec2;
public var lowerAngle:Number;
public var upperAngle:Number;
public var motorTorque:Number;
public var motorSpeed:Number;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public function b2RevoluteJointDef(){
type = b2Joint.e_revoluteJoint;
anchorPoint = new b2Vec2(0, 0);
lowerAngle = 0;
upperAngle = 0;
motorTorque = 0;
motorSpeed = 0;
enableLimit = false;
enableMotor = false;
}
}
}//package Box2D.Dynamics.Joints
Section 55
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Common.*;
public class b2Body {
private var sMat0:b2Mat22;
public var m_flags:uint;
public var m_position:b2Vec2;
public var m_rotation:Number;
public var m_R:b2Mat22;
public var m_position0:b2Vec2;
public var m_rotation0:Number;
public var m_linearVelocity:b2Vec2;
public var m_angularVelocity:Number;
public var m_force:b2Vec2;
public var m_torque:Number;
public var m_center:b2Vec2;
public var m_world:b2World;
public var m_prev:b2Body;
public var m_next:b2Body;
public var m_shapeList:b2Shape;
public var m_shapeCount:int;
public var m_jointList:b2JointNode;
public var m_contactList:b2ContactNode;
public var m_mass:Number;
public var m_invMass:Number;
public var m_I:Number;
public var m_invI:Number;
public var m_linearDamping:Number;
public var m_angularDamping:Number;
public var m_sleepTime:Number;
public var m_userData;
public static var e_staticFlag:uint = 1;
public static var e_frozenFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var e_sleepFlag:uint = 8;
public static var e_allowSleepFlag:uint = 16;
public static var e_destroyFlag:uint = 32;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
var _local3:int;
var _local4:b2ShapeDef;
var _local5:b2MassData;
var _local7:b2Vec2;
var _local8:b2Shape;
sMat0 = new b2Mat22();
m_position = new b2Vec2();
m_R = new b2Mat22(0);
m_position0 = new b2Vec2();
super();
m_flags = 0;
m_position.SetV(_arg1.position);
m_rotation = _arg1.rotation;
m_R.Set(m_rotation);
m_position0.SetV(m_position);
m_rotation0 = m_rotation;
m_world = _arg2;
m_linearDamping = b2Math.b2Clamp((1 - _arg1.linearDamping), 0, 1);
m_angularDamping = b2Math.b2Clamp((1 - _arg1.angularDamping), 0, 1);
m_force = new b2Vec2(0, 0);
m_torque = 0;
m_mass = 0;
var _local6:Array = new Array(b2Settings.b2_maxShapesPerBody);
_local3 = 0;
while (_local3 < b2Settings.b2_maxShapesPerBody) {
_local6[_local3] = new b2MassData();
_local3++;
};
m_shapeCount = 0;
m_center = new b2Vec2(0, 0);
_local3 = 0;
while (_local3 < b2Settings.b2_maxShapesPerBody) {
_local4 = _arg1.shapes[_local3];
if (_local4 == null){
break;
};
_local5 = _local6[_local3];
_local4.ComputeMass(_local5);
m_mass = (m_mass + _local5.mass);
m_center.x = (m_center.x + (_local5.mass * (_local4.localPosition.x + _local5.center.x)));
m_center.y = (m_center.y + (_local5.mass * (_local4.localPosition.y + _local5.center.y)));
m_shapeCount++;
_local3++;
};
if (m_mass > 0){
m_center.Multiply((1 / m_mass));
m_position.Add(b2Math.b2MulMV(m_R, m_center));
} else {
m_flags = (m_flags | e_staticFlag);
};
m_I = 0;
_local3 = 0;
while (_local3 < m_shapeCount) {
_local4 = _arg1.shapes[_local3];
_local5 = _local6[_local3];
m_I = (m_I + _local5.I);
_local7 = b2Math.SubtractVV(b2Math.AddVV(_local4.localPosition, _local5.center), m_center);
m_I = (m_I + (_local5.mass * b2Math.b2Dot(_local7, _local7)));
_local3++;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
} else {
m_invMass = 0;
};
if ((((m_I > 0)) && ((_arg1.preventRotation == false)))){
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
m_linearVelocity = b2Math.AddVV(_arg1.linearVelocity, b2Math.b2CrossFV(_arg1.angularVelocity, m_center));
m_angularVelocity = _arg1.angularVelocity;
m_jointList = null;
m_contactList = null;
m_prev = null;
m_next = null;
m_shapeList = null;
_local3 = 0;
while (_local3 < m_shapeCount) {
_local4 = _arg1.shapes[_local3];
_local8 = b2Shape.Create(_local4, this, m_center);
_local8.m_next = m_shapeList;
m_shapeList = _local8;
_local3++;
};
m_sleepTime = 0;
if (_arg1.allowSleep){
m_flags = (m_flags | e_allowSleepFlag);
};
if (_arg1.isSleeping){
m_flags = (m_flags | e_sleepFlag);
};
if ((((m_flags & e_sleepFlag)) || ((m_invMass == 0)))){
m_linearVelocity.Set(0, 0);
m_angularVelocity = 0;
};
m_userData = _arg1.userData;
}
public function SetOriginPosition(_arg1:b2Vec2, _arg2:Number):void{
if (IsFrozen()){
return;
};
m_rotation = _arg2;
m_R.Set(m_rotation);
m_position = b2Math.AddVV(_arg1, b2Math.b2MulMV(m_R, m_center));
m_position0.SetV(m_position);
m_rotation0 = m_rotation;
var _local3:b2Shape = m_shapeList;
while (_local3 != null) {
_local3.Synchronize(m_position, m_R, m_position, m_R);
_local3 = _local3.m_next;
};
m_world.m_broadPhase.Commit();
}
public function GetOriginPosition():b2Vec2{
return (b2Math.SubtractVV(m_position, b2Math.b2MulMV(m_R, m_center)));
}
public function SetCenterPosition(_arg1:b2Vec2, _arg2:Number):void{
if (IsFrozen()){
return;
};
m_rotation = _arg2;
m_R.Set(m_rotation);
m_position.SetV(_arg1);
m_position0.SetV(m_position);
m_rotation0 = m_rotation;
var _local3:b2Shape = m_shapeList;
while (_local3 != null) {
_local3.Synchronize(m_position, m_R, m_position, m_R);
_local3 = _local3.m_next;
};
m_world.m_broadPhase.Commit();
}
public function GetCenterPosition():b2Vec2{
return (m_position);
}
public function GetRotation():Number{
return (m_rotation);
}
public function GetRotationMatrix():b2Mat22{
return (m_R);
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping() == false){
m_force.Add(_arg1);
m_torque = (m_torque + b2Math.b2CrossVV(b2Math.SubtractVV(_arg2, m_position), _arg1));
};
}
public function ApplyTorque(_arg1:Number):void{
if (IsSleeping() == false){
m_torque = (m_torque + _arg1);
};
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping() == false){
m_linearVelocity.Add(b2Math.MulFV(m_invMass, _arg1));
m_angularVelocity = (m_angularVelocity + (m_invI * b2Math.b2CrossVV(b2Math.SubtractVV(_arg2, m_position), _arg1)));
};
}
public function GetMass():Number{
return (m_mass);
}
public function GetInertia():Number{
return (m_I);
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.AddVV(m_position, b2Math.b2MulMV(m_R, _arg1)));
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_R, _arg1));
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_R, b2Math.SubtractVV(_arg1, m_position)));
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_R, _arg1));
}
public function IsStatic():Boolean{
return (((m_flags & e_staticFlag) == e_staticFlag));
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function WakeUp():void{
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 0;
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function GetContactList():b2ContactNode{
return (m_contactList);
}
public function GetJointList():b2JointNode{
return (m_jointList);
}
public function GetNext():b2Body{
return (m_next);
}
public function GetUserData(){
return (m_userData);
}
public function Destroy():void{
var _local2:b2Shape;
var _local1:b2Shape = m_shapeList;
while (_local1) {
_local2 = _local1;
_local1 = _local1.m_next;
b2Shape.Destroy(_local2);
};
}
public function SynchronizeShapes():void{
sMat0.Set(m_rotation0);
var _local1:b2Shape = m_shapeList;
while (_local1 != null) {
_local1.Synchronize(m_position0, sMat0, m_position, m_R);
_local1 = _local1.m_next;
};
}
public function QuickSyncShapes():void{
var _local1:b2Shape = m_shapeList;
while (_local1 != null) {
_local1.QuickSync(m_position, m_R);
_local1 = _local1.m_next;
};
}
public function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointNode = m_jointList;
while (_local2 != null) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
public function Freeze():void{
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
var _local1:b2Shape = m_shapeList;
while (_local1 != null) {
_local1.DestroyProxy();
_local1 = _local1.m_next;
};
}
}
}//package Box2D.Dynamics
Section 56
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2BodyDef {
public var userData;
public var shapes:Array;
public var position:b2Vec2;
public var rotation:Number;
public var linearVelocity:b2Vec2;
public var angularVelocity:Number;
public var linearDamping:Number;
public var angularDamping:Number;
public var allowSleep:Boolean;
public var isSleeping:Boolean;
public var preventRotation:Boolean;
public function b2BodyDef(){
shapes = new Array();
super();
userData = null;
var _local1:int;
while (_local1 < b2Settings.b2_maxShapesPerBody) {
shapes[_local1] = null;
_local1++;
};
position = new b2Vec2(0, 0);
rotation = 0;
linearVelocity = new b2Vec2(0, 0);
angularVelocity = 0;
linearDamping = 0;
angularDamping = 0;
allowSleep = true;
isSleeping = false;
preventRotation = false;
}
public function AddShape(_arg1:b2ShapeDef):void{
var _local2:int;
while (_local2 < b2Settings.b2_maxShapesPerBody) {
if (shapes[_local2] == null){
shapes[_local2] = _arg1;
break;
};
_local2++;
};
}
}
}//package Box2D.Dynamics
Section 57
//b2CollisionFilter (Box2D.Dynamics.b2CollisionFilter)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
public class b2CollisionFilter {
public static var b2_defaultFilter:b2CollisionFilter = new (b2CollisionFilter);
;
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
if ((((_arg1.m_groupIndex == _arg2.m_groupIndex)) && (!((_arg1.m_groupIndex == 0))))){
return ((_arg1.m_groupIndex > 0));
};
var _local3:Boolean = ((!(((_arg1.m_maskBits & _arg2.m_categoryBits) == 0))) && (!(((_arg1.m_categoryBits & _arg2.m_maskBits) == 0))));
return (_local3);
}
}
}//package Box2D.Dynamics
Section 58
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.*;
public class b2ContactManager extends b2PairCallback {
public var m_world:b2World;
public var m_nullContact:b2NullContact;
public var m_destroyImmediate:Boolean;
public function b2ContactManager(){
m_nullContact = new b2NullContact();
super();
m_world = null;
m_destroyImmediate = false;
}
override public function PairAdded(_arg1, _arg2){
var _local8:b2Shape;
var _local9:b2Body;
var _local3:b2Shape = (_arg1 as b2Shape);
var _local4:b2Shape = (_arg2 as b2Shape);
var _local5:b2Body = _local3.m_body;
var _local6:b2Body = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (m_nullContact);
};
if (((!((m_world.m_filter == null))) && ((m_world.m_filter.ShouldCollide(_local3, _local4) == false)))){
return (m_nullContact);
};
if (_local6.m_invMass == 0){
_local8 = _local3;
_local3 = _local4;
_local4 = _local8;
_local9 = _local5;
_local5 = _local6;
_local6 = _local9;
};
var _local7:b2Contact = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator);
if (_local7 == null){
return (m_nullContact);
};
_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;
m_world.m_contactCount++;
return (_local7);
}
override public function PairRemoved(_arg1, _arg2, _arg3):void{
if (_arg3 == null){
return;
};
var _local4:b2Contact = (_arg3 as b2Contact);
if (_local4 != m_nullContact){
if (m_destroyImmediate == true){
DestroyContact(_local4);
_local4 = null;
} else {
_local4.m_flags = (_local4.m_flags | b2Contact.e_destroyFlag);
};
};
}
public function DestroyContact(_arg1:b2Contact):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2ContactNode;
var _local5:b2ContactNode;
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;
};
if (_arg1.GetManifoldCount() > 0){
_local2 = _arg1.m_shape1.m_body;
_local3 = _arg1.m_shape2.m_body;
_local4 = _arg1.m_node1;
_local5 = _arg1.m_node2;
_local2.WakeUp();
_local3.WakeUp();
if (_local4.prev){
_local4.prev.next = _local4.next;
};
if (_local4.next){
_local4.next.prev = _local4.prev;
};
if (_local4 == _local2.m_contactList){
_local2.m_contactList = _local4.next;
};
_local4.prev = null;
_local4.next = null;
if (_local5.prev){
_local5.prev.next = _local5.next;
};
if (_local5.next){
_local5.next.prev = _local5.prev;
};
if (_local5 == _local3.m_contactList){
_local3.m_contactList = _local5.next;
};
_local5.prev = null;
_local5.next = null;
};
b2Contact.Destroy(_arg1, m_world.m_blockAllocator);
m_world.m_contactCount--;
}
public function CleanContactList():void{
var _local2:b2Contact;
var _local1:b2Contact = m_world.m_contactList;
while (_local1 != null) {
_local2 = _local1;
_local1 = _local1.m_next;
if ((_local2.m_flags & b2Contact.e_destroyFlag)){
DestroyContact(_local2);
_local2 = null;
};
};
}
public function Collide():void{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2ContactNode;
var _local4:b2ContactNode;
var _local6:int;
var _local7:int;
var _local5:b2Contact = m_world.m_contactList;
while (_local5 != null) {
if (((_local5.m_shape1.m_body.IsSleeping()) && (_local5.m_shape2.m_body.IsSleeping()))){
} else {
_local6 = _local5.GetManifoldCount();
_local5.Evaluate();
_local7 = _local5.GetManifoldCount();
if ((((_local6 == 0)) && ((_local7 > 0)))){
_local1 = _local5.m_shape1.m_body;
_local2 = _local5.m_shape2.m_body;
_local3 = _local5.m_node1;
_local4 = _local5.m_node2;
_local3.contact = _local5;
_local3.other = _local2;
_local3.prev = null;
_local3.next = _local1.m_contactList;
if (_local3.next != null){
_local3.next.prev = _local5.m_node1;
};
_local1.m_contactList = _local5.m_node1;
_local4.contact = _local5;
_local4.other = _local1;
_local4.prev = null;
_local4.next = _local2.m_contactList;
if (_local4.next != null){
_local4.next.prev = _local4;
};
_local2.m_contactList = _local4;
} else {
if ((((_local6 > 0)) && ((_local7 == 0)))){
_local1 = _local5.m_shape1.m_body;
_local2 = _local5.m_shape2.m_body;
_local3 = _local5.m_node1;
_local4 = _local5.m_node2;
if (_local3.prev){
_local3.prev.next = _local3.next;
};
if (_local3.next){
_local3.next.prev = _local3.prev;
};
if (_local3 == _local1.m_contactList){
_local1.m_contactList = _local3.next;
};
_local3.prev = null;
_local3.next = null;
if (_local4.prev){
_local4.prev.next = _local4.next;
};
if (_local4.next){
_local4.next.prev = _local4.prev;
};
if (_local4 == _local2.m_contactList){
_local2.m_contactList = _local4.next;
};
_local4.prev = null;
_local4.next = null;
};
};
};
_local5 = _local5.m_next;
};
}
}
}//package Box2D.Dynamics
Section 59
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Common.*;
public class b2Island {
public var m_allocator;
public var m_bodies:Array;
public var m_contacts:Array;
public var m_joints:Array;
public var m_bodyCount:int;
public var m_jointCount:int;
public var m_contactCount:int;
public var m_bodyCapacity:int;
public var m_contactCapacity:int;
public var m_jointCapacity:int;
public var m_positionError:Number;
public static var m_positionIterationCount:uint;
public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4):void{
var _local5:int;
super();
m_bodyCapacity = _arg1;
m_contactCapacity = _arg2;
m_jointCapacity = _arg3;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_bodies = new Array(_arg1);
_local5 = 0;
while (_local5 < _arg1) {
m_bodies[_local5] = null;
_local5++;
};
m_contacts = new Array(_arg2);
_local5 = 0;
while (_local5 < _arg2) {
m_contacts[_local5] = null;
_local5++;
};
m_joints = new Array(_arg3);
_local5 = 0;
while (_local5 < _arg3) {
m_joints[_local5] = null;
_local5++;
};
m_allocator = _arg4;
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2):void{
var _local3:int;
var _local4:b2Body;
var _local6:int;
var _local7:Boolean;
var _local8:Boolean;
var _local9:Boolean;
_local3 = 0;
while (_local3 < m_bodyCount) {
_local4 = m_bodies[_local3];
if (_local4.m_invMass == 0){
} else {
_local4.m_linearVelocity.Add(b2Math.MulFV(_arg1.dt, b2Math.AddVV(_arg2, b2Math.MulFV(_local4.m_invMass, _local4.m_force))));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_arg1.dt * _local4.m_invI) * _local4.m_torque));
_local4.m_linearVelocity.Multiply(_local4.m_linearDamping);
_local4.m_angularVelocity = (_local4.m_angularVelocity * _local4.m_angularDamping);
_local4.m_position0.SetV(_local4.m_position);
_local4.m_rotation0 = _local4.m_rotation;
};
_local3++;
};
var _local5:b2ContactSolver = new b2ContactSolver(m_contacts, m_contactCount, m_allocator);
_local5.PreSolve();
_local3 = 0;
while (_local3 < m_jointCount) {
m_joints[_local3].PrepareVelocitySolver();
_local3++;
};
_local3 = 0;
while (_local3 < _arg1.iterations) {
_local5.SolveVelocityConstraints();
_local6 = 0;
while (_local6 < m_jointCount) {
m_joints[_local6].SolveVelocityConstraints(_arg1);
_local6++;
};
_local3++;
};
_local3 = 0;
while (_local3 < m_bodyCount) {
_local4 = m_bodies[_local3];
if (_local4.m_invMass == 0){
} else {
_local4.m_position.x = (_local4.m_position.x + (_arg1.dt * _local4.m_linearVelocity.x));
_local4.m_position.y = (_local4.m_position.y + (_arg1.dt * _local4.m_linearVelocity.y));
_local4.m_rotation = (_local4.m_rotation + (_arg1.dt * _local4.m_angularVelocity));
_local4.m_R.Set(_local4.m_rotation);
};
_local3++;
};
_local3 = 0;
while (_local3 < m_jointCount) {
m_joints[_local3].PreparePositionSolver();
_local3++;
};
if (b2World.s_enablePositionCorrection){
m_positionIterationCount = 0;
while (m_positionIterationCount < _arg1.iterations) {
_local7 = _local5.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local8 = true;
_local3 = 0;
while (_local3 < m_jointCount) {
_local9 = m_joints[_local3].SolvePositionConstraints();
_local8 = ((_local8) && (_local9));
_local3++;
};
if (((_local7) && (_local8))){
break;
};
m_positionIterationCount++;
};
};
_local5.PostSolve();
_local3 = 0;
while (_local3 < m_bodyCount) {
_local4 = m_bodies[_local3];
if (_local4.m_invMass == 0){
} else {
_local4.m_R.Set(_local4.m_rotation);
_local4.SynchronizeShapes();
_local4.m_force.Set(0, 0);
_local4.m_torque = 0;
};
_local3++;
};
}
public function UpdateSleep(_arg1:Number):void{
var _local2:int;
var _local3:b2Body;
var _local4:Number = Number.MAX_VALUE;
var _local5:Number = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
var _local6:Number = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local2 = 0;
while (_local2 < m_bodyCount) {
_local3 = m_bodies[_local2];
if (_local3.m_invMass == 0){
} else {
if ((_local3.m_flags & b2Body.e_allowSleepFlag) == 0){
_local3.m_sleepTime = 0;
_local4 = 0;
};
if (((((((_local3.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local3.m_angularVelocity * _local3.m_angularVelocity) > _local6)))) || ((b2Math.b2Dot(_local3.m_linearVelocity, _local3.m_linearVelocity) > _local5)))){
_local3.m_sleepTime = 0;
_local4 = 0;
} else {
_local3.m_sleepTime = (_local3.m_sleepTime + _arg1);
_local4 = b2Math.b2Min(_local4, _local3.m_sleepTime);
};
};
_local2++;
};
if (_local4 >= b2Settings.b2_timeToSleep){
_local2 = 0;
while (_local2 < m_bodyCount) {
_local3 = m_bodies[_local2];
_local3.m_flags = (_local3.m_flags | b2Body.e_sleepFlag);
_local2++;
};
};
}
public function AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
}
}//package Box2D.Dynamics
Section 60
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var dt:Number;
public var inv_dt:Number;
public var iterations:int;
}
}//package Box2D.Dynamics
Section 61
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2World {
private var step:b2TimeStep;
public var m_blockAllocator;
public var m_stackAllocator;
public var m_broadPhase:b2BroadPhase;
public var m_contactManager:b2ContactManager;
public var m_bodyList:b2Body;
public var m_contactList:b2Contact;
public var m_jointList:b2Joint;
public var m_bodyCount:int;
public var m_contactCount:int;
public var m_jointCount:int;
public var m_bodyDestroyList:b2Body;
public var m_gravity:b2Vec2;
public var m_allowSleep:Boolean;
public var m_groundBody:b2Body;
public var m_listener:b2WorldListener;
public var m_filter:b2CollisionFilter;
public var m_positionIterationCount:int;
public static var s_enablePositionCorrection:int = 1;
public static var s_enableWarmStarting:int = 1;
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
step = new b2TimeStep();
m_contactManager = new b2ContactManager();
super();
m_listener = null;
m_filter = b2CollisionFilter.b2_defaultFilter;
m_bodyList = null;
m_contactList = null;
m_jointList = null;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_bodyDestroyList = null;
m_allowSleep = _arg3;
m_gravity = _arg2;
m_contactManager.m_world = this;
m_broadPhase = new b2BroadPhase(_arg1, m_contactManager);
var _local4:b2BodyDef = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function SetListener(_arg1:b2WorldListener):void{
m_listener = _arg1;
}
public function SetFilter(_arg1:b2CollisionFilter):void{
m_filter = _arg1;
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
var _local2:b2Body = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
public function DestroyBody(_arg1:b2Body):void{
if ((_arg1.m_flags & b2Body.e_destroyFlag)){
return;
};
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;
};
_arg1.m_flags = (_arg1.m_flags | b2Body.e_destroyFlag);
m_bodyCount--;
_arg1.m_prev = null;
_arg1.m_next = m_bodyDestroyList;
m_bodyDestroyList = _arg1;
}
public function CleanBodyList():void{
var _local2:b2Body;
var _local3:b2JointNode;
var _local4:b2JointNode;
m_contactManager.m_destroyImmediate = true;
var _local1:b2Body = m_bodyDestroyList;
while (_local1) {
_local2 = _local1;
_local1 = _local1.m_next;
_local3 = _local2.m_jointList;
while (_local3) {
_local4 = _local3;
_local3 = _local3.next;
if (m_listener){
m_listener.NotifyJointDestroyed(_local4.joint);
};
DestroyJoint(_local4.joint);
};
_local2.Destroy();
};
m_bodyDestroyList = null;
m_contactManager.m_destroyImmediate = false;
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local3:b2Body;
var _local4:b2Shape;
var _local2:b2Joint = b2Joint.Create(_arg1, m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_node1.joint = _local2;
_local2.m_node1.other = _local2.m_body2;
_local2.m_node1.prev = null;
_local2.m_node1.next = _local2.m_body1.m_jointList;
if (_local2.m_body1.m_jointList){
_local2.m_body1.m_jointList.prev = _local2.m_node1;
};
_local2.m_body1.m_jointList = _local2.m_node1;
_local2.m_node2.joint = _local2;
_local2.m_node2.other = _local2.m_body1;
_local2.m_node2.prev = null;
_local2.m_node2.next = _local2.m_body2.m_jointList;
if (_local2.m_body2.m_jointList){
_local2.m_body2.m_jointList.prev = _local2.m_node2;
};
_local2.m_body2.m_jointList = _local2.m_node2;
if (_arg1.collideConnected == false){
_local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.ResetProxy(m_broadPhase);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local5:b2Body;
var _local6:b2Shape;
var _local2:Boolean = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_jointList){
m_jointList = _arg1.m_next;
};
var _local3:b2Body = _arg1.m_body1;
var _local4:b2Body = _arg1.m_body2;
_local3.WakeUp();
_local4.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local4.m_jointList){
_local4.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, m_blockAllocator);
m_jointCount--;
if (_local2 == false){
_local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.ResetProxy(m_broadPhase);
_local6 = _local6.m_next;
};
};
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
public function Step(_arg1:Number, _arg2:int):void{
var _local3:b2Body;
var _local4:b2Body;
var _local12:int;
var _local13:int;
var _local14:b2ContactNode;
var _local15:b2JointNode;
var _local16:uint;
step.dt = _arg1;
step.iterations = _arg2;
if (_arg1 > 0){
step.inv_dt = (1 / _arg1);
} else {
step.inv_dt = 0;
};
m_positionIterationCount = 0;
m_contactManager.CleanContactList();
CleanBodyList();
m_contactManager.Collide();
var _local5:b2Island = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator);
_local3 = m_bodyList;
while (_local3 != null) {
_local3.m_flags = (_local3.m_flags & ~(b2Body.e_islandFlag));
_local3 = _local3.m_next;
};
var _local6:b2Contact = m_contactList;
while (_local6 != null) {
_local6.m_flags = (_local6.m_flags & ~(b2Contact.e_islandFlag));
_local6 = _local6.m_next;
};
var _local7:b2Joint = m_jointList;
while (_local7 != null) {
_local7.m_islandFlag = false;
_local7 = _local7.m_next;
};
var _local8:int = m_bodyCount;
var _local9:Array = new Array(m_bodyCount);
var _local10:int;
while (_local10 < m_bodyCount) {
_local9[_local10] = null;
_local10++;
};
var _local11:b2Body = m_bodyList;
while (_local11 != null) {
if ((_local11.m_flags & (((b2Body.e_staticFlag | b2Body.e_islandFlag) | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){
} else {
_local5.Clear();
_local12 = 0;
var _temp1 = _local12;
_local12 = (_local12 + 1);
var _local17 = _temp1;
_local9[_local17] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
while (_local12 > 0) {
--_local12;
_local3 = _local9[_local12];
_local5.AddBody(_local3);
_local3.m_flags = (_local3.m_flags & ~(b2Body.e_sleepFlag));
if ((_local3.m_flags & b2Body.e_staticFlag)){
} else {
_local14 = _local3.m_contactList;
while (_local14 != null) {
if ((_local14.contact.m_flags & b2Contact.e_islandFlag)){
} else {
_local5.AddContact(_local14.contact);
_local14.contact.m_flags = (_local14.contact.m_flags | b2Contact.e_islandFlag);
_local4 = _local14.other;
if ((_local4.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local12;
_local12 = (_local12 + 1);
var _local18 = _temp2;
_local9[_local18] = _local4;
_local4.m_flags = (_local4.m_flags | b2Body.e_islandFlag);
};
};
_local14 = _local14.next;
};
_local15 = _local3.m_jointList;
while (_local15 != null) {
if (_local15.joint.m_islandFlag == true){
} else {
_local5.AddJoint(_local15.joint);
_local15.joint.m_islandFlag = true;
_local4 = _local15.other;
if ((_local4.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local12;
_local12 = (_local12 + 1);
_local18 = _temp3;
_local9[_local18] = _local4;
_local4.m_flags = (_local4.m_flags | b2Body.e_islandFlag);
};
};
_local15 = _local15.next;
};
};
};
_local5.Solve(step, m_gravity);
m_positionIterationCount = b2Math.b2Max(m_positionIterationCount, b2Island.m_positionIterationCount);
if (m_allowSleep){
_local5.UpdateSleep(_arg1);
};
_local13 = 0;
while (_local13 < _local5.m_bodyCount) {
_local3 = _local5.m_bodies[_local13];
if ((_local3.m_flags & b2Body.e_staticFlag)){
_local3.m_flags = (_local3.m_flags & ~(b2Body.e_islandFlag));
};
if (((_local3.IsFrozen()) && (m_listener))){
_local16 = m_listener.NotifyBoundaryViolated(_local3);
if (_local16 == b2WorldListener.b2_destroyBody){
DestroyBody(_local3);
_local3 = null;
_local5.m_bodies[_local13] = null;
};
};
_local13++;
};
};
_local11 = _local11.m_next;
};
m_broadPhase.Commit();
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array = new Array();
var _local5:int = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
var _local6:int;
while (_local6 < _local5) {
_arg2[_local6] = (_local4[_local6] as b2Shape);
_local6++;
};
return (_local5);
}
public function GetBodyList():b2Body{
return (m_bodyList);
}
public function GetJointList():b2Joint{
return (m_jointList);
}
public function GetContactList():b2Contact{
return (m_contactList);
}
}
}//package Box2D.Dynamics
Section 62
//b2WorldListener (Box2D.Dynamics.b2WorldListener)
package Box2D.Dynamics {
import Box2D.Dynamics.Joints.*;
public class b2WorldListener {
public static var b2_freezeBody:uint = 0;
public static var b2_destroyBody:uint = 1;
public function NotifyJointDestroyed(_arg1:b2Joint):void{
}
public function NotifyBoundaryViolated(_arg1:b2Body):uint{
return (b2_freezeBody);
}
}
}//package Box2D.Dynamics
Section 63
//TransformTool (com.senocular.display.TransformTool)
package com.senocular.display {
import flash.utils.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class TransformTool extends Sprite {
private var toolInvertedMatrix:Matrix;
private var innerRegistration:Point;
private var registrationLog:Dictionary;
private var targetBounds:Rectangle;
private var mouseLoc:Point;
private var mouseOffset:Point;
private var innerMouseLoc:Point;
private var interactionStart:Point;
private var innerInteractionStart:Point;
private var interactionStartAngle:Number;// = 0
private var interactionStartMatrix:Matrix;
private var toolSprites:Sprite;
private var lines:Sprite;
private var moveControls:Sprite;
private var registrationControls:Sprite;
private var rotateControls:Sprite;
private var scaleControls:Sprite;
private var scaleProportionalControls:Sprite;
private var skewControls:Sprite;
private var cursors:Sprite;
private var customControls:Sprite;
private var customCursors:Sprite;
private var _target:DisplayObject;
private var _toolMatrix:Matrix;
private var _globalMatrix:Matrix;
private var _registration:Point;
private var _livePreview:Boolean;// = true
private var _raiseNewTargets:Boolean;// = true
private var _moveNewTargets:Boolean;// = false
private var _moveEnabled:Boolean;// = true
private var _registrationEnabled:Boolean;// = true
private var _rotationEnabled:Boolean;// = true
private var _scaleEnabled:Boolean;// = true
private var _scaleProportionalEnabled:Boolean;// = true
private var _skewEnabled:Boolean;// = true
private var _outlineEnabled:Boolean;// = true
private var _customControlsEnabled:Boolean;// = true
private var _customCursorsEnabled:Boolean;// = true
private var _cursorsEnabled:Boolean;// = true
private var _rememberRegistration:Boolean;// = true
private var _constrainScale:Boolean;// = false
private var _constrainRotationAngle:Number;// = 0.785398163397448
private var _constrainRotation:Boolean;// = false
private var _moveUnderObjects:Boolean;// = true
private var _maintainControlForm:Boolean;// = true
private var _controlSize:Number;// = 8
private var _maxScaleX:Number;// = INF
private var _maxScaleY:Number;// = INF
private var _boundsTopLeft:Point;
private var _boundsTop:Point;
private var _boundsTopRight:Point;
private var _boundsRight:Point;
private var _boundsBottomRight:Point;
private var _boundsBottom:Point;
private var _boundsBottomLeft:Point;
private var _boundsLeft:Point;
private var _boundsCenter:Point;
private var _currentControl:TransformToolControl;
private var _moveControl:TransformToolControl;
private var _registrationControl:TransformToolControl;
private var _outlineControl:TransformToolControl;
private var _scaleTopLeftControl:TransformToolControl;
private var _scaleTopControl:TransformToolControl;
private var _scaleTopRightControl:TransformToolControl;
private var _scaleRightControl:TransformToolControl;
private var _scaleBottomRightControl:TransformToolControl;
private var _scaleBottomControl:TransformToolControl;
private var _scaleBottomLeftControl:TransformToolControl;
private var _scaleLeftControl:TransformToolControl;
private var _rotationTopLeftControl:TransformToolControl;
private var _rotationTopRightControl:TransformToolControl;
private var _rotationBottomRightControl:TransformToolControl;
private var _rotationBottomLeftControl:TransformToolControl;
private var _skewTopControl:TransformToolControl;
private var _skewRightControl:TransformToolControl;
private var _skewBottomControl:TransformToolControl;
private var _skewLeftControl:TransformToolControl;
private var _moveCursor:TransformToolCursor;
private var _registrationCursor:TransformToolCursor;
private var _rotationCursor:TransformToolCursor;
private var _scaleCursor:TransformToolCursor;
private var _skewCursor:TransformToolCursor;
public static const NEW_TARGET:String = "newTarget";
public static const TRANSFORM_TARGET:String = "transformTarget";
public static const TRANSFORM_TOOL:String = "transformTool";
public static const CONTROL_INIT:String = "controlInit";
public static const CONTROL_TRANSFORM_TOOL:String = "controlTransformTool";
public static const CONTROL_DOWN:String = "controlDown";
public static const CONTROL_MOVE:String = "controlMove";
public static const CONTROL_UP:String = "controlUp";
public static const CONTROL_PREFERENCE:String = "controlPreference";
public static const REGISTRATION:String = "registration";
public static const SCALE_TOP_LEFT:String = "scaleTopLeft";
public static const SCALE_TOP:String = "scaleTop";
public static const SCALE_TOP_RIGHT:String = "scaleTopRight";
public static const SCALE_RIGHT:String = "scaleRight";
public static const SCALE_BOTTOM_RIGHT:String = "scaleBottomRight";
public static const SCALE_BOTTOM:String = "scaleBottom";
public static const SCALE_BOTTOM_LEFT:String = "scaleBottomLeft";
public static const SCALE_LEFT:String = "scaleLeft";
public static const ROTATION_TOP_LEFT:String = "rotationTopLeft";
public static const ROTATION_TOP_RIGHT:String = "rotationTopRight";
public static const ROTATION_BOTTOM_RIGHT:String = "rotationBottomRight";
public static const ROTATION_BOTTOM_LEFT:String = "rotationBottomLeft";
public static const SKEW_TOP:String = "skewTop";
public static const SKEW_RIGHT:String = "skewRight";
public static const SKEW_BOTTOM:String = "skewBottom";
public static const SKEW_LEFT:String = "skewLeft";
public static const CURSOR_REGISTRATION:String = "cursorRegistration";
public static const CURSOR_MOVE:String = "cursorMove";
public static const CURSOR_SCALE:String = "cursorScale";
public static const CURSOR_ROTATION:String = "cursorRotate";
public static const CURSOR_SKEW:String = "cursorSkew";
public function TransformTool(){
toolInvertedMatrix = new Matrix();
innerRegistration = new Point();
registrationLog = new Dictionary(true);
targetBounds = new Rectangle();
mouseLoc = new Point();
mouseOffset = new Point();
innerMouseLoc = new Point();
interactionStart = new Point();
innerInteractionStart = new Point();
interactionStartMatrix = new Matrix();
toolSprites = new Sprite();
lines = new Sprite();
moveControls = new Sprite();
registrationControls = new Sprite();
rotateControls = new Sprite();
scaleControls = new Sprite();
scaleProportionalControls = new Sprite();
skewControls = new Sprite();
cursors = new Sprite();
customControls = new Sprite();
customCursors = new Sprite();
_toolMatrix = new Matrix();
_globalMatrix = new Matrix();
_registration = new Point();
_boundsTopLeft = new Point();
_boundsTop = new Point();
_boundsTopRight = new Point();
_boundsRight = new Point();
_boundsBottomRight = new Point();
_boundsBottom = new Point();
_boundsBottomLeft = new Point();
_boundsLeft = new Point();
_boundsCenter = new Point();
super();
createControls();
}
public function get target():DisplayObject{
return (_target);
}
public function set target(_arg1:DisplayObject):void{
if (!_arg1){
if (_target){
_target = null;
updateControlsVisible();
dispatchEvent(new Event(NEW_TARGET));
};
return;
} else {
if ((((((((_arg1 == _target)) || ((_arg1 == this)))) || (contains(_arg1)))) || ((((_arg1 is DisplayObjectContainer)) && ((_arg1 as DisplayObjectContainer).contains(this)))))){
return;
};
_target = _arg1;
updateMatrix();
setNewRegistation();
updateControlsVisible();
if (_raiseNewTargets){
raiseTarget();
};
};
if (!_moveNewTargets){
apply();
};
dispatchEvent(new Event(NEW_TARGET));
if (((((_moveNewTargets) && (_moveEnabled))) && (_moveControl))){
_currentControl = _moveControl;
_currentControl.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_DOWN));
};
}
public function get raiseNewTargets():Boolean{
return (_raiseNewTargets);
}
public function set raiseNewTargets(_arg1:Boolean):void{
_raiseNewTargets = _arg1;
}
public function get moveNewTargets():Boolean{
return (_moveNewTargets);
}
public function set moveNewTargets(_arg1:Boolean):void{
_moveNewTargets = _arg1;
}
public function get livePreview():Boolean{
return (_livePreview);
}
public function set livePreview(_arg1:Boolean):void{
_livePreview = _arg1;
}
public function get controlSize():Number{
return (_controlSize);
}
public function set controlSize(_arg1:Number):void{
if (_controlSize != _arg1){
_controlSize = _arg1;
dispatchEvent(new Event(CONTROL_PREFERENCE));
};
}
public function get maintainControlForm():Boolean{
return (_maintainControlForm);
}
public function set maintainControlForm(_arg1:Boolean):void{
if (_maintainControlForm != _arg1){
_maintainControlForm = _arg1;
dispatchEvent(new Event(CONTROL_PREFERENCE));
};
}
public function get moveUnderObjects():Boolean{
return (_moveUnderObjects);
}
public function set moveUnderObjects(_arg1:Boolean):void{
if (_moveUnderObjects != _arg1){
_moveUnderObjects = _arg1;
dispatchEvent(new Event(CONTROL_PREFERENCE));
};
}
public function get toolMatrix():Matrix{
return (_toolMatrix.clone());
}
public function set toolMatrix(_arg1:Matrix):void{
updateMatrix(_arg1, false);
updateRegistration();
dispatchEvent(new Event(TRANSFORM_TOOL));
}
public function get globalMatrix():Matrix{
var _local1:Matrix = _toolMatrix.clone();
_local1.concat(transform.concatenatedMatrix);
return (_local1);
}
public function set globalMatrix(_arg1:Matrix):void{
updateMatrix(_arg1);
updateRegistration();
dispatchEvent(new Event(TRANSFORM_TOOL));
}
public function get registration():Point{
return (_registration.clone());
}
public function set registration(_arg1:Point):void{
_registration = _arg1.clone();
innerRegistration = toolInvertedMatrix.transformPoint(_registration);
if (_rememberRegistration){
registrationLog[_target] = innerRegistration;
};
dispatchEvent(new Event(TRANSFORM_TOOL));
}
public function get currentControl():TransformToolControl{
return (_currentControl);
}
public function get moveEnabled():Boolean{
return (_moveEnabled);
}
public function set moveEnabled(_arg1:Boolean):void{
if (_moveEnabled != _arg1){
_moveEnabled = _arg1;
updateControlsEnabled();
};
}
public function get registrationEnabled():Boolean{
return (_registrationEnabled);
}
public function set registrationEnabled(_arg1:Boolean):void{
if (_registrationEnabled != _arg1){
_registrationEnabled = _arg1;
updateControlsEnabled();
};
}
public function get rotationEnabled():Boolean{
return (_rotationEnabled);
}
public function set rotationEnabled(_arg1:Boolean):void{
if (_rotationEnabled != _arg1){
_rotationEnabled = _arg1;
updateControlsEnabled();
};
}
public function get scaleProportionalEnabled():Boolean{
return (_scaleProportionalEnabled);
}
public function set scaleProportionalEnabled(_arg1:Boolean):void{
if (_scaleProportionalEnabled != _arg1){
_scaleProportionalEnabled = _arg1;
updateControlsEnabled();
};
}
public function get scaleEnabled():Boolean{
return (_scaleEnabled);
}
public function set scaleEnabled(_arg1:Boolean):void{
if (_scaleEnabled != _arg1){
_scaleEnabled = _arg1;
updateControlsEnabled();
};
}
public function get skewEnabled():Boolean{
return (_skewEnabled);
}
public function set skewEnabled(_arg1:Boolean):void{
if (_skewEnabled != _arg1){
_skewEnabled = _arg1;
updateControlsEnabled();
};
}
public function get outlineEnabled():Boolean{
return (_outlineEnabled);
}
public function set outlineEnabled(_arg1:Boolean):void{
if (_outlineEnabled != _arg1){
_outlineEnabled = _arg1;
updateControlsEnabled();
};
}
public function get cursorsEnabled():Boolean{
return (_cursorsEnabled);
}
public function set cursorsEnabled(_arg1:Boolean):void{
if (_cursorsEnabled != _arg1){
_cursorsEnabled = _arg1;
updateControlsEnabled();
};
}
public function get customControlsEnabled():Boolean{
return (_customControlsEnabled);
}
public function set customControlsEnabled(_arg1:Boolean):void{
if (_customControlsEnabled != _arg1){
_customControlsEnabled = _arg1;
updateControlsEnabled();
dispatchEvent(new Event(CONTROL_PREFERENCE));
};
}
public function get customCursorsEnabled():Boolean{
return (_customCursorsEnabled);
}
public function set customCursorsEnabled(_arg1:Boolean):void{
if (_customCursorsEnabled != _arg1){
_customCursorsEnabled = _arg1;
updateControlsEnabled();
dispatchEvent(new Event(CONTROL_PREFERENCE));
};
}
public function get rememberRegistration():Boolean{
return (_rememberRegistration);
}
public function set rememberRegistration(_arg1:Boolean):void{
_rememberRegistration = _arg1;
if (!_rememberRegistration){
registrationLog = new Dictionary(true);
};
}
public function get constrainScale():Boolean{
return (_constrainScale);
}
public function set constrainScale(_arg1:Boolean):void{
if (_constrainScale != _arg1){
_constrainScale = _arg1;
dispatchEvent(new Event(CONTROL_PREFERENCE));
};
}
public function get constrainRotation():Boolean{
return (_constrainRotation);
}
public function set constrainRotation(_arg1:Boolean):void{
if (_constrainRotation != _arg1){
_constrainRotation = _arg1;
dispatchEvent(new Event(CONTROL_PREFERENCE));
};
}
public function get constrainRotationAngle():Number{
return (((_constrainRotationAngle * 180) / Math.PI));
}
public function set constrainRotationAngle(_arg1:Number):void{
var _local2:Number = ((_arg1 * Math.PI) / 180);
if (_constrainRotationAngle != _local2){
_constrainRotationAngle = _local2;
dispatchEvent(new Event(CONTROL_PREFERENCE));
};
}
public function get maxScaleX():Number{
return (_maxScaleX);
}
public function set maxScaleX(_arg1:Number):void{
_maxScaleX = _arg1;
}
public function get maxScaleY():Number{
return (_maxScaleY);
}
public function set maxScaleY(_arg1:Number):void{
_maxScaleY = _arg1;
}
public function get boundsTopLeft():Point{
return (_boundsTopLeft.clone());
}
public function get boundsTop():Point{
return (_boundsTop.clone());
}
public function get boundsTopRight():Point{
return (_boundsTopRight.clone());
}
public function get boundsRight():Point{
return (_boundsRight.clone());
}
public function get boundsBottomRight():Point{
return (_boundsBottomRight.clone());
}
public function get boundsBottom():Point{
return (_boundsBottom.clone());
}
public function get boundsBottomLeft():Point{
return (_boundsBottomLeft.clone());
}
public function get boundsLeft():Point{
return (_boundsLeft.clone());
}
public function get boundsCenter():Point{
return (_boundsCenter.clone());
}
public function get mouse():Point{
return (new Point(mouseX, mouseY));
}
public function get moveControl():TransformToolControl{
return (_moveControl);
}
public function get registrationControl():TransformToolControl{
return (_registrationControl);
}
public function get outlineControl():TransformToolControl{
return (_outlineControl);
}
public function get scaleTopLeftControl():TransformToolControl{
return (_scaleTopLeftControl);
}
public function get scaleTopControl():TransformToolControl{
return (_scaleTopControl);
}
public function get scaleTopRightControl():TransformToolControl{
return (_scaleTopRightControl);
}
public function get scaleRightControl():TransformToolControl{
return (_scaleRightControl);
}
public function get scaleBottomRightControl():TransformToolControl{
return (_scaleBottomRightControl);
}
public function get scaleBottomControl():TransformToolControl{
return (_scaleBottomControl);
}
public function get scaleBottomLeftControl():TransformToolControl{
return (_scaleBottomLeftControl);
}
public function get scaleLeftControl():TransformToolControl{
return (_scaleLeftControl);
}
public function get rotationTopLeftControl():TransformToolControl{
return (_rotationTopLeftControl);
}
public function get rotationTopRightControl():TransformToolControl{
return (_rotationTopRightControl);
}
public function get rotationBottomRightControl():TransformToolControl{
return (_rotationBottomRightControl);
}
public function get rotationBottomLeftControl():TransformToolControl{
return (_rotationBottomLeftControl);
}
public function get skewTopControl():TransformToolControl{
return (_skewTopControl);
}
public function get skewRightControl():TransformToolControl{
return (_skewRightControl);
}
public function get skewBottomControl():TransformToolControl{
return (_skewBottomControl);
}
public function get skewLeftControl():TransformToolControl{
return (_skewLeftControl);
}
public function get moveCursor():TransformToolCursor{
return (_moveCursor);
}
public function get registrationCursor():TransformToolCursor{
return (_registrationCursor);
}
public function get rotationCursor():TransformToolCursor{
return (_rotationCursor);
}
public function get scaleCursor():TransformToolCursor{
return (_scaleCursor);
}
public function get skewCursor():TransformToolCursor{
return (_skewCursor);
}
override public function toString():String{
return ((("[Transform Tool: target=" + String(_target)) + "]"));
}
private function createControls():void{
_moveControl = new TransformToolMoveShape("move", moveInteraction);
_registrationControl = new TransformToolRegistrationControl(REGISTRATION, registrationInteraction, "registration");
_rotationTopLeftControl = new TransformToolRotateControl(ROTATION_TOP_LEFT, rotationInteraction, "boundsTopLeft");
_rotationTopRightControl = new TransformToolRotateControl(ROTATION_TOP_RIGHT, rotationInteraction, "boundsTopRight");
_rotationBottomRightControl = new TransformToolRotateControl(ROTATION_BOTTOM_RIGHT, rotationInteraction, "boundsBottomRight");
_rotationBottomLeftControl = new TransformToolRotateControl(ROTATION_BOTTOM_LEFT, rotationInteraction, "boundsBottomLeft");
_scaleTopLeftControl = new TransformToolScaleControl(SCALE_TOP_LEFT, scaleBothInteraction, "boundsTopLeft");
_scaleTopControl = new TransformToolScaleControl(SCALE_TOP, scaleYInteraction, "boundsTop");
_scaleTopRightControl = new TransformToolScaleControl(SCALE_TOP_RIGHT, scaleBothInteraction, "boundsTopRight");
_scaleRightControl = new TransformToolScaleControl(SCALE_RIGHT, scaleXInteraction, "boundsRight");
_scaleBottomRightControl = new TransformToolScaleControl(SCALE_BOTTOM_RIGHT, scaleBothInteraction, "boundsBottomRight");
_scaleBottomControl = new TransformToolScaleControl(SCALE_BOTTOM, scaleYInteraction, "boundsBottom");
_scaleBottomLeftControl = new TransformToolScaleControl(SCALE_BOTTOM_LEFT, scaleBothInteraction, "boundsBottomLeft");
_scaleLeftControl = new TransformToolScaleControl(SCALE_LEFT, scaleXInteraction, "boundsLeft");
_skewTopControl = new TransformToolSkewBar(SKEW_TOP, skewXInteraction, "boundsTopRight", "boundsTopLeft", "boundsTopRight");
_skewRightControl = new TransformToolSkewBar(SKEW_RIGHT, skewYInteraction, "boundsBottomRight", "boundsTopRight", "boundsBottomRight");
_skewBottomControl = new TransformToolSkewBar(SKEW_BOTTOM, skewXInteraction, "boundsBottomLeft", "boundsBottomRight", "boundsBottomLeft");
_skewLeftControl = new TransformToolSkewBar(SKEW_LEFT, skewYInteraction, "boundsTopLeft", "boundsBottomLeft", "boundsTopLeft");
_moveCursor = new TransformToolMoveCursor();
_moveCursor.addReference(_moveControl);
_registrationCursor = new TransformToolRegistrationCursor();
_registrationCursor.addReference(_registrationControl);
_rotationCursor = new TransformToolRotateCursor();
_rotationCursor.addReference(_rotationTopLeftControl);
_rotationCursor.addReference(_rotationTopRightControl);
_rotationCursor.addReference(_rotationBottomRightControl);
_rotationCursor.addReference(_rotationBottomLeftControl);
_scaleCursor = new TransformToolScaleCursor();
_scaleCursor.addReference(_scaleTopLeftControl);
_scaleCursor.addReference(_scaleTopControl);
_scaleCursor.addReference(_scaleTopRightControl);
_scaleCursor.addReference(_scaleRightControl);
_scaleCursor.addReference(_scaleBottomRightControl);
_scaleCursor.addReference(_scaleBottomControl);
_scaleCursor.addReference(_scaleBottomLeftControl);
_scaleCursor.addReference(_scaleLeftControl);
_skewCursor = new TransformToolSkewCursor();
_skewCursor.addReference(_skewTopControl);
_skewCursor.addReference(_skewRightControl);
_skewCursor.addReference(_skewBottomControl);
_skewCursor.addReference(_skewLeftControl);
addToolControl(moveControls, _moveControl);
addToolControl(registrationControls, _registrationControl);
addToolControl(rotateControls, _rotationTopLeftControl);
addToolControl(rotateControls, _rotationTopRightControl);
addToolControl(rotateControls, _rotationBottomRightControl);
addToolControl(rotateControls, _rotationBottomLeftControl);
addToolControl(scaleControls, _scaleTopControl);
addToolControl(scaleControls, _scaleRightControl);
addToolControl(scaleControls, _scaleBottomControl);
addToolControl(scaleControls, _scaleLeftControl);
addToolControl(scaleProportionalControls, _scaleTopLeftControl);
addToolControl(scaleProportionalControls, _scaleTopRightControl);
addToolControl(scaleProportionalControls, _scaleBottomRightControl);
addToolControl(scaleProportionalControls, _scaleBottomLeftControl);
addToolControl(skewControls, _skewTopControl);
addToolControl(skewControls, _skewRightControl);
addToolControl(skewControls, _skewBottomControl);
addToolControl(skewControls, _skewLeftControl);
addToolControl(lines, new TransformToolOutline("outline"), false);
addToolControl(cursors, _moveCursor, false);
addToolControl(cursors, _registrationCursor, false);
addToolControl(cursors, _rotationCursor, false);
addToolControl(cursors, _scaleCursor, false);
addToolControl(cursors, _skewCursor, false);
updateControlsEnabled();
}
private function addToolControl(_arg1:Sprite, _arg2:TransformToolControl, _arg3:Boolean=true):void{
_arg2.transformTool = this;
if (_arg3){
_arg2.addEventListener(MouseEvent.MOUSE_DOWN, startInteractionHandler);
};
_arg1.addChild(_arg2);
_arg2.dispatchEvent(new Event(CONTROL_INIT));
}
public function addControl(_arg1:TransformToolControl):void{
addToolControl(customControls, _arg1);
}
public function removeControl(_arg1:TransformToolControl):TransformToolControl{
if (customControls.contains(_arg1)){
customControls.removeChild(_arg1);
return (_arg1);
};
return (null);
}
public function addCursor(_arg1:TransformToolCursor):void{
addToolControl(customCursors, _arg1);
}
public function removeCursor(_arg1:TransformToolCursor):TransformToolCursor{
if (customCursors.contains(_arg1)){
customCursors.removeChild(_arg1);
return (_arg1);
};
return (null);
}
public function setSkin(_arg1:String, _arg2:DisplayObject):void{
var _local3:TransformToolInternalControl = getControlByName(_arg1);
if (_local3){
_local3.skin = _arg2;
};
}
public function getSkin(_arg1:String):DisplayObject{
var _local2:TransformToolInternalControl = getControlByName(_arg1);
return (_local2.skin);
}
private function getControlByName(_arg1:String):TransformToolInternalControl{
var _local2:TransformToolInternalControl;
var _local3:Array = new Array(skewControls, registrationControls, cursors, rotateControls, scaleControls, scaleProportionalControls);
var _local4:int = _local3.length;
while (((_local4--) && ((_local2 == null)))) {
_local2 = (_local3[_local4].getChildByName(_arg1) as TransformToolInternalControl);
};
return (_local2);
}
private function startInteractionHandler(_arg1:MouseEvent):void{
_currentControl = (_arg1.currentTarget as TransformToolControl);
if (_currentControl){
setupInteraction();
};
}
private function setupInteraction():void{
updateMatrix();
apply();
dispatchEvent(new Event(CONTROL_DOWN));
mouseOffset = (((_currentControl) && (_currentControl.referencePoint))) ? _currentControl.referencePoint.subtract(new Point(mouseX, mouseY)) : new Point(0, 0);
updateMouse();
interactionStart = mouseLoc.clone();
innerInteractionStart = innerMouseLoc.clone();
interactionStartMatrix = _toolMatrix.clone();
interactionStartAngle = distortAngle();
if (stage){
stage.addEventListener(MouseEvent.MOUSE_MOVE, interactionHandler);
stage.addEventListener(MouseEvent.MOUSE_UP, endInteractionHandler, false);
stage.addEventListener(MouseEvent.MOUSE_UP, endInteractionHandler, true);
};
}
private function interactionHandler(_arg1:MouseEvent):void{
updateMouse();
_toolMatrix = interactionStartMatrix.clone();
dispatchEvent(new Event(CONTROL_MOVE));
dispatchEvent(new Event(CONTROL_TRANSFORM_TOOL));
if (_livePreview){
apply();
};
_arg1.updateAfterEvent();
}
private function endInteractionHandler(_arg1:MouseEvent):void{
if ((((_arg1.eventPhase == EventPhase.BUBBLING_PHASE)) || (!((_arg1.currentTarget is Stage))))){
return;
};
if (!_livePreview){
apply();
};
var _local2:Stage = (_arg1.currentTarget as Stage);
_local2.removeEventListener(MouseEvent.MOUSE_MOVE, interactionHandler);
_local2.removeEventListener(MouseEvent.MOUSE_UP, endInteractionHandler, false);
_local2.removeEventListener(MouseEvent.MOUSE_UP, endInteractionHandler, true);
dispatchEvent(new Event(CONTROL_UP));
_currentControl = null;
}
public function moveInteraction():void{
var _local1:Point = mouseLoc.subtract(interactionStart);
_toolMatrix.tx = (_toolMatrix.tx + _local1.x);
_toolMatrix.ty = (_toolMatrix.ty + _local1.y);
updateRegistration();
completeInteraction();
}
public function registrationInteraction():void{
_registration.x = mouseLoc.x;
_registration.y = mouseLoc.y;
innerRegistration = toolInvertedMatrix.transformPoint(_registration);
if (_rememberRegistration){
registrationLog[_target] = innerRegistration;
};
completeInteraction();
}
public function rotationInteraction():void{
var _local1:Matrix = transform.concatenatedMatrix;
var _local2:Matrix = _local1.clone();
_local2.invert();
_toolMatrix.concat(_local1);
var _local3:Number = (distortAngle() - interactionStartAngle);
if (_constrainRotation){
if (_local3 > Math.PI){
_local3 = (_local3 - (Math.PI * 2));
} else {
if (_local3 < -(Math.PI)){
_local3 = (_local3 + (Math.PI * 2));
};
};
_local3 = (Math.round((_local3 / _constrainRotationAngle)) * _constrainRotationAngle);
};
_toolMatrix.rotate(_local3);
_toolMatrix.concat(_local2);
completeInteraction(true);
}
public function scaleXInteraction():void{
var _local1:Point = distortOffset(new Point(innerMouseLoc.x, innerInteractionStart.y), (innerInteractionStart.x - innerRegistration.x));
_toolMatrix.a = (_toolMatrix.a + _local1.x);
_toolMatrix.b = (_toolMatrix.b + _local1.y);
completeInteraction(true);
}
public function scaleYInteraction():void{
var _local1:Point = distortOffset(new Point(innerInteractionStart.x, innerMouseLoc.y), (innerInteractionStart.y - innerRegistration.y));
_toolMatrix.c = (_toolMatrix.c + _local1.x);
_toolMatrix.d = (_toolMatrix.d + _local1.y);
completeInteraction(true);
}
public function scaleBothInteraction():void{
var _local4:Point;
var _local5:Point;
var _local6:*;
var _local7:*;
var _local1:Point = innerMouseLoc.clone();
if (_constrainScale){
_local4 = innerMouseLoc.subtract(innerInteractionStart);
_local5 = innerInteractionStart.subtract(innerRegistration);
_local6 = (_local5.x) ? (_local4.x / _local5.x) : 0;
_local7 = (_local5.y) ? (_local4.y / _local5.y) : 0;
if (_local6 > _local7){
_local1.x = (innerInteractionStart.x + (_local5.x * _local7));
} else {
_local1.y = (innerInteractionStart.y + (_local5.y * _local6));
};
};
var _local2:Point = distortOffset(new Point(_local1.x, innerInteractionStart.y), (innerInteractionStart.x - innerRegistration.x));
var _local3:Point = distortOffset(new Point(innerInteractionStart.x, _local1.y), (innerInteractionStart.y - innerRegistration.y));
_toolMatrix.a = (_toolMatrix.a + _local2.x);
_toolMatrix.b = (_toolMatrix.b + _local2.y);
_toolMatrix.c = (_toolMatrix.c + _local3.x);
_toolMatrix.d = (_toolMatrix.d + _local3.y);
completeInteraction(true);
}
public function skewXInteraction():void{
var _local1:Point = distortOffset(new Point(innerMouseLoc.x, innerInteractionStart.y), (innerInteractionStart.y - innerRegistration.y));
_toolMatrix.c = (_toolMatrix.c + _local1.x);
_toolMatrix.d = (_toolMatrix.d + _local1.y);
completeInteraction(true);
}
public function skewYInteraction():void{
var _local1:Point = distortOffset(new Point(innerInteractionStart.x, innerMouseLoc.y), (innerInteractionStart.x - innerRegistration.x));
_toolMatrix.a = (_toolMatrix.a + _local1.x);
_toolMatrix.b = (_toolMatrix.b + _local1.y);
completeInteraction(true);
}
private function distortOffset(_arg1:Point, _arg2:Number):Point{
var _local3:Number = (_arg2) ? (targetBounds.width / _arg2) : 0;
var _local4:Number = (_arg2) ? (targetBounds.height / _arg2) : 0;
_arg1 = interactionStartMatrix.transformPoint(_arg1).subtract(interactionStart);
_arg1.x = (_arg1.x * (targetBounds.width) ? (_local3 / targetBounds.width) : 0);
_arg1.y = (_arg1.y * (targetBounds.height) ? (_local4 / targetBounds.height) : 0);
return (_arg1);
}
private function completeInteraction(_arg1:Boolean=false):void{
var _local2:Point;
enforceLimits();
if (_arg1){
_local2 = _registration.subtract(_toolMatrix.transformPoint(innerRegistration));
_toolMatrix.tx = (_toolMatrix.tx + _local2.x);
_toolMatrix.ty = (_toolMatrix.ty + _local2.y);
};
updateBounds();
}
private function distortAngle():Number{
var _local1:Matrix = transform.concatenatedMatrix;
var _local2:Point = _local1.transformPoint(mouseLoc);
var _local3:Point = _local1.transformPoint(_registration);
var _local4:Point = _local2.subtract(_local3);
return (Math.atan2(_local4.y, _local4.x));
}
private function updateMouse():void{
mouseLoc = new Point(mouseX, mouseY).add(mouseOffset);
innerMouseLoc = toolInvertedMatrix.transformPoint(mouseLoc);
}
private function updateMatrix(_arg1:Matrix=null, _arg2:Boolean=true):void{
var _local3:Matrix;
if (_target){
_toolMatrix = (_arg1) ? _arg1.clone() : _target.transform.concatenatedMatrix.clone();
if (_arg2){
_local3 = transform.concatenatedMatrix;
_local3.invert();
_toolMatrix.concat(_local3);
};
enforceLimits();
toolInvertedMatrix = _toolMatrix.clone();
toolInvertedMatrix.invert();
updateBounds();
};
}
private function updateBounds():void{
if (_target){
targetBounds = _target.getBounds(_target);
_boundsTopLeft = _toolMatrix.transformPoint(new Point(targetBounds.left, targetBounds.top));
_boundsTopRight = _toolMatrix.transformPoint(new Point(targetBounds.right, targetBounds.top));
_boundsBottomRight = _toolMatrix.transformPoint(new Point(targetBounds.right, targetBounds.bottom));
_boundsBottomLeft = _toolMatrix.transformPoint(new Point(targetBounds.left, targetBounds.bottom));
_boundsTop = Point.interpolate(_boundsTopLeft, _boundsTopRight, 0.5);
_boundsRight = Point.interpolate(_boundsTopRight, _boundsBottomRight, 0.5);
_boundsBottom = Point.interpolate(_boundsBottomRight, _boundsBottomLeft, 0.5);
_boundsLeft = Point.interpolate(_boundsBottomLeft, _boundsTopLeft, 0.5);
_boundsCenter = Point.interpolate(_boundsTopLeft, _boundsBottomRight, 0.5);
};
}
private function updateControlsVisible():void{
var _local1:Boolean = contains(toolSprites);
if (_target){
if (!_local1){
addChild(toolSprites);
};
} else {
if (_local1){
removeChild(toolSprites);
};
};
}
private function updateControlsEnabled():void{
updateControlContainer(customCursors, _customCursorsEnabled);
updateControlContainer(cursors, _cursorsEnabled);
updateControlContainer(customControls, _customControlsEnabled);
updateControlContainer(registrationControls, _registrationEnabled);
updateControlContainer(scaleControls, _scaleEnabled);
updateControlContainer(scaleProportionalControls, _scaleProportionalEnabled);
updateControlContainer(skewControls, _skewEnabled);
updateControlContainer(moveControls, _moveEnabled);
updateControlContainer(rotateControls, _rotationEnabled);
updateControlContainer(lines, _outlineEnabled);
}
private function updateControlContainer(_arg1:Sprite, _arg2:Boolean):void{
var _local3:Boolean = toolSprites.contains(_arg1);
if (_arg2){
if (_local3){
toolSprites.setChildIndex(_arg1, 0);
} else {
toolSprites.addChildAt(_arg1, 0);
};
} else {
if (_local3){
toolSprites.removeChild(_arg1);
};
};
}
private function updateRegistration():void{
_registration = _toolMatrix.transformPoint(innerRegistration);
}
private function enforceLimits():void{
var _local1:Number;
var _local2:Number;
var _local5:Matrix;
var _local3:Boolean;
var _local4:Matrix = _toolMatrix.clone();
_local4.concat(transform.concatenatedMatrix);
_local1 = Math.sqrt(((_local4.a * _local4.a) + (_local4.b * _local4.b)));
if (_local1 > _maxScaleX){
_local2 = Math.atan2(_local4.b, _local4.a);
_local4.a = (Math.cos(_local2) * _maxScaleX);
_local4.b = (Math.sin(_local2) * _maxScaleX);
_local3 = true;
};
_local1 = Math.sqrt(((_local4.c * _local4.c) + (_local4.d * _local4.d)));
if (_local1 > _maxScaleY){
_local2 = Math.atan2(_local4.c, _local4.d);
_local4.d = (Math.cos(_local2) * _maxScaleY);
_local4.c = (Math.sin(_local2) * _maxScaleY);
_local3 = true;
};
if (_local3){
_toolMatrix = _local4;
_local5 = transform.concatenatedMatrix;
_local5.invert();
_toolMatrix.concat(_local5);
};
}
private function setNewRegistation():void{
var _local1:Point;
if (((_rememberRegistration) && ((_target in registrationLog)))){
_local1 = registrationLog[_target];
innerRegistration = registrationLog[_target];
} else {
innerRegistration = new Point(0, 0);
};
updateRegistration();
}
private function raiseTarget():void{
var _local1:int = (_target.parent.numChildren - 1);
_target.parent.setChildIndex(_target, _local1);
if (_target.parent == parent){
parent.setChildIndex(this, _local1);
};
}
public function draw():void{
updateMatrix();
dispatchEvent(new Event(TRANSFORM_TOOL));
}
public function apply():void{
var _local1:Matrix;
var _local2:Matrix;
if (_target){
_local1 = _toolMatrix.clone();
_local1.concat(transform.concatenatedMatrix);
if (_target.parent){
_local2 = target.parent.transform.concatenatedMatrix;
_local2.invert();
_local1.concat(_local2);
};
_target.transform.matrix = _local1;
dispatchEvent(new Event(TRANSFORM_TARGET));
};
}
}
}//package com.senocular.display
import flash.events.*;
import flash.display.*;
import flash.geom.*;
class TransformToolInternalControl extends TransformToolControl {
public var interactionMethod:Function;
public var referenceName:String;
public var _skin:DisplayObject;
private function TransformToolInternalControl(_arg1:String, _arg2:Function=null, _arg3:String=null){
this.name = _arg1;
this.interactionMethod = _arg2;
this.referenceName = _arg3;
addEventListener(TransformTool.CONTROL_INIT, init);
}
public function set skin(_arg1:DisplayObject):void{
if (((_skin) && (contains(_skin)))){
removeChild(_skin);
};
_skin = _arg1;
if (_skin){
addChild(_skin);
};
draw();
}
public function get skin():DisplayObject{
return (_skin);
}
override public function get referencePoint():Point{
if ((referenceName in _transformTool)){
return (_transformTool[referenceName]);
};
return (null);
}
protected function init(_arg1:Event):void{
_transformTool.addEventListener(TransformTool.NEW_TARGET, draw);
_transformTool.addEventListener(TransformTool.TRANSFORM_TOOL, draw);
_transformTool.addEventListener(TransformTool.CONTROL_TRANSFORM_TOOL, position);
_transformTool.addEventListener(TransformTool.CONTROL_PREFERENCE, draw);
_transformTool.addEventListener(TransformTool.CONTROL_MOVE, controlMove);
draw();
}
public function draw(_arg1:Event=null):void{
if (_transformTool.maintainControlForm){
counterTransform();
};
position();
}
public function position(_arg1:Event=null):void{
var _local2:Point = referencePoint;
if (_local2){
x = _local2.x;
y = _local2.y;
};
}
private function controlMove(_arg1:Event):void{
if (((!((interactionMethod == null))) && ((_transformTool.currentControl == this)))){
interactionMethod();
};
}
}
class TransformToolMoveShape extends TransformToolInternalControl {
private var lastTarget:DisplayObject;
private function TransformToolMoveShape(_arg1:String, _arg2:Function){
super(_arg1, _arg2);
}
override public function draw(_arg1:Event=null):void{
var _local2:DisplayObject;
var _local4:TransformToolCursor;
var _local3:Boolean = _transformTool.moveUnderObjects;
if (_local3){
hitArea = (_transformTool.target as Sprite);
_local2 = null;
relatedObject = this;
} else {
hitArea = null;
_local2 = _transformTool.target;
relatedObject = (_transformTool.target as InteractiveObject);
};
if (lastTarget != _local2){
if (lastTarget){
lastTarget.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDown, false);
};
if (_local2){
_local2.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown, false, 0, true);
};
_local4 = _transformTool.moveCursor;
_local4.removeReference(lastTarget);
_local4.addReference(_local2);
lastTarget = _local2;
};
}
private function mouseDown(_arg1:MouseEvent):void{
dispatchEvent(new MouseEvent(MouseEvent.MOUSE_DOWN));
}
}
class TransformToolRegistrationControl extends TransformToolInternalControl {
private function TransformToolRegistrationControl(_arg1:String, _arg2:Function, _arg3:String){
super(_arg1, _arg2, _arg3);
}
override public function draw(_arg1:Event=null):void{
graphics.clear();
if (!_skin){
graphics.lineStyle(1, 0);
graphics.beginFill(0xFFFFFF);
graphics.drawCircle(0, 0, (_transformTool.controlSize / 2));
graphics.endFill();
};
super.draw();
}
}
class TransformToolScaleControl extends TransformToolInternalControl {
private function TransformToolScaleControl(_arg1:String, _arg2:Function, _arg3:String){
super(_arg1, _arg2, _arg3);
}
override public function draw(_arg1:Event=null):void{
var _local2:*;
var _local3:Number;
graphics.clear();
if (!_skin){
graphics.lineStyle(2, 0xFFFFFF);
graphics.beginFill(0);
_local2 = _transformTool.controlSize;
_local3 = (_local2 / 2);
graphics.drawRect(-(_local3), -(_local3), _local2, _local2);
graphics.endFill();
};
super.draw();
}
}
class TransformToolRotateControl extends TransformToolInternalControl {
private var locationName:String;
private function TransformToolRotateControl(_arg1:String, _arg2:Function, _arg3:String){
super(_arg1, _arg2);
this.locationName = _arg3;
}
override public function draw(_arg1:Event=null):void{
graphics.clear();
if (!_skin){
graphics.beginFill(0xFF, 0);
graphics.drawCircle(0, 0, (_transformTool.controlSize * 2));
graphics.endFill();
};
super.draw();
}
override public function position(_arg1:Event=null):void{
var _local2:Point;
if ((locationName in _transformTool)){
_local2 = _transformTool[locationName];
x = _local2.x;
y = _local2.y;
};
}
}
class TransformToolSkewBar extends TransformToolInternalControl {
private var locationStart:String;
private var locationEnd:String;
private function TransformToolSkewBar(_arg1:String, _arg2:Function, _arg3:String, _arg4:String, _arg5:String){
super(_arg1, _arg2, _arg3);
this.locationStart = _arg4;
this.locationEnd = _arg5;
}
override public function draw(_arg1:Event=null):void{
var _local4:Matrix;
var _local5:Matrix;
graphics.clear();
if (_skin){
super.draw(_arg1);
return;
};
var _local2:Point = _transformTool[locationStart];
var _local3:Point = _transformTool[locationEnd];
var _local6:Boolean = _transformTool.maintainControlForm;
if (_local6){
_local4 = transform.concatenatedMatrix;
_local5 = _local4.clone();
_local5.invert();
_local2 = _local4.transformPoint(_local2);
_local3 = _local4.transformPoint(_local3);
};
var _local7:Number = (_transformTool.controlSize / 2);
var _local8:Point = _local3.subtract(_local2);
var _local9:Number = (Math.atan2(_local8.y, _local8.x) - (Math.PI / 2));
var _local10:Point = Point.polar(_local7, _local9);
var _local11:Point = _local2.add(_local10);
var _local12:Point = _local3.add(_local10);
var _local13:Point = _local3.subtract(_local10);
var _local14:Point = _local2.subtract(_local10);
if (_local6){
_local11 = _local5.transformPoint(_local11);
_local12 = _local5.transformPoint(_local12);
_local13 = _local5.transformPoint(_local13);
_local14 = _local5.transformPoint(_local14);
};
graphics.beginFill(0xFF0000, 0);
graphics.moveTo(_local11.x, _local11.y);
graphics.lineTo(_local12.x, _local12.y);
graphics.lineTo(_local13.x, _local13.y);
graphics.lineTo(_local14.x, _local14.y);
graphics.lineTo(_local11.x, _local11.y);
graphics.endFill();
}
override public function position(_arg1:Event=null):void{
var _local2:Point;
var _local3:Point;
var _local4:Point;
if (_skin){
_local2 = _transformTool[locationStart];
_local3 = _transformTool[locationEnd];
_local4 = Point.interpolate(_local2, _local3, 0.5);
x = _local4.x;
y = _local4.y;
} else {
x = 0;
y = 0;
draw(_arg1);
};
}
}
class TransformToolOutline extends TransformToolInternalControl {
private function TransformToolOutline(_arg1:String){
super(_arg1);
}
override public function draw(_arg1:Event=null):void{
var _local2:Point = _transformTool.boundsTopLeft;
var _local3:Point = _transformTool.boundsTopRight;
var _local4:Point = _transformTool.boundsBottomRight;
var _local5:Point = _transformTool.boundsBottomLeft;
graphics.clear();
graphics.lineStyle(0, 0);
graphics.moveTo(_local2.x, _local2.y);
graphics.lineTo(_local3.x, _local3.y);
graphics.lineTo(_local4.x, _local4.y);
graphics.lineTo(_local5.x, _local5.y);
graphics.lineTo(_local2.x, _local2.y);
}
override public function position(_arg1:Event=null):void{
draw(_arg1);
}
}
class TransformToolInternalCursor extends TransformToolCursor {
public var offset:Point;
public var icon:Shape;
private function TransformToolInternalCursor(){
offset = new Point();
icon = new Shape();
super();
addChild(icon);
offset = _mouseOffset;
addEventListener(TransformTool.CONTROL_INIT, init);
}
private function init(_arg1:Event):void{
_transformTool.addEventListener(TransformTool.NEW_TARGET, maintainTransform);
_transformTool.addEventListener(TransformTool.CONTROL_PREFERENCE, maintainTransform);
draw();
}
protected function maintainTransform(_arg1:Event):void{
var _local2:Matrix;
offset = _mouseOffset;
if (_transformTool.maintainControlForm){
transform.matrix = new Matrix();
_local2 = transform.concatenatedMatrix;
_local2.invert();
transform.matrix = _local2;
offset = _local2.deltaTransformPoint(offset);
};
updateVisible(_arg1);
}
protected function drawArc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean=true):void{
var _local12:int;
var _local7:Number = (_arg5 - _arg4);
var _local8:Number = (1 + Math.floor((Math.abs(_local7) / (Math.PI / 4))));
var _local9:Number = (_local7 / (2 * _local8));
var _local10:Number = Math.cos(_local9);
var _local11:Number = (_local10) ? (_arg3 / _local10) : 0;
if (_arg6){
icon.graphics.moveTo((_arg1 + (Math.cos(_arg4) * _arg3)), (_arg2 - (Math.sin(_arg4) * _arg3)));
} else {
icon.graphics.lineTo((_arg1 + (Math.cos(_arg4) * _arg3)), (_arg2 - (Math.sin(_arg4) * _arg3)));
};
_local12 = 0;
while (_local12 < _local8) {
_arg5 = (_arg4 + _local9);
_arg4 = (_arg5 + _local9);
icon.graphics.curveTo((_arg1 + (Math.cos(_arg5) * _local11)), (_arg2 - (Math.sin(_arg5) * _local11)), (_arg1 + (Math.cos(_arg4) * _arg3)), (_arg2 - (Math.sin(_arg4) * _arg3)));
_local12++;
};
}
protected function getGlobalAngle(_arg1:Point):Number{
var _local2:Matrix = _transformTool.globalMatrix;
_arg1 = _local2.deltaTransformPoint(_arg1);
return ((Math.atan2(_arg1.y, _arg1.x) * (180 / Math.PI)));
}
override public function position(_arg1:Event=null):void{
if (parent){
x = (parent.mouseX + offset.x);
y = (parent.mouseY + offset.y);
};
}
public function draw():void{
icon.graphics.beginFill(0);
icon.graphics.lineStyle(1, 0xFFFFFF);
}
}
class TransformToolRegistrationCursor extends TransformToolInternalCursor {
private function TransformToolRegistrationCursor(){
}
override public function draw():void{
super.draw();
icon.graphics.drawCircle(0, 0, 2);
icon.graphics.drawCircle(0, 0, 4);
icon.graphics.endFill();
}
}
class TransformToolMoveCursor extends TransformToolInternalCursor {
private function TransformToolMoveCursor(){
}
override public function draw():void{
super.draw();
icon.graphics.moveTo(1, 1);
icon.graphics.lineTo(1, -2);
icon.graphics.lineTo(-1, -2);
icon.graphics.lineTo(2, -6);
icon.graphics.lineTo(5, -2);
icon.graphics.lineTo(3, -2);
icon.graphics.lineTo(3, 1);
icon.graphics.lineTo(6, 1);
icon.graphics.lineTo(6, -1);
icon.graphics.lineTo(10, 2);
icon.graphics.lineTo(6, 5);
icon.graphics.lineTo(6, 3);
icon.graphics.lineTo(3, 3);
icon.graphics.lineTo(3, 5);
icon.graphics.lineTo(3, 6);
icon.graphics.lineTo(5, 6);
icon.graphics.lineTo(2, 10);
icon.graphics.lineTo(-1, 6);
icon.graphics.lineTo(1, 6);
icon.graphics.lineTo(1, 5);
icon.graphics.lineTo(1, 3);
icon.graphics.lineTo(-2, 3);
icon.graphics.lineTo(-2, 5);
icon.graphics.lineTo(-6, 2);
icon.graphics.lineTo(-2, -1);
icon.graphics.lineTo(-2, 1);
icon.graphics.lineTo(1, 1);
icon.graphics.endFill();
}
}
class TransformToolScaleCursor extends TransformToolInternalCursor {
private function TransformToolScaleCursor(){
}
override public function draw():void{
super.draw();
icon.graphics.moveTo(4.5, -0.5);
icon.graphics.lineTo(4.5, -2.5);
icon.graphics.lineTo(8.5, 0.5);
icon.graphics.lineTo(4.5, 3.5);
icon.graphics.lineTo(4.5, 1.5);
icon.graphics.lineTo(-0.5, 1.5);
icon.graphics.lineTo(-3.5, 1.5);
icon.graphics.lineTo(-3.5, 3.5);
icon.graphics.lineTo(-7.5, 0.5);
icon.graphics.lineTo(-3.5, -2.5);
icon.graphics.lineTo(-3.5, -0.5);
icon.graphics.lineTo(4.5, -0.5);
icon.graphics.endFill();
}
override public function updateVisible(_arg1:Event=null):void{
var _local2:TransformToolScaleControl;
super.updateVisible(_arg1);
if (_arg1){
_local2 = (_arg1.target as TransformToolScaleControl);
if (_local2){
switch (_local2){
case _transformTool.scaleTopLeftControl:
case _transformTool.scaleBottomRightControl:
icon.rotation = ((getGlobalAngle(new Point(0, 100)) + getGlobalAngle(new Point(100, 0))) / 2);
break;
case _transformTool.scaleTopRightControl:
case _transformTool.scaleBottomLeftControl:
icon.rotation = ((getGlobalAngle(new Point(0, -100)) + getGlobalAngle(new Point(100, 0))) / 2);
break;
case _transformTool.scaleTopControl:
case _transformTool.scaleBottomControl:
icon.rotation = getGlobalAngle(new Point(0, 100));
break;
default:
icon.rotation = getGlobalAngle(new Point(100, 0));
};
};
};
}
}
class TransformToolRotateCursor extends TransformToolInternalCursor {
private function TransformToolRotateCursor(){
}
override public function draw():void{
super.draw();
var _local1:Number = Math.PI;
var _local2:Number = (-(Math.PI) / 2);
drawArc(0, 0, 4, _local1, _local2);
drawArc(0, 0, 6, _local2, _local1, false);
icon.graphics.lineTo(-8, 0);
icon.graphics.lineTo(-5, 4);
icon.graphics.lineTo(-2, 0);
icon.graphics.lineTo(-4, 0);
icon.graphics.endFill();
}
}
class TransformToolSkewCursor extends TransformToolInternalCursor {
private function TransformToolSkewCursor(){
}
override public function draw():void{
super.draw();
icon.graphics.moveTo(-6, -1);
icon.graphics.lineTo(6, -1);
icon.graphics.lineTo(6, -4);
icon.graphics.lineTo(10, 1);
icon.graphics.lineTo(-6, 1);
icon.graphics.lineTo(-6, -1);
icon.graphics.endFill();
super.draw();
icon.graphics.moveTo(10, 5);
icon.graphics.lineTo(-2, 5);
icon.graphics.lineTo(-2, 8);
icon.graphics.lineTo(-6, 3);
icon.graphics.lineTo(10, 3);
icon.graphics.lineTo(10, 5);
icon.graphics.endFill();
}
override public function updateVisible(_arg1:Event=null):void{
var _local2:TransformToolSkewBar;
super.updateVisible(_arg1);
if (_arg1){
_local2 = (_arg1.target as TransformToolSkewBar);
if (_local2){
switch (_local2){
case _transformTool.skewLeftControl:
case _transformTool.skewRightControl:
icon.rotation = getGlobalAngle(new Point(0, 100));
break;
default:
icon.rotation = getGlobalAngle(new Point(100, 0));
};
};
};
}
}
Section 64
//TransformToolControl (com.senocular.display.TransformToolControl)
package com.senocular.display {
import flash.display.*;
import flash.geom.*;
public class TransformToolControl extends MovieClip {
protected var _transformTool:TransformTool;
protected var _referencePoint:Point;
protected var _relatedObject:InteractiveObject;
public function TransformToolControl(){
_relatedObject = this;
}
public function get transformTool():TransformTool{
return (_transformTool);
}
public function set transformTool(_arg1:TransformTool):void{
_transformTool = _arg1;
}
public function get relatedObject():InteractiveObject{
return (_relatedObject);
}
public function set relatedObject(_arg1:InteractiveObject):void{
_relatedObject = (_arg1) ? _arg1 : this;
}
public function get referencePoint():Point{
return (_referencePoint);
}
public function set referencePoint(_arg1:Point):void{
_referencePoint = _arg1;
}
public function counterTransform():void{
transform.matrix = new Matrix();
var _local1:Matrix = transform.concatenatedMatrix;
_local1.invert();
transform.matrix = _local1;
}
}
}//package com.senocular.display
Section 65
//TransformToolCursor (com.senocular.display.TransformToolCursor)
package com.senocular.display {
import flash.utils.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class TransformToolCursor extends TransformToolControl {
protected var _mouseOffset:Point;
protected var contact:Boolean;// = false
protected var active:Boolean;// = false
protected var references:Dictionary;
public function TransformToolCursor(){
_mouseOffset = new Point(20, 20);
references = new Dictionary(true);
super();
addEventListener(TransformTool.CONTROL_INIT, init);
}
public function get mouseOffset():Point{
return (_mouseOffset.clone());
}
public function set mouseOffset(_arg1:Point):void{
_mouseOffset = _arg1;
}
public function addReference(_arg1:DisplayObject):void{
if (((_arg1) && (!(references[_arg1])))){
references[_arg1] = true;
addReferenceListeners(_arg1);
};
}
public function removeReference(_arg1:DisplayObject):DisplayObject{
if (((_arg1) && (references[_arg1]))){
removeReferenceListeners(_arg1);
delete references[_arg1];
return (_arg1);
};
return (null);
}
public function updateVisible(_arg1:Event=null):void{
if (active){
if (!visible){
visible = true;
};
} else {
if (visible != contact){
visible = contact;
};
};
position(_arg1);
}
public function position(_arg1:Event=null):void{
if (parent){
x = (parent.mouseX + mouseOffset.x);
y = (parent.mouseY + mouseOffset.y);
};
}
private function init(_arg1:Event):void{
_transformTool.addEventListener(TransformTool.TRANSFORM_TOOL, position, false, 0, true);
_transformTool.addEventListener(TransformTool.NEW_TARGET, referenceUnset, false, 0, true);
_transformTool.addEventListener(TransformTool.CONTROL_TRANSFORM_TOOL, position, false, 0, true);
_transformTool.addEventListener(TransformTool.CONTROL_DOWN, controlMouseDown, false, 0, true);
_transformTool.addEventListener(TransformTool.CONTROL_MOVE, controlMove, false, 0, true);
_transformTool.addEventListener(TransformTool.CONTROL_UP, controlMouseUp, false, 0, true);
updateVisible(_arg1);
position(_arg1);
}
private function addReferenceListeners(_arg1:DisplayObject):void{
_arg1.addEventListener(MouseEvent.MOUSE_MOVE, referenceMove, false, 0, true);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, referenceSet, false, 0, true);
_arg1.addEventListener(MouseEvent.ROLL_OVER, referenceSet, false, 0, true);
_arg1.addEventListener(MouseEvent.ROLL_OUT, referenceUnset, false, 0, true);
}
private function removeReferenceListeners(_arg1:DisplayObject):void{
_arg1.removeEventListener(MouseEvent.MOUSE_MOVE, referenceMove, false);
_arg1.removeEventListener(MouseEvent.MOUSE_DOWN, referenceSet, false);
_arg1.removeEventListener(MouseEvent.ROLL_OVER, referenceSet, false);
_arg1.removeEventListener(MouseEvent.ROLL_OUT, referenceUnset, false);
}
protected function referenceMove(_arg1:MouseEvent):void{
position(_arg1);
_arg1.updateAfterEvent();
}
protected function referenceSet(_arg1:Event):void{
contact = true;
if (!_transformTool.currentControl){
updateVisible(_arg1);
};
}
protected function referenceUnset(_arg1:Event):void{
contact = false;
if (!_transformTool.currentControl){
updateVisible(_arg1);
};
}
protected function controlMouseDown(_arg1:Event):void{
if (references[_transformTool.currentControl.relatedObject]){
active = true;
};
updateVisible(_arg1);
}
protected function controlMove(_arg1:Event):void{
if (references[_transformTool.currentControl.relatedObject]){
position(_arg1);
};
}
protected function controlMouseUp(_arg1:Event):void{
if (references[_transformTool.currentControl.relatedObject]){
active = false;
};
updateVisible(_arg1);
}
}
}//package com.senocular.display
Section 66
//Base64 (com.Base64)
package com {
import flash.utils.*;
public class Base64 {
private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
public static const version:String = "1.1.0";
public function Base64(){
throw (new Error("Base64 class is static container only"));
}
public static function encode(_arg1:String):String{
var _local2:ByteArray = new ByteArray();
_local2.writeUTFBytes(_arg1);
_local2.compress();
return (encodeByteArray(_local2));
}
public static function encodeByteArray(_arg1:ByteArray):String{
var _local3:Array;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local2 = "";
var _local4:Array = new Array(4);
_arg1.position = 0;
while (_arg1.bytesAvailable > 0) {
_local3 = new Array();
_local5 = 0;
while ((((_local5 < 3)) && ((_arg1.bytesAvailable > 0)))) {
_local3[_local5] = _arg1.readUnsignedByte();
_local5++;
};
_local4[0] = ((_local3[0] & 252) >> 2);
_local4[1] = (((_local3[0] & 3) << 4) | (_local3[1] >> 4));
_local4[2] = (((_local3[1] & 15) << 2) | (_local3[2] >> 6));
_local4[3] = (_local3[2] & 63);
_local6 = _local3.length;
while (_local6 < 3) {
_local4[(_local6 + 1)] = 64;
_local6++;
};
_local7 = 0;
while (_local7 < _local4.length) {
_local2 = (_local2 + BASE64_CHARS.charAt(_local4[_local7]));
_local7++;
};
};
return (_local2);
}
public static function decode(_arg1:String):String{
var _local2:ByteArray = decodeToByteArray(_arg1);
_local2.uncompress();
return (_local2.readUTFBytes(_local2.length));
}
public static function decodeToByteArray(_arg1:String):ByteArray{
var _local6:uint;
var _local7:uint;
var _local2:ByteArray = new ByteArray();
var _local3:Array = new Array(4);
var _local4:Array = new Array(3);
var _local5:uint;
while (_local5 < _arg1.length) {
_local6 = 0;
while ((((_local6 < 4)) && (((_local5 + _local6) < _arg1.length)))) {
_local3[_local6] = BASE64_CHARS.indexOf(_arg1.charAt((_local5 + _local6)));
_local6++;
};
_local4[0] = ((_local3[0] << 2) + ((_local3[1] & 48) >> 4));
_local4[1] = (((_local3[1] & 15) << 4) + ((_local3[2] & 60) >> 2));
_local4[2] = (((_local3[2] & 3) << 6) + _local3[3]);
_local7 = 0;
while (_local7 < _local4.length) {
if (_local3[(_local7 + 1)] == 64){
break;
};
_local2.writeByte(_local4[_local7]);
_local7++;
};
_local5 = (_local5 + 4);
};
_local2.position = 0;
return (_local2);
}
}
}//package com
Section 67
//bumperLight_75 (com.bumperLight_75)
package com {
import flash.display.*;
public dynamic class bumperLight_75 extends MovieClip {
public function bumperLight_75(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package com
Section 68
//CB_button_mc_5 (com.CB_button_mc_5)
package com {
import flash.events.*;
import flash.display.*;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.text.*;
public dynamic class CB_button_mc_5 extends MovieClip {
public var buttonText:TextField;
public var w:Number;
public var h:Number;
public var txt:String;
public var newText:String;
public var n:uint;
public var char:String;
public function CB_button_mc_5(){
addFrameScript(0, frame1);
}
public function enlarge(_arg1:MouseEvent):void{
var _local2:* = new Tween(this, "width", Elastic.easeOut, w, (w * 1.5), 1, true);
var _local3:* = new Tween(this, "height", Elastic.easeOut, h, (h * 1.5), 1, true);
}
public function reduce(_arg1:MouseEvent):void{
var _local2:* = new Tween(this, "width", Elastic.easeOut, (w * 1.5), w, 1, true);
var _local3:* = new Tween(this, "height", Elastic.easeOut, (h * 1.5), h, 1, true);
}
function frame1(){
var _local1:*;
stop();
w = this.width;
h = this.height;
txt = this.name;
newText = "";
n = 0;
while (n < txt.length) {
char = txt.charAt(n);
if (char != "_"){
newText = (newText + char);
} else {
newText = (newText + " ");
};
_local1 = (n + 1);
n = _local1;
};
buttonText.text = newText;
buttonText.mouseEnabled = false;
this.addEventListener(MouseEvent.MOUSE_OVER, enlarge);
this.addEventListener(MouseEvent.MOUSE_OUT, reduce);
}
}
}//package com
Section 69
//nose_mc_121 (com.nose_mc_121)
package com {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public dynamic class nose_mc_121 extends MovieClip {
public var noseY:int;
public function nose_mc_121(){
addFrameScript(0, frame1);
}
public function sniff():void{
this.y = (this.y - 3);
setTimeout(unsniff, 100);
setTimeout(resniff, 200);
setTimeout(unsniff, 300);
var _local1:* = new Timer(((Math.random() * 5000) + 2000), 1);
_local1.start();
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, sniffAgain);
}
public function unsniff():void{
this.y = noseY;
}
public function resniff():void{
this.y = (this.y - 3);
}
public function sniffAgain(_arg1:TimerEvent):void{
sniff();
}
function frame1(){
noseY = this.y;
sniff();
}
}
}//package com
Section 70
//pigEyes_mc_120 (com.pigEyes_mc_120)
package com {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public dynamic class pigEyes_mc_120 extends MovieClip {
public var eyeHeight:int;
public function pigEyes_mc_120(){
addFrameScript(0, frame1);
}
public function blink():void{
this.height = 3;
setTimeout(unblink, 150);
var _local1:* = new Timer(((Math.random() * 4000) + 1000), 1);
_local1.start();
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, blinkAgain);
}
public function unblink():void{
this.height = eyeHeight;
}
public function blinkAgain(_arg1:TimerEvent):void{
blink();
}
function frame1(){
eyeHeight = this.height;
blink();
}
}
}//package com
Section 71
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class AdLoader extends Sprite {
private var cpmstarLoader:Loader;
private var contentspotid:String;
public function AdLoader(_arg1:String){
this.contentspotid = _arg1;
addEventListener(Event.ADDED, addedHandler);
}
private function addedHandler(_arg1:Event):void{
removeEventListener(Event.ADDED, addedHandler);
Security.allowDomain("server.cpmstar.com");
var _local2 = "http://server.cpmstar.com/adviewas3.swf";
var _local3:DisplayObjectContainer = parent;
cpmstarLoader = new Loader();
cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler);
cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler);
cpmstarLoader.load(new URLRequest(((_local2 + "?contentspotid=") + contentspotid)));
addChild(cpmstarLoader);
}
private function dispatchHandler(_arg1:Event):void{
dispatchEvent(_arg1);
}
}
}//package CPMStar
Section 72
//Elastic (fl.transitions.easing.Elastic)
package fl.transitions.easing {
public class Elastic {
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
--_arg1;
return ((-(((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
return (((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) + _arg3) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * (0.3 * 1.5));
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
};
--_arg1;
return ((((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) * 0.5) + _arg3) + _arg2));
}
}
}//package fl.transitions.easing
Section 73
//None (fl.transitions.easing.None)
package fl.transitions.easing {
public class None {
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package fl.transitions.easing
Section 74
//Strong (fl.transitions.easing.Strong)
package fl.transitions.easing {
public class Strong {
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2));
}
}
}//package fl.transitions.easing
Section 75
//Tween (fl.transitions.Tween)
package fl.transitions {
import flash.utils.*;
import flash.events.*;
import flash.display.*;
public class Tween extends EventDispatcher {
public var isPlaying:Boolean;// = false
public var obj:Object;// = null
public var prop:String;// = ""
public var func:Function;
public var begin:Number;// = NAN
public var change:Number;// = NAN
public var useSeconds:Boolean;// = false
public var prevTime:Number;// = NAN
public var prevPos:Number;// = NAN
public var looping:Boolean;// = false
private var _duration:Number;// = NAN
private var _time:Number;// = NAN
private var _fps:Number;// = NAN
private var _position:Number;// = NAN
private var _startTime:Number;// = NAN
private var _intervalID:uint;// = 0
private var _finish:Number;// = NAN
private var _timer:Timer;// = null
protected static var _mc:MovieClip = new MovieClip();
public function Tween(_arg1:Object, _arg2:String, _arg3:Function, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean=false){
this.func = function (_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
};
super();
if (!arguments.length){
return;
};
this.obj = _arg1;
this.prop = _arg2;
this.begin = _arg4;
this.position = _arg4;
this.duration = _arg6;
this.useSeconds = _arg7;
if ((_arg3 is Function)){
this.func = _arg3;
};
this.finish = _arg5;
this._timer = new Timer(100);
this.start();
}
public function get time():Number{
return (this._time);
}
public function set time(_arg1:Number):void{
this.prevTime = this._time;
if (_arg1 > this.duration){
if (this.looping){
this.rewind((_arg1 - this._duration));
this.update();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_LOOP, this._time, this._position));
} else {
if (this.useSeconds){
this._time = this._duration;
this.update();
};
this.stop();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_FINISH, this._time, this._position));
};
} else {
if (_arg1 < 0){
this.rewind();
this.update();
} else {
this._time = _arg1;
this.update();
};
};
}
public function get duration():Number{
return (this._duration);
}
public function set duration(_arg1:Number):void{
this._duration = ((_arg1)<=0) ? Infinity : _arg1;
}
public function get FPS():Number{
return (this._fps);
}
public function set FPS(_arg1:Number):void{
var _local2:Boolean = this.isPlaying;
this.stopEnterFrame();
this._fps = _arg1;
if (_local2){
this.startEnterFrame();
};
}
public function get position():Number{
return (this.getPosition(this._time));
}
public function set position(_arg1:Number):void{
this.setPosition(_arg1);
}
public function getPosition(_arg1:Number=NaN):Number{
if (isNaN(_arg1)){
_arg1 = this._time;
};
return (this.func(_arg1, this.begin, this.change, this._duration));
}
public function setPosition(_arg1:Number):void{
this.prevPos = this._position;
if (this.prop.length){
this.obj[this.prop] = (this._position = _arg1);
};
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_CHANGE, this._time, this._position));
}
public function get finish():Number{
return ((this.begin + this.change));
}
public function set finish(_arg1:Number):void{
this.change = (_arg1 - this.begin);
}
public function continueTo(_arg1:Number, _arg2:Number):void{
this.begin = this.position;
this.finish = _arg1;
if (!isNaN(_arg2)){
this.duration = _arg2;
};
this.start();
}
public function yoyo():void{
this.continueTo(this.begin, this.time);
}
protected function startEnterFrame():void{
var _local1:Number;
if (isNaN(this._fps)){
_mc.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, false, 0, true);
} else {
_local1 = (1000 / this._fps);
this._timer.delay = _local1;
this._timer.addEventListener(TimerEvent.TIMER, this.timerHandler, false, 0, true);
this._timer.start();
};
this.isPlaying = true;
}
protected function stopEnterFrame():void{
if (isNaN(this._fps)){
_mc.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
} else {
this._timer.stop();
};
this.isPlaying = false;
}
public function start():void{
this.rewind();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_START, this._time, this._position));
}
public function stop():void{
this.stopEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_STOP, this._time, this._position));
}
public function resume():void{
this.fixTime();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_RESUME, this._time, this._position));
}
public function rewind(_arg1:Number=0):void{
this._time = _arg1;
this.fixTime();
this.update();
}
public function fforward():void{
this.time = this._duration;
this.fixTime();
}
public function nextFrame():void{
if (this.useSeconds){
this.time = ((getTimer() - this._startTime) / 1000);
} else {
this.time = (this._time + 1);
};
}
protected function onEnterFrame(_arg1:Event):void{
this.nextFrame();
}
protected function timerHandler(_arg1:TimerEvent):void{
this.nextFrame();
_arg1.updateAfterEvent();
}
public function prevFrame():void{
if (!this.useSeconds){
this.time = (this._time - 1);
};
}
private function fixTime():void{
if (this.useSeconds){
this._startTime = (getTimer() - (this._time * 1000));
};
}
private function update():void{
this.setPosition(this.getPosition(this._time));
}
}
}//package fl.transitions
Section 76
//TweenEvent (fl.transitions.TweenEvent)
package fl.transitions {
import flash.events.*;
public class TweenEvent extends Event {
public var time:Number;// = NAN
public var position:Number;// = NAN
public static const MOTION_START:String = "motionStart";
public static const MOTION_STOP:String = "motionStop";
public static const MOTION_FINISH:String = "motionFinish";
public static const MOTION_CHANGE:String = "motionChange";
public static const MOTION_RESUME:String = "motionResume";
public static const MOTION_LOOP:String = "motionLoop";
public function TweenEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false){
super(_arg1, _arg4, _arg5);
this.time = _arg2;
this.position = _arg3;
}
override public function clone():Event{
return (new TweenEvent(this.type, this.time, this.position, this.bubbles, this.cancelable));
}
}
}//package fl.transitions
Section 77
//arrowButton_mc_221 (mooo_fla.arrowButton_mc_221)
package mooo_fla {
import flash.display.*;
public dynamic class arrowButton_mc_221 extends MovieClip {
public var bg:MovieClip;
public function arrowButton_mc_221(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package mooo_fla
Section 78
//checkBox_mc_241 (mooo_fla.checkBox_mc_241)
package mooo_fla {
import flash.display.*;
public dynamic class checkBox_mc_241 extends MovieClip {
public function checkBox_mc_241(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package mooo_fla
Section 79
//eraserButton_mc_223 (mooo_fla.eraserButton_mc_223)
package mooo_fla {
import flash.display.*;
public dynamic class eraserButton_mc_223 extends MovieClip {
public var bg:MovieClip;
public function eraserButton_mc_223(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package mooo_fla
Section 80
//MainTimeline (mooo_fla.MainTimeline)
package mooo_fla {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import flash.utils.*;
import flash.events.*;
import SWFStats.*;
import flash.display.*;
import fl.transitions.*;
import flash.net.*;
import com.senocular.display.*;
import flash.geom.*;
import fl.transitions.easing.*;
import com.*;
import Box2D.Common.*;
import flash.media.*;
import CPMStar.*;
import flash.text.*;
import flash.system.*;
import flash.external.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var myPreloader:MovieClip;
public var stageAssets:MovieClip;
public var adBox:MovieClip;
public var _Continue_:CB_button_mc_5;
public var intro:Intro_TurboNuke;
public var blackOut:blackScreen_mc;
public var turboNuke:SimpleButton;
public var currentURL2:String;
public var allowedURL2:String;
public var onKong:Boolean;
public var CPMStarContentSpotID:String;
public var ad:DisplayObject;
public var finished:Boolean;
public var counter:uint;
public var counterMax:uint;
public var fps:Number;
public var fpsStartTime:Number;
public var fpsNewTime:Number;
public var fpsElapsedTime:Number;
public var fpsCounter:Number;
public var grav:Number;
public var maxAngVel:Number;
public var torque:Number;
public var levelButtonStart:Number;
public var buttonSpeed:Number;
public var buttonDistToTarget:Number;
public var rotationSpeed:Number;
public var gameZoneRadius:Number;
public var tickerStart:Number;
public var gunSpeed:Number;
public var scrollSpeed:Number;
public var scrollSpeedScale:Number;
public var slowBarValue:Number;
public var slowBarStartValue:Number;
public var scrolled:Number;
public var bubbleSpeedX:Number;
public var bubbleSpeedY:Number;
public var impulseSize:Number;
public var numberOfLevels;
public var currentLevel:uint;
public var highestLevel:uint;
public var oink:int;
public var so:SharedObject;
public var alwaysUnlocked:uint;
public var score:uint;
public var bestScore:uint;
public var kinetroidsDestroyed:uint;
public var livesLost:uint;
public var startOfLevelScore:uint;
public var bonusLifeScore:uint;
public var bonusLifeInterval:uint;
public var numberOfPucks:uint;
public var numberOfTargets:uint;
public var lives:int;
public var startLives:int;
public var targetsReached:uint;
public var numberOfTravelators:uint;
public var bonus:Number;
public var discsUsed:uint;
public var bonusTweenNumber:uint;
public var tickerSection:uint;
public var levelsPlayed:uint;
public var levelOffset:int;
public var numberOfHintBoxes:uint;
public var numberOfTeleports:uint;
public var teleportPair:uint;
public var numberOfEGs:uint;
public var rapidFireCounter:uint;
public var numberOfStages:uint;
public var myBallRadius:uint;
public var storeBallY:int;
public var maxBallY:int;
public var stillCounter:int;
public var userRating:uint;
public var pageNumber:uint;
public var levelsInDatabase:uint;
public var lastButtonPressed:String;
public var editString:String;
public var userString:String;
public var levelObject:Object;
public var editMode:Boolean;
public var userMode:Boolean;
public var gameRunning:Boolean;
public var gameOver:Boolean;
public var gameWon:Boolean;
public var submitSuccess:Boolean;
public var arrowLeftDownFlag:Boolean;
public var arrowRightDownFlag:Boolean;
public var adjusting:Boolean;
public var leftKeyDown:Boolean;
public var rightKeyDown:Boolean;
public var upKeyDown:Boolean;
public var downKeyDown:Boolean;
public var mouseIsDown:Boolean;
public var preventFiring:Boolean;
public var crosshairsOn:Boolean;
public var cleaned:Boolean;
public var targetReached:Boolean;
public var soundOn:Boolean;
public var musicOn:Boolean;
public var checkForCollisions:Boolean;
public var fadePuckIn:Boolean;
public var hintBoxExists:Boolean;
public var disableReset:Boolean;
public var securityOn:Boolean;
public var rapidFireOn:Boolean;
public var tickerPresent:Boolean;
public var killed:Boolean;
public var placing:Boolean;
public var lastLevelReached:Boolean;
public var groundCreated:Boolean;
public var aim:Boolean;
public var waitForMouseUp:Boolean;
public var flying:Boolean;
public var delayStart:Boolean;
public var newGame:Boolean;
public var retrying:Boolean;
public var levelIsComplete:Boolean;
public var eraserOn:Boolean;
public var itemHolderVisible:Boolean;
public var sortByNewest:Boolean;
public var editorHelpShown:Boolean;
public var editorError:Boolean;
public var levelTested:Boolean;
public var bombExploded:Boolean;
public var cowOffScreen:Boolean;
public var m_physScale:Number;
public var m_world:b2World;
public var m_timeStep:Number;
public var m_iterations:int;
public var lastBody1:b2Body;
public var lastBody2:b2Body;
public var myBall:b2Body;
public var myCow:b2Body;
public var myTarget:b2Body;
public var crosshairs:crosshairs_mc;
public var menu:menu_mc;
public var instructions:instructions_mc;
public var highscores:highscores_mc;
public var levelSelect:levelSelect_mc;
public var gui:gui_mc;
public var glints:glints_mc;
public var levelInfo:levelInfo_mc;
public var debug:debug_mc;
public var gameOverScreen:gameOverScreen_mc;
public var confirmQuit:MovieClip;
public var confirmReset:confirmReset_mc;
public var gun:gun_mc;
public var gunShadow:gunShadow_mc;
public var puckYellow:MovieClip;
public var targetYellow:targetYellow_mc;
public var puckBlue:MovieClip;
public var targetBlue:targetBlue_mc;
public var puckGreen:MovieClip;
public var targetGreen:targetGreen_mc;
public var puckRed:MovieClip;
public var targetRed:targetRed_mc;
public var blackScreen:blackScreen_mc;
public var soundToggle:soundToggle_mc;
public var musicToggle:musicToggle_mc;
public var ticker:ticker_mc;
public var hintBox:hintBox_mc;
public var background1:MovieClip;
public var background2:MovieClip;
public var background3:MovieClip;
public var background4:MovieClip;
public var gloss:gloss_mc;
public var awards:awards_mc;
public var sky:blueGradient_mc;
public var ground:MovieClip;
public var arrow:MovieClip;
public var oldArrow:MovieClip;
public var editor:MovieClip;
public var outputPanel:MovieClip;
public var inputPanel:MovieClip;
public var currentMC:MovieClip;
public var userLevelSelect:MovieClip;
public var authorForm:MovieClip;
public var ratingForm:MovieClip;
public var keyboardTarget:MovieClip;
public var projectCanvas:Sprite;
public var gameCanvas:Sprite;
public var gunCanvas:Sprite;
public var backgroundCanvas:Sprite;
public var editorCanvas:Sprite;
public var sideWall:Array;
public var teleportArray:Array;
public var puckArray:Array;
public var targetArray:Array;
public var tweenArray:Array;
public var travelator:Array;
public var hintBoxArray:Array;
public var hint:Array;
public var bonusTweenArray:Array;
public var tickerArray:Array;
public var starArray:Array;
public var myBallArray:Array;
public var pigArray:Array;
public var haystackArray:Array;
public var levelStringArray:Array;
public var egArray:Array;
public var fadeOutTween:Tween;
public var fadeInTween:Tween;
public var centre:Point;
public var musicChannel:SoundChannel;
public var musicTransform:SoundTransform;
public var musicSound;
public var winSound:win;
public var popSound:pop;
public var explosionSound;
public var oink1Sound;
public var hsLoader:URLLoader;
public var currentURL:String;
public var allowedURL:String;
public var allowedLocal:String;
public var currTool:TransformTool;
public var userLevelArray:Array;
public var addedRowArray:Array;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
public function gotoTurboNuke(_arg1:MouseEvent):void{
var _local2 = "http://www.turbonuke.com?gamereferal=Mooo";
var _local3:URLRequest = new URLRequest(_local2);
navigateToURL(_local3);
Log.CustomMetric("ClickedSponsorsLinks", "Links");
}
public function loader(_arg1:Event){
if (counter < counterMax){
counter++;
} else {
counter = counterMax;
};
var _local2:Number = ((100 * counter) / counterMax);
var _local3:* = stage.loaderInfo.bytesTotal;
var _local4:* = stage.loaderInfo.bytesLoaded;
var _local5:* = Math.round(((_local4 * 100) / _local3));
myPreloader.loadingBar.width = (2 * (_local5 + _local2));
myPreloader.loadingText.text = (("Loading: " + String(Math.round(((_local5 + _local2) / 2)))) + "%");
if ((((((_local4 >= _local3)) && ((finished == false)))) && ((counter >= counterMax)))){
myPreloader.loadingText.text = "Loading: 100%";
finished = true;
end_preload();
};
}
public function end_preload():void{
removeEventListener(Event.ENTER_FRAME, loader);
_Continue_.visible = true;
if (onKong == false){
_Continue_.addEventListener(MouseEvent.MOUSE_DOWN, removeAd);
} else {
nextFrame();
};
}
public function gotoNextFrame():void{
removeChild(adBox);
nextFrame();
}
public function removeAd(_arg1:MouseEvent):void{
removeChild(adBox);
_Continue_.removeEventListener(MouseEvent.MOUSE_DOWN, end_preload);
nextFrame();
}
public function initialise():void{
projectCanvas = new Sprite();
stage.addChild(projectCanvas);
var _local1:* = new overlay_mc();
stage.addChild(_local1);
_local1.blendMode = BlendMode.MULTIPLY;
_local1.alpha = 0.3;
_local1.mouseEnabled = false;
crosshairs = new crosshairs_mc();
stage.addChild(crosshairs);
crosshairs.visible = false;
setupArrays();
soundToggle = new soundToggle_mc();
soundToggle.stop();
stage.addChild(soundToggle);
musicToggle = new musicToggle_mc();
musicToggle.stop();
stage.addChild(musicToggle);
showMenu();
initialiseSoundToggle();
initialiseMusicToggle();
musicChannel = musicSound.play(0, 100);
storeHints();
blackScreen = new blackScreen_mc();
stage.addChild(blackScreen);
setTimeout(loseBlack, 1500);
}
public function showScores(_arg1:MouseEvent):void{
var _local2 = "http://www.arcadetown.com/galaxochimp/view_high_scores.asp";
var _local3:URLRequest = new URLRequest(_local2);
navigateToURL(_local3);
}
public function showScoreSubmissionScreen(_arg1:MouseEvent):void{
gameOverScreen.submissionScreen.visible = true;
gameOverScreen.submissionScreen.message.text = "";
gameOverScreen.submissionScreen._Submit_.addEventListener(MouseEvent.MOUSE_DOWN, submitScore);
gameOverScreen.submissionScreen.close.addEventListener(MouseEvent.MOUSE_DOWN, removeScoreSubmissionScreen);
}
public function removeScoreSubmissionScreen(_arg1:MouseEvent):void{
gameOverScreen.submissionScreen.visible = false;
gameOverScreen.submissionScreen._Submit_.removeEventListener(MouseEvent.MOUSE_DOWN, submitScore);
gameOverScreen.submissionScreen.close.removeEventListener(MouseEvent.MOUSE_DOWN, removeScoreSubmissionScreen);
}
public function submitScore(_arg1:MouseEvent):void{
var _local2:String;
var _local3:*;
var _local4:String;
var _local5:URLRequest;
if (((!((gameOverScreen.submissionScreen.playerName.text == ""))) && (!((gameOverScreen.submissionScreen.playerName.text == "Player Name"))))){
_local2 = ((gameOverScreen.submissionScreen.playerName.text + "|") + String(score));
_local3 = EncrpytString(_local2);
trace(_local3);
_local4 = ("http://www.arcadetown.com/galaxochimp/hs.asp?" + _local3);
_local5 = new URLRequest(_local4);
navigateToURL(_local5);
gameOverScreen.submissionScreen._Submit_.removeEventListener(MouseEvent.MOUSE_DOWN, submitScore);
gameOverScreen.submissionScreen.close.removeEventListener(MouseEvent.MOUSE_DOWN, removeScoreSubmissionScreen);
gameOverScreen.submissionScreen.visible = false;
gameOverScreen._Submit_Score_.visible = false;
} else {
gameOverScreen.submissionScreen.message.text = "Please enter a name!";
};
}
public function onConnectError(_arg1:String):void{
}
public function loseBlack():void{
stage.removeChild(blackScreen);
}
public function storeHints():void{
hint[1] = "Use the mouse to aim and fire bullets at objects on the screen.";
hint[2] = "Use the left and right arrow keys (or A and D) to move your cannon left or right";
hint[3] = "";
hint[4] = "Watch out for Kinetroids - they will try to push your puck over the blue lines!";
hint[5] = "Use the up arrow (or W) to increase the vertical speed";
hint[6] = "Get more points for firing less discs";
hint[7] = "Get each puck to the target with the same colour.";
hint[8] = "Get a new life for every 4000 points";
hint[9] = "There are 30 levels - can you clear them all?";
hint[30] = "Final level !!";
}
public function addTicker():void{
tickerPresent = true;
tickerSection = 0;
ticker = new ticker_mc();
projectCanvas.addChild(ticker);
ticker.x = 0;
ticker.y = 176;
tickerStart = ticker.mc.textField.x;
ticker.mc.textField.x = (tickerStart + 600);
ticker.mc.textField.text = tickerArray[tickerSection];
ticker.mc.textField.autoSize = TextFieldAutoSize.LEFT;
ticker.addEventListener(Event.ENTER_FRAME, scrollTicker);
}
public function scrollTicker(_arg1:Event):void{
ticker.mc.textField.x = (ticker.mc.textField.x - 3);
if (ticker.mc.textField.x < (tickerStart - ticker.mc.textField.width)){
ticker.mc.textField.x = (tickerStart + 600);
tickerSection++;
if (tickerSection >= tickerArray.length){
tickerSection = 0;
};
ticker.mc.textField.text = tickerArray[tickerSection];
ticker.mc.textField.autoSize = TextFieldAutoSize.LEFT;
};
}
public function showMenu():void{
editMode = false;
userMode = false;
soundToggle.x = 545;
soundToggle.y = 562;
musicToggle.x = 520;
musicToggle.y = 560;
menu = new menu_mc();
projectCanvas.addChild(menu);
menu.credits.visible = false;
menu._More_Games_.addEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
menu._Add_to_Website_.addEventListener(MouseEvent.MOUSE_DOWN, gotoHostGame);
menu.turboNuke.addEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
menu._Credits_.addEventListener(MouseEvent.MOUSE_DOWN, showCredits);
if (securityOn == true){
if (((!((currentURL.indexOf(allowedURL, 0) == -1))) || (!((currentURL.indexOf(allowedLocal, 0) == -1))))){
menu._Play_.addEventListener(MouseEvent.MOUSE_DOWN, fadeInLevelSelect);
} else {
menu.warningMessage.text = "Please go to andromedus.com to host this game";
};
} else {
menu._Play_.addEventListener(MouseEvent.MOUSE_DOWN, fadeInLevelSelect);
};
if (tickerPresent == false){
addTicker();
};
ticker.visible = true;
menu._editor_.addEventListener(MouseEvent.CLICK, menuToEditor);
}
public function showCredits(_arg1:MouseEvent):void{
menu._Credits_.removeEventListener(MouseEvent.MOUSE_DOWN, showCredits);
menu.credits.visible = true;
menu.credits._Close_.addEventListener(MouseEvent.MOUSE_DOWN, hideCredits);
menu.credits.andromedusButton.addEventListener(MouseEvent.MOUSE_DOWN, gotoAndromedus);
}
public function hideCredits(_arg1:MouseEvent):void{
menu._Credits_.addEventListener(MouseEvent.MOUSE_DOWN, showCredits);
menu.credits.visible = false;
menu.credits._Close_.removeEventListener(MouseEvent.MOUSE_DOWN, hideCredits);
menu.credits.andromedusButton.removeEventListener(MouseEvent.MOUSE_DOWN, gotoAndromedus);
}
public function moveBubble(_arg1:Event):void{
}
public function gotoArmorBlog(_arg1:MouseEvent):void{
var _local2 = "http://www.armorblog.com";
var _local3:URLRequest = new URLRequest(_local2);
navigateToURL(_local3);
}
public function gotoKinetikz(_arg1:MouseEvent):void{
var _local2 = "http://armorgames.com/play/1032/kinetikz";
var _local3:URLRequest = new URLRequest(_local2);
navigateToURL(_local3);
}
public function gotoKinetikz2(_arg1:MouseEvent):void{
var _local2 = "http://armorgames.com/play/1953/kinetikz-2";
var _local3:URLRequest = new URLRequest(_local2);
navigateToURL(_local3);
}
public function gotoAndromedus(_arg1:MouseEvent):void{
var _local2 = "http://www.andromedus.com";
var _local3:URLRequest = new URLRequest(_local2);
navigateToURL(_local3);
Log.CustomMetric("ClickedDeveloperLink", "Links");
}
public function gotoFullScreen(_arg1:MouseEvent):void{
var _local2 = "http://www.arcadetown.com/galaxochimp/download.asp";
var _local3:URLRequest = new URLRequest(_local2);
navigateToURL(_local3);
}
public function gotoHostGame(_arg1:MouseEvent):void{
var _local2 = "http://www.turbonuke.com/addgame.php#Mooo";
var _local3:URLRequest = new URLRequest(_local2);
navigateToURL(_local3);
Log.CustomMetric("ClickedAddToWebsite", "Links");
}
public function menuToEditor(_arg1:MouseEvent){
fadeInOut();
setTimeout(removeMenu, 500);
setTimeout(showEditor, 501);
}
public function showEditor():void{
Log.CustomMetric("UsedLevelEditor", "Actions");
editor = new levelEditor_mc();
projectCanvas.addChild(editor);
editor._exit_.addEventListener(MouseEvent.CLICK, editorToMenu);
initEditor();
}
public function editorToMenu(_arg1:MouseEvent):void{
fadeInOut();
setTimeout(removeEditor, 500);
setTimeout(showMenu, 501);
}
public function removeEditor():void{
cleanEditor();
editor._exit_.removeEventListener(MouseEvent.CLICK, editorToMenu);
projectCanvas.removeChild(editor);
}
public function removeMenu():void{
menu._editor_.removeEventListener(MouseEvent.CLICK, menuToEditor);
menu.removeEventListener(Event.ENTER_FRAME, moveBubble);
menu._Play_.removeEventListener(MouseEvent.MOUSE_DOWN, fadeInLevelSelect);
menu._More_Games_.removeEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
menu._Add_to_Website_.removeEventListener(MouseEvent.MOUSE_DOWN, gotoHostGame);
menu.turboNuke.removeEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
menu._Credits_.removeEventListener(MouseEvent.MOUSE_DOWN, showCredits);
projectCanvas.removeChild(menu);
}
public function showInstructions(_arg1:MouseEvent):void{
removeMenu();
ticker.visible = false;
soundToggle.x = 82;
soundToggle.y = 533;
musicToggle.x = 53;
musicToggle.y = 525;
instructions = new instructions_mc();
projectCanvas.addChild(instructions);
instructions.menuButton.addEventListener(MouseEvent.MOUSE_DOWN, removeInstructions);
instructions.guiInstance.quitButton.addEventListener(MouseEvent.MOUSE_DOWN, removeInstructions);
}
public function removeInstructions(_arg1:MouseEvent):void{
instructions.menuButton.removeEventListener(MouseEvent.MOUSE_DOWN, removeInstructions);
instructions.guiInstance.quitButton.removeEventListener(MouseEvent.MOUSE_DOWN, removeInstructions);
projectCanvas.removeChild(instructions);
showMenu();
ticker.visible = true;
}
public function showHighscoresOnClick(_arg1:MouseEvent):void{
showHighscores();
}
public function showHighscores(){
}
public function fadeInLevelSelect(_arg1:MouseEvent):void{
fadeInOut();
setTimeout(removeMenu, 500);
setTimeout(showLevelSelect, 501);
Log.Play();
}
public function showLevelSelect():void{
score = 0;
newGame = true;
ticker.visible = false;
levelSelect = new levelSelect_mc();
projectCanvas.addChild(levelSelect);
levelSelect.background.scenery.posts.visible = false;
levelSelect._Back_.addEventListener(MouseEvent.MOUSE_DOWN, fadeToMenu);
levelSelect.levelButtonHolder.addEventListener(MouseEvent.MOUSE_DOWN, selectLevel);
levelSelect._Player_Levels_.addEventListener(MouseEvent.MOUSE_DOWN, fadeInUserLevels);
lockLevels();
}
public function fadeInUserLevels(_arg1:MouseEvent):void{
fadeInOut();
setTimeout(removeLevelSelect, 500);
pageNumber = 1;
setTimeout(showUserLevels, 501);
}
public function showUserLevels():void{
Log.CustomMetric("PlayedUserLevels", "Actions");
userLevelSelect = new userLevelSelect_mc();
projectCanvas.addChild(userLevelSelect);
userLevelSelect.background.scenery.posts.visible = false;
userLevelSelect._Back_.addEventListener(MouseEvent.CLICK, userLevelSelectToMenu);
userLevelSelect.nextArrow.addEventListener(MouseEvent.CLICK, nextPage);
userLevelSelect.previousArrow.addEventListener(MouseEvent.CLICK, previousPage);
userLevelSelect.nextArrow.visible = false;
userLevelSelect.previousArrow.visible = false;
updateCheckBoxes();
userLevelSelect.sortNewest.mouseChildren = false;
userLevelSelect.sortHighest.mouseChildren = false;
userLevelSelect.sortNewest.addEventListener(MouseEvent.MOUSE_OVER, glowItems);
userLevelSelect.sortHighest.addEventListener(MouseEvent.MOUSE_OVER, glowItems);
userLevelSelect.sortNewest.addEventListener(MouseEvent.MOUSE_OUT, unglowItems);
userLevelSelect.sortHighest.addEventListener(MouseEvent.MOUSE_OUT, unglowItems);
userLevelSelect.sortNewest.addEventListener(MouseEvent.CLICK, setSortNewest);
userLevelSelect.sortHighest.addEventListener(MouseEvent.CLICK, setSortHighest);
fetchUserLevels();
}
public function userLevelSelectToMenu(_arg1:MouseEvent):void{
fadeInOut();
setTimeout(removeUserLevels, 500);
setTimeout(showMenu, 501);
}
public function removeUserLevels():void{
userLevelSelect._Back_.removeEventListener(MouseEvent.CLICK, userLevelSelectToMenu);
projectCanvas.removeChild(userLevelSelect);
}
public function fadeInAwards(_arg1:MouseEvent):void{
fadeInOut();
setTimeout(removeMenu, 500);
setTimeout(showAwards, 501);
}
public function showAwards():void{
}
public function fadeOutAwards(_arg1:MouseEvent):void{
awards.menuButton.removeEventListener(MouseEvent.MOUSE_DOWN, fadeOutAwards);
fadeInOut();
setTimeout(removeAwards, 500);
}
public function removeAwards():void{
awards.menuButton.removeEventListener(MouseEvent.MOUSE_DOWN, fadeOutAwards);
projectCanvas.removeChild(awards);
showMenu();
ticker.visible = true;
}
public function removeLevelSelect():void{
levelSelect._Player_Levels_.removeEventListener(MouseEvent.MOUSE_DOWN, fadeInUserLevels);
levelSelect.levelButtonHolder.removeEventListener(MouseEvent.MOUSE_DOWN, selectLevel);
projectCanvas.removeChild(levelSelect);
}
public function fadeToMenu(_arg1:MouseEvent):void{
levelSelect._Back_.removeEventListener(MouseEvent.MOUSE_DOWN, fadeToMenu);
fadeInOut();
setTimeout(returnToMenu, 500);
}
public function returnToMenu():void{
removeLevelSelect();
showMenu();
ticker.visible = true;
}
public function selectLevel(_arg1:MouseEvent):void{
currentLevel = parseInt(_arg1.target.name.substring("level".length));
if ((((currentLevel <= alwaysUnlocked)) || ((currentLevel <= highestLevel)))){
blackScreen = new blackScreen_mc();
blackScreen.alpha = 0;
stage.addChild(blackScreen);
fadeInTween = new Tween(blackScreen, "alpha", None.easeNone, 0, 1, 0.5, true);
fadeInTween.addEventListener(TweenEvent.MOTION_FINISH, fadeOutBlackScreen);
};
}
public function fadeOutBlackScreen(_arg1:TweenEvent):void{
fadeInTween.removeEventListener(TweenEvent.MOTION_FINISH, fadeOutBlackScreen);
removeLevelSelect();
ticker.removeEventListener(Event.ENTER_FRAME, scrollTicker);
projectCanvas.removeChild(ticker);
tickerPresent = false;
setInitialVariables();
Log.Play();
initialiseGame();
fadeOutTween = new Tween(blackScreen, "alpha", None.easeNone, 1, 0, 0.5, true);
fadeOutTween.addEventListener(TweenEvent.MOTION_FINISH, removeBlackScreen);
}
public function showInfo():void{
levelInfo = new levelInfo_mc();
projectCanvas.addChild(levelInfo);
levelInfo._More_Games_.addEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
levelInfo.turboNuke.addEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
levelInfo.m1.text = (("Now starting level " + String(currentLevel)) + ".");
levelInfo.m2.text = "Good luck!";
levelInfo.m3.text = "";
levelInfo.m4.text = "";
levelInfo._Menu_.addEventListener(MouseEvent.MOUSE_DOWN, infoToMenu);
levelInfo._Continue_.addEventListener(MouseEvent.MOUSE_DOWN, fadeInfoOut);
}
public function infoToMenu(_arg1:MouseEvent):void{
fadeInOut();
setTimeout(removeInfo, 500);
setTimeout(showMenu, 501);
}
public function fadeInfoOut(_arg1:MouseEvent):void{
fadeInOut();
setTimeout(removeInfo, 500);
if (gameWon == false){
setTimeout(initialiseGame, 501);
} else {
setTimeout(showGameOverScreen, 501);
};
}
public function removeInfo():void{
levelInfo._Continue_.removeEventListener(MouseEvent.MOUSE_DOWN, fadeInfoOut);
levelInfo._More_Games_.removeEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
levelInfo.turboNuke.removeEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
levelInfo._Menu_.removeEventListener(MouseEvent.MOUSE_DOWN, infoToMenu);
projectCanvas.removeChild(levelInfo);
}
public function showGameOverScreen():void{
gameRunning = false;
gameOverScreen = new gameOverScreen_mc();
projectCanvas.addChild(gameOverScreen);
gameOverScreen.background.scenery.posts.visible = false;
gameOverScreen.submissionScreen.visible = false;
gameOverScreen._Menu_.addEventListener(MouseEvent.MOUSE_DOWN, removeGameOverScreen);
gameOverScreen._More_Games_.addEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
gameOverScreen.turboNuke.addEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
if (soundOn == true){
winSound.play();
};
}
public function retryLevel(_arg1:MouseEvent):void{
submitSuccess = false;
gameOverScreen._Menu_.removeEventListener(MouseEvent.MOUSE_DOWN, removeGameOverScreen);
gameOverScreen._Try_Again_.removeEventListener(MouseEvent.MOUSE_DOWN, retryLevel);
gameOverScreen._Submit_Score_.removeEventListener(MouseEvent.MOUSE_DOWN, submitScore);
projectCanvas.removeChild(gameOverScreen);
if (gameWon == false){
cleanUp();
} else {
gameWon = false;
};
setInitialVariables();
retrying = true;
showInfo();
}
public function setInitialVariables():void{
gameWon = false;
bonusLifeScore = bonusLifeInterval;
lives = startLives;
levelsPlayed = 0;
kinetroidsDestroyed = 0;
}
public function removeGameOverScreen(_arg1:MouseEvent):void{
submitSuccess = false;
gameOverScreen._Menu_.removeEventListener(MouseEvent.MOUSE_DOWN, removeGameOverScreen);
gameOverScreen._More_Games_.removeEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
gameOverScreen.turboNuke.removeEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
setTimeout(removeGameOverScreenPartTwo, 1000);
exitGame();
}
public function removeGameOverScreenPartTwo():void{
projectCanvas.removeChild(gameOverScreen);
}
public function showConfirmQuit(_arg1:MouseEvent):void{
if ((((disableReset == false)) && ((gameOver == false)))){
disableReset = true;
gameRunning = false;
crosshairsOn = false;
gui.quitButton.removeEventListener(MouseEvent.MOUSE_DOWN, showConfirmQuit);
if (editMode == false){
confirmQuit = new confirmQuit_mc();
} else {
confirmQuit = new confirmReturnToEditor_mc();
};
projectCanvas.addChild(confirmQuit);
if (editMode == false){
confirmQuit.yesButton.addEventListener(MouseEvent.MOUSE_DOWN, quitGame);
} else {
confirmQuit.yesButton.addEventListener(MouseEvent.MOUSE_DOWN, gameToEditor);
};
confirmQuit.noButton.addEventListener(MouseEvent.MOUSE_DOWN, resumeGame);
delayStart = true;
};
}
public function quitGame(_arg1:MouseEvent):void{
projectCanvas.removeChild(confirmQuit);
confirmQuit.yesButton.removeEventListener(MouseEvent.MOUSE_DOWN, quitGame);
confirmQuit.noButton.removeEventListener(MouseEvent.MOUSE_DOWN, resumeGame);
exitGame();
}
public function gameToEditor(_arg1:MouseEvent):void{
projectCanvas.removeChild(confirmQuit);
confirmQuit.yesButton.removeEventListener(MouseEvent.MOUSE_DOWN, quitGame);
confirmQuit.noButton.removeEventListener(MouseEvent.MOUSE_DOWN, resumeGame);
gameRunning = false;
fadeInOut();
setTimeout(cleanUp, 500);
gameWon = false;
setTimeout(showEditor, 501);
}
public function resumeGame(_arg1:MouseEvent):void{
disableReset = false;
gameRunning = true;
crosshairsOn = true;
projectCanvas.removeChild(confirmQuit);
confirmQuit.yesButton.removeEventListener(MouseEvent.MOUSE_DOWN, quitGame);
confirmQuit.noButton.removeEventListener(MouseEvent.MOUSE_DOWN, resumeGame);
gui.quitButton.addEventListener(MouseEvent.MOUSE_DOWN, showConfirmQuit);
stage.focus = stage;
setTimeout(setDelay, 500);
}
public function showConfirmResetLevel(_arg1:MouseEvent):void{
if ((((((disableReset == false)) && ((gameOver == false)))) && ((gameRunning == true)))){
resetLevelDirect();
};
}
public function resetLevel(_arg1:MouseEvent):void{
projectCanvas.removeChild(confirmReset);
confirmReset.yesButton.removeEventListener(MouseEvent.MOUSE_DOWN, resetLevel);
confirmReset.noButton.removeEventListener(MouseEvent.MOUSE_DOWN, resumeGame2);
resetLevelDirect();
}
public function resetLevelDirect():void{
cleanUp();
setInitialVariables();
delayStart = true;
initialiseGame();
setTimeout(setDelay, 500);
}
public function resumeGame2(_arg1:MouseEvent):void{
disableReset = false;
gameRunning = true;
crosshairsOn = true;
projectCanvas.removeChild(confirmReset);
confirmReset.yesButton.removeEventListener(MouseEvent.MOUSE_DOWN, resetLevel);
confirmReset.noButton.removeEventListener(MouseEvent.MOUSE_DOWN, resumeGame2);
gui.resetButton.addEventListener(MouseEvent.MOUSE_DOWN, showConfirmResetLevel);
stage.focus = stage;
setTimeout(setDelay, 500);
}
public function exitGame():void{
gameRunning = false;
fadeInOut();
setTimeout(cleanUp, 500);
gameWon = false;
setTimeout(showMenu, 501);
}
public function playIntroMusic():void{
}
public function EncrpytString(_arg1):String{
var _local8:*;
var _local9:*;
var _local10:*;
var _local2:* = "aHfEjcDebChGiAfIjDbEjacD";
var _local3:* = _local2.length;
var _local4:* = "0";
var _local5:* = "";
var _local6:* = _arg1.length;
var _local7:* = 0;
var _local11:* = 0;
var _local12:* = 0;
while (_local12 < _local6) {
_local8 = _arg1.charCodeAt(_local12);
if (_local8 >= 128){
_local8 = "X";
};
_local9 = _local2.charCodeAt(_local7);
_local7 = (_local7 + 1);
if (_local7 >= _local3){
_local7 = 0;
};
_local10 = ((_local8 % 16) + _local9);
_local5 = (_local5 + String.fromCharCode(_local10));
_local11 = (_local11 + _local10);
_local9 = _local2.charCodeAt(_local7);
_local7 = (_local7 + 1);
if (_local7 >= _local3){
_local7 = 0;
};
_local10 = (Math.floor((_local8 / 16)) + _local9);
_local5 = (_local5 + String.fromCharCode(_local10));
_local11 = (_local11 + _local10);
_local12++;
};
_local11 = (_local11 % 0x0100);
_local9 = _local2.charCodeAt(_local7);
_local7 = (_local7 + 1);
if (_local7 >= _local3){
_local7 = 0;
};
_local10 = ((_local11 % 16) + _local9);
_local5 = (_local5 + String.fromCharCode(_local10));
_local9 = _local2.charCodeAt(_local7);
_local7 = (_local7 + 1);
if (_local7 >= _local3){
_local7 = 0;
};
_local10 = (Math.floor((_local11 / 16)) + _local9);
_local5 = (_local5 + String.fromCharCode(_local10));
return (_local5);
}
public function setupArrays(){
levelStringArray[1] = "eNpFjUEKwjAQRa8y7hR+JWlqTZaC4Ak8QK2pCU0NpAPF2zuWgpvh82fmvT6j0tZCG4f2jJODAnfQTkHXFqaFbaQKUc6MktFq1NZBKyv1zTNx8NTnhTiv8ZGZk6fu/aQhpkSRaYkcaIpp3G2cBpWI/pj77Cn5gdevEl9BUinCHP1npn0udFlX18PPUrJgN+vxCyIKNss=";
levelStringArray[2] = "eNotzgsKgzAMBuCr5AB/oYm1tTfYNWpXVnEqTJl4+0UnhEA+8torDPsIdmAfIAKLvMCIjZoi1NqotiUIWxjHaDw6p7RXcBBwq9H8J6tSA2bdx4Lob7Lneq2YbwkwwV09/pJBn+DzoG0hnU7bTvmRjnVLeVwpp5n6Qp8yLd/ypP6g/B7yOMwvWmbaapl+d2MxUw==";
levelStringArray[3] = "eNoVy1EOgyAQBNCr7AGGhF1F5Q69BAJRY4UGjL1+t38zbzLfHUaY4cFugAgs7qCkyYwOw4RlVIsVopWHGdMM55XeDxYPmSAWMv+P+wHD7PVtHURHtovyq26dYii0ZjpLjWdOVJ/c6K50hTNTC9enUyiJ1nakLfcfHQQnJg==";
levelStringArray[4] = "eNpFjl0OgzAMg6/SA7hS0z/Sg+wAaENiUrdOUEC7/Yx42EPy8MV2fMwQDVAHSQHew6GP8CHCSokIGRpPtpFlsoxAqXNk94YICYo8IBWCY4YtAZECWq+sDdYPCvV/X1/IKLLlIuGE8/MUDlxCqxZelPi2TqYv4z7VsbdlNb2Zeaof822bebV9MuPStvcDla/FK9hPOD7TW3fYxMTMwARhC/cDeOg5VQ==";
levelStringArray[5] = "eNpNjmEKgzAMRq+SA3xCG7u2u8GuUaXaglrQTtntFx3IIPmRx8uXHAmN9hbNE9oqMEOhL8Jag8YwjINRwroCNhqe0T5gtZAaZMNBs0Fr4c1P8g5e344AraXcTVKWbCfNDuzlqPJCtxrWSjVFmuIeJwpjyMvlmvb8j//cV641LyN1Ze42KiuN5RzLMFwBW7/GuNCRp4nmGBb6lDelsEeq5QvfgT62";
levelStringArray[6] = "eNpdj01uhDAMha/iAzykOCEmOcosA0IFtRBp6pmqt68DUoXYvMWX9+OMFV1mdAkhQhgOo5EgN8LJbFcwyBX8LOg8JMOH1LwH8TEb9Rh6mDpogU82JRFeztxiOZYADgPEmP9nR71pL1dk0bvNekzzgVZz2ADnYEsZ7Nolj/qiqew0fa3TJ+ky03P+1vJUGl+qdaeiVPZf0nWbSSudb+WjrDum2kaiiXeIPfpWuL3Bktqf2DlwznB/NUFOlg==";
levelStringArray[14] = "eNplkEsOwjAQQy/kSPNJMslxKJvuukFwfTyUQhFSFsmL7flcN1gbKKaOOlErBOuK0hVFu6B3eLLHCqvU6VCMDh07S8L/E1EPuitawIzoduHTWUAGrIO5Lxlt+uctOjNwwsQT8pa9mFDaAyEIigMLM60bSgw0yUP7naxCRbKuur/ZDMz5RcsGNldY19vezJIbYIMRZ1Rbzjo/KOdnAFdwDEZRLmjITxKf2g7yBDhKSpk=";
levelStringArray[8] = "eNoljtGNwzAMQ1fRADRgyZFjr3EbuL1cYyCND0HQrF+p/STB98BrBYsisGSwMiQi4rIyI1QGs0AEIVUvgw2CZuToZcTZEGaD6wzDM1t1NFNMUDVbhPLXFiZGYSRbfcDbwFwQJCqSfsFbA0c/YslJ/3EfYN9xNnuBVre9LNeElFxVfLZ2U/kPkQlSqomK1T9j2/r+oL7Ts/9S6wfd207rsv3Tc7wW2pa/k8ZBR3+s5xsNTT8M";
levelStringArray[9] = "eNpNzk0OAiEMhuELfST9oQWO45hJ2JjZmHh9C4qyIfAEXnqcSCx5LA1OEAPhCFQdVnezea386YpzFhjU4Bxyv1bNo1ZhLbB3pGkFzAKRsFfYyGmGMTgv0tgseN6inMZn/qk/OthRDZkITN8JJIL+m2AKN4y5dis1iHYqGsK7CMn+7g1KEjvb";
levelStringArray[10] = "eNpdzkkKwzAUA9ALKfBHD8cp3XiR0k1Jrl85DhS6snkWls6BTT2wNYdbwAyCc/AstIBG/kwaw3xQtYWvgV5pUhAiUKHtNJtXbWWl9gOaOdWo0Ra5oSu03/J5YDP+ZcLCQFbaOJAyycHWlHtGsjH7tcJ9xewvxhE+KRS1cgnp+b76QsAts/ILjLE1lA==";
levelStringArray[11] = "eNplzUEKwzAMBMAPrUEr25LznLaXXEqghOT7lQI1pb2J0Up7ruAgqoG9QRWC1xakKKagVdDD9huUDYUi0IY+wtYjRgu77oZ8yIPIbyPrb4zXN8q054GSFebIEi5L4GNLZPZqbnriPZBxRnXUDuO0+PYnxWfqDXPvMhM=";
levelStringArray[12] = "eNpNzkEKwzAMBMAPbUErx5bynNKLD4FeSvz9rkgJBV80WllaJx6eiRFwhxth+DxlNsDW4Gp12VKOblXcueNEbEplUY9LGF2037Qm6KFhGenlP+zC+MM5kRXssozL9KEPXUMirZ5oYjfQlKChVrzeKh3ZsDVojX0BU/stuw==";
levelStringArray[13] = "eNplzjsOg0AMBNALDdL6vz5OkoYCiRQo549ZBRRBsc3bsT2vFRNbgNSgCRU0LDMmio7sxQoSTK7Y3qAgkNUTAfdKPlewBrpCDE4l2wPkOQbE948RiijhMzTG9q150vypm9SgDm916KCW8Dt1u1A1bXo3lovF6F/G+WumSPovVqGas4O+C7M9ng==";
levelStringArray[7] = "eNpVjUEKA0EIBD/UA7aOOvuckMseArmEvD89ZHMIiDRF2d6fGJ4FTkc18oDhfGOwDrFEO7QNjxOje2d3hxMj1ha55r+n29kgHXvsYr2EQqZQf+uYSJGQHBcxYtbvQRRet12iLJKEfQC75SUE";
levelStringArray[15] = "eNpVkEsOgzAMRC80kfzJxzlO2w2LSkgVLdfvJAiqLljweJ6xeaxI5gXqgdpQOgTbG9YcNcMFKvJDqcqP7Qu6ImlpsAozoufCd3eoUcp8OOIN+wepGenUQg4z2GpKz4fHHaiZ/1lzcGTEhRZWWEbqNNWO2jGYZ9Np3cdZjdkxgqueWbQ0Z/Irn+cQcY0Kfp2L9YFY2wPjd7xWmBSiXmmxth2aBVlklDK17TaXMN7Cq1gsXyITSqY=";
levelStringArray[16] = "eNpVkEsOwjAQQy/kSPNJMslxCkLqAtQNKtfHCRQVKZtYb8b2PHYU1AoVgfYOwWVBUipJe0GR8QTXDRFDaqiBMrkbkjVqpaIKrFB7rfz7FBtUDWZD3UnGVPNQmnxRc0Vq/SAtcF9RCdLDJFMn+FwQzllRWAbN5kJthRonfvtoMiKG/lmoBvQwSNkGZy2T8zNnhRAvQEdjJna+bFBjNOlwXkg/XJ8tuJL9Pt1mDZZ1OdWYzkw7Cmuu8CPhsK79HDp44RnFzCFv2jRVVg==";
levelStringArray[17] = "eNolytEJwCAMANGFTkhiNXEccYBCKe36jfTzHrdOikmlqDvdaQPhWtnRKc3RJrRj48xTsV805Z7oyLZO7cSe3geVkRSYEYJ8BXcUvw==";
levelStringArray[18] = "eNpFjs0KAzEIhF9oAtGosY9Tesmh0IUu3dffkRwK4s+HM3o+0UQn0yOgChd0XAstgywUIg7JDVWEsBOGbPg94MHqWtFxHlQahDYlHoPs9UFTS7Rayv8F9XIbyLm93gvTiDnoLI96AOvHtzrbVFhAzNBv2Wsmjw==";
levelStringArray[19] = "eNpNkMEKAyEMRH9oBBMTdT+nLYU9FPZSdn+/E7W04EFfMsmM146kLkhS0BukI2M/yVpGsoZiYHWx0ZcFphO+bwELoTt0wfsz3gbZUDPUF+r+Ty6u5RRuFQiVPG3u0MZK/+3docXJcwVHhL3HQWRE5N5nG+dpJ5Ot8BLjBpNeFyuT3Q+IhVY3UF5D+zrDUxKjFdr2vPyRMUarS8msPfI3AVtGVxg2/pPUr+E6nBTUwljb/M4gzCrEIj7YB12YT3M=";
levelStringArray[20] = "eNplks1qxDAMhF9oDJZk+edxdnvJobCwLO3rd5TYIaGXgL+MrNHIzxdSG0iqMEcVZDwDdRQ/yfazC9RQ+fWD8GQNluF5SoogSfmHqt2QZCTrN2QauKEQ14PxHqJ6Ippyp7JdbXoNkVx9GsnNJQ24Rre2rhlxWiWfBw2ypgu0o/qcv9PR6Kfqe6NkUOcGEd6uhL+EyqCSCIqF4wszO9kaWjgIf+21nzd1vJ09JOcwRN12sIhaaEZmE/XIgnBkihezY/TFWKw5GM2cxV8vSPNYisXYHqO8H5DOhdMc8/cZmxj4CiKotnbicD6CHO9g7jJacZeKMseqexiRdpuzC3OX2JmVXfUHDdaBUg==";
}
public function lockLevels():void{
var _local2:String;
var _local4:DisplayObject;
var _local5:padlock_mc;
var _local6:DropShadowFilter;
var _local1:int;
var _local3:* = 0;
while (_local3 < levelSelect.levelButtonHolder.numChildren) {
_local4 = levelSelect.levelButtonHolder.getChildAt(_local3);
if ((_local4 is levelThumb)){
_local1++;
if ((((((_local1 > alwaysUnlocked)) && ((_local1 > highestLevel)))) && ((_local4.visible == true)))){
_local5 = new padlock_mc();
levelSelect.levelButtonHolder.addChild(_local5);
_local6 = new DropShadowFilter();
_local6.distance = 3;
_local6.angle = 45;
_local6.strength = 0.8;
_local5.filters = [_local6];
_local5.mouseEnabled = false;
_local5.x = ((_local4.x + _local4.width) - (_local5.width * 2));
_local5.y = (_local4.y - (_local5.height * 2));
};
};
_local3++;
};
}
public function positionLevelButtons():void{
}
public function scrollLevelButtons():void{
levelSelect.addEventListener(Event.ENTER_FRAME, slideButtonsLeft);
levelSelect.addEventListener(Event.ENTER_FRAME, slideButtonsRight);
levelSelect.addEventListener(Event.ENTER_FRAME, adjustButtons);
levelSelect.arrowLeft.addEventListener(MouseEvent.MOUSE_DOWN, arrowLeftDown);
levelSelect.arrowRight.addEventListener(MouseEvent.MOUSE_DOWN, arrowRightDown);
levelSelect.arrowLeft.addEventListener(MouseEvent.MOUSE_UP, arrowLeftUp);
levelSelect.arrowRight.addEventListener(MouseEvent.MOUSE_UP, arrowRightUp);
levelSelect.arrowLeft.addEventListener(MouseEvent.MOUSE_OUT, arrowLeftUp);
levelSelect.arrowRight.addEventListener(MouseEvent.MOUSE_OUT, arrowRightUp);
}
public function arrowLeftDown(_arg1:MouseEvent):void{
arrowLeftDownFlag = true;
lastButtonPressed = "left";
}
public function arrowRightDown(_arg1:MouseEvent):void{
arrowRightDownFlag = true;
lastButtonPressed = "right";
}
public function arrowLeftUp(_arg1:MouseEvent):void{
arrowLeftDownFlag = false;
}
public function arrowRightUp(_arg1:MouseEvent):void{
arrowRightDownFlag = false;
}
public function slideButtonsLeft(_arg1:Event):void{
if (arrowRightDownFlag == true){
if (levelSelect.levelButtonHolder.x > (levelButtonStart - (levelSelect.levelButtonHolder.width - 350))){
levelSelect.levelButtonHolder.x = (levelSelect.levelButtonHolder.x - 8);
};
};
}
public function slideButtonsRight(_arg1:Event):void{
if (arrowLeftDownFlag == true){
if (levelSelect.levelButtonHolder.x < levelButtonStart){
levelSelect.levelButtonHolder.x = (levelSelect.levelButtonHolder.x + 8);
};
};
}
public function adjustButtons(_arg1:Event):void{
var _local2:*;
if ((((((arrowRightDownFlag == false)) && ((arrowLeftDownFlag == false)))) && (!((lastButtonPressed == "none"))))){
adjusting = true;
levelSelect.levelButtonHolder.x = (levelSelect.levelButtonHolder.x + buttonSpeed);
_local2 = (levelButtonStart / 2);
if (lastButtonPressed == "left"){
buttonDistToTarget = ((-(_local2) + (Math.floor((((levelSelect.levelButtonHolder.x + _local2) + 75) / 75)) * 75)) - levelSelect.levelButtonHolder.x);
};
if (lastButtonPressed == "right"){
buttonDistToTarget = ((_local2 + levelSelect.levelButtonHolder.x) - (Math.ceil((((levelSelect.levelButtonHolder.x + _local2) - 75) / 75)) * 75));
};
if (lastButtonPressed == "left"){
buttonSpeed = (1 + ((7 * buttonDistToTarget) / 75));
};
if (lastButtonPressed == "right"){
buttonSpeed = (-1 - ((7 * buttonDistToTarget) / 75));
};
if (Math.abs(buttonDistToTarget) < 3){
levelSelect.levelButtonHolder.x = (-(_local2) + (Math.round(((levelSelect.levelButtonHolder.x + _local2) / 75)) * 75));
lastButtonPressed = "none";
adjusting = false;
};
if (levelSelect.levelButtonHolder.x < (levelButtonStart - (levelSelect.levelButtonHolder.width - 350))){
levelSelect.levelButtonHolder.x = (levelButtonStart - (levelSelect.levelButtonHolder.width - 350));
};
if (levelSelect.levelButtonHolder.x > levelButtonStart){
levelSelect.levelButtonHolder.x = levelButtonStart;
};
};
}
public function adjustingComplete(_arg1:TweenEvent):void{
adjusting = false;
}
public function disableScrollLevelButtons():void{
levelSelect.removeEventListener(Event.ENTER_FRAME, slideButtonsLeft);
levelSelect.removeEventListener(Event.ENTER_FRAME, slideButtonsRight);
levelSelect.removeEventListener(Event.ENTER_FRAME, adjustButtons);
levelSelect.arrowLeft.removeEventListener(MouseEvent.MOUSE_DOWN, arrowLeftDown);
levelSelect.arrowRight.removeEventListener(MouseEvent.MOUSE_DOWN, arrowRightDown);
levelSelect.arrowLeft.removeEventListener(MouseEvent.MOUSE_UP, arrowLeftUp);
levelSelect.arrowRight.removeEventListener(MouseEvent.MOUSE_UP, arrowRightUp);
levelSelect.arrowLeft.removeEventListener(MouseEvent.MOUSE_OUT, arrowLeftUp);
levelSelect.arrowRight.removeEventListener(MouseEvent.MOUSE_OUT, arrowRightUp);
}
public function addGUI():void{
gui = new gui_mc();
projectCanvas.addChild(gui);
if (userMode == true){
gui.level.text = ("Level: " + levelObject.levelName);
gui.score.visible = false;
gui.bonus.visible = false;
gui.bonusLabel.visible = false;
} else {
if (editMode == true){
gui.level.text = "Test Level";
gui.score.visible = false;
gui.bonus.visible = false;
gui.bonusLabel.visible = false;
} else {
gui.level.text = ("Level " + String(currentLevel));
gui.score.text = ("Score " + String(score));
};
};
gui.turboNuke.addEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
gui._Walkthrough_.addEventListener(MouseEvent.MOUSE_DOWN, gotoWalkthrough);
}
public function gotoWalkthrough(_arg1:MouseEvent):void{
var _local2 = "http://www.turbonuke.com/walkthrough.php?game=Mooo";
var _local3:URLRequest = new URLRequest(_local2);
navigateToURL(_local3);
Log.CustomMetric("ClickedWalkthrough", "Links");
}
public function setDelay():void{
delayStart = false;
}
public function resetVars():void{
bonus = 0;
discsUsed = 0;
gameWon = false;
gameRunning = true;
gameOver = false;
targetsReached = 0;
leftKeyDown = false;
rightKeyDown = false;
checkForCollisions = true;
tweenArray = new Array();
numberOfTravelators = 0;
travelator = new Array();
bonusTweenArray = new Array();
bonusTweenNumber = 0;
disableReset = false;
startOfLevelScore = score;
livesLost = 0;
}
public function initialiseGame():void{
backgroundCanvas = new Sprite();
projectCanvas.addChild(backgroundCanvas);
var _local1:* = new gameBG_mc();
backgroundCanvas.addChild(_local1);
_local1.y = 0;
gameCanvas = new Sprite();
gameCanvas.x = centre.x;
gameCanvas.y = centre.y;
projectCanvas.addChild(gameCanvas);
resetVars();
initialisePhysics();
if (editMode == true){
createLevel(editString);
} else {
if (userMode == true){
createLevel(userString);
} else {
createLevel(levelStringArray[currentLevel]);
};
};
createGround();
debug = new debug_mc();
stage.addChild(debug);
debug.visible = false;
addGUI();
gui.quitButton.addEventListener(MouseEvent.MOUSE_DOWN, showConfirmQuit);
gui.resetButton.addEventListener(MouseEvent.MOUSE_DOWN, showConfirmResetLevel);
var _local2:Date = new Date();
fpsStartTime = _local2.getTime();
stage.addEventListener(Event.ENTER_FRAME, gameLoop, false, 0, true);
initialiseControls();
crosshairsOn = true;
cleaned = false;
lives = 3;
bonus = 100;
}
public function setCurrentLevel():void{
}
public function initialiseSoundToggle():void{
soundToggle.addEventListener(MouseEvent.MOUSE_OVER, soundOver);
soundToggle.addEventListener(MouseEvent.MOUSE_OUT, soundUp);
soundToggle.addEventListener(MouseEvent.MOUSE_DOWN, toggleSound);
}
public function soundOver(_arg1:MouseEvent):void{
if (soundOn == true){
soundToggle.gotoAndStop("onOver");
} else {
soundToggle.gotoAndStop("offOver");
};
}
public function soundUp(_arg1:MouseEvent):void{
if (soundOn == true){
soundToggle.gotoAndStop("onUp");
} else {
soundToggle.gotoAndStop("offUp");
};
}
public function toggleSound(_arg1:MouseEvent):void{
if (soundOn == true){
soundOn = false;
soundToggle.gotoAndStop("offOver");
} else {
soundOn = true;
soundToggle.gotoAndStop("onOver");
};
}
public function initialiseMusicToggle():void{
musicToggle.addEventListener(MouseEvent.MOUSE_OVER, musicOver);
musicToggle.addEventListener(MouseEvent.MOUSE_OUT, musicUp);
musicToggle.addEventListener(MouseEvent.MOUSE_DOWN, toggleMusic);
}
public function musicOver(_arg1:MouseEvent):void{
if (musicOn == true){
musicToggle.gotoAndStop("onOver");
} else {
musicToggle.gotoAndStop("offOver");
};
}
public function musicUp(_arg1:MouseEvent):void{
if (musicOn == true){
musicToggle.gotoAndStop("onUp");
} else {
musicToggle.gotoAndStop("offUp");
};
}
public function toggleMusic(_arg1:MouseEvent):void{
if (musicOn == true){
musicOn = false;
musicToggle.gotoAndStop("offOver");
musicTransform.volume = 0;
musicChannel.soundTransform = musicTransform;
} else {
musicOn = true;
musicToggle.gotoAndStop("onOver");
musicTransform.volume = 1;
musicChannel.soundTransform = musicTransform;
};
}
public function initialiseControls():void{
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
stage.focus = stage;
}
public function disableControls():void{
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
stage.removeEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
stage.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}
public function initialisePhysics():void{
var _local1:b2AABB = new b2AABB();
_local1.minVertex.Set(-400, -800);
_local1.maxVertex.Set(400, 300);
var _local2:b2Vec2 = new b2Vec2(0, grav);
var _local3:Boolean;
m_world = new b2World(_local1, _local2, _local3);
}
public function createLevel(_arg1:String):void{
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:String;
_arg1 = Base64.decode(_arg1);
var _local2:Array = _arg1.split(",");
var _local3:uint;
while (_local3 < _local2.length) {
_local4 = _local2[_local3];
_local5 = int(_local2[(_local3 + 1)]);
_local6 = int(_local2[(_local3 + 2)]);
_local7 = int(_local2[(_local3 + 3)]);
_local8 = int(_local2[(_local3 + 4)]);
_local9 = int(_local2[(_local3 + 5)]);
if (_local4 == "hi"){
_local10 = _local2[(_local3 + 6)];
};
if (_local4 == "wh"){
makeBlock(_local5, _local6, _local7, _local8, _local9, "wall", "h");
};
if (_local4 == "wv"){
makeBlock(_local5, _local6, _local7, _local8, _local9, "wall", "v");
};
if (_local4 == "hh"){
makeBlock(_local5, _local6, _local7, _local8, _local9, "haystack", "h");
};
if (_local4 == "hv"){
makeBlock(_local5, _local6, _local7, _local8, _local9, "haystack", "v");
};
if (_local4 == "lh"){
makeBlock(_local5, _local6, _local7, _local8, _local9, "log", "h");
};
if (_local4 == "lv"){
makeBlock(_local5, _local6, _local7, _local8, _local9, "log", "v");
};
if (_local4 == "tp"){
makeBlock(_local5, _local6, _local7, _local8, _local9, "trampoline", "h");
};
if (_local4 == "ta"){
makeTarget(_local5, _local6, _local7, _local8);
};
if (_local4 == "mh"){
makeMovingLineH(_local5, _local6);
};
if (_local4 == "mv"){
makeMovingLineV(_local5, _local6);
};
if (_local4 == "pi"){
makePig(_local5, _local6, _local7, _local8);
};
if (_local4 == "co"){
makeCowRound(_local5, _local6, _local7, _local8);
};
if (_local4 == "bo"){
makeBomb(_local5, _local6, _local7, _local8);
};
if (_local4 == "ba"){
makeBall(_local5, _local6, _local7, _local8);
};
if (_local4 == "sp"){
makeRotator(_local5, _local6);
};
if (_local4 == "rc"){
makeRotatorLong(_local5, _local6, 1);
};
if (_local4 == "ra"){
makeRotatorLong(_local5, _local6, -1);
};
if (_local4 == "ro"){
makePivotV(_local5, _local6);
};
if (_local4 == "tr"){
createTravelator(_local5, _local6, "right");
};
if (_local4 == "tl"){
createTravelator(_local5, _local6, "left");
};
if (_local4 == "tu"){
createTravelator(_local5, _local6, "up");
};
if (_local4 == "td"){
createTravelator(_local5, _local6, "down");
};
if (_local4 == "be"){
makeBelt(_local5, _local6);
};
if (_local4 == "hi"){
createHintBox(_local5, _local6, _local10);
};
if (_local4 != "hi"){
_local3 = (_local3 + 6);
} else {
_local3 = (_local3 + 7);
};
};
}
public function makeBelt(_arg1, _arg2){
var _local5:b2Body;
var _local8:b2Body;
var _local11:b2Body;
var _local14:b2Body;
var _local15:b2RevoluteJointDef;
var _local16:int;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:b2Body;
var _local3:b2BodyDef = new b2BodyDef();
var _local4:b2BoxDef = new b2BoxDef();
_local4.extents.Set(20, 4);
_local4.friction = 0.3;
_local4.density = 0;
_local3.position.Set(_arg1, _arg2);
_local3.userData = new bridge_mc();
_local3.userData.width = (_local4.extents.x * 2);
_local3.userData.height = (_local4.extents.y * 2);
_local3.userData.dragable = true;
_local3.AddShape(_local4);
gameCanvas.addChild(_local3.userData);
_local5 = m_world.CreateBody(_local3);
var _local6:b2BodyDef = new b2BodyDef();
var _local7:b2BoxDef = new b2BoxDef();
_local7.density = 1;
_local7.friction = 0.3;
_local7.restitution = 0.5;
_local7.extents.Set(8, 8);
_local6.position.Set((_arg1 - 20), _arg2);
_local6.userData = new cog_mc();
_local6.userData.width = (_local7.extents.x * 2.5);
_local6.userData.height = (_local7.extents.y * 2.5);
_local6.userData.dragable = true;
_local6.AddShape(_local7);
gameCanvas.addChild(_local6.userData);
_local8 = m_world.CreateBody(_local6);
var _local9:b2BodyDef = new b2BodyDef();
var _local10:b2BoxDef = new b2BoxDef();
_local10.density = 1;
_local10.friction = 0.3;
_local10.restitution = 0.5;
_local10.extents.Set(8, 8);
_local9.position.Set((_arg1 + 20), _arg2);
_local9.userData = new cog_mc();
_local9.userData.width = (_local10.extents.x * 2.5);
_local9.userData.height = (_local10.extents.y * 2.5);
_local9.userData.dragable = true;
_local9.AddShape(_local10);
gameCanvas.addChild(_local9.userData);
_local11 = m_world.CreateBody(_local9);
var _local12:b2RevoluteJointDef = new b2RevoluteJointDef();
_local12.body1 = _local5;
_local12.body2 = _local8;
_local12.anchorPoint = _local8.GetCenterPosition();
_local12.enableMotor = true;
_local12.motorTorque = 1000000000;
_local12.motorSpeed = 8;
m_world.CreateJoint(_local12);
var _local13:b2RevoluteJointDef = new b2RevoluteJointDef();
_local13.body1 = _local5;
_local13.body2 = _local11;
_local13.anchorPoint = _local11.GetCenterPosition();
_local13.enableMotor = false;
m_world.CreateJoint(_local13);
_local4.extents.Set((4 / m_physScale), (3 / m_physScale));
_local4.friction = 1;
_local4.density = 1;
_local3 = new b2BodyDef();
_local3.AddShape(_local4);
_local15 = new b2RevoluteJointDef();
_local15.enableLimit = true;
_local15.lowerAngle = (-20 / (180 / Math.PI));
_local15.upperAngle = (20 / (180 / Math.PI));
_local16 = 0;
while (_local16 < 25) {
_local17 = (((_local16 / 25) * Math.PI) * 2);
_local18 = (_arg1 + (Math.sin(_local17) * 22));
_local19 = (_arg2 + (Math.cos(_local17) * 22));
_local3.position.Set(_local18, _local19);
_local3.rotation = -(_local17);
_local3.userData = new segment_mc();
_local3.userData.width = (_local4.extents.x * 2);
_local3.userData.height = _local4.extents.y;
_local3.userData.dragable = true;
gameCanvas.addChild(_local3.userData);
_local14 = m_world.CreateBody(_local3);
if (_local16 != 0){
_local15.anchorPoint.Set((((_local18 / m_physScale) + _local5.m_position.x) / 2), (((_local19 / m_physScale) + _local5.m_position.y) / 2));
_local15.body1 = _local5;
_local15.body2 = _local14;
m_world.CreateJoint(_local15);
} else {
_local20 = _local14;
};
_local5 = _local14;
_local16++;
};
_local15.anchorPoint.Set(((_local20.m_position.x + _local14.m_position.x) / 2), ((_local20.m_position.y + _local14.m_position.y) / 2));
_local15.body1 = _local14;
_local15.body2 = _local20;
m_world.CreateJoint(_local15);
}
public function makeBall(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:* = new b2BodyDef();
var _local6:* = new b2CircleDef();
_local6.radius = (_arg3 / 2);
_local6.friction = 1;
_local6.density = 1;
_local6.restitution = 0.2;
_local5.AddShape(_local6);
_local5.userData = new ball_mc();
_local5.userData.cacheAsBitmap = true;
_local5.position.Set(_arg1, _arg2);
_local5.userData.width = _arg3;
_local5.userData.height = _arg4;
_local5.userData.x = _arg1;
_local5.userData.y = _arg2;
_local5.userData.id = "ball";
gameCanvas.addChild(_local5.userData);
m_world.CreateBody(_local5);
}
public function makeCowRound(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:* = new b2BodyDef();
var _local6:* = new b2CircleDef();
_local6.radius = (0.42 * _arg3);
_local6.friction = 1;
_local6.density = 1;
_local6.restitution = 0.2;
_local5.AddShape(_local6);
_local5.userData = new cowRound_mc();
_local5.userData.cacheAsBitmap = true;
_local5.position.Set(_arg1, _arg2);
_local5.userData.width = _arg3;
_local5.userData.height = _arg4;
_local5.userData.x = _arg1;
_local5.userData.y = _arg2;
_local5.userData.id = "cow";
gameCanvas.addChild(_local5.userData);
myCow = m_world.CreateBody(_local5);
myCow.m_userData.radius = (0.42 * _arg3);
myCow.m_userData.targetReached = false;
}
public function makeBomb(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:* = new b2BodyDef();
var _local6:* = new b2CircleDef();
_local6.radius = (0.5 * _arg3);
_local6.friction = 1;
_local6.density = 0;
_local6.restitution = 0.2;
_local5.AddShape(_local6);
_local5.angularDamping = 0.1;
_local5.userData = new bomb_mc();
_local5.userData.cacheAsBitmap = true;
_local5.position.Set(_arg1, _arg2);
_local5.userData.width = _arg3;
_local5.userData.height = _arg4;
_local5.userData.x = _arg1;
_local5.userData.y = _arg2;
_local5.userData.id = "bomb";
gameCanvas.addChild(_local5.userData);
m_world.CreateBody(_local5);
}
public function createEnemyGun(_arg1:Number, _arg2:Number):void{
numberOfEGs++;
egArray[numberOfEGs] = new enemyGun_mc();
gameCanvas.addChildAt(egArray[numberOfEGs], 0);
egArray[numberOfEGs].x = _arg1;
egArray[numberOfEGs].y = _arg2;
egArray[numberOfEGs].width = (egArray[numberOfEGs].width * 0.6);
egArray[numberOfEGs].height = (egArray[numberOfEGs].height * 0.6);
egArray[numberOfEGs].counter = 0;
egArray[numberOfEGs].active = true;
}
public function makeBonusStar(_arg1:Number, _arg2:Number):void{
var _local3:* = new bonusStar_mc();
gameCanvas.addChild(_local3);
_local3.x = _arg1;
_local3.y = _arg2;
starArray.push(_local3);
}
public function makeTarget(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:* = new b2BodyDef();
var _local6:* = new b2BoxDef();
_local6.extents.Set((0.5 * _arg3), (0.5 * _arg4));
_local6.friction = 1;
_local6.density = 2;
_local6.restitution = 0.1;
_local5.AddShape(_local6);
_local5.userData = new bottle_mc();
_local5.userData.stop();
_local5.position.Set(_arg1, _arg2);
_local5.userData.width = _arg3;
_local5.userData.height = (_arg4 * 2);
_local5.userData.x = _arg1;
_local5.userData.y = _arg2;
_local5.userData.id = "target";
gameCanvas.addChild(_local5.userData);
myTarget = m_world.CreateBody(_local5);
}
public function createHintBox(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:* = new hintBox_mc();
_local4.mouseEnabled = false;
_local4.mouseChildren = false;
_local4.x = _arg1;
_local4.y = _arg2;
_local4.message.text = _arg3;
gameCanvas.addChild(_local4);
}
public function fadeHintBox(){
var _local1:Tween;
if (hintBoxExists == true){
_local1 = new Tween(hintBox, "alpha", None.easeNone, 0.7, 0, 2, true);
setTimeout(removeHintBox, 2500);
tweenArray.push(_local1);
};
}
public function removeHintBox():void{
if (hintBoxExists == true){
projectCanvas.removeChild(hintBox);
hintBoxExists = false;
};
}
public function makeTeleport(_arg1:Number, _arg2:Number, _arg3:String){
numberOfTeleports++;
if (_arg3 == "in"){
teleportArray[numberOfTeleports] = new teleportIn_mc();
};
if (_arg3 == "out"){
teleportArray[numberOfTeleports] = new teleportOut_mc();
};
teleportArray[numberOfTeleports].x = _arg1;
teleportArray[numberOfTeleports].y = _arg2;
teleportArray[numberOfTeleports].variety = _arg3;
gameCanvas.addChildAt(teleportArray[numberOfTeleports], 0);
teleportPair++;
if (teleportPair == 2){
teleportArray[numberOfTeleports].pair = teleportArray[(numberOfTeleports - 1)];
teleportArray[(numberOfTeleports - 1)].pair = teleportArray[numberOfTeleports];
teleportPair = 0;
};
}
public function makeBlock(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String):void{
var _local8:* = new b2BodyDef();
var _local9:* = new b2BoxDef();
_local9.extents.Set((_arg3 * 0.5), (_arg4 * 0.5));
_local9.friction = 0.8;
_local9.restitution = 0.2;
if (_arg6 == "wall"){
_local9.density = 0;
} else {
_local9.density = 1;
};
_local8.position.Set(_arg1, _arg2);
_local8.AddShape(_local9);
_local8.rotation = ((_arg5 * Math.PI) / 180);
if (_arg7 == "h"){
if (_arg6 == "wall"){
_local8.userData = new wallH_mc();
_local8.userData.id = "wall";
};
if (_arg6 == "log"){
_local8.userData = new logH_mc();
_local8.userData.id = "log";
};
if (_arg6 == "haystack"){
_local8.userData = new haystackH_mc();
_local8.userData.id = "haystack";
};
if (_arg6 == "trampoline"){
_local8.userData = new trampoline_mc();
_local8.userData.id = "trampoline";
_local9.restitution = 0.98;
_local9.friction = 0;
_local9.density = 0;
};
};
if (_arg7 == "v"){
if (_arg6 == "wall"){
_local8.userData = new wallV_mc();
_local8.userData.id = "wall";
};
if (_arg6 == "log"){
_local8.userData = new logV_mc();
_local8.userData.id = "log";
};
if (_arg6 == "haystack"){
_local8.userData = new haystackV_mc();
_local8.userData.id = "haystack";
};
};
_local8.userData.width = (_local9.extents.x * 2);
_local8.userData.height = (_local9.extents.y * 2);
_local8.userData.x = _arg1;
_local8.userData.y = _arg2;
_local8.userData.rotation = (_local8.rotation * (180 / Math.PI));
gameCanvas.addChild(_local8.userData);
_local8.userData.body = m_world.CreateBody(_local8);
if (_arg6 == "haystack"){
haystackArray.push(_local8.userData);
};
_local8.userData.cacheAsBitmap = true;
}
public function makeIce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local15:squareShadow_mc;
var _local6:* = 0;
if ((((_arg5 < 0)) && ((_arg5 >= -90)))){
_local6 = ((Math.PI / 180) * Math.abs(_arg5));
} else {
if ((((_arg5 < -90)) && ((_arg5 >= -180)))){
_local6 = ((Math.PI / 180) * (180 - Math.abs(_arg5)));
} else {
if ((((_arg5 > 90)) && ((_arg5 <= 180)))){
_local6 = ((Math.PI / 180) * (360 - Math.abs(_arg5)));
} else {
_local6 = ((Math.PI / 180) * Math.abs(_arg5));
};
};
};
var _local7:* = Math.cos(_local6);
var _local8:* = Math.sin(_local6);
var _local9:* = _arg3;
var _local10:* = _arg4;
var _local11:* = (((_local10 * _local7) - (_local9 * _local8)) / ((_local7 * _local7) - (_local8 * _local8)));
var _local12:* = ((_local9 - (_local11 * _local8)) / _local7);
var _local13:* = new b2BodyDef();
var _local14:* = new b2BoxDef();
_local14.extents.Set((_local12 * 0.5), (_local11 * 0.5));
_local14.friction = 0.1;
_local14.restitution = 0.1;
_local14.density = 0;
_local13.position.Set(_arg1, _arg2);
_local13.AddShape(_local14);
_local13.rotation = ((_arg5 * Math.PI) / 180);
_local13.userData = new ice_mc();
_local13.userData.width = (_local14.extents.x * 2);
_local13.userData.height = (_local14.extents.y * 2);
_local13.userData.x = _arg1;
_local13.userData.y = _arg2;
_local13.userData.rotation = (_local13.rotation * (180 / Math.PI));
_local13.userData.id = "wall";
gameCanvas.addChild(_local13.userData);
_local13.userData.squareShadow = new squareShadow_mc();
_local13.userData.squareShadow.width = (_local14.extents.x * 2);
_local13.userData.squareShadow.height = (_local14.extents.y * 2);
_local13.userData.squareShadow.x = _arg1;
_local13.userData.squareShadow.y = _arg2;
_local13.userData.squareShadow.rotation = (_local13.rotation * (180 / Math.PI));
gameCanvas.addChildAt(_local13.userData.squareShadow, 0);
m_world.CreateBody(_local13);
}
public function createLevelComplete(_arg1:Number, _arg2:Number):void{
var _local5:squareShadow_mc;
lastLevelReached = true;
ground = new ground_mc();
backgroundCanvas.addChildAt(ground, 0);
ground.y = 600;
groundCreated = true;
var _local3:* = new b2BodyDef();
var _local4:* = new b2BoxDef();
_local4.extents.Set(100, 20);
_local4.friction = 0.15;
_local4.restitution = 0.95;
_local4.density = 0;
_local3.position.Set(_arg1, _arg2);
_local3.AddShape(_local4);
_local3.userData = new levelComplete_mc();
_local3.userData.width = (_local4.extents.x * 2);
_local3.userData.height = (_local4.extents.y * 2);
_local3.userData.x = _arg1;
_local3.userData.y = _arg2;
_local3.userData.id = "levelComplete";
gameCanvas.addChild(_local3.userData);
_local3.userData.squareShadow = new squareShadow_mc();
_local3.userData.squareShadow.width = (_local4.extents.x * 2);
_local3.userData.squareShadow.height = (_local4.extents.y * 2);
_local3.userData.squareShadow.x = (_arg1 + 5);
_local3.userData.squareShadow.y = (_arg2 + 5);
gameCanvas.addChildAt(_local3.userData.squareShadow, 0);
m_world.CreateBody(_local3);
}
public function makeLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:* = 0;
if ((((_arg5 < 0)) && ((_arg5 >= -90)))){
_local6 = ((Math.PI / 180) * Math.abs(_arg5));
} else {
if ((((_arg5 < -90)) && ((_arg5 >= -180)))){
_local6 = ((Math.PI / 180) * (180 - Math.abs(_arg5)));
} else {
if ((((_arg5 > 90)) && ((_arg5 <= 180)))){
_local6 = ((Math.PI / 180) * (360 - Math.abs(_arg5)));
} else {
_local6 = ((Math.PI / 180) * Math.abs(_arg5));
};
};
};
var _local7:* = Math.cos(_local6);
var _local8:* = Math.sin(_local6);
var _local9:* = _arg3;
var _local10:* = _arg4;
var _local11:* = (((_local10 * _local7) - (_local9 * _local8)) / ((_local7 * _local7) - (_local8 * _local8)));
var _local12:* = ((_local9 - (_local11 * _local8)) / _local7);
var _local13:* = new b2BodyDef();
var _local14:* = new b2BoxDef();
_local14.extents.Set((_local12 * 0.5), (_local11 * 0.5));
_local14.friction = 0;
_local14.restitution = 1.05;
_local14.density = 0;
_local13.position.Set(_arg1, _arg2);
_local13.AddShape(_local14);
_local13.rotation = ((_arg5 * Math.PI) / 180);
_local13.userData = new line_mc();
_local13.userData.width = (_local14.extents.x * 2);
_local13.userData.height = (_local14.extents.y * 2);
_local13.userData.x = _arg1;
_local13.userData.y = _arg2;
_local13.userData.id = "line";
gameCanvas.addChild(_local13.userData);
m_world.CreateBody(_local13);
}
public function makeMovingLineV(_arg1:Number, _arg2:Number):void{
var _local3:* = new b2BodyDef();
var _local4:* = new b2BoxDef();
_local4.extents.Set(50, 5);
_local4.friction = 2;
_local4.restitution = 0.2;
_local4.density = 1;
_local3.position.Set(_arg1, _arg2);
_local3.AddShape(_local4);
_local3.userData = new movingLine_mc();
_local3.userData.width = 100;
_local3.userData.height = 10;
_local3.userData.x = _arg1;
_local3.userData.y = _arg2;
_local3.userData.id = "movingLineV";
_local3.userData.startY = _arg2;
_local3.userData.speed = 2;
gameCanvas.addChild(_local3.userData);
var _local5:* = m_world.CreateBody(_local3);
var _local6:b2PrismaticJointDef = new b2PrismaticJointDef();
_local6.body1 = _local5;
_local6.body2 = m_world.m_groundBody;
_local6.anchorPoint = new b2Vec2(_arg1, _arg2);
_local6.axis = new b2Vec2(0, 1);
_local6.enableMotor = true;
_local6.motorForce = 15000000;
_local6.motorSpeed = 0;
_local6.upperTranslation = 95;
_local6.lowerTranslation = -95;
_local6.enableLimit = true;
_local3.userData.joint = m_world.CreateJoint(_local6);
_local3.userData.counter = 0;
_local3.userData.direction = 1;
}
public function makeMovingLineH(_arg1:Number, _arg2:Number):void{
var _local3:* = new b2BodyDef();
var _local4:* = new b2BoxDef();
_local4.extents.Set(50, 5);
_local4.friction = 2;
_local4.restitution = 0.2;
_local4.density = 1;
_local3.position.Set(_arg1, _arg2);
_local3.AddShape(_local4);
_local3.userData = new movingLine_mc();
_local3.userData.width = 100;
_local3.userData.height = 10;
_local3.userData.x = _arg1;
_local3.userData.y = _arg2;
_local3.userData.id = "movingLineH";
_local3.userData.startY = _arg2;
_local3.userData.speed = 2;
gameCanvas.addChild(_local3.userData);
var _local5:* = m_world.CreateBody(_local3);
var _local6:b2PrismaticJointDef = new b2PrismaticJointDef();
_local6.body1 = _local5;
_local6.body2 = m_world.m_groundBody;
_local6.anchorPoint = new b2Vec2(_arg1, _arg2);
_local6.axis = new b2Vec2(1, 0);
_local6.enableMotor = true;
_local6.motorForce = 15000000;
_local6.motorSpeed = 0;
_local6.upperTranslation = 150;
_local6.lowerTranslation = -150;
_local6.enableLimit = true;
_local3.userData.joint = m_world.CreateJoint(_local6);
_local3.userData.counter = 0;
_local3.userData.direction = 1;
}
public function makePig(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:* = new b2BodyDef();
var _local6:* = new b2BoxDef();
_local6.extents.Set((_arg3 / 2), (_arg4 / 2));
_local6.friction = 0.1;
_local6.density = 1;
_local6.restitution = 0.2;
_local5.AddShape(_local6);
_local5.userData = new pig_mc();
_local5.position.Set(_arg1, _arg2);
_local5.linearDamping = 0;
_local5.angularDamping = 0.02;
_local5.userData.width = _arg3;
_local5.userData.height = _arg4;
_local5.userData.x = _arg1;
_local5.userData.y = _arg2;
_local5.userData.id = "pig";
_local5.userData.down = false;
_local5.userData.cacheAsBitmap = true;
gameCanvas.addChild(_local5.userData);
pigArray.push(_local5.userData);
_local5.userData.body = m_world.CreateBody(_local5);
}
public function makeRotator(_arg1:Number, _arg2:Number):void{
var _local5:b2Body;
var _local8:b2Body;
var _local3:* = new b2BodyDef();
var _local4:* = new b2BoxDef();
_local4.extents.Set(25, 25);
_local4.friction = 1;
_local4.density = 1;
_local4.restitution = 0.85;
_local3.AddShape(_local4);
_local3.userData = new rotator_mc();
_local3.position.Set(_arg1, _arg2);
_local3.userData.width = (_local4.extents.x * 2);
_local3.userData.height = (_local4.extents.y * 2);
_local3.userData.x = _arg1;
_local3.userData.y = _arg2;
_local3.userData.id = "rotator";
gameCanvas.addChild(_local3.userData);
_local5 = m_world.CreateBody(_local3);
var _local6:* = new b2BodyDef();
var _local7:* = new b2BoxDef();
_local7.extents.Set(1, 1);
_local7.friction = 1;
_local7.density = 0;
_local7.restitution = 0.85;
_local6.AddShape(_local7);
_local6.position.Set(_arg1, _arg2);
_local8 = m_world.CreateBody(_local6);
var _local9:b2RevoluteJointDef = new b2RevoluteJointDef();
_local9.body1 = _local5;
_local9.body2 = _local8;
_local9.anchorPoint = _local5.GetCenterPosition();
_local9.enableMotor = true;
_local9.motorTorque = 150000000;
_local9.motorSpeed = -4;
m_world.CreateJoint(_local9);
}
public function makeRotatorLong(_arg1:Number, _arg2:Number, _arg3:int):void{
var _local6:b2Body;
var _local9:b2Body;
var _local4:* = new b2BodyDef();
var _local5:* = new b2BoxDef();
_local5.extents.Set(8, 75);
_local5.friction = 1;
_local5.density = 1;
_local5.restitution = 0.85;
_local4.AddShape(_local5);
_local4.userData = new rotatorLong_mc();
_local4.position.Set(_arg1, _arg2);
_local4.userData.width = (_local5.extents.x * 2);
_local4.userData.height = (_local5.extents.y * 2);
_local4.userData.x = _arg1;
_local4.userData.y = _arg2;
_local4.userData.id = "rotator";
gameCanvas.addChild(_local4.userData);
_local6 = m_world.CreateBody(_local4);
var _local7:* = new b2BodyDef();
var _local8:* = new b2BoxDef();
_local8.extents.Set(1, 1);
_local8.friction = 1;
_local8.density = 0;
_local8.restitution = 0.85;
_local7.AddShape(_local8);
_local7.position.Set(_arg1, _arg2);
_local9 = m_world.CreateBody(_local7);
var _local10:b2RevoluteJointDef = new b2RevoluteJointDef();
_local10.body1 = _local6;
_local10.body2 = _local9;
_local10.anchorPoint = _local6.GetCenterPosition();
_local10.enableMotor = true;
_local10.motorTorque = 150000000;
_local10.motorSpeed = (-1 * _arg3);
m_world.CreateJoint(_local10);
}
public function makePivotV(_arg1:Number, _arg2:Number):void{
var _local5:b2Body;
var _local8:b2Body;
var _local3:* = new b2BodyDef();
var _local4:* = new b2BoxDef();
_local4.extents.Set(8, 75);
_local4.friction = 1;
_local4.density = 1;
_local4.restitution = 0.2;
_local3.AddShape(_local4);
_local3.userData = new pivotV_mc();
_local3.position.Set(_arg1, _arg2);
_local3.userData.width = (_local4.extents.x * 2);
_local3.userData.height = (_local4.extents.y * 2);
_local3.userData.x = _arg1;
_local3.userData.y = _arg2;
_local3.rotation = (Math.PI / 2);
_local3.userData.id = "rotator";
gameCanvas.addChild(_local3.userData);
_local5 = m_world.CreateBody(_local3);
var _local6:* = new b2BodyDef();
var _local7:* = new b2BoxDef();
_local7.extents.Set(1, 1);
_local7.friction = 1;
_local7.density = 0;
_local7.restitution = 0.85;
_local6.AddShape(_local7);
_local6.position.Set(_arg1, _arg2);
_local8 = m_world.CreateBody(_local6);
var _local9:b2RevoluteJointDef = new b2RevoluteJointDef();
_local9.body1 = _local5;
_local9.body2 = _local8;
_local9.anchorPoint = _local5.GetCenterPosition();
_local9.enableMotor = false;
m_world.CreateJoint(_local9);
}
public function makeEnemy(_arg1:Number, _arg2:Number):void{
var _local5:roundShadow_mc;
var _local3:* = new b2BodyDef();
var _local4:* = new b2CircleDef();
_local4.categoryBits = 2;
_local4.radius = 10;
_local4.friction = 1;
_local4.density = 1;
_local4.restitution = 0.85;
_local3.AddShape(_local4);
_local3.userData = new enemy_mc();
_local3.position.Set(_arg1, _arg2);
_local3.linearDamping = 0.03;
_local3.angularDamping = 0.02;
_local3.userData.width = (_local4.radius * 2);
_local3.userData.height = (_local4.radius * 2);
_local3.userData.x = _arg1;
_local3.userData.y = _arg2;
_local3.userData.id = "enemy";
gameCanvas.addChild(_local3.userData);
_local3.userData.roundShadow = new roundShadow_mc();
_local3.userData.roundShadow.width = (_local4.radius * 2);
_local3.userData.roundShadow.height = (_local4.radius * 2);
gameCanvas.addChildAt(_local3.userData.roundShadow, 0);
m_world.CreateBody(_local3);
}
public function makeBumper(_arg1:Number, _arg2:Number):void{
var _local3:* = new b2BodyDef();
var _local4:* = new b2CircleDef();
_local4.radius = 25;
_local4.friction = 1;
_local4.density = 0;
_local4.restitution = 1;
_local3.AddShape(_local4);
_local3.userData = new bumper_mc();
_local3.userData.cacheAsBitmap = true;
_local3.position.Set(_arg1, _arg2);
_local3.userData.width = 54.2;
_local3.userData.height = 54.2;
_local3.userData.x = _arg1;
_local3.userData.y = _arg2;
_local3.userData.id = "bumper";
gameCanvas.addChild(_local3.userData);
m_world.CreateBody(_local3);
}
public function makeLifeBonus(_arg1:Number, _arg2:Number):void{
var _local3:* = new b2BodyDef();
var _local4:* = new b2CircleDef();
_local4.radius = 23;
_local4.friction = 1;
_local4.density = 0;
_local4.restitution = 0.2;
_local3.AddShape(_local4);
_local3.userData = new lifeBonus_mc();
_local3.userData.cacheAsBitmap = true;
_local3.position.Set(_arg1, _arg2);
_local3.userData.width = 50;
_local3.userData.height = 50;
_local3.userData.x = _arg1;
_local3.userData.y = _arg2;
_local3.userData.id = "lifeBonus";
gameCanvas.addChild(_local3.userData);
m_world.CreateBody(_local3);
}
public function makeSlowBonus(_arg1:Number, _arg2:Number):void{
var _local3:* = new b2BodyDef();
var _local4:* = new b2CircleDef();
_local4.radius = 23;
_local4.friction = 1;
_local4.density = 0;
_local4.restitution = 1;
_local3.AddShape(_local4);
_local3.userData = new slowBonus_mc();
_local3.userData.cacheAsBitmap = true;
_local3.position.Set(_arg1, _arg2);
_local3.userData.width = 50;
_local3.userData.height = 50;
_local3.userData.x = _arg1;
_local3.userData.y = _arg2;
_local3.userData.id = "slowBonus";
gameCanvas.addChild(_local3.userData);
m_world.CreateBody(_local3);
}
public function makeRapidFire(_arg1:Number, _arg2:Number):void{
var _local3:*;
var _local4:*;
if (rapidFireOn == false){
_local3 = new b2BodyDef();
_local4 = new b2CircleDef();
_local4.radius = 23;
_local4.friction = 1;
_local4.density = 0;
_local4.restitution = 1;
_local3.AddShape(_local4);
_local3.userData = new rapidFire_mc();
_local3.userData.cacheAsBitmap = true;
_local3.position.Set(_arg1, _arg2);
_local3.userData.width = 50;
_local3.userData.height = 50;
_local3.userData.x = _arg1;
_local3.userData.y = _arg2;
_local3.userData.id = "rapidFire";
gameCanvas.addChild(_local3.userData);
m_world.CreateBody(_local3);
};
}
public function makePuck(_arg1:Number, _arg2:Number, _arg3:String, _arg4:Number){
var _local7:roundShadow_mc;
var _local8:highlight_mc;
numberOfPucks++;
var _local5:* = new b2BodyDef();
var _local6:* = new b2CircleDef();
_local6.radius = (_arg4 / 2);
_local6.friction = 0.15;
_local6.density = 0;
_local6.restitution = 1;
_local6.categoryBits = 2;
_local5.AddShape(_local6);
if (_arg3 == "yellow"){
_local5.userData = new puckYellow_mc();
_local5.userData.color = "yellow";
};
if (_arg3 == "blue"){
_local5.userData = new puckBlue_mc();
_local5.userData.color = "blue";
};
if (_arg3 == "red"){
_local5.userData = new puckRed_mc();
_local5.userData.color = "red";
};
if (_arg3 == "green"){
_local5.userData = new puckGreen_mc();
_local5.userData.color = "green";
};
puckArray[numberOfPucks] = _local5.userData;
puckArray[numberOfPucks].arrayPosition = numberOfPucks;
puckArray[numberOfPucks].active = true;
_local5.userData.id = "puck";
_local5.userData.startX = _arg1;
_local5.userData.startY = _arg2;
_local5.linearDamping = 0.02;
_local5.angularDamping = 0.02;
_local5.position.Set(_arg1, _arg2);
_local5.userData.x = _arg1;
_local5.userData.y = _arg2;
_local5.userData.width = (_local6.radius * 2);
_local5.userData.height = (_local6.radius * 2);
_local5.userData.roundShadow = new roundShadow_mc();
_local5.userData.roundShadow.alpha = 0.4;
_local5.userData.roundShadow.width = (_local6.radius * 2);
_local5.userData.roundShadow.height = (_local6.radius * 2);
gameCanvas.addChildAt(_local5.userData.roundShadow, 0);
gameCanvas.addChild(_local5.userData);
_local5.userData.highlight = new highlight_mc();
_local5.userData.highlight.width = (_local6.radius * 1.7);
_local5.userData.highlight.height = (_local6.radius * 1.7);
_local5.userData.highlight.alpha = 0.6;
gameCanvas.addChild(_local5.userData.highlight);
_local5.userData.body = m_world.CreateBody(_local5);
}
public function makeMyBall(_arg1:Number, _arg2:Number){
var _local3:* = new b2BodyDef();
var _local4:* = new b2CircleDef();
_local4.radius = myBallRadius;
_local4.friction = 0.05;
_local4.density = 0.7;
_local4.restitution = 0.6;
_local4.categoryBits = 2;
_local3.AddShape(_local4);
_local3.userData = new myBall_mc();
_local3.userData.monkey.monkeyAnim.gotoAndStop(1);
_local3.userData.id = "myBall";
_local3.userData.startX = _arg1;
_local3.userData.startY = _arg2;
_local3.userData.fired = false;
_local3.linearDamping = 0.008;
_local3.angularDamping = 0.01;
_local3.position.Set(_arg1, _arg2);
_local3.userData.x = _arg1;
_local3.userData.y = _arg2;
_local3.userData.width = (_local3.userData.width * ((myBallRadius * 2) / 100));
_local3.userData.height = (_local3.userData.height * ((myBallRadius * 2) / 100));
gameCanvas.addChild(_local3.userData);
myBall = m_world.CreateBody(_local3);
myBallArray.push(myBall);
}
public function createTravelator(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:travelatorRight_mc;
var _local5:travelatorLeft_mc;
var _local6:travelatorDown_mc;
var _local7:travelatorUp_mc;
numberOfTravelators++;
if (_arg3 == "right"){
_local4 = new travelatorRight_mc();
travelator[numberOfTravelators] = _local4;
};
if (_arg3 == "left"){
_local5 = new travelatorLeft_mc();
travelator[numberOfTravelators] = _local5;
};
if (_arg3 == "down"){
_local6 = new travelatorDown_mc();
travelator[numberOfTravelators] = _local6;
};
if (_arg3 == "up"){
_local7 = new travelatorUp_mc();
travelator[numberOfTravelators] = _local7;
};
gameCanvas.addChildAt(travelator[numberOfTravelators], 0);
travelator[numberOfTravelators].x = _arg1;
travelator[numberOfTravelators].y = _arg2;
if ((((_arg3 == "left")) || ((_arg3 == "right")))){
travelator[numberOfTravelators].width = 100;
travelator[numberOfTravelators].height = 30;
} else {
travelator[numberOfTravelators].width = 30;
travelator[numberOfTravelators].height = 100;
};
travelator[numberOfTravelators].variety = _arg3;
}
public function createGround():void{
var _local1:* = new b2BodyDef();
var _local2:* = new b2BoxDef();
_local2.extents.Set(500, 100);
_local2.friction = 0.8;
_local2.restitution = 0.1;
_local2.density = 0;
_local1.position.Set(0, 269);
_local1.AddShape(_local2);
_local1.userData = new MovieClip();
_local1.userData.id = "ground";
m_world.CreateBody(_local1);
}
public function fadeInOut():void{
blackScreen = new blackScreen_mc();
blackScreen.alpha = 0;
stage.addChild(blackScreen);
var _local1:Tween = new Tween(blackScreen, "alpha", None.easeNone, 0, 1, 0.5, true);
setTimeout(fadeOut, 510);
}
public function fadeInOutSlow():void{
blackScreen = new blackScreen_mc();
blackScreen.alpha = 0;
stage.addChild(blackScreen);
var _local1:Tween = new Tween(blackScreen, "alpha", None.easeNone, 0, 1, 2, true);
setTimeout(fadeOut, 2010);
}
public function fadeOut():void{
fadeOutTween = new Tween(blackScreen, "alpha", None.easeNone, 1, 0, 0.5, true);
fadeOutTween.addEventListener(TweenEvent.MOTION_FINISH, removeBlackScreen);
}
public function removeBlackScreen(_arg1:TweenEvent):void{
fadeOutTween.removeEventListener(TweenEvent.MOTION_FINISH, removeBlackScreen);
stage.removeChild(blackScreen);
}
public function gameLoop(_arg1:Event):void{
if (gameRunning == true){
processGameFunctions();
};
}
public function processGameFunctions():void{
displayFPS();
removeHaystacks();
updatePhysics();
checkCollisions();
moveCow();
updateBonus();
updateGUI();
moveEnemies();
controlEGs();
checkNonPhysicsCollisions();
checkStarCollisions();
checkCowOnScreen();
}
public function checkCowOnScreen():void{
var _local1:MovieClip = myCow.m_userData;
var _local2:MovieClip = myTarget.m_userData;
if ((((((cowOffScreen == false)) && ((bombExploded == false)))) && ((_local1.targetReached == false)))){
if ((((((((_local1.x > (300 + (_local1.width / 2)))) || ((_local1.x < (-300 - (_local1.width / 2)))))) || ((_local2.x > (300 + (_local2.width / 2)))))) || ((_local2.x < (-300 - (_local2.width / 2)))))){
cowOffScreen = true;
fadeInOut();
setTimeout(resetLevelDirect, 500);
};
};
}
public function updateBonus():void{
if ((((userMode == false)) && ((editMode == false)))){
bonus = (bonus - 0.03);
};
}
public function removeHaystacks():void{
var _local1:uint;
var _local2:MovieClip;
var _local3:Array;
var _local4:int;
var _local5:b2AABB;
var _local6:b2Vec2;
var _local7:*;
var _local8:uint;
var _local9:*;
var _local10:*;
var _local11:Boolean;
if (delayStart == false){
_local1 = 0;
while (_local1 < haystackArray.length) {
haystackArray[_local1].filters = [];
_local1++;
};
_local2 = null;
_local3 = new Array();
_local4 = 1000;
_local5 = new b2AABB();
_local5.maxVertex.x = (gameCanvas.mouseX + 1);
_local5.minVertex.x = gameCanvas.mouseX;
_local5.maxVertex.y = (gameCanvas.mouseY + 1);
_local5.minVertex.y = gameCanvas.mouseY;
_local6 = new b2Vec2(gameCanvas.mouseX, gameCanvas.mouseY);
_local7 = m_world.Query(_local5, _local3, _local4);
if (_local7 > 0){
_local8 = 0;
while (_local8 < _local7) {
_local9 = (_local3[_local8] as b2Shape);
_local10 = _local9.GetBody().m_userData;
if (_local10.hasOwnProperty("id")){
if (_local10.id == "haystack"){
_local11 = _local9.TestPoint(_local6);
if (_local11 == true){
_local2 = _local10;
};
};
};
_local8++;
};
};
if (_local2 != null){
if (mouseIsDown == true){
deleteBody(_local2.body);
if (soundOn == true){
popSound.play();
};
} else {
_local2.filters = [new GlowFilter(0xFFFFFF, 0.75, 25, 25, 2, 2, false, false)];
};
};
};
}
public function checkLevelComplete():void{
}
public function checkStarCollisions():void{
var _local3:uint;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local1:Number = ((21 + myBallRadius) * (21 + myBallRadius));
var _local2:uint;
while (_local2 < myBallArray.length) {
_local3 = 0;
while (_local3 < starArray.length) {
if (starArray[_local3].visible == true){
_local4 = (myBallArray[_local2].m_userData.x - starArray[_local3].x);
_local5 = (myBallArray[_local2].m_userData.y - starArray[_local3].y);
_local6 = ((_local4 * _local4) + (_local5 * _local5));
if (_local6 <= _local1){
collectStar(starArray[_local3]);
};
};
_local3++;
};
_local2++;
};
}
public function collectStar(_arg1:MovieClip):void{
var _local2:annihilationEffect_mc = new annihilationEffect_mc();
gameCanvas.addChild(_local2);
if (soundOn == true){
};
_local2.x = _arg1.x;
_local2.y = _arg1.y;
_local2.width = (_local2.width * 0.5);
_local2.height = (_local2.height * 0.5);
var _local3:bonusDisplay_mc = new bonusDisplay_mc();
gameCanvas.addChild(_local3);
var _local4:Number = 100;
bonus = (bonus + _local4);
_local3.textField.text = String(_local4);
_local3.x = _local2.x;
_local3.y = _local2.y;
_arg1.visible = false;
}
public function aimArrow():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:*;
var _local5:Number;
var _local6:b2Vec2;
var _local7:explosion_mc;
var _local8:Tween;
if (aim == true){
arrow.x = myBall.m_userData.startX;
arrow.y = myBall.m_userData.startY;
if (delayStart == true){
myBall.m_userData.x = arrow.x;
myBall.m_userData.y = (arrow.y - 50);
myBall.SetCenterPosition(new b2Vec2(myBall.m_userData.x, myBall.m_userData.y), 0);
};
myBall.SetLinearVelocity(new b2Vec2(0, 0));
arrow.turret.scalableArrow.visible = true;
if ((((mouseIsDown == false)) && ((delayStart == false)))){
myBall.m_userData.monkey.monkeyAnim.gotoAndStop(1);
_local1 = (gameCanvas.mouseX - arrow.x);
_local2 = (gameCanvas.mouseY - arrow.y);
_local3 = (Math.sqrt(((_local1 * _local1) + (_local2 * _local2))) - 50);
if (_local3 > 200){
_local3 = 200;
};
if (_local3 < 20){
_local3 = 20;
};
arrow.turret.rotation = 0;
arrow.turret.scalableArrow.height = _local3;
oldArrow.storeWidth = arrow.turret.scalableArrow.height;
impulseSize = (_local3 / 2);
_local4 = Math.atan2(_local2, _local1);
arrow.turret.rotation = (((180 / Math.PI) * _local4) + 90);
myBall.m_userData.x = (arrow.x + (50 * Math.cos(_local4)));
myBall.m_userData.y = (arrow.y + (50 * Math.sin(_local4)));
myBall.SetCenterPosition(new b2Vec2(myBall.m_userData.x, myBall.m_userData.y), ((Math.PI / 180) * arrow.turret.rotation));
};
if ((((((((mouseIsDown == true)) && ((stage.mouseY > 50)))) && ((stage.mouseY < 550)))) && ((delayStart == false)))){
myBall.m_userData.fired = true;
_local5 = 18000;
_local6 = new b2Vec2(((_local5 * impulseSize) * Math.cos((((arrow.turret.rotation - 90) * Math.PI) / 180))), ((_local5 * impulseSize) * Math.sin((((arrow.turret.rotation - 90) * Math.PI) / 180))));
myBall.WakeUp();
myBall.ApplyImpulse(_local6, myBall.GetCenterPosition());
myBall.m_userData.monkey.monkeyAnim.gotoAndStop(2);
_local7 = new explosion_mc();
gameCanvas.addChild(_local7);
if (soundOn == true){
};
_local7.x = myBall.m_userData.x;
_local7.y = myBall.m_userData.y;
_local7.width = (_local7.width * 0.5);
_local7.height = (_local7.height * 0.5);
myBall.m_userData.monkey.flame.alpha = 1;
_local8 = new Tween(myBall.m_userData.monkey.flame, "alpha", None.easeNone, 1, 0, 2, true);
tweenArray.push(_local8);
aim = false;
flying = true;
arrow.turret.scalableArrow.visible = false;
oldArrow.x = arrow.x;
oldArrow.y = arrow.y;
oldArrow.visible = true;
oldArrow.turret.rotation = 0;
oldArrow.turret.scalableArrow.height = oldArrow.storeWidth;
oldArrow.turret.rotation = arrow.turret.rotation;
lives--;
if (lives > 0){
setTimeout(reload, 2000);
};
};
};
}
public function increaseScore():void{
var _local1:int;
if (myBall.m_userData.y > maxBallY){
_local1 = (myBall.m_userData.y - storeBallY);
if (_local1 > 0){
score = (score + _local1);
};
};
storeBallY = myBall.m_userData.y;
if (storeBallY > maxBallY){
maxBallY = storeBallY;
};
}
public function moveCow():void{
if (myCow != null){
if (leftKeyDown == true){
myCow.WakeUp();
myCow.ApplyTorque(-(torque));
myCow.ApplyForce(new b2Vec2(-100000, 0), myCow.GetCenterPosition());
};
if (rightKeyDown == true){
myCow.WakeUp();
myCow.ApplyTorque(torque);
myCow.ApplyForce(new b2Vec2(100000, 0), myCow.GetCenterPosition());
};
if (myCow.GetAngularVelocity() > maxAngVel){
myCow.SetAngularVelocity(maxAngVel);
};
if (myCow.GetAngularVelocity() < -(maxAngVel)){
myCow.SetAngularVelocity(-(maxAngVel));
};
};
}
public function scrollGameCanvas(){
}
public function moveSideWalls():void{
sideWall[1].SetCenterPosition(new b2Vec2(-295, (-(gameCanvas.y) + 300)), 0);
sideWall[2].SetCenterPosition(new b2Vec2(295, (-(gameCanvas.y) + 300)), 0);
}
public function removeInactiveBodies(){
var _local3:b2Body;
var _local6:Point;
var _local7:Point;
var _local1:b2Body = m_world.m_bodyList;
var _local2:* = m_world.m_bodyCount;
var _local4:Boolean;
var _local5:* = 0;
while (_local5 < (_local2 - 1)) {
if (_local4 == false){
_local3 = _local1;
_local1 = _local1.m_next;
if (_local3.hasOwnProperty("m_userData")){
if (_local3.m_userData != null){
_local6 = new Point(0, _local3.m_userData.y);
_local7 = gameCanvas.localToGlobal(_local6);
if (_local3.m_userData.id == "levelComplete"){
if ((((_local7.y < 300)) && ((_local7.y > 0)))){
trace(("levelEnd.y: " + _local7.y));
_local4 = true;
levelComplete();
};
};
if (_local4 == false){
if (_local7.y < -50){
if (_local3.hasOwnProperty("m_userData")){
if (_local3.m_userData != null){
if (_local3.m_userData.hasOwnProperty("roundShadow")){
gameCanvas.removeChild(_local3.m_userData.roundShadow);
};
if (_local3.m_userData.hasOwnProperty("squareShadow")){
gameCanvas.removeChild(_local3.m_userData.squareShadow);
};
if (_local3.m_userData.hasOwnProperty("highlight") == true){
gameCanvas.removeChild(_local3.m_userData.highlight);
};
gameCanvas.removeChild(_local3.m_userData);
_local3.m_userData = null;
};
};
m_world.DestroyBody(_local3);
};
};
};
};
};
_local5++;
};
}
public function removeInactiveObjects():void{
var _local1:uint;
var _local2:uint;
var _local3:DisplayObject;
var _local5:Point;
var _local6:Point;
var _local4:* = 0;
while (_local4 <= (gameCanvas.numChildren - 1)) {
_local3 = gameCanvas.getChildAt(_local4);
_local5 = new Point(0, _local3.y);
_local6 = gameCanvas.localToGlobal(_local5);
if (_local6.y < -50){
_local2 = numberOfTravelators;
_local1 = 1;
while (_local1 <= _local2) {
if (_local3 == travelator[_local1]){
gameCanvas.removeChildAt(_local4);
};
_local1++;
};
_local2 = numberOfHintBoxes;
_local1 = 1;
while (_local1 <= _local2) {
if (_local3 == hintBoxArray[_local1]){
gameCanvas.removeChildAt(_local4);
};
_local1++;
};
_local2 = numberOfTeleports;
_local1 = 1;
while (_local1 <= _local2) {
if (_local3 == teleportArray[_local1]){
gameCanvas.removeChildAt(_local4);
};
_local1++;
};
_local2 = numberOfEGs;
_local1 = 1;
while (_local1 <= _local2) {
if (_local3 == egArray[_local1]){
gameCanvas.removeChildAt(_local4);
egArray[_local1].active = false;
};
_local1++;
};
};
_local4++;
};
}
public function updateGUI():void{
gui.bonus.text = String(Math.round(bonus));
}
public function flashScoreOff():void{
gui.lives.visible = false;
}
public function flashScoreOn():void{
gui.lives.visible = true;
}
public function checkTargetReached(_arg1:b2Body, _arg2:b2Body):void{
var _local3:MovieClip;
var _local4:MovieClip;
var _local5:*;
if (bombExploded == false){
if (((_arg1.hasOwnProperty("m_userData")) && (_arg2.hasOwnProperty("m_userData")))){
if (((!((_arg1.m_userData == null))) && (!((_arg2.m_userData == null))))){
if ((((_arg1.m_userData.id == "cow")) && ((_arg2.m_userData.id == "target")))){
_local3 = _arg1.m_userData;
_local4 = _arg2.m_userData;
} else {
if ((((_arg2.m_userData.id == "cow")) && ((_arg1.m_userData.id == "target")))){
_local4 = _arg1.m_userData;
_local3 = _arg2.m_userData;
};
};
};
};
if (_local3 != null){
if (_local3.targetReached == false){
_local3.targetReached = true;
_local4.play();
_local5 = new starburst_mc();
gameCanvas.addChild(_local5);
_local5.x = _local3.x;
_local5.y = _local3.y;
setTimeout(moveCowAway, 2000, myCow);
if (soundOn == true){
oink1Sound.play();
};
};
};
};
}
public function checkNonPhysicsCollisions():void{
var _local3:MovieClip;
var _local11:Number;
var _local12:Number;
var _local1:b2Body = m_world.m_bodyList;
var _local2:* = m_world.m_bodyCount;
var _local4:b2Vec2 = new b2Vec2(160, 0);
var _local5:b2Vec2 = new b2Vec2(-160, 0);
var _local6:b2Vec2 = new b2Vec2(0, 160);
var _local7:b2Vec2 = new b2Vec2(0, -160);
var _local8:uint;
var _local9:uint;
var _local10:* = 0;
while (_local10 < (_local2 - 1)) {
if (numberOfTravelators > 0){
_local8 = 1;
while (_local8 <= numberOfTravelators) {
if (_local1.hasOwnProperty("m_userData") == true){
if (_local1.m_userData != null){
if (_local1.m_userData.id != "target"){
if ((((((((((((_local1.m_userData.hitTestObject(travelator[_local8].hitZone1) == true)) || ((_local1.m_userData.hitTestObject(travelator[_local8].hitZone2) == true)))) || ((_local1.m_userData.hitTestObject(travelator[_local8].hitZone3) == true)))) || ((_local1.m_userData.hitTestObject(travelator[_local8].hitZone4) == true)))) || ((_local1.m_userData.hitTestObject(travelator[_local8].hitZone5) == true)))) || ((_local1.m_userData.hitTestObject(travelator[_local8].hitZone6) == true)))){
if (travelator[_local8].variety == "left"){
_local1.SetLinearVelocity(_local5);
};
if (travelator[_local8].variety == "right"){
_local1.SetLinearVelocity(_local4);
};
if (travelator[_local8].variety == "down"){
_local1.SetLinearVelocity(_local6);
};
if (travelator[_local8].variety == "up"){
_local1.SetLinearVelocity(_local7);
};
};
} else {
if ((((((((((((_local1.m_userData.hitZone.hitTestObject(travelator[_local8].hitZone1) == true)) || ((_local1.m_userData.hitZone.hitTestObject(travelator[_local8].hitZone2) == true)))) || ((_local1.m_userData.hitZone.hitTestObject(travelator[_local8].hitZone3) == true)))) || ((_local1.m_userData.hitZone.hitTestObject(travelator[_local8].hitZone4) == true)))) || ((_local1.m_userData.hitZone.hitTestObject(travelator[_local8].hitZone5) == true)))) || ((_local1.m_userData.hitZone.hitTestObject(travelator[_local8].hitZone6) == true)))){
if (travelator[_local8].variety == "left"){
_local1.SetLinearVelocity(_local5);
};
if (travelator[_local8].variety == "right"){
_local1.SetLinearVelocity(_local4);
};
if (travelator[_local8].variety == "down"){
_local1.SetLinearVelocity(_local6);
};
if (travelator[_local8].variety == "up"){
_local1.SetLinearVelocity(_local7);
};
};
};
};
};
_local8++;
};
};
if (numberOfTeleports > 0){
_local8 = 1;
while (_local8 <= numberOfTeleports) {
if (teleportArray[_local8].variety == "in"){
if (_local1.hasOwnProperty("m_userData") == true){
if (_local1.m_userData != null){
if (((!((_local1.m_userData.id == "wall"))) && (!((_local1.m_userData.id == "line"))))){
_local11 = (((_local1.m_userData.x - teleportArray[_local8].x) * (_local1.m_userData.x - teleportArray[_local8].x)) + ((_local1.m_userData.y - teleportArray[_local8].y) * (_local1.m_userData.y - teleportArray[_local8].y)));
_local12 = ((teleportArray[_local8].width / 2) + (_local1.m_userData.width / 2));
if (_local11 <= (_local12 * _local12)){
_local1.m_position.x = teleportArray[_local8].pair.x;
_local1.m_position.y = teleportArray[_local8].pair.y;
};
};
};
};
};
_local8++;
};
};
_local1 = _local1.m_next;
_local10++;
};
}
public function updateCrosshairs():void{
}
public function aimGun(){
}
public function fireBullet():void{
var _local2:b2Body;
var _local3:Point;
var _local4:Point;
var _local5:Point;
var _local6:Number;
var _local7:*;
var _local8:b2Vec2;
var _local1:Boolean;
if (rapidFireOn == true){
if (rapidFireCounter >= 5){
rapidFireCounter = 0;
};
if (rapidFireCounter == 0){
_local1 = true;
};
rapidFireCounter++;
};
if (mouseIsDown == true){
if ((((((rapidFireOn == false)) && ((preventFiring == false)))) || ((_local1 == true)))){
if (crosshairs.visible == true){
preventFiring = true;
_local3 = new Point(gun.x, gun.y);
_local4 = gunCanvas.localToGlobal(_local3);
_local5 = gameCanvas.globalToLocal(_local4);
_local2 = makeBullet(_local2, _local5.x, _local5.y);
_local6 = (((gun.turret.rotation * Math.PI) / 180) - ((gameCanvas.rotation * Math.PI) / 180));
_local7 = 100000;
_local8 = new b2Vec2((_local7 * Math.sin(_local6)), (-(_local7) * Math.cos(_local6)));
_local2.ApplyImpulse(_local8, _local2.GetCenterPosition());
if (soundOn == true){
};
discsUsed++;
};
};
};
}
public function makeBullet(_arg1:b2Body, _arg2:Number, _arg3:Number):b2Body{
var _local6:roundShadow_mc;
var _local4:* = new b2BodyDef();
var _local5:* = new b2CircleDef();
_local5.radius = 7;
_local5.friction = 1;
_local5.density = 2;
_local5.restitution = 1;
_local4.AddShape(_local5);
_local4.userData = new bullet_mc();
_local4.position.Set(_arg2, _arg3);
_local4.linearDamping = 0.015;
_local4.angularDamping = 0.02;
_local4.userData.width = (_local5.radius * 2);
_local4.userData.height = (_local5.radius * 2);
_local4.userData.x = _arg2;
_local4.userData.y = _arg3;
_local4.userData.id = "bullet";
gameCanvas.addChild(_local4.userData);
_local4.userData.roundShadow = new roundShadow_mc();
_local4.userData.roundShadow.width = (_local5.radius * 2.2);
_local4.userData.roundShadow.height = (_local5.radius * 2.2);
_local4.userData.roundShadow.x = _arg2;
_local4.userData.roundShadow.y = _arg3;
_local4.userData.roundShadow.alpha = 0.4;
gameCanvas.addChildAt(_local4.userData.roundShadow, 1);
_arg1 = m_world.CreateBody(_local4);
setTimeout(deleteBody, 5000, _arg1);
var _local7:Tween = new Tween(_arg1.m_userData, "alpha", Strong.easeIn, 1, 0, 5, true);
var _local8:Tween = new Tween(_arg1.m_userData.roundShadow, "alpha", Strong.easeIn, 0.4, 0, 5, true);
tweenArray.push(_local7);
tweenArray.push(_local8);
return (_arg1);
}
public function fireEnemyBullet(_arg1:MovieClip):void{
var _local2:b2Body;
_local2 = makeEnemyBullet(_local2, _arg1.x, _arg1.y);
var _local3:Number = ((_arg1.rotation * Math.PI) / 180);
var _local4:* = 100000;
var _local5:b2Vec2 = new b2Vec2((_local4 * Math.sin(_local3)), (-(_local4) * Math.cos(_local3)));
_local2.ApplyImpulse(_local5, _local2.GetCenterPosition());
if (soundOn == true){
};
}
public function makeEnemyBullet(_arg1:b2Body, _arg2:Number, _arg3:Number):b2Body{
var _local6:roundShadow_mc;
var _local7:Tween;
var _local8:Tween;
var _local4:* = new b2BodyDef();
var _local5:* = new b2CircleDef();
_local5.radius = 7;
_local5.friction = 1;
_local5.density = 2;
_local5.restitution = 1;
_local4.AddShape(_local5);
_local4.userData = new enemyBullet_mc();
_local4.position.Set(_arg2, _arg3);
_local4.linearDamping = 0.015;
_local4.angularDamping = 0.02;
_local4.userData.width = (_local5.radius * 2);
_local4.userData.height = (_local5.radius * 2);
_local4.userData.id = "bullet";
_local4.userData.x = _arg2;
_local4.userData.y = _arg3;
gameCanvas.addChild(_local4.userData);
_local4.userData.roundShadow = new roundShadow_mc();
_local4.userData.roundShadow.width = (_local5.radius * 2.2);
_local4.userData.roundShadow.height = (_local5.radius * 2.2);
_local4.userData.roundShadow.alpha = 0.4;
_local4.userData.roundShadow.x = _arg2;
_local4.userData.roundShadow.y = _arg3;
gameCanvas.addChildAt(_local4.userData.roundShadow, 1);
_arg1 = m_world.CreateBody(_local4);
setTimeout(deleteBody, 5000, _arg1);
_local7 = new Tween(_arg1.m_userData, "alpha", Strong.easeIn, 1, 0, 5, true);
_local8 = new Tween(_arg1.m_userData.roundShadow, "alpha", Strong.easeIn, 0.4, 0, 5, true);
tweenArray.push(_local7);
tweenArray.push(_local8);
return (_arg1);
}
public function deleteBody(_arg1):void{
if (cleaned == false){
if (_arg1.hasOwnProperty("m_userData")){
if (_arg1.m_userData != null){
if (_arg1.m_userData.hasOwnProperty("roundShadow")){
gameCanvas.removeChild(_arg1.m_userData.roundShadow);
};
if (_arg1.m_userData.hasOwnProperty("squareShadow")){
gameCanvas.removeChild(_arg1.m_userData.squareShadow);
};
if (_arg1.m_userData.hasOwnProperty("highlight")){
gameCanvas.removeChild(_arg1.m_userData.highlight);
};
gameCanvas.removeChild(_arg1.m_userData);
_arg1.m_userData = null;
m_world.DestroyBody(_arg1);
};
};
};
}
public function controlEGs():void{
var _local1:uint;
var _local2:MovieClip;
_local1 = 1;
while (_local1 <= numberOfEGs) {
_local2 = egArray[_local1];
if (_local2.active == true){
_local2.rotation = 45;
if (_local2.counter == 0){
fireEnemyBullet(_local2);
};
_local2.counter++;
if (_local2.counter >= 40){
_local2.counter = 0;
};
};
_local1++;
};
}
public function moveEnemies():void{
var _local1:MovieClip;
var _local2:b2Body;
var _local3:b2Vec2;
var _local4:Number;
var _local5:uint;
var _local6:Number;
var _local7:*;
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:*;
var _local17:b2Vec2;
_local1 = null;
_local2 = m_world.m_bodyList;
while (_local2) {
if ((_local2.m_userData is Sprite)){
if (_local2.m_userData.id == "enemy"){
_local3 = _local2.GetCenterPosition();
_local4 = 100000000;
_local5 = 1;
while (_local5 <= numberOfPucks) {
if (puckArray[_local5].active == true){
_local6 = (((_local3.x - puckArray[_local5].x) * (_local3.x - puckArray[_local5].x)) + ((_local3.y - puckArray[_local5].y) * (_local3.y - puckArray[_local5].y)));
if (_local6 < _local4){
_local4 = _local6;
_local1 = puckArray[_local5];
};
};
_local5++;
};
if (_local1 != null){
_local7 = _local4;
_local8 = 3200;
_local9 = 0;
_local10 = wrapvalue((Math.atan2((_local1.y - _local3.y), (_local1.x - _local3.x)) - (Math.PI / 2)));
_local11 = wrapvalue((Math.atan2((_local1.y - (_local1.y - 20)), 0) - (Math.PI / 2)));
_local12 = differenceBetweenBearings(_local10, _local11);
if ((((_local7 <= _local8)) && ((Math.abs(_local12) > ((30 * Math.PI) / 180))))){
if (_local12 > 0){
_local9 = Math.atan2((_local3.y - _local1.y), (_local3.x - _local1.x));
} else {
_local9 = (Math.atan2((_local3.y - _local1.y), (_local3.x - _local1.x)) - Math.PI);
};
} else {
_local9 = (Math.atan2((_local3.y - _local1.y), (_local3.x - _local1.x)) - (Math.PI / 2));
};
_local13 = _local2.GetRotation();
if (_local13 < 0){
_local13 = (_local13 + (2 * Math.PI));
_local2.SetCenterPosition(_local2.GetCenterPosition(), _local13);
};
if (_local13 > (2 * Math.PI)){
_local13 = (_local13 - (2 * Math.PI));
_local2.SetCenterPosition(_local2.GetCenterPosition(), _local13);
};
_local14 = _local9;
if (_local14 < 0){
_local14 = (_local14 + (2 * Math.PI));
};
if (_local14 > (2 * Math.PI)){
_local14 = (_local14 - (2 * Math.PI));
};
_local15 = (_local14 - _local13);
if (_local15 > 0){
if (_local15 > Math.PI){
_local2.SetCenterPosition(_local2.GetCenterPosition(), (_local2.GetRotation() - ((2 * Math.PI) / 180)));
} else {
_local2.SetCenterPosition(_local2.GetCenterPosition(), (_local2.GetRotation() + ((2 * Math.PI) / 180)));
};
};
if (_local15 < 0){
if (_local15 < -(Math.PI)){
_local2.SetCenterPosition(_local2.GetCenterPosition(), (_local2.GetRotation() + ((2 * Math.PI) / 180)));
} else {
_local2.SetCenterPosition(_local2.GetCenterPosition(), (_local2.GetRotation() - ((2 * Math.PI) / 180)));
};
};
_local16 = 400;
_local17 = new b2Vec2((_local16 * Math.sin(_local9)), (-(_local16) * Math.cos(_local9)));
_local2.ApplyImpulse(_local17, _local2.GetCenterPosition());
};
};
};
_local2 = _local2.m_next;
};
}
public function wrapvalue(_arg1:Number):Number{
if (_arg1 < 0){
_arg1 = (_arg1 + (2 * Math.PI));
};
if (_arg1 > (2 * Math.PI)){
_arg1 = (_arg1 - (2 * Math.PI));
};
return (_arg1);
}
public function differenceBetweenBearings(_arg1:Number, _arg2:Number){
var _local3:Number;
_local3 = (wrapvalue(((_arg1 + Math.PI) - _arg2)) - Math.PI);
return (_local3);
}
public function checkMonkeyDead():void{
var _local1:uint;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Point;
var _local6:Point;
var _local7:explosion_mc;
_local1 = 0;
while (_local1 < myBallArray.length) {
if ((((myBallArray[_local1].m_userData.visible == true)) && ((myBallArray[_local1].m_userData.fired == true)))){
_local2 = Math.abs(myBallArray[_local1].GetLinearVelocity().x);
_local3 = Math.abs(myBallArray[_local1].GetLinearVelocity().y);
_local4 = ((_local2 * _local2) + (_local3 * _local3));
if (_local4 < 100){
stillCounter++;
} else {
stillCounter = 0;
};
if (stillCounter >= 50){
removeMonkey(myBallArray[_local1]);
};
_local5 = new Point(myBallArray[_local1].m_userData.x, myBallArray[_local1].m_userData.y);
_local6 = gameCanvas.localToGlobal(_local5);
if ((((((((_local6.y < 0)) || ((_local6.y > 600)))) || ((_local6.x > 600)))) || ((_local6.x < 0)))){
_local7 = new explosion_mc();
gameCanvas.addChild(_local7);
if (soundOn == true){
};
_local7.x = _local5.x;
_local7.y = _local5.y;
_local7.width = (_local7.width * 0.5);
_local7.height = (_local7.height * 0.5);
removeMonkey(myBallArray[_local1]);
};
};
_local1++;
};
}
public function removeMonkey(_arg1:b2Body):void{
_arg1.SetCenterPosition(new b2Vec2(1000, 1000), 0);
_arg1.m_userData.visible = false;
}
public function reload():void{
makeMyBall(myBall.m_userData.startX, myBall.m_userData.startY);
aim = true;
gameCanvas.swapChildren(arrow, myBall.m_userData);
}
public function showReload():void{
}
public function hideReload():void{
}
public function placeStar():void{
myBall.m_userData.x = myBall.m_userData.startX;
myBall.m_userData.y = myBall.m_userData.startY;
}
public function continueGame(_arg1:MouseEvent):void{
gameRunning = true;
stage.removeEventListener(MouseEvent.MOUSE_DOWN, continueGame);
gui.message.visible = false;
}
public function setGameOver():void{
gameOver = true;
}
public function deleteBonusDisplay(_arg1:bonusDisplay_mc):void{
stage.removeChild(_arg1);
}
public function updatePhysics():void{
var _local1:b2Body;
m_world.Step(m_timeStep, m_iterations);
_local1 = m_world.m_bodyList;
while (_local1) {
if ((_local1.m_userData is Sprite)){
if (_local1.m_userData.id == "movingLineV"){
_local1.WakeUp();
_local1.m_userData.counter++;
_local1.m_userData.joint.SetMotorSpeed((_local1.m_userData.direction * 60));
if (_local1.m_userData.counter > 150){
_local1.m_userData.direction = (_local1.m_userData.direction * -1);
_local1.m_userData.counter = 0;
};
};
if (_local1.m_userData.id == "movingLineH"){
_local1.WakeUp();
_local1.m_userData.counter++;
_local1.m_userData.joint.SetMotorSpeed((_local1.m_userData.direction * 60));
if (_local1.m_userData.counter > 250){
_local1.m_userData.direction = (_local1.m_userData.direction * -1);
_local1.m_userData.counter = 0;
};
};
_local1.m_userData.x = _local1.m_position.x;
_local1.m_userData.y = _local1.m_position.y;
if (_local1.m_userData.id != "wall"){
_local1.m_userData.rotation = (_local1.m_rotation * (180 / Math.PI));
};
};
_local1 = _local1.m_next;
};
}
public function checkCollisions():void{
var _local1:b2Contact;
var _local2:b2Body;
var _local3:b2Body;
if (checkForCollisions == true){
_local1 = m_world.GetContactList();
while (_local1) {
if (_local1.GetManifoldCount() > 0){
_local2 = _local1.GetShape1().GetBody();
_local3 = _local1.GetShape2().GetBody();
if (soundOn == true){
};
triggerBumpers(_local2, _local3);
checkPigDown(_local2, _local3);
checkTargetReached(_local2, _local3);
checkBombs(_local2, _local3);
triggerTrampoline(_local2, _local3);
};
_local1 = _local1.GetNext();
};
};
}
public function triggerTrampoline(_arg1, _arg2):void{
var _local3:b2Body;
var _local4:b2Body;
if (_arg1.hasOwnProperty("m_userData") == true){
if (_arg2.hasOwnProperty("m_userData") == true){
if (_arg1.m_userData != null){
if (_arg2.m_userData != null){
if ((((_arg1.m_userData.id == "trampoline")) || ((_arg2.m_userData.id == "trampoline")))){
if (_arg1.m_userData.id == "trampoline"){
_local3 = _arg1;
_local4 = _arg2;
} else {
_local3 = _arg2;
_local4 = _arg1;
};
_local3.m_userData.gotoAndPlay(2);
};
};
};
};
};
}
public function checkPigDown(_arg1:b2Body, _arg2:b2Body):void{
}
public function moveCowAway(_arg1:b2Body):void{
_arg1.SetCenterPosition(new b2Vec2(0, 400), 0);
if (levelIsComplete == false){
levelIsComplete = true;
levelComplete();
};
}
public function checkPuckAnnihilation(_arg1:b2Body, _arg2:b2Body):void{
var _local3:b2Body;
var _local4:annihilationEffect_mc;
var _local5:bonusDisplay_mc;
var _local6:Number;
if (((_arg1.hasOwnProperty("m_userData")) && (_arg2.hasOwnProperty("m_userData")))){
if (((!((_arg1.m_userData == null))) && (!((_arg2.m_userData == null))))){
if ((((((_arg1.m_userData.id == "puck")) && ((_arg2.m_userData.id == "myBall")))) || ((((_arg2.m_userData.id == "puck")) && ((_arg1.m_userData.id == "myBall")))))){
if (_arg1.m_userData.id == "puck"){
_local3 = _arg1;
} else {
_local3 = _arg2;
};
_local4 = new annihilationEffect_mc();
gameCanvas.addChild(_local4);
if (soundOn == true){
};
_local4.x = _local3.m_userData.x;
_local4.y = _local3.m_userData.y;
_local4.width = (_local4.width * 0.5);
_local4.height = (_local4.height * 0.5);
_local5 = new bonusDisplay_mc();
gameCanvas.addChild(_local5);
_local6 = (Math.round((_local3.m_userData.width / 25)) * 25);
bonus = (bonus + _local6);
_local5.textField.text = String(_local6);
_local5.x = _local4.x;
_local5.y = _local4.y;
_local3.m_userData.active = false;
deleteBody(_local3);
};
};
};
}
public function checkBombs(_arg1:b2Body, _arg2:b2Body):void{
var _local3:b2Body;
var _local4:b2Body;
var _local5:*;
if ((((bombExploded == false)) && ((myCow.m_userData.targetReached == false)))){
if (((_arg1.hasOwnProperty("m_userData")) && (_arg2.hasOwnProperty("m_userData")))){
if (((!((_arg1.m_userData == null))) && (!((_arg2.m_userData == null))))){
if ((((((((((_arg1.m_userData.id == "cow")) && ((_arg2.m_userData.id == "bomb")))) || ((((_arg2.m_userData.id == "cow")) && ((_arg1.m_userData.id == "bomb")))))) || ((((_arg1.m_userData.id == "target")) && ((_arg2.m_userData.id == "bomb")))))) || ((((_arg2.m_userData.id == "target")) && ((_arg1.m_userData.id == "bomb")))))){
bombExploded = true;
if (_arg1.m_userData.id != "bomb"){
_local3 = _arg1;
_local4 = _arg2;
} else {
_local3 = _arg2;
_local4 = _arg1;
};
_local5 = new explosion_mc();
gameCanvas.addChild(_local5);
if (soundOn == true){
};
_local5.x = ((_local3.m_userData.x + _local4.m_userData.x) / 2);
_local5.y = ((_local3.m_userData.y + _local4.m_userData.y) / 2);
_local5.width = (_local5.width * 0.5);
_local5.height = (_local5.height * 0.5);
_local3.m_userData.visible = false;
_local4.m_userData.visible = false;
setTimeout(fadeInOut, 1000);
setTimeout(resetLevelDirect, 1500);
if (soundOn == true){
explosionSound.play();
};
};
};
};
};
}
public function playSound(_arg1:b2Body, _arg2:b2Body){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:b2Vec2;
var _local10:b2Vec2;
if (((_arg1.hasOwnProperty("m_userData")) && (_arg2.hasOwnProperty("m_userData")))){
if (((!((_arg1.m_userData == null))) && (!((_arg2.m_userData == null))))){
if ((((((_arg1 == lastBody1)) && ((_arg2 == lastBody2)))) || ((((_arg1 == lastBody2)) && ((_arg2 == lastBody1)))))){
} else {
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = 0;
_local9 = _arg1.GetLinearVelocity();
_local10 = _arg2.GetLinearVelocity();
_local3 = _local9.x;
_local4 = _local9.y;
_local5 = _local10.x;
_local6 = _local10.y;
_local7 = Math.abs((_local5 - _local3));
_local8 = Math.abs((_local6 - _local4));
if ((((_local7 > 5)) && ((_local8 > 5)))){
if ((((_arg1.m_userData.id == "wall")) || ((_arg2.m_userData.id == "wall")))){
} else {
if ((((_arg1.m_userData.id == "puck")) || ((_arg2.m_userData.id == "puck")))){
} else {
if ((((_arg1.m_userData.id == "enemy")) || ((_arg2.m_userData.id == "enemy")))){
};
};
};
lastBody1 = _arg1;
lastBody2 = _arg2;
};
};
};
};
}
public function triggerBumpers(_arg1, _arg2):void{
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:b2Vec2;
if (_arg1.hasOwnProperty("m_userData") == true){
if (_arg2.hasOwnProperty("m_userData") == true){
if (_arg1.m_userData != null){
if (_arg2.m_userData != null){
if ((((_arg1.m_userData.id == "bumper")) || ((_arg2.m_userData.id == "bumper")))){
if (_arg1.m_userData.id == "bumper"){
_local3 = _arg1;
_local4 = _arg2;
} else {
_local3 = _arg2;
_local4 = _arg1;
};
_local5 = new b2Vec2((_local4.m_position.x - _local3.m_position.x), (_local4.m_position.y - _local3.m_position.y));
_local6 = _local5.Length();
_local7 = ((300000 * _local5.x) / _local6);
_local8 = ((300000 * _local5.y) / _local6);
_local9 = new b2Vec2(_local7, _local8);
_local4.ApplyImpulse(_local9, _local4.GetCenterPosition());
_local3.m_userData.light.gotoAndPlay(2);
};
};
};
};
};
}
public function addLife(_arg1, _arg2):void{
var _local3:b2Body;
var _local4:b2Body;
var _local5:bonusDisplay_mc;
var _local6:annihilationEffect_mc;
if (_arg1.hasOwnProperty("m_userData") == true){
if (_arg2.hasOwnProperty("m_userData") == true){
if (_arg1.m_userData != null){
if (_arg2.m_userData != null){
if ((((_arg1.m_userData.id == "lifeBonus")) || ((_arg2.m_userData.id == "lifeBonus")))){
if ((((_arg1.m_userData.id == "myBall")) || ((_arg2.m_userData.id == "myBall")))){
if (_arg1.m_userData.id == "lifeBonus"){
_local3 = _arg1;
_local4 = _arg2;
} else {
_local3 = _arg2;
_local4 = _arg1;
};
lives++;
if (soundOn == true){
};
setTimeout(flashScoreOff, 200);
setTimeout(flashScoreOn, 400);
setTimeout(flashScoreOff, 600);
setTimeout(flashScoreOn, 800);
setTimeout(flashScoreOff, 1000);
setTimeout(flashScoreOn, 1200);
setTimeout(flashScoreOff, 1400);
setTimeout(flashScoreOn, 1600);
_local5 = new bonusDisplay_mc();
gameCanvas.addChild(_local5);
_local5.textField.text = "+1 life";
_local5.x = _local3.m_userData.x;
_local5.y = _local3.m_userData.y;
_local6 = new annihilationEffect_mc();
gameCanvas.addChild(_local6);
_local6.x = _local3.m_userData.x;
_local6.y = _local3.m_userData.y;
_local6.width = (_local6.width * 0.5);
_local6.height = (_local6.height * 0.5);
deleteBody(_local3);
};
};
};
};
};
};
}
public function preventSticking(_arg1, _arg2):void{
var _local3:b2ContactNode;
var _local4:b2Contact;
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:b2Vec2;
var _local10:b2Manifold;
var _local11:b2ContactPoint;
var _local12:b2Vec2;
var _local13:b2ContactNode;
var _local14:b2Contact;
var _local15:b2Vec2;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:b2Vec2;
var _local20:b2Manifold;
var _local21:b2ContactPoint;
var _local22:b2Vec2;
var _local23:b2ContactNode;
var _local24:b2Contact;
var _local25:b2Vec2;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:b2Vec2;
var _local30:b2Manifold;
var _local31:b2ContactPoint;
var _local32:b2Vec2;
var _local33:b2ContactNode;
var _local34:b2Contact;
var _local35:b2Vec2;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:b2Vec2;
var _local40:b2Manifold;
var _local41:b2ContactPoint;
var _local42:b2Vec2;
if (_arg1.hasOwnProperty("m_userData") == true){
if (_arg2.hasOwnProperty("m_userData") == true){
if (_arg1.m_userData != null){
if (_arg2.m_userData != null){
if ((((((_arg1.m_userData.id == "puck")) && ((_arg2.m_userData.id == "wall")))) || ((_arg2.m_userData.id == "sideWall")))){
_local3 = _arg1.GetContactList();
_local4 = _local3.contact;
if (_local4.GetManifoldCount() > 0){
_local10 = (_local4.GetManifolds()[0] as b2Manifold);
_local11 = (_local10.points[0] as b2ContactPoint);
_local12 = _local11.position;
};
_local5 = new b2Vec2((_local12.x - _arg1.m_position.x), (_local12.y - _arg1.m_position.y));
_local6 = _local5.Length();
_local7 = ((-2500 * _local5.x) / _local6);
_local8 = ((-2500 * _local5.y) / _local6);
_local9 = new b2Vec2(_local7, _local8);
_arg1.ApplyImpulse(_local9, _arg1.GetCenterPosition());
};
if ((((((_arg2.m_userData.id == "puck")) && ((_arg1.m_userData.id == "wall")))) || ((_arg1.m_userData.id == "sideWall")))){
_local13 = _arg2.GetContactList();
_local14 = _local13.contact;
if (_local14.GetManifoldCount() > 0){
_local20 = (_local14.GetManifolds()[0] as b2Manifold);
_local21 = (_local20.points[0] as b2ContactPoint);
_local22 = _local21.position;
};
_local15 = new b2Vec2((_local22.x - _arg2.m_position.x), (_local22.y - _arg2.m_position.y));
_local16 = _local15.Length();
_local17 = ((-2500 * _local15.x) / _local16);
_local18 = ((-2500 * _local15.y) / _local16);
_local19 = new b2Vec2(_local17, _local18);
_arg2.ApplyImpulse(_local19, _arg2.GetCenterPosition());
};
if ((((_arg1.m_userData.id == "bullet")) && ((_arg2.m_userData.id == "wall")))){
_local23 = _arg1.GetContactList();
_local24 = _local23.contact;
if (_local24.GetManifoldCount() > 0){
_local30 = (_local24.GetManifolds()[0] as b2Manifold);
_local31 = (_local30.points[0] as b2ContactPoint);
_local32 = _local31.position;
};
_local25 = new b2Vec2((_local32.x - _arg1.m_position.x), (_local32.y - _arg1.m_position.y));
_local26 = _local25.Length();
_local27 = ((-2500 * _local25.x) / _local26);
_local28 = ((-2500 * _local25.y) / _local26);
_local29 = new b2Vec2(_local27, _local28);
_arg1.ApplyImpulse(_local29, _arg1.GetCenterPosition());
};
if ((((_arg2.m_userData.id == "bullet")) && ((_arg1.m_userData.id == "wall")))){
_local33 = _arg2.GetContactList();
_local34 = _local33.contact;
if (_local34.GetManifoldCount() > 0){
_local40 = (_local34.GetManifolds()[0] as b2Manifold);
_local41 = (_local40.points[0] as b2ContactPoint);
_local42 = _local41.position;
};
_local35 = new b2Vec2((_local42.x - _arg2.m_position.x), (_local42.y - _arg2.m_position.y));
_local36 = _local35.Length();
_local37 = ((-2500 * _local35.x) / _local36);
_local38 = ((-2500 * _local35.y) / _local36);
_local39 = new b2Vec2(_local37, _local38);
_arg2.ApplyImpulse(_local39, _arg2.GetCenterPosition());
};
};
};
};
};
}
public function enableSkimming(_arg1, _arg2):void{
var _local3:b2ContactNode;
var _local4:b2Contact;
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:b2Vec2;
var _local10:b2Manifold;
var _local11:b2ContactPoint;
var _local12:b2Vec2;
var _local13:b2ContactNode;
var _local14:b2Contact;
var _local15:b2Vec2;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:b2Vec2;
var _local20:b2Manifold;
var _local21:b2ContactPoint;
var _local22:b2Vec2;
if (_arg1.hasOwnProperty("m_userData") == true){
if (_arg2.hasOwnProperty("m_userData") == true){
if (_arg1.m_userData != null){
if (_arg2.m_userData != null){
if ((((_arg1.m_userData.id == "puck")) && ((_arg2.m_userData.id == "bullet")))){
_local3 = _arg1.GetContactList();
_local4 = _local3.contact;
if (_local4.GetManifoldCount() > 0){
_local10 = (_local4.GetManifolds()[0] as b2Manifold);
_local11 = (_local10.points[0] as b2ContactPoint);
_local12 = _local11.position;
};
_local5 = new b2Vec2((_local12.x - _arg1.m_position.x), (_local12.y - _arg1.m_position.y));
_local6 = _local5.Length();
_local7 = ((-2000 * _local5.x) / _local6);
_local8 = ((-2000 * _local5.y) / _local6);
_local9 = new b2Vec2(_local7, _local8);
_arg1.ApplyImpulse(_local9, _arg1.GetCenterPosition());
};
if ((((_arg2.m_userData.id == "puck")) && ((_arg1.m_userData.id == "bullet")))){
_local13 = _arg2.GetContactList();
_local14 = _local13.contact;
if (_local14.GetManifoldCount() > 0){
_local20 = (_local14.GetManifolds()[0] as b2Manifold);
_local21 = (_local20.points[0] as b2ContactPoint);
_local22 = _local21.position;
};
_local15 = new b2Vec2((_local22.x - _arg2.m_position.x), (_local22.y - _arg2.m_position.y));
_local16 = _local15.Length();
_local17 = ((-2000 * _local15.x) / _local16);
_local18 = ((-2000 * _local15.y) / _local16);
_local19 = new b2Vec2(_local17, _local18);
_arg2.ApplyImpulse(_local19, _arg2.GetCenterPosition());
};
};
};
};
};
}
public function checkGameOver():void{
var _local1:Boolean;
var _local2:uint;
_local1 = true;
_local2 = 0;
while (_local2 < myBallArray.length) {
if (myBallArray[_local2].m_userData.visible == true){
_local1 = false;
};
_local2++;
};
if ((((lives == 0)) && ((_local1 == true)))){
gameOver = true;
killed = true;
gameRunning = false;
};
if ((((gameOver == true)) && ((gameRunning == false)))){
showGameOverScreen();
if (soundOn == true){
};
};
}
public function moveGun():void{
if (leftKeyDown == true){
gun.x = (gun.x - gunSpeed);
};
if (rightKeyDown == true){
gun.x = (gun.x + gunSpeed);
};
if (gun.x < -220){
gun.x = -220;
};
if (gun.x > 220){
gun.x = 220;
};
gunShadow.x = gun.x;
}
public function mouseDownHandler(_arg1:MouseEvent):void{
mouseIsDown = true;
rapidFireCounter = 0;
}
public function mouseUpHandler(_arg1:MouseEvent):void{
mouseIsDown = false;
preventFiring = false;
waitForMouseUp = false;
}
public function keyDownHandler(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.LEFT)) || ((_arg1.keyCode == 65)))){
leftKeyDown = true;
};
if ((((_arg1.keyCode == Keyboard.RIGHT)) || ((_arg1.keyCode == 68)))){
rightKeyDown = true;
};
if ((((_arg1.keyCode == Keyboard.UP)) || ((_arg1.keyCode == 87)))){
upKeyDown = true;
};
if ((((_arg1.keyCode == Keyboard.DOWN)) || ((_arg1.keyCode == 83)))){
downKeyDown = true;
};
if (_arg1.keyCode == 82){
resetLevelDirect();
};
}
public function keyUpHandler(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.LEFT)) || ((_arg1.keyCode == 65)))){
leftKeyDown = false;
};
if ((((_arg1.keyCode == Keyboard.RIGHT)) || ((_arg1.keyCode == 68)))){
rightKeyDown = false;
};
if ((((_arg1.keyCode == Keyboard.UP)) || ((_arg1.keyCode == 87)))){
upKeyDown = false;
};
if ((((_arg1.keyCode == Keyboard.DOWN)) || ((_arg1.keyCode == 83)))){
downKeyDown = false;
};
}
public function displayFPS():void{
var _local1:Date;
_local1 = new Date();
fpsNewTime = _local1.getTime();
fpsElapsedTime = (fpsNewTime - fpsStartTime);
fpsCounter++;
if (fpsCounter == 99){
fpsCounter = 0;
fps = int((100 / (fpsElapsedTime / 1000)));
fpsStartTime = fpsNewTime;
};
}
public function levelComplete():void{
gameRunning = false;
currentLevel++;
levelsPlayed++;
if (currentLevel > numberOfLevels){
gameWon = true;
currentLevel = numberOfLevels;
};
if (currentLevel > highestLevel){
highestLevel = currentLevel;
so.data.highestLevel = highestLevel;
};
if (score > bestScore){
};
fadeInOutSlow();
if (editMode == true){
setTimeout(cleanUp, 2000);
setTimeout(showEditor, 2001);
levelTested = true;
} else {
if (userMode == true){
setTimeout(cleanUp, 2000);
setTimeout(showRatingForm, 2001);
} else {
if (gameWon == false){
setTimeout(cleanUp, 2000);
setTimeout(showInfo, 2001);
} else {
gameWon = false;
setTimeout(showGameOverScreen, 2000);
};
};
};
}
public function showRatingForm():void{
ratingForm = new ratingForm_mc();
projectCanvas.addChild(ratingForm);
ratingForm.message.text = (((("You completed " + levelObject.levelName) + " by ") + levelObject.author) + ". Yay! \nPlease rate this level (if you haven't already).\n1 = poor, 10 = superb!");
ratingForm.rating.visible = false;
ratingForm.stars.addEventListener(MouseEvent.MOUSE_OVER, changeRating);
ratingForm.stars.addEventListener(MouseEvent.CLICK, setRating);
ratingForm._Submit_.addEventListener(MouseEvent.CLICK, submitRating);
ratingForm._Submit_.visible = false;
ratingForm._Cancel_.addEventListener(MouseEvent.CLICK, cancelRating);
}
public function cancelRating(_arg1:MouseEvent):void{
fadeInOut();
setTimeout(removeRatingForm, 500);
setTimeout(showUserLevels, 501);
}
public function changeRating(_arg1:MouseEvent):void{
var _local2:uint;
var _local3:MovieClip;
userRating = int(_arg1.target.name.slice(1));
_local2 = 0;
while (_local2 < ratingForm.stars.numChildren) {
_local3 = (ratingForm.stars.getChildAt(_local2) as MovieClip);
if (_local2 < userRating){
_local3.gotoAndStop(2);
} else {
_local3.gotoAndStop(1);
};
_local2++;
};
}
public function setRating(_arg1:MouseEvent):void{
if (userRating != 0){
ratingForm.rating.visible = true;
ratingForm.rating.text = userRating;
ratingForm._Submit_.visible = true;
};
}
public function submitRating(_arg1:MouseEvent):void{
var _local2:uint;
var _local3:MovieClip;
ratingForm._Cancel_.removeEventListener(MouseEvent.CLICK, cancelRating);
ratingForm._Cancel_.visible = false;
ratingForm._Submit_.visible = false;
ratingForm.stars.removeEventListener(MouseEvent.MOUSE_OVER, changeRating);
ratingForm.stars.removeEventListener(MouseEvent.CLICK, setRating);
ratingForm._Submit_.removeEventListener(MouseEvent.CLICK, submitRating);
userRating = int(ratingForm.rating.text);
_local2 = 0;
while (_local2 < ratingForm.stars.numChildren) {
_local3 = (ratingForm.stars.getChildAt(_local2) as MovieClip);
if (_local2 < userRating){
_local3.gotoAndStop(2);
} else {
_local3.gotoAndStop(1);
};
_local2++;
};
ratingForm.message.text = "Submitting ....";
PlayerLevels.Rate(levelObject.id, userRating, this.RateComplete);
}
public function RateComplete(_arg1:Boolean):void{
ratingForm.message.text = "Thank you";
setTimeout(fadeInOut, 1000);
setTimeout(removeRatingForm, 1500);
setTimeout(showUserLevels, 1501);
}
public function removeRatingForm():void{
projectCanvas.removeChild(ratingForm);
}
public function checkAwardsLevelIncomplete():void{
}
public function nextLevel():void{
}
public function displayGameOverMessages():void{
crosshairsOn = false;
Mouse.show();
crosshairs.visible = false;
gui.score.text = String(score);
gui.bonus.text = String(bonus);
gui.lives.text = String(lives);
if (gameWon == false){
gameOverScreen.message1.text = "Game Over";
gameOverScreen.cup1.visible = false;
gameOverScreen.cup2.visible = false;
} else {
gameOverScreen.message1.text = "Congratulations";
gameOverScreen.cup1.visible = true;
gameOverScreen.cup2.visible = true;
gameOverScreen._Try_Again_.visible = false;
if (soundOn == true){
winSound.play();
};
};
if (gameWon == false){
gameOverScreen.message2.text = ("Your score: " + String(score));
} else {
gameOverScreen.message2.text = (("You cleared all levels and scored " + String(score)) + ". Awesome!");
};
}
public function cleanUp():void{
cleaned = true;
crosshairsOn = false;
Mouse.show();
crosshairs.visible = false;
cleanPhysics();
stage.removeEventListener(Event.ENTER_FRAME, gameLoop);
stage.removeEventListener(MouseEvent.MOUSE_DOWN, fireBullet);
gui.resetButton.removeEventListener(MouseEvent.MOUSE_DOWN, resetLevel);
gui.quitButton.removeEventListener(MouseEvent.MOUSE_DOWN, showConfirmQuit);
gui.turboNuke.removeEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
gui._Walkthrough_.removeEventListener(MouseEvent.MOUSE_DOWN, gotoWalkthrough);
projectCanvas.removeChild(gui);
projectCanvas.removeChild(gameCanvas);
projectCanvas.removeChild(backgroundCanvas);
stage.removeChild(debug);
disableControls();
numberOfPucks = 0;
puckArray = new Array();
numberOfTargets = 0;
targetArray = new Array();
teleportArray = new Array();
numberOfTeleports = 0;
teleportPair = 0;
numberOfHintBoxes = 0;
hintBoxArray = new Array();
tweenArray = new Array();
sideWall = new Array();
numberOfEGs = 0;
egArray = new Array();
starArray = new Array();
mouseIsDown = false;
rapidFireOn = false;
scrolled = 0;
killed = false;
placing = false;
storeBallY = 0;
maxBallY = 0;
lastLevelReached = false;
groundCreated = false;
aim = false;
stillCounter = 0;
delayStart = false;
myBallArray = new Array();
pigArray = new Array();
haystackArray = new Array();
levelIsComplete = false;
bombExploded = false;
cowOffScreen = false;
}
public function cleanPhysics():void{
var _local1:b2Body;
var _local2:*;
var _local3:b2Body;
var _local4:*;
_local1 = m_world.m_bodyList;
_local2 = m_world.m_bodyCount;
_local4 = 0;
while (_local4 < (_local2 - 1)) {
_local3 = _local1;
_local1 = _local1.m_next;
m_world.DestroyBody(_local3);
if ((((_local3.hasOwnProperty("m_userData") == true)) && (!((_local3.m_userData == null))))){
_local3.m_userData = null;
};
_local4++;
};
}
public function submitHighscore(_arg1:MouseEvent):void{
gameOverScreen.submitButton.removeEventListener(MouseEvent.MOUSE_DOWN, submitHighscore);
gameOverScreen.message3.text = "Connecting: Please wait ...";
hsLoader = submit(gameOverScreen.playerName.text, score);
hsLoader.addEventListener(Event.COMPLETE, submitCompleteHandler);
setTimeout(submitFail, 15000);
}
public function submit(_arg1:String, _arg2:Number):URLLoader{
var _local3:URLVariables;
var _local4:URLRequest;
var _local5:URLLoader;
_local3 = new URLVariables();
_local3.hsname = _arg1;
_local3.score = String(_arg2);
_local4 = new URLRequest("http://www.andromedus.com/scripts/insert_score.php");
_local4.data = _local3;
_local4.method = URLRequestMethod.POST;
_local5 = new URLLoader();
_local5.dataFormat = URLLoaderDataFormat.TEXT;
_local5.load(_local4);
return (_local5);
}
public function submitCompleteHandler(_arg1:Event):void{
submitSuccess = true;
gameOverScreen.message3.text = "Score submitted!";
hsLoader.removeEventListener(Event.COMPLETE, submitCompleteHandler);
}
public function submitFail():void{
if (submitSuccess == false){
gameOverScreen.message3.text = "Sorry, could not connect. Try submitting again.";
hsLoader.removeEventListener(Event.COMPLETE, submitCompleteHandler);
gameOverScreen.submitButton.addEventListener(MouseEvent.MOUSE_DOWN, submitHighscore);
};
}
public function initEditor():void{
var _local1:uint;
var _local2:MovieClip;
keyboardTarget = null;
editor.hintInput.visible = false;
editor.eraser.gotoAndStop(2);
editor.eraser.addEventListener(MouseEvent.CLICK, showEraser);
editor.cursor.addEventListener(MouseEvent.CLICK, removeEraserOnClick);
if (eraserOn == true){
removeEraser();
};
editor.messageBox.visible = false;
if (editorHelpShown == true){
editor.help.visible = false;
} else {
editor.help._Close_.addEventListener(MouseEvent.CLICK, hideEditorHelp);
editorHelpShown = true;
};
editor._help_.addEventListener(MouseEvent.CLICK, showEditorHelp);
editor._export_.addEventListener(MouseEvent.CLICK, export);
editor._share_.addEventListener(MouseEvent.CLICK, share);
editor._import_.addEventListener(MouseEvent.CLICK, importLevel);
editor._test_.addEventListener(MouseEvent.CLICK, testLevel);
editor._clear_.addEventListener(MouseEvent.CLICK, clearEditor);
editor._import_.visible = false;
editor._export_.visible = false;
itemHolderVisible = false;
editor.itemHolder.addEventListener(MouseEvent.MOUSE_OVER, showItemHolder);
editor.addEventListener(MouseEvent.MOUSE_UP, checkItemsInBounds);
_local1 = 0;
while (_local1 < editor.itemHolder.objects.numChildren) {
_local2 = (editor.itemHolder.objects.getChildAt(_local1) as MovieClip);
_local2.mouseChildren = false;
_local1++;
};
editorCanvas = new Sprite();
editor.addChild(editorCanvas);
editor.swapChildren(editorCanvas, editor.layerMarker);
editorCanvas.x = centre.x;
editorCanvas.y = centre.y;
editor.background.addEventListener(MouseEvent.MOUSE_DOWN, removeTransformTool);
currTool = new TransformTool();
editor.addChild(currTool);
if (editMode == true){
loadLevelIntoEditor();
editMode = false;
};
stage.addEventListener(KeyboardEvent.KEY_DOWN, editItemWithKeyboard);
}
public function checkItemsInBounds(_arg1:MouseEvent):void{
var _local2:MovieClip;
var _local3:Point;
if (currTool.target != null){
_local2 = (currTool.target as MovieClip);
_local3 = new Point(0, 0);
if (_local2.x > 300){
_local3.x = (_local2.x - 300);
_local2.x = 300;
};
if (_local2.x < -300){
_local3.x = (_local2.x + 300);
_local2.x = -300;
};
if (_local2.y < -248){
_local3.y = (_local2.y + 248);
_local2.y = -248;
};
if (_local2.y > 170){
_local3.y = (_local2.y - 170);
_local2.y = 170;
};
currTool.x = (currTool.x - _local3.x);
currTool.y = (currTool.y - _local3.y);
};
}
public function showEditorHelp(_arg1:MouseEvent):void{
if (keyboardTarget != null){
keyboardTarget = null;
};
currTool.target = null;
editor.help.visible = true;
editor.help._Close_.addEventListener(MouseEvent.CLICK, hideEditorHelp);
}
public function hideEditorHelp(_arg1:MouseEvent):void{
editor.help.visible = false;
editor.help._Close_.removeEventListener(MouseEvent.CLICK, hideEditorHelp);
}
public function showItemHolder(_arg1:MouseEvent):void{
var _local2:Tween;
if (itemHolderVisible == false){
if (eraserOn == true){
removeEraser();
};
if (keyboardTarget != null){
keyboardTarget = null;
};
currTool.target = null;
editor.itemHolder.removeEventListener(MouseEvent.MOUSE_OVER, showItemHolder);
editor.itemHolder.alpha = 1;
_local2 = new Tween(editor.itemHolder, "y", None.easeNone, 595, 402, 0.5, true);
tweenArray.push(_local2);
itemHolderVisible = true;
editor.itemHolder.objects.addEventListener(MouseEvent.MOUSE_OVER, glowItems);
editor.itemHolder.objects.addEventListener(MouseEvent.MOUSE_OUT, unglowItems);
editor.itemHolder.objects.addEventListener(MouseEvent.CLICK, dragItemToCanvas);
editor.itemHolder.close.addEventListener(MouseEvent.CLICK, hideItemHolder);
};
}
public function hideItemHolder(_arg1:MouseEvent):void{
hideItemHolderDirect();
}
public function hideItemHolderDirect():void{
var _local1:Tween;
var _local2:Tween;
if (itemHolderVisible == true){
editor.itemHolder.close.removeEventListener(MouseEvent.MOUSE_OVER, hideItemHolder);
editor.itemHolder.alpha = 0.4;
_local1 = new Tween(editor.itemHolder, "y", None.easeNone, 402, 595, 0.5, true);
_local2 = new Tween(editor.itemHolder, "alpha", None.easeNone, 0.4, 1, 0.5, true);
tweenArray.push(_local1);
tweenArray.push(_local2);
itemHolderVisible = false;
editor.itemHolder.objects.removeEventListener(MouseEvent.MOUSE_OVER, glowItems);
editor.itemHolder.objects.removeEventListener(MouseEvent.MOUSE_OUT, unglowItems);
editor.itemHolder.objects.removeEventListener(MouseEvent.CLICK, dragItemToCanvas);
setTimeout(enableItemHolder, 1500);
};
}
public function enableItemHolder():void{
editor.itemHolder.addEventListener(MouseEvent.MOUSE_OVER, showItemHolder);
}
public function clearEditor(_arg1:MouseEvent):void{
clearEditorDirect();
}
public function clearEditorDirect():void{
if (eraserOn == true){
removeEraser();
};
editor.swapChildren(editorCanvas, editor.layerMarker);
editor.removeChild(editorCanvas);
editorCanvas = new Sprite();
editor.addChild(editorCanvas);
editor.swapChildren(editorCanvas, editor.layerMarker);
editorCanvas.x = centre.x;
editorCanvas.y = centre.y;
keyboardTarget = null;
}
public function loadLevelIntoEditor():void{
var _local1:Array;
var _local2:uint;
var _local3:MovieClip;
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:String;
clearEditorDirect();
editString = Base64.decode(editString);
_local1 = editString.split(",");
_local2 = 0;
while (_local2 < _local1.length) {
_local4 = _local1[_local2];
_local5 = int(_local1[(_local2 + 1)]);
_local6 = int(_local1[(_local2 + 2)]);
_local7 = int(_local1[(_local2 + 3)]);
_local8 = int(_local1[(_local2 + 4)]);
_local9 = int(_local1[(_local2 + 5)]);
if (_local4 == "hi"){
_local10 = _local1[(_local2 + 6)];
};
if (_local4 == "wh"){
_local3 = new wallH_template();
};
if (_local4 == "wv"){
_local3 = new wallV_template();
};
if (_local4 == "hh"){
_local3 = new haystackH_template();
};
if (_local4 == "hv"){
_local3 = new haystackV_template();
};
if (_local4 == "lh"){
_local3 = new logH_template();
};
if (_local4 == "lv"){
_local3 = new logV_template();
};
if (_local4 == "tp"){
_local3 = new trampoline_template();
};
if (_local4 == "ta"){
_local3 = new bottle_template();
};
if (_local4 == "mh"){
_local3 = new movingLineH_template();
};
if (_local4 == "mv"){
_local3 = new movingLineV_template();
};
if (_local4 == "pi"){
_local3 = new pig_mc();
};
if (_local4 == "co"){
_local3 = new cowRound_mc();
};
if (_local4 == "bo"){
_local3 = new bomb_template();
};
if (_local4 == "ba"){
_local3 = new ball_mc();
};
if (_local4 == "sp"){
_local3 = new rotator_template();
};
if (_local4 == "rc"){
_local3 = new rotatorLongC_template();
};
if (_local4 == "ra"){
_local3 = new rotatorLongCC_template();
};
if (_local4 == "ro"){
_local3 = new pivotV_template();
};
if (_local4 == "tr"){
_local3 = new travelatorRight_mc();
};
if (_local4 == "tl"){
_local3 = new travelatorLeft_mc();
};
if (_local4 == "tu"){
_local3 = new travelatorUp_mc();
};
if (_local4 == "td"){
_local3 = new travelatorDown_mc();
};
if (_local4 == "be"){
_local3 = new belt_template();
};
if (_local4 == "hi"){
_local3 = new hintBox_mc();
_local3.message.text = _local10;
};
if (_local3 != null){
_local3.id = _local4;
_local3.name = _local4;
_local3.x = _local5;
_local3.y = _local6;
_local3.width = _local7;
_local3.height = _local8;
_local3.rotation = _local9;
_local3.mouseChildren = false;
editorCanvas.addChild(_local3);
_local3.addEventListener(MouseEvent.MOUSE_DOWN, transformObject);
_local3.addEventListener(MouseEvent.MOUSE_OVER, glowItems);
_local3.addEventListener(MouseEvent.MOUSE_OUT, unglowItems);
};
if (_local4 != "hi"){
_local2 = (_local2 + 6);
} else {
_local2 = (_local2 + 7);
};
};
}
public function removeTransformTool(_arg1:MouseEvent):void{
removeTransformToolDirect();
}
public function removeTransformToolDirect():void{
if (itemHolderVisible == true){
hideItemHolderDirect();
};
if (editor.hintInput.visible == true){
editor.hintInput._ok_.removeEventListener(MouseEvent.CLICK, updateHint);
editor.hintInput.visible = false;
editor.itemHolder.visible = true;
};
if (keyboardTarget != null){
keyboardTarget = null;
};
currTool.target = null;
}
public function glowItems(_arg1:MouseEvent):void{
_arg1.target.filters = [new GlowFilter(0xFFFFFF, 0.75, 25, 25, 2, 2, false, false)];
}
public function unglowItems(_arg1:MouseEvent):void{
_arg1.target.filters = [];
}
public function dragItemToCanvas(_arg1:MouseEvent):void{
var _local2:MovieClip;
_local2 = (_arg1.target as MovieClip);
dragItemToCanvasDirect(_local2, false);
}
public function dragItemToCanvasDirect(_arg1:MovieClip, _arg2:Boolean):void{
var _local3:MovieClip;
var _local4:Object;
trace(_arg1);
if (_arg1.name == "ba"){
_local3 = new ball_mc();
_local3.width = 50;
_local3.height = 50;
};
if (_arg1.name == "bo"){
_local3 = new bomb_template();
_local3.width = 35;
_local3.height = 61;
};
if (_arg1.name == "pi"){
_local3 = new pig_mc();
_local3.width = 60;
_local3.height = 58;
};
if (_arg1.name == "co"){
_local3 = new cowRound_mc();
_local3.width = (96 * 0.7);
_local3.height = (85 * 0.7);
};
if (_arg1.name == "be"){
_local3 = new belt_template();
_local3.width = 60;
_local3.height = 25;
};
if (_arg1.name == "tu"){
_local3 = new travelatorUp_mc();
_local3.width = 30;
_local3.height = 100;
};
if (_arg1.name == "td"){
_local3 = new travelatorDown_mc();
_local3.width = 30;
_local3.height = 100;
};
if (_arg1.name == "tl"){
_local3 = new travelatorLeft_mc();
_local3.width = 100;
_local3.height = 30;
};
if (_arg1.name == "tr"){
_local3 = new travelatorRight_mc();
_local3.width = 100;
_local3.height = 30;
};
if (_arg1.name == "wh"){
_local3 = new wallH_template();
_local3.width = 112;
_local3.height = 22;
};
if (_arg1.name == "wv"){
_local3 = new wallV_template();
_local3.width = 22;
_local3.height = 80;
};
if (_arg1.name == "lh"){
_local3 = new logH_template();
_local3.width = 112;
_local3.height = 22;
};
if (_arg1.name == "lv"){
_local3 = new logV_template();
_local3.width = 22;
_local3.height = 80;
};
if (_arg1.name == "hh"){
_local3 = new haystackH_template();
_local3.width = 112;
_local3.height = 22;
};
if (_arg1.name == "hv"){
_local3 = new haystackV_template();
_local3.width = 22;
_local3.height = 80;
};
if (_arg1.name == "tp"){
_local3 = new trampoline_template();
};
if (_arg1.name == "ta"){
_local3 = new bottle_template();
};
if (_arg1.name == "mh"){
_local3 = new movingLineH_template();
};
if (_arg1.name == "mv"){
_local3 = new movingLineV_template();
};
if (_arg1.name == "sp"){
_local3 = new rotator_template();
};
if (_arg1.name == "rc"){
_local3 = new rotatorLongC_template();
};
if (_arg1.name == "ra"){
_local3 = new rotatorLongCC_template();
};
if (_arg1.name == "ro"){
_local3 = new pivotV_template();
};
if (_arg1.name == "hi"){
_local3 = new hintBox_mc();
};
if (_arg2 == true){
_local4 = getDimensions(_arg1);
_local3.width = _local4.width;
_local3.height = _local4.height;
_local3.rotation = _arg1.rotation;
};
hideItemHolderDirect();
if (((!((_local3 == null))) && ((eraserOn == false)))){
editorCanvas.addChild(_local3);
_local3.id = _arg1.name;
_local3.name = _arg1.name;
_local3.mouseChildren = false;
_local3.startDrag(true);
_local3.addEventListener(MouseEvent.CLICK, placeOnCanvas);
};
}
public function getDimensions(_arg1:MovieClip):Object{
var _local2:Object;
var _local3:Number;
_local2 = new Object();
_local3 = _arg1.rotation;
_arg1.rotation = 0;
_local2.width = _arg1.width;
_local2.height = _arg1.height;
_arg1.rotation = _local3;
return (_local2);
}
public function showEraser(_arg1:MouseEvent):void{
if (eraserOn == false){
removeTransformToolDirect();
editor.cursor.gotoAndStop(2);
editor.eraser.gotoAndStop(1);
Mouse.hide();
crosshairs = new crosshairs_mc();
stage.addChild(crosshairs);
crosshairs.x = stage.mouseX;
crosshairs.y = stage.mouseY;
crosshairs.mouseEnabled = false;
crosshairs.mouseChildren = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE, updateEraser);
eraserOn = true;
};
}
public function updateEraser(_arg1:MouseEvent):void{
crosshairs.x = _arg1.stageX;
crosshairs.y = _arg1.stageY;
}
public function removeEraserOnClick(_arg1:MouseEvent):void{
removeEraser();
}
public function removeEraser():void{
editor.cursor.gotoAndStop(1);
editor.eraser.gotoAndStop(2);
Mouse.show();
stage.removeChild(crosshairs);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, updateEraser);
eraserOn = false;
}
public function placeOnCanvas(_arg1:MouseEvent):void{
var _local2:MovieClip;
levelTested = false;
_local2 = (_arg1.currentTarget as MovieClip);
_local2.removeEventListener(MouseEvent.CLICK, placeOnCanvas);
_local2.stopDrag();
setTimeout(allowTransformation, 200, _local2);
_local2.addEventListener(MouseEvent.MOUSE_OVER, glowItems);
_local2.addEventListener(MouseEvent.MOUSE_OUT, unglowItems);
if (_local2.x < -300){
_local2.x = -300;
};
if (_local2.x > 300){
_local2.x = 300;
};
if (_local2.y < -248){
_local2.y = -248;
};
if (_local2.y > 170){
_local2.y = 170;
};
}
public function allowTransformation(_arg1:MovieClip):void{
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, transformObject);
}
public function editItemWithKeyboard(_arg1:KeyboardEvent):void{
if (editor.hintInput.visible == false){
if (keyboardTarget != null){
if (_arg1.keyCode == 46){
editorCanvas.removeChild(keyboardTarget);
removeTransformToolDirect();
keyboardTarget = null;
};
if (_arg1.keyCode == Keyboard.DOWN){
if (keyboardTarget.y < 170){
keyboardTarget.y++;
currTool.y++;
};
};
if (_arg1.keyCode == Keyboard.UP){
if (keyboardTarget.y > -248){
keyboardTarget.y--;
currTool.y--;
};
};
if (_arg1.keyCode == Keyboard.RIGHT){
if (keyboardTarget.x < 300){
keyboardTarget.x++;
currTool.x++;
};
};
if (_arg1.keyCode == Keyboard.LEFT){
if (keyboardTarget.x > -300){
keyboardTarget.x--;
currTool.x--;
};
};
if (_arg1.keyCode == 68){
dragItemToCanvasDirect(keyboardTarget, true);
};
};
};
}
public function transformObject(_arg1:MouseEvent):void{
var _local2:MovieClip;
_local2 = (_arg1.target as MovieClip);
transformObjectDirect(_local2);
}
public function transformObjectDirect(_arg1:MovieClip):void{
var _local2:String;
levelTested = false;
if (eraserOn == true){
editorCanvas.removeChild(_arg1);
removeTransformToolDirect();
} else {
keyboardTarget = _arg1;
currTool.parent.setChildIndex(currTool, (currTool.parent.numChildren - 1));
currTool.scaleEnabled = true;
currTool.scaleProportionalEnabled = true;
currTool.rotationEnabled = true;
currTool.skewEnabled = false;
currTool.constrainScale = false;
currTool.moveNewTargets = true;
_local2 = _arg1.id;
if ((((((((((((((((((((((((((_local2 == "hi")) || ((_local2 == "ba")))) || ((_local2 == "be")))) || ((_local2 == "tu")))) || ((_local2 == "td")))) || ((_local2 == "tl")))) || ((_local2 == "tr")))) || ((_local2 == "sp")))) || ((_local2 == "rc")))) || ((_local2 == "ra")))) || ((_local2 == "ro")))) || ((_local2 == "mh")))) || ((_local2 == "mv")))){
currTool.scaleEnabled = false;
currTool.scaleProportionalEnabled = false;
currTool.rotationEnabled = false;
};
if ((((((((((_local2 == "bo")) || ((_local2 == "co")))) || ((_local2 == "pi")))) || ((_local2 == "ta")))) || ((_local2 == "tp")))){
currTool.constrainScale = true;
currTool.rotationEnabled = false;
currTool.scaleEnabled = false;
};
currTool.target = (_arg1 as Sprite);
if (_local2 == "hi"){
currentMC = (_arg1 as MovieClip);
editor.hintInput.visible = true;
editor.itemHolder.visible = false;
if (currentMC.message.text == "text"){
editor.hintInput.textField.text = "Enter text here ...";
} else {
editor.hintInput.textField.text = currentMC.message.text;
};
editor.hintInput._ok_.addEventListener(MouseEvent.CLICK, updateHint);
} else {
editor.hintInput._ok_.removeEventListener(MouseEvent.CLICK, updateHint);
editor.hintInput.visible = false;
editor.itemHolder.visible = true;
};
};
}
public function updateHint(_arg1:MouseEvent):void{
var _local2:String;
var _local3:String;
var _local4:uint;
var _local5:String;
_local2 = editor.hintInput.textField.text;
_local3 = "";
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2.charAt(_local4);
if (((!((_local5 == ","))) && (!((_local5 == "\""))))){
_local3 = (_local3 + _local5);
};
_local4++;
};
currentMC.message.text = _local3;
editor.hintInput._ok_.removeEventListener(MouseEvent.CLICK, updateHint);
editor.hintInput.visible = false;
editor.itemHolder.visible = true;
currTool.target = null;
}
public function cleanEditor():void{
editor._help_.removeEventListener(MouseEvent.CLICK, showEditorHelp);
editor.eraser.removeEventListener(MouseEvent.CLICK, showEraser);
editor.cursor.removeEventListener(MouseEvent.CLICK, removeEraserOnClick);
editor.itemHolder.removeEventListener(MouseEvent.MOUSE_OVER, showItemHolder);
editor.itemHolder.close.removeEventListener(MouseEvent.CLICK, hideItemHolder);
editor.background.removeEventListener(MouseEvent.MOUSE_DOWN, removeTransformTool);
editor._test_.removeEventListener(MouseEvent.CLICK, testLevel);
editor._export_.removeEventListener(MouseEvent.CLICK, export);
editor._share_.removeEventListener(MouseEvent.CLICK, share);
editor._clear_.removeEventListener(MouseEvent.CLICK, clearEditor);
editor._import_.removeEventListener(MouseEvent.CLICK, importLevel);
editor.removeEventListener(MouseEvent.MOUSE_UP, checkItemsInBounds);
editor.removeChild(currTool);
keyboardTarget = null;
stage.removeEventListener(KeyboardEvent.KEY_DOWN, editItemWithKeyboard);
}
public function testLevel(_arg1:MouseEvent):void{
if (eraserOn == true){
removeEraser();
};
editMode = true;
editString = createStringFromEditor();
if (editorError == false){
fadeInOut();
setTimeout(removeEditor, 500);
setTimeout(initialiseGame, 501);
} else {
showMessageBox(editString);
};
}
public function showMessageBox(_arg1:String):void{
if (keyboardTarget != null){
keyboardTarget = null;
};
currTool.target = null;
editor.messageBox.visible = true;
editor.messageBox.message.text = _arg1;
editor.messageBox._Close_.addEventListener(MouseEvent.MOUSE_DOWN, hideMessageBox);
}
public function hideMessageBox(_arg1:MouseEvent):void{
editor.messageBox.visible = false;
editor.messageBox._Close_.removeEventListener(MouseEvent.MOUSE_DOWN, hideMessageBox);
}
public function share(_arg1:MouseEvent):void{
if (eraserOn == true){
removeEraser();
};
if (levelTested == false){
showMessageBox("Please test and complete your level before sharing it. If you make any alterations, you will need to complete it again to make sure it is possible.");
} else {
authorForm = new authorForm_mc();
editor.addChild(authorForm);
authorForm.message.text = "Please give your level a name and author";
authorForm._ok_.addEventListener(MouseEvent.CLICK, submitAuthorForm);
authorForm._cancel_.addEventListener(MouseEvent.CLICK, removeAuthorForm);
};
}
public function submitAuthorForm(_arg1:MouseEvent):void{
var _local2:PlayerLevel;
if (authorForm.levelName.text == ""){
authorForm.message.text = "Please enter a name for your level.";
} else {
if (authorForm.author.text == ""){
authorForm.message.text = "Please enter an author for your level.";
} else {
authorForm._ok_.removeEventListener(MouseEvent.CLICK, submitAuthorForm);
_local2 = new PlayerLevel();
_local2.Name = authorForm.levelName.text;
_local2.PlayerName = authorForm.author.text;
_local2.Data = createStringFromEditor();
PlayerLevels.Save(_local2, editorCanvas, this.SaveComplete);
authorForm.message.text = "Saving level ....";
authorForm._ok_.visible = false;
authorForm._cancel_.visible = false;
};
};
}
public function SaveComplete(_arg1:PlayerLevel, _arg2:Boolean, _arg3:int):void{
if (_arg2){
authorForm.message.text = "\nLevel saved successfully!";
} else {
switch (_arg3){
case PlayerLevels.SAVE_FAILED_GENERAL_ERROR:
authorForm.message.text = "\nSorry, an error occurred";
break;
case PlayerLevels.SAVE_FAILED_LEVEL_EXISTS:
authorForm.message.text = "\nThis level has already been saved";
break;
case PlayerLevels.SAVE_INVALID_THUMB:
authorForm.message.text = "\nThumbnail failed validation";
break;
};
};
authorForm._ok_.visible = true;
authorForm._ok_.addEventListener(MouseEvent.CLICK, removeAuthorForm);
}
public function removeAuthorForm(_arg1:MouseEvent):void{
authorForm._cancel_.removeEventListener(MouseEvent.CLICK, removeAuthorForm);
authorForm._ok_.removeEventListener(MouseEvent.CLICK, removeAuthorForm);
editor.removeChild(authorForm);
}
public function export(_arg1:MouseEvent):void{
if (eraserOn == true){
removeEraser();
};
outputPanel = new output_mc();
editor.addChild(outputPanel);
outputPanel.outputText.text = createStringFromEditor();
outputPanel._ok_.addEventListener(MouseEvent.CLICK, removeExport);
}
public function createStringFromEditor():String{
var _local1:String;
var _local2:MovieClip;
var _local3:String;
var _local4:int;
var _local5:int;
var _local6:uint;
var _local7:Object;
editorError = false;
_local1 = "";
_local3 = "";
_local4 = 0;
_local5 = 0;
_local6 = 0;
while (_local6 < editorCanvas.numChildren) {
_local2 = (editorCanvas.getChildAt(_local6) as MovieClip);
_local7 = getDimensions(_local2);
_local3 = (_local3 + (_local2.id + ","));
_local3 = (_local3 + (String(int(_local2.x)) + ","));
_local3 = (_local3 + (String(int(_local2.y)) + ","));
_local3 = (_local3 + (String(int(_local7.width)) + ","));
_local3 = (_local3 + (String(int(_local7.height)) + ","));
_local3 = (_local3 + (String(int(_local2.rotation)) + ","));
if (_local2.id == "hi"){
_local3 = (_local3 + (_local2.message.text + ","));
};
if (_local2.id == "co"){
_local4++;
};
if (_local2.id == "ta"){
_local5++;
};
_local6++;
};
if (_local4 > 1){
editorError = true;
_local1 = "You can only have one cow per level.";
};
if (_local4 < 1){
editorError = true;
_local1 = "You must have one cow per level.";
};
if (_local5 > 1){
editorError = true;
_local1 = "You can only have one target per level.";
};
if (_local5 < 1){
editorError = true;
_local1 = "You must have one target per level.";
};
_local3 = _local3.slice(0, (_local3.length - 1));
_local3 = Base64.encode(_local3);
if (editorError == false){
return (_local3);
};
return (_local1);
}
public function removeExport(_arg1:MouseEvent):void{
outputPanel._ok_.removeEventListener(MouseEvent.CLICK, removeExport);
editor.removeChild(outputPanel);
}
public function removeShare(_arg1:MouseEvent):void{
outputPanel._ok_.removeEventListener(MouseEvent.CLICK, removeShare);
editor.removeChild(outputPanel);
}
public function importLevel(_arg1:MouseEvent):void{
if (eraserOn == true){
removeEraser();
};
inputPanel = new inputPanel_mc();
editor.addChild(inputPanel);
inputPanel.inputText.text = "Paste level code here";
inputPanel._ok_.addEventListener(MouseEvent.CLICK, removeImportLevel);
}
public function removeImportLevel(_arg1:MouseEvent):void{
editString = inputPanel.inputText.text;
inputPanel._ok_.removeEventListener(MouseEvent.CLICK, removeImportLevel);
editor.removeChild(inputPanel);
loadLevelIntoEditor();
}
public function fetchUserLevels():void{
var _local1:String;
userLevelSelect.loading.message.text = "Loading list";
if (sortByNewest == true){
_local1 = "newest";
} else {
_local1 = "popular";
};
addedRowArray = new Array();
PlayerLevels.List(this.ListLoaded, _local1, pageNumber, 100);
userLevelSelect.loading._OK_.visible = false;
}
public function setSortNewest(_arg1:MouseEvent):void{
if (sortByNewest == false){
sortByNewest = true;
pageNumber = 1;
updateTable();
};
}
public function setSortHighest(_arg1:MouseEvent):void{
if (sortByNewest == true){
sortByNewest = false;
pageNumber = 1;
updateTable();
};
}
public function updateCheckBoxes():void{
if (sortByNewest == true){
userLevelSelect.sortNewest.checkBox.gotoAndStop(2);
userLevelSelect.sortHighest.checkBox.gotoAndStop(1);
} else {
userLevelSelect.sortNewest.checkBox.gotoAndStop(1);
userLevelSelect.sortHighest.checkBox.gotoAndStop(2);
};
}
public function nextPage(_arg1:MouseEvent):void{
pageNumber++;
populateTable();
}
public function previousPage(_arg1:MouseEvent):void{
pageNumber--;
populateTable();
}
public function updateTable():void{
removeUserLevels();
showUserLevels();
}
public function ListLoaded(_arg1:Array, _arg2:int):void{
var _local3:uint;
var _local4:uint;
var _local5:PlayerLevel;
var _local6:Array;
var _local7:uint;
var _local8:Array;
var _local9:uint;
var _local10:Number;
var _local11:Number;
trace((_arg2 + " levels loaded total"));
if (((!((_arg1 == null))) && ((_arg2 > 0)))){
_local3 = _arg1.length;
userLevelArray = new Array();
userLevelSelect.loading.visible = false;
while (_local4 < _local3) {
_local5 = _arg1[_local4];
userLevelArray.push(_local5);
_local4++;
};
if (sortByNewest == false){
_local6 = new Array();
_local7 = 0;
while (_local7 < _local3) {
_local10 = (userLevelArray[_local7].Score / userLevelArray[_local7].Votes);
_local11 = (Math.round((_local10 * 100)) / 100);
_local6.push({realRating:_local11, index:_local7});
_local7++;
};
_local6.sortOn("realRating", (Array.NUMERIC | Array.DESCENDING));
_local8 = new Array();
_local9 = 0;
while (_local9 < _local3) {
_local8.push(userLevelArray[_local6[_local9].index]);
_local9++;
};
userLevelArray = _local8;
};
populateTable();
} else {
userLevelSelect.loading.icon.visible = false;
userLevelSelect.loading.message.text = "Sorry, could not connect. Please try later.";
userLevelSelect.loading._OK_.visible = true;
userLevelSelect.loading._OK_.addEventListener(MouseEvent.CLICK, userLevelSelectToMenu);
};
}
public function populateTable():void{
var _local1:uint;
var _local2:uint;
var _local3:MovieClip;
var _local4:PlayerLevel;
var _local5:*;
var _local6:Number;
var _local7:Number;
var _local8:String;
_local1 = 0;
while (_local1 < addedRowArray.length) {
_local3 = addedRowArray[_local1];
_local3.removeEventListener(MouseEvent.MOUSE_OVER, glowItems);
_local3.removeEventListener(MouseEvent.MOUSE_OUT, unglowItems);
_local3.removeEventListener(MouseEvent.CLICK, selectRow);
userLevelSelect.table.removeChild(_local3);
_local1++;
};
addedRowArray = new Array();
_local2 = 0;
while (_local2 < 10) {
if (userLevelArray[(_local2 + (10 * (pageNumber - 1)))] != null){
_local4 = userLevelArray[(_local2 + (10 * (pageNumber - 1)))];
_local5 = new row_mc();
addedRowArray.push(_local5);
userLevelSelect.table.addChild(_local5);
_local5.x = 9;
_local5.y = (46 + (34 * _local2));
_local5.levelName.text = _local4.Name;
_local5.author.text = _local4.PlayerName;
_local6 = (_local4.Score / _local4.Votes);
_local7 = (Math.round((_local6 * 100)) / 100);
_local8 = String(_local7);
_local5.rating.text = _local8;
_local5.plays.text = String(_local4.Votes);
_local5.id = _local4.LevelId;
_local5.mouseChildren = false;
_local5.addEventListener(MouseEvent.MOUSE_OVER, glowItems);
_local5.addEventListener(MouseEvent.MOUSE_OUT, unglowItems);
_local5.addEventListener(MouseEvent.CLICK, selectRow);
};
_local2++;
};
if (userLevelArray.length > (pageNumber * 10)){
userLevelSelect.nextArrow.visible = true;
} else {
userLevelSelect.nextArrow.visible = false;
};
if (pageNumber > 1){
userLevelSelect.previousArrow.visible = true;
} else {
userLevelSelect.previousArrow.visible = false;
};
}
public function selectRow(_arg1:MouseEvent):void{
userLevelSelect.loading.visible = true;
userLevelSelect.loading._OK_.visible = false;
userLevelSelect.loading.icon.visible = true;
userLevelSelect.loading.message.text = "Loading level";
levelObject.id = _arg1.target.id;
levelObject.levelName = _arg1.target.levelName.text;
levelObject.author = _arg1.target.author.text;
PlayerLevels.Load(levelObject.id, this.loadUserLevelComplete);
}
public function loadUserLevelComplete(_arg1:PlayerLevel):void{
if (_arg1 != null){
userString = _arg1.Data;
userMode = true;
fadeInOut();
setTimeout(initialiseGame, 500);
setTimeout(removeUserLevels, 501);
} else {
userLevelSelect.loading.icon.visible = false;
userLevelSelect.loading.message.text = "Could not load level";
userLevelSelect.loading._OK_.visible = true;
userLevelSelect.loading._OK_.addEventListener(MouseEvent.CLICK, refreshTable);
};
}
public function refreshTable(_arg1:MouseEvent):void{
userLevelSelect.loading._OK_.removeEventListener(MouseEvent.CLICK, refreshTable);
removeUserLevels();
showUserLevels();
}
function frame1(){
stop();
Log.View(1229, "447d739afb10", root.loaderInfo.loaderURL);
_Continue_.visible = false;
stage.frameRate = 30;
currentURL2 = stage.loaderInfo.url;
allowedURL2 = "kongregate.com";
onKong = false;
if (currentURL2.indexOf(allowedURL2, 0) != -1){
onKong = true;
};
if (onKong == false){
if (Math.random() < 0.5){
CPMStarContentSpotID = "3868Q98FB7C1A";
} else {
CPMStarContentSpotID = "3876QCF8F339C";
};
ad = new AdLoader(CPMStarContentSpotID);
adBox.addChild(ad);
} else {
adBox.visible = false;
};
turboNuke.addEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
finished = false;
addEventListener(Event.ENTER_FRAME, loader);
counter = 0;
counterMax = 200;
}
function frame2(){
stop();
stage.frameRate = 24;
intro.addEventListener(MouseEvent.MOUSE_DOWN, gotoTurboNuke);
}
function frame3(){
play();
stageAssets.visible = false;
}
function frame4(){
stop();
stage.frameRate = 30;
fps = 0;
fpsStartTime = 0;
fpsNewTime = 0;
fpsElapsedTime = 0;
fpsCounter = 0;
grav = 180;
maxAngVel = 1000;
torque = 0x7A1200;
levelButtonStart = 0;
buttonSpeed = 0;
buttonDistToTarget = 0;
rotationSpeed = 2;
gameZoneRadius = 215;
tickerStart = 0;
gunSpeed = 8;
scrollSpeed = 0.6;
scrollSpeedScale = 1;
slowBarValue = 0;
slowBarStartValue = 418;
scrolled = 0;
bubbleSpeedX = 2;
bubbleSpeedY = 2;
impulseSize = 0;
numberOfLevels = 20;
currentLevel = 1;
highestLevel = 1;
oink = 1;
so = SharedObject.getLocal("highestLevel");
if (((!((so.data.highestLevel == undefined))) && (!((so.data.highestLevel == null))))){
highestLevel = so.data.highestLevel;
};
if (highestLevel < 1){
highestLevel = 1;
};
alwaysUnlocked = 1;
score = 0;
bestScore = 0;
if (((!((so.data.bestScore == undefined))) && (!((so.data.bestScore == null))))){
bestScore = so.data.bestScore;
};
if (bestScore < 0){
bestScore = 0;
};
kinetroidsDestroyed = 0;
livesLost = 0;
startOfLevelScore = 0;
bonusLifeScore = 0;
bonusLifeInterval = 20000;
numberOfPucks = 0;
numberOfTargets = 0;
lives = 0;
startLives = 3;
targetsReached = 0;
numberOfTravelators = 0;
bonus = 0;
discsUsed = 0;
bonusTweenNumber = 0;
tickerSection = 0;
levelsPlayed = 0;
levelOffset = 0;
numberOfHintBoxes = 0;
numberOfTeleports = 0;
teleportPair = 0;
numberOfEGs = 0;
rapidFireCounter = 0;
numberOfStages = 6;
myBallRadius = 35;
storeBallY = 0;
maxBallY = 0;
stillCounter = 0;
userRating = 0;
pageNumber = 0;
levelsInDatabase = 0;
lastButtonPressed = "";
editString = "";
userString = "";
levelObject = new Object();
editMode = false;
userMode = false;
gameRunning = false;
gameOver = false;
gameWon = false;
submitSuccess = false;
arrowLeftDownFlag = false;
arrowRightDownFlag = false;
adjusting = false;
leftKeyDown = false;
rightKeyDown = false;
upKeyDown = false;
downKeyDown = false;
mouseIsDown = false;
preventFiring = false;
crosshairsOn = false;
cleaned = false;
targetReached = false;
soundOn = true;
musicOn = true;
checkForCollisions = false;
fadePuckIn = false;
hintBoxExists = false;
disableReset = false;
securityOn = false;
rapidFireOn = false;
tickerPresent = false;
killed = false;
placing = false;
lastLevelReached = false;
groundCreated = false;
aim = false;
waitForMouseUp = false;
flying = false;
delayStart = false;
newGame = false;
retrying = false;
levelIsComplete = false;
eraserOn = false;
itemHolderVisible = false;
sortByNewest = true;
editorHelpShown = false;
editorError = false;
levelTested = false;
bombExploded = false;
cowOffScreen = false;
m_physScale = 1;
m_timeStep = (1 / 30);
m_iterations = 10;
sideWall = new Array();
teleportArray = new Array();
puckArray = new Array();
targetArray = new Array();
tweenArray = new Array();
travelator = new Array();
hintBoxArray = new Array();
hint = new Array();
bonusTweenArray = new Array();
tickerArray = new Array();
starArray = new Array();
myBallArray = new Array();
pigArray = new Array();
haystackArray = new Array();
levelStringArray = new Array();
tickerArray[0] = "*** Get ready for Mooo !! ***";
tickerArray[1] = "*** A game developed by -ANDROMEDUS.COM- ***";
tickerArray[2] = "*** Coding and Design by -RIC- ***";
tickerArray[3] = "*** Art supervisor -MR HOD- ***";
tickerArray[4] = "*** Sponsored by - TURBONUKE.COM - ***";
tickerArray[5] = "*** Thanks to -ERIN CATTO- -SKATEHEAD- -PLAYTOMIC- ***";
tickerArray[6] = "*** Don't forget to check out more great games at - TURBONUKE.COM - ***";
egArray = new Array();
centre = new Point(300, 300);
musicChannel = new SoundChannel();
musicTransform = musicChannel.soundTransform;
musicSound = new country_medley();
winSound = new win();
popSound = new pop();
explosionSound = new explosion();
oink1Sound = new moo();
currentURL = stage.loaderInfo.url;
allowedURL = "andromedus.com";
allowedLocal = "Richard/Documents/";
userLevelArray = new Array();
addedRowArray = new Array();
MochiBot.track(this, "82e9a607");
initialise();
}
}
}//package mooo_fla
Section 81
//ratingStar_mc_251 (mooo_fla.ratingStar_mc_251)
package mooo_fla {
import flash.display.*;
public dynamic class ratingStar_mc_251 extends MovieClip {
public function ratingStar_mc_251(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package mooo_fla
Section 82
//Encode (SWFStats.Encode)
package SWFStats {
import flash.utils.*;
import flash.display.*;
public class Encode {
private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
private static var crcTable:Array;
private static var crcTableComputed:Boolean = false;
private static var hex_chr:String = "0123456789abcdef";
public static function Base64(_arg1:ByteArray):String{
var _local3:Array;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local2 = "";
var _local4:Array = new Array(4);
_arg1.position = 0;
while (_arg1.bytesAvailable > 0) {
_local3 = new Array();
_local5 = 0;
while ((((_local5 < 3)) && ((_arg1.bytesAvailable > 0)))) {
_local3[_local5] = _arg1.readUnsignedByte();
_local5++;
};
_local4[0] = ((_local3[0] & 252) >> 2);
_local4[1] = (((_local3[0] & 3) << 4) | (_local3[1] >> 4));
_local4[2] = (((_local3[1] & 15) << 2) | (_local3[2] >> 6));
_local4[3] = (_local3[2] & 63);
_local6 = _local3.length;
while (_local6 < 3) {
_local4[(_local6 + 1)] = 64;
_local6++;
};
_local7 = 0;
while (_local7 < _local4.length) {
_local2 = (_local2 + BASE64_CHARS.charAt(_local4[_local7]));
_local7++;
};
};
return (_local2);
}
public static function PNG(_arg1:BitmapData):ByteArray{
var _local5:uint;
var _local6:int;
var _local2:ByteArray = new ByteArray();
_local2.writeUnsignedInt(2303741511);
_local2.writeUnsignedInt(218765834);
var _local3:ByteArray = new ByteArray();
_local3.writeInt(_arg1.width);
_local3.writeInt(_arg1.height);
_local3.writeUnsignedInt(134610944);
_local3.writeByte(0);
writeChunk(_local2, 1229472850, _local3);
var _local4:ByteArray = new ByteArray();
var _local7:int;
while (_local7 < _arg1.height) {
_local4.writeByte(0);
if (!_arg1.transparent){
_local6 = 0;
while (_local6 < _arg1.width) {
_local5 = _arg1.getPixel(_local6, _local7);
_local4.writeUnsignedInt(uint((((_local5 & 0xFFFFFF) << 8) | 0xFF)));
_local6++;
};
} else {
_local6 = 0;
while (_local6 < _arg1.width) {
_local5 = _arg1.getPixel32(_local6, _local7);
_local4.writeUnsignedInt(uint((((_local5 & 0xFFFFFF) << 8) | (_local5 >>> 24))));
_local6++;
};
};
_local7++;
};
_local4.compress();
writeChunk(_local2, 1229209940, _local4);
writeChunk(_local2, 1229278788, null);
return (_local2);
}
private static function writeChunk(_arg1:ByteArray, _arg2:uint, _arg3:ByteArray):void{
var _local8:uint;
var _local9:uint;
var _local10:uint;
if (!crcTableComputed){
crcTableComputed = true;
crcTable = [];
_local9 = 0;
while (_local9 < 0x0100) {
_local8 = _local9;
_local10 = 0;
while (_local10 < 8) {
if ((_local8 & 1)){
_local8 = uint((uint(3988292384) ^ uint((_local8 >>> 1))));
} else {
_local8 = uint((_local8 >>> 1));
};
_local10++;
};
crcTable[_local9] = _local8;
_local9++;
};
};
var _local4:uint;
if (_arg3 != null){
_local4 = _arg3.length;
};
_arg1.writeUnsignedInt(_local4);
var _local5:uint = _arg1.position;
_arg1.writeUnsignedInt(_arg2);
if (_arg3 != null){
_arg1.writeBytes(_arg3);
};
var _local6:uint = _arg1.position;
_arg1.position = _local5;
_local8 = 4294967295;
var _local7:int;
while (_local7 < (_local6 - _local5)) {
_local8 = uint((crcTable[((_local8 ^ _arg1.readUnsignedByte()) & uint(0xFF))] ^ uint((_local8 >>> 8))));
_local7++;
};
_local8 = uint((_local8 ^ uint(4294967295)));
_arg1.position = _local6;
_arg1.writeUnsignedInt(_local8);
}
private static function bitOR(_arg1:Number, _arg2:Number):Number{
var _local3:Number = ((_arg1 & 1) | (_arg2 & 1));
var _local4:Number = ((_arg1 >>> 1) | (_arg2 >>> 1));
return (((_local4 << 1) | _local3));
}
private static function bitXOR(_arg1:Number, _arg2:Number):Number{
var _local3:Number = ((_arg1 & 1) ^ (_arg2 & 1));
var _local4:Number = ((_arg1 >>> 1) ^ (_arg2 >>> 1));
return (((_local4 << 1) | _local3));
}
private static function bitAND(_arg1:Number, _arg2:Number):Number{
var _local3:Number = ((_arg1 & 1) & (_arg2 & 1));
var _local4:Number = ((_arg1 >>> 1) & (_arg2 >>> 1));
return (((_local4 << 1) | _local3));
}
private static function addme(_arg1:Number, _arg2:Number):Number{
var _local3:Number = ((_arg1 & 0xFFFF) + (_arg2 & 0xFFFF));
var _local4:Number = (((_arg1 >> 16) + (_arg2 >> 16)) + (_local3 >> 16));
return (((_local4 << 16) | (_local3 & 0xFFFF)));
}
private static function rhex(_arg1:Number):String{
var _local3:int;
var _local2 = "";
_local3 = 0;
while (_local3 <= 3) {
_local2 = (_local2 + (hex_chr.charAt(((_arg1 >> ((_local3 * 8) + 4)) & 15)) + hex_chr.charAt(((_arg1 >> (_local3 * 8)) & 15))));
_local3++;
};
return (_local2);
}
private static function str2blks_MD5(_arg1:String):Array{
var _local4:int;
var _local2:Number = (((_arg1.length + 8) >> 6) + 1);
var _local3:Array = new Array((_local2 * 16));
_local4 = 0;
while (_local4 < (_local2 * 16)) {
_local3[_local4] = 0;
_local4++;
};
_local4 = 0;
while (_local4 < _arg1.length) {
_local3[(_local4 >> 2)] = (_local3[(_local4 >> 2)] | (_arg1.charCodeAt(_local4) << ((((_arg1.length * 8) + _local4) % 4) * 8)));
_local4++;
};
_local3[(_local4 >> 2)] = (_local3[(_local4 >> 2)] | (128 << ((((_arg1.length * 8) + _local4) % 4) * 8)));
var _local5:int = (_arg1.length * 8);
_local3[((_local2 * 16) - 2)] = (_local5 & 0xFF);
_local3[((_local2 * 16) - 2)] = (_local3[((_local2 * 16) - 2)] | (((_local5 >>> 8) & 0xFF) << 8));
_local3[((_local2 * 16) - 2)] = (_local3[((_local2 * 16) - 2)] | (((_local5 >>> 16) & 0xFF) << 16));
_local3[((_local2 * 16) - 2)] = (_local3[((_local2 * 16) - 2)] | (((_local5 >>> 24) & 0xFF) << 24));
return (_local3);
}
private static function rol(_arg1:Number, _arg2:Number):Number{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
private static function cmn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{
return (addme(rol(addme(addme(_arg2, _arg1), addme(_arg4, _arg6)), _arg5), _arg3));
}
private static function ff(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (cmn(bitOR(bitAND(_arg2, _arg3), bitAND(~(_arg2), _arg4)), _arg1, _arg2, _arg5, _arg6, _arg7));
}
private static function gg(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (cmn(bitOR(bitAND(_arg2, _arg4), bitAND(_arg3, ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
private static function hh(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (cmn(bitXOR(bitXOR(_arg2, _arg3), _arg4), _arg1, _arg2, _arg5, _arg6, _arg7));
}
private static function ii(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (cmn(bitXOR(_arg3, bitOR(_arg2, ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function MD5(_arg1:String):String{
var _local7:int;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local2:Array = str2blks_MD5(_arg1);
var _local3:Number = 1732584193;
var _local4:Number = -271733879;
var _local5:Number = -1732584194;
var _local6:Number = 271733878;
_local7 = 0;
while (_local7 < _local2.length) {
_local8 = _local3;
_local9 = _local4;
_local10 = _local5;
_local11 = _local6;
_local3 = ff(_local3, _local4, _local5, _local6, _local2[(_local7 + 0)], 7, -680876936);
_local6 = ff(_local6, _local3, _local4, _local5, _local2[(_local7 + 1)], 12, -389564586);
_local5 = ff(_local5, _local6, _local3, _local4, _local2[(_local7 + 2)], 17, 606105819);
_local4 = ff(_local4, _local5, _local6, _local3, _local2[(_local7 + 3)], 22, -1044525330);
_local3 = ff(_local3, _local4, _local5, _local6, _local2[(_local7 + 4)], 7, -176418897);
_local6 = ff(_local6, _local3, _local4, _local5, _local2[(_local7 + 5)], 12, 1200080426);
_local5 = ff(_local5, _local6, _local3, _local4, _local2[(_local7 + 6)], 17, -1473231341);
_local4 = ff(_local4, _local5, _local6, _local3, _local2[(_local7 + 7)], 22, -45705983);
_local3 = ff(_local3, _local4, _local5, _local6, _local2[(_local7 + 8)], 7, 1770035416);
_local6 = ff(_local6, _local3, _local4, _local5, _local2[(_local7 + 9)], 12, -1958414417);
_local5 = ff(_local5, _local6, _local3, _local4, _local2[(_local7 + 10)], 17, -42063);
_local4 = ff(_local4, _local5, _local6, _local3, _local2[(_local7 + 11)], 22, -1990404162);
_local3 = ff(_local3, _local4, _local5, _local6, _local2[(_local7 + 12)], 7, 1804603682);
_local6 = ff(_local6, _local3, _local4, _local5, _local2[(_local7 + 13)], 12, -40341101);
_local5 = ff(_local5, _local6, _local3, _local4, _local2[(_local7 + 14)], 17, -1502002290);
_local4 = ff(_local4, _local5, _local6, _local3, _local2[(_local7 + 15)], 22, 1236535329);
_local3 = gg(_local3, _local4, _local5, _local6, _local2[(_local7 + 1)], 5, -165796510);
_local6 = gg(_local6, _local3, _local4, _local5, _local2[(_local7 + 6)], 9, -1069501632);
_local5 = gg(_local5, _local6, _local3, _local4, _local2[(_local7 + 11)], 14, 643717713);
_local4 = gg(_local4, _local5, _local6, _local3, _local2[(_local7 + 0)], 20, -373897302);
_local3 = gg(_local3, _local4, _local5, _local6, _local2[(_local7 + 5)], 5, -701558691);
_local6 = gg(_local6, _local3, _local4, _local5, _local2[(_local7 + 10)], 9, 38016083);
_local5 = gg(_local5, _local6, _local3, _local4, _local2[(_local7 + 15)], 14, -660478335);
_local4 = gg(_local4, _local5, _local6, _local3, _local2[(_local7 + 4)], 20, -405537848);
_local3 = gg(_local3, _local4, _local5, _local6, _local2[(_local7 + 9)], 5, 568446438);
_local6 = gg(_local6, _local3, _local4, _local5, _local2[(_local7 + 14)], 9, -1019803690);
_local5 = gg(_local5, _local6, _local3, _local4, _local2[(_local7 + 3)], 14, -187363961);
_local4 = gg(_local4, _local5, _local6, _local3, _local2[(_local7 + 8)], 20, 1163531501);
_local3 = gg(_local3, _local4, _local5, _local6, _local2[(_local7 + 13)], 5, -1444681467);
_local6 = gg(_local6, _local3, _local4, _local5, _local2[(_local7 + 2)], 9, -51403784);
_local5 = gg(_local5, _local6, _local3, _local4, _local2[(_local7 + 7)], 14, 1735328473);
_local4 = gg(_local4, _local5, _local6, _local3, _local2[(_local7 + 12)], 20, -1926607734);
_local3 = hh(_local3, _local4, _local5, _local6, _local2[(_local7 + 5)], 4, -378558);
_local6 = hh(_local6, _local3, _local4, _local5, _local2[(_local7 + 8)], 11, -2022574463);
_local5 = hh(_local5, _local6, _local3, _local4, _local2[(_local7 + 11)], 16, 1839030562);
_local4 = hh(_local4, _local5, _local6, _local3, _local2[(_local7 + 14)], 23, -35309556);
_local3 = hh(_local3, _local4, _local5, _local6, _local2[(_local7 + 1)], 4, -1530992060);
_local6 = hh(_local6, _local3, _local4, _local5, _local2[(_local7 + 4)], 11, 1272893353);
_local5 = hh(_local5, _local6, _local3, _local4, _local2[(_local7 + 7)], 16, -155497632);
_local4 = hh(_local4, _local5, _local6, _local3, _local2[(_local7 + 10)], 23, -1094730640);
_local3 = hh(_local3, _local4, _local5, _local6, _local2[(_local7 + 13)], 4, 681279174);
_local6 = hh(_local6, _local3, _local4, _local5, _local2[(_local7 + 0)], 11, -358537222);
_local5 = hh(_local5, _local6, _local3, _local4, _local2[(_local7 + 3)], 16, -722521979);
_local4 = hh(_local4, _local5, _local6, _local3, _local2[(_local7 + 6)], 23, 76029189);
_local3 = hh(_local3, _local4, _local5, _local6, _local2[(_local7 + 9)], 4, -640364487);
_local6 = hh(_local6, _local3, _local4, _local5, _local2[(_local7 + 12)], 11, -421815835);
_local5 = hh(_local5, _local6, _local3, _local4, _local2[(_local7 + 15)], 16, 530742520);
_local4 = hh(_local4, _local5, _local6, _local3, _local2[(_local7 + 2)], 23, -995338651);
_local3 = ii(_local3, _local4, _local5, _local6, _local2[(_local7 + 0)], 6, -198630844);
_local6 = ii(_local6, _local3, _local4, _local5, _local2[(_local7 + 7)], 10, 1126891415);
_local5 = ii(_local5, _local6, _local3, _local4, _local2[(_local7 + 14)], 15, -1416354905);
_local4 = ii(_local4, _local5, _local6, _local3, _local2[(_local7 + 5)], 21, -57434055);
_local3 = ii(_local3, _local4, _local5, _local6, _local2[(_local7 + 12)], 6, 1700485571);
_local6 = ii(_local6, _local3, _local4, _local5, _local2[(_local7 + 3)], 10, -1894986606);
_local5 = ii(_local5, _local6, _local3, _local4, _local2[(_local7 + 10)], 15, -1051523);
_local4 = ii(_local4, _local5, _local6, _local3, _local2[(_local7 + 1)], 21, -2054922799);
_local3 = ii(_local3, _local4, _local5, _local6, _local2[(_local7 + 8)], 6, 1873313359);
_local6 = ii(_local6, _local3, _local4, _local5, _local2[(_local7 + 15)], 10, -30611744);
_local5 = ii(_local5, _local6, _local3, _local4, _local2[(_local7 + 6)], 15, -1560198380);
_local4 = ii(_local4, _local5, _local6, _local3, _local2[(_local7 + 13)], 21, 1309151649);
_local3 = ii(_local3, _local4, _local5, _local6, _local2[(_local7 + 4)], 6, -145523070);
_local6 = ii(_local6, _local3, _local4, _local5, _local2[(_local7 + 11)], 10, -1120210379);
_local5 = ii(_local5, _local6, _local3, _local4, _local2[(_local7 + 2)], 15, 718787259);
_local4 = ii(_local4, _local5, _local6, _local3, _local2[(_local7 + 9)], 21, -343485551);
_local3 = addme(_local3, _local8);
_local4 = addme(_local4, _local9);
_local5 = addme(_local5, _local10);
_local6 = addme(_local6, _local11);
_local7 = (_local7 + 16);
};
return ((((rhex(_local3) + rhex(_local4)) + rhex(_local5)) + rhex(_local6)));
}
}
}//package SWFStats
Section 83
//Log (SWFStats.Log)
package SWFStats {
import flash.utils.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
import flash.external.*;
public final class Log {
private static const PingF:Timer = new Timer(60000);
private static const PingR:Timer = new Timer(30000);
public static var Enabled:Boolean = false;
public static var Queue:Boolean = true;
public static var SWFID:int = 0;
public static var GUID:String = "";
public static var SourceUrl:String;
private static var Request:LogRequest = new LogRequest();
private static var FirstPing:Boolean = true;
private static var Pings:int = 0;
private static var Plays:int = 0;
private static var HighestGoal:int = 0;
public static function View(_arg1:int=0, _arg2:String="", _arg3:String=""):void{
if (SWFID > 0){
return;
};
SWFID = _arg1;
GUID = _arg2;
Enabled = true;
if ((((SWFID == 0)) || ((GUID == "")))){
Enabled = false;
return;
};
if (((((!((_arg3.indexOf("http://") == 0))) && (!((Security.sandboxType == "localWithNetwork"))))) && (!((Security.sandboxType == "localTrusted"))))){
Enabled = false;
return;
};
SourceUrl = GetUrl(_arg3);
if ((((SourceUrl == null)) || ((SourceUrl == "")))){
Enabled = false;
return;
};
Security.allowDomain("http://tracker.swfstats.com/");
Security.allowInsecureDomain("http://tracker.swfstats.com/");
Security.loadPolicyFile("http://tracker.swfstats.com/crossdomain.xml");
Security.allowDomain("http://utils.swfstats.com/");
Security.allowInsecureDomain("http://utils.swfstats.com/");
Security.loadPolicyFile("http://utils.swfstats.com/crossdomain.xml");
var _local4:int = GetCookie("views");
_local4++;
SaveCookie("views", _local4);
Send(("v/" + _local4), true);
PingF.addEventListener(TimerEvent.TIMER, PingServer);
PingF.start();
}
public static function Play():void{
if (!Enabled){
return;
};
Plays++;
Send(("p/" + Plays));
}
public static function Goal(_arg1:int, _arg2:String):void{
}
private static function PingServer(... _args):void{
if (!Enabled){
return;
};
Pings++;
Send(((("t/" + (FirstPing) ? "y" : "n") + "/") + Pings), true);
if (FirstPing){
PingF.stop();
PingR.addEventListener(TimerEvent.TIMER, PingServer);
PingR.start();
FirstPing = false;
};
}
public static function CustomMetric(_arg1:String, _arg2:String=null):void{
if (!Enabled){
return;
};
if (_arg2 == null){
_arg2 = "";
};
Send(((("c/" + Clean(_arg1)) + "/") + Clean(_arg2)));
}
public static function LevelCounterMetric(_arg1:String, _arg2):void{
if (!Enabled){
return;
};
Send(((("lc/" + Clean(_arg1)) + "/") + Clean(_arg2)));
}
public static function LevelRangedMetric(_arg1:String, _arg2, _arg3:int):void{
if (!Enabled){
return;
};
Send(((((("lr/" + Clean(_arg1)) + "/") + Clean(_arg2)) + "/") + _arg3));
}
public static function LevelAverageMetric(_arg1:String, _arg2, _arg3:int):void{
if (!Enabled){
return;
};
Send(((((("la/" + Clean(_arg1)) + "/") + Clean(_arg2)) + "/") + _arg3));
}
private static function Send(_arg1:String, _arg2:Boolean=false):void{
Request.Queue(_arg1);
if (((((Request.Ready) || (_arg2))) || (!(Queue)))){
Request.Send();
Request = new LogRequest();
};
}
private static function Clean(_arg1:String):String{
return (escape(_arg1.replace("/", "\\").replace("~", "-")));
}
private static function GetCookie(_arg1:String):int{
var _local2:SharedObject = SharedObject.getLocal("swfstats");
if (_local2.data[_arg1] == undefined){
return (0);
};
return (int(_local2.data[_arg1]));
}
private static function SaveCookie(_arg1:String, _arg2:int):void{
var _local3:SharedObject = SharedObject.getLocal("swfstats");
_local3.data[_arg1] = _arg2.toString();
_local3.flush();
}
private static function GetUrl(_arg1:String):String{
var url:String;
var defaulturl = _arg1;
if (ExternalInterface.available){
try {
url = String(ExternalInterface.call("window.location.href.toString"));
} catch(s:Error) {
url = defaulturl;
};
} else {
if (defaulturl.indexOf("http://") == 0){
url = defaulturl;
};
};
if ((((((url == null)) || ((url == "")))) || ((url == "null")))){
if ((((Security.sandboxType == "localWithNetwork")) || ((Security.sandboxType == "localTrusted")))){
url = "http://local-testing/";
} else {
url = null;
};
};
return (escape(url));
}
}
}//package SWFStats
Section 84
//LogRequest (SWFStats.LogRequest)
package SWFStats {
import flash.events.*;
import flash.net.*;
public final class LogRequest {
private var Data:String;// = ""
private var Pieces:int;
public var Ready:Boolean;// = false
private static var Failed:int = 0;
public function Queue(_arg1:String):void{
if (Failed > 3){
return;
};
this.Pieces++;
this.Data = (this.Data + (((this.Data == "")) ? "" : "~" + _arg1));
if ((((this.Pieces == 8)) || ((this.Data.length > 300)))){
this.Ready = true;
};
}
public function Send():void{
var _local1:URLLoader = new URLLoader();
_local1.addEventListener(IOErrorEvent.IO_ERROR, this.IOErrorHandler);
_local1.addEventListener(HTTPStatusEvent.HTTP_STATUS, this.StatusChange);
_local1.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.SecurityErrorHandler);
_local1.load(new URLRequest((((((((((("http://tracker.swfstats.com/Games/q.aspx?guid=" + Log.GUID) + "&swfid=") + Log.SWFID) + "&q=") + this.Data) + "&url=") + Log.SourceUrl) + "&") + Math.random()) + "z")));
trace((((((((((("http://tracker.swfstats.com/Games/q.aspx?guid=" + Log.GUID) + "&swfid=") + Log.SWFID) + "&q=") + this.Data) + "&url=") + Log.SourceUrl) + "&") + Math.random()) + "z"));
}
private function IOErrorHandler(_arg1:IOErrorEvent):void{
Failed++;
}
private function SecurityErrorHandler(_arg1:SecurityErrorEvent):void{
}
private function StatusChange(_arg1:HTTPStatusEvent):void{
}
}
}//package SWFStats
Section 85
//PlayerLevel (SWFStats.PlayerLevel)
package SWFStats {
import flash.utils.*;
public final class PlayerLevel {
public var LevelId:String;
public var PlayerSource:String;// = ""
public var PlayerId:int;// = 0
public var PlayerName:String;// = ""
public var Name:String;
public var Data:String;
public var Votes:int;
public var Plays:int;
public var Rating:Number;
public var Score:int;
public var CustomData:Dictionary;
public function Thumbnail():String{
return (((("http://utils.swfstats.com/playerlevels/thumb.aspx?swfid=" + Log.SWFID) + "&levelid=") + this.LevelId));
}
}
}//package SWFStats
Section 86
//PlayerLevels (SWFStats.PlayerLevels)
package SWFStats {
import flash.utils.*;
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.geom.*;
public final class PlayerLevels {
public static const SAVE_COMPLETE:int = 0;
public static const SAVE_FAILED_LEVEL_EXISTS:int = 1;
public static const SAVE_FAILED_GENERAL_ERROR:int = 2;
public static const SAVE_FAILED_INVALID_HASH:int = 4;
public static const SAVE_INVALID_THUMB:int = 3;
private static var ListCallback:Function = null;
private static var LoadCallback:Function = null;
private static var SaveCallback:Function = null;
private static var RateCallback:Function = null;
private static var SaveLevel:PlayerLevel;
private static var RateLevel:String;
private static var RateAmount:int;
public static function Rate(_arg1:String, _arg2:int, _arg3:Function):Boolean{
if (RateCallback != null){
return (false);
};
var _local4:SharedObject = SharedObject.getLocal("ratings");
if (_local4.data[_arg1] != null){
_arg3(false);
return (false);
};
RateCallback = _arg3;
RateLevel = _arg1;
RateAmount = _arg2;
var _local5:URLLoader = new URLLoader();
_local5.addEventListener(Event.COMPLETE, RateComplete);
_local5.addEventListener(IOErrorEvent.IO_ERROR, RateErrorHandler);
_local5.addEventListener(HTTPStatusEvent.HTTP_STATUS, StatusChange);
_local5.addEventListener(SecurityErrorEvent.SECURITY_ERROR, LoadErrorHandler);
_local5.load(new URLRequest(((((((((("http://utils.swfstats.com/playerlevels/rate.aspx?swfid=" + Log.SWFID) + "&guid=") + Log.GUID) + "&levelid=") + _arg1) + "&rating=") + _arg2) + "&") + Math.random())));
return (true);
}
public static function RateComplete(_arg1:Event):void{
var _local2:SharedObject = SharedObject.getLocal("ratings");
_local2.data[RateLevel] = RateAmount;
_local2.flush();
var _local3:XML = XML(_arg1.target["data"]);
var _local4:int = _local3["status"];
RateCallback((_local4 == 0));
RateCallback = null;
}
private static function RateErrorHandler(_arg1):void{
RateCallback(false);
RateCallback = null;
}
public static function Load(_arg1:String, _arg2:Function):Boolean{
if (LoadCallback != null){
return (false);
};
LoadCallback = _arg2;
var _local3:URLLoader = new URLLoader();
_local3.addEventListener(Event.COMPLETE, LoadComplete);
_local3.addEventListener(IOErrorEvent.IO_ERROR, LoadErrorHandler);
_local3.addEventListener(HTTPStatusEvent.HTTP_STATUS, StatusChange);
_local3.addEventListener(SecurityErrorEvent.SECURITY_ERROR, LoadErrorHandler);
_local3.load(new URLRequest(((((((("http://utils.swfstats.com/playerlevels/load.aspx?swfid=" + Log.SWFID) + "&guid=") + Log.GUID) + "&levelid=") + _arg1) + "&") + Math.random())));
return (true);
}
private static function LoadComplete(_arg1:Event):void{
var _local6:XML;
var _local2:XML = XML(_arg1.target["data"]);
var _local3:XML = XML(_local2["level"]);
var _local4:PlayerLevel = new PlayerLevel();
_local4.LevelId = _local3["levelid"];
_local4.PlayerName = _local3["playername"];
_local4.PlayerId = _local3["playerid"];
_local4.Name = _local3["name"];
_local4.Score = _local3["score"];
_local4.Votes = _local3["votes"];
_local4.Rating = _local3["rating"];
_local4.Data = _local3["data"];
var _local5:XMLList = _local3["custom"];
if (_local5 != null){
_local4.CustomData = new Dictionary();
for each (_local6 in _local5.children()) {
_local4.CustomData[_local6.name()] = _local6.text();
};
};
LoadCallback(_local4);
LoadCallback = null;
}
private static function LoadErrorHandler(_arg1):void{
LoadCallback(null);
LoadCallback = null;
}
public static function List(_arg1:Function, _arg2:String, _arg3:int=1, _arg4:int=20, _arg5:Boolean=false, _arg6:String="", _arg7:String=""):Boolean{
if (ListCallback != null){
return (false);
};
ListCallback = _arg1;
var _local8:URLLoader = new URLLoader();
_local8.addEventListener(Event.COMPLETE, ListComplete);
_local8.addEventListener(IOErrorEvent.IO_ERROR, ListErrorHandler);
_local8.addEventListener(HTTPStatusEvent.HTTP_STATUS, StatusChange);
_local8.addEventListener(SecurityErrorEvent.SECURITY_ERROR, ListErrorHandler);
_local8.load(new URLRequest(((((((((((((((((("http://utils.swfstats.com/playerlevels/list.aspx?swfid=" + Log.SWFID) + "&guid=") + Log.GUID) + "&mode=") + _arg2) + "&page=") + _arg3) + "&perpage=") + _arg4) + "&data=") + _arg5) + "&datemin=") + _arg6) + "&datemax=") + _arg7) + "&") + Math.random())));
return (true);
}
private static function ListComplete(_arg1:Event):void{
var _local6:XML;
var _local7:XML;
var _local8:PlayerLevel;
var _local9:XMLList;
var _local2:XML = XML(_arg1.target["data"]);
var _local3:XMLList = _local2["level"];
var _local4:Array = new Array();
var _local5:int = _local2["numresults"];
for each (_local7 in _local3) {
_local8 = new PlayerLevel();
_local8.LevelId = _local7["levelid"];
_local8.PlayerId = _local7["playerid"];
_local8.PlayerName = _local7["playername"];
_local8.Name = _local7["name"];
_local8.Score = _local7["score"];
_local8.Rating = _local7["rating"];
_local8.Plays = _local7["plays"];
_local8.Votes = _local7["votes"];
if (_local7["data"]){
_local8.Data = _local7["data"];
};
_local9 = _local7["custom"];
if (_local9 != null){
_local8.CustomData = new Dictionary();
for each (_local6 in _local9.children()) {
_local8.CustomData[_local6.name()] = _local6.text();
};
};
_local4.push(_local8);
};
ListCallback(_local4, _local5);
ListCallback = null;
}
private static function ListErrorHandler(_arg1):void{
ListCallback(null, 0);
ListCallback = null;
}
public static function Save(_arg1:PlayerLevel, _arg2:DisplayObject, _arg3:Function):Boolean{
var _local13:String;
if (SaveCallback != null){
return (false);
};
SaveCallback = _arg3;
SaveLevel = _arg1;
var _local4:Number = 1;
var _local5:int = _arg2.width;
var _local6:int = _arg2.height;
if ((((_arg2.width > 100)) || ((_arg2.height > 100)))){
if (_arg2.width >= _arg2.height){
_local4 = (100 / _arg2.width);
_local5 = 100;
_local6 = Math.ceil((_local4 * _arg2.height));
} else {
if (_arg2.height > _arg2.width){
_local4 = (100 / _arg2.height);
_local5 = Math.ceil((_local4 * _arg2.width));
_local6 = 100;
};
};
};
var _local7:Matrix = new Matrix();
_local7.scale(_local4, _local4);
var _local8:BitmapData = new BitmapData(_local5, _local6, true, 0);
_local8.draw(_arg2, _local7, null, null, null, true);
var _local9:URLVariables = new URLVariables();
_local9.data = _arg1.Data;
_local9.image = Encode.Base64(Encode.PNG(_local8));
_local9.arrp = RandomSample(_local8);
_local9.hash = Encode.MD5((_local9.image + _local9.arrp));
var _local10:int;
if (_arg1.CustomData != null){
for (_local13 in _arg1.CustomData) {
_local9[("ckey" + _local10)] = _local13;
_local9[("cdata" + _local10)] = escape(_arg1.CustomData[_local13]);
_local10++;
};
};
var _local11:URLRequest = new URLRequest(((((((((((((("http://utils.swfstats.com/playerlevels/save.aspx?swfid=" + Log.SWFID) + "&guid=") + Log.GUID) + "&playerid=") + _arg1.PlayerId) + "&playersource=") + escape(_arg1.PlayerSource)) + "&playername=") + escape(_arg1.PlayerName)) + "&name=") + escape(_arg1.Name)) + "&customfields=") + _local10));
_local11.data = _local9;
_local11.method = URLRequestMethod.POST;
var _local12:URLLoader = new URLLoader();
_local12.dataFormat = URLLoaderDataFormat.TEXT;
_local12.addEventListener(Event.COMPLETE, SaveComplete);
_local12.addEventListener(IOErrorEvent.IO_ERROR, SaveErrorHandler);
_local12.addEventListener(HTTPStatusEvent.HTTP_STATUS, StatusChange);
_local12.addEventListener(SecurityErrorEvent.SECURITY_ERROR, SaveErrorHandler);
_local12.load(_local11);
return (true);
}
private static function SaveComplete(_arg1:Event):void{
var _local2:XML = XML(_arg1.target["data"]);
var _local3:int = _local2["status"];
SaveLevel.LevelId = _local2["levelid"];
SaveCallback(SaveLevel, !((SaveLevel.LevelId == "")), _local3);
SaveCallback = null;
SaveLevel = null;
}
private static function SaveErrorHandler(_arg1):void{
SaveCallback(SaveLevel, false, SAVE_FAILED_GENERAL_ERROR);
SaveCallback = null;
SaveLevel = null;
}
private static function StatusChange(_arg1:HTTPStatusEvent):void{
}
private static function RandomSample(_arg1:BitmapData):String{
var _local3:int;
var _local4:int;
var _local5:String;
var _local2:Array = new Array();
while (_local2.length < 10) {
_local3 = (Math.random() * _arg1.width);
_local4 = (Math.random() * _arg1.height);
_local5 = _arg1.getPixel32(_local3, _local4).toString(16);
while (_local5.length < 6) {
_local5 = ("0" + _local5);
};
_local2.push(((((_local3 + "/") + _local4) + "/") + _local5));
};
return (_local2.join(","));
}
}
}//package SWFStats
Section 87
//annihilationEffect_mc (annihilationEffect_mc)
package {
import flash.display.*;
public dynamic class annihilationEffect_mc extends MovieClip {
}
}//package
Section 88
//appleBubble_mc (appleBubble_mc)
package {
import flash.display.*;
public dynamic class appleBubble_mc extends MovieClip {
}
}//package
Section 89
//arrow_mc (arrow_mc)
package {
import flash.display.*;
public dynamic class arrow_mc extends MovieClip {
public var turret:MovieClip;
public var base:MovieClip;
}
}//package
Section 90
//authorForm_mc (authorForm_mc)
package {
import flash.display.*;
import com.*;
import flash.text.*;
public dynamic class authorForm_mc extends MovieClip {
public var _ok_:CB_button_mc_5;
public var author:TextField;
public var levelName:TextField;
public var message:TextField;
public var _cancel_:CB_button_mc_5;
}
}//package
Section 91
//awards_mc (awards_mc)
package {
import flash.display.*;
import flash.text.*;
public dynamic class awards_mc extends MovieClip {
public var bestScore:TextField;
public var menuButton:SimpleButton;
public var titleButton:MovieClip;
}
}//package
Section 92
//background_mc (background_mc)
package {
import flash.display.*;
public dynamic class background_mc extends MovieClip {
public var scenery:MovieClip;
}
}//package
Section 93
//ball_mc (ball_mc)
package {
import flash.display.*;
public dynamic class ball_mc extends MovieClip {
}
}//package
Section 94
//ball_template (ball_template)
package {
import flash.display.*;
public dynamic class ball_template extends MovieClip {
}
}//package
Section 95
//bananaBubble_mc (bananaBubble_mc)
package {
import flash.display.*;
public dynamic class bananaBubble_mc extends MovieClip {
}
}//package
Section 96
//bananas_mc (bananas_mc)
package {
import flash.display.*;
public dynamic class bananas_mc extends MovieClip {
}
}//package
Section 97
//belt_template (belt_template)
package {
import flash.display.*;
public dynamic class belt_template extends MovieClip {
}
}//package
Section 98
//blackScreen_mc (blackScreen_mc)
package {
import flash.display.*;
public dynamic class blackScreen_mc extends MovieClip {
}
}//package
Section 99
//blueGradient_mc (blueGradient_mc)
package {
import flash.display.*;
public dynamic class blueGradient_mc extends MovieClip {
}
}//package
Section 100
//bomb_mc (bomb_mc)
package {
import flash.display.*;
public dynamic class bomb_mc extends MovieClip {
}
}//package
Section 101
//bomb_template (bomb_template)
package {
import flash.display.*;
public dynamic class bomb_template extends MovieClip {
}
}//package
Section 102
//bonusDisplay_mc (bonusDisplay_mc)
package {
import flash.display.*;
import flash.text.*;
public dynamic class bonusDisplay_mc extends MovieClip {
public var textField:TextField;
}
}//package
Section 103
//bonusStar_mc (bonusStar_mc)
package {
import flash.display.*;
public dynamic class bonusStar_mc extends MovieClip {
}
}//package
Section 104
//bonusStar_template (bonusStar_template)
package {
import flash.display.*;
public dynamic class bonusStar_template extends MovieClip {
}
}//package
Section 105
//bottle_mc (bottle_mc)
package {
import flash.display.*;
public dynamic class bottle_mc extends MovieClip {
public var hitZone:MovieClip;
public function bottle_mc(){
addFrameScript(48, frame49);
}
function frame49(){
stop();
}
}
}//package
Section 106
//bottle_template (bottle_template)
package {
import flash.display.*;
public dynamic class bottle_template extends MovieClip {
}
}//package
Section 107
//box_mc (box_mc)
package {
import flash.display.*;
public dynamic class box_mc extends MovieClip {
}
}//package
Section 108
//bridge_mc (bridge_mc)
package {
import flash.display.*;
public dynamic class bridge_mc extends MovieClip {
}
}//package
Section 109
//bullet_mc (bullet_mc)
package {
import flash.display.*;
public dynamic class bullet_mc extends MovieClip {
}
}//package
Section 110
//bumper_mc (bumper_mc)
package {
import flash.display.*;
import com.*;
public dynamic class bumper_mc extends MovieClip {
public var light:bumperLight_75;
}
}//package
Section 111
//bumper_template (bumper_template)
package {
import flash.display.*;
public dynamic class bumper_template extends MovieClip {
}
}//package
Section 112
//cog_mc (cog_mc)
package {
import flash.display.*;
public dynamic class cog_mc extends MovieClip {
}
}//package
Section 113
//confirmQuit_mc (confirmQuit_mc)
package {
import flash.display.*;
public dynamic class confirmQuit_mc extends MovieClip {
public var noButton:SimpleButton;
public var yesButton:SimpleButton;
}
}//package
Section 114
//confirmReset_mc (confirmReset_mc)
package {
import flash.display.*;
public dynamic class confirmReset_mc extends MovieClip {
public var noButton:SimpleButton;
public var yesButton:SimpleButton;
}
}//package
Section 115
//confirmReturnToEditor_mc (confirmReturnToEditor_mc)
package {
import flash.display.*;
public dynamic class confirmReturnToEditor_mc extends MovieClip {
public var noButton:SimpleButton;
public var yesButton:SimpleButton;
}
}//package
Section 116
//country_medley (country_medley)
package {
import flash.media.*;
public dynamic class country_medley extends Sound {
}
}//package
Section 117
//cowRound_mc (cowRound_mc)
package {
import flash.display.*;
public dynamic class cowRound_mc extends MovieClip {
}
}//package
Section 118
//cowRound_template (cowRound_template)
package {
import flash.display.*;
public dynamic class cowRound_template extends MovieClip {
}
}//package
Section 119
//crosshairs_mc (crosshairs_mc)
package {
import flash.display.*;
public dynamic class crosshairs_mc extends MovieClip {
}
}//package
Section 120
//debug_mc (debug_mc)
package {
import flash.display.*;
import flash.text.*;
public dynamic class debug_mc extends MovieClip {
public var txt:TextField;
}
}//package
Section 121
//enemy_mc (enemy_mc)
package {
import flash.display.*;
public dynamic class enemy_mc extends MovieClip {
}
}//package
Section 122
//enemyBullet_mc (enemyBullet_mc)
package {
import flash.display.*;
public dynamic class enemyBullet_mc extends MovieClip {
}
}//package
Section 123
//enemyGun_mc (enemyGun_mc)
package {
import flash.display.*;
public dynamic class enemyGun_mc extends MovieClip {
}
}//package
Section 124
//enemyGun_template (enemyGun_template)
package {
import flash.display.*;
public dynamic class enemyGun_template extends MovieClip {
}
}//package
Section 125
//explosion (explosion)
package {
import flash.media.*;
public dynamic class explosion extends Sound {
}
}//package
Section 126
//explosion_mc (explosion_mc)
package {
import flash.display.*;
public dynamic class explosion_mc extends MovieClip {
public function explosion_mc(){
addFrameScript(30, frame31);
}
function frame31(){
stop();
this.parent.removeChild(this);
}
}
}//package
Section 127
//flagPole_mc (flagPole_mc)
package {
import flash.display.*;
public dynamic class flagPole_mc extends MovieClip {
}
}//package
Section 128
//gameBG_mc (gameBG_mc)
package {
import flash.display.*;
public dynamic class gameBG_mc extends MovieClip {
}
}//package
Section 129
//gameCanvas_mc (gameCanvas_mc)
package {
import flash.display.*;
public dynamic class gameCanvas_mc extends MovieClip {
}
}//package
Section 130
//gameOverScreen_mc (gameOverScreen_mc)
package {
import flash.display.*;
import com.*;
public dynamic class gameOverScreen_mc extends MovieClip {
public var cup1:MovieClip;
public var cup2:MovieClip;
public var submissionScreen:MovieClip;
public var _Menu_:CB_button_mc_5;
public var _More_Games_:CB_button_mc_5;
public var turboNuke:SimpleButton;
}
}//package
Section 131
//glints_mc (glints_mc)
package {
import flash.display.*;
public dynamic class glints_mc extends MovieClip {
}
}//package
Section 132
//gloss_mc (gloss_mc)
package {
import flash.display.*;
public dynamic class gloss_mc extends MovieClip {
}
}//package
Section 133
//ground_mc (ground_mc)
package {
import flash.display.*;
public dynamic class ground_mc extends MovieClip {
}
}//package
Section 134
//gui_mc (gui_mc)
package {
import flash.display.*;
import com.*;
import flash.text.*;
public dynamic class gui_mc extends MovieClip {
public var quitButton:SimpleButton;
public var score:TextField;
public var _Walkthrough_:CB_button_mc_5;
public var bonusLabel:MovieClip;
public var level:TextField;
public var resetButton:SimpleButton;
public var turboNuke:SimpleButton;
public var bonus:TextField;
}
}//package
Section 135
//gun_mc (gun_mc)
package {
import flash.display.*;
public dynamic class gun_mc extends MovieClip {
public var turret:MovieClip;
}
}//package
Section 136
//gunShadow_mc (gunShadow_mc)
package {
import flash.display.*;
public dynamic class gunShadow_mc extends MovieClip {
}
}//package
Section 137
//haystackH_mc (haystackH_mc)
package {
import flash.display.*;
public dynamic class haystackH_mc extends MovieClip {
}
}//package
Section 138
//haystackH_template (haystackH_template)
package {
import flash.display.*;
public dynamic class haystackH_template extends MovieClip {
}
}//package
Section 139
//haystackV_mc (haystackV_mc)
package {
import flash.display.*;
public dynamic class haystackV_mc extends MovieClip {
}
}//package
Section 140
//haystackV_template (haystackV_template)
package {
import flash.display.*;
public dynamic class haystackV_template extends MovieClip {
}
}//package
Section 141
//highlight_mc (highlight_mc)
package {
import flash.display.*;
public dynamic class highlight_mc extends MovieClip {
}
}//package
Section 142
//highscores_mc (highscores_mc)
package {
import flash.display.*;
import flash.text.*;
public dynamic class highscores_mc extends MovieClip {
public var connectingDisplay:TextField;
public var scoreDisplay:TextField;
public var nameDisplay:TextField;
public var rankDisplay:TextField;
}
}//package
Section 143
//hintBox_mc (hintBox_mc)
package {
import flash.display.*;
import flash.text.*;
public dynamic class hintBox_mc extends MovieClip {
public var message:TextField;
}
}//package
Section 144
//hintBox_template (hintBox_template)
package {
import flash.display.*;
public dynamic class hintBox_template extends MovieClip {
}
}//package
Section 145
//ice_mc (ice_mc)
package {
import flash.display.*;
public dynamic class ice_mc extends MovieClip {
}
}//package
Section 146
//ice_template (ice_template)
package {
import flash.display.*;
public dynamic class ice_template extends MovieClip {
}
}//package
Section 147
//inputPanel_mc (inputPanel_mc)
package {
import flash.display.*;
import com.*;
import flash.text.*;
public dynamic class inputPanel_mc extends MovieClip {
public var _ok_:CB_button_mc_5;
public var inputText:TextField;
}
}//package
Section 148
//instructions_mc (instructions_mc)
package {
import flash.display.*;
public dynamic class instructions_mc extends MovieClip {
public var guiInstance:gui_mc;
public var target:targetYellow_mc;
public var menuButton:SimpleButton;
public var mockBackground:MovieClip;
}
}//package
Section 149
//Intro_TurboNuke (Intro_TurboNuke)
package {
import flash.display.*;
public dynamic class Intro_TurboNuke extends MovieClip {
public function Intro_TurboNuke(){
addFrameScript(93, frame94);
}
function frame94(){
MovieClip(parent).nextFrame();
}
}
}//package
Section 150
//levelComplete_mc (levelComplete_mc)
package {
import flash.display.*;
public dynamic class levelComplete_mc extends MovieClip {
}
}//package
Section 151
//levelContainer_mc (levelContainer_mc)
package {
import flash.display.*;
public dynamic class levelContainer_mc extends MovieClip {
}
}//package
Section 152
//levelEditor_mc (levelEditor_mc)
package {
import flash.display.*;
import com.*;
public dynamic class levelEditor_mc extends MovieClip {
public var background:gameBG_mc;
public var help:MovieClip;
public var _clear_:CB_button_mc_5;
public var layerMarker:MovieClip;
public var messageBox:MovieClip;
public var itemHolder:MovieClip;
public var eraser:MovieClip;
public var _export_:CB_button_mc_5;
public var _share_:CB_button_mc_5;
public var _import_:CB_button_mc_5;
public var hintInput:MovieClip;
public var _help_:CB_button_mc_5;
public var _exit_:CB_button_mc_5;
public var cursor:MovieClip;
public var _test_:CB_button_mc_5;
}
}//package
Section 153
//levelInfo_mc (levelInfo_mc)
package {
import flash.display.*;
import com.*;
import flash.text.*;
public dynamic class levelInfo_mc extends MovieClip {
public var _Menu_:CB_button_mc_5;
public var m1:TextField;
public var m2:TextField;
public var _Continue_:CB_button_mc_5;
public var m3:TextField;
public var m4:TextField;
public var _More_Games_:CB_button_mc_5;
public var turboNuke:SimpleButton;
}
}//package
Section 154
//levelSelect_mc (levelSelect_mc)
package {
import flash.display.*;
import com.*;
public dynamic class levelSelect_mc extends MovieClip {
public var background:background_mc;
public var levelButtonHolder:MovieClip;
public var _Player_Levels_:CB_button_mc_5;
public var _Back_:CB_button_mc_5;
}
}//package
Section 155
//levelThumb (levelThumb)
package {
import flash.display.*;
public dynamic class levelThumb extends SimpleButton {
}
}//package
Section 156
//lifeBonus_mc (lifeBonus_mc)
package {
import flash.display.*;
import com.*;
public dynamic class lifeBonus_mc extends MovieClip {
public var light:bumperLight_75;
}
}//package
Section 157
//line_mc (line_mc)
package {
import flash.display.*;
public dynamic class line_mc extends MovieClip {
}
}//package
Section 158
//logH_mc (logH_mc)
package {
import flash.display.*;
public dynamic class logH_mc extends MovieClip {
}
}//package
Section 159
//logH_template (logH_template)
package {
import flash.display.*;
public dynamic class logH_template extends MovieClip {
}
}//package
Section 160
//logV_mc (logV_mc)
package {
import flash.display.*;
public dynamic class logV_mc extends MovieClip {
}
}//package
Section 161
//logV_template (logV_template)
package {
import flash.display.*;
public dynamic class logV_template extends MovieClip {
}
}//package
Section 162
//menu_mc (menu_mc)
package {
import flash.display.*;
import com.*;
import flash.text.*;
public dynamic class menu_mc extends MovieClip {
public var _Play_:CB_button_mc_5;
public var _Credits_:CB_button_mc_5;
public var _Hiscores_:CB_button_mc_5;
public var credits:MovieClip;
public var warningMessage:TextField;
public var _Add_to_Website_:CB_button_mc_5;
public var _More_Games_:CB_button_mc_5;
public var cow:MovieClip;
public var _editor_:CB_button_mc_5;
public var _Download_Game_:CB_button_mc_5;
public var turboNuke:SimpleButton;
}
}//package
Section 163
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var _local3:MochiBot = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var _local4 = "http://core.mochibot.com/my/core.swf";
var _local5:URLVariables = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
var _local6:String = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
var _local7:URLRequest = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
var _local8:Loader = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 164
//moo (moo)
package {
import flash.media.*;
public dynamic class moo extends Sound {
}
}//package
Section 165
//movingLine_mc (movingLine_mc)
package {
import flash.display.*;
public dynamic class movingLine_mc extends MovieClip {
}
}//package
Section 166
//movingLineH_template (movingLineH_template)
package {
import flash.display.*;
public dynamic class movingLineH_template extends MovieClip {
}
}//package
Section 167
//movingLineV_template (movingLineV_template)
package {
import flash.display.*;
public dynamic class movingLineV_template extends MovieClip {
}
}//package
Section 168
//musicToggle_mc (musicToggle_mc)
package {
import flash.display.*;
public dynamic class musicToggle_mc extends MovieClip {
}
}//package
Section 169
//myBall_mc (myBall_mc)
package {
import flash.display.*;
public dynamic class myBall_mc extends MovieClip {
public var monkey:MovieClip;
}
}//package
Section 170
//output_mc (output_mc)
package {
import flash.display.*;
import com.*;
import flash.text.*;
public dynamic class output_mc extends MovieClip {
public var _ok_:CB_button_mc_5;
public var outputText:TextField;
}
}//package
Section 171
//overlay_mc (overlay_mc)
package {
import flash.display.*;
public dynamic class overlay_mc extends MovieClip {
}
}//package
Section 172
//padlock_mc (padlock_mc)
package {
import flash.display.*;
public dynamic class padlock_mc extends MovieClip {
}
}//package
Section 173
//pig_mc (pig_mc)
package {
import flash.display.*;
public dynamic class pig_mc extends MovieClip {
}
}//package
Section 174
//pig_template (pig_template)
package {
import flash.display.*;
public dynamic class pig_template extends MovieClip {
}
}//package
Section 175
//pivotV_mc (pivotV_mc)
package {
import flash.display.*;
public dynamic class pivotV_mc extends MovieClip {
}
}//package
Section 176
//pivotV_template (pivotV_template)
package {
import flash.display.*;
public dynamic class pivotV_template extends MovieClip {
}
}//package
Section 177
//pop (pop)
package {
import flash.media.*;
public dynamic class pop extends Sound {
}
}//package
Section 178
//puckBlue_mc (puckBlue_mc)
package {
import flash.display.*;
public dynamic class puckBlue_mc extends MovieClip {
public var hitzone:MovieClip;
}
}//package
Section 179
//puckGreen_mc (puckGreen_mc)
package {
import flash.display.*;
public dynamic class puckGreen_mc extends MovieClip {
public var hitzone:MovieClip;
}
}//package
Section 180
//puckRed_mc (puckRed_mc)
package {
import flash.display.*;
public dynamic class puckRed_mc extends MovieClip {
}
}//package
Section 181
//puckYellow_mc (puckYellow_mc)
package {
import flash.display.*;
public dynamic class puckYellow_mc extends MovieClip {
}
}//package
Section 182
//rapidFire_mc (rapidFire_mc)
package {
import flash.display.*;
import com.*;
public dynamic class rapidFire_mc extends MovieClip {
public var light:bumperLight_75;
}
}//package
Section 183
//ratingForm_mc (ratingForm_mc)
package {
import flash.display.*;
import com.*;
import flash.text.*;
public dynamic class ratingForm_mc extends MovieClip {
public var background:background_mc;
public var rating:TextField;
public var _Submit_:CB_button_mc_5;
public var _Cancel_:CB_button_mc_5;
public var message:TextField;
public var stars:MovieClip;
}
}//package
Section 184
//rotator_mc (rotator_mc)
package {
import flash.display.*;
public dynamic class rotator_mc extends MovieClip {
}
}//package
Section 185
//rotator_template (rotator_template)
package {
import flash.display.*;
public dynamic class rotator_template extends MovieClip {
}
}//package
Section 186
//rotatorLong_mc (rotatorLong_mc)
package {
import flash.display.*;
public dynamic class rotatorLong_mc extends MovieClip {
}
}//package
Section 187
//rotatorLongC_template (rotatorLongC_template)
package {
import flash.display.*;
public dynamic class rotatorLongC_template extends MovieClip {
}
}//package
Section 188
//rotatorLongCC_template (rotatorLongCC_template)
package {
import flash.display.*;
public dynamic class rotatorLongCC_template extends MovieClip {
}
}//package
Section 189
//roundShadow_mc (roundShadow_mc)
package {
import flash.display.*;
public dynamic class roundShadow_mc extends MovieClip {
}
}//package
Section 190
//row_mc (row_mc)
package {
import flash.display.*;
import flash.text.*;
public dynamic class row_mc extends MovieClip {
public var plays:TextField;
public var rating:TextField;
public var author:TextField;
public var levelName:TextField;
}
}//package
Section 191
//segment_mc (segment_mc)
package {
import flash.display.*;
public dynamic class segment_mc extends MovieClip {
}
}//package
Section 192
//slowBonus_mc (slowBonus_mc)
package {
import flash.display.*;
import com.*;
public dynamic class slowBonus_mc extends MovieClip {
public var light:bumperLight_75;
}
}//package
Section 193
//soundToggle_mc (soundToggle_mc)
package {
import flash.display.*;
public dynamic class soundToggle_mc extends MovieClip {
}
}//package
Section 194
//squareShadow_mc (squareShadow_mc)
package {
import flash.display.*;
public dynamic class squareShadow_mc extends MovieClip {
}
}//package
Section 195
//star_mc (star_mc)
package {
import flash.display.*;
public dynamic class star_mc extends MovieClip {
}
}//package
Section 196
//starburst_mc (starburst_mc)
package {
import flash.utils.*;
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.geom.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.external.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class starburst_mc extends MovieClip {
public var label:TextField;
public var splatterArray:Array;
public var numberOfSplatters:uint;
public var gravity:Number;
public function starburst_mc(){
addFrameScript(0, frame1);
}
public function spawnSplatters(_arg1:String):void{
var _local3:*;
var _local2:* = 1;
while (_local2 <= numberOfSplatters) {
_local3 = new star_mc();
splatterArray[_local2] = _local3;
if (_arg1 == "medium"){
splatterArray[_local2].height = (splatterArray[_local2].height * 0.2);
splatterArray[_local2].width = (splatterArray[_local2].width * 0.2);
};
if (_arg1 == "small"){
splatterArray[_local2].height = (splatterArray[_local2].height * 0.1);
splatterArray[_local2].width = (splatterArray[_local2].width * 0.1);
};
this.addChild(splatterArray[_local2]);
splatterArray[_local2].splatSpeedY = (-3 - (Math.random() * 3));
splatterArray[_local2].splatSpeedX = (-3 + (Math.random() * 6));
splatterArray[_local2].dead = false;
_local2++;
};
}
public function moveSplatters(_arg1:Event):void{
var _local2:* = 1;
while (_local2 <= numberOfSplatters) {
if (((!((splatterArray[_local2] == undefined))) && (!((splatterArray[_local2] == 0))))){
if (splatterArray[_local2].dead == false){
splatterArray[_local2].x = (splatterArray[_local2].x + splatterArray[_local2].splatSpeedX);
splatterArray[_local2].y = (splatterArray[_local2].y + splatterArray[_local2].splatSpeedY);
splatterArray[_local2].splatSpeedY = (splatterArray[_local2].splatSpeedY + gravity);
splatterArray[_local2].rotation = ((-180 / Math.PI) * Math.atan2(splatterArray[_local2].splatSpeedX, splatterArray[_local2].splatSpeedY));
splatterArray[_local2].alpha = (splatterArray[_local2].alpha - 0.015);
};
if (splatterArray[_local2].y > 35){
splatterArray[_local2].dead = true;
splatterArray[_local2].visible = false;
};
};
_local2++;
};
}
public function removeThis():void{
this.removeEventListener(Event.ENTER_FRAME, moveSplatters);
this.parent.removeChild(this);
}
function frame1(){
label.visible = false;
splatterArray = new Array();
numberOfSplatters = 10;
gravity = 0.2;
spawnSplatters("medium");
this.addEventListener(Event.ENTER_FRAME, moveSplatters);
setTimeout(removeThis, 2500);
}
}
}//package
Section 197
//target_template (target_template)
package {
import flash.display.*;
public dynamic class target_template extends MovieClip {
}
}//package
Section 198
//targetBlue_mc (targetBlue_mc)
package {
import flash.display.*;
public dynamic class targetBlue_mc extends MovieClip {
public var fill:MovieClip;
}
}//package
Section 199
//targetGreen_mc (targetGreen_mc)
package {
import flash.display.*;
public dynamic class targetGreen_mc extends MovieClip {
public var fill:MovieClip;
}
}//package
Section 200
//targetRed_mc (targetRed_mc)
package {
import flash.display.*;
public dynamic class targetRed_mc extends MovieClip {
public var fill:MovieClip;
}
}//package
Section 201
//targetYellow_mc (targetYellow_mc)
package {
import flash.display.*;
public dynamic class targetYellow_mc extends MovieClip {
public var fill:MovieClip;
}
}//package
Section 202
//teleportIn_mc (teleportIn_mc)
package {
import flash.display.*;
public dynamic class teleportIn_mc extends MovieClip {
}
}//package
Section 203
//teleportIn_template (teleportIn_template)
package {
import flash.display.*;
public dynamic class teleportIn_template extends MovieClip {
}
}//package
Section 204
//teleportOut_mc (teleportOut_mc)
package {
import flash.display.*;
public dynamic class teleportOut_mc extends MovieClip {
}
}//package
Section 205
//teleportOut_template (teleportOut_template)
package {
import flash.display.*;
public dynamic class teleportOut_template extends MovieClip {
}
}//package
Section 206
//ticker_mc (ticker_mc)
package {
import flash.display.*;
public dynamic class ticker_mc extends MovieClip {
public var mc:MovieClip;
}
}//package
Section 207
//trampoline_mc (trampoline_mc)
package {
import flash.display.*;
public dynamic class trampoline_mc extends MovieClip {
public function trampoline_mc(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 208
//trampoline_template (trampoline_template)
package {
import flash.display.*;
public dynamic class trampoline_template extends MovieClip {
}
}//package
Section 209
//travelatorDown_mc (travelatorDown_mc)
package {
import flash.display.*;
public dynamic class travelatorDown_mc extends MovieClip {
public var hitZone6:MovieClip;
public var hitZone4:MovieClip;
public var hitZone5:MovieClip;
public var hitZone2:MovieClip;
public var hitZone3:MovieClip;
public var hitZone1:MovieClip;
}
}//package
Section 210
//travelatorDown_template (travelatorDown_template)
package {
import flash.display.*;
public dynamic class travelatorDown_template extends MovieClip {
}
}//package
Section 211
//travelatorLeft_mc (travelatorLeft_mc)
package {
import flash.display.*;
public dynamic class travelatorLeft_mc extends MovieClip {
public var hitZone6:MovieClip;
public var hitZone4:MovieClip;
public var hitZone5:MovieClip;
public var hitZone2:MovieClip;
public var hitZone3:MovieClip;
public var hitZone1:MovieClip;
}
}//package
Section 212
//travelatorLeft_template (travelatorLeft_template)
package {
import flash.display.*;
public dynamic class travelatorLeft_template extends MovieClip {
}
}//package
Section 213
//travelatorRight_mc (travelatorRight_mc)
package {
import flash.display.*;
public dynamic class travelatorRight_mc extends MovieClip {
public var hitZone6:MovieClip;
public var hitZone4:MovieClip;
public var hitZone5:MovieClip;
public var hitZone2:MovieClip;
public var hitZone3:MovieClip;
public var hitZone1:MovieClip;
}
}//package
Section 214
//travelatorRight_template (travelatorRight_template)
package {
import flash.display.*;
public dynamic class travelatorRight_template extends MovieClip {
}
}//package
Section 215
//travelatorUp_mc (travelatorUp_mc)
package {
import flash.display.*;
public dynamic class travelatorUp_mc extends MovieClip {
public var hitZone6:MovieClip;
public var hitZone4:MovieClip;
public var hitZone5:MovieClip;
public var hitZone2:MovieClip;
public var hitZone3:MovieClip;
public var hitZone1:MovieClip;
}
}//package
Section 216
//travelatorUp_template (travelatorUp_template)
package {
import flash.display.*;
public dynamic class travelatorUp_template extends MovieClip {
}
}//package
Section 217
//userLevelSelect_mc (userLevelSelect_mc)
package {
import flash.display.*;
import com.*;
public dynamic class userLevelSelect_mc extends MovieClip {
public var background:background_mc;
public var previousArrow:SimpleButton;
public var table:MovieClip;
public var sortNewest:MovieClip;
public var sortHighest:MovieClip;
public var nextArrow:SimpleButton;
public var loading:MovieClip;
public var _Back_:CB_button_mc_5;
}
}//package
Section 218
//wallH_mc (wallH_mc)
package {
import flash.display.*;
public dynamic class wallH_mc extends MovieClip {
}
}//package
Section 219
//wallH_template (wallH_template)
package {
import flash.display.*;
public dynamic class wallH_template extends MovieClip {
}
}//package
Section 220
//wallV_mc (wallV_mc)
package {
import flash.display.*;
public dynamic class wallV_mc extends MovieClip {
}
}//package
Section 221
//wallV_template (wallV_template)
package {
import flash.display.*;
public dynamic class wallV_template extends MovieClip {
}
}//package
Section 222
//win (win)
package {
import flash.media.*;
public dynamic class win extends Sound {
}
}//package