Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2CircleDef extends b2ShapeDef {
public var radius:Number;
public var localPosition:b2Vec2;
public function b2CircleDef(){
localPosition = new b2Vec2(0, 0);
super();
type = b2Shape.e_circleShape;
radius = 1;
}
}
}//package Box2D.Collision.Shapes
Section 2
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
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){
m_localPosition = new b2Vec2();
super(_arg1);
var _local2:b2CircleDef = (_arg1 as b2CircleDef);
m_type = e_circleShape;
m_localPosition.SetV(_local2.localPosition);
m_radius = _local2.radius;
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local10:Number;
var _local6:b2Mat22 = _arg1.R;
var _local7:Number = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y)));
var _local8:Number = (_arg1.position.y + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y)));
var _local9:Number = (_arg4.p1.x - _local7);
_local10 = (_arg4.p1.y - _local8);
var _local11:Number = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius));
if (_local11 < 0){
return (false);
};
var _local12:Number = (_arg4.p2.x - _arg4.p1.x);
var _local13:Number = (_arg4.p2.y - _arg4.p1.y);
var _local14:Number = ((_local9 * _local12) + (_local10 * _local13));
var _local15:Number = ((_local12 * _local12) + (_local13 * _local13));
var _local16:Number = ((_local14 * _local14) - (_local15 * _local11));
if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){
return (false);
};
var _local17:Number = -((_local14 + Math.sqrt(_local16)));
if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){
_local17 = (_local17 / _local15);
_arg2[0] = _local17;
_arg3.x = (_local9 + (_local17 * _local12));
_arg3.y = (_local10 + (_local17 * _local13));
_arg3.Normalize();
return (true);
};
return (false);
}
public function GetLocalPosition():b2Vec2{
return (m_localPosition);
}
public function GetRadius():Number{
return (m_radius);
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2Mat22;
_local4 = _arg2.R;
var _local5:Number = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
var _local6:Number = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_local4 = _arg3.R;
var _local7:Number = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
var _local8:Number = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius));
_arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius));
}
override public function ComputeMass(_arg1:b2MassData):void{
_arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius);
_arg1.center.SetV(m_localPosition);
_arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y))));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:Number = (m_localPosition.x - _arg1.x);
var _local3:Number = (m_localPosition.y - _arg1.y);
_local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22 = _arg2.R;
var _local4:Number = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
var _local5:Number = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius));
_arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius));
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Mat22 = _arg1.R;
var _local4:Number = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
var _local5:Number = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_local4 = (_arg2.x - _local4);
_local5 = (_arg2.y - _local5);
return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius)));
}
}
}//package Box2D.Collision.Shapes
Section 3
//b2FilterData (Box2D.Collision.Shapes.b2FilterData)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2FilterData {
public var maskBits:uint;// = 0xFFFF
public var groupIndex:int;// = 0
public var categoryBits:uint;// = 1
public function Copy():b2FilterData{
var _local1:b2FilterData = new b2FilterData();
_local1.categoryBits = categoryBits;
_local1.maskBits = maskBits;
_local1.groupIndex = groupIndex;
return (_local1);
}
}
}//package Box2D.Collision.Shapes
Section 4
//b2MassData (Box2D.Collision.Shapes.b2MassData)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2MassData {
public var mass:Number;// = 0
public var center:b2Vec2;
public var I:Number;// = 0
public function b2MassData(){
center = new b2Vec2(0, 0);
super();
}
}
}//package Box2D.Collision.Shapes
Section 5
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PolygonDef extends b2ShapeDef {
public var vertices:Array;
public var vertexCount:int;
private static var s_mat:b2Mat22 = new b2Mat22();
public function b2PolygonDef(){
vertices = new Array(b2Settings.b2_maxPolygonVertices);
super();
type = b2Shape.e_polygonShape;
vertexCount = 0;
var _local1:int;
while (_local1 < b2Settings.b2_maxPolygonVertices) {
vertices[_local1] = new b2Vec2();
_local1++;
};
}
public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{
var _local5:b2Vec2;
var _local6:b2Mat22;
var _local7:int;
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
if (_arg3){
_local5 = _arg3;
_local6 = s_mat;
_local6.Set(_arg4);
_local7 = 0;
while (_local7 < vertexCount) {
_arg3 = vertices[_local7];
_arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y)));
_arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y)));
_arg3.x = _arg1;
_local7++;
};
};
}
public function SetAsBox(_arg1:Number, _arg2:Number):void{
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
}
}
}//package Box2D.Collision.Shapes
Section 6
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class b2PolygonShape extends b2Shape {
public var m_coreVertices:Array;
public var m_vertices:Array;
private var s_supportVec:b2Vec2;
public var m_centroid:b2Vec2;
public var m_normals:Array;
public var m_obb:b2OBB;
public var m_vertexCount:int;
private static var s_computeMat:b2Mat22 = new b2Mat22();
private static var s_sweptAABB1:b2AABB = new b2AABB();
private static var s_sweptAABB2:b2AABB = new b2AABB();
public function b2PolygonShape(_arg1:b2ShapeDef){
var _local3:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
s_supportVec = new b2Vec2();
m_obb = new b2OBB();
m_vertices = new Array(b2Settings.b2_maxPolygonVertices);
m_normals = new Array(b2Settings.b2_maxPolygonVertices);
m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices);
super(_arg1);
m_type = e_polygonShape;
var _local2:b2PolygonDef = (_arg1 as b2PolygonDef);
m_vertexCount = _local2.vertexCount;
var _local4:int = _local3;
var _local5:int = _local3;
_local3 = 0;
while (_local3 < m_vertexCount) {
m_vertices[_local3] = _local2.vertices[_local3].Copy();
_local3++;
};
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = _local3;
_local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0;
_local6 = (m_vertices[_local5].x - m_vertices[_local4].x);
_local7 = (m_vertices[_local5].y - m_vertices[_local4].y);
_local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8));
_local3++;
};
m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount);
ComputeOBB(m_obb, m_vertices, m_vertexCount);
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1);
_local5 = _local3;
_local9 = m_normals[_local4].x;
_local10 = m_normals[_local4].y;
_local11 = m_normals[_local5].x;
_local12 = m_normals[_local5].y;
_local13 = (m_vertices[_local3].x - m_centroid.x);
_local14 = (m_vertices[_local3].y - m_centroid.y);
_local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop);
_local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop);
_local17 = (1 / ((_local9 * _local12) - (_local10 * _local11)));
m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y));
_local3++;
};
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2AABB = s_sweptAABB1;
var _local5:b2AABB = s_sweptAABB2;
ComputeAABB(_local4, _arg2);
ComputeAABB(_local5, _arg3);
_arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y);
_arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y);
}
public function GetVertices():Array{
return (m_vertices);
}
public function GetCoreVertices():Array{
return (m_coreVertices);
}
public function GetCentroid():b2Vec2{
return (m_centroid);
}
public function GetOBB():b2OBB{
return (m_obb);
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_coreVertices[0]));
}
public function Centroid(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_centroid));
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local20:Number;
var _local21:Number;
var _local6:Number = 0;
var _local7:Number = _arg5;
_local8 = (_arg4.p1.x - _arg1.position.x);
_local9 = (_arg4.p1.y - _arg1.position.y);
_local10 = _arg1.R;
var _local12:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
var _local13:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local8 = (_arg4.p2.x - _arg1.position.x);
_local9 = (_arg4.p2.y - _arg1.position.y);
_local10 = _arg1.R;
var _local14:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
var _local15:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
var _local16:Number = (_local14 - _local12);
var _local17:Number = (_local15 - _local13);
var _local18:int = -1;
var _local19:int;
while (_local19 < m_vertexCount) {
_local11 = m_vertices[_local19];
_local8 = (_local11.x - _local12);
_local9 = (_local11.y - _local13);
_local11 = m_normals[_local19];
_local20 = ((_local11.x * _local8) + (_local11.y * _local9));
_local21 = ((_local11.x * _local16) + (_local11.y * _local17));
if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){
_local6 = (_local20 / _local21);
_local18 = _local19;
} else {
if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){
_local7 = (_local20 / _local21);
};
};
if (_local7 < _local6){
return (false);
};
_local19++;
};
if (_local18 >= 0){
_arg2[0] = _local6;
_local10 = _arg1.R;
_local11 = m_normals[_local18];
_arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
return (true);
};
return (false);
}
override public function ComputeMass(_arg1:b2MassData):void{
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
var _local7:Number = 0;
var _local8:Number = (1 / 3);
var _local9:int;
while (_local9 < m_vertexCount) {
_local10 = m_vertices[_local9];
_local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0];
_local12 = (_local10.x - _local6);
_local13 = (_local10.y - _local7);
_local14 = (_local11.x - _local6);
_local15 = (_local11.y - _local7);
_local16 = ((_local12 * _local15) - (_local13 * _local14));
_local17 = (0.5 * _local16);
_local4 = (_local4 + _local17);
_local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x)));
_local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y)));
_local18 = _local6;
_local19 = _local7;
_local20 = _local12;
_local21 = _local13;
_local22 = _local14;
_local23 = _local15;
_local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18));
_local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19));
_local5 = (_local5 + (_local16 * (_local24 + _local25)));
_local9++;
};
_arg1.mass = (m_density * _local4);
_local2 = (_local2 * (1 / _local4));
_local3 = (_local3 * (1 / _local4));
_arg1.center.Set(_local2, _local3);
_arg1.I = (m_density * _local5);
}
public function GetNormals():Array{
return (m_normals);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local11:Number;
_local5 = _arg1.R;
var _local6:Number = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y));
var _local7:Number = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y));
var _local8:int;
_local4 = m_coreVertices[0];
var _local9:Number = ((_local4.x * _local6) + (_local4.y * _local7));
var _local10:int = 1;
while (_local10 < m_vertexCount) {
_local4 = m_coreVertices[_local10];
_local11 = ((_local4.x * _local6) + (_local4.y * _local7));
if (_local11 > _local9){
_local8 = _local10;
_local9 = _local11;
};
_local10++;
};
_local5 = _arg1.R;
_local4 = m_coreVertices[_local8];
s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y)));
s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y)));
return (s_supportVec);
}
public function GetVertexCount():int{
return (m_vertexCount);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Mat22 = s_computeMat;
_local3 = _arg2.R;
_local4 = m_obb.R.col1;
_local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local4 = m_obb.R.col2;
_local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local5.Abs();
var _local6:b2Mat22 = _local5;
_local4 = m_obb.extents;
var _local7:Number = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y));
var _local8:Number = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y));
_local3 = _arg2.R;
_local4 = m_obb.center;
var _local9:Number = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)));
var _local10:Number = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)));
_arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8));
_arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:b2Vec2;
var _local4:Number;
var _local5:Number;
m_sweepRadius = 0;
var _local3:int;
while (_local3 < m_vertexCount) {
_local2 = m_coreVertices[_local3];
_local4 = (_local2.x - _arg1.x);
_local5 = (_local2.y - _arg1.y);
_local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
if (_local4 > m_sweepRadius){
m_sweepRadius = _local4;
};
_local3++;
};
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Vec2;
var _local10:Number;
var _local4:b2Mat22 = _arg1.R;
var _local5:Number = (_arg2.x - _arg1.position.x);
var _local6:Number = (_arg2.y - _arg1.position.y);
var _local7:Number = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y));
var _local8:Number = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y));
var _local9:int;
while (_local9 < m_vertexCount) {
_local3 = m_vertices[_local9];
_local5 = (_local7 - _local3.x);
_local6 = (_local8 - _local3.y);
_local3 = m_normals[_local9];
_local10 = ((_local3.x * _local5) + (_local3.y * _local6));
if (_local10 > 0){
return (false);
};
_local9++;
};
return (true);
}
public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{
var _local3:b2Vec2;
var _local7:Number;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local3 = new b2Vec2();
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
_local7 = (1 / 3);
var _local8:int;
while (_local8 < _arg2) {
_local9 = _arg1[_local8];
_local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0];
_local11 = (_local9.x - _local5);
_local12 = (_local9.y - _local6);
_local13 = (_local10.x - _local5);
_local14 = (_local10.y - _local6);
_local15 = ((_local11 * _local14) - (_local12 * _local13));
_local16 = (0.5 * _local15);
_local4 = (_local4 + _local16);
_local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x)));
_local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y)));
_local8++;
};
_local3.x = (_local3.x * (1 / _local4));
_local3.y = (_local3.y * (1 / _local4));
return (_local3);
}
public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{
var _local4:int;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:b2Mat22;
var _local5:Array = new Array((b2Settings.b2_maxPolygonVertices + 1));
_local4 = 0;
while (_local4 < _arg3) {
_local5[_local4] = _arg2[_local4];
_local4++;
};
_local5[_arg3] = _local5[0];
var _local6:Number = Number.MAX_VALUE;
_local4 = 1;
while (_local4 <= _arg3) {
_local7 = _local5[int((_local4 - 1))];
_local8 = (_local5[_local4].x - _local7.x);
_local9 = (_local5[_local4].y - _local7.y);
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local8 = (_local8 / _local10);
_local9 = (_local9 / _local10);
_local11 = -(_local9);
_local12 = _local8;
_local13 = Number.MAX_VALUE;
_local14 = Number.MAX_VALUE;
_local15 = -(Number.MAX_VALUE);
_local16 = -(Number.MAX_VALUE);
_local17 = 0;
while (_local17 < _arg3) {
_local19 = (_local5[_local17].x - _local7.x);
_local20 = (_local5[_local17].y - _local7.y);
_local21 = ((_local8 * _local19) + (_local9 * _local20));
_local22 = ((_local11 * _local19) + (_local12 * _local20));
if (_local21 < _local13){
_local13 = _local21;
};
if (_local22 < _local14){
_local14 = _local22;
};
if (_local21 > _local15){
_local15 = _local21;
};
if (_local22 > _local16){
_local16 = _local22;
};
_local17++;
};
_local18 = ((_local15 - _local13) * (_local16 - _local14));
if (_local18 < (0.95 * _local6)){
_local6 = _local18;
_arg1.R.col1.x = _local8;
_arg1.R.col1.y = _local9;
_arg1.R.col2.x = _local11;
_arg1.R.col2.y = _local12;
_local23 = (0.5 * (_local13 + _local15));
_local24 = (0.5 * (_local14 + _local16));
_local25 = _arg1.R;
_arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24)));
_arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24)));
_arg1.extents.x = (0.5 * (_local15 - _local13));
_arg1.extents.y = (0.5 * (_local16 - _local14));
};
_local4++;
};
}
}
}//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class b2Shape {
public var m_next:b2Shape;
public var m_type:int;
public var m_sweepRadius:Number;
public var m_density:Number;
public var m_filter:b2FilterData;
public var m_friction:Number;
public var m_isSensor:Boolean;
public var m_restitution:Number;
public var m_userData;
public var m_proxyId:uint;
public var m_body:b2Body;
public static const e_polygonShape:int = 1;
public static const e_unknownShape:int = -1;
public static const e_circleShape:int = 0;
public static const e_shapeTypeCount:int = 2;
private static var s_resetAABB:b2AABB = new b2AABB();
private static var s_syncAABB:b2AABB = new b2AABB();
private static var s_proxyAABB:b2AABB = new b2AABB();
public function b2Shape(_arg1:b2ShapeDef){
m_userData = _arg1.userData;
m_friction = _arg1.friction;
m_restitution = _arg1.restitution;
m_density = _arg1.density;
m_body = null;
m_sweepRadius = 0;
m_next = null;
m_proxyId = b2Pair.b2_nullProxy;
m_filter = _arg1.filter.Copy();
m_isSensor = _arg1.isSensor;
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetSweepRadius():Number{
return (m_sweepRadius);
}
public function GetNext():b2Shape{
return (m_next);
}
public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
}
public function GetType():int{
return (m_type);
}
public function GetRestitution():Number{
return (m_restitution);
}
public function GetFriction():Number{
return (m_friction);
}
public function GetFilterData():b2FilterData{
return (m_filter.Copy());
}
public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
return (false);
}
public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
_arg1.DestroyProxy(m_proxyId);
var _local3:b2AABB = s_resetAABB;
ComputeAABB(_local3, _arg2);
var _local4:Boolean = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetFilterData(_arg1:b2FilterData):void{
m_filter = _arg1.Copy();
}
public function GetUserData(){
return (m_userData);
}
public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{
if (m_proxyId == b2Pair.b2_nullProxy){
return (false);
};
var _local4:b2AABB = s_syncAABB;
ComputeSweptAABB(_local4, _arg2, _arg3);
if (_arg1.InRange(_local4)){
_arg1.MoveProxy(m_proxyId, _local4);
return (true);
};
return (false);
}
public function ComputeMass(_arg1:b2MassData):void{
}
public function IsSensor():Boolean{
return (m_isSensor);
}
public function DestroyProxy(_arg1:b2BroadPhase):void{
if (m_proxyId != b2Pair.b2_nullProxy){
_arg1.DestroyProxy(m_proxyId);
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function UpdateSweepRadius(_arg1:b2Vec2):void{
}
public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
}
public function GetBody():b2Body{
return (m_body);
}
public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB = s_proxyAABB;
ComputeAABB(_local3, _arg2);
var _local4:Boolean = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
return (false);
}
public static function Destroy(_arg1:b2Shape, _arg2):void{
}
public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{
switch (_arg1.type){
case e_circleShape:
return (new b2CircleShape(_arg1));
case e_polygonShape:
return (new b2PolygonShape(_arg1));
default:
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 friction:Number;// = 0.2
public var isSensor:Boolean;// = false
public var density:Number;// = 0
public var restitution:Number;// = 0
public var userData;// = null
public var filter:b2FilterData;
public var type:int;// = -1
public function b2ShapeDef(){
filter = new b2FilterData();
super();
}
}
}//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2AABB {
public var upperBound:b2Vec2;
public var lowerBound:b2Vec2;
public function b2AABB(){
lowerBound = new b2Vec2();
upperBound = new b2Vec2();
super();
}
public function IsValid():Boolean{
var _local1:Number = (upperBound.x - lowerBound.x);
var _local2:Number = (upperBound.y - lowerBound.y);
var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid()));
return (_local3);
}
}
}//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound)
package Box2D.Collision {
public class b2Bound {
public var value:uint;
public var proxyId:uint;
public var stabbingCount:uint;
public function Swap(_arg1:b2Bound):void{
var _local2:uint = value;
var _local3:uint = proxyId;
var _local4:uint = stabbingCount;
value = _arg1.value;
proxyId = _arg1.proxyId;
stabbingCount = _arg1.stabbingCount;
_arg1.value = _local2;
_arg1.proxyId = _local3;
_arg1.stabbingCount = _local4;
}
public function IsLower():Boolean{
return (((value & 1) == 0));
}
public function IsUpper():Boolean{
return (((value & 1) == 1));
}
}
}//package Box2D.Collision
Section 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.*;
import Box2D.Common.Math.*;
public class b2BroadPhase {
public var m_bounds:Array;
public var m_quantizationFactor:b2Vec2;
public var m_worldAABB:b2AABB;
public var m_freeProxy:uint;
public var m_proxyCount:int;
public var m_proxyPool:Array;
public var m_queryResultCount:int;
public var m_pairManager:b2PairManager;
public var m_timeStamp:uint;
public var m_queryResults:Array;
public static const b2_nullEdge:uint = b2Settings.USHRT_MAX;
public static const b2_invalid:uint = b2Settings.USHRT_MAX;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local5:Number;
var _local6:b2Proxy;
var _local7:int;
m_pairManager = new b2PairManager();
m_proxyPool = new Array(b2Settings.b2_maxPairs);
m_bounds = new Array((2 * b2Settings.b2_maxProxies));
m_queryResults = new Array(b2Settings.b2_maxProxies);
m_quantizationFactor = new b2Vec2();
super();
m_pairManager.Initialize(this, _arg2);
m_worldAABB = _arg1;
m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
m_queryResults[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
var _local4:Number = (_arg1.upperBound.x - _arg1.lowerBound.x);
_local5 = (_arg1.upperBound.y - _arg1.lowerBound.y);
m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4);
m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5);
_local3 = 0;
while (_local3 < (b2Settings.b2_maxProxies - 1)) {
_local6 = new b2Proxy();
m_proxyPool[_local3] = _local6;
_local6.SetNext((_local3 + 1));
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
_local3++;
};
_local6 = new b2Proxy();
m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6;
_local6.SetNext(b2Pair.b2_nullProxy);
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
m_freeProxy = 0;
m_timeStamp = 1;
m_queryResultCount = 0;
}
public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{
var _local6:uint;
var _local7:uint;
var _local12:b2Proxy;
var _local4:Array = new Array();
var _local5:Array = new Array();
ComputeBounds(_local4, _local5, _arg1);
var _local8:Array = [_local6];
var _local9:Array = [_local7];
Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0);
Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1);
var _local10:int;
var _local11:int;
while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) {
_local12 = m_proxyPool[m_queryResults[_local11]];
_arg2[_local11] = _local12.userData;
_local11++;
_local10++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local10);
}
public function Commit():void{
m_pairManager.Commit();
}
public function GetProxy(_arg1:int):b2Proxy{
var _local2:b2Proxy = m_proxyPool[_arg1];
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){
return (null);
};
return (_local2);
}
private function IncrementTimeStamp():void{
var _local1:uint;
if (m_timeStamp == b2Settings.USHRT_MAX){
_local1 = 0;
while (_local1 < b2Settings.b2_maxProxies) {
(m_proxyPool[_local1] as b2Proxy).timeStamp = 0;
_local1++;
};
m_timeStamp = 1;
} else {
m_timeStamp++;
};
}
private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{
var _local10:b2Bound;
var _local12:int;
var _local13:int;
var _local14:b2Proxy;
var _local8:uint = BinarySearch(_arg5, _arg6, _arg3);
var _local9:uint = BinarySearch(_arg5, _arg6, _arg4);
var _local11:uint = _local8;
while (_local11 < _local9) {
_local10 = _arg5[_local11];
if (_local10.IsLower()){
IncrementOverlapCount(_local10.proxyId);
};
_local11++;
};
if (_local8 > 0){
_local12 = (_local8 - 1);
_local10 = _arg5[_local12];
_local13 = _local10.stabbingCount;
while (_local13) {
_local10 = _arg5[_local12];
if (_local10.IsLower()){
_local14 = m_proxyPool[_local10.proxyId];
if (_local8 <= _local14.upperBounds[_arg7]){
IncrementOverlapCount(_local10.proxyId);
_local13--;
};
};
_local12--;
};
};
_arg1[0] = _local8;
_arg2[0] = _local9;
}
private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{
var _local4:Array;
var _local5:b2Bound;
var _local6:b2Bound;
var _local3:int;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg1.lowerBounds[_local3]];
_local6 = _local4[_arg2.upperBounds[_local3]];
if (_local5.value > _local6.value){
return (false);
};
_local5 = _local4[_arg1.upperBounds[_local3]];
_local6 = _local4[_arg2.lowerBounds[_local3]];
if (_local5.value < _local6.value){
return (false);
};
_local3++;
};
return (true);
}
private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{
var _local4:Number = _arg3.lowerBound.x;
var _local5:Number = _arg3.lowerBound.y;
_local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x);
_local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y);
_local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x);
_local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y);
var _local6:Number = _arg3.upperBound.x;
var _local7:Number = _arg3.upperBound.y;
_local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x);
_local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y);
_local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x);
_local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y);
_arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1));
_arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1);
_arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1));
_arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1);
}
public function CreateProxy(_arg1:b2AABB, _arg2):uint{
var _local3:uint;
var _local4:b2Proxy;
var _local11:Array;
var _local12:uint;
var _local13:uint;
var _local14:Array;
var _local15:Array;
var _local16:Array;
var _local17:int;
var _local18:int;
var _local19:b2Bound;
var _local20:b2Bound;
var _local21:b2Bound;
var _local22:int;
var _local23:b2Proxy;
var _local5:uint = m_freeProxy;
_local4 = m_proxyPool[_local5];
m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
var _local6:uint = (2 * m_proxyCount);
var _local7:Array = new Array();
var _local8:Array = new Array();
ComputeBounds(_local7, _local8, _arg1);
var _local9:int;
while (_local9 < 2) {
_local11 = m_bounds[_local9];
_local14 = [_local12];
_local15 = [_local13];
Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9);
_local12 = _local14[0];
_local13 = _local15[0];
_local16 = new Array();
_local18 = (_local6 - _local13);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local13 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local13 + 2);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local16 = new Array();
_local18 = (_local13 - _local12);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local12 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local12 + 1);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local13++;
_local19 = _local11[_local12];
_local20 = _local11[_local13];
_local19.value = _local7[_local9];
_local19.proxyId = _local5;
_local20.value = _local8[_local9];
_local20.proxyId = _local5;
_local21 = _local11[int((_local12 - 1))];
_local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount;
_local21 = _local11[int((_local13 - 1))];
_local20.stabbingCount = _local21.stabbingCount;
_local3 = _local12;
while (_local3 < _local13) {
_local21 = _local11[_local3];
_local21.stabbingCount++;
_local3++;
};
_local3 = _local12;
while (_local3 < (_local6 + 2)) {
_local19 = _local11[_local3];
_local23 = m_proxyPool[_local19.proxyId];
if (_local19.IsLower()){
_local23.lowerBounds[_local9] = _local3;
} else {
_local23.upperBounds[_local9] = _local3;
};
_local3++;
};
_local9++;
};
m_proxyCount++;
var _local10:int;
while (_local10 < m_queryResultCount) {
m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]);
_local10++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local5);
}
public function DestroyProxy(_arg1:uint):void{
var _local2:b2Bound;
var _local3:b2Bound;
var _local8:Array;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:Array;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:uint;
var _local18:int;
var _local19:b2Proxy;
var _local4:b2Proxy = m_proxyPool[_arg1];
var _local5:int = (2 * m_proxyCount);
var _local6:int;
while (_local6 < 2) {
_local8 = m_bounds[_local6];
_local9 = _local4.lowerBounds[_local6];
_local10 = _local4.upperBounds[_local6];
_local2 = _local8[_local9];
_local11 = _local2.value;
_local3 = _local8[_local10];
_local12 = _local3.value;
_local13 = new Array();
_local15 = ((_local10 - _local9) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local9 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = _local9;
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local13 = new Array();
_local15 = ((_local5 - _local10) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local10 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = (_local10 - 1);
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = (_local5 - 2);
_local17 = _local9;
while (_local17 < _local15) {
_local2 = _local8[_local17];
_local19 = m_proxyPool[_local2.proxyId];
if (_local2.IsLower()){
_local19.lowerBounds[_local6] = _local17;
} else {
_local19.upperBounds[_local6] = _local17;
};
_local17++;
};
_local15 = (_local10 - 1);
_local18 = _local9;
while (_local18 < _local15) {
_local2 = _local8[_local18];
_local2.stabbingCount--;
_local18++;
};
Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6);
_local6++;
};
var _local7:int;
while (_local7 < m_queryResultCount) {
m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]);
_local7++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
_local4.userData = null;
_local4.overlapCount = b2_invalid;
_local4.lowerBounds[0] = b2_invalid;
_local4.lowerBounds[1] = b2_invalid;
_local4.upperBounds[0] = b2_invalid;
_local4.upperBounds[1] = b2_invalid;
_local4.SetNext(m_freeProxy);
m_freeProxy = _arg1;
m_proxyCount--;
}
public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{
var _local4:Array;
var _local5:b2Bound;
var _local3:int;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg2.upperBounds[_local3]];
if (_arg1.lowerValues[_local3] > _local5.value){
return (false);
};
_local5 = _local4[_arg2.lowerBounds[_local3]];
if (_arg1.upperValues[_local3] < _local5.value){
return (false);
};
_local3++;
};
return (true);
}
public function Validate():void{
var _local1:b2Pair;
var _local2:b2Proxy;
var _local3:b2Proxy;
var _local4:Boolean;
var _local6:b2Bound;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
var _local5:int;
while (_local5 < 2) {
_local6 = m_bounds[_local5];
_local7 = (2 * m_proxyCount);
_local8 = 0;
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local6[_local9];
if (_local10.IsLower() == true){
_local8++;
} else {
_local8--;
};
_local9++;
};
_local5++;
};
}
private function IncrementOverlapCount(_arg1:uint):void{
var _local2:b2Proxy = m_proxyPool[_arg1];
if (_local2.timeStamp < m_timeStamp){
_local2.timeStamp = m_timeStamp;
_local2.overlapCount = 1;
} else {
_local2.overlapCount = 2;
m_queryResults[m_queryResultCount] = _arg1;
m_queryResultCount++;
};
}
public function InRange(_arg1:b2AABB):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = _arg1.lowerBound.x;
_local3 = _arg1.lowerBound.y;
_local2 = (_local2 - m_worldAABB.upperBound.x);
_local3 = (_local3 - m_worldAABB.upperBound.y);
_local4 = m_worldAABB.lowerBound.x;
_local5 = m_worldAABB.lowerBound.y;
_local4 = (_local4 - _arg1.upperBound.x);
_local5 = (_local5 - _arg1.upperBound.y);
_local2 = b2Math.b2Max(_local2, _local4);
_local3 = b2Math.b2Max(_local3, _local5);
return ((b2Math.b2Max(_local2, _local3) < 0));
}
public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{
var _local3:Array;
var _local4:int;
var _local5:uint;
var _local6:uint;
var _local7:b2Bound;
var _local8:b2Bound;
var _local9:b2Bound;
var _local10:uint;
var _local11:b2Proxy;
var _local16:Array;
var _local17:uint;
var _local18:uint;
var _local19:uint;
var _local20:uint;
var _local21:int;
var _local22:int;
var _local23:uint;
var _local24:b2Proxy;
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){
return;
};
if (_arg2.IsValid() == false){
return;
};
var _local12:uint = (2 * m_proxyCount);
var _local13:b2Proxy = m_proxyPool[_arg1];
var _local14:b2BoundValues = new b2BoundValues();
ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2);
var _local15:b2BoundValues = new b2BoundValues();
_local5 = 0;
while (_local5 < 2) {
_local7 = m_bounds[_local5][_local13.lowerBounds[_local5]];
_local15.lowerValues[_local5] = _local7.value;
_local7 = m_bounds[_local5][_local13.upperBounds[_local5]];
_local15.upperValues[_local5] = _local7.value;
_local5++;
};
_local5 = 0;
while (_local5 < 2) {
_local16 = m_bounds[_local5];
_local17 = _local13.lowerBounds[_local5];
_local18 = _local13.upperBounds[_local5];
_local19 = _local14.lowerValues[_local5];
_local20 = _local14.upperValues[_local5];
_local7 = _local16[_local17];
_local21 = (_local19 - _local7.value);
_local7.value = _local19;
_local7 = _local16[_local18];
_local22 = (_local20 - _local7.value);
_local7.value = _local20;
if (_local21 < 0){
_local6 = _local17;
while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local8.proxyId];
_local8.stabbingCount++;
if (_local8.IsUpper() == true){
if (TestOverlap(_local14, _local24)){
m_pairManager.AddBufferedPair(_arg1, _local23);
};
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
if (_local22 > 0){
_local6 = _local18;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount++;
if (_local9.IsLower() == true){
if (TestOverlap(_local14, _local11)){
m_pairManager.AddBufferedPair(_arg1, _local10);
};
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local21 > 0){
_local6 = _local17;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount--;
if (_local9.IsUpper()){
if (TestOverlap(_local15, _local11)){
m_pairManager.RemoveBufferedPair(_arg1, _local10);
};
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local22 < 0){
_local6 = _local18;
while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local23];
_local8.stabbingCount--;
if (_local8.IsLower() == true){
if (TestOverlap(_local15, _local24)){
m_pairManager.RemoveBufferedPair(_arg1, _local23);
};
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
_local5++;
};
}
public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{
var _local6:int;
var _local7:b2Bound;
var _local4:int;
var _local5:int = (_arg2 - 1);
while (_local4 <= _local5) {
_local6 = ((_local4 + _local5) / 2);
_local7 = _arg1[_local6];
if (_local7.value > _arg3){
_local5 = (_local6 - 1);
} else {
if (_local7.value < _arg3){
_local4 = (_local6 + 1);
} else {
return (uint(_local6));
};
};
};
return (uint(_local4));
}
}
}//package Box2D.Collision
Section 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.Common.*;
import Box2D.Collision.Shapes.*;
public class b2Collision {
public static const b2_nullFeature:uint = 0xFF;
private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2();
public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local11:b2Mat22;
var _local12:b2Vec2;
var _local25:Number;
var _local6:int = _arg1.m_vertexCount;
var _local7:Array = _arg1.m_vertices;
var _local8:Array = _arg1.m_normals;
var _local9:int = _arg4.m_vertexCount;
var _local10:Array = _arg4.m_vertices;
_local11 = _arg2.R;
_local12 = _local8[_arg3];
var _local13:Number = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y));
var _local14:Number = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y));
_local11 = _arg5.R;
var _local15:Number = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14));
var _local16:Number = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14));
var _local17:int;
var _local18:Number = Number.MAX_VALUE;
var _local19:int;
while (_local19 < _local9) {
_local12 = _local10[_local19];
_local25 = ((_local12.x * _local15) + (_local12.y * _local16));
if (_local25 < _local18){
_local18 = _local25;
_local17 = _local19;
};
_local19++;
};
_local12 = _local7[_arg3];
_local11 = _arg2.R;
var _local20:Number = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
var _local21:Number = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local12 = _local10[_local17];
_local11 = _arg5.R;
var _local22:Number = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
var _local23:Number = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local22 = (_local22 - _local20);
_local23 = (_local23 - _local21);
var _local24:Number = ((_local22 * _local13) + (_local23 * _local14));
return (_local24);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2 = _arg2.lowerBound;
var _local4:b2Vec2 = _arg1.upperBound;
var _local5:Number = (_local3.x - _local4.x);
var _local6:Number = (_local3.y - _local4.y);
_local3 = _arg1.lowerBound;
_local4 = _arg2.upperBound;
var _local7:Number = (_local3.x - _local4.x);
var _local8:Number = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{
var _local12:b2Mat22;
var _local13:b2Vec2;
var _local20:ClipVertex;
var _local23:Number;
var _local7:int = _arg2.m_vertexCount;
var _local8:Array = _arg2.m_normals;
var _local9:int = _arg5.m_vertexCount;
var _local10:Array = _arg5.m_vertices;
var _local11:Array = _arg5.m_normals;
_local12 = _arg3.R;
_local13 = _local8[_arg4];
var _local14:Number = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y));
var _local15:Number = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y));
_local12 = _arg6.R;
var _local16:Number = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15));
_local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15));
_local14 = _local16;
var _local17:int;
var _local18:Number = Number.MAX_VALUE;
var _local19:int;
while (_local19 < _local9) {
_local13 = _local11[_local19];
_local23 = ((_local14 * _local13.x) + (_local15 * _local13.y));
if (_local23 < _local18){
_local18 = _local23;
_local17 = _local19;
};
_local19++;
};
var _local21:int = _local17;
var _local22:int = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0;
_local20 = _arg1[0];
_local13 = _local10[_local21];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local21;
_local20.id.features.incidentVertex = 0;
_local20 = _arg1[1];
_local13 = _local10[_local22];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local22;
_local20.id.features.incidentVertex = 1;
}
public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{
var _local6:ClipVertex;
var _local13:b2PolygonShape;
var _local14:b2PolygonShape;
var _local17:int;
var _local18:uint;
var _local34:int;
var _local37:b2Vec2;
var _local38:Number;
var _local39:b2ManifoldPoint;
_arg1.pointCount = 0;
var _local7:int;
var _local8:Array = [_local7];
var _local9:Number = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5);
_local7 = _local8[0];
if (_local9 > 0){
return;
};
var _local10:int;
var _local11:Array = [_local10];
var _local12:Number = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3);
_local10 = _local11[0];
if (_local12 > 0){
return;
};
var _local15:b2XForm = new b2XForm();
var _local16:b2XForm = new b2XForm();
var _local19:Number = 0.98;
var _local20:Number = 0.001;
if (_local12 > ((_local19 * _local9) + _local20)){
_local13 = _arg4;
_local14 = _arg2;
_local15.Set(_arg5);
_local16.Set(_arg3);
_local17 = _local10;
_local18 = 1;
} else {
_local13 = _arg2;
_local14 = _arg4;
_local15.Set(_arg3);
_local16.Set(_arg5);
_local17 = _local7;
_local18 = 0;
};
var _local21:Array = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16);
var _local22:int = _local13.m_vertexCount;
var _local23:Array = _local13.m_vertices;
var _local24:b2Vec2 = _local23[_local17];
var _local25:b2Vec2 = _local24.Copy();
if ((_local17 + 1) < _local22){
_local24 = _local23[int((_local17 + 1))];
_local37 = _local24.Copy();
} else {
_local24 = _local23[0];
_local37 = _local24.Copy();
};
var _local26:b2Vec2 = b2Math.SubtractVV(_local37, _local25);
var _local27:b2Vec2 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25));
_local27.Normalize();
var _local28:b2Vec2 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local37 = b2Math.b2MulX(_local15, _local37);
var _local29:Number = b2Math.b2Dot(_local28, _local25);
var _local30:Number = -(b2Math.b2Dot(_local27, _local25));
var _local31:Number = b2Math.b2Dot(_local27, _local37);
var _local32:Array = [new ClipVertex(), new ClipVertex()];
var _local33:Array = [new ClipVertex(), new ClipVertex()];
_local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30);
if (_local34 < 2){
return;
};
_local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31);
if (_local34 < 2){
return;
};
_arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy();
var _local35:int;
var _local36:int;
while (_local36 < b2Settings.b2_maxManifoldPoints) {
_local6 = _local33[_local36];
_local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29);
if (_local38 <= 0){
_local39 = _arg1.points[_local35];
_local39.separation = _local38;
_local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local39.id.key = _local6.id._key;
_local39.id.features.flip = _local18;
_local35++;
};
_local36++;
};
_arg1.pointCount = _local35;
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local8:b2Vec2;
var _local9:b2Mat22;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:Number;
var _local6:int = _arg2.m_vertexCount;
var _local7:Array = _arg2.m_normals;
_local9 = _arg5.R;
_local8 = _arg4.m_centroid;
var _local10:Number = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)));
var _local11:Number = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)));
_local9 = _arg3.R;
_local8 = _arg2.m_centroid;
_local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))));
_local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))));
var _local12:Number = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y));
var _local13:Number = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y));
var _local14:int;
var _local15:Number = -(Number.MAX_VALUE);
var _local16:int;
while (_local16 < _local6) {
_local8 = _local7[_local16];
_local25 = ((_local8.x * _local12) + (_local8.y * _local13));
if (_local25 > _local15){
_local15 = _local25;
_local14 = _local16;
};
_local16++;
};
var _local17:Number = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
var _local18:int = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1);
var _local19:Number = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5);
if (_local19 > 0){
return (_local19);
};
var _local20:int = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0;
var _local21:Number = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5);
if (_local21 > 0){
return (_local21);
};
if ((((_local19 > _local17)) && ((_local19 > _local21)))){
_local24 = -1;
_local22 = _local18;
_local23 = _local19;
} else {
if (_local21 > _local17){
_local24 = 1;
_local22 = _local20;
_local23 = _local21;
} else {
_arg1[0] = _local14;
return (_local17);
};
};
while (true) {
if (_local24 == -1){
_local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1);
} else {
_local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
if (_local17 > _local23){
_local22 = _local14;
_local23 = _local17;
} else {
break;
};
};
_arg1[0] = _local22;
return (_local23);
}
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:ClipVertex;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:Number;
var _local11:Number;
var _local12:b2Vec2;
var _local13:ClipVertex;
_local6 = 0;
_local5 = _arg2[0];
_local7 = _local5.v;
_local5 = _arg2[1];
_local8 = _local5.v;
_local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4);
var _local10:Number = (b2Math.b2Dot(_arg3, _local8) - _arg4);
if (_local9 <= 0){
var _temp1 = _local6;
_local6 = (_local6 + 1);
var _local14 = _temp1;
_arg1[_local14] = _arg2[0];
};
if (_local10 <= 0){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_local14 = _temp2;
_arg1[_local14] = _arg2[1];
};
if ((_local9 * _local10) < 0){
_local11 = (_local9 / (_local9 - _local10));
_local5 = _arg1[_local6];
_local12 = _local5.v;
_local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x)));
_local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y)));
_local5 = _arg1[_local6];
if (_local9 > 0){
_local13 = _arg2[0];
_local5.id = _local13.id;
} else {
_local13 = _arg2[1];
_local5.id = _local13.id;
};
_local6++;
};
return (_local6);
}
public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2Mat22;
var _local7:b2Vec2;
var _local18:Number;
var _local24:Number;
var _local25:Number;
_arg1.pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_localPosition;
var _local8:Number = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local9:Number = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_localPosition;
var _local10:Number = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local11:Number = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
var _local12:Number = (_local10 - _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = ((_local12 * _local12) + (_local13 * _local13));
var _local15:Number = _arg2.m_radius;
var _local16:Number = _arg4.m_radius;
var _local17:Number = (_local15 + _local16);
if (_local14 > (_local17 * _local17)){
return;
};
if (_local14 < Number.MIN_VALUE){
_local18 = -(_local17);
_arg1.normal.Set(0, 1);
} else {
_local24 = Math.sqrt(_local14);
_local18 = (_local24 - _local17);
_local25 = (1 / _local24);
_arg1.normal.x = (_local25 * _local12);
_arg1.normal.y = (_local25 * _local13);
};
_arg1.pointCount = 1;
var _local19:b2ManifoldPoint = _arg1.points[0];
_local19.id.key = 0;
_local19.separation = _local18;
_local8 = (_local8 + (_local15 * _arg1.normal.x));
_local9 = (_local9 + (_local15 * _arg1.normal.y));
_local10 = (_local10 - (_local16 * _arg1.normal.x));
_local11 = (_local11 - (_local16 * _arg1.normal.y));
var _local20:Number = (0.5 * (_local8 + _local10));
var _local21:Number = (0.5 * (_local9 + _local11));
var _local22:Number = (_local20 - _arg3.position.x);
var _local23:Number = (_local21 - _arg3.position.y);
_local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y));
_local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y));
_local22 = (_local20 - _arg5.position.x);
_local23 = (_local21 - _arg5.position.y);
_local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y));
_local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y));
}
public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2ManifoldPoint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local12:b2Mat22;
var _local17:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_arg1.pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_localPosition;
var _local13:Number = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
var _local14:Number = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)));
_local7 = (_local13 - _arg3.position.x);
_local8 = (_local14 - _arg3.position.y);
_local12 = _arg3.R;
var _local15:Number = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
var _local16:Number = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
var _local18:int;
var _local19:Number = -(Number.MAX_VALUE);
var _local20:Number = _arg4.m_radius;
var _local21:int = _arg2.m_vertexCount;
var _local22:Array = _arg2.m_vertices;
var _local23:Array = _arg2.m_normals;
var _local24:int;
while (_local24 < _local21) {
_local11 = _local22[_local24];
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local11 = _local23[_local24];
_local34 = ((_local11.x * _local7) + (_local11.y * _local8));
if (_local34 > _local20){
return;
};
if (_local34 > _local19){
_local19 = _local34;
_local18 = _local24;
};
_local24++;
};
if (_local19 < Number.MIN_VALUE){
_arg1.pointCount = 1;
_local11 = _local23[_local18];
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y));
_arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y));
_local6 = _arg1.points[0];
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local19 - _local20);
return;
};
var _local25:int = _local18;
var _local26:int = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
_local11 = _local22[_local25];
var _local27:b2Vec2 = _local22[_local26];
var _local28:Number = (_local27.x - _local11.x);
var _local29:Number = (_local27.y - _local11.y);
var _local30:Number = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
var _local31:Number = ((_local7 * _local28) + (_local8 * _local29));
_local6 = _arg1.points[0];
if (_local31 <= 0){
_local32 = _local11.x;
_local33 = _local11.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local25;
} else {
if (_local31 >= _local30){
_local32 = _local27.x;
_local33 = _local27.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local26;
} else {
_local32 = ((_local28 * _local31) + _local11.x);
_local33 = ((_local29 * _local31) + _local11.y);
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
};
};
_local7 = (_local15 - _local32);
_local8 = (_local16 - _local33);
_local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local7 / _local17);
_local8 = (_local8 / _local17);
if (_local17 > _local20){
return;
};
_arg1.pointCount = 1;
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8));
_arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8));
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local17 - _local20);
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
}
}
}//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID)
package Box2D.Collision {
public class b2ContactID {
public var _key:uint;
public var features:Features;
public function b2ContactID(){
features = new Features();
super();
features._m_id = this;
}
public function Set(_arg1:b2ContactID):void{
key = _arg1._key;
}
public function Copy():b2ContactID{
var _local1:b2ContactID = new b2ContactID();
_local1.key = key;
return (_local1);
}
public function set key(_arg1:uint):void{
_key = _arg1;
features._referenceEdge = (_key & 0xFF);
features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF);
features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF);
features._flip = (((_key & 4278190080) >> 24) & 0xFF);
}
public function get key():uint{
return (_key);
}
}
}//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class b2ContactPoint {
public var friction:Number;
public var separation:Number;
public var normal:b2Vec2;
public var position:b2Vec2;
public var restitution:Number;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var id:b2ContactID;
public var velocity:b2Vec2;
public function b2ContactPoint(){
position = new b2Vec2();
velocity = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Collision.Shapes.*;
public class b2Distance {
private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var gPoint:b2Point = new b2Point();
public static var g_GJK_Iterations:int = 0;
public static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{
var _local6:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local4:Number = (100 * Number.MIN_VALUE);
var _local5:int;
while (_local5 < _arg3) {
_local6 = _arg2[_local5];
_local7 = Math.abs((_arg1.x - _local6.x));
_local8 = Math.abs((_arg1.y - _local6.y));
_local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x));
_local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y));
if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){
return (true);
};
_local5++;
};
return (false);
}
public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{
var _local7:b2Vec2;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:int;
var _local8:Array = s_p1s;
var _local9:Array = s_p2s;
var _local10:Array = s_points;
var _local11:int;
_arg1.SetV(_arg3.GetFirstVertex(_arg4));
_arg2.SetV(_arg5.GetFirstVertex(_arg6));
var _local12:Number = 0;
var _local13:int = 20;
var _local14:int;
while (_local14 < _local13) {
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local17 = _arg3.Support(_arg4, _local15, _local16);
_local18 = _arg5.Support(_arg6, -(_local15), -(_local16));
_local12 = ((_local15 * _local15) + (_local16 * _local16));
_local19 = (_local18.x - _local17.x);
_local20 = (_local18.y - _local17.y);
_local21 = ((_local15 * _local19) + (_local16 * _local20));
if ((_local12 - _local21) <= (0.01 * _local12)){
if (_local11 == 0){
_arg1.SetV(_local17);
_arg2.SetV(_local18);
};
g_GJK_Iterations = _local14;
return (Math.sqrt(_local12));
};
switch (_local11){
case 0:
_local7 = _local8[0];
_local7.SetV(_local17);
_local7 = _local9[0];
_local7.SetV(_local18);
_local7 = _local10[0];
_local7.x = _local19;
_local7.y = _local20;
_arg1.SetV(_local8[0]);
_arg2.SetV(_local9[0]);
_local11++;
break;
case 1:
_local7 = _local8[1];
_local7.SetV(_local17);
_local7 = _local9[1];
_local7.SetV(_local18);
_local7 = _local10[1];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessTwo(_arg1, _arg2, _local8, _local9, _local10);
break;
case 2:
_local7 = _local8[2];
_local7.SetV(_local17);
_local7 = _local9[2];
_local7.SetV(_local18);
_local7 = _local10[2];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessThree(_arg1, _arg2, _local8, _local9, _local10);
break;
};
if (_local11 == 3){
g_GJK_Iterations = _local14;
return (0);
};
_local22 = -(Number.MAX_VALUE);
_local23 = 0;
while (_local23 < _local11) {
_local7 = _local10[_local23];
_local22 = b2Math.b2Max(_local22, ((_local7.x * _local7.x) + (_local7.y * _local7.y)));
_local23++;
};
if ((((_local11 == 3)) || ((_local12 <= ((100 * Number.MIN_VALUE) * _local22))))){
g_GJK_Iterations = _local14;
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local12 = ((_local15 * _local15) + (_local16 * _local16));
return (Math.sqrt(_local12));
};
_local14++;
};
g_GJK_Iterations = _local13;
return (Math.sqrt(_local12));
}
public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local19:Number;
var _local20:Number;
_local7 = _arg4.R;
_local8 = _arg3.m_localPosition;
var _local9:Number = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
var _local10:Number = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local7 = _arg6.R;
_local8 = _arg5.m_localPosition;
var _local11:Number = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
var _local12:Number = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
var _local13:Number = (_local11 - _local9);
var _local14:Number = (_local12 - _local10);
var _local15:Number = ((_local13 * _local13) + (_local14 * _local14));
var _local16:Number = (_arg3.m_radius - b2Settings.b2_toiSlop);
var _local17:Number = (_arg5.m_radius - b2Settings.b2_toiSlop);
var _local18:Number = (_local16 + _local17);
if (_local15 > (_local18 * _local18)){
_local19 = Math.sqrt(_local15);
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_local20 = (_local19 - _local18);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = (_local11 - (_local17 * _local13));
_arg2.y = (_local12 - (_local17 * _local14));
return (_local20);
};
if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){
_local19 = Math.sqrt(_local15);
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
};
_arg1.x = _local9;
_arg1.y = _local10;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
}
public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local35:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg5[2];
_local9 = _arg3[0];
_local10 = _arg3[1];
_local11 = _arg3[2];
_local12 = _arg4[0];
_local13 = _arg4[1];
var _local14:b2Vec2 = _arg4[2];
var _local15:Number = _local6.x;
var _local16:Number = _local6.y;
var _local17:Number = _local7.x;
var _local18:Number = _local7.y;
var _local19:Number = _local8.x;
var _local20:Number = _local8.y;
var _local21:Number = (_local17 - _local15);
var _local22:Number = (_local18 - _local16);
var _local23:Number = (_local19 - _local15);
var _local24:Number = (_local20 - _local16);
var _local25:Number = (_local19 - _local17);
var _local26:Number = (_local20 - _local18);
var _local27:Number = -(((_local15 * _local21) + (_local16 * _local22)));
var _local28:Number = ((_local17 * _local21) + (_local18 * _local22));
var _local29:Number = -(((_local15 * _local23) + (_local16 * _local24)));
var _local30:Number = ((_local19 * _local23) + (_local20 * _local24));
var _local31:Number = -(((_local17 * _local25) + (_local18 * _local26)));
var _local32:Number = ((_local19 * _local25) + (_local20 * _local26));
if ((((_local30 <= 0)) && ((_local32 <= 0)))){
_arg1.SetV(_local11);
_arg2.SetV(_local14);
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (1);
};
var _local33:Number = ((_local21 * _local24) - (_local22 * _local23));
var _local34:Number = (_local33 * ((_local15 * _local18) - (_local16 * _local17)));
var _local36:Number = (_local33 * ((_local17 * _local20) - (_local18 * _local19)));
if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){
_local35 = (_local31 / (_local31 + _local32));
_arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x)));
_arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y)));
_arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x)));
_arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y)));
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (2);
};
var _local37:Number = (_local33 * ((_local19 * _local16) - (_local20 * _local15)));
if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){
_local35 = (_local29 / (_local29 + _local30));
_arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x)));
_arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y)));
_arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x)));
_arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y)));
_local10.SetV(_local11);
_local13.SetV(_local14);
_local7.SetV(_local8);
return (2);
};
var _local38:Number = ((_local36 + _local37) + _local34);
_local38 = (1 / _local38);
var _local39:Number = (_local36 * _local38);
var _local40:Number = (_local37 * _local38);
var _local41:Number = ((1 - _local39) - _local40);
_arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x));
_arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y));
_arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x));
_arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y));
return (3);
}
public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local9:b2Point = gPoint;
_local8 = _arg5.m_localPosition;
_local7 = _arg6.R;
_local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
var _local10:Number = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity);
var _local11:Number = (_arg5.m_radius - b2Settings.b2_toiSlop);
if (_local10 > _local11){
_local10 = (_local10 - _local11);
_local12 = (_arg2.x - _arg1.x);
_local13 = (_arg2.y - _arg1.y);
_local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13)));
_local12 = (_local12 / _local14);
_local13 = (_local13 / _local14);
_arg2.x = (_arg2.x - (_local11 * _local12));
_arg2.y = (_arg2.y - (_local11 * _local13));
} else {
_local10 = 0;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
};
return (_local10);
}
public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{
var _local7:int = _arg3.m_type;
var _local8:int = _arg5.m_type;
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6));
};
return (0);
}
public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local17:Number;
var _local6:b2Vec2 = _arg5[0];
var _local7:b2Vec2 = _arg5[1];
var _local8:b2Vec2 = _arg3[0];
_local9 = _arg3[1];
_local10 = _arg4[0];
_local11 = _arg4[1];
var _local12:Number = -(_local7.x);
var _local13:Number = -(_local7.y);
var _local14:Number = (_local6.x - _local7.x);
var _local15:Number = (_local6.y - _local7.y);
var _local16:Number = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
_local14 = (_local14 / _local16);
_local15 = (_local15 / _local16);
_local17 = ((_local12 * _local14) + (_local13 * _local15));
if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){
_arg1.SetV(_local9);
_arg2.SetV(_local11);
_local8.SetV(_local9);
_local10.SetV(_local11);
_local6.SetV(_local7);
return (1);
};
_local17 = (_local17 / _local16);
_arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x)));
_arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y)));
_arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x)));
_arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y)));
return (2);
}
}
}//package Box2D.Collision
Section 18
//b2Manifold (Box2D.Collision.b2Manifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Manifold {
public var pointCount:int;// = 0
public var normal:b2Vec2;
public var points:Array;
public function b2Manifold(){
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ManifoldPoint();
_local1++;
};
normal = new b2Vec2();
}
public function Set(_arg1:b2Manifold):void{
pointCount = _arg1.pointCount;
var _local2:int;
while (_local2 < b2Settings.b2_maxManifoldPoints) {
(points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]);
_local2++;
};
normal.SetV(_arg1.normal);
}
public function Reset():void{
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
normal.SetZero();
pointCount = 0;
}
}
}//package Box2D.Collision
Section 19
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2ManifoldPoint {
public var separation:Number;
public var localPoint2:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var localPoint1:b2Vec2;
public var id:b2ContactID;
public function b2ManifoldPoint(){
localPoint1 = new b2Vec2();
localPoint2 = new b2Vec2();
id = new b2ContactID();
super();
}
public function Set(_arg1:b2ManifoldPoint):void{
localPoint1.SetV(_arg1.localPoint1);
localPoint2.SetV(_arg1.localPoint2);
separation = _arg1.separation;
normalImpulse = _arg1.normalImpulse;
tangentImpulse = _arg1.tangentImpulse;
id.key = _arg1.id.key;
}
public function Reset():void{
localPoint1.SetZero();
localPoint2.SetZero();
separation = 0;
normalImpulse = 0;
tangentImpulse = 0;
id.key = 0;
}
}
}//package Box2D.Collision
Section 20
//b2OBB (Box2D.Collision.b2OBB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2OBB {
public var R:b2Mat22;
public var center:b2Vec2;
public var extents:b2Vec2;
public function b2OBB(){
R = new b2Mat22();
center = new b2Vec2();
extents = new b2Vec2();
super();
}
}
}//package Box2D.Collision
Section 21
//b2Pair (Box2D.Collision.b2Pair)
package Box2D.Collision {
import Box2D.Common.*;
public class b2Pair {
public var proxyId1:uint;
public var userData;// = null
public var proxyId2:uint;
public var status:uint;
public var next:uint;
public static var e_pairFinal:uint = 4;
public static var b2_tableMask:int = (b2_tableCapacity - 1);
public static var e_pairRemoved:uint = 2;
public static var b2_nullPair:uint = b2Settings.USHRT_MAX;
public static var e_pairBuffered:uint = 1;
public static var b2_nullProxy:uint = b2Settings.USHRT_MAX;
public static var b2_tableCapacity:int = b2Settings.b2_maxPairs;
public function SetBuffered():void{
status = (status | e_pairBuffered);
}
public function IsBuffered():Boolean{
return (((status & e_pairBuffered) == e_pairBuffered));
}
public function IsFinal():Boolean{
return (((status & e_pairFinal) == e_pairFinal));
}
public function ClearRemoved():void{
status = (status & ~(e_pairRemoved));
}
public function SetFinal():void{
status = (status | e_pairFinal);
}
public function IsRemoved():Boolean{
return (((status & e_pairRemoved) == e_pairRemoved));
}
public function ClearBuffered():void{
status = (status & ~(e_pairBuffered));
}
public function SetRemoved():void{
status = (status | e_pairRemoved);
}
}
}//package Box2D.Collision
Section 22
//b2PairCallback (Box2D.Collision.b2PairCallback)
package Box2D.Collision {
public class b2PairCallback {
public function PairRemoved(_arg1, _arg2, _arg3):void{
}
public function PairAdded(_arg1, _arg2){
return (null);
}
}
}//package Box2D.Collision
Section 23
//b2PairManager (Box2D.Collision.b2PairManager)
package Box2D.Collision {
import Box2D.Common.*;
import Box2D.Common.Math.*;
public class b2PairManager {
public var m_pairCount:int;
public var m_pairBuffer:Array;
public var m_hashTable:Array;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_pairBufferCount:int;
public var m_broadPhase:b2BroadPhase;
public var m_freePair:uint;
public function b2PairManager(){
var _local1:uint;
super();
m_hashTable = new Array(b2Pair.b2_tableCapacity);
_local1 = 0;
while (_local1 < b2Pair.b2_tableCapacity) {
m_hashTable[_local1] = b2Pair.b2_nullPair;
_local1++;
};
m_pairs = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1] = new b2Pair();
_local1++;
};
m_pairBuffer = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairBuffer[_local1] = new b2BufferedPair();
_local1++;
};
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy;
m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy;
m_pairs[_local1].userData = null;
m_pairs[_local1].status = 0;
m_pairs[_local1].next = (_local1 + 1);
_local1++;
};
m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair;
m_pairCount = 0;
m_pairBufferCount = 0;
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:b2Pair;
var _local5:uint = m_hashTable[_arg3];
_local4 = m_pairs[_local5];
while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) {
_local5 = _local4.next;
_local4 = m_pairs[_local5];
};
if (_local5 == b2Pair.b2_nullPair){
return (null);
};
return (_local4);
}
private function Find(_arg1:uint, _arg2:uint):b2Pair{
var _local4:uint;
if (_arg1 > _arg2){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
return (FindHash(_arg1, _arg2, _local3));
}
private function ValidateBuffer():void{
}
public function Commit():void{
var _local1:b2BufferedPair;
var _local2:int;
var _local5:b2Pair;
var _local6:b2Proxy;
var _local7:b2Proxy;
var _local3:int;
var _local4:Array = m_broadPhase.m_proxyPool;
_local2 = 0;
while (_local2 < m_pairBufferCount) {
_local1 = m_pairBuffer[_local2];
_local5 = Find(_local1.proxyId1, _local1.proxyId2);
_local5.ClearBuffered();
_local6 = _local4[_local5.proxyId1];
_local7 = _local4[_local5.proxyId2];
if (_local5.IsRemoved()){
if (_local5.IsFinal() == true){
m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData);
};
_local1 = m_pairBuffer[_local3];
_local1.proxyId1 = _local5.proxyId1;
_local1.proxyId2 = _local5.proxyId2;
_local3++;
} else {
if (_local5.IsFinal() == false){
_local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData);
_local5.SetFinal();
};
};
_local2++;
};
_local2 = 0;
while (_local2 < _local3) {
_local1 = m_pairBuffer[_local2];
RemovePair(_local1.proxyId1, _local1.proxyId2);
_local2++;
};
m_pairBufferCount = 0;
if (b2BroadPhase.s_validate){
ValidateTable();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair = Find(_arg1, _arg2);
if (_local4 == null){
return;
};
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.SetRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function RemovePair(_arg1:uint, _arg2:uint){
var _local3:b2Pair;
var _local7:uint;
var _local8:uint;
var _local9:*;
if (_arg1 > _arg2){
_local7 = _arg1;
_arg1 = _arg2;
_arg2 = _local7;
};
var _local4:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local5:uint = m_hashTable[_local4];
var _local6:b2Pair;
while (_local5 != b2Pair.b2_nullPair) {
if (Equals(m_pairs[_local5], _arg1, _arg2)){
_local8 = _local5;
_local3 = m_pairs[_local5];
if (_local6){
_local6.next = _local3.next;
} else {
m_hashTable[_local4] = _local3.next;
};
_local3 = m_pairs[_local8];
_local9 = _local3.userData;
_local3.next = m_freePair;
_local3.proxyId1 = b2Pair.b2_nullProxy;
_local3.proxyId2 = b2Pair.b2_nullProxy;
_local3.userData = null;
_local3.status = 0;
m_freePair = _local8;
m_pairCount--;
return (_local9);
} else {
_local6 = m_pairs[_local5];
_local5 = _local6.next;
};
};
return (null);
}
public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{
m_broadPhase = _arg1;
m_callback = _arg2;
}
public function AddBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair = AddPair(_arg1, _arg2);
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.ClearRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function AddPair(_arg1:uint, _arg2:uint):b2Pair{
var _local6:uint;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local4 = FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
var _local5:uint = m_freePair;
_local4 = m_pairs[_local5];
m_freePair = _local4.next;
_local4.proxyId1 = _arg1;
_local4.proxyId2 = _arg2;
_local4.status = 0;
_local4.userData = null;
_local4.next = m_hashTable[_local3];
m_hashTable[_local3] = _local5;
m_pairCount++;
return (_local4);
}
private function ValidateTable():void{
}
public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{
return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2))));
}
public static function Hash(_arg1:uint, _arg2:uint):uint{
var _local3:uint = (((_arg2 << 16) & 4294901760) | _arg1);
_local3 = (~(_local3) + ((_local3 << 15) & 4294934528));
_local3 = (_local3 ^ ((_local3 >> 12) & 1048575));
_local3 = (_local3 + ((_local3 << 2) & 4294967292));
_local3 = (_local3 ^ ((_local3 >> 4) & 268435455));
_local3 = (_local3 * 2057);
_local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF));
return (_local3);
}
public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{
return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3))));
}
}
}//package Box2D.Collision
Section 24
//b2Point (Box2D.Collision.b2Point)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2Point {
public var p:b2Vec2;
public function b2Point(){
p = new b2Vec2();
super();
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (p);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
return (p);
}
}
}//package Box2D.Collision
Section 25
//b2Proxy (Box2D.Collision.b2Proxy)
package Box2D.Collision {
public class b2Proxy {
public var overlapCount:uint;
public var userData;// = null
public var lowerBounds:Array;
public var upperBounds:Array;
public var timeStamp:uint;
public function b2Proxy(){
lowerBounds = [uint(0), uint(0)];
upperBounds = [uint(0), uint(0)];
super();
}
public function GetNext():uint{
return (lowerBounds[0]);
}
public function IsValid():Boolean{
return (!((overlapCount == b2BroadPhase.b2_invalid)));
}
public function SetNext(_arg1:uint):void{
lowerBounds[0] = (_arg1 & 0xFFFF);
}
}
}//package Box2D.Collision
Section 26
//b2Segment (Box2D.Collision.b2Segment)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Segment {
public var p1:b2Vec2;
public var p2:b2Vec2;
public function b2Segment(){
p1 = new b2Vec2();
p2 = new b2Vec2();
super();
}
public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local5:b2Vec2 = _arg3.p1;
var _local6:Number = (_arg3.p2.x - _local5.x);
var _local7:Number = (_arg3.p2.y - _local5.y);
var _local8:Number = (p2.x - p1.x);
var _local9:Number = (p2.y - p1.y);
var _local10:Number = _local9;
var _local11:Number = -(_local8);
var _local12:Number = (100 * Number.MIN_VALUE);
var _local13:Number = -(((_local6 * _local10) + (_local7 * _local11)));
if (_local13 > _local12){
_local14 = (_local5.x - p1.x);
_local15 = (_local5.y - p1.y);
_local16 = ((_local14 * _local10) + (_local15 * _local11));
if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){
_local17 = ((-(_local6) * _local15) + (_local7 * _local14));
if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){
_local16 = (_local16 / _local13);
_local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
_local10 = (_local10 / _local18);
_local11 = (_local11 / _local18);
_arg1[0] = _local16;
_arg2.Set(_local10, _local11);
return (true);
};
};
};
return (false);
}
}
}//package Box2D.Collision
Section 27
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Collision.Shapes.*;
public class b2TimeOfImpact {
public static var s_xf1:b2XForm = new b2XForm();
public static var s_xf2:b2XForm = new b2XForm();
public static var s_p1:b2Vec2 = new b2Vec2();
public static var s_p2:b2Vec2 = new b2Vec2();
public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{
var _local5:Number;
var _local6:Number;
var _local25:Number;
var _local26:b2XForm;
var _local27:b2XForm;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local7:Number = _arg1.m_sweepRadius;
var _local8:Number = _arg3.m_sweepRadius;
var _local9:Number = _arg2.t0;
var _local10:Number = (_arg2.c.x - _arg2.c0.x);
var _local11:Number = (_arg2.c.y - _arg2.c0.y);
var _local12:Number = (_arg4.c.x - _arg4.c0.x);
var _local13:Number = (_arg4.c.y - _arg4.c0.y);
var _local14:Number = (_arg2.a - _arg2.a0);
var _local15:Number = (_arg4.a - _arg4.a0);
var _local16:Number = 0;
var _local17:b2Vec2 = s_p1;
var _local18:b2Vec2 = s_p2;
var _local19:int = 20;
var _local20:int;
var _local21:Number = 0;
var _local22:Number = 0;
var _local23:Number = 0;
var _local24:Number = 0;
while (true) {
_local25 = (((1 - _local16) * _local9) + _local16);
_local26 = s_xf1;
_local27 = s_xf2;
_arg2.GetXForm(_local26, _local25);
_arg4.GetXForm(_local27, _local25);
_local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27);
if (_local20 == 0){
if (_local23 > (2 * b2Settings.b2_toiSlop)){
_local24 = (1.5 * b2Settings.b2_toiSlop);
} else {
_local5 = (0.05 * b2Settings.b2_toiSlop);
_local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop));
_local24 = ((_local5 > _local6)) ? _local5 : _local6;
};
};
if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){
break;
};
_local21 = (_local18.x - _local17.x);
_local22 = (_local18.y - _local17.y);
_local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22)));
_local21 = (_local21 / _local28);
_local22 = (_local22 / _local28);
_local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8));
if (_local29 == 0){
_local16 = 1;
break;
};
_local30 = ((_local23 - _local24) / _local29);
_local31 = (_local16 + _local30);
if ((((_local31 < 0)) || ((1 < _local31)))){
_local16 = 1;
break;
};
if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){
break;
};
_local16 = _local31;
_local20++;
};
return (_local16);
}
}
}//package Box2D.Collision
Section 28
//ClipVertex (Box2D.Collision.ClipVertex)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class ClipVertex {
public var id:b2ContactID;
public var v:b2Vec2;
public function ClipVertex(){
v = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features)
package Box2D.Collision {
public class Features {
public var _referenceEdge:int;
public var _incidentEdge:int;
public var _flip:int;
public var _incidentVertex:int;
public var _m_id:b2ContactID;
public function get referenceEdge():int{
return (_referenceEdge);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
public function get flip():int{
return (_flip);
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set referenceEdge(_arg1:int):void{
_referenceEdge = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
}
}//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22)
package Box2D.Common.Math {
import Box2D.Common.*;
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){
var _local4:Number;
var _local5:Number;
col1 = new b2Vec2();
col2 = new b2Vec2();
super();
if (((!((_arg2 == null))) && (!((_arg3 == null))))){
col1.SetV(_arg2);
col2.SetV(_arg3);
} else {
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
col1.x = _local4;
col2.x = -(_local5);
col1.y = _local5;
col2.y = _local4;
};
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function Set(_arg1:Number):void{
var _local2:Number;
_local2 = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function SetM(_arg1:b2Mat22):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local4:Number;
var _local6:Number;
_local2 = col1.x;
var _local3:Number = col2.x;
_local4 = col1.y;
var _local5:Number = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
_local6 = (1 / _local6);
_arg1.col1.x = (_local6 * _local5);
_arg1.col2.x = (-(_local6) * _local3);
_arg1.col1.y = (-(_local6) * _local4);
_arg1.col2.y = (_local6 * _local2);
return (_arg1);
}
public function GetAngle():Number{
return (Math.atan2(col1.y, col1.x));
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number = col1.x;
var _local5:Number = col2.x;
var _local6:Number = col1.y;
var _local7:Number = col2.y;
var _local8:Number = ((_local4 * _local7) - (_local5 * _local6));
_local8 = (1 / _local8);
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
}
}//package Box2D.Common.Math
Section 31
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1));
public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity);
public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0);
public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = b2MulMV(_arg1.R, _arg2);
_local3.x = (_local3.x + _arg1.position.x);
_local3.y = (_local3.y + _arg1.position.y);
return (_local3);
}
public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number = (_arg1.x - _arg2.x);
var _local4:Number = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:* = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
_local3 = SubtractVV(_arg2, _arg1.position);
_local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y));
_local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y));
_local3.x = _local4;
return (_local3);
}
public static function b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number = (_arg1.x - _arg2.x);
var _local4:Number = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
var _local4:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
var _local5:b2Mat22 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2NextPowerOfTwo(_arg1:uint):uint{
_arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647));
_arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823));
_arg1 = (_arg1 | ((_arg1 >> 4) & 268435455));
_arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF));
_arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF));
return ((_arg1 + 1));
}
public static function b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
}
}//package Box2D.Common.Math
Section 32
//b2Sweep (Box2D.Common.Math.b2Sweep)
package Box2D.Common.Math {
import Box2D.Common.*;
public class b2Sweep {
public var localCenter:b2Vec2;
public var a:Number;
public var c:b2Vec2;
public var a0:Number;
public var c0:b2Vec2;
public var t0:Number;
public function b2Sweep(){
localCenter = new b2Vec2();
c0 = new b2Vec2();
c = new b2Vec2();
super();
}
public function Advance(_arg1:Number):void{
var _local2:Number;
if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){
_local2 = ((_arg1 - t0) / (1 - t0));
c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x));
c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y));
a0 = (((1 - _local2) * a0) + (_local2 * a));
t0 = _arg1;
};
}
public function GetXForm(_arg1:b2XForm, _arg2:Number):void{
var _local4:Number;
var _local5:Number;
if ((1 - t0) > Number.MIN_VALUE){
_local4 = ((_arg2 - t0) / (1 - t0));
_arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x));
_arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y));
_local5 = (((1 - _local4) * a0) + (_local4 * a));
_arg1.R.Set(_local5);
} else {
_arg1.position.SetV(c);
_arg1.R.Set(a);
};
var _local3:b2Mat22 = _arg1.R;
_arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y)));
_arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y)));
}
}
}//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2)
package Box2D.Common.Math {
import Box2D.Common.*;
public class b2Vec2 {
public var y:Number;
public var x:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function LengthSquared():Number{
return (((x * x) + (y * y)));
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function SetZero():void{
x = 0;
y = 0;
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function Normalize():Number{
var _local1:Number = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
var _local2:Number = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function CrossVF(_arg1:Number):void{
var _local2:Number = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function CrossFV(_arg1:Number):void{
var _local2:Number = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm)
package Box2D.Common.Math {
import Box2D.Common.*;
public class b2XForm {
public var position:b2Vec2;
public var R:b2Mat22;
public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{
position = new b2Vec2();
R = new b2Mat22();
super();
if (_arg1){
position.SetV(_arg1);
R.SetM(_arg2);
};
}
public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{
position.SetV(_arg1);
R.SetM(_arg2);
}
public function Set(_arg1:b2XForm):void{
position.SetV(_arg1.position);
R.SetM(_arg1.R);
}
public function SetIdentity():void{
position.SetZero();
R.SetIdentity();
}
}
}//package Box2D.Common.Math
Section 35
//b2Color (Box2D.Common.b2Color)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Color {
private var _r:uint;// = 0
private var _g:uint;// = 0
private var _b:uint;// = 0
public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function set b(_arg1:Number):void{
_b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function get color():uint{
return (((_r | (_g << 8)) | (_b << 16)));
}
public function set r(_arg1:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set g(_arg1:Number):void{
_g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
}
}//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static const b2_linearSleepTolerance:Number = 0.01;
public static const b2_angularSlop:Number = 0.0349065850398866;
public static const b2_linearSlop:Number = 0.005;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_maxProxies:int = 0x0200;
public static const b2_maxAngularVelocitySquared:Number = 62500;
public static const b2_maxPolygonVertices:int = 8;
public static const b2_velocityThreshold:Number = 1;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_maxPairs:int = 4096;
public static const b2_maxTOIContactsPerIsland:int = 32;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_maxAngularVelocity:Number = 250;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_maxLinearVelocity:Number = 200;
public static const b2_maxLinearCorrection:Number = 0.2;
public static const b2_toiSlop:Number = 0.04;
public static const b2_maxLinearVelocitySquared:Number = 40000;
public static function b2Assert(_arg1:Boolean):void{
var _local2:b2Vec2;
if (!(_arg1)){
_local2.x++;
};
}
}
}//package Box2D.Common
Section 37
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
import Box2D.Common.Math.*;
public class b2CircleContact extends b2Contact {
private var m_manifolds:Array;
public var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
var _local3:b2ManifoldPoint = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local8:b2ManifoldPoint;
var _local5:b2Body = m_shape1.m_body;
var _local6:b2Body = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf);
var _local7:b2ContactPoint = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
m_manifoldCount = 1;
_local8 = m_manifold.points[0];
if (m0.pointCount == 0){
_local8.normalImpulse = 0;
_local8.tangentImpulse = 0;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Add(_local7);
};
} else {
_local4 = m0.points[0];
_local8.normalImpulse = _local4.normalImpulse;
_local8.tangentImpulse = _local4.tangentImpulse;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Persist(_local7);
};
};
} else {
m_manifoldCount = 0;
if ((((m0.pointCount > 0)) && (_arg1))){
_local4 = m0.points[0];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2CircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Contact {
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_prev:b2Contact;
public var m_toi:Number;
public var m_next:b2Contact;
public var m_friction:Number;
public var m_manifoldCount:int;
public var m_node1:b2ContactEdge;
public var m_node2:b2ContactEdge;
public var m_restitution:Number;
public var m_flags:uint;
public static var e_toiFlag:uint = 8;
public static var e_nonSolidFlag:uint = 1;
public static var e_slowFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var s_registers:Array;
public static var s_initialized:Boolean = false;
public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){
m_node1 = new b2ContactEdge();
m_node2 = new b2ContactEdge();
super();
m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
m_shape1 = null;
m_shape2 = null;
return;
};
if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){
m_flags = (m_flags | e_nonSolidFlag);
};
m_shape1 = _arg1;
m_shape2 = _arg2;
m_manifoldCount = 0;
m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction));
m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution);
m_prev = null;
m_next = null;
m_node1.contact = null;
m_node1.prev = null;
m_node1.next = null;
m_node1.other = null;
m_node2.contact = null;
m_node2.prev = null;
m_node2.next = null;
m_node2.other = null;
}
public function IsSolid():Boolean{
return (((m_flags & e_nonSolidFlag) == 0));
}
public function GetShape1():b2Shape{
return (m_shape1);
}
public function GetShape2():b2Shape{
return (m_shape2);
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetManifoldCount():int{
return (m_manifoldCount);
}
public function GetManifolds():Array{
return (null);
}
public function Update(_arg1:b2ContactListener):void{
var _local2:int = m_manifoldCount;
Evaluate(_arg1);
var _local3:int = m_manifoldCount;
var _local4:b2Body = m_shape1.m_body;
var _local5:b2Body = m_shape2.m_body;
if ((((_local3 == 0)) && ((_local2 > 0)))){
_local4.WakeUp();
_local5.WakeUp();
};
if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){
m_flags = (m_flags & ~(e_slowFlag));
} else {
m_flags = (m_flags | e_slowFlag);
};
}
public function Evaluate(_arg1:b2ContactListener):void{
}
public static function InitializeRegisters():void{
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
var _local1:int;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_registers[_local1][_local2] = new b2ContactRegister();
_local2++;
};
_local1++;
};
AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape);
AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape);
AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
if (_arg1.m_manifoldCount > 0){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
var _local3:int = _arg1.m_shape1.m_type;
var _local4:int = _arg1.m_shape2.m_type;
var _local5:b2ContactRegister = s_registers[_local3][_local4];
var _local6:Function = _local5.destroyFcn;
_local6(_arg1, _arg2);
}
public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{
s_registers[_arg3][_arg4].createFcn = _arg1;
s_registers[_arg3][_arg4].destroyFcn = _arg2;
s_registers[_arg3][_arg4].primary = true;
if (_arg3 != _arg4){
s_registers[_arg4][_arg3].createFcn = _arg1;
s_registers[_arg4][_arg3].destroyFcn = _arg2;
s_registers[_arg4][_arg3].primary = false;
};
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local8:b2Contact;
var _local9:int;
var _local10:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
var _local4:int = _arg1.m_type;
var _local5:int = _arg2.m_type;
var _local6:b2ContactRegister = s_registers[_local4][_local5];
var _local7:Function = _local6.createFcn;
if (_local7 != null){
if (_local6.primary){
return (_local7(_arg1, _arg2, _arg3));
};
_local8 = _local7(_arg2, _arg1, _arg3);
_local9 = 0;
while (_local9 < _local8.m_manifoldCount) {
_local10 = _local8.GetManifolds()[_local9];
_local10.normal = _local10.normal.Negative();
_local9++;
};
return (_local8);
//unresolved jump
};
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 39
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var normal:b2Vec2;
public var restitution:Number;
public var body1:b2Body;
public var manifold:b2Manifold;
public var body2:b2Body;
public var friction:Number;
public var pointCount:int;
public function b2ContactConstraint(){
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var r2:b2Vec2;
public var separation:Number;
public var positionImpulse:Number;
public var normalImpulse:Number;
public var tangentMass:Number;
public var equalizedMass:Number;
public var tangentImpulse:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var normalMass:Number;
public var velocityBias:Number;
public var r1:b2Vec2;
public function b2ContactConstraintPoint(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
r1 = new b2Vec2();
r2 = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2ContactEdge {
public var other:b2Body;
public var prev:b2ContactEdge;
public var contact:b2Contact;
public var next:b2ContactEdge;
}
}//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var primary:Boolean;
public var createFcn:Function;
public var destroyFcn:Function;
}
}//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class b2ContactResult {
public var position:b2Vec2;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var normalImpulse:Number;
public var normal:b2Vec2;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ContactResult(){
position = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactSolver {
public var m_constraintCount:int;
public var m_constraints:Array;
public var m_allocator;
public var m_step:b2TimeStep;
public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){
var _local5:b2Contact;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _local10:b2Body;
var _local11:b2Body;
var _local12:int;
var _local13:Array;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:int;
var _local23:b2Manifold;
var _local24:Number;
var _local25:Number;
var _local26:b2ContactConstraint;
var _local27:uint;
var _local28:b2ManifoldPoint;
var _local29:b2ContactConstraintPoint;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:Number;
var _local44:Number;
var _local45:Number;
var _local46:Number;
var _local47:Number;
m_step = new b2TimeStep();
m_constraints = new Array();
super();
m_step.dt = _arg1.dt;
m_step.inv_dt = _arg1.inv_dt;
m_step.maxIterations = _arg1.maxIterations;
m_allocator = _arg4;
m_constraintCount = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
m_constraintCount = (m_constraintCount + _local5.m_manifoldCount);
_local6++;
};
_local6 = 0;
while (_local6 < m_constraintCount) {
m_constraints[_local6] = new b2ContactConstraint();
_local6++;
};
var _local9:int;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
_local10 = _local5.m_shape1.m_body;
_local11 = _local5.m_shape2.m_body;
_local12 = _local5.m_manifoldCount;
_local13 = _local5.GetManifolds();
_local14 = _local5.m_friction;
_local15 = _local5.m_restitution;
_local16 = _local10.m_linearVelocity.x;
_local17 = _local10.m_linearVelocity.y;
_local18 = _local11.m_linearVelocity.x;
_local19 = _local11.m_linearVelocity.y;
_local20 = _local10.m_angularVelocity;
_local21 = _local11.m_angularVelocity;
_local22 = 0;
while (_local22 < _local12) {
_local23 = _local13[_local22];
_local24 = _local23.normal.x;
_local25 = _local23.normal.y;
_local26 = m_constraints[_local9];
_local26.body1 = _local10;
_local26.body2 = _local11;
_local26.manifold = _local23;
_local26.normal.x = _local24;
_local26.normal.y = _local25;
_local26.pointCount = _local23.pointCount;
_local26.friction = _local14;
_local26.restitution = _local15;
_local27 = 0;
while (_local27 < _local26.pointCount) {
_local28 = _local23.points[_local27];
_local29 = _local26.points[_local27];
_local29.normalImpulse = _local28.normalImpulse;
_local29.tangentImpulse = _local28.tangentImpulse;
_local29.separation = _local28.separation;
_local29.positionImpulse = 0;
_local29.localAnchor1.SetV(_local28.localPoint1);
_local29.localAnchor2.SetV(_local28.localPoint2);
_local8 = _local10.m_xf.R;
_local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x);
_local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33));
_local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33));
_local32 = _local30;
_local29.r1.Set(_local32, _local33);
_local8 = _local11.m_xf.R;
_local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x);
_local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35));
_local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35));
_local34 = _local30;
_local29.r2.Set(_local34, _local35);
_local36 = ((_local32 * _local32) + (_local33 * _local33));
_local37 = ((_local34 * _local34) + (_local35 * _local35));
_local38 = ((_local32 * _local24) + (_local33 * _local25));
_local39 = ((_local34 * _local24) + (_local35 * _local25));
_local40 = (_local10.m_invMass + _local11.m_invMass);
_local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39)))));
_local29.normalMass = (1 / _local40);
_local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass));
_local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39)))));
_local29.equalizedMass = (1 / _local41);
_local42 = _local25;
_local43 = -(_local24);
_local44 = ((_local32 * _local42) + (_local33 * _local43));
_local45 = ((_local34 * _local42) + (_local35 * _local43));
_local46 = (_local10.m_invMass + _local11.m_invMass);
_local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45)))));
_local29.tangentMass = (1 / _local46);
_local29.velocityBias = 0;
if (_local29.separation > 0){
_local29.velocityBias = (-60 * _local29.separation);
};
_local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33));
_local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32));
_local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31));
if (_local47 < -(b2Settings.b2_velocityThreshold)){
_local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47));
};
_local27++;
};
_local9++;
_local22++;
};
_local6++;
};
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:b2ContactConstraintPoint;
var _local21:Number;
var _local22:Number;
var _local23:b2ContactConstraintPoint;
var _local5:int;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_invMass;
_local10 = _local7.m_invI;
_local11 = _local8.m_invMass;
_local12 = _local8.m_invI;
_local13 = _local6.normal.x;
_local14 = _local6.normal.y;
_local15 = _local14;
_local16 = -(_local13);
if (_arg1.warmStarting){
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local20 = _local6.points[_local18];
_local20.normalImpulse = (_local20.normalImpulse * _arg1.dtRatio);
_local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio);
_local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15));
_local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16));
_local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.r1.x * _local22) - (_local20.r1.y * _local21))));
_local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21));
_local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22));
_local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.r2.x * _local22) - (_local20.r2.y * _local21))));
_local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21));
_local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22));
_local18++;
};
} else {
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local23 = _local6.points[_local18];
_local23.normalImpulse = 0;
_local23.tangentImpulse = 0;
_local18++;
};
};
_local5++;
};
}
public function SolvePositionConstraints(_arg1:Number):Boolean{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:b2Vec2;
var _local10:Number;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:int;
var _local20:int;
var _local21:b2ContactConstraintPoint;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local2:Number = 0;
var _local5:int;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_sweep.c;
_local10 = _local7.m_sweep.a;
_local11 = _local8.m_sweep.c;
_local12 = _local8.m_sweep.a;
_local13 = (_local7.m_mass * _local7.m_invMass);
_local14 = (_local7.m_mass * _local7.m_invI);
_local15 = (_local8.m_mass * _local8.m_invMass);
_local16 = (_local8.m_mass * _local8.m_invI);
_local17 = _local6.normal.x;
_local18 = _local6.normal.y;
_local19 = _local6.pointCount;
_local20 = 0;
while (_local20 < _local19) {
_local21 = _local6.points[_local20];
_local3 = _local7.m_xf.R;
_local4 = _local7.m_sweep.localCenter;
_local22 = (_local21.localAnchor1.x - _local4.x);
_local23 = (_local21.localAnchor1.y - _local4.y);
_local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23));
_local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23));
_local22 = _local26;
_local3 = _local8.m_xf.R;
_local4 = _local8.m_sweep.localCenter;
_local24 = (_local21.localAnchor2.x - _local4.x);
_local25 = (_local21.localAnchor2.y - _local4.y);
_local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25));
_local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25));
_local24 = _local26;
_local27 = (_local9.x + _local22);
_local28 = (_local9.y + _local23);
_local29 = (_local11.x + _local24);
_local30 = (_local11.y + _local25);
_local31 = (_local29 - _local27);
_local32 = (_local30 - _local28);
_local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation);
_local2 = b2Math.b2Min(_local2, _local33);
_local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0));
_local35 = (-(_local21.equalizedMass) * _local34);
_local36 = _local21.positionImpulse;
_local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0);
_local35 = (_local21.positionImpulse - _local36);
_local37 = (_local35 * _local17);
_local38 = (_local35 * _local18);
_local9.x = (_local9.x - (_local13 * _local37));
_local9.y = (_local9.y - (_local13 * _local38));
_local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37))));
_local7.m_sweep.a = _local10;
_local7.SynchronizeTransform();
_local11.x = (_local11.x + (_local15 * _local37));
_local11.y = (_local11.y + (_local15 * _local38));
_local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37))));
_local8.m_sweep.a = _local12;
_local8.SynchronizeTransform();
_local20++;
};
_local5++;
};
return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop)));
}
public function SolveVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraintPoint;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:b2Mat22;
var _local18:b2Vec2;
var _local20:b2ContactConstraint;
var _local21:b2Body;
var _local22:b2Body;
var _local23:Number;
var _local24:Number;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:int;
var _local38:Number;
var _local19:int;
while (_local19 < m_constraintCount) {
_local20 = m_constraints[_local19];
_local21 = _local20.body1;
_local22 = _local20.body2;
_local23 = _local21.m_angularVelocity;
_local24 = _local22.m_angularVelocity;
_local25 = _local21.m_linearVelocity;
_local26 = _local22.m_linearVelocity;
_local27 = _local21.m_invMass;
_local28 = _local21.m_invI;
_local29 = _local22.m_invMass;
_local30 = _local22.m_invI;
_local31 = _local20.normal.x;
_local32 = _local20.normal.y;
_local33 = _local32;
_local34 = -(_local31);
_local35 = _local20.friction;
_local37 = _local20.pointCount;
_local1 = 0;
while (_local1 < _local37) {
_local2 = _local20.points[_local1];
_local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y));
_local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x));
_local9 = ((_local7 * _local31) + (_local8 * _local32));
_local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias));
_local10 = ((_local7 * _local33) + (_local8 * _local34));
_local12 = (_local2.tangentMass * -(_local10));
_local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0);
_local11 = (_local13 - _local2.normalImpulse);
_local38 = (_local35 * _local2.normalImpulse);
_local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38);
_local12 = (_local14 - _local2.tangentImpulse);
_local15 = ((_local11 * _local31) + (_local12 * _local33));
_local16 = ((_local11 * _local32) + (_local12 * _local34));
_local25.x = (_local25.x - (_local27 * _local15));
_local25.y = (_local25.y - (_local27 * _local16));
_local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15))));
_local26.x = (_local26.x + (_local29 * _local15));
_local26.y = (_local26.y + (_local29 * _local16));
_local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15))));
_local2.normalImpulse = _local13;
_local2.tangentImpulse = _local14;
_local1++;
};
_local21.m_angularVelocity = _local23;
_local22.m_angularVelocity = _local24;
_local19++;
};
}
public function FinalizeVelocityConstraints():void{
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
var _local1:int;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2NullContact extends b2Contact {
override public function Evaluate(_arg1:b2ContactListener):void{
}
override public function GetManifolds():Array{
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
import Box2D.Common.Math.*;
public class b2PolyAndCircleContact extends b2Contact {
private var m_manifolds:Array;
public var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape));
b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape));
m_manifold.pointCount = 0;
var _local3:b2ManifoldPoint = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2ManifoldPoint;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local6:b2Body = m_shape1.m_body;
var _local7:b2Body = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf);
var _local8:Array = [false, false];
var _local9:b2ContactPoint = s_evalCP;
_local9.shape1 = m_shape1;
_local9.shape2 = m_shape2;
_local9.friction = m_friction;
_local9.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local2 = 0;
while (_local2 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local2];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local8[_local13] == true){
} else {
_local5 = m0.points[_local13];
if (_local5.id._key == _local12){
_local8[_local13] = true;
_local10.normalImpulse = _local5.normalImpulse;
_local10.tangentImpulse = _local5.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Persist(_local9);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Add(_local9);
};
_local2++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local2 = 0;
while (_local2 < m0.pointCount) {
if (_local8[_local2]){
} else {
_local5 = m0.points[_local2];
_local9.position = _local6.GetWorldPoint(_local5.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m0.normal);
_local9.separation = _local5.separation;
_local9.id.key = _local5.id._key;
_arg1.Remove(_local9);
};
_local2++;
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndCircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
import Box2D.Common.Math.*;
public class b2PolygonContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{
m0 = new b2Manifold();
m_manifolds = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local7:b2ContactPoint;
var _local8:int;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local5:b2Body = m_shape1.m_body;
var _local6:b2Body = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf);
var _local9:Array = [false, false];
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local8 = 0;
while (_local8 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local8];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local9[_local13] == true){
} else {
_local4 = m0.points[_local13];
if (_local4.id._key == _local12){
_local9[_local13] = true;
_local10.normalImpulse = _local4.normalImpulse;
_local10.tangentImpulse = _local4.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Persist(_local7);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Add(_local7);
};
_local8++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local8 = 0;
while (_local8 < m0.pointCount) {
if (_local9[_local8]){
} else {
_local4 = m0.points[_local8];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
_local8++;
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolygonContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Dynamics.*;
public class b2DistanceJoint extends b2Joint {
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_bias:Number;
public var m_gamma:Number;
public var m_u:b2Vec2;
public var m_mass:Number;
public var m_impulse:Number;
public var m_dampingRatio:Number;
public var m_frequencyHz:Number;
public var m_length:Number;
public function b2DistanceJoint(_arg1:b2DistanceJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u = new b2Vec2();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_length = _arg1.length;
m_frequencyHz = _arg1.frequencyHz;
m_dampingRatio = _arg1.dampingRatio;
m_impulse = 0;
m_gamma = 0;
m_bias = 0;
m_inv_dt = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local8:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
m_inv_dt = _arg1.inv_dt;
_local4 = m_body1;
_local5 = m_body2;
_local2 = _local4.m_xf.R;
_local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7));
_local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7));
_local6 = _local3;
_local2 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6);
m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7);
var _local10:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y)));
if (_local10 > b2Settings.b2_linearSlop){
m_u.Multiply((1 / _local10));
} else {
m_u.SetZero();
};
var _local11:Number = ((_local6 * m_u.y) - (_local7 * m_u.x));
var _local12:Number = ((_local8 * m_u.y) - (_local9 * m_u.x));
var _local13:Number = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12));
m_mass = (1 / _local13);
if (m_frequencyHz > 0){
_local14 = (_local10 - m_length);
_local15 = ((2 * Math.PI) * m_frequencyHz);
_local16 = (((2 * m_mass) * m_dampingRatio) * _local15);
_local17 = ((m_mass * _local15) * _local15);
m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17))));
m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma);
m_mass = (1 / (_local13 + m_gamma));
};
if (_arg1.warmStarting){
m_impulse = (m_impulse * _arg1.dtRatio);
_local18 = (m_impulse * m_u.x);
_local19 = (m_impulse * m_u.y);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19));
_local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18))));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19));
_local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18))));
} else {
m_impulse = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = new b2Vec2();
_local1.SetV(m_u);
_local1.Multiply((m_inv_dt * m_impulse));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
if (m_frequencyHz > 0){
return (true);
};
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local1 = _local2.m_xf.R;
var _local4:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local5:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local6:Number = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5));
_local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5));
_local4 = _local6;
_local1 = _local3.m_xf.R;
var _local7:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8));
_local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8));
_local7 = _local6;
var _local9:Number = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4);
var _local10:Number = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5);
var _local11:Number = Math.sqrt(((_local9 * _local9) + (_local10 * _local10)));
_local9 = (_local9 / _local11);
_local10 = (_local10 / _local11);
var _local12:Number = (_local11 - m_length);
_local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local13:Number = (-(m_mass) * _local12);
m_u.Set(_local9, _local10);
var _local14:Number = (_local13 * m_u.x);
var _local15:Number = (_local13 * m_u.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14))));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15));
_local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14))));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
_local2 = _local3.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
var _local7:Number = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6));
_local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6));
_local5 = _local7;
_local2 = _local4.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6));
var _local11:Number = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5));
var _local12:Number = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9));
var _local13:Number = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8));
var _local14:Number = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11)));
var _local15:Number = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse)));
m_impulse = (m_impulse + _local15);
var _local16:Number = (_local15 * m_u.x);
var _local17:Number = (_local15 * m_u.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16))));
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17));
_local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
}
}
}//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2DistanceJointDef extends b2JointDef {
public var localAnchor1:b2Vec2;
public var length:Number;
public var dampingRatio:Number;
public var localAnchor2:b2Vec2;
public var frequencyHz:Number;
public function b2DistanceJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_distanceJoint;
length = 1;
frequencyHz = 0;
dampingRatio = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1.SetV(body1.GetLocalPoint(_arg3));
localAnchor2.SetV(body2.GetLocalPoint(_arg4));
var _local5:Number = (_arg4.x - _arg3.x);
var _local6:Number = (_arg4.y - _arg3.y);
length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
frequencyHz = 0;
dampingRatio = 0;
}
}
}//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Dynamics.*;
public class b2GearJoint extends b2Joint {
public var m_ground2:b2Body;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_ratio:Number;
public var m_revolute2:b2RevoluteJoint;
public var m_force:Number;
public var m_mass:Number;
public var m_prismatic2:b2PrismaticJoint;
public var m_ground1:b2Body;
public var m_revolute1:b2RevoluteJoint;
public var m_prismatic1:b2PrismaticJoint;
public var m_constant:Number;
public var m_J:b2Jacobian;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local4:Number;
var _local5:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_J = new b2Jacobian();
super(_arg1);
var _local2:int = _arg1.joint1.m_type;
var _local3:int = _arg1.joint2.m_type;
m_revolute1 = null;
m_prismatic1 = null;
m_revolute2 = null;
m_prismatic2 = null;
m_ground1 = _arg1.joint1.m_body1;
m_body1 = _arg1.joint1.m_body2;
if (_local2 == b2Joint.e_revoluteJoint){
m_revolute1 = (_arg1.joint1 as b2RevoluteJoint);
m_groundAnchor1.SetV(m_revolute1.m_localAnchor1);
m_localAnchor1.SetV(m_revolute1.m_localAnchor2);
_local4 = m_revolute1.GetJointAngle();
} else {
m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint);
m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1);
m_localAnchor1.SetV(m_prismatic1.m_localAnchor2);
_local4 = m_prismatic1.GetJointTranslation();
};
m_ground2 = _arg1.joint2.m_body1;
m_body2 = _arg1.joint2.m_body2;
if (_local3 == b2Joint.e_revoluteJoint){
m_revolute2 = (_arg1.joint2 as b2RevoluteJoint);
m_groundAnchor2.SetV(m_revolute2.m_localAnchor1);
m_localAnchor2.SetV(m_revolute2.m_localAnchor2);
_local5 = m_revolute2.GetJointAngle();
} else {
m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint);
m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1);
m_localAnchor2.SetV(m_prismatic2.m_localAnchor2);
_local5 = m_prismatic2.GetJointTranslation();
};
m_ratio = _arg1.ratio;
m_constant = (_local4 + (m_ratio * _local5));
m_force = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local15:Number;
var _local2:b2Body = m_ground1;
var _local3:b2Body = m_ground2;
var _local4:b2Body = m_body1;
var _local5:b2Body = m_body2;
var _local14:Number = 0;
m_J.SetZero();
if (m_revolute1){
m_J.angular1 = -1;
_local14 = (_local14 + _local4.m_invI);
} else {
_local10 = _local2.m_xf.R;
_local11 = m_prismatic1.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local4.m_xf.R;
_local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear1.Set(-(_local6), -(_local7));
m_J.angular1 = -(_local12);
_local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12)));
};
if (m_revolute2){
m_J.angular2 = -(m_ratio);
_local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI));
} else {
_local10 = _local3.m_xf.R;
_local11 = m_prismatic2.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7));
m_J.angular2 = (-(m_ratio) * _local12);
_local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12))));
};
m_mass = (1 / _local14);
if (_arg1.warmStarting){
_local15 = (_arg1.dt * m_force);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2));
} else {
m_force = 0;
};
}
override public function GetReactionTorque():Number{
var _local1:b2Mat22 = m_body2.m_xf.R;
var _local2:Number = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x);
var _local3:Number = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y);
var _local4:Number = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3));
_local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3));
_local2 = _local4;
_local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x))));
return (_local4);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local4:Number;
var _local5:Number;
var _local1:Number = 0;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
if (m_revolute1){
_local4 = m_revolute1.GetJointAngle();
} else {
_local4 = m_prismatic1.GetJointTranslation();
};
if (m_revolute2){
_local5 = m_revolute2.GetJointAngle();
} else {
_local5 = m_prismatic2.GetJointTranslation();
};
var _local6:Number = (m_constant - (_local4 + (m_ratio * _local5)));
var _local7:Number = (-(m_mass) * _local6);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y));
_local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((_local1 < b2Settings.b2_linearSlop));
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local5:Number = ((-(_arg1.inv_dt) * m_mass) * _local4);
m_force = (m_force + _local5);
var _local6:Number = (_arg1.dt * _local5);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2));
}
}
}//package Box2D.Dynamics.Joints
Section 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2GearJointDef extends b2JointDef {
public var joint1:b2Joint;
public var joint2:b2Joint;
public var ratio:Number;
public function b2GearJointDef(){
type = b2Joint.e_gearJoint;
joint1 = null;
joint2 = null;
ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2Jacobian {
public var linear1:b2Vec2;
public var linear2:b2Vec2;
public var angular1:Number;
public var angular2:Number;
public function b2Jacobian(){
linear1 = new b2Vec2();
linear2 = new b2Vec2();
super();
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linear1.SetV(_arg1);
angular1 = _arg2;
linear2.SetV(_arg3);
angular2 = _arg4;
}
public function SetZero():void{
linear1.SetZero();
angular1 = 0;
linear2.SetZero();
angular2 = 0;
}
public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{
return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4)));
}
}
}//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Dynamics.*;
public class b2Joint {
public var m_islandFlag:Boolean;
public var m_body1:b2Body;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_type:int;
public var m_collideConnected:Boolean;
public var m_node1:b2JointEdge;
public var m_node2:b2JointEdge;
public var m_inv_dt:Number;
public var m_userData;
public var m_body2:b2Body;
public static const e_unknownJoint:int = 0;
public static const e_inactiveLimit:int = 0;
public static const e_atUpperLimit:int = 2;
public static const e_atLowerLimit:int = 1;
public static const e_gearJoint:int = 6;
public static const e_revoluteJoint:int = 1;
public static const e_equalLimits:int = 3;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_prismaticJoint:int = 2;
public static const e_mouseJoint:int = 5;
public function b2Joint(_arg1:b2JointDef){
m_node1 = new b2JointEdge();
m_node2 = new b2JointEdge();
super();
m_type = _arg1.type;
m_prev = null;
m_next = null;
m_body1 = _arg1.body1;
m_body2 = _arg1.body2;
m_collideConnected = _arg1.collideConnected;
m_islandFlag = false;
m_userData = _arg1.userData;
}
public function GetBody2():b2Body{
return (m_body2);
}
public function GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetType():int{
return (m_type);
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
}
public function GetReactionTorque():Number{
return (0);
}
public function GetUserData(){
return (m_userData);
}
public function GetReactionForce():b2Vec2{
return (null);
}
public function SolvePositionConstraints():Boolean{
return (false);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetBody1():b2Body{
return (m_body1);
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function InitPositionConstraints():void{
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
switch (_arg1.type){
case e_distanceJoint:
_local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef));
break;
case e_mouseJoint:
_local3 = new b2MouseJoint((_arg1 as b2MouseJointDef));
break;
case e_prismaticJoint:
_local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef));
break;
case e_revoluteJoint:
_local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef));
break;
case e_pulleyJoint:
_local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef));
break;
case e_gearJoint:
_local3 = new b2GearJoint((_arg1 as b2GearJointDef));
break;
default:
break;
};
return (_local3);
}
}
}//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2JointDef {
public var body2:b2Body;
public var type:int;
public var userData;
public var collideConnected:Boolean;
public var body1:b2Body;
public function b2JointDef(){
type = b2Joint.e_unknownJoint;
userData = null;
body1 = null;
body2 = null;
collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointEdge {
public var other:b2Body;
public var next:b2JointEdge;
public var prev:b2JointEdge;
public var joint:b2Joint;
}
}//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Dynamics.*;
public class b2MouseJoint extends b2Joint {
private var K1:b2Mat22;
private var K:b2Mat22;
public var m_beta:Number;
public var m_mass:b2Mat22;
private var K2:b2Mat22;
public var m_target:b2Vec2;
public var m_gamma:Number;
public var m_impulse:b2Vec2;
public var m_C:b2Vec2;
public var m_localAnchor:b2Vec2;
public var m_maxForce:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
var _local3:Number;
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
m_localAnchor = new b2Vec2();
m_target = new b2Vec2();
m_impulse = new b2Vec2();
m_mass = new b2Mat22();
m_C = new b2Vec2();
super(_arg1);
m_target.SetV(_arg1.target);
var _local2:Number = (m_target.x - m_body2.m_xf.position.x);
_local3 = (m_target.y - m_body2.m_xf.position.y);
var _local4:b2Mat22 = m_body2.m_xf.R;
m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y));
m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y));
m_maxForce = _arg1.maxForce;
m_impulse.SetZero();
var _local5:Number = m_body2.m_mass;
var _local6:Number = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
var _local7:Number = (((2 * _local5) * _arg1.dampingRatio) * _local6);
var _local8:Number = ((_arg1.timeStep * _local5) * (_local6 * _local6));
m_gamma = (1 / (_local7 + _local8));
m_beta = (_local8 / (_local7 + _local8));
}
public function SetTarget(_arg1:b2Vec2):void{
if (m_body2.IsSleeping()){
m_body2.WakeUp();
};
m_target = _arg1;
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local7:Number;
var _local8:Number;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local7 = _local2.m_invMass;
_local8 = _local2.m_invI;
K1.col1.x = _local7;
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = _local7;
K2.col1.x = ((_local8 * _local5) * _local5);
K2.col2.x = ((-(_local8) * _local4) * _local5);
K2.col1.y = ((-(_local8) * _local4) * _local5);
K2.col2.y = ((_local8 * _local4) * _local4);
K.SetM(K1);
K.AddM(K2);
K.col1.x = (K.col1.x + m_gamma);
K.col2.y = (K.col2.y + m_gamma);
K.Invert(m_mass);
m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x);
m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y);
_local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98);
var _local9:Number = (_arg1.dt * m_impulse.x);
var _local10:Number = (_arg1.dt * m_impulse.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9))));
}
override public function GetAnchor1():b2Vec2{
return (m_target);
}
override public function GetReactionTorque():Number{
return (0);
}
override public function GetReactionForce():b2Vec2{
return (m_impulse);
}
override public function SolvePositionConstraints():Boolean{
return (true);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local2:b2Body = m_body2;
_local3 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7));
_local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7));
_local6 = _local4;
var _local8:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7));
var _local9:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6));
_local3 = m_mass;
_local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x));
_local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y));
var _local10:Number = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)));
var _local11:Number = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)));
var _local12:Number = m_impulse.x;
var _local13:Number = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
var _local14:Number = m_impulse.Length();
if (_local14 > m_maxForce){
m_impulse.Multiply((m_maxForce / _local14));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
var _local15:Number = (_arg1.dt * _local10);
var _local16:Number = (_arg1.dt * _local11);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
}
}
}//package Box2D.Dynamics.Joints
Section 57
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2MouseJointDef extends b2JointDef {
public var timeStep:Number;
public var target:b2Vec2;
public var maxForce:Number;
public var dampingRatio:Number;
public var frequencyHz:Number;
public function b2MouseJointDef(){
target = new b2Vec2();
super();
type = b2Joint.e_mouseJoint;
maxForce = 0;
frequencyHz = 5;
dampingRatio = 0.7;
timeStep = (1 / 60);
}
}
}//package Box2D.Dynamics.Joints
Section 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PrismaticJoint extends b2Joint {
public var m_limitForce:Number;
public var m_lowerTranslation:Number;
public var m_localXAxis1:b2Vec2;
public var m_refAngle:Number;
public var m_torque:Number;
public var m_motorForce:Number;
public var m_enableLimit:Boolean;
public var m_angularMass:Number;
public var m_maxMotorForce:Number;
public var m_localYAxis1:b2Vec2;
public var m_force:Number;
public var m_motorMass:Number;
public var m_upperTranslation:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_limitState:int;
public var m_linearMass:Number;
public var m_motorJacobian:b2Jacobian;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_enableMotor:Boolean;
public var m_linearJacobian:b2Jacobian;
public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_localXAxis1 = new b2Vec2();
m_localYAxis1 = new b2Vec2();
m_linearJacobian = new b2Jacobian();
m_motorJacobian = new b2Jacobian();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_localXAxis1.SetV(_arg1.localAxis1);
m_localYAxis1.x = -(m_localXAxis1.y);
m_localYAxis1.y = m_localXAxis1.x;
m_refAngle = _arg1.referenceAngle;
m_linearJacobian.SetZero();
m_linearMass = 0;
m_force = 0;
m_angularMass = 0;
m_torque = 0;
m_motorJacobian.SetZero();
m_motorMass = 0;
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerTranslation = _arg1.lowerTranslation;
m_upperTranslation = _arg1.upperTranslation;
m_maxMotorForce = _arg1.maxMotorForce;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local8:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = _local2.m_invMass;
var _local5:Number = _local3.m_invMass;
var _local6:Number = _local2.m_invI;
var _local7:Number = _local3.m_invI;
var _local9:Number = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local10:Number = ((-(_arg1.inv_dt) * m_linearMass) * _local9);
m_force = (m_force + _local10);
var _local11:Number = (_arg1.dt * _local10);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2));
var _local12:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity);
var _local13:Number = ((-(_arg1.inv_dt) * m_angularMass) * _local12);
m_torque = (m_torque + _local13);
var _local14:Number = (_arg1.dt * _local13);
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed);
_local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15);
_local17 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce);
_local16 = (m_motorForce - _local17);
_local11 = (_arg1.dt * _local16);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local19);
} else {
if (m_limitState == e_atLowerLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
} else {
if (m_limitState == e_atUpperLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
};
};
};
_local11 = (_arg1.dt * _local19);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function GetUpperLimit():Number{
return (m_upperTranslation);
}
public function GetLowerLimit():Number{
return (m_lowerTranslation);
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetJointTranslation():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
var _local4:b2Vec2 = _local1.GetWorldPoint(m_localAnchor1);
var _local5:b2Vec2 = _local2.GetWorldPoint(m_localAnchor2);
var _local6:Number = (_local5.x - _local4.x);
var _local7:Number = (_local5.y - _local4.y);
var _local8:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local9:Number = ((_local8.x * _local6) + (_local8.y * _local7));
return (_local9);
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Mat22 = m_body1.m_xf.R;
var _local2:Number = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y)));
var _local3:Number = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y)));
var _local4:Number = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y)));
var _local5:Number = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y)));
return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5))));
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local9:b2Mat22;
var _local10:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = _local3.m_invMass;
var _local6:Number = _local4.m_invMass;
var _local7:Number = _local3.m_invI;
var _local8:Number = _local4.m_invI;
_local9 = _local3.m_xf.R;
var _local11:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local12:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
var _local13:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local14:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
var _local15:Number = (_local3.m_sweep.c.x + _local11);
var _local16:Number = (_local3.m_sweep.c.y + _local12);
var _local17:Number = (_local4.m_sweep.c.x + _local13);
var _local18:Number = (_local4.m_sweep.c.y + _local14);
var _local19:Number = (_local17 - _local15);
var _local20:Number = (_local18 - _local16);
_local9 = _local3.m_xf.R;
var _local21:Number = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
var _local22:Number = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
var _local23:Number = ((_local21 * _local19) + (_local22 * _local20));
_local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local24:Number = (-(m_linearMass) * _local23);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2));
var _local25:Number = b2Math.b2Abs(_local23);
var _local26:Number = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle);
_local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
var _local27:Number = (-(m_angularMass) * _local26);
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
var _local28:Number = b2Math.b2Abs(_local26);
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y));
_local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y));
_local31 = ((_local29 * _local19) + (_local30 * _local20));
_local32 = 0;
if (m_limitState == e_equalLimits){
_local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26));
} else {
if (m_limitState == e_atLowerLimit){
_local1 = (_local31 - m_lowerTranslation);
_local25 = b2Math.b2Max(_local25, -(_local1));
_local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
} else {
if (m_limitState == e_atUpperLimit){
_local1 = (_local31 - m_upperTranslation);
_local25 = b2Math.b2Max(_local25, _local1);
_local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
};
};
};
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop))));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetJointSpeed():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_xf.R;
var _local4:Number = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
var _local5:Number = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local3 = _local2.m_xf.R;
var _local7:Number = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8));
_local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8));
_local7 = _local6;
var _local9:Number = (_local1.m_sweep.c.x + _local4);
var _local10:Number = (_local1.m_sweep.c.y + _local5);
var _local11:Number = (_local2.m_sweep.c.x + _local7);
var _local12:Number = (_local2.m_sweep.c.y + _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = (_local12 - _local10);
var _local15:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local16:b2Vec2 = _local1.m_linearVelocity;
var _local17:b2Vec2 = _local2.m_linearVelocity;
var _local18:Number = _local1.m_angularVelocity;
var _local19:Number = _local2.m_angularVelocity;
var _local20:Number = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4)))));
return (_local20);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local10:Number = _local2.m_invMass;
var _local11:Number = _local3.m_invMass;
var _local12:Number = _local2.m_invI;
var _local13:Number = _local3.m_invI;
_local4 = _local2.m_xf.R;
var _local14:Number = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y));
var _local15:Number = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y));
var _local16:Number = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x);
var _local17:Number = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y);
m_linearJacobian.linear1.x = -(_local14);
m_linearJacobian.linear1.y = -(_local15);
m_linearJacobian.linear2.x = _local14;
m_linearJacobian.linear2.y = _local15;
m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14)));
m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14));
m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2));
m_linearMass = (1 / m_linearMass);
m_angularMass = (_local12 + _local13);
if (m_angularMass > Number.MIN_VALUE){
m_angularMass = (1 / m_angularMass);
};
if (((m_enableLimit) || (m_enableMotor))){
_local4 = _local2.m_xf.R;
_local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y));
_local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y));
m_motorJacobian.linear1.x = -(_local18);
m_motorJacobian.linear1.y = -(_local19);
m_motorJacobian.linear2.x = _local18;
m_motorJacobian.linear2.y = _local19;
m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18)));
m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18));
m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2));
m_motorMass = (1 / m_motorMass);
if (m_enableLimit){
_local20 = (_local16 - _local6);
_local21 = (_local17 - _local7);
_local22 = ((_local18 * _local20) + (_local19 * _local21));
if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local22 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local22 >= m_upperTranslation){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
};
};
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit == false){
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x)));
_local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y)));
_local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x)));
_local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y)));
_local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1)));
_local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2)));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28));
} else {
m_force = 0;
m_torque = 0;
m_limitForce = 0;
m_motorForce = 0;
};
m_limitPositionImpulse = 0;
}
public function GetMotorForce():Number{
return (m_motorForce);
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
public function SetMaxMotorForce(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
override public function GetReactionTorque():Number{
return (m_torque);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerTranslation = _arg1;
m_upperTranslation = _arg2;
}
}
}//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PrismaticJointDef extends b2JointDef {
public var motorSpeed:Number;
public var localAxis1:b2Vec2;
public var referenceAngle:Number;
public var upperTranslation:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public var maxMotorForce:Number;
public var lowerTranslation:Number;
public function b2PrismaticJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
localAxis1 = new b2Vec2();
super();
type = b2Joint.e_prismaticJoint;
localAxis1.Set(1, 0);
referenceAngle = 0;
enableLimit = false;
lowerTranslation = 0;
upperTranslation = 0;
enableMotor = false;
maxMotorForce = 0;
motorSpeed = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
localAxis1 = body1.GetLocalVector(_arg4);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Dynamics.*;
public class b2PulleyJoint extends b2Joint {
public var m_limitState1:int;
public var m_limitState2:int;
public var m_ground:b2Body;
public var m_maxLength2:Number;
public var m_maxLength1:Number;
public var m_limitPositionImpulse1:Number;
public var m_limitPositionImpulse2:Number;
public var m_force:Number;
public var m_constant:Number;
public var m_positionImpulse:Number;
public var m_state:int;
public var m_ratio:Number;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_limitMass1:Number;
public var m_limitMass2:Number;
public var m_pulleyMass:Number;
public var m_u1:b2Vec2;
public var m_limitForce1:Number;
public var m_limitForce2:Number;
public var m_u2:b2Vec2;
public static const b2_minPulleyLength:Number = 2;
public function b2PulleyJoint(_arg1:b2PulleyJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u1 = new b2Vec2();
m_u2 = new b2Vec2();
super(_arg1);
m_ground = m_body1.m_world.m_groundBody;
m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x);
m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y);
m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x);
m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_ratio = _arg1.ratio;
m_constant = (_arg1.length1 + (m_ratio * _arg1.length2));
m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength)));
m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio));
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
}
public function GetGroundAnchor2():b2Vec2{
var _local1:b2Vec2 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor2);
return (_local1);
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = m_u2.Copy();
_local1.Multiply(m_force);
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local3:b2Mat22;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
var _local4:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local5:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local6:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local7:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
var _local23:Number = 0;
if (m_state == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local16 = m_u1.Length();
_local17 = m_u2.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local16));
} else {
m_u1.SetZero();
};
if (_local17 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = ((m_constant - _local16) - (m_ratio * _local17));
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_pulleyMass) * _local18);
_local20 = m_positionImpulse;
m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19));
_local19 = (m_positionImpulse - _local20);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local14 = ((-(m_ratio) * _local19) * m_u2.x);
_local15 = ((-(m_ratio) * _local19) * m_u2.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local1.SynchronizeTransform();
_local2.SynchronizeTransform();
};
if (m_limitState1 == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
_local16 = m_u1.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.x = (m_u1.x * (1 / _local16));
m_u1.y = (m_u1.y * (1 / _local16));
} else {
m_u1.SetZero();
};
_local18 = (m_maxLength1 - _local16);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass1) * _local18);
_local21 = m_limitPositionImpulse1;
m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19));
_local19 = (m_limitPositionImpulse1 - _local21);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local1.SynchronizeTransform();
};
if (m_limitState2 == e_atUpperLimit){
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local17 = m_u2.Length();
if (_local17 > b2Settings.b2_linearSlop){
m_u2.x = (m_u2.x * (1 / _local17));
m_u2.y = (m_u2.y * (1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = (m_maxLength2 - _local17);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass2) * _local18);
_local21 = m_limitPositionImpulse2;
m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19));
_local19 = (m_limitPositionImpulse2 - _local21);
_local14 = (-(_local19) * m_u2.x);
_local15 = (-(_local19) * m_u2.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local2.SynchronizeTransform();
};
return ((_local23 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (_local2.m_sweep.c.x + _local5);
var _local11:Number = (_local2.m_sweep.c.y + _local6);
var _local12:Number = (_local3.m_sweep.c.x + _local8);
var _local13:Number = (_local3.m_sweep.c.y + _local9);
var _local14:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local15:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local16:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local17:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
m_u1.Set((_local10 - _local14), (_local11 - _local15));
m_u2.Set((_local12 - _local16), (_local13 - _local17));
var _local18:Number = m_u1.Length();
var _local19:Number = m_u2.Length();
if (_local18 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local18));
} else {
m_u1.SetZero();
};
if (_local19 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local19));
} else {
m_u2.SetZero();
};
var _local20:Number = ((m_constant - _local18) - (m_ratio * _local19));
if (_local20 > 0){
m_state = e_inactiveLimit;
m_force = 0;
} else {
m_state = e_atUpperLimit;
m_positionImpulse = 0;
};
if (_local18 < m_maxLength1){
m_limitState1 = e_inactiveLimit;
m_limitForce1 = 0;
} else {
m_limitState1 = e_atUpperLimit;
m_limitPositionImpulse1 = 0;
};
if (_local19 < m_maxLength2){
m_limitState2 = e_inactiveLimit;
m_limitForce2 = 0;
} else {
m_limitState2 = e_atUpperLimit;
m_limitPositionImpulse2 = 0;
};
var _local21:Number = ((_local5 * m_u1.y) - (_local6 * m_u1.x));
var _local22:Number = ((_local8 * m_u2.y) - (_local9 * m_u2.x));
m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21));
m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22));
m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2));
m_limitMass1 = (1 / m_limitMass1);
m_limitMass2 = (1 / m_limitMass2);
m_pulleyMass = (1 / m_pulleyMass);
if (_arg1.warmStarting){
_local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x);
_local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y);
_local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x);
_local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25))));
} else {
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
if (m_state == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13))));
_local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18);
_local20 = m_force;
m_force = b2Math.b2Max(0, (m_force + _local19));
_local19 = (m_force - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x);
_local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
if (m_limitState1 == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18);
_local20 = m_limitForce1;
m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19));
_local19 = (m_limitForce1 - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
};
if (m_limitState2 == e_atUpperLimit){
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18);
_local20 = m_limitForce2;
m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19));
_local19 = (m_limitForce2 - _local20);
_local16 = ((-(_arg1.dt) * _local19) * m_u2.x);
_local17 = ((-(_arg1.dt) * _local19) * m_u2.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
}
public function GetLength1():Number{
var _local1:b2Vec2 = m_body1.GetWorldPoint(m_localAnchor1);
var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local4:Number = (_local1.x - _local2);
var _local5:Number = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetLength2():Number{
var _local1:b2Vec2 = m_body2.GetWorldPoint(m_localAnchor2);
var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
var _local4:Number = (_local1.x - _local2);
var _local5:Number = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetGroundAnchor1():b2Vec2{
var _local1:b2Vec2 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor1);
return (_local1);
}
}
}//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PulleyJointDef extends b2JointDef {
public var maxLength1:Number;
public var maxLength2:Number;
public var length1:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var groundAnchor1:b2Vec2;
public var groundAnchor2:b2Vec2;
public var ratio:Number;
public var length2:Number;
public function b2PulleyJointDef(){
groundAnchor1 = new b2Vec2();
groundAnchor2 = new b2Vec2();
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_pulleyJoint;
groundAnchor1.Set(-1, 1);
groundAnchor2.Set(1, 1);
localAnchor1.Set(-1, 0);
localAnchor2.Set(1, 0);
length1 = 0;
maxLength1 = 0;
length2 = 0;
maxLength2 = 0;
ratio = 1;
collideConnected = true;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{
body1 = _arg1;
body2 = _arg2;
groundAnchor1.SetV(_arg3);
groundAnchor2.SetV(_arg4);
localAnchor1 = body1.GetLocalPoint(_arg5);
localAnchor2 = body2.GetLocalPoint(_arg6);
var _local8:Number = (_arg5.x - _arg3.x);
var _local9:Number = (_arg5.y - _arg3.y);
length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
var _local10:Number = (_arg6.x - _arg4.x);
var _local11:Number = (_arg6.y - _arg4.y);
length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
ratio = _arg7;
var _local12:Number = (length1 + (ratio * length2));
maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength));
maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio);
}
}
}//package Box2D.Dynamics.Joints
Section 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Dynamics.*;
public class b2RevoluteJoint extends b2Joint {
public var m_limitForce:Number;
public var m_pivotMass:b2Mat22;
public var m_motorForce:Number;
public var m_enableLimit:Boolean;
public var m_limitState:int;
public var m_motorMass:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K3:b2Mat22;
private var K:b2Mat22;
public var m_pivotForce:b2Vec2;
public var m_enableMotor:Boolean;
public var m_referenceAngle:Number;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_upperAngle:Number;
public var m_lowerAngle:Number;
public var m_maxMotorTorque:Number;
public static var tImpulse:b2Vec2 = new b2Vec2();
public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
K3 = new b2Mat22();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_pivotForce = new b2Vec2();
m_pivotMass = new b2Mat22();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_referenceAngle = _arg1.referenceAngle;
m_pivotForce.Set(0, 0);
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerAngle = _arg1.lowerAngle;
m_upperAngle = _arg1.upperAngle;
m_maxMotorTorque = _arg1.maxMotorTorque;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local10:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local11:Number = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7));
var _local12:Number = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6));
var _local13:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12)));
var _local14:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12)));
m_pivotForce.x = (m_pivotForce.x + _local13);
m_pivotForce.y = (m_pivotForce.y + _local14);
var _local15:Number = (_arg1.dt * _local13);
_local16 = (_arg1.dt * _local14);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15))));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed);
_local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17);
_local19 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque);
_local18 = (m_motorForce - _local19);
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local21);
} else {
if (m_limitState == e_atLowerLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
} else {
if (m_limitState == e_atUpperLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
};
};
};
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21));
};
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function GetUpperLimit():Number{
return (m_upperAngle);
}
public function GetLowerLimit():Number{
return (m_lowerAngle);
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
return (m_pivotForce);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local6:b2Mat22;
var _local25:Number;
var _local26:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = 0;
_local6 = _local3.m_xf.R;
var _local7:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
var _local9:Number = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8));
_local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8));
_local7 = _local9;
_local6 = _local4.m_xf.R;
var _local10:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local11:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11));
_local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11));
_local10 = _local9;
var _local12:Number = (_local3.m_sweep.c.x + _local7);
var _local13:Number = (_local3.m_sweep.c.y + _local8);
var _local14:Number = (_local4.m_sweep.c.x + _local10);
var _local15:Number = (_local4.m_sweep.c.y + _local11);
var _local16:Number = (_local14 - _local12);
var _local17:Number = (_local15 - _local13);
_local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17)));
var _local18:Number = _local3.m_invMass;
var _local19:Number = _local4.m_invMass;
var _local20:Number = _local3.m_invI;
var _local21:Number = _local4.m_invI;
K1.col1.x = (_local18 + _local19);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local18 + _local19);
K2.col1.x = ((_local20 * _local8) * _local8);
K2.col2.x = ((-(_local20) * _local7) * _local8);
K2.col1.y = ((-(_local20) * _local7) * _local8);
K2.col2.y = ((_local20 * _local7) * _local7);
K3.col1.x = ((_local21 * _local11) * _local11);
K3.col2.x = ((-(_local21) * _local10) * _local11);
K3.col1.y = ((-(_local21) * _local10) * _local11);
K3.col2.y = ((_local21 * _local10) * _local10);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Solve(tImpulse, -(_local16), -(_local17));
var _local22:Number = tImpulse.x;
var _local23:Number = tImpulse.y;
_local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23));
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22))));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22))));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
var _local24:Number = 0;
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle);
_local26 = 0;
if (m_limitState == e_equalLimits){
_local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local24 = b2Math.b2Abs(_local2);
} else {
if (m_limitState == e_atLowerLimit){
_local2 = (_local25 - m_lowerAngle);
_local24 = b2Math.b2Max(0, -(_local2));
_local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
} else {
if (m_limitState == e_atUpperLimit){
_local2 = (_local25 - m_upperAngle);
_local24 = b2Math.b2Max(0, _local2);
_local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
};
};
};
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop))));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function SetMaxMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
public function GetJointAngle():Number{
return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle));
}
public function GetMotorTorque():Number{
return (m_motorForce);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local7:Number;
var _local14:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local10:Number = _local2.m_invMass;
var _local11:Number = _local3.m_invMass;
var _local12:Number = _local2.m_invI;
var _local13:Number = _local3.m_invI;
K1.col1.x = (_local10 + _local11);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local10 + _local11);
K2.col1.x = ((_local12 * _local7) * _local7);
K2.col2.x = ((-(_local12) * _local6) * _local7);
K2.col1.y = ((-(_local12) * _local6) * _local7);
K2.col2.y = ((_local12 * _local6) * _local6);
K3.col1.x = ((_local13 * _local9) * _local9);
K3.col2.x = ((-(_local13) * _local8) * _local9);
K3.col1.y = ((-(_local13) * _local8) * _local9);
K3.col2.y = ((_local13 * _local8) * _local8);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Invert(m_pivotMass);
m_motorMass = (1 / (_local12 + _local13));
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit){
_local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle);
if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
m_limitState = e_equalLimits;
} else {
if (_local14 <= m_lowerAngle){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local14 >= m_upperAngle){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
} else {
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
} else {
m_pivotForce.SetZero();
m_motorForce = 0;
m_limitForce = 0;
};
m_limitPositionImpulse = 0;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
override public function GetReactionTorque():Number{
return (m_limitForce);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerAngle = _arg1;
m_upperAngle = _arg2;
}
}
}//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2RevoluteJointDef extends b2JointDef {
public var upperAngle:Number;
public var enableMotor:Boolean;
public var referenceAngle:Number;
public var motorSpeed:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var lowerAngle:Number;
public var maxMotorTorque:Number;
public function b2RevoluteJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_revoluteJoint;
localAnchor1.Set(0, 0);
localAnchor2.Set(0, 0);
referenceAngle = 0;
lowerAngle = 0;
upperAngle = 0;
maxMotorTorque = 0;
motorSpeed = 0;
enableLimit = false;
enableMotor = false;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 64
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Body {
public var m_next:b2Body;
public var m_xf:b2XForm;
public var m_contactList:b2ContactEdge;
public var m_angularVelocity:Number;
public var m_shapeList:b2Shape;
public var m_force:b2Vec2;
public var m_mass:Number;
public var m_sweep:b2Sweep;
public var m_torque:Number;
public var m_userData;
public var m_flags:uint;
public var m_world:b2World;
public var m_prev:b2Body;
public var m_invMass:Number;
public var m_type:int;
public var m_linearDamping:Number;
public var m_shapeCount:int;
public var m_angularDamping:Number;
public var m_invI:Number;
public var m_linearVelocity:b2Vec2;
public var m_sleepTime:Number;
public var m_jointList:b2JointEdge;
public var m_I:Number;
public static var e_fixedRotationFlag:uint = 64;
public static var e_frozenFlag:uint = 2;
public static var e_maxTypes:uint = 3;
public static var e_sleepFlag:uint = 8;
private static var s_massData:b2MassData = new b2MassData();
public static var e_bulletFlag:uint = 32;
public static var e_staticType:uint = 1;
public static var e_islandFlag:uint = 4;
public static var e_allowSleepFlag:uint = 16;
private static var s_xf1:b2XForm = new b2XForm();
public static var e_dynamicType:uint = 2;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
m_xf = new b2XForm();
m_sweep = new b2Sweep();
m_linearVelocity = new b2Vec2();
m_force = new b2Vec2();
super();
m_flags = 0;
if (_arg1.isBullet){
m_flags = (m_flags | e_bulletFlag);
};
if (_arg1.fixedRotation){
m_flags = (m_flags | e_fixedRotationFlag);
};
if (_arg1.allowSleep){
m_flags = (m_flags | e_allowSleepFlag);
};
if (_arg1.isSleeping){
m_flags = (m_flags | e_sleepFlag);
};
m_world = _arg2;
m_xf.position.SetV(_arg1.position);
m_xf.R.Set(_arg1.angle);
m_sweep.localCenter.SetV(_arg1.massData.center);
m_sweep.t0 = 1;
m_sweep.a0 = (m_sweep.a = _arg1.angle);
var _local3:b2Mat22 = m_xf.R;
var _local4:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_jointList = null;
m_contactList = null;
m_prev = null;
m_next = null;
m_linearDamping = _arg1.linearDamping;
m_angularDamping = _arg1.angularDamping;
m_force.Set(0, 0);
m_torque = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_sleepTime = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.massData.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.massData.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
m_userData = _arg1.userData;
m_shapeList = null;
m_shapeCount = 0;
}
public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{
return (new b2Vec2((m_linearVelocity.x - (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.y + (m_angularVelocity * (_arg1.x - m_sweep.c.x)))));
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function WakeUp():void{
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 0;
}
public function GetLocalCenter():b2Vec2{
return (m_sweep.localCenter);
}
public function ApplyTorque(_arg1:Number):void{
if (IsSleeping()){
WakeUp();
};
m_torque = (m_torque + _arg1);
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsDynamic():Boolean{
return ((m_type == e_dynamicType));
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
public function SynchronizeTransform():void{
m_xf.R.Set(m_sweep.a);
var _local1:b2Mat22 = m_xf.R;
var _local2:b2Vec2 = m_sweep.localCenter;
m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y)));
m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y)));
}
public function GetInertia():Number{
return (m_I);
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function SetMassFromShapes():void{
var _local1:b2Shape;
if (m_world.m_lock == true){
return;
};
m_mass = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:b2MassData = s_massData;
_local1 = m_shapeList;
while (_local1) {
_local1.ComputeMass(_local4);
m_mass = (m_mass + _local4.mass);
_local2 = (_local2 + (_local4.mass * _local4.center.x));
_local3 = (_local3 + (_local4.mass * _local4.center.y));
m_I = (m_I + _local4.I);
_local1 = _local1.m_next;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
_local2 = (_local2 * m_invMass);
_local3 = (_local3 * m_invMass);
};
if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){
m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3))));
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
m_sweep.localCenter.Set(_local2, _local3);
var _local5:b2Mat22 = m_xf.R;
var _local6:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local1 = m_shapeList;
while (_local1) {
_local1.UpdateSweepRadius(m_sweep.localCenter);
_local1 = _local1.m_next;
};
var _local7:int = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local7 != m_type){
_local1 = m_shapeList;
while (_local1) {
_local1.RefilterProxy(m_world.m_broadPhase, m_xf);
_local1 = _local1.m_next;
};
};
}
public function PutToSleep():void{
m_flags = (m_flags | e_sleepFlag);
m_sleepTime = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_force.SetZero();
m_torque = 0;
}
public function GetJointList():b2JointEdge{
return (m_jointList);
}
public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{
var _local3:b2Shape;
var _local7:Boolean;
if (m_world.m_lock == true){
return (true);
};
if (IsFrozen()){
return (false);
};
m_xf.R.Set(_arg2);
m_xf.position.SetV(_arg1);
var _local4:b2Mat22 = m_xf.R;
var _local5:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y));
m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_sweep.a0 = (m_sweep.a = _arg2);
var _local6:Boolean;
_local3 = m_shapeList;
while (_local3) {
_local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf);
if (_local7 == false){
_local6 = true;
break;
};
_local3 = _local3.m_next;
};
if (_local6 == true){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local3 = m_shapeList;
while (_local3) {
_local3.DestroyProxy(m_world.m_broadPhase);
_local3 = _local3.m_next;
};
return (false);
};
m_world.m_broadPhase.Commit();
return (true);
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(m_xf, _arg1));
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_force.x = (m_force.x + _arg1.x);
m_force.y = (m_force.y + _arg1.y);
m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)));
}
public function SynchronizeShapes():Boolean{
var _local4:b2Shape;
var _local1:b2XForm = s_xf1;
_local1.R.Set(m_sweep.a0);
var _local2:b2Mat22 = _local1.R;
var _local3:b2Vec2 = m_sweep.localCenter;
_local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y)));
_local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y)));
var _local5:Boolean = true;
_local4 = m_shapeList;
while (_local4) {
_local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf);
if (_local5 == false){
break;
};
_local4 = _local4.m_next;
};
if (_local5 == false){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local4 = m_shapeList;
while (_local4) {
_local4.DestroyProxy(m_world.m_broadPhase);
_local4 = _local4.m_next;
};
return (false);
};
return (true);
}
public function GetAngle():Number{
return (m_sweep.a);
}
public function GetXForm():b2XForm{
return (m_xf);
}
public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = m_xf.R;
var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x)))));
}
public function GetNext():b2Body{
return (m_next);
}
public function GetMass():Number{
return (m_mass);
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x));
m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y));
m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))));
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SetMass(_arg1:b2MassData):void{
var _local2:b2Shape;
if (m_world.m_lock == true){
return;
};
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
m_sweep.localCenter.SetV(_arg1.center);
var _local3:b2Mat22 = m_xf.R;
var _local4:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local2 = m_shapeList;
while (_local2) {
_local2.UpdateSweepRadius(m_sweep.localCenter);
_local2 = _local2.m_next;
};
var _local5:int = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local5 != m_type){
_local2 = m_shapeList;
while (_local2) {
_local2.RefilterProxy(m_world.m_broadPhase, m_xf);
_local2 = _local2.m_next;
};
};
}
public function IsStatic():Boolean{
return ((m_type == e_staticType));
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_xf.R, _arg1));
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function Advance(_arg1:Number):void{
m_sweep.Advance(_arg1);
m_sweep.c.SetV(m_sweep.c0);
m_sweep.a = m_sweep.a0;
SynchronizeTransform();
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_bulletFlag);
} else {
m_flags = (m_flags & ~(e_bulletFlag));
};
}
public function CreateShape(_arg1:b2ShapeDef):b2Shape{
var _local2:b2Shape;
if (m_world.m_lock == true){
return (null);
};
_local2 = b2Shape.Create(_arg1, m_world.m_blockAllocator);
_local2.m_next = m_shapeList;
m_shapeList = _local2;
m_shapeCount++;
_local2.m_body = this;
_local2.CreateProxy(m_world.m_broadPhase, m_xf);
_local2.UpdateSweepRadius(m_sweep.localCenter);
return (_local2);
}
public function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointEdge = m_jointList;
while (_local2) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
public function DestroyShape(_arg1:b2Shape):void{
if (m_world.m_lock == true){
return;
};
_arg1.DestroyProxy(m_world.m_broadPhase);
var _local2:b2Shape = m_shapeList;
var _local3:b2Shape;
var _local4:Boolean;
while (_local2 != null) {
if (_local2 == _arg1){
if (_local3){
_local3.m_next = _arg1.m_next;
} else {
m_shapeList = _arg1.m_next;
};
_local4 = true;
break;
};
_local3 = _local2;
_local2 = _local2.m_next;
};
_arg1.m_body = null;
_arg1.m_next = null;
m_shapeCount--;
b2Shape.Destroy(_arg1, m_world.m_blockAllocator);
}
public function GetUserData(){
return (m_userData);
}
public function IsBullet():Boolean{
return (((m_flags & e_bulletFlag) == e_bulletFlag));
}
public function GetWorldCenter():b2Vec2{
return (m_sweep.c);
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_xf.R, _arg1));
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = m_xf.R;
var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (_local3);
}
public function GetWorld():b2World{
return (m_world);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
}
}//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class b2BodyDef {
public var angularDamping:Number;
public var angle:Number;
public var isSleeping:Boolean;
public var position:b2Vec2;
public var isBullet:Boolean;
public var allowSleep:Boolean;
public var userData;
public var fixedRotation:Boolean;
public var linearDamping:Number;
public var massData:b2MassData;
public function b2BodyDef(){
massData = new b2MassData();
position = new b2Vec2();
super();
massData.center.SetZero();
massData.mass = 0;
massData.I = 0;
userData = null;
position.Set(0, 0);
angle = 0;
linearDamping = 0;
angularDamping = 0;
allowSleep = true;
isSleeping = false;
fixedRotation = false;
isBullet = false;
}
}
}//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2ContactFilter {
public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter);
;
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData = _arg1.GetFilterData();
var _local4:b2FilterData = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
var _local5:Boolean = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
}
}//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactListener {
public function Add(_arg1:b2ContactPoint):void{
}
public function Remove(_arg1:b2ContactPoint):void{
}
public function Persist(_arg1:b2ContactPoint):void{
}
public function Result(_arg1:b2ContactResult):void{
}
}
}//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2ContactManager extends b2PairCallback {
public var m_world:b2World;
public var m_destroyImmediate:Boolean;
public var m_nullContact:b2NullContact;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2ContactManager(){
m_nullContact = new b2NullContact();
super();
m_world = null;
m_destroyImmediate = false;
}
override public function PairRemoved(_arg1, _arg2, _arg3):void{
if (_arg3 == null){
return;
};
var _local4:b2Contact = (_arg3 as b2Contact);
if (_local4 == m_nullContact){
return;
};
Destroy(_local4);
}
public function Destroy(_arg1:b2Contact):void{
var _local7:b2Body;
var _local8:b2Body;
var _local9:Array;
var _local10:b2ContactPoint;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2Vec2;
var _local16:b2Vec2;
var _local2:b2Shape = _arg1.m_shape1;
var _local3:b2Shape = _arg1.m_shape2;
var _local4:int = _arg1.m_manifoldCount;
if ((((_local4 > 0)) && (m_world.m_contactListener))){
_local7 = _local2.m_body;
_local8 = _local3.m_body;
_local9 = _arg1.GetManifolds();
_local10 = s_evalCP;
_local10.shape1 = _arg1.m_shape1;
_local10.shape2 = _arg1.m_shape2;
_local10.friction = _arg1.m_friction;
_local10.restitution = _arg1.m_restitution;
_local11 = 0;
while (_local11 < _local4) {
_local12 = _local9[_local11];
_local10.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local10.position = _local7.GetWorldPoint(_local14.localPoint1);
_local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1);
_local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2);
_local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y));
_local10.separation = _local14.separation;
_local10.id.key = _local14.id._key;
m_world.m_contactListener.Remove(_local10);
_local13++;
};
_local11++;
};
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_world.m_contactList){
m_world.m_contactList = _arg1.m_next;
};
var _local5:b2Body = _local2.m_body;
var _local6:b2Body = _local3.m_body;
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local5.m_contactList){
_local5.m_contactList = _arg1.m_node1.next;
};
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local6.m_contactList){
_local6.m_contactList = _arg1.m_node2.next;
};
b2Contact.Destroy(_arg1, m_world.m_blockAllocator);
m_world.m_contactCount--;
}
override public function PairAdded(_arg1, _arg2){
var _local3:b2Shape = (_arg1 as b2Shape);
var _local4:b2Shape = (_arg2 as b2Shape);
var _local5:b2Body = _local3.m_body;
var _local6:b2Body = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (m_nullContact);
};
if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){
return (m_nullContact);
};
var _local7:b2Contact = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator);
if (_local7 == null){
return (m_nullContact);
};
_local3 = _local7.m_shape1;
_local4 = _local7.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local7.m_prev = null;
_local7.m_next = m_world.m_contactList;
if (m_world.m_contactList != null){
m_world.m_contactList.m_prev = _local7;
};
m_world.m_contactList = _local7;
_local7.m_node1.contact = _local7;
_local7.m_node1.other = _local6;
_local7.m_node1.prev = null;
_local7.m_node1.next = _local5.m_contactList;
if (_local5.m_contactList != null){
_local5.m_contactList.prev = _local7.m_node1;
};
_local5.m_contactList = _local7.m_node1;
_local7.m_node2.contact = _local7;
_local7.m_node2.other = _local5;
_local7.m_node2.prev = null;
_local7.m_node2.next = _local6.m_contactList;
if (_local6.m_contactList != null){
_local6.m_contactList.prev = _local7.m_node2;
};
_local6.m_contactList = _local7.m_node2;
m_world.m_contactCount++;
return (_local7);
}
public function Collide():void{
var _local2:b2Body;
var _local3:b2Body;
var _local1:b2Contact = m_world.m_contactList;
while (_local1) {
_local2 = _local1.m_shape1.m_body;
_local3 = _local1.m_shape2.m_body;
if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){
} else {
_local1.Update(m_world.m_contactListener);
};
_local1 = _local1.m_next;
};
}
}
}//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
import flash.display.*;
public class b2DebugDraw {
public var m_xformScale:Number;// = 1
public var m_fillAlpha:Number;// = 1
public var m_alpha:Number;// = 1
public var m_drawFlags:uint;
public var m_lineThickness:Number;// = 1
public var m_drawScale:Number;// = 1
public var m_sprite:Sprite;
public static var e_coreShapeBit:uint = 4;
public static var e_shapeBit:uint = 1;
public static var e_centerOfMassBit:uint = 64;
public static var e_aabbBit:uint = 8;
public static var e_obbBit:uint = 16;
public static var e_pairBit:uint = 32;
public static var e_jointBit:uint = 2;
public function b2DebugDraw(){
m_drawFlags = 0;
}
public function ClearFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags & ~(_arg1));
}
public function SetFlags(_arg1:uint):void{
m_drawFlags = _arg1;
}
public function AppendFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags | _arg1);
}
public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale));
}
public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha);
var _local4:int = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.endFill();
}
public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
}
public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
var _local4:int = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
}
public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha);
m_sprite.graphics.moveTo(0, 0);
m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
m_sprite.graphics.endFill();
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale));
}
public function GetFlags():uint{
return (m_drawFlags);
}
public function DrawXForm(_arg1:b2XForm):void{
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale));
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale));
}
}
}//package Box2D.Dynamics
Section 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener)
package Box2D.Dynamics {
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
public class b2DestructionListener {
public function SayGoodbyeShape(_arg1:b2Shape):void{
}
public function SayGoodbyeJoint(_arg1:b2Joint):void{
}
}
}//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Common.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.*;
public class b2Island {
public var m_listener:b2ContactListener;
public var m_positionIterationCount:int;
public var m_bodyCapacity:int;
public var m_bodies:Array;
public var m_joints:Array;
public var m_jointCapacity:int;
public var m_contactCount:int;
public var m_contacts:Array;
public var m_contactCapacity:int;
public var m_jointCount:int;
public var m_allocator;
public var m_bodyCount:int;
private static var s_reportCR:b2ContactResult = new b2ContactResult();
public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){
var _local6:int;
super();
m_bodyCapacity = _arg1;
m_contactCapacity = _arg2;
m_jointCapacity = _arg3;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_allocator = _arg4;
m_listener = _arg5;
m_bodies = new Array(_arg1);
_local6 = 0;
while (_local6 < _arg1) {
m_bodies[_local6] = null;
_local6++;
};
m_contacts = new Array(_arg2);
_local6 = 0;
while (_local6 < _arg2) {
m_contacts[_local6] = null;
_local6++;
};
m_joints = new Array(_arg3);
_local6 = 0;
while (_local6 < _arg3) {
m_joints[_local6] = null;
_local6++;
};
m_positionIterationCount = 0;
}
public function AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
public function Report(_arg1:Array):void{
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local5:b2Contact;
var _local6:b2ContactConstraint;
var _local7:b2ContactResult;
var _local8:b2Body;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2ContactConstraintPoint;
if (m_listener == null){
return;
};
var _local4:int;
while (_local4 < m_contactCount) {
_local5 = m_contacts[_local4];
_local6 = _arg1[_local4];
_local7 = s_reportCR;
_local7.shape1 = _local5.m_shape1;
_local7.shape2 = _local5.m_shape2;
_local8 = _local7.shape1.m_body;
_local9 = _local5.m_manifoldCount;
_local10 = _local5.GetManifolds();
_local11 = 0;
while (_local11 < _local9) {
_local12 = _local10[_local11];
_local7.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local15 = _local6.points[_local13];
_local7.position = _local8.GetWorldPoint(_local14.localPoint1);
_local7.normalImpulse = _local15.normalImpulse;
_local7.tangentImpulse = _local15.tangentImpulse;
_local7.id.key = _local14.id.key;
m_listener.Result(_local7);
_local13++;
};
_local11++;
};
_local4++;
};
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{
var _local5:int;
var _local6:b2Body;
var _local7:b2Joint;
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y))));
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_force.SetZero();
_local6.m_torque = 0;
_local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity);
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity);
};
if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity);
} else {
_local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity;
};
};
};
_local5++;
};
var _local8:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local8.InitVelocityConstraints(_arg1);
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitVelocityConstraints(_arg1);
_local5++;
};
_local5 = 0;
while (_local5 < _arg1.maxIterations) {
_local8.SolveVelocityConstraints();
_local9 = 0;
while (_local9 < m_jointCount) {
_local7 = m_joints[_local9];
_local7.SolveVelocityConstraints(_arg1);
_local9++;
};
_local5++;
};
_local8.FinalizeVelocityConstraints();
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_sweep.c0.SetV(_local6.m_sweep.c);
_local6.m_sweep.a0 = _local6.m_sweep.a;
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y));
_local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity));
_local6.SynchronizeTransform();
};
_local5++;
};
if (_arg3){
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitPositionConstraints();
_local5++;
};
m_positionIterationCount = 0;
while (m_positionIterationCount < _arg1.maxIterations) {
_local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local11 = true;
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local12 = _local7.SolvePositionConstraints();
_local11 = ((_local11) && (_local12));
_local5++;
};
if (((_local10) && (_local11))){
break;
};
m_positionIterationCount++;
};
};
Report(_local8.m_constraints);
if (_arg4){
_local13 = Number.MAX_VALUE;
_local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.m_invMass == 0){
} else {
if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){
_local6.m_sleepTime = 0;
_local13 = 0;
};
if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){
_local6.m_sleepTime = 0;
_local13 = 0;
} else {
_local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt);
_local13 = b2Math.b2Min(_local13, _local6.m_sleepTime);
};
};
_local5++;
};
if (_local13 >= b2Settings.b2_timeToSleep){
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
_local6.m_flags = (_local6.m_flags | b2Body.e_sleepFlag);
_local6.m_linearVelocity.SetZero();
_local6.m_angularVelocity = 0;
_local5++;
};
};
};
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:int;
var _local5:b2Body;
var _local6:Boolean;
var _local3:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local3.SolveVelocityConstraints();
_local2++;
};
_local2 = 0;
while (_local2 < m_bodyCount) {
_local5 = m_bodies[_local2];
if (_local5.IsStatic()){
} else {
_local5.m_sweep.c0.SetV(_local5.m_sweep.c);
_local5.m_sweep.a0 = _local5.m_sweep.a;
_local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y));
_local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity));
_local5.SynchronizeTransform();
};
_local2++;
};
var _local4:Number = 0.75;
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local6 = _local3.SolvePositionConstraints(_local4);
if (_local6){
break;
};
_local2++;
};
Report(_local3.m_constraints);
}
}
}//package Box2D.Dynamics
Section 73
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var warmStarting:Boolean;
public var positionCorrection:Boolean;
public var dt:Number;
public var maxIterations:int;
public var dtRatio:Number;
public var inv_dt:Number;
}
}//package Box2D.Dynamics
Section 74
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.Joints.*;
public class b2World {
public var m_inv_dt0:Number;
public var m_boundaryListener:b2BoundaryListener;
public var m_contactList:b2Contact;
public var m_blockAllocator;
public var m_contactListener:b2ContactListener;
public var m_allowSleep:Boolean;
public var m_broadPhase:b2BroadPhase;
public var m_destructionListener:b2DestructionListener;
public var m_jointCount:int;
public var m_bodyCount:int;
public var m_lock:Boolean;
public var m_positionIterationCount:int;
public var m_groundBody:b2Body;
public var m_contactCount:int;
public var m_debugDraw:b2DebugDraw;
public var m_contactFilter:b2ContactFilter;
public var m_bodyList:b2Body;
public var m_stackAllocator;
public var m_jointList:b2Joint;
public var m_gravity:b2Vec2;
public var m_contactManager:b2ContactManager;
private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8);
public static var m_continuousPhysics:Boolean;
public static var m_warmStarting:Boolean;
private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6);
public static var m_positionCorrection:Boolean;
private static var s_xf:b2XForm = new b2XForm();
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
m_contactManager = new b2ContactManager();
super();
m_destructionListener = null;
m_boundaryListener = null;
m_contactFilter = b2ContactFilter.b2_defaultFilter;
m_contactListener = null;
m_debugDraw = null;
m_bodyList = null;
m_contactList = null;
m_jointList = null;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_positionCorrection = true;
m_warmStarting = true;
m_continuousPhysics = true;
m_allowSleep = _arg3;
m_gravity = _arg2;
m_lock = false;
m_inv_dt0 = 0;
m_contactManager.m_world = this;
m_broadPhase = new b2BroadPhase(_arg1, m_contactManager);
var _local4:b2BodyDef = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function DrawJoint(_arg1:b2Joint):void{
var _local11:b2PulleyJoint;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local2:b2Body = _arg1.m_body1;
var _local3:b2Body = _arg1.m_body2;
var _local4:b2XForm = _local2.m_xf;
var _local5:b2XForm = _local3.m_xf;
var _local6:b2Vec2 = _local4.position;
var _local7:b2Vec2 = _local5.position;
var _local8:b2Vec2 = _arg1.GetAnchor1();
var _local9:b2Vec2 = _arg1.GetAnchor2();
var _local10:b2Color = s_jointColor;
switch (_arg1.m_type){
case b2Joint.e_distanceJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
case b2Joint.e_pulleyJoint:
_local11 = (_arg1 as b2PulleyJoint);
_local12 = _local11.GetGroundAnchor1();
_local13 = _local11.GetGroundAnchor2();
m_debugDraw.DrawSegment(_local12, _local8, _local10);
m_debugDraw.DrawSegment(_local13, _local9, _local10);
m_debugDraw.DrawSegment(_local12, _local13, _local10);
break;
case b2Joint.e_mouseJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
default:
if (_local2 != m_groundBody){
m_debugDraw.DrawSegment(_local6, _local8, _local10);
};
m_debugDraw.DrawSegment(_local8, _local9, _local10);
if (_local3 != m_groundBody){
m_debugDraw.DrawSegment(_local7, _local9, _local10);
};
};
}
public function Refilter(_arg1:b2Shape):void{
_arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf);
}
public function SetDebugDraw(_arg1:b2DebugDraw):void{
m_debugDraw = _arg1;
}
public function SetContinuousPhysics(_arg1:Boolean):void{
m_continuousPhysics = _arg1;
}
public function GetProxyCount():int{
return (m_broadPhase.m_proxyCount);
}
public function DrawDebugData():void{
var _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
var _local5:b2Joint;
var _local6:b2BroadPhase;
var _local11:b2XForm;
var _local15:Boolean;
var _local16:uint;
var _local17:b2Pair;
var _local18:b2Proxy;
var _local19:b2Proxy;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:b2Proxy;
var _local23:b2PolygonShape;
var _local24:b2OBB;
var _local25:b2Vec2;
var _local26:b2Mat22;
var _local27:b2Vec2;
var _local28:Number;
if (m_debugDraw == null){
return;
};
m_debugDraw.m_sprite.graphics.clear();
var _local1:uint = m_debugDraw.GetFlags();
var _local7:b2Vec2 = new b2Vec2();
var _local8:b2Vec2 = new b2Vec2();
var _local9:b2Vec2 = new b2Vec2();
var _local10:b2Color = new b2Color(0, 0, 0);
var _local12:b2AABB = new b2AABB();
var _local13:b2AABB = new b2AABB();
var _local14:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
if ((_local1 & b2DebugDraw.e_shapeBit)){
_local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local3.IsStatic()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15);
} else {
if (_local3.IsSleeping()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15);
} else {
DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15);
};
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_jointBit)){
_local5 = m_jointList;
while (_local5) {
DrawJoint(_local5);
_local5 = _local5.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local6 = m_broadPhase;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.9, 0.3);
_local2 = 0;
while (_local2 < b2Pair.b2_tableCapacity) {
_local16 = _local6.m_pairManager.m_hashTable[_local2];
while (_local16 != b2Pair.b2_nullPair) {
_local17 = _local6.m_pairManager.m_pairs[_local16];
_local18 = _local6.m_proxyPool[_local17.proxyId1];
_local19 = _local6.m_proxyPool[_local17.proxyId2];
_local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value));
_local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value));
_local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value));
_local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value));
_local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value));
_local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value));
_local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value));
_local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value));
_local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x));
_local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y));
_local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x));
_local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y));
m_debugDraw.DrawSegment(_local8, _local9, _local10);
_local16 = _local17.next;
};
_local2++;
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local6 = m_broadPhase;
_local20 = _local6.m_worldAABB.lowerBound;
_local21 = _local6.m_worldAABB.upperBound;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.3, 0.9);
_local2 = 0;
while (_local2 < b2Settings.b2_maxProxies) {
_local22 = _local6.m_proxyPool[_local2];
if (_local22.IsValid() == false){
} else {
_local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value));
_local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value));
_local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value));
_local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value));
_local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y);
_local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y);
_local14[2].Set(_local12.upperBound.x, _local12.upperBound.y);
_local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y);
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local2++;
};
_local14[0].Set(_local20.x, _local20.y);
_local14[1].Set(_local21.x, _local20.y);
_local14[2].Set(_local21.x, _local21.y);
_local14[3].Set(_local20.x, _local21.y);
m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9));
};
if ((_local1 & b2DebugDraw.e_obbBit)){
_local10.Set(0.5, 0.3, 0.5);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local4.m_type != b2Shape.e_polygonShape){
} else {
_local23 = (_local4 as b2PolygonShape);
_local24 = _local23.GetOBB();
_local25 = _local24.extents;
_local14[0].Set(-(_local25.x), -(_local25.y));
_local14[1].Set(_local25.x, -(_local25.y));
_local14[2].Set(_local25.x, _local25.y);
_local14[3].Set(-(_local25.x), _local25.y);
_local2 = 0;
while (_local2 < 4) {
_local26 = _local24.R;
_local27 = _local14[_local2];
_local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local26 = _local11.R;
_local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local2++;
};
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_centerOfMassBit)){
_local3 = m_bodyList;
while (_local3) {
_local11 = s_xf;
_local11.R = _local3.m_xf.R;
_local11.position = _local3.GetWorldCenter();
m_debugDraw.DrawXForm(_local11);
_local3 = _local3.m_next;
};
};
}
public function DestroyBody(_arg1:b2Body):void{
var _local4:b2JointEdge;
var _local5:b2Shape;
if (m_lock == true){
return;
};
var _local2:b2JointEdge = _arg1.m_jointList;
while (_local2) {
_local4 = _local2;
_local2 = _local2.next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeJoint(_local4.joint);
};
DestroyJoint(_local4.joint);
};
var _local3:b2Shape = _arg1.m_shapeList;
while (_local3) {
_local5 = _local3;
_local3 = _local3.m_next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeShape(_local5);
};
_local5.DestroyProxy(m_broadPhase);
b2Shape.Destroy(_local5, m_blockAllocator);
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_bodyList){
m_bodyList = _arg1.m_next;
};
m_bodyCount--;
}
public function SetContactFilter(_arg1:b2ContactFilter):void{
m_contactFilter = _arg1;
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{
var _local6:b2CircleShape;
var _local7:b2Vec2;
var _local8:Number;
var _local9:b2Vec2;
var _local10:int;
var _local11:b2PolygonShape;
var _local12:int;
var _local13:Array;
var _local14:Array;
var _local15:Array;
var _local5:b2Color = s_coreColor;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local6 = (_arg1 as b2CircleShape);
_local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition);
_local8 = _local6.m_radius;
_local9 = _arg2.R.col1;
m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3);
if (_arg4){
m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5);
};
break;
case b2Shape.e_polygonShape:
_local11 = (_arg1 as b2PolygonShape);
_local12 = _local11.GetVertexCount();
_local13 = _local11.GetVertices();
_local14 = new Array(b2Settings.b2_maxPolygonVertices);
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]);
_local10++;
};
m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3);
if (_arg4){
_local15 = _local11.GetCoreVertices();
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]);
_local10++;
};
m_debugDraw.DrawPolygon(_local14, _local12, _local5);
};
break;
};
}
public function GetContactCount():int{
return (m_contactCount);
}
public function Solve(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local9:int;
var _local10:int;
var _local11:b2Body;
var _local12:b2ContactEdge;
var _local13:b2JointEdge;
var _local14:Boolean;
m_positionIterationCount = 0;
var _local3:b2Island = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2 = _local2.m_next;
};
var _local4:b2Contact = m_contactList;
while (_local4) {
_local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag));
_local4 = _local4.m_next;
};
var _local5:b2Joint = m_jointList;
while (_local5) {
_local5.m_islandFlag = false;
_local5 = _local5.m_next;
};
var _local6:int = m_bodyCount;
var _local7:Array = new Array(_local6);
var _local8:b2Body = m_bodyList;
while (_local8) {
if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){
} else {
if (_local8.IsStatic()){
} else {
_local3.Clear();
_local9 = 0;
var _temp1 = _local9;
_local9 = (_local9 + 1);
var _local15 = _temp1;
_local7[_local15] = _local8;
_local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag);
while (_local9 > 0) {
--_local9;
_local2 = _local7[_local9];
_local3.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local12 = _local2.m_contactList;
while (_local12) {
if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){
} else {
if (_local12.contact.m_manifoldCount == 0){
} else {
_local3.AddContact(_local12.contact);
_local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag);
_local11 = _local12.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local9;
_local9 = (_local9 + 1);
var _local16 = _temp2;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
};
_local12 = _local12.next;
};
_local13 = _local2.m_jointList;
while (_local13) {
if (_local13.joint.m_islandFlag == true){
} else {
_local3.AddJoint(_local13.joint);
_local13.joint.m_islandFlag = true;
_local11 = _local13.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local9;
_local9 = (_local9 + 1);
_local16 = _temp3;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
_local13 = _local13.next;
};
};
};
_local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep);
if (_local3.m_positionIterationCount > m_positionIterationCount){
m_positionIterationCount = _local3.m_positionIterationCount;
};
_local10 = 0;
while (_local10 < _local3.m_bodyCount) {
_local2 = _local3.m_bodies[_local10];
if (_local2.IsStatic()){
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
};
_local10++;
};
};
};
_local8 = _local8.m_next;
};
_local2 = m_bodyList;
while (_local2) {
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local14 = _local2.SynchronizeShapes();
if ((((_local14 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
};
};
_local2 = _local2.m_next;
};
m_broadPhase.Commit();
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array = new Array(_arg3);
var _local5:int = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
var _local6:int;
while (_local6 < _local5) {
_arg2[_local6] = _local4[_local6];
_local6++;
};
return (_local5);
}
public function SetGravity(_arg1:b2Vec2):void{
m_gravity = _arg1;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local11:b2Contact;
var _local12:b2Contact;
var _local13:Number;
var _local14:b2Body;
var _local15:int;
var _local16:b2TimeStep;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:b2Body;
var _local21:Boolean;
var _local8:b2Island = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener);
var _local9:int = m_bodyCount;
var _local10:Array = new Array(_local9);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2.m_sweep.t0 = 0;
_local2 = _local2.m_next;
};
_local11 = m_contactList;
while (_local11) {
_local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local11 = _local11.m_next;
};
while (true) {
_local12 = null;
_local13 = 1;
_local11 = m_contactList;
for (;_local11;(_local11 = _local11.m_next)) {
if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){
} else {
_local18 = 1;
if ((_local11.m_flags & b2Contact.e_toiFlag)){
_local18 = _local11.m_toi;
} else {
_local3 = _local11.m_shape1;
_local4 = _local11.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){
continue;
};
_local19 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local19 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local19);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local19 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local19);
};
};
_local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep);
if ((((_local18 > 0)) && ((_local18 < 1)))){
_local18 = (((1 - _local18) * _local19) + _local18);
if (_local18 > 1){
_local18 = 1;
};
};
_local11.m_toi = _local18;
_local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){
_local12 = _local11;
_local13 = _local18;
};
};
};
if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){
break;
};
_local3 = _local12.m_shape1;
_local4 = _local12.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local5.Advance(_local13);
_local6.Advance(_local13);
_local12.Update(m_contactListener);
_local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag));
if (_local12.m_manifoldCount == 0){
} else {
_local14 = _local5;
if (_local14.IsStatic()){
_local14 = _local6;
};
_local8.Clear();
_local15 = 0;
var _temp1 = _local15;
_local15 = (_local15 + 1);
var _local22 = _temp1;
_local10[_local22] = _local14;
_local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag);
while (_local15 > 0) {
--_local15;
_local2 = _local10[_local15];
_local8.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local8.m_contactCount == _local8.m_contactCapacity){
} else {
if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){
} else {
if (_local7.contact.m_manifoldCount == 0){
} else {
_local8.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local20 = _local7.other;
if ((_local20.m_flags & b2Body.e_islandFlag)){
} else {
if (_local20.IsStatic() == false){
_local20.Advance(_local13);
_local20.WakeUp();
};
var _temp2 = _local15;
_local15 = (_local15 + 1);
var _local23 = _temp2;
_local10[_local23] = _local20;
_local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local7 = _local7.next;
};
};
};
_local16 = new b2TimeStep();
_local16.dt = ((1 - _local13) * _arg1.dt);
_local16.inv_dt = (1 / _local16.dt);
_local16.maxIterations = _arg1.maxIterations;
_local8.SolveTOI(_local16);
_local17 = 0;
while (_local17 < _local8.m_bodyCount) {
_local2 = _local8.m_bodies[_local17];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local21 = _local2.SynchronizeShapes();
if ((((_local21 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
_local7 = _local2.m_contactList;
while (_local7) {
_local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag));
_local7 = _local7.next;
};
};
};
_local17++;
};
_local17 = 0;
while (_local17 < _local8.m_contactCount) {
_local11 = _local8.m_contacts[_local17];
_local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local17++;
};
m_broadPhase.Commit();
};
};
}
public function GetJointList():b2Joint{
return (m_jointList);
}
public function GetBodyList():b2Body{
return (m_bodyList);
}
public function GetPairCount():int{
return (m_broadPhase.m_pairManager.m_pairCount);
}
public function Validate():void{
m_broadPhase.Validate();
}
public function SetWarmStarting(_arg1:Boolean):void{
m_warmStarting = _arg1;
}
public function SetPositionCorrection(_arg1:Boolean):void{
m_positionCorrection = _arg1;
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local3:b2Body;
var _local4:b2Shape;
var _local2:b2Joint = b2Joint.Create(_arg1, m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_node1.joint = _local2;
_local2.m_node1.other = _local2.m_body2;
_local2.m_node1.prev = null;
_local2.m_node1.next = _local2.m_body1.m_jointList;
if (_local2.m_body1.m_jointList){
_local2.m_body1.m_jointList.prev = _local2.m_node1;
};
_local2.m_body1.m_jointList = _local2.m_node1;
_local2.m_node2.joint = _local2;
_local2.m_node2.other = _local2.m_body1;
_local2.m_node2.prev = null;
_local2.m_node2.next = _local2.m_body2.m_jointList;
if (_local2.m_body2.m_jointList){
_local2.m_body2.m_jointList.prev = _local2.m_node2;
};
_local2.m_body2.m_jointList = _local2.m_node2;
if (_arg1.collideConnected == false){
_local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.RefilterProxy(m_broadPhase, _local3.m_xf);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local5:b2Body;
var _local6:b2Shape;
var _local2:Boolean = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_jointList){
m_jointList = _arg1.m_next;
};
var _local3:b2Body = _arg1.m_body1;
var _local4:b2Body = _arg1.m_body2;
_local3.WakeUp();
_local4.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local4.m_jointList){
_local4.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, m_blockAllocator);
m_jointCount--;
if (_local2 == false){
_local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.RefilterProxy(m_broadPhase, _local5.m_xf);
_local6 = _local6.m_next;
};
};
}
public function SetContactListener(_arg1:b2ContactListener):void{
m_contactListener = _arg1;
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
if (m_lock == true){
return (null);
};
var _local2:b2Body = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
public function SetBoundaryListener(_arg1:b2BoundaryListener):void{
m_boundaryListener = _arg1;
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function Step(_arg1:Number, _arg2:int):void{
m_lock = true;
var _local3:b2TimeStep = new b2TimeStep();
_local3.dt = _arg1;
_local3.maxIterations = _arg2;
if (_arg1 > 0){
_local3.inv_dt = (1 / _arg1);
} else {
_local3.inv_dt = 0;
};
_local3.dtRatio = (m_inv_dt0 * _arg1);
_local3.positionCorrection = m_positionCorrection;
_local3.warmStarting = m_warmStarting;
m_contactManager.Collide();
if (_local3.dt > 0){
Solve(_local3);
};
if (((m_continuousPhysics) && ((_local3.dt > 0)))){
SolveTOI(_local3);
};
DrawDebugData();
m_inv_dt0 = _local3.inv_dt;
m_lock = false;
}
public function GetBodyCount():int{
return (m_bodyCount);
}
public function GetJointCount():int{
return (m_jointCount);
}
}
}//package Box2D.Dynamics
Section 75
//bblogo_4 (bubblebox_submit_score_fla.bblogo_4)
package bubblebox_submit_score_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class bblogo_4 extends MovieClip {
public function bblogo_4(){
addFrameScript(0, frame1);
}
function frame1(){
this.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.bubblebox.com/"), "_blank");
});
}
}
}//package bubblebox_submit_score_fla
Section 76
//bubblebox_saving_5 (bubblebox_submit_score_fla.bubblebox_saving_5)
package bubblebox_submit_score_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class bubblebox_saving_5 extends MovieClip {
public function bubblebox_saving_5(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package bubblebox_submit_score_fla
Section 77
//bubblebox_send_btn_2 (bubblebox_submit_score_fla.bubblebox_send_btn_2)
package bubblebox_submit_score_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class bubblebox_send_btn_2 extends MovieClip {
public function bubblebox_send_btn_2(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
this.mouseChildren = false;
this.useHandCursor = true;
this.buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(2);
});
this.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(1);
});
}
}
}//package bubblebox_submit_score_fla
Section 78
//bubblebox_try_again_10 (bubblebox_submit_score_fla.bubblebox_try_again_10)
package bubblebox_submit_score_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class bubblebox_try_again_10 extends MovieClip {
public function bubblebox_try_again_10(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
this.mouseChildren = false;
this.useHandCursor = true;
this.buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(2);
});
this.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(1);
});
}
}
}//package bubblebox_submit_score_fla
Section 79
//bubblebox_view_scores_8 (bubblebox_submit_score_fla.bubblebox_view_scores_8)
package bubblebox_submit_score_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class bubblebox_view_scores_8 extends MovieClip {
public function bubblebox_view_scores_8(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
this.mouseChildren = false;
this.useHandCursor = true;
this.buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(2);
});
this.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(1);
});
}
}
}//package bubblebox_submit_score_fla
Section 80
//AABBox (com.cheezeworld.math.AABBox)
package com.cheezeworld.math {
public class AABBox {
public var width:Number;
public var left:Number;
public var topRight:Vector2D;
public var bottomLeft:Vector2D;
public var halfWidth:Number;
public var top:Number;
public var right:Number;
public var height:Number;
public var bottom:Number;
public var center:Vector2D;
public var bottomRight:Vector2D;
public var halfHeight:Number;
public var topLeft:Vector2D;
public function AABBox(_arg1:Vector2D, _arg2:Number, _arg3:Number){
this.center = new Vector2D(_arg1.x, _arg1.y);
this.width = _arg2;
this.height = _arg3;
halfWidth = (_arg2 / 2);
halfHeight = (_arg3 / 2);
left = (_arg1.x - halfWidth);
right = (_arg1.x + halfWidth);
top = (_arg1.y - halfHeight);
bottom = (_arg1.y + halfHeight);
topLeft = new Vector2D(left, top);
topRight = new Vector2D(right, top);
bottomRight = new Vector2D(right, bottom);
bottomLeft = new Vector2D(left, bottom);
}
public function Set(_arg1:Vector2D, _arg2:Number, _arg3:Number):void{
this.center.x = _arg1.x;
this.center.y = _arg1.y;
this.width = _arg2;
this.height = _arg3;
halfWidth = (_arg2 / 2);
halfHeight = (_arg3 / 2);
left = (_arg1.x - halfWidth);
right = (_arg1.x + halfWidth);
top = (_arg1.y - halfHeight);
bottom = (_arg1.y + halfHeight);
topLeft.x = left;
topLeft.y = top;
topRight.x = right;
topRight.y = top;
bottomRight.x = right;
bottomRight.y = bottom;
bottomLeft.x = left;
bottomLeft.y = bottom;
}
public function setSize(_arg1:Number, _arg2:Number):void{
this.width = _arg1;
this.height = _arg2;
halfWidth = (_arg1 / 2);
halfHeight = (_arg2 / 2);
left = (center.x - halfWidth);
right = (center.x + halfWidth);
top = (center.y - halfHeight);
bottom = (center.y + halfHeight);
topLeft.x = left;
topLeft.y = top;
topRight.x = right;
topRight.y = top;
bottomRight.x = right;
bottomRight.y = bottom;
bottomLeft.x = left;
bottomLeft.y = bottom;
}
public function moveTo(_arg1:Vector2D):void{
center.x = _arg1.x;
center.y = _arg1.y;
left = (center.x - halfWidth);
right = (center.x + halfWidth);
top = (center.y - halfHeight);
bottom = (center.y + halfHeight);
topLeft.x = left;
topLeft.y = top;
topRight.x = right;
topRight.y = top;
bottomRight.x = right;
bottomRight.y = bottom;
bottomLeft.x = left;
bottomLeft.y = bottom;
}
public function isOverlapping(_arg1:AABBox):Boolean{
return (!((((((((_arg1.top > bottom)) || ((_arg1.bottom < top)))) || ((_arg1.left > right)))) || ((_arg1.right < left)))));
}
public function toString():String{
return (String(((((center + " ; width:") + width) + " height:") + height)));
}
}
}//package com.cheezeworld.math
Section 81
//MathUtils (com.cheezeworld.math.MathUtils)
package com.cheezeworld.math {
public class MathUtils {
public static const DEG_TO_RAD:Number = 0.0174532925199433;
public static const RAD_TO_DEG:Number = 57.2957795130823;
public static function simplifyRadian(_arg1:Number):Number{
var _local2:Number;
if ((((_arg1 > Math.PI)) || ((_arg1 < -(Math.PI))))){
_local2 = (_arg1 - (int((_arg1 / (Math.PI * 2))) * (Math.PI * 2)));
if (_arg1 > 0){
if (_local2 < Math.PI){
return (_local2);
};
_local2 = -(((Math.PI * 2) - _local2));
return (_local2);
} else {
if (_local2 > -(Math.PI)){
return (_local2);
};
_local2 = ((Math.PI * 2) + _local2);
return (_local2);
};
};
return (_arg1);
}
public static function getSmallestRotationDirection(_arg1:Number, _arg2:Number, _arg3:Number=0):int{
_arg1 = simplifyRadian(_arg1);
_arg2 = simplifyRadian(_arg2);
_arg2 = (_arg2 + -(_arg1));
_arg2 = simplifyRadian(_arg2);
_arg1 = 0;
if (_arg2 < -(_arg3)){
return (-1);
};
if (_arg2 > _arg3){
return (1);
};
return (0);
}
public static function rand(_arg1:int, _arg2:int):int{
return ((_arg1 + Math.floor((Math.random() * ((_arg2 - _arg1) + 1)))));
}
public static function calcAngle(_arg1:Vector2D, _arg2:Vector2D):Number{
var _local3:Number = (Math.atan(((_arg2.y - _arg1.y) / (_arg2.x - _arg1.x))) * RAD_TO_DEG);
if ((((_arg2.y < _arg1.y)) && ((_arg2.x > _arg1.x)))){
return (_local3);
};
if ((((((_arg2.y < _arg1.y)) && ((_arg2.x < _arg1.x)))) || ((((_arg2.y > _arg1.y)) && ((_arg2.x < _arg1.x)))))){
return ((_local3 + 180));
};
return ((_local3 + 360));
}
}
}//package com.cheezeworld.math
Section 82
//Vector2D (com.cheezeworld.math.Vector2D)
package com.cheezeworld.math {
import flash.geom.*;
public class Vector2D {
private var v2:Vector2D;
private var _length:Number;
private var _oldX:Number;
private var v1:Vector2D;
private var _oldY:Number;
public var x:Number;
public var y:Number;
private static const DEG_TO_RAD:Number = 0.0174532925199433;
private static const RAD_TO_DEG:Number = 57.2957795130823;
public function Vector2D(_arg1:Number=0, _arg2:Number=0){
x = _arg1;
y = _arg2;
_length = 0;
}
public function divide(_arg1:Number):void{
if (_arg1 == 0){
trace("Vector::dividedBy() - Illegal Divide by Zero!");
} else {
x = (x / _arg1);
y = (y / _arg1);
};
}
public function isZero():Boolean{
return ((((x == 0)) || ((y == 0))));
}
public function Set(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function sign(_arg1:Vector2D):int{
if ((y * _arg1.x) > (x * _arg1.y)){
return (-1);
};
return (1);
}
public function dotOf(_arg1:Vector2D):Number{
return (((x * _arg1.x) + (y * _arg1.y)));
}
public function dividedBy(_arg1:Number):Vector2D{
if (_arg1 == 0){
trace("Vector::dividedBy() - Illegal Divide by Zero!");
return (new Vector2D());
};
return (new Vector2D((x / _arg1), (y / _arg1)));
}
public function normalize():void{
if (length != 0){
x = (x / _length);
y = (y / _length);
};
}
public function isParallelTo(_arg1:Vector2D):Boolean{
v1 = copy();
v1.normalize();
v2 = _arg1.copy();
v2.normalize();
return ((((((v1.x == v2.x)) && ((v1.y == v2.y)))) || ((((v1.x == -(v2.x))) && ((v1.y == -(v2.y)))))));
}
public function distanceTo(_arg1:Vector2D):Number{
var _local2:Number = (_arg1.x - x);
var _local3:Number = (_arg1.y - y);
return (Math.sqrt(((_local3 * _local3) + (_local2 * _local2))));
}
public function subtract(_arg1:Vector2D):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function toPoint():Point{
return (new Point(x, y));
}
public function toRotation():Number{
var _local1:Number = Math.atan((y / x));
if ((((y < 0)) && ((x > 0)))){
return (_local1);
};
if ((((((y < 0)) && ((x < 0)))) || ((((y > 0)) && ((x < 0)))))){
return ((_local1 + 3.14159265358979));
};
return ((_local1 + 6.28318530717959));
}
public function isInsideRegion(_arg1:Vector2D, _arg2:Vector2D):Boolean{
return (!((((((((x < _arg1.x)) || ((x > (_arg1.x + _arg2.x))))) || ((y < _arg1.y)))) || ((y > (_arg1.y + _arg2.y))))));
}
public function addedTo(_arg1:Vector2D):Vector2D{
return (new Vector2D((x + _arg1.x), (y + _arg1.y)));
}
public function perpDotOf(_arg1:Vector2D):Number{
return (getPerp().dotOf(_arg1));
}
public function projectionOn(_arg1:Vector2D):Vector2D{
v1 = _arg1.copy();
v1.multiply((this.dotOf(_arg1) / _arg1.dotOf(_arg1)));
return (v1);
}
public function distanceSqTo(_arg1:Vector2D):Number{
var _local2:Number = (_arg1.y - y);
var _local3:Number = (_arg1.x - x);
return (((_local3 * _local3) + (_local2 * _local2)));
}
public function get lengthSq():Number{
return (((x * x) + (y * y)));
}
public function get length():Number{
if (((!((_oldX == x))) || (!((_oldY == y))))){
_oldX = x;
_oldY = y;
_length = Math.sqrt(((x * x) + (y * y)));
};
return (_length);
}
public function getPerp():Vector2D{
return (new Vector2D(-(y), x));
}
public function subtractedBy(_arg1:Vector2D):Vector2D{
return (new Vector2D((x - _arg1.x), (y - _arg1.y)));
}
public function multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function toString():String{
return ((((("( " + x) + ", ") + y) + " )"));
}
public function truncate(_arg1:Number):void{
if (lengthSq > (_arg1 * _arg1)){
normalize();
multiply(_arg1);
};
}
public function angleTo(_arg1:Vector2D):Number{
return (Math.acos((dotOf(_arg1) / (length * _arg1.length))));
}
public function multipliedBy(_arg1:Number):Vector2D{
return (new Vector2D((x * _arg1), (y * _arg1)));
}
public function getNormalized():Vector2D{
if (length == 0){
return (new Vector2D());
};
return (new Vector2D((x / _length), (y / _length)));
}
public function copy():Vector2D{
var _local1:Vector2D = new Vector2D(x, y);
_local1._length = _length;
_local1._oldX = x;
_local1._oldY = y;
return (_local1);
}
public function wrapAround(_arg1:Vector2D, _arg2:Vector2D):void{
if (x > _arg2.x){
x = (_arg1.x + (x - _arg2.x));
} else {
if (x < _arg1.x){
x = (_arg2.x + x);
};
};
if (y < _arg1.y){
y = (_arg2.y + y);
} else {
if (y > _arg2.y){
y = (_arg1.y + (y - _arg2.y));
};
};
}
public function getReverse():Vector2D{
return (new Vector2D(-(x), -(y)));
}
public function addTo(_arg1:Vector2D):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function reflect(_arg1:Vector2D):void{
v1 = _arg1.getReverse();
v1.multiply((2 * dotOf(_arg1)));
addTo(v1);
}
public function crossOf(_arg1:Vector2D):Number{
return (((x * _arg1.y) - (y * _arg1.x)));
}
public static function rotToHeading(_arg1:Number):Vector2D{
var _local2:Number = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
return (new Vector2D(_local2, _local3));
}
public static function is2ndInFOVof1st(_arg1:Vector2D, _arg2:Vector2D, _arg3:Number, _arg4:Vector2D):Boolean{
var _local5:Vector2D = _arg4.copy();
_local5.subtract(_arg1);
_local5.normalize();
return ((_arg2.dotOf(_local5) >= Math.cos((_arg3 / 2))));
}
public static function pointToVector(_arg1:Point):Vector2D{
return (new Vector2D(_arg1.x, _arg1.y));
}
}
}//package com.cheezeworld.math
Section 83
//AScreen (com.cheezeworld.screens.AScreen)
package com.cheezeworld.screens {
import flash.display.*;
import flash.events.*;
public class AScreen extends Sprite implements IScreenItem {
private var m_parentScreen:IScreenItem;
private var m_currentScreen:IScreenItem;
public function AScreen(_arg1:IScreenItem=null){
m_parentScreen = _arg1;
if ((m_parentScreen == null)){
m_currentScreen = null;
} else {
m_currentScreen = currentScreen;
};
}
public function get currentScreen():IScreenItem{
if (m_parentScreen != null){
return (m_parentScreen.currentScreen);
};
return (m_currentScreen);
}
public function dispose():void{
}
public function update(_arg1:int):void{
if ((((m_parentScreen == null)) && (!((m_currentScreen == null))))){
m_currentScreen.update(_arg1);
};
}
public function setScreen(_arg1:Class):void{
if (m_parentScreen != null){
m_parentScreen.setScreen(_arg1);
return;
};
if (m_currentScreen != null){
removeChild((m_currentScreen as Sprite));
m_currentScreen.dispose();
};
m_currentScreen = new _arg1(this);
addChild((m_currentScreen as Sprite));
}
public function get parentScreen():IScreenItem{
return (m_parentScreen);
}
}
}//package com.cheezeworld.screens
Section 84
//IScreenItem (com.cheezeworld.screens.IScreenItem)
package com.cheezeworld.screens {
import flash.events.*;
public interface IScreenItem extends IEventDispatcher {
function get currentScreen():IScreenItem;
function get parentScreen():IScreenItem;
function update(_arg1:int):void;
function setScreen(_arg1:Class):void;
function dispose():void;
}
}//package com.cheezeworld.screens
Section 85
//Root (com.cheezeworld.screens.Root)
package com.cheezeworld.screens {
import com.cheezeworld.utils.*;
import flash.display.*;
import flash.events.*;
import com.urbansquall.metronome.*;
public class Root extends AScreen {
private const DEFAULT_QUALITY:String = "high";
private const TICK_INTERVAL:int = 25;
private var m_screenToSet:Class;
private var m_ticker:Ticker;
public static const WIDTH:Number = 500;
public static const HEIGHT:Number = 440;
private static var m_areBreakpointsEnabled:Boolean;
private static var m_gameSpeed:Number;
private static var m_isUpdateOn:Boolean;
public static var stage:Stage;
public function Root(_arg1:Stage=null){
m_gameSpeed = 1;
if (_arg1 == null){
Root.stage = this.stage;
} else {
Root.stage = _arg1;
};
Root.stage.quality = DEFAULT_QUALITY;
m_isUpdateOn = true;
m_areBreakpointsEnabled = true;
Input.instance.activate(Root.stage);
onDataLoad(null);
}
private function onTick(_arg1:TickerEvent):void{
if (m_isUpdateOn){
update((_arg1.interval * m_gameSpeed));
};
Input.instance.update();
if (m_screenToSet){
super.setScreen(m_screenToSet);
m_screenToSet = null;
};
}
private function handleInput():void{
if (Input.instance.isKeyPressed(KeyCode.P)){
m_isUpdateOn = !(m_isUpdateOn);
trace(("<Root> Game " + (m_isUpdateOn) ? "unpaused" : "paused"));
};
if (Input.instance.isKeyPressed(KeyCode.PAGE_DOWN)){
if (!(m_isUpdateOn)){
update(TICK_INTERVAL);
};
};
if (Input.instance.isKeyPressed(KeyCode.PAGE_UP)){
m_areBreakpointsEnabled = !(m_areBreakpointsEnabled);
trace(("<Root> Breakpoints " + (m_areBreakpointsEnabled) ? "enabled" : "disabled"));
};
}
private function onDataLoad(_arg1:Event):void{
m_ticker = new Ticker(TICK_INTERVAL);
m_ticker.addEventListener(TickerEvent.TICK, onTick);
m_ticker.start();
Root.stage.showDefaultContextMenu = false;
}
override public function setScreen(_arg1:Class):void{
m_screenToSet = _arg1;
}
public static function pauseGame():void{
m_isUpdateOn = true;
}
public static function togglePause():void{
m_isUpdateOn = !(m_isUpdateOn);
}
public static function set gameSpeed(_arg1:Number):void{
m_gameSpeed = _arg1;
if (m_gameSpeed < 0){
m_gameSpeed = 0;
};
}
public static function breakpoint(_arg1:String, _arg2:Boolean=false):void{
if (((!(m_areBreakpointsEnabled)) && (!(_arg2)))){
return;
};
trace(("<Root> Breakpoint: " + _arg1));
m_isUpdateOn = false;
}
public static function get gameSpeed():Number{
return (m_gameSpeed);
}
public static function resumeGame():void{
m_isUpdateOn = false;
}
}
}//package com.cheezeworld.screens
Section 86
//Input (com.cheezeworld.utils.Input)
package com.cheezeworld.utils {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import com.cheezeworld.math.*;
import models.*;
public class Input {
public var _keyBuffer:Array;
private var _ot:int;
public var isMousePressed:Boolean;// = false
private var _timeKeyReleased:int;
private var _timeMousePressed:int;
public var mouseDelta:int;// = 0
public var lastKeyName:String;// = ""
public var worldMousePos:Vector2D;
private var _timeKeyPressed:int;
private var m_canvasX:int;
private var _keyArr:Array;
private var _timeMouseReleased:int;
private var _bufferSize:int;
private var m_camera:GameCamera;
private var _dt:int;
private var _keyState:Array;
public var mouseX:Number;// = 0
public var mouseY:Number;// = 0
private var _hasMouseScrolled:Boolean;
private var _ascii:Array;
public var mouseBounds:AABBox;
public var isMouseDown:Boolean;// = false
private var _nt:int;
private var m_canvasY:int;
public var mousePos:Vector2D;
public var lastKeyCode:int;// = 0
public var isMouseReleased:Boolean;// = false
private var _stage:Stage;
private static const BUFFER_SIZE:int = 5;
private static var _instance:Input;
public function Input(_arg1:SingletonEnforcer){
_timeKeyPressed = (_nt = (_ot = getTimer()));
_dt = 0;
mousePos = new Vector2D();
worldMousePos = new Vector2D();
_ascii = new Array(222);
fillAscii();
_keyState = new Array(222);
_keyArr = new Array();
var _local2:int;
while (_local2 < 222) {
_keyState[_local2] = new int(0);
if (_ascii[_local2] != undefined){
_keyArr.push(_local2);
};
_local2++;
};
_bufferSize = Input.BUFFER_SIZE;
_keyBuffer = new Array(_bufferSize);
var _local3:int;
while (_local3 < _bufferSize) {
_keyBuffer[_local3] = new Array(0, 0);
_local3++;
};
}
public function activateWorldMouse(_arg1:GameWorld, _arg2:int, _arg3:int):void{
m_camera = _arg1.camera;
m_canvasX = _arg2;
m_canvasY = _arg3;
}
public function isKeyPressed(_arg1:int):Boolean{
return ((_keyState[_arg1] == 1));
}
public function get timeSinceMouseReleased():int{
return ((getTimer() - _timeMouseReleased));
}
private function mouseMove(_arg1:MouseEvent):void{
mouseX = (_arg1.stageX - _stage.x);
mouseY = (_arg1.stageY - _stage.y);
mousePos.x = mouseX;
mousePos.y = mouseY;
if (m_camera != null){
worldMousePos.x = ((mouseX + m_camera.bounds.width) - m_camera.position.x);
worldMousePos.y = ((mouseY + m_camera.bounds.height) - m_camera.position.y);
} else {
worldMousePos.x = mouseX;
worldMousePos.y = mouseY;
};
}
public function isKeyDown(_arg1:int):Boolean{
return ((_keyState[_arg1] > 0));
}
public function desactivateWorldMouse():void{
m_camera = null;
m_canvasX = 0;
m_canvasY = 0;
}
public function getKeyString(_arg1:int):String{
return (_ascii[_arg1]);
}
private function fillAscii():void{
_ascii[65] = "A";
_ascii[66] = "B";
_ascii[67] = "C";
_ascii[68] = "D";
_ascii[69] = "E";
_ascii[70] = "F";
_ascii[71] = "G";
_ascii[72] = "H";
_ascii[73] = "I";
_ascii[74] = "J";
_ascii[75] = "K";
_ascii[76] = "L";
_ascii[77] = "M";
_ascii[78] = "N";
_ascii[79] = "O";
_ascii[80] = "P";
_ascii[81] = "Q";
_ascii[82] = "R";
_ascii[83] = "S";
_ascii[84] = "T";
_ascii[85] = "U";
_ascii[86] = "V";
_ascii[87] = "W";
_ascii[88] = "X";
_ascii[89] = "Y";
_ascii[90] = "Z";
_ascii[48] = "0";
_ascii[49] = "1";
_ascii[50] = "2";
_ascii[51] = "3";
_ascii[52] = "4";
_ascii[53] = "5";
_ascii[54] = "6";
_ascii[55] = "7";
_ascii[56] = "8";
_ascii[57] = "9";
_ascii[32] = "Space";
_ascii[13] = "Enter";
_ascii[17] = "Ctrl";
_ascii[16] = "Shift";
_ascii[192] = "~";
_ascii[38] = "Up";
_ascii[40] = "Down";
_ascii[37] = "Left";
_ascii[39] = "Right";
_ascii[96] = "Numpad 0";
_ascii[97] = "Numpad 1";
_ascii[98] = "Numpad 2";
_ascii[99] = "Numpad 3";
_ascii[100] = "Numpad 4";
_ascii[101] = "Numpad 5";
_ascii[102] = "Numpad 6";
_ascii[103] = "Numpad 7";
_ascii[104] = "Numpad 8";
_ascii[105] = "Numpad 9";
_ascii[111] = "Numpad /";
_ascii[106] = "Numpad *";
_ascii[109] = "Numpad -";
_ascii[107] = "Numpad +";
_ascii[110] = "Numpad .";
_ascii[45] = "Insert";
_ascii[46] = "Delete";
_ascii[33] = "Page Up";
_ascii[34] = "Page Down";
_ascii[35] = "End";
_ascii[36] = "Home";
_ascii[112] = "F1";
_ascii[113] = "F2";
_ascii[114] = "F3";
_ascii[115] = "F4";
_ascii[116] = "F5";
_ascii[117] = "F6";
_ascii[118] = "F7";
_ascii[119] = "F8";
_ascii[188] = ",";
_ascii[190] = ".";
_ascii[186] = ";";
_ascii[222] = "'";
_ascii[219] = "[";
_ascii[221] = "]";
_ascii[189] = "-";
_ascii[187] = "+";
_ascii[220] = "\\";
_ascii[191] = "/";
_ascii[9] = "TAB";
_ascii[8] = "Backspace";
_ascii[27] = "ESC";
}
private function mousePress(_arg1:MouseEvent):void{
isMouseDown = true;
isMousePressed = true;
_timeMousePressed = getTimer();
}
private function mouseRelease(_arg1:MouseEvent):void{
isMouseDown = false;
isMouseReleased = true;
_timeMouseReleased = getTimer();
}
private function keyPress(_arg1:KeyboardEvent):void{
_keyState[_arg1.keyCode] = Math.max(_keyState[_arg1.keyCode], 1);
lastKeyName = _ascii[_arg1.keyCode];
lastKeyCode = _arg1.keyCode;
if (_keyState[_arg1.keyCode] == 1){
_timeKeyPressed = getTimer();
};
}
private function keyRelease(_arg1:KeyboardEvent):void{
_keyState[_arg1.keyCode] = -1;
var _local2:int = (_bufferSize - 1);
while (_local2 > 0) {
_keyBuffer[_local2] = _keyBuffer[(_local2 - 1)];
_local2--;
};
_keyBuffer[0] = [_arg1.keyCode, 0];
_timeKeyReleased = getTimer();
}
public function get timeSinceLastKeyRelease():int{
return ((getTimer() - _timeKeyReleased));
}
public function isKeyReleased(_arg1:int):Boolean{
return ((_keyState[_arg1] == -1));
}
public function isKeyInBuffer(_arg1:int, _arg2:int, _arg3:int):Boolean{
return ((((_keyBuffer[_arg2][0] == _arg1)) && ((_keyBuffer[_arg2][1] <= _arg3))));
}
public function update():void{
_nt = getTimer();
_dt = (_nt - _ot);
_ot = _nt;
var _local1:int;
while (_local1 < _keyArr.length) {
if (_keyState[_keyArr[_local1]] != 0){
var _local3 = _keyState;
var _local4 = _keyArr[_local1];
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
};
_local1++;
};
var _local2:int;
while (_local2 < _bufferSize) {
_keyBuffer[_local2][1] = (_keyBuffer[_local2][1] + _dt);
_local2++;
};
isMousePressed = false;
isMouseReleased = false;
}
public function get timeSinceMousePressed():int{
return ((getTimer() - _timeMousePressed));
}
private function mouseScroll(_arg1:MouseEvent):void{
_hasMouseScrolled = true;
mouseDelta = _arg1.delta;
}
public function onCameraMove(_arg1:Event=null):void{
worldMousePos.x = (mouseX + m_camera.bounds.topLeft.x);
worldMousePos.y = (mouseY + m_camera.bounds.topLeft.y);
}
public function get timeSinceLastKeyPress():int{
return ((getTimer() - _timeKeyPressed));
}
public function activate(_arg1:Stage):void{
_stage = _arg1;
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyPress, false, 0, true);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyRelease, false, 0, true);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, mousePress, false, 0, true);
_arg1.addEventListener(MouseEvent.MOUSE_UP, mouseRelease, false, 0, true);
_arg1.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove, false, 0, true);
_arg1.addEventListener(MouseEvent.MOUSE_WHEEL, mouseScroll, false, 0, true);
}
public function get hasMouseScrolled():Boolean{
if (_hasMouseScrolled){
_hasMouseScrolled = false;
return (true);
};
return (false);
}
public static function get instance():Input{
if (Input._instance == null){
Input._instance = new Input(new SingletonEnforcer());
};
return (Input._instance);
}
}
}//package com.cheezeworld.utils
class SingletonEnforcer {
private function SingletonEnforcer(){
}
}
Section 87
//KeyCode (com.cheezeworld.utils.KeyCode)
package com.cheezeworld.utils {
public class KeyCode {
public static const BACKWARD_SLASH:int = 220;
public static const RIGHT:int = 39;
public static const LEFT:int = 37;
public static const SPACEBAR:int = 32;
public static const FOUR:int = 52;
public static const TWO:int = 50;
public static const CLEAR:int = 12;
public static const TILDE:int = 192;
public static const CONTROL:int = 17;
public static const NUMPAD_DECIMAL:int = 110;
public static const A:int = 65;
public static const B:int = 66;
public static const C:int = 67;
public static const D:int = 68;
public static const E:int = 69;
public static const F:int = 70;
public static const G:int = 71;
public static const H:int = 72;
public static const I:int = 73;
public static const J:int = 74;
public static const K:int = 75;
public static const L:int = 76;
public static const M:int = 77;
public static const N:int = 78;
public static const O:int = 79;
public static const P:int = 80;
public static const Q:int = 81;
public static const R:int = 82;
public static const S:int = 83;
public static const T:int = 84;
public static const U:int = 85;
public static const V:int = 86;
public static const W:int = 87;
public static const X:int = 88;
public static const Y:int = 89;
public static const Z:int = 90;
public static const ONE:int = 49;
public static const PAGE_UP:int = 33;
public static const NUMPAD_ENTER:int = 108;
public static const COLON:int = 186;
public static const BACKSPACE:int = 8;
public static const EIGHT:int = 56;
public static const SHIFT:int = 16;
public static const TAB:int = 9;
public static const THREE:int = 51;
public static const HELP:int = 47;
public static const QUOTES:int = 222;
public static const ALT:int = 18;
public static const NUMPAD_ADD:int = 107;
public static const ESC:int = 27;
public static const F3:int = 114;
public static const ZERO:int = 48;
public static const F4:int = 115;
public static const F5:int = 116;
public static const F6:int = 117;
public static const F7:int = 118;
public static const NUMPAD_DIVIDE:int = 111;
public static const F2:int = 113;
public static const CLOSED_BRACKET:int = 221;
public static const UP:int = 38;
public static const NUMPAD_0:int = 96;
public static const NUMPAD_1:int = 97;
public static const NUMPAD_2:int = 98;
public static const FIVE:int = 53;
public static const SIX:int = 54;
public static const NUMPAD_5:int = 101;
public static const NUMPAD_6:int = 102;
public static const NUMPAD_7:int = 103;
public static const NUMPAD_SUBTRACT:int = 109;
public static const NUMPAD_9:int = 105;
public static const NUMPAD_3:int = 99;
public static const NUMPAD_4:int = 100;
public static const NINE:int = 57;
public static const F9:int = 120;
public static const NUMPAD_8:int = 104;
public static const DOWN:int = 40;
public static const F8:int = 119;
public static const NUMPAD_MULTIPLY:int = 106;
public static const EQUALS:int = 187;
public static const F1:int = 112;
public static const UNDERSCORE:int = 189;
public static const HOME:int = 36;
public static const DELETE:int = 46;
public static const F10:int = 121;
public static const F11:int = 122;
public static const F12:int = 123;
public static const F13:int = 124;
public static const F14:int = 125;
public static const F15:int = 126;
public static const CAPS_LOCK:int = 20;
public static const SEVEN:int = 55;
public static const INSERT:int = 45;
public static const END:int = 35;
public static const OPEN_BRACKET:int = 219;
public static const QUESTION_MARK:int = 191;
public static const NUM_LOCK:int = 144;
public static const PAGE_DOWN:int = 34;
public static const ENTER:int = 13;
}
}//package com.cheezeworld.utils
Section 88
//SoundManager (com.cheezeworld.utils.SoundManager)
package com.cheezeworld.utils {
import flash.media.*;
import flash.utils.*;
import flash.events.*;
public class SoundManager {
private var m_volumeMap:Dictionary;
private var m_sounds:Dictionary;
private var m_musicTransform:SoundTransform;
private var m_soundTransform:SoundTransform;
private var m_channels:Dictionary;
private var m_musicChannel:SoundChannel;
private var _mute:Boolean;
private static var m_instance:SoundManager;
public function SoundManager(_arg1:SingletonEnforcer){
m_musicChannel = new SoundChannel();
m_musicTransform = new SoundTransform(1);
m_soundTransform = new SoundTransform(1);
m_sounds = new Dictionary();
m_channels = new Dictionary();
_mute = false;
}
public function stopMusic():void{
m_musicChannel.stop();
}
public function addCallback(_arg1:String, _arg2:Function):void{
m_channels[_arg1].addEventListener(Event.SOUND_COMPLETE, _arg2);
}
public function getVolumeOf(_arg1:String):Number{
if ((((m_channels[_arg1] == null)) || (_mute))){
return (0);
};
return (SoundChannel(m_channels[_arg1]).soundTransform.volume);
}
public function get soundVolume():Number{
return (m_soundTransform.volume);
}
public function playMusic(_arg1:String, _arg2:int=0, _arg3:int=0):void{
if (m_sounds[_arg1] == null){
throw (new Error((("<SoundManager> Sound: " + _arg1) + " does not exist!")));
};
m_musicChannel = m_sounds[_arg1].play(_arg2, _arg3, m_musicTransform);
}
public function set soundVolume(_arg1:Number):void{
if (_arg1 < 0){
_arg1 = 0;
};
m_soundTransform.volume = _arg1;
}
public function setVolumeOf(_arg1:String, _arg2:Number):void{
if ((((m_channels[_arg1] == null)) || (_mute))){
return;
};
var _local3:SoundTransform = new SoundTransform(_arg2);
SoundChannel(m_channels[_arg1]).soundTransform = _local3;
trace(_arg2, SoundChannel(m_channels[_arg1]).soundTransform.volume);
}
public function get mute():Boolean{
return (_mute);
}
public function get musicVolume():Number{
return (m_musicTransform.volume);
}
private function handleVolume():void{
var _local1:SoundChannel;
if (_mute){
for each (_local1 in m_channels) {
_local1.soundTransform = new SoundTransform(0);
};
};
}
public function removeCallback(_arg1:String, _arg2:Function):void{
m_channels[_arg1].removeEventListener(Event.SOUND_COMPLETE, _arg2);
}
public function stopSound(_arg1:String):void{
if (m_channels[_arg1] != null){
m_channels[_arg1].stop();
delete m_channels[_arg1];
};
}
public function set mute(_arg1:Boolean):void{
_mute = _arg1;
}
public function registerSound(_arg1:Sound, _arg2:String):void{
m_sounds[_arg2] = _arg1;
}
public function playSound(_arg1:String, _arg2:int=0, _arg3:int=0):void{
var _local4:Boolean;
if (m_sounds[_arg1] == null){
throw (new Error((("<SoundManager> Sound: " + _arg1) + " does not exist!")));
};
m_channels[_arg1] = m_sounds[_arg1].play(_arg2, _arg3, m_soundTransform);
}
public function set musicVolume(_arg1:Number):void{
if (_arg1 < 0){
_arg1 = 0;
};
m_musicTransform.volume = _arg1;
m_musicChannel.soundTransform = m_musicTransform;
}
public static function get instance():SoundManager{
if (SoundManager.m_instance == null){
SoundManager.m_instance = new SoundManager(new SingletonEnforcer());
};
return (SoundManager.m_instance);
}
}
}//package com.cheezeworld.utils
class SingletonEnforcer {
private function SingletonEnforcer(){
}
}
Section 89
//Ticker (com.urbansquall.metronome.Ticker)
package com.urbansquall.metronome {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Ticker extends EventDispatcher {
private var m_accruedTime:Number;
private var m_running:Boolean;
private var m_shape:Shape;
private var m_delay:Number;
private var m_timeOfLastUpdate:Number;
public function Ticker(_arg1:Number=33){
m_running = false;
m_delay = _arg1;
m_shape = new Shape();
}
public function get delay():int{
return (m_delay);
}
public function stop():void{
m_shape.removeEventListener(Event.ENTER_FRAME, tick);
m_running = false;
}
private function calculateDeltaTime():Number{
var _local1:Number = getTimer();
var _local2:Number = (_local1 - m_timeOfLastUpdate);
m_timeOfLastUpdate = _local1;
return (_local2);
}
public function start():void{
m_running = true;
m_timeOfLastUpdate = getTimer();
m_accruedTime = 0;
m_shape.addEventListener(Event.ENTER_FRAME, tick, false, 0, true);
}
private function tick(_arg1:Event):void{
var _local2:Number = calculateDeltaTime();
if (!(m_running)){
return;
};
m_accruedTime = (m_accruedTime + _local2);
while (m_accruedTime >= m_delay) {
m_accruedTime = (m_accruedTime - m_delay);
dispatchEvent(new TickerEvent(m_delay));
};
}
public function get running():Boolean{
return (m_running);
}
}
}//package com.urbansquall.metronome
Section 90
//TickerEvent (com.urbansquall.metronome.TickerEvent)
package com.urbansquall.metronome {
import flash.events.*;
public class TickerEvent extends Event {
private var m_interval:Number;
public static const TICK:String = "tick";
public function TickerEvent(_arg1:Number){
super(TICK, false, false);
m_interval = _arg1;
}
public function get interval():Number{
return (m_interval);
}
}
}//package com.urbansquall.metronome
Section 91
//FPS (com.urbansquall.utils.FPS)
package com.urbansquall.utils {
import flash.events.*;
import flash.text.*;
import flash.utils.*;
import com.cheezeworld.screens.*;
public class FPS extends TextField {
protected var timeOfLastUpdate:Number;
protected var timer:Timer;
protected var frames:int;
private static var m_current:int = 0;
public function FPS(){
defaultTextFormat = new TextFormat("Verdana", 9, 0);
timer = new Timer(1000);
this.autoSize = TextFieldAutoSize.CENTER;
this.text = "FPS";
this.backgroundColor = 0xFFFFFF;
this.background = true;
this.selectable = false;
timer.addEventListener(TimerEvent.TIMER, timerHandler);
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
timer.start();
timeOfLastUpdate = getTimer();
}
private function timerHandler(_arg1:TimerEvent):void{
var _local2:Number = calculateDeltaTime();
text = ((Root.stage.quality.toUpperCase() + " / ") + String(Math.round((frames / (_local2 / 1000)))));
m_current = Math.round((frames / (_local2 / 1000)));
frames = 0;
}
private function enterFrameHandler(_arg1:Event):void{
frames++;
}
private function calculateDeltaTime():Number{
var _local1:Number = getTimer();
var _local2:Number = (_local1 - timeOfLastUpdate);
timeOfLastUpdate = _local1;
return (_local2);
}
public function reset():void{
frames = 0;
text = "FPS";
timeOfLastUpdate = getTimer();
}
public static function get():int{
return (m_current);
}
}
}//package com.urbansquall.utils
Section 92
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
public class AdLoader extends Sprite {
private var cpmstarLoader:Loader;
private var contentspotid:String;
public function AdLoader(_arg1:String){
this.contentspotid = _arg1;
addEventListener(Event.ADDED, addedHandler);
}
private function dispatchHandler(_arg1:Event):void{
dispatchEvent(_arg1);
}
private function addedHandler(_arg1:Event):void{
removeEventListener(Event.ADDED, addedHandler);
Security.allowDomain("server.cpmstar.com");
var _local2:String = "http://server.cpmstar.com/adviewas3.swf";
var _local3:DisplayObjectContainer = parent;
cpmstarLoader = new Loader();
cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler);
cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler);
cpmstarLoader.load(new URLRequest(((_local2 + "?contentspotid=") + contentspotid)));
addChild(cpmstarLoader);
}
}
}//package CPMStar
Section 93
//AFX (data.AFX)
package data {
import models.*;
public class AFX extends GameObject {
public function AFX(_arg1:GameObjectParams){
super(_arg1);
alwaysUpdate = true;
}
override public function update():void{
super.update();
if (getClip().currentFrame == getClip().totalFrames){
$parent.removeObject(this);
};
}
}
}//package data
Section 94
//AStair (data.AStair)
package data {
import flash.utils.*;
import flash.display.*;
public class AStair {
public var clip:MovieClip;
public var weight:Number;
public var name:String;
public var levelComplete:int;
public function AStair(_arg1:MovieClip, _arg2:Number=0.5, _arg3:int=0){
clip = _arg1;
weight = _arg2;
levelComplete = _arg3;
name = getQualifiedClassName(clip).toUpperCase();
}
}
}//package data
Section 95
//Avatar (data.Avatar)
package data {
import com.cheezeworld.math.*;
import screens.*;
import models.*;
import gs.*;
import flash.events.*;
import com.cheezeworld.utils.*;
public class Avatar extends GameObject implements ICollider {
private const TRAIL_TIME:int;
private const JUMP_DELAY:int = 2;
private const TOP:Vector2D;
private const MOON_LINK_ID:String = "moon_revolute_joint";
private const GEAR_LINK_ID:String = "gear_revolute_joint";
private const BASE:Vector2D;
private const ANG_ACC:Number = 0.005;
private const MAX_ACC:Number = 70;
private const JUMP_COEF:Number = 0.8;
private var _readyToDispose:Boolean;
private var _trailcounter:int;// = 0
private var _initPos:Vector2D;
private var _gear:Gear;
private var _jumpFrameCounter:int;// = 0
private var _prevRestitution:Number;
public static const RUN:String = "Run";
public static const DASH:String = "Dash";
public static const FLY:String = "Fly";
public static const IDLE:String = "Idle";
public static const RECOVERY:String = "Recovery";
public static const REACH_THE_MOON:String = "Reach_The_Moon";
public static const WIN:String = "Win";
public static var sens:int;
private static var _state:String;
private static var _angVel:Number;
public function Avatar(_arg1:GameObjectParams){
BASE = new Vector2D(0, ((Definitions.STAGE_HEIGHT * Tower.NB_STAIRS) - (220 - 50)));
TOP = new Vector2D(0, (Definitions.STAGE_HEIGHT * 0.8));
TRAIL_TIME = Math.round((Definitions.FRAMERATE / 8));
super(_arg1);
sens = 1;
_readyToDispose = false;
}
private function collideBloc(_arg1:GameObject):void{
var _local2:Number = _arg1.getPhysics().GetAngle();
if (!(_local2)){
return;
};
getPhysics().PutToSleep();
getPhysics().GetShapeList().m_restitution = 0.2;
getPhysics().GetShapeList().m_friction = 0.5;
getPhysics().WakeUp();
_state = DASH;
rotation = 0;
if (_local2 > 0){
getClip().scaleX = 1;
} else {
if (_local2 < 0){
getClip().scaleX = -1;
};
};
}
private function restore():void{
GameStats.instance.setAvatarProgression((BASE.distanceTo(TOP) - Math.abs((BASE.y - position.y))), BASE.distanceTo(TOP));
var _local1:Number = 0;
if ((((getPhysics().GetLinearVelocity().Length() >= Definitions.AVATAR_TRAIL_VELOCITY)) && ((((state == FLY)) || ((state == RUN)))))){
generateTrail();
if (_state == FLY){
_local1 = ((getPhysics().GetLinearVelocity().Length() - Definitions.AVATAR_TRAIL_VELOCITY) / 5);
};
if (_local1 > 1){
_local1 = 1;
};
};
SFX.instance.Fly(_local1);
if (_gear != null){
return;
};
if ((((_jumpFrameCounter > 0)) && ((_jumpFrameCounter < JUMP_DELAY)))){
_jumpFrameCounter++;
} else {
if (_jumpFrameCounter >= JUMP_DELAY){
_jumpFrameCounter = 0;
};
};
}
override protected function init(_arg1:Event=null):void{
super.init(_arg1);
_angVel = Definitions.AVATAR_START_ROTATION;
_state = IDLE;
getPhysics().PutToSleep();
_prevRestitution = getPhysics().GetShapeList().m_restitution;
_initPos = new Vector2D(position.x, position.y);
TweenMax.to(getClip(), 1, {glowFilter:{color:0xFFFFFF, alpha:1, blurX:20, blurY:20}});
addEventListener(Event.COMPLETE, onAnimComplete);
}
private function generateTrail():void{
var _local1:Object;
var _local2:Vector2D;
var _local3:FXPrint;
if (!(_trailcounter)){
_local1 = {};
_local1.alpha = 0;
_local2 = new Vector2D();
_local2.x = position.x;
_local2.y = position.y;
_local3 = ($parent.createObject("Trail", _local2) as FXPrint);
_local3.draw(this);
_trailcounter = TRAIL_TIME;
} else {
_trailcounter--;
};
}
private function reachTheMoon():void{
var _local1:Vector2D = position.subtractedBy(GameUtils.b2Vec2_to_Vector2D($parent.physics.getRevoluteJoint(MOON_LINK_ID).GetBody2().GetPosition()));
if (Math.abs(_local1.x) > 5){
if (_local1.x < 0){
sens = -1;
} else {
sens = 1;
};
if (getPhysics().GetAngularVelocity() < 0){
getClip().scaleX = -1;
} else {
getClip().scaleX = 1;
};
getPhysics().SetAngularVelocity(sens);
} else {
_state = WIN;
SFX.instance.Victory();
if (!(getPhysics().IsSleeping())){
getPhysics().PutToSleep();
};
};
var _local2:Vector2D = new Vector2D(1, 0);
var _local3:Number = ((_local1.angleTo(_local2) * MathUtils.RAD_TO_DEG) - 270);
rotation = _local3;
if ($parent.camera.position.y > (Definitions.STAGE_HEIGHT * 0.5)){
$parent.camera.position.y = ($parent.camera.position.y - Definitions.SCROLLING_SPEED);
};
}
override public function dispose():void{
removeEventListener(Event.COMPLETE, onAnimComplete);
_gear = null;
_initPos = null;
super.dispose();
}
public function onEnterContact(_arg1:GameObject):void{
var _local2:Boolean = true;
if (((((GameUtils.stringHasPrefix(_arg1.name, "Gear")) && ((_gear == null)))) && (!(_jumpFrameCounter)))){
if ($parent.physics.getRevoluteJoint(GEAR_LINK_ID) == null){
collideGear(_arg1);
};
} else {
if (GameUtils.stringHasPrefix(_arg1.name, "CheezeMoon")){
collideCheezeMoon(_arg1);
} else {
if ((((((_arg1.name == "Bloc_Big")) && ((_state == FLY)))) && ((getPhysics().GetLinearVelocity().Length() <= Definitions.AVATAR_DASH_TO_BUMPER)))){
collideBloc(_arg1);
createBigSmoke(false);
} else {
if ((((_arg1.name == "Bumper")) && ((_state == DASH)))){
collideBumper(_arg1);
} else {
_local2 = false;
createSmallSmoke();
};
};
};
};
}
private function handleBumper():void{
var _local1:Vector2D;
if (((((Input.instance.isMouseDown) && (isMouseOver()))) || (Definitions.BUTTON_ACTION(true)))){
getPhysics().WakeUp();
_local1 = new Vector2D(0, ((-(Definitions.AVATAR_START_FORCE) * getPhysics().GetMass()) * GamePhysics.PHYSCALE));
getPhysics().ApplyImpulse(GameUtils.Vector2D_to_b2Vec2(_local1), GameUtils.Vector2D_to_b2Vec2(position));
getPhysics().SetAngularVelocity(_angVel);
Bumper.bump();
_state = FLY;
SFX.instance.Bump();
};
}
private function jump():void{
_gear.mouseEnabled = false;
var _local1:Vector2D = _gear.position.subtractedBy(position).getReverse().getNormalized();
_local1.multiply((JUMP_COEF * _angVel));
getPhysics().ApplyImpulse(GameUtils.Vector2D_to_b2Vec2(_local1), getPhysics().GetPosition());
_jumpFrameCounter++;
_state = FLY;
}
private function collideCheezeMoon(_arg1:GameObject):void{
getPhysics().SetAngularVelocity(0);
getPhysics().SetLinearVelocity(GameUtils.Vector2D_to_b2Vec2(new Vector2D()));
$parent.physics.createRevoluteJoint(MOON_LINK_ID, getPhysics(), _arg1.getPhysics(), _arg1.position);
createBigSmoke();
dispatchEvent(new Event(REACH_THE_MOON));
_state = REACH_THE_MOON;
}
private function handleGearing():void{
var _local1:Number;
var _local2:Vector2D;
var _local3:Vector2D;
var _local4:Number;
var _local5:Number;
var _local6:Number;
if (_gear == null){
return;
};
if (((((Definitions.BUTTON_ACTION(true)) || (((Input.instance.isMouseDown) && (_gear.isMouseOver()))))) && (!(($parent.physics.getRevoluteJoint(GEAR_LINK_ID) == null))))){
$parent.physics.deleteRevoluteJoint(GEAR_LINK_ID);
jump();
_gear = null;
} else {
_local4 = (getPhysics().GetAngularVelocity() + GameStats.instance.levelsComplete);
_local5 = ((_angVel * ANG_ACC) / (Math.PI * 2));
if (_angVel < MAX_ACC){
_angVel = (_angVel + _local5);
};
_local6 = (Math.abs((_local4 / (Math.PI * 2))) * Definitions.ROTATION_TO_TIME);
GameStats.instance.time = (GameStats.instance.time + _local6);
getPhysics().SetAngularVelocity((_angVel * sens));
if (_local4 < 0){
getClip().scaleX = -1;
} else {
getClip().scaleX = 1;
};
_local3 = position.subtractedBy(_gear.position);
_local2 = new Vector2D(0, 1);
_local1 = (_local3.angleTo(_local2) * MathUtils.RAD_TO_DEG);
_local1 = (_local1 - 180);
if (position.x > _gear.position.x){
_local1 = (_local1 * -1);
};
rotation = _local1;
};
}
private function collideBumper(_arg1:GameObject):void{
getPhysics().PutToSleep();
getPhysics().SetAngularVelocity(0);
_state = RECOVERY;
getPhysics().WakeUp();
}
private function createSmallSmoke(_arg1:Boolean=true):void{
var _local2:Vector2D = new Vector2D();
_local2.x = position.x;
_local2.y = position.y;
var _local3:AFX = ($parent.createObject("FXSmokeSmall", _local2) as AFX);
if (_arg1){
_local3.rotation = (rotation - 90);
};
SFX.instance.Collide();
}
override public function update():void{
var _local2:Number;
super.update();
switch (_state){
case IDLE:
Gear.hasAvatar = false;
handleBumper();
setAnim("Idle");
break;
case FLY:
Gear.hasAvatar = false;
handleFlying();
setAnim("Fly");
break;
case RUN:
Gear.hasAvatar = true;
handleGearing();
setAnim("Run");
break;
case REACH_THE_MOON:
Gear.hasAvatar = false;
reachTheMoon();
setAnim("Run");
break;
case WIN:
Gear.hasAvatar = false;
setAnim("Win");
break;
case DASH:
Gear.hasAvatar = false;
setAnim("Dash");
_local2 = _angVel;
if (_local2 <= 10){
_local2 = 10;
};
getPhysics().SetAngularVelocity((getClip().scaleX * _local2));
break;
case RECOVERY:
Gear.hasAvatar = false;
setAnim("Recovery");
break;
};
handleFX();
var _local1:Boolean = !($parent.getBonus().every(handleBonus));
restore();
}
private function handleBonus(_arg1:Object, _arg2:int, _arg3:Array):Boolean{
var _local4:Bonus = (_arg1 as Bonus);
if (!(isOverlapping(_local4))){
return (true);
};
switch (_local4.name){
case "BonusX1":
GameStats.instance.score = (GameStats.instance.score + Definitions.BONUSx1_SCORE);
break;
case "BonusX2":
GameStats.instance.score = (GameStats.instance.score + Definitions.BONUSx2_SCORE);
break;
case "BonusX3":
GameStats.instance.score = (GameStats.instance.score + Definitions.BONUSx3_SCORE);
break;
case "BonusTime":
GameStats.instance.time = (GameStats.instance.time - Definitions.BONUSTIME_VALUE);
break;
};
SFX.instance.CollideBonus(_local4.name);
_local4.explode();
$parent.removeObject(_local4);
return (false);
}
private function handleFlying():void{
var _local1:Number;
var _local2:Vector2D;
var _local3:Vector2D;
_local3 = GameUtils.b2Vec2_to_Vector2D(getPhysics().GetLinearVelocity());
_local2 = new Vector2D(1, 0);
_local1 = (_local3.angleTo(_local2) * MathUtils.RAD_TO_DEG);
if (_local3.y < 0){
_local1 = (_local1 * -1);
};
rotation = _local1;
getClip().scaleX = 1;
}
public function onSolveContact(_arg1:GameObject):void{
}
public function onLeaveContact(_arg1:GameObject):void{
}
private function onAnimComplete(_arg1:Event):void{
if ((((_state == WIN)) && (($currentAnim.currentFrame > 60)))){
$currentAnim.stop();
$parent.screen.dispatchEvent(new Event(Event.COMPLETE));
} else {
if (_state == RECOVERY){
getClip().scaleX = 1;
getPhysics().GetShapeList().m_restitution = _prevRestitution;
getPhysics().GetShapeList().m_friction = 0;
_state = IDLE;
};
};
}
private function createBigSmoke(_arg1:Boolean=true):void{
var _local2:Vector2D = new Vector2D();
_local2.x = position.x;
_local2.y = position.y;
var _local3:AFX = ($parent.createObject("FXSmokeBig", _local2) as AFX);
if (_arg1){
_local3.rotation = (rotation - 90);
};
SFX.instance.CollideGear();
}
private function collideGear(_arg1:GameObject):void{
_gear = (_arg1 as Gear);
_gear.mouseEnabled = true;
var _local2:Vector2D = GameUtils.b2Vec2_to_Vector2D(getPhysics().GetLinearVelocity());
var _local3:Vector2D = _gear.position.subtractedBy(position);
var _local4:Vector2D = _local3.addedTo(_local2);
Avatar.sens = -(_local3.sign(_local2));
getPhysics().SetAngularVelocity((getPhysics().GetAngularVelocity() * sens));
$parent.physics.createRevoluteJoint(GEAR_LINK_ID, getPhysics(), _gear.getPhysics(), _gear.position);
createBigSmoke();
_state = RUN;
}
private function handleFX():void{
if (_state == WIN){
return;
};
SFX.instance.Glocken(position.y);
SFX.instance.Foule(position.y);
SFX.instance.Hurry();
}
public function onLoopContact(_arg1:GameObject):void{
}
public static function get state():String{
return (_state);
}
public static function set state(_arg1:String):void{
_state = _arg1;
}
public static function clear():void{
_angVel = 0;
}
public static function get angularVelocity():Number{
return ((_angVel * sens));
}
}
}//package data
Section 96
//Bonus (data.Bonus)
package data {
import models.*;
import com.cheezeworld.math.*;
public class Bonus extends GameObject {
public function Bonus(_arg1:GameObjectParams){
super(_arg1);
}
public function explode():void{
var _local1:Vector2D = new Vector2D();
_local1.x = position.x;
_local1.y = position.y;
var _local2:AFX = ($parent.createObject(String(("FX" + name)), _local1) as AFX);
}
override public function update():void{
super.update();
}
override public function dispose():void{
super.dispose();
}
}
}//package data
Section 97
//Bumper (data.Bumper)
package data {
import models.*;
import flash.events.*;
public class Bumper extends GameObject {
private var _frameCounter:int;// = 0
public static const IDLE:String = "Idle";
public static const BUMP:String = "Bump";
private static var _bump:Boolean = false;
public function Bumper(_arg1:GameObjectParams){
super(_arg1);
_bump = false;
}
override protected function init(_arg1:Event=null):void{
super.init(_arg1);
getClip().gotoAndStop(1);
}
override public function update():void{
super.update();
if (_bump){
getClip().nextFrame();
_frameCounter++;
_bump = false;
};
if (_frameCounter > 0){
if (_frameCounter < 14){
_frameCounter++;
} else {
_frameCounter = 0;
getClip().prevFrame();
};
};
}
public static function bump():void{
_bump = true;
}
}
}//package data
Section 98
//ButtonClip (data.ButtonClip)
package data {
import flash.events.*;
import flash.display.*;
public class ButtonClip extends EventDispatcher {
private const ENABLE:int = 3;
private const OUT:int = 1;
private const OVER:int = 2;
public var clip:MovieClip;
private var _state:int;// = 0
public function ButtonClip(_arg1:MovieClip){
clip = _arg1;
clip.addEventListener(MouseEvent.MOUSE_OVER, onOver);
clip.addEventListener(MouseEvent.MOUSE_OUT, onOut);
clip.addEventListener(MouseEvent.CLICK, onClick);
onOut();
}
public function get enabled():Boolean{
if (_state == ENABLE){
return (true);
};
return (false);
}
public function set enabled(_arg1:Boolean):void{
_state = 0;
if (_arg1){
onClick();
} else {
onOut();
};
}
protected function onClick(_arg1:MouseEvent=null):void{
if (((!((_state == ENABLE))) || (!(_state)))){
_state = ENABLE;
clip.gotoAndStop(ENABLE);
clip.buttonMode = true;
} else {
onOver();
clip.buttonMode = false;
};
}
protected function onOut(_arg1:MouseEvent=null):void{
if ((((_state == OVER)) || (!(_state)))){
_state = OUT;
clip.gotoAndStop(OUT);
};
}
protected function onOver(_arg1:MouseEvent=null):void{
if ((((_state == OUT)) || (!(_state)))){
_state = OVER;
clip.gotoAndStop(OVER);
};
}
}
}//package data
Section 99
//Definitions (data.Definitions)
package data {
import models.*;
import com.cheezeworld.math.*;
import flash.display.*;
import com.cheezeworld.utils.*;
public class Definitions {
public static const AVATAR_MAX_ACC:Number = 70;
public static const AVATAR_START_ROTATION:Number = 20;
public static const STAGE_WIDTH:int = 500;
public static const TIME_DECREASER:Number = 0.997;
public static const MOUSE_RADIUS:int = 3;
public static const STAGE_QUALITY:String = "high";
public static const DRAW_DEBUG:Boolean = false;
public static const MOUSE_TRIGGER_RADIUS:int = 1;
public static const BONUS_PROB:Number = 0.9;
public static const SCORE_CHRONO:Number = 0.004;
public static const BASE_STAIRS:int = 5;
public static const SCORE_PER_LEVEL:Number = 1000;
public static const MAX_LAYERS:int = 4;
public static const BONUSTIME_VALUE:Number = 10;
public static const AVATAR_JUMP_FORCE:Number = 0.8;
public static const BONUSTIME_PROB:Number = 0.35;
public static const LAYER_FX:int = 3;
public static const STAGE_HEIGHT:int = 440;
public static const FRAMERATE:int = 25;
public static const SCROLL_DISTANCE:Number = 100;
public static const AVATAR_START_FORCE:Number = 20;
public static const ALPHABET:Array = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
public static const BONUSx2_SCORE:int = 300;
public static const GRAVITY:Vector2D = new Vector2D(0, 100);
public static const LAYER_AVATAR:int = 1;
public static const DOORS_FRAME:int = 60;
public static const AVATAR_TRAIL_VELOCITY:Number = 20;
public static const MOUSE_TRIGGER_BOUNDS:int = 2;
public static const BONUSx1_BASE:int = 81;
public static const SCROLLING_SPEED:Number = 2;
public static const SCORE_DECREASE_TIME:int = 600;
public static const NEW_STAIR:int = 2;
public static const GEAR_ROTATION_DEC:Number = 0.9;
public static const GEAR_ROTATION_SPEED:Number = 5;
public static const LAYER_GEAR:int = 2;
public static const ROTATION_TO_TIME:Number = 0.05;
public static const AVATAR_DASH_TO_BUMPER:Number = 20;
public static const BONUSx2_BASE:int = 17;
public static const MAX_TIME:Number = 100;
public static const BONUSx1_SCORE:int = 100;
public static const BONUSx3_SCORE:int = 1000;
public static const LEVELCOMPLETE_TO_TIME:Number = 0.5;
public static const BACKGROUND_COLOR:uint = 0;
public static const BONUSx3_BASE:int = 2;
public static const LAYER_BACKGROUND:int = 0;
public static const AVATAR_ANGULAR_ACC:Number = 0.005;
private static var _objectsParams:Array;
private static var _backgrounds:Array;
public function Definitions(_arg1:Function){
var _local2:GameObjectParams;
var _local3:PhysicsParams;
super();
createBackground("Background_Bottom", new BD_BackgroundBottom(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_Top", new BD_BackgroundTop(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_A", new BD_BackgroundA(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_B", new BD_BackgroundB(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_C", new BD_BackgroundC(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_D", new BD_BackgroundD(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_E", new BD_BackgroundE(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_F", new BD_BackgroundF(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_G", new BD_BackgroundG(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_H", new BD_BackgroundH(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_I", new BD_BackgroundI(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_J", new BD_BackgroundJ(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_K", new BD_BackgroundK(STAGE_WIDTH, STAGE_HEIGHT));
createBackground("Background_L", new BD_BackgroundL(STAGE_WIDTH, STAGE_HEIGHT));
SFX.instance.registerSound("BonusX1", SOUND_BONUSX1);
SFX.instance.registerSound("BonusX2", SOUND_BONUSX2);
SFX.instance.registerSound("BonusX3", SOUND_BONUSX3);
SFX.instance.registerSound("BonusTime", SOUND_BONUSTIME);
SFX.instance.registerSound("Fly", SOUND_FLYING);
SFX.instance.registerSound("Collide", SOUND_COLLIDE);
SFX.instance.registerSound("CollideGear", SOUND_COLLIDEGEAR);
SFX.instance.registerSound("Bumper", SOUND_BUMPER);
SFX.instance.registerSound("Foule", SOUND_FOULE);
SFX.instance.registerSound("Applaude", SOUND_APPLAUDE);
SFX.instance.registerSound("Beat", SOUND_BEAT);
SFX.instance.registerSound("Inter", SOUND_INTER);
SFX.instance.registerSound("Glocken", SOUND_GLOCKEN);
SFX.instance.registerSound("Hurry", SOUND_HURRY);
SFX.instance.registerSound("TimeOut", SOUND_TIMEOUT);
SFX.instance.registerSound("Victory", SOUND_VICTORY);
SFX.instance.registerSound("Intro", SOUND_INTRO);
SFX.instance.registerSound("Squeak", SOUND_SQUEAK);
SFX.instance.registerSound("Score", SOUND_SCORE);
_local2 = new GameObjectParams();
_local2.name = "Wall";
_local2.bounds.setSize(20, STAGE_HEIGHT);
_local2.layer = 0;
_local3 = new PhysicsParams();
_local3.type = PhysicsParams.SHAPE_TYPE_POLYGON;
_local3.width = 20;
_local3.height = STAGE_HEIGHT;
_local3.friction = 1;
_local2.setPhysicsParams(_local3);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "Bloc_Big";
_local2.bounds.setSize(200, 20);
_local2.layer = 0;
_local3 = new PhysicsParams();
_local3.type = PhysicsParams.SHAPE_TYPE_POLYGON;
_local3.width = 200;
_local3.height = 20;
_local3.friction = 1;
_local2.setPhysicsParams(_local3);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "Bloc_Small";
_local2.bounds.setSize(40, 40);
_local2.layer = 0;
_local2.doesRotMatchPhysics = false;
_local3 = new PhysicsParams();
_local3.type = PhysicsParams.SHAPE_TYPE_POLYGON;
_local3.width = 40;
_local3.height = 40;
_local3.friction = 1;
_local2.setPhysicsParams(_local3);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "DoorLeft";
_local2.bounds.setSize(204, 69);
_local2.layer = 0;
_local2.alwaysUpdate = true;
_local2.customClass = Door;
_local2.doesRotMatchPhysics = false;
_local2.setClip(MC_DoorLeft);
_local3 = new PhysicsParams();
_local3.type = PhysicsParams.SHAPE_TYPE_POLYGON;
_local3.width = 204;
_local3.height = 69;
_local3.friction = 1;
_local2.setPhysicsParams(_local3);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "DoorRight";
_local2.bounds.setSize(204, 69);
_local2.layer = 0;
_local2.alwaysUpdate = true;
_local2.customClass = Door;
_local2.doesRotMatchPhysics = false;
_local2.setClip(MC_DoorRight);
_local3 = new PhysicsParams();
_local3.type = PhysicsParams.SHAPE_TYPE_POLYGON;
_local3.width = 204;
_local3.height = 69;
_local3.friction = 1;
_local2.setPhysicsParams(_local3);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "CheezeMoon";
_local2.bounds.setSize(572, 572);
_local2.layer = 0;
_local3 = new PhysicsParams();
_local3.type = PhysicsParams.SHAPE_TYPE_CIRCLE;
_local3.radius = (580 * 0.5);
_local3.friction = 10;
_local2.setPhysicsParams(_local3);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "Trail";
_local2.bounds.setSize(0, 0);
_local2.layer = 0;
_local2.customClass = FXPrint;
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "Bumper";
_local2.bounds.setSize(60, 60);
_local2.layer = LAYER_BACKGROUND;
_local2.customClass = Bumper;
_local2.setClip(MC_Bumper);
_local3 = new PhysicsParams();
_local3.type = PhysicsParams.SHAPE_TYPE_CIRCLE;
_local3.radius = 1;
_local3.isSensor = true;
_local2.setPhysicsParams(_local3);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "GearA";
_local2.bounds.setSize(60, 60);
_local2.layer = LAYER_GEAR;
_local2.mouseTrigger = MOUSE_TRIGGER_RADIUS;
_local2.customClass = Gear;
_local2.setClip(MC_GearA);
_local3 = new PhysicsParams();
_local3.type = PhysicsParams.SHAPE_TYPE_CIRCLE;
_local3.friction = 0;
_local3.radius = (60 * 0.5);
_local2.setPhysicsParams(_local3);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "GearB";
_local2.bounds.setSize(110, 110);
_local2.layer = LAYER_GEAR;
_local2.mouseTrigger = MOUSE_TRIGGER_RADIUS;
_local2.customClass = Gear;
_local2.setClip(MC_GearB);
_local3 = new PhysicsParams();
_local3.type = PhysicsParams.SHAPE_TYPE_CIRCLE;
_local3.friction = 0;
_local3.radius = (110 * 0.5);
_local2.setPhysicsParams(_local3);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "GearC";
_local2.bounds.setSize(215, 215);
_local2.layer = LAYER_GEAR;
_local2.mouseTrigger = MOUSE_TRIGGER_RADIUS;
_local2.customClass = Gear;
_local2.setClip(MC_GearC);
_local3 = new PhysicsParams();
_local3.type = PhysicsParams.SHAPE_TYPE_CIRCLE;
_local3.friction = 0;
_local3.radius = (215 * 0.5);
_local2.setPhysicsParams(_local3);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "BonusTime";
_local2.bounds.setSize(65, 65);
_local2.layer = LAYER_AVATAR;
_local2.customClass = Bonus;
_local2.setBitmapData(new BD_BonusTime(_local2.bounds.width, _local2.bounds.height));
_local2.radius = 10;
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "FXBonusTime";
_local2.bounds.setSize(333, 103);
_local2.layer = LAYER_FX;
_local2.customClass = AFX;
_local2.setClip(FX_BonusTime);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "BonusX1";
_local2.bounds.setSize(48, 69);
_local2.layer = LAYER_AVATAR;
_local2.customClass = Bonus;
_local2.setBitmapData(new BD_BonusX1(_local2.bounds.width, _local2.bounds.height));
_local2.radius = 10;
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "FXBonusX1";
_local2.bounds.setSize(333, 103);
_local2.layer = LAYER_FX;
_local2.customClass = AFX;
_local2.setClip(FX_BonusX1);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "BonusX2";
_local2.bounds.setSize(67, 76);
_local2.layer = LAYER_AVATAR;
_local2.customClass = Bonus;
_local2.setBitmapData(new BD_BonusX2(_local2.bounds.width, _local2.bounds.height));
_local2.radius = 15;
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "FXBonusX2";
_local2.bounds.setSize(333, 103);
_local2.layer = LAYER_FX;
_local2.customClass = AFX;
_local2.setClip(FX_BonusX2);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "BonusX3";
_local2.bounds.setSize(77, 91);
_local2.layer = LAYER_AVATAR;
_local2.customClass = Bonus;
_local2.setBitmapData(new BD_BonusX3(_local2.bounds.width, _local2.bounds.height));
_local2.radius = 20;
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "FXBonusX3";
_local2.bounds.setSize(333, 103);
_local2.layer = LAYER_FX;
_local2.customClass = AFX;
_local2.setClip(FX_BonusX3);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "Avatar";
_local2.bounds.setSize(50, 50);
_local2.layer = LAYER_AVATAR;
_local2.listenAnim = true;
_local2.customClass = Avatar;
_local2.mouseTrigger = MOUSE_TRIGGER_RADIUS;
_local2.setClip(MC_SuperMouse);
_local3 = new PhysicsParams();
_local3.type = PhysicsParams.SHAPE_TYPE_CIRCLE;
_local3.radius = 10;
_local3.density = 10;
_local3.friction = 0;
_local3.linearDamping = 0;
_local3.restitution = 0.8;
_local3.isBullet = true;
_local2.setPhysicsParams(_local3);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "FXSmokeBig";
_local2.bounds.setSize(333, 103);
_local2.layer = LAYER_FX;
_local2.customClass = AFX;
_local2.setClip(MC_SMOKEBIG);
register(_local2);
_local2 = new GameObjectParams();
_local2.name = "FXSmokeSmall";
_local2.bounds.setSize(333, 103);
_local2.layer = LAYER_FX;
_local2.customClass = AFX;
_local2.setClip(MC_SMOKESMALL);
register(_local2);
_arg1();
}
public static function getObjectParams(_arg1:String):GameObjectParams{
if (_objectsParams == null){
_objectsParams = new Array();
};
return (GameObjectParams(_objectsParams[_arg1]));
}
public static function register(_arg1:GameObjectParams):void{
if (_objectsParams == null){
_objectsParams = new Array();
};
_objectsParams[_arg1.name] = _arg1;
}
public static function createBackground(_arg1:String, _arg2:BitmapData):void{
if (_backgrounds == null){
_backgrounds = new Array();
};
_backgrounds[_arg1] = _arg2;
}
public static function BUTTON_ACTION(_arg1:Boolean=false):Boolean{
if (_arg1){
return (Input.instance.isKeyPressed(KeyCode.SPACEBAR));
};
return (Input.instance.isKeyDown(KeyCode.SPACEBAR));
}
public static function getBackgrounds(_arg1:String):GameBackground{
if (_backgrounds == null){
_backgrounds = new Array();
};
return (new GameBackground(BitmapData(_backgrounds[_arg1]).clone()));
}
}
}//package data
Section 100
//Door (data.Door)
package data {
import models.*;
import com.cheezeworld.math.*;
import flash.events.*;
import ui.*;
public class Door extends GameObject {
private var _initPos:Vector2D;
private var _desiredPos:Vector2D;
public function Door(_arg1:GameObjectParams){
super(_arg1);
}
override protected function init(_arg1:Event=null):void{
super.init(_arg1);
_initPos = new Vector2D(position.x, position.y);
if (name == "DoorLeft"){
_desiredPos = new Vector2D(176, _initPos.y);
} else {
if (name == "DoorRight"){
_desiredPos = new Vector2D(389, _initPos.y);
};
};
}
override public function update():void{
var _local1:int;
var _local2:int;
var _local3:Number;
var _local4:Vector2D;
super.update();
if (_initPos == null){
return;
};
if (UITimeBar.getTimePrcent() > Definitions.DOORS_FRAME){
_local1 = Math.round((UITimeBar.getTimePrcent() - Definitions.DOORS_FRAME));
_local2 = Math.round((100 - Definitions.DOORS_FRAME));
_local3 = (_local1 / _local2);
_local4 = new Vector2D(_initPos.x, _initPos.y);
if (name == "DoorLeft"){
_local4.x = (_local4.x + (_desiredPos.distanceTo(_initPos) * _local3));
} else {
if (name == "DoorRight"){
_local4.x = (_local4.x - (_desiredPos.distanceTo(_initPos) * _local3));
};
};
getPhysics().SetXForm(GameUtils.Vector2D_to_b2Vec2(_local4), getPhysics().GetAngle());
} else {
position.Set(_initPos.x, _initPos.y);
};
}
}
}//package data
Section 101
//FXPrint (data.FXPrint)
package data {
import models.*;
import flash.display.*;
import flash.geom.*;
import com.cheezeworld.math.*;
public class FXPrint extends GameObject {
private const ALPHA_COEF:Number = 1;
private var _frameCounter:int;// = 0
private var _bmp:Bitmap;
public var trailAlpha:int;
public function FXPrint(_arg1:GameObjectParams){
trailAlpha = Math.round(Definitions.FRAMERATE);
super(_arg1);
}
public function draw(_arg1:GameObject):void{
var _local2:BitmapData = new BitmapData(_arg1.bounds.width, _arg1.bounds.height, true, 0);
var _local3:Matrix = new Matrix();
var _local4:ColorTransform = new ColorTransform();
_local4.redOffset = 0xFF;
_local4.blueOffset = 194;
_local4.greenOffset = 224;
if (_arg1.getClip() != null){
_local3.rotate((_arg1.rotation * MathUtils.DEG_TO_RAD));
_local3.scale(_arg1.getClip().scaleX, 1);
_local3.translate(_arg1.bounds.halfWidth, _arg1.bounds.halfHeight);
_local2.draw(_arg1.getClip(), _local3, _local4);
};
setBitmapData(_local2);
bounds.Set(_arg1.bounds.center, _arg1.bounds.width, _arg1.bounds.height);
_bmp = new Bitmap(_local2);
}
override public function update():void{
var _local1:ColorTransform;
var _local2:Number;
super.update();
if (_bmp == null){
return;
};
if (_frameCounter < trailAlpha){
_frameCounter++;
_local1 = new ColorTransform();
_local2 = ((ALPHA_COEF * _frameCounter) / trailAlpha);
_local1.alphaMultiplier = (ALPHA_COEF - _local2);
_bmp.bitmapData.colorTransform(_bmp.bitmapData.rect, _local1);
setBitmapData(_bmp.bitmapData);
} else {
dispose();
};
}
override public function dispose():void{
_bmp = null;
super.dispose();
}
}
}//package data
Section 102
//GameOption (data.GameOption)
package data {
import flash.display.*;
import com.cheezeworld.screens.*;
import com.urbansquall.utils.*;
public class GameOption {
private const CHECK_FRAME_LIMIT:int = 20;
private const CHECK_FRAME_TOTAL:int;
private const QUALITY:Array;
private var _autoQuality:Boolean;
private var _currFPS:int;// = 25
private var _checkFrame:int;
private var _canBeUpdate:Boolean;
private var _currQuality:int;
private static var _instance:GameOption;
public function GameOption(){
CHECK_FRAME_TOTAL = Math.round((Definitions.FRAMERATE * 5));
QUALITY = new Array(StageQuality.LOW, StageQuality.MEDIUM, StageQuality.HIGH);
_currQuality = QUALITY.indexOf(Root.stage.quality.toLowerCase());
super();
}
public function decreaseQuality():void{
if (_currQuality > 0){
_currQuality--;
Root.stage.quality = QUALITY[_currQuality];
};
}
public function disableSound():void{
SFX.instance.muteAll();
}
public function setMediumQuality():void{
Root.stage.quality = StageQuality.MEDIUM;
_autoQuality = false;
}
public function enableSound():void{
SFX.instance.demuteAll();
}
public function setLowQuality():void{
Root.stage.quality = StageQuality.LOW;
_autoQuality = false;
}
public function setAutoQuality():void{
_autoQuality = true;
}
public function increaseQuality():void{
if (_currQuality < (QUALITY.length - 1)){
_currQuality++;
Root.stage.quality = QUALITY[_currQuality];
};
}
public function resetQuality():void{
if (!(_autoQuality)){
return;
};
trace("STARTING QUALITY TEST");
_canBeUpdate = true;
_checkFrame = 0;
}
public function updateQuality():void{
if (!(_canBeUpdate)){
return;
};
if (_checkFrame >= CHECK_FRAME_TOTAL){
_canBeUpdate = false;
trace(this, "current FPS:", _currFPS, _currQuality);
if ((((_currFPS < CHECK_FRAME_LIMIT)) && ((_currQuality > 0)))){
decreaseQuality();
resetQuality();
} else {
if ((((_currFPS >= Definitions.FRAMERATE)) && ((_currQuality < (QUALITY.length - 1))))){
increaseQuality();
resetQuality();
};
};
trace(Root.stage.quality);
} else {
_currFPS = FPS.get();
_checkFrame++;
};
}
public function setHighQuality():void{
Root.stage.quality = StageQuality.HIGH;
_autoQuality = false;
}
public static function get instance():GameOption{
if (_instance == null){
_instance = new (GameOption);
};
return (_instance);
}
}
}//package data
Section 103
//GameStats (data.GameStats)
package data {
import screens.*;
public class GameStats {
private var _chrono:int;// = 0
public var levelsComplete:int;// = 0
private var _score:Number;
private var _avatarProgression:Number;// = 0
private var _time:Number;
public var totalScore:Number;// = 0
private var _savedTime:Number;// = 0
public static const GAME_ID:Number = 1527;
private static var _instance:GameStats;
public function GameStats(){
clearStats();
}
public function increaseChrono():void{
if (_chrono != -1){
_chrono++;
};
}
public function update():void{
}
public function get time():Number{
return (_time);
}
public function getTimeScore():int{
return (int((Math.round(((((((99 * 60) * Definitions.FRAMERATE) - _chrono) * Definitions.SCORE_CHRONO) * Tower.NB_STAIRS) / 100)) * 100)));
}
public function resetChrono():void{
_chrono = 0;
}
public function loadTime():void{
_time = _savedTime;
trace("loadTime() loaded:", _time, "from:", _savedTime);
}
public function init():void{
_chrono = 0;
_score = 0;
}
public function get score():Number{
return (_score);
}
public function setAvatarProgression(_arg1:Number, _arg2:Number):void{
_avatarProgression = (Math.round(((100 * _arg1) / _arg2)) * 0.01);
}
public function set time(_arg1:Number):void{
if (_time >= Definitions.MAX_TIME){
return;
};
_time = _arg1;
if (_time < 0){
_time = 0;
};
}
public function set score(_arg1:Number):void{
_score = _arg1;
}
public function getChrono():int{
return (_chrono);
}
public function getBonusScore():int{
return (int(Math.round(_score)));
}
public function saveTime():void{
_savedTime = _time;
trace("saveTime() saved:", _time, "from:", _savedTime);
}
public function getLevelScore():int{
return (int(Math.round((levelsComplete * Definitions.SCORE_PER_LEVEL))));
}
public function getAvatarProgression():Number{
return ((1 - _avatarProgression));
}
public function clearStats():void{
_time = 0;
levelsComplete = 0;
totalScore = 0;
}
public static function get instance():GameStats{
if (_instance == null){
_instance = new (GameStats);
};
return (_instance);
}
}
}//package data
Section 104
//Gear (data.Gear)
package data {
import models.*;
import com.cheezeworld.math.*;
public class Gear extends GameObject {
private const ANG_ACC:Number = 5;
private const ANG_DEC:Number = 0.9;
public var mouseEnabled:Boolean;// = false
private static var _angVel:Number = 0;
public static var hasAvatar:Boolean = false;
public function Gear(_arg1:GameObjectParams){
super(_arg1);
_angVel = 0;
}
override public function update():void{
super.update();
if (((mouseEnabled) && (isMouseOver()))){
setAnim("over");
getClip().buttonMode = true;
} else {
setAnim("out");
getClip().buttonMode = false;
};
if (!(Gear.hasAvatar)){
if (Math.abs(_angVel) > 0){
_angVel = (_angVel * ANG_DEC);
};
} else {
_angVel = ((((Avatar.angularVelocity * MathUtils.RAD_TO_DEG) * GamePhysics.TIMESTEP) / Definitions.FRAMERATE) * ANG_ACC);
};
getClip().rotation = (getClip().rotation - _angVel);
if (Gear.hasAvatar){
SFX.instance.Squeak(Math.abs(_angVel));
};
}
public static function increaseRotation(_arg1:Number):void{
}
}
}//package data
Section 105
//SFX (data.SFX)
package data {
import flash.utils.*;
import com.cheezeworld.utils.*;
import screens.*;
import ui.*;
public class SFX {
private var _mute:Boolean;
private var _maxFrames:int;// = 45
private var _frameCounter:int;
private var _soundMap:Dictionary;
private static var _instance:SFX;
public function SFX(){
_soundMap = new Dictionary();
SoundManager.instance.registerSound(new SOUND_SCORE(), "Score");
}
public function Applaude():void{
if (getSound("Applaude").isPlaying){
return;
};
getSound("Applaude").start();
getSound("Applaude").setVolume(1);
}
public function Score():void{
SoundManager.instance.playSound("Score");
}
public function muteAll():void{
_mute = true;
handleVolume();
trace("mute All:", _mute);
}
public function Intro():void{
if (getSound("Intro").isPlaying){
return;
};
stopAll();
getSound("Intro").isLoop = true;
getSound("Intro").start();
}
public function CollideGear():void{
getSound("CollideGear").start();
}
public function Fly(_arg1:Number):void{
if (getSound("Fly").isPlaying == false){
getSound("Fly").isLoop = true;
getSound("Fly").start();
};
getSound("Fly").setVolume(_arg1);
}
public function Bump():void{
getSound("Bumper").start();
}
public function get mute():Boolean{
return (_mute);
}
public function Glocken(_arg1:Number=0):void{
var _local3:Number;
var _local4:Number;
var _local2:Sons = getSound("Glocken");
if (!(_local2.isPlaying)){
_local2.isLoop = true;
_local2.start();
_local2.setVolume(0);
} else {
_local3 = (Math.round((Definitions.BASE_STAIRS * 0.5)) * Definitions.STAGE_HEIGHT);
_local4 = ((_local3 - _arg1) / _local3);
if (_local4 < 0){
_local4 = 0;
};
_local2.setVolume((_local4 * 0.7));
};
}
public function Beat():void{
if (getSound("Beat").isPlaying){
return;
};
getSound("Beat").isLoop = true;
getSound("Beat").start();
getSound("Beat").setVolume(1);
Hurry();
}
public function Collide():void{
getSound("Collide").start();
}
public function getSound(_arg1:String):Sons{
return ((_soundMap[_arg1] as Sons));
}
public function CollideBonus(_arg1:String):void{
getSound(_arg1).start();
}
private function handleVolume():void{
var _local1:Sons;
for each (_local1 in _soundMap) {
_local1.mute(_mute);
};
}
public function Foule(_arg1:Number=0):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local2:Sons = getSound("Foule");
if (!(_local2.isPlaying)){
_local2.isLoop = true;
_local2.start();
_local2.setVolume(1);
} else {
_local3 = (Tower.NB_STAIRS * Definitions.STAGE_HEIGHT);
_local4 = (_local3 - (Definitions.BASE_STAIRS * Definitions.STAGE_HEIGHT));
_local5 = ((_arg1 - _local4) / _local3);
if (_local5 < 0){
_local5 = 0;
};
_local2.setVolume(_local5);
};
}
public function demuteAll():void{
_mute = false;
handleVolume();
trace("demute All:", _mute);
}
public function TimeOut():void{
stopAll();
if (getSound("TimeOut").isPlaying){
return;
};
getSound("TimeOut").start();
}
public function Hurry():void{
if (!(getSound("Hurry").isPlaying)){
getSound("Hurry").isLoop = true;
getSound("Hurry").start();
getSound("Inter").setVolume(0);
};
var _local1:Number = 0;
var _local2:Number = UITimeBar.getTimePrcent();
if (_local2 >= Definitions.DOORS_FRAME){
_local1 = (_local2 / 100);
_local1 = (_local1 * 0.2);
};
getSound("Hurry").setVolume(_local1);
}
public function Victory():void{
stopAll();
if (getSound("Victory").isPlaying){
return;
};
getSound("Victory").start();
}
public function registerSound(_arg1:String, _arg2:Class):void{
var _local3:* = new (_arg2);
if (!((_local3 is Sons))){
trace("FICHIER SON INVALIDE !!!!!!!!!!!!");
} else {
Sons(_local3).name = _arg1;
};
_soundMap[_arg1] = (_local3 as Sons);
}
public function Squeak(_arg1:Number):void{
if (!(_frameCounter)){
getSound("Squeak").start();
_frameCounter = (_frameCounter + _arg1);
} else {
if (_frameCounter >= _maxFrames){
_frameCounter = 0;
} else {
_frameCounter++;
};
};
}
public function set mute(_arg1:Boolean):void{
_mute = _arg1;
handleVolume();
trace(_mute);
}
public function Inter():void{
stopAll();
if (getSound("Inter").isPlaying){
return;
};
getSound("Inter").isLoop = true;
getSound("Inter").start();
getSound("Inter").setVolume(1);
}
public function stopAll(_arg1:Number=0):void{
var _local2:Sons;
for each (_local2 in _soundMap) {
if (_local2.isPlaying){
_local2.stop(_arg1);
};
};
}
public static function get instance():SFX{
if (_instance == null){
_instance = new (SFX);
};
return (_instance);
}
}
}//package data
Section 106
//StairsLoader (data.StairsLoader)
package data {
import gs.easing.*;
import screens.*;
import models.*;
import flash.display.*;
import com.cheezeworld.math.*;
public class StairsLoader {
private const TOTAL_STAIRS:int;
private const BACKGROUND_WIDTH:Number = 420;
private const DIFF_RANGE_MAX:int = 5;
private const WALL_WIDTH:Number = 80;
private var _loadBar:MovieClip;
private var _prevStair:String;// = ""
private var COMPLETE_STAIRS:int;// = 0
private var _gameworld:GameWorld;
private var _start:Boolean;
private var _loaded:Boolean;// = false
private var HEIGHT:Number;
private var _stairsList:Array;
private var DIFFICULTY:int;
private var _hud:MovieClip;
public function StairsLoader(_arg1:GameWorld){
DIFFICULTY = GameStats.instance.levelsComplete;
TOTAL_STAIRS = Tower.NB_STAIRS;
super();
_gameworld = _arg1;
trace("_ _ _", this, "_ _ _");
_stairsList = new Array();
_stairsList.push(new AStair(new Lvl1(), 0.5, 0));
_stairsList.push(new AStair(new Lvl2(), 0.5, 0));
_stairsList.push(new AStair(new Lvl3(), 0.4, 0));
_stairsList.push(new AStair(new Lvl4(), 0.5, 1));
_stairsList.push(new AStair(new Lvl5(), 0.4, 1));
_stairsList.push(new AStair(new Lvl6(), 0.5, 0));
_stairsList.push(new AStair(new Lvl7(), 0.6, 2));
_stairsList.push(new AStair(new Lvl8(), 0.5, 1));
_stairsList.push(new AStair(new Lvl9(), 0.4, 0));
_stairsList.push(new AStair(new Lvl10(), 0.5, 0));
_stairsList.push(new AStair(new Lvl11(), 0.4, 1));
_stairsList.push(new AStair(new Lvl12(), 0.6, 3));
createWalls();
}
private function updateLoadBar():void{
var _local1:int = Math.round(((_loadBar.totalFrames * COMPLETE_STAIRS) / TOTAL_STAIRS));
if (_local1 < 1){
_local1 = 1;
};
_loadBar.gotoAndStop(_local1);
}
public function update():void{
HEIGHT = (Definitions.STAGE_HEIGHT * ((TOTAL_STAIRS - COMPLETE_STAIRS) - 1));
if (COMPLETE_STAIRS < TOTAL_STAIRS){
generateStair();
COMPLETE_STAIRS++;
} else {
_loaded = true;
};
}
private function createWalls():void{
var _local1:Number = (Definitions.STAGE_HEIGHT * TOTAL_STAIRS);
var _local2:GameObjectParams = new GameObjectParams();
_local2.name = "TowerWall";
_local2.bounds.setSize(20, _local1);
_local2.layer = 0;
var _local3:PhysicsParams = new PhysicsParams();
_local3.type = PhysicsParams.SHAPE_TYPE_POLYGON;
_local3.width = 20;
_local3.height = _local1;
_local3.friction = 1;
_local2.setPhysicsParams(_local3);
Definitions.register(_local2);
var _local4:Vector2D = new Vector2D();
_local4.Set(95, (_local1 * 0.5));
_gameworld.createObject("TowerWall", _local4);
_local4.Set((Definitions.STAGE_WIDTH - 27), (_local1 * 0.5));
_gameworld.createObject("TowerWall", _local4);
}
public function isLoaded():Boolean{
return (_loaded);
}
private function getBonusName():String{
var _local2:int;
var _local1:String = "";
if (Math.random() > Definitions.BONUS_PROB){
return (_local1);
};
var _local3:int;
while (_local3 <= Math.round((COMPLETE_STAIRS / DIFF_RANGE_MAX))) {
_local2 = MathUtils.rand(1, 100);
_local3++;
if (_local2 <= Definitions.BONUSx3_BASE){
_local1 = "BonusX3";
} else {
if (_local2 <= Definitions.BONUSx2_BASE){
_local1 = "BonusX2";
} else {
if (_local2 <= Definitions.BONUSx1_BASE){
_local1 = "BonusX1";
};
};
};
if (_local1 == "BonusX3"){
break;
};
};
return (_local1);
}
private function pasteWalls():void{
var _local1:Vector2D = new Vector2D();
var _local2:Number = HEIGHT;
_local1.Set(95, ((Definitions.STAGE_HEIGHT * 0.5) + _local2));
_gameworld.createObject("Wall", _local1);
_local1.Set((Definitions.STAGE_WIDTH - 27), ((Definitions.STAGE_HEIGHT * 0.5) + _local2));
_gameworld.createObject("Wall", _local1);
}
private function testStair(_arg1:Object, _arg2:int, _arg3:Array):Boolean{
var _local4:AStair = AStair(_arg1);
if (GameStats.instance.levelsComplete < _local4.levelComplete){
return (false);
};
if (Math.random() < _local4.weight){
return (true);
};
return (false);
}
private function generateStair():void{
var _local4:DisplayObject;
var _local5:GameObject;
var _local8:Number;
var _local9:String;
var _local1:Boolean;
var _local2:AStair = selectStair();
trace("Previous Stair:", _prevStair);
while (!(_local1)) {
_local1 = true;
_local2 = selectStair();
if (_prevStair == _local2.name){
_local1 = false;
};
if ((((COMPLETE_STAIRS == 1)) && ((((_local2.name == "LVL12")) || ((_local2.name == "LVL8")))))){
_local1 = false;
};
};
var _local3:DisplayObjectContainer = (_local2.clip as DisplayObjectContainer);
_prevStair = _local2.name;
trace(("### GENERATING STAIR N°" + String(COMPLETE_STAIRS)), "at Height:", HEIGHT, "(", _prevStair, ")");
var _local6:Vector2D = new Vector2D();
var _local7:int;
for (;_local7 < _local3.numChildren;_local7++) {
_local4 = _local3.getChildAt(_local7);
if (GameUtils.stringHasPrefix(_local4.name, "Background")){
_local6.Set(WALL_WIDTH, HEIGHT);
_gameworld.createBackground(_local4.name, _local6);
} else {
if (GameUtils.stringHasPrefix(_local4.name, "Bloc")){
_local6.Set(_local4.x, (_local4.y + HEIGHT));
_local5 = _gameworld.createObject(_local4.name, _local6);
if (_local4.name == "Bloc_Small"){
_local8 = 45;
} else {
_local8 = _local4.rotation;
};
_local5.getPhysics().SetXForm(GameUtils.Vector2D_to_b2Vec2(_local5.position), (_local8 * MathUtils.DEG_TO_RAD));
} else {
if (GameUtils.stringHasPrefix(_local4.name, "Gear")){
_local6.Set(_local4.x, (_local4.y + HEIGHT));
_local5 = _gameworld.createObject(getGearFromChildName(_local4.name), _local6);
} else {
if (GameUtils.stringHasPrefix(_local4.name, "CheezeMoon")){
_local6.Set(_local4.x, _local4.y);
_local5 = _gameworld.createObject("CheezeMoon", _local6);
} else {
if (GameUtils.stringHasPrefix(_local4.name, "Bumper")){
_local6.Set(_local4.x, (_local4.y + HEIGHT));
_local5 = _gameworld.createObject("Bumper", _local6);
} else {
if (GameUtils.stringHasPrefix(_local4.name, "Bonus")){
_local6.Set(_local4.x, (_local4.y + HEIGHT));
_local9 = getBonusName();
if (_local9 != ""){
_local5 = _gameworld.createObject(_local9, _local6);
};
} else {
if (GameUtils.stringHasPrefix(_local4.name, "Special")){
if ((((Math.random() > Definitions.BONUSTIME_PROB)) || ((TOTAL_STAIRS <= 6)))){
continue;
};
_local6.Set(_local4.x, (_local4.y + HEIGHT));
_local5 = _gameworld.createObject("BonusTime", _local6);
} else {
if (GameUtils.stringHasPrefix(_local4.name, "Door")){
_local6.Set(_local4.x, ((_local4.y + HEIGHT) - 2));
_local5 = _gameworld.createObject(_local4.name, _local6);
};
};
};
};
};
};
};
};
};
}
public function dispose():void{
_loadBar = null;
_gameworld = null;
}
private function selectStair():AStair{
if (COMPLETE_STAIRS == 0){
return (new AStair(new LvlBottom()));
};
if (COMPLETE_STAIRS == (TOTAL_STAIRS - 1)){
return (new AStair(new LvlTop()));
};
var _local1:Array = GameUtils.copyArray(_stairsList);
while (_local1.length > 2) {
_local1 = _local1.filter(testStair);
if (!(_local1.length)){
_local1 = GameUtils.copyArray(_stairsList);
};
};
var _local2:int = MathUtils.rand(0, (_local1.length - 1));
return ((_local1[_local2] as AStair));
}
private function getGearFromChildName(_arg1:String):String{
var _local2:Array = new Array();
var _local3:int = _arg1.substr(0, String("Gear").length).length;
while (_local3 < _arg1.length) {
_local2.push(_arg1.substr(_local3, 1));
_local3++;
};
return (String(("Gear" + _local2[MathUtils.rand(0, (_local2.length - 1))])));
}
}
}//package data
Section 107
//bubble_logo3_3 (FlyMe_fla.bubble_logo3_3)
package FlyMe_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class bubble_logo3_3 extends MovieClip {
public function bubble_logo3_3(){
addFrameScript(0, frame1, 9, frame10);
}
function frame10(){
stop();
}
function frame1(){
stop();
}
}
}//package FlyMe_fla
Section 108
//BubbleBoxSplash_1 (FlyMe_fla.BubbleBoxSplash_1)
package FlyMe_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import data.*;
public dynamic class BubbleBoxSplash_1 extends MovieClip {
public var play_latest_text:MovieClip;
public var link:MovieClip;
public var rq:URLRequest;
public function BubbleBoxSplash_1(){
addFrameScript(0, frame1, 160, frame161);
}
function frame1(){
rq = new URLRequest((("http://www.bubblebox.com/clickreg.php?type=gamestats&id=" + String(GameStats.GAME_ID)) + "&subid=splash"));
this.buttonMode = true;
this.addEventListener(MouseEvent.CLICK, onClick);
}
function frame161(){
this.dispatchEvent(new Event(Event.COMPLETE));
this.buttonMode = false;
this.removeEventListener(MouseEvent.CLICK, onClick);
this.stop();
}
public function onClick(_arg1:MouseEvent):void{
navigateToURL(rq, "_blank");
}
}
}//package FlyMe_fla
Section 109
//MainTimeline (FlyMe_fla.MainTimeline)
package FlyMe_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import CPMStar.*;
import gs.*;
public dynamic class MainTimeline extends MovieClip {
public var bubbleSplash:MovieClip;
public var loadingbar:MovieClip;
public var hack;
public var ad:DisplayObject;
public var CPMStarContentSpotID:String;
public var splash:MovieClip;
public var go;
public var adBox:MovieClip;
public var domains:Array;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 4, frame5);
}
public function endOfSplash(_arg1:Event):void{
splash.removeEventListener(Event.COMPLETE, endOfSplash);
setTimeout(this.nextFrame, 1000);
}
public function LoadingLoop(_arg1:Event):void{
var _local2:Number = stage.loaderInfo.bytesLoaded;
var _local3:Number = stage.loaderInfo.bytesTotal;
var _local4:Number = Math.ceil(((_local2 / _local3) * 100));
if (_local3 <= 0){
_local4 = 100;
};
if (loadingbar.currentFrame <= 100){
if (loadingbar.currentFrame < _local4){
loadingbar.play();
} else {
loadingbar.stop();
};
};
if ((((_local2 >= _local3)) && ((go == true)))){
closeAd();
};
}
function frame2(){
stop();
splash = (this["bubbleSplash"] as MovieClip);
splash.addEventListener(Event.COMPLETE, endOfSplash);
}
function frame1(){
domains = new Array();
domains.push("bubblebox.com", "cccplay.com");
stage.quality = StageQuality.HIGH;
hack = false;
}
function frame3(){
go = false;
CPMStarContentSpotID = "977QA51E52C0";
ad = new AdLoader(CPMStarContentSpotID);
adBox.addChild(ad);
TweenMax.from(this, 1, {alpha:0});
this.addEventListener(Event.ENTER_FRAME, LoadingLoop, false, 0, true);
}
public function sitelock(_arg1:Array):void{
var _local2:Boolean;
var _local3:String = stage.loaderInfo.url;
var _local4:Number = (_local3.indexOf("://") + 3);
var _local5:Number = _local3.indexOf("/", _local4);
var _local6:String = _local3.substring(_local4, _local5);
var _local7:Number = (_local6.lastIndexOf(".") - 1);
var _local8:Number = (_local6.lastIndexOf(".", _local7) + 1);
_local6 = _local6.substring(_local8, _local6.length);
var _local9:int = _arg1.length;
while (((_local9--) && (!(_local2)))) {
if ((!(_arg1[_local9]) is String)){
} else {
if (String(_arg1[_local9]) == _local6){
_local2 = true;
};
};
};
if (!(_local2)){
hack = true;
};
}
function frame5(){
stop();
if (this.hack == true){
} else {
this.addChild(new Main(this.stage));
TweenMax.from(this, 1, {alpha:0});
};
}
public function closeAd():void{
this.removeEventListener(Event.ENTER_FRAME, LoadingLoop);
this.gotoAndStop(5);
if (this["adBox"] != null){
this.removeChild(this["adBox"]);
};
}
}
}//package FlyMe_fla
Section 110
//MC_sourisloading_13 (FlyMe_fla.MC_sourisloading_13)
package FlyMe_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class MC_sourisloading_13 extends MovieClip {
public var SUPERMOUSE:MovieClip;
public function MC_sourisloading_13(){
addFrameScript(99, frame100, 159, frame160);
}
function frame100(){
play();
}
function frame160(){
parent.go = true;
stop();
}
}
}//package FlyMe_fla
Section 111
//MCAvatarIDle_95 (FlyMe_fla.MCAvatarIDle_95)
package FlyMe_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class MCAvatarIDle_95 extends MovieClip {
public function MCAvatarIDle_95(){
addFrameScript(39, frame40);
}
function frame40(){
this.stop();
}
}
}//package FlyMe_fla
Section 112
//MCCercle_80 (FlyMe_fla.MCCercle_80)
package FlyMe_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class MCCercle_80 extends MovieClip {
public function MCCercle_80(){
addFrameScript(101, frame102);
}
function frame102(){
this.gotoAndPlay(43);
}
}
}//package FlyMe_fla
Section 113
//SuperMouse_15 (FlyMe_fla.SuperMouse_15)
package FlyMe_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class SuperMouse_15 extends MovieClip {
public function SuperMouse_15(){
addFrameScript(139, frame140);
}
function frame140(){
stop();
}
}
}//package FlyMe_fla
Section 114
//Timeline_6 (FlyMe_fla.Timeline_6)
package FlyMe_fla {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import data.*;
public dynamic class Timeline_6 extends MovieClip {
public var btnBUBBLEBOX:SimpleButton;
public var logo2:InteractiveObject;
public var logo:InteractiveObject;
public var btnCCCPLAY:SimpleButton;
public function Timeline_6(){
addFrameScript(0, frame1);
}
function frame1(){
logo2 = (this["btnBUBBLEBOX"] as InteractiveObject);
logo2.addEventListener(MouseEvent.CLICK, gotoBubbleBox);
logo = (this["btnCCCPLAY"] as InteractiveObject);
logo.addEventListener(MouseEvent.CLICK, gotoCCCP);
}
public function gotoCCCP(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://www.cccplay.com");
navigateToURL(_local2, "_blank");
}
public function gotoBubbleBox(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest((("http://www.bubblebox.com/clickreg.php?type=gamestats&id=" + String(GameStats.GAME_ID)) + "&subid=preload"));
navigateToURL(_local2, "_blank");
}
}
}//package FlyMe_fla
Section 115
//Bounce (gs.easing.Bounce)
package gs.easing {
public class Bounce {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
if (_arg1 < (1 / 2.75)){
return (((_arg3 * ((7.5625 * _arg1) * _arg1)) + _arg2));
};
if (_arg1 < (2 / 2.75)){
_arg1 = (_arg1 - (1.5 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.75)) + _arg2));
};
if (_arg1 < (2.5 / 2.75)){
_arg1 = (_arg1 - (2.25 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.9375)) + _arg2));
};
_arg1 = (_arg1 - (2.625 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.984375)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg3 - easeOut((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
if (_arg1 < (_arg4 / 2)){
return (((easeIn((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeOut(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
}
}//package gs.easing
Section 116
//TweenEvent (gs.events.TweenEvent)
package gs.events {
import flash.events.*;
public class TweenEvent extends Event {
public var info:Object;
public static const UPDATE:String = "update";
public static const START:String = "start";
public static const version:Number = 0.9;
public static const COMPLETE:String = "complete";
public function TweenEvent(_arg1:String, _arg2:Object=null, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
this.info = _arg2;
}
override public function clone():Event{
return (new TweenEvent(this.type, this.info, this.bubbles, this.cancelable));
}
}
}//package gs.events
Section 117
//AutoAlphaPlugin (gs.plugins.AutoAlphaPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class AutoAlphaPlugin extends TweenPlugin {
protected var _tweenVisible:Boolean;
protected var _target:Object;
protected var _visible:Boolean;
protected var _tween:TweenLite;
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function AutoAlphaPlugin(){
this.propName = "autoAlpha";
this.overwriteProps = ["alpha", "visible"];
this.onComplete = onCompleteTween;
}
override public function killProps(_arg1:Object):void{
super.killProps(_arg1);
_tweenVisible = !(Boolean(("visible" in _arg1)));
}
public function onCompleteTween():void{
if (((((_tweenVisible) && (!((_tween.vars.runBackwards == true))))) && ((_tween.ease == _tween.vars.ease)))){
_target.visible = _visible;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_tween = _arg3;
_visible = Boolean(!((_arg2 == 0)));
_tweenVisible = true;
addTween(_arg1, "alpha", _arg1.alpha, _arg2, "alpha");
return (true);
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
if (((!((_target.visible == true))) && (_tweenVisible))){
_target.visible = true;
};
}
}
}//package gs.plugins
Section 118
//BevelFilterPlugin (gs.plugins.BevelFilterPlugin)
package gs.plugins {
import flash.filters.*;
import flash.display.*;
import gs.*;
public class BevelFilterPlugin extends FilterPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function BevelFilterPlugin(){
this.propName = "bevelFilter";
this.overwriteProps = ["bevelFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = BevelFilter;
initFilter(_arg2, new BevelFilter(0, 0, 0xFFFFFF, 0.5, 0, 0.5, 2, 2, 0, ((_arg2.quality) || (2))));
return (true);
}
}
}//package gs.plugins
Section 119
//BezierPlugin (gs.plugins.BezierPlugin)
package gs.plugins {
import gs.*;
import gs.utils.tween.*;
public class BezierPlugin extends TweenPlugin {
protected var _future:Object;
protected var _orient:Boolean;
protected var _orientData:Array;
protected var _target:Object;
protected var _beziers:Object;
protected static const _RAD2DEG:Number = 57.2957795130823;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function BezierPlugin(){
_future = {};
super();
this.propName = "bezier";
this.overwriteProps = [];
}
override public function killProps(_arg1:Object):void{
var _local2:String;
for (_local2 in _beziers) {
if ((_local2 in _arg1)){
delete _beziers[_local2];
};
};
super.killProps(_arg1);
}
protected function init(_arg1:TweenLite, _arg2:Array, _arg3:Boolean):void{
var _local5:int;
var _local6:String;
_target = _arg1.target;
if (_arg1.exposedVars.orientToBezier == true){
_orientData = [["x", "y", "rotation", 0]];
_orient = true;
} else {
if ((_arg1.exposedVars.orientToBezier is Array)){
_orientData = _arg1.exposedVars.orientToBezier;
_orient = true;
};
};
var _local4:Object = {};
_local5 = 0;
while (_local5 < _arg2.length) {
for (_local6 in _arg2[_local5]) {
if (_local4[_local6] == undefined){
_local4[_local6] = [_arg1.target[_local6]];
};
if (typeof(_arg2[_local5][_local6]) == "number"){
_local4[_local6].push(_arg2[_local5][_local6]);
} else {
_local4[_local6].push((_arg1.target[_local6] + Number(_arg2[_local5][_local6])));
};
};
_local5++;
};
for (_local6 in _local4) {
this.overwriteProps[this.overwriteProps.length] = _local6;
if (_arg1.exposedVars[_local6] != undefined){
if (typeof(_arg1.exposedVars[_local6]) == "number"){
_local4[_local6].push(_arg1.exposedVars[_local6]);
} else {
_local4[_local6].push((_arg1.target[_local6] + Number(_arg1.exposedVars[_local6])));
};
delete _arg1.exposedVars[_local6];
_local5 = (_arg1.tweens.length - 1);
while (_local5 > -1) {
if (_arg1.tweens[_local5].name == _local6){
_arg1.tweens.splice(_local5, 1);
};
_local5--;
};
};
};
_beziers = parseBeziers(_local4, _arg3);
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (!((_arg2 is Array))){
return (false);
};
init(_arg3, (_arg2 as Array), false);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:String;
var _local4:Object;
var _local5:Number;
var _local6:uint;
var _local7:Number;
var _local8:int;
var _local9:Object;
var _local10:Boolean;
var _local11:Number;
var _local12:Number;
var _local13:Array;
var _local14:Number;
if (_arg1 == 1){
for (_local3 in _beziers) {
_local2 = (_beziers[_local3].length - 1);
_target[_local3] = _beziers[_local3][_local2][2];
};
} else {
for (_local3 in _beziers) {
_local6 = _beziers[_local3].length;
if (_arg1 < 0){
_local2 = 0;
} else {
if (_arg1 >= 1){
_local2 = (_local6 - 1);
} else {
_local2 = int((_local6 * _arg1));
};
};
_local5 = ((_arg1 - (_local2 * (1 / _local6))) * _local6);
_local4 = _beziers[_local3][_local2];
if (this.round){
_local7 = (_local4[0] + (_local5 * (((2 * (1 - _local5)) * (_local4[1] - _local4[0])) + (_local5 * (_local4[2] - _local4[0])))));
_local8 = ((_local7)<0) ? -1 : 1;
_target[_local3] = ((((_local7 % 1) * _local8))>0.5) ? (int(_local7) + _local8) : int(_local7);
} else {
_target[_local3] = (_local4[0] + (_local5 * (((2 * (1 - _local5)) * (_local4[1] - _local4[0])) + (_local5 * (_local4[2] - _local4[0])))));
};
};
};
if (_orient){
_local9 = _target;
_local10 = this.round;
_target = _future;
this.round = false;
_orient = false;
this.changeFactor = (_arg1 + 0.01);
_target = _local9;
this.round = _local10;
_orient = true;
_local2 = 0;
while (_local2 < _orientData.length) {
_local13 = _orientData[_local2];
_local14 = ((_local13[3]) || (0));
_local11 = (_future[_local13[0]] - _target[_local13[0]]);
_local12 = (_future[_local13[1]] - _target[_local13[1]]);
_target[_local13[2]] = ((Math.atan2(_local12, _local11) * _RAD2DEG) + _local14);
_local2++;
};
};
}
public static function parseBeziers(_arg1:Object, _arg2:Boolean=false):Object{
var _local3:int;
var _local4:Array;
var _local5:Object;
var _local6:String;
var _local7:Object = {};
if (_arg2){
for (_local6 in _arg1) {
_local4 = _arg1[_local6];
_local5 = [];
_local7[_local6] = _local5;
if (_local4.length > 2){
_local5[_local5.length] = [_local4[0], (_local4[1] - ((_local4[2] - _local4[0]) / 4)), _local4[1]];
_local3 = 1;
while (_local3 < (_local4.length - 1)) {
_local5[_local5.length] = [_local4[_local3], (_local4[_local3] + (_local4[_local3] - _local5[(_local3 - 1)][1])), _local4[(_local3 + 1)]];
_local3++;
};
} else {
_local5[_local5.length] = [_local4[0], ((_local4[0] + _local4[1]) / 2), _local4[1]];
};
};
} else {
for (_local6 in _arg1) {
_local4 = _arg1[_local6];
_local5 = [];
_local7[_local6] = _local5;
if (_local4.length > 3){
_local5[_local5.length] = [_local4[0], _local4[1], ((_local4[1] + _local4[2]) / 2)];
_local3 = 2;
while (_local3 < (_local4.length - 2)) {
_local5[_local5.length] = [_local5[(_local3 - 2)][2], _local4[_local3], ((_local4[_local3] + _local4[(_local3 + 1)]) / 2)];
_local3++;
};
_local5[_local5.length] = [_local5[(_local5.length - 1)][2], _local4[(_local4.length - 2)], _local4[(_local4.length - 1)]];
} else {
if (_local4.length == 3){
_local5[_local5.length] = [_local4[0], _local4[1], _local4[2]];
} else {
if (_local4.length == 2){
_local5[_local5.length] = [_local4[0], ((_local4[0] + _local4[1]) / 2), _local4[1]];
};
};
};
};
};
return (_local7);
}
}
}//package gs.plugins
Section 120
//BezierThroughPlugin (gs.plugins.BezierThroughPlugin)
package gs.plugins {
import gs.*;
public class BezierThroughPlugin extends BezierPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function BezierThroughPlugin(){
this.propName = "bezierThrough";
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (!((_arg2 is Array))){
return (false);
};
init(_arg3, (_arg2 as Array), true);
return (true);
}
}
}//package gs.plugins
Section 121
//BlurFilterPlugin (gs.plugins.BlurFilterPlugin)
package gs.plugins {
import flash.filters.*;
import flash.display.*;
import gs.*;
public class BlurFilterPlugin extends FilterPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function BlurFilterPlugin(){
this.propName = "blurFilter";
this.overwriteProps = ["blurFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = BlurFilter;
initFilter(_arg2, new BlurFilter(0, 0, ((_arg2.quality) || (2))));
return (true);
}
}
}//package gs.plugins
Section 122
//ColorMatrixFilterPlugin (gs.plugins.ColorMatrixFilterPlugin)
package gs.plugins {
import flash.display.*;
import flash.filters.*;
import gs.*;
public class ColorMatrixFilterPlugin extends FilterPlugin {
protected var _matrix:Array;
protected var _matrixTween:EndArrayPlugin;
public static const API:Number = 1;
public static const VERSION:Number = 1.1;
protected static var _lumG:Number = 0.71516;
protected static var _lumR:Number = 0.212671;
protected static var _idMatrix:Array = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0];
protected static var _lumB:Number = 0.072169;
public function ColorMatrixFilterPlugin(){
this.propName = "colorMatrixFilter";
this.overwriteProps = ["colorMatrixFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = ColorMatrixFilter;
var _local4:Object = _arg2;
initFilter({remove:_arg2.remove, index:_arg2.index, addFilter:_arg2.addFilter}, new ColorMatrixFilter(_idMatrix.slice()));
_matrix = ColorMatrixFilter(_filter).matrix;
var _local5:Array = [];
if (((!((_local4.matrix == null))) && ((_local4.matrix is Array)))){
_local5 = _local4.matrix;
} else {
if (_local4.relative == true){
_local5 = _matrix.slice();
} else {
_local5 = _idMatrix.slice();
};
_local5 = setBrightness(_local5, _local4.brightness);
_local5 = setContrast(_local5, _local4.contrast);
_local5 = setHue(_local5, _local4.hue);
_local5 = setSaturation(_local5, _local4.saturation);
_local5 = setThreshold(_local5, _local4.threshold);
if (!(isNaN(_local4.colorize))){
_local5 = colorize(_local5, _local4.colorize, _local4.amount);
};
};
_matrixTween = new EndArrayPlugin();
_matrixTween.init(_matrix, _local5);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
_matrixTween.changeFactor = _arg1;
ColorMatrixFilter(_filter).matrix = _matrix;
super.changeFactor = _arg1;
}
public static function setSaturation(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
var _local3:Number = (1 - _arg2);
var _local4:Number = (_local3 * _lumR);
var _local5:Number = (_local3 * _lumG);
var _local6:Number = (_local3 * _lumB);
var _local7:Array = [(_local4 + _arg2), _local5, _local6, 0, 0, _local4, (_local5 + _arg2), _local6, 0, 0, _local4, _local5, (_local6 + _arg2), 0, 0, 0, 0, 0, 1, 0];
return (applyMatrix(_local7, _arg1));
}
public static function setHue(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = (_arg2 * (Math.PI / 180));
var _local3:Number = Math.cos(_arg2);
var _local4:Number = Math.sin(_arg2);
var _local5:Array = [((_lumR + (_local3 * (1 - _lumR))) + (_local4 * -(_lumR))), ((_lumG + (_local3 * -(_lumG))) + (_local4 * -(_lumG))), ((_lumB + (_local3 * -(_lumB))) + (_local4 * (1 - _lumB))), 0, 0, ((_lumR + (_local3 * -(_lumR))) + (_local4 * 0.143)), ((_lumG + (_local3 * (1 - _lumG))) + (_local4 * 0.14)), ((_lumB + (_local3 * -(_lumB))) + (_local4 * -0.283)), 0, 0, ((_lumR + (_local3 * -(_lumR))) + (_local4 * -((1 - _lumR)))), ((_lumG + (_local3 * -(_lumG))) + (_local4 * _lumG)), ((_lumB + (_local3 * (1 - _lumB))) + (_local4 * _lumB)), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];
return (applyMatrix(_local5, _arg1));
}
public static function setThreshold(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
var _local3:Array = [(_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), (_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), (_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), 0, 0, 0, 1, 0];
return (applyMatrix(_local3, _arg1));
}
public static function applyMatrix(_arg1:Array, _arg2:Array):Array{
var _local6:int;
var _local7:int;
if (((!((_arg1 is Array))) || (!((_arg2 is Array))))){
return (_arg2);
};
var _local3:Array = [];
var _local4:int;
var _local5:int;
_local6 = 0;
while (_local6 < 4) {
_local7 = 0;
while (_local7 < 5) {
if (_local7 == 4){
_local5 = _arg1[(_local4 + 4)];
} else {
_local5 = 0;
};
_local3[(_local4 + _local7)] = (((((_arg1[_local4] * _arg2[_local7]) + (_arg1[(_local4 + 1)] * _arg2[(_local7 + 5)])) + (_arg1[(_local4 + 2)] * _arg2[(_local7 + 10)])) + (_arg1[(_local4 + 3)] * _arg2[(_local7 + 15)])) + _local5);
_local7++;
};
_local4 = (_local4 + 5);
_local6++;
};
return (_local3);
}
public static function colorize(_arg1:Array, _arg2:Number, _arg3:Number=1):Array{
if (isNaN(_arg2)){
return (_arg1);
};
if (isNaN(_arg3)){
_arg3 = 1;
};
var _local4:Number = (((_arg2 >> 16) & 0xFF) / 0xFF);
var _local5:Number = (((_arg2 >> 8) & 0xFF) / 0xFF);
var _local6:Number = ((_arg2 & 0xFF) / 0xFF);
var _local7:Number = (1 - _arg3);
var _local8:Array = [(_local7 + ((_arg3 * _local4) * _lumR)), ((_arg3 * _local4) * _lumG), ((_arg3 * _local4) * _lumB), 0, 0, ((_arg3 * _local5) * _lumR), (_local7 + ((_arg3 * _local5) * _lumG)), ((_arg3 * _local5) * _lumB), 0, 0, ((_arg3 * _local6) * _lumR), ((_arg3 * _local6) * _lumG), (_local7 + ((_arg3 * _local6) * _lumB)), 0, 0, 0, 0, 0, 1, 0];
return (applyMatrix(_local8, _arg1));
}
public static function setBrightness(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = ((_arg2 * 100) - 100);
return (applyMatrix([1, 0, 0, 0, _arg2, 0, 1, 0, 0, _arg2, 0, 0, 1, 0, _arg2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], _arg1));
}
public static function setContrast(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = (_arg2 + 0.01);
var _local3:Array = [_arg2, 0, 0, 0, (128 * (1 - _arg2)), 0, _arg2, 0, 0, (128 * (1 - _arg2)), 0, 0, _arg2, 0, (128 * (1 - _arg2)), 0, 0, 0, 1, 0];
return (applyMatrix(_local3, _arg1));
}
}
}//package gs.plugins
Section 123
//DropShadowFilterPlugin (gs.plugins.DropShadowFilterPlugin)
package gs.plugins {
import flash.filters.*;
import flash.display.*;
import gs.*;
public class DropShadowFilterPlugin extends FilterPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function DropShadowFilterPlugin(){
this.propName = "dropShadowFilter";
this.overwriteProps = ["dropShadowFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = DropShadowFilter;
initFilter(_arg2, new DropShadowFilter(0, 45, 0, 0, 0, 0, 1, ((_arg2.quality) || (2)), _arg2.inner, _arg2.knockout, _arg2.hideObject));
return (true);
}
}
}//package gs.plugins
Section 124
//EndArrayPlugin (gs.plugins.EndArrayPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import gs.utils.tween.*;
public class EndArrayPlugin extends TweenPlugin {
protected var _a:Array;
protected var _info:Array;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function EndArrayPlugin(){
_info = [];
super();
this.propName = "endArray";
this.overwriteProps = ["endArray"];
}
public function init(_arg1:Array, _arg2:Array):void{
_a = _arg1;
var _local3:int = (_arg2.length - 1);
while (_local3 > -1) {
if (((!((_arg1[_local3] == _arg2[_local3]))) && (!((_arg1[_local3] == null))))){
_info[_info.length] = new ArrayTweenInfo(_local3, _a[_local3], (_arg2[_local3] - _a[_local3]));
};
_local3--;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((!((_arg1 is Array))) || (!((_arg2 is Array))))){
return (false);
};
init((_arg1 as Array), _arg2);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:ArrayTweenInfo;
var _local4:Number;
var _local5:int;
if (this.round){
_local2 = (_info.length - 1);
while (_local2 > -1) {
_local3 = _info[_local2];
_local4 = (_local3.start + (_local3.change * _arg1));
_local5 = ((_local4)<0) ? -1 : 1;
_a[_local3.index] = ((((_local4 % 1) * _local5))>0.5) ? (int(_local4) + _local5) : int(_local4);
_local2--;
};
} else {
_local2 = (_info.length - 1);
while (_local2 > -1) {
_local3 = _info[_local2];
_a[_local3.index] = (_local3.start + (_local3.change * _arg1));
_local2--;
};
};
}
}
}//package gs.plugins
Section 125
//FilterPlugin (gs.plugins.FilterPlugin)
package gs.plugins {
import flash.display.*;
import flash.filters.*;
import gs.*;
import gs.utils.tween.*;
public class FilterPlugin extends TweenPlugin {
protected var _remove:Boolean;
protected var _target:Object;
protected var _index:int;
protected var _filter:BitmapFilter;
protected var _type:Class;
public static const VERSION:Number = 1.03;
public static const API:Number = 1;
public function onCompleteTween():void{
var _local1:int;
var _local2:Array;
if (_remove){
_local2 = _target.filters;
if (!((_local2[_index] is _type))){
_local1 = (_local2.length - 1);
while (_local1 > -1) {
if ((_local2[_local1] is _type)){
_local2.splice(_local1, 1);
break;
};
_local1--;
};
} else {
_local2.splice(_index, 1);
};
_target.filters = _local2;
};
}
protected function initFilter(_arg1:Object, _arg2:BitmapFilter):void{
var _local4:String;
var _local5:int;
var _local6:HexColorsPlugin;
var _local3:Array = _target.filters;
_index = -1;
if (_arg1.index != null){
_index = _arg1.index;
} else {
_local5 = (_local3.length - 1);
while (_local5 > -1) {
if ((_local3[_local5] is _type)){
_index = _local5;
break;
};
_local5--;
};
};
if ((((((_index == -1)) || ((_local3[_index] == null)))) || ((_arg1.addFilter == true)))){
_index = ((_arg1.index)!=null) ? _arg1.index : _local3.length;
_local3[_index] = _arg2;
_target.filters = _local3;
};
_filter = _local3[_index];
_remove = Boolean((_arg1.remove == true));
if (_remove){
this.onComplete = onCompleteTween;
};
var _local7:Object = ((_arg1.isTV)==true) ? _arg1.exposedVars : _arg1;
for (_local4 in _local7) {
if (((((((((!((_local4 in _filter))) || ((_filter[_local4] == _local7[_local4])))) || ((_local4 == "remove")))) || ((_local4 == "index")))) || ((_local4 == "addFilter")))){
} else {
if ((((((_local4 == "color")) || ((_local4 == "highlightColor")))) || ((_local4 == "shadowColor")))){
_local6 = new HexColorsPlugin();
_local6.initColor(_filter, _local4, _filter[_local4], _local7[_local4]);
_tweens[_tweens.length] = new TweenInfo(_local6, "changeFactor", 0, 1, _local4, false);
} else {
if ((((((((_local4 == "quality")) || ((_local4 == "inner")))) || ((_local4 == "knockout")))) || ((_local4 == "hideObject")))){
_filter[_local4] = _local7[_local4];
} else {
addTween(_filter, _local4, _filter[_local4], _local7[_local4], _local4);
};
};
};
};
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:TweenInfo;
var _local4:Array = _target.filters;
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
_local3 = _tweens[_local2];
_local3.target[_local3.property] = (_local3.start + (_local3.change * _arg1));
_local2--;
};
if (!((_local4[_index] is _type))){
_index = (_local4.length - 1);
_local2 = (_local4.length - 1);
while (_local2 > -1) {
if ((_local4[_local2] is _type)){
_index = _local2;
break;
};
_local2--;
};
};
_local4[_index] = _filter;
_target.filters = _local4;
}
}
}//package gs.plugins
Section 126
//FramePlugin (gs.plugins.FramePlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class FramePlugin extends TweenPlugin {
protected var _target:MovieClip;
public var frame:int;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function FramePlugin(){
this.propName = "frame";
this.overwriteProps = ["frame"];
this.round = true;
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((!((_arg1 is MovieClip))) || (isNaN(_arg2)))){
return (false);
};
_target = (_arg1 as MovieClip);
this.frame = _target.currentFrame;
addTween(this, "frame", this.frame, _arg2, "frame");
return (true);
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_target.gotoAndStop(this.frame);
}
}
}//package gs.plugins
Section 127
//GlowFilterPlugin (gs.plugins.GlowFilterPlugin)
package gs.plugins {
import flash.filters.*;
import flash.display.*;
import gs.*;
public class GlowFilterPlugin extends FilterPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function GlowFilterPlugin(){
this.propName = "glowFilter";
this.overwriteProps = ["glowFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = GlowFilter;
initFilter(_arg2, new GlowFilter(0xFFFFFF, 0, 0, 0, ((_arg2.strength) || (1)), ((_arg2.quality) || (2)), _arg2.inner, _arg2.knockout));
return (true);
}
}
}//package gs.plugins
Section 128
//HexColorsPlugin (gs.plugins.HexColorsPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class HexColorsPlugin extends TweenPlugin {
protected var _colors:Array;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function HexColorsPlugin(){
this.propName = "hexColors";
this.overwriteProps = [];
_colors = [];
}
override public function killProps(_arg1:Object):void{
var _local2:int = (_colors.length - 1);
while (_local2 > -1) {
if (_arg1[_colors[_local2][1]] != undefined){
_colors.splice(_local2, 1);
};
_local2--;
};
super.killProps(_arg1);
}
public function initColor(_arg1:Object, _arg2:String, _arg3:uint, _arg4:uint):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (_arg3 != _arg4){
_local5 = (_arg3 >> 16);
_local6 = ((_arg3 >> 8) & 0xFF);
_local7 = (_arg3 & 0xFF);
_colors[_colors.length] = [_arg1, _arg2, _local5, ((_arg4 >> 16) - _local5), _local6, (((_arg4 >> 8) & 0xFF) - _local6), _local7, ((_arg4 & 0xFF) - _local7)];
this.overwriteProps[this.overwriteProps.length] = _arg2;
};
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:Array;
_local2 = (_colors.length - 1);
while (_local2 > -1) {
_local3 = _colors[_local2];
_local3[0][_local3[1]] = ((((_local3[2] + (_arg1 * _local3[3])) << 16) | ((_local3[4] + (_arg1 * _local3[5])) << 8)) | (_local3[6] + (_arg1 * _local3[7])));
_local2--;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
var _local4:String;
for (_local4 in _arg2) {
initColor(_arg1, _local4, uint(_arg1[_local4]), uint(_arg2[_local4]));
};
return (true);
}
}
}//package gs.plugins
Section 129
//RemoveTintPlugin (gs.plugins.RemoveTintPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class RemoveTintPlugin extends TintPlugin {
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function RemoveTintPlugin(){
this.propName = "removeTint";
}
}
}//package gs.plugins
Section 130
//RoundPropsPlugin (gs.plugins.RoundPropsPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class RoundPropsPlugin extends TweenPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function RoundPropsPlugin(){
this.propName = "roundProps";
this.overwriteProps = [];
this.round = true;
}
public function add(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number):void{
addTween(_arg1, _arg2, _arg3, (_arg3 + _arg4), _arg2);
this.overwriteProps[this.overwriteProps.length] = _arg2;
}
}
}//package gs.plugins
Section 131
//ShortRotationPlugin (gs.plugins.ShortRotationPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class ShortRotationPlugin extends TweenPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function ShortRotationPlugin(){
this.propName = "shortRotation";
this.overwriteProps = [];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
var _local4:String;
if (typeof(_arg2) == "number"){
trace("WARNING: You appear to be using the old shortRotation syntax. Instead of passing a number, please pass an object with properties that correspond to the rotations values For example, TweenMax.to(mc, 2, {shortRotation:{rotationX:-170, rotationY:25}})");
return (false);
};
for (_local4 in _arg2) {
initRotation(_arg1, _local4, _arg1[_local4], _arg2[_local4]);
};
return (true);
}
public function initRotation(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number):void{
var _local5:Number = ((_arg4 - _arg3) % 360);
if (_local5 != (_local5 % 180)){
_local5 = ((_local5)<0) ? (_local5 + 360) : (_local5 - 360);
};
addTween(_arg1, _arg2, _arg3, (_arg3 + _local5), _arg2);
this.overwriteProps[this.overwriteProps.length] = _arg2;
}
}
}//package gs.plugins
Section 132
//TintPlugin (gs.plugins.TintPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.geom.*;
import gs.utils.tween.*;
public class TintPlugin extends TweenPlugin {
protected var _target:DisplayObject;
protected var _ct:ColorTransform;
protected var _ignoreAlpha:Boolean;
public static const VERSION:Number = 1.1;
public static const API:Number = 1;
protected static var _props:Array = ["redMultiplier", "greenMultiplier", "blueMultiplier", "alphaMultiplier", "redOffset", "greenOffset", "blueOffset", "alphaOffset"];
public function TintPlugin(){
this.propName = "tint";
this.overwriteProps = ["tint"];
}
public function init(_arg1:DisplayObject, _arg2:ColorTransform):void{
var _local3:int;
var _local4:String;
_target = _arg1;
_ct = _target.transform.colorTransform;
_local3 = (_props.length - 1);
while (_local3 > -1) {
_local4 = _props[_local3];
if (_ct[_local4] != _arg2[_local4]){
_tweens[_tweens.length] = new TweenInfo(_ct, _local4, _ct[_local4], (_arg2[_local4] - _ct[_local4]), "tint", false);
};
_local3--;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (!((_arg1 is DisplayObject))){
return (false);
};
var _local4:ColorTransform = new ColorTransform();
if (((!((_arg2 == null))) && (!((_arg3.exposedVars.removeTint == true))))){
_local4.color = uint(_arg2);
};
_ignoreAlpha = true;
init((_arg1 as DisplayObject), _local4);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
var _local2:ColorTransform;
updateTweens(_arg1);
if (_ignoreAlpha){
_local2 = _target.transform.colorTransform;
_ct.alphaMultiplier = _local2.alphaMultiplier;
_ct.alphaOffset = _local2.alphaOffset;
};
_target.transform.colorTransform = _ct;
}
}
}//package gs.plugins
Section 133
//TweenPlugin (gs.plugins.TweenPlugin)
package gs.plugins {
import gs.*;
import gs.utils.tween.*;
public class TweenPlugin {
public var overwriteProps:Array;
protected var _tweens:Array;
public var propName:String;
public var onComplete:Function;
public var round:Boolean;
protected var _changeFactor:Number;// = 0
public static const VERSION:Number = 1.03;
public static const API:Number = 1;
public function TweenPlugin(){
_tweens = [];
super();
}
protected function updateTweens(_arg1:Number):void{
var _local2:int;
var _local3:TweenInfo;
var _local4:Number;
var _local5:int;
if (this.round){
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
_local3 = _tweens[_local2];
_local4 = (_local3.start + (_local3.change * _arg1));
_local5 = ((_local4)<0) ? -1 : 1;
_local3.target[_local3.property] = ((((_local4 % 1) * _local5))>0.5) ? (int(_local4) + _local5) : int(_local4);
_local2--;
};
} else {
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
_local3 = _tweens[_local2];
_local3.target[_local3.property] = (_local3.start + (_local3.change * _arg1));
_local2--;
};
};
}
public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_changeFactor = _arg1;
}
protected function addTween(_arg1:Object, _arg2:String, _arg3:Number, _arg4, _arg5:String=null):void{
var _local6:Number;
if (_arg4 != null){
_local6 = ((typeof(_arg4))=="number") ? (_arg4 - _arg3) : Number(_arg4);
if (_local6 != 0){
_tweens[_tweens.length] = new TweenInfo(_arg1, _arg2, _arg3, _local6, ((_arg5) || (_arg2)), false);
};
};
}
public function killProps(_arg1:Object):void{
var _local2:int;
_local2 = (this.overwriteProps.length - 1);
while (_local2 > -1) {
if ((this.overwriteProps[_local2] in _arg1)){
this.overwriteProps.splice(_local2, 1);
};
_local2--;
};
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
if ((_tweens[_local2].name in _arg1)){
_tweens.splice(_local2, 1);
};
_local2--;
};
}
public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
addTween(_arg1, this.propName, _arg1[this.propName], _arg2, this.propName);
return (true);
}
public function get changeFactor():Number{
return (_changeFactor);
}
public static function activate(_arg1:Array):Boolean{
var _local2:int;
var _local3:Object;
_local2 = (_arg1.length - 1);
while (_local2 > -1) {
_local3 = new (_arg1[_local2]);
TweenLite.plugins[_local3.propName] = _arg1[_local2];
_local2--;
};
return (true);
}
}
}//package gs.plugins
Section 134
//VisiblePlugin (gs.plugins.VisiblePlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class VisiblePlugin extends TweenPlugin {
protected var _target:Object;
protected var _visible:Boolean;
protected var _tween:TweenLite;
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function VisiblePlugin(){
this.propName = "visible";
this.overwriteProps = ["visible"];
this.onComplete = onCompleteTween;
}
public function onCompleteTween():void{
if (((!((_tween.vars.runBackwards == true))) && ((_tween.ease == _tween.vars.ease)))){
_target.visible = _visible;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_tween = _arg3;
_visible = Boolean(_arg2);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
if (_target.visible != true){
_target.visible = true;
};
}
}
}//package gs.plugins
Section 135
//VolumePlugin (gs.plugins.VolumePlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.media.*;
public class VolumePlugin extends TweenPlugin {
protected var _target:Object;
protected var _st:SoundTransform;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function VolumePlugin(){
this.propName = "volume";
this.overwriteProps = ["volume"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((isNaN(_arg2)) || (!(_arg1.hasOwnProperty("soundTransform"))))){
return (false);
};
_target = _arg1;
_st = _target.soundTransform;
addTween(_st, "volume", _st.volume, _arg2, "volume");
return (true);
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_target.soundTransform = _st;
}
}
}//package gs.plugins
Section 136
//ArrayTweenInfo (gs.utils.tween.ArrayTweenInfo)
package gs.utils.tween {
public class ArrayTweenInfo {
public var change:Number;
public var start:Number;
public var index:uint;
public function ArrayTweenInfo(_arg1:uint, _arg2:Number, _arg3:Number){
this.index = _arg1;
this.start = _arg2;
this.change = _arg3;
}
}
}//package gs.utils.tween
Section 137
//TweenInfo (gs.utils.tween.TweenInfo)
package gs.utils.tween {
public class TweenInfo {
public var start:Number;
public var name:String;
public var change:Number;
public var target:Object;
public var property:String;
public var isPlugin:Boolean;
public function TweenInfo(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Boolean){
this.target = _arg1;
this.property = _arg2;
this.start = _arg3;
this.change = _arg4;
this.name = _arg5;
this.isPlugin = _arg6;
}
}
}//package gs.utils.tween
Section 138
//OverwriteManager (gs.OverwriteManager)
package gs {
import flash.errors.*;
import flash.utils.*;
import gs.utils.tween.*;
public class OverwriteManager {
public static const ALL:int = 1;
public static const NONE:int = 0;
public static const AUTO:int = 2;
public static const CONCURRENT:int = 3;
public static const version:Number = 3.12;
public static var mode:int;
public static var enabled:Boolean;
public static function killVars(_arg1:Object, _arg2:Object, _arg3:Array):void{
var _local4:int;
var _local5:String;
var _local6:TweenInfo;
_local4 = (_arg3.length - 1);
while (_local4 > -1) {
_local6 = _arg3[_local4];
if ((_local6.name in _arg1)){
_arg3.splice(_local4, 1);
} else {
if (((_local6.isPlugin) && ((_local6.name == "_MULTIPLE_")))){
_local6.target.killProps(_arg1);
if (_local6.target.overwriteProps.length == 0){
_arg3.splice(_local4, 1);
};
};
};
_local4--;
};
for (_local5 in _arg1) {
delete _arg2[_local5];
};
}
public static function manageOverwrites(_arg1:TweenLite, _arg2:Array):void{
var _local7:int;
var _local8:TweenLite;
var _local10:Array;
var _local11:Object;
var _local12:int;
var _local13:TweenInfo;
var _local14:Array;
var _local3:Object = _arg1.vars;
var _local4:int = ((_local3.overwrite)==undefined) ? mode : int(_local3.overwrite);
if ((((_local4 < 2)) || ((_arg2 == null)))){
return;
};
var _local5:Number = _arg1.startTime;
var _local6:Array = [];
var _local9:int = -1;
_local7 = (_arg2.length - 1);
while (_local7 > -1) {
_local8 = _arg2[_local7];
if (_local8 == _arg1){
_local9 = _local7;
} else {
if ((((((_local7 < _local9)) && ((_local8.startTime <= _local5)))) && (((_local8.startTime + ((_local8.duration * 1000) / _local8.combinedTimeScale)) > _local5)))){
_local6[_local6.length] = _local8;
};
};
_local7--;
};
if ((((_local6.length == 0)) || ((_arg1.tweens.length == 0)))){
return;
};
if (_local4 == AUTO){
_local10 = _arg1.tweens;
_local11 = {};
_local7 = (_local10.length - 1);
while (_local7 > -1) {
_local13 = _local10[_local7];
if (_local13.isPlugin){
if (_local13.name == "_MULTIPLE_"){
_local14 = _local13.target.overwriteProps;
_local12 = (_local14.length - 1);
while (_local12 > -1) {
_local11[_local14[_local12]] = true;
_local12--;
};
} else {
_local11[_local13.name] = true;
};
_local11[_local13.target.propName] = true;
} else {
_local11[_local13.name] = true;
};
_local7--;
};
_local7 = (_local6.length - 1);
while (_local7 > -1) {
killVars(_local11, _local6[_local7].exposedVars, _local6[_local7].tweens);
_local7--;
};
} else {
_local7 = (_local6.length - 1);
while (_local7 > -1) {
_local6[_local7].enabled = false;
_local7--;
};
};
}
public static function init(_arg1:int=2):int{
if (TweenLite.version < 10.09){
trace("TweenLite warning: Your TweenLite class needs to be updated to work with OverwriteManager (or you may need to clear your ASO files). Please download and install the latest version from http://www.tweenlite.com.");
};
TweenLite.overwriteManager = OverwriteManager;
mode = _arg1;
enabled = true;
return (mode);
}
}
}//package gs
Section 139
//TweenLite (gs.TweenLite)
package gs {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import gs.plugins.*;
import gs.utils.tween.*;
public class TweenLite {
public var started:Boolean;
public var delay:Number;
protected var _hasUpdate:Boolean;
protected var _hasPlugins:Boolean;
public var initted:Boolean;
public var active:Boolean;
public var startTime:Number;
public var target:Object;
public var duration:Number;
public var gc:Boolean;
public var tweens:Array;
public var vars:Object;
public var ease:Function;
public var exposedVars:Object;
public var initTime:Number;
public var combinedTimeScale:Number;
public static const version:Number = 10.092;
private static var _timer:Timer = new Timer(2000);
public static var defaultEase:Function = TweenLite.easeOut;
public static var plugins:Object = {};
public static var currentTime:uint;
public static var masterList:Dictionary = new Dictionary(false);
protected static var _reservedProps:Object = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, roundProps:1, onStart:1, onStartParams:1, persist:1, renderOnStart:1, proxiedEase:1, easeParams:1, yoyo:1, loop:1, onCompleteListener:1, onUpdateListener:1, onStartListener:1, orientToBezier:1, timeScale:1};
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
public static var timingSprite:Sprite = new Sprite();
public static var overwriteManager:Object;
private static var _tlInitted:Boolean;
public function TweenLite(_arg1:Object, _arg2:Number, _arg3:Object){
if (_arg1 == null){
return;
};
if (!(_tlInitted)){
TweenPlugin.activate([TintPlugin, RemoveTintPlugin, FramePlugin, AutoAlphaPlugin, VisiblePlugin, VolumePlugin, EndArrayPlugin]);
currentTime = getTimer();
timingSprite.addEventListener(Event.ENTER_FRAME, updateAll, false, 0, true);
if (overwriteManager == null){
overwriteManager = {mode:1, enabled:false};
};
_timer.addEventListener("timer", killGarbage, false, 0, true);
_timer.start();
_tlInitted = true;
};
this.vars = _arg3;
this.duration = ((_arg2) || (0.001));
this.delay = ((_arg3.delay) || (0));
this.combinedTimeScale = ((_arg3.timeScale) || (1));
this.active = Boolean((((_arg2 == 0)) && ((this.delay == 0))));
this.target = _arg1;
if (typeof(this.vars.ease) != "function"){
this.vars.ease = defaultEase;
};
if (this.vars.easeParams != null){
this.vars.proxiedEase = this.vars.ease;
this.vars.ease = easeProxy;
};
this.ease = this.vars.ease;
this.exposedVars = ((this.vars.isTV)==true) ? this.vars.exposedVars : this.vars;
this.tweens = [];
this.initTime = currentTime;
this.startTime = (this.initTime + (this.delay * 1000));
var _local4:int = ((((_arg3.overwrite == undefined)) || (((!(overwriteManager.enabled)) && ((_arg3.overwrite > 1)))))) ? overwriteManager.mode : int(_arg3.overwrite);
if (((!((_arg1 in masterList))) || ((_local4 == 1)))){
masterList[_arg1] = [this];
} else {
masterList[_arg1].push(this);
};
if ((((((this.vars.runBackwards == true)) && (!((this.vars.renderOnStart == true))))) || (this.active))){
initTweenVals();
if (this.active){
render((this.startTime + 1));
} else {
render(this.startTime);
};
if (((((!((this.exposedVars.visible == null))) && ((this.vars.runBackwards == true)))) && ((this.target is DisplayObject)))){
this.target.visible = this.exposedVars.visible;
};
};
}
public function get enabled():Boolean{
return ((this.gc) ? false : true);
}
public function set enabled(_arg1:Boolean):void{
var _local2:Array;
var _local3:Boolean;
var _local4:int;
if (_arg1){
if (!((this.target in masterList))){
masterList[this.target] = [this];
} else {
_local2 = masterList[this.target];
_local4 = (_local2.length - 1);
while (_local4 > -1) {
if (_local2[_local4] == this){
_local3 = true;
break;
};
_local4--;
};
if (!(_local3)){
_local2[_local2.length] = this;
};
};
};
this.gc = (_arg1) ? false : true;
if (this.gc){
this.active = false;
} else {
this.active = this.started;
};
}
public function clear():void{
this.tweens = [];
this.vars = (this.exposedVars = {ease:this.vars.ease});
_hasUpdate = false;
}
public function render(_arg1:uint):void{
var _local3:Number;
var _local4:TweenInfo;
var _local5:int;
var _local2:Number = ((_arg1 - this.startTime) * 0.001);
if (_local2 >= this.duration){
_local2 = this.duration;
_local3 = ((((this.ease == this.vars.ease)) || ((this.duration == 0.001)))) ? 1 : 0;
} else {
_local3 = this.ease(_local2, 0, 1, this.duration);
};
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local4 = this.tweens[_local5];
_local4.target[_local4.property] = (_local4.start + (_local3 * _local4.change));
_local5--;
};
if (_hasUpdate){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local2 == this.duration){
complete(true);
};
}
public function activate():void{
this.started = (this.active = true);
if (!(this.initted)){
initTweenVals();
};
if (this.vars.onStart != null){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
if (this.duration == 0.001){
this.startTime = (this.startTime - 1);
};
}
public function initTweenVals():void{
var _local1:String;
var _local2:int;
var _local3:*;
var _local4:TweenInfo;
if (((!((this.exposedVars.timeScale == undefined))) && (this.target.hasOwnProperty("timeScale")))){
this.tweens[this.tweens.length] = new TweenInfo(this.target, "timeScale", this.target.timeScale, (this.exposedVars.timeScale - this.target.timeScale), "timeScale", false);
};
for (_local1 in this.exposedVars) {
if ((_local1 in _reservedProps)){
} else {
if ((_local1 in plugins)){
_local3 = new (plugins[_local1]);
if (_local3.onInitTween(this.target, this.exposedVars[_local1], this) == false){
this.tweens[this.tweens.length] = new TweenInfo(this.target, _local1, this.target[_local1], ((typeof(this.exposedVars[_local1]))=="number") ? (this.exposedVars[_local1] - this.target[_local1]) : Number(this.exposedVars[_local1]), _local1, false);
} else {
this.tweens[this.tweens.length] = new TweenInfo(_local3, "changeFactor", 0, 1, ((_local3.overwriteProps.length)==1) ? _local3.overwriteProps[0] : "_MULTIPLE_", true);
_hasPlugins = true;
};
} else {
this.tweens[this.tweens.length] = new TweenInfo(this.target, _local1, this.target[_local1], ((typeof(this.exposedVars[_local1]))=="number") ? (this.exposedVars[_local1] - this.target[_local1]) : Number(this.exposedVars[_local1]), _local1, false);
};
};
};
if (this.vars.runBackwards == true){
_local2 = (this.tweens.length - 1);
while (_local2 > -1) {
_local4 = this.tweens[_local2];
_local4.start = (_local4.start + _local4.change);
_local4.change = -(_local4.change);
_local2--;
};
};
if (this.vars.onUpdate != null){
_hasUpdate = true;
};
if (((TweenLite.overwriteManager.enabled) && ((this.target in masterList)))){
overwriteManager.manageOverwrites(this, masterList[this.target]);
};
this.initted = true;
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams)));
}
public function killVars(_arg1:Object):void{
if (overwriteManager.enabled){
overwriteManager.killVars(_arg1, this.exposedVars, this.tweens);
};
}
public function complete(_arg1:Boolean=false):void{
var _local2:int;
if (!(_arg1)){
if (!(this.initted)){
initTweenVals();
};
this.startTime = (currentTime - ((this.duration * 1000) / this.combinedTimeScale));
render(currentTime);
return;
};
if (_hasPlugins){
_local2 = (this.tweens.length - 1);
while (_local2 > -1) {
if (((this.tweens[_local2].isPlugin) && (!((this.tweens[_local2].target.onComplete == null))))){
this.tweens[_local2].target.onComplete();
};
_local2--;
};
};
if (this.vars.persist != true){
this.enabled = false;
};
if (this.vars.onComplete != null){
this.vars.onComplete.apply(null, this.vars.onCompleteParams);
};
}
public static function updateAll(_arg1:Event=null):void{
var _local4:Array;
var _local5:int;
var _local6:TweenLite;
var _local2:uint = (currentTime = getTimer());
var _local3:Dictionary = masterList;
for each (_local4 in _local3) {
_local5 = (_local4.length - 1);
while (_local5 > -1) {
_local6 = _local4[_local5];
if (_local6.active){
_local6.render(_local2);
} else {
if (_local6.gc){
_local4.splice(_local5, 1);
} else {
if (_local2 >= _local6.startTime){
_local6.activate();
_local6.render(_local2);
};
};
};
_local5--;
};
};
}
public static function removeTween(_arg1:TweenLite, _arg2:Boolean=true):void{
if (_arg1 != null){
if (_arg2){
_arg1.clear();
};
_arg1.enabled = false;
};
}
public static function killTweensOf(_arg1:Object=null, _arg2:Boolean=false):void{
var _local3:Array;
var _local4:int;
var _local5:TweenLite;
if (((!((_arg1 == null))) && ((_arg1 in masterList)))){
_local3 = masterList[_arg1];
_local4 = (_local3.length - 1);
while (_local4 > -1) {
_local5 = _local3[_local4];
if (((_arg2) && (!(_local5.gc)))){
_local5.complete(false);
};
_local5.clear();
_local4--;
};
delete masterList[_arg1];
};
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
_arg3.runBackwards = true;
return (new TweenLite(_arg1, _arg2, _arg3));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
protected static function killGarbage(_arg1:TimerEvent):void{
var _local3:Object;
var _local2:Dictionary = masterList;
for (_local3 in _local2) {
if (_local2[_local3].length == 0){
delete _local2[_local3];
};
};
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null):TweenLite{
return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, overwrite:0}));
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
return (new TweenLite(_arg1, _arg2, _arg3));
}
}
}//package gs
Section 140
//TweenMax (gs.TweenMax)
package gs {
import flash.events.*;
import flash.utils.*;
import gs.plugins.*;
import gs.utils.tween.*;
import gs.events.*;
public class TweenMax extends TweenLite implements IEventDispatcher {
protected var _dispatcher:EventDispatcher;
protected var _callbacks:Object;
public var pauseTime:Number;
protected var _repeatCount:Number;
protected var _timeScale:Number;
public static const version:Number = 10.12;
public static var removeTween:Function = TweenLite.removeTween;
private static var _overwriteMode:int = (OverwriteManager.enabled) ? OverwriteManager.mode : OverwriteManager.init();
;
protected static var _pausedTweens:Dictionary = new Dictionary(false);
protected static var _globalTimeScale:Number = 1;
public static var killTweensOf:Function = TweenLite.killTweensOf;
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
private static var _activatedPlugins:Boolean = TweenPlugin.activate([TintPlugin, RemoveTintPlugin, FramePlugin, AutoAlphaPlugin, VisiblePlugin, VolumePlugin, EndArrayPlugin, HexColorsPlugin, BlurFilterPlugin, ColorMatrixFilterPlugin, BevelFilterPlugin, DropShadowFilterPlugin, GlowFilterPlugin, RoundPropsPlugin, BezierPlugin, BezierThroughPlugin, ShortRotationPlugin]);
public function TweenMax(_arg1:Object, _arg2:Number, _arg3:Object){
super(_arg1, _arg2, _arg3);
if (TweenLite.version < 10.092){
trace("TweenMax error! Please update your TweenLite class or try deleting your ASO files. TweenMax requires a more recent version. Download updates at http://www.TweenMax.com.");
};
if (((!((this.combinedTimeScale == 1))) && ((this.target is TweenMax)))){
_timeScale = 1;
this.combinedTimeScale = _globalTimeScale;
} else {
_timeScale = this.combinedTimeScale;
this.combinedTimeScale = (this.combinedTimeScale * _globalTimeScale);
};
if (((!((this.combinedTimeScale == 1))) && (!((this.delay == 0))))){
this.startTime = (this.initTime + (this.delay * (1000 / this.combinedTimeScale)));
};
if (((((!((this.vars.onCompleteListener == null))) || (!((this.vars.onUpdateListener == null))))) || (!((this.vars.onStartListener == null))))){
initDispatcher();
if ((((_arg2 == 0)) && ((this.delay == 0)))){
onUpdateDispatcher();
onCompleteDispatcher();
};
};
_repeatCount = 0;
if (((!(isNaN(this.vars.yoyo))) || (!(isNaN(this.vars.loop))))){
this.vars.persist = true;
};
if ((((this.delay == 0)) && (!((this.vars.startAt == null))))){
this.vars.startAt.overwrite = 0;
new TweenMax(this.target, 0, this.vars.startAt);
};
}
public function dispatchEvent(_arg1:Event):Boolean{
if (_dispatcher == null){
return (false);
};
return (_dispatcher.dispatchEvent(_arg1));
}
public function get reversed():Boolean{
return ((this.ease == reverseEase));
}
public function set reversed(_arg1:Boolean):void{
if (this.reversed != _arg1){
reverse();
};
}
public function get progress():Number{
var _local1:Number = (!(isNaN(this.pauseTime))) ? this.pauseTime : currentTime;
var _local2:Number = (((((_local1 - this.initTime) * 0.001) - (this.delay / this.combinedTimeScale)) / this.duration) * this.combinedTimeScale);
if (_local2 > 1){
return (1);
};
if (_local2 < 0){
return (0);
};
return (_local2);
}
override public function set enabled(_arg1:Boolean):void{
if (!(_arg1)){
_pausedTweens[this] = null;
delete _pausedTweens[this];
};
super.enabled = _arg1;
if (_arg1){
this.combinedTimeScale = (_timeScale * _globalTimeScale);
};
}
protected function onStartDispatcher(... _args):void{
if (_callbacks.onStart != null){
_callbacks.onStart.apply(null, this.vars.onStartParams);
};
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.START));
}
public function setDestination(_arg1:String, _arg2, _arg3:Boolean=true):void{
var _local5:int;
var _local6:TweenInfo;
var _local7:Object;
var _local8:Object;
var _local9:Array;
var _local10:Boolean;
var _local11:Array;
var _local12:Object;
var _local4:Number = this.progress;
if (this.initted){
if (!(_arg3)){
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local6 = this.tweens[_local5];
if (_local6.name == _arg1){
_local6.target[_local6.property] = _local6.start;
};
_local5--;
};
};
_local7 = this.vars;
_local8 = this.exposedVars;
_local9 = this.tweens;
_local10 = _hasPlugins;
this.tweens = [];
this.vars = (this.exposedVars = {});
this.vars[_arg1] = _arg2;
initTweenVals();
if (((!((this.ease == reverseEase))) && ((_local7.ease is Function)))){
this.ease = _local7.ease;
};
if (((_arg3) && (!((_local4 == 0))))){
adjustStartValues();
};
_local11 = this.tweens;
this.vars = _local7;
this.exposedVars = _local8;
this.tweens = _local9;
_local12 = {};
_local12[_arg1] = true;
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local6 = this.tweens[_local5];
if (_local6.name == _arg1){
this.tweens.splice(_local5, 1);
} else {
if (((_local6.isPlugin) && ((_local6.name == "_MULTIPLE_")))){
_local6.target.killProps(_local12);
if (_local6.target.overwriteProps.length == 0){
this.tweens.splice(_local5, 1);
};
};
};
_local5--;
};
this.tweens = this.tweens.concat(_local11);
_hasPlugins = Boolean(((_local10) || (_hasPlugins)));
};
this.vars[_arg1] = (this.exposedVars[_arg1] = _arg2);
}
override public function initTweenVals():void{
var _local1:int;
var _local2:int;
var _local3:String;
var _local4:String;
var _local5:Array;
var _local6:Object;
var _local7:TweenInfo;
if (((!((this.vars.startAt == null))) && (!((this.delay == 0))))){
this.vars.startAt.overwrite = 0;
new TweenMax(this.target, 0, this.vars.startAt);
};
super.initTweenVals();
if ((((this.exposedVars.roundProps is Array)) && (!((TweenLite.plugins.roundProps == null))))){
_local5 = this.exposedVars.roundProps;
_local1 = (_local5.length - 1);
while (_local1 > -1) {
_local3 = _local5[_local1];
_local2 = (this.tweens.length - 1);
while (_local2 > -1) {
_local7 = this.tweens[_local2];
if (_local7.name == _local3){
if (_local7.isPlugin){
_local7.target.round = true;
} else {
if (_local6 == null){
_local6 = new TweenLite.plugins.roundProps();
_local6.add(_local7.target, _local3, _local7.start, _local7.change);
_hasPlugins = true;
this.tweens[_local2] = new TweenInfo(_local6, "changeFactor", 0, 1, _local3, true);
} else {
_local6.add(_local7.target, _local3, _local7.start, _local7.change);
this.tweens.splice(_local2, 1);
};
};
} else {
if (((((_local7.isPlugin) && ((_local7.name == "_MULTIPLE_")))) && (!(_local7.target.round)))){
_local4 = ((" " + _local7.target.overwriteProps.join(" ")) + " ");
if (_local4.indexOf(((" " + _local3) + " ")) != -1){
_local7.target.round = true;
};
};
};
_local2--;
};
_local1--;
};
};
}
public function restart(_arg1:Boolean=false):void{
if (_arg1){
this.initTime = currentTime;
this.startTime = (currentTime + (this.delay * (1000 / this.combinedTimeScale)));
} else {
this.startTime = currentTime;
this.initTime = (currentTime - (this.delay * (1000 / this.combinedTimeScale)));
};
_repeatCount = 0;
if (this.target != this.vars.onComplete){
render(this.startTime);
};
this.pauseTime = NaN;
_pausedTweens[this] = null;
delete _pausedTweens[this];
this.enabled = true;
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
if (_dispatcher != null){
_dispatcher.removeEventListener(_arg1, _arg2, _arg3);
};
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
if (_dispatcher == null){
initDispatcher();
};
if ((((_arg1 == TweenEvent.UPDATE)) && (!((this.vars.onUpdate == onUpdateDispatcher))))){
this.vars.onUpdate = onUpdateDispatcher;
_hasUpdate = true;
};
_dispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
protected function adjustStartValues():void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:TweenInfo;
var _local6:int;
var _local1:Number = this.progress;
if (_local1 != 0){
_local2 = this.ease(_local1, 0, 1, 1);
_local3 = (1 / (1 - _local2));
_local6 = (this.tweens.length - 1);
while (_local6 > -1) {
_local5 = this.tweens[_local6];
_local4 = (_local5.start + _local5.change);
if (_local5.isPlugin){
_local5.change = ((_local4 - _local2) * _local3);
} else {
_local5.change = ((_local4 - _local5.target[_local5.property]) * _local3);
};
_local5.start = (_local4 - _local5.change);
_local6--;
};
};
}
override public function render(_arg1:uint):void{
var _local3:Number;
var _local4:TweenInfo;
var _local5:int;
var _local2:Number = (((_arg1 - this.startTime) * 0.001) * this.combinedTimeScale);
if (_local2 >= this.duration){
_local2 = this.duration;
_local3 = ((((this.ease == this.vars.ease)) || ((this.duration == 0.001)))) ? 1 : 0;
} else {
_local3 = this.ease(_local2, 0, 1, this.duration);
};
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local4 = this.tweens[_local5];
_local4.target[_local4.property] = (_local4.start + (_local3 * _local4.change));
_local5--;
};
if (_hasUpdate){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local2 == this.duration){
complete(true);
};
}
protected function initDispatcher():void{
var _local1:Object;
var _local2:String;
if (_dispatcher == null){
_dispatcher = new EventDispatcher(this);
_callbacks = {onStart:this.vars.onStart, onUpdate:this.vars.onUpdate, onComplete:this.vars.onComplete};
if (this.vars.isTV == true){
this.vars = this.vars.clone();
} else {
_local1 = {};
for (_local2 in this.vars) {
_local1[_local2] = this.vars[_local2];
};
this.vars = _local1;
};
this.vars.onStart = onStartDispatcher;
this.vars.onComplete = onCompleteDispatcher;
if ((this.vars.onStartListener is Function)){
_dispatcher.addEventListener(TweenEvent.START, this.vars.onStartListener, false, 0, true);
};
if ((this.vars.onUpdateListener is Function)){
_dispatcher.addEventListener(TweenEvent.UPDATE, this.vars.onUpdateListener, false, 0, true);
this.vars.onUpdate = onUpdateDispatcher;
_hasUpdate = true;
};
if ((this.vars.onCompleteListener is Function)){
_dispatcher.addEventListener(TweenEvent.COMPLETE, this.vars.onCompleteListener, false, 0, true);
};
};
}
public function willTrigger(_arg1:String):Boolean{
if (_dispatcher == null){
return (false);
};
return (_dispatcher.willTrigger(_arg1));
}
public function get repeatCount():Number{
return (_repeatCount);
}
public function reverse(_arg1:Boolean=true, _arg2:Boolean=true):void{
this.ease = ((this.vars.ease)==this.ease) ? reverseEase : this.vars.ease;
var _local3:Number = this.progress;
if (((_arg1) && ((_local3 > 0)))){
this.startTime = (currentTime - ((((1 - _local3) * this.duration) * 1000) / this.combinedTimeScale));
this.initTime = (this.startTime - (this.delay * (1000 / this.combinedTimeScale)));
};
if (_arg2 != false){
if (_local3 < 1){
resume();
} else {
restart();
};
};
}
protected function onUpdateDispatcher(... _args):void{
if (_callbacks.onUpdate != null){
_callbacks.onUpdate.apply(null, this.vars.onUpdateParams);
};
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.UPDATE));
}
public function set paused(_arg1:Boolean):void{
if (_arg1){
pause();
} else {
resume();
};
}
public function resume():void{
this.enabled = true;
if (!(isNaN(this.pauseTime))){
this.initTime = (this.initTime + (currentTime - this.pauseTime));
this.startTime = (this.initTime + (this.delay * (1000 / this.combinedTimeScale)));
this.pauseTime = NaN;
if (((!(this.started)) && ((currentTime >= this.startTime)))){
activate();
} else {
this.active = this.started;
};
_pausedTweens[this] = null;
delete _pausedTweens[this];
};
}
public function get paused():Boolean{
return (!(isNaN(this.pauseTime)));
}
public function set repeatCount(_arg1:Number):void{
_repeatCount = _arg1;
}
public function reverseEase(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.ease((_arg4 - _arg1), _arg2, _arg3, _arg4));
}
public function killProperties(_arg1:Array):void{
var _local3:int;
var _local2:Object = {};
_local3 = (_arg1.length - 1);
while (_local3 > -1) {
_local2[_arg1[_local3]] = true;
_local3--;
};
killVars(_local2);
}
public function set progress(_arg1:Number):void{
this.startTime = (currentTime - ((this.duration * _arg1) * 1000));
this.initTime = (this.startTime - (this.delay * (1000 / this.combinedTimeScale)));
if (!(this.started)){
activate();
};
render(currentTime);
if (!(isNaN(this.pauseTime))){
this.pauseTime = currentTime;
this.startTime = 999999999999999;
this.active = false;
};
}
public function hasEventListener(_arg1:String):Boolean{
if (_dispatcher == null){
return (false);
};
return (_dispatcher.hasEventListener(_arg1));
}
public function pause():void{
if (isNaN(this.pauseTime)){
this.pauseTime = currentTime;
this.startTime = 999999999999999;
this.enabled = false;
_pausedTweens[this] = this;
};
}
override public function complete(_arg1:Boolean=false):void{
if (((((!(isNaN(this.vars.yoyo))) && ((((_repeatCount < this.vars.yoyo)) || ((this.vars.yoyo == 0)))))) || (((!(isNaN(this.vars.loop))) && ((((_repeatCount < this.vars.loop)) || ((this.vars.loop == 0)))))))){
_repeatCount++;
if (!(isNaN(this.vars.yoyo))){
this.ease = ((this.vars.ease)==this.ease) ? reverseEase : this.vars.ease;
};
this.startTime = (_arg1) ? (this.startTime + (this.duration * (1000 / this.combinedTimeScale))) : currentTime;
this.initTime = (this.startTime - (this.delay * (1000 / this.combinedTimeScale)));
} else {
if (this.vars.persist == true){
pause();
};
};
super.complete(_arg1);
}
public function set timeScale(_arg1:Number):void{
if (_arg1 < 1E-5){
_arg1 = (_timeScale = 1E-5);
} else {
_timeScale = _arg1;
_arg1 = (_arg1 * _globalTimeScale);
};
this.initTime = ((currentTime - ((((currentTime - this.initTime) - (this.delay * (1000 / this.combinedTimeScale))) * this.combinedTimeScale) * (1 / _arg1))) - (this.delay * (1000 / _arg1)));
if (this.startTime != 999999999999999){
this.startTime = (this.initTime + (this.delay * (1000 / _arg1)));
};
this.combinedTimeScale = _arg1;
}
public function invalidate(_arg1:Boolean=true):void{
var _local2:Number;
if (this.initted){
_local2 = this.progress;
if (((!(_arg1)) && (!((_local2 == 0))))){
this.progress = 0;
};
this.tweens = [];
_hasPlugins = false;
this.exposedVars = ((this.vars.isTV)==true) ? this.vars.exposedProps : this.vars;
initTweenVals();
_timeScale = ((this.vars.timeScale) || (1));
this.combinedTimeScale = (_timeScale * _globalTimeScale);
this.delay = ((this.vars.delay) || (0));
if (isNaN(this.pauseTime)){
this.startTime = (this.initTime + ((this.delay * 1000) / this.combinedTimeScale));
};
if (((((!((this.vars.onCompleteListener == null))) || (!((this.vars.onUpdateListener == null))))) || (!((this.vars.onStartListener == null))))){
if (_dispatcher != null){
this.vars.onStart = _callbacks.onStart;
this.vars.onUpdate = _callbacks.onUpdate;
this.vars.onComplete = _callbacks.onComplete;
_dispatcher = null;
};
initDispatcher();
};
if (_local2 != 0){
if (_arg1){
adjustStartValues();
} else {
this.progress = _local2;
};
};
};
}
public function get timeScale():Number{
return (_timeScale);
}
protected function onCompleteDispatcher(... _args):void{
if (_callbacks.onComplete != null){
_callbacks.onComplete.apply(null, this.vars.onCompleteParams);
};
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
}
public static function set globalTimeScale(_arg1:Number):void{
setGlobalTimeScale(_arg1);
}
public static function pauseAll(_arg1:Boolean=true, _arg2:Boolean=false):void{
changePause(true, _arg1, _arg2);
}
public static function killAllDelayedCalls(_arg1:Boolean=false):void{
killAll(_arg1, false, true);
}
public static function setGlobalTimeScale(_arg1:Number):void{
var _local3:int;
var _local4:Array;
if (_arg1 < 1E-5){
_arg1 = 1E-5;
};
var _local2:Dictionary = masterList;
_globalTimeScale = _arg1;
for each (_local4 in _local2) {
_local3 = (_local4.length - 1);
while (_local3 > -1) {
if ((_local4[_local3] is TweenMax)){
_local4[_local3].timeScale = (_local4[_local3].timeScale * 1);
};
_local3--;
};
};
}
public static function get globalTimeScale():Number{
return (_globalTimeScale);
}
public static function getTweensOf(_arg1:Object):Array{
var _local4:TweenLite;
var _local5:int;
var _local2:Array = masterList[_arg1];
var _local3:Array = [];
if (_local2 != null){
_local5 = (_local2.length - 1);
while (_local5 > -1) {
if (!(_local2[_local5].gc)){
_local3[_local3.length] = _local2[_local5];
};
_local5--;
};
};
for each (_local4 in _pausedTweens) {
if (_local4.target == _arg1){
_local3[_local3.length] = _local4;
};
};
return (_local3);
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null, _arg4:Boolean=false):TweenMax{
return (new TweenMax(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, persist:_arg4, overwrite:0}));
}
public static function isTweening(_arg1:Object):Boolean{
var _local2:Array = getTweensOf(_arg1);
var _local3:int = (_local2.length - 1);
while (_local3 > -1) {
if (((((_local2[_local3].active) || ((_local2[_local3].startTime == currentTime)))) && (!(_local2[_local3].gc)))){
return (true);
};
_local3--;
};
return (false);
}
public static function changePause(_arg1:Boolean, _arg2:Boolean=true, _arg3:Boolean=false):void{
var _local5:Boolean;
var _local4:Array = getAllTweens();
var _local6:int = (_local4.length - 1);
while (_local6 > -1) {
_local5 = (_local4[_local6].target == _local4[_local6].vars.onComplete);
if ((((_local4[_local6] is TweenMax)) && ((((_local5 == _arg3)) || (!((_local5 == _arg2))))))){
_local4[_local6].paused = _arg1;
};
_local6--;
};
}
public static function killAllTweens(_arg1:Boolean=false):void{
killAll(_arg1, true, false);
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenMax{
_arg3.runBackwards = true;
return (new TweenMax(_arg1, _arg2, _arg3));
}
public static function killAll(_arg1:Boolean=false, _arg2:Boolean=true, _arg3:Boolean=true):void{
var _local5:Boolean;
var _local6:int;
var _local4:Array = getAllTweens();
_local6 = (_local4.length - 1);
while (_local6 > -1) {
_local5 = (_local4[_local6].target == _local4[_local6].vars.onComplete);
if ((((_local5 == _arg3)) || (!((_local5 == _arg2))))){
if (_arg1){
_local4[_local6].complete(false);
_local4[_local6].clear();
} else {
TweenLite.removeTween(_local4[_local6], true);
};
};
_local6--;
};
}
public static function getAllTweens():Array{
var _local3:Array;
var _local4:int;
var _local5:TweenLite;
var _local1:Dictionary = masterList;
var _local2:Array = [];
for each (_local3 in _local1) {
_local4 = (_local3.length - 1);
while (_local4 > -1) {
if (!(_local3[_local4].gc)){
_local2[_local2.length] = _local3[_local4];
};
_local4--;
};
};
for each (_local5 in _pausedTweens) {
_local2[_local2.length] = _local5;
};
return (_local2);
}
public static function resumeAll(_arg1:Boolean=true, _arg2:Boolean=false):void{
changePause(false, _arg1, _arg2);
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenMax{
return (new TweenMax(_arg1, _arg2, _arg3));
}
}
}//package gs
Section 141
//GameBackground (models.GameBackground)
package models {
import flash.display.*;
import com.cheezeworld.math.*;
public class GameBackground {
public var topLeft:Vector2D;
private var _bitmapData:BitmapData;
public function GameBackground(_arg1:BitmapData){
_bitmapData = _arg1;
topLeft = new Vector2D();
}
public function dispose():void{
topLeft = null;
_bitmapData.dispose();
_bitmapData = null;
}
public function get bitmapData():BitmapData{
return (_bitmapData);
}
}
}//package models
Section 142
//GameCamera (models.GameCamera)
package models {
import com.cheezeworld.math.*;
import data.*;
import com.cheezeworld.utils.*;
import flash.events.*;
public class GameCamera extends EventDispatcher {
private const SCROLL_DISTANCE:Number = 100;
public var gameworld:GameWorld;
private var m_target:GameObject;
public var position:Vector2D;
public var bounds:AABBox;
public static const MOVE:String = "camera_move";
public static const TOP:String = "camera_on_top";
public static const BOTTOM:String = "camera_on_bottom";
public function GameCamera(_arg1:GameWorld){
var _local2:Vector2D = new Vector2D((Definitions.STAGE_WIDTH * 0.5), (Definitions.STAGE_HEIGHT * 0.5));
bounds = new AABBox(new Vector2D(), 0, 0);
bounds.Set(_local2, Definitions.STAGE_WIDTH, Definitions.STAGE_HEIGHT);
gameworld = _arg1;
position = bounds.center;
}
public function clearTarget():void{
m_target = null;
}
public function update():void{
updatePosition();
updateBounds();
Input.instance.onCameraMove();
}
private function updatePosition():void{
var _local1:Number;
var _local2:Number;
if ((position.y - bounds.halfHeight) < 0){
position.y = (position.y + (bounds.halfHeight - position.y));
dispatchEvent(new Event(GameCamera.TOP));
} else {
if ((position.y + bounds.halfHeight) > gameworld.bounds.height){
position.y = (position.y - ((position.y + bounds.halfHeight) - gameworld.bounds.height));
dispatchEvent(new Event(GameCamera.BOTTOM));
};
};
if (m_target != null){
_local1 = (m_target.position.x - position.x);
_local2 = (m_target.position.y - position.y);
if ((((((-(SCROLL_DISTANCE) > _local2)) && ((_local2 < 0)))) && (((position.y - bounds.halfHeight) > 0)))){
position.y = (position.y - (-(SCROLL_DISTANCE) - _local2));
};
if ((((((0 < _local2)) && ((_local2 > SCROLL_DISTANCE)))) && (((position.y + bounds.halfHeight) < gameworld.bounds.height)))){
position.y = (position.y + (_local2 - SCROLL_DISTANCE));
};
};
}
public function getTarget():GameObject{
return (m_target);
}
public function setTarget(_arg1:GameObject):void{
m_target = _arg1;
}
private function updateBounds():void{
bounds.center.x = position.x;
bounds.center.y = position.y;
bounds.left = (bounds.center.x - bounds.halfWidth);
bounds.right = (bounds.center.x + bounds.halfWidth);
bounds.top = (bounds.center.y - bounds.halfHeight);
bounds.bottom = (bounds.center.y + bounds.halfHeight);
bounds.topLeft.x = bounds.left;
bounds.topLeft.y = bounds.top;
bounds.bottomRight.x = bounds.right;
bounds.bottomRight.y = bounds.bottom;
bounds.topRight.x = bounds.right;
bounds.topRight.y = bounds.top;
bounds.bottomLeft.x = bounds.left;
bounds.bottomLeft.y = bounds.bottom;
}
public function dispose():void{
clearTarget();
}
}
}//package models
Section 143
//GameCollisions (models.GameCollisions)
package models {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.*;
public class GameCollisions extends b2ContactListener {
override public function Add(_arg1:b2ContactPoint):void{
var _local2:Object = _arg1.shape1.GetBody().GetUserData();
var _local3:Object = _arg1.shape2.GetBody().GetUserData();
if ((((_local2 is GameObject)) && ((_local3 is GameObject)))){
if ((_local2 is ICollider)){
ICollider(_local2).onEnterContact((_local3 as GameObject));
};
if ((_local3 is ICollider)){
ICollider(_local3).onEnterContact((_local2 as GameObject));
};
};
}
override public function Persist(_arg1:b2ContactPoint):void{
var _local2:Object = _arg1.shape1.GetBody().GetUserData();
var _local3:Object = _arg1.shape2.GetBody().GetUserData();
if ((((_local2 is GameObject)) && ((_local3 is GameObject)))){
if ((_local2 is ICollider)){
ICollider(_local2).onLoopContact((_local3 as GameObject));
};
if ((_local3 is ICollider)){
ICollider(_local3).onLoopContact((_local2 as GameObject));
};
};
}
override public function Result(_arg1:b2ContactResult):void{
var _local2:Object = _arg1.shape1.GetBody().GetUserData();
var _local3:Object = _arg1.shape2.GetBody().GetUserData();
if ((((_local2 is GameObject)) && ((_local3 is GameObject)))){
if ((_local2 is ICollider)){
ICollider(_local2).onSolveContact((_local3 as GameObject));
};
if ((_local3 is ICollider)){
ICollider(_local3).onSolveContact((_local2 as GameObject));
};
};
}
override public function Remove(_arg1:b2ContactPoint):void{
var _local2:Object = _arg1.shape1.GetBody().GetUserData();
var _local3:Object = _arg1.shape2.GetBody().GetUserData();
if ((((_local2 is GameObject)) && ((_local3 is GameObject)))){
if ((_local2 is ICollider)){
ICollider(_local2).onLeaveContact((_local3 as GameObject));
};
if ((_local3 is ICollider)){
ICollider(_local3).onLeaveContact((_local2 as GameObject));
};
};
}
}
}//package models
Section 144
//GameCutScene (models.GameCutScene)
package models {
import com.cheezeworld.screens.*;
import flash.display.*;
import flash.events.*;
public class GameCutScene extends EventDispatcher {
private var _removeAtEnd:Boolean;
private var _isGamePaused:Boolean;
private var _scene:MovieClip;
private var _frameModif:int;
public function GameCutScene(_arg1:MovieClip, _arg2:Boolean=true, _arg3:Boolean=true){
_scene = _arg1;
_isGamePaused = _arg2;
_removeAtEnd = _arg3;
if (_isGamePaused){
Root.togglePause();
};
}
public function start(_arg1:DisplayObjectContainer, _arg2:Number=0, _arg3:Number=0, _arg4:int=0):void{
_scene.x = _arg2;
_scene.y = _arg3;
_arg1.addChild(_scene);
_frameModif = _arg4;
_scene.addEventListener(Event.ENTER_FRAME, checkFrame);
}
private function sceneComplete(_arg1:Boolean=false):void{
_scene.removeEventListener(Event.ENTER_FRAME, checkFrame);
if (((_removeAtEnd) && (!(_arg1)))){
GameUtils.removeChild(_scene);
_scene = null;
};
if (!(_removeAtEnd)){
_scene.stop();
};
}
private function checkFrame(_arg1:Event):void{
if (_scene.currentFrame == (_scene.totalFrames - _frameModif)){
if (_isGamePaused){
Root.togglePause();
};
dispatchEvent(new Event(Event.COMPLETE));
};
if (_scene.currentFrame == _scene.totalFrames){
sceneComplete();
};
}
public function getScene():MovieClip{
return (_scene);
}
}
}//package models
Section 145
//GameObject (models.GameObject)
package models {
import Box2D.Dynamics.*;
import flash.display.*;
import flash.events.*;
import com.cheezeworld.math.*;
import data.*;
import com.cheezeworld.utils.*;
public class GameObject extends EventDispatcher {
public var doesRotMatchPhysics:Boolean;
private var _body:b2Body;
protected var $currentAnim:MovieClip;
public var name:String;
private var _bmpData:BitmapData;
public var radius:Number;
private var _mouseOver:Boolean;// = false
public var id:String;
private var _disposing:Boolean;// = false
public var position:Vector2D;
protected var $index:int;
private var _clip:MovieClip;
private var _loaded:Boolean;// = false
public var bounds:AABBox;
public var alwaysUpdate:Boolean;
protected var $parent:GameWorld;
private var animInit:Boolean;
public var layer:int;
public var mouseTrigger:int;
private var _rotation:Number;// = 0
public var listenAnim:Boolean;
public function GameObject(_arg1:GameObjectParams){
addEventListener(Event.COMPLETE, init);
layer = _arg1.layer;
name = _arg1.name;
setClip(_arg1.createClip());
setBitmapData(_arg1.getBitmapData());
bounds = _arg1.bounds;
if (((!(bounds.width)) || (!(bounds.height)))){
if (getClip() != null){
bounds.Set(new Vector2D(), getClip().width, getClip().height);
} else {
if (getBitmapData() != null){
bounds.Set(new Vector2D(), getBitmapData().rect.width, getBitmapData().rect.height);
};
};
};
var _local2:Vector2D = new Vector2D(bounds.halfWidth, bounds.halfHeight);
bounds.Set(_local2, bounds.width, bounds.height);
if (!(_arg1.radius)){
if (bounds.width < bounds.height){
radius = bounds.halfWidth;
} else {
radius = bounds.halfHeight;
};
} else {
radius = _arg1.radius;
};
mouseTrigger = _arg1.mouseTrigger;
position = bounds.center.copy();
doesRotMatchPhysics = _arg1.doesRotMatchPhysics;
if (getClip() != null){
getClip().cacheAsBitmap = true;
};
listenAnim = _arg1.listenAnim;
rotation = 0;
alwaysUpdate = _arg1.alwaysUpdate;
}
public function setPhysics(_arg1:b2Body):void{
_body = _arg1;
}
public function getAnim():String{
if (_clip == null){
return (String(""));
};
return (getClip().currentLabel);
}
public function isMouseOver():Boolean{
return (_mouseOver);
}
public function getPhysics():b2Body{
return (_body);
}
public function setAnim(_arg1:String):void{
if (_clip == null){
return;
};
if (getAnim() != _arg1){
_clip.gotoAndStop(_arg1);
$currentAnim = null;
};
}
protected function init(_arg1:Event=null):void{
removeEventListener(Event.COMPLETE, init);
update();
_loaded = true;
}
public function dispose():void{
_disposing = true;
if (willTrigger(Event.COMPLETE)){
removeEventListener(Event.COMPLETE, init);
};
if (_bmpData){
_bmpData.dispose();
_bmpData = null;
};
if (_clip){
GameUtils.removeChild(_clip);
_clip = null;
};
bounds = null;
position = null;
$parent = null;
$currentAnim = null;
dispatchEvent(new Event(Event.REMOVED));
}
public function get parent():GameWorld{
return ($parent);
}
public function set index(_arg1:int):void{
$index = _arg1;
}
public function isDisposable():Boolean{
return (_disposing);
}
private function handleInput():void{
var _local1:AABBox;
var _local2:Vector2D;
if (!(mouseTrigger)){
return;
};
if (mouseTrigger == Definitions.MOUSE_TRIGGER_BOUNDS){
_local1 = new AABBox(Input.instance.worldMousePos, Definitions.MOUSE_RADIUS, Definitions.MOUSE_RADIUS);
if (bounds.isOverlapping(_local1)){
_mouseOver = true;
} else {
_mouseOver = false;
};
} else {
if (mouseTrigger == Definitions.MOUSE_TRIGGER_RADIUS){
_local2 = position.subtractedBy($parent.camera.bounds.topLeft);
if (_local2.distanceTo(Input.instance.mousePos) <= radius){
_mouseOver = true;
} else {
_mouseOver = false;
};
};
};
}
public function CanBeUpdate():Boolean{
if (alwaysUpdate){
return (true);
};
if (((((_loaded) && (!(_disposing)))) && (isNotTooFar()))){
if (getClip() != null){
getClip().visible = true;
};
return (true);
//unresolved jump
};
if (getClip() != null){
getClip().visible = false;
};
return (false);
}
public function isOverlapping(_arg1:GameObject):Boolean{
var _local2:Number = position.distanceSqTo(_arg1.position);
var _local3:Number = (radius + _arg1.radius);
if (_local2 < (_local3 * _local3)){
return (true);
};
return (false);
}
private function handleAnimation():void{
if ((((getClip() == null)) || (!(listenAnim)))){
return;
};
if ($currentAnim == null){
$currentAnim = (getClip().getChildAt(0) as MovieClip);
animInit = true;
} else {
if (((($currentAnim.currentFrame == $currentAnim.totalFrames)) && (animInit))){
this.dispatchEvent(new Event(Event.COMPLETE));
animInit = false;
} else {
if (((($currentAnim.currentFrame == 1)) && (!(animInit)))){
animInit = true;
};
};
};
}
public function getClip():MovieClip{
return (_clip);
}
public function update():void{
updateBounds();
handleInput();
handleAnimation();
}
private function isNotTooFar():Boolean{
var _local1:Boolean = true;
var _local2:Vector2D = position.subtractedBy($parent.camera.position);
if (Math.abs(_local2.x) > ($parent.camera.bounds.halfWidth + bounds.halfWidth)){
_local1 = false;
};
if (Math.abs(_local2.y) > ($parent.camera.bounds.halfHeight + bounds.halfHeight)){
_local1 = false;
};
return (_local1);
}
public function isLoaded():Boolean{
return (_loaded);
}
public function set parent(_arg1:GameWorld):void{
$parent = _arg1;
}
public function get index():int{
return ($index);
}
public function setClip(_arg1:MovieClip):void{
_clip = _arg1;
}
private function updateBounds():void{
bounds.center.x = position.x;
bounds.center.y = position.y;
bounds.left = (bounds.center.x - bounds.halfWidth);
bounds.right = (bounds.center.x + bounds.halfWidth);
bounds.top = (bounds.center.y - bounds.halfHeight);
bounds.bottom = (bounds.center.y + bounds.halfHeight);
bounds.topLeft.x = bounds.left;
bounds.topLeft.y = bounds.top;
bounds.bottomRight.x = bounds.right;
bounds.bottomRight.y = bounds.bottom;
bounds.topRight.x = bounds.right;
bounds.topRight.y = bounds.top;
bounds.bottomLeft.x = bounds.left;
bounds.bottomLeft.y = bounds.bottom;
}
override public function toString():String{
return (String(((((((((((("[" + $index) + "] ") + "'") + name) + "'") + " - ") + position) + " (") + radius) + ") ") + bounds)));
}
public function getBitmapData():BitmapData{
return (_bmpData);
}
public function setBitmapData(_arg1:BitmapData):void{
_bmpData = _arg1;
}
public function set rotation(_arg1:Number):void{
_rotation = _arg1;
if (_clip != null){
_clip.rotation = _arg1;
};
}
public function get rotation():Number{
return (_rotation);
}
}
}//package models
Section 146
//GameObjectParams (models.GameObjectParams)
package models {
import com.cheezeworld.math.*;
import flash.display.*;
public class GameObjectParams {
public var doesRotMatchPhysics:Boolean;
public var customClass:Class;
private var _clipClass:Class;
public var name:String;
private var _bmpData:BitmapData;
public var layer:int;
public var mouseTrigger:int;
public var radius:Number;
public var position:Vector2D;
private var _phys:PhysicsParams;
public var bounds:AABBox;
public var listenAnim:Boolean;
public var alwaysUpdate:Boolean;
public function GameObjectParams(){
name = "";
layer = 0;
bounds = new AABBox(new Vector2D(), 0, 0);
position = new Vector2D();
mouseTrigger = 0;
doesRotMatchPhysics = false;
radius = 0;
listenAnim = false;
alwaysUpdate = false;
}
public function clone():GameObjectParams{
var _local1:GameObjectParams = new GameObjectParams();
_local1.name = name;
_local1.layer = layer;
_local1.bounds = bounds;
_local1.position = position;
_local1.customClass = customClass;
_local1.doesRotMatchPhysics = doesRotMatchPhysics;
_local1.mouseTrigger = mouseTrigger;
return (_local1);
}
public function setPhysicsParams(_arg1:PhysicsParams):void{
_phys = _arg1;
}
public function createClip():MovieClip{
if (_clipClass == null){
return (null);
};
return (new _clipClass());
}
public function getBitmapData():BitmapData{
if (_bmpData == null){
return (null);
};
return (_bmpData.clone());
}
public function setClip(_arg1:Class):void{
_clipClass = _arg1;
}
public function setBitmapData(_arg1:BitmapData):void{
_bmpData = _arg1;
}
public function getPhysicsParams():PhysicsParams{
return (_phys);
}
}
}//package models
Section 147
//GamePhysics (models.GamePhysics)
package models {
import flash.utils.*;
import Box2D.Collision.*;
import data.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import flash.display.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Joints.*;
import com.cheezeworld.math.*;
public class GamePhysics {
private var m_bodyMap:Dictionary;
public var world:b2World;
private var m_joints:Dictionary;
public static const TIMESTEP:Number = 0.0166666666666667;
public static const BOUNDS_MODIFIER:Number = 100;
public static const ITERATIONS:int = 1;
public static const PHYSCALE:Number = 30;
public function GamePhysics(_arg1:GameWorld, _arg2:Boolean=true, _arg3:Sprite=null){
m_bodyMap = new Dictionary();
m_joints = new Dictionary();
var _local4:b2AABB = new b2AABB();
_local4.lowerBound.Set(-(BOUNDS_MODIFIER), -(BOUNDS_MODIFIER));
_local4.upperBound.Set((_arg1.bounds.width + BOUNDS_MODIFIER), (_arg1.bounds.height + BOUNDS_MODIFIER));
var _local5:b2Vec2 = GameUtils.Vector2D_to_b2Vec2(Definitions.GRAVITY);
var _local6:Boolean = _arg2;
world = new b2World(_local4, _local5, _local6);
world.SetContactListener(new GameCollisions());
drawDebug(_arg3);
}
private function getPolygonDef(_arg1:Number, _arg2:Number, _arg3:Number=1, _arg4:Number=1, _arg5:Number=0):b2PolygonDef{
var _local6:b2PolygonDef = new b2PolygonDef();
_local6.SetAsBox((_arg1 / PHYSCALE), (_arg2 / PHYSCALE));
_local6.density = _arg3;
_local6.friction = _arg4;
_local6.restitution = _arg5;
return (_local6);
}
public function wakeUpAllBodies():void{
var _local1:b2Body = world.GetBodyList();
while (_local1) {
_local1.WakeUp();
_local1 = _local1.GetNext();
};
}
public function removeBody(_arg1:String):void{
var _local2:b2Body = (m_bodyMap[_arg1] as b2Body);
if (_local2 == null){
return;
};
world.DestroyBody(_local2);
delete m_bodyMap[_arg1];
m_bodyMap[_arg1] = null;
}
public function createRevoluteJoint(_arg1:String, _arg2:b2Body, _arg3:b2Body, _arg4:Vector2D, _arg5:Boolean=false, _arg6:Number=0, _arg7:Number=0, _arg8:Boolean=false, _arg9:Number=0, _arg10:Number=0):void{
var _local11:b2RevoluteJointDef = new b2RevoluteJointDef();
_local11.Initialize(_arg2, _arg3, GameUtils.Vector2D_to_b2Vec2(_arg4));
_local11.lowerAngle = _arg6;
_local11.upperAngle = _arg7;
_local11.enableLimit = _arg5;
_local11.maxMotorTorque = _arg9;
_local11.motorSpeed = _arg10;
_local11.enableMotor = _arg8;
m_joints[_arg1] = world.CreateJoint(_local11);
}
public function update():void{
world.Step(TIMESTEP, ITERATIONS);
}
public function getRevoluteJoint(_arg1:String):b2RevoluteJoint{
return ((m_joints[_arg1] as b2RevoluteJoint));
}
private function drawDebug(_arg1:Sprite):void{
var _local2:b2DebugDraw = new b2DebugDraw();
var _local3:Sprite = new Sprite();
_arg1.addChild(_local3);
_local2.m_sprite = _local3;
_local2.m_drawScale = PHYSCALE;
_local2.m_alpha = 1;
_local2.m_fillAlpha = 0.5;
_local2.m_lineThickness = 1;
_local2.m_drawFlags = ((((((b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit) | b2DebugDraw.e_coreShapeBit) | b2DebugDraw.e_aabbBit) | b2DebugDraw.e_obbBit) | b2DebugDraw.e_pairBit) | b2DebugDraw.e_centerOfMassBit);
world.SetDebugDraw(_local2);
}
public function putToSleepAllBodies():void{
var _local1:b2Body = world.GetBodyList();
while (_local1) {
_local1.PutToSleep();
_local1 = _local1.GetNext();
};
}
private function getCircleDef(_arg1:Number, _arg2:Number=1, _arg3:Number=1, _arg4:Number=0):b2CircleDef{
var _local5:b2CircleDef = new b2CircleDef();
_local5.radius = (_arg1 / PHYSCALE);
_local5.density = _arg2;
_local5.friction = _arg3;
_local5.restitution = _arg4;
return (_local5);
}
public function deleteRevoluteJoint(_arg1:String):void{
world.DestroyJoint(m_joints[_arg1]);
delete m_joints[_arg1];
(m_joints[_arg1] == null);
}
public function createBody(_arg1:GameObject):void{
var _local2:PhysicsParams;
var _local5:b2ShapeDef;
var _local6:b2Body;
_local2 = Definitions.getObjectParams(_arg1.name).getPhysicsParams();
if (_local2 == null){
return;
};
var _local3:b2Vec2 = GameUtils.Vector2D_to_b2Vec2(_arg1.position);
var _local4:b2BodyDef = new b2BodyDef();
_local4.position.Set(_local3.x, _local3.y);
_local4.linearDamping = _local2.linearDamping;
_local4.angularDamping = _local2.angularDamping;
_local4.fixedRotation = _local2.fixedRotation;
_local4.isBullet = _local2.isBullet;
_local4.isSleeping = true;
_local6 = world.CreateBody(_local4);
if (_local2.type == PhysicsParams.SHAPE_TYPE_CIRCLE){
_local5 = getCircleDef(_local2.radius, _local2.density, _local2.friction, _local2.restitution);
} else {
if (_local2.type == PhysicsParams.SHAPE_TYPE_POLYGON){
_local5 = getPolygonDef((_local2.width * 0.5), (_local2.height * 0.5), _local2.density, _local2.friction, _local2.restitution);
};
};
_local5.isSensor = _local2.isSensor;
_local6.CreateShape(_local5);
_local6.SetMassFromShapes();
_local6.SetUserData(_arg1);
_arg1.setPhysics(_local6);
m_bodyMap[_arg1.id] = _local6;
_local6.PutToSleep();
}
public function dispose():void{
var _local1:b2Joint;
for each (_local1 in m_joints) {
world.DestroyJoint(_local1);
_local1 = null;
};
m_joints = null;
world = null;
m_bodyMap = null;
}
}
}//package models
Section 148
//GameUtils (models.GameUtils)
package models {
import flash.geom.*;
import com.cheezeworld.math.*;
import Box2D.Common.Math.*;
import flash.display.*;
import data.*;
public class GameUtils {
public static function Vector2Point(_arg1:Vector2D):Point{
var _local2:Point = new Point();
_local2.x = _arg1.x;
_local2.y = _arg1.y;
return (_local2);
}
public static function copyArray(_arg1:Array):Array{
var _local2:Array = [];
var _local3:int;
while (_local3 < _arg1.length) {
_local2.push(_arg1[_local3]);
_local3++;
};
return (_local2);
}
public static function Point2Vector(_arg1:Point):Vector2D{
var _local2:Vector2D = new Vector2D();
_local2.x = _arg1.x;
_local2.y = _arg1.y;
return (_local2);
}
public static function AABBox2Rectangle(_arg1:AABBox):Rectangle{
return (new Rectangle(0, 0, _arg1.width, _arg1.height));
}
public static function Vector2D_to_b2Vec2(_arg1:Vector2D):b2Vec2{
var _local2:b2Vec2;
_local2 = new b2Vec2();
_local2.x = (_arg1.x / GamePhysics.PHYSCALE);
_local2.y = (_arg1.y / GamePhysics.PHYSCALE);
return (_local2);
}
public static function frameToChrono(_arg1:Number, _arg2:String=":"):String{
var _local3:int = Definitions.FRAMERATE;
var _local4:int = Math.floor((_arg1 / _local3));
var _local5:int = Math.floor((((_arg1 / _local3) * 10) - (_local4 * 10)));
var _local6:int = Math.floor(((((_arg1 / _local3) * 100) - (_local4 * 100)) - (_local5 * 10)));
var _local7:int;
while (_local4 >= 60) {
_local4 = (_local4 - 60);
_local7++;
};
if (_local4 < 0){
_local4 = 0;
};
if (_local5 < 0){
_local5 = 0;
};
if (_local6 < 0){
_local6 = 0;
};
var _local8:String = "";
if (_local7 < 10){
_local8 = (_local8 + "0");
};
_local8 = (_local8 + (_local7 + _arg2));
if (_local4 < 10){
_local8 = (_local8 + "0");
};
_local8 = (_local8 + (((_local4 + _arg2) + _local5) + _local6));
return (_local8);
}
public static function Rectangle2AABBox(_arg1:Rectangle):AABBox{
return (new AABBox(new Vector2D((_arg1.width * 0.5), (_arg1.height * 0.5)), _arg1.width, _arg1.height));
}
public static function truncate(_arg1:Number, _arg2:uint):Number{
var _local3:String = String(_arg1.toString());
return (Number(_local3.substr(0, (_local3.length - _arg2))));
}
public static function b2Vec2_to_Vector2D(_arg1:b2Vec2):Vector2D{
var _local2:Vector2D = new Vector2D();
_local2.x = (_arg1.x * GamePhysics.PHYSCALE);
_local2.y = (_arg1.y * GamePhysics.PHYSCALE);
return (_local2);
}
public static function drawVec(_arg1:Vector2D, _arg2:Graphics, _arg3:uint=0xFF0000):void{
if (_arg2 != null){
_arg2.clear();
};
_arg2.lineStyle(2, _arg3);
_arg2.lineTo(_arg1.x, _arg1.y);
}
public static function getIntAt(_arg1:int, _arg2:int):int{
var _local3:String = String(_arg1.toString());
if (_arg2 >= _local3.length){
return (int(0));
};
return (int(_local3.substr(_arg2, 1)));
}
public static function RadAngleTo360(_arg1:Number):Number{
var _local2:Number;
_local2 = (_arg1 % (Math.PI * 2));
_local2 = (_local2 * MathUtils.RAD_TO_DEG);
return (Math.round(_local2));
}
public static function removeChild(_arg1:DisplayObject):void{
if (_arg1.parent == null){
return;
};
if (_arg1.parent.contains(_arg1)){
_arg1.parent.removeChild(_arg1);
};
}
public static function stringHasPrefix(_arg1:String, _arg2:String):Boolean{
if (_arg1.substr(0, _arg2.length) == _arg2){
return (true);
};
return (false);
}
public static function AngleToClipRotation(_arg1:Number):Number{
var _local2:Number;
_local2 = (_arg1 * MathUtils.RAD_TO_DEG);
return (_local2);
}
}
}//package models
Section 149
//GameWorld (models.GameWorld)
package models {
import com.cheezeworld.math.*;
import flash.display.*;
import data.*;
import com.cheezeworld.utils.*;
import com.cheezeworld.screens.*;
import flash.events.*;
import flash.geom.*;
public class GameWorld extends EventDispatcher {
private var _container:DisplayObjectContainer;
private var _bmpData:BitmapData;
private var _fxSprite:Sprite;
private var _loaded:Boolean;// = false
public var camera:GameCamera;
private var _trashbin:Array;
public var bounds:AABBox;
private var _backgrounds:Array;
public var physics:GamePhysics;
private var _bmp:Bitmap;
private var _b2Sprite:Sprite;
private var _objects:Array;
private var _layers:Array;
private var _bonusList:Array;
private var _uiSprite:Sprite;
public var screen:AScreen;
private var _disposable:Boolean;
public function GameWorld(_arg1:Number, _arg2:Number, _arg3:AScreen){
_bonusList = new Array();
super();
_objects = new Array();
_trashbin = new Array();
_backgrounds = new Array();
_layers = new Array();
screen = _arg3;
createRenderer();
createLayers();
bounds = new AABBox(new Vector2D((_arg1 * 0.5), (_arg2 * 0.5)), _arg1, _arg2);
camera = new GameCamera(this);
_fxSprite = new Sprite();
screen.addChild(_fxSprite);
_b2Sprite = new Sprite();
if (Definitions.DRAW_DEBUG == true){
screen.addChild(_b2Sprite);
};
_uiSprite = new Sprite();
screen.addChild(_uiSprite);
physics = new GamePhysics(this, true, _b2Sprite);
Input.instance.activateWorldMouse(this, _arg1, _arg2);
}
private function renderClip(_arg1:Vector2D, _arg2:MovieClip):void{
_arg2.x = (_arg1.x - camera.bounds.topLeft.x);
_arg2.y = (_arg1.y - camera.bounds.topLeft.y);
}
public function getLayer(_arg1:int):DisplayObjectContainer{
return (DisplayObjectContainer(_layers[_arg1]));
}
public function dispose():void{
var _local1:Sprite;
_disposable = true;
while (_layers.length) {
_local1 = (getLayer(0) as Sprite);
if (_container.contains(_local1)){
_container.removeChild(_local1);
};
_local1 = null;
_layers.splice(0, 1);
};
_objects.forEach(removeItem);
_backgrounds.forEach(removeItem);
_objects = null;
_backgrounds = null;
physics.dispose();
physics = null;
GameUtils.removeChild(_container);
GameUtils.removeChild(_b2Sprite);
_b2Sprite = null;
GameUtils.removeChild(_fxSprite);
_fxSprite = null;
GameUtils.removeChild(_uiSprite);
_uiSprite = null;
screen = null;
_bmpData.dispose();
_bmpData = null;
_bmp = null;
}
private function simulate(_arg1:GameObject):void{
_arg1.position = GameUtils.b2Vec2_to_Vector2D(_arg1.getPhysics().GetPosition());
if (_arg1.doesRotMatchPhysics == true){
_arg1.rotation = (_arg1.getPhysics().GetAngle() * MathUtils.RAD_TO_DEG);
};
}
private function removeItem(_arg1:Object, _arg2:int, _arg3:Array):void{
if ((_arg1 is GameObject)){
GameObject(_arg1).dispose();
} else {
if ((_arg1 is GameBackground)){
GameBackground(_arg1).dispose();
};
};
_arg3.splice(_arg2, 1);
}
public function getFXContainer():Sprite{
return (_fxSprite);
}
public function getUIContainer():Sprite{
return (_uiSprite);
}
public function update():void{
var _local2:GameObject;
var _local1:int;
if (_disposable){
return;
};
physics.update();
if (Definitions.DRAW_DEBUG == true){
_b2Sprite.x = (-(camera.position.x) + camera.bounds.halfWidth);
_b2Sprite.y = (-(camera.position.y) + camera.bounds.halfHeight);
};
_fxSprite.x = (-(camera.position.x) + camera.bounds.halfWidth);
_fxSprite.y = (-(camera.position.y) + camera.bounds.halfHeight);
camera.update();
_bmpData.fillRect(_bmpData.rect, 0);
_trashbin.forEach(removeItem);
_backgrounds.forEach(updateBackground);
_objects.forEach(updateObject);
}
public function createBackground(_arg1:String, _arg2:Vector2D):void{
var _local3:GameBackground = Definitions.getBackgrounds(_arg1);
_local3.topLeft.Set(_arg2.x, _arg2.y);
_backgrounds.push(_local3);
}
private function updateBackground(_arg1:Object, _arg2:int, _arg3:Array):void{
if (!((_arg1 is GameBackground))){
return;
};
renderBitmap(GameUtils.Vector2Point(GameBackground(_arg1).topLeft.subtractedBy(camera.bounds.topLeft)), GameBackground(_arg1).bitmapData);
}
public function createObject(_arg1:String, _arg2:Vector2D):GameObject{
var _local4:GameObject;
var _local3:GameObjectParams = Definitions.getObjectParams(_arg1);
if (_local3.customClass != null){
_local4 = (new _local3.customClass(_local3) as GameObject);
} else {
_local4 = new GameObject(_local3);
};
_local4.parent = this;
_local4.position.Set(_arg2.x, _arg2.y);
if (_local4.getClip() != null){
getLayer(_local4.layer).addChild(_local4.getClip());
};
physics.createBody(_local4);
_local4.dispatchEvent(new Event(Event.COMPLETE));
_local4.index = (_objects.push(_local4) - 1);
_local4.id = ((_local4.index + "-") + _local4.name);
if (GameUtils.stringHasPrefix(_local4.name, "Bonus")){
_bonusList.push(int(_local4.index));
};
return (_local4);
}
private function createLayers(_arg1:int=4):void{
var _local2:Sprite;
_container = new Sprite();
var _local3:int;
while (_local3 < _arg1) {
_local2 = new Sprite();
_container.addChild(_local2);
_layers.push(_local2);
_local3++;
};
screen.addChildAt(_container, 0);
screen.swapChildren(_container, _bmp);
}
private function createRenderer(_arg1:Number=500, _arg2:Number=440, _arg3:uint=0):void{
_bmpData = new BitmapData(_arg1, _arg2, false, _arg3);
_bmp = new Bitmap(_bmpData);
screen.addChild(_bmp);
}
public function removeObject(_arg1:GameObject):void{
_trashbin.push(_arg1);
_objects.splice(_objects.indexOf(_arg1), 1);
}
private function updateObject(_arg1:Object, _arg2:int, _arg3:Array):void{
if (!((_arg1 is GameObject))){
return;
};
if (!(GameObject(_arg1).CanBeUpdate())){
return;
};
GameObject(_arg1).update();
if (GameObject(_arg1).getPhysics() != null){
simulate((_arg1 as GameObject));
};
if (GameObject(_arg1).getBitmapData() != null){
renderBitmap(GameUtils.Vector2Point(GameObject(_arg1).bounds.topLeft.subtractedBy(camera.bounds.topLeft)), GameObject(_arg1).getBitmapData());
};
if (GameObject(_arg1).getClip() != null){
renderClip(GameObject(_arg1).position, GameObject(_arg1).getClip());
};
}
public function getBonus():Array{
return (_objects.filter(bonusFromObjects));
}
private function bonusFromObjects(_arg1:Object, _arg2:int, _arg3:Array):Boolean{
if ((_arg1 is Bonus)){
return (true);
};
return (false);
}
private function renderBitmap(_arg1:Point, _arg2:BitmapData):void{
_bmpData.copyPixels(_arg2, _arg2.rect, _arg1);
}
}
}//package models
Section 150
//ICollider (models.ICollider)
package models {
public interface ICollider {
function onSolveContact(_arg1:GameObject):void;
function onLeaveContact(_arg1:GameObject):void;
function onLoopContact(_arg1:GameObject):void;
function onEnterContact(_arg1:GameObject):void;
}
}//package models
Section 151
//PhysicsParams (models.PhysicsParams)
package models {
public class PhysicsParams {
public var angularDamping:Number;
public var friction:Number;
public var isSensor:Boolean;
public var width:Number;
public var type:int;
public var isBullet:Boolean;
public var fixedRotation:Boolean;
public var radius:Number;
public var linearDamping:Number;
public var height:Number;
public var density:Number;
public var restitution:Number;
public static const SHAPE_TYPE_POLYGON:int = 2;
public static const SHAPE_TYPE_CIRCLE:int = 1;
public function PhysicsParams(){
type = 0;
density = 0;
restitution = 0;
friction = 0;
linearDamping = 0;
angularDamping = 0;
isBullet = false;
fixedRotation = false;
radius = 0;
width = 0;
height = 0;
isSensor = false;
}
}
}//package models
Section 152
//GameOver (screens.GameOver)
package screens {
import data.*;
import gs.*;
import ui.*;
import flash.display.*;
import flash.events.*;
import com.cheezeworld.screens.*;
import com.cheezeworld.utils.*;
import gs.easing.*;
public class GameOver extends AScreen {
private var _started:Boolean;
private var _total:Number;
private var _retryHud:MC_RetryLevel;
private var _counterFans:UICompteur;
private var _currentCounter:int;// = 0
private var _counterStars:UICompteur;
private var _clip:SCREEN_GameOver;
public function GameOver(_arg1:IScreenItem){
super(_arg1);
SFX.instance.Intro();
_clip = new SCREEN_GameOver();
_clip.x = (Definitions.STAGE_WIDTH * 0.5);
_clip.y = (Definitions.STAGE_HEIGHT * 0.5);
addChild(_clip);
TweenMax.from(_clip, 1, {y:(Definitions.STAGE_HEIGHT + (Definitions.STAGE_HEIGHT * 0.5)), onComplete:init});
var _local2:int = GameStats.instance.getBonusScore();
var _local3:int = GameStats.instance.totalScore;
var _local4:int = (_local3 + _local2);
_total = _local4;
trace("stars:", _local2, "fans:", _local3, "total:", _local4);
_counterStars = new UICompteur(_local2);
_counterFans = new UICompteur(_local4, _local3);
var _local5:int;
var _local6:DisplayObject = _clip[("FANS_" + _local5)];
while (_local6 != null) {
_counterFans.addMC((_local6 as MovieClip));
_local5++;
_local6 = _clip[("FANS_" + _local5)];
};
_local5 = 0;
_local6 = _clip[("CHEESESTARS_" + _local5)];
while (_local6 != null) {
_counterStars.addMC((_local6 as MovieClip));
_local5++;
_local6 = _clip[("CHEESESTARS_" + _local5)];
};
UICompteur.inc_score = 66;
_clip.CERCLE.visible = false;
_clip.btnBACK.visible = false;
_clip.btnSUBMIT.visible = false;
_clip.CERCLE.stop();
_clip.btnBACK.addEventListener(MouseEvent.CLICK, onBack);
_clip.btnSUBMIT.addEventListener(MouseEvent.CLICK, onSubmit);
_clip.mcBack.scaleX = (_clip.mcBack.scaleY = 0);
_clip.mcSubmit.scaleX = (_clip.mcSubmit.scaleY = 0);
}
override public function update(_arg1:int):void{
super.update(_arg1);
if (!(_started)){
return;
};
if (!(_currentCounter)){
if (_counterStars.isFinished()){
_currentCounter++;
} else {
_counterStars.update();
};
} else {
if (_currentCounter == 1){
if (_counterFans.isFinished()){
showRetry();
_currentCounter++;
} else {
_counterFans.update();
};
};
};
if (((Input.instance.isMouseDown) || (Definitions.BUTTON_ACTION()))){
UICompteur.inc_score = 99;
} else {
UICompteur.inc_score = 66;
};
}
private function onFinish(_arg1:Event=null):void{
if (_retryHud != null){
_clip.removeChild(_retryHud);
_retryHud = null;
};
trace("FINISH");
_clip.CERCLE.visible = true;
_clip.btnBACK.visible = true;
_clip.btnSUBMIT.visible = true;
_clip.CERCLE.play();
TweenMax.to(_clip.mcBack, 0.5, {scaleX:1, scaleY:1, ease:Bounce.easeOut});
TweenMax.to(_clip.mcSubmit, 0.5, {scaleX:1, scaleY:1, ease:Bounce.easeOut});
}
private function stopListener():void{
_retryHud.btnYES.removeEventListener(MouseEvent.CLICK, clickOnYes);
_retryHud.btnNO.removeEventListener(MouseEvent.CLICK, clickOnNo);
_retryHud.btnYES.enabled = false;
_retryHud.btnNO.enabled = false;
}
private function onSubmit(_arg1:MouseEvent):void{
var _local2:bubblebox_submit_score = new bubblebox_submit_score();
_local2.alpha = 0;
_local2.x = ((Root.WIDTH * 0.5) - (_local2.width * 0.5));
_local2.y = ((Root.HEIGHT * 0.5) - (_local2.height * 0.5));
var _local3:MovieClip = new MC_BackgroundPause();
_local3.buttonMode = true;
_local3.alpha = 0;
this.addChild(_local3);
this.addChild(_local2);
TweenMax.to(_local3, 1, {alpha:0.7});
TweenMax.to(_local2, 1, {alpha:1});
_local2.setScore(_total, GameStats.GAME_ID);
_local3.addEventListener(MouseEvent.CLICK, onBack);
_clip.btnSUBMIT.removeEventListener(MouseEvent.CLICK, onSubmit);
_clip.btnSUBMIT.enabled = false;
TweenMax.to(_clip.mcSubmit, 0.5, {scaleX:0, scaleY:0, ease:Bounce.easeIn});
}
private function init():void{
_started = true;
}
private function clickOnYes(_arg1:MouseEvent):void{
stopListener();
SFX.instance.stopAll(0.5);
TweenMax.to(_retryHud, 0.5, {scaleX:0, scaleY:0, onComplete:retryLevel, ease:Bounce.easeIn});
}
private function onBack(_arg1:MouseEvent):void{
DisplayObject(_arg1.target).removeEventListener(MouseEvent.CLICK, onBack);
Tower.NB_STAIRS = Definitions.BASE_STAIRS;
GameStats.instance.clearStats();
Main.setScreen(Title);
}
private function clickOnNo(_arg1:MouseEvent):void{
stopListener();
TweenMax.to(_retryHud, 0.5, {scaleX:0, scaleY:0, onComplete:onFinish, ease:Bounce.easeIn});
}
private function showRetry(_arg1:Event=null):void{
_retryHud = new MC_RetryLevel();
_retryHud.x = -5;
_retryHud.y = 115;
_clip.addChild(_retryHud);
TweenMax.from(_retryHud, 0.5, {scaleX:0, scaleY:0, ease:Bounce.easeOut, onComplete:startListener});
}
private function startListener():void{
_retryHud.btnNO.addEventListener(MouseEvent.CLICK, clickOnNo);
_retryHud.btnYES.addEventListener(MouseEvent.CLICK, clickOnYes);
_retryHud.btnYES.enabled = true;
_retryHud.btnNO.enabled = true;
}
private function retryLevel():void{
_clip.removeChild(_retryHud);
_retryHud = null;
GameStats.instance.init();
GameStats.instance.loadTime();
Main.setScreen(Tower);
}
}
}//package screens
Section 153
//Title (screens.Title)
package screens {
import data.*;
import flash.events.*;
import com.cheezeworld.screens.*;
import ui.*;
import flash.display.*;
import models.*;
import flash.net.*;
public class Title extends AScreen {
private var nbStairs:int;
private var menu:SCREEN_Title;
public function Title(_arg1:IScreenItem){
super(_arg1);
SFX.instance.Intro();
menu = new SCREEN_Title();
menu.x = (Definitions.STAGE_WIDTH * 0.5);
menu.y = (Definitions.STAGE_HEIGHT * 0.5);
addChild(menu);
menu.btnPLAY.addEventListener(MouseEvent.CLICK, play);
menu.btnINSTRUCTION.addEventListener(MouseEvent.CLICK, help);
menu.btnHIGHSCORE.addEventListener(MouseEvent.CLICK, highscore);
}
private function help(_arg1:MouseEvent):void{
var _local2:UIInstructions = new UIInstructions(this, (_arg1.target as DisplayObjectContainer));
}
private function play(_arg1:MouseEvent):void{
menu.btnPLAY.removeEventListener(MouseEvent.CLICK, play);
menu.btnINSTRUCTION.removeEventListener(MouseEvent.CLICK, help);
menu.btnPLAY.enabled = false;
menu.btnINSTRUCTION.enabled = false;
menu.btnHIGHSCORE.enabled = false;
SFX.instance.stopAll(1);
this.mouseEnabled = false;
var _local2:GameCutScene = new GameCutScene(new FX_Close(), true, false);
var _local3:Number = (menu.SUPERMOUSE.x + menu.x);
var _local4:Number = (menu.SUPERMOUSE.y + menu.y);
_local2.start(this, _local3, _local4);
_local2.addEventListener(Event.COMPLETE, launch);
}
private function highscore(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest((("http://www.bubblebox.com/clickreg.php?type=gamestats&id=" + String(GameStats.GAME_ID)) + "&subid=scores&action=viewscores"));
navigateToURL(_local2, "_blank");
}
override public function update(_arg1:int):void{
super.update(_arg1);
}
private function launch(_arg1:Event=null):void{
GameStats.instance.clearStats();
setScreen(Tower);
}
}
}//package screens
Section 154
//Tower (screens.Tower)
package screens {
import gs.easing.*;
import data.*;
import com.cheezeworld.screens.*;
import com.cheezeworld.math.*;
import models.*;
import flash.text.*;
import flash.events.*;
import ui.*;
import gs.*;
import com.cheezeworld.utils.*;
import flash.utils.*;
public class Tower extends AScreen {
private const SCROLL_VECTOR:Vector2D;
private var _foule:MC_Foule;
private var _timeBar:UITimeBar;
private var _rideau:GameCutScene;
private var _scrollEnable:Boolean;// = false
private var _lastObject:GameObject;
private var _stairsLoader:StairsLoader;
private var _gameworld:GameWorld;
private var _pause:UIPause;
private var _endHud:UIEndOfLevel;
private var _avatarPos:UIAvatarPos;
public static var COMPLETE:Boolean = false;
public static var NB_STAIRS:int = 5;
public function Tower(_arg1:IScreenItem){
var endOfFade:*;
var a_parentScreen = _arg1;
SCROLL_VECTOR = new Vector2D(0, (NB_STAIRS * Definitions.SCROLLING_SPEED));
endOfFade = function ():void{
_foule.visible = true;
Root.togglePause();
};
super(a_parentScreen);
Tower.NB_STAIRS = (Definitions.BASE_STAIRS + (Definitions.NEW_STAIR * GameStats.instance.levelsComplete));
_gameworld = new GameWorld(Definitions.STAGE_WIDTH, (Definitions.STAGE_HEIGHT * NB_STAIRS), this);
GameOption.instance.resetQuality();
_stairsLoader = new StairsLoader(_gameworld);
_rideau = new GameCutScene(new MC_Rideau(), false);
TextField(MC_Rideau(_rideau.getScene()).DAY["TXT"]).text = ("DAY " + String((GameStats.instance.levelsComplete + 1)));
_rideau.addEventListener(Event.COMPLETE, init);
_rideau.start(_gameworld.getUIContainer(), 287, 203);
_rideau.getScene().stop();
_timeBar = new UITimeBar(_gameworld);
_timeBar.addEventListener(Event.COMPLETE, onGameOver);
_foule = new MC_Foule();
_foule.x = (253 + 25);
_foule.y = (Definitions.STAGE_HEIGHT - 60);
if (!(GameStats.instance.levelsComplete)){
_foule.visible = false;
};
addChildAt(_foule, (numChildren - 2));
SFX.instance.Foule();
if (GameStats.instance.levelsComplete == 0){
_gameworld.camera.position.Set((Definitions.STAGE_WIDTH * 0.5), (Definitions.STAGE_HEIGHT * 0.5));
Root.togglePause();
TweenMax.from(this, 1, {alpha:0, onComplete:endOfFade});
} else {
_gameworld.camera.position.Set((Definitions.STAGE_WIDTH * 0.5), (Definitions.STAGE_HEIGHT * NB_STAIRS));
};
GameStats.instance.resetChrono();
_timeBar.update();
}
override public function update(_arg1:int):void{
super.update(_arg1);
if (_stairsLoader != null){
if (_stairsLoader.isLoaded()){
_stairsLoader.dispose();
_stairsLoader = null;
_rideau.getScene().play();
SFX.instance.Applaude();
} else {
_stairsLoader.update();
return;
};
};
GameOption.instance.updateQuality();
_gameworld.update();
if ((((_gameworld.camera.getTarget() == null)) && (_scrollEnable))){
_gameworld.camera.position.addTo(new Vector2D(0, 10));
};
if (_foule != null){
_foule.y = ((((Definitions.STAGE_HEIGHT * NB_STAIRS) - _gameworld.camera.position.y) + _gameworld.camera.bounds.halfHeight) - 60);
if (_avatarPos == null){
_foule.y = (_foule.y + 10);
};
};
if ((((Avatar.state == Avatar.RUN)) || ((Avatar.state == Avatar.FLY)))){
GameStats.instance.increaseChrono();
};
if (_timeBar != null){
_timeBar.update();
};
if (_avatarPos != null){
_avatarPos.update();
};
if (_endHud != null){
_endHud.update();
};
if (Input.instance.isKeyPressed(KeyCode.ESC)){
if (_pause != null){
_pause.TogglePause();
};
};
}
private function init(_arg1:Event=null):void{
var EnableScroll:*;
var e = _arg1;
EnableScroll = function ():void{
_scrollEnable = true;
};
if (GameStats.instance.levelsComplete == 0){
setTimeout(EnableScroll, 2000);
_gameworld.camera.addEventListener(GameCamera.BOTTOM, endOfScroll);
} else {
endOfScroll();
};
}
private function avatarReachTheMoon(_arg1:Event=null):void{
_arg1.currentTarget.removeEventListener(Avatar.REACH_THE_MOON, avatarReachTheMoon);
_pause.dispose();
_pause = null;
}
private function endOfOutro(_arg1:Event=null):void{
this.removeEventListener(Event.COMPLETE, endOfOutro);
_timeBar.removeEventListener(Event.COMPLETE, onGameOver);
trace("END_OF_OUTRO");
SFX.instance.Inter();
GameStats.instance.levelsComplete++;
_endHud = new UIEndOfLevel(_gameworld);
_avatarPos.dispose();
_avatarPos = null;
}
private function endOfScene(_arg1:Event=null):void{
_avatarPos = new UIAvatarPos(_gameworld);
_pause = new UIPause(_gameworld);
_lastObject = _gameworld.createObject("Avatar", new Vector2D((253 + 30), ((Definitions.STAGE_HEIGHT * NB_STAIRS) - (220 - 50))));
_gameworld.camera.setTarget(_lastObject);
_lastObject.addEventListener(Avatar.REACH_THE_MOON, avatarReachTheMoon);
this.addEventListener(Event.COMPLETE, endOfOutro);
SFX.instance.Beat();
GameStats.instance.init();
}
private function endOfGameOver(_arg1:Event=null):void{
Root.togglePause();
_arg1.target.removeEventListener(Event.COMPLETE, endOfGameOver);
TweenMax.to(_avatarPos.getClip(), 1, {x:-(_timeBar.getClip().width), alpha:0});
TweenMax.to(_timeBar.getClip(), 1, {x:-(_timeBar.getClip().width), alpha:0, onComplete:gotoGameOver});
}
private function onGameOver(_arg1:Event=null):void{
_timeBar.removeEventListener(Event.COMPLETE, onGameOver);
SFX.instance.TimeOut();
_pause.dispose();
var _local2:GameCutScene = new GameCutScene(new FX_Close(), true, false);
_local2.addEventListener(Event.COMPLETE, endOfGameOver);
_local2.start(_gameworld.getLayer(3), (_lastObject.position.x - _gameworld.camera.bounds.topLeft.x), (_lastObject.position.y - _gameworld.camera.bounds.topLeft.y));
}
override public function dispose():void{
GameUtils.removeChild(_foule);
_foule = null;
_gameworld.removeObject(_lastObject);
_lastObject = null;
_gameworld.dispose();
_gameworld = null;
_timeBar.dispose();
_timeBar = null;
if (_endHud != null){
_endHud.dispose();
_endHud = null;
};
if (_stairsLoader != null){
_stairsLoader.dispose();
_stairsLoader = null;
};
super.dispose();
}
private function gotoGameOver():void{
Root.togglePause();
Main.setScreen(GameOver);
}
private function endOfScroll(_arg1:Event=null):void{
if (_gameworld.camera.willTrigger(GameCamera.BOTTOM)){
_gameworld.camera.removeEventListener(GameCamera.BOTTOM, endOfScroll);
};
_gameworld.camera.position = new Vector2D((Definitions.STAGE_WIDTH * 0.5), ((Definitions.STAGE_HEIGHT * NB_STAIRS) - (Definitions.STAGE_HEIGHT * 0.5)));
var _local2:GameCutScene = new GameCutScene(new SCENE_Starting());
_local2.addEventListener(Event.COMPLETE, endOfScene);
_local2.start(_gameworld.getLayer(0), 253, 220, 1);
}
}
}//package screens
Section 155
//UIAvatarPos (ui.UIAvatarPos)
package ui {
import com.cheezeworld.math.*;
import gs.*;
import models.*;
import data.*;
import flash.display.*;
public class UIAvatarPos {
private const MIN:Vector2D;
private var _clip:MovieClip;
public function UIAvatarPos(_arg1:GameWorld){
MIN = new Vector2D(30, 383);
super();
_clip = new UI_AvatarPos();
_clip.cacheAsBitmap = true;
_clip.x = MIN.x;
_clip.y = MIN.y;
_clip.stop();
_arg1.getUIContainer().addChild(_clip);
TweenMax.from(_clip, 1, {x:-(_clip.width), alpha:0});
}
public function update():void{
if (Avatar.state == Avatar.IDLE){
return;
};
var _local1:int = Math.round((GameStats.instance.getAvatarProgression() * _clip.totalFrames));
_clip.gotoAndStop(_local1);
}
public function getClip():MovieClip{
return (_clip);
}
private function onQuit():void{
GameUtils.removeChild(_clip);
_clip = null;
}
public function dispose():void{
TweenMax.to(_clip, 1, {x:-(_clip.width), alpha:0, onComplete:onQuit});
}
}
}//package ui
Section 156
//UIBulle (ui.UIBulle)
package ui {
import gs.easing.*;
import flash.display.*;
import flash.events.*;
import data.*;
public class UIBulle extends ButtonClip {
private var _canBeDesactivate:Boolean;
private var _family:Array;
private var _event:Event;
public function UIBulle(_arg1:MovieClip, _arg2:Boolean=true){
_canBeDesactivate = _arg2;
super(_arg1);
}
private function createFamily(_arg1:Object, _arg2:int, _arg3:Array):Boolean{
if ((_arg1 is UIBulle)){
if (UIBulle(_arg1).clip.name == clip.name){
return (false);
};
return (true);
//unresolved jump
};
return (false);
}
public function setFamily(_arg1:Array):void{
_family = _arg1.filter(createFamily);
}
public function setEvent(_arg1:String):void{
_event = new Event(_arg1);
if (enabled){
dispatchEvent(_event);
};
}
override protected function onClick(_arg1:MouseEvent=null):void{
if (((!(_canBeDesactivate)) && (enabled))){
return;
};
super.onClick(_arg1);
if (_event != null){
dispatchEvent(_event);
};
if (_family != null){
_family.forEach(handleFamily);
};
}
private function handleFamily(_arg1:Object, _arg2:int, _arg3:Array):void{
UIBulle(_arg1).enabled = !(enabled);
}
}
}//package ui
Section 157
//UICompteur (ui.UICompteur)
package ui {
import flash.display.*;
public class UICompteur {
private const ADJUST:int = 2;
private var _finished:Boolean;
private var _value:int;
private var _MC:Array;
private var _current:int;
public static var inc_score:int;
public function UICompteur(_arg1:int, _arg2:int=0){
_MC = new Array();
_value = _arg1;
_current = _arg2;
_finished = false;
if (_current >= _value){
_finished = true;
};
}
private function updateItem(_arg1:Object, _arg2:int, _arg3:Array):void{
var _local4:MovieClip = MovieClip(_arg1);
var _local5:int = Math.pow(10, (_arg2 + 1));
var _local6:int = Math.floor((((_current % _local5) * 10) / _local5));
if (_local5 > (_current * 10)){
_local6 = -1;
};
_local4.gotoAndStop((_local6 + ADJUST));
}
public function update():void{
if (_finished){
if (!(_current)){
_MC[0].gotoAndStop(ADJUST);
};
return;
};
var _local1:int;
while ((((_local1 < UICompteur.inc_score)) && (!(_finished)))) {
_current++;
if (_current >= _value){
_finished = true;
};
_local1++;
};
_MC.forEach(updateItem);
}
public function addMC(_arg1:MovieClip):void{
_arg1.gotoAndStop(1);
var _local2:int = (_MC.push(_arg1) - 1);
if (_current){
updateItem(_arg1, _local2, _MC);
};
}
public function isFinished():Boolean{
return (_finished);
}
public function dispose():void{
_MC = null;
}
}
}//package ui
Section 158
//UIEndOfLevel (ui.UIEndOfLevel)
package ui {
import flash.display.*;
import gs.easing.*;
import data.*;
import flash.events.*;
import gs.*;
import models.*;
import com.cheezeworld.utils.*;
import com.cheezeworld.screens.*;
import screens.*;
public class UIEndOfLevel {
private const BACKGROUND_WIDTH:Number = 420;
private const MIN_INC_SCORE:int = 66;
private const WALL_WIDTH:Number = 80;
private const MAX_INC_SCORE:int = 666;
private const LABELS:Array;
public var _started:Boolean;
private var _bonusTime:int;
private var _counters:Array;
private var _currentCounter:int;
private var _clip:MovieClip;
public function UIEndOfLevel(_arg1:GameWorld){
var _local4:UICompteur;
var _local5:DisplayObject;
var _local6:int;
LABELS = new Array("LEVELEND", "CHEESESTARS", "TIME", "TOTAL", "FANS");
super();
_clip = new UI_EndLevelMenu();
_clip.x = (WALL_WIDTH + (BACKGROUND_WIDTH * 0.5));
_clip.y = (Definitions.STAGE_HEIGHT * 0.5);
_arg1.getUIContainer().addChildAt(_clip, 0);
UICompteur.inc_score = MIN_INC_SCORE;
UI_EndLevelMenu(_clip).NEXTDAY.visible = false;
UI_EndLevelMenu(_clip).NEXTDAY.tabEnabled = false;
UI_EndLevelMenu(_clip).NEXTDAY.addEventListener(MouseEvent.CLICK, onNext);
TweenMax.from(_clip, 1, {x:(Definitions.STAGE_HEIGHT + _clip.x), ease:Bounce.easeOut, onComplete:onTweenComplete});
var _local2:Array = new Array(4);
_local2.push(GameStats.instance.totalScore);
var _local3:Array = new Array();
_local3.push(GameStats.instance.getLevelScore());
_local3.push(GameStats.instance.getBonusScore());
_local3.push(GameStats.instance.getTimeScore());
_local3.push(((_local3[0] + _local3[1]) + _local3[2]));
GameStats.instance.totalScore = (GameStats.instance.totalScore + _local3[3]);
_local3.push(GameStats.instance.totalScore);
_bonusTime = _local3[3];
trace("bonusTime:", _bonusTime);
_counters = new Array();
var _local7:int;
while (_local7 < LABELS.length) {
_local4 = new UICompteur(_local3[_local7], _local2[_local7]);
_local6 = 0;
_local5 = _clip[String(((LABELS[_local7] + "_") + _local6))];
while (_local5 != null) {
_local4.addMC((_local5 as MovieClip));
_local6++;
_local5 = _clip[String(((LABELS[_local7] + "_") + _local6))];
};
_counters.push(_local4);
_local7++;
};
_currentCounter = 0;
}
public function getClip():MovieClip{
return (_clip);
}
public function update():void{
var _local1:int;
if (!(_started)){
return;
};
if (_currentCounter >= _counters.length){
if (UITimeBar.displayFX){
UITimeBar.displayFX = false;
};
if (!(UI_EndLevelMenu(_clip).NEXTDAY.visible)){
UI_EndLevelMenu(_clip).NEXTDAY.visible = true;
};
if (Definitions.BUTTON_ACTION(true)){
onNext();
};
return;
};
if (((Input.instance.isMouseDown) || (Definitions.BUTTON_ACTION()))){
UICompteur.inc_score = MAX_INC_SCORE;
} else {
UICompteur.inc_score = MIN_INC_SCORE;
};
_counters[_currentCounter].update();
if ((((LABELS[_currentCounter] == "FANS")) && (_bonusTime))){
_local1 = 0;
while ((((_local1 < UICompteur.inc_score)) && (_bonusTime))) {
_bonusTime--;
_local1++;
};
GameStats.instance.time = (GameStats.instance.time - (_local1 / Definitions.SCORE_DECREASE_TIME));
UITimeBar.displayFX = true;
};
if (_counters[_currentCounter].isFinished()){
_currentCounter++;
};
}
private function newLevel():void{
Root.togglePause();
GameStats.instance.saveTime();
Main.setScreen(Tower);
}
public function dispose():void{
var _local1:int;
while (_local1 < _counters.length) {
_counters[_local1].dispose();
_local1++;
};
GameUtils.removeChild(_clip);
_clip = null;
}
private function onTweenComplete():void{
_started = true;
}
private function onNext(_arg1:MouseEvent=null):void{
var _local2:MC_Rideau = new MC_Rideau();
_local2.DAY["TXT"].text = ("DAY " + String((GameStats.instance.levelsComplete + 1)));
_local2.x = 287;
_local2.y = 203;
_local2.stop();
_clip.parent.addChildAt(_local2, _clip.parent.getChildIndex(_clip));
Root.togglePause();
SFX.instance.stopAll(1);
TweenMax.to(_clip, 1, {x:(Definitions.STAGE_HEIGHT + _clip.x), onComplete:newLevel});
}
}
}//package ui
Section 159
//UIInstructions (ui.UIInstructions)
package ui {
import flash.display.*;
import data.*;
import gs.*;
import flash.events.*;
import models.*;
public class UIInstructions {
private var _closed:Boolean;
private var _background:Sprite;
private var _clip:UI_Instructions;
private var _button:DisplayObjectContainer;
public function UIInstructions(_arg1:DisplayObjectContainer, _arg2:DisplayObjectContainer=null, _arg3:Number=243, _arg4:Number=224){
_clip = new UI_Instructions();
_clip.x = _arg3;
_clip.y = _arg4;
_clip.gotoAndStop(1);
_background = new Sprite();
_background.alpha = 0;
_background.graphics.beginFill(0);
_background.graphics.drawRect(0, 0, Definitions.STAGE_WIDTH, Definitions.STAGE_HEIGHT);
_arg1.addChild(_background);
TweenMax.to(_background, 0.5, {alpha:0.1});
_button = _arg2;
_clip.FLECHEDROITE.addEventListener(MouseEvent.CLICK, onClickRight);
_clip.FLECHEGAUCHE.addEventListener(MouseEvent.CLICK, onClickLeft);
_clip.CLOSE.addEventListener(MouseEvent.CLICK, onClickClose);
_arg1.addChild(_clip);
TweenMax.from(_clip, 0.5, {y:(_clip.y + _clip.height), onComplete:onTweenComplete});
handleShowAndHide();
if (_button != null){
_button.mouseEnabled = false;
};
}
private function onTweenComplete():void{
if (_closed){
dispose();
};
}
private function onClickLeft(_arg1:MouseEvent):void{
_clip.prevFrame();
handleShowAndHide();
}
private function onClickRight(_arg1:MouseEvent):void{
_clip.nextFrame();
handleShowAndHide();
}
private function handleShowAndHide():void{
if (_clip.currentFrame == 1){
_clip.FLECHEGAUCHE.visible = false;
_clip.FLECHEDROITE.visible = true;
} else {
if (_clip.currentFrame == _clip.totalFrames){
_clip.FLECHEGAUCHE.visible = true;
_clip.FLECHEDROITE.visible = false;
} else {
_clip.FLECHEDROITE.visible = true;
_clip.FLECHEGAUCHE.visible = true;
};
};
}
private function onClickClose(_arg1:MouseEvent):void{
_closed = true;
TweenMax.to(_background, 0.5, {alpha:0});
TweenMax.to(_clip, 0.5, {y:(_clip.y + _clip.height), onComplete:onTweenComplete});
}
public function dispose():void{
if (_button != null){
_button.mouseEnabled = true;
};
_button = null;
_clip.FLECHEDROITE.removeEventListener(MouseEvent.CLICK, onClickRight);
_clip.FLECHEGAUCHE.removeEventListener(MouseEvent.CLICK, onClickLeft);
_clip.CLOSE.removeEventListener(MouseEvent.CLICK, onClickClose);
GameUtils.removeChild(_clip);
_clip = null;
GameUtils.removeChild(_background);
_background = null;
}
}
}//package ui
Section 160
//UIPause (ui.UIPause)
package ui {
import flash.display.*;
import flash.events.*;
import gs.*;
import flash.utils.*;
import models.*;
import data.*;
import com.cheezeworld.screens.*;
import screens.*;
import gs.easing.*;
public class UIPause {
private const BACKGROUND_TWEEN_DURATION:Number = 1;
private var _buttonMap:Dictionary;
private var _changeScreen:Boolean;
private var _btn:UI_Pause;
private var _gameworld:GameWorld;
private var _tween:Boolean;
private var _clip:UI_MenuPause;
private var _pause:Boolean;// = false
public static const EVENT_GRAPHICS_LOW:String = "Event_Graphics_Low";
public static const EVENT_GRAPHICS_HIGH:String = "Event_Graphics_High";
public static const EVENT_SOUND_ON:String = "Event_Sound_On";
public static const EVENT_GRAPHICS_NORMAL:String = "Event_Graphics_Normal";
public static const EVENT_SOUND_OFF:String = "Event_Sound_Off";
public static const EVENT_GRAPHICS_AUTO:String = "Event_Graphics_Auto";
public function UIPause(_arg1:GameWorld){
var _local3:DisplayObjectContainer;
var _local4:DisplayObject;
var _local5:Array;
var _local6:UIBulle;
var _local7:int;
var _local8:Boolean;
var _local9:Boolean;
super();
_btn = new UI_Pause();
_btn.x = 479;
_btn.y = 13;
_btn.addEventListener(MouseEvent.CLICK, onClickPause);
_clip = new UI_MenuPause();
_clip.visible = false;
_clip.BACKGROUND.alpha = 0;
_arg1.getUIContainer().addChild(_btn);
_arg1.getUIContainer().addChild(_clip);
_gameworld = _arg1;
TweenMax.from(_btn, 1, {x:(479 + _btn.width)});
_buttonMap = new Dictionary();
_clip.MENU["RESUME"].addEventListener(MouseEvent.CLICK, onClickPause);
_clip.MENU["INSTRUCTIONS"].addEventListener(MouseEvent.CLICK, onClickHelp);
_clip.MENU["QUIT"].addEventListener(MouseEvent.CLICK, onBackToMainMenu);
var _local2:Array = [];
_local2["AUTO"] = EVENT_GRAPHICS_AUTO;
_local2["LOW"] = EVENT_GRAPHICS_LOW;
_local2["NORMAL"] = EVENT_GRAPHICS_NORMAL;
_local2["HIGH"] = EVENT_GRAPHICS_HIGH;
_local2["ON"] = EVENT_SOUND_ON;
_local2["OFF"] = EVENT_SOUND_OFF;
_local5 = [];
_local3 = (_clip.MENU["GRAPHICS"] as DisplayObjectContainer);
_local7 = 0;
while (_local7 < _local3.numChildren) {
_local8 = false;
_local4 = _local3.getChildAt(_local7);
if ((((_local4 is MovieClip)) && (!((_local4.name == ""))))){
if (_local4.name == "AUTO"){
_local8 = true;
};
_local6 = new UIBulle((_local4 as MovieClip), false);
_local6.enabled = _local8;
if (_local2[_local4.name] != null){
_local6.addEventListener(_local2[_local4.name], onClickBulle);
_local6.setEvent(_local2[_local4.name]);
};
_local5.push(_local6);
};
_local7++;
};
for each (_local6 in _local5) {
_local6.setFamily(_local5);
};
_buttonMap["GRAPHICS"] = _local5;
_local5 = [];
_local3 = (_clip.MENU["SOUND"] as DisplayObjectContainer);
_local7 = 0;
while (_local7 < _local3.numChildren) {
_local8 = false;
_local4 = _local3.getChildAt(_local7);
if ((((_local4 is MovieClip)) && (!((_local4.name == ""))))){
trace(_local4.name);
if (_local4.name == "ON"){
_local8 = true;
};
_local6 = new UIBulle((_local4 as MovieClip), false);
_local6.enabled = _local8;
if (_local2[_local4.name] != null){
_local6.addEventListener(_local2[_local4.name], onClickBulle);
_local6.setEvent(_local2[_local4.name]);
};
_local5.push(_local6);
};
_local7++;
};
for each (_local6 in _local5) {
_local6.setFamily(_local5);
};
_buttonMap["SOUND"] = _local5;
hideAll();
}
private function unpause(_arg1:Event=null):void{
Root.togglePause();
allMovieClipOf(_gameworld.getFXContainer(), false);
var _local2:int;
while (_local2 < Definitions.MAX_LAYERS) {
allMovieClipOf(_gameworld.getLayer(_local2), false);
_local2++;
};
}
private function pause(_arg1:Event=null):void{
Root.togglePause();
allMovieClipOf(_gameworld.getFXContainer(), true);
var _local2:int;
while (_local2 < Definitions.MAX_LAYERS) {
allMovieClipOf(_gameworld.getLayer(_local2), true);
_local2++;
};
}
private function onClickBulle(_arg1:Event):void{
switch (_arg1.type){
case EVENT_GRAPHICS_AUTO:
GameOption.instance.setAutoQuality();
break;
case EVENT_GRAPHICS_LOW:
GameOption.instance.setLowQuality();
break;
case EVENT_GRAPHICS_NORMAL:
GameOption.instance.setMediumQuality();
break;
case EVENT_GRAPHICS_HIGH:
GameOption.instance.setHighQuality();
break;
case EVENT_SOUND_ON:
GameOption.instance.disableSound();
break;
case EVENT_SOUND_OFF:
GameOption.instance.enableSound();
break;
};
trace(_arg1.type);
}
private function onClickHelp(_arg1:MouseEvent):void{
var _local2:UIInstructions = new UIInstructions(_clip.parent, (_arg1.target as DisplayObjectContainer));
}
private function onClickPause(_arg1:MouseEvent=null):void{
if (_tween){
return;
};
_pause = !(_pause);
_btn.mouseEnabled = false;
_tween = true;
if (_pause){
pause();
_clip.visible = true;
showAll();
TweenMax.to(_clip.BACKGROUND, BACKGROUND_TWEEN_DURATION, {alpha:0.5, onComplete:onBackgroundAppear});
} else {
TweenMax.to(_clip.BACKGROUND, BACKGROUND_TWEEN_DURATION, {alpha:0, onComplete:onBackgroundDisappear});
hideAll();
};
}
private function onQuit():void{
GameUtils.removeChild(_btn);
_btn = null;
}
private function onBackToMainMenu(_arg1:MouseEvent=null):void{
_changeScreen = true;
_tween = true;
TweenMax.to(_gameworld.screen, BACKGROUND_TWEEN_DURATION, {alpha:0, onComplete:onBackgroundDisappear});
}
private function showChild(_arg1:DisplayObject):void{
TweenMax.to(_arg1, 1, {scaleX:1, scaleY:1, ease:Bounce.easeOut});
}
public function TogglePause():void{
if (_tween){
return;
};
_pause = !(_pause);
_btn.mouseEnabled = false;
_tween = true;
if (_pause){
pause();
_clip.visible = true;
showAll();
TweenMax.to(_clip.BACKGROUND, BACKGROUND_TWEEN_DURATION, {alpha:0.5, onComplete:onBackgroundAppear});
} else {
hideAll();
TweenMax.to(_clip.BACKGROUND, BACKGROUND_TWEEN_DURATION, {alpha:0, onComplete:onBackgroundDisappear});
};
}
private function showAll():void{
showChild(_clip.MENU["GRAPHICS"]);
showChild(_clip.MENU["SOUND"]);
showChild(_clip.MENU["RESUME"]);
showChild(_clip.MENU["QUIT"]);
showChild(_clip.MENU["INSTRUCTIONS"]);
}
public function dispose(_arg1:Boolean=true):void{
if (_arg1){
TweenMax.to(_btn, 1, {x:(479 + _btn.width), onComplete:onQuit});
} else {
onQuit();
};
}
private function onBackgroundAppear():void{
_btn.mouseEnabled = true;
_tween = false;
}
private function hideChild(_arg1:DisplayObject):void{
TweenMax.to(_arg1, 1, {scaleX:0, scaleY:0, ease:Bounce.easeOut});
}
private function onBackgroundDisappear():void{
_clip.visible = false;
_btn.mouseEnabled = true;
_tween = false;
if (!(_changeScreen)){
unpause();
} else {
Root.togglePause();
Main.setScreen(Title);
};
}
private function hideAll():void{
hideChild(_clip.MENU["GRAPHICS"]);
hideChild(_clip.MENU["SOUND"]);
hideChild(_clip.MENU["RESUME"]);
hideChild(_clip.MENU["QUIT"]);
hideChild(_clip.MENU["INSTRUCTIONS"]);
}
public static function allMovieClipOf(_arg1:DisplayObjectContainer, _arg2:Boolean=true):void{
var _local3:DisplayObject;
var _local4:int;
while (_local4 < _arg1.numChildren) {
_local3 = _arg1.getChildAt(_local4);
if (!((_local3 is MovieClip))){
} else {
if (!(_arg2)){
MovieClip(_local3).play();
} else {
MovieClip(_local3).stop();
};
if (MovieClip(_local3).getChildAt(0) != null){
if ((MovieClip(_local3).getChildAt(0) is MovieClip)){
if (!(_arg2)){
MovieClip(MovieClip(_local3).getChildAt(0)).play();
} else {
MovieClip(MovieClip(_local3).getChildAt(0)).stop();
};
};
};
};
_local4++;
};
}
}
}//package ui
Section 161
//UITimeBar (ui.UITimeBar)
package ui {
import flash.geom.*;
import models.*;
import gs.*;
import data.*;
import flash.events.*;
import flash.display.*;
public class UITimeBar extends EventDispatcher {
private const MAX_TIME:Number = 100;
private var _fxHurryGauche:FX_Jauge;
private var _time:Number;
private var _ch1:MovieClip;
private var _ch2:MovieClip;
private var _clip:MovieClip;
private var _fx:FX_Jauge;
private var _ch4:MovieClip;
private var _fxHurryDroite:FX_Jauge;
private var _ch3:MovieClip;
private static var _displayFX:Boolean;
private static var _timePrcent:int;
public function UITimeBar(_arg1:GameWorld){
_clip = new UI_TimeBar();
_clip.cacheAsBitmap = true;
_clip.x = 39;
_clip.y = 217;
_arg1.getUIContainer().addChild(_clip);
_fx = new FX_Jauge();
_fx.visible = false;
_arg1.getUIContainer().addChild(_fx);
var _local2:ColorTransform = new ColorTransform();
_local2.redOffset = 588;
_local2.greenOffset = 199;
_local2.blueOffset = 474;
_fxHurryDroite = new FX_Jauge();
_fxHurryDroite.x = (_clip.x + 19);
_fxHurryDroite.y = (_clip.y - 180);
_fxHurryDroite.rotation = 143;
_fxHurryDroite.visible = false;
_fxHurryDroite.transform.colorTransform = _local2;
_arg1.getUIContainer().addChild(_fxHurryDroite);
_fxHurryGauche = new FX_Jauge();
_fxHurryGauche.x = (_clip.x - 30);
_fxHurryGauche.y = (_clip.y - 175);
_fxHurryGauche.rotation = -172;
_fxHurryGauche.visible = false;
_fxHurryGauche.transform.colorTransform = _local2;
_arg1.getUIContainer().addChild(_fxHurryGauche);
_displayFX = false;
_ch1 = UI_TimeBar(_clip).CHRONO1;
_ch2 = UI_TimeBar(_clip).CHRONO2;
_ch3 = UI_TimeBar(_clip).CHRONO3;
_ch4 = UI_TimeBar(_clip).CHRONO4;
_time = 0;
_timePrcent = 0;
update();
}
public function getClip():MovieClip{
return (_clip);
}
public function update():void{
var _local2:String;
var _local3:Point;
if (((!(_fx.visible)) && (_displayFX))){
_fx.visible = true;
TweenMax.to(UI_TimeBar(_clip).BARRE, 0.5, {glowFilter:{color:0xFF0000, alpha:1, blurX:15, blurY:15}});
} else {
if (((!(_displayFX)) && (_fx.visible))){
_fx.visible = false;
TweenMax.to(UI_TimeBar(_clip).BARRE, 0.5, {glowFilter:{color:0xFF0000, alpha:0, blurX:15, blurY:15}});
};
};
if (UI_TimeBar(_clip).INDICATEUR != null){
_local3 = UI_TimeBar(_clip).INDICATEUR.localToGlobal(new Point());
_fx.x = _local3.x;
_fx.y = (_local3.y - 8);
};
_time = GameStats.instance.time;
var _local1:int = Math.round(((_time * _clip.totalFrames) / MAX_TIME));
_timePrcent = Math.round(((_time * 100) / MAX_TIME));
_clip.gotoAndStop(_local1);
if (_local1 >= _clip.totalFrames){
this.dispatchEvent(new Event(Event.COMPLETE));
};
if ((((_local1 >= Definitions.DOORS_FRAME)) && ((_local1 < _clip.totalFrames)))){
_fxHurryDroite.visible = true;
_fxHurryGauche.visible = true;
} else {
_fxHurryDroite.visible = false;
_fxHurryGauche.visible = false;
};
_local2 = GameUtils.frameToChrono(GameStats.instance.getChrono(), "");
_ch4.gotoAndStop((int(_local2.charAt(0)) + 1));
_ch3.gotoAndStop((int(_local2.charAt(1)) + 1));
_ch2.gotoAndStop((int(_local2.charAt(2)) + 1));
_ch1.gotoAndStop((int(_local2.charAt(3)) + 1));
}
public function dispose():void{
_ch1 = null;
_ch2 = null;
_ch3 = null;
_ch4 = null;
GameUtils.removeChild(_fx);
_fx = null;
GameUtils.removeChild(_clip);
_clip = null;
}
public static function get displayFX():Boolean{
return (_displayFX);
}
public static function set displayFX(_arg1:Boolean):void{
_displayFX = _arg1;
}
public static function clearTimePrcent():void{
_timePrcent = 0;
}
public static function getTimePrcent():int{
return (_timePrcent);
}
}
}//package ui
Section 162
//BD_BackgroundA (BD_BackgroundA)
package {
import flash.display.*;
public dynamic class BD_BackgroundA extends BitmapData {
public function BD_BackgroundA(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 163
//BD_BackgroundB (BD_BackgroundB)
package {
import flash.display.*;
public dynamic class BD_BackgroundB extends BitmapData {
public function BD_BackgroundB(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 164
//BD_BackgroundBottom (BD_BackgroundBottom)
package {
import flash.display.*;
public dynamic class BD_BackgroundBottom extends BitmapData {
public function BD_BackgroundBottom(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 165
//BD_BackgroundC (BD_BackgroundC)
package {
import flash.display.*;
public dynamic class BD_BackgroundC extends BitmapData {
public function BD_BackgroundC(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 166
//BD_BackgroundD (BD_BackgroundD)
package {
import flash.display.*;
public dynamic class BD_BackgroundD extends BitmapData {
public function BD_BackgroundD(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 167
//BD_BackgroundE (BD_BackgroundE)
package {
import flash.display.*;
public dynamic class BD_BackgroundE extends BitmapData {
public function BD_BackgroundE(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 168
//BD_BackgroundF (BD_BackgroundF)
package {
import flash.display.*;
public dynamic class BD_BackgroundF extends BitmapData {
public function BD_BackgroundF(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 169
//BD_BackgroundG (BD_BackgroundG)
package {
import flash.display.*;
public dynamic class BD_BackgroundG extends BitmapData {
public function BD_BackgroundG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 170
//BD_BackgroundH (BD_BackgroundH)
package {
import flash.display.*;
public dynamic class BD_BackgroundH extends BitmapData {
public function BD_BackgroundH(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 171
//BD_BackgroundI (BD_BackgroundI)
package {
import flash.display.*;
public dynamic class BD_BackgroundI extends BitmapData {
public function BD_BackgroundI(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 172
//BD_BackgroundJ (BD_BackgroundJ)
package {
import flash.display.*;
public dynamic class BD_BackgroundJ extends BitmapData {
public function BD_BackgroundJ(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 173
//BD_BackgroundK (BD_BackgroundK)
package {
import flash.display.*;
public dynamic class BD_BackgroundK extends BitmapData {
public function BD_BackgroundK(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 174
//BD_BackgroundL (BD_BackgroundL)
package {
import flash.display.*;
public dynamic class BD_BackgroundL extends BitmapData {
public function BD_BackgroundL(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 175
//BD_BackgroundTop (BD_BackgroundTop)
package {
import flash.display.*;
public dynamic class BD_BackgroundTop extends BitmapData {
public function BD_BackgroundTop(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 176
//BD_BonusTime (BD_BonusTime)
package {
import flash.display.*;
public dynamic class BD_BonusTime extends BitmapData {
public function BD_BonusTime(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 177
//BD_BonusX1 (BD_BonusX1)
package {
import flash.display.*;
public dynamic class BD_BonusX1 extends BitmapData {
public function BD_BonusX1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 178
//BD_BonusX2 (BD_BonusX2)
package {
import flash.display.*;
public dynamic class BD_BonusX2 extends BitmapData {
public function BD_BonusX2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 179
//BD_BonusX3 (BD_BonusX3)
package {
import flash.display.*;
public dynamic class BD_BonusX3 extends BitmapData {
public function BD_BonusX3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 180
//bubblebox_submit_score (bubblebox_submit_score)
package {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class bubblebox_submit_score extends BubbleboxScores {
public var hexArray_chr;
public var vartext;
public var validWeeklyScore;
public var validScore;
public function bubblebox_submit_score(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
public function ii(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
return (cmn((_arg3 ^ (_arg2 | ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public function gg(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
return (cmn((MathbitAND(_arg2, _arg4) | MathbitAND(_arg3, ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public function cmn(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
return (addme(rol(addme(addme(_arg2, _arg1), addme(_arg4, _arg6)), _arg5), _arg3));
}
function frame2(){
stop();
}
function frame3(){
this.bubblebox_view_score.addEventListener(MouseEvent.CLICK, function (_arg1:Event){
navigateToURL(new URLRequest((("http://www.bubblebox.com/highscores/" + _arg1.currentTarget.parent.bubbleboxGameID) + ".htm")), "_blank");
_arg1.target.parent.dispatchEvent(new Event("viewScores"));
});
vartext = "";
validScore = true;
validWeeklyScore = true;
if (isNaN(this.result_scorepos)){
validScore = false;
};
if (isNaN(this.result_scorepos)){
validWeeklyScore = false;
};
if ((((validScore == true)) && ((this.result_scorepos <= 1000)))){
vartext = (("Congratulations, you're ranked nr " + this.result_scorepos) + " in the alltime highscores!!");
} else {
if ((((validWeeklyScore == true)) && ((this.result_weeklyScorepos <= 1000)))){
vartext = (("Congratulations, you're ranked nr " + this.result_weeklyScorepos) + " in the weekly highscores.");
} else {
vartext = "Sorry, you did not make it into the weekly or alltime top 1000.";
};
};
this.postext.text = vartext;
}
public function hh(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
return (cmn(((_arg2 ^ _arg3) ^ _arg4), _arg1, _arg2, _arg5, _arg6, _arg7));
}
function frame1(){
MathbitAND = function (_arg1, _arg2){
var _local3:*;
var _local4:*;
if ((((_arg1 < 0)) && ((_arg2 < 0)))){
_local3 = ((_arg1 & 1) & (_arg2 & 1));
_local4 = ((_arg1 >>> 1) & (_arg2 >>> 1));
return (((_local4 << 1) | _local3));
};
return ((_arg1 & _arg2));
};
hexArray_chr = "0123456789abcdef";
String.prototype.MD5 = function (){
var _local1:* = this;
xArray = str2blks_MD5(_local1);
a = 1732584193;
b = -271733879;
c = -1732584194;
d = 271733878;
i = 0;
while (i < xArray.length) {
olda = a;
oldb = b;
oldc = c;
oldd = d;
a = ff(a, b, c, d, xArray[(i + 0)], 7, -680876936);
d = ff(d, a, b, c, xArray[(i + 1)], 12, -389564586);
c = ff(c, d, a, b, xArray[(i + 2)], 17, 606105819);
b = ff(b, c, d, a, xArray[(i + 3)], 22, -1044525330);
a = ff(a, b, c, d, xArray[(i + 4)], 7, -176418897);
d = ff(d, a, b, c, xArray[(i + 5)], 12, 1200080426);
c = ff(c, d, a, b, xArray[(i + 6)], 17, -1473231341);
b = ff(b, c, d, a, xArray[(i + 7)], 22, -45705983);
a = ff(a, b, c, d, xArray[(i + 8)], 7, 1770035416);
d = ff(d, a, b, c, xArray[(i + 9)], 12, -1958414417);
c = ff(c, d, a, b, xArray[(i + 10)], 17, -42063);
b = ff(b, c, d, a, xArray[(i + 11)], 22, -1990404162);
a = ff(a, b, c, d, xArray[(i + 12)], 7, 1804603682);
d = ff(d, a, b, c, xArray[(i + 13)], 12, -40341101);
c = ff(c, d, a, b, xArray[(i + 14)], 17, -1502002290);
b = ff(b, c, d, a, xArray[(i + 15)], 22, 1236535329);
a = gg(a, b, c, d, xArray[(i + 1)], 5, -165796510);
d = gg(d, a, b, c, xArray[(i + 6)], 9, -1069501632);
c = gg(c, d, a, b, xArray[(i + 11)], 14, 643717713);
b = gg(b, c, d, a, xArray[(i + 0)], 20, -373897302);
a = gg(a, b, c, d, xArray[(i + 5)], 5, -701558691);
d = gg(d, a, b, c, xArray[(i + 10)], 9, 38016083);
c = gg(c, d, a, b, xArray[(i + 15)], 14, -660478335);
b = gg(b, c, d, a, xArray[(i + 4)], 20, -405537848);
a = gg(a, b, c, d, xArray[(i + 9)], 5, 568446438);
d = gg(d, a, b, c, xArray[(i + 14)], 9, -1019803690);
c = gg(c, d, a, b, xArray[(i + 3)], 14, -187363961);
b = gg(b, c, d, a, xArray[(i + 8)], 20, 1163531501);
a = gg(a, b, c, d, xArray[(i + 13)], 5, -1444681467);
d = gg(d, a, b, c, xArray[(i + 2)], 9, -51403784);
c = gg(c, d, a, b, xArray[(i + 7)], 14, 1735328473);
b = gg(b, c, d, a, xArray[(i + 12)], 20, -1926607734);
a = hh(a, b, c, d, xArray[(i + 5)], 4, -378558);
d = hh(d, a, b, c, xArray[(i + 8)], 11, -2022574463);
c = hh(c, d, a, b, xArray[(i + 11)], 16, 1839030562);
b = hh(b, c, d, a, xArray[(i + 14)], 23, -35309556);
a = hh(a, b, c, d, xArray[(i + 1)], 4, -1530992060);
d = hh(d, a, b, c, xArray[(i + 4)], 11, 1272893353);
c = hh(c, d, a, b, xArray[(i + 7)], 16, -155497632);
b = hh(b, c, d, a, xArray[(i + 10)], 23, -1094730640);
a = hh(a, b, c, d, xArray[(i + 13)], 4, 681279174);
d = hh(d, a, b, c, xArray[(i + 0)], 11, -358537222);
c = hh(c, d, a, b, xArray[(i + 3)], 16, -722521979);
b = hh(b, c, d, a, xArray[(i + 6)], 23, 76029189);
a = hh(a, b, c, d, xArray[(i + 9)], 4, -640364487);
d = hh(d, a, b, c, xArray[(i + 12)], 11, -421815835);
c = hh(c, d, a, b, xArray[(i + 15)], 16, 530742520);
b = hh(b, c, d, a, xArray[(i + 2)], 23, -995338651);
a = ii(a, b, c, d, xArray[(i + 0)], 6, -198630844);
d = ii(d, a, b, c, xArray[(i + 7)], 10, 1126891415);
c = ii(c, d, a, b, xArray[(i + 14)], 15, -1416354905);
b = ii(b, c, d, a, xArray[(i + 5)], 21, -57434055);
a = ii(a, b, c, d, xArray[(i + 12)], 6, 1700485571);
d = ii(d, a, b, c, xArray[(i + 3)], 10, -1894986606);
c = ii(c, d, a, b, xArray[(i + 10)], 15, -1051523);
b = ii(b, c, d, a, xArray[(i + 1)], 21, -2054922799);
a = ii(a, b, c, d, xArray[(i + 8)], 6, 1873313359);
d = ii(d, a, b, c, xArray[(i + 15)], 10, -30611744);
c = ii(c, d, a, b, xArray[(i + 6)], 15, -1560198380);
b = ii(b, c, d, a, xArray[(i + 13)], 21, 1309151649);
a = ii(a, b, c, d, xArray[(i + 4)], 6, -145523070);
d = ii(d, a, b, c, xArray[(i + 11)], 10, -1120210379);
c = ii(c, d, a, b, xArray[(i + 2)], 15, 718787259);
b = ii(b, c, d, a, xArray[(i + 9)], 21, -343485551);
a = addme(a, olda);
b = addme(b, oldb);
c = addme(c, oldc);
d = addme(d, oldd);
i = (i + 16);
};
return ((((rhexArray(a) + rhexArray(b)) + rhexArray(c)) + rhexArray(d)));
};
stop();
scoreMc = this;
sendBubbleBoxScore = function (_arg1, _arg2:Sprite){
var gameID = _arg1;
var root = _arg2;
userData = new URLLoader();
var sendStr:* = ((((gameID + "_") + root.score) + "_") + root.bubblebox_name.text);
var preHashStr:* = ((((((((((gameID + "_") + "4234232143214421") + "_") + root.score) + "_") + "2537625476251") + "_") + root.bubblebox_name.text) + "_") + "desleutelistessa");
var hashStr:* = preHashStr.MD5();
var data:URLVariables = new URLVariables(((("datastring=" + sendStr) + "&hashstring=") + hashStr));
userData.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:Event){
scoreMc.gotoAndStop("tryagain");
});
userData.addEventListener(Event.COMPLETE, function (_arg1:Event){
var _local5:String;
var _local6:Array;
var _local2:* = _arg1.target;
var _local3:Array = _local2.data.split("&");
var _local4:Object = {};
for each (_local5 in _local3) {
_local6 = _local5.split("=");
if (_local6.length == 2){
_local4[_local6[0]] = _local6[1];
};
};
scoreMc.result_scoreID = _local4.id;
scoreMc.result_weeklyID = _local4.weekly_id;
scoreMc.result_scorepos = _local4.scorepos;
scoreMc.result_weeklyScorepos = _local4.weeklyScorepos;
scoreMc.gotoAndStop("success");
});
var request:URLRequest = new URLRequest("http://www.bubblebox.com/scripts/insertscore2009.php");
request.method = URLRequestMethod.POST;
request.data = data;
userData.load(request);
};
this.send_btn.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
var _local2:Sprite = _arg1.target.parent;
if (((!((_local2.bubblebox_name.text == "YOUR NAME"))) && ((_local2.bubblebox_name.text.length > 0)))){
trace(_local2.bubbleboxGameID);
sendBubbleBoxScore(_local2.bubbleboxGameID, _local2);
_local2.gotoAndStop("saving");
_local2.dispatchEvent(new Event("sendScores"));
};
});
}
function frame4(){
this.try_again.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
_arg1.currentTarget.parent.gotoAndStop(1);
});
}
public function ff(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
return (cmn((MathbitAND(_arg2, _arg3) | MathbitAND(~(_arg2), _arg4)), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public function rhexArray(_arg1){
str = "";
j = 0;
while (j <= 3) {
str = (str + (hexArray_chr.charAt(MathbitAND((_arg1 >> ((j * 8) + 4)), 15)) + hexArray_chr.charAt(MathbitAND((_arg1 >> (j * 8)), 15))));
j++;
};
return (str);
}
public function str2blks_MD5(_arg1){
_arg1 = String(_arg1);
nblk = (((_arg1.length + 8) >> 6) + 1);
blks = new Array((nblk * 16));
i = 0;
while (i < (nblk * 16)) {
blks[i] = 0;
i++;
};
i = 0;
while (i < _arg1.length) {
blks[(i >> 2)] = (blks[(i >> 2)] | (_arg1.charCodeAt(i) << ((i % 4) * 8)));
i++;
};
blks[(i >> 2)] = (blks[(i >> 2)] | (128 << ((i % 4) * 8)));
blks[((nblk * 16) - 2)] = (_arg1.length * 8);
return (blks);
}
public function rol(_arg1, _arg2){
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
public function addme(_arg1, _arg2){
var _local3:* = (MathbitAND(_arg1, 0xFFFF) + MathbitAND(_arg2, 0xFFFF));
var _local4:* = (((_arg1 >> 16) + (_arg2 >> 16)) + (_local3 >> 16));
return (((_local4 << 16) | MathbitAND(_local3, 0xFFFF)));
}
}
}//package
Section 181
//BubbleboxScores (BubbleboxScores)
package {
import flash.display.*;
public dynamic class BubbleboxScores extends MovieClip {
public function setScore(_arg1:Number, _arg2:int):void{
this.bubbleboxGameID = _arg2;
this.score = _arg1;
this.gotoAndStop(1);
}
}
}//package
Section 182
//FX_BonusTime (FX_BonusTime)
package {
import flash.display.*;
public dynamic class FX_BonusTime extends MovieClip {
}
}//package
Section 183
//FX_BonusX1 (FX_BonusX1)
package {
import flash.display.*;
public dynamic class FX_BonusX1 extends MovieClip {
}
}//package
Section 184
//FX_BonusX2 (FX_BonusX2)
package {
import flash.display.*;
public dynamic class FX_BonusX2 extends MovieClip {
}
}//package
Section 185
//FX_BonusX3 (FX_BonusX3)
package {
import flash.display.*;
public dynamic class FX_BonusX3 extends MovieClip {
}
}//package
Section 186
//FX_Close (FX_Close)
package {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class FX_Close extends MovieClip {
public function FX_Close(){
addFrameScript(26, frame27);
}
function frame27(){
stop();
setTimeout(continuer, 1000);
}
public function continuer():void{
play();
}
}
}//package
Section 187
//FX_Jauge (FX_Jauge)
package {
import flash.display.*;
public dynamic class FX_Jauge extends MovieClip {
}
}//package
Section 188
//Lvl1 (Lvl1)
package {
import flash.display.*;
public dynamic class Lvl1 extends MovieClip {
public var GearBC:MovieClip;
public var Bloc_Small:MovieClip;
public var Background_A:MovieClip;
public var Bonus:MovieClip;
}
}//package
Section 189
//Lvl10 (Lvl10)
package {
import flash.display.*;
public dynamic class Lvl10 extends MovieClip {
public var GearA:MovieClip;
public var Bloc_Small:MovieClip;
public var Special:MovieClip;
public var GearBC:MovieClip;
public var Background_J:MovieClip;
public var Bonus:MovieClip;
}
}//package
Section 190
//Lvl11 (Lvl11)
package {
import flash.display.*;
public dynamic class Lvl11 extends MovieClip {
public var Bloc_Small:MovieClip;
public var Special:MovieClip;
public var GearAB:MovieClip;
public var GearA:MovieClip;
public var Background_K:MovieClip;
public var Bonus:MovieClip;
}
}//package
Section 191
//Lvl12 (Lvl12)
package {
import flash.display.*;
public dynamic class Lvl12 extends MovieClip {
public var Bloc_Small:MovieClip;
public var Special:MovieClip;
public var GearAB:MovieClip;
public var GearA:MovieClip;
public var Background_L:MovieClip;
public var Bonus:MovieClip;
}
}//package
Section 192
//Lvl2 (Lvl2)
package {
import flash.display.*;
public dynamic class Lvl2 extends MovieClip {
public var GearAB:MovieClip;
public var Background_B:MovieClip;
public var Bloc_Small:MovieClip;
public var GearA:MovieClip;
public var Bonus:MovieClip;
}
}//package
Section 193
//Lvl3 (Lvl3)
package {
import flash.display.*;
public dynamic class Lvl3 extends MovieClip {
public var GearAB:MovieClip;
public var Background_C:MovieClip;
public var Bonus:MovieClip;
public var GearBC:MovieClip;
public var Bloc_Small:MovieClip;
}
}//package
Section 194
//Lvl4 (Lvl4)
package {
import flash.display.*;
public dynamic class Lvl4 extends MovieClip {
public var GearAB:MovieClip;
public var GearA:MovieClip;
public var Background_D:MovieClip;
public var GearABC:MovieClip;
public var Bonus:MovieClip;
}
}//package
Section 195
//Lvl5 (Lvl5)
package {
import flash.display.*;
public dynamic class Lvl5 extends MovieClip {
public var GearA:MovieClip;
public var Background_E:MovieClip;
public var Bloc_Small:MovieClip;
public var Special:MovieClip;
public var Bonus:MovieClip;
}
}//package
Section 196
//Lvl6 (Lvl6)
package {
import flash.display.*;
public dynamic class Lvl6 extends MovieClip {
public var GearAB:MovieClip;
public var GearA:MovieClip;
public var Background_F:MovieClip;
public var Bloc_Small:MovieClip;
public var Bonus:MovieClip;
}
}//package
Section 197
//Lvl7 (Lvl7)
package {
import flash.display.*;
public dynamic class Lvl7 extends MovieClip {
public var GearAB:MovieClip;
public var GearA:MovieClip;
public var Bonus:MovieClip;
public var GearBC:MovieClip;
public var Background_G:MovieClip;
}
}//package
Section 198
//Lvl8 (Lvl8)
package {
import flash.display.*;
public dynamic class Lvl8 extends MovieClip {
public var Bloc_Small:MovieClip;
public var Background_H:MovieClip;
public var Special:MovieClip;
public var Bonus:MovieClip;
}
}//package
Section 199
//Lvl9 (Lvl9)
package {
import flash.display.*;
public dynamic class Lvl9 extends MovieClip {
public var GearAB:MovieClip;
public var Bloc_Small:MovieClip;
public var Background_I:MovieClip;
public var GearA:MovieClip;
public var Bonus:MovieClip;
}
}//package
Section 200
//LvlBottom (LvlBottom)
package {
import flash.display.*;
public dynamic class LvlBottom extends MovieClip {
public var Bumper:MovieClip;
public var Background_Bottom:MovieClip;
public var Bloc_Big:MovieClip;
}
}//package
Section 201
//LvlTop (LvlTop)
package {
import flash.display.*;
public dynamic class LvlTop extends MovieClip {
public var CheezeMoon:MovieClip;
public var Background_Top:MovieClip;
public var DoorLeft:MC_DoorLeft;
public var DoorRight:MC_DoorRight;
}
}//package
Section 202
//Main (Main)
package {
import screens.*;
import data.*;
import flash.display.*;
import flash.events.*;
import com.cheezeworld.screens.*;
public class Main extends Root {
private static var m_instance:Main;
public function Main(_arg1:Stage):void{
super(_arg1);
m_instance = this;
new Definitions(launch);
}
private function launch(_arg1:Event=null):void{
Main.setScreen(Title);
}
public static function setScreen(_arg1:Class):void{
m_instance.setScreen(_arg1);
}
}
}//package
Section 203
//MC_BackgroundPause (MC_BackgroundPause)
package {
import flash.display.*;
public dynamic class MC_BackgroundPause extends MovieClip {
}
}//package
Section 204
//MC_Bumper (MC_Bumper)
package {
import flash.display.*;
public dynamic class MC_Bumper extends MovieClip {
}
}//package
Section 205
//MC_DoorLeft (MC_DoorLeft)
package {
import flash.display.*;
public dynamic class MC_DoorLeft extends MovieClip {
}
}//package
Section 206
//MC_DoorRight (MC_DoorRight)
package {
import flash.display.*;
public dynamic class MC_DoorRight extends MovieClip {
}
}//package
Section 207
//MC_FlecheEtage (MC_FlecheEtage)
package {
import flash.display.*;
public dynamic class MC_FlecheEtage extends MovieClip {
}
}//package
Section 208
//MC_Foule (MC_Foule)
package {
import flash.display.*;
public dynamic class MC_Foule extends MovieClip {
}
}//package
Section 209
//MC_GearA (MC_GearA)
package {
import flash.display.*;
public dynamic class MC_GearA extends MovieClip {
}
}//package
Section 210
//MC_GearB (MC_GearB)
package {
import flash.display.*;
public dynamic class MC_GearB extends MovieClip {
}
}//package
Section 211
//MC_GearC (MC_GearC)
package {
import flash.display.*;
public dynamic class MC_GearC extends MovieClip {
}
}//package
Section 212
//MC_RetryLevel (MC_RetryLevel)
package {
import flash.display.*;
public dynamic class MC_RetryLevel extends MovieClip {
public var btnYES:SimpleButton;
public var btnNO:SimpleButton;
}
}//package
Section 213
//MC_Rideau (MC_Rideau)
package {
import flash.display.*;
public dynamic class MC_Rideau extends MovieClip {
public var DAY:MovieClip;
}
}//package
Section 214
//MC_SMOKEBIG (MC_SMOKEBIG)
package {
import flash.display.*;
public dynamic class MC_SMOKEBIG extends MovieClip {
}
}//package
Section 215
//MC_SMOKESMALL (MC_SMOKESMALL)
package {
import flash.display.*;
public dynamic class MC_SMOKESMALL extends MovieClip {
}
}//package
Section 216
//MC_SuperMouse (MC_SuperMouse)
package {
import flash.display.*;
public dynamic class MC_SuperMouse extends MovieClip {
}
}//package
Section 217
//SCENE_Outro (SCENE_Outro)
package {
import flash.display.*;
public dynamic class SCENE_Outro extends MovieClip {
}
}//package
Section 218
//SCENE_Starting (SCENE_Starting)
package {
import flash.display.*;
public dynamic class SCENE_Starting extends MovieClip {
}
}//package
Section 219
//SCREEN_EcranTitre (SCREEN_EcranTitre)
package {
import flash.display.*;
public dynamic class SCREEN_EcranTitre extends MovieClip {
}
}//package
Section 220
//SCREEN_GameOver (SCREEN_GameOver)
package {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import data.*;
public dynamic class SCREEN_GameOver extends MovieClip {
public var FANS_12:MovieClip;
public var FANS_13:MovieClip;
public var CHEESESTARS_1:MovieClip;
public var FANS_10:MovieClip;
public var FANS_8:MovieClip;
public var FANS_14:MovieClip;
public var CHEESESTARS_0:MovieClip;
public var CHEESESTARS_2:MovieClip;
public var FANS_11:MovieClip;
public var CHEESESTARS_5:MovieClip;
public var FANS_9:MovieClip;
public var mcBack:MovieClip;
public var moreg1:SimpleButton;
public var btnBACK:SimpleButton;
public var CERCLE:MovieClip;
public var mcSubmit:MovieClip;
public var FANS_0:MovieClip;
public var FANS_2:MovieClip;
public var btnSUBMIT:SimpleButton;
public var FANS_4:MovieClip;
public var FANS_5:MovieClip;
public var FANS_6:MovieClip;
public var FANS_7:MovieClip;
public var FANS_1:MovieClip;
public var FANS_3:MovieClip;
public var CHEESESTARS_3:MovieClip;
public var CHEESESTARS_4:MovieClip;
public function SCREEN_GameOver(){
addFrameScript(0, frame1);
}
public function gotoBubbleBox(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest((("http://www.bubblebox.com/clickreg.php?type=gamestats&id=" + String(GameStats.GAME_ID)) + "&subid=moregames2"));
navigateToURL(_local2, "_blank");
}
function frame1(){
moreg1.addEventListener(MouseEvent.CLICK, gotoBubbleBox);
}
}
}//package
Section 221
//SCREEN_Title (SCREEN_Title)
package {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import data.*;
public dynamic class SCREEN_Title extends MovieClip {
public var btnCCCPLAY:SimpleButton;
public var btnBUBBLEBOX:SimpleButton;
public var logo2:InteractiveObject;
public var SUPERMOUSE:MovieClip;
public var logo:InteractiveObject;
public var btnPLAY:SimpleButton;
public var btnINSTRUCTION:SimpleButton;
public var btnHIGHSCORE:SimpleButton;
public function SCREEN_Title(){
addFrameScript(0, frame1);
}
function frame1(){
logo2 = (this["btnBUBBLEBOX"] as InteractiveObject);
logo2.addEventListener(MouseEvent.CLICK, gotoBubbleBox);
logo = (this["btnCCCPLAY"] as InteractiveObject);
logo.addEventListener(MouseEvent.CLICK, gotoCCCP);
}
public function gotoCCCP(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://www.cccplay.com");
navigateToURL(_local2, "_blank");
}
public function gotoBubbleBox(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest((("http://www.bubblebox.com/clickreg.php?type=gamestats&id=" + String(GameStats.GAME_ID)) + "&subid=menup"));
navigateToURL(_local2, "_blank");
}
}
}//package
Section 222
//Sons (Sons)
package {
import gs.*;
import flash.media.*;
public class Sons extends Sound {
private var channel:SoundChannel;
public var isPlaying:Boolean;// = false
public var name:String;
private var transform:SoundTransform;
public var isLoop:Boolean;// = false
private var actif:Boolean;// = true
private var volume:Number;// = 1
public function Sons(){
channel = this.play();
channel.stop();
}
public function start():void{
if (this.isLoop){
channel = this.play(0, 9999, null);
} else {
channel = this.play();
};
if (this.actif){
this.setVolume(volume);
} else {
transform = channel.soundTransform;
transform.volume = 0;
channel.soundTransform = transform;
};
isPlaying = true;
}
public function stop(_arg1:Number=0):void{
if (!(_arg1)){
channel.stop();
isPlaying = false;
} else {
TweenMax.to(channel, _arg1, {volume:0, onComplete:stop});
};
}
public function getVolume():Number{
return (volume);
}
public function setVolume(_arg1:Number):void{
if (this.actif){
transform = channel.soundTransform;
transform.volume = _arg1;
channel.soundTransform = transform;
volume = _arg1;
};
}
public function mute(_arg1:Boolean):void{
if (!(_arg1)){
transform = channel.soundTransform;
transform.volume = 0;
channel.soundTransform = transform;
this.actif = false;
} else {
transform = channel.soundTransform;
transform.volume = volume;
channel.soundTransform = transform;
this.actif = true;
};
}
}
}//package
Section 223
//SOUND_APPLAUDE (SOUND_APPLAUDE)
package {
public dynamic class SOUND_APPLAUDE extends Sons {
}
}//package
Section 224
//SOUND_BEAT (SOUND_BEAT)
package {
public dynamic class SOUND_BEAT extends Sons {
}
}//package
Section 225
//SOUND_BONUSTIME (SOUND_BONUSTIME)
package {
public dynamic class SOUND_BONUSTIME extends Sons {
}
}//package
Section 226
//SOUND_BONUSX1 (SOUND_BONUSX1)
package {
public dynamic class SOUND_BONUSX1 extends Sons {
}
}//package
Section 227
//SOUND_BONUSX2 (SOUND_BONUSX2)
package {
public dynamic class SOUND_BONUSX2 extends Sons {
}
}//package
Section 228
//SOUND_BONUSX3 (SOUND_BONUSX3)
package {
public dynamic class SOUND_BONUSX3 extends Sons {
}
}//package
Section 229
//SOUND_BUMPER (SOUND_BUMPER)
package {
public dynamic class SOUND_BUMPER extends Sons {
}
}//package
Section 230
//SOUND_COLLIDE (SOUND_COLLIDE)
package {
public dynamic class SOUND_COLLIDE extends Sons {
}
}//package
Section 231
//SOUND_COLLIDEGEAR (SOUND_COLLIDEGEAR)
package {
public dynamic class SOUND_COLLIDEGEAR extends Sons {
}
}//package
Section 232
//SOUND_FLYING (SOUND_FLYING)
package {
public dynamic class SOUND_FLYING extends Sons {
}
}//package
Section 233
//SOUND_FOULE (SOUND_FOULE)
package {
public dynamic class SOUND_FOULE extends Sons {
}
}//package
Section 234
//SOUND_GLOCKEN (SOUND_GLOCKEN)
package {
public dynamic class SOUND_GLOCKEN extends Sons {
}
}//package
Section 235
//SOUND_HURRY (SOUND_HURRY)
package {
public dynamic class SOUND_HURRY extends Sons {
}
}//package
Section 236
//SOUND_INTER (SOUND_INTER)
package {
public dynamic class SOUND_INTER extends Sons {
}
}//package
Section 237
//SOUND_INTRO (SOUND_INTRO)
package {
public dynamic class SOUND_INTRO extends Sons {
}
}//package
Section 238
//SOUND_SCORE (SOUND_SCORE)
package {
public dynamic class SOUND_SCORE extends Sons {
}
}//package
Section 239
//SOUND_SQUEAK (SOUND_SQUEAK)
package {
public dynamic class SOUND_SQUEAK extends Sons {
}
}//package
Section 240
//SOUND_TIMEOUT (SOUND_TIMEOUT)
package {
public dynamic class SOUND_TIMEOUT extends Sons {
}
}//package
Section 241
//SOUND_VICTORY (SOUND_VICTORY)
package {
public dynamic class SOUND_VICTORY extends Sons {
}
}//package
Section 242
//UI_AvatarPos (UI_AvatarPos)
package {
import flash.display.*;
public dynamic class UI_AvatarPos extends MovieClip {
}
}//package
Section 243
//UI_EndLevelMenu (UI_EndLevelMenu)
package {
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import data.*;
public dynamic class UI_EndLevelMenu extends MovieClip {
public var CHEESESTARS_5:MovieClip;
public var CHEESESTARS_1:MovieClip;
public var CHEESESTARS_3:MovieClip;
public var CHEESESTARS_2:MovieClip;
public var CHEESESTARS_4:MovieClip;
public var NEXTDAY:SimpleButton;
public var TIME_0:MovieClip;
public var TIME_1:MovieClip;
public var TIME_2:MovieClip;
public var TIME_3:MovieClip;
public var TIME_4:MovieClip;
public var TIME_5:MovieClip;
public var moreg1:SimpleButton;
public var LEVELEND_0:MovieClip;
public var LEVELEND_1:MovieClip;
public var LEVELEND_2:MovieClip;
public var LEVELEND_3:MovieClip;
public var LEVELEND_4:MovieClip;
public var LEVELEND_5:MovieClip;
public var TOTAL_0:MovieClip;
public var TOTAL_1:MovieClip;
public var TOTAL_2:MovieClip;
public var TOTAL_3:MovieClip;
public var TOTAL_4:MovieClip;
public var TOTAL_5:MovieClip;
public var FANS_0:MovieClip;
public var FANS_1:MovieClip;
public var FANS_2:MovieClip;
public var FANS_3:MovieClip;
public var FANS_4:MovieClip;
public var FANS_5:MovieClip;
public var FANS_6:MovieClip;
public var FANS_7:MovieClip;
public var FANS_8:MovieClip;
public var CHEESESTARS_0:MovieClip;
public function UI_EndLevelMenu(){
addFrameScript(0, frame1);
}
public function gotoBubbleBox(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest((("http://www.bubblebox.com/clickreg.php?type=gamestats&id=" + String(GameStats.GAME_ID)) + "&subid=moregames1"));
navigateToURL(_local2, "_blank");
}
function frame1(){
moreg1.addEventListener(MouseEvent.CLICK, gotoBubbleBox);
}
}
}//package
Section 244
//UI_Instructions (UI_Instructions)
package {
import flash.display.*;
public dynamic class UI_Instructions extends MovieClip {
public var FLECHEGAUCHE:SimpleButton;
public var CLOSE:SimpleButton;
public var FLECHEDROITE:SimpleButton;
}
}//package
Section 245
//UI_Loading (UI_Loading)
package {
import flash.display.*;
public dynamic class UI_Loading extends MovieClip {
public var loadBar:MovieClip;
}
}//package
Section 246
//UI_MenuPause (UI_MenuPause)
package {
import flash.display.*;
public dynamic class UI_MenuPause extends MovieClip {
public var BACKGROUND:MC_BackgroundPause;
public var MENU:MovieClip;
}
}//package
Section 247
//UI_Pause (UI_Pause)
package {
import flash.display.*;
public dynamic class UI_Pause extends SimpleButton {
}
}//package
Section 248
//UI_TimeBar (UI_TimeBar)
package {
import flash.display.*;
public dynamic class UI_TimeBar extends MovieClip {
public var BARRE:MovieClip;
public var CHRONO1:MovieClip;
public var CHRONO2:MovieClip;
public var CHRONO3:MovieClip;
public var CHRONO4:MovieClip;
public var INDICATEUR:MovieClip;
}
}//package