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.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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 _local4:b2CircleDef;
var _local5:Number;
var _local6:Number;
var _local7:b2AABB;
var _local8:b2BroadPhase;
m_localPosition = new b2Vec2();
super(_arg1, _arg2);
_local4 = (_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);
_local7 = 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));
_local8 = 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 ResetProxy(_arg1:b2BroadPhase):void{
var _local2:b2Proxy;
var _local3:b2AABB;
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
_local2 = _arg1.GetProxy(m_proxyId);
_arg1.DestroyProxy(m_proxyId);
_local2 = null;
_local3 = 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 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 Support(_arg1:Number, _arg2:Number, _arg3:b2Vec2):void{
var _local4:Number;
_local4 = 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)));
}
override public function Synchronize(_arg1:b2Vec2, _arg2:b2Mat22, _arg3:b2Vec2, _arg4:b2Mat22):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2AABB;
var _local12:b2BroadPhase;
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;
};
_local5 = (_arg1.x + ((_arg2.col1.x * m_localPosition.x) + (_arg2.col2.x * m_localPosition.y)));
_local6 = (_arg1.y + ((_arg2.col1.y * m_localPosition.x) + (_arg2.col2.y * m_localPosition.y)));
_local7 = Math.min(_local5, m_position.x);
_local8 = Math.min(_local6, m_position.y);
_local9 = Math.max(_local5, m_position.x);
_local10 = Math.max(_local6, m_position.y);
_local11 = new b2AABB();
_local11.minVertex.Set((_local7 - m_radius), (_local8 - m_radius));
_local11.maxVertex.Set((_local9 + m_radius), (_local10 + m_radius));
_local12 = m_body.m_world.m_broadPhase;
if (_local12.InRange(_local11)){
_local12.MoveProxy(m_proxyId, _local11);
} else {
m_body.Freeze();
};
}
override public function TestPoint(_arg1:b2Vec2):Boolean{
var _local2:b2Vec2;
_local2 = new b2Vec2();
_local2.SetV(_arg1);
_local2.Subtract(m_position);
return ((b2Math.b2Dot(_local2, _local2) <= (m_radius * m_radius)));
}
}
}//package Box2D.Collision.Shapes
Section 4
//b2MassData (Box2D.Collision.Shapes.b2MassData)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2MassData {
public var mass:Number;// = 0
public var center:b2Vec2;
public var I:Number;// = 0
public function b2MassData(){
mass = 0;
center = new b2Vec2(0, 0);
I = 0;
super();
}
}
}//package Box2D.Collision.Shapes
Section 5
//b2PolyDef (Box2D.Collision.Shapes.b2PolyDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PolyDef extends b2ShapeDef {
public var vertexCount:int;
public var vertices:Array;
public function b2PolyDef(){
var _local1:int;
vertices = new Array(b2Settings.b2_maxPolyVertices);
super();
type = b2Shape.e_polyShape;
vertexCount = 0;
_local1 = 0;
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.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PolyShape extends b2Shape {
public var m_vertices:Array;
public var m_localOBB:b2OBB;
public var m_normals:Array;
public var m_vertexCount:int;
private var syncMat:b2Mat22;
public var m_coreVertices:Array;
public var m_localCentroid:b2Vec2;
private var syncAABB:b2AABB;
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 _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:int;
var _local15:int;
var _local16:Number;
var _local17:Number;
var _local18:b2BroadPhase;
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++;
};
};
_local10 = Number.MAX_VALUE;
_local11 = Number.MAX_VALUE;
_local12 = -(Number.MAX_VALUE);
_local13 = -(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));
_local16 = (m_position.x + ((m_R.col1.x * m_localOBB.center.x) + (m_R.col2.x * m_localOBB.center.y)));
_local17 = (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);
_local18 = 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 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 Support(_arg1:Number, _arg2:Number, _arg3:b2Vec2):void{
var _local4:Number;
var _local5:Number;
var _local6:int;
var _local7:Number;
var _local8:int;
var _local9:Number;
_local4 = ((_arg1 * m_R.col1.x) + (_arg2 * m_R.col1.y));
_local5 = ((_arg1 * m_R.col2.x) + (_arg2 * m_R.col2.y));
_local6 = 0;
_local7 = ((m_coreVertices[0].x * _local4) + (m_coreVertices[0].y * _local5));
_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))));
}
override public function Synchronize(_arg1:b2Vec2, _arg2:b2Mat22, _arg3:b2Vec2, _arg4:b2Mat22):void{
var _local5:Number;
var _local6:Number;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:b2BroadPhase;
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;
};
_local7 = _arg2.col1;
_local8 = _arg2.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 = (_arg1.x + ((_arg2.col1.x * _local5) + (_arg2.col2.x * _local6)));
_local12 = (_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));
_local13 = m_body.m_world.m_broadPhase;
if (_local13.InRange(syncAABB)){
_local13.MoveProxy(m_proxyId, syncAABB);
} else {
m_body.Freeze();
};
}
override public function TestPoint(_arg1:b2Vec2):Boolean{
var _local2:b2Vec2;
var _local3:int;
var _local4:b2Vec2;
var _local5:Number;
_local2 = new b2Vec2();
_local2.SetV(_arg1);
_local2.Subtract(m_position);
_local2.MulTM(m_R);
_local3 = 0;
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 ResetProxy(_arg1:b2BroadPhase):void{
var _local2:b2Proxy;
var _local3:b2Mat22;
var _local4:b2Mat22;
var _local5:b2Vec2;
var _local6:b2Vec2;
var _local7:b2AABB;
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
_local2 = _arg1.GetProxy(m_proxyId);
_arg1.DestroyProxy(m_proxyId);
_local2 = null;
_local3 = b2Math.b2MulMM(m_R, m_localOBB.R);
_local4 = b2Math.b2AbsM(_local3);
_local5 = b2Math.b2MulMV(_local4, m_localOBB.extents);
_local6 = b2Math.b2MulMV(m_R, m_localOBB.center);
_local6.Add(m_position);
_local7 = 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();
};
}
}
}//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape)
package Box2D.Collision.Shapes {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2Shape {
public var m_body:b2Body;
public var m_maxRadius:Number;
public var m_next:b2Shape;
public var m_R:b2Mat22;
public var m_type:int;
public var m_friction:Number;
public var m_proxyId:uint;
public var m_maskBits:uint;
public var m_groupIndex:int;
public var m_userData;// = null
public var m_restitution:Number;
public var m_position:b2Vec2;
public var m_categoryBits:uint;
public static const e_boxShape:int = 1;
public static const e_unknownShape:int = -1;
public static const e_shapeTypeCount:int = 4;
public static const e_circleShape:int = 0;
public static const e_meshShape:int = 3;
public static const e_polyShape:int = 2;
public function b2Shape(_arg1:b2ShapeDef, _arg2:b2Body){
m_R = new b2Mat22();
m_position = new b2Vec2();
m_userData = null;
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 GetMaxRadius():Number{
return (m_maxRadius);
}
public function GetPosition():b2Vec2{
return (m_position);
}
public function QuickSync(_arg1:b2Vec2, _arg2:b2Mat22):void{
}
public function GetNext():b2Shape{
return (m_next);
}
public function GetType():int{
return (m_type);
}
public function GetUserData(){
return (m_userData);
}
public function Support(_arg1:Number, _arg2:Number, _arg3:b2Vec2):void{
}
public function Synchronize(_arg1:b2Vec2, _arg2:b2Mat22, _arg3:b2Vec2, _arg4:b2Mat22):void{
}
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 GetRotationMatrix():b2Mat22{
return (m_R);
}
public function GetBody():b2Body{
return (m_body);
}
public function TestPoint(_arg1:b2Vec2):Boolean{
return (false);
}
public function ResetProxy(_arg1:b2BroadPhase):void{
}
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 _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:b2Vec2;
var _local9:Number;
var _local10:int;
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;
_local5 = new b2Vec2();
_local5.SetZero();
_local6 = 0;
_local7 = 0;
_local8 = new b2Vec2(0, 0);
_local9 = (1 / 3);
_local10 = 0;
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 _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:int;
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;
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = 0;
_local9 = (1 / 3);
_local10 = 0;
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);
}
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);
}
}
}//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 groupIndex:int;
public var categoryBits:int;
public var localRotation:Number;
public var restitution:Number;
public var userData;// = null
public var density:Number;
public var maskBits:int;
public var type:int;
public var localPosition:b2Vec2;
public var friction:Number;
public function b2ShapeDef(){
userData = null;
super();
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;
var _local2:Number;
var _local3:Boolean;
_local1 = maxVertex.x;
_local2 = maxVertex.y;
_local1 = maxVertex.x;
_local2 = maxVertex.y;
_local1 = (_local1 - minVertex.x);
_local2 = (_local2 - minVertex.y);
_local3 = (((_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 proxyId:uint;
public var stabbingCount:uint;
public var value:uint;
public function Swap(_arg1:b2Bound):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
_local2 = value;
_local3 = proxyId;
_local4 = stabbingCount;
value = _arg1.value;
proxyId = _arg1.proxyId;
stabbingCount = _arg1.stabbingCount;
_arg1.value = _local2;
_arg1.proxyId = _local3;
_arg1.stabbingCount = _local4;
}
public function IsLower():Boolean{
return (((value & 1) == 0));
}
public function IsUpper():Boolean{
return (((value & 1) == 1));
}
}
}//package Box2D.Collision
Section 11
//b2BoundValues (Box2D.Collision.b2BoundValues)
package Box2D.Collision {
public class b2BoundValues {
public var lowerValues:Array;
public var upperValues:Array;
public function b2BoundValues(){
lowerValues = [0, 0];
upperValues = [0, 0];
super();
}
}
}//package Box2D.Collision
Section 12
//b2BroadPhase (Box2D.Collision.b2BroadPhase)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2BroadPhase {
public var m_quantizationFactor:b2Vec2;
public var m_worldAABB:b2AABB;
public var m_bounds:Array;
public var m_freeProxy:uint;
public var m_proxyCount:int;
public var m_proxyPool:Array;
public var m_queryResultCount:int;
public var m_pairManager:b2PairManager;
public var m_timeStamp:uint;
public var m_queryResults:Array;
public static const b2_nullEdge:uint = b2Settings.USHRT_MAX;
public static const b2_invalid:uint = b2Settings.USHRT_MAX;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:b2Proxy;
var _local7:int;
m_pairManager = new b2PairManager();
m_proxyPool = new Array(b2Settings.b2_maxPairs);
m_bounds = new Array((2 * b2Settings.b2_maxProxies));
m_queryResults = new Array(b2Settings.b2_maxProxies);
m_quantizationFactor = new b2Vec2();
super();
m_pairManager.Initialize(this, _arg2);
m_worldAABB = _arg1;
m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
m_queryResults[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
_local4 = _arg1.maxVertex.x;
_local5 = _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 QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{
var _local4:Array;
var _local5:Array;
var _local6:uint;
var _local7:uint;
var _local8:Array;
var _local9:Array;
var _local10:int;
var _local11:int;
var _local12:b2Proxy;
_local4 = new Array();
_local5 = new Array();
ComputeBounds(_local4, _local5, _arg1);
_local8 = [_local6];
_local9 = [_local7];
Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0);
Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1);
_local10 = 0;
_local11 = 0;
while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) {
_local12 = m_proxyPool[m_queryResults[_local11]];
_arg2[_local11] = _local12.userData;
_local11++;
_local10++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local10);
}
public function Commit():void{
m_pairManager.Commit();
}
public function GetProxy(_arg1:int):b2Proxy{
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((m_proxyPool[_arg1].IsValid() == false)))){
return (null);
};
return (m_proxyPool[_arg1]);
}
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++;
};
}
private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:int;
var _local12:int;
var _local13:b2Proxy;
_local8 = BinarySearch(_arg5, _arg6, _arg3);
_local9 = BinarySearch(_arg5, _arg6, _arg4);
_local10 = _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 TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{
var _local3:int;
var _local4:Array;
_local3 = 0;
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);
}
private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local4 = _arg3.minVertex.x;
_local5 = _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);
_local6 = _arg3.maxVertex.x;
_local7 = _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);
}
public function CreateProxy(_arg1:b2AABB, _arg2):uint{
var _local3:uint;
var _local4:b2Proxy;
var _local5:uint;
var _local6:uint;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:int;
var _local11:Array;
var _local12:uint;
var _local13:uint;
var _local14:Array;
var _local15:Array;
var _local16:Array;
var _local17:int;
var _local18:int;
var _local19:b2Bound;
var _local20:b2Bound;
var _local21:int;
var _local22:b2Proxy;
_local5 = m_freeProxy;
_local4 = m_proxyPool[_local5];
m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
_local6 = (2 * m_proxyCount);
_local7 = new Array();
_local8 = new Array();
ComputeBounds(_local7, _local8, _arg1);
_local9 = 0;
while (_local9 < 2) {
_local11 = m_bounds[_local9];
_local14 = [_local12];
_local15 = [_local13];
Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9);
_local12 = _local14[0];
_local13 = _local15[0];
_local16 = new Array();
_local18 = (_local6 - _local13);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[(_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++;
_local10 = 0;
while (_local10 < m_queryResultCount) {
m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]);
_local10++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local5);
}
public function DestroyProxy(_arg1:uint):void{
var _local2:b2Proxy;
var _local3:int;
var _local4:int;
var _local5:int;
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;
_local2 = m_proxyPool[_arg1];
_local3 = (2 * m_proxyCount);
_local4 = 0;
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++;
};
_local5 = 0;
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 TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{
var _local3:int;
var _local4:Array;
_local3 = 0;
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);
}
public function Validate():void{
var _local1:b2Pair;
var _local2:b2Proxy;
var _local3:b2Proxy;
var _local4:Boolean;
var _local5:int;
var _local6:b2Bound;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
_local5 = 0;
while (_local5 < 2) {
_local6 = m_bounds[_local5];
_local7 = (2 * m_proxyCount);
_local8 = 0;
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local6[_local9];
if (_local10.IsLower() == true){
_local8++;
} else {
_local8--;
};
_local9++;
};
_local5++;
};
}
private function IncrementOverlapCount(_arg1:uint):void{
var _local2:b2Proxy;
_local2 = m_proxyPool[_arg1];
if (_local2.timeStamp < m_timeStamp){
_local2.timeStamp = m_timeStamp;
_local2.overlapCount = 1;
} else {
_local2.overlapCount = 2;
m_queryResults[m_queryResultCount] = _arg1;
m_queryResultCount++;
};
}
public function InRange(_arg1:b2AABB):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = _arg1.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 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 _local10:uint;
var _local11:b2Proxy;
var _local12:b2BoundValues;
var _local13:b2BoundValues;
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;
};
_local10 = (2 * m_proxyCount);
_local11 = m_proxyPool[_arg1];
_local12 = new b2BoundValues();
ComputeBounds(_local12.lowerValues, _local12.upperValues, _arg2);
_local13 = 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 static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{
var _local4:int;
var _local5:int;
var _local6:int;
_local4 = 0;
_local5 = (_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 EdgeSeparation(_arg1:b2PolyShape, _arg2:int, _arg3:b2PolyShape):Number{
var _local4:Array;
var _local5:int;
var _local6:Array;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:Number;
var _local12:Number;
var _local13:int;
var _local14:Number;
var _local15:int;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:b2Vec2;
var _local22:Number;
_local4 = _arg1.m_vertices;
_local5 = _arg3.m_vertexCount;
_local6 = _arg3.m_vertices;
_local7 = _arg1.m_normals[_arg2].x;
_local8 = _arg1.m_normals[_arg2].y;
_local9 = _local7;
_local10 = _arg1.m_R;
_local7 = ((_local10.col1.x * _local9) + (_local10.col2.x * _local8));
_local8 = ((_local10.col1.y * _local9) + (_local10.col2.y * _local8));
_local11 = _local7;
_local12 = _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;
_local13 = 0;
_local14 = Number.MAX_VALUE;
_local15 = 0;
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;
_local16 = (_arg1.m_position.x + ((_local10.col1.x * _local4[_arg2].x) + (_local10.col2.x * _local4[_arg2].y)));
_local17 = (_arg1.m_position.y + ((_local10.col1.y * _local4[_arg2].x) + (_local10.col2.y * _local4[_arg2].y)));
_local10 = _arg3.m_R;
_local18 = (_arg3.m_position.x + ((_local10.col1.x * _local6[_local13].x) + (_local10.col2.x * _local6[_local13].y)));
_local19 = (_arg3.m_position.y + ((_local10.col1.y * _local6[_local13].x) + (_local10.col2.y * _local6[_local13].y)));
_local18 = (_local18 - _local16);
_local19 = (_local19 - _local17);
_local20 = ((_local18 * _local7) + (_local19 * _local8));
return (_local20);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = _arg2.minVertex;
_local4 = _arg1.maxVertex;
_local5 = (_local3.x - _local4.x);
_local6 = (_local3.y - _local4.y);
_local3 = _arg1.minVertex;
_local4 = _arg2.maxVertex;
_local7 = (_local3.x - _local4.x);
_local8 = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolyShape, _arg3:int, _arg4:b2PolyShape):void{
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:Array;
var _local9:int;
var _local10:int;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:b2Mat22;
var _local19:Number;
var _local20:Number;
var _local21:int;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:ClipVertex;
var _local26:int;
var _local27:int;
var _local28:Number;
var _local29:Number;
var _local30:Number;
_local5 = _arg2.m_vertexCount;
_local6 = _arg2.m_vertices;
_local7 = _arg4.m_vertexCount;
_local8 = _arg4.m_vertices;
_local9 = _arg3;
_local10 = (((_arg3 + 1) == _local5)) ? 0 : (_arg3 + 1);
_local11 = _local6[_local10];
_local12 = _local11.x;
_local13 = _local11.y;
_local11 = _local6[_local9];
_local12 = (_local12 - _local11.x);
_local13 = (_local13 - _local11.y);
_local14 = _local12;
_local12 = _local13;
_local13 = -(_local14);
_local15 = (1 / Math.sqrt(((_local12 * _local12) + (_local13 * _local13))));
_local12 = (_local12 * _local15);
_local13 = (_local13 * _local15);
_local16 = _local12;
_local17 = _local13;
_local14 = _local16;
_local18 = _arg2.m_R;
_local16 = ((_local18.col1.x * _local14) + (_local18.col2.x * _local17));
_local17 = ((_local18.col1.y * _local14) + (_local18.col2.y * _local17));
_local19 = _local16;
_local20 = _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;
_local23 = Number.MAX_VALUE;
_local24 = 0;
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 b2CollidePolyAndCircle(_arg1:b2Manifold, _arg2:b2PolyShape, _arg3:b2CircleShape, _arg4:Boolean):void{
var _local5:b2ContactPoint;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:Number;
var _local12:Number;
var _local13:int;
var _local14:Number;
var _local15:Number;
var _local16:int;
var _local17:int;
var _local18:int;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:b2Vec2;
_arg1.pointCount = 0;
_local8 = (_arg3.m_position.x - _arg2.m_position.x);
_local9 = (_arg3.m_position.y - _arg2.m_position.y);
_local10 = _arg2.m_R;
_local11 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local9 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local8 = _local11;
_local13 = 0;
_local14 = -(Number.MAX_VALUE);
_local15 = _arg3.m_radius;
_local16 = 0;
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;
};
_local17 = _local13;
_local18 = (((_local17 + 1) < _arg2.m_vertexCount)) ? (_local17 + 1) : 0;
_local19 = (_arg2.m_vertices[_local18].x - _arg2.m_vertices[_local17].x);
_local20 = (_arg2.m_vertices[_local18].y - _arg2.m_vertices[_local17].y);
_local21 = 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;
};
_local22 = (((_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 FindMaxSeparation(_arg1:Array, _arg2:b2PolyShape, _arg3:b2PolyShape, _arg4:Boolean):Number{
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:int;
var _local11:Number;
var _local12:int;
var _local13:Number;
var _local14:int;
var _local15:Number;
var _local16:int;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:int;
var _local21:Number;
_local5 = _arg2.m_vertexCount;
_local6 = (_arg3.m_position.x - _arg2.m_position.x);
_local7 = (_arg3.m_position.y - _arg2.m_position.y);
_local8 = ((_local6 * _arg2.m_R.col1.x) + (_local7 * _arg2.m_R.col1.y));
_local9 = ((_local6 * _arg2.m_R.col2.x) + (_local7 * _arg2.m_R.col2.y));
_local10 = 0;
_local11 = -(Number.MAX_VALUE);
_local12 = 0;
while (_local12 < _local5) {
_local21 = ((_arg2.m_normals[_local12].x * _local8) + (_arg2.m_normals[_local12].y * _local9));
if (_local21 > _local11){
_local11 = _local21;
_local10 = _local12;
};
_local12++;
};
_local13 = EdgeSeparation(_arg2, _local10, _arg3);
if ((((_local13 > 0)) && ((_arg4 == false)))){
return (_local13);
};
_local14 = (((_local10 - 1) >= 0)) ? (_local10 - 1) : (_local5 - 1);
_local15 = EdgeSeparation(_arg2, _local14, _arg3);
if ((((_local15 > 0)) && ((_arg4 == false)))){
return (_local15);
};
_local16 = (((_local10 + 1) < _local5)) ? (_local10 + 1) : 0;
_local17 = 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 ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:int;
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
_local5 = 0;
_local6 = _arg2[0].v;
_local7 = _arg2[1].v;
_local8 = (b2Math.b2Dot(_arg3, _arg2[0].v) - _arg4);
_local9 = (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 b2CollidePoly(_arg1:b2Manifold, _arg2:b2PolyShape, _arg3:b2PolyShape, _arg4:Boolean):void{
var _local5:int;
var _local6:Array;
var _local7:Number;
var _local8:int;
var _local9:Array;
var _local10:Number;
var _local11:b2PolyShape;
var _local12:b2PolyShape;
var _local13:int;
var _local14:int;
var _local15:Number;
var _local16:Number;
var _local17:Array;
var _local18:int;
var _local19:Array;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:b2Mat22;
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:Array;
var _local39:Array;
var _local40:int;
var _local41:int;
var _local42:int;
var _local43:b2Vec2;
var _local44:Number;
var _local45:b2ContactPoint;
_arg1.pointCount = 0;
_local5 = 0;
_local6 = [_local5];
_local7 = FindMaxSeparation(_local6, _arg2, _arg3, _arg4);
_local5 = _local6[0];
if ((((_local7 > 0)) && ((_arg4 == false)))){
return;
};
_local8 = 0;
_local9 = [_local8];
_local10 = FindMaxSeparation(_local9, _arg3, _arg2, _arg4);
_local8 = _local9[0];
if ((((_local10 > 0)) && ((_arg4 == false)))){
return;
};
_local15 = 0.98;
_local16 = 0.001;
if (_local10 > ((_local15 * _local7) + _local16)){
_local11 = _arg3;
_local12 = _arg2;
_local13 = _local8;
_local14 = 1;
} else {
_local11 = _arg2;
_local12 = _arg3;
_local13 = _local5;
_local14 = 0;
};
_local17 = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local17, _local11, _local13, _local12);
_local18 = _local11.m_vertexCount;
_local19 = _local11.m_vertices;
_local20 = _local19[_local13];
_local21 = (((_local13 + 1) < _local18)) ? _local19[(_local13 + 1)] : _local19[0];
_local22 = (_local21.x - _local20.x);
_local23 = (_local21.y - _local20.y);
_local24 = (_local21.x - _local20.x);
_local25 = (_local21.y - _local20.y);
_local26 = _local24;
_local27 = _local11.m_R;
_local24 = ((_local27.col1.x * _local26) + (_local27.col2.x * _local25));
_local25 = ((_local27.col1.y * _local26) + (_local27.col2.y * _local25));
_local28 = (1 / Math.sqrt(((_local24 * _local24) + (_local25 * _local25))));
_local24 = (_local24 * _local28);
_local25 = (_local25 * _local28);
_local29 = _local24;
_local30 = _local25;
_local26 = _local29;
_local29 = _local30;
_local30 = -(_local26);
_local31 = _local20.x;
_local32 = _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);
_local33 = _local21.x;
_local34 = _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);
_local35 = ((_local29 * _local31) + (_local30 * _local32));
_local36 = -(((_local24 * _local31) + (_local25 * _local32)));
_local37 = ((_local24 * _local33) + (_local25 * _local34));
_local38 = [new ClipVertex(), new ClipVertex()];
_local39 = [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);
};
_local41 = 0;
_local42 = 0;
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 _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2ContactPoint;
var _local11:Number;
var _local12:Number;
_arg1.pointCount = 0;
_local5 = (_arg3.m_position.x - _arg2.m_position.x);
_local6 = (_arg3.m_position.y - _arg2.m_position.y);
_local7 = ((_local5 * _local5) + (_local6 * _local6));
_local8 = (_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;
_local10 = _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));
}
}
}//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID)
package Box2D.Collision {
public class b2ContactID {
public var _key:uint;
public var features:Features;
public function b2ContactID(){
features = new Features();
super();
features._m_id = this;
}
public function Set(_arg1:b2ContactID):void{
key = _arg1._key;
}
public function Copy():b2ContactID{
var _local1:b2ContactID;
_local1 = new b2ContactID();
_local1.key = key;
return (_local1);
}
public function get key():uint{
return (_key);
}
public function set key(_arg1:uint):void{
_key = _arg1;
features._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 separation:Number;
public var position:b2Vec2;
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 pointCount:int;
public var normal:b2Vec2;
public function b2Manifold(){
var _local1:int;
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
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 status:uint;
public var next:uint;
public static var e_pairFinal:uint = 4;
public static var b2_tableMask:int = (b2_tableCapacity - 1);
public static var e_pairRemoved:uint = 2;
public static var b2_nullPair:uint = 0xFFFF;
public static var e_pairBuffered:uint = 1;
public static var b2_nullProxy:uint = 0xFFFF;
public static var b2_tableCapacity:int = 8192;
public function b2Pair(){
userData = null;
super();
}
public function SetBuffered():void{
status = (status | e_pairBuffered);
}
public function IsBuffered():Boolean{
return (((status & e_pairBuffered) == e_pairBuffered));
}
public function IsFinal():Boolean{
return (((status & e_pairFinal) == e_pairFinal));
}
public function ClearRemoved():void{
status = (status & ~(e_pairRemoved));
}
public function SetFinal():void{
status = (status | e_pairFinal);
}
public function IsRemoved():Boolean{
return (((status & e_pairRemoved) == e_pairRemoved));
}
public function ClearBuffered():void{
status = (status & ~(e_pairBuffered));
}
public function SetRemoved():void{
status = (status | e_pairRemoved);
}
}
}//package Box2D.Collision
Section 20
//b2PairCallback (Box2D.Collision.b2PairCallback)
package Box2D.Collision {
public class b2PairCallback {
public function PairRemoved(_arg1, _arg2, _arg3):void{
}
public function PairAdded(_arg1, _arg2){
return (null);
}
}
}//package Box2D.Collision
Section 21
//b2PairManager (Box2D.Collision.b2PairManager)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PairManager {
public var m_pairCount:int;
public var m_pairBuffer:Array;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_pairBufferCount:int;
public var m_hashTable:Array;
public var m_broadPhase:b2BroadPhase;
public var m_freePair:uint;
public function b2PairManager(){
var _local1:uint;
super();
m_hashTable = new Array(b2Pair.b2_tableCapacity);
_local1 = 0;
while (_local1 < b2Pair.b2_tableCapacity) {
m_hashTable[_local1] = b2Pair.b2_nullPair;
_local1++;
};
m_pairs = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1] = new b2Pair();
_local1++;
};
m_pairBuffer = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairBuffer[_local1] = new b2BufferedPair();
_local1++;
};
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy;
m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy;
m_pairs[_local1].userData = null;
m_pairs[_local1].status = 0;
m_pairs[_local1].next = (_local1 + 1);
_local1++;
};
m_pairs[(b2Settings.b2_maxPairs - 1)].next = b2Pair.b2_nullPair;
m_pairCount = 0;
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:uint;
_local4 = 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 Find(_arg1:uint, _arg2:uint):b2Pair{
var _local3:uint;
var _local4:uint;
if (_arg1 > _arg2){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
return (FindHash(_arg1, _arg2, _local3));
}
private function ValidateBuffer():void{
}
public function Commit():void{
var _local1:int;
var _local2:int;
var _local3:Array;
var _local4:b2Pair;
var _local5:b2Proxy;
var _local6:b2Proxy;
_local2 = 0;
_local3 = 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();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2Pair;
_local3 = 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();
};
}
private function RemovePair(_arg1:uint, _arg2:uint){
var _local3:uint;
var _local4:uint;
var _local5:b2Pair;
var _local6:uint;
var _local7:uint;
var _local8:b2Pair;
var _local9:*;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
_local4 = m_hashTable[_local3];
_local5 = null;
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);
}
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;
_local3 = 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();
};
}
private function AddPair(_arg1:uint, _arg2:uint):b2Pair{
var _local3:uint;
var _local4:b2Pair;
var _local5:uint;
var _local6:uint;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
_local4 = FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
_local5 = m_freePair;
_local4 = m_pairs[_local5];
m_freePair = _local4.next;
_local4.proxyId1 = _arg1;
_local4.proxyId2 = _arg2;
_local4.status = 0;
_local4.userData = null;
_local4.next = m_hashTable[_local3];
m_hashTable[_local3] = _local5;
m_pairCount++;
return (_local4);
}
private function ValidateTable():void{
}
public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{
return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2))));
}
public static function Hash(_arg1:uint, _arg2:uint):uint{
var _local3:uint;
_local3 = (((_arg2 << 16) & 4294901760) | _arg1);
_local3 = (~(_local3) + ((_local3 << 15) & 4294934528));
_local3 = (_local3 ^ ((_local3 >> 12) & 1048575));
_local3 = (_local3 + ((_local3 << 2) & 4294967292));
_local3 = (_local3 ^ ((_local3 >> 4) & 268435455));
_local3 = (_local3 * 2057);
_local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF));
return (_local3);
}
public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{
return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3))));
}
}
}//package Box2D.Collision
Section 22
//b2Proxy (Box2D.Collision.b2Proxy)
package Box2D.Collision {
public class b2Proxy {
public var overlapCount:uint;
public var lowerBounds:Array;
public var upperBounds:Array;
public var userData;// = null
public var timeStamp:uint;
public function b2Proxy(){
lowerBounds = [uint(0), uint(0)];
upperBounds = [uint(0), uint(0)];
userData = null;
super();
}
public function GetNext():uint{
return (lowerBounds[0]);
}
public function IsValid():Boolean{
return (!((overlapCount == b2BroadPhase.b2_invalid)));
}
public function SetNext(_arg1:uint):void{
lowerBounds[0] = (_arg1 & 0xFFFF);
}
}
}//package Box2D.Collision
Section 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 _flip:int;
public var _incidentVertex:int;
public var _m_id:b2ContactID;
public function get referenceFace():int{
return (_referenceFace);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
public function get flip():int{
return (_flip);
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set referenceFace(_arg1:int):void{
_referenceFace = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceFace & 0xFF));
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
}
}//package Box2D.Collision
Section 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 SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function Set(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function SetM(_arg1:b2Mat22):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = col1.x;
_local3 = col2.x;
_local4 = col1.y;
_local5 = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
_local6 = (1 / _local6);
_arg1.col1.x = (_local6 * _local5);
_arg1.col2.x = (-(_local6) * _local3);
_arg1.col1.y = (-(_local6) * _local4);
_arg1.col2.y = (_local6 * _local2);
return (_arg1);
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = col1.x;
_local5 = col2.x;
_local6 = col1.y;
_local7 = col2.y;
_local8 = ((_local4 * _local7) - (_local5 * _local6));
_local8 = (1 / _local8);
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
}
}//package Box2D.Common.Math
Section 26
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:*;
_local3 = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22;
_local2 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2;
_local2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2Mat22;
_local3 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
_local4 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
_local5 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean;
_local2 = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2NextPowerOfTwo(_arg1:uint):uint{
_arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647));
_arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823));
_arg1 = (_arg1 | ((_arg1 >> 4) & 268435455));
_arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF));
_arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF));
return ((_arg1 + 1));
}
public static function b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
}
}//package Box2D.Common.Math
Section 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 Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function SetZero():void{
x = 0;
y = 0;
}
public function CrossVF(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function Abs():void{
x = Math.abs(x);
y = Math.abs(y);
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function Normalize():Number{
var _local1:Number;
var _local2:Number;
_local1 = Length();
if (_local1 < Number.MIN_VALUE){
return (0);
};
_local2 = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 28
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const b2_lengthUnitsPerMeter:Number = 30;
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static const b2_linearSleepTolerance:Number = 0.3;
public static const b2_angularSlop:Number = 0.0349065850398866;
public static const b2_linearSlop:Number = 0.15;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_maxShapesPerBody:int = 64;
public static const b2_maxProxies:int = 0x0400;
public static const b2_velocityThreshold:Number = 30;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_maxPairs:int = 8192;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_massUnitsPerKilogram:Number = 1;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_maxLinearCorrection:Number = 6;
public static const b2_maxPolyVertices:int = 16;
public static const b2_timeUnitsPerSecond:Number = 1;
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.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
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 GetManifolds():Array{
return (m_manifold);
}
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;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2CircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 30
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Contact {
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_prev:b2Contact;
public var m_next:b2Contact;
public var m_friction:Number;
public var m_manifoldCount:int;
public var m_node1:b2ContactNode;
public var m_node2:b2ContactNode;
public var m_restitution:Number;
public var m_flags:uint;
public static var s_registers:Array;
public static var s_initialized:Boolean = false;
public static var e_islandFlag:uint = 1;
public static var e_destroyFlag:uint = 2;
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 GetShape1():b2Shape{
return (m_shape1);
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetShape2():b2Shape{
return (m_shape2);
}
public function GetManifoldCount():int{
return (m_manifoldCount);
}
public function GetManifolds():Array{
return (null);
}
public function Evaluate():void{
}
public static function InitializeRegisters():void{
var _local1:int;
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
_local1 = 0;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_registers[_local1][_local2] = new b2ContactRegister();
_local2++;
};
_local1++;
};
AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape);
AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polyShape, b2Shape.e_circleShape);
AddType(b2PolyContact.Create, b2PolyContact.Destroy, b2Shape.e_polyShape, b2Shape.e_polyShape);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
var _local3:int;
var _local4:int;
var _local5:*;
if (_arg1.GetManifoldCount() > 0){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
_local3 = _arg1.m_shape1.m_type;
_local4 = _arg1.m_shape2.m_type;
_local5 = s_registers[_local3][_local4].destroyFcn;
_local5(_arg1, _arg2);
}
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 Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local4:int;
var _local5:int;
var _local6:*;
var _local7:b2Contact;
var _local8:int;
var _local9:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
_local4 = _arg1.m_type;
_local5 = _arg2.m_type;
_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);
}
}
}//package Box2D.Dynamics.Contacts
Section 31
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var restitution:Number;
public var body1:b2Body;
public var manifold:b2Manifold;
public var normal:b2Vec2;
public var body2:b2Body;
public var friction:Number;
public var pointCount:int;
public function b2ContactConstraint(){
var _local1:int;
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 32
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var separation:Number;
public var positionImpulse:Number;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var tangentMass:Number;
public var normalMass: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 next:b2ContactNode;
public var other:b2Body;
public var contact:b2Contact;
public var prev:b2ContactNode;
}
}//package Box2D.Dynamics.Contacts
Section 34
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var primary:Boolean;
public var createFcn;
public var destroyFcn;
}
}//package Box2D.Dynamics.Contacts
Section 35
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2ContactSolver {
public var m_constraintCount:int;
public var m_constraints:Array;
public var m_allocator;
public function b2ContactSolver(_arg1:Array, _arg2:int, _arg3){
var _local4:int;
var _local5:b2Vec2;
var _local6:b2Mat22;
var _local7:int;
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++;
};
_local7 = 0;
_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 SolvePositionConstraints(_arg1:Number):Boolean{
var _local2:Number;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:int;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:b2Vec2;
var _local10:Number;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19: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;
_local2 = 0;
_local5 = 0;
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 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 _local15:int;
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;
_local15 = 0;
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 PreSolve():void{
var _local1:b2Vec2;
var _local2:b2Vec2;
var _local3:b2Mat22;
var _local4:int;
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;
_local4 = 0;
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 PostSolve():void{
var _local1:int;
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ContactPoint;
var _local6:b2ContactConstraintPoint;
_local1 = 0;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 36
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
public class b2NullContact extends b2Contact {
public function b2NullContact():void{
}
override public function GetManifolds():Array{
return (null);
}
override public function Evaluate():void{
}
}
}//package Box2D.Dynamics.Contacts
Section 37
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
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 GetManifolds():Array{
return (m_manifold);
}
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;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndCircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 38
//b2PolyContact (Box2D.Dynamics.Contacts.b2PolyContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2PolyContact extends b2Contact {
public var m_manifold:Array;
private var m0:b2Manifold;
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 GetManifolds():Array{
return (m_manifold);
}
override public function Evaluate():void{
var _local1:b2Manifold;
var _local2:Array;
var _local3:int;
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;
_local1 = m_manifold[0];
_local2 = m0.points;
_local3 = 0;
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;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyContact(_arg1, _arg2));
}
}
}//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_localAnchor2:b2Vec2;
public var m_mass:Number;
public var m_localAnchor1:b2Vec2;
public var m_u:b2Vec2;
public var m_impulse: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 SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local2 = m_body1.m_R;
_local3 = ((_local2.col1.x * m_localAnchor1.x) + (_local2.col2.x * m_localAnchor1.y));
_local4 = ((_local2.col1.y * m_localAnchor1.x) + (_local2.col2.y * m_localAnchor1.y));
_local2 = m_body2.m_R;
_local5 = ((_local2.col1.x * m_localAnchor2.x) + (_local2.col2.x * m_localAnchor2.y));
_local6 = ((_local2.col1.y * m_localAnchor2.x) + (_local2.col2.y * m_localAnchor2.y));
_local7 = (m_body1.m_linearVelocity.x + (-(m_body1.m_angularVelocity) * _local4));
_local8 = (m_body1.m_linearVelocity.y + (m_body1.m_angularVelocity * _local3));
_local9 = (m_body2.m_linearVelocity.x + (-(m_body2.m_angularVelocity) * _local6));
_local10 = (m_body2.m_linearVelocity.y + (m_body2.m_angularVelocity * _local5));
_local11 = ((m_u.x * (_local9 - _local7)) + (m_u.y * (_local10 - _local8)));
_local12 = (-(m_mass) * _local11);
m_impulse = (m_impulse + _local12);
_local13 = (_local12 * m_u.x);
_local14 = (_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 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 PrepareVelocitySolver():void{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_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);
_local6 = 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();
};
_local7 = ((_local2 * m_u.y) - (_local3 * m_u.x));
_local8 = ((_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 GetReactionTorque(_arg1:Number):Number{
return (0);
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
var _local2:b2Vec2;
_local2 = new b2Vec2();
_local2.SetV(m_u);
_local2.Multiply((m_impulse * _arg1));
return (_local2);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
_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));
_local6 = (((m_body2.m_position.x + _local4) - m_body1.m_position.x) - _local2);
_local7 = (((m_body2.m_position.y + _local5) - m_body1.m_position.y) - _local3);
_local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
_local6 = (_local6 / _local8);
_local7 = (_local7 / _local8);
_local9 = (_local8 - m_length);
_local9 = b2Math.b2Clamp(_local9, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local10 = (-(m_mass) * _local9);
m_u.Set(_local6, _local7);
_local11 = (_local10 * m_u.x);
_local12 = (_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));
}
}
}//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 anchorPoint2:b2Vec2;
public var anchorPoint1: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_impulse:Number;
public var m_mass:Number;
public var m_prismatic1:b2PrismaticJoint;
public var m_prismatic2:b2PrismaticJoint;
public var m_ground1:b2Body;
public var m_ground2:b2Body;
public var m_constant:Number;
public var m_revolute1:b2RevoluteJoint;
public var m_revolute2:b2RevoluteJoint;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_ratio:Number;
public var m_J:b2Jacobian;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local2: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;
_local1 = 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;
_local1 = 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 PrepareVelocitySolver():void{
var _local1:b2Body;
var _local2:b2Body;
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 _local12:Number;
_local1 = m_ground1;
_local2 = m_ground2;
_local3 = m_body1;
_local4 = m_body2;
_local12 = 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 GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2());
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = 0;
_local2 = m_body1;
_local3 = m_body2;
if (m_revolute1){
_local4 = m_revolute1.GetJointAngle();
} else {
_local4 = m_prismatic1.GetJointTranslation();
};
if (m_revolute2){
_local5 = m_revolute2.GetJointAngle();
} else {
_local5 = m_prismatic2.GetJointTranslation();
};
_local6 = (m_constant - (_local4 + (m_ratio * _local5)));
_local7 = (-(m_mass) * _local6);
_local2.m_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));
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local5 = (-(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));
}
}
}//package Box2D.Dynamics.Joints
Section 42
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef)
package Box2D.Dynamics.Joints {
public class b2GearJointDef extends b2JointDef {
public var joint2:b2Joint;
public var joint1:b2Joint;
public var ratio:Number;
public function b2GearJointDef(){
type = b2Joint.e_gearJoint;
joint1 = null;
joint2 = null;
ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 43
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2Jacobian {
public var linear1:b2Vec2;
public var linear2:b2Vec2;
public var angular2:Number;
public var angular1:Number;
public function b2Jacobian(){
linear1 = new b2Vec2();
linear2 = new b2Vec2();
super();
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linear1.SetV(_arg1);
angular1 = _arg2;
linear2.SetV(_arg3);
angular2 = _arg4;
}
public function SetZero():void{
linear1.SetZero();
angular1 = 0;
linear2.SetZero();
angular2 = 0;
}
public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{
return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4)));
}
}
}//package Box2D.Dynamics.Joints
Section 44
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2Joint {
public var m_islandFlag:Boolean;
public var m_collideConnected:Boolean;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_type:int;
public var m_node1:b2JointNode;
public var m_node2:b2JointNode;
public var m_userData;
public var m_body1:b2Body;
public var m_body2:b2Body;
public static const e_unknownJoint:int = 0;
public static const e_inactiveLimit:int = 0;
public static const e_atUpperLimit:int = 2;
public static const e_atLowerLimit:int = 1;
public static const e_gearJoint:int = 6;
public static const e_revoluteJoint:int = 1;
public static const e_equalLimits:int = 3;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_prismaticJoint:int = 2;
public static const e_mouseJoint:int = 5;
public function b2Joint(_arg1:b2JointDef){
m_node1 = new 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 GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetType():int{
return (m_type);
}
public function GetBody2():b2Body{
return (m_body2);
}
public function PrepareVelocitySolver():void{
}
public function PreparePositionSolver():void{
}
public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function GetUserData(){
return (m_userData);
}
public function GetReactionForce(_arg1:Number):b2Vec2{
return (null);
}
public function SolvePositionConstraints():Boolean{
return (false);
}
public function GetBody1():b2Body{
return (m_body1);
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
_local3 = null;
switch (_arg1.type){
case e_distanceJoint:
_local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef));
break;
case e_mouseJoint:
_local3 = new b2MouseJoint((_arg1 as b2MouseJointDef));
break;
case e_prismaticJoint:
_local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef));
break;
case e_revoluteJoint:
_local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef));
break;
case e_pulleyJoint:
_local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef));
break;
case e_gearJoint:
_local3 = new b2GearJoint((_arg1 as b2GearJointDef));
break;
default:
break;
};
return (_local3);
}
}
}//package Box2D.Dynamics.Joints
Section 45
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointDef {
public var collideConnected:Boolean;
public var body1:b2Body;
public var body2:b2Body;
public var userData;
public var type:int;
public function b2JointDef(){
type = b2Joint.e_unknownJoint;
userData = null;
body1 = null;
body2 = null;
collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 46
//b2JointNode (Box2D.Dynamics.Joints.b2JointNode)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointNode {
public var joint:b2Joint;
public var other:b2Body;
public var next:b2JointNode;
public var prev: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 {
public var m_beta:Number;
public var m_target:b2Vec2;
public var m_impulse:b2Vec2;
public var m_ptpMass:b2Mat22;
public var m_localAnchor:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K:b2Mat22;
public var m_gamma:Number;
public var m_C:b2Vec2;
public var m_maxForce:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7: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);
_local2 = (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();
_local4 = m_body2.m_mass;
_local5 = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
_local6 = (((2 * _local4) * _arg1.dampingRatio) * _local5);
_local7 = ((_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;
_local1 = b2Math.b2MulMV(m_body2.m_R, m_localAnchor);
_local1.Add(m_body2.m_position);
return (_local1);
}
override public function PrepareVelocitySolver():void{
var _local1:b2Body;
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8: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);
_local7 = m_impulse.x;
_local8 = 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 GetReactionForce(_arg1:Number):b2Vec2{
var _local2:b2Vec2;
_local2 = new b2Vec2();
_local2.SetV(m_impulse);
_local2.Multiply(_arg1);
return (_local2);
}
override public function SolvePositionConstraints():Boolean{
return (true);
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function SetTarget(_arg1:b2Vec2):void{
m_body2.WakeUp();
m_target = _arg1;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local2 = m_body2;
_local3 = _local2.m_R;
_local4 = ((_local3.col1.x * m_localAnchor.x) + (_local3.col2.x * m_localAnchor.y));
_local5 = ((_local3.col1.y * m_localAnchor.x) + (_local3.col2.y * m_localAnchor.y));
_local6 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local5));
_local7 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local4));
_local3 = m_ptpMass;
_local8 = ((_local6 + ((m_beta * _arg1.inv_dt) * m_C.x)) + (m_gamma * m_impulse.x));
_local9 = ((_local7 + ((m_beta * _arg1.inv_dt) * m_C.y)) + (m_gamma * m_impulse.y));
_local10 = -(((_local3.col1.x * _local8) + (_local3.col2.x * _local9)));
_local11 = -(((_local3.col1.y * _local8) + (_local3.col2.y * _local9)));
_local12 = m_impulse.x;
_local13 = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
_local14 = m_impulse.Length();
if (_local14 > (_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))));
}
}
}//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 frequencyHz:Number;
public var dampingRatio:Number;
public var maxForce:Number;
public var target:b2Vec2;
public var timeStep:Number;
public function b2MouseJointDef(){
target = new b2Vec2();
super();
type = b2Joint.e_mouseJoint;
maxForce = 0;
frequencyHz = 5;
dampingRatio = 0.7;
timeStep = (1 / 60);
}
}
}//package Box2D.Dynamics.Joints
Section 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_initialAngle:Number;
public var m_lowerTranslation:Number;
public var m_localXAxis1:b2Vec2;
public var m_enableLimit:Boolean;
public var m_maxMotorForce:Number;
public var m_angularMass:Number;
public var m_localYAxis1:b2Vec2;
public var m_linearImpulse:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_motorMass:Number;
public var m_limitState:int;
public var m_linearMass:Number;
public var m_upperTranslation:Number;
public var m_angularImpulse:Number;
public var m_motorImpulse:Number;
public var m_motorJacobian:b2Jacobian;
public var m_limitImpulse:Number;
public var m_motorSpeed:Number;
public var m_enableMotor:Boolean;
public var m_limitPositionImpulse:Number;
public var m_linearJacobian:b2Jacobian;
public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_localXAxis1 = new b2Vec2();
m_localYAxis1 = new b2Vec2();
m_linearJacobian = new b2Jacobian();
m_motorJacobian = new b2Jacobian();
super(_arg1);
_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;
var _local2:b2Vec2;
_local1 = m_body1;
_local2 = 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;
var _local2:b2Vec2;
_local1 = m_body2;
_local2 = new b2Vec2();
_local2.SetV(m_localAnchor2);
_local2.MulM(_local1.m_R);
_local2.Add(_local1.m_position);
return (_local2);
}
override public function PrepareVelocitySolver():void{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local1 = m_body1;
_local2 = m_body2;
_local3 = _local1.m_R;
_local4 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
_local5 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
_local6 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
_local7 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
_local8 = _local1.m_invMass;
_local9 = _local2.m_invMass;
_local10 = _local1.m_invI;
_local11 = _local2.m_invI;
_local3 = _local1.m_R;
_local12 = ((_local3.col1.x * m_localYAxis1.x) + (_local3.col2.x * m_localYAxis1.y));
_local13 = ((_local3.col1.y * m_localYAxis1.x) + (_local3.col2.y * m_localYAxis1.y));
_local14 = ((_local2.m_position.x + _local6) - _local1.m_position.x);
_local15 = ((_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;
}
public function GetJointTranslation():Number{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local1 = m_body1;
_local2 = m_body2;
_local3 = _local1.m_R;
_local4 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
_local5 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
_local6 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
_local7 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
_local8 = (_local1.m_position.x + _local4);
_local9 = (_local1.m_position.y + _local5);
_local10 = (_local2.m_position.x + _local6);
_local11 = (_local2.m_position.y + _local7);
_local12 = (_local10 - _local8);
_local13 = (_local11 - _local9);
_local3 = _local1.m_R;
_local14 = ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y));
_local15 = ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y));
_local16 = ((_local14 * _local12) + (_local15 * _local13));
return (_local16);
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
var _local2:Number;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local2 = (_arg1 * m_limitImpulse);
_local3 = m_body1.m_R;
_local4 = (_local2 * ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y)));
_local5 = (_local2 * ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y)));
_local6 = (_local2 * ((_local3.col1.x * m_localYAxis1.x) + (_local3.col2.x * m_localYAxis1.y)));
_local7 = (_local2 * ((_local3.col1.y * m_localYAxis1.x) + (_local3.col2.y * m_localYAxis1.y)));
return (new b2Vec2((_local4 + _local6), (_local5 + _local7)));
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
_local3 = m_body1;
_local4 = m_body2;
_local5 = _local3.m_invMass;
_local6 = _local4.m_invMass;
_local7 = _local3.m_invI;
_local8 = _local4.m_invI;
_local9 = _local3.m_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;
_local20 = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
_local21 = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
_local22 = ((_local20 * _local18) + (_local21 * _local19));
_local22 = b2Math.b2Clamp(_local22, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local23 = (-(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));
_local24 = b2Math.b2Abs(_local22);
_local25 = ((_local4.m_rotation - _local3.m_rotation) - m_initialAngle);
_local25 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local26 = (-(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);
_local27 = 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))));
}
public function GetJointSpeed():Number{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:b2Vec2;
var _local17:b2Vec2;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local1 = m_body1;
_local2 = m_body2;
_local3 = _local1.m_R;
_local4 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
_local5 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
_local6 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
_local7 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
_local8 = (_local1.m_position.x + _local4);
_local9 = (_local1.m_position.y + _local5);
_local10 = (_local2.m_position.x + _local6);
_local11 = (_local2.m_position.y + _local7);
_local12 = (_local10 - _local8);
_local13 = (_local11 - _local9);
_local3 = _local1.m_R;
_local14 = ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y));
_local15 = ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y));
_local16 = _local1.m_linearVelocity;
_local17 = _local2.m_linearVelocity;
_local18 = _local1.m_angularVelocity;
_local19 = _local2.m_angularVelocity;
_local20 = (((_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 SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetMotorForce(_arg1:Number):Number{
return ((_arg1 * m_motorImpulse));
}
public function SetMotorForce(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
override public function GetReactionTorque(_arg1:Number):Number{
return ((_arg1 * m_angularImpulse));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_invMass;
_local5 = _local3.m_invMass;
_local6 = _local2.m_invI;
_local7 = _local3.m_invI;
_local9 = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local10 = (-(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));
_local11 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local12 = (-(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));
};
}
}
}//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 motorSpeed:Number;
public var anchorPoint:b2Vec2;
public var axis:b2Vec2;
public var upperTranslation:Number;
public var lowerTranslation:Number;
public var enableMotor:Boolean;
public var motorForce:Number;
public var enableLimit: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_maxLength2:Number;
public var m_limitState1:int;
public var m_maxLength1:Number;
public var m_pulleyImpulse:Number;
public var m_limitPositionImpulse1:Number;
public var m_constant:Number;
public var m_ratio:Number;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_limitPositionImpulse2:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_limitState2:int;
public var m_limitMass2:Number;
public var m_limitMass1:Number;
public var m_limitImpulse2:Number;
public var m_u1:b2Vec2;
public var m_u2:b2Vec2;
public var m_limitImpulse1:Number;
public var m_pulleyMass:Number;
public static var b2_minPulleyLength:Number = 30;
public function b2PulleyJoint(_arg1:b2PulleyJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8: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);
_local5 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
_local3 = (_arg1.groundPoint2.x - _arg1.anchorPoint2.x);
_local4 = (_arg1.groundPoint2.y - _arg1.anchorPoint2.y);
_local6 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
_local7 = b2Math.b2Max((0.5 * b2_minPulleyLength), _local5);
_local8 = 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;
}
public function GetLength1():Number{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body1.m_R;
_local2 = (m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y)));
_local3 = (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y)));
_local4 = (_local2 - (m_ground.m_position.x + m_groundAnchor1.x));
_local5 = (_local3 - (m_ground.m_position.y + m_groundAnchor1.y));
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
override public function GetAnchor1():b2Vec2{
var _local1:b2Mat22;
_local1 = 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;
_local1 = 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 PrepareVelocitySolver():void{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
_local1 = m_body1;
_local2 = m_body2;
_local3 = _local1.m_R;
_local4 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
_local5 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
_local6 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
_local7 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
_local8 = (_local1.m_position.x + _local4);
_local9 = (_local1.m_position.y + _local5);
_local10 = (_local2.m_position.x + _local6);
_local11 = (_local2.m_position.y + _local7);
_local12 = (m_ground.m_position.x + m_groundAnchor1.x);
_local13 = (m_ground.m_position.y + m_groundAnchor1.y);
_local14 = (m_ground.m_position.x + m_groundAnchor2.x);
_local15 = (m_ground.m_position.y + m_groundAnchor2.y);
m_u1.Set((_local8 - _local12), (_local9 - _local13));
m_u2.Set((_local10 - _local14), (_local11 - _local15));
_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();
};
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;
};
_local18 = ((_local4 * m_u1.y) - (_local5 * m_u1.x));
_local19 = ((_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);
_local20 = ((-(m_pulleyImpulse) - m_limitImpulse1) * m_u1.x);
_local21 = ((-(m_pulleyImpulse) - m_limitImpulse1) * m_u1.y);
_local22 = (((-(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 GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2());
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
_local1 = m_body1;
_local2 = m_body2;
_local4 = (m_ground.m_position.x + m_groundAnchor1.x);
_local5 = (m_ground.m_position.y + m_groundAnchor1.y);
_local6 = (m_ground.m_position.x + m_groundAnchor2.x);
_local7 = (m_ground.m_position.y + m_groundAnchor2.y);
_local21 = 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));
}
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 GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function GetRatio():Number{
return (m_ratio);
}
public function GetLength2():Number{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body2.m_R;
_local2 = (m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y)));
_local3 = (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y)));
_local4 = (_local2 - (m_ground.m_position.x + m_groundAnchor2.x));
_local5 = (_local3 - (m_ground.m_position.y + m_groundAnchor2.y));
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_R;
_local5 = ((_local4.col1.x * m_localAnchor1.x) + (_local4.col2.x * m_localAnchor1.y));
_local6 = ((_local4.col1.y * m_localAnchor1.x) + (_local4.col2.y * m_localAnchor1.y));
_local4 = _local3.m_R;
_local7 = ((_local4.col1.x * m_localAnchor2.x) + (_local4.col2.x * m_localAnchor2.y));
_local8 = ((_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))));
};
}
}
}//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 ratio:Number;
public var maxLength1:Number;
public var maxLength2:Number;
public var anchorPoint1:b2Vec2;
public var anchorPoint2:b2Vec2;
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 {
public var m_intialAngle:Number;
public var m_enableLimit:Boolean;
public var m_limitState:int;
public var m_ptpMass:b2Mat22;
public var m_motorMass:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K3:b2Mat22;
private var K:b2Mat22;
public var m_limitImpulse:Number;
public var m_motorImpulse:Number;
public var m_enableMotor:Boolean;
public var m_lowerAngle:Number;
public var m_limitPositionImpulse:Number;
public var m_maxMotorTorque:Number;
public var m_upperAngle:Number;
public var m_motorSpeed:Number;
public var m_ptpImpulse:b2Vec2;
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;
_local1 = 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;
_local1 = 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 PrepareVelocitySolver():void{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
_local1 = m_body1;
_local2 = m_body2;
_local3 = _local1.m_R;
_local4 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
_local5 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
_local6 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
_local7 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
_local8 = _local1.m_invMass;
_local9 = _local2.m_invMass;
_local10 = _local1.m_invI;
_local11 = _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 GetReactionForce(_arg1:Number):b2Vec2{
var _local2:b2Vec2;
_local2 = m_ptpImpulse.Copy();
_local2.Multiply(_arg1);
return (_local2);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_local3 = m_body1;
_local4 = m_body2;
_local5 = 0;
_local6 = _local3.m_R;
_local7 = ((_local6.col1.x * m_localAnchor1.x) + (_local6.col2.x * m_localAnchor1.y));
_local8 = ((_local6.col1.y * m_localAnchor1.x) + (_local6.col2.y * m_localAnchor1.y));
_local6 = _local4.m_R;
_local9 = ((_local6.col1.x * m_localAnchor2.x) + (_local6.col2.x * m_localAnchor2.y));
_local10 = ((_local6.col1.y * m_localAnchor2.x) + (_local6.col2.y * m_localAnchor2.y));
_local11 = (_local3.m_position.x + _local7);
_local12 = (_local3.m_position.y + _local8);
_local13 = (_local4.m_position.x + _local9);
_local14 = (_local4.m_position.y + _local10);
_local15 = (_local13 - _local11);
_local16 = (_local14 - _local12);
_local5 = Math.sqrt(((_local15 * _local15) + (_local16 * _local16)));
_local17 = _local3.m_invMass;
_local18 = _local4.m_invMass;
_local19 = _local3.m_invI;
_local20 = _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));
_local21 = tImpulse.x;
_local22 = 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);
_local23 = 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))));
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function SetMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
public function GetJointAngle():Number{
return ((m_body2.m_rotation - m_body1.m_rotation));
}
public function GetMotorTorque(_arg1:Number):Number{
return ((_arg1 * m_motorImpulse));
}
override public function GetReactionTorque(_arg1:Number):Number{
return ((_arg1 * m_limitImpulse));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_R;
_local5 = ((_local4.col1.x * m_localAnchor1.x) + (_local4.col2.x * m_localAnchor1.y));
_local6 = ((_local4.col1.y * m_localAnchor1.x) + (_local4.col2.y * m_localAnchor1.y));
_local4 = _local3.m_R;
_local7 = ((_local4.col1.x * m_localAnchor2.x) + (_local4.col2.x * m_localAnchor2.y));
_local8 = ((_local4.col1.y * m_localAnchor2.x) + (_local4.col2.y * m_localAnchor2.y));
_local10 = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local8)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local6));
_local11 = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local7)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local5));
_local12 = -(((m_ptpMass.col1.x * _local10) + (m_ptpMass.col2.x * _local11)));
_local13 = -(((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));
};
}
}
}//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 upperAngle:Number;
public var lowerAngle:Number;
public var motorSpeed:Number;
public var anchorPoint:b2Vec2;
public var motorTorque:Number;
public var enableMotor:Boolean;
public var enableLimit: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.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Body {
public var m_next:b2Body;
public var m_mass:Number;
public var m_contactList:b2ContactNode;
public var m_angularVelocity:Number;
public var m_rotation:Number;
public var m_shapeList:b2Shape;
public var m_R:b2Mat22;
public var m_force:b2Vec2;
public var m_torque:Number;
public var m_rotation0:Number;
public var m_userData;
public var m_linearVelocity:b2Vec2;
public var m_invMass:Number;
public var m_position:b2Vec2;
public var m_flags:uint;
public var m_invI:Number;
public var m_linearDamping:Number;
public var m_prev:b2Body;
public var m_world:b2World;
public var m_angularDamping:Number;
public var m_position0:b2Vec2;
private var sMat0:b2Mat22;
public var m_center:b2Vec2;
public var m_sleepTime:Number;
public var m_shapeCount:int;
public var m_I:Number;
public var m_jointList:b2JointNode;
public static var e_frozenFlag:uint = 2;
public static var e_sleepFlag:uint = 8;
public static var e_islandFlag:uint = 4;
public static var e_destroyFlag:uint = 32;
public static var e_allowSleepFlag:uint = 16;
public static var e_staticFlag:uint = 1;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
var _local3:int;
var _local4:b2ShapeDef;
var _local5:b2MassData;
var _local6:Array;
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;
_local6 = 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 SetCenterPosition(_arg1:b2Vec2, _arg2:Number):void{
var _local3:b2Shape;
if (IsFrozen()){
return;
};
m_rotation = _arg2;
m_R.Set(m_rotation);
m_position.SetV(_arg1);
m_position0.SetV(m_position);
m_rotation0 = m_rotation;
_local3 = 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 GetWorldPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.AddVV(m_position, b2Math.b2MulMV(m_R, _arg1)));
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function QuickSyncShapes():void{
var _local1:b2Shape;
_local1 = m_shapeList;
while (_local1 != null) {
_local1.QuickSync(m_position, m_R);
_local1 = _local1.m_next;
};
}
public function GetInertia():Number{
return (m_I);
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_R, _arg1));
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
public function GetJointList():b2JointNode{
return (m_jointList);
}
public function GetRotationMatrix():b2Mat22{
return (m_R);
}
public function Freeze():void{
var _local1:b2Shape;
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local1 = m_shapeList;
while (_local1 != null) {
_local1.DestroyProxy();
_local1 = _local1.m_next;
};
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SynchronizeShapes():void{
var _local1:b2Shape;
sMat0.Set(m_rotation0);
_local1 = m_shapeList;
while (_local1 != null) {
_local1.Synchronize(m_position0, sMat0, m_position, m_R);
_local1 = _local1.m_next;
};
}
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 GetOriginPosition():b2Vec2{
return (b2Math.SubtractVV(m_position, b2Math.b2MulMV(m_R, m_center)));
}
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 GetContactList():b2ContactNode{
return (m_contactList);
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function GetMass():Number{
return (m_mass);
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function SetOriginPosition(_arg1:b2Vec2, _arg2:Number):void{
var _local3:b2Shape;
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;
_local3 = 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 GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_R, b2Math.SubtractVV(_arg1, m_position)));
}
public function GetRotation():Number{
return (m_rotation);
}
public function IsStatic():Boolean{
return (((m_flags & e_staticFlag) == e_staticFlag));
}
public function Destroy():void{
var _local1:b2Shape;
var _local2:b2Shape;
_local1 = m_shapeList;
while (_local1) {
_local2 = _local1;
_local1 = _local1.m_next;
b2Shape.Destroy(_local2);
};
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_R, _arg1));
}
public function GetNext():b2Body{
return (m_next);
}
public function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointNode;
_local2 = m_jointList;
while (_local2 != null) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
public function GetUserData(){
return (m_userData);
}
public function GetCenterPosition():b2Vec2{
return (m_position);
}
public function ApplyTorque(_arg1:Number):void{
if (IsSleeping() == false){
m_torque = (m_torque + _arg1);
};
}
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;
}
}
}//package Box2D.Dynamics
Section 56
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2BodyDef {
public var angularDamping:Number;
public var rotation:Number;
public var allowSleep:Boolean;
public var userData;
public var linearDamping:Number;
public var angularVelocity:Number;
public var linearVelocity:b2Vec2;
public var position:b2Vec2;
public var shapes:Array;
public var isSleeping:Boolean;
public var preventRotation:Boolean;
public function b2BodyDef(){
var _local1:int;
shapes = new Array();
super();
userData = null;
_local1 = 0;
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;
_local2 = 0;
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{
var _local3:Boolean;
if ((((_arg1.m_groupIndex == _arg2.m_groupIndex)) && (!((_arg1.m_groupIndex == 0))))){
return ((_arg1.m_groupIndex > 0));
};
_local3 = ((!(((_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.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.Shapes.*;
public class b2ContactManager extends b2PairCallback {
public var m_world:b2World;
public var m_destroyImmediate:Boolean;
public var m_nullContact:b2NullContact;
public function b2ContactManager(){
m_nullContact = new b2NullContact();
super();
m_world = null;
m_destroyImmediate = false;
}
public function Collide():void{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2ContactNode;
var _local4:b2ContactNode;
var _local5:b2Contact;
var _local6:int;
var _local7:int;
_local5 = 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;
};
}
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--;
}
override public function PairAdded(_arg1, _arg2){
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2Contact;
var _local8:b2Shape;
var _local9:b2Body;
_local3 = (_arg1 as b2Shape);
_local4 = (_arg2 as b2Shape);
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (m_nullContact);
};
if (((!((m_world.m_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;
};
_local7 = 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);
}
public function CleanContactList():void{
var _local1:b2Contact;
var _local2:b2Contact;
_local1 = m_world.m_contactList;
while (_local1 != null) {
_local2 = _local1;
_local1 = _local1.m_next;
if ((_local2.m_flags & b2Contact.e_destroyFlag)){
DestroyContact(_local2);
_local2 = null;
};
};
}
override public function PairRemoved(_arg1, _arg2, _arg3):void{
var _local4:b2Contact;
if (_arg3 == null){
return;
};
_local4 = (_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);
};
};
}
}
}//package Box2D.Dynamics
Section 59
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.*;
public class b2Island {
public var m_positionError:Number;
public var m_bodyCapacity:int;
public var m_bodies:Array;
public var m_joints:Array;
public var m_jointCapacity:int;
public var m_contactCount:int;
public var m_contacts:Array;
public var m_contactCapacity:int;
public var m_jointCount:int;
public var m_allocator;
public var m_bodyCount:int;
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 AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2):void{
var _local3:int;
var _local4:b2Body;
var _local5:b2ContactSolver;
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++;
};
_local5 = 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 AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function UpdateSleep(_arg1:Number):void{
var _local2:int;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local4 = Number.MAX_VALUE;
_local5 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local6 = (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++;
};
};
}
}
}//package Box2D.Dynamics
Section 60
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var dt:Number;
public var iterations:int;
public var inv_dt:Number;
}
}//package Box2D.Dynamics
Section 61
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.Shapes.*;
public class b2World {
public var m_filter:b2CollisionFilter;
public var m_blockAllocator;
public var m_contactList:b2Contact;
public var m_broadPhase:b2BroadPhase;
public var m_allowSleep:Boolean;
public var m_jointCount:int;
public var m_bodyCount:int;
public var m_listener:b2WorldListener;
private var step:b2TimeStep;
public var m_positionIterationCount:int;
public var m_groundBody:b2Body;
public var m_contactCount:int;
public var m_bodyDestroyList:b2Body;
public var m_bodyList:b2Body;
public var m_stackAllocator;
public var m_gravity:b2Vec2;
public var m_jointList:b2Joint;
public var m_contactManager:b2ContactManager;
public static var s_enableWarmStarting:int = 1;
public static var s_enablePositionCorrection:int = 1;
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
var _local4:b2BodyDef;
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);
_local4 = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function SetListener(_arg1:b2WorldListener):void{
m_listener = _arg1;
}
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 GetGroundBody():b2Body{
return (m_groundBody);
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array;
var _local5:int;
var _local6:int;
_local4 = new Array();
_local5 = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
_local6 = 0;
while (_local6 < _local5) {
_arg2[_local6] = (_local4[_local6] as b2Shape);
_local6++;
};
return (_local5);
}
public function CleanBodyList():void{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2JointNode;
var _local4:b2JointNode;
m_contactManager.m_destroyImmediate = true;
_local1 = 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 GetJointList():b2Joint{
return (m_jointList);
}
public function GetBodyList():b2Body{
return (m_bodyList);
}
public function GetContactList():b2Contact{
return (m_contactList);
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local2:b2Joint;
var _local3:b2Body;
var _local4:b2Shape;
_local2 = b2Joint.Create(_arg1, m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_node1.joint = _local2;
_local2.m_node1.other = _local2.m_body2;
_local2.m_node1.prev = null;
_local2.m_node1.next = _local2.m_body1.m_jointList;
if (_local2.m_body1.m_jointList){
_local2.m_body1.m_jointList.prev = _local2.m_node1;
};
_local2.m_body1.m_jointList = _local2.m_node1;
_local2.m_node2.joint = _local2;
_local2.m_node2.other = _local2.m_body1;
_local2.m_node2.prev = null;
_local2.m_node2.next = _local2.m_body2.m_jointList;
if (_local2.m_body2.m_jointList){
_local2.m_body2.m_jointList.prev = _local2.m_node2;
};
_local2.m_body2.m_jointList = _local2.m_node2;
if (_arg1.collideConnected == false){
_local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.ResetProxy(m_broadPhase);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local2:Boolean;
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Body;
var _local6:b2Shape;
_local2 = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_jointList){
m_jointList = _arg1.m_next;
};
_local3 = _arg1.m_body1;
_local4 = _arg1.m_body2;
_local3.WakeUp();
_local4.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local4.m_jointList){
_local4.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, m_blockAllocator);
m_jointCount--;
if (_local2 == false){
_local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.ResetProxy(m_broadPhase);
_local6 = _local6.m_next;
};
};
}
public function SetFilter(_arg1:b2CollisionFilter):void{
m_filter = _arg1;
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
var _local2:b2Body;
_local2 = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
public function Step(_arg1:Number, _arg2:int):void{
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Island;
var _local6:b2Contact;
var _local7:b2Joint;
var _local8:int;
var _local9:Array;
var _local10:int;
var _local11: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();
_local5 = 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;
};
_local6 = m_contactList;
while (_local6 != null) {
_local6.m_flags = (_local6.m_flags & ~(b2Contact.e_islandFlag));
_local6 = _local6.m_next;
};
_local7 = m_jointList;
while (_local7 != null) {
_local7.m_islandFlag = false;
_local7 = _local7.m_next;
};
_local8 = m_bodyCount;
_local9 = new Array(m_bodyCount);
_local10 = 0;
while (_local10 < m_bodyCount) {
_local9[_local10] = null;
_local10++;
};
_local11 = 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();
}
}
}//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 NotifyBoundaryViolated(_arg1:b2Body):uint{
return (b2_freezeBody);
}
public function NotifyJointDestroyed(_arg1:b2Joint):void{
}
}
}//package Box2D.Dynamics
Section 63
//3_1_74 (index_fla.3_1_74)
package index_fla {
import flash.display.*;
public dynamic class 3_1_74 extends MovieClip {
public function 3_1_74(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package index_fla
Section 64
//3_2_75 (index_fla.3_2_75)
package index_fla {
import flash.display.*;
public dynamic class 3_2_75 extends MovieClip {
public function 3_2_75(){
addFrameScript(20, frame21);
}
function frame21(){
stop();
}
}
}//package index_fla
Section 65
//3_70 (index_fla.3_70)
package index_fla {
import flash.display.*;
public dynamic class 3_70 extends MovieClip {
public function 3_70(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package index_fla
Section 66
//a_1_46 (index_fla.a_1_46)
package index_fla {
import flash.display.*;
public dynamic class a_1_46 extends MovieClip {
public var yes_off:MovieClip;
public var no_on:MovieClip;
public var yes_on:MovieClip;
public var no_off:MovieClip;
}
}//package index_fla
Section 67
//a_2_40 (index_fla.a_2_40)
package index_fla {
import flash.display.*;
public dynamic class a_2_40 extends MovieClip {
public var yes_off:MovieClip;
public var no_on:MovieClip;
public var yes_on:MovieClip;
public var no_off:MovieClip;
}
}//package index_fla
Section 68
//a_3_32 (index_fla.a_3_32)
package index_fla {
import flash.display.*;
public dynamic class a_3_32 extends MovieClip {
public var yes_off:MovieClip;
public var a3_text1:MovieClip;
public var no_on:MovieClip;
public var yes_on:MovieClip;
public var a3_text:MovieClip;
public var no_off:MovieClip;
}
}//package index_fla
Section 69
//a_4_24 (index_fla.a_4_24)
package index_fla {
import flash.display.*;
public dynamic class a_4_24 extends MovieClip {
public var yes_off:MovieClip;
public var no_on:MovieClip;
public var yes_on:MovieClip;
public var a4_text1:MovieClip;
public var no_off:MovieClip;
public var a4_text:MovieClip;
}
}//package index_fla
Section 70
//achievements_new_22 (index_fla.achievements_new_22)
package index_fla {
import flash.display.*;
public dynamic class achievements_new_22 extends MovieClip {
public var line1:MovieClip;
public var line2:MovieClip;
public var line0:MovieClip;
public var line3:MovieClip;
public var line4:MovieClip;
}
}//package index_fla
Section 71
//archi_line1_45 (index_fla.archi_line1_45)
package index_fla {
import flash.display.*;
public dynamic class archi_line1_45 extends MovieClip {
public var a:MovieClip;
public function archi_line1_45(){
addFrameScript(0, frame1, 14, frame15);
}
function frame15(){
stop();
}
function frame1(){
stop();
}
}
}//package index_fla
Section 72
//archi_line2_39 (index_fla.archi_line2_39)
package index_fla {
import flash.display.*;
public dynamic class archi_line2_39 extends MovieClip {
public var a:MovieClip;
public function archi_line2_39(){
addFrameScript(0, frame1, 14, frame15);
}
function frame15(){
stop();
}
function frame1(){
stop();
}
}
}//package index_fla
Section 73
//archi_line3_31 (index_fla.archi_line3_31)
package index_fla {
import flash.display.*;
public dynamic class archi_line3_31 extends MovieClip {
public var a:MovieClip;
public function archi_line3_31(){
addFrameScript(0, frame1, 14, frame15);
}
function frame15(){
stop();
}
function frame1(){
stop();
}
}
}//package index_fla
Section 74
//archi_line4_23 (index_fla.archi_line4_23)
package index_fla {
import flash.display.*;
public dynamic class archi_line4_23 extends MovieClip {
public var a:MovieClip;
public function archi_line4_23(){
addFrameScript(0, frame1, 14, frame15);
}
function frame15(){
stop();
}
function frame1(){
stop();
}
}
}//package index_fla
Section 75
//aw_dildo_61 (index_fla.aw_dildo_61)
package index_fla {
import flash.display.*;
public dynamic class aw_dildo_61 extends MovieClip {
public function aw_dildo_61(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 76
//aw_heart_62 (index_fla.aw_heart_62)
package index_fla {
import flash.display.*;
public dynamic class aw_heart_62 extends MovieClip {
public function aw_heart_62(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 77
//aw_stars_63 (index_fla.aw_stars_63)
package index_fla {
import flash.display.*;
public dynamic class aw_stars_63 extends MovieClip {
public function aw_stars_63(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 78
//ballmc_135 (index_fla.ballmc_135)
package index_fla {
import flash.display.*;
public dynamic class ballmc_135 extends MovieClip {
public var ring1:MovieClip;
public var ring2:MovieClip;
public var white:MovieClip;
public var ballbody:MovieClip;
public var l8:MovieClip;
public var l3:MovieClip;
public var l6:MovieClip;
public var flashes:MovieClip;
public var blik2:MovieClip;
}
}//package index_fla
Section 79
//bita_127 (index_fla.bita_127)
package index_fla {
import flash.display.*;
public dynamic class bita_127 extends MovieClip {
public var barmask:MovieClip;
public var bitagreen:MovieClip;
}
}//package index_fla
Section 80
//circle_133 (index_fla.circle_133)
package index_fla {
import flash.display.*;
public dynamic class circle_133 extends MovieClip {
public function circle_133(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 81
//dark_166 (index_fla.dark_166)
package index_fla {
import flash.events.*;
import flash.display.*;
public dynamic class dark_166 extends MovieClip {
public function dark_166(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
dispatchEvent(new Event("DONE"));
}
}
}//package index_fla
Section 82
//ending_173 (index_fla.ending_173)
package index_fla {
import flash.display.*;
import flash.media.*;
public dynamic class ending_173 extends MovieClip {
public function ending_173(){
addFrameScript(1, frame2, 4, frame5, 5, frame6, 6, frame7);
}
function frame6(){
stop();
}
function frame7(){
SoundMixer.stopAll();
(parent as MovieClip).gotoAndStop(1, "Top");
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package index_fla
Section 83
//extrasbg_188 (index_fla.extrasbg_188)
package index_fla {
import flash.display.*;
public dynamic class extrasbg_188 extends MovieClip {
public function extrasbg_188(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package index_fla
Section 84
//flags_60 (index_fla.flags_60)
package index_fla {
import flash.display.*;
public dynamic class flags_60 extends MovieClip {
public function flags_60(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 85
//flash1_144 (index_fla.flash1_144)
package index_fla {
import flash.display.*;
public dynamic class flash1_144 extends MovieClip {
public function flash1_144(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 86
//flash2_145 (index_fla.flash2_145)
package index_fla {
import flash.display.*;
public dynamic class flash2_145 extends MovieClip {
public function flash2_145(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 87
//flash3_146 (index_fla.flash3_146)
package index_fla {
import flash.display.*;
public dynamic class flash3_146 extends MovieClip {
public function flash3_146(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 88
//flash4_147 (index_fla.flash4_147)
package index_fla {
import flash.display.*;
public dynamic class flash4_147 extends MovieClip {
public function flash4_147(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 89
//flash5_148 (index_fla.flash5_148)
package index_fla {
import flash.display.*;
public dynamic class flash5_148 extends MovieClip {
public function flash5_148(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 90
//flash6_149 (index_fla.flash6_149)
package index_fla {
import flash.display.*;
public dynamic class flash6_149 extends MovieClip {
public function flash6_149(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 91
//flash7_150 (index_fla.flash7_150)
package index_fla {
import flash.display.*;
public dynamic class flash7_150 extends MovieClip {
public function flash7_150(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 92
//flash8_151 (index_fla.flash8_151)
package index_fla {
import flash.display.*;
public dynamic class flash8_151 extends MovieClip {
public function flash8_151(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 93
//flashes_143 (index_fla.flashes_143)
package index_fla {
import flash.display.*;
public dynamic class flashes_143 extends MovieClip {
public var light:MovieClip;
public function flashes_143(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 94
//game_over_167 (index_fla.game_over_167)
package index_fla {
import flash.display.*;
import flash.media.*;
public dynamic class game_over_167 extends MovieClip {
public function game_over_167(){
addFrameScript(1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
SoundMixer.stopAll();
(parent as MovieClip).gotoAndStop(1, "Top");
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package index_fla
Section 95
//helpbtn_57 (index_fla.helpbtn_57)
package index_fla {
import flash.display.*;
public dynamic class helpbtn_57 extends MovieClip {
public function helpbtn_57(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 96
//life_gone_161 (index_fla.life_gone_161)
package index_fla {
import flash.display.*;
public dynamic class life_gone_161 extends MovieClip {
public function life_gone_161(){
addFrameScript(12, frame13);
}
function frame13(){
visible = false;
}
}
}//package index_fla
Section 97
//lifeindicator_159 (index_fla.lifeindicator_159)
package index_fla {
import flash.display.*;
public dynamic class lifeindicator_159 extends MovieClip {
public var lg:MovieClip;
public var lm:MovieClip;
}
}//package index_fla
Section 98
//LOADING_SCREEN_1 (index_fla.LOADING_SCREEN_1)
package index_fla {
import flash.events.*;
import flash.display.*;
public dynamic class LOADING_SCREEN_1 extends MovieClip {
public var preloadermask:MovieClip;
public var Muny:MovieClip;
public var shin:MovieClip;
public var startbtn:MovieClip;
public function LOADING_SCREEN_1(){
addFrameScript(117, frame118, 139, frame140, 149, frame150);
}
function frame118(){
stop();
shin.useHandCursor = true;
shin.buttonMode = true;
shin.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
gotoAndPlay(119);
});
}
function frame140(){
stop();
}
function frame150(){
stop();
(parent as MovieClip).gotoAndStop(1, "Menu_");
}
}
}//package index_fla
Section 99
//LOADING_SCREEN_START_16 (index_fla.LOADING_SCREEN_START_16)
package index_fla {
import flash.display.*;
public dynamic class LOADING_SCREEN_START_16 extends MovieClip {
public var Muny:MovieClip;
public function LOADING_SCREEN_START_16(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
(parent as MovieClip).gotoAndStop(1, "Menu_");
}
}
}//package index_fla
Section 100
//M2_106 (index_fla.M2_106)
package index_fla {
import flash.display.*;
public dynamic class M2_106 extends MovieClip {
public var eye3:MovieClip;
public var eye1:MovieClip;
public var eye2:MovieClip;
public var mouth3:MovieClip;
public var mouth2:MovieClip;
public var wet:MovieClip;
public var wet3:MovieClip;
public var wet2:MovieClip;
}
}//package index_fla
Section 101
//M3_115 (index_fla.M3_115)
package index_fla {
import flash.display.*;
public dynamic class M3_115 extends MovieClip {
public var eye3:MovieClip;
public var eye1:MovieClip;
public var eye2:MovieClip;
public var mouth3:MovieClip;
public var mouth2:MovieClip;
public var wet:MovieClip;
public var wet3:MovieClip;
public var wet2:MovieClip;
}
}//package index_fla
Section 102
//M4_1_122 (index_fla.M4_1_122)
package index_fla {
import flash.display.*;
public dynamic class M4_1_122 extends MovieClip {
public var eye3:MovieClip;
public var eye1:MovieClip;
public var eye2:MovieClip;
public var mouth3:MovieClip;
public var mouth2:MovieClip;
public var wet:MovieClip;
public var wet3:MovieClip;
public var wet2:MovieClip;
}
}//package index_fla
Section 103
//M4_121 (index_fla.M4_121)
package index_fla {
import flash.display.*;
public dynamic class M4_121 extends MovieClip {
public var eye3:MovieClip;
public var eye1:MovieClip;
public var eye2:MovieClip;
public var mouth3:MovieClip;
public var mouth2:MovieClip;
public var wet:MovieClip;
public var wet3:MovieClip;
public var wet2:MovieClip;
}
}//package index_fla
Section 104
//M4_2_124 (index_fla.M4_2_124)
package index_fla {
import flash.display.*;
public dynamic class M4_2_124 extends MovieClip {
public var eye3:MovieClip;
public var eye1:MovieClip;
public var eye2:MovieClip;
public var mouth3:MovieClip;
public var mouth2:MovieClip;
public var wet:MovieClip;
public var wet3:MovieClip;
public var wet2:MovieClip;
}
}//package index_fla
Section 105
//M5_123 (index_fla.M5_123)
package index_fla {
import flash.display.*;
public dynamic class M5_123 extends MovieClip {
public var eye3:MovieClip;
public var eye1:MovieClip;
public var eye2:MovieClip;
public var mouth3:MovieClip;
public var mouth2:MovieClip;
public var wet:MovieClip;
public var wet3:MovieClip;
public var wet2:MovieClip;
}
}//package index_fla
Section 106
//MainTimeline (index_fla.MainTimeline)
package index_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var a4;
public var maxspeedindicator:MovieClip;
public var countmsg:MovieClip;
public var loader:URLLoader;
public var flushStatus:String;
public var mouthid:uint;
public var maineq:main;
public var lbar:MovieClip;
public var sndt:SoundTransform;
public var preveyestate:uint;
public var btnsch:SoundChannel;
public var i:uint;
public var k:uint;
public var l:topline;
public var oppcounter:uint;
public var goc:uint;
public var mouthplay:Boolean;
public var m3chaincounter:uint;
public var z:uint;
public var test:TextField;
public var finish:MovieClip;
public var gameid:String;
public var gamemode:uint;
public var skip_on:MovieClip;
public var mouthframeid:uint;
public var ts_btn:MovieClip;
public var ht_btn:MovieClip;
public var muny_x:Number;
public var msgslist:Array;
public var emc:MovieClip;
public var mmbtn:MovieClip;
public var achi:MovieClip;
public var loadingScreen:MovieClip;
public var munnydrag:Boolean;
public var ex_btn:MovieClip;
public var fr:uint;
public var version:uint;
public var timearea:MovieClip;
public var gamecombo:uint;
public var back:MovieClip;
public var gotogirl21:Boolean;
public var msgs:Array;
public var messagearea:MovieClip;
public var girl1:MovieClip;
public var girl3:MovieClip;
public var m3chain:uint;
public var preveyecounter:uint;
public var girl2:MovieClip;
public var mySo:SharedObject;
public var rollafterm3:Boolean;
public var loading:MovieClip;
public var watch2:Boolean;
public var watch3:Boolean;
public var watch1:Boolean;
public var top:MovieClip;
public var menu:MovieClip;
public var ebar:MovieClip;
public var Muny:MovieClip;
public var btns:Array;
public var gotogirl3:Boolean;
public var messagearea1:MovieClip;
public var gotogirl2:Boolean;
public var sndt_:SoundTransform;
public var gametime:uint;
public var gamescore:uint;
public var mouthsch:SoundChannel;
public var eqbg:MovieClip;
public var gameovermsg:MovieClip;
public var oldmc:uint;
public var opmsg:MovieClip;
public var ctc:Boolean;
public var infowindow:MovieClip;
public var mg_btn:MovieClip;
public var rq:URLRequest;
public var rv:URLVariables;
public var zeroflash:MovieClip;
public var morganie2:Boolean;
public var ebarbg:MovieClip;
public var updwindow:MovieClip;
public var st:uint;
public var myContextMenu:ContextMenu;
public var comix:MovieClip;
public var topXML:XML;
public var lifeindicator:MovieClip;
public var girl:MovieClip;
public var msgbox:MovieClip;
public var mln:MovieClip;
public var wordinfo:Array;
public var maxcombo:uint;
public var currid:uint;
public var emc1:MovieClip;
public var rl_btn:MovieClip;
public var soundbtn:MovieClip;
public var infobtn:MovieClip;
public var sm_btn:MovieClip;
public var lines:Array;
public var item:ContextMenuItem;
public var cont:MovieClip;
public var combomsg:MovieClip;
public var maxspeedmsg:MovieClip;
public var config:configManager;
public var girl2_1:MovieClip;
public var girl2_2:MovieClip;
public var schs:Array;
public var dark:MovieClip;
public var item1:ContextMenuItem;
public var gamespeed:uint;
public var mccounter:uint;
public var gameover:Boolean;
public var aftergame:Boolean;
public var g3fin:Boolean;
public var a1;
public var a2;
public var a3;
public var voldown:Boolean;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12);
}
public function loaded(_arg1:Event):void{
removeChild(loading);
stage.removeEventListener(MouseEvent.CLICK, stageclck);
back.visible = true;
}
public function setGameOvermsg(_arg1:Event):void{
var xx:Number;
var mess:String;
var i:uint;
var myTimer:Timer;
var timerHandler:Function;
var sc:Function;
var l:letter;
var e = _arg1;
timerHandler = function (_arg1:TimerEvent):void{
stage.removeEventListener(MouseEvent.CLICK, sc);
gotoAndStop(1, "GameOver");
};
sc = function (_arg1:Event):void{
stage.removeEventListener(MouseEvent.CLICK, sc);
gotoAndStop(1, "GameOver");
};
xx = 0;
mess = "GAME OVER!!!";
i = 0;
while (i < mess.length) {
if (mess.charCodeAt(i) != 32){
l = new letter(mess.charCodeAt(i), xx, 0);
l.cacheAsBitmap = true;
xx = (xx + l.width);
gameovermsg.addChild(l);
l.setpos(1, int.MAX_VALUE, gameovermsg);
} else {
xx = (xx + 17);
};
i = (i + 1);
};
gameovermsg.x = ((700 - gameovermsg.width) / 2);
myTimer = new Timer(2000, 1);
myTimer.addEventListener("timer", timerHandler);
myTimer.start();
stage.addEventListener(MouseEvent.CLICK, sc);
}
function frame10(){
SoundMixer.stopAll();
if (!getFlashVersion()){
initupdate();
} else {
updwindow.visible = false;
};
stop();
Muny.x = muny_x;
if (gamemode == 1){
mySo.data.arcadecount = gamescore;
};
achi.addEventListener(MouseEvent.ROLL_OUT, function (_arg1:Event):void{
achi_show("line0");
});
set_achi();
setMuny();
Muny.useHandCursor = true;
Muny.buttonMode = true;
Muny.addEventListener(MouseEvent.MOUSE_DOWN, function (_arg1:Event):void{
munnydrag = true;
Muny.startDrag(false, new Rectangle(-200, 85, 800, 0));
});
Muny.addEventListener(MouseEvent.MOUSE_UP, mmu);
Muny.addEventListener(MouseEvent.CLICK, mmu);
Muny.addEventListener(MouseEvent.MOUSE_MOVE, function (_arg1:MouseEvent):void{
muny_x = Muny.x;
});
lines = [];
k = 0;
while (k < 20) {
l = new topline();
top.linesplace.addChild(l);
l.x = 190;
l.y = (98 + (k * 17));
l.linebg.visible = false;
l.aw_dildo.visible = false;
l.aw_heart.visible = false;
l.aw_stars.visible = false;
lines[k] = l;
k++;
};
loader = new URLLoader();
msg("LOADING... PLEASE WAIT");
config.addArea("records", emc1);
msgbox.visible = false;
msgbox.editname.visible = false;
msgbox.btncancel.useHandCursor = true;
msgbox.btncancel.buttonMode = true;
msgbox.btncancel.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:Event):void{
_arg1.target.y = 89;
_arg1.target.gotoAndStop(2);
});
msgbox.btncancel.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event):void{
_arg1.target.y = 90;
_arg1.target.gotoAndStop(1);
});
msgbox.btnok.useHandCursor = true;
msgbox.btnok.buttonMode = true;
msgbox.btnok.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:Event):void{
_arg1.target.y = 89;
_arg1.target.gotoAndStop(2);
});
msgbox.btnok.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event):void{
_arg1.target.y = 90;
_arg1.target.gotoAndStop(1);
});
mmbtn.useHandCursor = true;
mmbtn.buttonMode = true;
mmbtn.visible = false;
mmbtn.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
gotoAndStop(1, "Menu_");
});
mmbtn.addEventListener(MouseEvent.MOUSE_MOVE, function (_arg1:Event):void{
top.mmtext.y = 450;
});
mmbtn.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event):void{
top.mmtext.y = 451;
});
mmbtn.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
gotoAndStop(1, "Menu_");
});
top.addEventListener("DONE", tdone);
rq = new URLRequest("http://top.mutanky.com/");
rv = new URLVariables();
makeloader();
loader.addEventListener(Event.COMPLETE, loadXML);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, ioErrorHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
trace(rq.data);
loader.load(rq);
i = 1;
while (i < 5) {
if (mySo.data.achives[i]){
mySo.flush();
break;
};
i++;
};
}
function frame11(){
stop();
back.visible = false;
if (!getFlashVersion()){
initupdate();
} else {
updwindow.visible = false;
};
SoundMixer.stopAll();
stage.addEventListener(MouseEvent.CLICK, stageclck);
msg("LOADING... PLEASE WAIT");
config.addArea("extras", emc1);
config.addEventListener("LOADED_extras", loaded);
back.useHandCursor = true;
back.buttonMode = true;
back.addEventListener(MouseEvent.MOUSE_MOVE, function (_arg1:Event):void{
back.y = 9;
});
back.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event):void{
if (back != null){
back.y = 10;
};
});
back.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
gotoAndStop(1, "Menu_");
});
}
public function eqclick(_arg1:Event):void{
if (!gameover){
if ((((maineq.currid == 0)) || ((maineq.currid == 7)))){
new bar_1().play();
};
if ((((maineq.currid == 1)) || ((maineq.currid == 6)))){
new bar_2().play();
};
if ((((maineq.currid == 2)) || ((maineq.currid == 5)))){
new bar_3().play();
};
if ((((maineq.currid == 3)) || ((maineq.currid == 4)))){
new bar_4().play();
};
};
}
function frame1(){
version = 2;
gameid = "dildo-heroine-1";
config = new configManager(gameid, version, stage);
gamemode = 0;
gametime = 0;
gamescore = 0;
gamecombo = 0;
gamespeed = 0;
st = getTimer();
aftergame = false;
flushStatus = null;
mySo = SharedObject.getLocal("mutanky-dildo-heroine-1");
if (mySo.data.achives == undefined){
mySo.data.arcadecount = 0;
mySo.data.achives = [];
mySo.data.achives_show = [];
z = 1;
while (z < 5) {
mySo.data.achives[z] = false;
mySo.data.achives_show[z] = true;
z++;
};
};
if (mySo.data.arcadecount == undefined){
mySo.data.arcadecount = 0;
};
muny_x = 388;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.showDefaultContextMenu = false;
myContextMenu = new ContextMenu();
item = new ContextMenuItem("!!!- MORE GAMES -!!!");
myContextMenu.customItems.push(item);
item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
item1 = new ContextMenuItem("EXIT");
myContextMenu.customItems.push(item1);
item1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler1);
contextMenu = myContextMenu;
}
function frame2(){
if ((getTimer() - st) > 1000){
loadingScreen.preloadermask.scaleX = 0.001;
loadingScreen.startbtn.visible = false;
};
setMuny();
loadingScreen.startbtn.useHandCursor = true;
loadingScreen.startbtn.buttonMode = true;
loadingScreen.startbtn.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
if (loadingScreen.currentFrame == 140){
loadingScreen.gotoAndPlay(141);
} else {
gotoAndStop(2, "PreMenu");
};
});
loaderInfo.addEventListener(ProgressEvent.PROGRESS, update);
stop();
}
function frame4(){
stop();
SoundMixer.stopAll();
new menu_music().play(0, int.MAX_VALUE);
infowindow.visible = false;
munnydrag = false;
aftergame = false;
gametime = 0;
gamescore = 0;
gamecombo = 0;
gamespeed = 0;
config.addArea("menu", emc);
Muny.x = muny_x;
achi.addEventListener(MouseEvent.ROLL_OUT, function (_arg1:Event):void{
achi_show("line0");
});
setMuny();
set_achi();
infobtn.useHandCursor = true;
infobtn.buttonMode = true;
infobtn.addEventListener(MouseEvent.MOUSE_MOVE, function (_arg1:Event):void{
infobtn.y = 463;
});
infobtn.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event):void{
infobtn.y = 464;
});
infobtn.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
infowindow.visible = true;
});
infowindow.okbtn.useHandCursor = true;
infowindow.okbtn.buttonMode = true;
infowindow.okbtn.addEventListener(MouseEvent.ROLL_OVER, function (_arg1:Event):void{
infowindow.okbtn.gotoAndStop(2);
infowindow.okbtn.y = 95;
});
infowindow.okbtn.addEventListener(MouseEvent.ROLL_OUT, function (_arg1:Event):void{
infowindow.okbtn.gotoAndStop(1);
infowindow.okbtn.y = 96;
});
infowindow.okbtn.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
infowindow.visible = false;
});
Muny.useHandCursor = true;
Muny.buttonMode = true;
Muny.addEventListener(MouseEvent.MOUSE_DOWN, function (_arg1:Event):void{
munnydrag = true;
Muny.startDrag(false, new Rectangle(-200, 85, 800, 0));
});
Muny.addEventListener(MouseEvent.MOUSE_UP, mmu);
Muny.addEventListener(MouseEvent.CLICK, mmu);
Muny.addEventListener(MouseEvent.MOUSE_MOVE, MunyMOVE);
Muny.addEventListener(MouseEvent.MOUSE_OUT, MunyOUT);
wordinfo = [];
btns = [["STORY", sm_btn], ["ARCADE", rl_btn], ["RECORDS", ts_btn], ["MORE GAMES", mg_btn], ["HOW TO PLAY", ht_btn], ["EXTRAS", ex_btn]];
crmsg("STORY", sm_btn);
sm_btn.addEventListener("DONE", showword, false, 0, true);
sm_btn.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
gamemode = 0;
gotoAndStop(1, "Comix");
});
rl_btn.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
gamemode = 1;
gotoAndStop(1, "Game");
});
ts_btn.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
gotoAndStop(1, "Top");
});
ex_btn.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
gotoAndStop(1, "Extras");
});
ht_btn.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
gotoAndStop(1, "HowToPlay");
});
mg_btn.addEventListener(MouseEvent.MOUSE_DOWN, function (_arg1:MouseEvent):void{
navigateToURL(new URLRequest((((("http://tds.mutanky.com/?gameid=" + gameid) + "&version=") + version) + "&action=more-games")));
});
if (!getFlashVersion()){
initupdate();
} else {
updwindow.visible = false;
};
}
public function ioErrorHandler(_arg1:Event):void{
var stageclck:Function;
var ee = _arg1;
stageclck = function (_arg1:Event):void{
stage.removeEventListener(MouseEvent.CLICK, stageclck);
stage.removeChild(stage.getChildByName("loading"));
gotoAndStop(1, "Menu_");
};
if (contains(loading)){
removeChild(loading);
};
loading = new MovieClip();
loading.name = "loading";
loading.y = 233;
stage.addChild(loading);
msg("ERROR LOADING...");
stage.addEventListener(MouseEvent.CLICK, stageclck);
}
function frame7(){
mln.visible = false;
SoundMixer.stopAll();
if (!getFlashVersion()){
initupdate();
} else {
updwindow.visible = false;
};
a1 = 10;
a2 = 200;
a3 = 2000;
a4 = 50000;
goc = 32;
maxcombo = 0;
mouthid = 0;
mouthframeid = 0;
mouthplay = false;
oppcounter = 0;
stop();
dark.gotoAndStop(1);
dark.visible = false;
dark.addEventListener("DONE", setGameOvermsg);
maineq.gamemode = gamemode;
zeroflash.visible = false;
zeroflash.gotoAndStop(1);
if (gamemode == 1){
maineq.addEventListener("OPP", setopmsg);
maineq.addEventListener("OPP1", opp1);
maineq.addEventListener("OPP2", opp2);
lifeindicator.visible = false;
} else {
combomsg.y = 10;
countmsg.visible = false;
maineq.wtf1.visible = false;
maineq.wtf2.visible = false;
finish.alpha = 0;
finish.visible = false;
};
finish.useHandCursor = true;
finish.buttonMode = true;
finish.addEventListener(MouseEvent.MOUSE_MOVE, function (_arg1:Event):void{
finish.y = 9;
});
finish.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event):void{
if (finish != null){
finish.y = 10;
};
});
finish.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, EF);
gameover = true;
SoundMixer.stopAll();
maineq.finalize();
gametime = (getTimer() - maineq.starttime);
gamescore = maineq.count;
gamecombo = maxcombo;
gamespeed = maineq.speedrecord;
aftergame = true;
gotoAndStop(1, "Top");
if (gamemode == 0){
gotoAndStop(1, "Win");
};
});
messagearea.visible = true;
messagearea1.visible = true;
maineq.init();
if (gamemode == 1){
maineq.count = mySo.data.arcadecount;
};
ctc = false;
fr = 1;
morganie2 = false;
rollafterm3 = false;
m3chain = 1;
m3chaincounter = 0;
g3fin = false;
watch1 = false;
watch2 = false;
watch3 = false;
gotogirl2 = false;
gotogirl21 = false;
gotogirl3 = false;
oldmc = 10;
mccounter = 0;
preveyestate = 0;
preveyecounter = 0;
gameover = false;
voldown = false;
sndt = new SoundTransform();
sndt.volume = 0;
sndt_ = new SoundTransform();
sndt_.volume = 1;
schs = [];
schs[0] = new beat1().play(0, int.MAX_VALUE);
schs[1] = new beat2().play(0, int.MAX_VALUE, sndt);
schs[2] = new beat3().play(0, int.MAX_VALUE, sndt);
schs[3] = new beat4().play(0, int.MAX_VALUE, sndt);
schs[4] = new beat5().play(0, int.MAX_VALUE, sndt);
schs[5] = new beat6().play(0, int.MAX_VALUE, sndt);
ebar.y = (143 + ebar.height);
combomsg.scaleX = 0.5;
combomsg.scaleY = 0.5;
lifeindicator.lg.visible = false;
msgslist = [[], [], [1, 2, 3, 4, 5, 7], [14, 22, 5, 6, 7, 12], [3, 5, 7, 8, 26], [26, 7, 8, 9, 10], [7, 8, 12, 11, 12], [8, 9, 11, 26, 5], [9, 10, 11, 12, 16], [10, 11, 12, 26, 3, 7, 8], [13, 26], [11, 12, 13, 8, 30], [10, 12, 14, 7, 26], [12, 14, 8, 16], [14, 7, 12], [8, 11, 10, 19], [15, 25], [10, 11, 30, 19, 22], [18, 25, 16, 12, 23], [8, 19, 14, 25], [19, 3, 16, 13], [17, 32], [26, 14, 22, 24, 21], [25, 12, 30], [24, 7, 3, 19, 10], [9, 3, 22, 20, 30], [33, 26, 5, 8], [23, 15], [15], [27], [28], [29], [32, 34], [31]];
msgs = ["", "FEELS GOOD!", "GO WITH THE RYTHM!", "GREAT!", "KEEP ME BOUNCE!", "AWESOME!", "YOU ARE ROCK!", "WOW!", "HARDER!", "OUTSTANDING!", "MORE!", "FASTER!", "AAAAH!", "I`M ON FIRE!", "FUCK YEAH!", "IT`S ALMOST THERE!", "OH MY GOD!", "THAT DILDO GONNA MELT!", "MAKE ME CUM!", "DON`T STOP!", "AGAIN!", "OH YEAH!!!", "FUCK!!!", "DO IT ONCE MORE!", "OH FUCK!!!", "IT`S SO FUCKING GOOD!", "FEELING GREAT", "I`M GONNA CUM!", "I`M CUMMING!", "I`M CUMMING AGAIN!", "I`TS SO HOT!", "I CAN`T TAKE IT ANYMORE!", "I LOVE THAT DILDO!", "NEXT GAME WILL BE BETTER!", "MUTANKY KICK ASS!"];
soundbtn.useHandCursor = true;
soundbtn.buttonMode = true;
soundbtn.addEventListener(MouseEvent.CLICK, soundCLICK);
maineq.addEventListener("EQCLICK", eqclick);
eqbg.addEventListener(MouseEvent.CLICK, maineq.CLICKHandler);
messagearea.addEventListener(MouseEvent.CLICK, maineq.CLICKHandler);
messagearea1.addEventListener(MouseEvent.CLICK, maineq.CLICKHandler);
girl1.visible = false;
girl2.visible = false;
girl2.stop();
girl2_1.visible = false;
girl2_1.stop();
girl2_2.visible = false;
girl2_2.stop();
girl3.visible = false;
girl3.stop();
girl.wet.visible = false;
girl.wet2.visible = false;
girl.wet3.visible = false;
girl1.wet.visible = false;
girl1.wet2.visible = false;
girl1.wet3.visible = false;
girl2.wet.visible = false;
girl2.wet2.visible = false;
girl2.wet3.visible = false;
girl2_1.wet.visible = false;
girl2_1.wet2.visible = false;
girl2_1.wet3.visible = false;
girl2_2.wet.visible = false;
girl2_2.wet2.visible = false;
girl2_2.wet3.visible = false;
girl3.wet.visible = false;
girl3.wet2.visible = false;
girl3.wet3.visible = false;
addEventListener(Event.ENTER_FRAME, EF);
maineq.addEventListener("BANG", BANGEVENT);
setcountmsg(maineq.count);
maineq.addEventListener("MISS", MISSEVENT, false, 0, true);
maineq.addEventListener("MAXSPEED", MAXSPEEDEVENT);
maineq.addEventListener("FINE", FINEVENT);
maineq.addEventListener("COUNT", COUNTEVENT);
maineq.addEventListener("COUNT1", COUNTEVENT1);
}
function frame5(){
SoundMixer.stopAll();
}
function frame6(){
stop();
SoundMixer.stopAll();
comix.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
cont.visible = false;
skip_on.visible = false;
comix.gotoAndPlay((comix.currentFrame + 1));
});
skip_on.buttonMode = true;
skip_on.useHandCursor = true;
skip_on.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
SoundMixer.stopAll();
gotoAndStop(1, "Game");
});
}
function frame9(){
stop();
SoundMixer.stopAll();
comix.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
comix.gotoAndPlay((comix.currentFrame + 1));
});
aftergame = true;
}
function frame3(){
stop();
setMuny();
}
function frame8(){
stop();
comix.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
comix.gotoAndPlay((comix.currentFrame + 1));
});
aftergame = true;
}
function frame12(){
SoundMixer.stopAll();
if (!getFlashVersion()){
initupdate();
} else {
updwindow.visible = false;
};
new menu_music().play(0, int.MAX_VALUE);
back.useHandCursor = true;
back.buttonMode = true;
back.addEventListener(MouseEvent.MOUSE_MOVE, function (_arg1:Event):void{
back.y = 449;
});
back.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event):void{
if (back != null){
back.y = 450;
};
});
back.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
gotoAndStop(1, "Menu_");
});
}
public function reg(_arg1:Event=null):void{
msgbox.editname.visible = true;
msgbox.msg.text = "Please enter your NICKNAME:";
mySo.data.key = undefined;
msgbox.btncancel.addEventListener(MouseEvent.CLICK, oncancel);
msgbox.btnok.addEventListener(MouseEvent.CLICK, onok2);
}
public function EF(_arg1:Event):void{
var morganie:Boolean;
var snd:SoundTransform;
var i:uint;
var hideg1:Boolean;
var hideg2:Boolean;
var hideg3:Boolean;
var newmc:uint;
var eyepos:uint;
var myTimer:Timer;
var timerHandler:Function;
var e = _arg1;
if (!gameover){
if ((((maineq.nonstopbeats_cut > 4)) && ((maineq.nonstopbeats_cut < 10)))){
if (!mouthplay){
if (int((Math.random() * 2)) == 1){
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_05_B().play();
mouthframeid = 0;
mouthid = 5;
mouthplay = true;
} else {
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_07_B().play();
mouthframeid = 0;
mouthid = 7;
mouthplay = true;
};
};
};
if ((((maineq.nonstopbeats_cut > 9)) && ((maineq.nonstopbeats_cut < 15)))){
if (!mouthplay){
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_02_E().play();
mouthframeid = 0;
mouthid = 2;
mouthplay = true;
};
};
if ((((maineq.nonstopbeats_cut > 14)) && ((maineq.nonstopbeats_cut < 20)))){
if (!mouthplay){
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_04_A().play();
mouthframeid = 0;
mouthid = 4;
mouthplay = true;
};
};
if (maineq.nonstopbeats_cut > 19){
if (!mouthplay){
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_05_B().play();
mouthframeid = 0;
mouthid = 5;
mouthplay = true;
};
};
if (mouthplay){
mouthframeid++;
if (mouthid == 1){
if (mouthframeid == 1){
setmouth(3);
};
if ((((mouthframeid >= 2)) && ((mouthframeid <= 6)))){
setmouth(1);
};
if ((((mouthframeid >= 7)) && ((mouthframeid <= 14)))){
setmouth(2);
};
if (mouthframeid == 15){
setmouth(3);
mouthplay = false;
};
};
if (mouthid == 2){
if (mouthframeid == 1){
setmouth(3);
};
if ((((mouthframeid >= 2)) && ((mouthframeid <= 5)))){
setmouth(2);
};
if ((((mouthframeid >= 6)) && ((mouthframeid <= 11)))){
setmouth(1);
};
if (mouthframeid == 12){
setmouth(3);
mouthplay = false;
};
};
if (mouthid == 3){
if (mouthframeid == 1){
setmouth(3);
};
if ((((mouthframeid >= 2)) && ((mouthframeid <= 5)))){
setmouth(2);
};
if ((((mouthframeid >= 6)) && ((mouthframeid <= 7)))){
setmouth(1);
};
if ((((mouthframeid >= 8)) && ((mouthframeid <= 12)))){
setmouth(2);
};
if ((((mouthframeid >= 13)) && ((mouthframeid <= 17)))){
setmouth(1);
};
if ((((mouthframeid >= 18)) && ((mouthframeid <= 22)))){
setmouth(2);
};
if (mouthframeid == 23){
setmouth(3);
mouthplay = false;
};
};
if (mouthid == 4){
if (mouthframeid == 1){
setmouth(3);
};
if ((((mouthframeid >= 2)) && ((mouthframeid <= 10)))){
setmouth(2);
};
if ((((mouthframeid >= 11)) && ((mouthframeid <= 17)))){
setmouth(1);
};
if (mouthframeid == 18){
setmouth(3);
mouthplay = false;
};
};
if (mouthid == 5){
if (mouthframeid == 1){
setmouth(3);
};
if ((((mouthframeid >= 2)) && ((mouthframeid <= 4)))){
setmouth(1);
};
if ((((mouthframeid >= 5)) && ((mouthframeid <= 7)))){
setmouth(2);
};
if ((((mouthframeid >= 8)) && ((mouthframeid <= 11)))){
setmouth(1);
};
if (mouthframeid == 12){
setmouth(2);
};
if (mouthframeid == 13){
setmouth(3);
mouthplay = false;
};
};
if (mouthid == 6){
if (mouthframeid == 1){
setmouth(3);
};
if (mouthframeid == 2){
setmouth(2);
};
if ((((mouthframeid >= 3)) && ((mouthframeid <= 7)))){
setmouth(1);
};
if ((((mouthframeid >= 8)) && ((mouthframeid <= 13)))){
setmouth(2);
};
if ((((mouthframeid >= 14)) && ((mouthframeid <= 18)))){
setmouth(1);
};
if ((((mouthframeid >= 19)) && ((mouthframeid <= 24)))){
setmouth(2);
};
if ((((mouthframeid >= 25)) && ((mouthframeid <= 28)))){
setmouth(1);
};
if (mouthframeid == 29){
setmouth(3);
mouthplay = false;
};
};
if (mouthid == 7){
if (mouthframeid == 1){
setmouth(3);
};
if ((((mouthframeid >= 2)) && ((mouthframeid <= 5)))){
setmouth(1);
};
if ((((mouthframeid >= 6)) && ((mouthframeid <= 9)))){
setmouth(2);
};
if ((((mouthframeid >= 10)) && ((mouthframeid <= 15)))){
setmouth(1);
};
if (mouthframeid == 16){
setmouth(2);
};
if (mouthframeid == 17){
setmouth(3);
mouthplay = false;
};
};
if (mouthid == 8){
if (mouthframeid == 1){
setmouth(3);
};
if ((((mouthframeid >= 2)) && ((mouthframeid <= 3)))){
setmouth(2);
};
if ((((mouthframeid >= 4)) && ((mouthframeid <= 6)))){
setmouth(1);
};
if (mouthframeid == 7){
setmouth(2);
};
if (mouthframeid == 8){
setmouth(3);
mouthplay = false;
};
};
if (mouthid == 9){
if (mouthframeid == 1){
setmouth(3);
};
if ((((mouthframeid >= 2)) && ((mouthframeid <= 3)))){
setmouth(2);
};
if ((((mouthframeid >= 4)) && ((mouthframeid <= 9)))){
setmouth(1);
};
if (mouthframeid == 10){
setmouth(2);
};
if (mouthframeid == 11){
setmouth(3);
mouthplay = false;
};
};
};
if (gamemode == 0){
createtimemsg();
};
if ((((gamemode == 0)) && ((((maineq.nonstopbeats == goc)) || ((maineq.count == 50000)))))){
gameover = true;
};
if (voldown){
if ((((schs[1].soundTransform.volume > 0)) || ((schs[2].soundTransform.volume > 0)))){
snd = new SoundTransform();
if (schs[2].soundTransform.volume > schs[1].soundTransform.volume){
snd.volume = (schs[2].soundTransform.volume - 0.016);
} else {
snd.volume = (schs[1].soundTransform.volume - 0.016);
};
i = 1;
while (i < 6) {
if (schs[i].soundTransform.volume > 0){
schs[i].soundTransform = snd;
} else {
schs[i].soundTransform = sndt;
};
i = (i + 1);
};
} else {
schs[1].soundTransform = sndt;
voldown = false;
};
};
if (watch1){
hideg1 = false;
if ((((fr < 8)) && ((girl1.currentFrame == 2)))){
hideg1 = true;
} else {
if ((((fr < 23)) && ((girl1.currentFrame == 3)))){
hideg1 = true;
} else {
if ((((fr < 30)) && ((girl1.currentFrame == 4)))){
hideg1 = true;
} else {
if (girl1.currentFrame == 5){
hideg1 = true;
};
};
};
};
if (hideg1){
watch1 = false;
girl1.visible = false;
girl.visible = true;
girl1.gotoAndStop(1);
};
};
if (watch2){
hideg2 = false;
if ((((fr < 8)) && ((girl2.currentFrame == 2)))){
hideg2 = true;
} else {
if ((((fr < 23)) && ((girl2.currentFrame == 3)))){
hideg2 = true;
} else {
if ((((fr < 30)) && ((girl2.currentFrame == 4)))){
hideg2 = true;
} else {
if (girl2.currentFrame == 5){
hideg2 = true;
};
};
};
};
if (hideg2){
watch2 = false;
girl2.visible = false;
girl2.gotoAndStop(1);
};
};
if (watch3){
hideg3 = false;
if ((((fr < 8)) && ((girl2_2.currentFrame == 2)))){
hideg3 = true;
} else {
if ((((fr < 23)) && ((girl2_2.currentFrame == 3)))){
hideg3 = true;
} else {
if ((((fr < 30)) && ((girl2_2.currentFrame == 4)))){
hideg3 = true;
} else {
if (girl2_2.currentFrame > 4){
hideg3 = true;
};
};
};
};
if (hideg3){
watch3 = false;
girl2_2.visible = false;
girl2_2.gotoAndStop(1);
};
};
if (((((girl2_1.visible) && ((girl2_1.currentFrame == 7)))) && ((maineq.nonstopbeats_cut < 20)))){
girl2_1.visible = false;
girl2_1.gotoAndStop(1);
girl3.visible = true;
girl3.gotoAndPlay(1);
};
if (((((girl3.visible) && ((girl3.currentFrame == 10)))) && ((((maineq.nonstopbeats_cut < 20)) || (g3fin))))){
if ((((m3chaincounter == m3chain)) || (g3fin))){
girl3.visible = false;
girl3.gotoAndStop(1);
girl2_2.visible = true;
girl2_2.gotoAndPlay(1);
} else {
m3chaincounter++;
};
};
if (((((girl2_2.visible) && ((girl2_2.currentFrame == 6)))) && ((maineq.nonstopbeats_cut < 20)))){
if (!g3fin){
girl2_2.visible = false;
girl2_2.gotoAndStop(1);
girl2.visible = true;
girl2.gotoAndPlay(1);
} else {
girl2_2.visible = false;
girl2_2.gotoAndStop(1);
g3fin = false;
};
};
if (((gotogirl3) && ((girl2_2.currentFrame == 6)))){
girl2_2.visible = false;
girl2_2.gotoAndStop(1);
girl2_1.visible = true;
girl2_1.gotoAndPlay(1);
};
if (((gotogirl3) && ((girl2_1.currentFrame == 7)))){
gotogirl3 = false;
girl2_1.visible = false;
girl2_1.gotoAndStop(1);
girl3.visible = true;
girl3.gotoAndPlay(1);
};
if (((gotogirl2) && ((girl1.currentFrame == 13)))){
gotogirl2 = false;
girl2.visible = true;
girl2.gotoAndPlay(1);
};
if (((gotogirl21) && ((girl2.currentFrame == 13)))){
gotogirl21 = false;
girl2_1.visible = true;
girl2_1.gotoAndPlay(1);
};
if ((((maineq.nonstopbeats_cut < 10)) && ((girl2.currentFrame == 13)))){
girl2.gotoAndStop(1);
girl2.visible = false;
girl1.gotoAndPlay(1);
};
if ((((maineq.nonstopbeats_cut == 15)) || ((maineq.count > 5000)))){
girl.wet3.visible = true;
girl1.wet3.visible = true;
girl2.wet3.visible = true;
girl2_1.wet3.visible = true;
girl2_2.wet3.visible = true;
girl3.wet3.visible = true;
};
if ((((maineq.nonstopbeats_cut == 30)) || ((maineq.count > 10000)))){
girl.wet.visible = true;
girl.wet2.visible = true;
girl1.wet.visible = true;
girl1.wet2.visible = true;
girl2.wet.visible = true;
girl2.wet2.visible = true;
girl2_1.wet.visible = true;
girl2_1.wet2.visible = true;
girl2_2.wet.visible = true;
girl2_2.wet2.visible = true;
girl3.wet.visible = true;
girl3.wet2.visible = true;
};
morganie = false;
if ((((int((Math.random() * 50)) == 25)) && (!(morganie2)))){
morganie = true;
};
if (((((girl.visible) && (!(morganie)))) && (!(morganie2)))){
if (maineq.eyes_id == 1){
girl.eye1.visible = true;
girl.eye2.visible = false;
girl.eye3.visible = false;
};
if (maineq.eyes_id == 2){
girl.eye1.visible = false;
girl.eye2.visible = true;
girl.eye3.visible = false;
};
if (maineq.eyes_id == 3){
girl.eye1.visible = false;
girl.eye2.visible = false;
girl.eye3.visible = true;
};
};
if (((girl.visible) && (morganie2))){
morganie2 = false;
if ((((maineq.eyes_id == 3)) || ((maineq.eyes_id == 1)))){
girl.eye1.visible = false;
girl.eye2.visible = true;
girl.eye3.visible = false;
};
};
if (((girl.visible) && (morganie))){
if (maineq.eyes_id == 2){
girl.eye1.visible = true;
girl.eye2.visible = false;
girl.eye3.visible = false;
};
if ((((maineq.eyes_id == 3)) || ((maineq.eyes_id == 1)))){
morganie2 = true;
girl.eye1.visible = true;
girl.eye2.visible = false;
girl.eye3.visible = false;
};
};
if (girl1.visible){
if (maineq.eyes_id == 1){
girl1.eye1.visible = true;
girl1.eye2.visible = false;
girl1.eye3.visible = false;
};
if (maineq.eyes_id == 2){
girl1.eye1.visible = false;
girl1.eye2.visible = true;
girl1.eye3.visible = false;
};
if (maineq.eyes_id == 3){
girl1.eye1.visible = false;
girl1.eye2.visible = false;
girl1.eye3.visible = true;
};
};
if (girl2.visible){
if (maineq.eyes_id == 1){
girl2.eye1.visible = true;
girl2.eye2.visible = false;
girl2.eye3.visible = false;
};
if (maineq.eyes_id == 2){
girl2.eye1.visible = false;
girl2.eye2.visible = true;
girl2.eye3.visible = false;
};
if (maineq.eyes_id == 3){
girl2.eye1.visible = false;
girl2.eye2.visible = false;
girl2.eye3.visible = true;
};
};
if (girl2_1.visible){
if (maineq.eyes_id == 1){
girl2_1.eye1.visible = true;
girl2_1.eye2.visible = false;
girl2_1.eye3.visible = false;
};
if (maineq.eyes_id == 2){
girl2_1.eye1.visible = false;
girl2_1.eye2.visible = true;
girl2_1.eye3.visible = false;
};
if (maineq.eyes_id == 3){
girl2_1.eye1.visible = false;
girl2_1.eye2.visible = false;
girl2_1.eye3.visible = true;
};
};
if (girl2_2.visible){
if (maineq.eyes_id == 1){
girl2_2.eye1.visible = true;
girl2_2.eye2.visible = false;
girl2_2.eye3.visible = false;
};
if (maineq.eyes_id == 2){
girl2_2.eye1.visible = false;
girl2_2.eye2.visible = true;
girl2_2.eye3.visible = false;
};
if (maineq.eyes_id == 3){
girl2_2.eye1.visible = false;
girl2_2.eye2.visible = false;
girl2_2.eye3.visible = true;
};
};
if (girl3.visible){
if (maineq.eyes_id == 1){
girl3.eye1.visible = true;
girl3.eye2.visible = false;
girl3.eye3.visible = false;
};
if (maineq.eyes_id == 2){
girl3.eye1.visible = false;
girl3.eye2.visible = true;
girl3.eye3.visible = false;
};
};
if (ebar.y < (143 + 214)){
if (gamemode == 0){
ebar.y = (ebar.y + (((214 / 10) / 25) + (maineq.nonstopbeats / 17.5)));
} else {
ebar.y = (ebar.y + ((214 / 10) / 25));
};
} else {
if (ebar.visible){
if ((((maineq.nonstopbeats_cut > 1)) && (!(gameover)))){
createmsg("COMBO FAILED!", 200, 400);
voldown = true;
if (maineq.nonstopbeats_cut >= 20){
g3fin = true;
};
if (girl1.visible){
watch1 = true;
};
if (girl2.visible){
watch2 = true;
};
if (((girl3.visible) && (g3fin))){
watch3 = true;
};
};
maineq.nonstopbeats = 0;
maineq.nonstopbeats_cut = 0;
setcombomsg();
ebar.visible = false;
};
};
if (maineq.nonstopbeats_cut < 5){
if (maineq.circbody != null){
fr = (int(((maineq.circbody.m_position.y - 40) / 12)) + 1);
};
if (!rollafterm3){
girl.gotoAndStop(fr);
} else {
if (girl.currentFrame < fr){
girl.gotoAndStop((girl.currentFrame + 1));
} else {
rollafterm3 = false;
};
};
if ((((girl1.currentFrame == 1)) && (girl1.visible))){
girl1.visible = false;
girl.visible = true;
girl.gotoAndStop(2);
rollafterm3 = true;
};
} else {
if (maineq.nonstopbeats_cut < 10){
if (!girl1.visible){
girl1.visible = true;
};
} else {
if (!girl2.visible){
gotogirl2 = true;
};
};
};
} else {
if (!ctc){
timerHandler = function (_arg1:TimerEvent):void{
finish.visible = true;
};
gametime = (getTimer() - maineq.starttime);
gamescore = maineq.count;
gamecombo = maineq.nonstopbeats;
gamespeed = maineq.speedrecord;
if (mySo.data.achive1 == undefined){
mySo.data.achive1 = 1;
} else {
mySo.data.achive1++;
};
if (mySo.data.achive1 >= a1){
mySo.data.achives[1] = true;
};
myTimer = new Timer(3000, 1);
myTimer.addEventListener("timer", timerHandler);
myTimer.start();
timearea.alpha = (timearea.alpha + -0.1);
ctc = true;
};
if (((finish.visible) && ((finish.alpha < 1)))){
finish.alpha = (finish.alpha + 0.1);
};
if ((((timearea.alpha < 1)) && ((timearea.alpha > 0)))){
timearea.alpha = (timearea.alpha + -0.1);
};
if (maineq.alpha > 0){
maxspeedmsg.alpha = (maxspeedmsg.alpha + -0.02);
maxspeedindicator.alpha = (maxspeedindicator.alpha + -0.02);
lifeindicator.alpha = (lifeindicator.alpha + -0.02);
maineq.alpha = (maineq.alpha + -0.02);
eqbg.alpha = (eqbg.alpha + -0.02);
ebarbg.alpha = (ebarbg.alpha + -0.02);
combomsg.alpha = (combomsg.alpha + -0.02);
countmsg.alpha = (countmsg.alpha + -0.02);
} else {
maxspeedmsg.visible = false;
maxspeedindicator.visible = false;
lifeindicator.visible = false;
maineq.visible = false;
eqbg.visible = false;
ebarbg.visible = false;
combomsg.visible = false;
countmsg.visible = false;
};
if (oldmc > 3){
newmc = (int((Math.random() * 3)) + 1);
oldmc = newmc;
} else {
if ((((mccounter < (int((Math.random() * 3)) + 4))) && ((((((girl3.currentFrame == 10)) || ((girl2.currentFrame == 13)))) || ((girl1.currentFrame == 13)))))){
mccounter++;
newmc = oldmc;
} else {
mccounter = 0;
newmc = (int((Math.random() * 3)) + 1);
oldmc = newmc;
};
};
if (((girl3.visible) && ((girl3.currentFrame == 10)))){
if (newmc != 3){
girl3.gotoAndStop(1);
girl3.visible = false;
girl2_2.visible = true;
girl2_2.gotoAndPlay(1);
};
};
if (((girl2.visible) && ((girl2.currentFrame == 13)))){
if (newmc == 1){
girl2.gotoAndStop(1);
girl2.visible = false;
girl1.visible = true;
girl1.gotoAndPlay(1);
};
if (newmc == 3){
girl2.gotoAndStop(1);
girl2.visible = false;
girl2_1.visible = true;
girl2_1.gotoAndPlay(1);
};
};
if (((girl2_1.visible) && ((girl2_1.currentFrame == 7)))){
girl2_1.gotoAndStop(1);
girl2_1.visible = false;
girl3.visible = true;
girl3.gotoAndPlay(1);
};
if (((girl2_2.visible) && ((girl2_2.currentFrame == 6)))){
girl2_2.gotoAndStop(1);
girl2_2.visible = false;
girl1.visible = true;
girl1.gotoAndPlay(1);
};
if (((girl1.visible) && ((girl1.currentFrame == 13)))){
if (newmc == 2){
girl1.gotoAndStop(1);
girl1.visible = false;
girl2.visible = true;
girl2.gotoAndPlay(1);
};
if (newmc == 3){
girl1.gotoAndStop(1);
girl1.visible = false;
girl2_1.visible = true;
girl2_1.gotoAndPlay(1);
};
};
if (preveyecounter < int(((Math.random() * 5) + 3))){
preveyecounter++;
eyepos = preveyestate;
} else {
eyepos = int((Math.random() * 2));
preveyestate = eyepos;
preveyecounter = 0;
};
if (eyepos == 0){
girl1.eye1.visible = true;
girl1.eye2.visible = false;
girl1.eye3.visible = false;
girl2.eye1.visible = true;
girl2.eye2.visible = false;
girl2.eye3.visible = false;
girl2_1.eye1.visible = true;
girl2_1.eye2.visible = false;
girl2_1.eye3.visible = false;
girl3.eye1.visible = true;
girl3.eye2.visible = false;
girl3.eye3.visible = false;
girl2_2.eye1.visible = true;
girl2_2.eye2.visible = false;
girl2_2.eye3.visible = false;
} else {
girl1.eye1.visible = false;
girl1.eye2.visible = true;
girl1.eye3.visible = false;
girl2.eye1.visible = false;
girl2.eye2.visible = true;
girl2.eye3.visible = false;
girl2_1.eye1.visible = false;
girl2_1.eye2.visible = true;
girl2_1.eye3.visible = false;
girl3.eye1.visible = false;
girl3.eye2.visible = true;
girl3.eye3.visible = false;
girl2_2.eye1.visible = false;
girl2_2.eye2.visible = true;
girl2_2.eye3.visible = false;
};
};
}
public function onFlushStatus(_arg1:NetStatusEvent):void{
trace("User closed permission dialog...\n");
switch (_arg1.info.code){
case "SharedObject.Flush.Success":
trace("User granted permission -- value saved.\n");
reg();
break;
case "SharedObject.Flush.Failed":
trace("User denied permission -- value not saved.\n");
mySo.data.key = undefined;
msgbox.btnok.addEventListener(MouseEvent.CLICK, onok);
msgbox.btncancel.addEventListener(MouseEvent.CLICK, oncancel);
break;
};
mySo.removeEventListener(NetStatusEvent.NET_STATUS, onFlushStatus);
}
public function crmsg(_arg1:String, _arg2:MovieClip):void{
var xx:Number;
var i:uint;
var l:letter;
var mess = _arg1;
var area = _arg2;
if (area.numChildren == 1){
area.useHandCursor = true;
area.buttonMode = true;
xx = 0;
i = 0;
while (i < mess.length) {
if (mess.charCodeAt(i) != 32){
l = new letter(mess.charCodeAt(i), xx, 0);
l.cacheAsBitmap = true;
l.name = ("l_" + i);
xx = (xx + l.width);
area.addChild(l);
if (i > 0){
l.visible = false;
} else {
wordinfo.push([area, 0]);
currid = (wordinfo.length - 1);
l.setpos(2, 2, area);
};
} else {
area.addChild(new MovieClip());
xx = (xx + 17);
};
i = (i + 1);
};
};
area.bg.width = xx;
area.x = ((700 - area.width) / 2);
area.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:Event):void{
_arg1.target.y--;
});
area.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event):void{
_arg1.target.y++;
});
area.addEventListener(MouseEvent.ROLL_OVER, function (_arg1:Event):void{
var _local2:Sound;
if (btnsch != null){
btnsch.stop();
};
switch (_arg1.target.name){
case "sm_btn":
case "ex_btn":
_local2 = new bar_1();
break;
case "rl_btn":
case "ht_btn":
_local2 = new bar_2();
break;
case "ts_btn":
_local2 = new bar_3();
break;
case "mg_btn":
_local2 = new bar_4();
break;
};
btnsch = _local2.play();
});
area.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:Event):void{
_arg1.target.parent.y--;
});
area.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event):void{
_arg1.target.parent.y++;
});
}
public function update(_arg1:ProgressEvent):void{
var _local2:Number;
_local2 = Math.floor(((_arg1.bytesLoaded * 100) / _arg1.bytesTotal));
trace(_local2);
loadingScreen.preloadermask.scaleX = (_local2 / 100);
if (_local2 == 100){
loadingScreen.startbtn.visible = true;
} else {
loadingScreen.startbtn.visible = false;
};
}
public function MunyOUT(_arg1:MouseEvent):void{
sm_btn.y = 200;
rl_btn.y = 235;
ts_btn.y = 270;
mg_btn.y = 305;
ht_btn.y = 340;
ex_btn.y = 375;
}
public function createmaxspeedmsg(_arg1:uint, _arg2:Boolean=true):void{
var _local3:String;
var _local4:uint;
var _local5:uint;
var _local6:MovieClip;
var _local7:Number;
var _local8:uint;
var _local9:letter;
if ((((_arg1 >= a3)) && (mySo.data.achives[1]))){
mySo.data.achives[3] = true;
};
_local3 = String(_arg1);
_local4 = _local3.length;
_local5 = 0;
while (_local5 < (4 - _local4)) {
_local3 = ("0" + _local3);
_local5++;
};
_local6 = (maxspeedmsg.getChildByName("emc") as MovieClip);
if (_local6 != null){
_local8 = 0;
while (_local8 < _local6.numChildren) {
_local6.removeChildAt(_local8);
_local8++;
};
maxspeedmsg.removeChild(_local6);
};
_local6 = new MovieClip();
_local6.name = "emc";
maxspeedmsg.addChild(_local6);
_local7 = 0;
_local5 = 0;
while (_local5 < _local3.length) {
if (_local3.charCodeAt(_local5) != 32){
_local9 = new letter(_local3.charCodeAt(_local5), _local7, 0);
_local9.cacheAsBitmap = true;
_local7 = (_local7 + _local9.width);
_local6.addChild(_local9);
_local9.setpos(1, ((25 * 60) * 60), maxspeedmsg);
} else {
_local7 = (_local7 + 17);
};
_local5++;
};
_local6.scaleX = 0.5;
_local6.scaleY = 0.5;
_local6.x = ((56 - _local6.width) / 2);
}
public function menuItemSelectHandler1(_arg1:ContextMenuEvent):void{
gotoAndStop(1, "Menu_");
}
public function setMuny():void{
var _local1:MovieClip;
var _local2:uint;
if (loadingScreen != null){
_local1 = loadingScreen.Muny;
} else {
_local1 = Muny.old;
};
_local2 = 1;
while (_local2 < 5) {
(_local1.getChildByName(("ah" + _local2)) as MovieClip).visible = mySo.data.achives_show[_local2];
_local2++;
};
}
public function createmsg(_arg1:String, _arg2:Number=0, _arg3:Number=400, _arg4:uint=20):void{
var emc:MovieClip;
var doneEvt:Function;
var i:uint;
var l:letter;
var mess = _arg1;
var xx = _arg2;
var yy = _arg3;
var time = _arg4;
if (((!((messagearea == null))) && ((messagearea.numChildren == 0)))){
doneEvt = function (_arg1:Event):void{
var _local2:uint;
if (((((!((messagearea == null))) && (!((emc == null))))) && (messagearea.contains(emc)))){
_local2 = 0;
while (_local2 < emc.numChildren) {
emc.removeChildAt(_local2);
_local2++;
};
messagearea.removeChild(emc);
};
};
xx = 0;
yy = 440;
emc = new MovieClip();
messagearea.addEventListener("DONE", doneEvt);
messagearea.addChild(emc);
i = 0;
while (i < mess.length) {
if (mess.charCodeAt(i) != 32){
l = new letter(mess.charCodeAt(i), xx, yy);
l.cacheAsBitmap = true;
xx = (xx + l.width);
emc.addChild(l);
l.setpos(1, time, messagearea);
} else {
xx = (xx + 17);
};
i = (i + 1);
};
emc.x = ((700 - emc.width) / 2);
};
}
public function createtimemsg():void{
var _local1:uint;
var _local2:uint;
var _local3:uint;
var _local4:*;
var _local5:*;
var _local6:String;
var _local7:String;
var _local8:Number;
var _local9:uint;
var _local10:uint;
var _local11:letter;
_local1 = (getTimer() - maineq.starttime);
_local2 = int((_local1 / 1000));
_local3 = int((_local2 / 60));
_local4 = String(_local3);
if (_local3 < 10){
_local4 = ("0" + _local4);
};
_local5 = String((_local2 - (_local3 * 60)));
if ((_local2 - (_local3 * 60)) < 10){
_local5 = ("0" + _local5);
};
_local6 = String((_local1 - (_local2 * 1000)));
if ((_local1 - (_local2 * 1000)) < 10){
_local6 = ("0" + _local6);
};
_local7 = ((_local4 + ":") + _local5);
_local8 = 0;
_local9 = 0;
while (_local9 < timearea.numChildren) {
timearea.removeChildAt(_local9);
_local9++;
};
_local10 = 0;
while (_local10 < _local7.length) {
if (_local7.charCodeAt(_local10) != 32){
_local11 = new letter(_local7.charCodeAt(_local10), _local8, 0);
_local11.cacheAsBitmap = true;
_local8 = (_local8 + _local11.width);
timearea.addChild(_local11);
_local11.setpos(3, 0, timearea);
} else {
_local8 = (_local8 + 17);
};
_local10++;
};
timearea.scaleX = 0.75;
timearea.scaleY = 0.75;
}
public function achi_show(_arg1:String):void{
var _local2:uint;
if ((achi.getChildByName(_arg1) as MovieClip).currentFrame != 15){
_local2 = 1;
while (_local2 < 5) {
if (((!((String(("line" + _local2)) == _arg1))) && (((achi.getChildByName(("line" + _local2)) as MovieClip).currentFrame <= 15)))){
(achi.getChildByName(("line" + _local2)) as MovieClip).gotoAndPlay(((16 + 15) - (achi.getChildByName(("line" + _local2)) as MovieClip).currentFrame));
};
_local2++;
};
};
}
public function oncancel(_arg1:Event):void{
msgbox.btncancel.removeEventListener(MouseEvent.CLICK, oncancel);
msgbox.btnok.removeEventListener(MouseEvent.CLICK, onok);
msgbox.visible = false;
top.gotoAndPlay(2);
}
public function getFlashVersion():Boolean{
var _local1:String;
var _local2:Array;
var _local3:Number;
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = Capabilities.version;
trace(("versionNumber: " + _local1));
_local2 = _local1.split(",");
_local3 = _local2.length;
_local4 = _local2[0].split(" ");
_local5 = parseInt(_local4[1]);
_local6 = parseInt(_local2[1]);
_local7 = parseInt(_local2[2]);
trace(("Platform: " + _local4[0]));
trace(("Major version: " + _local5));
trace(("Minor version: " + _local6));
trace(("Build number: " + _local7));
if ((((int(_local5) >= 10)) || (!(config.chk9)))){
return (true);
};
return (false);
}
public function showtop(_arg1:uint):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:*;
var _local7:*;
var _local8:String;
var _local9:uint;
_local2 = 0;
while (_local2 < 20) {
if (_local2 < topXML.tabs.tab[(_arg1 - 1)].item.length()){
lines[_local2].flag.gotoAndStop((int(topXML.tabs.tab[(_arg1 - 1)].item[_local2].@country) + 1));
if (String(topXML.tabs.tab[(_arg1 - 1)].item[_local2].@me) == "yes"){
lines[_local2].linebg.visible = true;
} else {
lines[_local2].linebg.visible = false;
};
if (int(topXML.tabs.tab[(_arg1 - 1)].item[_local2].@dildo) > 0){
lines[_local2].aw_dildo.visible = true;
lines[_local2].aw_dildo.gotoAndStop(int(topXML.tabs.tab[(_arg1 - 1)].item[_local2].@dildo));
} else {
lines[_local2].aw_dildo.visible = false;
};
if (int(topXML.tabs.tab[(_arg1 - 1)].item[_local2].@heart) > 0){
lines[_local2].aw_heart.visible = true;
lines[_local2].aw_heart.gotoAndStop(int(topXML.tabs.tab[(_arg1 - 1)].item[_local2].@heart));
} else {
lines[_local2].aw_heart.visible = false;
};
if (int(topXML.tabs.tab[(_arg1 - 1)].item[_local2].@stars) > 0){
lines[_local2].aw_stars.visible = true;
lines[_local2].aw_stars.gotoAndStop(int(topXML.tabs.tab[(_arg1 - 1)].item[_local2].@stars));
} else {
lines[_local2].aw_stars.visible = false;
};
lines[_local2].namearea.text = String(topXML.tabs.tab[(_arg1 - 1)].item[_local2].@name);
if (_arg1 == 4){
_local3 = int(topXML.tabs.tab[(_arg1 - 1)].item[_local2].@score);
_local4 = int((_local3 / 1000));
_local5 = int((_local4 / 60));
_local7 = String(_local5);
if (_local7.length == 1){
_local7 = ("0" + _local7);
};
_local6 = String((_local4 - (_local5 * 60)));
if (_local6.length == 1){
_local6 = ("0" + _local6);
};
_local8 = String(((_local3 - (1000 * _local4)) - (_local5 * 60)));
_local9 = 0;
while (_local9 < (3 - _local8.length)) {
_local8 = ("0" + _local6);
_local9++;
};
lines[_local2].scorearea.text = ((((_local7 + ":") + _local6) + ":") + _local8);
} else {
lines[_local2].scorearea.text = String(topXML.tabs.tab[(_arg1 - 1)].item[_local2].@score);
};
} else {
lines[_local2].aw_dildo.visible = false;
lines[_local2].aw_heart.visible = false;
lines[_local2].aw_stars.visible = false;
lines[_local2].linebg.visible = false;
lines[_local2].namearea.text = "";
lines[_local2].scorearea.text = "";
lines[_local2].flag.gotoAndStop(1);
};
_local2++;
};
}
public function loadXML(_arg1:Event):void{
trace(_arg1.target.data, "\ntopxml loaded\n\n");
topXML = new XML(_arg1.target.data);
loading.visible = false;
if (int(topXML.user.@win) > 0){
if (mySo.data.key != undefined){
if (String(topXML.user.@status) == "waitforname"){
waitforname(true);
} else {
top.gotoAndPlay(2);
};
} else {
if (aftergame){
waitforname();
} else {
top.gotoAndPlay(2);
};
};
} else {
top.gotoAndPlay(2);
};
}
public function FINEVENT(_arg1:Event):void{
var _local2:Array;
var _local3:uint;
_local2 = ["COME ON!", "HEY!", "START RECORDER!", "I`M WAITING!", "START ALREADY!", "I WANNA FUCK!", "PLAY WITH ME!"];
_local3 = int((Math.random() * _local2.length));
if (!gameover){
createmsg(_local2[_local3], 295, 400);
};
}
public function setcombomsg():void{
var _local1:String;
var _local2:MovieClip;
var _local3:Number;
var _local4:uint;
var _local5:uint;
var _local6:letter;
_local1 = "";
if (maineq.nonstopbeats > 1){
_local1 = (maineq.nonstopbeats + " HITS COMBO!");
};
if (maineq.nonstopbeats == a2){
mySo.data.achives[2] = true;
};
_local2 = (combomsg.getChildByName("emc") as MovieClip);
if (_local2 != null){
_local5 = 0;
while (_local5 < _local2.numChildren) {
_local2.removeChildAt(_local5);
_local5++;
};
combomsg.removeChild(_local2);
};
_local2 = new MovieClip();
_local2.name = "emc";
combomsg.addChild(_local2);
_local3 = 0;
_local4 = 0;
while (_local4 < _local1.length) {
if (_local1.charCodeAt(_local4) != 32){
_local6 = new letter(_local1.charCodeAt(_local4), _local3, 0);
_local6.cacheAsBitmap = true;
_local3 = (_local3 + _local6.width);
_local2.addChild(_local6);
_local6.setpos(1, ((25 * 60) * 60), combomsg);
} else {
_local3 = (_local3 + 17);
};
_local4++;
};
}
public function setmouth(_arg1:uint):void{
var _local2:Array;
var _local3:uint;
var _local4:uint;
var _local5:MovieClip;
_local2 = ["", "1", "2", "2_1", "2_2", "3"];
_local3 = 0;
while (_local3 < _local2.length) {
_local4 = 2;
while (_local4 < 4) {
_local5 = (getChildByName(("girl" + _local2[_local3])) as MovieClip);
trace(("girl" + _local2[_local3]), ("mouth" + _local4));
if (_arg1 == _local4){
(_local5.getChildByName(("mouth" + _local4)) as MovieClip).visible = true;
} else {
(_local5.getChildByName(("mouth" + _local4)) as MovieClip).visible = false;
};
_local4++;
};
_local3++;
};
}
public function soundCLICK(_arg1:Event):void{
var _local2:SoundTransform;
_local2 = new SoundTransform();
if (soundbtn.currentFrame == 1){
soundbtn.gotoAndStop(2);
_local2.volume = 0;
} else {
soundbtn.gotoAndStop(1);
_local2.volume = 1;
};
SoundMixer.soundTransform = _local2;
}
public function initupdate():void{
var md:Function;
var mu:Function;
md = function (_arg1:MouseEvent):void{
if (((!(updwindow.updbtn.hitTestPoint(_arg1.stageX, _arg1.stageY))) && (!(updwindow.helpbtn.hitTestPoint(_arg1.stageX, _arg1.stageY))))){
updwindow.startDrag(false, new Rectangle(-100, -70, 700, 500));
};
};
mu = function (_arg1:MouseEvent):void{
if (updwindow != null){
updwindow.stopDrag();
};
};
updwindow.updbtn.useHandCursor = true;
updwindow.updbtn.buttonMode = true;
updwindow.updbtn.addEventListener(MouseEvent.MOUSE_DOWN, function (_arg1:Event):void{
updwindow.updbtn.gotoAndStop(2);
});
updwindow.updbtn.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
navigateToURL(new URLRequest("http://www.adobe.com/go/EN_US-H-GET-FLASH"));
});
updwindow.updbtn.addEventListener(MouseEvent.MOUSE_UP, function (_arg1:Event):void{
updwindow.updbtn.gotoAndStop(1);
});
updwindow.helpbtn.useHandCursor = true;
updwindow.helpbtn.buttonMode = true;
updwindow.helpbtn.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:Event):void{
updwindow.helpbtn.gotoAndStop(2);
});
updwindow.helpbtn.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
navigateToURL(new URLRequest("http://www.adobe.com/products/flashplayer/"));
});
updwindow.helpbtn.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event):void{
updwindow.helpbtn.gotoAndStop(1);
});
updwindow.addEventListener(MouseEvent.MOUSE_DOWN, md);
stage.addEventListener(MouseEvent.MOUSE_UP, mu);
}
public function tdone(_arg1:Event):void{
var i:uint;
var tabCLICK:Function;
var e = _arg1;
tabCLICK = function (_arg1:Event):void{
settab(int(_arg1.target.parent.name.substr(3, 1)));
};
mmbtn.visible = true;
settab(int(topXML.user.@win));
i = 1;
while (i < 5) {
(top.getChildByName(("bar" + i)) as MovieClip).addEventListener(MouseEvent.CLICK, tabCLICK);
i = (i + 1);
};
}
public function achi_show1(_arg1:String):void{
var _local2:uint;
_local2 = int(_arg1.substr(4, 1));
mySo.data.achives_show[_local2] = !(mySo.data.achives_show[_local2]);
if (mySo.data.achives_show[1]){
mySo.data.achives_show[3] = true;
};
if (mySo.data.achives_show[2]){
mySo.data.achives_show[4] = true;
};
mySo.flush();
setMuny();
}
public function set_achi():void{
var i:uint;
var m:MovieClip;
if (mySo.data.achives[1]){
achi.line3.a.a3_text1.visible = false;
} else {
achi.line3.a.a3_text.visible = false;
};
if (mySo.data.achives[2]){
achi.line4.a.a4_text1.visible = false;
} else {
achi.line4.a.a4_text.visible = false;
};
i = 1;
while (i < 5) {
m = (achi.getChildByName(("line" + i)) as MovieClip);
if (mySo.data.achives[i]){
m.a.yes_on.visible = false;
m.a.no_on.visible = false;
m.a.no_off.visible = false;
m.a.yes_on.useHandCursor = true;
m.a.yes_on.buttonMode = true;
m.a.yes_off.useHandCursor = true;
m.a.yes_off.buttonMode = true;
m.a.yes_off.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:Event):void{
_arg1.target.parent.yes_on.visible = true;
});
m.a.yes_on.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
achi_show1(_arg1.target.parent.parent.name);
});
m.a.yes_on.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event):void{
_arg1.target.parent.yes_on.visible = false;
});
} else {
m.a.yes_on.visible = false;
m.a.yes_off.visible = false;
m.a.no_on.visible = false;
m.a.no_on.useHandCursor = true;
m.a.no_on.buttonMode = true;
m.a.no_off.useHandCursor = true;
m.a.no_off.buttonMode = true;
m.a.no_off.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:Event):void{
_arg1.target.parent.no_on.visible = true;
trace("1", _arg1.target.parent.no_on.x);
});
m.a.no_on.addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
achi_show(_arg1.target.parent.parent.name);
_arg1.target.parent.parent.gotoAndPlay((_arg1.target.parent.parent.currentFrame + 1));
});
m.a.no_on.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event):void{
_arg1.target.parent.no_on.visible = false;
});
};
i = (i + 1);
};
}
public function setcountmsg(_arg1:uint, _arg2:Boolean=true):void{
var _local3:String;
var _local4:uint;
var _local5:uint;
var _local6:MovieClip;
var _local7:Number;
var _local8:uint;
var _local9:letter;
var _local10:bang;
while (_arg1 > 999999) {
_arg1 = (_arg1 + -999999);
mln.visible = true;
};
if (gamemode == 1){
if ((((_arg1 >= a4)) && (mySo.data.achives[2]))){
mySo.data.achives[4] = true;
};
_local3 = String(_arg1);
_local4 = _local3.length;
_local5 = 0;
while (_local5 < (6 - _local4)) {
_local3 = ("0" + _local3);
_local5++;
};
_local6 = (countmsg.getChildByName("emc") as MovieClip);
if (_local6 != null){
_local8 = 0;
while (_local8 < _local6.numChildren) {
_local6.removeChildAt(_local8);
_local8++;
};
countmsg.removeChild(_local6);
};
_local6 = new MovieClip();
_local6.name = "emc";
countmsg.addChild(_local6);
_local7 = 0;
_local5 = 0;
while (_local5 < _local3.length) {
if (_local3.charCodeAt(_local5) != 32){
_local9 = new letter(_local3.charCodeAt(_local5), _local7, 0);
_local9.cacheAsBitmap = true;
_local7 = (_local7 + _local9.width);
_local6.addChild(_local9);
_local9.setpos(1, ((25 * 60) * 60), countmsg);
if (_arg2){
_local10 = new bang();
_local10.x = (_local9.x - 14);
_local10.y = (_local9.y - 15);
_local6.addChild(_local10);
};
} else {
_local7 = (_local7 + 17);
};
_local5++;
};
};
}
public function stageclck(_arg1:Event):void{
stage.removeEventListener(MouseEvent.CLICK, stageclck);
gotoAndStop(1, "Menu_");
}
public function COUNTEVENT1(_arg1:Event):void{
if (!gameover){
setcountmsg(maineq.count, false);
};
}
public function menuItemSelectHandler(_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest((((("http://tds.mutanky.com/?gameid=" + gameid) + "&version=") + version) + "&action=more-games")), "_blank");
}
public function mmu(_arg1:Event=null):void{
munnydrag = false;
Muny.stopDrag();
}
public function setopmsg(_arg1:Event=null):void{
var _local2:String;
var _local3:MovieClip;
var _local4:Number;
var _local5:uint;
var _local6:uint;
var _local7:letter;
_local2 = "";
if (maineq.ball.white.visible){
oppcounter++;
_local2 = (Math.abs(oppcounter) + " OPPOSITS!");
} else {
oppcounter = 0;
_local2 = "";
};
if (_arg1 != null){
oppcounter = 0;
_local2 = "";
};
_local3 = (opmsg.getChildByName("emc") as MovieClip);
if (_local3 != null){
_local6 = 0;
while (_local6 < _local3.numChildren) {
_local3.removeChildAt(_local6);
_local6++;
};
opmsg.removeChild(_local3);
};
_local3 = new MovieClip();
_local3.name = "emc";
opmsg.addChild(_local3);
_local4 = 0;
_local5 = 0;
while (_local5 < _local2.length) {
if (_local2.charCodeAt(_local5) != 32){
_local7 = new letter(_local2.charCodeAt(_local5), _local4, 0);
_local7.cacheAsBitmap = true;
_local4 = (_local4 + _local7.width);
_local3.addChild(_local7);
_local7.setpos(1, ((25 * 60) * 60), opmsg);
} else {
_local4 = (_local4 + 17);
};
_local5++;
};
_local3.scaleX = 0.5;
_local3.scaleY = 0.5;
}
public function COUNTEVENT(_arg1:Event):void{
if (!gameover){
setcountmsg(maineq.count);
};
}
public function MISSEVENT(_arg1:Event):void{
if (!gameover){
new miss().play();
lifeindicator.lg.visible = true;
lifeindicator.lg.y = (lifeindicator.lg.y + 19);
lifeindicator.lg.gotoAndPlay(1);
lifeindicator.lm.y = (lifeindicator.lg.y + (19 * 2));
if ((((lifeindicator.lm.y > 200)) && ((gamemode == 0)))){
removeEventListener(Event.ENTER_FRAME, EF);
gameover = true;
SoundMixer.stopAll();
maineq.finalize();
gametime = (getTimer() - maineq.starttime);
gamescore = maineq.count;
gamecombo = maineq.nonstopbeats;
gamespeed = maineq.speedrecord;
dark.visible = true;
dark.gotoAndPlay(1);
return;
};
if ((((lifeindicator.lm.y <= 200)) || ((gamemode == 1)))){
voldown = true;
if (maineq.nonstopbeats_cut >= 20){
g3fin = true;
};
ebar.y = (143 + 214);
setcombomsg();
createmsg("MISS", 295, 400);
if (girl1.visible){
watch1 = true;
};
if (girl2.visible){
watch2 = true;
};
if (((girl3.visible) && (g3fin))){
watch3 = true;
};
};
};
}
public function MAXSPEEDEVENT(_arg1:Event):void{
if (!gameover){
createmaxspeedmsg(maineq.speedrecord);
};
}
public function BANGEVENT(_arg1:Event):void{
if (!gameover){
if ((((maineq.currid == 0)) || ((maineq.currid == 7)))){
new hit_1().play();
};
if ((((maineq.currid == 1)) || ((maineq.currid == 6)))){
new hit_2().play();
};
if ((((maineq.currid == 2)) || ((maineq.currid == 5)))){
new hit_3().play();
};
if ((((maineq.currid == 3)) || ((maineq.currid == 4)))){
new hit_4().play();
};
if (maineq.nonstopbeats > maxcombo){
maxcombo = maineq.nonstopbeats;
};
if ((((((maineq.nonstopbeats < 33)) && ((maineq.nonstopbeats > 1)))) && ((gamemode == 0)))){
createmsg(msgs[msgslist[maineq.nonstopbeats][int((Math.random() * msgslist[maineq.nonstopbeats].length))]]);
};
setcombomsg();
ebar.y = 143;
ebar.visible = true;
if (maineq.nonstopbeats == 3){
schs[1].soundTransform = sndt_;
};
if (maineq.nonstopbeats == 5){
schs[2].soundTransform = sndt_;
};
if (maineq.nonstopbeats == 7){
schs[3].soundTransform = sndt_;
};
if (maineq.nonstopbeats == 10){
schs[4].soundTransform = sndt_;
schs[1].soundTransform = sndt;
};
if (maineq.nonstopbeats == 15){
schs[5].soundTransform = sndt_;
};
if (maineq.nonstopbeats_cut < 5){
if (int((Math.random() * 2)) == 1){
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_02_E().play();
mouthframeid = 0;
mouthid = 2;
mouthplay = true;
} else {
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_06_D().play();
mouthframeid = 0;
mouthid = 6;
mouthplay = true;
};
girl1.visible = true;
if (fr < 8){
girl1.gotoAndPlay(2);
} else {
if (fr < 23){
girl1.gotoAndPlay(3);
} else {
if (fr < 30){
girl1.gotoAndPlay(4);
} else {
girl1.gotoAndPlay(5);
};
};
};
} else {
if (maineq.nonstopbeats_cut < 10){
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_01_A().play();
mouthframeid = 0;
mouthid = 1;
mouthplay = true;
gotogirl2 = true;
} else {
if (maineq.nonstopbeats_cut < 15){
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_07_B().play();
mouthframeid = 0;
mouthid = 7;
mouthplay = true;
m3chain = 1;
m3chaincounter = 0;
gotogirl21 = true;
} else {
if (maineq.nonstopbeats_cut < 20){
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_02_E().play();
mouthframeid = 0;
mouthid = 2;
mouthplay = true;
m3chaincounter = 0;
m3chain = (maineq.nonstopbeats_cut - 13);
gotogirl21 = true;
} else {
if (maineq.nonstopbeats_cut < 26){
if (int((Math.random() * 2)) == 1){
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_09_C().play();
mouthframeid = 0;
mouthid = 9;
mouthplay = true;
} else {
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_08_C().play();
mouthframeid = 0;
mouthid = 8;
mouthplay = true;
};
} else {
if (mouthsch != null){
mouthsch.stop();
};
mouthsch = new v_03_D().play();
mouthframeid = 0;
mouthid = 3;
mouthplay = true;
};
gotogirl3 = true;
girl2_2.visible = true;
girl2_2.gotoAndPlay(1);
girl3.visible = false;
};
};
};
};
};
}
public function opp1(_arg1:Event):void{
zeroflash.visible = true;
zeroflash.x = 277;
zeroflash.scaleX = -1;
zeroflash.gotoAndPlay(1);
setopmsg();
setcountmsg(maineq.count);
}
public function opp2(_arg1:Event):void{
zeroflash.visible = true;
zeroflash.x = 422;
zeroflash.scaleX = 1;
zeroflash.gotoAndPlay(1);
setopmsg();
setcountmsg(maineq.count);
}
public function msg(_arg1:String):void{
var _local2:Number;
var _local3:uint;
var _local4:letter;
_local2 = 0;
_local3 = 0;
while (_local3 < _arg1.length) {
if (_arg1.charCodeAt(_local3) != 32){
_local4 = new letter(_arg1.charCodeAt(_local3), _local2, 0);
_local4.cacheAsBitmap = true;
_local2 = (_local2 + _local4.width);
loading.addChild(_local4);
_local4.setpos(1, int.MAX_VALUE, loading);
} else {
_local2 = (_local2 + 17);
};
_local3++;
};
loading.x = ((700 - loading.width) / 2);
}
public function showword(_arg1:Event):void{
var _local2:MovieClip;
var _local3:letter;
if (wordinfo[currid] != undefined){
_local2 = wordinfo[currid][0];
var _local4 = wordinfo[currid];
var _local5 = 1;
var _local6 = (_local4[_local5] + 1);
_local4[_local5] = _local6;
if (wordinfo[currid][1] < (_local2.numChildren - 1)){
_local3 = (_local2.getChildByName(("l_" + wordinfo[currid][1])) as letter);
if (_local3 == null){
_local4 = wordinfo[currid];
_local5 = 1;
_local6 = (_local4[_local5] + 1);
_local4[_local5] = _local6;
_local3 = (_local2.getChildByName(("l_" + wordinfo[currid][1])) as letter);
};
_local3.visible = true;
_local3.setpos(2, 2, _local2);
} else {
if ((btns.length - 1) > currid){
btns[(currid + 1)][1].addEventListener("DONE", showword, false, 0, true);
crmsg(btns[(currid + 1)][0], btns[(currid + 1)][1]);
};
};
};
}
public function makeloader():void{
rv.gameid = gameid;
rv.version = version;
rv.key = mySo.data.key;
rv.mode = gamemode;
rv.time = gametime;
rv.score = gamescore;
rv.combo = gamecombo;
rv.speed = gamespeed;
rv.ah1 = int(mySo.data.achives[1]);
rv.ah2 = int(mySo.data.achives[2]);
rv.ah3 = int(mySo.data.achives[3]);
rv.ah4 = int(mySo.data.achives[4]);
rq.data = rv;
rq.method = URLRequestMethod.POST;
}
public function onok2(_arg1:Event):void{
mySo.data.key = (String((Math.random() * 10)) + String((Math.random() * 10)));
msgbox.btncancel.removeEventListener(MouseEvent.CLICK, oncancel);
msgbox.btnok.removeEventListener(MouseEvent.CLICK, onok);
msgbox.visible = false;
loading = new MovieClip();
loading.name = "loading";
loading.y = 233;
addChild(loading);
msg("REGISTRATION... PLEASE WAIT");
rv.name = msgbox.editname.text;
makeloader();
trace(rq.data);
loader.load(rq);
}
public function waitforname(_arg1:Boolean=false):void{
msgbox.visible = true;
msgbox.msg.text = "CONGRATULATIONS!\nYou`ve got into the TOP20 with your result! Please enter your NICKNAME for the TABLE of RECORDS";
if (_arg1){
msgbox.btnok.addEventListener(MouseEvent.CLICK, reg);
} else {
msgbox.btnok.addEventListener(MouseEvent.CLICK, onok);
};
msgbox.btncancel.addEventListener(MouseEvent.CLICK, oncancel);
}
public function createmsg1(_arg1:String, _arg2:Number=0, _arg3:Number=400, _arg4:uint=20):void{
var doneEvt:Function;
var emc:MovieClip;
var i:uint;
var l:letter;
var mess = _arg1;
var xx = _arg2;
var yy = _arg3;
var time = _arg4;
if (messagearea1.numChildren == 0){
doneEvt = function (_arg1:Event):void{
var _local2:uint;
_local2 = 0;
while (_local2 < emc.numChildren) {
emc.removeChildAt(_local2);
_local2++;
};
if (messagearea1.contains(emc)){
messagearea1.removeChild(emc);
};
};
xx = 0;
yy = 875;
messagearea1.addEventListener("DONE", doneEvt);
emc = new MovieClip();
messagearea1.addChild(emc);
i = 0;
while (i < mess.length) {
if (mess.charCodeAt(i) != 32){
l = new letter(mess.charCodeAt(i), xx, yy);
l.cacheAsBitmap = true;
xx = (xx + l.width);
emc.addChild(l);
l.setpos(1, time, messagearea1);
} else {
xx = (xx + 17);
};
i = (i + 1);
};
emc.scaleX = 0.5;
emc.scaleY = 0.5;
emc.x = ((700 - emc.width) / 2);
};
}
public function MunyMOVE(_arg1:MouseEvent):void{
muny_x = Muny.x;
if (!munnydrag){
if (sm_btn.hitTestPoint(_arg1.stageX, _arg1.stageY)){
sm_btn.y = 199;
} else {
sm_btn.y = 200;
};
if (rl_btn.hitTestPoint(_arg1.stageX, _arg1.stageY)){
rl_btn.y = 234;
} else {
rl_btn.y = 235;
};
if (ts_btn.hitTestPoint(_arg1.stageX, _arg1.stageY)){
ts_btn.y = 269;
} else {
ts_btn.y = 270;
};
if (mg_btn.hitTestPoint(_arg1.stageX, _arg1.stageY)){
mg_btn.y = 304;
} else {
mg_btn.y = 305;
};
if (ht_btn.hitTestPoint(_arg1.stageX, _arg1.stageY)){
ht_btn.y = 339;
} else {
ht_btn.y = 340;
};
if (ex_btn.hitTestPoint(_arg1.stageX, _arg1.stageY)){
ex_btn.y = 374;
} else {
ex_btn.y = 375;
};
};
}
public function settab(_arg1:uint):void{
var _local2:uint;
if (_arg1 == 0){
_arg1 = 1;
};
showtop(_arg1);
_local2 = 1;
while (_local2 < 5) {
if (_local2 != _arg1){
(top.getChildByName(("bar" + _local2)) as MovieClip).buttonMode = true;
(top.getChildByName(("bar" + _local2)) as MovieClip).useHandCursor = true;
(top.getChildByName(("tab" + _local2)) as MovieClip).visible = false;
} else {
(top.getChildByName(("bar" + _local2)) as MovieClip).buttonMode = false;
(top.getChildByName(("bar" + _local2)) as MovieClip).useHandCursor = false;
(top.getChildByName(("tab" + _local2)) as MovieClip).visible = true;
};
_local2++;
};
}
public function onok(_arg1:Event):void{
var e = _arg1;
mySo.data.key = (String((Math.random() * 10)) + String((Math.random() * 10)));
msgbox.btnok.removeEventListener(MouseEvent.CLICK, onok);
msgbox.btncancel.removeEventListener(MouseEvent.CLICK, oncancel);
try {
flushStatus = mySo.flush();
} catch(error:Error) {
trace("Error...Could not write SharedObject to disk\n");
};
if (flushStatus != null){
switch (flushStatus){
case SharedObjectFlushStatus.PENDING:
trace("Requesting permission to save object...\n");
mySo.addEventListener(NetStatusEvent.NET_STATUS, onFlushStatus);
break;
case SharedObjectFlushStatus.FLUSHED:
trace("Value flushed to disk.\n");
reg();
break;
};
};
}
}
}//package index_fla
Section 107
//menu_14 (index_fla.menu_14)
package index_fla {
import flash.display.*;
public dynamic class menu_14 extends MovieClip {
public function menu_14(){
addFrameScript(33, frame34);
}
function frame34(){
stop();
}
}
}//package index_fla
Section 108
//menu_records_178 (index_fla.menu_records_178)
package index_fla {
import flash.events.*;
import flash.display.*;
public dynamic class menu_records_178 extends MovieClip {
public var tab1:MovieClip;
public var tab3:MovieClip;
public var tab4:MovieClip;
public var tab2:MovieClip;
public var linesplace:MovieClip;
public var bar2:MovieClip;
public var bar3:MovieClip;
public var bar4:MovieClip;
public var bar1:MovieClip;
public var mmtext:MovieClip;
public function menu_records_178(){
addFrameScript(0, frame1, 35, frame36);
}
function frame1(){
stop();
}
function frame36(){
stop();
dispatchEvent(new Event("DONE"));
}
}
}//package index_fla
Section 109
//msgbtncancel_186 (index_fla.msgbtncancel_186)
package index_fla {
import flash.display.*;
public dynamic class msgbtncancel_186 extends MovieClip {
public function msgbtncancel_186(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 110
//msgbtnok_185 (index_fla.msgbtnok_185)
package index_fla {
import flash.display.*;
public dynamic class msgbtnok_185 extends MovieClip {
public function msgbtnok_185(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 111
//Muny_2 (index_fla.Muny_2)
package index_fla {
import flash.display.*;
public dynamic class Muny_2 extends MovieClip {
public var ah3:MovieClip;
public var ah2:MovieClip;
public var ah4:MovieClip;
public var ah1:MovieClip;
}
}//package index_fla
Section 112
//Muny_new_21 (index_fla.Muny_new_21)
package index_fla {
import flash.display.*;
public dynamic class Muny_new_21 extends MovieClip {
public var old:MovieClip;
}
}//package index_fla
Section 113
//okbtn_53 (index_fla.okbtn_53)
package index_fla {
import flash.display.*;
public dynamic class okbtn_53 extends MovieClip {
public function okbtn_53(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 114
//oppening_64 (index_fla.oppening_64)
package index_fla {
import flash.display.*;
import flash.media.*;
public dynamic class oppening_64 extends MovieClip {
public function oppening_64(){
addFrameScript(1, frame2, 4, frame5, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 14, frame15, 15, frame16, 18, frame19, 21, frame22, 22, frame23, 25, frame26, 28, frame29, 29, frame30, 32, frame33, 35, frame36, 36, frame37, 39, frame40, 42, frame43, 45, frame46, 46, frame47, 47, frame48, 50, frame51, 51, frame52, 54, frame55, 55, frame56, 58, frame59, 59, frame60, 61, frame62);
}
function frame10(){
stop();
}
function frame12(){
stop();
}
function frame15(){
stop();
}
function frame16(){
stop();
}
function frame8(){
stop();
}
function frame19(){
stop();
}
function frame26(){
stop();
}
function frame23(){
stop();
}
function frame5(){
stop();
}
function frame9(){
stop();
}
function frame22(){
stop();
}
function frame29(){
stop();
}
function frame2(){
stop();
}
function frame30(){
stop();
}
function frame36(){
stop();
}
function frame37(){
stop();
}
function frame11(){
stop();
}
function frame40(){
stop();
}
function frame43(){
stop();
}
function frame33(){
stop();
}
function frame47(){
stop();
}
function frame48(){
stop();
}
function frame46(){
stop();
}
function frame51(){
stop();
}
function frame52(){
stop();
}
function frame55(){
stop();
}
function frame56(){
stop();
}
function frame59(){
stop();
}
function frame62(){
SoundMixer.stopAll();
(parent as MovieClip).play();
}
function frame60(){
stop();
}
}
}//package index_fla
Section 115
//rb_130 (index_fla.rb_130)
package index_fla {
import flash.display.*;
public dynamic class rb_130 extends MovieClip {
public var other:MovieClip;
}
}//package index_fla
Section 116
//sm_btn_18 (index_fla.sm_btn_18)
package index_fla {
import flash.display.*;
public dynamic class sm_btn_18 extends MovieClip {
public var bg:MovieClip;
}
}//package index_fla
Section 117
//soundbtn_163 (index_fla.soundbtn_163)
package index_fla {
import flash.display.*;
public dynamic class soundbtn_163 extends MovieClip {
public function soundbtn_163(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 118
//Symbol10_171 (index_fla.Symbol10_171)
package index_fla {
import flash.display.*;
public dynamic class Symbol10_171 extends MovieClip {
public function Symbol10_171(){
addFrameScript(24, frame25);
}
function frame25(){
stop();
}
}
}//package index_fla
Section 119
//Symbol3_85 (index_fla.Symbol3_85)
package index_fla {
import flash.display.*;
public dynamic class Symbol3_85 extends MovieClip {
public function Symbol3_85(){
addFrameScript(49, frame50);
}
function frame50(){
stop();
}
}
}//package index_fla
Section 120
//Symbol5_90 (index_fla.Symbol5_90)
package index_fla {
import flash.display.*;
public dynamic class Symbol5_90 extends MovieClip {
public function Symbol5_90(){
addFrameScript(49, frame50);
}
function frame50(){
stop();
}
}
}//package index_fla
Section 121
//Symbol6_69 (index_fla.Symbol6_69)
package index_fla {
import flash.display.*;
public dynamic class Symbol6_69 extends MovieClip {
public function Symbol6_69(){
addFrameScript(23, frame24);
}
function frame24(){
stop();
}
}
}//package index_fla
Section 122
//Symbol7_93 (index_fla.Symbol7_93)
package index_fla {
import flash.display.*;
public dynamic class Symbol7_93 extends MovieClip {
public function Symbol7_93(){
addFrameScript(149, frame150);
}
function frame150(){
stop();
}
}
}//package index_fla
Section 123
//Symbol8_99 (index_fla.Symbol8_99)
package index_fla {
import flash.display.*;
public dynamic class Symbol8_99 extends MovieClip {
public function Symbol8_99(){
addFrameScript(49, frame50);
}
function frame50(){
stop();
}
}
}//package index_fla
Section 124
//Symbol9_103 (index_fla.Symbol9_103)
package index_fla {
import flash.display.*;
public dynamic class Symbol9_103 extends MovieClip {
public function Symbol9_103(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package index_fla
Section 125
//t1_66 (index_fla.t1_66)
package index_fla {
import flash.display.*;
public dynamic class t1_66 extends MovieClip {
public function t1_66(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 126
//t10_80 (index_fla.t10_80)
package index_fla {
import flash.display.*;
public dynamic class t10_80 extends MovieClip {
public function t10_80(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 127
//t11_81 (index_fla.t11_81)
package index_fla {
import flash.display.*;
public dynamic class t11_81 extends MovieClip {
public function t11_81(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 128
//t12_82 (index_fla.t12_82)
package index_fla {
import flash.display.*;
public dynamic class t12_82 extends MovieClip {
public function t12_82(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 129
//t13_83 (index_fla.t13_83)
package index_fla {
import flash.display.*;
public dynamic class t13_83 extends MovieClip {
public function t13_83(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 130
//t14_84 (index_fla.t14_84)
package index_fla {
import flash.display.*;
public dynamic class t14_84 extends MovieClip {
public function t14_84(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 131
//t15_88 (index_fla.t15_88)
package index_fla {
import flash.display.*;
public dynamic class t15_88 extends MovieClip {
public function t15_88(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 132
//t16_89 (index_fla.t16_89)
package index_fla {
import flash.display.*;
public dynamic class t16_89 extends MovieClip {
public function t16_89(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 133
//t17_91 (index_fla.t17_91)
package index_fla {
import flash.display.*;
public dynamic class t17_91 extends MovieClip {
public function t17_91(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 134
//t18_92 (index_fla.t18_92)
package index_fla {
import flash.display.*;
public dynamic class t18_92 extends MovieClip {
public function t18_92(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 135
//t19_94 (index_fla.t19_94)
package index_fla {
import flash.display.*;
public dynamic class t19_94 extends MovieClip {
public function t19_94(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 136
//t2_67 (index_fla.t2_67)
package index_fla {
import flash.display.*;
public dynamic class t2_67 extends MovieClip {
public function t2_67(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 137
//t20_95 (index_fla.t20_95)
package index_fla {
import flash.display.*;
public dynamic class t20_95 extends MovieClip {
public function t20_95(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 138
//t21_96 (index_fla.t21_96)
package index_fla {
import flash.display.*;
public dynamic class t21_96 extends MovieClip {
public function t21_96(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 139
//t22_97 (index_fla.t22_97)
package index_fla {
import flash.display.*;
public dynamic class t22_97 extends MovieClip {
public function t22_97(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 140
//t23_98 (index_fla.t23_98)
package index_fla {
import flash.display.*;
public dynamic class t23_98 extends MovieClip {
public function t23_98(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 141
//t24_100 (index_fla.t24_100)
package index_fla {
import flash.display.*;
public dynamic class t24_100 extends MovieClip {
public function t24_100(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 142
//t25_101 (index_fla.t25_101)
package index_fla {
import flash.display.*;
public dynamic class t25_101 extends MovieClip {
public function t25_101(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 143
//t26_102 (index_fla.t26_102)
package index_fla {
import flash.display.*;
public dynamic class t26_102 extends MovieClip {
public function t26_102(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 144
//t27_168 (index_fla.t27_168)
package index_fla {
import flash.display.*;
public dynamic class t27_168 extends MovieClip {
public function t27_168(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 145
//t28_169 (index_fla.t28_169)
package index_fla {
import flash.display.*;
public dynamic class t28_169 extends MovieClip {
public function t28_169(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 146
//t29_170 (index_fla.t29_170)
package index_fla {
import flash.display.*;
public dynamic class t29_170 extends MovieClip {
public function t29_170(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 147
//t3_68 (index_fla.t3_68)
package index_fla {
import flash.display.*;
public dynamic class t3_68 extends MovieClip {
public function t3_68(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 148
//t30_172 (index_fla.t30_172)
package index_fla {
import flash.display.*;
public dynamic class t30_172 extends MovieClip {
public function t30_172(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 149
//t31_174 (index_fla.t31_174)
package index_fla {
import flash.display.*;
public dynamic class t31_174 extends MovieClip {
public function t31_174(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 150
//t32_176 (index_fla.t32_176)
package index_fla {
import flash.display.*;
public dynamic class t32_176 extends MovieClip {
public function t32_176(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 151
//t33_177 (index_fla.t33_177)
package index_fla {
import flash.display.*;
public dynamic class t33_177 extends MovieClip {
public function t33_177(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 152
//t4_71 (index_fla.t4_71)
package index_fla {
import flash.display.*;
public dynamic class t4_71 extends MovieClip {
public function t4_71(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 153
//t5_72 (index_fla.t5_72)
package index_fla {
import flash.display.*;
public dynamic class t5_72 extends MovieClip {
public function t5_72(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 154
//t6_73 (index_fla.t6_73)
package index_fla {
import flash.display.*;
public dynamic class t6_73 extends MovieClip {
public function t6_73(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 155
//t7_76 (index_fla.t7_76)
package index_fla {
import flash.display.*;
public dynamic class t7_76 extends MovieClip {
public function t7_76(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 156
//t8_77 (index_fla.t8_77)
package index_fla {
import flash.display.*;
public dynamic class t8_77 extends MovieClip {
public function t8_77(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 157
//t9_79 (index_fla.t9_79)
package index_fla {
import flash.display.*;
public dynamic class t9_79 extends MovieClip {
public function t9_79(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 158
//update_55 (index_fla.update_55)
package index_fla {
import flash.display.*;
public dynamic class update_55 extends MovieClip {
public var helpbtn:MovieClip;
public var updbtn:MovieClip;
}
}//package index_fla
Section 159
//updbutton_56 (index_fla.updbutton_56)
package index_fla {
import flash.display.*;
public dynamic class updbutton_56 extends MovieClip {
public function updbutton_56(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 160
//white_152 (index_fla.white_152)
package index_fla {
import flash.display.*;
public dynamic class white_152 extends MovieClip {
public function white_152(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package index_fla
Section 161
//whoom_165 (index_fla.whoom_165)
package index_fla {
import flash.display.*;
public dynamic class whoom_165 extends MovieClip {
public function whoom_165(){
addFrameScript(12, frame13);
}
function frame13(){
stop();
visible = false;
}
}
}//package index_fla
Section 162
//window_184 (index_fla.window_184)
package index_fla {
import flash.display.*;
import flash.text.*;
public dynamic class window_184 extends MovieClip {
public var btnok:MovieClip;
public var msg:TextField;
public var editname:TextField;
public var btncancel:MovieClip;
}
}//package index_fla
Section 163
//windowinfo_51 (index_fla.windowinfo_51)
package index_fla {
import flash.display.*;
public dynamic class windowinfo_51 extends MovieClip {
public var okbtn:MovieClip;
}
}//package index_fla
Section 164
//bang (bang)
package {
import flash.display.*;
public dynamic class bang extends MovieClip {
public function bang(){
addFrameScript(9, frame10);
}
function frame10(){
visible = false;
}
}
}//package
Section 165
//bar_1 (bar_1)
package {
import flash.media.*;
public dynamic class bar_1 extends Sound {
}
}//package
Section 166
//bar_2 (bar_2)
package {
import flash.media.*;
public dynamic class bar_2 extends Sound {
}
}//package
Section 167
//bar_3 (bar_3)
package {
import flash.media.*;
public dynamic class bar_3 extends Sound {
}
}//package
Section 168
//bar_4 (bar_4)
package {
import flash.media.*;
public dynamic class bar_4 extends Sound {
}
}//package
Section 169
//beat1 (beat1)
package {
import flash.media.*;
public dynamic class beat1 extends Sound {
}
}//package
Section 170
//beat2 (beat2)
package {
import flash.media.*;
public dynamic class beat2 extends Sound {
}
}//package
Section 171
//beat3 (beat3)
package {
import flash.media.*;
public dynamic class beat3 extends Sound {
}
}//package
Section 172
//beat4 (beat4)
package {
import flash.media.*;
public dynamic class beat4 extends Sound {
}
}//package
Section 173
//beat5 (beat5)
package {
import flash.media.*;
public dynamic class beat5 extends Sound {
}
}//package
Section 174
//beat6 (beat6)
package {
import flash.media.*;
public dynamic class beat6 extends Sound {
}
}//package
Section 175
//configManager (configManager)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
public class configManager extends MovieClip {
var popupurl:String;// = ""
var areacontent:Dictionary;
public var chk9:Boolean;// = false
var configXML:XML;
var showonload:String;// = null
var areas:Dictionary;
var ver:uint;
var gid:String;
public function configManager(_arg1:String, _arg2:uint, _arg3:Stage):void{
var loader:URLLoader;
var ioErrorHandler:Function;
var loadXML:Function;
var gameid = _arg1;
var version = _arg2;
var st = _arg3;
configXML = <config></config>
;
areas = new Dictionary(true);
areacontent = new Dictionary(true);
showonload = null;
popupurl = "";
chk9 = false;
super();
ioErrorHandler = function (_arg1:Event):void{
trace("config fail");
};
loadXML = function (_arg1:Event):void{
var i:uint;
var k:uint;
var tmpfn:Function;
var e = _arg1;
trace(e.target.data);
configXML = new XML(e.target.data);
trace("config loaded\n\n");
if (String(configXML.settings.player.@chk9) == "yes"){
chk9 = true;
};
i = 0;
while (i < configXML.stages.stage.length()) {
k = 0;
while (k < configXML.stages.stage[i].banners.banner.length()) {
if (configXML.stages.stage[i].banners.banner[k].@autoload == "true"){
trace(((("get content " + configXML.stages.stage[i].@name) + " loc:") + configXML.stages.stage[i].banners.banner[k].@location));
getContent(configXML.stages.stage[i].@name, k, configXML.stages.stage[i].banners.banner[k].@location, configXML.stages.stage[i].banners.banner[k].@x, configXML.stages.stage[i].banners.banner[k].@y, configXML.stages.stage[i].banners.banner[k].@href);
};
if (configXML.stages.stage[i].@name == "popup"){
tmpfn = function (_arg1:Event):void{
if (popupurl != ""){
navigateToURL(new URLRequest(popupurl), "_blank");
};
st.removeEventListener(MouseEvent.CLICK, tmpfn);
};
st.addEventListener(MouseEvent.CLICK, tmpfn);
popupurl = configXML.stages.stage[i].banners.banner[k].@href;
};
k = (k + 1);
};
i = (i + 1);
};
};
gid = gameid;
ver = version;
loader = new URLLoader();
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, ioErrorHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.addEventListener(Event.COMPLETE, loadXML);
loader.load(new URLRequest(((("http://config.mutanky.com/?gameid=" + gameid) + "&version=") + version)));
}
function getContent(_arg1:String, _arg2:uint, _arg3:String, _arg4:Number, _arg5:Number, _arg6:String):void{
var loader:Loader;
var loadcontent:Function;
var id = _arg1;
var arrid = _arg2;
var loc = _arg3;
var x = _arg4;
var y = _arg5;
var href = _arg6;
loadcontent = function (_arg1:Event):void{
var bannerid:uint;
var e = _arg1;
if (areacontent[id] == undefined){
areacontent[id] = [];
};
e.target.content.x = x;
e.target.content.y = y;
e.target.content.href = href;
e.target.content.gameid = gid;
e.target.content.version = ver;
areacontent[id][arrid] = e.target.content;
if (showonload == id){
bannerid = int((Math.random() * areacontent[id].length));
areas[id].addChild(areacontent[id][bannerid]);
if (areacontent[id][bannerid].href != ""){
areacontent[id][bannerid].addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
navigateToURL(new URLRequest(areacontent[id][bannerid].href), "_blank");
});
};
};
trace("content loaded");
trace(("LOADED_" + id));
dispatchEvent(new Event(("LOADED_" + id)));
};
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadcontent);
loader.load(new URLRequest(loc));
}
public function addArea(_arg1:String, _arg2:MovieClip):void{
var bannerid:uint;
var i:uint;
var k:uint;
var id = _arg1;
var area = _arg2;
if (areas[id] == undefined){
areas[id] = area;
if (areacontent[id] == undefined){
areacontent[id] = [];
i = 0;
while (i < configXML.stages.stage.length()) {
if (String(configXML.stages.stage[i].@name) == id){
k = 0;
while (k < configXML.stages.stage[i].banners.banner.length()) {
getContent(configXML.stages.stage[i].@name, k, configXML.stages.stage[i].banners.banner[k].@location, configXML.stages.stage[i].banners.banner[k].@x, configXML.stages.stage[i].banners.banner[k].@y, configXML.stages.stage[i].banners.banner[k].@href);
k = (k + 1);
};
};
i = (i + 1);
};
};
};
bannerid = int((Math.random() * areacontent[id].length));
if (((((!((areacontent[id][bannerid] == null))) && (!((areacontent[id][bannerid] == undefined))))) && (!(area.contains(areacontent[id][bannerid]))))){
area.addChild(areacontent[id][bannerid]);
dispatchEvent(new Event(("LOADED_" + id)));
if (areacontent[id][bannerid].href != ""){
areacontent[id][bannerid].addEventListener(MouseEvent.CLICK, function (_arg1:Event):void{
navigateToURL(new URLRequest(areacontent[id][bannerid].href), "_blank");
});
};
} else {
showonload = id;
};
trace((("start " + id) + " area"));
}
}
}//package
Section 176
//fire (fire)
package {
import flash.display.*;
public class fire extends MovieClip {
}
}//package
Section 177
//fires (fires)
package {
public dynamic class fires extends fire {
public function fires(){
addFrameScript(14, frame15);
}
function frame15(){
stop();
}
}
}//package
Section 178
//hit_1 (hit_1)
package {
import flash.media.*;
public dynamic class hit_1 extends Sound {
}
}//package
Section 179
//hit_2 (hit_2)
package {
import flash.media.*;
public dynamic class hit_2 extends Sound {
}
}//package
Section 180
//hit_3 (hit_3)
package {
import flash.media.*;
public dynamic class hit_3 extends Sound {
}
}//package
Section 181
//hit_4 (hit_4)
package {
import flash.media.*;
public dynamic class hit_4 extends Sound {
}
}//package
Section 182
//letter (letter)
package {
import flash.events.*;
import flash.display.*;
public class letter extends MovieClip {
var y1:Number;
var sw;
var sh:uint;
var fmc:uint;// = 0
var area:MovieClip;
var x1;
var lifetime:uint;
var intype:uint;
public function letter(_arg1:uint, _arg2:Number, _arg3:Number):void{
fmc = 0;
super();
addFrameScript(0, frame1);
gotoAndStop((_arg1 - 33));
cacheAsBitmap = true;
x1 = _arg2;
y1 = _arg3;
}
function frame1(){
stop();
}
function EF(_arg1:Event):void{
fmc++;
if (fmc == 1){
width = 1;
height = 1;
} else {
if (fmc < 5){
width = int(((0.3 * (fmc - 1)) * sw));
height = int(((0.3 * (fmc - 1)) * sh));
x = (x1 - ((width - sw) / 2));
y = (y1 - ((height - sh) / 2));
};
};
if (fmc == 5){
width = int((1.2 * sw));
height = int((1.2 * sh));
x = (x1 - ((width - sw) / 2));
y = (y1 - ((height - sh) / 2));
};
if (fmc == 6){
width = int((1.1 * sw));
height = int((1.1 * sh));
x = (x1 - ((width - sw) / 2));
y = (y1 - ((height - sh) / 2));
};
if (fmc == 7){
x = (x + ((width - sw) / 2));
y = (y + ((height - sh) / 2));
width = sw;
height = sh;
};
if ((((((fmc == (lifetime + 5))) && (!((intype == 2))))) || ((((fmc == lifetime)) && ((intype == 2)))))){
if (area != null){
area.dispatchEvent(new Event("DONE"));
};
};
}
public function setpos(_arg1:uint, _arg2:uint, _arg3:MovieClip):void{
area = _arg3;
intype = _arg1;
lifetime = _arg2;
x = x1;
y = y1;
sw = width;
sh = height;
if (intype != 3){
addEventListener(Event.ENTER_FRAME, EF, false, 0, true);
};
}
}
}//package
Section 183
//main (main)
package {
public dynamic class main extends newgirl {
}
}//package
Section 184
//menu_music (menu_music)
package {
import flash.media.*;
public dynamic class menu_music extends Sound {
}
}//package
Section 185
//miss (miss)
package {
import flash.media.*;
public dynamic class miss extends Sound {
}
}//package
Section 186
//newgirl (newgirl)
package {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.Shapes.*;
import flash.events.*;
import flash.display.*;
import Box2D.Common.*;
import flash.utils.*;
import flash.geom.*;
public class newgirl extends MovieClip {
public var rb1:MovieClip;
public var eyes_id:uint;// = 3
var b_ring1_way:Number;// = 0
public var wtf1:MovieClip;
public var wtf2:MovieClip;
public var rb:MovieClip;
public var starttime:uint;
var fire:Boolean;// = false
var m_iterations:int;// = 25
var bricks:Array;
public var bar1:MovieClip;
public var bar2:MovieClip;
public var bar3:MovieClip;
public var bar6:MovieClip;
public var bar7:MovieClip;
public var bar8:MovieClip;
public var bar4:MovieClip;
public var bar5:MovieClip;
public var nonstopbeats:uint;// = 0
var get1000bonus:Boolean;// = false
var ball_y_prev;
var skiipzero:Boolean;// = false
public var gamemode:uint;// = 0
var speed1000bonus:uint;// = 0
var m_timeStep:Number;// = 0.04
public var currid:uint;
var zeroy:uint;// = 0
var m_sprite:Sprite;
var get1500bonus:Boolean;// = false
var worldAABB:b2AABB;
var direction_prev:Number;// = 0
var direction_curr:Number;// = 0
public var count:uint;// = 0
public var nonstopbeats_cut:uint;// = 0
public var direction_zero_amount:Number;// = 0
var cont:Boolean;// = false
public var circbody:b2Body;
var m_world:b2World;
public var speedrecord:uint;// = 0
public var smoke:MovieClip;
var direction_zero:Number;// = 0
var get2000bonus:Boolean;// = false
var get50fine:Boolean;// = false
public var firearea:MovieClip;
var nonstopmiss:uint;// = 0
var speedcounter:uint;// = 0
var ball_rot_prev:Number;
var speed50fine:uint;// = 0
var get2500bonus:Boolean;// = false
public var ball:MovieClip;
public function newgirl():void{
var MMHandler:Function;
var ground:b2Body;
var bd:b2BodyDef;
var circ:b2CircleDef;
var jd:b2RevoluteJointDef;
var i:int;
var angle:Number;
var tX:Number;
var tY:Number;
var rjd:b2RevoluteJointDef;
var sd:b2BoxDef;
var prevBody:b2Body;
var m_joint3:b2PrismaticJoint;
var yy:Number;
var L:Number;
var xx:Number;
eyes_id = 3;
starttime = getTimer();
count = 0;
bricks = [];
direction_curr = 0;
direction_prev = 0;
direction_zero = 0;
direction_zero_amount = 0;
skiipzero = false;
worldAABB = new b2AABB();
m_iterations = 25;
m_timeStep = (1 / 25);
fire = false;
cont = false;
nonstopbeats = 0;
nonstopbeats_cut = 0;
nonstopmiss = 0;
speedrecord = 0;
speedcounter = 0;
speed1000bonus = 0;
get1000bonus = false;
get1500bonus = false;
get2000bonus = false;
get2500bonus = false;
speed50fine = 0;
get50fine = false;
zeroy = 0;
gamemode = 0;
b_ring1_way = 0;
super();
MMHandler = function (_arg1:MouseEvent):void{
var _local2:Number;
_local2 = int((Math.abs((_arg1.stageX - 119)) / 58));
if (_local2 > 7){
_local2 = 7;
};
if (_local2 < 0){
_local2 = 0;
};
rb1.x = (_local2 * 58);
};
stage.scaleMode = StageScaleMode.NO_SCALE;
worldAABB.minVertex.Set(-1000, -1000);
worldAABB.maxVertex.Set(1000, 1000);
m_world = new b2World(worldAABB, new b2Vec2(0, 500), true);
m_sprite = new Sprite();
addChild(m_sprite);
addEventListener(MouseEvent.CLICK, CLICKHandler, false, 0, true);
wtf1.addEventListener(MouseEvent.CLICK, CLICKHandler, false, 0, true);
wtf2.addEventListener(MouseEvent.CLICK, CLICKHandler, false, 0, true);
ball.addEventListener(MouseEvent.CLICK, CLICKHandler, false, 0, true);
smoke.addEventListener(MouseEvent.CLICK, CLICKHandler, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_MOVE, MMHandler);
ground = m_world.m_groundBody;
circ = new b2CircleDef();
rjd = new b2RevoluteJointDef();
sd = new b2BoxDef();
prevBody = ground;
i = 1;
while (i < 9) {
(getChildByName(("bar" + i)) as MovieClip).barmask.y = 454;
i = (i + 1);
};
circ.radius = 15;
circ.density = 1;
circ.friction = 0;
circ.restitution = 1;
bd = new b2BodyDef();
bd.AddShape(circ);
jd = new b2RevoluteJointDef();
yy = 460;
L = 214;
zeroy = (yy - L);
xx = (350 - 119);
bd.position.Set(xx, yy);
bd.position.Set(xx, (yy - (2 * L)));
circbody = m_world.CreateBody(bd);
jd.anchorPoint.Set(xx, (yy - L));
jd.body1 = ground;
jd.body2 = circbody;
m_world.CreateJoint(jd);
}
public function finalize():void{
removeEventListener(Event.ENTER_FRAME, Update);
}
function cr(_arg1:Number):void{
var _local2:Number;
var _local3:b2BoxDef;
var _local4:b2BodyDef;
var _local5:b2Body;
var _local6:uint;
var _local7:uint;
var _local8:MovieClip;
_local2 = int((Math.abs((_arg1 - 119)) / 58));
if (_local2 > 7){
_local2 = 7;
};
if (_local2 < 0){
_local2 = 0;
};
fire = true;
_local3 = new b2BoxDef();
_local3.extents.Set(32, 5);
_local3.density = 15;
_local3.friction = 0;
_local4 = new b2BodyDef();
_local4.AddShape(_local3);
_local4.position.Set(((_local2 * 58) + 28), 500);
_local5 = m_world.CreateBody(_local4);
_local5.SetLinearVelocity(new b2Vec2(0, -500));
if ((((_local2 == 0)) || ((_local2 == 7)))){
_local6 = 0xFF;
};
if ((((_local2 == 1)) || ((_local2 == 6)))){
_local6 = 375;
};
if ((((_local2 == 2)) || ((_local2 == 5)))){
_local6 = 420;
};
if ((((_local2 == 3)) || ((_local2 == 4)))){
_local6 = 443;
};
currid = _local2;
bricks = [_local5, _local6];
_local7 = 1;
while (_local7 < 3) {
_local8 = (getChildByName(("bar" + ((currid + 1) + _local7))) as MovieClip);
if (_local8 != null){
_local8.bitagreen.alpha = (1 - (0.25 * _local7));
};
_local8 = (getChildByName(("bar" + ((currid + 1) - _local7))) as MovieClip);
if (_local8 != null){
_local8.bitagreen.alpha = (1 - (0.25 * _local7));
};
_local7++;
};
rb.other.visible = false;
dispatchEvent(new Event("EQCLICK"));
}
public function CLICKHandler(_arg1:MouseEvent):void{
if (!fire){
cr(_arg1.stageX);
};
}
public function Update(_arg1:Event):void{
var _local2:uint;
var _local3:uint;
var _local4:Number;
var _local5:b2ContactNode;
var _local6:Boolean;
var _local7:uint;
var _local8:uint;
var _local9:MovieClip;
var _local10:MovieClip;
var _local11:uint;
_local2 = 0;
while (_local2 < firearea.numChildren) {
if (((!((firearea.getChildAt(_local2) == null))) && (((firearea.getChildAt(_local2) as MovieClip).currentFrame == 15)))){
firearea.removeChildAt(_local2);
};
_local2++;
};
ball_y_prev = circbody.m_linearVelocity.y;
ball_rot_prev = smoke.rotation;
_local3 = int(Math.sqrt((Math.pow(circbody.m_linearVelocity.x, 2) + Math.pow(circbody.m_linearVelocity.y, 2))));
if (_local3 < 350){
eyes_id = 3;
} else {
if (_local3 < 700){
eyes_id = 2;
} else {
eyes_id = 1;
};
};
if (gamemode == 1){
if (_local3 > 500){
if (ball.white.currentFrame == 1){
ball.white.visible = true;
ball.white.gotoAndPlay(2);
};
} else {
ball.white.visible = false;
ball.white.gotoAndStop(1);
};
};
if (circbody.m_position.y > zeroy){
if (_local3 <= 50){
if (!get50fine){
dispatchEvent(new Event("FINE"));
if (count > 49){
count = (count + -50);
} else {
count = 0;
};
dispatchEvent(new Event("COUNT1"));
speed50fine++;
get50fine = true;
};
} else {
get50fine = false;
};
};
if ((((_local3 >= 1000)) && ((_local3 < 1500)))){
if (((((((!(get1000bonus)) && (!(get1500bonus)))) && (!(get2000bonus)))) && (!(get2500bonus)))){
dispatchEvent(new Event("BONUS1000"));
count = (count + 100);
dispatchEvent(new Event("COUNT"));
get1000bonus = true;
speed1000bonus++;
};
} else {
get1000bonus = false;
};
if ((((_local3 >= 1500)) && ((_local3 < 2000)))){
if (((((((!(get1000bonus)) && (!(get1500bonus)))) && (!(get2000bonus)))) && (!(get2500bonus)))){
dispatchEvent(new Event("BONUS1500"));
count = (count + 150);
dispatchEvent(new Event("COUNT"));
get1500bonus = true;
};
} else {
get1500bonus = false;
};
if ((((_local3 >= 2000)) && ((_local3 < 2500)))){
if (((((((!(get1000bonus)) && (!(get1500bonus)))) && (!(get2000bonus)))) && (!(get2500bonus)))){
dispatchEvent(new Event("BONUS2000"));
count = (count + 300);
dispatchEvent(new Event("COUNT"));
get2000bonus = true;
};
} else {
get2000bonus = false;
};
if (_local3 >= 2500){
if (((((((!(get1000bonus)) && (!(get1500bonus)))) && (!(get2000bonus)))) && (!(get2500bonus)))){
dispatchEvent(new Event("BONUS2500"));
count = (count + 500);
dispatchEvent(new Event("COUNT"));
get2500bonus = true;
};
} else {
get2500bonus = false;
};
if (_local3 > speedrecord){
speedrecord = _local3;
dispatchEvent(new Event("MAXSPEED"));
};
speedcounter = (speedcounter + (_local3 / 100));
_local4 = circbody.m_linearVelocity.y;
m_world.Step(m_timeStep, m_iterations);
_local5 = circbody.GetContactList();
_local6 = false;
if (_local5 != null){
if (_local5.other != null){
if (sign(ball_y_prev) == sign(circbody.m_linearVelocity.y)){
circbody.SetLinearVelocity(new b2Vec2(-(circbody.m_linearVelocity.x), -(circbody.m_linearVelocity.y)));
};
ball.flashes.visible = true;
ball.flashes.light.gotoAndPlay(2);
cont = true;
firearea.x = ball.x;
firearea.y = (ball.y + 18);
_local8 = 0;
while (_local8 < 10) {
_local9 = new fires();
_local9.x = (Math.random() * 8);
_local9.y = (Math.random() * 8);
_local9.scaleX = (0.7 + (Math.random() * 0.5));
_local9.scaleY = _local9.scaleX;
_local9.rotation = ((-45 + (Math.random() * 90)) + 180);
firearea.addChild(_local9);
_local8++;
};
_local6 = true;
};
};
ball.x = circbody.m_position.x;
ball.y = circbody.m_position.y;
ball.ballbody.rotation = (((circbody.m_rotation * 180) / Math.PI) + 45);
direction_prev = direction_curr;
smoke.rotation = (((circbody.m_rotation * 180) / Math.PI) + 90);
direction_curr = (smoke.rotation - ball_rot_prev);
if ((((direction_curr > 300)) && ((direction_prev < 0)))){
direction_curr = -1;
};
if ((((direction_curr < -300)) && ((direction_prev > 0)))){
direction_curr = 1;
};
if ((((smoke.rotation < ball_rot_prev)) && ((sign(smoke.rotation) == sign(ball_rot_prev))))){
smoke.scaleY = 1;
};
if ((((smoke.rotation > ball_rot_prev)) && ((sign(smoke.rotation) == sign(ball_rot_prev))))){
smoke.scaleY = -1;
};
_local7 = int(Math.sqrt((Math.pow(circbody.m_linearVelocity.y, 2) + Math.pow(circbody.m_linearVelocity.x, 2))));
if (_local7 > 400){
_local7 = (_local7 + -400);
} else {
_local7 = 50;
};
_local7 = int((_local7 / 50));
if (_local7 > 11){
_local7 = 11;
};
smoke.gotoAndStop(_local7);
if (bricks[0] != null){
if (((((((((_local6) || (!((bricks[0].m_linearVelocity.x == 0))))) || ((bricks[0].m_linearVelocity.y > 0)))) || (!((bricks[0].m_rotation == 0))))) || ((bricks[0].m_position.y < bricks[1])))){
m_world.DestroyBody(bricks[0]);
if (cont){
nonstopmiss = 0;
nonstopbeats++;
nonstopbeats_cut++;
if (nonstopbeats_cut > 32){
nonstopbeats_cut = 1;
};
if ((((currid == 0)) || ((currid == 7)))){
count = (count + (5 * nonstopbeats_cut));
};
if ((((currid == 1)) || ((currid == 6)))){
count = (count + (10 * nonstopbeats_cut));
};
if ((((currid == 2)) || ((currid == 5)))){
count = (count + (20 * nonstopbeats_cut));
};
if ((((currid == 3)) || ((currid == 4)))){
count = (count + (30 * nonstopbeats_cut));
};
dispatchEvent(new Event("BANG"));
dispatchEvent(new Event("COUNT"));
if (nonstopbeats == 2){
ball.ring1.visible = true;
ball.blik2.visible = true;
};
if (nonstopbeats == 3){
ball.l3.visible = true;
};
if (nonstopbeats == 6){
ball.l6.visible = true;
};
if (nonstopbeats == 8){
ball.l8.visible = true;
};
if (nonstopbeats == 9){
ball.ring2.visible = true;
};
_local11 = nonstopbeats;
if (_local11 > 8){
_local11 = 8;
};
ball.flashes.gotoAndStop(_local11);
} else {
ball.flashes.visible = false;
nonstopmiss++;
nonstopbeats = 0;
nonstopbeats_cut = 0;
dispatchEvent(new Event("MISS"));
ball.flashes.gotoAndStop(1);
ball.blik2.visible = false;
ball.ring1.visible = false;
ball.ring2.visible = false;
ball.l3.visible = false;
ball.l6.visible = false;
ball.l8.visible = false;
};
bricks[0] = null;
rb.x = 1000;
(getChildByName(("bar" + (currid + 1))) as MovieClip).barmask.y = 454;
_local8 = 1;
while (_local8 < 3) {
_local10 = (getChildByName(("bar" + ((currid + 1) + _local8))) as MovieClip);
if (_local10 != null){
_local10.barmask.y = (getChildByName(("bar" + (currid + 1))) as MovieClip).barmask.y;
};
_local10 = (getChildByName(("bar" + ((currid + 1) - _local8))) as MovieClip);
if (_local10 != null){
_local10.barmask.y = (getChildByName(("bar" + (currid + 1))) as MovieClip).barmask.y;
};
_local8++;
};
fire = false;
cont = false;
} else {
if (bricks[0].m_linearVelocity.y < 0){
rb.x = (bricks[0].m_position.x - 28);
rb.y = (bricks[0].m_position.y - 5);
(getChildByName(("bar" + (currid + 1))) as MovieClip).barmask.y = ((int(((rb.y - 14) / 12)) * 12) - 2);
_local8 = 1;
while (_local8 < 3) {
_local10 = (getChildByName(("bar" + ((currid + 1) + _local8))) as MovieClip);
if (_local10 != null){
_local10.barmask.y = (getChildByName(("bar" + (currid + 1))) as MovieClip).barmask.y;
};
_local10 = (getChildByName(("bar" + ((currid + 1) - _local8))) as MovieClip);
if (_local10 != null){
_local10.barmask.y = (getChildByName(("bar" + (currid + 1))) as MovieClip).barmask.y;
};
_local8++;
};
};
};
};
if ((((int(ball.y) == 459)) && (!(skiipzero)))){
if ((((direction_zero > 0)) && ((direction_curr > 0)))){
if (direction_zero_amount < 0){
direction_zero_amount = 0;
} else {
direction_zero_amount++;
count = (count + 100);
dispatchEvent(new Event("OPP"));
};
};
if ((((direction_zero < 0)) && ((direction_curr < 0)))){
if (direction_zero_amount > 0){
direction_zero_amount = 0;
} else {
direction_zero_amount--;
count = (count + 100);
dispatchEvent(new Event("OPP"));
};
};
if (sign(direction_zero) != sign(direction_curr)){
direction_zero_amount = 0;
if (ball.white.visible){
if (direction_zero > 0){
dispatchEvent(new Event("OPP1"));
} else {
dispatchEvent(new Event("OPP2"));
};
} else {
dispatchEvent(new Event("OPP"));
};
};
skiipzero = true;
direction_zero = direction_curr;
};
if (int(ball.y) != 459){
skiipzero = false;
};
}
public function init():void{
ball.white.visible = false;
ball.blik2.visible = false;
ball.ring1.visible = false;
ball.ring2.visible = false;
ball.l3.visible = false;
ball.l6.visible = false;
ball.l8.visible = false;
ball.flashes.visible = false;
nonstopbeats = 0;
nonstopbeats_cut = 0;
nonstopmiss = 0;
speedrecord = 0;
speedcounter = 0;
speed1000bonus = 0;
speed50fine = 0;
circbody.SetLinearVelocity(new b2Vec2(500, 0));
addEventListener(Event.ENTER_FRAME, Update, false, 0, true);
}
function sign(_arg1:Number):int{
if (_arg1 < 0){
return (-1);
};
return (1);
}
}
}//package
Section 187
//topline (topline)
package {
import flash.display.*;
import flash.text.*;
public dynamic class topline extends MovieClip {
public var aw_dildo:MovieClip;
public var scorearea:TextField;
public var aw_stars:MovieClip;
public var linebg:MovieClip;
public var flag:MovieClip;
public var namearea:TextField;
public var aw_heart:MovieClip;
}
}//package
Section 188
//v_01_A (v_01_A)
package {
import flash.media.*;
public dynamic class v_01_A extends Sound {
}
}//package
Section 189
//v_02_E (v_02_E)
package {
import flash.media.*;
public dynamic class v_02_E extends Sound {
}
}//package
Section 190
//v_03_D (v_03_D)
package {
import flash.media.*;
public dynamic class v_03_D extends Sound {
}
}//package
Section 191
//v_04_A (v_04_A)
package {
import flash.media.*;
public dynamic class v_04_A extends Sound {
}
}//package
Section 192
//v_05_B (v_05_B)
package {
import flash.media.*;
public dynamic class v_05_B extends Sound {
}
}//package
Section 193
//v_06_D (v_06_D)
package {
import flash.media.*;
public dynamic class v_06_D extends Sound {
}
}//package
Section 194
//v_07_B (v_07_B)
package {
import flash.media.*;
public dynamic class v_07_B extends Sound {
}
}//package
Section 195
//v_08_C (v_08_C)
package {
import flash.media.*;
public dynamic class v_08_C extends Sound {
}
}//package
Section 196
//v_09_C (v_09_C)
package {
import flash.media.*;
public dynamic class v_09_C extends Sound {
}
}//package