Section 1
//b2BoxDef (Box2D.Collision.Shapes.b2BoxDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2BoxDef extends b2ShapeDef {
public var extents:b2Vec2;
public function b2BoxDef(){
type = b2Shape.e_boxShape;
extents = new b2Vec2(1, 1);
}
}
}//package Box2D.Collision.Shapes
Section 2
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef)
package Box2D.Collision.Shapes {
public class b2CircleDef extends b2ShapeDef {
public var radius:Number;
public function b2CircleDef(){
type = b2Shape.e_circleShape;
radius = 1;
}
}
}//package Box2D.Collision.Shapes
Section 3
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class b2CircleShape extends b2Shape {
public var m_localPosition:b2Vec2;
public var m_radius:Number;
public function b2CircleShape(_arg1:b2ShapeDef, _arg2:b2Body, _arg3:b2Vec2){
var _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.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
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.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
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 = 0xFFFF;
public static const b2_invalid:uint = 0xFFFF;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:b2Proxy;
var _local7:int;
m_pairManager = new b2PairManager();
m_proxyPool = new Array(b2Settings.b2_maxPairs);
m_bounds = new Array((2 * b2Settings.b2_maxProxies));
m_queryResults = new Array(b2Settings.b2_maxProxies);
m_quantizationFactor = new b2Vec2();
super();
m_pairManager.Initialize(this, _arg2);
m_worldAABB = _arg1;
m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
m_queryResults[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
_local4 = _arg1.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 = 8;
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.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2CircleContact extends b2Contact {
public var m_manifold:Array;
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifold = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold[0].pointCount = 0;
m_manifold[0].points[0].normalImpulse = 0;
m_manifold[0].points[0].tangentImpulse = 0;
}
override public function 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.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2Contact {
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_prev:b2Contact;
public var m_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.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var restitution:Number;
public var body1:b2Body;
public var manifold:b2Manifold;
public var normal:b2Vec2;
public var body2:b2Body;
public var friction:Number;
public var pointCount:int;
public function b2ContactConstraint(){
var _local1:int;
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 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.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactSolver {
public var m_constraintCount:int;
public var m_constraints:Array;
public var m_allocator;
public 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.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolyAndCircleContact extends b2Contact {
public var m_manifold:Array;
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifold = [new b2Manifold()];
super(_arg1, _arg2);
b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polyShape));
b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape));
m_manifold[0].pointCount = 0;
m_manifold[0].points[0].normalImpulse = 0;
m_manifold[0].points[0].tangentImpulse = 0;
}
override public function 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.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
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.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.Joints.*;
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.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.*;
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.Contacts.*;
import Box2D.Dynamics.Joints.*;
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.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.*;
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
//CollisonVO (com.geekglue.Box2Utils.VO.CollisonVO)
package com.geekglue.Box2Utils.VO {
import Box2D.Dynamics.*;
public class CollisonVO {
public var body:b2Body;
public var full_type:String;// = ""
public var name:String;// = ""
public var type:String;
public function CollisonVO(_arg1:b2Body, _arg2:String, _arg3:String="NA"){
name = "";
full_type = "";
super();
this.body = _arg1;
this.type = _arg2;
if (_arg3 == "NA"){
this.full_type = this.type;
} else {
this.full_type = _arg3;
};
}
}
}//package com.geekglue.Box2Utils.VO
Section 64
//StyleVO (com.geekglue.Box2Utils.VO.StyleVO)
package com.geekglue.Box2Utils.VO {
public class StyleVO {
public var fill_alpha:Number;// = 1
public var fill_color:Number;// = 0xFFFFFF
public var stroke_alpha:Number;// = 1
public var stroke_color:Number;// = 0
public var stroke_weight:Number;// = 1
public function StyleVO(){
fill_alpha = 1;
fill_color = 0xFFFFFF;
stroke_alpha = 1;
stroke_color = 0;
stroke_weight = 1;
super();
}
}
}//package com.geekglue.Box2Utils.VO
Section 65
//Box2CircleBodyDef (com.geekglue.Box2Utils.Box2CircleBodyDef)
package com.geekglue.Box2Utils {
import flash.display.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import com.geekglue.Box2Utils.VO.*;
public class Box2CircleBodyDef extends b2BodyDef {
public function Box2CircleBodyDef(_arg1:b2CircleDef, _arg2:StyleVO, _arg3:MovieClip, _arg4:Number=0, _arg5:Number=0, _arg6:Number=0){
var _local7:Box2DCircle;
super();
this.rotation = _arg4;
this.position.Set(_arg5, _arg6);
this.AddShape(_arg1);
if (_arg3 == null){
_local7 = new Box2DCircle(_arg1.radius, _arg2);
this.userData = _local7;
} else {
this.userData = _arg3;
};
this.userData.cacheAsBitmap = true;
this.userData.width = (_arg1.radius * 2);
this.userData.height = (_arg1.radius * 2);
}
}
}//package com.geekglue.Box2Utils
Section 66
//Box2DCircle (com.geekglue.Box2Utils.Box2DCircle)
package com.geekglue.Box2Utils {
import flash.display.*;
import com.geekglue.Box2Utils.VO.*;
public class Box2DCircle extends Sprite {
public function Box2DCircle(_arg1:Number, _arg2:StyleVO){
var _local3:Number;
var _local4:Number;
super();
this.cacheAsBitmap = true;
_local3 = (_arg1 * -1);
_local4 = (_arg1 * -1);
this.graphics.lineStyle(_arg2.stroke_weight, _arg2.stroke_color, _arg2.stroke_alpha);
this.graphics.beginFill(_arg2.fill_color, _arg2.fill_alpha);
this.graphics.drawCircle(0, 0, _arg1);
this.graphics.moveTo(0, 0);
this.graphics.lineTo(0, _local4);
}
}
}//package com.geekglue.Box2Utils
Section 67
//Box2DRectangle (com.geekglue.Box2Utils.Box2DRectangle)
package com.geekglue.Box2Utils {
import flash.display.*;
import com.geekglue.Box2Utils.VO.*;
public class Box2DRectangle extends Sprite {
public function Box2DRectangle(_arg1:Number, _arg2:Number, _arg3:StyleVO){
var _local4:Number;
var _local5:Number;
super();
this.cacheAsBitmap = true;
_local4 = ((_arg1 / 2) * -1);
_local5 = ((_arg2 / 2) * -1);
this.graphics.beginFill(_arg3.fill_color, _arg3.fill_alpha);
this.graphics.lineStyle(_arg3.stroke_weight, _arg3.stroke_color, _arg3.stroke_alpha);
this.graphics.drawRect(_local4, _local5, _arg1, _arg2);
}
}
}//package com.geekglue.Box2Utils
Section 68
//Box2RectangleBodyDef (com.geekglue.Box2Utils.Box2RectangleBodyDef)
package com.geekglue.Box2Utils {
import flash.display.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import com.geekglue.Box2Utils.VO.*;
public class Box2RectangleBodyDef extends b2BodyDef {
public function Box2RectangleBodyDef(_arg1:b2BoxDef, _arg2:StyleVO, _arg3:MovieClip, _arg4:Number=0, _arg5:Number=0, _arg6:Number=0, _arg7:Number=20, _arg8:Number=20){
var _local9:Box2DRectangle;
super();
this.rotation = _arg4;
this.position.Set(_arg5, _arg6);
this.AddShape(_arg1);
if (_arg3 == null){
_local9 = new Box2DRectangle(_arg7, _arg8, _arg2);
this.userData = _local9;
} else {
this.userData = _arg3;
};
this.userData.cacheAsBitmap = true;
this.userData.width = _arg7;
this.userData.height = _arg8;
}
}
}//package com.geekglue.Box2Utils
Section 69
//Balloon01 (com.geekglue.pMotion.Assets.Balloon01)
package com.geekglue.pMotion.Assets {
import flash.display.*;
public class Balloon01 extends BalloonBase {
public var BalloonBase01:MovieClip;
public function Balloon01(){
this.cacheAsBitmap = true;
}
}
}//package com.geekglue.pMotion.Assets
Section 70
//BalloonBase (com.geekglue.pMotion.Assets.BalloonBase)
package com.geekglue.pMotion.Assets {
import flash.display.*;
public class BalloonBase extends MovieClip {
public var speed:Number;// = 0.1
public function BalloonBase(){
speed = 0.1;
super();
this.cacheAsBitmap = true;
}
}
}//package com.geekglue.pMotion.Assets
Section 71
//BeachBall (com.geekglue.pMotion.Assets.BeachBall)
package com.geekglue.pMotion.Assets {
import flash.display.*;
public class BeachBall extends MovieClip {
public function BeachBall(){
this.cacheAsBitmap = true;
}
}
}//package com.geekglue.pMotion.Assets
Section 72
//BonusItem (com.geekglue.pMotion.Assets.BonusItem)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
public class BonusItem extends MovieClip {
public var yPos:Number;// = 0
private var frame_max:Number;// = 178
public var star_mc:MovieClip;
public var xPos:Number;// = 0
public var hit_state:Boolean;// = true
public function BonusItem(_arg1:Number=0, _arg2:Number=0){
xPos = 0;
yPos = 0;
frame_max = 178;
hit_state = true;
addFrameScript(178, frame179);
super();
this.xPos = _arg1;
this.yPos = _arg2;
this.addEventListener(Event.ADDED_TO_STAGE, added_handler);
}
private function added_handler(_arg1:Event):void{
var _local2:Number;
this.removeEventListener(Event.ADDED_TO_STAGE, added_handler);
_local2 = Math.round((Math.random() * frame_max));
this.gotoAndPlay(_local2);
}
function frame179(){
this.gotoAndPlay(1);
}
}
}//package com.geekglue.pMotion.Assets
Section 73
//BtnSound01 (com.geekglue.pMotion.Assets.BtnSound01)
package com.geekglue.pMotion.Assets {
import flash.net.*;
import flash.media.*;
public class BtnSound01 extends Sound {
public function BtnSound01(_arg1:URLRequest=null, _arg2:SoundLoaderContext=null){
super(_arg1, _arg2);
}
}
}//package com.geekglue.pMotion.Assets
Section 74
//Bumper (com.geekglue.pMotion.Assets.Bumper)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
import Box2D.Common.Math.*;
import com.geekglue.pMotion.Model.*;
public class Bumper extends MovieClip {
private var model:ModelLocator;
public function Bumper(){
model = ModelLocator.getInstance();
super();
this.cacheAsBitmap = false;
this.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
this.addEventListener(MouseEvent.MOUSE_OUT, mouse_out_handler);
}
private function mouse_down_handler(_arg1:MouseEvent):void{
model.drag_offset = new b2Vec2(this.mouseX, this.mouseY);
model.drag_object = this;
}
private function mouse_out_handler(_arg1:MouseEvent):void{
model.drag_object = null;
}
}
}//package com.geekglue.pMotion.Assets
Section 75
//ClickerSkin (com.geekglue.pMotion.Assets.ClickerSkin)
package com.geekglue.pMotion.Assets {
import flash.display.*;
public class ClickerSkin extends MovieClip {
public function ClickerSkin(){
this.cacheAsBitmap = true;
}
}
}//package com.geekglue.pMotion.Assets
Section 76
//ControlButton (com.geekglue.pMotion.Assets.ControlButton)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
public class ControlButton extends MovieClip {
private var _over_state:String;// = "off"
private var _btn_type:String;// = "play"
public function ControlButton(){
_btn_type = "play";
_over_state = "off";
super();
this.cacheAsBitmap = true;
this.addEventListener(MouseEvent.MOUSE_OVER, mouse_over_handler);
this.addEventListener(MouseEvent.MOUSE_OUT, mouse_out_handler);
}
public function get btn_type():String{
return (_btn_type);
}
private function mouse_over_handler(_arg1:MouseEvent):void{
if (this.enabled){
over_state = "over";
};
}
public function get over_state():String{
return (_over_state);
}
public function enable():void{
this.enabled = true;
this.tabEnabled = true;
over_state = "off";
update_skin();
}
private function update_skin():void{
this.gotoAndStop(((btn_type + "_") + over_state));
}
public function set btn_type(_arg1:String):void{
_btn_type = _arg1;
update_skin();
}
public function set over_state(_arg1:String):void{
_over_state = _arg1;
update_skin();
}
private function mouse_out_handler(_arg1:MouseEvent):void{
if (this.enabled){
over_state = "off";
};
}
public function disable():void{
this.enabled = false;
this.tabEnabled = false;
over_state = "disabled";
update_skin();
}
}
}//package com.geekglue.pMotion.Assets
Section 77
//DeathWheel (com.geekglue.pMotion.Assets.DeathWheel)
package com.geekglue.pMotion.Assets {
import flash.display.*;
public class DeathWheel extends MovieClip {
public function DeathWheel(){
addFrameScript(0, frame1, 1, frame2, 4, frame5);
super();
this.cacheAsBitmap = true;
}
public function victory():void{
this.gotoAndStop("victory");
}
public function push():void{
this.gotoAndPlay("push");
}
function frame1(){
stop();
}
public function wait():void{
this.gotoAndStop("start");
}
function frame5(){
}
function frame2(){
stop();
}
public function hold():void{
this.gotoAndStop("hold");
}
}
}//package com.geekglue.pMotion.Assets
Section 78
//FanRH (com.geekglue.pMotion.Assets.FanRH)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
import Box2D.Common.Math.*;
import com.geekglue.pMotion.Model.*;
public class FanRH extends MovieClip {
private var model:ModelLocator;
public function FanRH(){
model = ModelLocator.getInstance();
super();
this.cacheAsBitmap = false;
this.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
this.addEventListener(MouseEvent.MOUSE_OUT, mouse_out_handler);
}
private function mouse_down_handler(_arg1:MouseEvent):void{
model.drag_offset = new b2Vec2(this.mouseX, this.mouseY);
model.drag_object = this;
}
private function mouse_out_handler(_arg1:MouseEvent):void{
}
}
}//package com.geekglue.pMotion.Assets
Section 79
//FXCrash (com.geekglue.pMotion.Assets.FXCrash)
package com.geekglue.pMotion.Assets {
import flash.net.*;
import flash.media.*;
public class FXCrash extends Sound {
public function FXCrash(_arg1:URLRequest=null, _arg2:SoundLoaderContext=null){
super(_arg1, _arg2);
}
}
}//package com.geekglue.pMotion.Assets
Section 80
//FXDrum (com.geekglue.pMotion.Assets.FXDrum)
package com.geekglue.pMotion.Assets {
import flash.net.*;
import flash.media.*;
public class FXDrum extends Sound {
public function FXDrum(_arg1:URLRequest=null, _arg2:SoundLoaderContext=null){
super(_arg1, _arg2);
}
}
}//package com.geekglue.pMotion.Assets
Section 81
//FXShoot (com.geekglue.pMotion.Assets.FXShoot)
package com.geekglue.pMotion.Assets {
import flash.net.*;
import flash.media.*;
public class FXShoot extends Sound {
public function FXShoot(_arg1:URLRequest=null, _arg2:SoundLoaderContext=null){
super(_arg1, _arg2);
}
}
}//package com.geekglue.pMotion.Assets
Section 82
//FXSpring (com.geekglue.pMotion.Assets.FXSpring)
package com.geekglue.pMotion.Assets {
import flash.net.*;
import flash.media.*;
public class FXSpring extends Sound {
public function FXSpring(_arg1:URLRequest=null, _arg2:SoundLoaderContext=null){
super(_arg1, _arg2);
}
}
}//package com.geekglue.pMotion.Assets
Section 83
//JumpLH_mc (com.geekglue.pMotion.Assets.JumpLH_mc)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
import Box2D.Common.Math.*;
import com.geekglue.pMotion.Model.*;
import flash.geom.*;
public class JumpLH_mc extends MovieClip {
private var model:ModelLocator;
public function JumpLH_mc(){
model = ModelLocator.getInstance();
super();
this.cacheAsBitmap = false;
this.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
this.addEventListener(MouseEvent.MOUSE_OUT, mouse_out_handler);
}
private function mouse_down_handler(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:Number;
var _local4:Number;
_local2 = new Point(this.mouseX, this.mouseY);
_local2 = this.localToGlobal(_local2);
_local3 = (_local2.x - this.x);
_local4 = (_local2.y - this.y);
model.drag_offset = new b2Vec2(_local3, _local4);
model.drag_object = this;
}
private function mouse_out_handler(_arg1:MouseEvent):void{
model.drag_object = null;
}
}
}//package com.geekglue.pMotion.Assets
Section 84
//JumpRH_mc (com.geekglue.pMotion.Assets.JumpRH_mc)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
import Box2D.Common.Math.*;
import com.geekglue.pMotion.Model.*;
import flash.geom.*;
public class JumpRH_mc extends MovieClip {
private var model:ModelLocator;
public function JumpRH_mc(){
model = ModelLocator.getInstance();
super();
this.cacheAsBitmap = false;
this.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
this.addEventListener(MouseEvent.MOUSE_OUT, mouse_out_handler);
this.addEventListener(MouseEvent.MOUSE_UP, mouse_out_handler);
}
private function mouse_down_handler(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:Number;
var _local4:Number;
_local2 = new Point(this.mouseX, this.mouseY);
_local2 = this.localToGlobal(_local2);
_local3 = (_local2.x - this.x);
_local4 = (_local2.y - this.y);
model.drag_offset = new b2Vec2(_local3, _local4);
model.drag_object = this;
}
private function mouse_out_handler(_arg1:MouseEvent):void{
}
}
}//package com.geekglue.pMotion.Assets
Section 85
//KingButton (com.geekglue.pMotion.Assets.KingButton)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
import com.geekglue.pMotion.Model.*;
import flash.utils.*;
import flash.filters.*;
public class KingButton extends MovieClip {
private var shut_timer:Timer;
private var _over_state:String;// = "off"
private var open_timer:Timer;
private var model:ModelLocator;
private var speed_Y:Number;// = 20
private var blur:BlurFilter;
private var btn_sound:BtnSound01;
public var shut_Y:Number;// = -250
public var open_Y:Number;// = 0
private var behaviour:String;// = "static"
private var _btn_type:String;// = "king"
public function KingButton(_arg1:String="static"){
model = ModelLocator.getInstance();
_btn_type = "king";
_over_state = "off";
behaviour = "static";
open_Y = 0;
shut_Y = -250;
speed_Y = 20;
addFrameScript(0, frame1);
super();
this.cacheAsBitmap = true;
behaviour = _arg1;
open_timer = new Timer(5);
open_timer.addEventListener(TimerEvent.TIMER, open);
shut_timer = new Timer(5);
shut_timer.addEventListener(TimerEvent.TIMER, shut);
blur = new BlurFilter();
blur.blurX = 10;
blur.blurY = 10;
blur.quality = BitmapFilterQuality.MEDIUM;
btn_sound = new BtnSound01();
this.addEventListener(MouseEvent.MOUSE_OVER, mouse_over_handler);
this.addEventListener(MouseEvent.MOUSE_OUT, mouse_out_handler);
this.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
model.addEventListener(ModelLocator.KING_BTN_UPDATE_EVENT, king_button_update_handler);
}
private function mouse_down_handler(_arg1:MouseEvent):void{
if (model.music_loop_state){
btn_sound.play();
};
}
public function get btn_type():String{
return (_btn_type);
}
private function mouse_over_handler(_arg1:MouseEvent):void{
if (this.enabled){
over_state = "over";
};
}
function frame1(){
stop();
}
public function get over_state():String{
return (_over_state);
}
private function open(_arg1:TimerEvent):void{
if (this.y < this.open_Y){
this.y = (this.y + this.speed_Y);
} else {
this.y = this.open_Y;
this.open_timer.stop();
this.filters = null;
};
}
public function enable():void{
this.enabled = true;
this.tabEnabled = true;
over_state = "off";
update_skin();
}
private function update_skin():void{
this.gotoAndStop(((btn_type + "_") + over_state));
}
private function shut(_arg1:TimerEvent):void{
if (this.y > this.shut_Y){
this.y = (this.y - this.speed_Y);
} else {
this.y = this.shut_Y;
this.shut_timer.stop();
this.filters = null;
};
}
public function set over_state(_arg1:String):void{
_over_state = _arg1;
update_skin();
}
private function mouse_out_handler(_arg1:MouseEvent):void{
if (this.enabled){
over_state = "off";
};
}
private function king_button_update_handler(_arg1:Event):void{
if (behaviour == "dynamic"){
switch (model.king_btn_state){
case "open":
this.filters = [blur];
shut_timer.stop();
open_timer.start();
break;
case "shut":
this.filters = [blur];
open_timer.stop();
shut_timer.start();
break;
};
};
}
public function set btn_type(_arg1:String):void{
_btn_type = _arg1;
update_skin();
}
public function disable():void{
this.enabled = false;
this.tabEnabled = false;
over_state = "disabled";
update_skin();
}
}
}//package com.geekglue.pMotion.Assets
Section 86
//MapButton (com.geekglue.pMotion.Assets.MapButton)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.View.Levels.*;
import flash.utils.*;
import com.geekglue.pMotion.View.*;
import flash.filters.*;
public class MapButton extends MovieClip {
public var tooltip:MapLevelTooltip;
private var model:ModelLocator;
private var filter_state:String;// = "grow"
private var _over_state:String;// = "off"
private var available_timer:Timer;
private var btn_sound:BtnSound01;
private var filter_strength:Number;// = 4
private var timer_interval:Number;// = 120
public var level:LevelBase;
private var glow_filter:GlowFilter;
private var _btn_type:String;// = "play"
private var filter_blur:Number;// = 12
public var enable_state:String;// = "enabled"
public function MapButton(){
model = ModelLocator.getInstance();
_btn_type = "play";
enable_state = "enabled";
_over_state = "off";
timer_interval = 120;
filter_blur = 12;
filter_strength = 4;
filter_state = "grow";
super();
this.cacheAsBitmap = true;
btn_sound = new BtnSound01();
available_timer = new Timer(timer_interval);
available_timer.addEventListener(TimerEvent.TIMER, available_handler);
this.addEventListener(MouseEvent.MOUSE_OVER, mouse_over_handler);
this.addEventListener(MouseEvent.MOUSE_OUT, mouse_out_handler);
this.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
}
private function mouse_down_handler(_arg1:MouseEvent):void{
var _local2:SoundTransform;
if (model.music_loop_state){
_local2 = new SoundTransform(0.5);
btn_sound.play(0, 0, _local2);
};
}
public function get btn_type():String{
return (_btn_type);
}
private function mouse_over_handler(_arg1:MouseEvent):void{
if (enable_state == "enabled"){
over_state = "over";
};
}
public function get over_state():String{
return (_over_state);
}
public function enable():void{
enable_state = "enabled";
over_state = "off";
update_skin();
}
private function update_skin():void{
this.gotoAndStop(((btn_type + "_") + over_state));
if (this.level){
if ((((enable_state == "enabled")) && ((this.level.points == 0)))){
glow_filter = new GlowFilter();
glow_filter.alpha = 0;
glow_filter.color = 3394815;
glow_filter.blurX = filter_blur;
glow_filter.blurY = filter_blur;
glow_filter.strength = filter_strength;
this.filters = new Array(glow_filter);
filter_state = "grow";
available_timer.start();
} else {
this.filters = new Array();
available_timer.stop();
};
};
}
public function set btn_type(_arg1:String):void{
_btn_type = _arg1;
update_skin();
}
public function set over_state(_arg1:String):void{
_over_state = _arg1;
update_skin();
}
private function mouse_out_handler(_arg1:MouseEvent):void{
if (enable_state == "enabled"){
over_state = "off";
};
}
private function available_handler(_arg1:TimerEvent):void{
if (this.filters.length > 0){
if (filter_state == "grow"){
if (glow_filter.alpha < 1){
glow_filter.alpha = (glow_filter.alpha + 0.1);
} else {
filter_state = "shrink";
};
} else {
if (glow_filter.alpha > 0){
glow_filter.alpha = (glow_filter.alpha - 0.1);
} else {
filter_state = "grow";
};
};
this.filters = new Array(glow_filter);
};
}
private function tooltip_expire_handler(_arg1:Event):void{
this.removeChild(this.tooltip);
}
public function disable():void{
enable_state = "disabled";
over_state = "disabled";
update_skin();
}
}
}//package com.geekglue.pMotion.Assets
Section 87
//PropShopButton (com.geekglue.pMotion.Assets.PropShopButton)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.View.Props.*;
import flash.utils.*;
import com.geekglue.pMotion.View.*;
import flash.filters.*;
public class PropShopButton extends MovieClip {
public var tooltip:PropLevelTooltip;
private var model:ModelLocator;
private var filter_state:String;// = "grow"
private var _over_state:String;// = "up"
public var prop:PropBase;
private var available_timer:Timer;
private var btn_sound:BtnSound01;
private var filter_strength:Number;// = 4
private var timer_interval:Number;// = 120
public var level:Number;// = 1
private var glow_filter:GlowFilter;
private var _btn_type:String;// = "bought"
private var filter_blur:Number;// = 12
public function PropShopButton(){
model = ModelLocator.getInstance();
_btn_type = "bought";
_over_state = "up";
level = 1;
timer_interval = 120;
filter_blur = 12;
filter_strength = 4;
filter_state = "grow";
prop = new PropBase();
super();
this.cacheAsBitmap = true;
btn_sound = new BtnSound01();
available_timer = new Timer(timer_interval);
available_timer.addEventListener(TimerEvent.TIMER, available_handler);
this.addEventListener(MouseEvent.MOUSE_OVER, mouse_over_handler);
this.addEventListener(MouseEvent.MOUSE_OUT, mouse_out_handler);
this.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
}
private function mouse_down_handler(_arg1:MouseEvent):void{
var _local2:SoundTransform;
if (model.music_loop_state){
_local2 = new SoundTransform(0.5);
btn_sound.play(0, 0, _local2);
};
}
public function get btn_type():String{
return (_btn_type);
}
private function mouse_over_handler(_arg1:MouseEvent):void{
if (this.enabled){
over_state = "over";
};
}
public function get over_state():String{
return (_over_state);
}
public function enable():void{
this.enabled = true;
this.tabEnabled = true;
over_state = "up";
update_skin();
}
private function update_skin():void{
this.gotoAndStop(((btn_type + "_") + over_state));
if ((((btn_type == "available")) && (this.enabled))){
glow_filter = new GlowFilter();
glow_filter.alpha = 0;
glow_filter.strength = filter_strength;
glow_filter.color = 3394815;
glow_filter.blurX = filter_blur;
glow_filter.blurY = filter_blur;
this.filters = new Array(glow_filter);
filter_state = "grow";
available_timer.start();
} else {
this.filters = new Array();
available_timer.stop();
};
}
public function set btn_type(_arg1:String):void{
_btn_type = _arg1;
update_skin();
}
public function set over_state(_arg1:String):void{
_over_state = _arg1;
update_skin();
}
private function mouse_out_handler(_arg1:MouseEvent):void{
if (this.enabled){
over_state = "up";
};
}
private function available_handler(_arg1:TimerEvent):void{
if (this.filters.length > 0){
if (filter_state == "grow"){
if (glow_filter.alpha < 1){
glow_filter.alpha = (glow_filter.alpha + 0.1);
} else {
filter_state = "shrink";
};
} else {
if (glow_filter.alpha > 0){
glow_filter.alpha = (glow_filter.alpha - 0.1);
} else {
filter_state = "grow";
};
};
this.filters = new Array(glow_filter);
};
}
public function disable():void{
this.enabled = false;
this.tabEnabled = false;
over_state = "disabled";
update_skin();
}
}
}//package com.geekglue.pMotion.Assets
Section 88
//Ramp_mc (com.geekglue.pMotion.Assets.Ramp_mc)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
import Box2D.Common.Math.*;
import com.geekglue.pMotion.Model.*;
import flash.geom.*;
public class Ramp_mc extends MovieClip {
private var model:ModelLocator;
public function Ramp_mc(){
model = ModelLocator.getInstance();
super();
this.cacheAsBitmap = false;
this.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
this.addEventListener(MouseEvent.MOUSE_OUT, mouse_out_handler);
}
private function mouse_down_handler(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:Number;
var _local4:Number;
_local2 = new Point(this.mouseX, this.mouseY);
_local2 = this.localToGlobal(_local2);
_local3 = (_local2.x - this.x);
_local4 = (_local2.y - this.y);
model.drag_offset = new b2Vec2(_local3, _local4);
model.drag_object = this;
}
private function mouse_out_handler(_arg1:MouseEvent):void{
model.drag_object = null;
}
}
}//package com.geekglue.pMotion.Assets
Section 89
//ShootLH (com.geekglue.pMotion.Assets.ShootLH)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
import Box2D.Common.Math.*;
import com.geekglue.pMotion.Model.*;
public class ShootLH extends MovieClip {
private var model:ModelLocator;
public function ShootLH(){
model = ModelLocator.getInstance();
super();
this.cacheAsBitmap = false;
this.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
this.addEventListener(MouseEvent.MOUSE_OUT, mouse_out_handler);
}
private function mouse_down_handler(_arg1:MouseEvent):void{
model.drag_offset = new b2Vec2(this.mouseX, this.mouseY);
model.drag_object = this;
}
private function mouse_out_handler(_arg1:MouseEvent):void{
model.drag_object = null;
}
}
}//package com.geekglue.pMotion.Assets
Section 90
//ShootRH (com.geekglue.pMotion.Assets.ShootRH)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
import Box2D.Common.Math.*;
import com.geekglue.pMotion.Model.*;
public class ShootRH extends MovieClip {
private var model:ModelLocator;
public function ShootRH(){
model = ModelLocator.getInstance();
super();
this.cacheAsBitmap = false;
this.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
this.addEventListener(MouseEvent.MOUSE_OUT, mouse_out_handler);
}
private function mouse_down_handler(_arg1:MouseEvent):void{
model.drag_offset = new b2Vec2(this.mouseX, this.mouseY);
model.drag_object = this;
}
private function mouse_out_handler(_arg1:MouseEvent):void{
}
}
}//package com.geekglue.pMotion.Assets
Section 91
//Skin (com.geekglue.pMotion.Assets.Skin)
package com.geekglue.pMotion.Assets {
import flash.events.*;
import flash.display.*;
import com.geekglue.pMotion.Model.*;
import flash.text.*;
public class Skin extends MovieClip {
public var Tanzania_tower:MovieClip;
public var Balloon02:MovieClip;
public var Balloon05:MovieClip;
public var Balloon06:MovieClip;
public var Brazil_TV_tower:MovieClip;
public var Indonesian_temple:MovieClip;
public var Wanganui_water_tower:MovieClip;
public var Balloon04:MovieClip;
public var Cape_town:MovieClip;
public var DAH_spaceship:MovieClip;
public var Kite:MovieClip;
public var Geralton_lighthouse:MovieClip;
public var Chimney:MovieClip;
private var test:Boolean;// = false
public var Iceberg:MovieClip;
public var Bangkok_elephant_bldg:MovieClip;
public var OceanLiner01:MovieClip;
public var Shanghai_pearl_tower:MovieClip;
public var HangGlider01:MovieClip;
public var HangGlider02:MovieClip;
public var HangGlider03:MovieClip;
public var Blimp:MovieClip;
public var Cooling_tower:MovieClip;
private var model:ModelLocator;
public var Moon:MovieClip;
public var Parkes_dish:MovieClip;
public var England_eddingstone_lighthouse:MovieClip;
public var Peru_lighthouse:MovieClip;
public var Saudi_Kingdom_Tower:MovieClip;
public var Uluru:MovieClip;
public var Moscow_monument:MovieClip;
public var BalloonBase01:MovieClip;
private var msg:TextField;
public var Sweden_Turning_Bldg:MovieClip;
public var Dubai_hotel:MovieClip;
public var Alaska_lighthouse:MovieClip;
public var Singapore_bg_wheel:MovieClip;
public var Al_Haggar_01:MovieClip;
public var Iceberg02:MovieClip;
public var Mt_Fuji:MovieClip;
public var Iceberg03:MovieClip;
public function Skin(){
model = ModelLocator.getInstance();
test = false;
addFrameScript(0, frame1);
super();
this.cacheAsBitmap = true;
if (test){
msg = new TextField();
msg.text = String(model.msg);
msg.width = 250;
msg.height = 100;
msg.x = 250;
msg.y = 100;
msg.selectable = false;
this.addChild(msg);
model.addEventListener(ModelLocator.MESSAGE_UPDATE_EVENT, message_update_handler);
};
model.addEventListener(ModelLocator.LEVEL_UP_EVENT, level_update_handler);
}
function frame1(){
stop();
}
private function message_update_handler(_arg1:Event):void{
msg.text = model.msg;
}
private function level_update_handler(_arg1:Event):void{
this.gotoAndStop(model.level);
}
}
}//package com.geekglue.pMotion.Assets
Section 92
//SpringBoxLH (com.geekglue.pMotion.Assets.SpringBoxLH)
package com.geekglue.pMotion.Assets {
import flash.display.*;
public class SpringBoxLH extends MovieClip {
public function SpringBoxLH(){
addFrameScript(0, frame1, 5, frame6);
super();
this.cacheAsBitmap = true;
}
public function spring():void{
this.gotoAndPlay(2);
}
function frame6(){
this.gotoAndStop(1);
}
function frame1(){
stop();
}
}
}//package com.geekglue.pMotion.Assets
Section 93
//SpringBoxRH (com.geekglue.pMotion.Assets.SpringBoxRH)
package com.geekglue.pMotion.Assets {
import flash.display.*;
public class SpringBoxRH extends MovieClip {
public function SpringBoxRH(){
addFrameScript(0, frame1, 5, frame6);
super();
this.cacheAsBitmap = true;
}
public function spring():void{
this.gotoAndPlay(2);
}
function frame6(){
this.gotoAndStop(1);
}
function frame1(){
stop();
}
}
}//package com.geekglue.pMotion.Assets
Section 94
//ModelLocator (com.geekglue.pMotion.Model.ModelLocator)
package com.geekglue.pMotion.Model {
import flash.events.*;
import flash.display.*;
import Box2D.Common.Math.*;
import com.geekglue.pMotion.VO.*;
import flash.net.*;
import com.kongregate.as3.client.*;
import com.geekglue.pMotion.View.Levels.*;
import com.geekglue.pMotion.View.Props.*;
public class ModelLocator extends Sprite {
public const ARENA_WIDTH:Number = 700;
public const BODY_HEIGHT:Number = 10;
public const BODY_WIDTH:Number = 100;
public const ARENA_HEIGHT:Number = 500;
private var _points_best:Number;// = 0
private var _points:Number;// = 0
public var level_fadein_speed:Number;// = 0.1
public var sponsor_frame:Number;// = 2
public var lives_bonus_max:Number;// = 30
public var props_list:Array;
private var _lives:Number;// = 0
private var _best_score:Number;// = 0
public var game_height:Number;// = 500
public var level_state:Boolean;// = false
public var level_start_time:Number;// = 0
private var _last_props:Number;// = 0
private var _game_pod_state:String;// = "shut"
public var level_max:Number;// = 36
private var _prop_shop_state:String;// = "shut"
private var _last_combo:Number;// = 0
private var _control_state_last:String;// = "menu"
public var ad_frame:Number;// = 3
private var _pending:BodyVO;
private var _king_btn_state:String;// = "shut"
private var _level_load:Number;// = 0
private var shared_object:SharedObject;
private var _level_run_time:Number;// = 0
private var _score_pod_state:String;// = "shut"
private var _level:Number;// = 0
private var _game_pause_state:Boolean;// = true
private var _prop_pending:String;// = ""
public var test_state:Boolean;// = false
public var prop_type_list:Array;
private var _action_pending:String;// = "init"
public var run_factor_threshold:Number;// = 6
private var _points_last:Number;// = 0
private var _help_pod_state:String;// = "shut"
public var saved_stars:Number;// = 0
private var _msg:String;// = ""
private var domain:String;// = "com.geekglue.pMotion"
private var points_base:Number;// = 120
private var _points_available:Number;// = 0
private var _level_target:Number;// = 0
private var _tries:Number;// = 0
public var saved_score:Number;// = 0
public var game_frame:Number;// = 5
private var _drag_object:DisplayObject;
public var lives_start_num:Number;// = 5
private var _levels_best:Number;
public var marker_fade_time:Number;// = 2000
private var _map_pod_state:String;// = "shut"
public var score_vo_best:ScoreVO;
private var _points_spent:Number;// = 0
private var _best_props:Number;// = 0
public var max_Y_speed:Number;// = 200
private var _best_combo:Number;// = 0
private var _last_stars:Number;// = 0
public var level_max_time:Number;// = 30
private var _control_state:String;// = "menu"
private var _control_pod_state:String;// = "shut"
private var _sequence_count:Number;// = 0
public var game_width:Number;// = 700
private var _level_win_state:String;// = "shut"
private var _last_score:Number;// = 0
private var _points_earned:Number;// = 0
private var _menu_pod_state:String;// = "shut"
public var saved_lives:Number;// = 0
public var levels:Array;
public var url_test_state:Boolean;// = false
public var marker_expire_time:Number;// = 2600
public var music_loop_state:Boolean;// = true
public var score_vo:ScoreVO;
public var level_complete:Number;// = 0
public var level_fadeout_speed:Number;// = 0.05
private var _props_last:Number;// = 0
public var prop_level:PropLevelVO;
public var level_target_count:Number;// = 0
public var level_current:LevelBase;
public var max_X_speed:Number;// = 400
public var saved_props:Number;// = 0
public var sequence_target:Number;// = 3
private var kongregate:KongregateAPI;
public var run_state:Boolean;// = false
private var _best_stars:Number;// = 0
private var _total_stars:Number;// = 0
public var marker_fade_speed:Number;// = 0.02
private var kong_state:Boolean;// = false
private var _props_total:Number;// = 0
public var drag_offset:b2Vec2;
public static var MENU_POD_EVENT:String = "menu_pod_event";
public static var GAME_PAUSE_EVENT:String = "game_pause_event";
public static var TRIES_UPDATE_EVENT:String = "tries_update_event";
public static var PROPS_UPDATE_EVENT:String = "props_update_event";
public static var LEVEL_TIMER_UPDATE_EVENT:String = "level_timer_update_event";
public static var LEVEL_LOAD_EVENT:String = "level_load_event";
public static var MAP_POD_EVENT:String = "map_pod_event";
public static var LEVEL_WIN_EVENT:String = "level_win_event";
public static var LEVEL_CURRENT_UPDATE_EVENT:String = "level_current_update_event";
private static var model:ModelLocator;
public static var BODY_DRAG_START_EVENT:String = "body_drag_start_event";
public static var SEQUENCE_COUNT_EVENT:String = "sequence_count_event";
public static var POINTS_BEST_EVENT:String = "points_best_event";
public static var CONTROL_UPDATE_EVENT:String = "control_update_event";
public static var LEVEL_TARGET_EVENT:String = "level_target_event";
public static var SCORE_UPDATE_EVENT:String = "score_update_event";
public static var PROP_SHOP_EVENT:String = "prop_shop_event";
public static var KING_BTN_UPDATE_EVENT:String = "king_btn_update_event";
public static var LEVEL_UP_EVENT:String = "level_up_event";
public static var GAME_POD_EVENT:String = "game_pod_event";
public static var PROP_PENDING_EVENT:String = "prop_pending_event";
public static var PROP_LEVEL_UPDATE_EVENT:String = "prop_level_update_event";
public static var LIVES_UPDATE_EVENT:String = "lives_update_event";
public static var CONTROL_POD_EVENT:String = "control_pod_event";
public static var BODY_ADD_EVENT:String = "body_add_event";
public static var POINTS_UPDATE_EVENT:String = "points_update_event";
public static var HELP_POD_EVENT:String = "help_pod_event";
public static var MESSAGE_UPDATE_EVENT:String = "message_update_event";
public static var BODY_DRAG_END_EVENT:String = "body_drag_end_event";
public static var ACTION_PENDING_EVENT:String = "action_pending_event";
public static var SCORE_POD_EVENT:String = "score_pod_event";
public function ModelLocator(){
_action_pending = "init";
_best_combo = 0;
_best_props = 0;
_best_score = 0;
_best_stars = 0;
_control_state_last = "menu";
_control_state = "menu";
_control_pod_state = "shut";
drag_offset = new b2Vec2(0, 0);
domain = "com.geekglue.pMotion";
ad_frame = 3;
game_frame = 5;
sponsor_frame = 2;
game_height = 500;
game_width = 700;
_game_pod_state = "shut";
_game_pause_state = true;
_help_pod_state = "shut";
_king_btn_state = "shut";
kong_state = false;
_last_combo = 0;
_last_props = 0;
_last_score = 0;
_last_stars = 0;
_level = 0;
levels = new Array();
_level_load = 0;
level_complete = 0;
level_max = 36;
_level_target = 0;
level_target_count = 0;
level_max_time = 30;
level_start_time = 0;
_level_run_time = 0;
level_state = false;
_level_win_state = "shut";
_lives = 0;
lives_bonus_max = 30;
lives_start_num = 5;
_map_pod_state = "shut";
level_fadein_speed = 0.1;
level_fadeout_speed = 0.05;
marker_expire_time = 2600;
marker_fade_time = 2000;
marker_fade_speed = 0.02;
max_X_speed = 400;
max_Y_speed = 200;
_menu_pod_state = "shut";
_msg = "";
music_loop_state = true;
_points = 0;
points_base = 120;
_points_best = 0;
_points_last = 0;
_props_last = 0;
_points_earned = 0;
_points_spent = 0;
_points_available = 0;
prop_level = new PropLevelVO();
prop_type_list = new Array();
_prop_pending = "";
_prop_shop_state = "shut";
_props_total = 0;
props_list = new Array();
run_factor_threshold = 6;
run_state = false;
saved_lives = 0;
saved_props = 0;
saved_score = 0;
saved_stars = 0;
_score_pod_state = "shut";
score_vo = new ScoreVO();
score_vo_best = new ScoreVO();
_sequence_count = 0;
sequence_target = 3;
test_state = false;
url_test_state = false;
_total_stars = 0;
_tries = 0;
super();
if (ModelLocator.model != null){
throw (new Error("Only one ModelLocator instance should be instantiated"));
};
shared_object = SharedObject.getLocal(this.domain);
save_data_test();
props_define();
levels_define();
this.points_level_update(0, 120);
}
private function points_total_update():void{
var _local1:Number;
var _local2:LevelBase;
_local1 = 0;
this.level_target_count = 0;
for each (_local2 in this.levels) {
_local1 = (_local1 + _local2.points);
if (_local2.points >= _local2.level_target){
this.level_target_count++;
};
};
this.points_earned = (_local1 + this.points_base);
points_available_update();
save();
}
public function get props_last():Number{
return (_props_last);
}
public function points_level_update(_arg1:Number, _arg2:Number):void{
var _local3:Number;
var _local4:LevelBase;
if (_arg1 != 0){
_local3 = level_index_get(_arg1);
_local4 = (this.levels[_local3] as LevelBase);
if (_local4.points < _arg2){
_local4.points = _arg2;
this.level_current.points = _arg2;
};
} else {
this.points_base = _arg2;
};
points_total_update();
this.dispatchEvent(new Event(ModelLocator.LEVEL_CURRENT_UPDATE_EVENT));
}
public function get game_pod_state():String{
return (_game_pod_state);
}
public function set lives(_arg1:Number):void{
_lives = _arg1;
if (_arg1 < 1){
};
this.dispatchEvent(new Event(ModelLocator.LIVES_UPDATE_EVENT));
}
public function set props_last(_arg1:Number):void{
_props_last = _arg1;
shared_object.data.props_last = _arg1;
shared_object.flush();
}
public function set sequence_count(_arg1:Number):void{
_sequence_count = _arg1;
this.dispatchEvent(new Event(ModelLocator.SEQUENCE_COUNT_EVENT));
}
public function set game_pod_state(_arg1:String):void{
_game_pod_state = _arg1;
this.dispatchEvent(new Event(ModelLocator.GAME_POD_EVENT));
}
public function set points_spent(_arg1:Number):void{
_points_spent = _arg1;
points_available_update();
}
public function save_data_load():void{
var _local1:Array;
var _local2:Array;
var _local3:Number;
var _local4:LevelBase;
var _local5:String;
_local1 = new Array();
if (shared_object.data.level_complete == null){
this.level_complete = 0;
} else {
this.level_complete = Number(shared_object.data.level_complete);
};
if (shared_object.data.level == null){
this.level = 0;
} else {
this.level = Number(shared_object.data.level);
};
if (shared_object.data.points_spent == null){
this.points_spent = 0;
} else {
this.points_spent = Number(shared_object.data.points_spent);
};
if (shared_object.data.level_scores != null){
_local1 = (shared_object.data.level_scores as Array);
for each (_local5 in _local1) {
_local2 = _local5.split(":");
_local3 = this.level_index_get(Number(_local2[0]));
_local4 = (this.levels[_local3] as LevelBase);
_local4.points = Number(_local2[1]);
};
};
if (shared_object.data.prop_levels != null){
save_prop_levels_load((shared_object.data.prop_levels as Array));
};
points_total_load();
this.dispatchEvent(new Event(ModelLocator.LEVEL_UP_EVENT));
this.dispatchEvent(new Event(ModelLocator.PROP_LEVEL_UPDATE_EVENT));
}
public function get game_pause_state():Boolean{
return (_game_pause_state);
}
public function level_load_current(_arg1:Number):void{
var _local2:LevelBase;
for each (_local2 in levels) {
if (_local2.level_index == _arg1){
this.level_current = _local2;
this.props_update(this.level_current.prop_list);
break;
};
};
this.dispatchEvent(new Event(ModelLocator.LEVEL_CURRENT_UPDATE_EVENT));
}
public function get level_run_time():Number{
return (_level_run_time);
}
public function props_reset():void{
this.dispatchEvent(new Event(ModelLocator.PROPS_UPDATE_EVENT));
}
public function set control_state(_arg1:String):void{
_control_state = _arg1;
this.dispatchEvent(new Event(ModelLocator.CONTROL_UPDATE_EVENT));
}
public function set menu_pod_state(_arg1:String):void{
_menu_pod_state = _arg1;
this.dispatchEvent(new Event(ModelLocator.MENU_POD_EVENT));
}
public function get points_available():Number{
return (_points_available);
}
public function set game_pause_state(_arg1:Boolean):void{
_game_pause_state = _arg1;
this.dispatchEvent(new Event(ModelLocator.GAME_PAUSE_EVENT));
}
public function get best_score():Number{
return (_best_score);
}
public function get prop_shop_state():String{
return (_prop_shop_state);
}
public function get best_stars():Number{
return (_best_stars);
}
private function save_prop_level_format():Array{
var _local1:Array;
var _local2:String;
_local1 = new Array();
_local2 = ("bumper:" + prop_level.bumper_level);
_local1.push(_local2);
_local2 = ("jumpLH:" + prop_level.jumpLH_level);
_local1.push(_local2);
_local2 = ("jumpRH:" + prop_level.jumpRH_level);
_local1.push(_local2);
_local2 = ("ramp10:" + prop_level.ramp10_level);
_local1.push(_local2);
_local2 = ("rampN10:" + prop_level.rampN10_level);
_local1.push(_local2);
_local2 = ("ramp30:" + prop_level.ramp30_level);
_local1.push(_local2);
_local2 = ("rampN30:" + prop_level.rampN30_level);
_local1.push(_local2);
_local2 = ("shootLH:" + prop_level.shootLH_level);
_local1.push(_local2);
_local2 = ("shootRH:" + prop_level.shootRH_level);
_local1.push(_local2);
_local2 = ("springLH:" + prop_level.springLH_level);
_local1.push(_local2);
_local2 = ("springRH:" + prop_level.springRH_level);
_local1.push(_local2);
return (_local1);
}
public function get last_props():Number{
return (_last_props);
}
public function set best_stars(_arg1:Number):void{
_best_stars = _arg1;
this.dispatchEvent(new Event(ModelLocator.SCORE_UPDATE_EVENT));
}
public function get action_pending():String{
return (_action_pending);
}
public function points_level_clear():void{
var _local1:LevelBase;
for each (_local1 in this.levels) {
_local1.points = 0;
};
points_total_update();
}
public function get help_pod_state():String{
return (_help_pod_state);
}
public function set king_btn_state(_arg1:String):void{
_king_btn_state = _arg1;
this.dispatchEvent(new Event(ModelLocator.KING_BTN_UPDATE_EVENT));
}
public function get points_last():Number{
return (_points_last);
}
public function set points_earned(_arg1:Number):void{
_points_earned = _arg1;
}
public function set best_props(_arg1:Number):void{
_best_props = _arg1;
if (_arg1 > Number(shared_object.data.best_props)){
shared_object.data.best_props = _arg1;
shared_object.flush();
};
this.dispatchEvent(new Event(ModelLocator.SCORE_UPDATE_EVENT));
}
public function get levels_best():Number{
return (_levels_best);
}
public function get last_combo():Number{
return (_last_combo);
}
public function props_update(_arg1:Array):void{
props_list = _arg1;
this.dispatchEvent(new Event(ModelLocator.PROPS_UPDATE_EVENT));
}
public function set level_run_time(_arg1:Number):void{
if (_arg1 != _level_run_time){
_level_run_time = _arg1;
};
this.dispatchEvent(new Event(ModelLocator.LEVEL_TIMER_UPDATE_EVENT));
}
public function get level_target():Number{
return (_level_target);
}
public function set prop_shop_state(_arg1:String):void{
_prop_shop_state = _arg1;
this.dispatchEvent(new Event(ModelLocator.PROP_SHOP_EVENT));
}
public function kongregate_load_handler(_arg1:KongregateAPI):void{
kong_state = true;
kongregate = _arg1;
}
public function get drag_object():DisplayObject{
return (_drag_object);
}
public function get level_load():Number{
return (_level_load);
}
private function points_available_update():void{
this.points_available = (this.points_earned - this.points_spent);
this.dispatchEvent(new Event(ModelLocator.POINTS_UPDATE_EVENT));
}
public function get prop_pending():String{
return (_prop_pending);
}
private function levels_define():void{
var _local1:LevelBase;
_local1 = new Start();
_local1.level_index = 1;
this.levels.push(_local1);
_local1 = new Springs();
_local1.level_index = 2;
this.levels.push(_local1);
_local1 = new SimpleSpringRamp();
_local1.level_index = 3;
this.levels.push(_local1);
_local1 = new SpringRamp01();
_local1.level_index = 4;
this.levels.push(_local1);
_local1 = new Spring70();
_local1.level_index = 5;
this.levels.push(_local1);
_local1 = new SpringCircleUnder();
_local1.level_index = 6;
this.levels.push(_local1);
_local1 = new MidRamps();
_local1.level_index = 7;
this.levels.push(_local1);
_local1 = new ShootLH01();
_local1.level_index = 8;
this.levels.push(_local1);
_local1 = new Jump01();
_local1.level_index = 9;
this.levels.push(_local1);
_local1 = new Jumpers();
_local1.level_index = 10;
this.levels.push(_local1);
_local1 = new SpringCircle();
_local1.level_index = 11;
this.levels.push(_local1);
_local1 = new SpringRamp02();
_local1.level_index = 12;
this.levels.push(_local1);
_local1 = new ReverseCascade();
_local1.level_index = 13;
this.levels.push(_local1);
_local1 = new Bumper01();
_local1.level_index = 14;
this.levels.push(_local1);
_local1 = new Ramps03();
_local1.level_index = 15;
this.levels.push(_local1);
_local1 = new Jump02();
_local1.level_index = 16;
this.levels.push(_local1);
_local1 = new LongRamp();
_local1.level_index = 17;
this.levels.push(_local1);
_local1 = new ShootRH02();
_local1.level_index = 18;
this.levels.push(_local1);
_local1 = new Shooters03();
_local1.level_index = 19;
this.levels.push(_local1);
_local1 = new DualLaneConveyor();
_local1.level_index = 20;
this.levels.push(_local1);
_local1 = new SimpleBumper();
_local1.level_index = 21;
this.levels.push(_local1);
_local1 = new Oscillator();
_local1.level_index = 22;
this.levels.push(_local1);
_local1 = new JumpRH03();
_local1.level_index = 23;
this.levels.push(_local1);
_local1 = new SimpleMaze();
_local1.level_index = 24;
this.levels.push(_local1);
_local1 = new SpringRampCircle();
_local1.level_index = 25;
this.levels.push(_local1);
_local1 = new Stairway();
_local1.level_index = 26;
this.levels.push(_local1);
_local1 = new JumpRH04();
_local1.level_index = 27;
this.levels.push(_local1);
_local1 = new Maze();
_local1.level_index = 28;
this.levels.push(_local1);
_local1 = new Chute();
_local1.level_index = 29;
this.levels.push(_local1);
_local1 = new ShootLH04();
_local1.level_index = 30;
this.levels.push(_local1);
_local1 = new SimpleConveyor();
_local1.level_index = 31;
this.levels.push(_local1);
_local1 = new SpringShooter();
_local1.level_index = 32;
this.levels.push(_local1);
_local1 = new RampCircuit();
_local1.level_index = 33;
this.levels.push(_local1);
_local1 = new BumperRamp();
_local1.level_index = 34;
this.levels.push(_local1);
_local1 = new BumperShoot();
_local1.level_index = 35;
this.levels.push(_local1);
_local1 = new BumperCircle();
_local1.level_index = 36;
this.levels.push(_local1);
}
public function set points_available(_arg1:Number):void{
_points_available = _arg1;
}
public function set best_combo(_arg1:Number):void{
_best_combo = _arg1;
if (_arg1 > Number(shared_object.data.best_combo)){
shared_object.data.best_combo = _arg1;
shared_object.flush();
};
this.dispatchEvent(new Event(ModelLocator.SCORE_UPDATE_EVENT));
}
public function get points():Number{
return (_points);
}
public function set level_win_state(_arg1:String):void{
_level_win_state = _arg1;
this.dispatchEvent(new Event(ModelLocator.LEVEL_WIN_EVENT));
}
public function set best_score(_arg1:Number):void{
_best_score = _arg1;
if (_arg1 > Number(shared_object.data.best_score)){
shared_object.data.best_score = _arg1;
shared_object.flush();
};
this.dispatchEvent(new Event(ModelLocator.SCORE_UPDATE_EVENT));
}
public function get king_btn_state():String{
return (_king_btn_state);
}
public function set points_last(_arg1:Number):void{
_points_last = _arg1;
shared_object.data.points_last = _arg1;
shared_object.flush();
}
public function set last_stars(_arg1:Number):void{
_last_stars = _arg1;
if (_arg1 > this.best_stars){
this.best_stars = _arg1;
};
this.dispatchEvent(new Event(ModelLocator.SCORE_UPDATE_EVENT));
}
public function game_over():void{
var _local1:KongregateAPI;
if (kong_state){
_local1 = KongregateAPI.getInstance();
_local1.stats.submit("GameComplete", 1);
};
}
public function set msg(_arg1:String):void{
_msg = (_msg + (_arg1 + "\n"));
this.dispatchEvent(new Event(ModelLocator.MESSAGE_UPDATE_EVENT));
}
public function set level(_arg1:Number):void{
if (_arg1 > this.level_max){
_arg1 = 0;
};
_level = _arg1;
if (_arg1 > this.levels_best){
levels_best = _arg1;
};
level_load = _arg1;
}
public function get score_pod_state():String{
return (_score_pod_state);
}
public function set last_props(_arg1:Number):void{
_last_props = _arg1;
if (_arg1 > this.best_props){
this.best_props = _arg1;
};
this.dispatchEvent(new Event(ModelLocator.SCORE_UPDATE_EVENT));
}
public function get points_spent():Number{
return (_points_spent);
}
public function set action_pending(_arg1:String):void{
_action_pending = _arg1;
this.dispatchEvent(new Event(ModelLocator.ACTION_PENDING_EVENT));
}
public function get lives():Number{
return (_lives);
}
public function set pending(_arg1:BodyVO):void{
_pending = _arg1;
this.dispatchEvent(new Event(ModelLocator.BODY_ADD_EVENT));
}
public function set help_pod_state(_arg1:String):void{
_help_pod_state = _arg1;
this.dispatchEvent(new Event(ModelLocator.HELP_POD_EVENT));
}
public function get sequence_count():Number{
return (_sequence_count);
}
public function get map_pod_state():String{
return (_map_pod_state);
}
public function prop_level_clear():void{
this.prop_level.bumper_level = 0;
this.prop_level.jumpLH_level = 0;
this.prop_level.jumpRH_level = 0;
this.prop_level.ramp10_level = 0;
this.prop_level.rampN10_level = 0;
this.prop_level.ramp30_level = 0;
this.prop_level.rampN30_level = 0;
this.prop_level.shootLH_level = 0;
this.prop_level.shootRH_level = 0;
this.prop_level.springLH_level = 0;
this.prop_level.springRH_level = 0;
this.dispatchEvent(new Event(ModelLocator.PROP_LEVEL_UPDATE_EVENT));
}
public function set tries(_arg1:Number):void{
_tries = _arg1;
this.dispatchEvent(new Event(ModelLocator.TRIES_UPDATE_EVENT));
}
public function get control_state():String{
return (_control_state);
}
public function body_drag_end():void{
this.dispatchEvent(new Event(ModelLocator.BODY_DRAG_END_EVENT));
}
public function set control_state_last(_arg1:String):void{
if (((!((_arg1 == "sound_ON"))) && (!((_arg1 == "sound_OFF"))))){
_control_state_last = _arg1;
};
}
public function get best_props():Number{
return (_best_props);
}
public function set level_target(_arg1:Number):void{
_level_target = _arg1;
this.dispatchEvent(new Event(ModelLocator.SCORE_UPDATE_EVENT));
}
public function set last_combo(_arg1:Number):void{
_last_combo = _arg1;
if (_arg1 > this.best_combo){
this.best_combo = _arg1;
};
this.dispatchEvent(new Event(ModelLocator.SCORE_UPDATE_EVENT));
}
public function set drag_object(_arg1:DisplayObject):void{
var filter_list:Array;
var b = _arg1;
try {
filter_list = new Array();
_drag_object.filters = filter_list;
} catch(error:Error) {
};
_drag_object = b;
if (b != null){
this.dispatchEvent(new Event(ModelLocator.BODY_DRAG_START_EVENT));
};
}
public function get points_earned():Number{
return (_points_earned);
}
private function save_prop_levels_load(_arg1:Array):void{
var _local2:Array;
var _local3:String;
for each (_local3 in _arg1) {
_local2 = _local3.split(":");
this.prop_level_update(_local2[0], _local2[1]);
};
}
public function get menu_pod_state():String{
return (_menu_pod_state);
}
public function set control_pod_state(_arg1:String):void{
_control_pod_state = _arg1;
this.dispatchEvent(new Event(ModelLocator.CONTROL_POD_EVENT));
}
public function prop_level_update(_arg1:String, _arg2:Number):void{
switch (_arg1){
case "bumper":
this.prop_level.bumper_level = _arg2;
break;
case "jumpLH":
this.prop_level.jumpLH_level = _arg2;
break;
case "jumpRH":
this.prop_level.jumpRH_level = _arg2;
break;
case "ramp10":
this.prop_level.ramp10_level = _arg2;
break;
case "rampN10":
this.prop_level.rampN10_level = _arg2;
break;
case "ramp30":
this.prop_level.ramp30_level = _arg2;
break;
case "rampN30":
this.prop_level.rampN30_level = _arg2;
break;
case "shootLH":
this.prop_level.shootLH_level = _arg2;
break;
case "shootRH":
this.prop_level.shootRH_level = _arg2;
break;
case "springLH":
this.prop_level.springLH_level = _arg2;
break;
case "springRH":
this.prop_level.springRH_level = _arg2;
break;
};
this.dispatchEvent(new Event(ModelLocator.PROP_LEVEL_UPDATE_EVENT));
save();
}
private function level_index_get(_arg1:Number):Number{
var _local2:Number;
var _local3:Number;
var _local4:LevelBase;
_local2 = -1;
_local3 = 0;
_local4 = (this.levels[(_arg1 - 1)] as LevelBase);
if (_local4.level_index == _arg1){
_local2 = (_arg1 - 1);
} else {
for each (_local4 in this.levels) {
if (_local4.level_index == _arg1){
_local2 = _local3;
};
_local3++;
};
};
return (_local2);
}
private function props_define():void{
var _local1:PropBase;
_local1 = new RampN30();
this.prop_type_list.push(_local1);
_local1 = new SpringRH();
this.prop_type_list.push(_local1);
_local1 = new SpringLH();
this.prop_type_list.push(_local1);
_local1 = new Ramp10();
this.prop_type_list.push(_local1);
_local1 = new Ramp30();
this.prop_type_list.push(_local1);
_local1 = new RampN10();
this.prop_type_list.push(_local1);
_local1 = new ShootLH();
this.prop_type_list.push(_local1);
_local1 = new JumpRH();
this.prop_type_list.push(_local1);
_local1 = new JumpLH();
this.prop_type_list.push(_local1);
_local1 = new Bumper();
this.prop_type_list.push(_local1);
_local1 = new ShootRH();
this.prop_type_list.push(_local1);
}
public function get best_combo():Number{
return (_best_combo);
}
public function set prop_pending(_arg1:String):void{
_prop_pending = _arg1;
this.dispatchEvent(new Event(ModelLocator.PROP_PENDING_EVENT));
}
public function set props_total(_arg1:Number):void{
_props_total = _arg1;
shared_object.data.props_total = _arg1;
shared_object.flush();
this.dispatchEvent(new Event(ModelLocator.SCORE_UPDATE_EVENT));
}
public function get level_win_state():String{
return (_level_win_state);
}
private function save():void{
var _local1:Array;
var _local2:String;
var _local3:LevelBase;
if (this.action_pending != "init"){
_local1 = new Array();
for each (_local3 in this.levels) {
_local2 = ((String(_local3.level_index) + ":") + String(_local3.points));
_local1.push(_local2);
};
shared_object.data.level_scores = _local1;
if (this.level){
shared_object.data.level = this.level;
};
shared_object.data.level_complete = this.level_complete;
shared_object.data.points_spent = this.points_spent;
shared_object.data.prop_levels = save_prop_level_format();
shared_object.flush();
};
}
public function get msg():String{
return (_msg);
}
public function set level_load(_arg1:Number):void{
if (_arg1 > this.level_max){
_arg1 = this.level_max;
};
if (_arg1 > this.level_load){
_level_load = _arg1;
shared_object.data.level_load = _arg1;
shared_object.flush();
this.dispatchEvent(new Event(ModelLocator.LEVEL_LOAD_EVENT));
};
}
public function set total_stars(_arg1:Number):void{
_total_stars = _arg1;
this.dispatchEvent(new Event(ModelLocator.SCORE_UPDATE_EVENT));
}
public function get last_stars():Number{
return (_last_stars);
}
public function save_data_clear():void{
save();
}
public function set last_score(_arg1:Number):void{
_last_score = _arg1;
if (_arg1 > this.best_score){
this.best_score = _arg1;
};
this.dispatchEvent(new Event(ModelLocator.SCORE_UPDATE_EVENT));
}
public function get pending():BodyVO{
return (_pending);
}
public function get tries():Number{
return (_tries);
}
public function set score_pod_state(_arg1:String):void{
_score_pod_state = _arg1;
this.dispatchEvent(new Event(ModelLocator.SCORE_POD_EVENT));
}
public function get level():Number{
return (_level);
}
public function set levels_best(_arg1:Number):void{
_levels_best = _arg1;
this.dispatchEvent(new Event(ModelLocator.LEVEL_LOAD_EVENT));
}
public function set points_best(_arg1:Number):void{
if (_arg1 > _points_best){
_points_best = _arg1;
shared_object.data.points_best = _arg1;
shared_object.flush();
if (kong_state){
kongregate.stats.submit("HighScore", _arg1);
kongregate.scores.submit(points_best);
};
this.dispatchEvent(new Event(ModelLocator.POINTS_BEST_EVENT));
};
}
public function get control_state_last():String{
return (_control_state_last);
}
public function get last_score():Number{
return (_last_score);
}
public function get total_stars():Number{
return (_total_stars);
}
public function load_game():void{
this.level = this.levels_best;
this.points = this.saved_score;
this.props_total = this.saved_props;
this.total_stars = this.saved_stars;
if (this.level <= 0){
this.level = 1;
};
}
public function get control_pod_state():String{
return (_control_pod_state);
}
public function reset():void{
this.level_complete_update(0);
this.level_update(0);
this.points_spent = 0;
this.points_level_clear();
this.prop_level_clear();
}
private function save_data_test():void{
if (shared_object.data.level != null){
this.levels_best = Number(shared_object.data.level);
};
}
public function set points(_arg1:Number):void{
_points = _arg1;
this.points_best = _arg1;
this.dispatchEvent(new Event(ModelLocator.POINTS_UPDATE_EVENT));
}
public function level_complete_update(_arg1:Number):void{
this.level_complete = _arg1;
this.save();
}
public function points_level_get(_arg1:Number):Number{
var _local2:Number;
var _local3:LevelBase;
_local2 = level_index_get(_arg1);
_local3 = (this.levels[_local2] as LevelBase);
return (_local3.points);
}
public function level_update(_arg1:Number):void{
this.level = _arg1;
this.save();
this.dispatchEvent(new Event(ModelLocator.LEVEL_UP_EVENT));
}
public function get points_best():Number{
return (_points_best);
}
public function get props_total():Number{
return (_props_total);
}
public function set map_pod_state(_arg1:String):void{
_map_pod_state = _arg1;
this.dispatchEvent(new Event(ModelLocator.MAP_POD_EVENT));
}
private function points_total_load():void{
var _local1:Number;
var _local2:LevelBase;
_local1 = 0;
this.level_target_count = 0;
for each (_local2 in this.levels) {
_local1 = (_local1 + _local2.points);
};
this.points_earned = (_local1 + this.points_base);
points_available_update();
}
public static function getInstance():ModelLocator{
if (model == null){
model = new (ModelLocator);
};
return (model);
}
}
}//package com.geekglue.pMotion.Model
Section 95
//Instruction1 (com.geekglue.pMotion.View.Instructions.Instruction1)
package com.geekglue.pMotion.View.Instructions {
import flash.display.*;
public class Instruction1 extends MovieClip {
public function Instruction1(){
addFrameScript(0, frame1);
super();
this.cacheAsBitmap = true;
}
function frame1(){
stop();
}
}
}//package com.geekglue.pMotion.View.Instructions
Section 96
//Instruction2 (com.geekglue.pMotion.View.Instructions.Instruction2)
package com.geekglue.pMotion.View.Instructions {
import flash.display.*;
public class Instruction2 extends MovieClip {
public function Instruction2(){
addFrameScript(0, frame1);
super();
this.cacheAsBitmap = true;
}
function frame1(){
stop();
}
}
}//package com.geekglue.pMotion.View.Instructions
Section 97
//Instruction3 (com.geekglue.pMotion.View.Instructions.Instruction3)
package com.geekglue.pMotion.View.Instructions {
import flash.display.*;
public class Instruction3 extends MovieClip {
public function Instruction3(){
addFrameScript(0, frame1);
super();
this.cacheAsBitmap = true;
}
function frame1(){
stop();
}
}
}//package com.geekglue.pMotion.View.Instructions
Section 98
//Instruction4 (com.geekglue.pMotion.View.Instructions.Instruction4)
package com.geekglue.pMotion.View.Instructions {
import flash.display.*;
public class Instruction4 extends MovieClip {
public function Instruction4(){
this.cacheAsBitmap = true;
}
}
}//package com.geekglue.pMotion.View.Instructions
Section 99
//Bumper01 (com.geekglue.pMotion.View.Levels.Bumper01)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Bumper01 extends LevelBase {
public function Bumper01(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 10;
level_target = 20;
city = "Punta Arenas";
country = "Chile";
map_point.x = 167;
map_point.y = 366;
_local1 = new BodyVO("ball", 350, 200);
this.start_list.push(_local1);
_local2 = new BonusItem(525, 280);
this.bonus_list.push(_local2);
_local1 = new BodyVO("bumper", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("ramp30", 0, 0, 100, 2);
this.prop_list.push(_local1);
this.prop_levels.bumper_level = 1;
this.prop_levels.ramp30_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 100
//BumperCircle (com.geekglue.pMotion.View.Levels.BumperCircle)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class BumperCircle extends LevelBase {
public function BumperCircle(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 30;
level_target = 3500;
city = "Sapporo";
country = "Japan";
map_point.x = 418;
map_point.y = 230;
_local1 = new BodyVO("ball", 350, 200);
this.start_list.push(_local1);
_local1 = new BodyVO("bumper", 0, 0, 100, 32);
this.prop_list.push(_local1);
this.prop_levels.bumper_level = 5;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 101
//BumperRamp (com.geekglue.pMotion.View.Levels.BumperRamp)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class BumperRamp extends LevelBase {
public function BumperRamp(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 15;
level_target = 150;
city = "Shanghai";
country = "China";
map_point.x = 385;
map_point.y = 0xFF;
_local1 = new BodyVO("ball", 50, 250);
this.start_list.push(_local1);
_local2 = new BonusItem(230, 195);
this.bonus_list.push(_local2);
_local2 = new BonusItem(600, 118);
this.bonus_list.push(_local2);
_local2 = new BonusItem(530, 0xFF);
this.bonus_list.push(_local2);
_local1 = new BodyVO("bumper", 0, 0, 100, 8);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN10", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("ramp10", 0, 0, 100, 2);
this.prop_list.push(_local1);
this.prop_levels.bumper_level = 3;
this.prop_levels.rampN10_level = 3;
this.prop_levels.ramp10_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 102
//BumperShoot (com.geekglue.pMotion.View.Levels.BumperShoot)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class BumperShoot extends LevelBase {
public function BumperShoot(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 30;
level_target = 950;
city = "Ushiku";
country = "Japan";
map_point.x = 410;
map_point.y = 245;
_local1 = new BodyVO("ball", 585, 45);
this.start_list.push(_local1);
_local2 = new BonusItem(195, 205);
this.bonus_list.push(_local2);
_local2 = new BonusItem(350, 140);
this.bonus_list.push(_local2);
_local2 = new BonusItem(270, 275);
this.bonus_list.push(_local2);
_local1 = new BodyVO("rampN30", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("bumper", 0, 0, 100, 16);
this.prop_list.push(_local1);
this.prop_levels.bumper_level = 4;
this.prop_levels.rampN30_level = 3;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 103
//Chute (com.geekglue.pMotion.View.Levels.Chute)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Chute extends LevelBase {
public function Chute(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 190;
city = "Malmo";
country = "Sweden";
map_point.x = 0x0101;
map_point.y = 197;
_local1 = new BodyVO("ball", 630, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(60, 320);
this.bonus_list.push(_local2);
_local2 = new BonusItem(250, 150);
this.bonus_list.push(_local2);
_local2 = new BonusItem(420, 200);
this.bonus_list.push(_local2);
_local1 = new BodyVO("rampN30", 0, 0, 100, 5);
this.prop_list.push(_local1);
_local1 = new BodyVO("springLH", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("bumper", 0, 0, 100, 2);
this.prop_list.push(_local1);
this.prop_levels.rampN30_level = 5;
this.prop_levels.springLH_level = 2;
this.prop_levels.bumper_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 104
//DualLaneConveyor (com.geekglue.pMotion.View.Levels.DualLaneConveyor)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class DualLaneConveyor extends LevelBase {
public function DualLaneConveyor(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 330;
map_point.x = 102;
map_point.y = 220;
city = "Calgary";
country = "Canada";
_local1 = new BodyVO("ball", 100, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(155, 315);
this.bonus_list.push(_local2);
_local2 = new BonusItem(485, 245);
this.bonus_list.push(_local2);
_local2 = new BonusItem(595, 315);
this.bonus_list.push(_local2);
_local1 = new BodyVO("rampN30", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("ramp30", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("springLH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("shootRH", 0, 0, 100, 6);
this.prop_list.push(_local1);
_local1 = new BodyVO("shootLH", 0, 0, 100, 6);
this.prop_list.push(_local1);
this.prop_levels.rampN30_level = 1;
this.prop_levels.ramp30_level = 1;
this.prop_levels.springLH_level = 1;
this.prop_levels.shootRH_level = 3;
this.prop_levels.shootLH_level = 3;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 105
//Jump01 (com.geekglue.pMotion.View.Levels.Jump01)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Jump01 extends LevelBase {
public function Jump01(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 160;
map_point.x = 312;
map_point.y = 263;
city = "Dubai";
country = "UAE";
_local1 = new BodyVO("ball", 100, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(173, 189);
this.bonus_list.push(_local2);
_local2 = new BonusItem(468, 155);
this.bonus_list.push(_local2);
_local1 = new BodyVO("rampN10", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("springRH", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpRH", 0, 0, 100, 1);
this.prop_list.push(_local1);
this.prop_levels.rampN10_level = 3;
this.prop_levels.springRH_level = 2;
this.prop_levels.jumpRH_level = 1;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 106
//Jump02 (com.geekglue.pMotion.View.Levels.Jump02)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Jump02 extends LevelBase {
public function Jump02(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 15;
level_target = 180;
map_point.x = 148;
map_point.y = 307;
city = "Lima";
country = "Peru";
_local1 = new BodyVO("ball", 100, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(214, 95);
this.bonus_list.push(_local2);
_local2 = new BonusItem(475, 0xFF);
this.bonus_list.push(_local2);
_local2 = new BonusItem(340, 355);
this.bonus_list.push(_local2);
_local1 = new BodyVO("ramp30", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN30", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpLH", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpRH", 0, 0, 100, 2);
this.prop_list.push(_local1);
this.prop_levels.ramp30_level = 3;
this.prop_levels.rampN30_level = 1;
this.prop_levels.jumpLH_level = 2;
this.prop_levels.jumpRH_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 107
//Jumpers (com.geekglue.pMotion.View.Levels.Jumpers)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Jumpers extends LevelBase {
public function Jumpers(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 15;
level_target = 80;
map_point.x = 298;
map_point.y = 260;
city = "Ar Riyad";
country = "Saudi Arabia";
_local1 = new BodyVO("ball", 100, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(380, 304);
this.bonus_list.push(_local2);
_local1 = new BodyVO("jumpRH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpLH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("ramp30", 0, 0, 100, 2);
this.prop_list.push(_local1);
this.prop_levels.jumpLH_level = 1;
this.prop_levels.jumpRH_level = 1;
this.prop_levels.ramp30_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 108
//JumpRH03 (com.geekglue.pMotion.View.Levels.JumpRH03)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class JumpRH03 extends LevelBase {
public function JumpRH03(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 15;
level_target = 180;
map_point.x = 177;
map_point.y = 154;
city = "Ilulissat";
country = "Greenland";
_local1 = new BodyVO("ball", 200, 200);
this.start_list.push(_local1);
_local2 = new BonusItem(220, 330);
this.bonus_list.push(_local2);
_local2 = new BonusItem(475, 195);
this.bonus_list.push(_local2);
_local1 = new BodyVO("ramp30", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpLH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpRH", 0, 0, 100, 3);
this.prop_list.push(_local1);
this.prop_levels.ramp30_level = 2;
this.prop_levels.jumpLH_level = 1;
this.prop_levels.jumpRH_level = 3;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 109
//JumpRH04 (com.geekglue.pMotion.View.Levels.JumpRH04)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class JumpRH04 extends LevelBase {
public function JumpRH04(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 660;
map_point.x = 260;
map_point.y = 229;
city = "Venice";
country = "Italy";
_local1 = new BodyVO("ball", 100, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(280, 60);
this.bonus_list.push(_local2);
_local2 = new BonusItem(118, 260);
this.bonus_list.push(_local2);
_local2 = new BonusItem(350, 395);
this.bonus_list.push(_local2);
_local2 = new BonusItem(595, 250);
this.bonus_list.push(_local2);
_local1 = new BodyVO("ramp30", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN30", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpLH", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpRH", 0, 0, 100, 5);
this.prop_list.push(_local1);
this.prop_levels.ramp30_level = 3;
this.prop_levels.rampN30_level = 3;
this.prop_levels.jumpLH_level = 3;
this.prop_levels.jumpRH_level = 4;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 110
//LevelBase (com.geekglue.pMotion.View.Levels.LevelBase)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
public class LevelBase {
public var prop_levels:PropLevelVO;
public var level_index:Number;// = -1
public var start_list:Array;
public var tooltip_pos:String;// = "right"
public var level_max_time:Number;// = 30
public var country:String;// = ""
public var points:Number;// = 0
public var city:String;// = ""
public var map_point:PointVO;
public var level_target:Number;// = 30
public var prop_list:Array;
public var bonus_list:Array;
public function LevelBase(){
bonus_list = new Array();
prop_list = new Array();
start_list = new Array();
country = "";
city = "";
level_index = -1;
level_max_time = 30;
level_target = 30;
map_point = new PointVO();
prop_levels = new PropLevelVO();
points = 0;
tooltip_pos = "right";
super();
}
}
}//package com.geekglue.pMotion.View.Levels
Section 111
//LongRamp (com.geekglue.pMotion.View.Levels.LongRamp)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class LongRamp extends LevelBase {
public function LongRamp(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 25;
level_target = 200;
city = "Caracas";
country = "Venezuela";
map_point.x = 152;
map_point.y = 274;
_local1 = new BodyVO("ball", 100, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(615, 150);
this.bonus_list.push(_local2);
_local2 = new BonusItem(360, 152);
this.bonus_list.push(_local2);
_local2 = new BonusItem(17, 285);
this.bonus_list.push(_local2);
_local1 = new BodyVO("springRH", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN10", 0, 0, 100, 4);
this.prop_list.push(_local1);
_local1 = new BodyVO("shootRH", 0, 0, 100, 1);
this.prop_list.push(_local1);
this.prop_levels.shootRH_level = 1;
this.prop_levels.springRH_level = 3;
this.prop_levels.rampN10_level = 4;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 112
//Maze (com.geekglue.pMotion.View.Levels.Maze)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Maze extends LevelBase {
public function Maze(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 1000;
city = "Paderborn";
country = "Germany";
map_point.x = 270;
map_point.y = 215;
_local1 = new BodyVO("ball", 335, 240);
this.start_list.push(_local1);
_local2 = new BonusItem(30, 260);
this.bonus_list.push(_local2);
_local2 = new BonusItem(275, 400);
this.bonus_list.push(_local2);
_local2 = new BonusItem(510, 260);
this.bonus_list.push(_local2);
_local2 = new BonusItem(545, 170);
this.bonus_list.push(_local2);
_local1 = new BodyVO("rampN30", 0, 0, 100, 4);
this.prop_list.push(_local1);
_local1 = new BodyVO("ramp30", 0, 0, 100, 4);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpRH", 0, 0, 100, 5);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpLH", 0, 0, 100, 5);
this.prop_list.push(_local1);
this.prop_levels.rampN30_level = 4;
this.prop_levels.ramp30_level = 4;
this.prop_levels.jumpRH_level = 4;
this.prop_levels.jumpLH_level = 4;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 113
//MidRamps (com.geekglue.pMotion.View.Levels.MidRamps)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class MidRamps extends LevelBase {
public function MidRamps(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 250;
map_point.x = 366;
map_point.y = 273;
city = "Bangkok";
country = "Thailand";
_local1 = new BodyVO("ball", 100, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(495, 72);
this.bonus_list.push(_local2);
_local2 = new BonusItem(312, 260);
this.bonus_list.push(_local2);
_local2 = new BonusItem(600, 157);
this.bonus_list.push(_local2);
_local1 = new BodyVO("ramp10", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN10", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("springLH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("springRH", 0, 0, 100, 2);
this.prop_list.push(_local1);
this.prop_levels.ramp10_level = 2;
this.prop_levels.rampN10_level = 2;
this.prop_levels.springLH_level = 1;
this.prop_levels.springRH_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 114
//Oscillator (com.geekglue.pMotion.View.Levels.Oscillator)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Oscillator extends LevelBase {
public function Oscillator(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 10;
level_target = 20;
city = "Gatineau";
country = "Canada";
map_point.x = 145;
map_point.y = 220;
_local1 = new BodyVO("ball", 350, 200);
this.start_list.push(_local1);
_local2 = new BonusItem(260, 220);
this.bonus_list.push(_local2);
_local2 = new BonusItem(450, 105);
this.bonus_list.push(_local2);
_local1 = new BodyVO("rampN30", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("bumper", 0, 0, 100, 2);
this.prop_list.push(_local1);
this.prop_levels.rampN30_level = 1;
this.prop_levels.bumper_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 115
//RampCircuit (com.geekglue.pMotion.View.Levels.RampCircuit)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class RampCircuit extends LevelBase {
public function RampCircuit(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 280;
city = "Xining";
country = "China";
map_point.x = 357;
map_point.y = 233;
_local1 = new BodyVO("ball", 335, 200);
this.start_list.push(_local1);
_local2 = new BonusItem(122, 260);
this.bonus_list.push(_local2);
_local2 = new BonusItem(318, 132);
this.bonus_list.push(_local2);
_local2 = new BonusItem(545, 145);
this.bonus_list.push(_local2);
_local1 = new BodyVO("rampN30", 0, 0, 100, 5);
this.prop_list.push(_local1);
_local1 = new BodyVO("ramp30", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("bumper", 0, 0, 100, 8);
this.prop_list.push(_local1);
this.prop_levels.rampN30_level = 5;
this.prop_levels.ramp30_level = 3;
this.prop_levels.bumper_level = 3;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 116
//Ramps03 (com.geekglue.pMotion.View.Levels.Ramps03)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Ramps03 extends LevelBase {
public function Ramps03(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 15;
level_target = 130;
map_point.x = 178;
map_point.y = 330;
city = "Curitiba";
country = "Brazil";
_local1 = new BodyVO("ball", 100, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(340, 105);
this.bonus_list.push(_local2);
_local2 = new BonusItem(575, 215);
this.bonus_list.push(_local2);
_local2 = new BonusItem(355, 340);
this.bonus_list.push(_local2);
_local1 = new BodyVO("jumpRH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpLH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("ramp30", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN30", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("bumper", 0, 0, 100, 1);
this.prop_list.push(_local1);
this.prop_levels.bumper_level = 1;
this.prop_levels.jumpLH_level = 1;
this.prop_levels.jumpRH_level = 1;
this.prop_levels.ramp30_level = 3;
this.prop_levels.rampN30_level = 1;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 117
//ReverseCascade (com.geekglue.pMotion.View.Levels.ReverseCascade)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class ReverseCascade extends LevelBase {
public function ReverseCascade(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 220;
city = "Cape Town";
country = "Sth Africa";
map_point.x = 267;
map_point.y = 333;
_local1 = new BodyVO("ball", 345, 175);
this.start_list.push(_local1);
_local2 = new BonusItem(325, 55);
this.bonus_list.push(_local2);
_local2 = new BonusItem(525, 200);
this.bonus_list.push(_local2);
_local2 = new BonusItem(270, 350);
this.bonus_list.push(_local2);
_local2 = new BonusItem(188, 280);
this.bonus_list.push(_local2);
_local1 = new BodyVO("ramp30", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN30", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("springLH", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("springRH", 0, 0, 100, 3);
this.prop_list.push(_local1);
this.prop_levels.rampN30_level = 3;
this.prop_levels.ramp30_level = 2;
this.prop_levels.springRH_level = 3;
this.prop_levels.springLH_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 118
//Shooters03 (com.geekglue.pMotion.View.Levels.Shooters03)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Shooters03 extends LevelBase {
public function Shooters03(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 150;
map_point.x = 115;
map_point.y = 245;
_local1 = new BodyVO("ball", 100, 150);
this.start_list.push(_local1);
city = "Roswell";
country = "USA";
_local2 = new BonusItem(180, 240);
this.bonus_list.push(_local2);
_local2 = new BonusItem(415, 170);
this.bonus_list.push(_local2);
_local2 = new BonusItem(585, 205);
this.bonus_list.push(_local2);
_local1 = new BodyVO("rampN10", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("ramp30", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("springLH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("shootRH", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("shootLH", 0, 0, 100, 3);
this.prop_list.push(_local1);
this.prop_levels.rampN10_level = 1;
this.prop_levels.ramp30_level = 1;
this.prop_levels.springLH_level = 1;
this.prop_levels.shootRH_level = 2;
this.prop_levels.shootLH_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 119
//ShootLH01 (com.geekglue.pMotion.View.Levels.ShootLH01)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class ShootLH01 extends LevelBase {
public function ShootLH01(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 100;
map_point.x = 336;
map_point.y = 272;
city = "Rajasthan";
country = "India";
_local1 = new BodyVO("ball", 100, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(163, 100);
this.bonus_list.push(_local2);
_local2 = new BonusItem(335, 197);
this.bonus_list.push(_local2);
_local1 = new BodyVO("springRH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("ramp10", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN10", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("shootLH", 0, 0, 100, 1);
this.prop_list.push(_local1);
this.prop_levels.ramp10_level = 2;
this.prop_levels.rampN10_level = 1;
this.prop_levels.shootLH_level = 1;
this.prop_levels.springRH_level = 1;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 120
//ShootLH04 (com.geekglue.pMotion.View.Levels.ShootLH04)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class ShootLH04 extends LevelBase {
public function ShootLH04(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 390;
map_point.x = 275;
map_point.y = 185;
city = "Oulu";
country = "Finland";
_local1 = new BodyVO("ball", 100, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(300, 157);
this.bonus_list.push(_local2);
_local2 = new BonusItem(575, 265);
this.bonus_list.push(_local2);
_local2 = new BonusItem(680, 325);
this.bonus_list.push(_local2);
_local2 = new BonusItem(30, 370);
this.bonus_list.push(_local2);
_local1 = new BodyVO("rampN10", 0, 0, 100, 4);
this.prop_list.push(_local1);
_local1 = new BodyVO("springLH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("shootLH", 0, 0, 100, 12);
this.prop_list.push(_local1);
_local1 = new BodyVO("bumper", 0, 0, 100, 2);
this.prop_list.push(_local1);
this.prop_levels.rampN10_level = 4;
this.prop_levels.springLH_level = 1;
this.prop_levels.shootLH_level = 4;
this.prop_levels.bumper_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 121
//ShootRH02 (com.geekglue.pMotion.View.Levels.ShootRH02)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class ShootRH02 extends LevelBase {
public function ShootRH02(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 60;
map_point.x = 120;
map_point.y = 267;
city = "Acapulco";
country = "Mexico";
_local1 = new BodyVO("ball", 80, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(315, 195);
this.bonus_list.push(_local2);
_local2 = new BonusItem(545, 150);
this.bonus_list.push(_local2);
_local1 = new BodyVO("ramp10", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN10", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("shootRH", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("bumper", 0, 0, 100, 1);
this.prop_list.push(_local1);
this.prop_levels.ramp10_level = 1;
this.prop_levels.rampN10_level = 2;
this.prop_levels.shootRH_level = 2;
this.prop_levels.bumper_level = 1;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 122
//SimpleBumper (com.geekglue.pMotion.View.Levels.SimpleBumper)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class SimpleBumper extends LevelBase {
public function SimpleBumper(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 10;
level_target = 60;
city = "Nome";
country = "Alaska";
map_point.x = 40;
map_point.y = 190;
_local1 = new BodyVO("ball", 150, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(530, 185);
this.bonus_list.push(_local2);
_local1 = new BodyVO("bumper", 0, 0, 100, 2);
this.prop_list.push(_local1);
this.prop_levels.bumper_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 123
//SimpleConveyor (com.geekglue.pMotion.View.Levels.SimpleConveyor)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class SimpleConveyor extends LevelBase {
public function SimpleConveyor(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 15;
level_target = 480;
city = "Moscow";
country = "Russia";
map_point.x = 300;
map_point.y = 195;
_local1 = new BodyVO("ball", 35, 185);
this.start_list.push(_local1);
_local2 = new BonusItem(190, 295);
this.bonus_list.push(_local2);
_local2 = new BonusItem(470, 295);
this.bonus_list.push(_local2);
_local2 = new BonusItem(680, 385);
this.bonus_list.push(_local2);
_local1 = new BodyVO("rampN10", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("springLH", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("shootRH", 0, 0, 100, 12);
this.prop_list.push(_local1);
this.prop_levels.rampN10_level = 2;
this.prop_levels.springLH_level = 2;
this.prop_levels.shootRH_level = 4;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 124
//SimpleMaze (com.geekglue.pMotion.View.Levels.SimpleMaze)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class SimpleMaze extends LevelBase {
public function SimpleMaze(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 300;
city = "Reykjavik";
country = "Iceland";
map_point.x = 216;
map_point.y = 183;
_local1 = new BodyVO("ball", 335, 140);
this.start_list.push(_local1);
_local2 = new BonusItem(100, 205);
this.bonus_list.push(_local2);
_local2 = new BonusItem(435, 205);
this.bonus_list.push(_local2);
_local2 = new BonusItem(375, 365);
this.bonus_list.push(_local2);
_local1 = new BodyVO("rampN30", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("ramp30", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpRH", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("jumpLH", 0, 0, 100, 3);
this.prop_list.push(_local1);
this.prop_levels.rampN30_level = 3;
this.prop_levels.ramp30_level = 3;
this.prop_levels.jumpRH_level = 3;
this.prop_levels.jumpLH_level = 3;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 125
//SimpleSpringRamp (com.geekglue.pMotion.View.Levels.SimpleSpringRamp)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class SimpleSpringRamp extends LevelBase {
public function SimpleSpringRamp(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 15;
level_target = 40;
map_point.x = 386;
map_point.y = 328;
city = "Geraldton";
country = "Australia";
_local1 = new BodyVO("ball", 450, 200);
this.start_list.push(_local1);
_local2 = new BonusItem(110, 210);
this.bonus_list.push(_local2);
_local2 = new BonusItem(270, 138);
this.bonus_list.push(_local2);
_local1 = new BodyVO("ramp10", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN30", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("springLH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("springRH", 0, 0, 100, 1);
this.prop_list.push(_local1);
this.prop_levels.ramp10_level = 1;
this.prop_levels.rampN30_level = 1;
this.prop_levels.springLH_level = 1;
this.prop_levels.springRH_level = 1;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 126
//Spring70 (com.geekglue.pMotion.View.Levels.Spring70)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Spring70 extends LevelBase {
public function Spring70(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 15;
level_target = 170;
city = "Yogyakarta";
country = "Indonesia";
map_point.x = 380;
map_point.y = 300;
_local1 = new BodyVO("ball", 200, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(435, 50);
this.bonus_list.push(_local2);
_local2 = new BonusItem(448, 232);
this.bonus_list.push(_local2);
_local1 = new BodyVO("springLH", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("springRH", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("ramp30", 0, 0, 100, 1);
this.prop_list.push(_local1);
this.prop_levels.ramp30_level = 1;
this.prop_levels.springRH_level = 2;
this.prop_levels.springLH_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 127
//SpringCircle (com.geekglue.pMotion.View.Levels.SpringCircle)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class SpringCircle extends LevelBase {
public function SpringCircle(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_index = 6;
level_max_time = 15;
level_target = 220;
city = "AHaggar";
country = "Algeria";
map_point.x = 0xFF;
map_point.y = 262;
_local1 = new BodyVO("ball", 400, 230);
this.start_list.push(_local1);
_local2 = new BonusItem(380, 100);
this.bonus_list.push(_local2);
_local2 = new BonusItem(220, 275);
this.bonus_list.push(_local2);
_local2 = new BonusItem(566, 222);
this.bonus_list.push(_local2);
_local1 = new BodyVO("springLH", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("springRH", 0, 0, 100, 3);
this.prop_list.push(_local1);
this.prop_levels.springRH_level = 3;
this.prop_levels.springLH_level = 3;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 128
//SpringCircleUnder (com.geekglue.pMotion.View.Levels.SpringCircleUnder)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class SpringCircleUnder extends LevelBase {
public function SpringCircleUnder(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 25;
level_target = 300;
map_point.x = 370;
map_point.y = 288;
city = "Singapore";
country = "Singapore";
_local1 = new BodyVO("ball", 300, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(22, 200);
this.bonus_list.push(_local2);
_local2 = new BonusItem(284, 326);
this.bonus_list.push(_local2);
_local2 = new BonusItem(0x0202, 310);
this.bonus_list.push(_local2);
_local1 = new BodyVO("ramp10", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN10", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("springLH", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("springRH", 0, 0, 100, 2);
this.prop_list.push(_local1);
this.prop_levels.ramp10_level = 1;
this.prop_levels.rampN10_level = 1;
this.prop_levels.springLH_level = 3;
this.prop_levels.springRH_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 129
//SpringRamp01 (com.geekglue.pMotion.View.Levels.SpringRamp01)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class SpringRamp01 extends LevelBase {
public function SpringRamp01(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 15;
level_target = 100;
city = "Uluru";
country = "Australia";
map_point.x = 405;
map_point.y = 315;
_local1 = new BodyVO("ball", 400, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(70, 200);
this.bonus_list.push(_local2);
_local2 = new BonusItem(209, 113);
this.bonus_list.push(_local2);
_local1 = new BodyVO("springRH", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("springLH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN30", 0, 0, 100, 1);
this.prop_list.push(_local1);
this.prop_levels.rampN30_level = 1;
this.prop_levels.springRH_level = 2;
this.prop_levels.springLH_level = 1;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 130
//SpringRamp02 (com.geekglue.pMotion.View.Levels.SpringRamp02)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class SpringRamp02 extends LevelBase {
public function SpringRamp02(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 15;
level_target = 200;
city = "Zanzibar";
country = "Tanzania";
map_point.x = 290;
map_point.y = 295;
_local1 = new BodyVO("ball", 400, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(20, 236);
this.bonus_list.push(_local2);
_local2 = new BonusItem(310, 105);
this.bonus_list.push(_local2);
_local1 = new BodyVO("springRH", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("springLH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN30", 0, 0, 100, 2);
this.prop_list.push(_local1);
this.prop_levels.rampN30_level = 2;
this.prop_levels.springRH_level = 3;
this.prop_levels.springLH_level = 1;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 131
//SpringRampCircle (com.geekglue.pMotion.View.Levels.SpringRampCircle)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class SpringRampCircle extends LevelBase {
public function SpringRampCircle(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 350;
city = "Rame Head";
country = "England";
map_point.x = 237;
map_point.y = 210;
_local1 = new BodyVO("ball", 620, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(57, 285);
this.bonus_list.push(_local2);
_local2 = new BonusItem(425, 40);
this.bonus_list.push(_local2);
_local2 = new BonusItem(360, 380);
this.bonus_list.push(_local2);
_local1 = new BodyVO("springRH", 0, 0, 100, 5);
this.prop_list.push(_local1);
_local1 = new BodyVO("springLH", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN30", 0, 0, 100, 2);
this.prop_list.push(_local1);
this.prop_levels.springRH_level = 4;
this.prop_levels.springLH_level = 2;
this.prop_levels.rampN30_level = 2;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 132
//Springs (com.geekglue.pMotion.View.Levels.Springs)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Springs extends LevelBase {
public function Springs(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 10;
level_target = 20;
tooltip_pos = "left";
city = "Parkes";
country = "Australia";
map_point.x = 428;
map_point.y = 328;
_local1 = new BodyVO("ball", 230, 150);
this.start_list.push(_local1);
_local2 = new BonusItem(388, 0x0101);
this.bonus_list.push(_local2);
_local1 = new BodyVO("springLH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("springRH", 0, 0, 100, 1);
this.prop_list.push(_local1);
this.prop_levels.springRH_level = 1;
this.prop_levels.springLH_level = 1;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 133
//SpringShooter (com.geekglue.pMotion.View.Levels.SpringShooter)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class SpringShooter extends LevelBase {
public function SpringShooter(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 30;
level_target = 1500;
city = "Irkutsk";
country = "Russia";
map_point.x = 370;
map_point.y = 185;
_local1 = new BodyVO("ball", 35, 185);
this.start_list.push(_local1);
_local2 = new BonusItem(165, 145);
this.bonus_list.push(_local2);
_local2 = new BonusItem(165, 305);
this.bonus_list.push(_local2);
_local2 = new BonusItem(655, 390);
this.bonus_list.push(_local2);
_local2 = new BonusItem(670, 70);
this.bonus_list.push(_local2);
_local1 = new BodyVO("springLH", 0, 0, 100, 3);
this.prop_list.push(_local1);
_local1 = new BodyVO("springRH", 0, 0, 100, 2);
this.prop_list.push(_local1);
_local1 = new BodyVO("shootLH", 0, 0, 100, 24);
this.prop_list.push(_local1);
_local1 = new BodyVO("shootRH", 0, 0, 100, 24);
this.prop_list.push(_local1);
this.prop_levels.springLH_level = 3;
this.prop_levels.springRH_level = 2;
this.prop_levels.shootLH_level = 5;
this.prop_levels.shootRH_level = 5;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 134
//Stairway (com.geekglue.pMotion.View.Levels.Stairway)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Stairway extends LevelBase {
public function Stairway(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 20;
level_target = 580;
city = "Barcelona";
country = "Spain";
map_point.x = 240;
map_point.y = 240;
_local1 = new BodyVO("ball", 650, 50);
this.start_list.push(_local1);
_local2 = new BonusItem(19, 400);
this.bonus_list.push(_local2);
_local2 = new BonusItem(242, 170);
this.bonus_list.push(_local2);
_local2 = new BonusItem(0x0202, 25);
this.bonus_list.push(_local2);
_local1 = new BodyVO("springRH", 0, 0, 100, 5);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN30", 0, 0, 100, 4);
this.prop_list.push(_local1);
this.prop_levels.springRH_level = 5;
this.prop_levels.rampN30_level = 4;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 135
//Start (com.geekglue.pMotion.View.Levels.Start)
package com.geekglue.pMotion.View.Levels {
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Start extends LevelBase {
public function Start(){
var _local1:BodyVO;
var _local2:BonusItem;
super();
level_max_time = 10;
level_target = 20;
city = "Wanganui";
country = "New Zealand";
tooltip_pos = "left";
map_point.x = 458;
map_point.y = 346;
_local1 = new BodyVO("ball", 360, 150);
this.start_list.push(_local1);
_local1 = new BodyVO("instructions", 0, 0, 1);
this.start_list.push(_local1);
_local2 = new BonusItem(223, 220);
this.bonus_list.push(_local2);
_local1 = new BodyVO("springRH", 0, 0, 100, 1);
this.prop_list.push(_local1);
_local1 = new BodyVO("rampN30", 0, 0, 100, 1);
this.prop_list.push(_local1);
this.prop_levels.rampN30_level = 1;
this.prop_levels.springRH_level = 1;
}
}
}//package com.geekglue.pMotion.View.Levels
Section 136
//Bumper (com.geekglue.pMotion.View.Props.Bumper)
package com.geekglue.pMotion.View.Props {
public class Bumper extends PropBase {
public function Bumper(){
cost = new Array(40, 80, 360, 800, 1600);
level_required = new Array(13, 20, 32, 34, 35);
qty = new Array("1", "4", "8", "16", "32");
type = "bumper";
type_name = "Bumper";
angle = "NA";
direction = "NA";
}
}
}//package com.geekglue.pMotion.View.Props
Section 137
//JumpLH (com.geekglue.pMotion.View.Props.JumpLH)
package com.geekglue.pMotion.View.Props {
public class JumpLH extends PropBase {
public function JumpLH(){
cost = new Array(50, 100, 150, 475);
level_required = new Array(9, 15, 23, 27);
qty = new Array("1", "2", "3", "5");
type = "jumpLH";
type_name = "Jump";
angle = "NA";
direction = "West";
}
}
}//package com.geekglue.pMotion.View.Props
Section 138
//JumpRH (com.geekglue.pMotion.View.Props.JumpRH)
package com.geekglue.pMotion.View.Props {
public class JumpRH extends PropBase {
public function JumpRH(){
cost = new Array(50, 100, 150, 475);
level_required = new Array(8, 15, 22, 26);
qty = new Array("1", "2", "3", "5");
type = "jumpRH";
type_name = "Jump";
angle = "NA";
direction = "East";
}
}
}//package com.geekglue.pMotion.View.Props
Section 139
//PropBase (com.geekglue.pMotion.View.Props.PropBase)
package com.geekglue.pMotion.View.Props {
public class PropBase {
public var level_required:Array;
public var cost:Array;
public var type_name:String;// = "Ramp"
public var angle:String;// = "10"
public var qty:Array;
public var type:String;// = "rampN10"
public var direction:String;// = "West"
public function PropBase(){
cost = new Array(10, 20, 40, 80, 120, 150);
level_required = new Array(1, 2, 3, 4, 5, 6);
qty = new Array("1", "2", "4", "8", "16", "32");
type = "rampN10";
type_name = "Ramp";
angle = "10";
direction = "West";
super();
}
}
}//package com.geekglue.pMotion.View.Props
Section 140
//Ramp10 (com.geekglue.pMotion.View.Props.Ramp10)
package com.geekglue.pMotion.View.Props {
public class Ramp10 extends PropBase {
public function Ramp10(){
cost = new Array(30, 100);
level_required = new Array(2, 6);
qty = new Array("1", "2");
type = "ramp10";
type_name = "Ramp";
angle = "10";
direction = "East";
}
}
}//package com.geekglue.pMotion.View.Props
Section 141
//Ramp30 (com.geekglue.pMotion.View.Props.Ramp30)
package com.geekglue.pMotion.View.Props {
public class Ramp30 extends PropBase {
public function Ramp30(){
cost = new Array(40, 100, 200, 300);
level_required = new Array(4, 9, 14, 27);
qty = new Array("1", "2", "3", "4");
type = "ramp30";
type_name = "Ramp";
angle = "30";
direction = "East";
}
}
}//package com.geekglue.pMotion.View.Props
Section 142
//RampN10 (com.geekglue.pMotion.View.Props.RampN10)
package com.geekglue.pMotion.View.Props {
public class RampN10 extends PropBase {
public function RampN10(){
cost = new Array(30, 100, 200, 300);
level_required = new Array(5, 6, 8, 16);
qty = new Array("1", "2", "3", "4");
type = "rampN10";
type_name = "Ramp";
angle = "10";
direction = "West";
}
}
}//package com.geekglue.pMotion.View.Props
Section 143
//RampN30 (com.geekglue.pMotion.View.Props.RampN30)
package com.geekglue.pMotion.View.Props {
public class RampN30 extends PropBase {
public function RampN30(){
cost = new Array(40, 100, 200, 300, 400);
level_required = new Array(0, 11, 12, 25, 28);
qty = new Array("1", "2", "3", "4", "5");
type = "rampN30";
type_name = "Ramp";
angle = "30";
direction = "West";
}
}
}//package com.geekglue.pMotion.View.Props
Section 144
//ShootLH (com.geekglue.pMotion.View.Props.ShootLH)
package com.geekglue.pMotion.View.Props {
public class ShootLH extends PropBase {
public function ShootLH(){
cost = new Array(30, 60, 90, 300, 530);
level_required = new Array(7, 18, 19, 29, 31);
qty = new Array("1", "3", "6", "12", "24");
type = "shootLH";
type_name = "Shooter";
angle = "NA";
direction = "West";
}
}
}//package com.geekglue.pMotion.View.Props
Section 145
//ShootRH (com.geekglue.pMotion.View.Props.ShootRH)
package com.geekglue.pMotion.View.Props {
public class ShootRH extends PropBase {
public function ShootRH(){
cost = new Array(30, 60, 90, 300, 530);
level_required = new Array(16, 17, 19, 30, 31);
qty = new Array("1", "3", "6", "12", "24");
type = "shootRH";
type_name = "Shooter";
angle = "NA";
direction = "East";
}
}
}//package com.geekglue.pMotion.View.Props
Section 146
//SpringLH (com.geekglue.pMotion.View.Props.SpringLH)
package com.geekglue.pMotion.View.Props {
public class SpringLH extends PropBase {
public function SpringLH(){
cost = new Array(30, 60, 150);
level_required = new Array(1, 4, 5);
qty = new Array("1", "2", "3");
type = "springLH";
type_name = "Spring";
angle = "NA";
direction = "West";
}
}
}//package com.geekglue.pMotion.View.Props
Section 147
//SpringRH (com.geekglue.pMotion.View.Props.SpringRH)
package com.geekglue.pMotion.View.Props {
public class SpringRH extends PropBase {
public function SpringRH(){
cost = new Array(30, 60, 150, 220, 360);
level_required = new Array(0, 3, 10, 24, 25);
qty = new Array("1", "2", "3", "4", "5");
type = "springRH";
type_name = "Spring";
angle = "NA";
direction = "East";
}
}
}//package com.geekglue.pMotion.View.Props
Section 148
//Arena (com.geekglue.pMotion.View.Arena)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import Box2D.Common.Math.*;
import com.geekglue.pMotion.VO.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import com.geekglue.Box2Utils.VO.*;
import flash.media.*;
import com.geekglue.pMotion.Model.*;
import flash.geom.*;
import com.geekglue.pMotion.View.Levels.*;
import com.geekglue.pMotion.Assets.*;
import flash.utils.*;
import com.geekglue.Box2Utils.*;
import flash.filters.*;
import com.geekglue.pMotion.View.Instructions.*;
import flash.ui.*;
public class Arena extends Sprite {
private var drag_offset:b2Vec2;
private var fx_spring:FXSpring;
private var ball_reset_timer:Timer;
private var default_style:StyleVO;
private var fx_bumper_channel:SoundChannel;
private var fx_shoot_channel:SoundChannel;
private var catch_RH:b2Body;
private var bonus_item_list:Array;
private var sequence_list:Array;
private var start_list:Array;
private var fx_bumper:FXBumper;
private var fx_shoot_state:Boolean;// = false
private var fx_shoot:FXShoot;
private var ball_start_pos:b2Vec2;
private var body_minX:Number;// = -100
private var bonus_count:Number;// = 0
private var extras_list:Array;
private var action_list:Array;
private var model:ModelLocator;
public var iterations:int;// = 15
public var timeStep:Number;// = 0.025
private var contact_list:Array;
public var ball_reset_state:Boolean;// = false
private var level:LevelBase;
private var collision_list:Array;
private var catch_floor:b2Body;
private var world:b2World;
private var clicker_velocity:Number;// = 5
private var drag_body:b2Body;
private var sequence_target:Number;// = 5
private var springH:Number;// = 20
private var springW:Number;// = 50
private var body_maxY:Number;// = 520
private var body_maxX:Number;// = 560
private var ball:b2Body;
public static var ARENA_EDIT_EVENT:String = "arena_edit_event";
public static var LEVEL_PAUSE_EVENT:String = "level_pause_event";
public static var STATS_SHOW_EVENT:String = "stats_show_event";
public static var LEVEL_END_EVENT:String = "level_end_event";
public function Arena(){
model = ModelLocator.getInstance();
iterations = 15;
timeStep = (1 / 40);
action_list = new Array();
ball_start_pos = new b2Vec2(20, 50);
ball_reset_state = false;
body_minX = -100;
body_maxX = 560;
body_maxY = 520;
bonus_count = 0;
bonus_item_list = new Array();
clicker_velocity = 5;
contact_list = new Array();
drag_offset = new b2Vec2(0, 0);
collision_list = new Array();
default_style = new StyleVO();
extras_list = new Array();
sequence_list = new Array();
sequence_target = 5;
springW = 50;
springH = 20;
fx_shoot_state = false;
start_list = new Array();
super();
this.cacheAsBitmap = false;
this.ball_reset_timer = new Timer(200, 1);
this.ball_reset_timer.addEventListener(TimerEvent.TIMER_COMPLETE, retry_handler);
model.addEventListener(ModelLocator.BODY_ADD_EVENT, body_add_handler);
model.addEventListener(ModelLocator.BODY_DRAG_END_EVENT, body_drag_end_handler);
model.addEventListener(ModelLocator.BODY_DRAG_START_EVENT, body_drag_start);
arena_world_define();
default_style.stroke_color = 0;
default_style.stroke_weight = 1;
default_style.fill_alpha = 1;
default_style.fill_color = 14856993;
level_create();
fx_bumper = new FXBumper();
fx_shoot = new FXShoot();
fx_spring = new FXSpring();
}
private function body_position_test(_arg1:b2Body, _arg2:b2Body, _arg3:String):Boolean{
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Rectangle;
var _local8:Rectangle;
_local4 = true;
_local5 = 10;
_local6 = 2;
_local7 = DisplayObject(_arg1.m_userData).getBounds(this);
_local8 = DisplayObject(_arg2.m_userData).getBounds(this);
if ((((_arg3 == "shootLH")) || ((_arg3 == "shootRH")))){
_local5 = 12;
_local6 = 0;
};
if (_local7.bottom > (_local8.top + _local5)){
_local4 = false;
};
if (_local7.left > (_local8.right - _local6)){
_local4 = false;
};
if (_local7.right < (_local8.left - _local6)){
_local4 = false;
};
return (_local4);
}
private function ramp(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0, _arg4:Number=200, _arg5:Number=30, _arg6:String="NA"):b2Body{
var _local7:Number;
var _local8:Ramp_mc;
var _local9:b2Body;
var _local10:Sprite;
_local7 = radians(_arg5);
_local8 = new Ramp_mc();
_local9 = box(_arg1, _local8, _arg2, _arg3, _arg4, model.BODY_HEIGHT, 0, 0.3, 0, _local7);
_local10 = _local9.m_userData;
_local10.addEventListener(MouseEvent.MOUSE_DOWN, body_mouse_down_handler);
_local10.addEventListener(MouseEvent.MOUSE_UP, body_drag_end_handler);
this.collision_list.push(new CollisonVO(_local9, "ramp", _arg6));
return (_local9);
}
private function level_create():void{
var _local1:b2Vec2;
var _local2:BodyVO;
model.level_load_current(model.level);
bonus_items_create();
model.level_target = model.level_current.level_target;
model.level_max_time = model.level_current.level_max_time;
for each (_local2 in model.level_current.start_list) {
switch (_local2.type){
case "ball":
this.ball_start_pos.x = _local2.position.x;
this.ball_start_pos.y = _local2.position.y;
ball_create(_local2);
break;
case "instructions":
instructions(_local2);
break;
};
};
model.level_state = true;
this.step();
}
public function pause():void{
this.contact_list = new Array();
this.model.run_state = false;
this.removeEventListener(Event.ENTER_FRAME, Update);
}
private function update_motion():void{
var _local1:BodyVO;
var _local2:b2Body;
var _local3:String;
var _local4:b2Vec2;
var _local5:Number;
var _local6:Number;
for each (_local1 in this.action_list) {
_local2 = _local1.body;
_local3 = _local1.type;
_local4 = _local1.position;
if (_local3 == "clicker"){
_local5 = _local2.GetRotation();
_local6 = _local2.GetAngularVelocity();
if ((((_local5 > 0.78)) && ((_local6 < clicker_velocity)))){
clicker_velocity_reset(_local2);
};
};
};
}
private function custom_menu_create(_arg1):void{
var _local2:ContextMenuItem;
var _local3:ContextMenu;
_local2 = new ContextMenuItem("Remove Prop");
_local2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, body_delete_handler);
_local3 = new ContextMenu();
_local3.hideBuiltInItems();
_local3.customItems.push(_local2);
_arg1.contextMenu = _local3;
}
private function clicker(_arg1:BodyVO):void{
var _local2:b2Vec2;
var _local3:b2Body;
var _local4:Clicker;
var _local5:b2RevoluteJointDef;
_local2 = _arg1.position;
_local3 = this.circle(default_style, null, (_local2.x + 9), (_local2.y - 1.5), 5, 0);
_local4 = new Clicker(default_style, (_local2.x + 5), (_local2.y - 1), 10);
addChild(_local4.userData);
_arg1.body = world.CreateBody(_local4);
_local5 = new b2RevoluteJointDef();
_local5.body1 = _local3;
_local5.body2 = _arg1.body;
_local5.anchorPoint = _local3.GetCenterPosition();
world.CreateJoint(_local5);
clicker_velocity_reset(_arg1.body);
this.action_list.push(_arg1);
}
private function line_block_test(_arg1:Rectangle, _arg2:Rectangle, _arg3:Array, _arg4:String):Boolean{
var _local5:Boolean;
var _local6:b2Body;
var _local7:MovieClip;
var _local8:Rectangle;
var _local9:CollisonVO;
_local5 = false;
for each (_local9 in _arg3) {
_local6 = _local9.body;
_local7 = _local6.m_userData;
_local8 = _local7.getBounds(this);
if ((((_arg4 == "RH")) && (line_vertical_test(_arg1, _local8)))){
if ((((_local8.x < _arg1.x)) && ((_local8.x > _arg2.x)))){
_local5 = true;
};
} else {
if ((((_arg4 == "LH")) && (line_vertical_test(_arg1, _local8)))){
if ((((_local8.x > _arg1.x)) && ((_local8.x < _arg2.x)))){
_local5 = true;
};
} else {
if ((((_arg4 == "UP")) && (line_horizontal_test(_arg1, _local8)))){
if ((((_local8.y > _arg1.y)) && ((_local8.y < _arg2.y)))){
_local5 = true;
};
} else {
if ((((_arg4 == "LO")) && (line_horizontal_test(_arg1, _local8)))){
if ((((_local8.y < _arg1.y)) && ((_local8.y > _arg2.y)))){
_local5 = true;
};
};
};
};
};
};
return (_local5);
}
private function springLH(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0):b2Body{
var _local4:SpringBoxLH;
var _local5:b2Body;
var _local6:Sprite;
_local4 = new SpringBoxLH();
_local5 = box(_arg1, _local4, _arg2, _arg3, springW, springH, 0, 0.3, 0.9);
this.collision_list.push(new CollisonVO(_local5, "springLH"));
_local6 = _local5.m_userData;
_local6.addEventListener(MouseEvent.MOUSE_DOWN, body_mouse_down_handler);
custom_menu_create(_local6);
return (_local5);
}
private function jumpLH(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0):b2Body{
var _local4:Number;
var _local5:JumpLH_mc;
var _local6:b2Body;
var _local7:MovieClip;
_local4 = radians(30);
_local5 = new JumpLH_mc();
_local6 = box(_arg1, _local5, _arg2, _arg3, 100, 10, 0, 0.3, 0, _local4);
_local7 = _local6.m_userData;
_local7.addEventListener(MouseEvent.MOUSE_UP, body_drag_end_handler);
this.collision_list.push(new CollisonVO(_local6, "jumpLH"));
return (_local6);
}
private function body_drag_end_handler(_arg1:Event):void{
var r:Number;
var xPos:Number;
var yPos:Number;
var event = _arg1;
try {
this.removeEventListener(Event.ENTER_FRAME, body_drag_update);
model.drag_object.filters = null;
r = this.drag_body.m_rotation;
xPos = drag_body.m_userData.x;
yPos = drag_body.m_userData.y;
this.drag_body.SetCenterPosition(new b2Vec2(xPos, yPos), r);
if ((((((this.drag_body.m_position.y > this.body_maxY)) || ((this.drag_body.m_position.x < this.body_minX)))) || ((this.drag_body..m_position.x > this.body_maxX)))){
xPos = (model.ARENA_WIDTH / 2);
yPos = (this.body_maxY / 2);
r = this.drag_body.m_rotation;
this.drag_body.SetCenterPosition(new b2Vec2(xPos, yPos), r);
this.drag_body.m_userData.x = this.drag_body.m_position.x;
this.drag_body.m_userData.y = this.drag_body.m_position.y;
this.drag_body.m_userData.rotation = degrees(r);
} else {
this.body_drag_update(new Event("tmp_evt"));
};
this.drag_body = null;
} catch(e:Error) {
};
}
private function body_drag_test():Boolean{
var test:Boolean;
var bb:b2Body;
var t:DisplayObject;
var c:b2ContactNode;
test = true;
bb = world.m_bodyList;
while (bb) {
t = (bb.m_userData as DisplayObject);
c = bb.GetContactList();
try {
if (model.drag_object.name != t.name){
if (model.drag_object.hitTestObject(t)){
test = false;
break;
};
};
} catch(error:Error) {
};
bb = bb.m_next;
};
return (test);
}
private function body_drag_start(_arg1:Event):void{
var _local2:DisplayObject;
var _local3:BitmapFilter;
var _local4:Array;
if (!model.run_state){
_local2 = model.drag_object;
this.drag_body = find_my_body(_local2);
if (this.drag_body != null){
this.addEventListener(Event.ENTER_FRAME, body_drag_update);
_local3 = new GlowFilter(0xFF0000);
_local4 = new Array();
_local4.push(_local3);
model.drag_object.filters = _local4;
};
};
}
private function bonus_items_destroy():void{
var _local1:BonusItem;
for each (_local1 in this.bonus_item_list) {
this.removeChild(_local1);
};
this.bonus_item_list = new Array();
}
private function start_list_reset():void{
var _local1:CollisonVO;
var _local2:CollisonVO;
var _local3:b2Body;
var _local4:DisplayObject;
for each (_local2 in start_list) {
_local3 = _local2.body;
_local4 = _local3.m_userData;
this.removeChild(_local4);
_local3.Destroy();
};
this.start_list = new Array();
}
private function bonus_items_create():void{
var _local1:BonusItem;
var _local2:BonusItem;
bonus_items_destroy();
for each (_local2 in model.level_current.bonus_list) {
if (_local2.hit_state){
_local1 = new BonusItem();
_local1.xPos = _local2.xPos;
_local1.yPos = _local2.yPos;
_local1.x = _local2.xPos;
_local1.y = _local2.yPos;
this.addChild(_local1);
_local1.hit_state = false;
bonus_item_list.push(_local1);
};
};
}
private function score_combo_calc(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = 0;
_local3 = Math.round(((10 * _arg1) * _arg2));
return (_local3);
}
private function fx_bumper_end(_arg1:Event):void{
fx_shoot_state = false;
}
private function body_add_handler(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = this.mouseX;
_local3 = this.mouseY;
model.drag_offset = new b2Vec2(0, 0);
switch (model.pending.type){
case "bumper":
drag_body = bumper(default_style, 100, 300);
break;
case "fanRH":
drag_body = fanRH(default_style, _local2, _local3);
break;
case "shootRH":
drag_body = shootRH(default_style, 100, 300);
break;
case "shootLH":
drag_body = shootLH(default_style, 100, 300);
break;
case "springLH":
drag_body = springLH(default_style, 100, 300);
break;
case "springRH":
drag_body = springRH(default_style, 100, 300);
break;
case "jumpLH":
model.drag_offset = new b2Vec2(0, -3);
drag_body = jumpLH(default_style, _local2, _local3);
break;
case "jumpRH":
model.drag_offset = new b2Vec2(0, -3);
drag_body = jumpRH(default_style, _local2, _local3);
break;
case "ramp10":
drag_body = ramp(default_style, _local2, _local3, 200, 10, model.pending.type);
break;
case "rampN10":
drag_body = ramp(default_style, _local2, _local3, 200, -10, model.pending.type);
break;
case "ramp30":
drag_body = ramp(default_style, _local2, _local3, 200, 30, model.pending.type);
break;
case "rampN30":
drag_body = ramp(default_style, _local2, _local3, 200, -30, model.pending.type);
break;
case "ramp45":
drag_body = ramp(default_style, _local2, _local3, 200, 45, model.pending.type);
break;
case "rampN45":
drag_body = ramp(default_style, _local2, _local3, 200, -45, model.pending.type);
break;
};
_local4 = drag_body.m_rotation;
this.drag_body.SetCenterPosition(new b2Vec2(_local2, _local3), _local4);
drag_body.m_userData.x = drag_body.m_position.x;
drag_body.m_userData.y = drag_body.m_position.y;
drag_body.m_userData.rotation = degrees(_local4);
model.drag_object = (drag_body.m_userData as DisplayObject);
this.addEventListener(Event.ENTER_FRAME, body_drag_update);
}
private function bumper(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0):b2Body{
var _local4:Bumper;
var _local5:b2Body;
_local4 = new Bumper();
_local5 = box(_arg1, _local4, _arg2, _arg3, 20, 20, 0, 0.5, 0.1, 40);
this.collision_list.push(new CollisonVO(_local5, "bumper"));
return (_local5);
}
private function platform(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0, _arg4:Number=200):b2Body{
var _local5:b2Body;
_local5 = box(_arg1, null, _arg2, _arg3, _arg4, model.BODY_HEIGHT, 0, 0.5, 0);
this.start_list.push(new CollisonVO(_local5, "platform"));
return (_local5);
}
private function fanRH(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0):b2Body{
var _local4:FanRH;
var _local5:b2Body;
var _local6:DisplayObject;
_local4 = new FanRH();
_local5 = box(_arg1, _local4, _arg2, _arg3, 20, 20, 0, 0.3, 0);
_local6 = _local5.m_userData;
this.collision_list.push(new CollisonVO(_local5, "fanRH"));
return (_local5);
}
public function run():void{
model.level_start_time = getTimer();
this.bonus_count = 0;
model.sequence_count = 0;
this.sequence_list = new Array();
this.contact_list = new Array();
ball.m_userData.push();
body_drag_end_handler(new Event("end_evt"));
model.run_state = true;
this.addEventListener(Event.ENTER_FRAME, Update);
}
private function radians(_arg1:Number):Number{
var _local2:Number;
_local2 = (_arg1 * (Math.PI / 180));
return (_local2);
}
private function sequence_marker_create(_arg1:CollisonVO, _arg2:uint):void{
var _local3:DisplayObject;
var _local4:SequenceMarker;
var _local5:Number;
var _local6:Number;
_local3 = this.getChildByName(_arg1.name);
_local4 = new SequenceMarker(_arg2);
_local4.width = 29;
_local4.height = 20;
_local5 = _local3.x;
_local6 = _local3.y;
if (_local5 > (model.ARENA_WIDTH - _local4.width)){
_local5 = (model.ARENA_WIDTH - _local4.width);
};
if (_local6 > (model.ARENA_HEIGHT - _local4.height)){
_local6 = (model.ARENA_HEIGHT - _local4.height);
};
if ((((_arg1.type == "bumper")) || ((_arg1.type == "fanRH")))){
_local5 = (_local5 + 30);
_local6 = (_local6 + 15);
};
_local4.x = _local5;
_local4.y = _local6;
_local4.addEventListener(SequenceMarker.MARKER_EXPIRE_EVENT, sequence_marker_expire);
this.addChild(_local4);
}
private function shootRH(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0):b2Body{
var _local4:ShootRH;
var _local5:b2Body;
_local4 = new ShootRH();
_local5 = box(_arg1, _local4, _arg2, _arg3, 50, 10, 0, 0.5, 0);
this.collision_list.push(new CollisonVO(_local5, "shootRH"));
return (_local5);
}
private function catcher(_arg1:b2Vec2):void{
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:CatcherMit;
var _local6:b2Body;
var _local7:b2RevoluteJointDef;
_local2 = radians(30);
_local3 = this.circle(default_style, null, (_arg1.x - 3), (_arg1.y - 6), 5, 0);
_local4 = this.circle(default_style, null, (_arg1.x + 30), (_arg1.y - 20), 5, 0);
_local4.m_userData.visible = false;
_local5 = new CatcherMit(default_style, _local2, (_arg1.x + 5), (_arg1.y - 1), 10);
addChild(_local5.userData);
_local6 = world.CreateBody(_local5);
_local7 = new b2RevoluteJointDef();
_local7.body1 = _local3;
_local7.body2 = _local6;
_local7.anchorPoint = _local3.GetCenterPosition();
world.CreateJoint(_local7);
}
public function retry():void{
model.score_vo.reset();
bonus_items_create();
ball_reset(new Event("tmp"));
}
private function line_vertical_test(_arg1:Rectangle, _arg2:Rectangle):Boolean{
var _local3:Boolean;
var _local4:Number;
_local3 = false;
_local4 = (_arg1.y + (_arg1.height / 2));
if ((((_local4 < _arg2.bottom)) && ((_local4 > _arg2.top)))){
_local3 = true;
};
return (_local3);
}
private function retry_handler(_arg1:TimerEvent):void{
model.action_pending = "retry";
}
private function clicker_velocity_reset(_arg1:b2Body):void{
_arg1.SetAngularVelocity(clicker_velocity);
}
private function sequence_marker_expire(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
_local2.removeEventListener(SequenceMarker.MARKER_EXPIRE_EVENT, sequence_marker_expire);
this.removeChild(_local2);
}
private function line_direction_calc(_arg1:Rectangle, _arg2:Rectangle):String{
var _local3:String;
_local3 = "NA";
if ((((_arg1.left > _arg2.right)) && (line_vertical_test(_arg1, _arg2)))){
_local3 = "RH";
} else {
if ((((_arg1.right < _arg2.left)) && (line_vertical_test(_arg1, _arg2)))){
_local3 = "LH";
} else {
if ((((_arg1.bottom < _arg2.top)) && (line_horizontal_test(_arg1, _arg2)))){
_local3 = "UP";
} else {
if ((((_arg1.top > _arg2.bottom)) && (line_horizontal_test(_arg1, _arg2)))){
_local3 = "LO";
};
};
};
};
return (_local3);
}
public function step():void{
var _local1:b2Body;
world.Step(timeStep, iterations);
_local1 = world.m_bodyList;
while (_local1) {
if ((_local1.m_userData is Sprite)){
_local1.m_userData.x = _local1.m_position.x;
_local1.m_userData.y = _local1.m_position.y;
_local1.m_userData.rotation = degrees(_local1.m_rotation);
};
_local1 = _local1.m_next;
};
}
private function level_next():void{
this.removeEventListener(Event.ENTER_FRAME, Update);
this.collision_list_reset();
this.start_list_reset();
model.level++;
this.level_create();
}
private function circle(_arg1:StyleVO, _arg2:MovieClip, _arg3:Number=0, _arg4:Number=0, _arg5:Number=20, _arg6:Number=0, _arg7:Number=0.1, _arg8:Number=0.1, _arg9:Number=0):b2Body{
var _local10:b2CircleDef;
var _local11:Box2CircleBodyDef;
var _local12:b2Body;
_local10 = new b2CircleDef();
_local10.radius = _arg5;
_local10.density = _arg6;
_local10.friction = _arg7;
_local10.restitution = _arg8;
_local11 = new Box2CircleBodyDef(_local10, _arg1, _arg2, _arg9, _arg3, _arg4);
addChild(_local11.userData);
_local12 = world.CreateBody(_local11);
return (_local12);
}
private function sequence_best_calc():Number{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Array;
_local1 = 0;
_local2 = 0;
_local3 = 0;
for each (_local4 in this.sequence_list) {
if (_local4.length > _local2){
_local2 = _local4.length;
_local1 = _local3;
};
_local3++;
};
return (_local1);
}
private function sequence_tracking_update():void{
var _local1:Number;
var _local2:Boolean;
var _local3:Number;
var _local4:Array;
var _local5:Array;
var _local6:CollisonVO;
var _local7:Object;
_local1 = this.sequence_list.length;
_local2 = true;
_local3 = 0;
if (_local1 > 1){
_local4 = this.sequence_list[(_local1 - 2)];
_local5 = this.sequence_list[(_local1 - 1)];
if (_local4.length != _local5.length){
_local2 = false;
} else {
for each (_local6 in _local4) {
_local7 = _local5[_local3];
if (_local6.name != _local7.name){
_local2 = false;
break;
};
_local3++;
};
};
};
if (!_local2){
model.sequence_count = 0;
this.sequence_list = new Array();
} else {
model.sequence_count++;
};
}
private function contact_list_repeat_test(_arg1:String):Number{
var _local2:Number;
var _local3:Number;
var _local4:CollisonVO;
_local2 = -1;
_local3 = 0;
for each (_local4 in this.contact_list) {
if (_local4.name == _arg1){
_local2 = _local3;
break;
};
_local3++;
};
return (_local2);
}
public function level_reset():void{
pause();
this.sequence_list = null;
this.dispatchEvent(new Event(LEVEL_END_EVENT));
}
private function fx_shoot_play(_arg1:SoundTransform):void{
var t = _arg1;
if (!fx_shoot_state){
try {
fx_shoot_channel = fx_shoot.play(0, 0, t);
fx_shoot_channel.addEventListener(Event.SOUND_COMPLETE, fx_shoot_end);
} catch(error:Error) {
};
};
}
public function Update(_arg1:Event):void{
var bb:b2Body;
var w:Number;
var h:Number;
var bodyVO:BodyVO;
var aBody:b2Body;
var aType:String;
var s:Sound;
var sc:SoundChannel;
var event = _arg1;
model.level_run_time = Math.round(((getTimer() - model.level_start_time) / 1000));
if ((((model.level_run_time >= model.level_max_time)) && (model.run_state))){
sequence_complete();
} else {
world.Step(timeStep, iterations);
bb = world.m_bodyList;
while (bb) {
if ((bb.m_userData is Sprite)){
bb.m_userData.x = bb.m_position.x;
bb.m_userData.y = bb.m_position.y;
bb.m_userData.rotation = degrees(bb.m_rotation);
};
bb = bb.m_next;
};
update_motion();
try {
w = model.ARENA_WIDTH;
h = model.ARENA_HEIGHT;
for each (bodyVO in this.action_list) {
aBody = bodyVO.body;
aType = bodyVO.type;
if ((((((aBody.m_position.x > (w + 100))) || ((aBody.m_position.x < (0 - 100))))) || ((aBody.m_position.y > (h + 100))))){
if (aType == "ball"){
ball_reset_state = true;
if (model.music_loop_state){
s = new FXCrash();
sc = s.play();
sc.addEventListener(Event.SOUND_COMPLETE, ball_reset);
};
this.ball_reset_timer.start();
pause();
this.dispatchEvent(new Event(ARENA_EDIT_EVENT));
} else {
aBody.SetAngularVelocity(0);
aBody.SetLinearVelocity(new b2Vec2(0, 0));
};
};
update_collision_handler(collision_list, bodyVO);
try {
if (bodyVO){
update_collision_handler(start_list, bodyVO);
};
} catch(error:Error) {
};
};
} catch(error:Error) {
};
update_line_handler(collision_list, bodyVO);
};
}
private function points():void{
this.dispatchEvent(new Event(STATS_SHOW_EVENT));
}
private function body_delete_handler(_arg1:ContextMenuEvent):void{
var _local2:DisplayObject;
var _local3:b2Body;
var _local4:Number;
var _local5:CollisonVO;
_local2 = DisplayObject(_arg1.mouseTarget);
_local3 = this.find_my_body(_local2);
if (this.name != _local2.parent.name){
_local2 = _local2.parent;
};
_local4 = collision_list_find(_local3);
if (_local4 != -1){
_local5 = this.collision_list[_local4];
model.prop_pending = _local5.full_type;
this.collision_list.splice(_local4, 1);
this.removeChild(_local2);
_local3.Destroy();
};
}
private function sound_error_handler(_arg1:IOErrorEvent):void{
}
private function jumpRH(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0):b2Body{
var _local4:Number;
var _local5:JumpRH_mc;
var _local6:b2Body;
var _local7:MovieClip;
_local4 = radians(-30);
_local5 = new JumpRH_mc();
_local6 = box(_arg1, _local5, _arg2, _arg3, 100, 10, 0, 0.3, 0, _local4);
_local7 = _local6.m_userData;
_local7.addEventListener(MouseEvent.MOUSE_UP, body_drag_end_handler);
this.collision_list.push(new CollisonVO(_local6, "jumpRH"));
return (_local6);
}
private function springRH(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0):b2Body{
var _local4:SpringBoxRH;
var _local5:b2Body;
var _local6:Sprite;
_local4 = new SpringBoxRH();
_local5 = box(_arg1, _local4, _arg2, _arg3, springW, springH, 0, 0.3, 0.9);
this.collision_list.push(new CollisonVO(_local5, "springRH"));
_local6 = _local5.m_userData;
_local6.addEventListener(MouseEvent.MOUSE_DOWN, body_mouse_down_handler);
custom_menu_create(_local6);
return (_local5);
}
public function ball_reset(_arg1:Event):void{
var _local2:BodyVO;
var _local3:b2Body;
var _local4:String;
var _local5:b2Vec2;
var _local6:Number;
if (ball_reset_state){
ball_reset_state = false;
for each (_local2 in this.action_list) {
_local3 = _local2.body;
_local4 = _local2.type;
_local5 = _local2.position;
_local6 = 0;
if (_local4 == "ball"){
_local3.SetAngularVelocity(0);
_local3.SetLinearVelocity(new b2Vec2(0, 0));
_local3.m_userData.wait();
} else {
if (_local4 == "bigBall"){
_local3.SetAngularVelocity(0);
_local3.SetLinearVelocity(new b2Vec2(0, 0));
} else {
if (_local4 == "clicker"){
clicker_velocity_reset(_local3);
};
};
};
_local3.SetOriginPosition(_local5, _local6);
_local3.SetCenterPosition(_local5, _local6);
_local3.m_userData.x = _local5.x;
_local3.m_userData.y = _local5.y;
_local3.m_userData.rotation = degrees(_local6);
};
Update(new Event("tmp_event"));
};
}
private function bigBall(_arg1:BodyVO):void{
var _local2:BeachBall;
var _local3:Number;
var _local4:b2Vec2;
_local2 = new BeachBall();
_local3 = (_arg1.boxW / 2);
_local4 = _arg1.position;
_arg1.body = this.circle(default_style, _local2, _local4.x, _local4.y, _local3, 1, 0.1, 0.3);
this.action_list.push(_arg1);
}
private function sequence_score_calc():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:String;
var _local7:Number;
var _local8:Array;
var _local9:CollisonVO;
_local1 = 0;
_local2 = 0;
_local3 = 0;
_local4 = 2;
_local5 = 1;
_local6 = "";
_local7 = sequence_best_calc();
_local8 = this.sequence_list[_local7];
model.last_props = _local8.length;
model.score_vo.prop_count = model.last_props;
model.score_vo.score_props = (_local8.length * 10);
for each (_local9 in _local8) {
if (_local9.type == _local6){
_local3++;
_local4 = (_local4 * run_factor_multiplier_calc(_local3));
_local4 = Math.floor(_local4);
} else {
if (_local3 > 0){
_local5 = type_factor_calc(_local6);
model.score_vo.combo_count++;
model.score_vo.combo_list.push((_local3 + 1));
model.score_vo.score_combo = (model.score_vo.score_combo + score_combo_calc(_local4, _local5));
};
_local4 = 2;
_local3 = 0;
};
_local6 = _local9.type;
};
if (_local3 > 0){
_local5 = type_factor_calc(_local6);
model.score_vo.combo_count++;
model.score_vo.combo_list.push((_local3 + 1));
model.score_vo.score_combo = (model.score_vo.score_combo + score_combo_calc(_local4, _local5));
_local4 = 2;
};
_local3 = 0;
model.score_vo.combo_calc();
model.score_vo.bonus_count = this.bonus_count;
model.last_stars = this.bonus_count;
model.score_vo.score_total = (((model.score_vo.score_props + model.score_vo.score_combo) + model.score_vo.combo_count_bonus) + model.score_vo.score_bonus);
model.last_score = model.score_vo.score_total;
if (model.score_vo.score_total > model.score_vo_best.score_total){
model.score_vo_best.copy_data(model.score_vo);
};
model.action_pending = "run_complete";
}
private function body_drag_update(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = (this.mouseX - model.drag_offset.x);
_local3 = (this.mouseY - model.drag_offset.y);
if (drag_body != null){
_local4 = drag_body.m_rotation;
drag_body.SetCenterPosition(new b2Vec2(_local2, _local3), _local4);
drag_body.m_userData.x = drag_body.m_position.x;
drag_body.m_userData.y = drag_body.m_position.y;
drag_body.m_userData.rotation = degrees(_local4);
};
}
private function degrees(_arg1:Number):Number{
var _local2:Number;
_local2 = (_arg1 * (180 / Math.PI));
return (_local2);
}
private function rampStatic(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0, _arg4:Number=200, _arg5:Number=30):b2Body{
var _local6:Number;
var _local7:b2Body;
var _local8:Sprite;
_local6 = radians(_arg5);
_local7 = box(_arg1, null, _arg2, _arg3, _arg4, model.BODY_HEIGHT, 0, 0.3, 0, _local6);
_local8 = _local7.m_userData;
return (_local7);
}
private function ball_create(_arg1:BodyVO):void{
var _local2:DeathWheel;
var _local3:b2Vec2;
_local2 = new DeathWheel();
_local3 = _arg1.position;
ball = this.circle(default_style, _local2, _local3.x, _local3.y, 15, 15);
ball.SetAngularVelocity(0);
_arg1.body = ball;
this.action_list.push(_arg1);
}
private function arena_world_define():void{
var _local1:b2AABB;
var _local2:b2Vec2;
var _local3:Boolean;
_local1 = new b2AABB();
_local1.minVertex.Set(-1000, -1000);
_local1.maxVertex.Set(1000, 1000);
_local2 = new b2Vec2(0, 800);
_local3 = true;
world = new b2World(_local1, _local2, _local3);
}
private function bonus_item_update():void{
var _local1:DisplayObject;
var _local2:BonusItem;
var _local3:DisplayObject;
_local1 = this.getChildByName(ball.m_userData.name);
for each (_local2 in level.bonus_list) {
if (!_local2.hit_state){
if (_local2.hitTestObject(_local1)){
_local3 = this.getChildByName(_local2.name);
this.removeChild(_local3);
_local2.hit_state = true;
bonus_count++;
};
};
};
}
private function update_collision_handler(_arg1:Array, _arg2:BodyVO):void{
var v:CollisonVO;
var aBody:b2Body;
var aType:String;
var other_body:b2Body;
var next_body:b2Body;
var other_contact:b2ContactNode;
var next_contact:b2ContactNode;
var body:b2Body;
var vec:b2Vec2;
var a = _arg1;
var bodyVO = _arg2;
try {
aBody = bodyVO.body;
aType = bodyVO.type;
other_contact = aBody.GetContactList();
if (other_contact != null){
other_body = other_contact.other;
next_contact = other_contact.next;
};
if (next_contact != null){
next_body = next_contact.other;
};
} catch(error:Error) {
};
for each (v in a) {
body = v.body;
try {
if (other_body != null){
if (other_body == body){
body_collision_update(v.type, body, aBody, aType);
};
};
} catch(error:Error) {
};
try {
if (next_body != null){
if (next_body == body){
body_collision_update(v.type, body, aBody, aType);
};
};
} catch(error:Error) {
};
};
}
private function run_factor_multiplier_calc(_arg1:Number):Number{
var _local2:Number;
var _local3:Number;
_local2 = 2;
if (_arg1 > model.run_factor_threshold){
_local3 = (_arg1 - model.run_factor_threshold);
_local2 = (1 + (model.run_factor_threshold / (_arg1 * 2)));
};
return (_local2);
}
private function body_mouse_out_handler(_arg1:MouseEvent):void{
}
private function body_collision_update(_arg1:String, _arg2:b2Body, _arg3:b2Body, _arg4:String):void{
var linV:b2Vec2;
var vec:b2Vec2;
var v:CollisonVO;
var bt:Boolean;
var t:SoundTransform;
var type = _arg1;
var body = _arg2;
var aBody = _arg3;
var aType = _arg4;
linV = aBody.GetLinearVelocity();
bt = true;
t = new SoundTransform(0.5);
switch (type){
case "boundary":
level_reset();
break;
case "bumper":
t.volume = 0.1;
try {
if (model.music_loop_state){
this.fx_bumper_play(t);
};
} catch(error:Error) {
};
vec = bumper_vector_calc(body, aBody);
aBody.SetLinearVelocity(vec);
aBody.SetAngularVelocity(10);
v = new CollisonVO(body, type);
v.name = String(body.m_userData.name);
contact_list_update(v);
break;
case "jumpRH":
try {
if (model.music_loop_state){
fx_shoot_play(t);
};
} catch(error:Error) {
};
vec = new b2Vec2(400, -300);
aBody.SetLinearVelocity(vec);
aBody.SetAngularVelocity(10);
v = new CollisonVO(body, type);
v.name = String(body.m_userData.name);
contact_list_update(v);
break;
case "jumpLH":
try {
if (model.music_loop_state){
fx_shoot_play(t);
};
} catch(error:Error) {
};
vec = new b2Vec2(-400, -300);
aBody.SetLinearVelocity(vec);
aBody.SetAngularVelocity(10);
v = new CollisonVO(body, type);
v.name = String(body.m_userData.name);
contact_list_update(v);
break;
case "shootRH":
bt = body_position_test(aBody, body, type);
if (bt){
if (model.music_loop_state){
fx_shoot_play(t);
};
vec = new b2Vec2(300, -100);
aBody.SetLinearVelocity(vec);
aBody.SetAngularVelocity(0);
aBody.m_rotation = 0;
if (aType == "ball"){
aBody.m_userData.wait();
};
v = new CollisonVO(body, type);
v.name = String(body.m_userData.name);
contact_list_update(v);
};
break;
case "shootLH":
bt = body_position_test(aBody, body, type);
if (bt){
if (model.music_loop_state){
fx_shoot_play(t);
};
vec = new b2Vec2(-300, -100);
aBody.SetLinearVelocity(vec);
aBody.SetAngularVelocity(0);
aBody.m_rotation = 0;
if (aType == "ball"){
aBody.m_userData.wait();
};
v = new CollisonVO(body, type);
v.name = String(body.m_userData.name);
contact_list_update(v);
};
break;
case "springLH":
bt = body_position_test(aBody, body, type);
if (bt){
vec = new b2Vec2(-150, -450);
aBody.SetLinearVelocity(vec);
aBody.SetAngularVelocity(0);
aBody.m_rotation = 0;
body.m_userData.spring();
if (aType == "ball"){
aBody.m_userData.hold();
};
if (model.music_loop_state){
fx_spring.play(0, 0, t);
};
v = new CollisonVO(body, type);
v.name = String(body.m_userData.name);
contact_list_update(v);
};
break;
case "springRH":
bt = body_position_test(aBody, body, type);
if (bt){
vec = new b2Vec2(150, -450);
aBody.SetLinearVelocity(vec);
aBody.SetAngularVelocity(0);
aBody.m_rotation = 0;
body.m_userData.spring();
if (aType == "ball"){
aBody.m_userData.hold();
};
if (model.music_loop_state){
fx_spring.play(0, 0, t);
};
v = new CollisonVO(body, type);
v.name = String(body.m_userData.name);
contact_list_update(v);
};
break;
case "ramp":
if (aType == "ball"){
aBody.m_userData.hold();
};
v = new CollisonVO(body, type);
v.name = String(body.m_userData.name);
contact_list_update(v);
break;
};
}
private function line_horizontal_test(_arg1:Rectangle, _arg2:Rectangle):Boolean{
var _local3:Boolean;
var _local4:Number;
_local3 = false;
_local4 = (_arg1.x + (_arg1.width / 2));
if ((((_local4 < _arg2.right)) && ((_local4 > _arg2.left)))){
_local3 = true;
};
return (_local3);
}
private function fx_shoot_end(_arg1:Event):void{
fx_shoot_state = false;
}
private function collision_list_reset():void{
var _local1:CollisonVO;
var _local2:CollisonVO;
var _local3:b2Body;
var _local4:DisplayObject;
for each (_local2 in collision_list) {
_local3 = _local2.body;
_local4 = _local3.m_userData;
this.removeChild(_local4);
_local3.Destroy();
};
this.collision_list = new Array();
}
private function fx_bumper_play(_arg1:SoundTransform):void{
var t = _arg1;
if (!fx_shoot_state){
try {
fx_bumper_channel = fx_bumper.play(0, 1, t);
fx_bumper_channel.addEventListener(Event.SOUND_COMPLETE, fx_bumper_end);
} catch(error:Error) {
};
};
}
private function instructions(_arg1:BodyVO):void{
var _local2:b2Vec2;
var _local3:Number;
var _local4:Instruction1;
var _local5:Instruction2;
var _local6:Instruction3;
var _local7:Instruction4;
_local2 = _arg1.position;
_local3 = _arg1.boxW;
if (_local3 == 1){
_local4 = new Instruction1();
_local4.x = _local2.x;
_local4.y = _local2.y;
this.addChild(_local4);
extras_list.push(_local4);
} else {
if (_local3 == 2){
_local5 = new Instruction2();
_local5.x = _local2.x;
_local5.y = _local2.y;
this.addChild(_local5);
extras_list.push(_local5);
} else {
if (_local3 == 3){
_local6 = new Instruction3();
_local6.x = _local2.x;
_local6.y = _local2.y;
this.addChild(_local6);
extras_list.push(_local6);
} else {
if (_local3 == 4){
_local7 = new Instruction4();
_local7.x = _local2.x;
_local7.y = _local2.y;
this.addChild(_local7);
extras_list.push(_local7);
};
};
};
};
}
private function slope(_arg1:BodyVO):b2Body{
var _local2:b2Vec2;
var _local3:Number;
var _local4:b2Body;
_local2 = _arg1.position;
_local3 = this.radians(_arg1.rotation);
_local4 = box(default_style, null, _local2.x, _local2.y, _arg1.boxW, model.BODY_HEIGHT, 0, 0.5, 0.1, _local3);
this.start_list.push(new CollisonVO(_local4, "slope"));
return (_local4);
}
private function update_line_handler(_arg1:Array, _arg2:BodyVO):void{
var _local3:b2Body;
var _local4:String;
var _local5:MovieClip;
var _local6:Rectangle;
var _local7:Rectangle;
var _local8:MovieClip;
var _local9:Boolean;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:CollisonVO;
var _local14:String;
var _local15:String;
var _local16:b2Vec2;
_local3 = _arg2.body;
_local4 = _arg2.type;
_local5 = _local3.m_userData;
_local6 = _local5.getBounds(this);
_local9 = false;
_local11 = 0;
_local12 = 100;
for each (_local13 in _arg1) {
_local14 = _local13.type;
_local15 = "NA";
switch (_local14){
case "fanRH":
_local8 = _local13.body.m_userData;
_local7 = _local8.getBounds(this);
_local10 = _local3.m_linearVelocity;
_local15 = line_direction_calc(_local6, _local7);
if (!line_block_test(_local6, _local7, this.collision_list, _local15)){
if (_local15 == "RH"){
_local12 = model.max_X_speed;
_local11 = ((_local6.left - _local7.right) / 10);
_local12 = (_local12 / _local11);
_local12 = (_local12 + _local10.x);
if (_local12 > model.max_X_speed){
_local12 = model.max_X_speed;
};
_local16 = new b2Vec2(_local12, _local10.y);
} else {
if (_local15 == "LH"){
_local12 = model.max_X_speed;
_local11 = ((_local7.left - _local6.right) / 10);
_local12 = (_local12 / _local11);
_local12 = (_local10.x - _local12);
if (_local12 < (model.max_X_speed * -1)){
_local12 = (model.max_X_speed * -1);
};
_local16 = new b2Vec2(_local12, _local10.y);
} else {
if (_local15 == "UP"){
_local12 = model.max_Y_speed;
_local11 = ((_local7.top - _local6.bottom) / 10);
_local12 = (_local12 / _local11);
_local12 = (_local10.y - _local12);
if (_local12 > model.max_Y_speed){
_local12 = model.max_Y_speed;
};
_local16 = new b2Vec2(_local10.x, _local12);
} else {
if (_local15 == "LO"){
_local16 = new b2Vec2(_local10.x, _local10.y);
};
};
};
};
};
if (((!((_local16 == null))) && (!((_local15 == "NA"))))){
_local3.SetLinearVelocity(_local16);
_local3.SetAngularVelocity(2);
};
_local13.name = String(_local13.body.m_userData.name);
contact_list_update(_local13);
break;
};
};
}
private function type_factor_calc(_arg1:String):Number{
var _local2:Number;
_local2 = 1;
switch (_arg1){
case "shootLH":
_local2 = 0.2;
break;
case "shootRH":
_local2 = 0.2;
break;
case "jumpLH":
_local2 = 0.5;
break;
case "jumpRH":
_local2 = 0.5;
break;
case "bumper":
_local2 = 0.5;
break;
};
return (_local2);
}
private function trace_try(_arg1:String, _arg2):void{
var title = _arg1;
var v = _arg2;
try {
} catch(error:Error) {
};
}
private function wall(_arg1:BodyVO):b2Body{
var _local2:b2Vec2;
var _local3:Number;
var _local4:b2Body;
_local2 = _arg1.position;
_local3 = _arg1.boxW;
_local4 = box(default_style, null, _local2.x, _local2.y, 30, _local3, 0, 0.3, 0);
this.start_list.push(new CollisonVO(_local4, "wall"));
return (_local4);
}
private function box(_arg1:StyleVO, _arg2:MovieClip, _arg3:Number=0, _arg4:Number=0, _arg5:Number=20, _arg6:Number=20, _arg7:Number=0, _arg8:Number=0.1, _arg9:Number=0.1, _arg10:Number=0):b2Body{
var _local11:Number;
var _local12:Number;
var _local13:b2BoxDef;
var _local14:Box2RectangleBodyDef;
var _local15:b2Body;
_local11 = (_arg5 / 2);
_local12 = (_arg6 / 2);
_local13 = new b2BoxDef();
_local13.extents.Set(_local11, _local12);
_local13.density = _arg7;
_local13.friction = _arg8;
_local13.restitution = _arg9;
_local14 = new Box2RectangleBodyDef(_local13, _arg1, _arg2, _arg10, _arg3, _arg4, _arg5, _arg6);
addChild(_local14.userData);
_local15 = world.CreateBody(_local14);
custom_menu_create(_local14.userData);
return (_local15);
}
private function body_mouse_down_handler(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
model.drag_object = (_arg1.target as DisplayObject);
_local2 = this.mouseX;
_local3 = model.drag_object.x;
_local4 = (_local2 - _local3);
_local5 = this.mouseY;
_local6 = model.drag_object.y;
_local7 = (_local5 - _local6);
model.drag_offset = new b2Vec2(_local4, _local7);
}
private function find_my_body(_arg1:DisplayObject):b2Body{
var b:b2Body;
var test:Boolean;
var bb:b2Body;
var t:DisplayObject;
var m:Sprite;
var d = _arg1;
test = false;
try {
bb = world.m_bodyList;
while (bb) {
t = (bb.m_userData as DisplayObject);
m = bb.m_userData;
if ((((t == d)) || ((m.name == d.name)))){
test = true;
b = bb;
break;
};
bb = bb.m_next;
};
} catch(error:Error) {
};
if ((((b == null)) && (!((d == null))))){
b = find_my_body(d.parent);
};
return (b);
}
private function level_complete():void{
model.level_state = false;
model.level++;
model.tries = 0;
this.dispatchEvent(new Event(Arena.LEVEL_PAUSE_EVENT));
}
private function contact_list_update(_arg1:CollisonVO):void{
var _local2:uint;
var _local3:CollisonVO;
var _local4:Number;
var _local5:Number;
var _local6:uint;
if (this.contact_list.length > 0){
_local4 = this.contact_list.length;
if (_local4 > 0){
_local3 = this.contact_list[(_local4 - 1)];
};
if (_local3.name != _arg1.name){
_local5 = contact_list_repeat_test(_arg1.name);
if (_local5 != -1){
this.sequence_list.push(this.contact_list.slice());
this.contact_list = new Array();
};
_local6 = (this.contact_list.push(_arg1) - 1);
};
} else {
this.contact_list.push(_arg1);
};
_local2 = (this.contact_list.length - 1);
sequence_marker_create(_arg1, _local2);
if (model.sequence_count == model.sequence_target){
this.sequence_complete();
};
}
private function collision_list_find(_arg1:b2Body):Number{
var _local2:CollisonVO;
var _local3:Number;
var _local4:Number;
var _local5:CollisonVO;
var _local6:b2Body;
_local3 = 0;
_local4 = -1;
for each (_local5 in collision_list) {
_local6 = _local5.body;
if (_local6 == _arg1){
_local4 = _local3;
};
_local3++;
};
return (_local4);
}
private function shootLH(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0):b2Body{
var _local4:ShootLH;
var _local5:b2Body;
_local4 = new ShootLH();
_local5 = box(_arg1, _local4, _arg2, _arg3, 50, 10, 0, 0.5, 0);
this.collision_list.push(new CollisonVO(_local5, "shootLH"));
return (_local5);
}
private function bumper_vector_calc(_arg1:b2Body, _arg2:b2Body):b2Vec2{
var _local3:String;
var _local4:String;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Rectangle;
var _local10:Rectangle;
_local3 = "NA";
_local4 = "NA";
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = 0;
_local9 = DisplayObject(_arg2.m_userData).getBounds(this);
_local10 = DisplayObject(_arg1.m_userData).getBounds(this);
if (_local9.x < (_local10.x - 3)){
_local3 = "left";
} else {
_local3 = "right";
};
if (_local9.y < _local10.y){
_local4 = "top";
} else {
_local4 = "bottom";
};
if ((((_local3 == "left")) && ((_local4 == "top")))){
_local7 = -450;
_local8 = -300;
} else {
if ((((_local3 == "left")) && ((_local4 == "bottom")))){
_local7 = -450;
_local8 = 300;
} else {
if ((((_local3 == "right")) && ((_local4 == "top")))){
_local7 = 450;
_local8 = -300;
} else {
if ((((_local3 == "right")) && ((_local4 == "bottom")))){
_local7 = 450;
_local8 = 300;
};
};
};
};
return (new b2Vec2(_local7, _local8));
}
private function sequence_complete():void{
model.run_state = false;
ball.m_rotation = 0;
ball.m_userData.rotation = 0;
ball.m_userData.victory();
model.action_pending = "sequence_complete";
sequence_score_calc();
}
private function destroy():void{
this.removeEventListener(Event.ENTER_FRAME, Update);
this.collision_list_reset();
this.start_list_reset();
model.level++;
}
private function level_points_calc():Number{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = 10;
_local2 = 0;
_local3 = 1;
if (_local3 == 0){
_local2 = 100;
} else {
if (_local3 < 10){
_local2 = (9 * Math.round((10 / _local3)));
};
};
return ((_local1 + _local2));
}
}
}//package com.geekglue.pMotion.View
Section 149
//CatcherMit (com.geekglue.pMotion.View.CatcherMit)
package com.geekglue.pMotion.View {
import flash.display.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import com.geekglue.Box2Utils.VO.*;
public class CatcherMit extends b2BodyDef {
public function CatcherMit(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0, _arg6:Number=0.1, _arg7:Number=0.1){
var _local8:b2BoxDef;
var _local9:b2BoxDef;
var _local10:b2BoxDef;
var _local11:Sprite;
var _local12:Number;
var _local13:Number;
super();
_local8 = new b2BoxDef();
_local8.extents.Set(40, 5);
_local8.localPosition.Set(-10, 0);
_local8.density = _arg5;
_local8.friction = _arg6;
_local8.restitution = _arg7;
this.AddShape(_local8);
_local9 = new b2BoxDef();
_local9.extents.Set(5, 25);
_local9.localPosition.Set(-10, -20);
_local9.density = _arg5;
_local9.friction = _arg6;
_local9.restitution = _arg7;
this.AddShape(_local9);
_local10 = new b2BoxDef();
_local10.extents.Set(14, 5);
_local10.localPosition.Set(49, -12);
_local10.localRotation = radians(-60);
_local10.density = _arg5;
_local10.friction = _arg6;
_local10.restitution = _arg7;
this.AddShape(_local10);
this.rotation = _arg2;
this.position.Set(_arg3, _arg4);
_local11 = new Sprite();
_local12 = 2;
_local13 = 10;
_local11.graphics.beginFill(_arg1.fill_color, _arg1.fill_alpha);
_local11.graphics.lineStyle(_arg1.stroke_weight, _arg1.stroke_color, _arg1.stroke_alpha);
_local11.graphics.moveTo((-50 - _local12), (5 + _local13));
_local11.graphics.lineTo((-50 - _local12), (-5 + _local13));
_local11.graphics.lineTo((-15 - _local12), (-5 + _local13));
_local11.graphics.lineTo((-15 - _local12), (-45 + _local13));
_local11.graphics.lineTo((-5 - _local12), (-45 + _local13));
_local11.graphics.lineTo((-5 - _local12), (-5 + _local13));
_local11.graphics.lineTo((27 - _local12), (-5 + _local13));
_local11.graphics.lineTo((68 - _local12), (-29 + _local13));
_local11.graphics.lineTo((73 - _local12), (-20 + _local13));
_local11.graphics.lineTo((30 - _local12), (5 + _local13));
_local11.graphics.lineTo((-50 - _local12), (5 + _local13));
_local11.cacheAsBitmap = true;
this.userData = _local11;
this.userData.width = 100;
this.userData.height = 50;
}
private function radians(_arg1:Number):Number{
var _local2:Number;
_local2 = (_arg1 * (Math.PI / 180));
return (_local2);
}
}
}//package com.geekglue.pMotion.View
Section 150
//Clicker (com.geekglue.pMotion.View.Clicker)
package com.geekglue.pMotion.View {
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import com.geekglue.Box2Utils.VO.*;
import com.geekglue.pMotion.Assets.*;
public class Clicker extends b2BodyDef {
public function Clicker(_arg1:StyleVO, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0.1, _arg6:Number=0.1){
var _local7:b2CircleDef;
var _local8:b2BoxDef;
var _local9:ClickerSkin;
super();
_local7 = new b2CircleDef();
_local7.radius = 30;
_local7.localPosition.Set(0, 0);
_local7.density = _arg4;
_local7.friction = _arg5;
_local7.restitution = _arg6;
this.AddShape(_local7);
_local8 = new b2BoxDef();
_local8.extents.Set(25, 5);
_local8.localPosition.Set(30, -5);
_local8.density = _arg4;
_local8.friction = _arg5;
_local8.restitution = _arg6;
this.AddShape(_local8);
this.position.Set(_arg2, _arg3);
_local9 = new ClickerSkin();
this.userData = _local9;
this.userData.width = 90;
this.userData.height = 60;
}
private function radians(_arg1:Number):Number{
var _local2:Number;
_local2 = (_arg1 * (Math.PI / 180));
return (_local2);
}
}
}//package com.geekglue.pMotion.View
Section 151
//GameController (com.geekglue.pMotion.View.GameController)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.Assets.*;
public class GameController extends Sprite {
public var crossover:MovieClip;
private var model:ModelLocator;
private var btn_X:Number;// = 6
private var music_btn:ControlButton;
private var btn_sound:BtnSound01;
private var reset_btn:ControlButton;
private var help_btn:ControlButton;
private var exit_btn:ControlButton;
private var play_btn:ControlButton;
public function GameController(){
model = ModelLocator.getInstance();
btn_X = 6;
super();
this.cacheAsBitmap = true;
init();
model.addEventListener(ModelLocator.CONTROL_UPDATE_EVENT, control_update_handler);
}
private function mouse_down_handler(_arg1:MouseEvent):void{
var _local2:String;
if (model.music_loop_state){
btn_sound.play();
};
_local2 = ControlButton(_arg1.target).btn_type.toString();
switch (_local2){
case "play":
if (play_btn.enabled){
model.action_pending = _local2;
};
break;
case "exit":
if (this.exit_btn.enabled){
model.action_pending = "map";
};
break;
case "help":
model.action_pending = _local2;
break;
case "retry":
if (play_btn.enabled){
model.action_pending = _local2;
};
break;
case "reset":
if (reset_btn.enabled){
model.action_pending = _local2;
};
break;
case "sound_on":
model.action_pending = "sound_off";
break;
case "sound_off":
model.action_pending = "sound_on";
break;
};
}
private function init():void{
btn_sound = new BtnSound01();
btns_create();
}
public function sound(_arg1:String):void{
if (_arg1 == "on"){
this.music_btn.btn_type = "sound_on";
} else {
if (_arg1 == "off"){
this.music_btn.btn_type = "sound_off";
};
};
}
public function reset():void{
this.exit_btn.enable();
this.play_btn.enable();
this.reset_btn.disable();
this.play_btn.btn_type = "play";
}
public function run():void{
this.exit_btn.enable();
this.play_btn.enable();
this.reset_btn.enable();
this.play_btn.btn_type = "retry";
}
private function btns_create():void{
play_btn = new ControlButton();
play_btn.btn_type = "play";
play_btn.x = btn_X;
play_btn.y = 44;
this.addChild(play_btn);
play_btn.disable();
play_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
reset_btn = new ControlButton();
reset_btn.btn_type = "reset";
reset_btn.x = btn_X;
reset_btn.y = 85;
this.addChild(reset_btn);
reset_btn.disable();
reset_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
music_btn = new ControlButton();
music_btn.btn_type = "sound_on";
music_btn.x = btn_X;
music_btn.y = 106;
this.addChild(music_btn);
music_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
help_btn = new ControlButton();
help_btn.btn_type = "help";
help_btn.x = btn_X;
help_btn.y = 157;
this.addChild(help_btn);
help_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
exit_btn = new ControlButton();
exit_btn.btn_type = "exit";
exit_btn.x = btn_X;
exit_btn.y = 126;
this.addChild(exit_btn);
exit_btn.disable();
exit_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
}
public function level_end():void{
this.play_btn.btn_type = "play";
this.exit_btn.disable();
this.play_btn.disable();
this.reset_btn.disable();
}
public function level_load():void{
this.exit_btn.enable();
this.play_btn.enable();
this.reset_btn.enable();
this.play_btn.btn_type = "play";
}
private function control_update_handler(_arg1:Event):void{
switch (model.control_state){
case "run":
this.run();
break;
case "reset":
this.reset();
break;
case "level_load":
this.level_load();
break;
case "level_end":
this.level_end();
break;
case "sound_ON":
this.sound("on");
break;
case "sound_OFF":
this.sound("off");
break;
};
}
}
}//package com.geekglue.pMotion.View
Section 152
//GameOver (com.geekglue.pMotion.View.GameOver)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import fl.controls.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.Assets.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
public class GameOver extends MovieClip {
private var shut_timer:Timer;
private var open_timer:Timer;
private var points_txt:TextField;
private var model:ModelLocator;
private var tf_points:TextFormat;
private var btn:Button;
private var blur:BlurFilter;
private var more_games_btn:Button;
private var btn_sound:BtnSound01;
private var tf:TextFormat;
private var speed_X:Number;// = 30
public var shut_X:Number;// = -300
public var open_X:Number;// = 260
private var submit_score_btn:Button;
private var high_score_txt:TextField;
private var map_btn:Button;
public function GameOver(){
model = ModelLocator.getInstance();
open_X = 260;
shut_X = -300;
speed_X = 30;
super();
this.cacheAsBitmap = true;
btn_sound = new BtnSound01();
create_text_formats();
create_text();
create_btns();
open_timer = new Timer(5);
open_timer.addEventListener(TimerEvent.TIMER, open);
shut_timer = new Timer(5);
shut_timer.addEventListener(TimerEvent.TIMER, shut);
blur = new BlurFilter();
blur.blurX = 10;
blur.blurY = 10;
blur.quality = BitmapFilterQuality.MEDIUM;
model.addEventListener(ModelLocator.POINTS_UPDATE_EVENT, points_update_handler);
model.addEventListener(ModelLocator.GAME_POD_EVENT, pod_update_handler);
}
private function pod_update_handler(_arg1:Event):void{
switch (model.game_pod_state){
case "open":
this.filters = [blur];
shut_timer.stop();
open_timer.start();
break;
case "shut":
this.filters = [blur];
open_timer.stop();
shut_timer.start();
break;
};
}
private function create_btns():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = 30;
_local2 = 135;
_local3 = 21;
submit_score_btn = new Button();
submit_score_btn.x = _local1;
submit_score_btn.y = _local2;
submit_score_btn.width = 126;
submit_score_btn.height = 18;
submit_score_btn.label = "";
submit_score_btn.name = "submitScoreBtn";
submit_score_btn.setStyle("upSkin", MenuSubmitScoresUp);
submit_score_btn.setStyle("overSkin", MenuSubmitScoresOver);
submit_score_btn.setStyle("downSkin", MenuSubmitScoresUp);
submit_score_btn.setStyle("textFormat", tf);
this.addChild(submit_score_btn);
submit_score_btn.addEventListener("mouseDown", btn_rollover_handler);
btn = new Button();
btn.x = _local1;
btn.y = (_local2 + _local3);
btn.width = 126;
btn.height = 18;
btn.label = "";
btn.name = "menuBtn";
btn.setStyle("upSkin", MenuNewUp);
btn.setStyle("overSkin", MenuNewOver);
btn.setStyle("downSkin", MenuNewUp);
btn.setStyle("textFormat", tf);
this.addChild(btn);
btn.addEventListener("mouseDown", btn_rollover_handler);
map_btn = new Button();
map_btn.x = _local1;
map_btn.y = (_local2 + (_local3 * 2));
map_btn.width = 126;
map_btn.height = 18;
map_btn.label = "";
map_btn.name = "mapBtn";
map_btn.setStyle("upSkin", MenuLoadUp);
map_btn.setStyle("overSkin", MenuLoadOver);
map_btn.setStyle("downSkin", MenuLoadUp);
map_btn.setStyle("disabledSkin", NextOff);
this.addChild(map_btn);
map_btn.addEventListener("mouseDown", btn_rollover_handler);
more_games_btn = new Button();
more_games_btn.x = _local1;
more_games_btn.y = (_local2 + (_local3 * 3));
more_games_btn.width = 126;
more_games_btn.height = 18;
more_games_btn.label = "";
more_games_btn.name = "MoreGames";
more_games_btn.setStyle("upSkin", MenuMoreGamesUp);
more_games_btn.setStyle("overSkin", MenuMoreGamesOver);
more_games_btn.setStyle("downSkin", MenuMoreGamesUp);
this.addChild(more_games_btn);
more_games_btn.addEventListener("mouseDown", btn_rollover_handler);
}
private function btn_rollover_handler(_arg1:Event):void{
if (model.music_loop_state){
btn_sound.play();
};
}
private function open(_arg1:TimerEvent):void{
if (this.x < this.open_X){
this.x = (this.x + this.speed_X);
} else {
this.x = this.open_X;
this.open_timer.stop();
this.filters = null;
this.enable();
};
}
public function enable():void{
this.btn.enabled = true;
}
private function create_text():void{
points_txt = new TextField();
points_txt.text = String(model.points_earned);
points_txt.setTextFormat(tf_points);
points_txt.width = 150;
points_txt.x = 15;
points_txt.y = 83;
points_txt.selectable = false;
this.addChild(points_txt);
}
private function create_text_formats():void{
tf_points = new TextFormat();
tf_points.font = "Arial";
tf_points.size = 14;
tf_points.align = "center";
tf_points.bold = true;
tf_points.color = 0xFFFFFF;
tf = new TextFormat();
tf.align = "center";
tf.bold = true;
}
private function points_update_handler(_arg1:Event):void{
points_txt.text = String(model.points_earned);
points_txt.setTextFormat(tf_points);
}
private function shut(_arg1:TimerEvent):void{
if (this.x > this.shut_X){
this.x = (this.x - this.speed_X);
} else {
this.x = this.shut_X;
this.shut_timer.stop();
this.filters = null;
this.disable();
};
}
public function disable():void{
this.btn.enabled = false;
}
}
}//package com.geekglue.pMotion.View
Section 153
//Help (com.geekglue.pMotion.View.Help)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import fl.controls.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.Assets.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
public class Help extends MovieClip {
private var shut_timer:Timer;
private var back_btn:Button;
private var open_timer:Timer;
private var next_btn:Button;
private var model:ModelLocator;
private var speed_Y:Number;// = 20
private var step_max:Number;// = 6
private var blur:BlurFilter;
private var btn_sound:BtnSound01;
private var tf:TextFormat;
private var ok_btn:Button;
public var shut_Y:Number;// = -520
public var open_Y:Number;// = 50
private var step:Number;// = 1
public function Help(){
model = ModelLocator.getInstance();
step = 1;
step_max = 6;
open_Y = 50;
shut_Y = -520;
speed_Y = 20;
addFrameScript(0, frame1);
super();
this.cacheAsBitmap = true;
btn_sound = new BtnSound01();
blur = new BlurFilter();
blur.blurX = 10;
blur.blurY = 10;
blur.quality = BitmapFilterQuality.MEDIUM;
open_timer = new Timer(5);
open_timer.addEventListener(TimerEvent.TIMER, open);
shut_timer = new Timer(5);
shut_timer.addEventListener(TimerEvent.TIMER, shut);
tf = new TextFormat();
tf.align = "center";
tf.bold = true;
ok_btn = new Button();
ok_btn.x = 490;
ok_btn.y = 365;
ok_btn.width = 55;
ok_btn.height = 18;
ok_btn.label = "";
ok_btn.name = "OK";
ok_btn.setStyle("upSkin", OkUp);
ok_btn.setStyle("overSkin", OkOver);
ok_btn.setStyle("downSkin", OkUp);
this.addChild(ok_btn);
ok_btn.addEventListener("mouseDown", btn_rollover_handler);
model.addEventListener(ModelLocator.HELP_POD_EVENT, help_pod_update_handler);
}
private function btn_rollover_handler(_arg1:Event):void{
if (model.music_loop_state){
btn_sound.play();
};
}
function frame1(){
stop();
}
private function open(_arg1:TimerEvent):void{
if (this.y < this.open_Y){
this.y = (this.y + this.speed_Y);
} else {
this.y = this.open_Y;
this.open_timer.stop();
this.filters = null;
};
}
private function btn_handler(_arg1:MouseEvent):void{
}
public function enable():void{
ok_btn.enabled = true;
show();
}
private function shut(_arg1:TimerEvent):void{
if (this.y > this.shut_Y){
this.y = (this.y - this.speed_Y);
} else {
this.y = this.shut_Y;
this.shut_timer.stop();
this.filters = null;
};
}
private function help_pod_update_handler(_arg1:Event):void{
switch (model.help_pod_state){
case "open":
this.filters = [blur];
shut_timer.stop();
open_timer.start();
break;
case "shut":
this.filters = [blur];
open_timer.stop();
shut_timer.start();
break;
};
}
public function disable():void{
ok_btn.enabled = false;
}
public function show(){
}
}
}//package com.geekglue.pMotion.View
Section 154
//LeaderBoard (com.geekglue.pMotion.View.LeaderBoard)
package com.geekglue.pMotion.View {
import flash.display.*;
public dynamic class LeaderBoard extends Sprite {
}
}//package com.geekglue.pMotion.View
Section 155
//LevelComplete (com.geekglue.pMotion.View.LevelComplete)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import fl.controls.*;
import flash.media.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.Assets.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
public class LevelComplete extends Sprite {
private var shut_timer:Timer;
private var total_txt:TextField;
private var open_timer:Timer;
private var model:ModelLocator;
private var tf_msg:TextFormat;
private var txt_width:Number;// = 60
private var target_txt_best:TextField;
private var score_txt:TextField;
private var combo_bonus_txt_best:TextField;
private var retry_btn:Button;
private var tf_points:TextFormat;
private var result_txt:TextField;
private var blur:BlurFilter;
private var score_txt_best:TextField;
private var step_max:Number;// = 5
private var combo_points_txt:TextField;
private var btn_sound:BtnSound01;
private var speed_X:Number;// = 40
private var ok_btn:Button;
private var combo_points_txt_best:TextField;
private var tf:TextFormat;
private var prop_txt:TextField;
private var prop_txt_best:TextField;
public var shut_X:Number;// = 720
public var open_X:Number;// = 225
private var target_txt:TextField;
private var step:Number;// = 1
private var combo_bonus_txt:TextField;
private var total_txt_best:TextField;
public function LevelComplete(){
model = ModelLocator.getInstance();
open_X = 225;
shut_X = 720;
speed_X = 40;
step = 1;
step_max = 5;
txt_width = 60;
super();
btn_sound = new BtnSound01();
this.cacheAsBitmap = true;
blur = new BlurFilter();
blur.blurX = 10;
blur.blurY = 10;
blur.quality = BitmapFilterQuality.MEDIUM;
open_timer = new Timer(5);
open_timer.addEventListener(TimerEvent.TIMER, open);
shut_timer = new Timer(5);
shut_timer.addEventListener(TimerEvent.TIMER, shut);
textformat_create();
points_create();
btns_create();
model.addEventListener(ModelLocator.LEVEL_WIN_EVENT, level_win_update_handler);
}
private function points_create():void{
prop_points();
combo_points();
score_create();
target_txt_create();
result_txt_create();
}
private function result_txt_create():void{
result_txt = new TextField();
result_txt.text = "";
result_txt.setTextFormat(this.tf_msg);
result_txt.width = 200;
result_txt.x = 25;
result_txt.y = 185;
result_txt.selectable = false;
this.addChild(result_txt);
}
private function target_txt_create():void{
target_txt = new TextField();
target_txt.text = String(0);
target_txt.setTextFormat(this.tf_points);
target_txt.width = txt_width;
target_txt.x = 103;
target_txt.y = 154;
target_txt.selectable = false;
this.addChild(target_txt);
target_txt_best = new TextField();
target_txt_best.text = String(0);
target_txt_best.setTextFormat(this.tf_points);
target_txt_best.width = txt_width;
target_txt_best.x = 155;
target_txt_best.y = 154;
target_txt_best.selectable = false;
this.addChild(target_txt_best);
}
private function combo_bonus_points():void{
combo_bonus_txt = new TextField();
combo_bonus_txt.text = String(0);
combo_bonus_txt.setTextFormat(this.tf_points);
combo_bonus_txt.width = txt_width;
combo_bonus_txt.x = 103;
combo_bonus_txt.y = 79;
combo_bonus_txt.selectable = false;
this.addChild(combo_bonus_txt);
combo_bonus_txt_best = new TextField();
combo_bonus_txt_best.text = String(0);
combo_bonus_txt_best.setTextFormat(this.tf_points);
combo_bonus_txt_best.width = txt_width;
combo_bonus_txt_best.x = 155;
combo_bonus_txt_best.y = 79;
combo_bonus_txt_best.selectable = false;
this.addChild(combo_bonus_txt_best);
}
private function score_update():void{
score_txt.text = String(model.score_vo.score_total);
score_txt.setTextFormat(this.tf_points);
score_txt_best.text = String(model.score_vo_best.score_total);
score_txt_best.setTextFormat(this.tf_points);
}
private function total_update():void{
total_txt.text = String((model.score_vo.score_total + model.points));
total_txt.setTextFormat(this.tf_points);
total_txt_best.text = String((model.score_vo_best.score_total + model.points));
total_txt_best.setTextFormat(this.tf_points);
}
private function level_win_update_handler(_arg1:Event):void{
switch (model.level_win_state){
case "open":
points_update();
this.filters = [blur];
shut_timer.stop();
open_timer.start();
break;
case "shut":
this.filters = [blur];
open_timer.stop();
shut_timer.start();
break;
};
}
private function prop_points():void{
prop_txt = new TextField();
prop_txt.text = String(model.score_vo.score_props);
prop_txt.setTextFormat(this.tf_points);
prop_txt.width = txt_width;
prop_txt.x = 103;
prop_txt.y = 62;
prop_txt.selectable = false;
this.addChild(prop_txt);
prop_txt_best = new TextField();
prop_txt_best.text = String(model.score_vo.score_props);
prop_txt_best.setTextFormat(this.tf_points);
prop_txt_best.width = txt_width;
prop_txt_best.x = 155;
prop_txt_best.y = 62;
prop_txt_best.selectable = false;
this.addChild(prop_txt_best);
}
private function score_create():void{
score_txt = new TextField();
score_txt.text = String(0);
score_txt.setTextFormat(this.tf_points);
score_txt.width = txt_width;
score_txt.x = 103;
score_txt.y = 128;
score_txt.selectable = false;
this.addChild(score_txt);
score_txt_best = new TextField();
score_txt_best.text = String(0);
score_txt_best.setTextFormat(this.tf_points);
score_txt_best.width = txt_width;
score_txt_best.x = 155;
score_txt_best.y = 128;
score_txt_best.selectable = false;
this.addChild(score_txt_best);
}
private function total_create():void{
total_txt = new TextField();
total_txt.text = String(0);
total_txt.setTextFormat(this.tf_points);
total_txt.width = txt_width;
total_txt.x = 103;
total_txt.y = 195;
total_txt.selectable = false;
this.addChild(total_txt);
total_txt_best = new TextField();
total_txt_best.text = String(0);
total_txt_best.setTextFormat(this.tf_points);
total_txt_best.width = txt_width;
total_txt_best.x = 155;
total_txt_best.y = 195;
total_txt_best.selectable = false;
this.addChild(total_txt_best);
}
private function combo_bonus_points_update():void{
combo_bonus_txt.text = String(model.score_vo.score_bonus);
combo_bonus_txt.setTextFormat(this.tf_points);
combo_bonus_txt_best.text = String(model.score_vo_best.score_bonus);
combo_bonus_txt_best.setTextFormat(this.tf_points);
}
private function btn_rollover_handler(_arg1:Event):void{
var _local2:SoundTransform;
if (model.music_loop_state){
_local2 = new SoundTransform(0.5);
btn_sound.play(0, 0, _local2);
};
}
private function open(_arg1:TimerEvent):void{
if (this.x > this.open_X){
this.x = (this.x - this.speed_X);
} else {
this.x = this.open_X;
this.open_timer.stop();
this.filters = null;
};
}
private function textformat_create():void{
tf = new TextFormat();
tf.align = "center";
tf.bold = true;
tf_points = new TextFormat();
tf_points.font = "Arial";
tf_points.size = 14;
tf_points.align = "right";
tf_points.bold = true;
tf_points.color = 0xFFFFFF;
tf_msg = new TextFormat();
tf_msg.font = "Arial";
tf_msg.size = 14;
tf_msg.align = "center";
tf_msg.bold = true;
tf_msg.color = 0xFFFFFF;
}
private function btns_create():void{
retry_btn = new Button();
retry_btn.name = "level_end_btn";
retry_btn.x = 45;
retry_btn.y = 230;
retry_btn.width = 55;
retry_btn.height = 18;
retry_btn.label = "";
retry_btn.name = "RETRY";
retry_btn.setStyle("upSkin", RetryUp);
retry_btn.setStyle("overSkin", RetryOver);
retry_btn.setStyle("downSkin", RetryUp);
this.addChild(retry_btn);
retry_btn.addEventListener("mouseDown", btn_rollover_handler);
ok_btn = new Button();
ok_btn.name = "level_end_btn";
ok_btn.x = 145;
ok_btn.y = 230;
ok_btn.width = 55;
ok_btn.height = 18;
ok_btn.label = "";
ok_btn.name = "OK";
ok_btn.setStyle("upSkin", NextUp);
ok_btn.setStyle("overSkin", NextOver);
ok_btn.setStyle("downSkin", NextUp);
ok_btn.setStyle("disabledSkin", NextOff);
this.addChild(ok_btn);
ok_btn.addEventListener("mouseDown", btn_rollover_handler);
}
private function points_update():void{
prop_points_update();
combo_points_update();
this.score_update();
this.target_txt_update();
this.result_txt_update();
}
private function combo_points():void{
combo_points_txt = new TextField();
combo_points_txt.text = String(model.score_vo.score_combo);
combo_points_txt.setTextFormat(this.tf_points);
combo_points_txt.width = txt_width;
combo_points_txt.x = 103;
combo_points_txt.y = 89;
combo_points_txt.selectable = false;
this.addChild(combo_points_txt);
combo_points_txt_best = new TextField();
combo_points_txt_best.text = String(model.score_vo.score_combo);
combo_points_txt_best.setTextFormat(this.tf_points);
combo_points_txt_best.width = txt_width;
combo_points_txt_best.x = 155;
combo_points_txt_best.y = 89;
combo_points_txt_best.selectable = false;
this.addChild(combo_points_txt_best);
}
private function prop_points_update():void{
prop_txt.text = String(model.score_vo.score_props);
prop_txt.setTextFormat(this.tf_points);
prop_txt_best.text = String(model.score_vo_best.score_props);
prop_txt_best.setTextFormat(this.tf_points);
}
private function combo_points_update():void{
var _local1:Number;
var _local2:Number;
_local1 = (model.score_vo.score_combo + model.score_vo.combo_count_bonus);
_local2 = (model.score_vo_best.score_combo + model.score_vo_best.combo_count_bonus);
combo_points_txt.text = String(_local1);
combo_points_txt.setTextFormat(this.tf_points);
combo_points_txt_best.text = String(_local2);
combo_points_txt_best.setTextFormat(this.tf_points);
}
private function result_txt_update():void{
if (model.level_target <= model.score_vo_best.score_total){
result_txt.text = "Target Achieved!";
} else {
result_txt.text = "Try Again!";
};
result_txt.setTextFormat(this.tf_msg);
}
private function shut(_arg1:TimerEvent):void{
if (this.x < this.shut_X){
this.x = (this.x + this.speed_X);
} else {
this.x = this.shut_X;
this.shut_timer.stop();
this.filters = null;
};
}
private function target_txt_update():void{
target_txt.text = String(model.level_target);
target_txt.setTextFormat(this.tf_points);
target_txt_best.text = String(model.level_target);
target_txt_best.setTextFormat(this.tf_points);
}
}
}//package com.geekglue.pMotion.View
Section 156
//LivesMarker (com.geekglue.pMotion.View.LivesMarker)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import com.geekglue.pMotion.Model.*;
import flash.utils.*;
public class LivesMarker extends MovieClip {
private var model:ModelLocator;
private var life_timer:Timer;
private var start_time:Number;// = 0
private var timer_step:uint;// = 10
private var lives_index:Number;// = 0
public static var MARKER_EXPIRE_EVENT:String = "marker_expire_event";
public function LivesMarker(_arg1:Number=0){
model = ModelLocator.getInstance();
lives_index = 0;
timer_step = 10;
start_time = 0;
super();
this.cacheAsBitmap = true;
stop();
lives_index = _arg1;
this.start_time = getTimer();
if (((!((model.action_pending == "init"))) && (!((model.action_pending == "menu"))))){
if (lives_index < 0){
this.gotoAndStop(2);
} else {
this.gotoAndStop((lives_index + 2));
};
} else {
this.alpha = 0;
};
this.life_timer = new Timer(timer_step);
this.life_timer.addEventListener(TimerEvent.TIMER, life_timer_handler);
this.life_timer.start();
}
private function life_timer_handler(_arg1:TimerEvent):void{
var _local2:uint;
_local2 = (this.timer_step * this.life_timer.currentCount);
_local2 = (getTimer() - this.start_time);
if (_local2 > model.marker_fade_time){
if (this.alpha > 0){
this.alpha = (this.alpha - model.marker_fade_speed);
} else {
this.life_timer.removeEventListener(TimerEvent.TIMER, life_timer_handler);
this.dispatchEvent(new Event(_slot1.MARKER_EXPIRE_EVENT));
this.life_timer.stop();
};
};
if (_local2 > model.marker_expire_time){
this.life_timer.removeEventListener(TimerEvent.TIMER, life_timer_handler);
this.dispatchEvent(new Event(_slot1.MARKER_EXPIRE_EVENT));
this.life_timer.stop();
};
}
}
}//package com.geekglue.pMotion.View
Section 157
//MapLevelTooltip (com.geekglue.pMotion.View.MapLevelTooltip)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.View.Levels.*;
import flash.utils.*;
import flash.text.*;
public class MapLevelTooltip extends MovieClip {
public var level_points:Number;// = 0
private var model:ModelLocator;
private var place_txt:TextField;
private var level_target_txt:TextField;
private var life_timer:Timer;
public var level:LevelBase;
private var tf:TextFormat;
private var timer_step:uint;// = 10
private var level_points_txt:TextField;
private var place_tf:TextFormat;
private var show_state:Boolean;// = false
public static var EXPIRE_EVENT:String = "expire_event";
public function MapLevelTooltip(_arg1:LevelBase, _arg2:Number=0){
model = ModelLocator.getInstance();
level_points = 0;
show_state = false;
timer_step = 10;
addFrameScript(0, frame1);
super();
this.cacheAsBitmap = true;
this.alpha = 0;
this.level = _arg1;
this.level_points = _arg2;
create_text();
this.gotoAndStop(level.level_index);
show_state = true;
this.life_timer = new Timer(timer_step);
this.life_timer.addEventListener(TimerEvent.TIMER, fader);
this.life_timer.start();
}
public function destroy():void{
show_state = false;
this.life_timer.start();
}
function frame1(){
stop();
}
public function reset():void{
this.gotoAndStop(0);
}
private function fader(_arg1:TimerEvent):void{
if (show_state){
if (this.alpha < 1){
this.alpha = (this.alpha + model.level_fadein_speed);
} else {
this.life_timer.stop();
};
} else {
if (this.alpha > 0){
this.alpha = (this.alpha - model.level_fadeout_speed);
} else {
this.life_timer.removeEventListener(TimerEvent.TIMER, fader);
this.dispatchEvent(new Event(MapLevelTooltip.EXPIRE_EVENT));
this.life_timer.stop();
};
};
}
private function create_text():void{
place_tf = new TextFormat();
place_tf.font = "Arial";
place_tf.size = 14;
place_tf.align = "left";
place_tf.color = 0x5A1000;
tf = new TextFormat();
tf.font = "Arial";
tf.size = 12;
tf.align = "center";
tf.color = 0xFFFFFF;
level_target_txt = new TextField();
level_target_txt.text = String(level.level_target);
level_target_txt.setTextFormat(tf);
level_target_txt.width = 40;
level_target_txt.x = 40;
level_target_txt.y = 88;
level_target_txt.selectable = false;
this.addChild(level_target_txt);
level_points_txt = new TextField();
level_points_txt.text = String(this.level_points);
level_points_txt.setTextFormat(tf);
level_points_txt.width = 40;
level_points_txt.x = 125;
level_points_txt.y = 88;
level_points_txt.selectable = false;
this.addChild(level_points_txt);
place_txt = new TextField();
place_txt.text = String(((level.city + ", ") + level.country));
place_txt.setTextFormat(place_tf);
place_txt.width = 160;
place_txt.x = 10;
place_txt.y = 8;
place_txt.selectable = false;
this.addChild(place_txt);
}
}
}//package com.geekglue.pMotion.View
Section 158
//MapPanel (com.geekglue.pMotion.View.MapPanel)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import fl.controls.*;
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.View.Levels.*;
import com.geekglue.pMotion.Assets.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
public class MapPanel extends MovieClip {
private var shut_timer:Timer;
private var open_timer:Timer;
private var tooltip:MapLevelTooltip;
private var model:ModelLocator;
private var map_btn_list:Array;
private var help_btn:Button;
private var speed_Y:Number;// = 30
private var blur:BlurFilter;
private var btn_sound:BtnSound01;
private var prop_shop:PropShop;
private var load_btn:Button;
private var points_earned_txt:TextField;
private var tf:TextFormat;
private var ok_btn:Button;
public var shut_Y:Number;// = -550
private var points_available_txt:TextField;
public var open_Y:Number;// = 15
public var wod:MovieClip;
private var king_btn:KingButton;
private var points_spent_txt:TextField;
public function MapPanel(){
var _local1:TextFormat;
var _local2:*;
var _local3:*;
var _local4:*;
model = ModelLocator.getInstance();
open_Y = 15;
shut_Y = -550;
speed_Y = 30;
map_btn_list = new Array();
super();
this.cacheAsBitmap = true;
open_timer = new Timer(5);
open_timer.addEventListener(TimerEvent.TIMER, open);
shut_timer = new Timer(5);
shut_timer.addEventListener(TimerEvent.TIMER, shut);
blur = new BlurFilter();
blur.blurX = 10;
blur.blurY = 10;
blur.quality = BitmapFilterQuality.MEDIUM;
_local1 = new TextFormat();
_local1.align = "center";
_local1.bold = true;
_local2 = 170;
_local3 = 12;
_local4 = 22;
this.king_btn_create();
create_text();
create_btns();
levels_create();
prop_shop_create();
btn_sound = new BtnSound01();
model.addEventListener(ModelLocator.MAP_POD_EVENT, map_pod_update_handler);
model.addEventListener(ModelLocator.LEVEL_LOAD_EVENT, level_update_handler);
model.addEventListener(ModelLocator.PROP_LEVEL_UPDATE_EVENT, level_update_handler);
model.addEventListener(ModelLocator.POINTS_UPDATE_EVENT, points_update_handler);
}
private function create_btns():void{
ok_btn = new Button();
ok_btn.x = 5;
ok_btn.y = 405;
ok_btn.width = 55;
ok_btn.height = 18;
ok_btn.label = "";
ok_btn.name = "Menu";
ok_btn.setStyle("upSkin", MenuUp);
ok_btn.setStyle("overSkin", MenuOver);
ok_btn.setStyle("downSkin", MenuUp);
ok_btn.setStyle("disabledSkin", MenuOff);
this.addChild(ok_btn);
ok_btn.addEventListener("mouseDown", btn_select_handler);
help_btn = new Button();
help_btn.x = 70;
help_btn.y = 405;
help_btn.width = 55;
help_btn.height = 18;
help_btn.label = "";
help_btn.name = "MapHelp";
help_btn.setStyle("upSkin", MapHelpUp);
help_btn.setStyle("overSkin", MapHelpOver);
help_btn.setStyle("downSkin", MapHelpUp);
this.addChild(help_btn);
help_btn.addEventListener("mouseDown", btn_select_handler);
}
private function open(_arg1:TimerEvent):void{
if (this.y < this.open_Y){
this.y = (this.y + this.speed_Y);
} else {
this.y = this.open_Y;
this.open_timer.stop();
this.filters = null;
this.level_update_handler(new Event("tmp"));
};
}
private function map_button_click_handler(_arg1:MouseEvent):void{
var _local2:MapButton;
_local2 = (_arg1.target as MapButton);
if (_local2.over_state != "disabled"){
model.level_update(_local2.level.level_index);
model.action_pending = "load";
};
}
private function map_button_over_handler(_arg1:MouseEvent):void{
var _local2:MapButton;
var _local3:Number;
var _local4:MapLevelTooltip;
_local2 = (_arg1.target as MapButton);
if (_local2.enabled){
_local3 = model.points_level_get(_local2.level.level_index);
_local4 = new MapLevelTooltip(_local2.level, _local3);
_local4.addEventListener(MapLevelTooltip.EXPIRE_EVENT, tooltip_expire_handler);
if (_local2.level.tooltip_pos == "right"){
_local4.x = (_local2.x + 5);
} else {
_local4.x = ((_local2.x - _local4.width) - 5);
};
_local4.y = _local2.y;
if (_local4.y > 345){
_local4.y = 345;
};
_local2.tooltip = _local4;
this.addChild(_local4);
};
}
private function create_text():void{
tf = new TextFormat();
tf.font = "Arial";
tf.size = 12;
tf.align = "left";
tf.color = 0xFFFFFF;
points_earned_txt = new TextField();
points_earned_txt.text = String(model.points_earned);
points_earned_txt.setTextFormat(tf);
points_earned_txt.width = 50;
points_earned_txt.x = 304;
points_earned_txt.y = 12;
points_earned_txt.selectable = false;
this.addChild(points_earned_txt);
points_spent_txt = new TextField();
points_spent_txt.text = String(model.points_spent);
points_spent_txt.setTextFormat(tf);
points_spent_txt.width = 50;
points_spent_txt.x = 392;
points_spent_txt.y = 12;
points_spent_txt.selectable = false;
this.addChild(points_spent_txt);
points_available_txt = new TextField();
points_available_txt.text = String(model.points_available);
points_available_txt.setTextFormat(tf);
points_available_txt.width = 50;
points_available_txt.x = 477;
points_available_txt.y = 12;
points_available_txt.selectable = false;
this.addChild(points_available_txt);
}
private function prop_shop_create():void{
prop_shop = new PropShop();
prop_shop.x = 535;
prop_shop.y = 10;
this.addChild(prop_shop);
}
private function map_button_out_handler(_arg1:MouseEvent):void{
var _local2:MapButton;
_local2 = (_arg1.target as MapButton);
if (_local2.tooltip){
_local2.tooltip.destroy();
};
}
public function enable():void{
var _local1:MapButton;
for each (_local1 in this.map_btn_list) {
_local1.enable();
_local1.enabled = true;
};
prop_shop.enable();
ok_btn.enabled = true;
}
private function points_update_handler(_arg1:Event):void{
points_earned_txt.text = String(model.points_earned);
points_earned_txt.setTextFormat(tf);
points_spent_txt.text = String(model.points_spent);
points_spent_txt.setTextFormat(tf);
points_available_txt.text = String(model.points_available);
points_available_txt.setTextFormat(tf);
}
private function btn_select_handler(_arg1:Event):void{
var _local2:String;
_local2 = Button(_arg1.target).name;
if (model.music_loop_state){
btn_sound.play();
};
switch (_local2){
case "Menu":
model.action_pending = "menu";
break;
case "MapHelp":
model.action_pending = "help";
break;
};
}
private function king_btn_selection(_arg1:Event):void{
model.action_pending = "king_sign";
}
private function levels_create():void{
var _local1:MapButton;
var _local2:LevelBase;
for each (_local2 in model.levels) {
_local1 = new MapButton();
_local1.x = _local2.map_point.x;
_local1.y = _local2.map_point.y;
_local1.btn_type = "play";
_local1.level = _local2;
_local1.addEventListener(MouseEvent.MOUSE_OVER, map_button_over_handler);
_local1.addEventListener(MouseEvent.MOUSE_OUT, map_button_out_handler);
_local1.addEventListener(MouseEvent.CLICK, map_button_click_handler);
this.addChild(_local1);
map_btn_list.push(_local1);
};
level_update_handler(new Event("tmp"));
}
private function shut(_arg1:TimerEvent):void{
if (this.y > this.shut_Y){
this.y = (this.y - this.speed_Y);
} else {
this.y = this.shut_Y;
this.shut_timer.stop();
this.filters = null;
this.disable();
};
}
private function map_pod_update_handler(_arg1:Event):void{
switch (model.map_pod_state){
case "open":
this.filters = [blur];
shut_timer.stop();
open_timer.start();
break;
case "shut":
this.filters = [blur];
open_timer.stop();
shut_timer.start();
break;
};
}
private function tooltip_expire_handler(_arg1:Event):void{
var _local2:MapLevelTooltip;
_local2 = (_arg1.target as MapLevelTooltip);
this.removeChild(_local2);
}
public function disable():void{
var _local1:MapButton;
if (model.game_pod_state == "open"){
for each (_local1 in this.map_btn_list) {
_local1.disable();
_local1.enabled = false;
};
};
ok_btn.enabled = false;
prop_shop.disable();
}
private function king_btn_create():void{
this.king_btn = new KingButton();
king_btn.x = 618;
king_btn.y = 429;
king_btn.addEventListener(MouseEvent.CLICK, king_btn_selection);
this.addChild(king_btn);
}
private function level_update_handler(_arg1:Event):void{
var _local2:MapButton;
for each (_local2 in map_btn_list) {
if (PropLevelVO.prop_level_test(_local2.level.prop_levels, model.prop_level)){
_local2.enable();
if (_local2.level.points >= _local2.level.level_target){
_local2.btn_type = "playScored";
} else {
_local2.btn_type = "play";
};
} else {
_local2.disable();
};
};
}
}
}//package com.geekglue.pMotion.View
Section 159
//Menu (com.geekglue.pMotion.View.Menu)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import fl.controls.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.Assets.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
public class Menu extends MovieClip {
private var shut_timer:Timer;
private var open_timer:Timer;
public var crossover:MovieClip;
private var model:ModelLocator;
private var addsite_btn:Button;
private var new_btn:Button;
private var help_btn:Button;
private var speed_Y:Number;// = 20
private var blur:BlurFilter;
private var btn_sound:BtnSound01;
private var load_btn:Button;
public var gg_btn:GeekGlueBtn;
public var shut_Y:Number;// = -220
private var highscores_btn:Button;
private var more_games_btn:Button;
public var open_Y:Number;// = 120
private var king_btn:KingButton;
public function Menu(){
model = ModelLocator.getInstance();
open_Y = 120;
shut_Y = -220;
speed_Y = 20;
super();
this.cacheAsBitmap = true;
open_timer = new Timer(5);
open_timer.addEventListener(TimerEvent.TIMER, open);
shut_timer = new Timer(5);
shut_timer.addEventListener(TimerEvent.TIMER, shut);
blur = new BlurFilter();
blur.blurX = 10;
blur.blurY = 10;
blur.quality = BitmapFilterQuality.MEDIUM;
create_menu_btns();
this.king_btn_create();
btn_sound = new BtnSound01();
model.addEventListener(ModelLocator.MENU_POD_EVENT, menu_pod_update_handler);
model.addEventListener(ModelLocator.LEVEL_LOAD_EVENT, level_update_handler);
}
private function level_update_handler(_arg1:Event):void{
if (model.levels_best > 0){
load_btn.enabled = true;
} else {
load_btn.enabled = false;
};
}
private function create_menu_btns():void{
var _local1:TextFormat;
var _local2:*;
var _local3:*;
var _local4:*;
_local1 = new TextFormat();
_local1.align = "center";
_local1.bold = true;
_local2 = 170;
_local3 = 5;
_local4 = 21;
new_btn = new Button();
new_btn.x = _local2;
new_btn.y = _local3;
new_btn.width = 126;
new_btn.height = 18;
new_btn.label = "";
new_btn.name = "MenuNew";
new_btn.setStyle("upSkin", MenuNewUp);
new_btn.setStyle("overSkin", MenuNewOver);
new_btn.setStyle("downSkin", MenuNewUp);
this.addChild(new_btn);
new_btn.addEventListener("mouseDown", btn_rollover_handler);
load_btn = new Button();
load_btn.x = _local2;
load_btn.y = (_local3 + _local4);
load_btn.width = 126;
load_btn.height = 18;
load_btn.label = "";
load_btn.name = "MenuLoad";
load_btn.setStyle("upSkin", MenuLoadUp);
load_btn.setStyle("overSkin", MenuLoadOver);
load_btn.setStyle("downSkin", MenuLoadUp);
load_btn.setStyle("disabledSkin", MenuLoadOff);
this.addChild(load_btn);
load_btn.addEventListener("mouseDown", btn_rollover_handler);
if (model.levels_best <= 1){
load_btn.enabled = false;
};
help_btn = new Button();
help_btn.x = _local2;
help_btn.y = (_local3 + (_local4 * 2));
help_btn.width = 126;
help_btn.height = 18;
help_btn.label = "";
help_btn.name = "MenuHelp";
help_btn.setStyle("upSkin", MenuHelpUp);
help_btn.setStyle("overSkin", MenuHelpOver);
help_btn.setStyle("downSkin", MenuHelpUp);
this.addChild(help_btn);
help_btn.addEventListener("mouseDown", btn_rollover_handler);
highscores_btn = new Button();
highscores_btn.x = _local2;
highscores_btn.y = ((_local3 + (_local4 * 3)) + 5);
highscores_btn.width = 126;
highscores_btn.height = 18;
highscores_btn.label = "";
highscores_btn.name = "MenuHighScores";
highscores_btn.setStyle("upSkin", MenuHighScoresUp);
highscores_btn.setStyle("overSkin", MenuHighScoresOver);
highscores_btn.setStyle("downSkin", MenuHighScoresUp);
this.addChild(highscores_btn);
highscores_btn.addEventListener("mouseDown", btn_rollover_handler);
addsite_btn = new Button();
addsite_btn.x = _local2;
addsite_btn.y = ((_local3 + (_local4 * 4)) + 5);
addsite_btn.width = 126;
addsite_btn.height = 18;
addsite_btn.label = "";
addsite_btn.name = "MenuAddSite";
addsite_btn.setStyle("upSkin", MenuAddSiteUp);
addsite_btn.setStyle("overSkin", MenuAddSiteOver);
addsite_btn.setStyle("downSkin", MenuAddSiteUp);
this.addChild(addsite_btn);
addsite_btn.addEventListener("mouseDown", btn_rollover_handler);
more_games_btn = new Button();
more_games_btn.x = _local2;
more_games_btn.y = ((_local3 + (_local4 * 5)) + 5);
more_games_btn.width = 126;
more_games_btn.height = 18;
more_games_btn.label = "";
more_games_btn.name = "MenuMoreGames";
more_games_btn.setStyle("upSkin", MenuMoreGamesUp);
more_games_btn.setStyle("overSkin", MenuMoreGamesOver);
more_games_btn.setStyle("downSkin", MenuMoreGamesUp);
this.addChild(more_games_btn);
more_games_btn.addEventListener("mouseDown", btn_rollover_handler);
}
private function btn_rollover_handler(_arg1:Event):void{
if (model.music_loop_state){
btn_sound.play();
};
}
public function enable():void{
new_btn.enabled = true;
if (model.level_load > 1){
load_btn.enabled = true;
};
help_btn.enabled = true;
}
private function open(_arg1:TimerEvent):void{
if (this.y < this.open_Y){
this.y = (this.y + this.speed_Y);
} else {
this.y = this.open_Y;
this.open_timer.stop();
this.filters = null;
this.level_update_handler(new Event("tmp"));
};
}
private function king_btn_selection(_arg1:Event):void{
model.action_pending = "king_sign";
}
private function shut(_arg1:TimerEvent):void{
if (this.y > this.shut_Y){
this.y = (this.y - this.speed_Y);
} else {
this.y = this.shut_Y;
this.shut_timer.stop();
this.filters = null;
};
}
private function king_btn_create():void{
this.king_btn = new KingButton();
king_btn.x = 235;
king_btn.y = 140;
king_btn.addEventListener(MouseEvent.CLICK, king_btn_selection);
this.addChild(king_btn);
}
public function disable():void{
new_btn.enabled = false;
load_btn.enabled = false;
help_btn.enabled = false;
}
private function menu_pod_update_handler(_arg1:Event):void{
switch (model.menu_pod_state){
case "open":
this.filters = [blur];
shut_timer.stop();
open_timer.start();
break;
case "shut":
this.filters = [blur];
open_timer.stop();
shut_timer.start();
break;
};
}
}
}//package com.geekglue.pMotion.View
Section 160
//pMotionGame (com.geekglue.pMotion.View.pMotionGame)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import com.geekglue.pMotion.VO.*;
import flash.net.*;
import flash.media.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.Assets.*;
import com.midasplayer.*;
public class pMotionGame extends Sprite {
private var menu_win:Menu;
private var game_over_index:Number;// = 9
private var score_swap_mc:Sprite;
private var model:ModelLocator;
private var map_index:Number;// = 8
private var props_index:Number;// = 1
private var level_over_index:Number;// = 7
private var help_index:Number;// = 10
private var control_pod:GameController;
private var scoreboard_index:Number;// = 4
private var arena:Arena;
private var control_index:Number;// = 5
private var scoreboard_mc:Scoreboard;
private var map_panel:MapPanel;
private var king_btn_index:Number;// = 11
private var music_loop:Wind;
private var arena_index:Number;// = 3
private var game_over_win:GameOver;
private var level_over_pod:LevelComplete;
private var king_btn:KingButton;
private var sequence_pod:SequenceCounter;
private var sequence_index:Number;// = 0
private var help_win:Help;
private var music_channel:SoundChannel;
private var menu_index:Number;// = 6
private var score_swap_index:Number;// = 2
public function pMotionGame(){
model = ModelLocator.getInstance();
sequence_index = 0;
props_index = 1;
score_swap_index = 2;
arena_index = 3;
scoreboard_index = 4;
control_index = 5;
menu_index = 6;
level_over_index = 7;
map_index = 8;
game_over_index = 9;
help_index = 10;
king_btn_index = 11;
music_loop = new Wind();
super();
this.addEventListener(Event.ADDED_TO_STAGE, init);
}
private function map_show():void{
arena_destroy();
this.map_panel.enable();
model.level_win_state = "shut";
model.map_pod_state = "open";
model.menu_pod_state = "shut";
model.control_pod_state = "shut";
model.control_state = "level_end";
model.help_pod_state = "shut";
model.score_pod_state = "shut";
model.king_btn_state = "shut";
}
private function game_over():void{
game_over_win = new GameOver();
game_over_win.addEventListener(MouseEvent.CLICK, game_end_selection);
game_over_win.x = -200;
game_over_win.y = ((model.game_height - game_over_win.height) / 2);
this.addChildAt(game_over_win, game_over_index);
game_over_win.visible = false;
game_over_win.disable();
}
private function init(_arg1:Event):void{
var _local2:Sprite;
this.removeEventListener(Event.ADDED_TO_STAGE, init);
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, key_handler);
this.stage.addEventListener(MouseEvent.MOUSE_UP, mouse_up_handler);
model.addEventListener(ModelLocator.ACTION_PENDING_EVENT, action_pending_handler);
this.sequence_counter();
this.props();
score_swap_mc = new Sprite();
this.addChildAt(score_swap_mc, score_swap_index);
_local2 = new Sprite();
this.addChildAt(_local2, arena_index);
this.scoreboard();
control_pod_create();
menu();
level_over_create();
map();
this.game_over();
help();
king_btn_create();
music(new Event("tmp"));
}
private function help_toggle():void{
if (model.help_pod_state == "open"){
model.control_state = model.control_state_last;
model.help_pod_state = "shut";
help_win.disable();
model.game_pause_state = false;
if ((((model.menu_pod_state == "shut")) && ((model.map_pod_state == "shut")))){
model.control_pod_state = "open";
};
} else {
model.control_state_last = model.control_state;
model.control_state = "level_end";
model.help_pod_state = "open";
model.game_pause_state = true;
help_win.enable();
};
}
private function game_load():void{
model.save_data_load();
model.map_pod_state = "open";
model.menu_pod_state = "shut";
menu_win.disable();
this.map_panel.enable();
scoreboard_swap_level("bottom");
}
private function music(_arg1:Event):void{
var _local2:SoundTransform;
if (model.music_loop_state){
_local2 = new SoundTransform(0.1);
music_channel = music_loop.play(0, 50, _local2);
music_channel.addEventListener(Event.SOUND_COMPLETE, music);
};
}
private function level_over_selection(_arg1:MouseEvent):void{
var _local2:String;
_local2 = _arg1.target.name;
switch (_local2){
case "OK":
model.action_pending = "level_over";
break;
case "RETRY":
level_over_retry();
break;
};
}
private function arena_create():void{
model.control_state = "level_load";
arena = new Arena();
this.addChildAt(arena, arena_index);
arena.addEventListener(Arena.LEVEL_PAUSE_EVENT, level_pause_handler);
arena.addEventListener(Arena.LEVEL_END_EVENT, level_end_handler);
arena.addEventListener(Arena.ARENA_EDIT_EVENT, arena_edit_handler);
}
private function level_destroy():void{
var _local1:Sprite;
arena.removeEventListener(Arena.LEVEL_PAUSE_EVENT, level_pause_handler);
arena.removeEventListener(Arena.LEVEL_END_EVENT, level_end_handler);
arena.removeEventListener(Arena.ARENA_EDIT_EVENT, arena_edit_handler);
this.removeChildAt(arena_index);
_local1 = new Sprite();
this.addChildAt(_local1, arena_index);
}
private function help():void{
help_win = new Help();
help_win.addEventListener(MouseEvent.CLICK, help_selection);
help_win.x = ((model.game_width - help_win.width) / 2);
help_win.y = help_win.shut_Y;
this.addChildAt(help_win, help_index);
help_win.disable();
}
private function level_over_retry():void{
level_status_update();
model.control_state = "level_load";
model.level_win_state = "shut";
model.game_pause_state = false;
scoreboard_swap_level("bottom");
}
private function level_status_update(){
var _local1:ScoreVO;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = new ScoreVO();
if (model.score_vo.score_total > model.score_vo_best.score_total){
_local1.copy_data(model.score_vo);
} else {
_local1.copy_data(model.score_vo_best);
};
model.points_level_update(model.level, _local1.score_total);
_local2 = model.level_current.level_index;
_local3 = model.level_max;
_local4 = model.level_current.level_target;
_local5 = model.level_current.points;
if ((((_local5 >= _local4)) && ((model.level_complete < model.level)))){
model.level_complete_update(model.level);
};
model.score_vo.reset();
model.score_vo_best.reset();
model.tries = 0;
}
private function control_pod_create():void{
control_pod = new GameController();
control_pod.x = 664;
control_pod.y = 95;
this.addChildAt(control_pod, control_index);
}
private function help_selection(_arg1:MouseEvent):void{
var _local2:Boolean;
var _local3:String;
_local2 = false;
_local3 = _arg1.target.name;
switch (_local3){
case "OK":
help_toggle();
break;
};
}
private function menu():void{
menu_win = new Menu();
menu_win.addEventListener(MouseEvent.CLICK, menu_selection);
menu_win.x = (((model.game_width - menu_win.width) / 2) - 10);
menu_win.y = -220;
this.addChildAt(menu_win, menu_index);
model.menu_pod_state = "open";
}
private function game_lost():void{
try {
level_destroy();
} catch(error:Error) {
};
game_end_show();
}
private function map():void{
map_panel = new MapPanel();
map_panel.x = 5;
map_panel.y = -500;
this.addChildAt(map_panel, map_index);
}
private function scoreboard_toggle():void{
if (model.score_pod_state == "shut"){
model.score_pod_state = "open";
} else {
model.score_pod_state = "shut";
};
}
private function props():void{
var _local1:PropsMenu;
_local1 = new PropsMenu();
_local1.x = ((model.ARENA_WIDTH - _local1.width) - 5);
_local1.y = model.ARENA_HEIGHT;
this.addChildAt(_local1, props_index);
}
private function key_handler(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 65:
break;
case 66:
if (model.test_state){
};
break;
case 67:
if ((((model.menu_pod_state == "open")) && ((model.levels_best > 0)))){
model.action_pending = "MenuLoad";
} else {
if (((model.level_state) && ((model.level_win_state == "shut")))){
arena.level_reset();
model.action_pending = "reset";
};
};
break;
case 72:
model.action_pending = "help";
break;
case 76:
break;
case 77:
if ((((model.menu_pod_state == "shut")) && ((model.map_pod_state == "open")))){
model.action_pending = "menu";
} else {
if (model.level_win_state == "open"){
model.action_pending = "level_over";
} else {
if ((((((model.level_win_state == "shut")) && ((model.menu_pod_state == "shut")))) && ((model.map_pod_state == "shut")))){
model.action_pending = "map";
};
};
};
break;
case 78:
if (model.menu_pod_state == "open"){
model.action_pending = "MenuNew";
};
break;
case 80:
if (model.menu_pod_state == "open"){
model.action_pending = "KingMoreGames";
};
break;
case 82:
if (((model.level_state) && ((model.level_win_state == "shut")))){
if (model.run_state){
model.action_pending = "retry";
model.score_pod_state = "open";
} else {
model.action_pending = "run";
model.score_pod_state = "shut";
};
} else {
if (model.level_win_state == "open"){
level_over_retry();
};
};
break;
case 83:
if (model.music_loop_state){
model.action_pending = "sound_off";
} else {
model.action_pending = "sound_on";
};
break;
case 84:
break;
case 90:
if (model.test_state){
model.lives = (model.lives + 5);
};
break;
};
}
private function scoreboard_swap_level(_arg1:String):void{
var _local2:Number;
var _local3:Number;
_local2 = this.getChildIndex(this.score_swap_mc);
_local3 = this.getChildIndex(this.scoreboard_mc);
if ((((_arg1 == "top")) && ((_local2 > _local3)))){
this.swapChildrenAt(_local2, _local3);
} else {
if ((((_arg1 == "bottom")) && ((_local3 > _local2)))){
this.swapChildrenAt(_local2, _local3);
};
};
}
private function mouse_up_handler(_arg1:MouseEvent):void{
model.body_drag_end();
}
private function action_pending_handler(_arg1:Event):void{
switch (model.action_pending){
case "exit":
model.action_pending = "menu";
menu_show();
model.control_pod_state = "shut";
model.score_pod_state = "shut";
model.game_pause_state = true;
scoreboard_swap_level("top");
break;
case "game_lost":
game_lost();
break;
case "game_over":
model.control_pod_state = "open";
model.score_pod_state = "shut";
model.level_win_state = "shut";
model.control_state = "reset";
model.game_pause_state = false;
arena.pause();
level_destroy();
sequence_pod.reset();
game_end_show();
break;
case "KingMoreGames":
KingAPI.openOtherGamesLink();
break;
case "KingHighScores":
KingAPI.openHighscoresLink();
break;
case "KingAddSite":
KingAPI.openAddToWebsiteLink();
break;
case "king_sign":
KingAPI.openSignLink();
break;
case "KingScoreSubmit":
KingAPI.submitScore(model.points_earned);
break;
case "level_over":
level_over();
break;
case "map":
model.control_pod_state = "open";
model.score_pod_state = "shut";
model.control_state = "reset";
model.game_pause_state = false;
arena.pause();
arena.retry();
sequence_pod.reset();
map_show();
this.map_panel.enable();
break;
case "menu":
menu_show();
model.control_pod_state = "shut";
model.score_pod_state = "shut";
scoreboard_swap_level("top");
break;
case "MenuNew":
model.reset();
map_show();
break;
case "MenuLoad":
game_load();
break;
case "play":
if (!model.run_state){
model.control_pod_state = "shut";
model.score_pod_state = "shut";
model.control_state = "run";
model.game_pause_state = false;
arena.run();
scoreboard_swap_level("bottom");
};
break;
case "run":
if (!model.run_state){
model.control_pod_state = "shut";
model.score_pod_state = "shut";
model.control_state = "run";
model.game_pause_state = false;
arena.run();
scoreboard_swap_level("bottom");
};
break;
case "run_complete":
model.control_state = "level_end";
model.level_win_state = "open";
model.score_pod_state = "open";
model.game_pause_state = true;
scoreboard_swap_level("top");
break;
case "reset":
model.control_pod_state = "open";
model.score_pod_state = "shut";
model.control_state = "reset";
model.game_pause_state = false;
model.tries++;
arena.level_reset();
sequence_pod.reset();
scoreboard_swap_level("bottom");
break;
case "retry":
arena.ball_reset_state = true;
model.control_pod_state = "open";
model.control_state = "level_load";
model.game_pause_state = false;
model.tries++;
arena.pause();
arena.retry();
sequence_pod.reset();
scoreboard_swap_level("bottom");
break;
case "sequence_complete":
arena.ball_reset_state = true;
model.control_pod_state = "open";
model.control_state = "reset";
model.game_pause_state = false;
arena.pause();
arena.retry();
sequence_pod.reset();
scoreboard_swap_level("top");
break;
case "help":
this.help_toggle();
break;
case "load":
model.map_pod_state = "shut";
model.prop_shop_state = "shut";
model.control_pod_state = "open";
model.score_pod_state = "open";
model.king_btn_state = "open";
model.control_state = "level_load";
model.game_pause_state = false;
model.run_state = false;
arena_create();
break;
case "sound_on":
model.control_state_last = model.control_state;
model.control_state = "sound_ON";
model.music_loop_state = true;
music(new Event("music_evt"));
break;
case "sound_off":
model.control_state_last = model.control_state;
model.control_state = "sound_OFF";
music_channel.stop();
model.music_loop_state = false;
break;
};
}
private function arena_edit_handler(_arg1:Event):void{
model.control_state = "level_load";
this.arena.mask = null;
model.control_pod_state = "open";
model.score_pod_state = "open";
}
private function level_over_create():void{
level_over_pod = new LevelComplete();
level_over_pod.x = 720;
level_over_pod.y = 120;
level_over_pod.addEventListener(MouseEvent.CLICK, level_over_selection);
this.addChildAt(level_over_pod, this.level_over_index);
}
private function game_end_show():void{
var _local1:Array;
model.control_state = "level_end";
model.game_pause_state = true;
model.game_pod_state = "open";
_local1 = new Array();
model.props_update(_local1);
game_over_win.visible = true;
game_over_win.enable();
}
private function menu_selection(_arg1:MouseEvent):void{
var test:Boolean;
var s:String;
var url:String;
var request:URLRequest;
var event = _arg1;
test = false;
s = event.target.name;
switch (s){
case "MenuNew":
model.action_pending = "MenuNew";
break;
case "MenuLoad":
model.action_pending = "MenuLoad";
break;
case "MenuHelp":
model.action_pending = "help";
break;
case "MenuMoreGames":
model.action_pending = "KingMoreGames";
break;
case "MenuHighScores":
model.action_pending = "KingHighScores";
break;
case "MenuAddSite":
model.action_pending = "KingAddSite";
break;
case "gg_btn":
url = "http://www.geekglue.com";
request = new URLRequest(url);
try {
navigateToURL(request);
} catch(e:Error) {
};
break;
};
}
private function game_end_selection(_arg1:MouseEvent):void{
var _local2:String;
var _local3:*;
_local2 = _arg1.target.name;
_local3 = false;
model.level_complete = (model.level_max - 1);
switch (_local2){
case "menuBtn":
model.action_pending = "menu";
_local3 = true;
break;
case "mapBtn":
model.action_pending = "map";
_local3 = true;
break;
case "submitScoreBtn":
model.action_pending = "KingScoreSubmit";
break;
case "MoreGames":
model.action_pending = "KingMoreGames";
break;
};
if (_local3){
this.map_panel.enable();
model.game_pod_state = "shut";
};
}
private function sequence_counter():void{
sequence_pod = new SequenceCounter();
sequence_pod.x = (model.ARENA_WIDTH / 2);
sequence_pod.y = 110;
sequence_pod.alpha = 0.2;
this.addChildAt(sequence_pod, sequence_index);
}
private function level_end_handler(_arg1:Event):void{
var a:Array;
var event = _arg1;
try {
level_destroy();
} catch(error:Error) {
};
if (model.level == -1){
a = new Array();
model.props_update(a);
menu_show();
} else {
if (model.level > 0){
arena_create();
} else {
model.game_over();
game_end_show();
};
};
}
private function map_selection(_arg1:MouseEvent):void{
var _local2:Boolean;
var _local3:String;
_local2 = false;
_local3 = _arg1.target.name;
switch (_local3){
case "LevelSelect":
break;
};
}
private function level_over():void{
level_status_update();
if (model.level_max == model.level_complete){
model.action_pending = "game_over";
} else {
model.action_pending = "map";
};
}
private function king_btn_selection(_arg1:Event):void{
model.action_pending = "king_sign";
}
private function arena_destroy():void{
var _local1:Sprite;
if (arena){
arena.removeEventListener(Arena.LEVEL_PAUSE_EVENT, level_pause_handler);
arena.removeEventListener(Arena.LEVEL_END_EVENT, level_end_handler);
arena.removeEventListener(Arena.ARENA_EDIT_EVENT, arena_edit_handler);
this.removeChildAt(arena_index);
_local1 = new Sprite();
this.addChildAt(_local1, arena_index);
};
}
private function level_pause_handler(_arg1:Event):void{
model.control_state = "level_end";
}
private function game_new():void{
model.level = 1;
model.lives = model.lives_start_num;
model.props_total = 0;
model.total_stars = 0;
model.control_pod_state = "open";
model.game_pause_state = false;
arena_create();
model.menu_pod_state = "shut";
menu_win.disable();
this.map_panel.enable();
scoreboard_swap_level("bottom");
}
private function scoreboard():void{
scoreboard_mc = new Scoreboard();
scoreboard_mc.x = 10;
scoreboard_mc.y = -167;
this.addChildAt(scoreboard_mc, scoreboard_index);
}
private function menu_show():void{
model.points = 0;
model.level = -1;
model.props_total = 0;
menu_win.enable();
model.map_pod_state = "shut";
model.menu_pod_state = "open";
model.control_pod_state = "shut";
model.control_state = "level_end";
model.help_pod_state = "shut";
model.king_btn_state = "shut";
}
private function king_btn_create():void{
this.king_btn = new KingButton("dynamic");
king_btn.x = 620;
king_btn.y = 0;
king_btn.addEventListener(MouseEvent.CLICK, king_btn_selection);
this.addChildAt(king_btn, this.king_btn_index);
model.king_btn_state = "shut";
}
}
}//package com.geekglue.pMotion.View
Section 161
//Prop (com.geekglue.pMotion.View.Prop)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import com.geekglue.pMotion.VO.*;
import flash.media.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.Assets.*;
import flash.text.*;
public class Prop extends MovieClip {
private var model:ModelLocator;
private var _type:String;// = "ramp30"
private var qty_txt:TextField;
private var btn_sound:BtnSound01;
private var tf:TextFormat;
private var quantity:Number;// = 0
public function Prop(_arg1:String="ramp30", _arg2:Number=0){
model = ModelLocator.getInstance();
_type = "ramp30";
quantity = 0;
addFrameScript(0, frame1);
super();
type = _arg1;
quantity = _arg2;
btn_sound = new BtnSound01();
model.addEventListener(ModelLocator.PROP_PENDING_EVENT, prop_add_handler);
this.addEventListener(MouseEvent.ROLL_OVER, rollover_handler);
this.addEventListener(MouseEvent.ROLL_OUT, rollout_handler);
this.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
tf = new TextFormat();
tf.font = "Arial";
tf.size = 10;
tf.align = "right";
tf.bold = true;
tf.color = 0;
this.qty_txt_create();
}
private function rollover_handler(_arg1:Event):void{
if (((((!(model.run_state)) && (!(model.game_pause_state)))) && ((this.quantity > 0)))){
this.gotoAndStop((this.type + "_over"));
};
}
private function mouse_down_handler(_arg1:MouseEvent):void{
var _local2:BodyVO;
var _local3:SoundTransform;
if (((!(model.run_state)) && (!(model.game_pause_state)))){
if (this.quantity > 0){
if (model.music_loop_state){
_local3 = new SoundTransform(0.5);
btn_sound.play(0, 0, _local3);
};
_local2 = new BodyVO(this.type);
model.pending = _local2;
this.quantity--;
qty_txt_update();
};
};
}
function frame1(){
stop();
}
private function set type(_arg1:String):void{
_type = _arg1;
this.gotoAndStop((_arg1 + "_up"));
}
private function get type():String{
return (_type);
}
private function qty_txt_update():void{
qty_txt.text = String(this.quantity);
qty_txt.setTextFormat(tf);
if (this.quantity == 0){
this.gotoAndStop((this.type + "_off"));
} else {
this.gotoAndStop((this.type + "_up"));
};
}
private function rollout_handler(_arg1:Event):void{
if (this.quantity > 0){
this.gotoAndStop((this.type + "_up"));
};
}
private function prop_add_handler(_arg1:Event):void{
if (this.type == model.prop_pending){
this.quantity++;
qty_txt_update();
};
}
private function qty_txt_create():void{
qty_txt = new TextField();
qty_txt = new TextField();
qty_txt.text = String(this.quantity);
qty_txt.setTextFormat(tf);
qty_txt.width = 20;
qty_txt.x = 20;
qty_txt.y = 0;
qty_txt.selectable = false;
this.addChild(qty_txt);
}
}
}//package com.geekglue.pMotion.View
Section 162
//PropLevelTooltip (com.geekglue.pMotion.View.PropLevelTooltip)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.View.Props.*;
import flash.utils.*;
import flash.text.*;
public class PropLevelTooltip extends MovieClip {
private var model:ModelLocator;
private var txt_width:Number;// = 50
private var txt_X:Number;// = 86
private var level_index:Number;// = 0
private var prop_type_txt:TextField;
private var prop_details:PropBase;
private var prop_cost_txt:TextField;
private var life_timer:Timer;
private var prop_angle_txt:TextField;
private var tf:TextFormat;
private var state:String;// = ""
private var timer_step:uint;// = 10
private var prop_qty_txt:TextField;
private var show_state:Boolean;// = false
private var prop_level_req_txt:TextField;
private var prop_direction_txt:TextField;
private var prop_msg_txt:TextField;
private var msg_tf:TextFormat;
public static var EXPIRE_EVENT:String = "expire_event";
public function PropLevelTooltip(_arg1:PropBase, _arg2:Number, _arg3:String){
model = ModelLocator.getInstance();
level_index = 0;
show_state = false;
state = "";
txt_X = 86;
txt_width = 50;
timer_step = 10;
addFrameScript(0, frame1);
super();
this.cacheAsBitmap = true;
this.alpha = 0;
this.level_index = _arg2;
this.prop_details = _arg1;
this.state = _arg3;
create_text();
show_state = true;
this.life_timer = new Timer(timer_step);
this.life_timer.addEventListener(TimerEvent.TIMER, fader);
this.life_timer.start();
}
public function destroy():void{
show_state = false;
this.life_timer.start();
}
function frame1(){
stop();
}
public function reset():void{
this.gotoAndStop(0);
}
private function fader(_arg1:TimerEvent):void{
if (show_state){
if (this.alpha < 1){
this.alpha = (this.alpha + model.level_fadein_speed);
} else {
this.life_timer.stop();
};
} else {
if (this.alpha > 0){
this.alpha = (this.alpha - model.level_fadeout_speed);
} else {
this.life_timer.removeEventListener(TimerEvent.TIMER, fader);
this.dispatchEvent(new Event(MapLevelTooltip.EXPIRE_EVENT));
this.life_timer.stop();
};
};
}
private function create_text():void{
tf = new TextFormat();
tf.font = "Arial";
tf.size = 12;
tf.align = "right";
tf.color = 0xFFFFFF;
msg_tf = new TextFormat();
msg_tf.font = "Arial";
msg_tf.size = 12;
msg_tf.align = "center";
msg_tf.color = 0xFFFFFF;
prop_type_txt = new TextField();
prop_type_txt.text = prop_details.type_name;
prop_type_txt.setTextFormat(tf);
prop_type_txt.width = txt_width;
prop_type_txt.x = txt_X;
prop_type_txt.y = 11;
prop_type_txt.selectable = false;
this.addChild(prop_type_txt);
prop_angle_txt = new TextField();
prop_angle_txt.text = prop_details.angle;
prop_angle_txt.setTextFormat(tf);
prop_angle_txt.width = txt_width;
prop_angle_txt.x = txt_X;
prop_angle_txt.y = 34;
prop_angle_txt.selectable = false;
this.addChild(prop_angle_txt);
prop_direction_txt = new TextField();
prop_direction_txt.text = prop_details.direction;
prop_direction_txt.setTextFormat(tf);
prop_direction_txt.width = txt_width;
prop_direction_txt.x = txt_X;
prop_direction_txt.y = 59;
prop_direction_txt.selectable = false;
this.addChild(prop_direction_txt);
prop_level_req_txt = new TextField();
prop_level_req_txt.text = prop_details.level_required[level_index];
prop_level_req_txt.setTextFormat(tf);
prop_level_req_txt.width = txt_width;
prop_level_req_txt.x = txt_X;
prop_level_req_txt.y = 83;
prop_level_req_txt.selectable = false;
this.addChild(prop_level_req_txt);
prop_qty_txt = new TextField();
prop_qty_txt.text = prop_details.qty[level_index];
prop_qty_txt.setTextFormat(tf);
prop_qty_txt.width = txt_width;
prop_qty_txt.x = txt_X;
prop_qty_txt.y = 106;
prop_qty_txt.selectable = false;
this.addChild(prop_qty_txt);
prop_cost_txt = new TextField();
prop_cost_txt.text = prop_details.cost[level_index];
prop_cost_txt.setTextFormat(tf);
prop_cost_txt.width = txt_width;
prop_cost_txt.x = txt_X;
prop_cost_txt.y = 130;
prop_cost_txt.selectable = false;
this.addChild(prop_cost_txt);
prop_msg_txt = new TextField();
prop_msg_txt.text = ((prop_details.type_name + " : ") + state);
prop_msg_txt.setTextFormat(msg_tf);
prop_msg_txt.width = 150;
prop_msg_txt.x = 5;
prop_msg_txt.y = 160;
prop_msg_txt.selectable = false;
this.addChild(prop_msg_txt);
}
}
}//package com.geekglue.pMotion.View
Section 163
//PropShop (com.geekglue.pMotion.View.PropShop)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import fl.controls.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.View.Props.*;
import com.geekglue.pMotion.Assets.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
public class PropShop extends MovieClip {
private var shut_timer:Timer;
private var open_timer:Timer;
private var btn_start_X:Number;// = 45
private var model:ModelLocator;
private var txt_width:Number;// = 50
private var txt_X:Number;// = 260
private var help_btn:Button;
private var speed_Y:Number;// = 20
private var blur:BlurFilter;
private var btn_sound:BtnSound01;
private var load_btn:Button;
private var ok_btn:Button;
public var shut_Y:Number;// = -400
private var btn_gap_Y:Number;// = 31
public var open_Y:Number;// = 10
private var btn_gap_X:Number;// = 16
private var btn_start_Y:Number;// = 36
private var prop_btn_list:Array;
public function PropShop(){
var _local1:TextFormat;
var _local2:*;
var _local3:*;
var _local4:*;
model = ModelLocator.getInstance();
btn_start_X = 45;
btn_start_Y = 36;
btn_gap_X = 16;
btn_gap_Y = 31;
prop_btn_list = new Array();
open_Y = 10;
shut_Y = -400;
speed_Y = 20;
txt_width = 50;
txt_X = 260;
super();
this.cacheAsBitmap = true;
open_timer = new Timer(5);
open_timer.addEventListener(TimerEvent.TIMER, open);
shut_timer = new Timer(5);
shut_timer.addEventListener(TimerEvent.TIMER, shut);
blur = new BlurFilter();
blur.blurX = 10;
blur.blurY = 10;
blur.quality = BitmapFilterQuality.MEDIUM;
_local1 = new TextFormat();
_local1.align = "center";
_local1.bold = true;
_local2 = 170;
_local3 = 12;
_local4 = 22;
create_btns();
btns_create();
btn_sound = new BtnSound01();
model.addEventListener(ModelLocator.MAP_POD_EVENT, level_update_handler);
model.addEventListener(ModelLocator.PROP_LEVEL_UPDATE_EVENT, level_update_handler);
model.addEventListener(ModelLocator.POINTS_UPDATE_EVENT, level_update_handler);
}
private function create_btns():void{
ok_btn = new Button();
ok_btn.x = 0x0100;
ok_btn.y = 322;
ok_btn.width = 55;
ok_btn.height = 18;
ok_btn.label = "";
ok_btn.name = "LevelSelect";
ok_btn.setStyle("upSkin", OkUp);
ok_btn.setStyle("overSkin", OkOver);
ok_btn.setStyle("downSkin", OkUp);
this.addChild(ok_btn);
ok_btn.addEventListener("mouseDown", btn_select_handler);
}
private function btn_add(_arg1:PropShopButton, _arg2:Number, _arg3:Number):void{
if (model.prop_level.ramp10_level > _arg2){
_arg1.btn_type = "available";
} else {
_arg1.btn_type = "bought";
};
_arg1.x = (this.btn_start_X + (_arg2 * this.btn_gap_X));
_arg1.y = (this.btn_start_Y + (_arg3 * this.btn_gap_Y));
_arg1.addEventListener(MouseEvent.MOUSE_OVER, prop_button_over_handler);
_arg1.addEventListener(MouseEvent.MOUSE_OUT, prop_button_out_handler);
_arg1.addEventListener(MouseEvent.CLICK, prop_button_click_handler);
this.addChild(_arg1);
this.prop_btn_list.push(_arg1);
}
private function btn_select_handler(_arg1:Event):void{
if (model.music_loop_state){
btn_sound.play();
};
model.action_pending = "prop_shop_hide";
}
private function prop_button_out_handler(_arg1:MouseEvent):void{
var _local2:PropShopButton;
_local2 = (_arg1.target as PropShopButton);
if (_local2.tooltip){
_local2.tooltip.destroy();
};
}
public function enable():void{
level_update_handler(new Event("tmp"));
}
private function open(_arg1:TimerEvent):void{
if (this.y < this.open_Y){
this.y = (this.y + this.speed_Y);
} else {
this.y = this.open_Y;
this.open_timer.stop();
this.filters = null;
this.level_update_handler(new Event("tmp"));
};
}
private function prop_btn_update(_arg1:PropShopButton, _arg2:Number):void{
var _local3:PropBase;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = _arg1.prop;
_local4 = (_arg1.level - 1);
_local5 = _local3.cost[_local4];
_local6 = _local3.level_required[_local4];
if (_arg1.level <= _arg2){
_arg1.btn_type = "bought";
} else {
if ((((((_arg1.level == (_arg2 + 1))) && ((_local5 <= model.points_available)))) && ((model.level_complete >= _local6)))){
_arg1.btn_type = "available";
} else {
_arg1.btn_type = "unavailable";
};
};
_arg1.enable();
}
private function prop_button_click_handler(_arg1:MouseEvent):void{
var _local2:PropShopButton;
var _local3:Number;
_local2 = (_arg1.target as PropShopButton);
_local3 = (_local2.level - 1);
if (_local2.btn_type == "available"){
model.prop_level_update(_local2.prop.type, _local2.level);
model.points_spent = (model.points_spent + _local2.prop.cost[_local3]);
if (_local2.tooltip){
_local2.tooltip.destroy();
};
};
level_update_handler(new Event("tmp"));
}
private function shut(_arg1:TimerEvent):void{
if (this.y > this.shut_Y){
this.y = (this.y - this.speed_Y);
} else {
this.y = this.shut_Y;
this.shut_timer.stop();
this.filters = null;
};
}
private function btns_create():void{
var _local1:PropShopButton;
var _local2:Number;
var _local3:Number;
var _local4:PropBase;
_local2 = 0;
_local3 = 0;
for each (_local4 in model.prop_type_list) {
while (_local2 < _local4.cost.length) {
_local1 = new PropShopButton();
_local1.prop = _local4;
_local1.level = (_local2 + 1);
btn_add(_local1, _local2, _local3);
_local2++;
};
_local2 = 0;
_local3++;
};
this.level_update_handler(new Event("tmp"));
}
private function tooltip_expire_handler(_arg1:Event):void{
var _local2:PropLevelTooltip;
_local2 = (_arg1.target as PropLevelTooltip);
this.removeChild(_local2);
}
public function disable():void{
var _local1:PropShopButton;
for each (_local1 in this.prop_btn_list) {
_local1.disable();
};
}
private function level_update_handler(_arg1:Event):void{
var _local2:PropShopButton;
for each (_local2 in this.prop_btn_list) {
switch (_local2.prop.type){
case "bumper":
prop_btn_update(_local2, model.prop_level.bumper_level);
break;
case "jumpLH":
prop_btn_update(_local2, model.prop_level.jumpLH_level);
break;
case "jumpRH":
prop_btn_update(_local2, model.prop_level.jumpRH_level);
break;
case "ramp10":
prop_btn_update(_local2, model.prop_level.ramp10_level);
break;
case "rampN10":
prop_btn_update(_local2, model.prop_level.rampN10_level);
break;
case "ramp30":
prop_btn_update(_local2, model.prop_level.ramp30_level);
break;
case "rampN30":
prop_btn_update(_local2, model.prop_level.rampN30_level);
break;
case "shootLH":
prop_btn_update(_local2, model.prop_level.shootLH_level);
break;
case "shootRH":
prop_btn_update(_local2, model.prop_level.shootRH_level);
break;
case "springLH":
prop_btn_update(_local2, model.prop_level.springLH_level);
break;
case "springRH":
prop_btn_update(_local2, model.prop_level.springRH_level);
break;
};
};
}
private function prop_button_over_handler(_arg1:MouseEvent):void{
var _local2:PropShopButton;
var _local3:String;
var _local4:PropBase;
var _local5:Number;
var _local6:Number;
var _local7:String;
var _local8:PropLevelTooltip;
_local2 = (_arg1.target as PropShopButton);
if (_local2.enabled){
_local3 = "";
_local4 = _local2.prop;
_local5 = (_local2.level - 1);
_local6 = 0;
_local7 = _local2.btn_type;
if (_local2.over_state == "disabled"){
_local7 = "Locked";
} else {
if (_local7 == "bought"){
_local7 = "Bought";
} else {
_local7 = "Available";
};
};
_local8 = new PropLevelTooltip(_local4, _local5, _local7);
_local8.addEventListener(PropLevelTooltip.EXPIRE_EVENT, tooltip_expire_handler);
_local8.x = (_local2.x - 155);
_local6 = _local2.y;
if ((_local6 + 220) > model.game_height){
_local6 = (model.game_height - 240);
};
_local8.y = _local6;
_local2.tooltip = _local8;
this.addChild(_local8);
};
}
}
}//package com.geekglue.pMotion.View
Section 164
//PropsMenu (com.geekglue.pMotion.View.PropsMenu)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import com.geekglue.pMotion.VO.*;
import com.geekglue.pMotion.Model.*;
import flash.utils.*;
import flash.filters.*;
public class PropsMenu extends Sprite {
private var menu_height:Number;// = 60
private var open_timer:Timer;
public var crossover:MovieClip;
private var model:ModelLocator;
private var horizontal_gap:Number;// = 3
private var blur:BlurFilter;
private var speed_Y:Number;// = 10
public var shut_Y:Number;
public var open_Y:Number;// = 424
private var prop_menu_list:Array;
private var vertical_gap:Number;// = 3
private var margin:Number;// = 0
private var menu_width:Number;// = 498
private var shut_timer:Timer;
public function PropsMenu(){
model = ModelLocator.getInstance();
menu_width = 498;
menu_height = 60;
margin = 0;
horizontal_gap = 3;
vertical_gap = 3;
prop_menu_list = new Array();
open_Y = 424;
shut_Y = model.ARENA_HEIGHT;
speed_Y = 10;
super();
this.cacheAsBitmap = true;
blur = new BlurFilter();
blur.blurX = 10;
blur.blurY = 10;
blur.quality = BitmapFilterQuality.MEDIUM;
open_timer = new Timer(5);
open_timer.addEventListener(TimerEvent.TIMER, open);
shut_timer = new Timer(5);
shut_timer.addEventListener(TimerEvent.TIMER, shut);
model.addEventListener(ModelLocator.PROPS_UPDATE_EVENT, props_update_handler);
model.addEventListener(ModelLocator.CONTROL_POD_EVENT, props_show_handler);
}
private function open(_arg1:TimerEvent):void{
if (this.y > this.open_Y){
this.y = (this.y - this.speed_Y);
} else {
this.y = this.open_Y;
this.open_timer.stop();
this.filters = null;
};
}
private function props_show_handler(_arg1:Event):void{
switch (model.control_pod_state){
case "open":
this.filters = [blur];
shut_timer.stop();
open_timer.start();
break;
case "shut":
this.filters = [blur];
open_timer.stop();
shut_timer.start();
break;
};
}
private function props_update_handler(_arg1:Event):void{
var _local2:Number;
var _local3:Prop;
var _local4:Number;
var _local5:BodyVO;
var _local6:Number;
_local2 = 0;
_local4 = 23;
for each (_local3 in prop_menu_list) {
this.removeChild(_local3);
};
this.prop_menu_list = new Array();
for each (_local5 in model.props_list) {
_local6 = 44;
_local3 = new Prop(_local5.type, _local5.quantity);
_local3.x = (10 + ((_local6 + this.horizontal_gap) * _local2));
_local3.y = _local4;
this.addChild(_local3);
this.prop_menu_list.push(_local3);
_local2++;
};
}
private function shut(_arg1:TimerEvent):void{
if (this.y < this.shut_Y){
this.y = (this.y + this.speed_Y);
} else {
this.y = this.shut_Y;
this.shut_timer.stop();
this.filters = null;
};
}
}
}//package com.geekglue.pMotion.View
Section 165
//Scoreboard (com.geekglue.pMotion.View.Scoreboard)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import com.geekglue.pMotion.Model.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
public class Scoreboard extends Sprite {
private var lives:Number;// = 0
private var open_timer:Timer;
public var crossover:MovieClip;
private var model:ModelLocator;
private var level_txt:TextField;
private var tf_points:TextFormat;
private var level_target_txt:TextField;
private var blur:BlurFilter;
private var speed_Y:Number;// = 2
public var shut_Y:Number;// = -50
public var open_Y:Number;// = -6
private var best_score_txt:TextField;
private var text_Y:Number;// = 11
private var shut_timer:Timer;
public function Scoreboard(){
model = ModelLocator.getInstance();
lives = 0;
text_Y = 11;
open_Y = -6;
shut_Y = -50;
speed_Y = 2;
super();
this.cacheAsBitmap = true;
blur = new BlurFilter();
blur.blurX = 10;
blur.blurY = 10;
blur.quality = BitmapFilterQuality.MEDIUM;
text_formats();
level_txt_create();
level_target_create();
best_score_create();
open_timer = new Timer(5);
open_timer.addEventListener(TimerEvent.TIMER, open);
shut_timer = new Timer(5);
shut_timer.addEventListener(TimerEvent.TIMER, shut);
model.addEventListener(ModelLocator.LEVEL_CURRENT_UPDATE_EVENT, level_update_handler);
model.addEventListener(ModelLocator.LEVEL_CURRENT_UPDATE_EVENT, score_update_handler);
model.addEventListener(ModelLocator.SCORE_POD_EVENT, scoreboard_show_handler);
}
private function level_target_create():void{
level_target_txt = new TextField();
level_target_txt.setTextFormat(tf_points);
level_target_txt.width = 45;
level_target_txt.x = 190;
level_target_txt.y = text_Y;
level_target_txt.selectable = false;
this.addChild(level_target_txt);
}
private function open(_arg1:TimerEvent):void{
if (this.y < this.open_Y){
this.y = (this.y + this.speed_Y);
} else {
this.y = this.open_Y;
this.open_timer.stop();
this.filters = null;
};
}
private function score_update_handler(_arg1:Event):void{
this.level_target_update();
this.best_score_update();
}
private function text_formats():void{
tf_points = new TextFormat();
tf_points.font = "Arial";
tf_points.size = 12;
tf_points.align = "center";
tf_points.bold = true;
tf_points.color = 0xFFFFFF;
}
private function level_txt_create():void{
level_txt = new TextField();
level_txt.text = String(model.level);
level_txt.setTextFormat(tf_points);
level_txt.width = 140;
level_txt.x = 5;
level_txt.y = text_Y;
level_txt.selectable = false;
this.addChild(level_txt);
}
private function best_score_update():void{
best_score_txt.text = String(model.level_current.points);
best_score_txt.setTextFormat(tf_points);
}
private function shut(_arg1:TimerEvent):void{
if (this.y > this.shut_Y){
this.y = (this.y - this.speed_Y);
} else {
this.y = this.shut_Y;
this.shut_timer.stop();
this.filters = null;
};
}
private function level_target_update():void{
level_target_txt.text = String(model.level_current.level_target);
level_target_txt.setTextFormat(tf_points);
}
private function best_score_create():void{
best_score_txt = new TextField();
best_score_txt.setTextFormat(tf_points);
best_score_txt.width = 45;
best_score_txt.x = 260;
best_score_txt.y = text_Y;
best_score_txt.selectable = false;
this.addChild(best_score_txt);
}
private function scoreboard_show_handler(_arg1:Event):void{
switch (model.score_pod_state){
case "open":
this.filters = [blur];
shut_timer.stop();
open_timer.start();
break;
case "shut":
this.filters = [blur];
open_timer.stop();
shut_timer.start();
break;
};
}
private function level_update_handler(_arg1:Event):void{
if ((((model.level >= 0)) && (model.level_current))){
level_txt.text = String(((model.level_current.city + ", ") + model.level_current.country));
} else {
level_txt.text = "";
};
level_txt.setTextFormat(tf_points);
}
}
}//package com.geekglue.pMotion.View
Section 166
//SequenceCounter (com.geekglue.pMotion.View.SequenceCounter)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import com.geekglue.pMotion.Model.*;
public class SequenceCounter extends MovieClip {
private var model:ModelLocator;
public function SequenceCounter(){
model = ModelLocator.getInstance();
super();
this.cacheAsBitmap = true;
stop();
model.addEventListener(ModelLocator.LEVEL_TIMER_UPDATE_EVENT, count_update_handler);
}
private function count_update_handler(_arg1:Event):void{
var _local2:Number;
_local2 = (model.level_max_time - model.level_run_time);
this.gotoAndStop((_local2 + 1));
}
public function reset():void{
this.gotoAndStop(0);
}
}
}//package com.geekglue.pMotion.View
Section 167
//SequenceMarker (com.geekglue.pMotion.View.SequenceMarker)
package com.geekglue.pMotion.View {
import flash.events.*;
import flash.display.*;
import com.geekglue.pMotion.Model.*;
import flash.utils.*;
public class SequenceMarker extends MovieClip {
private var model:ModelLocator;
private var life_timer:Timer;
private var start_time:Number;// = 0
private var timer_step:uint;// = 10
private var sequence_index:uint;// = 0
public static var MARKER_EXPIRE_EVENT:String = "marker_expire_event";
public function SequenceMarker(_arg1:uint=0){
model = ModelLocator.getInstance();
sequence_index = 0;
timer_step = 10;
start_time = 0;
super();
this.cacheAsBitmap = true;
stop();
sequence_index = _arg1;
this.start_time = getTimer();
this.gotoAndStop((sequence_index + 2));
this.life_timer = new Timer(timer_step);
this.life_timer.addEventListener(TimerEvent.TIMER, life_timer_handler);
this.life_timer.start();
}
private function life_timer_handler(_arg1:TimerEvent):void{
var _local2:uint;
_local2 = (this.timer_step * this.life_timer.currentCount);
_local2 = (getTimer() - this.start_time);
if (_local2 > model.marker_fade_time){
if (this.alpha > 0){
this.alpha = (this.alpha - model.marker_fade_speed);
} else {
this.life_timer.removeEventListener(TimerEvent.TIMER, life_timer_handler);
this.dispatchEvent(new Event(SequenceMarker.MARKER_EXPIRE_EVENT));
this.life_timer.stop();
};
};
if (_local2 > model.marker_expire_time){
this.life_timer.removeEventListener(TimerEvent.TIMER, life_timer_handler);
this.dispatchEvent(new Event(SequenceMarker.MARKER_EXPIRE_EVENT));
this.life_timer.stop();
};
}
}
}//package com.geekglue.pMotion.View
Section 168
//BodyVO (com.geekglue.pMotion.VO.BodyVO)
package com.geekglue.pMotion.VO {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class BodyVO {
public var body:b2Body;
public var position:b2Vec2;
public var quantity:Number;// = 0
public var boxW:Number;// = 100
public var rows:Number;// = 1
public var type:String;// = "platform"
public var columns:Number;// = 1
public var rotation:Number;// = 0
public function BodyVO(_arg1:String, _arg2:Number=0, _arg3:Number=0, _arg4:Number=200, _arg5:Number=0, _arg6:Number=1, _arg7:Number=1){
type = "platform";
position = new b2Vec2();
boxW = 100;
quantity = 0;
rows = 1;
columns = 1;
rotation = 0;
super();
type = _arg1;
quantity = _arg5;
boxW = _arg4;
rows = _arg6;
columns = _arg7;
position.Set(_arg2, _arg3);
}
}
}//package com.geekglue.pMotion.VO
Section 169
//PointVO (com.geekglue.pMotion.VO.PointVO)
package com.geekglue.pMotion.VO {
public class PointVO {
public var x:Number;// = 0
public var y:Number;// = 0
public function PointVO(){
x = 0;
y = 0;
super();
}
}
}//package com.geekglue.pMotion.VO
Section 170
//PropLevelVO (com.geekglue.pMotion.VO.PropLevelVO)
package com.geekglue.pMotion.VO {
public class PropLevelVO {
public var springRH_level:Number;// = 0
public var springLH_level:Number;// = 0
public var shootRH_level:Number;// = 0
public var rampN30_level:Number;// = 0
public var rampN10_level:Number;// = 0
public var shootLH_level:Number;// = 0
public var bumper_level:Number;// = 0
public var jumpRH_level:Number;// = 0
public var jumpLH_level:Number;// = 0
public var ramp30_level:Number;// = 0
public var ramp10_level:Number;// = 0
public function PropLevelVO(){
bumper_level = 0;
jumpLH_level = 0;
jumpRH_level = 0;
ramp10_level = 0;
rampN10_level = 0;
ramp30_level = 0;
rampN30_level = 0;
shootLH_level = 0;
shootRH_level = 0;
springRH_level = 0;
springLH_level = 0;
super();
}
public static function prop_level_test(_arg1:PropLevelVO, _arg2:PropLevelVO):Boolean{
var _local3:Boolean;
_local3 = true;
if (((!((_arg1.bumper_level == -1))) && ((_arg1.bumper_level > _arg2.bumper_level)))){
_local3 = false;
};
if (((!((_arg1.jumpLH_level == -1))) && ((_arg1.jumpLH_level > _arg2.jumpLH_level)))){
_local3 = false;
};
if (((!((_arg1.jumpRH_level == -1))) && ((_arg1.jumpRH_level > _arg2.jumpRH_level)))){
_local3 = false;
};
if (((!((_arg1.ramp10_level == -1))) && ((_arg1.ramp10_level > _arg2.ramp10_level)))){
_local3 = false;
};
if (((!((_arg1.rampN10_level == -1))) && ((_arg1.rampN10_level > _arg2.rampN10_level)))){
_local3 = false;
};
if (((!((_arg1.ramp30_level == -1))) && ((_arg1.ramp30_level > _arg2.ramp30_level)))){
_local3 = false;
};
if (((!((_arg1.rampN30_level == -1))) && ((_arg1.rampN30_level > _arg2.rampN30_level)))){
_local3 = false;
};
if (((!((_arg1.shootLH_level == -1))) && ((_arg1.shootLH_level > _arg2.shootLH_level)))){
_local3 = false;
};
if (((!((_arg1.shootRH_level == -1))) && ((_arg1.shootRH_level > _arg2.shootRH_level)))){
_local3 = false;
};
if (((!((_arg1.springRH_level == -1))) && ((_arg1.springRH_level > _arg2.springRH_level)))){
_local3 = false;
};
if (((!((_arg1.springLH_level == -1))) && ((_arg1.springLH_level > _arg2.springLH_level)))){
_local3 = false;
};
return (_local3);
}
}
}//package com.geekglue.pMotion.VO
Section 171
//ScoreVO (com.geekglue.pMotion.VO.ScoreVO)
package com.geekglue.pMotion.VO {
public class ScoreVO {
public var score_props:Number;// = 0
public var score_total:Number;// = 0
public var score_combo:Number;// = 0
public var combo_count:Number;// = 0
public var combo_list:Array;
private var _bonus_count:Number;// = 0
public var score_bonus:Number;// = 0
public var prop_count:Number;// = 0
public var combo_count_bonus:Number;// = 0
public function ScoreVO(){
score_total = 0;
score_props = 0;
score_combo = 0;
score_bonus = 0;
_bonus_count = 0;
combo_count = 0;
combo_list = new Array();
combo_count_bonus = 0;
prop_count = 0;
super();
}
public function print():void{
}
public function reset():void{
this.combo_list = new Array();
this.score_total = 0;
this.score_props = 0;
this.score_combo = 0;
this.combo_count = 0;
this.combo_count_bonus = 0;
this.bonus_count = 0;
this.prop_count = 0;
}
public function set bonus_count(_arg1:Number):void{
_bonus_count = _arg1;
this.score_bonus = (_arg1 * 20);
}
public function copy_data(_arg1:ScoreVO):void{
score_total = _arg1.score_total;
score_props = _arg1.score_props;
score_combo = _arg1.score_combo;
score_bonus = _arg1.score_bonus;
bonus_count = _arg1.bonus_count;
combo_count = _arg1.combo_count;
combo_list = _arg1.combo_list.slice();
combo_count_bonus = _arg1.combo_count_bonus;
prop_count = _arg1.prop_count;
}
public function combo_calc(){
var _local1:Number;
var _local2:Number;
if (combo_list.length > 0){
_local1 = 1;
for each (_local2 in this.combo_list) {
_local1 = (2 * _local1);
};
combo_count_bonus = (combo_count_bonus + (10 * _local1));
};
}
public function get bonus_count():Number{
return (_bonus_count);
}
}
}//package com.geekglue.pMotion.VO
Section 172
//KongregateEvent (com.kongregate.as3.client.events.KongregateEvent)
package com.kongregate.as3.client.events {
import flash.events.*;
public class KongregateEvent extends Event {
public static const COMPLETE:String = "component_api_available";
public function KongregateEvent(_arg1:String){
super(_arg1);
}
}
}//package com.kongregate.as3.client.events
Section 173
//AbstractShadowService (com.kongregate.as3.client.services.AbstractShadowService)
package com.kongregate.as3.client.services {
import flash.events.*;
public class AbstractShadowService extends EventDispatcher {
protected function alert(_arg1:String, _arg2:String, _arg3="", _arg4:String=""):void{
trace(((((((("Kongregate API: " + _arg1) + ".") + _arg2) + "(") + _arg3) + ") ") + _arg4));
}
}
}//package com.kongregate.as3.client.services
Section 174
//HighScoreServiceShadow (com.kongregate.as3.client.services.HighScoreServiceShadow)
package com.kongregate.as3.client.services {
public class HighScoreServiceShadow extends AbstractShadowService implements IHighScoreServices {
private var mode:String;
public function HighScoreServiceShadow(){
mode = "";
}
public function submit(_arg1:Number, _arg2:String=null):void{
alert("IHighScoreServices", "submit", arguments);
}
public function connect():Boolean{
alert("IKongregateServices", "connect");
return (true);
}
public function requestList(_arg1:Function):void{
alert("IHighScoreServices", "requestList", "", (("[Mode: " + mode) + "]"));
_arg1({success:false});
}
public function setMode(_arg1:String):void{
alert("IHighScoreServices", "setMode", arguments);
this.mode = _arg1;
}
}
}//package com.kongregate.as3.client.services
Section 175
//IHighScoreServices (com.kongregate.as3.client.services.IHighScoreServices)
package com.kongregate.as3.client.services {
public interface IHighScoreServices {
function setMode(_arg1:String):void;
function submit(_arg1:Number, _arg2:String=null):void;
function requestList(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 176
//IKongregateServices (com.kongregate.as3.client.services.IKongregateServices)
package com.kongregate.as3.client.services {
import flash.events.*;
public interface IKongregateServices extends IEventDispatcher {
function getPlayerInfo(_arg1:Function):void;
function connect(_arg1:Number=-1):Boolean;
}
}//package com.kongregate.as3.client.services
Section 177
//IStatServices (com.kongregate.as3.client.services.IStatServices)
package com.kongregate.as3.client.services {
public interface IStatServices {
function submitArray(_arg1:Array):void;
function submit(_arg1:String, _arg2:Number):void;
}
}//package com.kongregate.as3.client.services
Section 178
//IUserServices (com.kongregate.as3.client.services.IUserServices)
package com.kongregate.as3.client.services {
public interface IUserServices {
function getName():String;
function getPlayerInfo(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 179
//KongregateServiceShadow (com.kongregate.as3.client.services.KongregateServiceShadow)
package com.kongregate.as3.client.services {
public class KongregateServiceShadow extends AbstractShadowService implements IKongregateServices {
public function getName():String{
alert("IKongregateServices", "getName");
return ("Guest");
}
public function connect(_arg1:Number=-1):Boolean{
alert("IKongregateServices", "connect", arguments);
return (true);
}
public function getPlayerInfo(_arg1:Function):void{
alert("IKongregateServices", "getPlayerInfo");
_arg1(new Object());
}
}
}//package com.kongregate.as3.client.services
Section 180
//StatServiceShadow (com.kongregate.as3.client.services.StatServiceShadow)
package com.kongregate.as3.client.services {
public class StatServiceShadow extends AbstractShadowService implements IStatServices {
public function submitArray(_arg1:Array):void{
alert("IStatServices", "submitArray", arguments);
}
public function submit(_arg1:String, _arg2:Number):void{
alert("IStatServices", "submitStat", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 181
//UserServiceShadow (com.kongregate.as3.client.services.UserServiceShadow)
package com.kongregate.as3.client.services {
public class UserServiceShadow extends AbstractShadowService implements IUserServices {
public function getName():String{
alert("UserService", "getName");
return ("Guest");
}
public function getPlayerInfo(_arg1:Function):void{
alert("UserService", "getPlayerInfo");
_arg1({isGuest:true, name:"Guest", points:0, level:0, isMode:false, isAdmin:false, isDeveloper:false, avatarPath:"", chatAvatarPath:""});
}
}
}//package com.kongregate.as3.client.services
Section 182
//IAPIBootstrap (com.kongregate.as3.client.IAPIBootstrap)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
public interface IAPIBootstrap {
function init(_arg1:Event=null, _arg2:Stage=null):void;
function hideLog():void;
function showLog(_arg1:int=0):void;
}
}//package com.kongregate.as3.client
Section 183
//KongregateAPI (com.kongregate.as3.client.KongregateAPI)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import com.kongregate.as3.client.services.*;
import flash.utils.*;
import com.kongregate.as3.client.events.*;
import flash.system.*;
import flash.errors.*;
public class KongregateAPI extends Sprite {
private const VERSION:Number = 1;
private var loader:Loader;
private var loadedDomain:ApplicationDomain;
private static const CLASS_USER:String = "com.kongregate.as3.client.services.UserServices";
private static const CLASS_STATS:String = "com.kongregate.as3.client.services.StatServices";
private static const CLASS_SERVICES:String = "com.kongregate.as3.client.services.KongregateServices";
private static const CLASS_SCORES:String = "com.kongregate.as3.client.services.HighScoreServices";
private static const DEBUG_API_URL:String = "//Linuxpc/kongregate/public/flash/API_AS3.swf";
private static var _connected:Boolean;
private static var kUser:IUserServices;
private static var _loaded:Boolean;
private static var kServices:IKongregateServices;
private static var kScores:IHighScoreServices;
private static var mInstance:KongregateAPI;
private static var kStats:IStatServices;
private static var kAPI:IAPIBootstrap;
public function KongregateAPI(){
if (mInstance != null){
throw (new Error("Warning: KongregateAPI has been added to stage more than once or accessed improperly. Use getInstance() or a stage reference to access."));
};
mInstance = this;
this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
public function get loaded():Boolean{
return (_loaded);
}
public function get connected():Boolean{
return (_connected);
}
private function alertConnected(_arg1:TimerEvent=null):void{
var _local2:KongregateEvent;
var _local3:Boolean;
_local2 = new KongregateEvent(KongregateEvent.COMPLETE);
_local3 = this.dispatchEvent(_local2);
}
private function init(_arg1:Event):void{
var _local2:Object;
var _local3:String;
var _local4:URLRequest;
var _local5:LoaderContext;
this.removeEventListener(Event.ADDED_TO_STAGE, init);
_loaded = false;
_connected = false;
_local2 = LoaderInfo(root.loaderInfo).parameters;
_local3 = _local2.api_path;
if (_local3 == null){
trace("Alert: Kongregate API could not be loaded, due to local testing. API will load when the game is uploaded.");
createShadowServices();
return;
};
Security.allowDomain("*.kongregate.com");
Security.allowDomain("kongregatetrunk.com");
_local4 = new URLRequest(_local3);
_local5 = new LoaderContext(false);
_local5.applicationDomain = ApplicationDomain.currentDomain;
_local5.securityDomain = SecurityDomain.currentDomain;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.load(_local4, _local5);
}
public function get api():IAPIBootstrap{
return (kAPI);
}
private function loadComplete(_arg1:Event):void{
getServices();
}
public function get scores():IHighScoreServices{
return (kScores);
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
throw (new IOError(("API file not found. " + _arg1)));
}
public function get services():IKongregateServices{
return (kServices);
}
public function get stats():IStatServices{
return (kStats);
}
private function createShadowServices():void{
var _local1:Timer;
trace(">>> Kongregate Shadow Services instantiated for local development..");
kServices = new KongregateServiceShadow();
kScores = new HighScoreServiceShadow();
kStats = new StatServiceShadow();
kUser = new UserServiceShadow();
_local1 = new Timer(200, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, alertConnected);
_local1.start();
_connected = true;
}
public function get user():IUserServices{
return (kUser);
}
private function getServices():void{
var _local1:ApplicationDomain;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = ApplicationDomain.currentDomain;
kAPI = IAPIBootstrap(loader.getChildAt(0));
this.addChild(loader);
_local2 = _local1.getDefinition(CLASS_SERVICES);
trace(_local2);
kServices = _local2.getInstance();
_local3 = _local1.getDefinition(CLASS_SCORES);
kScores = _local3.getInstance();
_local4 = _local1.getDefinition(CLASS_STATS);
kStats = _local4.getInstance();
_local5 = _local1.getDefinition(CLASS_USER);
kUser = _local5.getInstance();
kServices.connect(VERSION);
_loaded = true;
_connected = true;
alertConnected();
}
public static function getInstance():KongregateAPI{
if (!mInstance){
throw (new IllegalOperationError("You must add the Kongregate API component to the stage before attempting to access it."));
};
return (mInstance);
}
}
}//package com.kongregate.as3.client
Section 184
//Main (com.midasplayer.particle.Main)
package com.midasplayer.particle {
import flash.events.*;
import flash.display.*;
public class Main extends Sprite {
private var minAlpha:Number;// = 0.01
private var maxAlpha:Number;// = 0.02
private var emitter;
private var minXVel:Number;// = -1
private var minSize:Number;// = 12
private var maxXVel:Number;// = 1
private var maxSize:Number;// = 29
private var particles:Array;
private var numParticles:int;// = 20
private var minYVel:Number;// = -1
private var maxYVel:Number;// = 1
public function Main(){
numParticles = 20;
minXVel = -1;
maxXVel = 1;
minYVel = -1;
maxYVel = 1;
minSize = 12;
maxSize = 29;
minAlpha = 0.01;
maxAlpha = 0.02;
particles = new Array();
super();
addEventListener(Event.ENTER_FRAME, enterFrame);
}
public function setEmitterClip(_arg1):void{
emitter = _arg1;
}
private function randRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = ((Math.random() * (_arg2 - _arg1)) + _arg1);
return (_local3);
}
private function enterFrame(_arg1:Event){
createNewParticle();
}
public function kill():void{
var _local1:Number;
removeEventListener(Event.ENTER_FRAME, enterFrame);
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].destroy();
_local1++;
};
}
private function createNewParticle():void{
var _local1:*;
var _local2:Number;
_local1 = new Particle(spark, emitter, -10, -7, stage.stageWidth, stage.stageHeight);
_local1.setVel(randRange(minXVel, maxXVel), randRange(minYVel, maxYVel));
_local1.setSize(randRange(minSize, maxSize));
particles.push(_local1);
while (particles.length > numParticles) {
_local1 = particles.shift();
_local1.destroy();
};
_local2 = 0;
while (_local2 < particles.length) {
particles[_local2].update();
_local2++;
};
}
}
}//package com.midasplayer.particle
Section 185
//Particle (com.midasplayer.particle.Particle)
package com.midasplayer.particle {
import flash.display.*;
import flash.geom.*;
public class Particle {
private var _yVel:Number;
private var _xVel:Number;
private var _stageHeight:Number;
private var _alphaDecr:Number;// = 0
private var clip:DisplayObject;
private var _stageWidth:Number;
public function Particle(_arg1:Class, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number){
_alphaDecr = 0;
super();
_stageWidth = _arg5;
_stageHeight = _arg6;
clip = new (_arg1);
_arg2.addChild(clip);
clip.x = _arg3;
clip.y = _arg4;
}
public function update(){
clip.x = (clip.x + _xVel);
clip.y = (clip.y + _yVel);
clip.alpha = (clip.alpha - _alphaDecr);
}
public function setSize(_arg1:Number){
clip.width = _arg1;
clip.height = _arg1;
}
public function setColour(_arg1:Number){
var _local2:ColorTransform;
_local2 = new ColorTransform();
_local2.color = _arg1;
clip.transform.colorTransform = _local2;
}
public function setAlphaDecr(_arg1:Number):void{
_alphaDecr = _arg1;
}
public function destroy():void{
clip.parent.removeChild(clip);
clip = null;
}
public function setVel(_arg1:Number, _arg2:Number){
_xVel = _arg1;
_yVel = _arg2;
}
}
}//package com.midasplayer.particle
Section 186
//DragonLoader (com.midasplayer.DragonLoader)
package com.midasplayer {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.utils.*;
import fl.transitions.easing.*;
import fl.transitions.*;
public class DragonLoader extends MovieClip {
public var fireLogoHolder:MovieClip;
public var mcPlayBtn:MovieClip;
private var m_dragonClip:MovieClip;
private var m_bannedSign:MovieClip;
private var m_glimmerTween:Tween;
private var m_bg:Sprite;
private var m_playBtnTween:Tween;
public var bannedSign:MovieClip;
private var m_fireLogoClip:MovieClip;
private var oldFrameRate:int;
private var m_fireLogoTween:Tween;
private var m_sndBell:Sound;
public var dragonHolder:MovieClip;
private var m_glimmer:MovieClip;
private var m_playBtn:MovieClip;
public static var LAUNCH_GAME:String = "launchGame";
public function DragonLoader(){
this.x = (this.y = 0);
m_bannedSign = bannedSign;
m_bannedSign.bg.width = stage.stageWidth;
m_bannedSign.bg.height = stage.stageHeight;
m_bannedSign.alpha = 0;
m_bannedSign.addEventListener(MouseEvent.CLICK, onMainMovie);
m_bannedSign.buttonMode = true;
m_fireLogoClip = fireLogoHolder;
m_fireLogoClip.x = ((m_bannedSign.bg.width - m_fireLogoClip.width) - 90);
m_fireLogoClip.y = (((m_bannedSign.bg.height / 2) - (m_fireLogoClip.height / 2)) - 60);
m_fireLogoClip.visible = false;
m_fireLogoClip.stop();
m_dragonClip = dragonHolder;
m_dragonClip.x = (m_bannedSign.bg.width - m_dragonClip.width);
m_dragonClip.y = ((m_bannedSign.bg.height / 2) - (m_dragonClip.height / 2));
m_dragonClip.stop();
m_playBtn = mcPlayBtn;
m_playBtn.buttonMode = true;
m_playBtn.alpha = 0;
m_sndBell = new sfxBell();
}
public function destroy():void{
var _local1:Sprite;
m_playBtn.removeEventListener(MouseEvent.ROLL_OVER, btnOver);
m_playBtn.removeEventListener(MouseEvent.ROLL_OUT, btnOut);
m_playBtn.removeEventListener(MouseEvent.MOUSE_DOWN, btnDown);
m_playBtn.removeEventListener(MouseEvent.MOUSE_UP, launchGame);
m_fireLogoTween.removeEventListener(TweenEvent.MOTION_FINISH, logoInPlace);
m_fireLogoTween = null;
_local1 = (this.parent.getChildByName("clickBg") as Sprite);
this.parent.removeChild(_local1);
this.parent.removeChild(this);
}
public function onMainMovie(_arg1:MouseEvent):void{
KingAPI.openLoaderMovieLink();
}
public function playLoaderMovie():void{
m_dragonClip.addEventListener(Event.ENTER_FRAME, animationDone);
m_dragonClip.play();
}
public function init(_arg1:String, _arg2:String=""):void{
if (_arg2 != ""){
MochiBot.track(this, _arg2);
};
oldFrameRate = root.stage.frameRate;
root.stage.frameRate = 30;
if (KingAPI.banned){
showBannedScreen();
} else {
playLoaderMovie();
};
}
private function btnDown(_arg1:MouseEvent):void{
m_playBtn.gotoAndStop("down");
}
public function animationDone(_arg1:Event):void{
if (m_dragonClip.currentFrame == 80){
m_fireLogoClip.visible = true;
m_fireLogoClip.play();
m_fireLogoTween = new Tween(m_fireLogoClip, "x", Regular.easeOut, m_fireLogoClip.x, (((stage.width / 2) - (m_dragonClip.width / 2)) - 51), 1, true);
m_fireLogoTween.addEventListener(TweenEvent.MOTION_FINISH, logoInPlace);
};
if (m_dragonClip.currentFrame == m_dragonClip.totalFrames){
m_dragonClip.removeEventListener(Event.ENTER_FRAME, animationDone);
m_dragonClip.stop();
m_playBtn.x = ((stage.width / 2) - (m_playBtn.width / 2));
m_playBtn.y = (m_fireLogoClip.y + 210);
m_playBtn.addEventListener(MouseEvent.ROLL_OVER, btnOver);
m_playBtn.addEventListener(MouseEvent.ROLL_OUT, btnOut);
m_playBtn.addEventListener(MouseEvent.MOUSE_DOWN, btnDown);
m_playBtn.addEventListener(MouseEvent.MOUSE_UP, launchGame);
};
}
private function onGlimmerTmr(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
_local2 = (m_fireLogoClip.x - m_glimmer.width);
_local3 = ((m_fireLogoClip.x + m_fireLogoClip.width) - 80);
m_glimmerTween = new Tween(m_glimmer, "x", None.easeNone, _local2, _local3, 0.5, true);
m_glimmerTween.addEventListener(TweenEvent.MOTION_FINISH, glimmerDone);
m_sndBell.play();
}
public function launchGame(_arg1:Event):void{
root.stage.frameRate = oldFrameRate;
this.dispatchEvent(new Event(LAUNCH_GAME));
}
private function btnOver(_arg1:MouseEvent):void{
m_playBtn.gotoAndStop("over");
}
private function logoVisible(_arg1:Event):void{
if (m_fireLogoClip.currentFrame == m_fireLogoClip.totalFrames){
m_fireLogoClip.removeEventListener(Event.ENTER_FRAME, logoVisible);
m_playBtnTween = new Tween(m_playBtn, "alpha", None.easeNone, 0, 1, 0.5, true);
m_glimmer = new mcGlimmer();
m_glimmer.x = (m_fireLogoClip.x - m_glimmer.width);
m_glimmer.y = (m_fireLogoClip.y + 112);
this.addChild(m_glimmer);
setTimeout(onGlimmerTmr, 1000, null);
};
}
private function btnOut(_arg1:MouseEvent):void{
m_playBtn.gotoAndStop("idle");
}
private function glimmerDone(_arg1:Event):void{
m_glimmerTween.removeEventListener(TweenEvent.MOTION_FINISH, glimmerDone);
this.removeChild(m_glimmer);
}
private function logoInPlace(_arg1:Event):void{
m_fireLogoClip.addEventListener(Event.ENTER_FRAME, logoVisible);
}
public function showBannedScreen():void{
m_bannedSign.alpha = 1;
}
}
}//package com.midasplayer
Section 187
//KingAPI (com.midasplayer.KingAPI)
package com.midasplayer {
import flash.events.*;
import flash.net.*;
import flash.external.*;
public class KingAPI {
public static const LINK_TYPE_RIGHT_CLICK:String = "rightclick";
public static const USER_TYPE_SUBSCRIPTION:int = 3;
public static const LINK_TYPE_HIGHSCORES:String = "highscores";
public static const LINK_TYPE_SIGN:String = "sign";
public static const INITIALIZED_EVENT:String = "initialized";
public static const LINK_TYPE_OTHER_GAMES:String = "other_games";
public static const USER_TYPE_REGISTERED:int = 1;
private static const SAK:String = "ggfd7sday923mdsfd8csfds34";
private static const loadHomeParametersURL:String = "http://www.king.com/servlet/FreeGameServlet?action=load";
public static const LINK_TYPE_LOADER_MOVIE:String = "loader_movie";
private static const bounceURL:String = "http://www.mygame.com/king/bounce.jsp";
public static const LINK_TYPE_PROTECT:String = "protect";
public static const LINK_TYPE_ADD_GAME:String = "add_game";
public static const USER_TYPE_GOLD:int = 2;
public static const USER_TYPE_UNREGISTERED:int = 0;
public static const HOST_BANNED_EVENT:String = "hostBanned";
private static const SK:String = "vf78hxcsjak77cxzhjkwad87s";
private static const loadCountURL:String = "http://www.mygame.com/king/loadcount.jsp";
public static const LINK_TYPE_LOADER_PROGRESS:String = "loader_progress";
private static var check:String = null;
public static var gameName:String;
public static var banned:Boolean = false;
protected static var dispatcher:EventDispatcher;
public static var isHome:Boolean = false;
private static var sessionID:String;
private static var iscore:int = 123;
public static var fromURL:String;
private static var SSK:String = "ng43ui54hy35tdsnd6f54rews";
private static function loadUrlErrorHandler(_arg1:Event):void{
}
public static function resetScore():void{
iscore = 123;
check = null;
}
public static function openOfflineProtectionLink():void{
openKingPage(LINK_TYPE_PROTECT);
}
public static function init(_arg1:String, _arg2:String):void{
var loadCounter:URLLoader;
var reqvars:URLVariables;
var request:URLRequest;
var so:SharedObject;
var rnd1:Number;
var rnd2:Number;
var name = _arg1;
var from = _arg2;
gameName = name;
fromURL = from;
loadCounter = new URLLoader();
reqvars = new URLVariables();
reqvars.game = gameName;
reqvars.from = fromURL;
try {
so = SharedObject.getLocal("sessionId");
if (so.data.sessionID == null){
rnd1 = Math.abs(Math.floor((Math.random() * 4294967295)));
rnd2 = Math.abs(Math.floor((Math.random() * 4294967295)));
so.data.sessionID = (rnd1.toString(16) + rnd2.toString(16));
so.flush();
};
sessionID = so.data.sessionID;
} catch(e:Error) {
sessionID = "error";
};
reqvars.session = sessionID;
request = new URLRequest(((loadCountURL + "?") + reqvars.toString()));
loadCounter.addEventListener(Event.COMPLETE, loadCountHandler);
loadCounter.addEventListener(IOErrorEvent.IO_ERROR, loadUrlErrorHandler);
loadCounter.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loadUrlErrorHandler);
try {
loadCounter.load(request);
} catch(error:Error) {
};
}
private static function loadHomeParametersHandler(_arg1:Event):void{
var _local2:URLLoader;
_local2 = URLLoader(_arg1.target);
}
public static function submitInternalScore():void{
var _local1:int;
checkScore();
_local1 = ((iscore - 123) / 2);
submitScore(_local1);
}
public static function openOtherGamesLink():void{
openKingPage(LINK_TYPE_OTHER_GAMES);
}
public static function openKingPage(_arg1:String, _arg2:String=null):void{
var _local3:URLVariables;
var _local4:String;
_local3 = new URLVariables();
_local3.game = gameName;
_local3.from = fromURL;
_local3.type = _arg1;
_local3.session = sessionID;
if (_arg2 != null){
_local3.redirect = _arg2;
};
_local4 = "_blank";
if (isHome){
_local4 = "_top";
};
navigateToURL(new URLRequest(((bounceURL + "?") + _local3.toString())), _local4);
}
private static function loadCountHandler(_arg1:Event):void{
var loadCounter:URLLoader;
var vars:URLVariables;
var event = _arg1;
loadCounter = URLLoader(event.target);
try {
vars = new URLVariables(loadCounter.data);
if (vars.h == "true"){
isHome = true;
};
if (vars.b == "true"){
banned = true;
dispatcher.dispatchEvent(new Event(HOST_BANNED_EVENT));
} else {
dispatcher.dispatchEvent(new Event(INITIALIZED_EVENT));
};
} catch(e:Error) {
};
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
if (dispatcher == null){
dispatcher = new EventDispatcher();
};
dispatcher.addEventListener(_arg1, _arg2);
}
public static function openLoaderMovieLink():void{
openKingPage(LINK_TYPE_LOADER_MOVIE);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
if (dispatcher == null){
return;
};
dispatcher.removeEventListener(_arg1, _arg2);
}
public static function submitScore(_arg1:int):void{
var hash:String;
var score = _arg1;
hash = md5.encrypt(((((score + ":") + gameName) + ":") + SSK));
try {
if (isHome){
ExternalInterface.call("submitScore", score, hash);
} else {
openKingPage(LINK_TYPE_HIGHSCORES, ((((("game/" + gameName) + "/submit/") + score) + ":") + hash));
};
} catch(e:Error) {
};
}
public static function openHighscoresLink():void{
openKingPage(LINK_TYPE_HIGHSCORES, (("game/" + gameName) + "/highscores"));
}
public static function openSignLink():void{
openKingPage(LINK_TYPE_SIGN);
}
public static function openRightClickLink():void{
openKingPage(LINK_TYPE_RIGHT_CLICK);
}
private static function checkScore():void{
if (check != null){
if (check != md5.encrypt(((((iscore + ":") + gameName) + ":") + SK))){
SSK = "ng41ui54hy35tdsnd6f54rews";
};
};
}
public static function addScore(_arg1:int):int{
var _local2:int;
checkScore();
_local2 = ((iscore - 123) / 2);
_local2 = (_local2 + _arg1);
iscore = ((_local2 * 2) + 123);
check = md5.encrypt(((((iscore + ":") + gameName) + ":") + SK));
return (_local2);
}
public static function openLoaderProgressLink():void{
openKingPage(LINK_TYPE_LOADER_PROGRESS);
}
public static function openAddToWebsiteLink():void{
openKingPage(LINK_TYPE_ADD_GAME, "website_content.jsp");
}
public static function submitAchievement(_arg1:String):void{
var hash:String;
var achievement = _arg1;
hash = md5.encrypt(((((achievement + ":") + gameName) + ":") + SAK));
try {
if (isHome){
ExternalInterface.call("submitAchievement", achievement, hash);
};
} catch(e:Error) {
};
}
}
}//package com.midasplayer
Section 188
//md5 (com.midasplayer.md5)
package com.midasplayer {
public class md5 {
public static const HEX_FORMAT_LOWERCASE:uint = 0;
public static const HEX_FORMAT_UPPERCASE:uint = 1;
public static const BASE64_PAD_CHARACTER_DEFAULT_COMPLIANCE:String = "";
public static const BASE64_PAD_CHARACTER_RFC_COMPLIANCE:String = "=";
public static var hexcase:uint = 0;
public static var b64pad:String = "";
public static function md5_gg(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 & _arg4) | (_arg3 & ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function md5_cmn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{
return (safe_add(bit_rol(safe_add(safe_add(_arg2, _arg1), safe_add(_arg4, _arg6)), _arg5), _arg3));
}
public static function binl_md5(_arg1:Array, _arg2:Number):Array{
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;
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (_arg2 % 32)));
_arg1[((((_arg2 + 64) >>> 9) << 4) + 14)] = _arg2;
_local3 = 1732584193;
_local4 = -271733879;
_local5 = -1732584194;
_local6 = 271733878;
_local7 = 0;
while (_local7 < _arg1.length) {
_local8 = _local3;
_local9 = _local4;
_local10 = _local5;
_local11 = _local6;
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 7, -680876936);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 1)], 12, -389564586);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 17, 606105819);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 3)], 22, -1044525330);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 7, -176418897);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 5)], 12, 1200080426);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 17, -1473231341);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 7)], 22, -45705983);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 7, 1770035416);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 9)], 12, -1958414417);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 17, -42063);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 11)], 22, -1990404162);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 7, 1804603682);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 13)], 12, -40341101);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 17, -1502002290);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 15)], 22, 1236535329);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 5, -165796510);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 6)], 9, -1069501632);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 14, 643717713);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 0)], 20, -373897302);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 5, -701558691);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 10)], 9, 38016083);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 14, -660478335);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 4)], 20, -405537848);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 5, 568446438);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 14)], 9, -1019803690);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 14, -187363961);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 8)], 20, 1163531501);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 5, -1444681467);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 2)], 9, -51403784);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 14, 1735328473);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 12)], 20, -1926607734);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 4, -378558);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 8)], 11, -2022574463);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 16, 1839030562);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 14)], 23, -35309556);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 4, -1530992060);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 4)], 11, 1272893353);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 16, -155497632);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 10)], 23, -1094730640);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 4, 681279174);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 0)], 11, -358537222);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 16, -722521979);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 6)], 23, 76029189);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 4, -640364487);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 12)], 11, -421815835);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 16, 530742520);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 2)], 23, -995338651);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 6, -198630844);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 7)], 10, 1126891415);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 15, -1416354905);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 5)], 21, -57434055);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 6, 1700485571);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 3)], 10, -1894986606);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 15, -1051523);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 1)], 21, -2054922799);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 6, 1873313359);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 15)], 10, -30611744);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 15, -1560198380);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 13)], 21, 1309151649);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 6, -145523070);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 11)], 10, -1120210379);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 15, 718787259);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 9)], 21, -343485551);
_local3 = safe_add(_local3, _local8);
_local4 = safe_add(_local4, _local9);
_local5 = safe_add(_local5, _local10);
_local6 = safe_add(_local6, _local11);
_local7 = (_local7 + 16);
};
return ([_local3, _local4, _local5, _local6]);
}
public static function str2rstr_utf16le(_arg1:String):String{
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode((_arg1.charCodeAt(_local3) & 0xFF), ((_arg1.charCodeAt(_local3) >>> 8) & 0xFF)));
_local3++;
};
return (_local2);
}
public static function hex_hmac_md5(_arg1:String, _arg2:String):String{
return (rstr2hex(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2))));
}
public static function binl2rstr(_arg1:Array):String{
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < (_arg1.length * 32)) {
_local2 = (_local2 + String.fromCharCode(((_arg1[(_local3 >> 5)] >>> (_local3 % 32)) & 0xFF)));
_local3 = (_local3 + 8);
};
return (_local2);
}
public static function md5_ff(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 & _arg3) | (~(_arg2) & _arg4)), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function md5_ii(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn((_arg3 ^ (_arg2 | ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function rstr2binl(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = Array((_arg1.length >> 2));
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3] = 0;
_local3++;
};
_local3 = 0;
while (_local3 < (_arg1.length * 8)) {
_local2[(_local3 >> 5)] = (_local2[(_local3 >> 5)] | ((_arg1.charCodeAt((_local3 / 8)) & 0xFF) << (_local3 % 32)));
_local3 = (_local3 + 8);
};
return (_local2);
}
public static function md5_vm_test():Boolean{
return ((hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"));
}
public static function b64_md5(_arg1:String):String{
return (rstr2b64(rstr_md5(str2rstr_utf8(_arg1))));
}
public static function any_hmac_md5(_arg1:String, _arg2:String, _arg3:String):String{
return (rstr2any(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2)), _arg3));
}
public static function hex_md5(_arg1:String):String{
return (rstr2hex(rstr_md5(str2rstr_utf8(_arg1))));
}
public static function bit_rol(_arg1:Number, _arg2:Number):Number{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
public static function encrypt(_arg1:String):String{
return (hex_md5(_arg1));
}
public static function md5_hh(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 ^ _arg3) ^ _arg4), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function rstr2hex(_arg1:String):String{
var _local2:String;
var _local3:String;
var _local4:Number;
var _local5:Number;
_local2 = (hexcase) ? "0123456789ABCDEF" : "0123456789abcdef";
_local3 = "";
_local5 = 0;
while (_local5 < _arg1.length) {
_local4 = _arg1.charCodeAt(_local5);
_local3 = (_local3 + (_local2.charAt(((_local4 >>> 4) & 15)) + _local2.charAt((_local4 & 15))));
_local5++;
};
return (_local3);
}
public static function any_md5(_arg1:String, _arg2:String):String{
return (rstr2any(rstr_md5(str2rstr_utf8(_arg1)), _arg2));
}
public static function b64_hmac_md5(_arg1:String, _arg2:String):String{
return (rstr2b64(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2))));
}
public static function rstr2b64(_arg1:String):String{
var _local2:String;
var _local3:String;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
_local3 = "";
_local4 = _arg1.length;
_local5 = 0;
while (_local5 < _local4) {
_local6 = (((_arg1.charCodeAt(_local5) << 16) | (((_local5 + 1) < _local4)) ? (_arg1.charCodeAt((_local5 + 1)) << 8) : 0) | (((_local5 + 2) < _local4)) ? _arg1.charCodeAt((_local5 + 2)) : 0);
_local7 = 0;
while (_local7 < 4) {
if (((_local5 * 8) + (_local7 * 6)) > (_arg1.length * 8)){
_local3 = (_local3 + b64pad);
} else {
_local3 = (_local3 + _local2.charAt(((_local6 >>> (6 * (3 - _local7))) & 63)));
};
_local7++;
};
_local5 = (_local5 + 3);
};
return (_local3);
}
public static function safe_add(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
_local3 = ((_arg1 & 0xFFFF) + (_arg2 & 0xFFFF));
_local4 = (((_arg1 >> 16) + (_arg2 >> 16)) + (_local3 >> 16));
return (((_local4 << 16) | (_local3 & 0xFFFF)));
}
public static function str2rstr_utf8(_arg1:String):String{
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = "";
_local3 = -1;
while (++_local3 < _arg1.length) {
_local4 = _arg1.charCodeAt(_local3);
_local5 = (((_local3 + 1) < _arg1.length)) ? _arg1.charCodeAt((_local3 + 1)) : 0;
if ((((((((0xD800 <= _local4)) && ((_local4 <= 56319)))) && ((0xDC00 <= _local5)))) && ((_local5 <= 57343)))){
_local4 = ((65536 + ((_local4 & 1023) << 10)) + (_local5 & 1023));
_local3++;
};
if (_local4 <= 127){
_local2 = (_local2 + String.fromCharCode(_local4));
} else {
if (_local4 <= 2047){
_local2 = (_local2 + String.fromCharCode((192 | ((_local4 >>> 6) & 31)), (128 | (_local4 & 63))));
} else {
if (_local4 <= 0xFFFF){
_local2 = (_local2 + String.fromCharCode((224 | ((_local4 >>> 12) & 15)), (128 | ((_local4 >>> 6) & 63)), (128 | (_local4 & 63))));
} else {
if (_local4 <= 2097151){
_local2 = (_local2 + String.fromCharCode((240 | ((_local4 >>> 18) & 7)), (128 | ((_local4 >>> 12) & 63)), (128 | ((_local4 >>> 6) & 63)), (128 | (_local4 & 63))));
};
};
};
};
};
return (_local2);
}
public static function rstr_hmac_md5(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = rstr2binl(_arg1);
if (_local3.length > 16){
_local3 = binl_md5(_local3, (_arg1.length * 8));
};
_local4 = Array(16);
_local5 = Array(16);
_local6 = 0;
while (_local6 < 16) {
_local4[_local6] = (_local3[_local6] ^ 909522486);
_local5[_local6] = (_local3[_local6] ^ 1549556828);
_local6++;
};
_local7 = binl_md5(_local4.concat(rstr2binl(_arg2)), (0x0200 + (_arg2.length * 8)));
return (binl2rstr(binl_md5(_local5.concat(_local7), (0x0200 + 128))));
}
public static function str2rstr_utf16be(_arg1:String):String{
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(((_arg1.charCodeAt(_local3) >>> 8) & 0xFF), (_arg1.charCodeAt(_local3) & 0xFF)));
_local3++;
};
return (_local2);
}
public static function rstr2any(_arg1:String, _arg2:String):String{
var _local3:Number;
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Array;
var _local9:Array;
var _local10:String;
_local3 = _arg2.length;
_local4 = [];
_local9 = Array((_arg1.length / 2));
_local5 = 0;
while (_local5 < _local9.length) {
_local9[_local5] = ((_arg1.charCodeAt((_local5 * 2)) << 8) | _arg1.charCodeAt(((_local5 * 2) + 1)));
_local5++;
};
while (_local9.length > 0) {
_local8 = [];
_local7 = 0;
_local5 = 0;
while (_local5 < _local9.length) {
_local7 = ((_local7 << 16) + _local9[_local5]);
_local6 = Math.floor((_local7 / _local3));
_local7 = (_local7 - (_local6 * _local3));
if ((((_local8.length > 0)) || ((_local6 > 0)))){
_local8[_local8.length] = _local6;
};
_local5++;
};
_local4[_local4.length] = _local7;
_local9 = _local8;
};
_local10 = "";
_local5 = (_local4.length - 1);
while (_local5 >= 0) {
_local10 = (_local10 + _arg2.charAt(_local4[_local5]));
_local5--;
};
return (_local10);
}
public static function rstr_md5(_arg1:String):String{
return (binl2rstr(binl_md5(rstr2binl(_arg1), (_arg1.length * 8))));
}
}
}//package com.midasplayer
Section 189
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class AdLoader {
private static var cpmstarLoader:Loader;
public static function LoadAd(_arg1:int, _arg2:int):DisplayObject{
var _local3:String;
Security.allowDomain("server.cpmstar.com");
_local3 = "http://server.cpmstar.com/adviewas3.swf";
cpmstarLoader = new Loader();
cpmstarLoader.load(new URLRequest(((((_local3 + "?poolid=") + _arg1) + "&subpoolid=") + _arg2)));
return (cpmstarLoader);
}
}
}//package CPMStar
Section 190
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.events.*;
import flash.display.*;
import fl.core.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 191
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 192
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 193
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.events.*;
import flash.display.*;
import fl.core.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 194
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 195
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 196
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.events.*;
import flash.display.*;
import fl.managers.*;
import flash.utils.*;
import fl.events.*;
import flash.text.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 197
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 198
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import flash.events.*;
import flash.display.*;
import fl.controls.*;
import fl.core.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 199
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import flash.display.*;
import fl.controls.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 200
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 201
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 202
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 203
//None (fl.transitions.easing.None)
package fl.transitions.easing {
public class None {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package fl.transitions.easing
Section 204
//Regular (fl.transitions.easing.Regular)
package fl.transitions.easing {
public class Regular {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
}
}//package fl.transitions.easing
Section 205
//Tween (fl.transitions.Tween)
package fl.transitions {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Tween extends EventDispatcher {
private var _position:Number;// = NAN
public var prevTime:Number;// = NAN
public var prevPos:Number;// = NAN
public var isPlaying:Boolean;// = false
public var begin:Number;// = NAN
private var _fps:Number;// = NAN
private var _time:Number;// = NAN
public var change:Number;// = NAN
private var _finish:Number;// = NAN
public var looping:Boolean;// = false
private var _intervalID:uint;// = 0
public var func:Function;
private var _timer:Timer;// = null
private var _startTime:Number;// = NAN
public var prop:String;// = ""
private var _duration:Number;// = NAN
public var obj:Object;// = null
public var useSeconds:Boolean;// = false
protected static var _mc:MovieClip = new MovieClip();
public function Tween(_arg1:Object, _arg2:String, _arg3:Function, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean=false){
isPlaying = false;
obj = null;
prop = "";
func = function (_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
};
begin = NaN;
change = NaN;
useSeconds = false;
prevTime = NaN;
prevPos = NaN;
looping = false;
_duration = NaN;
_time = NaN;
_fps = NaN;
_position = NaN;
_startTime = NaN;
_intervalID = 0;
_finish = NaN;
_timer = null;
super();
if (!arguments.length){
return;
};
this.obj = _arg1;
this.prop = _arg2;
this.begin = _arg4;
this.position = _arg4;
this.duration = _arg6;
this.useSeconds = _arg7;
if ((_arg3 is Function)){
this.func = _arg3;
};
this.finish = _arg5;
this._timer = new Timer(100);
this.start();
}
public function continueTo(_arg1:Number, _arg2:Number):void{
this.begin = this.position;
this.finish = _arg1;
if (!isNaN(_arg2)){
this.duration = _arg2;
};
this.start();
}
public function stop():void{
this.stopEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_STOP, this._time, this._position));
}
private function fixTime():void{
if (this.useSeconds){
this._startTime = (getTimer() - (this._time * 1000));
};
}
public function set FPS(_arg1:Number):void{
var _local2:Boolean;
_local2 = this.isPlaying;
this.stopEnterFrame();
this._fps = _arg1;
if (_local2){
this.startEnterFrame();
};
}
public function get finish():Number{
return ((this.begin + this.change));
}
public function get duration():Number{
return (this._duration);
}
protected function startEnterFrame():void{
var _local1:Number;
if (isNaN(this._fps)){
_mc.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, false, 0, true);
} else {
_local1 = (1000 / this._fps);
this._timer.delay = _local1;
this._timer.addEventListener(TimerEvent.TIMER, this.timerHandler, false, 0, true);
this._timer.start();
};
this.isPlaying = true;
}
public function set time(_arg1:Number):void{
this.prevTime = this._time;
if (_arg1 > this.duration){
if (this.looping){
this.rewind((_arg1 - this._duration));
this.update();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_LOOP, this._time, this._position));
} else {
if (this.useSeconds){
this._time = this._duration;
this.update();
};
this.stop();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_FINISH, this._time, this._position));
};
} else {
if (_arg1 < 0){
this.rewind();
this.update();
} else {
this._time = _arg1;
this.update();
};
};
}
protected function stopEnterFrame():void{
if (isNaN(this._fps)){
_mc.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
} else {
this._timer.stop();
};
this.isPlaying = false;
}
public function getPosition(_arg1:Number=NaN):Number{
if (isNaN(_arg1)){
_arg1 = this._time;
};
return (this.func(_arg1, this.begin, this.change, this._duration));
}
public function set finish(_arg1:Number):void{
this.change = (_arg1 - this.begin);
}
public function set duration(_arg1:Number):void{
this._duration = ((_arg1)<=0) ? Infinity : _arg1;
}
public function setPosition(_arg1:Number):void{
this.prevPos = this._position;
if (this.prop.length){
this.obj[this.prop] = (this._position = _arg1);
};
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_CHANGE, this._time, this._position));
}
public function resume():void{
this.fixTime();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_RESUME, this._time, this._position));
}
public function fforward():void{
this.time = this._duration;
this.fixTime();
}
protected function onEnterFrame(_arg1:Event):void{
this.nextFrame();
}
public function get position():Number{
return (this.getPosition(this._time));
}
public function yoyo():void{
this.continueTo(this.begin, this.time);
}
public function nextFrame():void{
if (this.useSeconds){
this.time = ((getTimer() - this._startTime) / 1000);
} else {
this.time = (this._time + 1);
};
}
protected function timerHandler(_arg1:TimerEvent):void{
this.nextFrame();
_arg1.updateAfterEvent();
}
public function get FPS():Number{
return (this._fps);
}
public function rewind(_arg1:Number=0):void{
this._time = _arg1;
this.fixTime();
this.update();
}
public function set position(_arg1:Number):void{
this.setPosition(_arg1);
}
public function get time():Number{
return (this._time);
}
private function update():void{
this.setPosition(this.getPosition(this._time));
}
public function start():void{
this.rewind();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_START, this._time, this._position));
}
public function prevFrame():void{
if (!this.useSeconds){
this.time = (this._time - 1);
};
}
}
}//package fl.transitions
Section 206
//TweenEvent (fl.transitions.TweenEvent)
package fl.transitions {
import flash.events.*;
public class TweenEvent extends Event {
public var time:Number;// = NAN
public var position:Number;// = NAN
public static const MOTION_START:String = "motionStart";
public static const MOTION_STOP:String = "motionStop";
public static const MOTION_LOOP:String = "motionLoop";
public static const MOTION_CHANGE:String = "motionChange";
public static const MOTION_FINISH:String = "motionFinish";
public static const MOTION_RESUME:String = "motionResume";
public function TweenEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false){
time = NaN;
position = NaN;
super(_arg1, _arg4, _arg5);
this.time = _arg2;
this.position = _arg3;
}
override public function clone():Event{
return (new TweenEvent(this.type, this.time, this.position, this.bubbles, this.cancelable));
}
}
}//package fl.transitions
Section 207
//Blade_anim_165 (pMotion_fla.Blade_anim_165)
package pMotion_fla {
import flash.display.*;
public dynamic class Blade_anim_165 extends MovieClip {
public var init:int;
public var f:Number;
public var Blade:MovieClip;
public function Blade_anim_165(){
addFrameScript(0, frame1, 249, frame250);
}
function frame1(){
init = 0;
f = Math.round((Math.random() * 199));
this.gotoAndPlay(f);
}
function frame250(){
this.gotoAndPlay(2);
}
}
}//package pMotion_fla
Section 208
//bumper_icon_279 (pMotion_fla.bumper_icon_279)
package pMotion_fla {
import flash.display.*;
public dynamic class bumper_icon_279 extends MovieClip {
public var Arrow:MovieClip;
}
}//package pMotion_fla
Section 209
//jumpLH_icon_278 (pMotion_fla.jumpLH_icon_278)
package pMotion_fla {
import flash.display.*;
public dynamic class jumpLH_icon_278 extends MovieClip {
public var Arrow:MovieClip;
}
}//package pMotion_fla
Section 210
//jumpRH_icon_277 (pMotion_fla.jumpRH_icon_277)
package pMotion_fla {
import flash.display.*;
public dynamic class jumpRH_icon_277 extends MovieClip {
public var Arrow:MovieClip;
}
}//package pMotion_fla
Section 211
//mcBannedSign_6 (pMotion_fla.mcBannedSign_6)
package pMotion_fla {
import flash.events.*;
import flash.display.*;
import com.midasplayer.*;
public dynamic class mcBannedSign_6 extends MovieClip {
public var bg:MovieClip;
public var king_banned_btn:SimpleButton;
public var Iceberg:MovieClip;
public function mcBannedSign_6(){
addFrameScript(0, frame1);
}
function frame1(){
king_banned_btn.addEventListener(MouseEvent.CLICK, offline_link_handler);
}
public function offline_link_handler(_arg1:MouseEvent){
KingAPI.openOfflineProtectionLink();
}
}
}//package pMotion_fla
Section 212
//mcFireLogo_5 (pMotion_fla.mcFireLogo_5)
package pMotion_fla {
import flash.display.*;
public dynamic class mcFireLogo_5 extends MovieClip {
public function mcFireLogo_5(){
addFrameScript(72, frame73);
}
function frame73(){
stop();
}
}
}//package pMotion_fla
Section 213
//mcLoadLogo_1 (pMotion_fla.mcLoadLogo_1)
package pMotion_fla {
import flash.display.*;
public dynamic class mcLoadLogo_1 extends MovieClip {
public var bar:MovieClip;
}
}//package pMotion_fla
Section 214
//mcPlayBtn_15 (pMotion_fla.mcPlayBtn_15)
package pMotion_fla {
import flash.display.*;
public dynamic class mcPlayBtn_15 extends MovieClip {
public function mcPlayBtn_15(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package pMotion_fla
Section 215
//Menu_bg_185 (pMotion_fla.Menu_bg_185)
package pMotion_fla {
import flash.display.*;
public dynamic class Menu_bg_185 extends MovieClip {
public var crossover:MovieClip;
public var wod:MovieClip;
}
}//package pMotion_fla
Section 216
//shootLH_icon_275 (pMotion_fla.shootLH_icon_275)
package pMotion_fla {
import flash.display.*;
public dynamic class shootLH_icon_275 extends MovieClip {
public var Arrow:MovieClip;
}
}//package pMotion_fla
Section 217
//shootRH_icon_280 (pMotion_fla.shootRH_icon_280)
package pMotion_fla {
import flash.display.*;
public dynamic class shootRH_icon_280 extends MovieClip {
public var Arrow:MovieClip;
}
}//package pMotion_fla
Section 218
//Turbine_163 (pMotion_fla.Turbine_163)
package pMotion_fla {
import flash.display.*;
public dynamic class Turbine_163 extends MovieClip {
public var Mast:MovieClip;
}
}//package pMotion_fla
Section 219
//BackOff (BackOff)
package {
import flash.display.*;
public dynamic class BackOff extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 220
//BackOver (BackOver)
package {
import flash.display.*;
public dynamic class BackOver extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 221
//BackUp (BackUp)
package {
import flash.display.*;
public dynamic class BackUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 222
//Button_disabledSkin (Button_disabledSkin)
package {
import flash.display.*;
public dynamic class Button_disabledSkin extends MovieClip {
}
}//package
Section 223
//Button_downSkin (Button_downSkin)
package {
import flash.display.*;
public dynamic class Button_downSkin extends MovieClip {
}
}//package
Section 224
//Button_emphasizedSkin (Button_emphasizedSkin)
package {
import flash.display.*;
public dynamic class Button_emphasizedSkin extends MovieClip {
}
}//package
Section 225
//Button_overSkin (Button_overSkin)
package {
import flash.display.*;
public dynamic class Button_overSkin extends MovieClip {
}
}//package
Section 226
//Button_selectedDisabledSkin (Button_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDisabledSkin extends MovieClip {
}
}//package
Section 227
//Button_selectedDownSkin (Button_selectedDownSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDownSkin extends MovieClip {
}
}//package
Section 228
//Button_selectedOverSkin (Button_selectedOverSkin)
package {
import flash.display.*;
public dynamic class Button_selectedOverSkin extends MovieClip {
}
}//package
Section 229
//Button_selectedUpSkin (Button_selectedUpSkin)
package {
import flash.display.*;
public dynamic class Button_selectedUpSkin extends MovieClip {
}
}//package
Section 230
//Button_upSkin (Button_upSkin)
package {
import flash.display.*;
public dynamic class Button_upSkin extends MovieClip {
}
}//package
Section 231
//CloseAdBtn (CloseAdBtn)
package {
import flash.display.*;
public dynamic class CloseAdBtn extends SimpleButton {
}
}//package
Section 232
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 233
//FXBumper (FXBumper)
package {
import flash.media.*;
public dynamic class FXBumper extends Sound {
}
}//package
Section 234
//GeekGlueBtn (GeekGlueBtn)
package {
import flash.display.*;
public dynamic class GeekGlueBtn extends SimpleButton {
}
}//package
Section 235
//libGlow (libGlow)
package {
import flash.display.*;
public dynamic class libGlow extends MovieClip {
}
}//package
Section 236
//MapHelpOver (MapHelpOver)
package {
import flash.display.*;
public dynamic class MapHelpOver extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 237
//MapHelpUp (MapHelpUp)
package {
import flash.display.*;
public dynamic class MapHelpUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 238
//mcGlimmer (mcGlimmer)
package {
import flash.display.*;
public dynamic class mcGlimmer extends MovieClip {
}
}//package
Section 239
//MenuAddSiteOver (MenuAddSiteOver)
package {
import flash.display.*;
public dynamic class MenuAddSiteOver extends MovieClip {
public var BtnOverBg:MovieClip;
}
}//package
Section 240
//MenuAddSiteUp (MenuAddSiteUp)
package {
import flash.display.*;
public dynamic class MenuAddSiteUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 241
//MenuHelpOver (MenuHelpOver)
package {
import flash.display.*;
public dynamic class MenuHelpOver extends MovieClip {
public var BtnOverBg:MovieClip;
}
}//package
Section 242
//MenuHelpUp (MenuHelpUp)
package {
import flash.display.*;
public dynamic class MenuHelpUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 243
//MenuHighScoresOver (MenuHighScoresOver)
package {
import flash.display.*;
public dynamic class MenuHighScoresOver extends MovieClip {
public var BtnOverBg:MovieClip;
}
}//package
Section 244
//MenuHighScoresUp (MenuHighScoresUp)
package {
import flash.display.*;
public dynamic class MenuHighScoresUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 245
//MenuLoadOff (MenuLoadOff)
package {
import flash.display.*;
public dynamic class MenuLoadOff extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 246
//MenuLoadOver (MenuLoadOver)
package {
import flash.display.*;
public dynamic class MenuLoadOver extends MovieClip {
public var BtnOverBg:MovieClip;
}
}//package
Section 247
//MenuLoadUp (MenuLoadUp)
package {
import flash.display.*;
public dynamic class MenuLoadUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 248
//MenuMoreGamesOver (MenuMoreGamesOver)
package {
import flash.display.*;
public dynamic class MenuMoreGamesOver extends MovieClip {
public var BtnOverBg:MovieClip;
}
}//package
Section 249
//MenuMoreGamesUp (MenuMoreGamesUp)
package {
import flash.display.*;
public dynamic class MenuMoreGamesUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 250
//MenuNewOver (MenuNewOver)
package {
import flash.display.*;
public dynamic class MenuNewOver extends MovieClip {
public var BtnOverBg:MovieClip;
}
}//package
Section 251
//MenuNewUp (MenuNewUp)
package {
import flash.display.*;
public dynamic class MenuNewUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 252
//MenuOff (MenuOff)
package {
import flash.display.*;
public dynamic class MenuOff extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 253
//MenuOver (MenuOver)
package {
import flash.display.*;
public dynamic class MenuOver extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 254
//MenuSubmitScoresOver (MenuSubmitScoresOver)
package {
import flash.display.*;
public dynamic class MenuSubmitScoresOver extends MovieClip {
public var BtnOverBg:MovieClip;
}
}//package
Section 255
//MenuSubmitScoresUp (MenuSubmitScoresUp)
package {
import flash.display.*;
public dynamic class MenuSubmitScoresUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 256
//MenuUp (MenuUp)
package {
import flash.display.*;
public dynamic class MenuUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 257
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("core.mochibot.com");
Security.allowInsecureDomain("core.mochibot.com");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 258
//NextOff (NextOff)
package {
import flash.display.*;
public dynamic class NextOff extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 259
//NextOver (NextOver)
package {
import flash.display.*;
public dynamic class NextOver extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 260
//NextUp (NextUp)
package {
import flash.display.*;
public dynamic class NextUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 261
//OkOff (OkOff)
package {
import flash.display.*;
public dynamic class OkOff extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 262
//OkOver (OkOver)
package {
import flash.display.*;
public dynamic class OkOver extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 263
//OkUp (OkUp)
package {
import flash.display.*;
public dynamic class OkUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 264
//pMotionBase (pMotionBase)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import com.geekglue.pMotion.Model.*;
import com.geekglue.pMotion.Assets.*;
import flash.utils.*;
import com.midasplayer.*;
import CPMStar.*;
import com.midasplayer.particle.*;
import com.geekglue.pMotion.View.*;
import mochi.*;
public class pMotionBase extends MovieClip {
public var bar:Sprite;
public var mcLoadLogoBg:MovieClip;
public var ad:Loader;
public var ad_timer:Timer;
private var model:ModelLocator;
public var bg:Sprite;
public var Parkes_dish:MovieClip;
public var close_ad_btn:CloseAdBtn;
public var loader_info:LoaderInfo;
private var leaderboard:LeaderBoard;
public var adBox:MovieClip;
public var holder:Sprite;
public var particles:Main;
public var CPMStarSubPoolID:int;
public var CPMStarPoolID:int;
public var mcKingLoader:DragonLoader;
public var game_name:String;
public var mochi_id:String;
private var game:pMotionGame;
public function pMotionBase(){
model = ModelLocator.getInstance();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
super();
stop();
this.addEventListener(Event.ENTER_FRAME, load_handler);
}
public function preload(_arg1:Event):void{
bg = new Sprite();
bg.buttonMode = true;
bg.name = "clickBg";
bg.graphics.beginFill(0, 0);
bg.graphics.lineTo(stage.stageWidth, 0);
bg.graphics.lineTo(stage.stageWidth, stage.stageHeight);
bg.graphics.lineTo(0, stage.stageHeight);
bg.graphics.lineTo(0, 0);
bg.graphics.endFill();
bg.addEventListener(MouseEvent.CLICK, openKingPage);
this.addChildAt(bg, this.getChildIndex(mcLoadLogoBg));
mcLoadLogoBg.x = ((stage.stageWidth / 2) - (mcLoadLogoBg.width / 2));
mcLoadLogoBg.y = ((stage.stageHeight / 2) - (mcLoadLogoBg.height / 2));
bar = new Sprite();
bar.graphics.beginFill(0xFFFFFF, 0);
bar.x = (mcLoadLogoBg.x + 5);
bar.y = (mcLoadLogoBg.y + 34);
bar.graphics.drawRect(0, 0, 96, 5);
bar.graphics.endFill();
this.addChild(bar);
holder = new Sprite();
this.addChild(holder);
holder.x = bar.x;
holder.y = bar.y;
particles = new Main();
particles.setEmitterClip(holder);
this.addChild(particles);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function init():void{
var _local1:Skin;
this.stage.frameRate = 60;
_local1 = new Skin();
this.addChild(_local1);
game = new pMotionGame();
this.addChild(game);
}
private function site_lock_test(_arg1:String):Boolean{
var _local2:Boolean;
var _local3:Number;
var _local4:Number;
var _local5:String;
_local2 = true;
_local3 = (_arg1.indexOf("://") + 3);
_local4 = _arg1.indexOf("/", _local3);
_local5 = _arg1.substring(_local3, _local4);
model.msg = ("domain : " + _local5);
if (((((((!((_local5.indexOf("flashgamelicense.com") == -1))) || (!((_local5.indexOf("mochiads.com") == -1))))) || (!((_local5.indexOf("192.168.30.2") == -1))))) || (!((_arg1.indexOf("pMotion.swf") == -1))))){
_local2 = true;
};
model.msg = ("site_lock_test : " + _local2);
return (_local2);
}
public function openKingPage(_arg1:Event):void{
KingAPI.openLoaderProgressLink();
}
public function launchGame(_arg1):void{
mcKingLoader.destroy();
if (KingAPI.isHome){
gotoAndStop(model.game_frame);
} else {
gotoAndStop(model.ad_frame);
};
}
function frame3(){
ad_timer = new Timer(5000, 1);
ad_timer.addEventListener(TimerEvent.TIMER, timer_end);
CPMStarPoolID = 3000;
CPMStarSubPoolID = 2;
close_ad_btn.addEventListener(MouseEvent.CLICK, close_ad_handler);
close_ad_btn.visible = false;
ad = (AdLoader.LoadAd(CPMStarPoolID, CPMStarSubPoolID) as Loader);
loader_info = ad.contentLoaderInfo;
loader_info.addEventListener(Event.COMPLETE, loader_complete_handler);
loader_info.addEventListener("ioError", loader_error_handler);
adBox.addChild(ad);
}
function frame1(){
stop();
game_name = "perpetual-motion";
mochi_id = "24773252";
stage.scaleMode = StageScaleMode.NO_SCALE;
if (!model.test_state){
KingAPI.addEventListener(KingAPI.INITIALIZED_EVENT, preload);
KingAPI.addEventListener(KingAPI.HOST_BANNED_EVENT, preload);
KingAPI.init(game_name, root.loaderInfo.url);
};
}
function frame2(){
mcKingLoader.addEventListener(DragonLoader.LAUNCH_GAME, launchGame);
mcKingLoader.init(game_name, mochi_id);
}
public function onEnterFrame(_arg1:Event):void{
holder.x = (bar.x + bar.width);
if (framesLoaded == totalFrames){
particles.kill();
this.removeChild(particles);
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
bg.removeEventListener(MouseEvent.CLICK, openKingPage);
this.removeChild(bar);
if (!KingAPI.isHome){
gotoAndStop(model.sponsor_frame);
} else {
gotoAndStop(model.game_frame);
};
} else {
bar.scaleX = (stage.loaderInfo.bytesLoaded / stage.loaderInfo.bytesTotal);
mcLoadLogoBg.bar.scaleX = (1 - (stage.loaderInfo.bytesLoaded / stage.loaderInfo.bytesTotal));
};
}
public function close_ad_handler(_arg1:MouseEvent){
var event = _arg1;
try {
if (adBox.ad){
adBox.removeChild(ad);
};
} catch(error:Error) {
};
this.gotoAndStop(model.game_frame);
}
public function timer_end(_arg1:TimerEvent):void{
close_ad_btn.visible = true;
ad_timer.stop();
}
public function loader_error_handler(_arg1:IOErrorEvent):void{
this.gotoAndStop(model.game_frame);
}
private function load_handler(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
_local2 = this.loaderInfo.bytesTotal;
_local3 = this.loaderInfo.bytesLoaded;
if (((model.test_state) && ((this.currentFrame < model.game_frame)))){
if (_local3 >= _local2){
this.gotoAndStop(model.game_frame);
};
};
if (this.currentFrame == model.game_frame){
stop();
SoundMixer.stopAll();
this.removeEventListener(Event.ENTER_FRAME, load_handler);
init();
};
}
public function loader_complete_handler(_arg1:Event):void{
ad_timer.start();
}
}
}//package
Section 265
//RetryOver (RetryOver)
package {
import flash.display.*;
public dynamic class RetryOver extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 266
//RetryUp (RetryUp)
package {
import flash.display.*;
public dynamic class RetryUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 267
//sfxBell (sfxBell)
package {
import flash.media.*;
public dynamic class sfxBell extends Sound {
}
}//package
Section 268
//ShopOff (ShopOff)
package {
import flash.display.*;
public dynamic class ShopOff extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 269
//ShopOver (ShopOver)
package {
import flash.display.*;
public dynamic class ShopOver extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 270
//ShopUp (ShopUp)
package {
import flash.display.*;
public dynamic class ShopUp extends MovieClip {
public var BtnUpBg:MovieClip;
}
}//package
Section 271
//spark (spark)
package {
import flash.display.*;
public dynamic class spark extends MovieClip {
public function spark(){
addFrameScript(22, frame23);
}
function frame23(){
gotoAndStop("loop");
}
}
}//package
Section 272
//Wind (Wind)
package {
import flash.media.*;
public dynamic class Wind extends Sound {
}
}//package