Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2CircleDef extends b2ShapeDef {
public var localPosition:b2Vec2;
public var radius:Number;
public function b2CircleDef(){
localPosition = new b2Vec2(0, 0);
super();
type = b2Shape.e_circleShape;
radius = 1;
}
}
}//package Box2D.Collision.Shapes
Section 2
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape)
package Box2D.Collision.Shapes {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2CircleShape extends b2Shape {
public var m_radius:Number;
public var m_localPosition:b2Vec2;
public function b2CircleShape(_arg1:b2ShapeDef){
var _local2:b2CircleDef;
m_localPosition = new b2Vec2();
super(_arg1);
_local2 = (_arg1 as b2CircleDef);
m_type = e_circleShape;
m_localPosition.SetV(_local2.localPosition);
m_radius = _local2.radius;
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
_local3 = _arg1.R;
_local4 = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
_local5 = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_local4 = (_arg2.x - _local4);
_local5 = (_arg2.y - _local5);
return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius)));
}
public function GetLocalPosition():b2Vec2{
return (m_localPosition);
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local6 = _arg1.R;
_local7 = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y)));
_local8 = (_arg1.position.x + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y)));
_local9 = (_arg4.p1.x - _local7);
_local10 = (_arg4.p1.y - _local8);
_local11 = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius));
if (_local11 < 0){
return (false);
};
_local12 = (_arg4.p2.x - _arg4.p1.x);
_local13 = (_arg4.p2.y - _arg4.p1.y);
_local14 = ((_local9 * _local12) + (_local10 * _local13));
_local15 = ((_local12 * _local12) + (_local13 * _local13));
_local16 = ((_local14 * _local14) - (_local15 * _local11));
if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){
return (false);
};
_local17 = -((_local14 + Math.sqrt(_local16)));
if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){
_local17 = (_local17 / _local15);
_arg2[0] = _local17;
_arg3.x = (_local9 + (_local17 * _local12));
_arg3.y = (_local10 + (_local17 * _local13));
_arg3.Normalize();
return (true);
};
return (false);
}
override public function ComputeMass(_arg1:b2MassData):void{
_arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius);
_arg1.center.SetV(m_localPosition);
_arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y))));
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = _arg2.R;
_local5 = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
_local6 = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_local4 = _arg3.R;
_local7 = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
_local8 = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius));
_arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius));
}
public function GetRadius():Number{
return (m_radius);
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:Number;
var _local3:Number;
_local2 = (m_localPosition.x - _arg1.x);
_local3 = (m_localPosition.y - _arg1.y);
_local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.R;
_local4 = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
_local5 = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius));
_arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius));
}
}
}//package Box2D.Collision.Shapes
Section 3
//b2FilterData (Box2D.Collision.Shapes.b2FilterData)
package Box2D.Collision.Shapes {
public class b2FilterData {
public var maskBits:uint;// = 0xFFFF
public var groupIndex:int;// = 0
public var categoryBits:uint;// = 1
public function b2FilterData(){
categoryBits = 1;
maskBits = 0xFFFF;
groupIndex = 0;
super();
}
public function Copy():b2FilterData{
var _local1:b2FilterData;
_local1 = new b2FilterData();
_local1.categoryBits = categoryBits;
_local1.maskBits = maskBits;
_local1.groupIndex = groupIndex;
return (_local1);
}
}
}//package Box2D.Collision.Shapes
Section 4
//b2MassData (Box2D.Collision.Shapes.b2MassData)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2MassData {
public var mass:Number;// = 0
public var center:b2Vec2;
public var I:Number;// = 0
public function b2MassData(){
mass = 0;
center = new b2Vec2(0, 0);
I = 0;
super();
}
}
}//package Box2D.Collision.Shapes
Section 5
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PolygonDef extends b2ShapeDef {
public var vertexCount:int;
public var vertices:Array;
private static var s_mat:b2Mat22 = new b2Mat22();
public function b2PolygonDef(){
var _local1:int;
vertices = new Array(b2Settings.b2_maxPolygonVertices);
super();
type = b2Shape.e_polygonShape;
vertexCount = 0;
_local1 = 0;
while (_local1 < b2Settings.b2_maxPolygonVertices) {
vertices[_local1] = new b2Vec2();
_local1++;
};
}
public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{
var _local5:b2Vec2;
var _local6:b2Mat22;
var _local7:int;
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
if (_arg3){
_local5 = _arg3;
_local6 = s_mat;
_local6.Set(_arg4);
_local7 = 0;
while (_local7 < vertexCount) {
_arg3 = vertices[_local7];
_arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y)));
_arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y)));
_arg3.x = _arg1;
_local7++;
};
};
}
public function SetAsBox(_arg1:Number, _arg2:Number):void{
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
}
}
}//package Box2D.Collision.Shapes
Section 6
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape)
package Box2D.Collision.Shapes {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PolygonShape extends b2Shape {
public var m_vertices:Array;
public var m_normals:Array;
private var s_supportVec:b2Vec2;
public var m_obb:b2OBB;
public var m_coreVertices:Array;
public var m_centroid:b2Vec2;
public var m_vertexCount:int;
private static var s_computeMat:b2Mat22 = new b2Mat22();
private static var s_sweptAABB1:b2AABB = new b2AABB();
private static var s_sweptAABB2:b2AABB = new b2AABB();
public function b2PolygonShape(_arg1:b2ShapeDef){
var _local2:b2PolygonDef;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
s_supportVec = new b2Vec2();
m_obb = new b2OBB();
m_vertices = new Array(b2Settings.b2_maxPolygonVertices);
m_normals = new Array(b2Settings.b2_maxPolygonVertices);
m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices);
super(_arg1);
m_type = e_polygonShape;
_local2 = (_arg1 as b2PolygonDef);
m_vertexCount = _local2.vertexCount;
_local4 = _local3;
_local5 = _local3;
_local3 = 0;
while (_local3 < m_vertexCount) {
m_vertices[_local3] = _local2.vertices[_local3].Copy();
_local3++;
};
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = _local3;
_local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0;
_local6 = (m_vertices[_local5].x - m_vertices[_local4].x);
_local7 = (m_vertices[_local5].y - m_vertices[_local4].y);
_local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8));
_local3++;
};
m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount);
ComputeOBB(m_obb, m_vertices, m_vertexCount);
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1);
_local5 = _local3;
_local9 = m_normals[_local4].x;
_local10 = m_normals[_local4].y;
_local11 = m_normals[_local5].x;
_local12 = m_normals[_local5].y;
_local13 = (m_vertices[_local3].x - m_centroid.x);
_local14 = (m_vertices[_local3].y - m_centroid.y);
_local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop);
_local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop);
_local17 = (1 / ((_local9 * _local12) - (_local10 * _local11)));
m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y));
_local3++;
};
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
var _local10:Number;
_local4 = _arg1.R;
_local5 = (_arg2.x - _arg1.position.x);
_local6 = (_arg2.y - _arg1.position.y);
_local7 = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y));
_local8 = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y));
_local9 = 0;
while (_local9 < m_vertexCount) {
_local3 = m_vertices[_local9];
_local5 = (_local7 - _local3.x);
_local6 = (_local8 - _local3.y);
_local3 = m_normals[_local9];
_local10 = ((_local3.x * _local5) + (_local3.y * _local6));
if (_local10 > 0){
return (false);
};
_local9++;
};
return (true);
}
public function GetCoreVertices():Array{
return (m_coreVertices);
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:Number;
var _local21:Number;
_local6 = 0;
_local7 = _arg5;
_local8 = (_arg4.p1.x - _arg1.position.x);
_local9 = (_arg4.p1.y - _arg1.position.y);
_local10 = _arg1.R;
_local12 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local13 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local8 = (_arg4.p2.x - _arg1.position.x);
_local9 = (_arg4.p2.y - _arg1.position.y);
_local10 = _arg1.R;
_local14 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local15 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local16 = (_local14 - _local12);
_local17 = (_local15 - _local13);
_local18 = -1;
_local19 = 0;
while (_local19 < m_vertexCount) {
_local11 = m_vertices[_local19];
_local8 = (_local11.x - _local12);
_local9 = (_local11.y - _local13);
_local11 = m_normals[_local19];
_local20 = ((_local11.x * _local8) + (_local11.y * _local9));
_local21 = ((_local11.x * _local16) + (_local11.y * _local17));
if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){
_local6 = (_local20 / _local21);
_local18 = _local19;
} else {
if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){
_local7 = (_local20 / _local21);
};
};
if (_local7 < _local6){
return (false);
};
_local19++;
};
if (_local18 >= 0){
_arg2[0] = _local6;
_local10 = _arg1.R;
_local11 = m_normals[_local18];
_arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
return (true);
};
return (false);
}
public function GetCentroid():b2Vec2{
return (m_centroid);
}
override public function ComputeMass(_arg1:b2MassData):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = (1 / 3);
_local9 = 0;
while (_local9 < m_vertexCount) {
_local10 = m_vertices[_local9];
_local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0];
_local12 = (_local10.x - _local6);
_local13 = (_local10.y - _local7);
_local14 = (_local11.x - _local6);
_local15 = (_local11.y - _local7);
_local16 = ((_local12 * _local15) - (_local13 * _local14));
_local17 = (0.5 * _local16);
_local4 = (_local4 + _local17);
_local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x)));
_local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y)));
_local18 = _local6;
_local19 = _local7;
_local20 = _local12;
_local21 = _local13;
_local22 = _local14;
_local23 = _local15;
_local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18));
_local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19));
_local5 = (_local5 + (_local16 * (_local24 + _local25)));
_local9++;
};
_arg1.mass = (m_density * _local4);
_local2 = (_local2 * (1 / _local4));
_local3 = (_local3 * (1 / _local4));
_arg1.center.Set(_local2, _local3);
_arg1.I = (m_density * _local5);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:int;
var _local11:Number;
_local5 = _arg1.R;
_local6 = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y));
_local7 = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y));
_local8 = 0;
_local4 = m_coreVertices[0];
_local9 = ((_local4.x * _local6) + (_local4.y * _local7));
_local10 = 1;
while (_local10 < m_vertexCount) {
_local4 = m_coreVertices[_local10];
_local11 = ((_local4.x * _local6) + (_local4.y * _local7));
if (_local11 > _local9){
_local8 = _local10;
_local9 = _local11;
};
_local10++;
};
_local5 = _arg1.R;
_local4 = m_coreVertices[_local8];
s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y)));
s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y)));
return (s_supportVec);
}
public function GetVertexCount():int{
return (m_vertexCount);
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2AABB;
var _local5:b2AABB;
_local4 = s_sweptAABB1;
_local5 = s_sweptAABB2;
ComputeAABB(_local4, _arg2);
ComputeAABB(_local5, _arg3);
_arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y);
_arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y);
}
public function GetVertices():Array{
return (m_vertices);
}
public function GetNormals():Array{
return (m_normals);
}
public function GetOBB():b2OBB{
return (m_obb);
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_coreVertices[0]));
}
public function Centroid(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_centroid));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:b2Vec2;
var _local3:int;
var _local4:Number;
var _local5:Number;
m_sweepRadius = 0;
_local3 = 0;
while (_local3 < m_vertexCount) {
_local2 = m_coreVertices[_local3];
_local4 = (_local2.x - _arg1.x);
_local5 = (_local2.y - _arg1.y);
_local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
if (_local4 > m_sweepRadius){
m_sweepRadius = _local4;
};
_local3++;
};
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local5 = s_computeMat;
_local3 = _arg2.R;
_local4 = m_obb.R.col1;
_local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local4 = m_obb.R.col2;
_local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local5.Abs();
_local6 = _local5;
_local4 = m_obb.extents;
_local7 = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y));
_local8 = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y));
_local3 = _arg2.R;
_local4 = m_obb.center;
_local9 = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)));
_local10 = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)));
_arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8));
_arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8));
}
public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local3 = new b2Vec2();
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = (1 / 3);
_local8 = 0;
while (_local8 < _arg2) {
_local9 = _arg1[_local8];
_local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0];
_local11 = (_local9.x - _local5);
_local12 = (_local9.y - _local6);
_local13 = (_local10.x - _local5);
_local14 = (_local10.y - _local6);
_local15 = ((_local11 * _local14) - (_local12 * _local13));
_local16 = (0.5 * _local15);
_local4 = (_local4 + _local16);
_local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x)));
_local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y)));
_local8++;
};
_local3.x = (_local3.x * (1 / _local4));
_local3.y = (_local3.y * (1 / _local4));
return (_local3);
}
public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{
var _local4:int;
var _local5:Array;
var _local6:Number;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:b2Mat22;
_local5 = new Array((b2Settings.b2_maxPolygonVertices + 1));
_local4 = 0;
while (_local4 < _arg3) {
_local5[_local4] = _arg2[_local4];
_local4++;
};
_local5[_arg3] = _local5[0];
_local6 = Number.MAX_VALUE;
_local4 = 1;
while (_local4 <= _arg3) {
_local7 = _local5[int((_local4 - 1))];
_local8 = (_local5[_local4].x - _local7.x);
_local9 = (_local5[_local4].y - _local7.y);
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local8 = (_local8 / _local10);
_local9 = (_local9 / _local10);
_local11 = -(_local9);
_local12 = _local8;
_local13 = Number.MAX_VALUE;
_local14 = Number.MAX_VALUE;
_local15 = -(Number.MAX_VALUE);
_local16 = -(Number.MAX_VALUE);
_local17 = 0;
while (_local17 < _arg3) {
_local19 = (_local5[_local17].x - _local7.x);
_local20 = (_local5[_local17].y - _local7.y);
_local21 = ((_local8 * _local19) + (_local9 * _local20));
_local22 = ((_local11 * _local19) + (_local12 * _local20));
if (_local21 < _local13){
_local13 = _local21;
};
if (_local22 < _local14){
_local14 = _local22;
};
if (_local21 > _local15){
_local15 = _local21;
};
if (_local22 > _local16){
_local16 = _local22;
};
_local17++;
};
_local18 = ((_local15 - _local13) * (_local16 - _local14));
if (_local18 < (0.95 * _local6)){
_local6 = _local18;
_arg1.R.col1.x = _local8;
_arg1.R.col1.y = _local9;
_arg1.R.col2.x = _local11;
_arg1.R.col2.y = _local12;
_local23 = (0.5 * (_local13 + _local15));
_local24 = (0.5 * (_local14 + _local16));
_local25 = _arg1.R;
_arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24)));
_arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24)));
_arg1.extents.x = (0.5 * (_local15 - _local13));
_arg1.extents.y = (0.5 * (_local16 - _local14));
};
_local4++;
};
}
}
}//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape)
package Box2D.Collision.Shapes {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2Shape {
public var m_type:int;
public var m_sweepRadius:Number;
public var m_density:Number;
public var m_filter:b2FilterData;
public var m_friction:Number;
public var m_next:b2Shape;
public var m_restitution:Number;
public var m_userData;
public var m_isSensor:Boolean;
public var m_proxyId:uint;
public var m_body:b2Body;
public static const e_polygonShape:int = 1;
public static const e_unknownShape:int = -1;
public static const e_circleShape:int = 0;
public static const e_shapeTypeCount:int = 2;
private static var s_resetAABB:b2AABB = new b2AABB();
private static var s_syncAABB:b2AABB = new b2AABB();
private static var s_proxyAABB:b2AABB = new b2AABB();
public function b2Shape(_arg1:b2ShapeDef){
m_userData = _arg1.userData;
m_friction = _arg1.friction;
m_restitution = _arg1.restitution;
m_density = _arg1.density;
m_body = null;
m_sweepRadius = 0;
m_next = null;
m_proxyId = b2Pair.b2_nullProxy;
m_filter = _arg1.filter.Copy();
m_isSensor = _arg1.isSensor;
}
public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
return (false);
}
public function GetSweepRadius():Number{
return (m_sweepRadius);
}
public function GetNext():b2Shape{
return (m_next);
}
public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
}
public function GetType():int{
return (m_type);
}
public function GetRestitution():Number{
return (m_restitution);
}
public function GetFriction():Number{
return (m_friction);
}
public function GetFilterData():b2FilterData{
return (m_filter.Copy());
}
public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
return (false);
}
public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB;
var _local4:Boolean;
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
_arg1.DestroyProxy(m_proxyId);
_local3 = s_resetAABB;
ComputeAABB(_local3, _arg2);
_local4 = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetFilterData(_arg1:b2FilterData):void{
m_filter = _arg1.Copy();
}
public function GetUserData(){
return (m_userData);
}
public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{
var _local4:b2AABB;
if (m_proxyId == b2Pair.b2_nullProxy){
return (false);
};
_local4 = s_syncAABB;
ComputeSweptAABB(_local4, _arg2, _arg3);
if (_arg1.InRange(_local4)){
_arg1.MoveProxy(m_proxyId, _local4);
return (true);
};
return (false);
}
public function ComputeMass(_arg1:b2MassData):void{
}
public function IsSensor():Boolean{
return (m_isSensor);
}
public function DestroyProxy(_arg1:b2BroadPhase):void{
if (m_proxyId != b2Pair.b2_nullProxy){
_arg1.DestroyProxy(m_proxyId);
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function UpdateSweepRadius(_arg1:b2Vec2):void{
}
public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
}
public function GetBody():b2Body{
return (m_body);
}
public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB;
var _local4:Boolean;
_local3 = s_proxyAABB;
ComputeAABB(_local3, _arg2);
_local4 = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public static function Destroy(_arg1:b2Shape, _arg2):void{
}
public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{
switch (_arg1.type){
case e_circleShape:
return (new b2CircleShape(_arg1));
case e_polygonShape:
return (new b2PolygonShape(_arg1));
default:
return (null);
};
}
}
}//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef)
package Box2D.Collision.Shapes {
public class b2ShapeDef {
public var isSensor:Boolean;// = false
public var density:Number;// = 0
public var type:int;// = -1
public var restitution:Number;// = 0
public var userData;// = null
public var filter:b2FilterData;
public var friction:Number;// = 0.2
public function b2ShapeDef(){
type = b2Shape.e_unknownShape;
userData = null;
friction = 0.2;
restitution = 0;
density = 0;
isSensor = false;
filter = new b2FilterData();
super();
}
}
}//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2AABB {
public var upperBound:b2Vec2;
public var lowerBound:b2Vec2;
public function b2AABB(){
lowerBound = new b2Vec2();
upperBound = new b2Vec2();
super();
}
public function IsValid():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:Boolean;
_local1 = (upperBound.x - lowerBound.x);
_local2 = (upperBound.y - lowerBound.y);
_local3 = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid()));
return (_local3);
}
}
}//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound)
package Box2D.Collision {
public class b2Bound {
public var proxyId:uint;
public var stabbingCount:uint;
public var value:uint;
public function Swap(_arg1:b2Bound):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
_local2 = value;
_local3 = proxyId;
_local4 = stabbingCount;
value = _arg1.value;
proxyId = _arg1.proxyId;
stabbingCount = _arg1.stabbingCount;
_arg1.value = _local2;
_arg1.proxyId = _local3;
_arg1.stabbingCount = _local4;
}
public function IsLower():Boolean{
return (((value & 1) == 0));
}
public function IsUpper():Boolean{
return (((value & 1) == 1));
}
}
}//package Box2D.Collision
Section 11
//b2BoundValues (Box2D.Collision.b2BoundValues)
package Box2D.Collision {
public class b2BoundValues {
public var lowerValues:Array;
public var upperValues:Array;
public function b2BoundValues(){
lowerValues = [0, 0];
upperValues = [0, 0];
super();
}
}
}//package Box2D.Collision
Section 12
//b2BroadPhase (Box2D.Collision.b2BroadPhase)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2BroadPhase {
public var m_quantizationFactor:b2Vec2;
public var m_worldAABB:b2AABB;
public var m_bounds:Array;
public var m_freeProxy:uint;
public var m_proxyCount:int;
public var m_proxyPool:Array;
public var m_queryResultCount:int;
public var m_pairManager:b2PairManager;
public var m_timeStamp:uint;
public var m_queryResults:Array;
public static const b2_nullEdge:uint = b2Settings.USHRT_MAX;
public static const b2_invalid:uint = b2Settings.USHRT_MAX;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:b2Proxy;
var _local7:int;
m_pairManager = new b2PairManager();
m_proxyPool = new Array(b2Settings.b2_maxPairs);
m_bounds = new Array((2 * b2Settings.b2_maxProxies));
m_queryResults = new Array(b2Settings.b2_maxProxies);
m_quantizationFactor = new b2Vec2();
super();
m_pairManager.Initialize(this, _arg2);
m_worldAABB = _arg1;
m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
m_queryResults[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
_local4 = (_arg1.upperBound.x - _arg1.lowerBound.x);
_local5 = (_arg1.upperBound.y - _arg1.lowerBound.y);
m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4);
m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5);
_local3 = 0;
while (_local3 < (b2Settings.b2_maxProxies - 1)) {
_local6 = new b2Proxy();
m_proxyPool[_local3] = _local6;
_local6.SetNext((_local3 + 1));
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
_local3++;
};
_local6 = new b2Proxy();
m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6;
_local6.SetNext(b2Pair.b2_nullProxy);
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
m_freeProxy = 0;
m_timeStamp = 1;
m_queryResultCount = 0;
}
public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{
var _local4:Array;
var _local5:Array;
var _local6:uint;
var _local7:uint;
var _local8:Array;
var _local9:Array;
var _local10:int;
var _local11:int;
var _local12:b2Proxy;
_local4 = new Array();
_local5 = new Array();
ComputeBounds(_local4, _local5, _arg1);
_local8 = [_local6];
_local9 = [_local7];
Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0);
Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1);
_local10 = 0;
_local11 = 0;
while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) {
_local12 = m_proxyPool[m_queryResults[_local11]];
_arg2[_local11] = _local12.userData;
_local11++;
_local10++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local10);
}
public function Commit():void{
m_pairManager.Commit();
}
public function GetProxy(_arg1:int):b2Proxy{
var _local2:b2Proxy;
_local2 = m_proxyPool[_arg1];
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){
return (null);
};
return (_local2);
}
private function IncrementTimeStamp():void{
var _local1:uint;
if (m_timeStamp == b2Settings.USHRT_MAX){
_local1 = 0;
while (_local1 < b2Settings.b2_maxProxies) {
(m_proxyPool[_local1] as b2Proxy).timeStamp = 0;
_local1++;
};
m_timeStamp = 1;
} else {
m_timeStamp++;
};
}
private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
var _local11:uint;
var _local12:int;
var _local13:int;
var _local14:b2Proxy;
_local8 = BinarySearch(_arg5, _arg6, _arg3);
_local9 = BinarySearch(_arg5, _arg6, _arg4);
_local11 = _local8;
while (_local11 < _local9) {
_local10 = _arg5[_local11];
if (_local10.IsLower()){
IncrementOverlapCount(_local10.proxyId);
};
_local11++;
};
if (_local8 > 0){
_local12 = (_local8 - 1);
_local10 = _arg5[_local12];
_local13 = _local10.stabbingCount;
while (_local13) {
_local10 = _arg5[_local12];
if (_local10.IsLower()){
_local14 = m_proxyPool[_local10.proxyId];
if (_local8 <= _local14.upperBounds[_arg7]){
IncrementOverlapCount(_local10.proxyId);
_local13--;
};
};
_local12--;
};
};
_arg1[0] = _local8;
_arg2[0] = _local9;
}
private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{
var _local3:int;
var _local4:Array;
var _local5:b2Bound;
var _local6:b2Bound;
_local3 = 0;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg1.lowerBounds[_local3]];
_local6 = _local4[_arg2.upperBounds[_local3]];
if (_local5.value > _local6.value){
return (false);
};
_local5 = _local4[_arg1.upperBounds[_local3]];
_local6 = _local4[_arg2.lowerBounds[_local3]];
if (_local5.value < _local6.value){
return (false);
};
_local3++;
};
return (true);
}
private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local4 = _arg3.lowerBound.x;
_local5 = _arg3.lowerBound.y;
_local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x);
_local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y);
_local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x);
_local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y);
_local6 = _arg3.upperBound.x;
_local7 = _arg3.upperBound.y;
_local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x);
_local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y);
_local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x);
_local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y);
_arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1));
_arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1);
_arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1));
_arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1);
}
public function CreateProxy(_arg1:b2AABB, _arg2):uint{
var _local3:uint;
var _local4:b2Proxy;
var _local5:uint;
var _local6:uint;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:int;
var _local11:Array;
var _local12:uint;
var _local13:uint;
var _local14:Array;
var _local15:Array;
var _local16:Array;
var _local17:int;
var _local18:int;
var _local19:b2Bound;
var _local20:b2Bound;
var _local21:b2Bound;
var _local22:int;
var _local23:b2Proxy;
_local5 = m_freeProxy;
_local4 = m_proxyPool[_local5];
m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
_local6 = (2 * m_proxyCount);
_local7 = new Array();
_local8 = new Array();
ComputeBounds(_local7, _local8, _arg1);
_local9 = 0;
while (_local9 < 2) {
_local11 = m_bounds[_local9];
_local14 = [_local12];
_local15 = [_local13];
Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9);
_local12 = _local14[0];
_local13 = _local15[0];
_local16 = new Array();
_local18 = (_local6 - _local13);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local13 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local13 + 2);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local16 = new Array();
_local18 = (_local13 - _local12);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local12 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local12 + 1);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local13++;
_local19 = _local11[_local12];
_local20 = _local11[_local13];
_local19.value = _local7[_local9];
_local19.proxyId = _local5;
_local20.value = _local8[_local9];
_local20.proxyId = _local5;
_local21 = _local11[int((_local12 - 1))];
_local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount;
_local21 = _local11[int((_local13 - 1))];
_local20.stabbingCount = _local21.stabbingCount;
_local3 = _local12;
while (_local3 < _local13) {
_local21 = _local11[_local3];
_local21.stabbingCount++;
_local3++;
};
_local3 = _local12;
while (_local3 < (_local6 + 2)) {
_local19 = _local11[_local3];
_local23 = m_proxyPool[_local19.proxyId];
if (_local19.IsLower()){
_local23.lowerBounds[_local9] = _local3;
} else {
_local23.upperBounds[_local9] = _local3;
};
_local3++;
};
_local9++;
};
m_proxyCount++;
_local10 = 0;
while (_local10 < m_queryResultCount) {
m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]);
_local10++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local5);
}
public function DestroyProxy(_arg1:uint):void{
var _local2:b2Bound;
var _local3:b2Bound;
var _local4:b2Proxy;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Array;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:Array;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:uint;
var _local18:int;
var _local19:b2Proxy;
_local4 = m_proxyPool[_arg1];
_local5 = (2 * m_proxyCount);
_local6 = 0;
while (_local6 < 2) {
_local8 = m_bounds[_local6];
_local9 = _local4.lowerBounds[_local6];
_local10 = _local4.upperBounds[_local6];
_local2 = _local8[_local9];
_local11 = _local2.value;
_local3 = _local8[_local10];
_local12 = _local3.value;
_local13 = new Array();
_local15 = ((_local10 - _local9) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local9 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = _local9;
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local13 = new Array();
_local15 = ((_local5 - _local10) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local10 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = (_local10 - 1);
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = (_local5 - 2);
_local17 = _local9;
while (_local17 < _local15) {
_local2 = _local8[_local17];
_local19 = m_proxyPool[_local2.proxyId];
if (_local2.IsLower()){
_local19.lowerBounds[_local6] = _local17;
} else {
_local19.upperBounds[_local6] = _local17;
};
_local17++;
};
_local15 = (_local10 - 1);
_local18 = _local9;
while (_local18 < _local15) {
_local2 = _local8[_local18];
_local2.stabbingCount--;
_local18++;
};
Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6);
_local6++;
};
_local7 = 0;
while (_local7 < m_queryResultCount) {
m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]);
_local7++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
_local4.userData = null;
_local4.overlapCount = b2_invalid;
_local4.lowerBounds[0] = b2_invalid;
_local4.lowerBounds[1] = b2_invalid;
_local4.upperBounds[0] = b2_invalid;
_local4.upperBounds[1] = b2_invalid;
_local4.SetNext(m_freeProxy);
m_freeProxy = _arg1;
m_proxyCount--;
}
public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{
var _local3:int;
var _local4:Array;
var _local5:b2Bound;
_local3 = 0;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg2.upperBounds[_local3]];
if (_arg1.lowerValues[_local3] > _local5.value){
return (false);
};
_local5 = _local4[_arg2.lowerBounds[_local3]];
if (_arg1.upperValues[_local3] < _local5.value){
return (false);
};
_local3++;
};
return (true);
}
public function Validate():void{
var _local1:b2Pair;
var _local2:b2Proxy;
var _local3:b2Proxy;
var _local4:Boolean;
var _local5:int;
var _local6:b2Bound;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
_local5 = 0;
while (_local5 < 2) {
_local6 = m_bounds[_local5];
_local7 = (2 * m_proxyCount);
_local8 = 0;
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local6[_local9];
if (_local10.IsLower() == true){
_local8++;
} else {
_local8--;
};
_local9++;
};
_local5++;
};
}
private function IncrementOverlapCount(_arg1:uint):void{
var _local2:b2Proxy;
_local2 = m_proxyPool[_arg1];
if (_local2.timeStamp < m_timeStamp){
_local2.timeStamp = m_timeStamp;
_local2.overlapCount = 1;
} else {
_local2.overlapCount = 2;
m_queryResults[m_queryResultCount] = _arg1;
m_queryResultCount++;
};
}
public function InRange(_arg1:b2AABB):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = _arg1.lowerBound.x;
_local3 = _arg1.lowerBound.y;
_local2 = (_local2 - m_worldAABB.upperBound.x);
_local3 = (_local3 - m_worldAABB.upperBound.y);
_local4 = m_worldAABB.lowerBound.x;
_local5 = m_worldAABB.lowerBound.y;
_local4 = (_local4 - _arg1.upperBound.x);
_local5 = (_local5 - _arg1.upperBound.y);
_local2 = b2Math.b2Max(_local2, _local4);
_local3 = b2Math.b2Max(_local3, _local5);
return ((b2Math.b2Max(_local2, _local3) < 0));
}
public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{
var _local3:Array;
var _local4:int;
var _local5:uint;
var _local6:uint;
var _local7:b2Bound;
var _local8:b2Bound;
var _local9:b2Bound;
var _local10:uint;
var _local11:b2Proxy;
var _local12:uint;
var _local13:b2Proxy;
var _local14:b2BoundValues;
var _local15:b2BoundValues;
var _local16:Array;
var _local17:uint;
var _local18:uint;
var _local19:uint;
var _local20:uint;
var _local21:int;
var _local22:int;
var _local23:uint;
var _local24:b2Proxy;
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){
return;
};
if (_arg2.IsValid() == false){
return;
};
_local12 = (2 * m_proxyCount);
_local13 = m_proxyPool[_arg1];
_local14 = new b2BoundValues();
ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2);
_local15 = new b2BoundValues();
_local5 = 0;
while (_local5 < 2) {
_local7 = m_bounds[_local5][_local13.lowerBounds[_local5]];
_local15.lowerValues[_local5] = _local7.value;
_local7 = m_bounds[_local5][_local13.upperBounds[_local5]];
_local15.upperValues[_local5] = _local7.value;
_local5++;
};
_local5 = 0;
while (_local5 < 2) {
_local16 = m_bounds[_local5];
_local17 = _local13.lowerBounds[_local5];
_local18 = _local13.upperBounds[_local5];
_local19 = _local14.lowerValues[_local5];
_local20 = _local14.upperValues[_local5];
_local7 = _local16[_local17];
_local21 = (_local19 - _local7.value);
_local7.value = _local19;
_local7 = _local16[_local18];
_local22 = (_local20 - _local7.value);
_local7.value = _local20;
if (_local21 < 0){
_local6 = _local17;
while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local8.proxyId];
_local8.stabbingCount++;
if (_local8.IsUpper() == true){
if (TestOverlap(_local14, _local24)){
m_pairManager.AddBufferedPair(_arg1, _local23);
};
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
if (_local22 > 0){
_local6 = _local18;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount++;
if (_local9.IsLower() == true){
if (TestOverlap(_local14, _local11)){
m_pairManager.AddBufferedPair(_arg1, _local10);
};
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local21 > 0){
_local6 = _local17;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount--;
if (_local9.IsUpper()){
if (TestOverlap(_local15, _local11)){
m_pairManager.RemoveBufferedPair(_arg1, _local10);
};
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local22 < 0){
_local6 = _local18;
while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local23];
_local8.stabbingCount--;
if (_local8.IsLower() == true){
if (TestOverlap(_local15, _local24)){
m_pairManager.RemoveBufferedPair(_arg1, _local23);
};
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
_local5++;
};
}
public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:b2Bound;
_local4 = 0;
_local5 = (_arg2 - 1);
while (_local4 <= _local5) {
_local6 = ((_local4 + _local5) / 2);
_local7 = _arg1[_local6];
if (_local7.value > _arg3){
_local5 = (_local6 - 1);
} else {
if (_local7.value < _arg3){
_local4 = (_local6 + 1);
} else {
return (uint(_local6));
};
};
};
return (uint(_local4));
}
}
}//package Box2D.Collision
Section 13
//b2BufferedPair (Box2D.Collision.b2BufferedPair)
package Box2D.Collision {
public class b2BufferedPair {
public var proxyId1:uint;
public var proxyId2:uint;
}
}//package Box2D.Collision
Section 14
//b2Collision (Box2D.Collision.b2Collision)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Collision {
public static const b2_nullFeature:uint = 0xFF;
private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2();
public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local6:int;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:Array;
var _local11:b2Mat22;
var _local12:b2Vec2;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:int;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_local6 = _arg1.m_vertexCount;
_local7 = _arg1.m_vertices;
_local8 = _arg1.m_normals;
_local9 = _arg4.m_vertexCount;
_local10 = _arg4.m_vertices;
_local11 = _arg2.R;
_local12 = _local8[_arg3];
_local13 = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y));
_local14 = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y));
_local11 = _arg5.R;
_local15 = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14));
_local16 = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14));
_local17 = 0;
_local18 = Number.MAX_VALUE;
_local19 = 0;
while (_local19 < _local9) {
_local12 = _local10[_local19];
_local25 = ((_local12.x * _local15) + (_local12.y * _local16));
if (_local25 < _local18){
_local18 = _local25;
_local17 = _local19;
};
_local19++;
};
_local12 = _local7[_arg3];
_local11 = _arg2.R;
_local20 = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
_local21 = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local12 = _local10[_local17];
_local11 = _arg5.R;
_local22 = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
_local23 = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local22 = (_local22 - _local20);
_local23 = (_local23 - _local21);
_local24 = ((_local22 * _local13) + (_local23 * _local14));
return (_local24);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = _arg2.lowerBound;
_local4 = _arg1.upperBound;
_local5 = (_local3.x - _local4.x);
_local6 = (_local3.y - _local4.y);
_local3 = _arg1.lowerBound;
_local4 = _arg2.upperBound;
_local7 = (_local3.x - _local4.x);
_local8 = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{
var _local7:int;
var _local8:Array;
var _local9:int;
var _local10:Array;
var _local11:Array;
var _local12:b2Mat22;
var _local13:b2Vec2;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:int;
var _local20:ClipVertex;
var _local21:int;
var _local22:int;
var _local23:Number;
_local7 = _arg2.m_vertexCount;
_local8 = _arg2.m_normals;
_local9 = _arg5.m_vertexCount;
_local10 = _arg5.m_vertices;
_local11 = _arg5.m_normals;
_local12 = _arg3.R;
_local13 = _local8[_arg4];
_local14 = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y));
_local15 = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y));
_local12 = _arg6.R;
_local16 = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15));
_local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15));
_local14 = _local16;
_local17 = 0;
_local18 = Number.MAX_VALUE;
_local19 = 0;
while (_local19 < _local9) {
_local13 = _local11[_local19];
_local23 = ((_local14 * _local13.x) + (_local15 * _local13.y));
if (_local23 < _local18){
_local18 = _local23;
_local17 = _local19;
};
_local19++;
};
_local21 = _local17;
_local22 = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0;
_local20 = _arg1[0];
_local13 = _local10[_local21];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local21;
_local20.id.features.incidentVertex = 0;
_local20 = _arg1[1];
_local13 = _local10[_local22];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local22;
_local20.id.features.incidentVertex = 1;
}
public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{
var _local6:ClipVertex;
var _local7:int;
var _local8:Array;
var _local9:Number;
var _local10:int;
var _local11:Array;
var _local12:Number;
var _local13:b2PolygonShape;
var _local14:b2PolygonShape;
var _local15:b2XForm;
var _local16:b2XForm;
var _local17:int;
var _local18:uint;
var _local19:Number;
var _local20:Number;
var _local21:Array;
var _local22:int;
var _local23:Array;
var _local24:b2Vec2;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:b2Vec2;
var _local28:b2Vec2;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Array;
var _local33:Array;
var _local34:int;
var _local35:int;
var _local36:int;
var _local37:b2Vec2;
var _local38:Number;
var _local39:b2ManifoldPoint;
_arg1.pointCount = 0;
_local7 = 0;
_local8 = [_local7];
_local9 = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5);
_local7 = _local8[0];
if (_local9 > 0){
return;
};
_local10 = 0;
_local11 = [_local10];
_local12 = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3);
_local10 = _local11[0];
if (_local12 > 0){
return;
};
_local15 = new b2XForm();
_local16 = new b2XForm();
_local19 = 0.98;
_local20 = 0.001;
if (_local12 > ((_local19 * _local9) + _local20)){
_local13 = _arg4;
_local14 = _arg2;
_local15.Set(_arg5);
_local16.Set(_arg3);
_local17 = _local10;
_local18 = 1;
} else {
_local13 = _arg2;
_local14 = _arg4;
_local15.Set(_arg3);
_local16.Set(_arg5);
_local17 = _local7;
_local18 = 0;
};
_local21 = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16);
_local22 = _local13.m_vertexCount;
_local23 = _local13.m_vertices;
_local24 = _local23[_local17];
_local25 = _local24.Copy();
if ((_local17 + 1) < _local22){
_local24 = _local23[int((_local17 + 1))];
_local37 = _local24.Copy();
} else {
_local24 = _local23[0];
_local37 = _local24.Copy();
};
_local26 = b2Math.SubtractVV(_local37, _local25);
_local27 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25));
_local27.Normalize();
_local28 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local37 = b2Math.b2MulX(_local15, _local37);
_local29 = b2Math.b2Dot(_local28, _local25);
_local30 = -(b2Math.b2Dot(_local27, _local25));
_local31 = b2Math.b2Dot(_local27, _local37);
_local32 = [new ClipVertex(), new ClipVertex()];
_local33 = [new ClipVertex(), new ClipVertex()];
_local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30);
if (_local34 < 2){
return;
};
_local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31);
if (_local34 < 2){
return;
};
_arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy();
_local35 = 0;
_local36 = 0;
while (_local36 < b2Settings.b2_maxManifoldPoints) {
_local6 = _local33[_local36];
_local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29);
if (_local38 <= 0){
_local39 = _arg1.points[_local35];
_local39.separation = _local38;
_local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local39.id.key = _local6.id._key;
_local39.id.features.flip = _local18;
_local35++;
};
_local36++;
};
_arg1.pointCount = _local35;
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local6:int;
var _local7:Array;
var _local8:b2Vec2;
var _local9:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:int;
var _local15:Number;
var _local16:int;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:int;
var _local21:Number;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:Number;
_local6 = _arg2.m_vertexCount;
_local7 = _arg2.m_normals;
_local9 = _arg5.R;
_local8 = _arg4.m_centroid;
_local10 = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)));
_local11 = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)));
_local9 = _arg3.R;
_local8 = _arg2.m_centroid;
_local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))));
_local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))));
_local12 = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y));
_local13 = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y));
_local14 = 0;
_local15 = -(Number.MAX_VALUE);
_local16 = 0;
while (_local16 < _local6) {
_local8 = _local7[_local16];
_local25 = ((_local8.x * _local12) + (_local8.y * _local13));
if (_local25 > _local15){
_local15 = _local25;
_local14 = _local16;
};
_local16++;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
_local18 = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1);
_local19 = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5);
if (_local19 > 0){
return (_local19);
};
_local20 = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0;
_local21 = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5);
if (_local21 > 0){
return (_local21);
};
if ((((_local19 > _local17)) && ((_local19 > _local21)))){
_local24 = -1;
_local22 = _local18;
_local23 = _local19;
} else {
if (_local21 > _local17){
_local24 = 1;
_local22 = _local20;
_local23 = _local21;
} else {
_arg1[0] = _local14;
return (_local17);
};
};
while (true) {
if (_local24 == -1){
_local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1);
} else {
_local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
if (_local17 > _local23){
_local22 = _local14;
_local23 = _local17;
} else {
break;
};
};
_arg1[0] = _local22;
return (_local23);
}
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:ClipVertex;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:b2Vec2;
var _local13:ClipVertex;
_local6 = 0;
_local5 = _arg2[0];
_local7 = _local5.v;
_local5 = _arg2[1];
_local8 = _local5.v;
_local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4);
_local10 = (b2Math.b2Dot(_arg3, _local8) - _arg4);
if (_local9 <= 0){
var _temp1 = _local6;
_local6 = (_local6 + 1);
var _local14 = _temp1;
_arg1[_local14] = _arg2[0];
};
if (_local10 <= 0){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_local14 = _temp2;
_arg1[_local14] = _arg2[1];
};
if ((_local9 * _local10) < 0){
_local11 = (_local9 / (_local9 - _local10));
_local5 = _arg1[_local6];
_local12 = _local5.v;
_local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x)));
_local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y)));
_local5 = _arg1[_local6];
if (_local9 > 0){
_local13 = _arg2[0];
_local5.id = _local13.id;
} else {
_local13 = _arg2[1];
_local5.id = _local13.id;
};
_local6++;
};
return (_local6);
}
public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2Mat22;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:b2ManifoldPoint;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_arg1.pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_localPosition;
_local8 = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
_local9 = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_localPosition;
_local10 = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
_local11 = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local12 = (_local10 - _local8);
_local13 = (_local11 - _local9);
_local14 = ((_local12 * _local12) + (_local13 * _local13));
_local15 = _arg2.m_radius;
_local16 = _arg4.m_radius;
_local17 = (_local15 + _local16);
if (_local14 > (_local17 * _local17)){
return;
};
if (_local14 < Number.MIN_VALUE){
_local18 = -(_local17);
_arg1.normal.Set(0, 1);
} else {
_local24 = Math.sqrt(_local14);
_local18 = (_local24 - _local17);
_local25 = (1 / _local24);
_arg1.normal.x = (_local25 * _local12);
_arg1.normal.y = (_local25 * _local13);
};
_arg1.pointCount = 1;
_local19 = _arg1.points[0];
_local19.id.key = 0;
_local19.separation = _local18;
_local8 = (_local8 + (_local15 * _arg1.normal.x));
_local9 = (_local9 + (_local15 * _arg1.normal.y));
_local10 = (_local10 - (_local16 * _arg1.normal.x));
_local11 = (_local11 - (_local16 * _arg1.normal.y));
_local20 = (0.5 * (_local8 + _local10));
_local21 = (0.5 * (_local9 + _local11));
_local22 = (_local20 - _arg3.position.x);
_local23 = (_local21 - _arg3.position.y);
_local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y));
_local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y));
_local22 = (_local20 - _arg5.position.x);
_local23 = (_local21 - _arg5.position.y);
_local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y));
_local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y));
}
public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2ManifoldPoint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local12:b2Mat22;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:Number;
var _local21:int;
var _local22:Array;
var _local23:Array;
var _local24:int;
var _local25:int;
var _local26:int;
var _local27:b2Vec2;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_arg1.pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_localPosition;
_local13 = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
_local14 = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)));
_local7 = (_local13 - _arg3.position.x);
_local8 = (_local14 - _arg3.position.y);
_local12 = _arg3.R;
_local15 = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local16 = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local18 = 0;
_local19 = -(Number.MAX_VALUE);
_local20 = _arg4.m_radius;
_local21 = _arg2.m_vertexCount;
_local22 = _arg2.m_vertices;
_local23 = _arg2.m_normals;
_local24 = 0;
while (_local24 < _local21) {
_local11 = _local22[_local24];
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local11 = _local23[_local24];
_local34 = ((_local11.x * _local7) + (_local11.y * _local8));
if (_local34 > _local20){
return;
};
if (_local34 > _local19){
_local19 = _local34;
_local18 = _local24;
};
_local24++;
};
if (_local19 < Number.MIN_VALUE){
_arg1.pointCount = 1;
_local11 = _local23[_local18];
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y));
_arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y));
_local6 = _arg1.points[0];
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local19 - _local20);
return;
};
_local25 = _local18;
_local26 = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
_local11 = _local22[_local25];
_local27 = _local22[_local26];
_local28 = (_local27.x - _local11.x);
_local29 = (_local27.y - _local11.y);
_local30 = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local31 = ((_local7 * _local28) + (_local8 * _local29));
_local6 = _arg1.points[0];
if (_local31 <= 0){
_local32 = _local11.x;
_local33 = _local11.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local25;
} else {
if (_local31 >= _local30){
_local32 = _local27.x;
_local33 = _local27.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local26;
} else {
_local32 = ((_local28 * _local31) + _local11.x);
_local33 = ((_local29 * _local31) + _local11.y);
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = 0;
};
};
_local7 = (_local15 - _local32);
_local8 = (_local16 - _local33);
_local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local7 / _local17);
_local8 = (_local8 / _local17);
if (_local17 > _local20){
return;
};
_arg1.pointCount = 1;
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8));
_arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8));
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local17 - _local20);
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
}
}
}//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID)
package Box2D.Collision {
public class b2ContactID {
public var _key:uint;
public var features:Features;
public function b2ContactID(){
features = new Features();
super();
features._m_id = this;
}
public function Set(_arg1:b2ContactID):void{
key = _arg1._key;
}
public function Copy():b2ContactID{
var _local1:b2ContactID;
_local1 = new b2ContactID();
_local1.key = key;
return (_local1);
}
public function get key():uint{
return (_key);
}
public function set key(_arg1:uint):void{
_key = _arg1;
features._referenceEdge = (_key & 0xFF);
features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF);
features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF);
features._flip = (((_key & 4278190080) >> 24) & 0xFF);
}
}
}//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2ContactPoint {
public var separation:Number;
public var normal:b2Vec2;
public var position:b2Vec2;
public var restitution:Number;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var id:b2ContactID;
public var friction:Number;
public var velocity:b2Vec2;
public function b2ContactPoint(){
position = new b2Vec2();
velocity = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Distance {
private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var gPoint:b2Point = new b2Point();
public static var g_GJK_Iterations:int = 0;
public static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{
var _local4:Number;
var _local5:int;
var _local6:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local4 = (100 * Number.MIN_VALUE);
_local5 = 0;
while (_local5 < _arg3) {
_local6 = _arg2[_local5];
_local7 = Math.abs((_arg1.x - _local6.x));
_local8 = Math.abs((_arg1.y - _local6.y));
_local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x));
_local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y));
if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){
return (true);
};
_local5++;
};
return (false);
}
public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{
var _local7:b2Vec2;
var _local8:Array;
var _local9:Array;
var _local10:Array;
var _local11:int;
var _local12:Number;
var _local13:int;
var _local14:int;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:int;
_local8 = s_p1s;
_local9 = s_p2s;
_local10 = s_points;
_local11 = 0;
_arg1.SetV(_arg3.GetFirstVertex(_arg4));
_arg2.SetV(_arg5.GetFirstVertex(_arg6));
_local12 = 0;
_local13 = 20;
_local14 = 0;
while (_local14 < _local13) {
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local17 = _arg3.Support(_arg4, _local15, _local16);
_local18 = _arg5.Support(_arg6, -(_local15), -(_local16));
_local12 = ((_local15 * _local15) + (_local16 * _local16));
_local19 = (_local18.x - _local17.x);
_local20 = (_local18.y - _local17.y);
_local21 = ((_local15 * _local19) + (_local16 * _local20));
if ((_local12 - ((_local15 * _local19) + (_local16 * _local20))) <= (0.01 * _local12)){
if (_local11 == 0){
_arg1.SetV(_local17);
_arg2.SetV(_local18);
};
g_GJK_Iterations = _local14;
return (Math.sqrt(_local12));
};
switch (_local11){
case 0:
_local7 = _local8[0];
_local7.SetV(_local17);
_local7 = _local9[0];
_local7.SetV(_local18);
_local7 = _local10[0];
_local7.x = _local19;
_local7.y = _local20;
_arg1.SetV(_local8[0]);
_arg2.SetV(_local9[0]);
_local11++;
break;
case 1:
_local7 = _local8[1];
_local7.SetV(_local17);
_local7 = _local9[1];
_local7.SetV(_local18);
_local7 = _local10[1];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessTwo(_arg1, _arg2, _local8, _local9, _local10);
break;
case 2:
_local7 = _local8[2];
_local7.SetV(_local17);
_local7 = _local9[2];
_local7.SetV(_local18);
_local7 = _local10[2];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessThree(_arg1, _arg2, _local8, _local9, _local10);
break;
};
if (_local11 == 3){
g_GJK_Iterations = _local14;
return (0);
};
_local22 = -(Number.MAX_VALUE);
_local23 = 0;
while (_local23 < _local11) {
_local7 = _local10[_local23];
_local22 = b2Math.b2Max(_local22, ((_local7.x * _local7.x) + (_local7.y * _local7.y)));
_local23++;
};
if ((((_local11 == 3)) || ((_local12 <= ((100 * Number.MIN_VALUE) * _local22))))){
g_GJK_Iterations = _local14;
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local12 = ((_local15 * _local15) + (_local16 * _local16));
return (Math.sqrt(_local12));
};
_local14++;
};
g_GJK_Iterations = _local13;
return (Math.sqrt(_local12));
}
public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local7 = _arg4.R;
_local8 = _arg3.m_localPosition;
_local9 = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local10 = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local7 = _arg6.R;
_local8 = _arg5.m_localPosition;
_local11 = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local12 = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local13 = (_local11 - _local9);
_local14 = (_local12 - _local10);
_local15 = ((_local13 * _local13) + (_local14 * _local14));
_local16 = (_arg3.m_radius - b2Settings.b2_toiSlop);
_local17 = (_arg5.m_radius - b2Settings.b2_toiSlop);
_local18 = (_local16 + _local17);
if (_local15 > (_local18 * _local18)){
_local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14)));
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_local20 = (_local19 - _local18);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = (_local11 - (_local17 * _local13));
_arg2.y = (_local12 - (_local17 * _local14));
return (_local20);
};
if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){
_local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14)));
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
};
_arg1.x = _local9;
_arg1.y = _local10;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
}
public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local14:b2Vec2;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg5[2];
_local9 = _arg3[0];
_local10 = _arg3[1];
_local11 = _arg3[2];
_local12 = _arg4[0];
_local13 = _arg4[1];
_local14 = _arg4[2];
_local15 = _local6.x;
_local16 = _local6.y;
_local17 = _local7.x;
_local18 = _local7.y;
_local19 = _local8.x;
_local20 = _local8.y;
_local21 = (_local17 - _local15);
_local22 = (_local18 - _local16);
_local23 = (_local19 - _local15);
_local24 = (_local20 - _local16);
_local25 = (_local19 - _local17);
_local26 = (_local20 - _local18);
_local27 = -(((_local15 * _local21) + (_local16 * _local22)));
_local28 = ((_local17 * _local21) + (_local18 * _local22));
_local29 = -(((_local15 * _local23) + (_local16 * _local24)));
_local30 = ((_local19 * _local23) + (_local20 * _local24));
_local31 = -(((_local17 * _local25) + (_local18 * _local26)));
_local32 = ((_local19 * _local25) + (_local20 * _local26));
if ((((_local30 <= 0)) && ((_local32 <= 0)))){
_arg1.SetV(_local11);
_arg2.SetV(_local14);
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (1);
};
_local33 = ((_local21 * _local24) - (_local22 * _local23));
_local34 = (_local33 * ((_local15 * _local18) - (_local16 * _local17)));
_local36 = (_local33 * ((_local17 * _local20) - (_local18 * _local19)));
if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){
_local35 = (_local31 / (_local31 + _local32));
_arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x)));
_arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y)));
_arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x)));
_arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y)));
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (2);
};
_local37 = (_local33 * ((_local19 * _local16) - (_local20 * _local15)));
if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){
_local35 = (_local29 / (_local29 + _local30));
_arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x)));
_arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y)));
_arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x)));
_arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y)));
_local10.SetV(_local11);
_local13.SetV(_local14);
_local7.SetV(_local8);
return (2);
};
_local38 = ((_local36 + _local37) + _local34);
_local38 = (1 / _local38);
_local39 = (_local36 * _local38);
_local40 = (_local37 * _local38);
_local41 = ((1 - _local39) - _local40);
_arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x));
_arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y));
_arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x));
_arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y));
return (3);
}
public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local9:b2Point;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local9 = gPoint;
_local8 = _arg5.m_localPosition;
_local7 = _arg6.R;
_local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local10 = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity);
_local11 = (_arg5.m_radius - b2Settings.b2_toiSlop);
if (_local10 > _local11){
_local10 = (_local10 - _local11);
_local12 = (_arg2.x - _arg1.x);
_local13 = (_arg2.y - _arg1.y);
_local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13)));
_local12 = (_local12 / _local14);
_local13 = (_local13 / _local14);
_arg2.x = (_arg2.x - (_local11 * _local12));
_arg2.y = (_arg2.y - (_local11 * _local13));
} else {
_local10 = 0;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
};
return (_local10);
}
public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{
var _local7:int;
var _local8:int;
_local7 = _arg3.m_type;
_local8 = _arg5.m_type;
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6));
};
return (0);
}
public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg3[0];
_local9 = _arg3[1];
_local10 = _arg4[0];
_local11 = _arg4[1];
_local12 = -(_local7.x);
_local13 = -(_local7.y);
_local14 = (_local6.x - _local7.x);
_local15 = (_local6.y - _local7.y);
_local16 = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
_local14 = (_local14 / _local16);
_local15 = (_local15 / _local16);
_local17 = ((_local12 * _local14) + (_local13 * _local15));
if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){
_arg1.SetV(_local9);
_arg2.SetV(_local11);
_local8.SetV(_local9);
_local10.SetV(_local11);
_local6.SetV(_local7);
return (1);
};
_local17 = (_local17 / _local16);
_arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x)));
_arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y)));
_arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x)));
_arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y)));
return (2);
}
}
}//package Box2D.Collision
Section 18
//b2Manifold (Box2D.Collision.b2Manifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Manifold {
public var points:Array;
public var pointCount:int;// = 0
public var normal:b2Vec2;
public function b2Manifold(){
var _local1:int;
pointCount = 0;
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ManifoldPoint();
_local1++;
};
normal = new b2Vec2();
}
public function Set(_arg1:b2Manifold):void{
var _local2:int;
pointCount = _arg1.pointCount;
_local2 = 0;
while (_local2 < b2Settings.b2_maxManifoldPoints) {
(points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]);
_local2++;
};
normal.SetV(_arg1.normal);
}
public function Reset():void{
var _local1:int;
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
normal.SetZero();
pointCount = 0;
}
}
}//package Box2D.Collision
Section 19
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2ManifoldPoint {
public var separation:Number;
public var localPoint2:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var localPoint1:b2Vec2;
public var id:b2ContactID;
public function b2ManifoldPoint(){
localPoint1 = new b2Vec2();
localPoint2 = new b2Vec2();
id = new b2ContactID();
super();
}
public function Set(_arg1:b2ManifoldPoint):void{
localPoint1.SetV(_arg1.localPoint1);
localPoint2.SetV(_arg1.localPoint2);
separation = _arg1.separation;
normalImpulse = _arg1.normalImpulse;
tangentImpulse = _arg1.tangentImpulse;
id.key = _arg1.id.key;
}
public function Reset():void{
localPoint1.SetZero();
localPoint2.SetZero();
separation = 0;
normalImpulse = 0;
tangentImpulse = 0;
id.key = 0;
}
}
}//package Box2D.Collision
Section 20
//b2OBB (Box2D.Collision.b2OBB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2OBB {
public var R:b2Mat22;
public var center:b2Vec2;
public var extents:b2Vec2;
public function b2OBB(){
R = new b2Mat22();
center = new b2Vec2();
extents = new b2Vec2();
super();
}
}
}//package Box2D.Collision
Section 21
//b2Pair (Box2D.Collision.b2Pair)
package Box2D.Collision {
import Box2D.Common.*;
public class b2Pair {
public var userData;// = null
public var proxyId1:uint;
public var proxyId2:uint;
public var status:uint;
public var next:uint;
public static var e_pairFinal:uint = 4;
public static var b2_tableMask:int = (b2_tableCapacity - 1);
public static var e_pairRemoved:uint = 2;
public static var b2_nullPair:uint = b2Settings.USHRT_MAX;
public static var e_pairBuffered:uint = 1;
public static var b2_nullProxy:uint = b2Settings.USHRT_MAX;
public static var b2_tableCapacity:int = b2Settings.b2_maxPairs;
public function b2Pair(){
userData = null;
super();
}
public function SetBuffered():void{
status = (status | e_pairBuffered);
}
public function IsBuffered():Boolean{
return (((status & e_pairBuffered) == e_pairBuffered));
}
public function IsFinal():Boolean{
return (((status & e_pairFinal) == e_pairFinal));
}
public function ClearRemoved():void{
status = (status & ~(e_pairRemoved));
}
public function SetFinal():void{
status = (status | e_pairFinal);
}
public function IsRemoved():Boolean{
return (((status & e_pairRemoved) == e_pairRemoved));
}
public function ClearBuffered():void{
status = (status & ~(e_pairBuffered));
}
public function SetRemoved():void{
status = (status | e_pairRemoved);
}
}
}//package Box2D.Collision
Section 22
//b2PairCallback (Box2D.Collision.b2PairCallback)
package Box2D.Collision {
public class b2PairCallback {
public function PairRemoved(_arg1, _arg2, _arg3):void{
}
public function PairAdded(_arg1, _arg2){
return (null);
}
}
}//package Box2D.Collision
Section 23
//b2PairManager (Box2D.Collision.b2PairManager)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PairManager {
public var m_pairCount:int;
public var m_pairBuffer:Array;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_pairBufferCount:int;
public var m_hashTable:Array;
public var m_broadPhase:b2BroadPhase;
public var m_freePair:uint;
public function b2PairManager(){
var _local1:uint;
super();
m_hashTable = new Array(b2Pair.b2_tableCapacity);
_local1 = 0;
while (_local1 < b2Pair.b2_tableCapacity) {
m_hashTable[_local1] = b2Pair.b2_nullPair;
_local1++;
};
m_pairs = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1] = new b2Pair();
_local1++;
};
m_pairBuffer = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairBuffer[_local1] = new b2BufferedPair();
_local1++;
};
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy;
m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy;
m_pairs[_local1].userData = null;
m_pairs[_local1].status = 0;
m_pairs[_local1].next = (_local1 + 1);
_local1++;
};
m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair;
m_pairCount = 0;
m_pairBufferCount = 0;
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:b2Pair;
var _local5:uint;
_local5 = m_hashTable[_arg3];
_local4 = m_pairs[_local5];
while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) {
_local5 = _local4.next;
_local4 = m_pairs[_local5];
};
if (_local5 == b2Pair.b2_nullPair){
return (null);
};
return (_local4);
}
private function Find(_arg1:uint, _arg2:uint):b2Pair{
var _local3:uint;
var _local4:uint;
if (_arg1 > _arg2){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
return (FindHash(_arg1, _arg2, _local3));
}
private function ValidateBuffer():void{
}
public function Commit():void{
var _local1:b2BufferedPair;
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:b2Pair;
var _local6:b2Proxy;
var _local7:b2Proxy;
_local3 = 0;
_local4 = m_broadPhase.m_proxyPool;
_local2 = 0;
while (_local2 < m_pairBufferCount) {
_local1 = m_pairBuffer[_local2];
_local5 = Find(_local1.proxyId1, _local1.proxyId2);
_local5.ClearBuffered();
_local6 = _local4[_local5.proxyId1];
_local7 = _local4[_local5.proxyId2];
if (_local5.IsRemoved()){
if (_local5.IsFinal() == true){
m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData);
};
_local1 = m_pairBuffer[_local3];
_local1.proxyId1 = _local5.proxyId1;
_local1.proxyId2 = _local5.proxyId2;
_local3++;
} else {
if (_local5.IsFinal() == false){
_local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData);
_local5.SetFinal();
};
};
_local2++;
};
_local2 = 0;
while (_local2 < _local3) {
_local1 = m_pairBuffer[_local2];
RemovePair(_local1.proxyId1, _local1.proxyId2);
_local2++;
};
m_pairBufferCount = 0;
if (b2BroadPhase.s_validate){
ValidateTable();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair;
_local4 = Find(_arg1, _arg2);
if (_local4 == null){
return;
};
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.SetRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function RemovePair(_arg1:uint, _arg2:uint){
var _local3:b2Pair;
var _local4:uint;
var _local5:uint;
var _local6:b2Pair;
var _local7:uint;
var _local8:uint;
var _local9:*;
if (_arg1 > _arg2){
_local7 = _arg1;
_arg1 = _arg2;
_arg2 = _local7;
};
_local4 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
_local5 = m_hashTable[_local4];
_local6 = null;
while (_local5 != b2Pair.b2_nullPair) {
if (Equals(m_pairs[_local5], _arg1, _arg2)){
_local8 = _local5;
_local3 = m_pairs[_local5];
if (_local6){
_local6.next = _local3.next;
} else {
m_hashTable[_local4] = _local3.next;
};
_local3 = m_pairs[_local8];
_local9 = _local3.userData;
_local3.next = m_freePair;
_local3.proxyId1 = b2Pair.b2_nullProxy;
_local3.proxyId2 = b2Pair.b2_nullProxy;
_local3.userData = null;
_local3.status = 0;
m_freePair = _local8;
m_pairCount--;
return (_local9);
} else {
_local6 = m_pairs[_local5];
_local5 = _local6.next;
};
};
return (null);
}
public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{
m_broadPhase = _arg1;
m_callback = _arg2;
}
public function AddBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair;
_local4 = AddPair(_arg1, _arg2);
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.ClearRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function AddPair(_arg1:uint, _arg2:uint):b2Pair{
var _local3:uint;
var _local4:b2Pair;
var _local5:uint;
var _local6:uint;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
_local4 = FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
_local5 = m_freePair;
_local4 = m_pairs[_local5];
m_freePair = _local4.next;
_local4.proxyId1 = _arg1;
_local4.proxyId2 = _arg2;
_local4.status = 0;
_local4.userData = null;
_local4.next = m_hashTable[_local3];
m_hashTable[_local3] = _local5;
m_pairCount++;
return (_local4);
}
private function ValidateTable():void{
}
public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{
return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2))));
}
public static function Hash(_arg1:uint, _arg2:uint):uint{
var _local3:uint;
_local3 = (((_arg2 << 16) & 4294901760) | _arg1);
_local3 = (~(_local3) + ((_local3 << 15) & 4294934528));
_local3 = (_local3 ^ ((_local3 >> 12) & 1048575));
_local3 = (_local3 + ((_local3 << 2) & 4294967292));
_local3 = (_local3 ^ ((_local3 >> 4) & 268435455));
_local3 = (_local3 * 2057);
_local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF));
return (_local3);
}
public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{
return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3))));
}
}
}//package Box2D.Collision
Section 24
//b2Point (Box2D.Collision.b2Point)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2Point {
public var p:b2Vec2;
public function b2Point(){
p = new b2Vec2();
super();
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (p);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
return (p);
}
}
}//package Box2D.Collision
Section 25
//b2Proxy (Box2D.Collision.b2Proxy)
package Box2D.Collision {
public class b2Proxy {
public var overlapCount:uint;
public var lowerBounds:Array;
public var upperBounds:Array;
public var userData;// = null
public var timeStamp:uint;
public function b2Proxy(){
lowerBounds = [uint(0), uint(0)];
upperBounds = [uint(0), uint(0)];
userData = null;
super();
}
public function GetNext():uint{
return (lowerBounds[0]);
}
public function IsValid():Boolean{
return (!((overlapCount == b2BroadPhase.b2_invalid)));
}
public function SetNext(_arg1:uint):void{
lowerBounds[0] = (_arg1 & 0xFFFF);
}
}
}//package Box2D.Collision
Section 26
//b2Segment (Box2D.Collision.b2Segment)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2Segment {
public var p1:b2Vec2;
public var p2:b2Vec2;
public function b2Segment(){
p1 = new b2Vec2();
p2 = new b2Vec2();
super();
}
public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
_local5 = _arg3.p1;
_local6 = (_arg3.p2.x - _local5.x);
_local7 = (_arg3.p2.y - _local5.y);
_local8 = (p2.x - p1.x);
_local9 = (p2.y - p1.y);
_local10 = _local9;
_local11 = -(_local8);
_local12 = (100 * Number.MIN_VALUE);
_local13 = -(((_local6 * _local10) + (_local7 * _local11)));
if (_local13 > _local12){
_local14 = (_local5.x - p1.x);
_local15 = (_local5.y - p1.y);
_local16 = ((_local14 * _local10) + (_local15 * _local11));
if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){
_local17 = ((-(_local7) * _local15) + (_local7 * _local14));
if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){
_local16 = (_local16 / _local13);
_local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
_local10 = (_local10 / _local18);
_local11 = (_local11 / _local18);
_arg1[0] = _local16;
_arg2.Set(_local10, _local11);
return (true);
};
};
};
return (false);
}
}
}//package Box2D.Collision
Section 27
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2TimeOfImpact {
public static var s_xf1:b2XForm = new b2XForm();
public static var s_xf2:b2XForm = new b2XForm();
public static var s_p1:b2Vec2 = new b2Vec2();
public static var s_p2:b2Vec2 = new b2Vec2();
public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:int;
var _local20:int;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:b2XForm;
var _local27:b2XForm;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
_local7 = _arg1.m_sweepRadius;
_local8 = _arg3.m_sweepRadius;
_local9 = _arg2.t0;
_local10 = (_arg2.c.x - _arg2.c0.x);
_local11 = (_arg2.c.y - _arg2.c0.y);
_local12 = (_arg4.c.x - _arg4.c0.x);
_local13 = (_arg4.c.y - _arg4.c0.y);
_local14 = (_arg2.a - _arg2.a0);
_local15 = (_arg4.a - _arg4.a0);
_local16 = 0;
_local17 = s_p1;
_local18 = s_p2;
_local19 = 20;
_local20 = 0;
_local21 = 0;
_local22 = 0;
_local23 = 0;
_local24 = 0;
while (true) {
_local25 = (((1 - _local16) * _local9) + _local16);
_local26 = s_xf1;
_local27 = s_xf2;
_arg2.GetXForm(_local26, _local25);
_arg4.GetXForm(_local27, _local25);
_local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27);
if (_local20 == 0){
if (_local23 > (2 * b2Settings.b2_toiSlop)){
_local24 = (1.5 * b2Settings.b2_toiSlop);
} else {
_local5 = (0.05 * b2Settings.b2_toiSlop);
_local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop));
_local24 = ((_local5 > _local6)) ? _local5 : _local6;
};
};
if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){
break;
};
_local21 = (_local18.x - _local17.x);
_local22 = (_local18.y - _local17.y);
_local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22)));
_local21 = (_local21 / _local28);
_local22 = (_local22 / _local28);
_local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8));
if (_local29 == 0){
_local16 = 1;
break;
};
_local30 = ((_local23 - _local24) / _local29);
_local31 = (_local16 + _local30);
if ((((_local31 < 0)) || ((1 < _local31)))){
_local16 = 1;
break;
};
if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){
break;
};
_local16 = _local31;
_local20++;
};
return (_local16);
}
}
}//package Box2D.Collision
Section 28
//ClipVertex (Box2D.Collision.ClipVertex)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class ClipVertex {
public var v:b2Vec2;
public var id:b2ContactID;
public function ClipVertex(){
v = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features)
package Box2D.Collision {
public class Features {
public var _referenceEdge:int;
public var _incidentEdge:int;
public var _flip:int;
public var _incidentVertex:int;
public var _m_id:b2ContactID;
public function get referenceEdge():int{
return (_referenceEdge);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
public function get flip():int{
return (_flip);
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set referenceEdge(_arg1:int):void{
_referenceEdge = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF));
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
}
}//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22)
package Box2D.Common.Math {
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){
var _local4:Number;
var _local5:Number;
col1 = new b2Vec2();
col2 = new b2Vec2();
super();
if (((!((_arg2 == null))) && (!((_arg3 == null))))){
col1.SetV(_arg2);
col2.SetV(_arg3);
} else {
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
col1.x = _local4;
col2.x = -(_local5);
col1.y = _local5;
col2.y = _local4;
};
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function Set(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function SetM(_arg1:b2Mat22):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = col1.x;
_local3 = col2.x;
_local4 = col1.y;
_local5 = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
_local6 = (1 / _local6);
_arg1.col1.x = (_local6 * _local5);
_arg1.col2.x = (-(_local6) * _local3);
_arg1.col1.y = (-(_local6) * _local4);
_arg1.col2.y = (_local6 * _local2);
return (_arg1);
}
public function GetAngle():Number{
return (Math.atan2(col1.y, col1.x));
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = col1.x;
_local5 = col2.x;
_local6 = col1.y;
_local7 = col2.y;
_local8 = ((_local4 * _local7) - (_local5 * _local6));
_local8 = (1 / _local8);
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
}
}//package Box2D.Common.Math
Section 31
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1));
public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity);
public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0);
public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = b2MulMV(_arg1.R, _arg2);
_local3.x = (_local3.x + _arg1.position.x);
_local3.y = (_local3.y + _arg1.position.y);
return (_local3);
}
public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:*;
_local3 = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22;
_local2 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
_local3 = SubtractVV(_arg2, _arg1.position);
_local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y));
_local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y));
_local3.x = _local4;
return (_local3);
}
public static function b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2;
_local2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2Mat22;
_local3 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
_local4 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
_local5 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean;
_local2 = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2NextPowerOfTwo(_arg1:uint):uint{
_arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647));
_arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823));
_arg1 = (_arg1 | ((_arg1 >> 4) & 268435455));
_arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF));
_arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF));
return ((_arg1 + 1));
}
public static function b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
}
}//package Box2D.Common.Math
Section 32
//b2Sweep (Box2D.Common.Math.b2Sweep)
package Box2D.Common.Math {
public class b2Sweep {
public var localCenter:b2Vec2;
public var c:b2Vec2;
public var a:Number;
public var c0:b2Vec2;
public var a0:Number;
public var t0:Number;
public function b2Sweep(){
localCenter = new b2Vec2();
c0 = new b2Vec2();
c = new b2Vec2();
super();
}
public function Advance(_arg1:Number):void{
var _local2:Number;
if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){
_local2 = ((_arg1 - t0) / (1 - t0));
c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x));
c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y));
a0 = (((1 - _local2) * a0) + (_local2 * a));
t0 = _arg1;
};
}
public function GetXForm(_arg1:b2XForm, _arg2:Number):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
if ((1 - t0) > Number.MIN_VALUE){
_local4 = ((_arg2 - t0) / (1 - t0));
_arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x));
_arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y));
_local5 = (((1 - _local4) * a0) + (_local4 * a));
_arg1.R.Set(_local5);
} else {
_arg1.position.SetV(c);
_arg1.R.Set(a);
};
_local3 = _arg1.R;
_arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y)));
_arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y)));
}
}
}//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2)
package Box2D.Common.Math {
public class b2Vec2 {
public var x:Number;
public var y:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function LengthSquared():Number{
return (((x * x) + (y * y)));
}
public function SetZero():void{
x = 0;
y = 0;
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function CrossVF(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function Normalize():Number{
var _local1:Number;
var _local2:Number;
_local1 = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
_local2 = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm)
package Box2D.Common.Math {
public class b2XForm {
public var R:b2Mat22;
public var position:b2Vec2;
public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{
position = new b2Vec2();
R = new b2Mat22();
super();
if (_arg1){
position.SetV(_arg1);
R.SetM(_arg2);
};
}
public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{
position.SetV(_arg1);
R.SetM(_arg2);
}
public function Set(_arg1:b2XForm):void{
position.SetV(_arg1.position);
R.SetM(_arg1.R);
}
public function SetIdentity():void{
position.SetZero();
R.SetIdentity();
}
}
}//package Box2D.Common.Math
Section 35
//b2Color (Box2D.Common.b2Color)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Color {
private var _g:uint;// = 0
private var _b:uint;// = 0
private var _r:uint;// = 0
public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){
_r = 0;
_g = 0;
_b = 0;
super();
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function get color():uint{
return (((_r | (_g << 8)) | (_b << 16)));
}
public function set r(_arg1:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set b(_arg1:Number):void{
_b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set g(_arg1:Number):void{
_g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
}
}//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static const b2_linearSleepTolerance:Number = 0.01;
public static const b2_angularSlop:Number = 0.0349065850398866;
public static const b2_linearSlop:Number = 0.005;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_maxProxies:int = 0x0200;
public static const b2_maxAngularVelocitySquared:Number = 62500;
public static const b2_maxPolygonVertices:int = 8;
public static const b2_velocityThreshold:Number = 1;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_maxPairs:int = 4096;
public static const b2_maxTOIContactsPerIsland:int = 32;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_maxAngularVelocity:Number = 250;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_maxLinearVelocity:Number = 200;
public static const b2_maxLinearCorrection:Number = 0.2;
public static const b2_toiSlop:Number = 0.04;
public static const b2_maxLinearVelocitySquared:Number = 40000;
public static function b2Assert(_arg1:Boolean):void{
var _local2:b2Vec2;
if (!_arg1){
_local2.x++;
};
}
}
}//package Box2D.Common
Section 37
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
public class b2CircleContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
var _local3:b2ManifoldPoint;
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
_local3 = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactPoint;
var _local8:b2ManifoldPoint;
_local5 = m_shape1.m_body;
_local6 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf);
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
m_manifoldCount = 1;
_local8 = m_manifold.points[0];
if (m0.pointCount == 0){
_local8.normalImpulse = 0;
_local8.tangentImpulse = 0;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Add(_local7);
};
} else {
_local4 = m0.points[0];
_local8.normalImpulse = _local4.normalImpulse;
_local8.tangentImpulse = _local4.tangentImpulse;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Persist(_local7);
};
};
} else {
m_manifoldCount = 0;
if ((((m0.pointCount > 0)) && (_arg1))){
_local4 = m0.points[0];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2CircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Contact {
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_prev:b2Contact;
public var m_toi:Number;
public var m_next:b2Contact;
public var m_friction:Number;
public var m_manifoldCount:int;
public var m_node1:b2ContactEdge;
public var m_node2:b2ContactEdge;
public var m_restitution:Number;
public var m_flags:uint;
public static var e_toiFlag:uint = 8;
public static var e_nonSolidFlag:uint = 1;
public static var e_slowFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var s_registers:Array;
public static var s_initialized:Boolean = false;
public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){
m_node1 = new b2ContactEdge();
m_node2 = new b2ContactEdge();
super();
m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
m_shape1 = null;
m_shape2 = null;
return;
};
if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){
m_flags = (m_flags | e_nonSolidFlag);
};
m_shape1 = _arg1;
m_shape2 = _arg2;
m_manifoldCount = 0;
m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction));
m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution);
m_prev = null;
m_next = null;
m_node1.contact = null;
m_node1.prev = null;
m_node1.next = null;
m_node1.other = null;
m_node2.contact = null;
m_node2.prev = null;
m_node2.next = null;
m_node2.other = null;
}
public function GetShape1():b2Shape{
return (m_shape1);
}
public function IsSolid():Boolean{
return (((m_flags & e_nonSolidFlag) == 0));
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetManifolds():Array{
return (null);
}
public function GetShape2():b2Shape{
return (m_shape2);
}
public function GetManifoldCount():int{
return (m_manifoldCount);
}
public function Update(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:int;
var _local4:b2Body;
var _local5:b2Body;
_local2 = m_manifoldCount;
Evaluate(_arg1);
_local3 = m_manifoldCount;
_local4 = m_shape1.m_body;
_local5 = m_shape2.m_body;
if ((((_local3 == 0)) && ((_local2 > 0)))){
_local4.WakeUp();
_local5.WakeUp();
};
if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){
m_flags = (m_flags & ~(e_slowFlag));
} else {
m_flags = (m_flags | e_slowFlag);
};
}
public function Evaluate(_arg1:b2ContactListener):void{
}
public static function InitializeRegisters():void{
var _local1:int;
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
_local1 = 0;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_registers[_local1][_local2] = new b2ContactRegister();
_local2++;
};
_local1++;
};
AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape);
AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape);
AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
var _local3:int;
var _local4:int;
var _local5:b2ContactRegister;
var _local6:Function;
if (_arg1.m_manifoldCount > 0){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
_local3 = _arg1.m_shape1.m_type;
_local4 = _arg1.m_shape2.m_type;
_local5 = s_registers[_local3][_local4];
_local6 = _local5.destroyFcn;
_local6(_arg1, _arg2);
}
public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{
s_registers[_arg3][_arg4].createFcn = _arg1;
s_registers[_arg3][_arg4].destroyFcn = _arg2;
s_registers[_arg3][_arg4].primary = true;
if (_arg3 != _arg4){
s_registers[_arg4][_arg3].createFcn = _arg1;
s_registers[_arg4][_arg3].destroyFcn = _arg2;
s_registers[_arg4][_arg3].primary = false;
};
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local4:int;
var _local5:int;
var _local6:b2ContactRegister;
var _local7:Function;
var _local8:b2Contact;
var _local9:int;
var _local10:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
_local4 = _arg1.m_type;
_local5 = _arg2.m_type;
_local6 = s_registers[_local4][_local5];
_local7 = _local6.createFcn;
if (_local7 != null){
if (_local6.primary){
return (_local7(_arg1, _arg2, _arg3));
};
_local8 = _local7(_arg2, _arg1, _arg3);
_local9 = 0;
while (_local9 < _local8.m_manifoldCount) {
_local10 = _local8.GetManifolds()[_local9];
_local8.GetManifolds()[_local9].normal = _local10.normal.Negative();
_local9++;
};
return (_local8);
//unresolved jump
};
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 39
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var restitution:Number;
public var body1:b2Body;
public var manifold:b2Manifold;
public var normal:b2Vec2;
public var body2:b2Body;
public var friction:Number;
public var pointCount:int;
public function b2ContactConstraint(){
var _local1:int;
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var r2:b2Vec2;
public var separation:Number;
public var positionImpulse:Number;
public var normalImpulse:Number;
public var equalizedMass:Number;
public var tangentMass:Number;
public var tangentImpulse:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var normalMass:Number;
public var velocityBias:Number;
public var r1:b2Vec2;
public function b2ContactConstraintPoint(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
r1 = new b2Vec2();
r2 = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2ContactEdge {
public var next:b2ContactEdge;
public var other:b2Body;
public var contact:b2Contact;
public var prev:b2ContactEdge;
}
}//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var primary:Boolean;
public var createFcn:Function;
public var destroyFcn:Function;
}
}//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2ContactResult {
public var normal:b2Vec2;
public var position:b2Vec2;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ContactResult(){
position = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2ContactSolver {
public var m_constraintCount:int;
public var m_constraints:Array;
public var m_allocator;
public var m_step:b2TimeStep;
public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){
var _local5:b2Contact;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _local9:int;
var _local10:b2Body;
var _local11:b2Body;
var _local12:int;
var _local13:Array;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:int;
var _local23:b2Manifold;
var _local24:Number;
var _local25:Number;
var _local26:b2ContactConstraint;
var _local27:uint;
var _local28:b2ManifoldPoint;
var _local29:b2ContactConstraintPoint;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:Number;
var _local44:Number;
var _local45:Number;
var _local46:Number;
var _local47:Number;
m_step = new b2TimeStep();
m_constraints = new Array();
super();
m_step.dt = _arg1.dt;
m_step.inv_dt = _arg1.inv_dt;
m_step.maxIterations = _arg1.maxIterations;
m_allocator = _arg4;
m_constraintCount = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
m_constraintCount = (m_constraintCount + _local5.m_manifoldCount);
_local6++;
};
_local6 = 0;
while (_local6 < m_constraintCount) {
m_constraints[_local6] = new b2ContactConstraint();
_local6++;
};
_local9 = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
_local10 = _local5.m_shape1.m_body;
_local11 = _local5.m_shape2.m_body;
_local12 = _local5.m_manifoldCount;
_local13 = _local5.GetManifolds();
_local14 = _local5.m_friction;
_local15 = _local5.m_restitution;
_local16 = _local10.m_linearVelocity.x;
_local17 = _local10.m_linearVelocity.y;
_local18 = _local11.m_linearVelocity.x;
_local19 = _local11.m_linearVelocity.y;
_local20 = _local10.m_angularVelocity;
_local21 = _local11.m_angularVelocity;
_local22 = 0;
while (_local22 < _local12) {
_local23 = _local13[_local22];
_local24 = _local23.normal.x;
_local25 = _local23.normal.y;
_local26 = m_constraints[_local9];
_local26.body1 = _local10;
_local26.body2 = _local11;
_local26.manifold = _local23;
_local26.normal.x = _local24;
_local26.normal.y = _local25;
_local26.pointCount = _local23.pointCount;
_local26.friction = _local14;
_local26.restitution = _local15;
_local27 = 0;
while (_local27 < _local26.pointCount) {
_local28 = _local23.points[_local27];
_local29 = _local26.points[_local27];
_local29.normalImpulse = _local28.normalImpulse;
_local29.tangentImpulse = _local28.tangentImpulse;
_local29.separation = _local28.separation;
_local29.positionImpulse = 0;
_local29.localAnchor1.SetV(_local28.localPoint1);
_local29.localAnchor2.SetV(_local28.localPoint2);
_local8 = _local10.m_xf.R;
_local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x);
_local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33));
_local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33));
_local32 = _local30;
_local29.r1.Set(_local32, _local33);
_local8 = _local11.m_xf.R;
_local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x);
_local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35));
_local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35));
_local34 = _local30;
_local29.r2.Set(_local34, _local35);
_local36 = ((_local32 * _local32) + (_local33 * _local33));
_local37 = ((_local34 * _local34) + (_local35 * _local35));
_local38 = ((_local32 * _local24) + (_local33 * _local25));
_local39 = ((_local34 * _local24) + (_local35 * _local25));
_local40 = (_local10.m_invMass + _local11.m_invMass);
_local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39)))));
_local29.normalMass = (1 / _local40);
_local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass));
_local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39)))));
_local29.equalizedMass = (1 / _local41);
_local42 = _local25;
_local43 = -(_local24);
_local44 = ((_local32 * _local42) + (_local33 * _local43));
_local45 = ((_local34 * _local42) + (_local35 * _local43));
_local46 = (_local10.m_invMass + _local11.m_invMass);
_local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45)))));
_local29.tangentMass = (1 / _local46);
_local29.velocityBias = 0;
if (_local29.separation > 0){
_local29.velocityBias = (-60 * _local29.separation);
};
_local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33));
_local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32));
_local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31));
if (_local47 < -(b2Settings.b2_velocityThreshold)){
_local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47));
};
_local27++;
};
_local9++;
_local22++;
};
_local6++;
};
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local5:int;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:b2ContactConstraintPoint;
var _local21:Number;
var _local22:Number;
var _local23:b2ContactConstraintPoint;
_local5 = 0;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_invMass;
_local10 = _local7.m_invI;
_local11 = _local8.m_invMass;
_local12 = _local8.m_invI;
_local13 = _local6.normal.x;
_local14 = _local6.normal.y;
_local15 = _local14;
_local16 = -(_local13);
if (_arg1.warmStarting){
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local20 = _local6.points[_local18];
_local6.points[_local18].normalImpulse = (_local20.normalImpulse * _arg1.dtRatio);
_local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio);
_local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15));
_local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16));
_local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.r1.x * _local22) - (_local20.r1.y * _local21))));
_local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21));
_local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22));
_local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.r2.x * _local22) - (_local20.r2.y * _local21))));
_local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21));
_local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22));
_local18++;
};
} else {
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local23 = _local6.points[_local18];
_local23.normalImpulse = 0;
_local23.tangentImpulse = 0;
_local18++;
};
};
_local5++;
};
}
public function SolvePositionConstraints(_arg1:Number):Boolean{
var _local2:Number;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:int;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:b2Vec2;
var _local10:Number;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:int;
var _local20:int;
var _local21:b2ContactConstraintPoint;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
_local2 = 0;
_local5 = 0;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_sweep.c;
_local10 = _local7.m_sweep.a;
_local11 = _local8.m_sweep.c;
_local12 = _local8.m_sweep.a;
_local13 = (_local7.m_mass * _local7.m_invMass);
_local14 = (_local7.m_mass * _local7.m_invI);
_local15 = (_local8.m_mass * _local8.m_invMass);
_local16 = (_local8.m_mass * _local8.m_invI);
_local17 = _local6.normal.x;
_local18 = _local6.normal.y;
_local19 = _local6.pointCount;
_local20 = 0;
while (_local20 < _local19) {
_local21 = _local6.points[_local20];
_local3 = _local7.m_xf.R;
_local4 = _local7.m_sweep.localCenter;
_local22 = (_local21.localAnchor1.x - _local4.x);
_local23 = (_local21.localAnchor1.y - _local4.y);
_local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23));
_local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23));
_local22 = _local26;
_local3 = _local8.m_xf.R;
_local4 = _local8.m_sweep.localCenter;
_local24 = (_local21.localAnchor2.x - _local4.x);
_local25 = (_local21.localAnchor2.y - _local4.y);
_local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25));
_local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25));
_local24 = _local26;
_local27 = (_local9.x + _local22);
_local28 = (_local9.y + _local23);
_local29 = (_local11.x + _local24);
_local30 = (_local11.y + _local25);
_local31 = (_local29 - _local27);
_local32 = (_local30 - _local28);
_local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation);
_local2 = b2Math.b2Min(_local2, _local33);
_local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0));
_local35 = (-(_local21.equalizedMass) * _local34);
_local36 = _local21.positionImpulse;
_local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0);
_local35 = (_local21.positionImpulse - _local36);
_local37 = (_local35 * _local17);
_local38 = (_local35 * _local18);
_local9.x = (_local9.x - (_local13 * _local37));
_local9.y = (_local9.y - (_local13 * _local38));
_local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37))));
_local7.m_sweep.a = _local10;
_local7.SynchronizeTransform();
_local11.x = (_local11.x + (_local15 * _local37));
_local11.y = (_local11.y + (_local15 * _local38));
_local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37))));
_local8.m_sweep.a = _local12;
_local8.SynchronizeTransform();
_local20++;
};
_local5++;
};
return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop)));
}
public function SolveVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraintPoint;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:b2Mat22;
var _local18:b2Vec2;
var _local19:int;
var _local20:b2ContactConstraint;
var _local21:b2Body;
var _local22:b2Body;
var _local23:Number;
var _local24:Number;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:int;
var _local38:Number;
_local19 = 0;
while (_local19 < m_constraintCount) {
_local20 = m_constraints[_local19];
_local21 = _local20.body1;
_local22 = _local20.body2;
_local23 = _local21.m_angularVelocity;
_local24 = _local22.m_angularVelocity;
_local25 = _local21.m_linearVelocity;
_local26 = _local22.m_linearVelocity;
_local27 = _local21.m_invMass;
_local28 = _local21.m_invI;
_local29 = _local22.m_invMass;
_local30 = _local22.m_invI;
_local31 = _local20.normal.x;
_local32 = _local20.normal.y;
_local33 = _local32;
_local34 = -(_local31);
_local35 = _local20.friction;
_local37 = _local20.pointCount;
_local1 = 0;
while (_local1 < _local37) {
_local2 = _local20.points[_local1];
_local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y));
_local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x));
_local9 = ((_local7 * _local31) + (_local8 * _local32));
_local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias));
_local10 = ((_local7 * _local33) + (_local8 * _local34));
_local12 = (_local2.tangentMass * -(_local10));
_local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0);
_local11 = (_local13 - _local2.normalImpulse);
_local38 = (_local35 * _local2.normalImpulse);
_local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38);
_local12 = (_local14 - _local2.tangentImpulse);
_local15 = ((_local11 * _local31) + (_local12 * _local33));
_local16 = ((_local11 * _local32) + (_local12 * _local34));
_local25.x = (_local25.x - (_local27 * _local15));
_local25.y = (_local25.y - (_local27 * _local16));
_local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15))));
_local26.x = (_local26.x + (_local29 * _local15));
_local26.y = (_local26.y + (_local29 * _local16));
_local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15))));
_local2.normalImpulse = _local13;
_local2.tangentImpulse = _local14;
_local1++;
};
_local21.m_angularVelocity = _local23;
_local22.m_angularVelocity = _local24;
_local19++;
};
}
public function FinalizeVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
_local1 = 0;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2NullContact extends b2Contact {
override public function GetManifolds():Array{
return (null);
}
override public function Evaluate(_arg1:b2ContactListener):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2PolyAndCircleContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
var _local3:b2ManifoldPoint;
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape));
b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape));
m_manifold.pointCount = 0;
_local3 = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2ManifoldPoint;
var _local6:b2Body;
var _local7:b2Body;
var _local8:Array;
var _local9:b2ContactPoint;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
_local6 = m_shape1.m_body;
_local7 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf);
_local8 = [false, false];
_local9 = s_evalCP;
_local9.shape1 = m_shape1;
_local9.shape2 = m_shape2;
_local9.friction = m_friction;
_local9.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local2 = 0;
while (_local2 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local2];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local8[_local13] == true){
} else {
_local5 = m0.points[_local13];
if (_local5.id._key == _local12){
_local8[_local13] = true;
_local10.normalImpulse = _local5.normalImpulse;
_local10.tangentImpulse = _local5.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Persist(_local9);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Add(_local9);
};
_local2++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local2 = 0;
while (_local2 < m0.pointCount) {
if (_local8[_local2]){
} else {
_local5 = m0.points[_local2];
_local9.position = _local6.GetWorldPoint(_local5.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m0.normal);
_local9.separation = _local5.separation;
_local9.id.key = _local5.id._key;
_arg1.Remove(_local9);
};
_local2++;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndCircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
public class b2PolygonContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{
m0 = new b2Manifold();
m_manifolds = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactPoint;
var _local8:int;
var _local9:Array;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
_local5 = m_shape1.m_body;
_local6 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf);
_local9 = [false, false];
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local8 = 0;
while (_local8 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local8];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local9[_local13] == true){
} else {
_local4 = m0.points[_local13];
if (_local4.id._key == _local12){
_local9[_local13] = true;
_local10.normalImpulse = _local4.normalImpulse;
_local10.tangentImpulse = _local4.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Persist(_local7);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Add(_local7);
};
_local8++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local8 = 0;
while (_local8 < m0.pointCount) {
if (_local9[_local8]){
} else {
_local4 = m0.points[_local8];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
_local8++;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolygonContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2DistanceJoint extends b2Joint {
public var m_mass:Number;
public var m_u:b2Vec2;
public var m_impulse:Number;
public var m_dampingRatio:Number;
public var m_frequencyHz:Number;
public var m_localAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_bias:Number;
public var m_gamma:Number;
public var m_length:Number;
public function b2DistanceJoint(_arg1:b2DistanceJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u = new b2Vec2();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_length = _arg1.length;
m_frequencyHz = _arg1.frequencyHz;
m_dampingRatio = _arg1.dampingRatio;
m_impulse = 0;
m_gamma = 0;
m_bias = 0;
m_inv_dt = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2;
_local1 = new b2Vec2();
_local1.SetV(m_u);
_local1.Multiply((m_inv_dt * m_impulse));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
if (m_frequencyHz > 0){
return (true);
};
_local2 = m_body1;
_local3 = m_body2;
_local1 = _local2.m_xf.R;
_local4 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5));
_local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5));
_local4 = _local6;
_local1 = _local3.m_xf.R;
_local7 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local8 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8));
_local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8));
_local7 = _local6;
_local9 = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4);
_local10 = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5);
_local11 = Math.sqrt(((_local9 * _local9) + (_local10 * _local10)));
_local9 = (_local9 / _local11);
_local10 = (_local10 / _local11);
_local12 = (_local11 - m_length);
_local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local13 = (-(m_mass) * _local12);
m_u.Set(_local9, _local10);
_local14 = (_local13 * m_u.x);
_local15 = (_local13 * m_u.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14))));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15));
_local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14))));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
m_inv_dt = _arg1.inv_dt;
_local4 = m_body1;
_local5 = m_body2;
_local2 = _local4.m_xf.R;
_local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7));
_local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7));
_local6 = _local3;
_local2 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6);
m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7);
_local10 = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y)));
if (_local10 > b2Settings.b2_linearSlop){
m_u.Multiply((1 / _local10));
} else {
m_u.SetZero();
};
_local11 = ((_local6 * m_u.y) - (_local7 * m_u.x));
_local12 = ((_local8 * m_u.y) - (_local9 * m_u.x));
_local13 = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12));
m_mass = (1 / _local13);
if (m_frequencyHz > 0){
_local14 = (_local10 - m_length);
_local15 = ((2 * Math.PI) * m_frequencyHz);
_local16 = (((2 * m_mass) * m_dampingRatio) * _local15);
_local17 = ((m_mass * _local15) * _local15);
m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17))));
m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma);
m_mass = (1 / (_local13 + m_gamma));
};
if (_arg1.warmStarting){
m_impulse = (m_impulse * _arg1.dtRatio);
_local18 = (m_impulse * m_u.x);
_local19 = (m_impulse * m_u.y);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19));
_local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18))));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19));
_local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18))));
} else {
m_impulse = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local3 = m_body1;
_local4 = m_body2;
_local2 = _local3.m_xf.R;
_local5 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6));
_local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6));
_local5 = _local7;
_local2 = _local4.m_xf.R;
_local8 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local7;
_local10 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6));
_local11 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5));
_local12 = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9));
_local13 = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8));
_local14 = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11)));
_local15 = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse)));
m_impulse = (m_impulse + _local15);
_local16 = (_local15 * m_u.x);
_local17 = (_local15 * m_u.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16))));
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17));
_local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
}
}
}//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2DistanceJointDef extends b2JointDef {
public var length:Number;
public var dampingRatio:Number;
public var frequencyHz:Number;
public var localAnchor2:b2Vec2;
public var localAnchor1:b2Vec2;
public function b2DistanceJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_distanceJoint;
length = 1;
frequencyHz = 0;
dampingRatio = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
var _local5:Number;
var _local6:Number;
body1 = _arg1;
body2 = _arg2;
localAnchor1.SetV(body1.GetLocalPoint(_arg3));
localAnchor2.SetV(body2.GetLocalPoint(_arg4));
_local5 = (_arg4.x - _arg3.x);
_local6 = (_arg4.y - _arg3.y);
length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
frequencyHz = 0;
dampingRatio = 0;
}
}
}//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2GearJoint extends b2Joint {
public var m_force:Number;
public var m_mass:Number;
public var m_prismatic1:b2PrismaticJoint;
public var m_prismatic2:b2PrismaticJoint;
public var m_ground1:b2Body;
public var m_ground2:b2Body;
public var m_constant:Number;
public var m_revolute1:b2RevoluteJoint;
public var m_revolute2:b2RevoluteJoint;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_ratio:Number;
public var m_J:b2Jacobian;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_J = new b2Jacobian();
super(_arg1);
_local2 = _arg1.joint1.m_type;
_local3 = _arg1.joint2.m_type;
m_revolute1 = null;
m_prismatic1 = null;
m_revolute2 = null;
m_prismatic2 = null;
m_ground1 = _arg1.joint1.m_body1;
m_body1 = _arg1.joint1.m_body2;
if (_local2 == b2Joint.e_revoluteJoint){
m_revolute1 = (_arg1.joint1 as b2RevoluteJoint);
m_groundAnchor1.SetV(m_revolute1.m_localAnchor1);
m_localAnchor1.SetV(m_revolute1.m_localAnchor2);
_local4 = m_revolute1.GetJointAngle();
} else {
m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint);
m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1);
m_localAnchor1.SetV(m_prismatic1.m_localAnchor2);
_local4 = m_prismatic1.GetJointTranslation();
};
m_ground2 = _arg1.joint2.m_body1;
m_body2 = _arg1.joint2.m_body2;
if (_local3 == b2Joint.e_revoluteJoint){
m_revolute2 = (_arg1.joint2 as b2RevoluteJoint);
m_groundAnchor2.SetV(m_revolute2.m_localAnchor1);
m_localAnchor2.SetV(m_revolute2.m_localAnchor2);
_local5 = m_revolute2.GetJointAngle();
} else {
m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint);
m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1);
m_localAnchor2.SetV(m_prismatic2.m_localAnchor2);
_local5 = m_prismatic2.GetJointTranslation();
};
m_ratio = _arg1.ratio;
m_constant = (_local4 + (m_ratio * _local5));
m_force = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2;
_local1 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = 0;
_local2 = m_body1;
_local3 = m_body2;
if (m_revolute1){
_local4 = m_revolute1.GetJointAngle();
} else {
_local4 = m_prismatic1.GetJointTranslation();
};
if (m_revolute2){
_local5 = m_revolute2.GetJointAngle();
} else {
_local5 = m_prismatic2.GetJointTranslation();
};
_local6 = (m_constant - (_local4 + (m_ratio * _local5)));
_local7 = (-(m_mass) * _local6);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y));
_local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((_local1 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local2 = m_ground1;
_local3 = m_ground2;
_local4 = m_body1;
_local5 = m_body2;
_local14 = 0;
m_J.SetZero();
if (m_revolute1){
m_J.angular1 = -1;
_local14 = (_local14 + _local4.m_invI);
} else {
_local10 = _local2.m_xf.R;
_local11 = m_prismatic1.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local4.m_xf.R;
_local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear1.Set(-(_local6), -(_local7));
m_J.angular1 = -(_local12);
_local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12)));
};
if (m_revolute2){
m_J.angular2 = -(m_ratio);
_local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI));
} else {
_local10 = _local3.m_xf.R;
_local11 = m_prismatic2.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7));
m_J.angular2 = (-(m_ratio) * _local12);
_local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12))));
};
m_mass = (1 / _local14);
if (_arg1.warmStarting){
_local15 = (_arg1.dt * m_force);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2));
} else {
m_force = 0;
};
}
override public function GetReactionTorque():Number{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = m_body2.m_xf.R;
_local2 = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x);
_local3 = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y);
_local4 = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3));
_local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3));
_local2 = _local4;
_local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x))));
return (_local4);
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local5 = ((-(_arg1.inv_dt) * m_mass) * _local4);
m_force = (m_force + _local5);
_local6 = (_arg1.dt * _local5);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2));
}
}
}//package Box2D.Dynamics.Joints
Section 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef)
package Box2D.Dynamics.Joints {
public class b2GearJointDef extends b2JointDef {
public var joint2:b2Joint;
public var joint1:b2Joint;
public var ratio:Number;
public function b2GearJointDef(){
type = b2Joint.e_gearJoint;
joint1 = null;
joint2 = null;
ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2Jacobian {
public var linear1:b2Vec2;
public var linear2:b2Vec2;
public var angular2:Number;
public var angular1:Number;
public function b2Jacobian(){
linear1 = new b2Vec2();
linear2 = new b2Vec2();
super();
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linear1.SetV(_arg1);
angular1 = _arg2;
linear2.SetV(_arg3);
angular2 = _arg4;
}
public function SetZero():void{
linear1.SetZero();
angular1 = 0;
linear2.SetZero();
angular2 = 0;
}
public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{
return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4)));
}
}
}//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2Joint {
public var m_islandFlag:Boolean;
public var m_body1:b2Body;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_type:int;
public var m_collideConnected:Boolean;
public var m_node1:b2JointEdge;
public var m_node2:b2JointEdge;
public var m_inv_dt:Number;
public var m_userData;
public var m_body2:b2Body;
public static const e_unknownJoint:int = 0;
public static const e_inactiveLimit:int = 0;
public static const e_atUpperLimit:int = 2;
public static const e_atLowerLimit:int = 1;
public static const e_gearJoint:int = 6;
public static const e_revoluteJoint:int = 1;
public static const e_equalLimits:int = 3;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_prismaticJoint:int = 2;
public static const e_mouseJoint:int = 5;
public function b2Joint(_arg1:b2JointDef){
m_node1 = new b2JointEdge();
m_node2 = new b2JointEdge();
super();
m_type = _arg1.type;
m_prev = null;
m_next = null;
m_body1 = _arg1.body1;
m_body2 = _arg1.body2;
m_collideConnected = _arg1.collideConnected;
m_islandFlag = false;
m_userData = _arg1.userData;
}
public function GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
}
public function GetType():int{
return (m_type);
}
public function GetBody2():b2Body{
return (m_body2);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetReactionTorque():Number{
return (0);
}
public function GetUserData(){
return (m_userData);
}
public function GetReactionForce():b2Vec2{
return (null);
}
public function SolvePositionConstraints():Boolean{
return (false);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetBody1():b2Body{
return (m_body1);
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function InitPositionConstraints():void{
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
_local3 = null;
switch (_arg1.type){
case e_distanceJoint:
_local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef));
break;
case e_mouseJoint:
_local3 = new b2MouseJoint((_arg1 as b2MouseJointDef));
break;
case e_prismaticJoint:
_local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef));
break;
case e_revoluteJoint:
_local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef));
break;
case e_pulleyJoint:
_local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef));
break;
case e_gearJoint:
_local3 = new b2GearJoint((_arg1 as b2GearJointDef));
break;
default:
break;
};
return (_local3);
}
}
}//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointDef {
public var collideConnected:Boolean;
public var body1:b2Body;
public var body2:b2Body;
public var userData;
public var type:int;
public function b2JointDef(){
type = b2Joint.e_unknownJoint;
userData = null;
body1 = null;
body2 = null;
collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointEdge {
public var joint:b2Joint;
public var other:b2Body;
public var next:b2JointEdge;
public var prev:b2JointEdge;
}
}//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2MouseJoint extends b2Joint {
public var m_beta:Number;
public var m_mass:b2Mat22;
public var m_target:b2Vec2;
public var m_impulse:b2Vec2;
public var m_localAnchor:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K:b2Mat22;
public var m_gamma:Number;
public var m_C:b2Vec2;
public var m_maxForce:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
var _local2:Number;
var _local3:Number;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
m_localAnchor = new b2Vec2();
m_target = new b2Vec2();
m_impulse = new b2Vec2();
m_mass = new b2Mat22();
m_C = new b2Vec2();
super(_arg1);
m_target.SetV(_arg1.target);
_local2 = (m_target.x - m_body2.m_xf.position.x);
_local3 = (m_target.y - m_body2.m_xf.position.y);
_local4 = m_body2.m_xf.R;
m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y));
m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y));
m_maxForce = _arg1.maxForce;
m_impulse.SetZero();
_local5 = m_body2.m_mass;
_local6 = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
_local7 = (((2 * _local5) * _arg1.dampingRatio) * _local6);
_local8 = ((_arg1.timeStep * _local5) * (_local6 * _local6));
m_gamma = (1 / (_local7 + _local8));
m_beta = (_local8 / (_local7 + _local8));
}
override public function GetAnchor1():b2Vec2{
return (m_target);
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor));
}
override public function GetReactionForce():b2Vec2{
return (m_impulse);
}
override public function SolvePositionConstraints():Boolean{
return (true);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local7 = _local2.m_invMass;
_local8 = _local2.m_invI;
K1.col1.x = _local7;
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = _local7;
K2.col1.x = ((_local8 * _local5) * _local5);
K2.col2.x = ((-(_local8) * _local4) * _local5);
K2.col1.y = ((-(_local8) * _local4) * _local5);
K2.col2.y = ((_local8 * _local4) * _local4);
K.SetM(K1);
K.AddM(K2);
K.col1.x = (K.col1.x + m_gamma);
K.col2.y = (K.col2.y + m_gamma);
K.Invert(m_mass);
m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x);
m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y);
_local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98);
_local9 = (_arg1.dt * m_impulse.x);
_local10 = (_arg1.dt * m_impulse.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9))));
}
override public function GetReactionTorque():Number{
return (0);
}
public function SetTarget(_arg1:b2Vec2):void{
if (m_body2.IsSleeping()){
m_body2.WakeUp();
};
m_target = _arg1;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local6 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7));
_local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7));
_local6 = _local4;
_local8 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7));
_local9 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6));
_local3 = m_mass;
_local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x));
_local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y));
_local10 = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)));
_local11 = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)));
_local12 = m_impulse.x;
_local13 = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
_local14 = m_impulse.Length();
if (_local14 > m_maxForce){
m_impulse.Multiply((m_maxForce / _local14));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
_local15 = (_arg1.dt * _local10);
_local16 = (_arg1.dt * _local11);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
}
}
}//package Box2D.Dynamics.Joints
Section 57
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2MouseJointDef extends b2JointDef {
public var frequencyHz:Number;
public var dampingRatio:Number;
public var maxForce:Number;
public var target:b2Vec2;
public var timeStep:Number;
public function b2MouseJointDef(){
target = new b2Vec2();
super();
type = b2Joint.e_mouseJoint;
maxForce = 0;
frequencyHz = 5;
dampingRatio = 0.7;
timeStep = (1 / 60);
}
}
}//package Box2D.Dynamics.Joints
Section 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PrismaticJoint extends b2Joint {
public var m_limitForce:Number;
public var m_refAngle:Number;
public var m_lowerTranslation:Number;
public var m_localXAxis1:b2Vec2;
public var m_torque:Number;
public var m_enableLimit:Boolean;
public var m_motorForce:Number;
public var m_force:Number;
public var m_localYAxis1:b2Vec2;
public var m_motorMass:Number;
public var m_maxMotorForce:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_angularMass:Number;
public var m_limitState:int;
public var m_linearMass:Number;
public var m_upperTranslation:Number;
public var m_motorJacobian:b2Jacobian;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_linearJacobian:b2Jacobian;
public var m_enableMotor:Boolean;
public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_localXAxis1 = new b2Vec2();
m_localYAxis1 = new b2Vec2();
m_linearJacobian = new b2Jacobian();
m_motorJacobian = new b2Jacobian();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_localXAxis1.SetV(_arg1.localAxis1);
m_localYAxis1.x = -(m_localXAxis1.y);
m_localYAxis1.y = m_localXAxis1.x;
m_refAngle = _arg1.referenceAngle;
m_linearJacobian.SetZero();
m_linearMass = 0;
m_force = 0;
m_angularMass = 0;
m_torque = 0;
m_motorJacobian.SetZero();
m_motorMass = 0;
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerTranslation = _arg1.lowerTranslation;
m_upperTranslation = _arg1.upperTranslation;
m_maxMotorForce = _arg1.maxMotorForce;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetUpperLimit():Number{
return (m_upperTranslation);
}
public function GetLowerLimit():Number{
return (m_lowerTranslation);
}
public function GetJointTranslation():Number{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:b2Vec2;
var _local9:Number;
_local1 = m_body1;
_local2 = m_body2;
_local4 = _local1.GetWorldPoint(m_localAnchor1);
_local5 = _local2.GetWorldPoint(m_localAnchor2);
_local6 = (_local5.x - _local4.x);
_local7 = (_local5.y - _local4.y);
_local8 = _local1.GetWorldVector(m_localXAxis1);
_local9 = ((_local8.x * _local6) + (_local8.y * _local7));
return (_local9);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerTranslation = _arg1;
m_upperTranslation = _arg2;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body1.m_xf.R;
_local2 = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y)));
_local3 = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y)));
_local4 = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y)));
_local5 = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y)));
return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5))));
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
_local3 = m_body1;
_local4 = m_body2;
_local5 = _local3.m_invMass;
_local6 = _local4.m_invMass;
_local7 = _local3.m_invI;
_local8 = _local4.m_invI;
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local21 = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
_local22 = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
_local23 = ((_local21 * _local19) + (_local22 * _local20));
_local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local24 = (-(m_linearMass) * _local23);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2));
_local25 = b2Math.b2Abs(_local23);
_local26 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle);
_local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local27 = (-(m_angularMass) * _local26);
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
_local28 = b2Math.b2Abs(_local26);
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y));
_local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y));
_local31 = ((_local29 * _local19) + (_local30 * _local20));
_local32 = 0;
if (m_limitState == e_equalLimits){
_local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26));
} else {
if (m_limitState == e_atLowerLimit){
_local1 = (_local31 - m_lowerTranslation);
_local25 = b2Math.b2Max(_local25, -(_local1));
_local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
} else {
if (m_limitState == e_atUpperLimit){
_local1 = (_local31 - m_upperTranslation);
_local25 = b2Math.b2Max(_local25, _local1);
_local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
};
};
};
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop))));
}
public function GetJointSpeed():Number{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:b2Vec2;
var _local16:b2Vec2;
var _local17:b2Vec2;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local1 = m_body1;
_local2 = m_body2;
_local3 = _local1.m_xf.R;
_local4 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local5 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local3 = _local2.m_xf.R;
_local7 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local8 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8));
_local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8));
_local7 = _local6;
_local9 = (_local1.m_sweep.c.x + _local4);
_local10 = (_local1.m_sweep.c.y + _local5);
_local11 = (_local2.m_sweep.c.x + _local7);
_local12 = (_local2.m_sweep.c.y + _local8);
_local13 = (_local11 - _local9);
_local14 = (_local12 - _local10);
_local15 = _local1.GetWorldVector(m_localXAxis1);
_local16 = _local1.m_linearVelocity;
_local17 = _local2.m_linearVelocity;
_local18 = _local1.m_angularVelocity;
_local19 = _local2.m_angularVelocity;
_local20 = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4)))));
return (_local20);
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
_local10 = _local2.m_invMass;
_local11 = _local3.m_invMass;
_local12 = _local2.m_invI;
_local13 = _local3.m_invI;
_local4 = _local2.m_xf.R;
_local14 = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y));
_local15 = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y));
_local16 = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x);
_local17 = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y);
m_linearJacobian.linear1.x = -(_local14);
m_linearJacobian.linear1.y = -(_local15);
m_linearJacobian.linear2.x = _local14;
m_linearJacobian.linear2.y = _local15;
m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14)));
m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14));
m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2));
m_linearMass = (1 / m_linearMass);
m_angularMass = (_local12 + _local13);
if (m_angularMass > Number.MIN_VALUE){
m_angularMass = (1 / m_angularMass);
};
if (((m_enableLimit) || (m_enableMotor))){
_local4 = _local2.m_xf.R;
_local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y));
_local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y));
m_motorJacobian.linear1.x = -(_local18);
m_motorJacobian.linear1.y = -(_local19);
m_motorJacobian.linear2.x = _local18;
m_motorJacobian.linear2.y = _local19;
m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18)));
m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18));
m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2));
m_motorMass = (1 / m_motorMass);
if (m_enableLimit){
_local20 = (_local16 - _local6);
_local21 = (_local17 - _local7);
_local22 = ((_local18 * _local20) + (_local19 * _local21));
if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local22 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local22 >= m_upperTranslation){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
};
};
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit == false){
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x)));
_local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y)));
_local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x)));
_local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y)));
_local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1)));
_local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2)));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28));
} else {
m_force = 0;
m_torque = 0;
m_limitForce = 0;
m_motorForce = 0;
};
m_limitPositionImpulse = 0;
}
public function GetMotorForce():Number{
return (m_motorForce);
}
public function SetMaxMotorForce(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
override public function GetReactionTorque():Number{
return (m_torque);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_invMass;
_local5 = _local3.m_invMass;
_local6 = _local2.m_invI;
_local7 = _local3.m_invI;
_local9 = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local10 = ((-(_arg1.inv_dt) * m_linearMass) * _local9);
m_force = (m_force + _local10);
_local11 = (_arg1.dt * _local10);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2));
_local12 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local13 = ((-(_arg1.inv_dt) * m_angularMass) * _local12);
m_torque = (m_torque + _local13);
_local14 = (_arg1.dt * _local13);
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed);
_local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15);
_local17 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce);
_local16 = (m_motorForce - _local17);
_local11 = (_arg1.dt * _local16);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local19);
} else {
if (m_limitState == e_atLowerLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
} else {
if (m_limitState == e_atUpperLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
};
};
};
_local11 = (_arg1.dt * _local19);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
}
}
}//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PrismaticJointDef extends b2JointDef {
public var localAxis1:b2Vec2;
public var referenceAngle:Number;
public var maxMotorForce:Number;
public var motorSpeed:Number;
public var upperTranslation:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public var lowerTranslation:Number;
public function b2PrismaticJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
localAxis1 = new b2Vec2();
super();
type = b2Joint.e_prismaticJoint;
localAxis1.Set(1, 0);
referenceAngle = 0;
enableLimit = false;
lowerTranslation = 0;
upperTranslation = 0;
enableMotor = false;
maxMotorForce = 0;
motorSpeed = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
localAxis1 = body1.GetLocalVector(_arg4);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PulleyJoint extends b2Joint {
public var m_ground:b2Body;
public var m_maxLength2:Number;
public var m_limitForce1:Number;
public var m_maxLength1:Number;
public var m_limitState1:int;
public var m_limitState2:int;
public var m_limitPositionImpulse2:Number;
public var m_force:Number;
public var m_limitPositionImpulse1:Number;
public var m_constant:Number;
public var m_state:int;
public var m_ratio:Number;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_positionImpulse:Number;
public var m_limitMass2:Number;
public var m_limitMass1:Number;
public var m_pulleyMass:Number;
public var m_u1:b2Vec2;
public var m_u2:b2Vec2;
public var m_limitForce2:Number;
public static const b2_minPulleyLength:Number = 2;
public function b2PulleyJoint(_arg1:b2PulleyJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u1 = new b2Vec2();
m_u2 = new b2Vec2();
super(_arg1);
m_ground = m_body1.m_world.m_groundBody;
m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x);
m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y);
m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x);
m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_ratio = _arg1.ratio;
m_constant = (_arg1.length1 + (m_ratio * _arg1.length2));
m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength)));
m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio));
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
}
public function GetGroundAnchor2():b2Vec2{
var _local1:b2Vec2;
_local1 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor2);
return (_local1);
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2;
_local1 = m_u2.Copy();
_local1.Multiply(m_force);
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
_local1 = m_body1;
_local2 = m_body2;
_local4 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local5 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local6 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local7 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
_local23 = 0;
if (m_state == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local16 = m_u1.Length();
_local17 = m_u2.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local16));
} else {
m_u1.SetZero();
};
if (_local17 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = ((m_constant - _local16) - (m_ratio * _local17));
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_pulleyMass) * _local18);
_local20 = m_positionImpulse;
m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19));
_local19 = (m_positionImpulse - _local20);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local14 = ((-(m_ratio) * _local19) * m_u2.x);
_local15 = ((-(m_ratio) * _local19) * m_u2.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local1.SynchronizeTransform();
_local2.SynchronizeTransform();
};
if (m_limitState1 == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
_local16 = m_u1.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.x = (m_u1.x * (1 / _local16));
m_u1.y = (m_u1.y * (1 / _local16));
} else {
m_u1.SetZero();
};
_local18 = (m_maxLength1 - _local16);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass1) * _local18);
_local21 = m_limitPositionImpulse1;
m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19));
_local19 = (m_limitPositionImpulse1 - _local21);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local1.SynchronizeTransform();
};
if (m_limitState2 == e_atUpperLimit){
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local17 = m_u2.Length();
if (_local17 > b2Settings.b2_linearSlop){
m_u2.x = (m_u2.x * (1 / _local17));
m_u2.y = (m_u2.y * (1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = (m_maxLength2 - _local17);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass2) * _local18);
_local21 = m_limitPositionImpulse2;
m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19));
_local19 = (m_limitPositionImpulse2 - _local21);
_local14 = (-(_local19) * m_u2.x);
_local15 = (-(_local19) * m_u2.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local2.SynchronizeTransform();
};
return ((_local23 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local5 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
_local10 = (_local2.m_sweep.c.x + _local5);
_local11 = (_local2.m_sweep.c.y + _local6);
_local12 = (_local3.m_sweep.c.x + _local8);
_local13 = (_local3.m_sweep.c.y + _local9);
_local14 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local15 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local16 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local17 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
m_u1.Set((_local10 - _local14), (_local11 - _local15));
m_u2.Set((_local12 - _local16), (_local13 - _local17));
_local18 = m_u1.Length();
_local19 = m_u2.Length();
if (_local18 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local18));
} else {
m_u1.SetZero();
};
if (_local19 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local19));
} else {
m_u2.SetZero();
};
_local20 = ((m_constant - _local18) - (m_ratio * _local19));
if (_local20 > 0){
m_state = e_inactiveLimit;
m_force = 0;
} else {
m_state = e_atUpperLimit;
m_positionImpulse = 0;
};
if (_local18 < m_maxLength1){
m_limitState1 = e_inactiveLimit;
m_limitForce1 = 0;
} else {
m_limitState1 = e_atUpperLimit;
m_limitPositionImpulse1 = 0;
};
if (_local19 < m_maxLength2){
m_limitState2 = e_inactiveLimit;
m_limitForce2 = 0;
} else {
m_limitState2 = e_atUpperLimit;
m_limitPositionImpulse2 = 0;
};
_local21 = ((_local5 * m_u1.y) - (_local6 * m_u1.x));
_local22 = ((_local8 * m_u2.y) - (_local9 * m_u2.x));
m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21));
m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22));
m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2));
m_limitMass1 = (1 / m_limitMass1);
m_limitMass2 = (1 / m_limitMass2);
m_pulleyMass = (1 / m_pulleyMass);
if (_arg1.warmStarting){
_local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x);
_local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y);
_local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x);
_local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25))));
} else {
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
public function GetRatio():Number{
return (m_ratio);
}
public function GetLength2():Number{
var _local1:b2Vec2;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body2.GetWorldPoint(m_localAnchor2);
_local2 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local3 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
_local4 = (_local1.x - _local2);
_local5 = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local5 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
if (m_state == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13))));
_local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18);
_local20 = m_force;
m_force = b2Math.b2Max(0, (m_force + _local19));
_local19 = (m_force - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x);
_local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
if (m_limitState1 == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18);
_local20 = m_limitForce1;
m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19));
_local19 = (m_limitForce1 - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
};
if (m_limitState2 == e_atUpperLimit){
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18);
_local20 = m_limitForce2;
m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19));
_local19 = (m_limitForce2 - _local20);
_local16 = ((-(_arg1.dt) * _local19) * m_u2.x);
_local17 = ((-(_arg1.dt) * _local19) * m_u2.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
}
public function GetLength1():Number{
var _local1:b2Vec2;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body1.GetWorldPoint(m_localAnchor1);
_local2 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local3 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local4 = (_local1.x - _local2);
_local5 = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetGroundAnchor1():b2Vec2{
var _local1:b2Vec2;
_local1 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor1);
return (_local1);
}
}
}//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PulleyJointDef extends b2JointDef {
public var maxLength2:Number;
public var length1:Number;
public var length2:Number;
public var maxLength1:Number;
public var ratio:Number;
public var groundAnchor1:b2Vec2;
public var groundAnchor2:b2Vec2;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public function b2PulleyJointDef(){
groundAnchor1 = new b2Vec2();
groundAnchor2 = new b2Vec2();
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_pulleyJoint;
groundAnchor1.Set(-1, 1);
groundAnchor2.Set(1, 1);
localAnchor1.Set(-1, 0);
localAnchor2.Set(1, 0);
length1 = 0;
maxLength1 = 0;
length2 = 0;
maxLength2 = 0;
ratio = 1;
collideConnected = true;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
body1 = _arg1;
body2 = _arg2;
groundAnchor1.SetV(_arg3);
groundAnchor2.SetV(_arg4);
localAnchor1 = body1.GetLocalPoint(_arg5);
localAnchor2 = body2.GetLocalPoint(_arg6);
_local8 = (_arg5.x - _arg3.x);
_local9 = (_arg5.y - _arg3.y);
length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local10 = (_arg6.x - _arg4.x);
_local11 = (_arg6.y - _arg4.y);
length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
ratio = _arg7;
_local12 = (length1 + (ratio * length2));
maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength));
maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio);
}
}
}//package Box2D.Dynamics.Joints
Section 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2RevoluteJoint extends b2Joint {
public var m_limitForce:Number;
public var m_motorForce:Number;
public var m_pivotMass:b2Mat22;
public var m_enableLimit:Boolean;
public var m_limitState:int;
public var m_motorMass:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K3:b2Mat22;
private var K:b2Mat22;
public var m_pivotForce:b2Vec2;
public var m_motorSpeed:Number;
public var m_enableMotor:Boolean;
public var m_limitPositionImpulse:Number;
public var m_maxMotorTorque:Number;
public var m_referenceAngle:Number;
public var m_lowerAngle:Number;
public var m_upperAngle:Number;
public static var tImpulse:b2Vec2 = new b2Vec2();
public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
K3 = new b2Mat22();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_pivotForce = new b2Vec2();
m_pivotMass = new b2Mat22();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_referenceAngle = _arg1.referenceAngle;
m_pivotForce.Set(0, 0);
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerAngle = _arg1.lowerAngle;
m_upperAngle = _arg1.upperAngle;
m_maxMotorTorque = _arg1.maxMotorTorque;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetUpperLimit():Number{
return (m_upperAngle);
}
public function GetLowerLimit():Number{
return (m_lowerAngle);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerAngle = _arg1;
m_upperAngle = _arg2;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
return (m_pivotForce);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local3 = m_body1;
_local4 = m_body2;
_local5 = 0;
_local6 = _local3.m_xf.R;
_local7 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local8 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8));
_local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8));
_local7 = _local9;
_local6 = _local4.m_xf.R;
_local10 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11));
_local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11));
_local10 = _local9;
_local12 = (_local3.m_sweep.c.x + _local7);
_local13 = (_local3.m_sweep.c.y + _local8);
_local14 = (_local4.m_sweep.c.x + _local10);
_local15 = (_local4.m_sweep.c.y + _local11);
_local16 = (_local14 - _local12);
_local17 = (_local15 - _local13);
_local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17)));
_local18 = _local3.m_invMass;
_local19 = _local4.m_invMass;
_local20 = _local3.m_invI;
_local21 = _local4.m_invI;
K1.col1.x = (_local18 + _local19);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local18 + _local19);
K2.col1.x = ((_local20 * _local8) * _local8);
K2.col2.x = ((-(_local20) * _local7) * _local8);
K2.col1.y = ((-(_local20) * _local7) * _local8);
K2.col2.y = ((_local20 * _local7) * _local7);
K3.col1.x = ((_local21 * _local11) * _local11);
K3.col2.x = ((-(_local21) * _local10) * _local11);
K3.col1.y = ((-(_local21) * _local10) * _local11);
K3.col2.y = ((_local21 * _local10) * _local10);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Solve(tImpulse, -(_local16), -(_local17));
_local22 = tImpulse.x;
_local23 = tImpulse.y;
_local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23));
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22))));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22))));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
_local24 = 0;
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle);
_local26 = 0;
if (m_limitState == e_equalLimits){
_local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local24 = b2Math.b2Abs(_local2);
} else {
if (m_limitState == e_atLowerLimit){
_local2 = (_local25 - m_lowerAngle);
_local24 = b2Math.b2Max(0, -(_local2));
_local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
} else {
if (m_limitState == e_atUpperLimit){
_local2 = (_local25 - m_upperAngle);
_local24 = b2Math.b2Max(0, _local2);
_local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
};
};
};
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop))));
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function SetMaxMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
public function GetJointAngle():Number{
return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
_local10 = _local2.m_invMass;
_local11 = _local3.m_invMass;
_local12 = _local2.m_invI;
_local13 = _local3.m_invI;
K1.col1.x = (_local10 + _local11);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local10 + _local11);
K2.col1.x = ((_local12 * _local7) * _local7);
K2.col2.x = ((-(_local12) * _local6) * _local7);
K2.col1.y = ((-(_local12) * _local6) * _local7);
K2.col2.y = ((_local12 * _local6) * _local6);
K3.col1.x = ((_local13 * _local9) * _local9);
K3.col2.x = ((-(_local13) * _local8) * _local9);
K3.col1.y = ((-(_local13) * _local8) * _local9);
K3.col2.y = ((_local13 * _local8) * _local8);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Invert(m_pivotMass);
m_motorMass = (1 / (_local12 + _local13));
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit){
_local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle);
if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
m_limitState = e_equalLimits;
} else {
if (_local14 <= m_lowerAngle){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local14 >= m_upperAngle){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
} else {
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
} else {
m_pivotForce.SetZero();
m_motorForce = 0;
m_limitForce = 0;
};
m_limitPositionImpulse = 0;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
public function GetMotorTorque():Number{
return (m_motorForce);
}
override public function GetReactionTorque():Number{
return (m_limitForce);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
_local11 = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7));
_local12 = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6));
_local13 = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12)));
_local14 = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12)));
m_pivotForce.x = (m_pivotForce.x + _local13);
m_pivotForce.y = (m_pivotForce.y + _local14);
_local15 = (_arg1.dt * _local13);
_local16 = (_arg1.dt * _local14);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15))));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed);
_local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17);
_local19 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque);
_local18 = (m_motorForce - _local19);
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local21);
} else {
if (m_limitState == e_atLowerLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
} else {
if (m_limitState == e_atUpperLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
};
};
};
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21));
};
}
}
}//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2RevoluteJointDef extends b2JointDef {
public var referenceAngle:Number;
public var upperAngle:Number;
public var lowerAngle:Number;
public var motorSpeed:Number;
public var maxMotorTorque:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public function b2RevoluteJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_revoluteJoint;
localAnchor1.Set(0, 0);
localAnchor2.Set(0, 0);
referenceAngle = 0;
lowerAngle = 0;
upperAngle = 0;
maxMotorTorque = 0;
motorSpeed = 0;
enableLimit = false;
enableMotor = false;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 64
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
public class b2Body {
public var m_next:b2Body;
public var m_contactList:b2ContactEdge;
public var m_angularVelocity:Number;
public var m_shapeList:b2Shape;
public var m_force:b2Vec2;
public var m_mass:Number;
public var m_sweep:b2Sweep;
public var m_xf:b2XForm;
public var m_torque:Number;
public var m_userData;
public var m_flags:uint;
public var m_world:b2World;
public var m_prev:b2Body;
public var m_invMass:Number;
public var m_type:int;
public var m_linearDamping:Number;
public var m_angularDamping:Number;
public var m_invI:Number;
public var m_linearVelocity:b2Vec2;
public var m_sleepTime:Number;
public var m_shapeCount:int;
public var m_jointList:b2JointEdge;
public var m_I:Number;
public static var e_fixedRotationFlag:uint = 64;
public static var e_frozenFlag:uint = 2;
public static var e_maxTypes:uint = 3;
public static var e_sleepFlag:uint = 8;
private static var s_massData:b2MassData = new b2MassData();
public static var e_bulletFlag:uint = 32;
public static var e_staticType:uint = 1;
public static var e_islandFlag:uint = 4;
public static var e_allowSleepFlag:uint = 16;
private static var s_xf1:b2XForm = new b2XForm();
public static var e_dynamicType:uint = 2;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
var _local3:b2Mat22;
var _local4:b2Vec2;
m_xf = new b2XForm();
m_sweep = new b2Sweep();
m_linearVelocity = new b2Vec2();
m_force = new b2Vec2();
super();
m_flags = 0;
if (_arg1.isBullet){
m_flags = (m_flags | e_bulletFlag);
};
if (_arg1.fixedRotation){
m_flags = (m_flags | e_fixedRotationFlag);
};
if (_arg1.allowSleep){
m_flags = (m_flags | e_allowSleepFlag);
};
if (_arg1.isSleeping){
m_flags = (m_flags | e_sleepFlag);
};
m_world = _arg2;
m_xf.position.SetV(_arg1.position);
m_xf.R.Set(_arg1.angle);
m_sweep.localCenter.SetV(_arg1.massData.center);
m_sweep.t0 = 1;
m_sweep.a0 = (m_sweep.a = _arg1.angle);
_local3 = m_xf.R;
_local4 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_jointList = null;
m_contactList = null;
m_prev = null;
m_next = null;
m_linearDamping = _arg1.linearDamping;
m_angularDamping = _arg1.angularDamping;
m_force.Set(0, 0);
m_torque = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_sleepTime = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.massData.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.massData.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
m_userData = _arg1.userData;
m_shapeList = null;
m_shapeCount = 0;
}
public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_arg1.x - m_sweep.c.x)))));
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function WakeUp():void{
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 0;
}
public function GetLocalCenter():b2Vec2{
return (m_sweep.localCenter);
}
public function ApplyTorque(_arg1:Number):void{
if (IsSleeping()){
WakeUp();
};
m_torque = (m_torque + _arg1);
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsDynamic():Boolean{
return ((m_type == e_dynamicType));
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
public function SynchronizeTransform():void{
var _local1:b2Mat22;
var _local2:b2Vec2;
m_xf.R.Set(m_sweep.a);
_local1 = m_xf.R;
_local2 = m_sweep.localCenter;
m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y)));
m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y)));
}
public function GetInertia():Number{
return (m_I);
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function SetMassFromShapes():void{
var _local1:b2Shape;
var _local2:Number;
var _local3:Number;
var _local4:b2MassData;
var _local5:b2Mat22;
var _local6:b2Vec2;
var _local7:int;
if (m_world.m_lock == true){
return;
};
m_mass = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
_local2 = 0;
_local3 = 0;
_local4 = s_massData;
_local1 = m_shapeList;
while (_local1) {
_local1.ComputeMass(_local4);
m_mass = (m_mass + _local4.mass);
_local2 = (_local2 + (_local4.mass * _local4.center.x));
_local3 = (_local3 + (_local4.mass * _local4.center.y));
m_I = (m_I + _local4.I);
_local1 = _local1.m_next;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
_local2 = (_local2 * m_invMass);
_local3 = (_local3 * m_invMass);
};
if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){
m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3))));
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
m_sweep.localCenter.Set(_local2, _local3);
_local5 = m_xf.R;
_local6 = m_sweep.localCenter;
m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local1 = m_shapeList;
while (_local1) {
_local1.UpdateSweepRadius(m_sweep.localCenter);
_local1 = _local1.m_next;
};
_local7 = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local7 != m_type){
_local1 = m_shapeList;
while (_local1) {
_local1.RefilterProxy(m_world.m_broadPhase, m_xf);
_local1 = _local1.m_next;
};
};
}
public function PutToSleep():void{
m_flags = (m_flags | e_sleepFlag);
m_sleepTime = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_force.SetZero();
m_torque = 0;
}
public function GetJointList():b2JointEdge{
return (m_jointList);
}
public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{
var _local3:b2Shape;
var _local4:b2Mat22;
var _local5:b2Vec2;
var _local6:Boolean;
var _local7:Boolean;
if (m_world.m_lock == true){
return (true);
};
if (IsFrozen()){
return (false);
};
m_xf.R.Set(_arg2);
m_xf.position.SetV(_arg1);
_local4 = m_xf.R;
_local5 = m_sweep.localCenter;
m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y));
m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_sweep.a0 = (m_sweep.a = _arg2);
_local6 = false;
_local3 = m_shapeList;
while (_local3) {
_local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf);
if (_local7 == false){
_local6 = true;
break;
};
_local3 = _local3.m_next;
};
if (_local6 == true){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local3 = m_shapeList;
while (_local3) {
_local3.DestroyProxy(m_world.m_broadPhase);
_local3 = _local3.m_next;
};
return (false);
};
m_world.m_broadPhase.Commit();
return (true);
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(m_xf, _arg1));
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_force.x = (m_force.x + _arg1.x);
m_force.y = (m_force.y + _arg1.y);
m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)));
}
public function SynchronizeShapes():Boolean{
var _local1:b2XForm;
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local4:b2Shape;
var _local5:Boolean;
_local1 = s_xf1;
_local1.R.Set(m_sweep.a0);
_local2 = _local1.R;
_local3 = m_sweep.localCenter;
_local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y)));
_local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y)));
_local5 = true;
_local4 = m_shapeList;
while (_local4) {
_local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf);
if (_local5 == false){
break;
};
_local4 = _local4.m_next;
};
if (_local5 == false){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local4 = m_shapeList;
while (_local4) {
_local4.DestroyProxy(m_world.m_broadPhase);
_local4 = _local4.m_next;
};
return (false);
};
return (true);
}
public function GetAngle():Number{
return (m_sweep.a);
}
public function GetXForm():b2XForm{
return (m_xf);
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x));
m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y));
m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))));
}
public function GetNext():b2Body{
return (m_next);
}
public function GetMass():Number{
return (m_mass);
}
public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22;
var _local3:b2Vec2;
_local2 = m_xf.R;
_local3 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x)))));
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SetMass(_arg1:b2MassData):void{
var _local2:b2Shape;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:int;
if (m_world.m_lock == true){
return;
};
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
m_sweep.localCenter.SetV(_arg1.center);
_local3 = m_xf.R;
_local4 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local2 = m_shapeList;
while (_local2) {
_local2.UpdateSweepRadius(m_sweep.localCenter);
_local2 = _local2.m_next;
};
_local5 = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local5 != m_type){
_local2 = m_shapeList;
while (_local2) {
_local2.RefilterProxy(m_world.m_broadPhase, m_xf);
_local2 = _local2.m_next;
};
};
}
public function IsStatic():Boolean{
return ((m_type == e_staticType));
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_xf.R, _arg1));
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function Advance(_arg1:Number):void{
m_sweep.Advance(_arg1);
m_sweep.c.SetV(m_sweep.c0);
m_sweep.a = m_sweep.a0;
SynchronizeTransform();
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_bulletFlag);
} else {
m_flags = (m_flags & ~(e_bulletFlag));
};
}
public function CreateShape(_arg1:b2ShapeDef):b2Shape{
var _local2:b2Shape;
if (m_world.m_lock == true){
return (null);
};
_local2 = b2Shape.Create(_arg1, m_world.m_blockAllocator);
_local2.m_next = m_shapeList;
m_shapeList = _local2;
m_shapeCount++;
_local2.m_body = this;
_local2.CreateProxy(m_world.m_broadPhase, m_xf);
_local2.UpdateSweepRadius(m_sweep.localCenter);
return (_local2);
}
public function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointEdge;
_local2 = m_jointList;
while (_local2) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
public function DestroyShape(_arg1:b2Shape):void{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:Boolean;
if (m_world.m_lock == true){
return;
};
_arg1.DestroyProxy(m_world.m_broadPhase);
_local2 = m_shapeList;
_local3 = null;
_local4 = false;
while (_local2 != null) {
if (_local2 == _arg1){
if (_local3){
_local3.m_next = _arg1.m_next;
} else {
m_shapeList = _arg1.m_next;
};
_local4 = true;
break;
};
_local3 = _local2;
_local2 = _local2.m_next;
};
_arg1.m_body = null;
_arg1.m_next = null;
m_shapeCount--;
b2Shape.Destroy(_arg1, m_world.m_blockAllocator);
}
public function GetUserData(){
return (m_userData);
}
public function IsBullet():Boolean{
return (((m_flags & e_bulletFlag) == e_bulletFlag));
}
public function GetWorldCenter():b2Vec2{
return (m_sweep.c);
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_xf.R, _arg1));
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22;
var _local3:b2Vec2;
_local2 = m_xf.R;
_local3 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (_local3);
}
public function GetWorld():b2World{
return (m_world);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
}
}//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2BodyDef {
public var isSleeping:Boolean;
public var position:b2Vec2;
public var isBullet:Boolean;
public var allowSleep:Boolean;
public var userData;
public var angularDamping:Number;
public var fixedRotation:Boolean;
public var angle:Number;
public var linearDamping:Number;
public var massData:b2MassData;
public function b2BodyDef(){
massData = new b2MassData();
position = new b2Vec2();
super();
massData.center.SetZero();
massData.mass = 0;
massData.I = 0;
userData = null;
position.Set(0, 0);
angle = 0;
linearDamping = 0;
angularDamping = 0;
allowSleep = true;
isSleeping = false;
fixedRotation = false;
isBullet = false;
}
}
}//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
public class b2ContactFilter {
public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter);
;
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData;
var _local4:b2FilterData;
var _local5:Boolean;
_local3 = _arg1.GetFilterData();
_local4 = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
_local5 = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
}
}//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactListener {
public function Add(_arg1:b2ContactPoint):void{
}
public function Remove(_arg1:b2ContactPoint):void{
}
public function Persist(_arg1:b2ContactPoint):void{
}
public function Result(_arg1:b2ContactResult):void{
}
}
}//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactManager extends b2PairCallback {
public var m_world:b2World;
public var m_destroyImmediate:Boolean;
public var m_nullContact:b2NullContact;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2ContactManager(){
m_nullContact = new b2NullContact();
super();
m_world = null;
m_destroyImmediate = false;
}
override public function PairAdded(_arg1, _arg2){
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2Contact;
_local3 = (_arg1 as b2Shape);
_local4 = (_arg2 as b2Shape);
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (m_nullContact);
};
if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){
return (m_nullContact);
};
_local7 = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator);
if (_local7 == null){
return (m_nullContact);
};
_local3 = _local7.m_shape1;
_local4 = _local7.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local7.m_prev = null;
_local7.m_next = m_world.m_contactList;
if (m_world.m_contactList != null){
m_world.m_contactList.m_prev = _local7;
};
m_world.m_contactList = _local7;
_local7.m_node1.contact = _local7;
_local7.m_node1.other = _local6;
_local7.m_node1.prev = null;
_local7.m_node1.next = _local5.m_contactList;
if (_local5.m_contactList != null){
_local5.m_contactList.prev = _local7.m_node1;
};
_local5.m_contactList = _local7.m_node1;
_local7.m_node2.contact = _local7;
_local7.m_node2.other = _local5;
_local7.m_node2.prev = null;
_local7.m_node2.next = _local6.m_contactList;
if (_local6.m_contactList != null){
_local6.m_contactList.prev = _local7.m_node2;
};
_local6.m_contactList = _local7.m_node2;
m_world.m_contactCount++;
return (_local7);
}
override public function PairRemoved(_arg1, _arg2, _arg3):void{
var _local4:b2Contact;
if (_arg3 == null){
return;
};
_local4 = (_arg3 as b2Contact);
if (_local4 == m_nullContact){
return;
};
Destroy(_local4);
}
public function Destroy(_arg1:b2Contact):void{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:int;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Array;
var _local10:b2ContactPoint;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2Vec2;
var _local16:b2Vec2;
_local2 = _arg1.m_shape1;
_local3 = _arg1.m_shape2;
_local4 = _arg1.m_manifoldCount;
if ((((_local4 > 0)) && (m_world.m_contactListener))){
_local7 = _local2.m_body;
_local8 = _local3.m_body;
_local9 = _arg1.GetManifolds();
_local10 = s_evalCP;
_local10.shape1 = _arg1.m_shape1;
_local10.shape2 = _arg1.m_shape1;
_local10.friction = _arg1.m_friction;
_local10.restitution = _arg1.m_restitution;
_local11 = 0;
while (_local11 < _local4) {
_local12 = _local9[_local11];
_local10.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local10.position = _local7.GetWorldPoint(_local14.localPoint1);
_local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1);
_local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2);
_local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y));
_local10.separation = _local14.separation;
_local10.id.key = _local14.id._key;
m_world.m_contactListener.Remove(_local10);
_local13++;
};
_local11++;
};
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_world.m_contactList){
m_world.m_contactList = _arg1.m_next;
};
_local5 = _local2.m_body;
_local6 = _local3.m_body;
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local5.m_contactList){
_local5.m_contactList = _arg1.m_node1.next;
};
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local6.m_contactList){
_local6.m_contactList = _arg1.m_node2.next;
};
b2Contact.Destroy(_arg1, m_world.m_blockAllocator);
m_world.m_contactCount--;
}
public function Collide():void{
var _local1:b2Contact;
var _local2:b2Body;
var _local3:b2Body;
_local1 = m_world.m_contactList;
while (_local1) {
_local2 = _local1.m_shape1.m_body;
_local3 = _local1.m_shape2.m_body;
if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){
} else {
_local1.Update(m_world.m_contactListener);
};
_local1 = _local1.m_next;
};
}
}
}//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import flash.display.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2DebugDraw {
public var m_xformScale:Number;// = 1
public var m_fillAlpha:Number;// = 1
public var m_alpha:Number;// = 1
public var m_lineThickness:Number;// = 1
public var m_drawFlags:uint;
public var m_sprite:Sprite;
public var m_drawScale:Number;// = 1
public static var e_coreShapeBit:uint = 4;
public static var e_shapeBit:uint = 1;
public static var e_centerOfMassBit:uint = 64;
public static var e_aabbBit:uint = 8;
public static var e_obbBit:uint = 16;
public static var e_pairBit:uint = 32;
public static var e_jointBit:uint = 2;
public function b2DebugDraw(){
m_drawScale = 1;
m_lineThickness = 1;
m_alpha = 1;
m_fillAlpha = 1;
m_xformScale = 1;
super();
m_drawFlags = 0;
}
public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
var _local4:int;
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha);
_local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.endFill();
}
public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
}
public function DrawXForm(_arg1:b2XForm):void{
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale));
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale));
}
public function ClearFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags & ~(_arg1));
}
public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha);
m_sprite.graphics.moveTo(0, 0);
m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
m_sprite.graphics.endFill();
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale));
}
public function SetFlags(_arg1:uint):void{
m_drawFlags = _arg1;
}
public function AppendFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags | _arg1);
}
public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale));
}
public function GetFlags():uint{
return (m_drawFlags);
}
public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
var _local4:int;
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
_local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
}
}
}//package Box2D.Dynamics
Section 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener)
package Box2D.Dynamics {
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
public class b2DestructionListener {
public function SayGoodbyeJoint(_arg1:b2Joint):void{
}
public function SayGoodbyeShape(_arg1:b2Shape):void{
}
}
}//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2Island {
public var m_joints:Array;
public var m_listener:b2ContactListener;
public var m_positionIterationCount:int;
public var m_bodyCapacity:int;
public var m_bodies:Array;
public var m_jointCapacity:int;
public var m_contactCount:int;
public var m_contacts:Array;
public var m_contactCapacity:int;
public var m_jointCount:int;
public var m_allocator;
public var m_bodyCount:int;
private static var s_reportCR:b2ContactResult = new b2ContactResult();
public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){
var _local6:int;
super();
m_bodyCapacity = _arg1;
m_contactCapacity = _arg2;
m_jointCapacity = _arg3;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_allocator = _arg4;
m_listener = _arg5;
m_bodies = new Array(_arg1);
_local6 = 0;
while (_local6 < _arg1) {
m_bodies[_local6] = null;
_local6++;
};
m_contacts = new Array(_arg2);
_local6 = 0;
while (_local6 < _arg2) {
m_contacts[_local6] = null;
_local6++;
};
m_joints = new Array(_arg3);
_local6 = 0;
while (_local6 < _arg3) {
m_joints[_local6] = null;
_local6++;
};
m_positionIterationCount = 0;
}
public function AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
public function Report(_arg1:Array):void{
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local4:int;
var _local5:b2Contact;
var _local6:b2ContactConstraint;
var _local7:b2ContactResult;
var _local8:b2Body;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2ContactConstraintPoint;
if (m_listener == null){
return;
};
_local4 = 0;
while (_local4 < m_contactCount) {
_local5 = m_contacts[_local4];
_local6 = _arg1[_local4];
_local7 = s_reportCR;
_local7.shape1 = _local5.m_shape1;
_local7.shape2 = _local5.m_shape2;
_local8 = _local7.shape1.m_body;
_local9 = _local5.m_manifoldCount;
_local10 = _local5.GetManifolds();
_local11 = 0;
while (_local11 < _local9) {
_local12 = _local10[_local11];
_local7.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local15 = _local6.points[_local13];
_local7.position = _local8.GetWorldPoint(_local14.localPoint1);
_local7.normalImpulse = _local15.normalImpulse;
_local7.tangentImpulse = _local15.tangentImpulse;
_local7.id.key = _local14.id.key;
m_listener.Result(_local7);
_local13++;
};
_local11++;
};
_local4++;
};
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{
var _local5:int;
var _local6:b2Body;
var _local7:b2Joint;
var _local8:b2ContactSolver;
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y))));
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_force.SetZero();
_local6.m_torque = 0;
_local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity);
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity);
};
if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity);
} else {
_local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity;
};
};
};
_local5++;
};
_local8 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local8.InitVelocityConstraints(_arg1);
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitVelocityConstraints(_arg1);
_local5++;
};
_local5 = 0;
while (_local5 < _arg1.maxIterations) {
_local8.SolveVelocityConstraints();
_local9 = 0;
while (_local9 < m_jointCount) {
_local7 = m_joints[_local9];
_local7.SolveVelocityConstraints(_arg1);
_local9++;
};
_local5++;
};
_local8.FinalizeVelocityConstraints();
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_sweep.c0.SetV(_local6.m_sweep.c);
_local6.m_sweep.a0 = _local6.m_sweep.a;
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y));
_local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity));
_local6.SynchronizeTransform();
};
_local5++;
};
if (_arg3){
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitPositionConstraints();
_local5++;
};
m_positionIterationCount = 0;
while (m_positionIterationCount < _arg1.maxIterations) {
_local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local11 = true;
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local12 = _local7.SolvePositionConstraints();
_local11 = ((_local11) && (_local12));
_local5++;
};
if (((_local10) && (_local11))){
break;
};
m_positionIterationCount++;
};
};
Report(_local8.m_constraints);
if (_arg4){
_local13 = Number.MAX_VALUE;
_local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.m_invMass == 0){
} else {
if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){
_local6.m_sleepTime = 0;
_local13 = 0;
};
if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){
_local6.m_sleepTime = 0;
_local13 = 0;
} else {
_local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt);
_local13 = b2Math.b2Min(_local13, _local6.m_sleepTime);
};
};
_local5++;
};
if (_local13 >= b2Settings.b2_timeToSleep){
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag);
_local6.m_linearVelocity.SetZero();
_local6.m_angularVelocity = 0;
_local5++;
};
};
};
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:int;
var _local3:b2ContactSolver;
var _local4:Number;
var _local5:b2Body;
var _local6:Boolean;
_local3 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local3.SolveVelocityConstraints();
_local2++;
};
_local2 = 0;
while (_local2 < m_bodyCount) {
_local5 = m_bodies[_local2];
if (_local5.IsStatic()){
} else {
_local5.m_sweep.c0.SetV(_local5.m_sweep.c);
_local5.m_sweep.a0 = _local5.m_sweep.a;
_local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y));
_local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity));
_local5.SynchronizeTransform();
};
_local2++;
};
_local4 = 0.75;
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local6 = _local3.SolvePositionConstraints(_local4);
if (_local6){
break;
};
_local2++;
};
Report(_local3.m_constraints);
}
}
}//package Box2D.Dynamics
Section 73
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var warmStarting:Boolean;
public var positionCorrection:Boolean;
public var dt:Number;
public var maxIterations:int;
public var dtRatio:Number;
public var inv_dt:Number;
}
}//package Box2D.Dynamics
Section 74
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2World {
public var m_inv_dt0:Number;
public var m_boundaryListener:b2BoundaryListener;
public var m_contactList:b2Contact;
public var m_blockAllocator;
public var m_contactListener:b2ContactListener;
public var m_allowSleep:Boolean;
public var m_broadPhase:b2BroadPhase;
public var m_destructionListener:b2DestructionListener;
public var m_jointCount:int;
public var m_bodyCount:int;
public var m_lock:Boolean;
public var m_positionIterationCount:int;
public var m_groundBody:b2Body;
public var m_contactCount:int;
public var m_debugDraw:b2DebugDraw;
public var m_contactFilter:b2ContactFilter;
public var m_bodyList:b2Body;
public var m_stackAllocator;
public var m_jointList:b2Joint;
public var m_gravity:b2Vec2;
public var m_contactManager:b2ContactManager;
private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8);
public static var m_continuousPhysics:Boolean;
public static var m_warmStarting:Boolean;
private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6);
public static var m_positionCorrection:Boolean;
private static var s_xf:b2XForm = new b2XForm();
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
var _local4:b2BodyDef;
m_contactManager = new b2ContactManager();
super();
m_destructionListener = null;
m_boundaryListener = null;
m_contactFilter = b2ContactFilter.b2_defaultFilter;
m_contactListener = null;
m_debugDraw = null;
m_bodyList = null;
m_contactList = null;
m_jointList = null;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_positionCorrection = true;
m_warmStarting = true;
m_continuousPhysics = true;
m_allowSleep = _arg3;
m_gravity = _arg2;
m_lock = false;
m_inv_dt0 = 0;
m_contactManager.m_world = this;
m_broadPhase = new b2BroadPhase(_arg1, m_contactManager);
_local4 = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function DrawJoint(_arg1:b2Joint):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2XForm;
var _local5:b2XForm;
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Color;
var _local11:b2PulleyJoint;
var _local12:b2Vec2;
var _local13:b2Vec2;
_local2 = _arg1.m_body1;
_local3 = _arg1.m_body2;
_local4 = _local2.m_xf;
_local5 = _local3.m_xf;
_local6 = _local4.position;
_local7 = _local5.position;
_local8 = _arg1.GetAnchor1();
_local9 = _arg1.GetAnchor2();
_local10 = s_jointColor;
switch (_arg1.m_type){
case b2Joint.e_distanceJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
case b2Joint.e_pulleyJoint:
_local11 = (_arg1 as b2PulleyJoint);
_local12 = _local11.GetGroundAnchor1();
_local13 = _local11.GetGroundAnchor2();
m_debugDraw.DrawSegment(_local12, _local8, _local10);
m_debugDraw.DrawSegment(_local13, _local9, _local10);
m_debugDraw.DrawSegment(_local12, _local13, _local10);
break;
case b2Joint.e_mouseJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
default:
if (_local2 != m_groundBody){
m_debugDraw.DrawSegment(_local6, _local8, _local10);
};
m_debugDraw.DrawSegment(_local8, _local9, _local10);
if (_local3 != m_groundBody){
m_debugDraw.DrawSegment(_local7, _local9, _local10);
};
};
}
public function Refilter(_arg1:b2Shape):void{
_arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf);
}
public function SetDebugDraw(_arg1:b2DebugDraw):void{
m_debugDraw = _arg1;
}
public function SetContinuousPhysics(_arg1:Boolean):void{
m_continuousPhysics = _arg1;
}
public function GetProxyCount():int{
return (m_broadPhase.m_proxyCount);
}
public function DrawDebugData():void{
var _local1:uint;
var _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
var _local5:b2Joint;
var _local6:b2BroadPhase;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Color;
var _local11:b2XForm;
var _local12:b2AABB;
var _local13:b2AABB;
var _local14:Array;
var _local15:Boolean;
var _local16:uint;
var _local17:b2Pair;
var _local18:b2Proxy;
var _local19:b2Proxy;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:b2Proxy;
var _local23:b2PolygonShape;
var _local24:b2OBB;
var _local25:b2Vec2;
var _local26:b2Mat22;
var _local27:b2Vec2;
var _local28:Number;
if (m_debugDraw == null){
return;
};
m_debugDraw.m_sprite.graphics.clear();
_local1 = m_debugDraw.GetFlags();
_local7 = new b2Vec2();
_local8 = new b2Vec2();
_local9 = new b2Vec2();
_local10 = new b2Color(0, 0, 0);
_local12 = new b2AABB();
_local13 = new b2AABB();
_local14 = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
if ((_local1 & b2DebugDraw.e_shapeBit)){
_local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local3.IsStatic()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15);
} else {
if (_local3.IsSleeping()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15);
} else {
DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15);
};
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_jointBit)){
_local5 = m_jointList;
while (_local5) {
DrawJoint(_local5);
_local5 = _local5.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local6 = m_broadPhase;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.9, 0.3);
_local2 = 0;
while (_local2 < b2Pair.b2_tableCapacity) {
_local16 = _local6.m_pairManager.m_hashTable[_local2];
while (_local16 != b2Pair.b2_nullPair) {
_local17 = _local6.m_pairManager.m_pairs[_local16];
_local18 = _local6.m_proxyPool[_local17.proxyId1];
_local19 = _local6.m_proxyPool[_local17.proxyId2];
_local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value));
_local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value));
_local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value));
_local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value));
_local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value));
_local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value));
_local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value));
_local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value));
_local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x));
_local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y));
_local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x));
_local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y));
m_debugDraw.DrawSegment(_local8, _local9, _local10);
_local16 = _local17.next;
};
_local2++;
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local6 = m_broadPhase;
_local20 = _local6.m_worldAABB.lowerBound;
_local21 = _local6.m_worldAABB.upperBound;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.3, 0.9);
_local2 = 0;
while (_local2 < b2Settings.b2_maxProxies) {
_local22 = _local6.m_proxyPool[_local2];
if (_local22.IsValid() == false){
} else {
_local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value));
_local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value));
_local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value));
_local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value));
_local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y);
_local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y);
_local14[2].Set(_local12.upperBound.x, _local12.upperBound.y);
_local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y);
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local2++;
};
_local14[0].Set(_local20.x, _local20.y);
_local14[1].Set(_local21.x, _local20.y);
_local14[2].Set(_local21.x, _local21.y);
_local14[3].Set(_local20.x, _local21.y);
m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9));
};
if ((_local1 & b2DebugDraw.e_obbBit)){
_local10.Set(0.5, 0.3, 0.5);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local4.m_type != b2Shape.e_polygonShape){
} else {
_local23 = (_local4 as b2PolygonShape);
_local24 = _local23.GetOBB();
_local25 = _local24.extents;
_local14[0].Set(-(_local25.x), -(_local25.y));
_local14[1].Set(_local25.x, -(_local25.y));
_local14[2].Set(_local25.x, _local25.y);
_local14[3].Set(-(_local25.x), _local25.y);
_local2 = 0;
while (_local2 < 4) {
_local26 = _local24.R;
_local27 = _local14[_local2];
_local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local26 = _local11.R;
_local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local2++;
};
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_centerOfMassBit)){
_local3 = m_bodyList;
while (_local3) {
_local11 = s_xf;
_local11.R = _local3.m_xf.R;
_local11.position = _local3.GetWorldCenter();
m_debugDraw.DrawXForm(_local11);
_local3 = _local3.m_next;
};
};
}
public function DestroyBody(_arg1:b2Body):void{
var _local2:b2JointEdge;
var _local3:b2Shape;
var _local4:b2JointEdge;
var _local5:b2Shape;
if (m_lock == true){
return;
};
_local2 = _arg1.m_jointList;
while (_local2) {
_local4 = _local2;
_local2 = _local2.next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeJoint(_local4.joint);
};
DestroyJoint(_local4.joint);
};
_local3 = _arg1.m_shapeList;
while (_local3) {
_local5 = _local3;
_local3 = _local3.m_next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeShape(_local5);
};
_local5.DestroyProxy(m_broadPhase);
b2Shape.Destroy(_local5, m_blockAllocator);
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_bodyList){
m_bodyList = _arg1.m_next;
};
m_bodyCount--;
}
public function SetContactFilter(_arg1:b2ContactFilter):void{
m_contactFilter = _arg1;
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{
var _local5:b2Color;
var _local6:b2CircleShape;
var _local7:b2Vec2;
var _local8:Number;
var _local9:b2Vec2;
var _local10:int;
var _local11:b2PolygonShape;
var _local12:int;
var _local13:Array;
var _local14:Array;
var _local15:Array;
_local5 = s_coreColor;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local6 = (_arg1 as b2CircleShape);
_local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition);
_local8 = _local6.m_radius;
_local9 = _arg2.R.col1;
m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3);
if (_arg4){
m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5);
};
break;
case b2Shape.e_polygonShape:
_local11 = (_arg1 as b2PolygonShape);
_local12 = _local11.GetVertexCount();
_local13 = _local11.GetVertices();
_local14 = new Array(b2Settings.b2_maxPolygonVertices);
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]);
_local10++;
};
m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3);
if (_arg4){
_local15 = _local11.GetCoreVertices();
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]);
_local10++;
};
m_debugDraw.DrawPolygon(_local14, _local12, _local5);
};
break;
};
}
public function GetContactCount():int{
return (m_contactCount);
}
public function Solve(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Island;
var _local4:b2Contact;
var _local5:b2Joint;
var _local6:int;
var _local7:Array;
var _local8:b2Body;
var _local9:int;
var _local10:int;
var _local11:b2Body;
var _local12:b2ContactEdge;
var _local13:b2JointEdge;
var _local14:Boolean;
m_positionIterationCount = 0;
_local3 = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2 = _local2.m_next;
};
_local4 = m_contactList;
while (_local4) {
_local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag));
_local4 = _local4.m_next;
};
_local5 = m_jointList;
while (_local5) {
_local5.m_islandFlag = false;
_local5 = _local5.m_next;
};
_local6 = m_bodyCount;
_local7 = new Array(_local6);
_local8 = m_bodyList;
while (_local8) {
if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){
} else {
if (_local8.IsStatic()){
} else {
_local3.Clear();
_local9 = 0;
var _temp1 = _local9;
_local9 = (_local9 + 1);
var _local15 = _temp1;
_local7[_local15] = _local8;
_local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag);
while (_local9 > 0) {
--_local9;
_local2 = _local7[_local9];
_local3.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local12 = _local2.m_contactList;
while (_local12) {
if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){
} else {
if (_local12.contact.m_manifoldCount == 0){
} else {
_local3.AddContact(_local12.contact);
_local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag);
_local11 = _local12.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local9;
_local9 = (_local9 + 1);
var _local16 = _temp2;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
};
_local12 = _local12.next;
};
_local13 = _local2.m_jointList;
while (_local13) {
if (_local13.joint.m_islandFlag == true){
} else {
_local3.AddJoint(_local13.joint);
_local13.joint.m_islandFlag = true;
_local11 = _local13.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local9;
_local9 = (_local9 + 1);
_local16 = _temp3;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
_local13 = _local13.next;
};
};
};
_local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep);
if (_local3.m_positionIterationCount > m_positionIterationCount){
m_positionIterationCount = _local3.m_positionIterationCount;
};
_local10 = 0;
while (_local10 < _local3.m_bodyCount) {
_local2 = _local3.m_bodies[_local10];
if (_local2.IsStatic()){
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
};
_local10++;
};
};
};
_local8 = _local8.m_next;
};
_local2 = m_bodyList;
while (_local2) {
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local14 = _local2.SynchronizeShapes();
if ((((_local14 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
};
};
_local2 = _local2.m_next;
};
m_broadPhase.Commit();
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array;
var _local5:int;
var _local6:int;
_local4 = new Array(_arg3);
_local5 = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
_local6 = 0;
while (_local6 < _local5) {
_arg2[_local6] = _local4[_local6];
_local6++;
};
return (_local5);
}
public function SetGravity(_arg1:b2Vec2):void{
m_gravity = _arg1;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local8:b2Island;
var _local9:int;
var _local10:Array;
var _local11:b2Contact;
var _local12:b2Contact;
var _local13:Number;
var _local14:b2Body;
var _local15:int;
var _local16:b2TimeStep;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:b2Body;
var _local21:Boolean;
_local8 = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener);
_local9 = m_bodyCount;
_local10 = new Array(_local9);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2.m_sweep.t0 = 0;
_local2 = _local2.m_next;
};
_local11 = m_contactList;
while (_local11) {
_local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local11 = _local11.m_next;
};
while (true) {
_local12 = null;
_local13 = 1;
_local11 = m_contactList;
for (;_local11;(_local11 = _local11.m_next)) {
if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){
} else {
_local18 = 1;
if ((_local11.m_flags & b2Contact.e_toiFlag)){
_local18 = _local11.m_toi;
} else {
_local3 = _local11.m_shape1;
_local4 = _local11.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){
continue;
};
_local19 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local19 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local19);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local19 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local19);
};
};
_local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep);
if ((((_local18 > 0)) && ((_local18 < 1)))){
_local18 = (((1 - _local18) * _local19) + _local18);
if (_local18 > 1){
_local18 = 1;
};
};
_local11.m_toi = _local18;
_local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){
_local12 = _local11;
_local13 = _local18;
};
};
};
if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){
break;
};
_local3 = _local12.m_shape1;
_local4 = _local12.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local5.Advance(_local13);
_local6.Advance(_local13);
_local12.Update(m_contactListener);
_local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag));
if (_local12.m_manifoldCount == 0){
} else {
_local14 = _local5;
if (_local14.IsStatic()){
_local14 = _local6;
};
_local8.Clear();
_local15 = 0;
var _temp1 = _local15;
_local15 = (_local15 + 1);
var _local22 = _temp1;
_local10[_local22] = _local14;
_local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag);
while (_local15 > 0) {
--_local15;
_local2 = _local10[_local15];
_local8.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local8.m_contactCount == _local8.m_contactCapacity){
} else {
if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){
} else {
if (_local7.contact.m_manifoldCount == 0){
} else {
_local8.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local20 = _local7.other;
if ((_local20.m_flags & b2Body.e_islandFlag)){
} else {
if (_local20.IsStatic() == false){
_local20.Advance(_local13);
_local20.WakeUp();
};
var _temp2 = _local15;
_local15 = (_local15 + 1);
var _local23 = _temp2;
_local10[_local23] = _local20;
_local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local7 = _local7.next;
};
};
};
_local16 = new b2TimeStep();
_local16.dt = ((1 - _local13) * _arg1.dt);
_local16.inv_dt = (1 / _local16.dt);
_local16.maxIterations = _arg1.maxIterations;
_local8.SolveTOI(_local16);
_local17 = 0;
while (_local17 < _local8.m_bodyCount) {
_local2 = _local8.m_bodies[_local17];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local21 = _local2.SynchronizeShapes();
if ((((_local21 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
_local7 = _local2.m_contactList;
while (_local7) {
_local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag));
_local7 = _local7.next;
};
};
};
_local17++;
};
_local17 = 0;
while (_local17 < _local8.m_contactCount) {
_local11 = _local8.m_contacts[_local17];
_local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local17++;
};
m_broadPhase.Commit();
};
};
}
public function GetJointList():b2Joint{
return (m_jointList);
}
public function Validate():void{
m_broadPhase.Validate();
}
public function GetPairCount():int{
return (m_broadPhase.m_pairManager.m_pairCount);
}
public function GetBodyList():b2Body{
return (m_bodyList);
}
public function SetWarmStarting(_arg1:Boolean):void{
m_warmStarting = _arg1;
}
public function SetPositionCorrection(_arg1:Boolean):void{
m_positionCorrection = _arg1;
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local2:b2Joint;
var _local3:b2Body;
var _local4:b2Shape;
_local2 = b2Joint.Create(_arg1, m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_node1.joint = _local2;
_local2.m_node1.other = _local2.m_body2;
_local2.m_node1.prev = null;
_local2.m_node1.next = _local2.m_body1.m_jointList;
if (_local2.m_body1.m_jointList){
_local2.m_body1.m_jointList.prev = _local2.m_node1;
};
_local2.m_body1.m_jointList = _local2.m_node1;
_local2.m_node2.joint = _local2;
_local2.m_node2.other = _local2.m_body1;
_local2.m_node2.prev = null;
_local2.m_node2.next = _local2.m_body2.m_jointList;
if (_local2.m_body2.m_jointList){
_local2.m_body2.m_jointList.prev = _local2.m_node2;
};
_local2.m_body2.m_jointList = _local2.m_node2;
if (_arg1.collideConnected == false){
_local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.RefilterProxy(m_broadPhase, _local3.m_xf);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local2:Boolean;
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Body;
var _local6:b2Shape;
_local2 = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_jointList){
m_jointList = _arg1.m_next;
};
_local3 = _arg1.m_body1;
_local4 = _arg1.m_body2;
_local3.WakeUp();
_local4.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local4.m_jointList){
_local4.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, m_blockAllocator);
m_jointCount--;
if (_local2 == false){
_local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.RefilterProxy(m_broadPhase, _local5.m_xf);
_local6 = _local6.m_next;
};
};
}
public function SetContactListener(_arg1:b2ContactListener):void{
m_contactListener = _arg1;
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
var _local2:b2Body;
if (m_lock == true){
return (null);
};
_local2 = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
public function SetBoundaryListener(_arg1:b2BoundaryListener):void{
m_boundaryListener = _arg1;
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function Step(_arg1:Number, _arg2:int):void{
var _local3:b2TimeStep;
m_lock = true;
_local3 = new b2TimeStep();
_local3.dt = _arg1;
_local3.maxIterations = _arg2;
if (_arg1 > 0){
_local3.inv_dt = (1 / _arg1);
} else {
_local3.inv_dt = 0;
};
_local3.dtRatio = (m_inv_dt0 * _arg1);
_local3.positionCorrection = m_positionCorrection;
_local3.warmStarting = m_warmStarting;
m_contactManager.Collide();
if (_local3.dt > 0){
Solve(_local3);
};
if (((m_continuousPhysics) && ((_local3.dt > 0)))){
SolveTOI(_local3);
};
DrawDebugData();
m_inv_dt0 = _local3.inv_dt;
m_lock = false;
}
public function GetBodyCount():int{
return (m_bodyCount);
}
public function GetJointCount():int{
return (m_jointCount);
}
}
}//package Box2D.Dynamics
Section 75
//BackgroundsLoader_2 (WaterWerks_fla.BackgroundsLoader_2)
package WaterWerks_fla {
import flash.display.*;
public dynamic class BackgroundsLoader_2 extends MovieClip {
public var sky:MovieClip;
}
}//package WaterWerks_fla
Section 76
//bubble_logo3_27 (WaterWerks_fla.bubble_logo3_27)
package WaterWerks_fla {
import flash.display.*;
public dynamic class bubble_logo3_27 extends MovieClip {
public function bubble_logo3_27(){
addFrameScript(0, frame1, 9, frame10);
}
function frame10(){
stop();
}
function frame1(){
stop();
}
}
}//package WaterWerks_fla
Section 77
//bubblebox_smallLogo2_47 (WaterWerks_fla.bubblebox_smallLogo2_47)
package WaterWerks_fla {
import flash.display.*;
public dynamic class bubblebox_smallLogo2_47 extends MovieClip {
public function bubblebox_smallLogo2_47(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WaterWerks_fla
Section 78
//BubbleBoxLogoGraphicMc_29 (WaterWerks_fla.BubbleBoxLogoGraphicMc_29)
package WaterWerks_fla {
import flash.display.*;
public dynamic class BubbleBoxLogoGraphicMc_29 extends MovieClip {
public var play_latest_text:MovieClip;
}
}//package WaterWerks_fla
Section 79
//BubbleBoxSplash_25 (WaterWerks_fla.BubbleBoxSplash_25)
package WaterWerks_fla {
import flash.display.*;
public dynamic class BubbleBoxSplash_25 extends MovieClip {
public var link:MovieClip;
public var play_latest_text:MovieClip;
public function BubbleBoxSplash_25(){
addFrameScript(0, frame1, 150, frame151, 160, frame161);
}
function frame151(){
MovieClip(parent).stop();
}
function frame161(){
stop();
MovieClip(parent).play();
}
function frame1(){
}
}
}//package WaterWerks_fla
Section 80
//flash_134 (WaterWerks_fla.flash_134)
package WaterWerks_fla {
import flash.display.*;
public dynamic class flash_134 extends MovieClip {
public function flash_134(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WaterWerks_fla
Section 81
//InstructionsScreenInner_62 (WaterWerks_fla.InstructionsScreenInner_62)
package WaterWerks_fla {
import flash.display.*;
public dynamic class InstructionsScreenInner_62 extends MovieClip {
public var buttonDone:SimpleButton;
public var buttonClose:SimpleButton;
public var buttonContinue:SimpleButton;
}
}//package WaterWerks_fla
Section 82
//kibalogo_45 (WaterWerks_fla.kibalogo_45)
package WaterWerks_fla {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class kibalogo_45 extends MovieClip {
public var clickBtn:SimpleButton;
public function kibalogo_45(){
addFrameScript(0, frame1);
}
function frame1(){
clickBtn.useHandCursor = true;
clickBtn.addEventListener(MouseEvent.CLICK, visitkiba);
}
public function visitkiba(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.kibagames.com/");
navigateToURL(_local2, "_blank");
}
}
}//package WaterWerks_fla
Section 83
//Kongintro30fps_9 (WaterWerks_fla.Kongintro30fps_9)
package WaterWerks_fla {
import flash.events.*;
import flash.display.*;
public dynamic class Kongintro30fps_9 extends MovieClip {
public function Kongintro30fps_9(){
addFrameScript(1, frame2, 198, frame199);
}
function frame199(){
trace("shopping kong intro");
stop();
MovieClip(parent).play();
}
function frame2(){
addEventListener(MouseEvent.CLICK, TitleScreenState.buttonKongregatePressed);
trace("starting kong intro");
}
}
}//package WaterWerks_fla
Section 84
//LevelSelectOver_85 (WaterWerks_fla.LevelSelectOver_85)
package WaterWerks_fla {
import flash.display.*;
public dynamic class LevelSelectOver_85 extends MovieClip {
public function LevelSelectOver_85(){
addFrameScript(8, frame9, 19, frame20);
}
function frame20(){
stop();
}
function frame9(){
stop();
}
}
}//package WaterWerks_fla
Section 85
//MainTimeline (WaterWerks_fla.MainTimeline)
package WaterWerks_fla {
import flash.events.*;
import flash.display.*;
public dynamic class MainTimeline extends MovieClip {
public var kongaiAd:MovieClip;
public var bubbleBoxIntro:MovieClip;
public var playBubbleBoxIntro:Boolean;
public var kongIntro:MovieClip;
public var playKongIntro:Boolean;
public var r:Number;
public var loaderback:MovieClip;
public var preloaderMC:MovieClip;
public var domain:String;
public function MainTimeline(){
addFrameScript(0, frame1, 5, frame6, 17, frame18);
}
function frame18(){
removeChild(loaderback);
loaderback = null;
removeChild(preloaderMC);
preloaderMC = null;
if (kongIntro != null){
removeChild(kongIntro);
kongIntro = null;
};
if (bubbleBoxIntro != null){
removeChild(bubbleBoxIntro);
bubbleBoxIntro = null;
};
stop();
}
function frame6(){
if (playKongIntro){
stop();
kongIntro.visible = true;
kongIntro.gotoAndPlay(1);
};
if (playBubbleBoxIntro){
stop();
bubbleBoxIntro.visible = true;
bubbleBoxIntro.gotoAndPlay(1);
};
}
function frame1(){
kongIntro.visible = false;
kongIntro.stop();
bubbleBoxIntro.visible = false;
bubbleBoxIntro.stop();
domain = Domain.GetDomain(this);
playKongIntro = false;
playBubbleBoxIntro = false;
if ((((((domain == "addictinggames.com")) || ((domain == "kaisergames.de")))) || ((domain == "bubblebox.com")))){
if (domain == "addictinggames.com"){
playKongIntro = false;
gotoAndPlay(10);
} else {
if (domain == "bubblebox.com"){
playBubbleBoxIntro = true;
gotoAndPlay(10);
} else {
playKongIntro = true;
gotoAndPlay(2);
};
};
} else {
playKongIntro = true;
r = Math.random();
r = (r * 0.5);
if (r >= 0.49999){
r = 0;
};
if (r <= 0.25){
MochiAd.showPreGameAd({clip:root, id:"9109270d5f33455d", res:"640x570"});
} else {
if (r <= 0.5){
MochiAd.showPreGameAd({clip:root, id:"73b6d4ee3010c313", res:"640x570"});
} else {
stop();
kongaiAd = new KongregateKongAIAd();
addChild(kongaiAd);
kongaiAd.x = 174;
kongaiAd.y = 138;
kongaiAd.addEventListener("finished", KongAIAdFinished);
kongaiAd.addEventListener(MouseEvent.CLICK, TitleScreenState.KongAIAdClicked);
};
};
};
}
public function KongAIAdFinished(_arg1:Event){
removeChild(kongaiAd);
kongaiAd = null;
trace("finished");
play();
}
}
}//package WaterWerks_fla
Section 86
//text1_128 (WaterWerks_fla.text1_128)
package WaterWerks_fla {
import flash.display.*;
public dynamic class text1_128 extends MovieClip {
public function text1_128(){
addFrameScript(74, frame75);
}
function frame75(){
stop();
}
}
}//package WaterWerks_fla
Section 87
//Text2_130 (WaterWerks_fla.Text2_130)
package WaterWerks_fla {
import flash.display.*;
public dynamic class Text2_130 extends MovieClip {
public function Text2_130(){
addFrameScript(99, frame100);
}
function frame100(){
stop();
}
}
}//package WaterWerks_fla
Section 88
//Text3_132 (WaterWerks_fla.Text3_132)
package WaterWerks_fla {
import flash.display.*;
public dynamic class Text3_132 extends MovieClip {
public function Text3_132(){
addFrameScript(129, frame130);
}
function frame130(){
stop();
}
}
}//package WaterWerks_fla
Section 89
//TextClip_111 (WaterWerks_fla.TextClip_111)
package WaterWerks_fla {
import flash.display.*;
public dynamic class TextClip_111 extends MovieClip {
public function TextClip_111(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package WaterWerks_fla
Section 90
//BackgroundBits (BackgroundBits)
package {
import flash.display.*;
public dynamic class BackgroundBits extends MovieClip {
}
}//package
Section 91
//Backgrounds (Backgrounds)
package {
import flash.display.*;
public dynamic class Backgrounds extends MovieClip {
public var sky:MovieClip;
}
}//package
Section 92
//Ball1 (Ball1)
package {
import flash.display.*;
public dynamic class Ball1 extends MovieClip {
}
}//package
Section 93
//Ball2 (Ball2)
package {
import flash.display.*;
public dynamic class Ball2 extends MovieClip {
}
}//package
Section 94
//Ball3 (Ball3)
package {
import flash.display.*;
public dynamic class Ball3 extends MovieClip {
}
}//package
Section 95
//BlockBits (BlockBits)
package {
import flash.display.*;
public dynamic class BlockBits extends MovieClip {
}
}//package
Section 96
//bubblebox_score (bubblebox_score)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import flash.media.*;
import flash.net.*;
import flash.ui.*;
import flash.filters.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
public dynamic class bubblebox_score extends MovieClip {
public var loader:URLLoader;
public var loadingStatus:String;
public var hexChars:String;
public var score:Number;
public var gameID:Number;
public var insertname:TextField;
public function bubblebox_score(){
addFrameScript(0, frame1);
}
public function hh(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (tr(h, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
public function hash(_arg1:String):String{
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (hashBinary(_local2));
}
public function removeListeners():void{
loader.removeEventListener(Event.COMPLETE, completeHandler);
loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
loader.removeEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}
public function clicked(_arg1:MouseEvent):void{
var _local2:String;
var _local3:String;
var _local4:String;
var _local5:String;
var _local6:URLVariables;
var _local7:URLRequest;
if (loadingStatus == "insertName"){
if (((((!((_arg1.target.name == "insertName"))) && (!((this.insertname.text == "YOUR NAME"))))) && ((this.insertname.text.length > 0)))){
_local2 = this.insertname.text;
_local3 = ((((gameID + "_") + score) + "_") + _local2);
_local4 = ((((((((((gameID + "_") + "4234232143214421") + "_") + score) + "_") + "2537625476251") + "_") + _local2) + "_") + "desleutelistessa");
_local5 = hash(_local4);
_local6 = new URLVariables();
_local6.datastring = _local3;
_local6.hashstring = _local5;
_local7 = new URLRequest("http://www.bubblebox.com/scripts/insertscore2008.php");
_local7.data = _local6;
_local7.method = URLRequestMethod.POST;
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, completeHandler, false, 0, true);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler, false, 0, true);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);
loader.load(_local7);
this.gotoAndStop(2);
loadingStatus = "sending";
};
} else {
if (loadingStatus == "sending"){
} else {
if (loadingStatus == "completed"){
navigateToURL(new URLRequest((("http://www.bubblebox.com/highscores/" + gameID) + ".htm")), "_blank");
} else {
if (loadingStatus == "failed"){
loadingStatus = "insertName";
this.gotoAndStop(1);
};
};
};
};
}
public function ii(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (tr(i, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
public function failed():void{
loadingStatus = "failed";
removeListeners();
this.gotoAndStop(4);
}
public function setScore(_arg1:Number, _arg2:Number):void{
score = _arg1;
gameID = _arg2;
}
public function f(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg2) | (~(_arg1) & _arg3)));
}
public function i(_arg1:int, _arg2:int, _arg3:int):int{
return ((_arg2 ^ (_arg1 | ~(_arg3))));
}
function frame1(){
hexChars = "0123456789abcdef";
this.stage.focus = this.insertname;
this.insertname.setSelection(0, this.insertname.text.length);
loader = new URLLoader();
loadingStatus = "insertName";
this.addEventListener(MouseEvent.CLICK, clicked, false, 0, true);
stop();
}
public function g(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg3) | (_arg2 & ~(_arg3))));
}
public function h(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 ^ _arg2) ^ _arg3));
}
public function ioErrorHandler(_arg1:IOErrorEvent):void{
trace("ioError");
failed();
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
trace("securityError");
failed();
}
public function toHex(_arg1:int, _arg2:Boolean=false):String{
var _local3:String;
var _local4:int;
var _local5:int;
_local3 = "";
if (_arg2){
_local4 = 0;
while (_local4 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> (((3 - _local4) * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> ((3 - _local4) * 8)) & 15))));
_local4++;
};
} else {
_local5 = 0;
while (_local5 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> ((_local5 * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> (_local5 * 8)) & 15))));
_local5++;
};
};
return (_local3);
}
public function createBlocks(_arg1:ByteArray):Array{
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = new Array();
_local3 = (_arg1.length * 8);
_local4 = 0xFF;
_local5 = 0;
while (_local5 < _local3) {
_local2[int((_local5 >> 5))] = (_local2[int((_local5 >> 5))] | ((_arg1[(_local5 / 8)] & _local4) << (_local5 % 32)));
_local5 = (_local5 + 8);
};
_local2[int((_local3 >> 5))] = (_local2[int((_local3 >> 5))] | (128 << (_local3 % 32)));
_local2[int(((((_local3 + 64) >>> 9) << 4) + 14))] = _local3;
return (_local2);
}
public function hashBinary(_arg1:ByteArray):String{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:int;
_local2 = 1732584193;
_local3 = -271733879;
_local4 = -1732584194;
_local5 = 271733878;
_local10 = createBlocks(_arg1);
_local11 = _local10.length;
_local12 = 0;
while (_local12 < _local11) {
_local6 = _local2;
_local7 = _local3;
_local8 = _local4;
_local9 = _local5;
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 7, -680876936);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 1))], 12, -389564586);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 17, 606105819);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 3))], 22, -1044525330);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 7, -176418897);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 5))], 12, 1200080426);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 17, -1473231341);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 7))], 22, -45705983);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 7, 1770035416);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 9))], 12, -1958414417);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 17, -42063);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 11))], 22, -1990404162);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 7, 1804603682);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 13))], 12, -40341101);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 17, -1502002290);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 15))], 22, 1236535329);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 5, -165796510);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 6))], 9, -1069501632);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 14, 643717713);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 0))], 20, -373897302);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 5, -701558691);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 10))], 9, 38016083);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 14, -660478335);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 4))], 20, -405537848);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 5, 568446438);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 14))], 9, -1019803690);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 14, -187363961);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 8))], 20, 1163531501);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 5, -1444681467);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 2))], 9, -51403784);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 14, 1735328473);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 12))], 20, -1926607734);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 4, -378558);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 8))], 11, -2022574463);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 16, 1839030562);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 14))], 23, -35309556);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 4, -1530992060);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 4))], 11, 1272893353);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 16, -155497632);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 10))], 23, -1094730640);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 4, 681279174);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 0))], 11, -358537222);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 16, -722521979);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 6))], 23, 76029189);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 4, -640364487);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 12))], 11, -421815835);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 16, 530742520);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 2))], 23, -995338651);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 6, -198630844);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 7))], 10, 1126891415);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 15, -1416354905);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 5))], 21, -57434055);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 6, 1700485571);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 3))], 10, -1894986606);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 15, -1051523);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 1))], 21, -2054922799);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 6, 1873313359);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 15))], 10, -30611744);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 15, -1560198380);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 13))], 21, 1309151649);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 6, -145523070);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 11))], 10, -1120210379);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 15, 718787259);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 9))], 21, -343485551);
_local2 = (_local2 + _local6);
_local3 = (_local3 + _local7);
_local4 = (_local4 + _local8);
_local5 = (_local5 + _local9);
_local12 = (_local12 + 16);
};
return ((((toHex(_local2) + toHex(_local3)) + toHex(_local4)) + toHex(_local5)));
}
public function tr(_arg1:Function, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int):int{
var _local9:int;
_local9 = (((_arg2 + int(_arg1(_arg3, _arg4, _arg5))) + _arg6) + _arg8);
return ((rol(_local9, _arg7) + _arg3));
}
public function rol(_arg1:int, _arg2:int):int{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
public function completeHandler(_arg1:Event):void{
loadingStatus = "completed";
removeListeners();
this.gotoAndStop(3);
}
public function ror(_arg1:int, _arg2:int):uint{
var _local3:int;
_local3 = (32 - _arg2);
return (((_arg1 << _local3) | (_arg1 >>> (32 - _local3))));
}
public function gg(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (tr(g, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
public function ff(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (tr(f, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
}
}//package
Section 97
//buttonRestart (buttonRestart)
package {
import flash.display.*;
public dynamic class buttonRestart extends SimpleButton {
}
}//package
Section 98
//c1 (c1)
package {
public dynamic class c1 extends Card {
}
}//package
Section 99
//c2 (c2)
package {
public dynamic class c2 extends Card {
}
}//package
Section 100
//c3 (c3)
package {
public dynamic class c3 extends Card {
}
}//package
Section 101
//c4 (c4)
package {
public dynamic class c4 extends Card {
}
}//package
Section 102
//Card (Card)
package {
import flash.events.*;
import flash.display.*;
dynamic class Card extends MovieClip {
public var orot:Number;
public var oSpeed:Number;
public var yDir:String;
public var speed:Number;
public var r:Number;
public var firstTime:Boolean;// = true
public var dir:String;
public var time:Number;
public var ox:Number;
public var oy:Number;
public static var WIDTH = 300;
public static var ranNum:Array = [9, 7, 3, 1, 2, 4, 5, 8, 6, 10];
public static var ranNumIndex:Number = 0;
public static var HEIGHT = 250;
function Card(){
firstTime = true;
super();
addEventListener("enterFrame", onEnterFrame);
}
public function randomNumber(){
ranNumIndex++;
if (ranNumIndex == ranNum.length){
ranNumIndex = 0;
};
return (ranNum[ranNumIndex]);
}
public function Init(){
cacheAsBitmap = true;
this.forceSmoothing = true;
ox = this.x;
oy = this.y;
orot = this.rotation;
time = 1;
speed = (randomNumber() + 5);
oSpeed = speed;
if (randomNumber() < 3){
r = (randomNumber() + 5);
} else {
r = 0;
};
if (this.x < (WIDTH / 2)){
dir = "left";
} else {
dir = "right";
};
if (this.y < (HEIGHT / 2)){
yDir = "up";
} else {
yDir = "down";
};
}
public function resetCards(){
}
public function onEnterFrame(_arg1:Event){
if (firstTime == true){
firstTime = false;
Init();
return;
};
time = (time + 1);
if (time > 30){
if (dir == "left"){
this.x = (this.x - speed);
speed = (speed * 1.1);
if (r != 0){
this.rotation = (this.rotation + r);
};
if (this.x <= -50){
dir = "stop";
};
};
if (dir == "right"){
this.x = (this.x + speed);
speed = (speed * 1.1);
if (r != 0){
this.rotation = (this.rotation + r);
};
if (this.x >= (WIDTH + 50)){
dir = "stop";
};
};
if (yDir == "up"){
this.y = (this.y - 2);
};
if (yDir == "down"){
this.y = (this.y + 2);
};
if (time > 250){
time = 1;
resetCards();
if (x < (WIDTH / 2)){
dir = "left";
} else {
dir = "right";
};
};
};
}
}
}//package
Section 103
//Collision (Collision)
package {
import flash.geom.*;
public class Collision {
public static var stats_numIntersections:int;
static var PolyCollision_LineHit:Line;
public static var IntersectionX:Number = 0;
public static var IntersectionY:Number = 0;
public static var stats_numBBTests:int;
public static var stats_numPolyCollisionTests:int;
public static var closestX:Number = 0;
public static var closestY:Number = 0;
public static var closestInfiniteX:Number = 0;
public static var closestInfiniteY:Number = 0;
public static var main:Main;
public static function FindNearestPathStartPointToPos(_arg1:Number, _arg2:Number):Poly{
var _local3:Poly;
var _local4:Number;
var _local5:Poly;
var _local6:Point;
var _local7:*;
_local3 = null;
_local4 = 99999999;
for each (_local5 in Game.polygonList) {
if (((_local5.active) && ((_local5.type == Poly.polytype_PATH)))){
_local6 = _local5.GetPoint(0);
_local7 = Utils.Dist2BetweenPoints(_local6.x, _local6.y, _arg1, _arg2);
if (_local7 < _local4){
_local4 = _local7;
_local3 = _local5;
};
};
};
return (_local3);
}
static function SideOfLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Boolean{
var _local7:Number;
_local7 = DotProduct((_arg3 - _arg1), (_arg4 - _arg2), (_arg5 - _arg1), (_arg6 - _arg2));
if (_local7 < 0){
return (false);
};
return (true);
}
static function GameObjectInPolyBoundingBox(_arg1:GameObj, _arg2:Poly):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = (_arg1.radius + 50);
_local4 = _arg1.xpos;
_local5 = _arg1.ypos;
if (_arg2.boundingRectangle == null){
return (false);
};
stats_numBBTests++;
if (_local4 < (_arg2.boundingRectangle.left - _local3)){
return (false);
};
if (_local4 > (_arg2.boundingRectangle.right + _local3)){
return (false);
};
if (_local5 < (_arg2.boundingRectangle.top - _local3)){
return (false);
};
if (_local5 > (_arg2.boundingRectangle.bottom + _local3)){
return (false);
};
return (true);
}
static function DotProduct(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
_local5 = ((_arg1 * _arg3) + (_arg2 * _arg4));
return (_local5);
}
static function PolyCollision(_arg1:GameObj, _arg2:Poly, _arg3:Number, _arg4:Number, _arg5:Number):Boolean{
var _local6:Array;
var _local7:Array;
var _local8:Line;
var _local9:Boolean;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Line;
var _local16:int;
var _local17:int;
var _local18:*;
var _local19:Number;
var _local20:Number;
var _local21:Line;
var _local22:Line;
stats_numPolyCollisionTests++;
_local6 = new Array();
_local7 = new Array();
_local11 = (_arg1.xpos + _arg3);
_local12 = (_arg1.ypos + _arg4);
_local13 = _arg5;
_local14 = (_arg5 * _local13);
for each (_local15 in _arg2.lineList) {
_local9 = SideOfLine(_local15.x0, _local15.y0, _local15.x1, _local15.y1, _local11, _local12);
if (_local9 == true){
_local10 = Dist2ToLine(_local15.x0, _local15.y0, _local15.x1, _local15.y1, _local11, _local12);
if (_local10 < _local14){
_local6.push(_local15);
_local7.push(_local10);
};
};
};
_local18 = _local6.length;
_local16 = 0;
while (_local16 < (_local18 - 1)) {
_local17 = _local16;
while (_local17 < _local18) {
_local19 = _local7[_local16];
_local20 = _local7[_local17];
_local21 = _local6[_local16];
_local22 = _local6[_local17];
if (_local20 < _local19){
_local7[_local16] = _local20;
_local7[_local17] = _local19;
_local6[_local16] = _local22;
_local6[_local17] = _local21;
};
_local17++;
};
_local16++;
};
_local16 = 0;
while (_local16 < _local18) {
_local8 = _local6[_local16];
_local9 = SideOfLine(_local8.x0, _local8.y0, _local8.x1, _local8.y1, _local11, _local12);
if (_local9 == true){
_local10 = Dist2ToLine(_local8.x0, _local8.y0, _local8.x1, _local8.y1, _local11, _local12);
if (_local10 < _local14){
stats_numIntersections++;
Intersected(_arg1, _local8, closestX, closestY, _arg3, _arg4, _arg5);
PolyCollision_LineHit = _local8;
return (true);
};
};
return (true);
_local16++;
};
return (false);
}
public static function LineLineIntersection(_arg1:Line, _arg2:Line):Boolean{
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:Number;
var _local18:Number;
_local3 = _arg1.x0;
_local4 = _arg1.y0;
_local5 = _arg1.x1;
_local6 = _arg1.y1;
_local7 = _arg2.x0;
_local8 = _arg2.y0;
_local9 = _arg2.x1;
_local10 = _arg2.y1;
_local11 = (_local5 - _local3);
_local12 = (_local9 - _local7);
_local13 = ((_local6 - _local4) / _local11);
_local14 = ((_local10 - _local8) / _local12);
_local15 = (_local4 - (_local13 * _local3));
_local16 = (_local8 - (_local14 * _local7));
_local17 = ((_local15 - _local16) / (_local14 - _local13));
_local18 = (((_local13 * (_local16 - _local15)) / (_local13 - _local14)) + _local15);
if (_arg1.boundingRect.contains(_local17, _local18)){
if (_arg2.boundingRect.contains(_local17, _local18)){
IntersectionX = _local17;
IntersectionY = _local18;
return (true);
};
};
return (false);
}
public static function FindHighestFloorPos(_arg1:Number):Number{
var _local2:Number;
var _local3:Boolean;
var _local4:Poly;
var _local5:Line;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
for each (_local4 in Game.polygonList) {
for each (_local5 in _local4.lineList) {
_local6 = _arg1;
_local7 = 0;
if ((((_local6 >= _local5.x0)) && ((_local6 <= _local5.x1)))){
_local8 = ((1 / (_local5.x1 - _local5.x0)) * (_local6 - _local5.x0));
_local9 = (_local5.y0 + (_local5.dy * _local8));
return (_local9);
};
};
};
return (999999);
}
static function Dist2ToLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{
var _local7:Number;
var _local8:Number;
ClosestPointOnLine(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
_local7 = (closestX - _arg5);
_local8 = (closestY - _arg6);
return (((_local7 * _local7) + (_local8 * _local8)));
}
static function DistBetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
public static function SingleObjectZoneCollision(_arg1:GameObj):Poly{
var _local2:Poly;
for each (_local2 in Game.polygonList) {
if (((_local2.active) && ((_local2.type == Poly.polytype_ZONE)))){
if (GameObjectInPolyBoundingBox(_arg1, _local2)){
if (PointInConvexPoly(_arg1.xpos, _arg1.ypos, _local2.lineList)){
return (_local2);
};
};
};
};
return (null);
}
public static function PointInConvexPoly(_arg1:Number, _arg2:Number, _arg3:Array):Boolean{
var _local4:int;
var _local5:int;
var _local6:Line;
var _local7:Number;
_local4 = _arg3.length;
_local5 = 0;
while (_local5 < _local4) {
_local6 = _arg3[_local5];
_local7 = DotProduct((_local6.x0 - _arg1), (_local6.y0 - _arg2), _local6.nx, _local6.ny);
if (_local7 < 0){
return (false);
};
_local5++;
};
return (true);
}
static function DistBetween(_arg1:GameObj, _arg2:GameObj):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg2.xpos - _arg1.xpos);
_local4 = (_arg2.ypos - _arg1.ypos);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function ClosestPointOnLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local7 = (_arg5 - _arg1);
_local8 = (_arg6 - _arg2);
_local9 = (_arg3 - _arg1);
_local10 = (_arg4 - _arg2);
_local11 = ((_local9 * _local9) + (_local10 * _local10));
_local12 = ((_local7 * _local9) + (_local8 * _local10));
_local13 = (_local12 / _local11);
closestInfiniteX = (_arg1 + (_local9 * _local13));
closestInfiniteY = (_arg2 + (_local10 * _local13));
if (_local13 < 0){
_local13 = 0;
};
if (_local13 > 1){
_local13 = 1;
};
closestX = (_arg1 + (_local9 * _local13));
closestY = (_arg2 + (_local10 * _local13));
}
static function Intersected(_arg1:GameObj, _arg2:Line, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):void{
var _local8:int;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:int;
var _local15:Number;
_local8 = 50;
_local9 = ((_arg1.oldxpos + _arg5) - _arg3);
_local10 = ((_arg1.oldypos + _arg6) - _arg4);
_local9 = (_local9 / Number(_local8));
_local10 = (_local10 / Number(_local8));
_local11 = (_arg1.xpos + _arg5);
_local12 = (_arg1.ypos + _arg6);
_local13 = (_arg7 * _arg7);
_local14 = 0;
while (_local14 < _local8) {
_local11 = (_local11 + _local9);
_local12 = (_local12 + _local10);
_local15 = Dist2ToLine(_arg2.x0, _arg2.y0, _arg2.x1, _arg2.y1, _local11, _local12);
if (_local15 > _local13){
_arg1.xpos = (_local11 - _arg5);
_arg1.ypos = (_local12 - _arg6);
return;
};
_local14++;
};
}
static function SideOfLine1(_arg1:Line, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number;
_local4 = DotProduct((_arg1.x1 - _arg1.x0), (_arg1.y1 - _arg1.y0), (_arg2 - _arg1.x0), (_arg3 - _arg1.y0));
if (_local4 < 0){
return (false);
};
return (true);
}
public static function Update(_arg1:Main){
main = _arg1;
stats_numIntersections = 0;
stats_numBBTests = 0;
stats_numPolyCollisionTests = 0;
}
public static function PlayerDeathZoneCollision():void{
var _local1:GameObj;
var _local2:Poly;
if (Game.goPlayer.colFlag_playercanbekilled == false){
return;
};
_local1 = Game.goPlayer;
for each (_local2 in Game.polygonList) {
if (((((_local2.active) && ((_local2.type == Poly.polytype_ZONE)))) && ((_local2.subTypeName == "Death")))){
if (GameObjectInPolyBoundingBox(_local1, _local2)){
if (PointInConvexPoly(_local1.xpos, _local1.ypos, _local2.lineList)){
_local1.PlayerHitEnemy(null);
return;
};
};
};
};
}
static function DistToLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{
var _local7:Number;
var _local8:Number;
var _local9:Number;
ClosestPointOnLine(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
_local7 = (closestX - _arg5);
_local8 = (closestY - _arg6);
_local9 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
return (_local9);
}
static function Dist2Between(_arg1:GameObj, _arg2:GameObj):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg2.xpos - _arg1.xpos);
_local4 = (_arg2.ypos - _arg1.ypos);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function FindPathByIndex(_arg1:int):Poly{
var _local2:int;
var _local3:Poly;
_local2 = 0;
for each (_local3 in Game.polygonList) {
if (((_local3.active) && ((_local3.type == Poly.polytype_PATH)))){
if (_local2 == _arg1){
return (_local3);
};
_local2++;
};
};
return (null);
}
static function Dist2BetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (((_local5 * _local5) + (_local6 * _local6)));
}
}
}//package
Section 104
//ContactListener (ContactListener)
package {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class ContactListener extends b2ContactListener {
override public function Add(_arg1:b2ContactPoint):void{
var _local2:GameObj;
var _local3:PhysObj_Instance;
var _local4:b2Body;
var _local5:PhysObj_BodyUserData;
var _local6:b2Body;
var _local7:PhysObj_BodyUserData;
var _local8:b2Vec2;
_local4 = _arg1.shape1.GetBody();
_local5 = _local4.GetUserData();
_local6 = _arg1.shape2.GetBody();
_local7 = _local6.GetUserData();
_local8 = new b2Vec2(0, 0);
Game.numCollisionTests++;
if (_local5.type == "ball"){
BallHitAnything(_local5, _local4, _local7, _arg1);
};
if (_local7.type == "ball"){
BallHitAnything(_local7, _local6, _local5, _arg1);
};
if ((((_local5.type == "ball")) && ((_local7.type == "ball")))){
BallHitBall(_local5, _local4, _local7);
};
if ((((_local7.type == "ball")) && ((_local5.type == "ball")))){
BallHitBall(_local7, _local6, _local5);
};
if ((((_local5.type == "ball")) && ((_local7.type == "mover50")))){
SetBallState(_local5, GameObj.ballstate_laughing);
_local8.x = Math.cos(Utils.DegToRad(_local7.instance.rot));
_local8.y = Math.sin(Utils.DegToRad(_local7.instance.rot));
_local8.Multiply(50);
_local4.ApplyForce(_local8, _local4.GetWorldCenter());
};
if ((((_local7.type == "ball")) && ((_local5.type == "mover50")))){
SetBallState(_local7, GameObj.ballstate_laughing);
_local8.x = Math.cos(Utils.DegToRad(_local5.instance.rot));
_local8.y = Math.sin(Utils.DegToRad(_local5.instance.rot));
_local8.Multiply(50);
_local6.ApplyForce(_local8, _local6.GetWorldCenter());
};
if ((((_local5.type == "ball")) && ((((_local7.type == "bouncer")) || ((_local7.type == "bouncer2")))))){
_local2 = GameObjects.objs[_local7.gameObjectID];
_local2.BouncerBounce();
SoundPlayer.Play("sfx_boing");
SetBallState(_local5, GameObj.ballstate_laughing);
};
if ((((_local7.type == "ball")) && ((((_local5.type == "bouncer")) || ((_local5.type == "bouncer2")))))){
_local2 = GameObjects.objs[_local5.gameObjectID];
_local2.BouncerBounce();
SoundPlayer.Play("sfx_boing");
SetBallState(_local7, GameObj.ballstate_laughing);
};
if ((((_local5.type == "ball")) && ((_local7.type == "conveyor100")))){
_local8.x = Math.cos(Utils.DegToRad(_local7.instance.rot));
_local8.y = Math.sin(Utils.DegToRad(_local7.instance.rot));
_local4.ApplyForce(_local8, _local4.GetLocalCenter());
};
if ((((_local7.type == "ball")) && ((_local5.type == "conveyor100")))){
_local8.x = Math.cos(Utils.DegToRad(_local5.instance.rot));
_local8.y = Math.sin(Utils.DegToRad(_local5.instance.rot));
_local6.ApplyForce(_local8, _local6.GetLocalCenter());
};
if ((((_local5.type == "ball")) && ((((_local7.type == "spikes")) || ((_local7.type == "screenborder")))))){
_local5.instance.collideFunction = Game.RemoveObj_BallDie_Splash;
if (_local5.instance.timer == 0){
_local5.instance.timer = 10;
};
};
if ((((_local7.type == "ball")) && ((((_local5.type == "spikes")) || ((_local5.type == "screenborder")))))){
_local7.instance.collideFunction = Game.RemoveObj_BallDie_Splash;
if (_local7.instance.timer == 0){
_local7.instance.timer = 10;
};
};
if ((((_local5.type == "ball")) && ((_local7.type == "gem")))){
SetBallState(_local5, GameObj.ballstate_laughing);
_local7.instance.collideFunction = Game.RemoveObj_Gem;
if (_local7.instance.timer == 0){
_local7.instance.timer = 10;
};
};
if ((((_local7.type == "ball")) && ((_local5.type == "gem")))){
SetBallState(_local7, GameObj.ballstate_laughing);
_local5.instance.collideFunction = Game.RemoveObj_Gem;
if (_local5.instance.timer == 0){
_local5.instance.timer = 10;
};
};
BallHopperCollisionTest(_local5, _local4, _local7, "hopper", -1);
BallHopperCollisionTest(_local5, _local4, _local7, "hopper1", 0);
BallHopperCollisionTest(_local5, _local4, _local7, "hopper2", 1);
BallHopperCollisionTest(_local5, _local4, _local7, "hopper3", 2);
BallHopperCollisionTest(_local7, _local6, _local5, "hopper", -1);
BallHopperCollisionTest(_local7, _local6, _local5, "hopper1", 0);
BallHopperCollisionTest(_local7, _local6, _local5, "hopper2", 1);
BallHopperCollisionTest(_local7, _local6, _local5, "hopper3", 2);
if ((((_local5.type == "pellet")) && ((((_local7.type == "pin_disappear")) || ((_local7.type == "pin_disappear_broken")))))){
_local2 = GameObjects.objs[_local7.gameObjectID];
if (_local2.PinDisappearHit()){
SoundPlayer.Play("sfx_removepin", Utils.RandBetweenFloat(0.5, 1));
_local7.instance.collideFunction = Game.RemoveObj_Standard;
if (_local7.instance.timer == 0){
_local7.instance.timer = 10;
};
};
};
if ((((_local7.type == "pellet")) && ((((_local5.type == "pin_disappear")) || ((_local5.type == "pin_disappear_broken")))))){
SoundPlayer.Play("sfx_removepin", Utils.RandBetweenFloat(0.5, 1));
_local2 = GameObjects.objs[_local5.gameObjectID];
if (_local2.PinDisappearHit()){
_local5.instance.collideFunction = Game.RemoveObj_Standard;
if (_local5.instance.timer == 0){
_local5.instance.timer = 10;
};
};
};
if (_local5.type == "pellet"){
_local5.instance.collideFunction = Game.RemoveObj_Pellet;
if (_local5.instance.timer == 0){
_local5.instance.timer = 1;
};
};
if (_local7.type == "pellet"){
_local7.instance.collideFunction = Game.RemoveObj_Pellet;
if (_local7.instance.timer == 0){
_local7.instance.timer = 1;
};
};
_local3 = (_arg1.shape1.GetUserData() as PhysObj_Instance);
if (_local3 != null){
};
_local3 = (_arg1.shape2.GetUserData() as PhysObj_Instance);
if (_local3 != null){
};
}
function SetBallState(_arg1:PhysObj_BodyUserData, _arg2:int){
var _local3:GameObj;
_local3 = GameObjects.objs[_arg1.gameObjectID];
_local3.SetBallState(_arg2);
}
function BallHopperCollisionTest(_arg1:PhysObj_BodyUserData, _arg2:b2Body, _arg3:PhysObj_BodyUserData, _arg4:String, _arg5:int){
var _local6:GameObj;
if ((((((_arg1.type == "ball")) && ((_arg3.type == _arg4)))) && ((_arg3.bodyName == "inner")))){
if (_arg1.instance.timer == 0){
_arg1.instance.timer = 10;
};
if (_arg5 == -1){
_arg1.instance.collideFunction = Game.RemoveObj_BallInHopper;
} else {
_local6 = GameObjects.objs[_arg1.gameObjectID];
if (_arg5 == _local6.type){
_arg1.instance.collideFunction = Game.RemoveObj_BallInHopper;
} else {
_arg1.instance.collideFunction = Game.RemoveObj_BallInWrongHopper;
};
};
};
}
function BallHitBall(_arg1:PhysObj_BodyUserData, _arg2:b2Body, _arg3:PhysObj_BodyUserData){
var _local4:GameObj;
var _local5:GameObj;
var _local6:int;
if (_arg2.GetLinearVelocity().Length() > 3){
_local4 = GameObjects.objs[_arg1.gameObjectID];
_local5 = GameObjects.objs[_arg3.gameObjectID];
_local6 = GameObj.ballstate_angry_with_ball;
if (_local4.type == _local5.type){
_local6 = GameObj.ballstate_happy_with_ball;
};
if (_local4.SetBallState(_local6)){
_local4.ballstate_otherGO = _local5;
};
if (_local5.SetBallState(_local6)){
_local5.ballstate_otherGO = _local4;
};
};
}
override public function Persist(_arg1:b2ContactPoint):void{
var _local2:GameObj;
var _local3:PhysObj_Instance;
var _local4:b2Body;
var _local5:PhysObj_BodyUserData;
var _local6:b2Body;
var _local7:PhysObj_BodyUserData;
var _local8:b2Vec2;
_local4 = _arg1.shape1.GetBody();
_local5 = _local4.GetUserData();
_local6 = _arg1.shape2.GetBody();
_local7 = _local6.GetUserData();
_local8 = new b2Vec2(0, 0);
Game.numCollisionTests++;
if ((((_local5.type == "ball")) && ((_local7.type == "mover50")))){
_local8.x = Math.cos(Utils.DegToRad(_local7.instance.rot));
_local8.y = Math.sin(Utils.DegToRad(_local7.instance.rot));
_local8.Multiply(50);
_local4.ApplyForce(_local8, _local4.GetWorldCenter());
};
if ((((_local7.type == "ball")) && ((_local5.type == "mover50")))){
_local8.x = Math.cos(Utils.DegToRad(_local5.instance.rot));
_local8.y = Math.sin(Utils.DegToRad(_local5.instance.rot));
_local8.Multiply(50);
_local6.ApplyForce(_local8, _local6.GetWorldCenter());
};
}
function BallHitAnything(_arg1:PhysObj_BodyUserData, _arg2:b2Body, _arg3:PhysObj_BodyUserData, _arg4:b2ContactPoint){
var _local5:GameObj;
var _local6:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
if (_arg2.GetLinearVelocity().Length() > 5){
_local5 = GameObjects.objs[_arg1.gameObjectID];
if (Utils.RandBetweenInt(0, 1000) < 500){
_local5.SetBallState(GameObj.ballstate_sad);
} else {
_local5.SetBallState(GameObj.ballstate_angry);
};
};
_local6 = _arg2.GetLinearVelocity();
_local7 = _local6.Length();
if (_local7 > 1){
_local8 = Utils.DotProduct(_arg4.normal.x, _arg4.normal.y, _local6.x, _local6.y);
_local8 = Math.abs(_local8);
if (_local8 > 10){
if (_arg3.instance.hitballsound != 0){
_local9 = _local7;
_local7 = Utils.LimitNumber(0, 30, _local7);
_local10 = Utils.ScaleTo(0, 1, 0, 30, _local7);
if (_local10 != 0){
SoundPlayer.PlayRandomBetween("sfx_bounce0", "sfx_bounce2", _local10);
};
};
};
};
}
}
}//package
Section 105
//Conveyor_Animated (Conveyor_Animated)
package {
import flash.display.*;
public dynamic class Conveyor_Animated extends MovieClip {
}
}//package
Section 106
//CreditsScreen (CreditsScreen)
package {
import flash.display.*;
public dynamic class CreditsScreen extends MovieClip {
public var buttonLongAnimals:LongAnimalsLogo;
public var buttonRobotJam:SimpleButton;
}
}//package
Section 107
//Cursor (Cursor)
package {
import flash.display.*;
public dynamic class Cursor extends MovieClip {
}
}//package
Section 108
//Debug (Debug)
package {
public class Debug {
public static var debugMode:int = 0;
public static function IsSet(_arg1:int):Boolean{
if ((debugMode & _arg1) == 0){
return (false);
};
return (true);
}
public static function RenderCollision(){
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:uint;
var _local5:Line;
var _local6:Line;
var _local7:int;
var _local8:Poly;
return;
}
public static function RenderPlayerInfo(){
var _local1:String;
var _local2:GameObj;
}
}
}//package
Section 109
//Defs (Defs)
package {
import flash.geom.*;
public class Defs {
public static const zpos_PICKUP = 1100;
public static const zpos_ENEMY = 1000;
public static const displayarea_w = 640;
public static const zpos_OVERLAY = 500;
public static const zpos_PLAYER = 1000;
public static const fps:Number = 33;
public static const zpos_FAR = 10000;
public static const zpos_BACKGROUND = 10000;
public static const displayarea_h = 570;
public static const platformW2 = 15;
public static var screenRect:Rectangle = new Rectangle(0, 0, displayarea_w, displayarea_h);
public static var pointZero:Point = new Point(0, 0);
}
}//package
Section 110
//DisappearingPin (DisappearingPin)
package {
import flash.display.*;
public dynamic class DisappearingPin extends MovieClip {
}
}//package
Section 111
//DisplayObj (DisplayObj)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.text.*;
public class DisplayObj {
var frames:Array;
public var frame:int;
public function DisplayObj(_arg1:MovieClip, _arg2:Number, _arg3:int):void{
frame = 0;
if (_arg1 != null){
CreateBitmapsFromMovieClip(_arg1, _arg3);
};
}
public function GetHeight():Number{
return (frames[frame].bitmap.height);
}
public function GetBitmap():Bitmap{
return (frames[frame].bitmap);
}
function CreateAsciiStringTable():Array{
var _local1:Array;
_local1 = new Array();
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push(" ");
_local1.push("!");
_local1.push("'");
_local1.push("#");
_local1.push("$");
_local1.push("%");
_local1.push("&");
_local1.push("'");
_local1.push("(");
_local1.push(")");
_local1.push("*");
_local1.push("+");
_local1.push(",");
_local1.push("-");
_local1.push(".");
_local1.push("/");
_local1.push("0");
_local1.push("1");
_local1.push("2");
_local1.push("3");
_local1.push("4");
_local1.push("5");
_local1.push("6");
_local1.push("7");
_local1.push("8");
_local1.push("9");
_local1.push(":");
_local1.push(";");
_local1.push("<");
_local1.push("=");
_local1.push(">");
_local1.push("?");
_local1.push("@");
_local1.push("A");
_local1.push("B");
_local1.push("C");
_local1.push("D");
_local1.push("E");
_local1.push("F");
_local1.push("G");
_local1.push("H");
_local1.push("I");
_local1.push("J");
_local1.push("K");
_local1.push("L");
_local1.push("M");
_local1.push("N");
_local1.push("O");
_local1.push("P");
_local1.push("Q");
_local1.push("R");
_local1.push("S");
_local1.push("T");
_local1.push("U");
_local1.push("V");
_local1.push("W");
_local1.push("X");
_local1.push("Y");
_local1.push("Z");
_local1.push("[");
_local1.push("\\");
_local1.push("]");
_local1.push("^");
_local1.push("_");
_local1.push("'");
_local1.push("a");
_local1.push("b");
_local1.push("c");
_local1.push("d");
_local1.push("e");
_local1.push("f");
_local1.push("g");
_local1.push("h");
_local1.push("i");
_local1.push("j");
_local1.push("k");
_local1.push("l");
_local1.push("m");
_local1.push("n");
_local1.push("o");
_local1.push("p");
_local1.push("q");
_local1.push("r");
_local1.push("s");
_local1.push("t");
_local1.push("u");
_local1.push("v");
_local1.push("w");
_local1.push("x");
_local1.push("y");
_local1.push("z");
_local1.push("{");
_local1.push("|");
_local1.push("}");
_local1.push("~");
return (_local1);
}
public function RenderAt(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
frames[frame].RenderAt(_arg1, _arg2, _arg3, _arg4);
}
public function SetFrame(_arg1:int){
frame = _arg1;
if (frame < 0){
frame = 0;
};
if (frame >= frames.length){
frame = (frames.length - 1);
};
}
public function CreateBitmapsFromMovieClip(_arg1:MovieClip, _arg2:int):void{
var _local3:Boolean;
var _local4:Boolean;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:Matrix;
var _local10:Rectangle;
var _local11:Bitmap;
var _local12:BitmapData;
var _local13:Bitmap;
var _local14:BitmapData;
var _local15:int;
var _local16:*;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Boolean;
var _local21:Number;
var _local22:*;
var _local23:Number;
var _local24:Point;
var _local25:Point;
var _local26:Point;
var _local27:Point;
var _local28:ColorTransform;
var _local29:ColorTransform;
_local3 = false;
_local4 = false;
if (_arg2 == 3){
_local4 = true;
_arg2 = 0;
};
if (_arg2 == 2){
_local3 = true;
_arg2 = 0;
};
if (_arg2 == 3){
};
frames = new Array();
_arg1.gotoAndStop(0);
_local15 = 32;
_local5 = 0;
while (_local5 < _arg1.totalFrames) {
_local16 = new DisplayObjFrame();
_local16.bitmaps = new Array();
_local16.burnedbitmaps = new Array();
_local16.xoffsets = new Array();
_local16.yoffsets = new Array();
_local16.mat = new Matrix();
_local16.colTrans = new ColorTransform();
if (_arg2 == 3){
_local17 = 1000;
_local10 = _arg1.getBounds(null);
_local18 = _local10.width;
_local19 = (_local18 + _local17);
_local20 = true;
_local21 = 0;
do {
_local9 = new Matrix();
_local9.translate(-(_local21), 0);
_local7 = _local21;
_local8 = 0;
_local16.xoffsets.push(Number(_local21));
_local16.yoffsets.push(Number(_local8));
_local21 = (_local21 + _local17);
_local22 = _local17;
_local19 = (_local19 - _local17);
if (_local19 < _local17){
_local20 = false;
_local22 = _local19;
};
trace(((("split: w:" + _local22) + " xoff:") + _local21));
_local11 = new Bitmap();
_local12 = new BitmapData(_local22, _arg1.height, true, 0);
_local12.draw(_arg1, _local9);
_local11.bitmapData = _local12;
_local16.bitmaps.push(_local11);
} while (_local20);
} else {
if (_arg2 == 1){
_local6 = 0;
while (_local6 < _local15) {
_local23 = (((Math.PI * 2) / Number(_local15)) * Number(_local6));
_local23 = -(_local23);
_local23 = (_local23 + (Math.PI / 2));
_local10 = _arg1.getBounds(null);
_local9 = new Matrix();
_local9.rotate(_local23);
_local9.translate(_local10.width, _local10.height);
_local24 = _local9.transformPoint(new Point(_local10.left, _local10.top));
_local25 = _local9.transformPoint(new Point(_local10.right, _local10.top));
_local26 = _local9.transformPoint(new Point(_local10.right, _local10.bottom));
_local27 = _local9.transformPoint(new Point(_local10.left, _local10.bottom));
if (((!((_arg1.width == 0))) && (!((_arg1.height == 0))))){
_local12 = new BitmapData((_local10.width * 2), (_local10.height * 2), true, 0);
_local12.draw(_arg1, _local9);
_local11 = new Bitmap(_local12);
_local16.bitmaps.push(_local11);
_local28 = new ColorTransform(1, 1, 1, 1, -100, -100, -100, 0);
_local14 = new BitmapData((_local10.width * 2), (_local10.height * 2), true, 0);
_local14.draw(_arg1, _local9, _local28);
_local13 = new Bitmap(_local14);
_local16.burnedbitmaps.push(_local13);
_local7 = (_local10.width / 2);
_local8 = (_local10.height / 2);
_local16.xoffsets.push(Number(-(_local10.width)));
_local16.yoffsets.push(Number(-(_local10.height)));
} else {
_local16.bitmaps.push(null);
_local16.burnedbitmaps.push(null);
_local16.xoffsets.push(0);
_local16.yoffsets.push(0);
};
_local6++;
};
} else {
_local10 = _arg1.getBounds(null);
_local10.x = Math.floor(_local10.x);
_local10.y = Math.floor(_local10.y);
_local10.width = Math.floor((_local10.width + 1));
_local10.height = Math.floor((_local10.height + 1));
_local8 = Math.floor(_local8);
_local9 = new Matrix();
_local7 = _local10.left;
_local8 = _local10.top;
_local9.translate(-(_local7), -(_local8));
_local16.xoffsets.push(Number(_local7));
_local16.yoffsets.push(Number(_local8));
if (((!((_arg1.width == 0))) && (!((_arg1.height == 0))))){
_local11 = new Bitmap();
_local12 = new BitmapData(_local10.width, _local10.height, true, 0);
_local12.draw(_arg1, _local9);
_local11.bitmapData = _local12;
_local16.bitmaps.push(_local11);
} else {
_local16.bitmaps.push(null);
};
if (_local3){
_local10 = _arg1.getBounds(null);
_local10.x = Math.floor(_local10.x);
_local10.y = Math.floor(_local10.y);
_local10.width = Math.floor((_local10.width + 1));
_local10.height = Math.floor((_local10.height + 1));
_local9 = new Matrix();
_local7 = _local10.left;
_local8 = _local10.top;
_local9.translate(-(_local7), -(_local8));
_local9.scale(-1, 1);
_local9.translate(_local10.width, 0);
_local16.xoffsets.push(Number(-(_local10.right)));
_local16.yoffsets.push(Number(_local8));
if (((!((_arg1.width == 0))) && (!((_arg1.height == 0))))){
_local11 = new Bitmap();
_local12 = new BitmapData(_local10.width, _local10.height, true, 0);
_local12.draw(_arg1, _local9);
_local11.bitmapData = _local12;
_local16.bitmaps.push(_local11);
} else {
_local16.bitmaps.push(null);
};
} else {
if (_local4){
_local29 = new ColorTransform(0.1, 0.1, 0.1, 0.3);
_local10 = _arg1.getBounds(null);
_local10.x = Math.floor(_local10.x);
_local10.y = Math.floor(_local10.y);
_local10.width = Math.floor((_local10.width + 1));
_local10.height = Math.floor((_local10.height + 1));
_local8 = Math.floor(_local8);
_local9 = new Matrix();
_local7 = _local10.left;
_local8 = _local10.top;
_local9.translate(-(_local7), -(_local8));
_local16.xoffsets.push(Number(_local7));
_local16.yoffsets.push(Number(_local8));
if (((!((_arg1.width == 0))) && (!((_arg1.height == 0))))){
_local11 = new Bitmap();
_local12 = new BitmapData(_local10.width, _local10.height, true, 0);
_local12.draw(_arg1, _local9, _local29);
_local11.bitmapData = _local12;
_local16.bitmaps.push(_local11);
} else {
_local16.bitmaps.push(null);
};
};
};
};
};
frames.push(_local16);
_arg1.nextFrame();
_local5++;
};
}
public function GetWidth():Number{
return (frames[frame].bitmap.width);
}
public function RenderAtColTrans(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:ColorTransform, _arg5:Boolean=false):void{
frames[frame].RenderAtColTrans(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function CreateFont(_arg1:TextFormat):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Matrix;
var _local7:Rectangle;
var _local8:Bitmap;
var _local9:BitmapData;
var _local10:Array;
var _local11:TextField;
var _local12:*;
frames = new Array();
_local10 = CreateAsciiStringTable();
_local2 = 0;
while (_local2 < _local10.length) {
_local11 = new TextField();
_local11.textColor = 4294967295;
_local11.selectable = false;
_local11.embedFonts = true;
_local11.autoSize = TextFieldAutoSize.LEFT;
_local11.x = 0;
_local11.y = 0;
_local11.text = _local10[_local2];
_local11.setTextFormat(_arg1);
_local12 = new DisplayObjFrame();
_local12.bitmaps = new Array();
_local12.xoffsets = new Array();
_local12.yoffsets = new Array();
_local12.mat = new Matrix();
_local12.colTrans = new ColorTransform();
_local7 = _local11.getBounds(null);
_local6 = new Matrix();
_local6.translate(-(_local7.x), -(_local7.y));
_local12.xoffsets.push(0);
_local12.yoffsets.push(0);
_local8 = new Bitmap();
_local9 = new BitmapData(_local7.width, _local7.height, true, 0);
_local9.draw(_local11, _local6, null, null, null, true);
_local8.bitmapData = _local9;
_local12.bitmaps.push(_local8);
frames.push(_local12);
_local2++;
};
}
public function GetMaxFrames():int{
return (frames.length);
}
public function GetXOffset():Number{
return (frames[frame].xoffset);
}
public function GetYOffset():Number{
return (frames[frame].yoffset);
}
public function GetFrame():int{
return (frame);
}
public function RenderAtRot(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean):void{
if (_arg5){
frames[frame].RenderAtRotBurned(_arg1, _arg2, _arg3, _arg4);
} else {
frames[frame].RenderAtRot(_arg1, _arg2, _arg3, _arg4);
};
}
public function GetFrameWidth(_arg1:int):Number{
return (frames[_arg1].bitmap.width);
}
public function GetScaledBitmap():Bitmap{
return (frames[frame].scaledBitmap);
}
}
}//package
import flash.display.*;
import flash.geom.*;
class DisplayObjFrame {
public var mat:Matrix;
public var bitmaps:Array;
public var xoffsets:Array;
public var burnedbitmaps:Array;
public var colTrans:ColorTransform;
public var yoffsets:Array;
private function DisplayObjFrame(){
}
public function RenderAtScaled(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1):void{
var _local6:Bitmap;
var _local7:Number;
var _local8:Number;
_local6 = bitmaps[0];
_local7 = xoffsets[0];
_local8 = yoffsets[0];
if (_arg4){
_local6 = bitmaps[1];
_local7 = xoffsets[1];
_local8 = yoffsets[1];
};
mat.identity();
mat.scale(_arg5, _arg5);
mat.translate((_arg2 + (_local7 * _arg5)), (_arg3 + (_local8 * _arg5)));
if (_local6 != null){
if (_local6.bitmapData != null){
_arg1.draw(_local6.bitmapData, mat);
};
};
}
public function RenderAt(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
var _local5:Bitmap;
var _local6:Number;
var _local7:Number;
_local5 = bitmaps[0];
_local6 = xoffsets[0];
_local7 = yoffsets[0];
if (_arg4){
_local5 = bitmaps[1];
_local6 = xoffsets[1];
_local7 = yoffsets[1];
};
_arg1.copyPixels(_local5.bitmapData, new Rectangle(0, 0, _local5.width, _local5.height), new Point((_arg2 + _local6), (_arg3 + _local7)), null, null, true);
}
public function RenderAtRotScaled(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=0, _arg7:ColorTransform=null):void{
var _local8:Bitmap;
var _local9:Number;
var _local10:Number;
var _local11:*;
_local8 = bitmaps[0];
_local9 = xoffsets[0];
_local10 = yoffsets[0];
if (_arg4){
_local8 = bitmaps[1];
_local9 = xoffsets[1];
_local10 = yoffsets[1];
};
mat.identity();
mat.translate(_local9, _local10);
mat.rotate(_arg6);
mat.translate(-(_local9), -(_local10));
mat.scale(_arg5, _arg5);
mat.translate((_arg2 + (_local9 * _arg5)), (_arg3 + (_local10 * _arg5)));
if (_local8 != null){
if (_local8.bitmapData != null){
_local11 = true;
if (_arg4 == true){
_local11 = true;
};
_arg1.draw(_local8.bitmapData, mat, _arg7, null, null, _local11);
};
};
}
public function RenderAtSplit(_arg1:BitmapData, _arg2:Number, _arg3:Number):void{
var _local4:int;
var _local5:Bitmap;
var _local6:Number;
var _local7:Number;
_local4 = 0;
while (_local4 < bitmaps.length) {
_local5 = bitmaps[_local4];
_local6 = xoffsets[_local4];
_local7 = yoffsets[_local4];
_arg1.copyPixels(_local5.bitmapData, new Rectangle(0, 0, _local5.width, _local5.height), new Point((_arg2 + _local6), (_arg3 + _local7)), null, null, true);
_local4++;
};
}
public function RenderAtColTrans(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:ColorTransform, _arg5:Boolean=false):void{
var _local6:Bitmap;
var _local7:Number;
var _local8:Number;
_local6 = bitmaps[0];
_local7 = xoffsets[0];
_local8 = yoffsets[0];
if (_arg5){
_local6 = bitmaps[1];
_local7 = xoffsets[1];
_local8 = yoffsets[1];
};
mat.identity();
mat.translate((_arg2 + _local7), (_arg3 + _local8));
if (_local6 != null){
if (_local6.bitmapData != null){
_arg1.draw(_local6.bitmapData, mat, _arg4);
};
};
}
public function RenderAtAdditive(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Bitmap;
var _local6:Number;
var _local7:Number;
_local5 = bitmaps[0];
_local6 = xoffsets[0];
_local7 = yoffsets[0];
mat.identity();
mat.translate((_arg2 + _local6), (_arg3 + _local7));
colTrans.alphaMultiplier = _arg4;
if (_local5 != null){
if (_local5.bitmapData != null){
_arg1.draw(_local5.bitmapData, mat, colTrans, "add");
};
};
}
public function RenderAtAlpha(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Bitmap;
var _local6:Number;
var _local7:Number;
_local5 = bitmaps[0];
_local6 = xoffsets[0];
_local7 = yoffsets[0];
mat.identity();
mat.translate((_arg2 + _local6), (_arg3 + _local7));
colTrans.alphaMultiplier = _arg4;
if (_local5 != null){
if (_local5.bitmapData != null){
_arg1.draw(_local5.bitmapData, mat, colTrans);
};
};
}
public function RenderAtRot(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:int;
var _local6:int;
var _local7:Bitmap;
var _local8:Number;
var _local9:Number;
_arg4 = (_arg4 - 0.01);
_local5 = bitmaps.length;
_arg4 = ((Number(_local5) / (Math.PI * 2)) * _arg4);
_local6 = _arg4;
while (_local6 < 0) {
_local6 = (_local6 + _local5);
};
while (_local6 > (_local5 - 1)) {
_local6 = (_local6 - _local5);
};
_local6 = ((_local5 - 1) - _local6);
_local7 = bitmaps[_local6];
_local8 = xoffsets[_local6];
_local9 = yoffsets[_local6];
_arg1.copyPixels(_local7.bitmapData, new Rectangle(0, 0, _local7.width, _local7.height), new Point((_arg2 + _local8), (_arg3 + _local9)));
}
}
Section 112
//Domain (Domain)
package {
public class Domain {
public static function GetDomain(_arg1:Object):String{
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:String;
var _local6:Number;
var _local7:Number;
_local2 = _arg1.loaderInfo.url;
_local3 = (_local2.indexOf("://") + 3);
_local4 = _local2.indexOf("/", _local3);
_local5 = _local2.substring(_local3, _local4);
_local6 = (_local5.lastIndexOf(".") - 1);
_local7 = (_local5.lastIndexOf(".", _local6) + 1);
_local5 = _local5.substring(_local7, _local5.length);
return (_local5);
}
public static function IsLockedOut():Boolean{
var _local1:String;
_local1 = GetDomain(Main.theStage);
if (((!((_local1 == "flashgamelicense.com"))) && (!((_local1 == "longanimalsgames.com"))))){
return (true);
};
return (false);
}
}
}//package
Section 113
//ExternalData (ExternalData)
package {
import flash.events.*;
import flash.net.*;
public class ExternalData {
public static var xml:XML;
static var xxx:XML = <data>
<!-- EASY levels (category 0) -->
<level name="Beginner's Look" category="0" frequency="2" max="5" quota="5" time="60" balltypes="1,2,3">
<helpscreen frame="19"/>
<helpscreen frame="1"/>
<helpscreen frame="2"/>
<helpscreen frame="20"/>
<helpscreen frame="21"/>
<obj type="ballstart" x="304" y="81" rot="0"/>
<obj type="plank100" x="252" y="144" rot="20"/>
<obj type="plank100" x="345" y="178" rot="30"/>
<obj type="plank100" x="430" y="228" rot="40"/>
<obj type="plank100" x="491" y="350" rot="-30"/>
<obj type="plank100" x="400" y="392" rot="-25"/>
<obj type="plank100" x="202" y="436" rot="-10"/>
<obj type="hinge90" x="394" y="400" rot="80"/>
<obj type="pin" x="384" y="474" rot="0"/>
<obj type="hopper" x="178" y="436" rot="0"/>
<obj type="gem" x="228" y="384" rot="0"/>
<obj type="plank50" x="203" y="144" rot="0"/>
<obj type="plank50" x="156" y="160" rot="-20"/>
<obj type="plank50" x="118" y="193" rot="-40"/>
<obj type="plank50" x="100" y="240" rot="-70"/>
<obj type="plank50" x="109" y="289" rot="-100"/>
<obj type="plank50" x="133" y="332" rot="-120"/>
<obj type="plank50" x="150" y="379" rot="-110"/>
<obj type="plank50" x="159" y="427" rot="-100"/>
<obj type="plank50" x="578" y="301" rot="-50"/>
<obj type="plank50" x="608" y="262" rot="-70"/>
<obj type="plank50" x="625" y="215" rot="-90"/>
<obj type="plank50" x="624" y="165" rot="-110"/>
<obj type="plank50" x="607" y="118" rot="-100"/>
<obj type="plank50" x="599" y="69" rot="-90"/>
<obj type="plank50" x="599" y="20" rot="-70"/>
<obj type="plank50" x="328" y="55" rot="-70"/>
<obj type="plank50" x="302" y="44" rot="-90"/>
<obj type="plank50" x="276" y="61" rot="-110"/>
<obj type="plank50" x="261" y="14" rot="-150"/>
<obj type="plank50" x="346" y="8" rot="-30"/>
</level>
<level name="Just Push 'Em" category="0" frequency="1" max="3" quota="5" time="50" balltypes="1,2,3">
<helpscreen frame="3"/>
<obj type="hopper" x="570" y="429" rot="0"/>
<obj type="ballstart" x="120" y="61" rot="0"/>
<obj type="plank100" x="68" y="136" rot="30"/>
<obj type="plank100" x="154" y="186" rot="30"/>
<obj type="plank100" x="300" y="213" rot="20"/>
<obj type="plank100" x="389" y="244" rot="50"/>
<obj type="plank100" x="450" y="316" rot="50"/>
<obj type="plank50" x="512" y="391" rot="40"/>
<obj type="plank50" x="615" y="383" rot="120"/>
<obj type="piston2" x="248" y="255" rot="40"/>
<obj type="gem" x="395" y="174" rot="0"/>
<obj type="plank50" x="301" y="218" rot="130"/>
</level>
<level name="Back At Ya" category="0" frequency="3" max="10" quota="5" time="60" balltypes="1,2,3">
<helpscreen frame="4"/>
<obj type="ballstart" x="48" y="217" rot="0"/>
<obj type="hopper" x="573" y="384" rot="-20"/>
<obj type="plank100" x="33" y="267" rot="20"/>
<obj type="plank100" x="120" y="301" rot="10"/>
<obj type="plank100" x="454" y="354" rot="20"/>
<obj type="plank100" x="603" y="280" rot="90"/>
<obj type="conveyor100" x="392" y="352" rot="180"/>
<obj type="plank50" x="212" y="317" rot="20"/>
<obj type="piston2" x="272" y="346" rot="23"/>
<obj type="bouncer" x="394" y="339" rot="10"/>
<obj type="gem" x="363" y="244" rot="0"/>
<obj type="plank50_smooth" x="351" y="318" rot="20"/>
</level>
<level name="Against The Clock" category="0" frequency="1" max="5" quota="5" time="40" balltypes="1,2,3">
<helpscreen frame="5"/>
<obj type="ballstart" x="125" y="53" rot="0"/>
<obj type="plank100" x="109" y="104" rot="31"/>
<obj type="plank100" x="193" y="155" rot="20"/>
<obj type="plank100" x="287" y="190" rot="10"/>
<obj type="plank100" x="389" y="255" rot="-40"/>
<obj type="plank100" x="325" y="332" rot="-50"/>
<obj type="plank100" x="238" y="378" rot="-28"/>
<obj type="plank100" x="184" y="372" rot="50"/>
<obj type="plank100" x="247" y="446" rot="12"/>
<obj type="plank100" x="345" y="467" rot="10"/>
<obj type="pin_disappear" x="246" y="159" rot="0"/>
<obj type="pin_disappear" x="338" y="185" rot="0"/>
<obj type="pin_disappear" x="397" y="228" rot="0"/>
<obj type="pin_disappear" x="438" y="194" rot="0"/>
<obj type="pin_disappear" x="346" y="285" rot="0"/>
<obj type="pin_disappear" x="277" y="342" rot="0"/>
<obj type="pin_disappear" x="229" y="403" rot="0"/>
<obj type="pin_disappear" x="292" y="439" rot="0"/>
<obj type="pin_disappear" x="386" y="460" rot="0"/>
<obj type="hopper" x="458" y="472" rot="-60"/>
<obj type="pin_disappear" x="182" y="349" rot="0"/>
<obj type="plank100" x="110" y="104" rot="-140"/>
<obj type="plank100" x="35" y="41" rot="-120"/>
<obj type="plank100" x="464" y="192" rot="-50"/>
<obj type="plank100" x="526" y="116" rot="-70"/>
<obj type="plank100" x="561" y="23" rot="-90"/>
<obj type="plank100" x="185" y="374" rot="-140"/>
<obj type="plank100" x="111" y="311" rot="-160"/>
<obj type="plank100" x="21" y="278" rot="-180"/>
<obj type="plank100" x="424" y="348" rot="-380"/>
<obj type="plank100" x="517" y="313" rot="-370"/>
<obj type="plank100" x="613" y="297" rot="-360"/>
<obj type="plank100" x="141" y="445" rot="-170"/>
<obj type="plank100" x="45" y="428" rot="-190"/>
<obj type="plank100" x="504" y="489" rot="0"/>
<obj type="plank100" x="601" y="489" rot="-10"/>
<obj type="pin_disappear" x="65" y="277" rot="0"/>
<obj type="pin_disappear" x="496" y="128" rot="0"/>
<obj type="pin_disappear" x="477" y="313" rot="0"/>
<obj type="pin_disappear" x="562" y="291" rot="0"/>
<obj type="pin_disappear" x="559" y="474" rot="0"/>
<obj type="pin_disappear" x="621" y="469" rot="0"/>
<obj type="pin_disappear" x="90" y="420" rot="0"/>
<obj type="pin_disappear" x="529" y="58" rot="0"/>
<obj type="pin_disappear" x="629" y="278" rot="0"/>
<obj type="pin_disappear" x="125" y="304" rot="0"/>
<obj type="gem" x="424" y="462" rot="0"/>
</level>
<level name="Nothing To Stop You" category="0" frequency="1" max="3" quota="5" time="50" balltypes="1,2,3">
<helpscreen frame="6"/>
<obj type="hopper" x="451" y="397" rot="0"/>
<obj type="ballstart" x="190" y="126" rot="0"/>
<obj type="hinge" x="230" y="229" rot="0"/>
<obj type="plank100" x="337" y="367" rot="20"/>
<obj type="plank50" x="298" y="344" rot="30"/>
<obj type="plank50" x="264" y="315" rot="40"/>
<obj type="gem" x="262" y="196" rot="0"/>
</level>
<level name="Hot Cross Puns" category="0" frequency="1.5" max="6" quota="10" time="60" balltypes="1,2,3">
<helpscreen frame="7"/>
<obj type="ballstart" x="79" y="25" rot="0"/>
<obj type="plank100" x="40" y="70" rot="22"/>
<obj type="plank100" x="132" y="108" rot="20"/>
<obj type="plank100" x="366" y="445" rot="20"/>
<obj type="plank100" x="557" y="396" rot="124"/>
<obj type="plank100" x="557" y="299" rot="90"/>
<obj type="plank100" x="557" y="204" rot="90"/>
<obj type="hopper" x="481" y="480" rot="0"/>
<obj type="cross" x="284" y="185" rot="0"/>
<obj type="cross" x="349" y="291" rot="0"/>
<obj type="cross" x="410" y="182" rot="0"/>
<obj type="cross" x="482" y="290" rot="0"/>
<obj type="cross" x="417" y="386" rot="0"/>
<obj type="gem" x="488" y="203" rot="0"/>
</level>
<level name="Tip The Balance" category="0" frequency="1" max="14" quota="20" time="60" balltypes="1,2,3">
<helpscreen frame="8"/>
<obj type="seesaw20" x="318" y="186" rot="0"/>
<obj type="seesaw20" x="259" y="244" rot="0"/>
<obj type="seesaw20" x="379" y="245" rot="0"/>
<obj type="seesaw20" x="316" y="308" rot="0"/>
<obj type="hopper" x="314" y="483" rot="0"/>
<obj type="plank50_smooth" x="251" y="471" rot="10"/>
<obj type="plank50_smooth" x="333" y="482" rot="-10"/>
<obj type="ballstart" x="260" y="82" rot="0"/>
<obj type="seesaw20" x="196" y="356" rot="0"/>
<obj type="seesaw20" x="438" y="354" rot="0"/>
<obj type="ballstart" x="374" y="83" rot="0"/>
<obj type="gem" x="282" y="353" rot="0"/>
</level>
<level name="Water Wheel" category="0" frequency="1" max="10" quota="12" time="50" balltypes="1,2,3">
<helpscreen frame="9"/>
<obj type="ballstart" x="322" y="61" rot="0"/>
<obj type="hopper" x="485" y="439" rot="0"/>
<obj type="plank100" x="306" y="170" rot="-20"/>
<obj type="plank100" x="216" y="175" rot="-4"/>
<obj type="plank100" x="126" y="209" rot="-20"/>
<obj type="hexcog" x="186" y="292" rot="0"/>
<obj type="plank100" x="266" y="375" rot="20"/>
<obj type="plank100" x="360" y="409" rot="10"/>
<obj type="bridge" x="17" y="267" rot="20"/>
<obj type="conveyor100" x="164" y="368" rot="0"/>
<obj type="gem" x="20" y="187" rot="0"/>
</level>
<level name="One At A Time Please" category="0" frequency="0.2" max="10" quota="10" time="50" balltypes="1,2,3">
<helpscreen frame="10"/>
<obj type="ballstart" x="156" y="94" rot="0"/>
<obj type="plank100" x="128" y="174" rot="10"/>
<obj type="plank100" x="227" y="191" rot="10"/>
<obj type="conveyor100" x="324" y="202" rot="0"/>
<obj type="hinge" x="520" y="209" rot="-180"/>
<obj type="pin" x="433" y="225" rot="0"/>
<obj type="plank100" x="34" y="449" rot="-80"/>
<obj type="plank100" x="31" y="445" rot="30"/>
<obj type="hopper" x="144" y="491" rot="0"/>
<obj type="bouncer2" x="504" y="495" rot="0"/>
<obj type="plank100" x="484" y="525" rot="0"/>
<obj type="piston2" x="315" y="187" rot="10"/>
<obj type="bouncer2" x="566" y="265" rot="-140"/>
<obj type="bouncer2" x="323" y="248" rot="199"/>
<obj type="pin" x="579" y="180" rot="0"/>
<obj type="plank50" x="542" y="209" rot="30"/>
<obj type="bouncer" x="213" y="504" rot="0"/>
<obj type="plank50" x="218" y="536" rot="0"/>
<obj type="plank50" x="170" y="501" rot="-30"/>
<obj type="plank50" x="53" y="358" rot="-120"/>
<obj type="gem" x="65" y="336" rot="0"/>
</level>
<level name="See Sore" category="0" frequency="3" max="5" quota="5" time="30" balltypes="1,2,3">
<obj type="ballstart" x="115" y="108" rot="0"/>
<obj type="seesaw" x="489" y="353" rot="0"/>
<obj type="hopper" x="574" y="406" rot="0"/>
<obj type="plank100" x="632" y="318" rot="110"/>
<obj type="plank100" x="613" y="221" rot="80"/>
<obj type="plank50" x="522" y="374" rot="50"/>
<obj type="plank50" x="384" y="338" rot="16"/>
<obj type="gem" x="595" y="317" rot="0"/>
<obj type="plank50" x="385" y="338" rot="-170"/>
<obj type="plank50" x="342" y="332" rot="-153"/>
<obj type="plank50" x="300" y="309" rot="-176"/>
<obj type="plank50" x="252" y="305" rot="-160"/>
<obj type="plank50" x="208" y="288" rot="-140"/>
<obj type="plank50" x="173" y="258" rot="-160"/>
<obj type="plank50" x="128" y="243" rot="-140"/>
<obj type="plank50" x="93" y="212" rot="-130"/>
<obj type="plank50" x="64" y="175" rot="-110"/>
<obj type="plank50" x="48" y="128" rot="-90"/>
<obj type="plank50" x="49" y="79" rot="-60"/>
<obj type="plank50" x="74" y="38" rot="-20"/>
<obj type="plank50" x="115" y="24" rot="0"/>
<obj type="plank50" x="163" y="25" rot="30"/>
<obj type="plank50" x="206" y="50" rot="-10"/>
<obj type="plank50" x="253" y="42" rot="-50"/>
<obj type="plank50" x="283" y="7" rot="-70"/>
<obj type="plank100" x="613" y="221" rot="-80"/>
<obj type="plank100" x="630" y="126" rot="-100"/>
<obj type="plank100" x="615" y="31" rot="-80"/>
</level>
<level name="Turning Turning" category="0" frequency="2" max="10" quota="15" time="50" balltypes="1,2,3">
<helpscreen frame="11"/>
<obj type="cross_rot_cw" x="481" y="252" rot="0"/>
<obj type="plank100" x="333" y="166" rot="20"/>
<obj type="plank100" x="350" y="363" rot="-30"/>
<obj type="plank100" x="288" y="436" rot="-50"/>
<obj type="plank100" x="237" y="435" rot="-130"/>
<obj type="plank100" x="175" y="360" rot="-110"/>
<obj type="hopper" x="264" y="432" rot="0"/>
<obj type="plank50" x="290" y="141" rot="30"/>
<obj type="plank50" x="240" y="158" rot="-20"/>
<obj type="cross_rot_ccw" x="129" y="193" rot="0"/>
<obj type="plank50" x="197" y="174" rot="-20"/>
<obj type="ballstart" x="286" y="27" rot="0"/>
<obj type="gem" x="389" y="239" rot="0"/>
</level>
<level name="Flick Em High" category="0" frequency="1" max="10" quota="8" time="60" balltypes="1,2,3">
<helpscreen frame="12"/>
<obj type="plank100" x="87" y="122" rot="40"/>
<obj type="plank100" x="534" y="132" rot="140"/>
<obj type="ballstart" x="211" y="78" rot="0"/>
<obj type="ballstart" x="315" y="94" rot="0"/>
<obj type="ballstart" x="417" y="78" rot="0"/>
<obj type="cog4" x="175" y="383" rot="0"/>
<obj type="cog4" x="228" y="383" rot="0"/>
<obj type="cog4" x="283" y="385" rot="0"/>23
<obj type="cog4" x="337" y="387" rot="0"/>
<obj type="cog4" x="394" y="387" rot="0"/>
<obj type="cog4" x="452" y="389" rot="0"/>
<obj type="plank100" x="86" y="249" rot="-40"/>
<obj type="plank100" x="54" y="343" rot="-70"/>
<obj type="plank100" x="55" y="442" rot="-90"/>
<obj type="plank100" x="84" y="466" rot="-50"/>
<obj type="plank100" x="523" y="268" rot="-130"/>
<obj type="plank100" x="556" y="357" rot="-110"/>
<obj type="plank100" x="556" y="457" rot="-90"/>
<obj type="plank100" x="529" y="482" rot="-120"/>
<obj type="hopper" x="70" y="454" rot="40"/>
<obj type="hopper" x="545" y="470" rot="-40"/>
<obj type="gem" x="84" y="350" rot="0"/>
</level>
<level name="Filler" category="0" frequency="1" max="5" quota="10" time="60" balltypes="1,2,3">
<helpscreen frame="13"/>
<obj type="plank100" x="260" y="387" rot="90"/>
<obj type="plank100" x="323" y="417" rot="90"/>
<obj type="plank100" x="324" y="478" rot="90"/>
<obj type="plank100" x="258" y="484" rot="90"/>
<obj type="plank100" x="337" y="544" rot="180"/>
<obj type="plank50_smooth" x="213" y="370" rot="19"/>
<obj type="plank50_smooth" x="168" y="353" rot="20"/>
<obj type="plank50_smooth" x="25" y="299" rot="20"/>
<obj type="plank50_smooth" x="337" y="310" rot="-20"/>
<obj type="plank50_smooth" x="383" y="293" rot="-20"/>
<obj type="plank50_smooth" x="431" y="276" rot="-20"/>
<obj type="plank50_smooth" x="209" y="212" rot="30"/>
<obj type="plank50_smooth" x="166" y="186" rot="30"/>
<obj type="plank50_smooth" x="334" y="171" rot="-10"/>
<obj type="plank50_smooth" x="385" y="162" rot="-10"/>
<obj type="plank50_smooth" x="434" y="155" rot="-10"/>
<obj type="plank50_smooth" x="319" y="412" rot="20"/>
<obj type="plank50_smooth" x="365" y="429" rot="20"/>
<obj type="plank50_smooth" x="411" y="446" rot="20"/>
<obj type="plank50_smooth" x="458" y="464" rot="20"/>
<obj type="heavyball" x="504" y="103" rot="0"/>
<obj type="heavyball" x="132" y="126" rot="0"/>
<obj type="heavyball" x="511" y="210" rot="0"/>
<obj type="plank50_smooth" x="108" y="158" rot="0"/>
<obj type="plank50_smooth" x="478" y="136" rot="0"/>
<obj type="plank50_smooth" x="485" y="243" rot="0"/>
<obj type="hammer" x="91" y="12" rot="-200"/>
<obj type="hammer" x="529" y="-13" rot="-350"/>
<obj type="hammer" x="592" y="129" rot="-320"/>
<obj type="pin_disappear" x="23" y="59" rot="0"/>
<obj type="pin_disappear" x="602" y="17" rot="0"/>
<obj type="pin_disappear" x="634" y="184" rot="0"/>
<obj type="spikes" x="261" y="529" rot="0"/>
<obj type="plank50_smooth" x="72" y="317" rot="20"/>
<obj type="plank50_smooth" x="121" y="335" rot="20"/>
<obj type="hexcog_limited" x="162" y="281" rot="0"/>
<obj type="gem" x="37" y="289" rot="0"/>
<obj type="ballstart" x="61" y="209" rot="0"/>
<obj type="hopper" x="525" y="478" rot="-21"/>
<obj type="plank50_smooth" x="548" y="473" rot="-90"/>
</level>
<level name="Wifes Directions" category="0" frequency="3" max="6" quota="6" time="70" balltypes="1,2,3">
<helpscreen frame="17"/>
<obj type="hopper" x="380" y="218" rot="-180"/>
<obj type="ballstart" x="315" y="173" rot="0"/>
<obj type="plank100" x="358" y="279" rot="88"/>
<obj type="plank100" x="354" y="376" rot="130"/>
<obj type="piston" x="172" y="470" rot="-20"/>
<obj type="plank100" x="118" y="378" rot="70"/>
<obj type="conveyor100" x="52" y="239" rot="0"/>
<obj type="plank50" x="153" y="244" rot="0"/>
<obj type="mover50" x="16" y="351" rot="-90"/>
<obj type="mover50" x="15" y="303" rot="-90"/>
<obj type="mover50" x="14" y="242" rot="-70"/>
<obj type="bouncer2" x="205" y="282" rot="0"/>
<obj type="plank50" x="208" y="314" rot="0"/>
<obj type="mover50" x="216" y="210" rot="-80"/>
<obj type="mover50" x="228" y="140" rot="-60"/>
<obj type="conveyor100" x="292" y="115" rot="0"/>
<obj type="plank100" x="392" y="122" rot="50"/>
<obj type="plank100" x="454" y="193" rot="90"/>
<obj type="plank100" x="490" y="194" rot="90"/>
<obj type="plank100" x="452" y="290" rot="50"/>
<obj type="plank100" x="489" y="287" rot="50"/>
<obj type="plank50" x="552" y="358" rot="90"/>
<obj type="piston2" x="544" y="495" rot="320"/>
<obj type="plank100" x="475" y="443" rot="50"/>
<obj type="plank100" x="642" y="435" rot="140"/>
<obj type="plank50" x="554" y="399" rot="100"/>
<obj type="bouncer2" x="392" y="505" rot="0"/>
<obj type="plank50" x="393" y="536" rot="0"/>
<obj type="mover50" x="386" y="470" rot="-100"/>
<obj type="mover50" x="377" y="420" rot="-100"/>
<obj type="mover50" x="370" y="365" rot="-100"/>
<obj type="mover50" x="362" y="305" rot="-90"/>
<obj type="mover50" x="363" y="255" rot="-100"/>
<obj type="conveyor100" x="288" y="463" rot="180"/>
<obj type="plank100" x="361" y="378" rot="80"/>
<obj type="plank50" x="366" y="230" rot="100"/>
<obj type="plank50" x="544" y="449" rot="60"/>
<obj type="gem" x="81" y="281" rot="0"/>
</level>
<level name="Which Way" category="0" frequency="3" max="3" quota="10" time="60" balltypes="1,2">
<helpscreen frame="14"/>
<helpscreen frame="15"/>
<obj type="cross" x="284" y="224" rot="50"/>
<obj type="ballstart" x="282" y="76" rot="0"/>
<obj type="plank100" x="292" y="286" rot="20"/>
<obj type="plank100" x="382" y="320" rot="70"/>
<obj type="plank100" x="271" y="289" rot="160"/>
<obj type="plank100" x="178" y="321" rot="110"/>
<obj type="plank100" x="98" y="321" rot="86"/>
<obj type="plank100" x="98" y="224" rot="90"/>
<obj type="plank100" x="462" y="317" rot="95"/>
<obj type="plank100" x="462" y="219" rot="90"/>
<obj type="hopper1" x="126" y="418" rot="-7"/>
<obj type="hopper2" x="433" y="416" rot="4"/>
<obj type="gem" x="443" y="231" rot="0"/>
<obj type="plank50" x="461" y="221" rot="-30"/>
<obj type="plank50" x="503" y="197" rot="-10"/>
<obj type="plank50" x="551" y="189" rot="-30"/>
<obj type="plank50" x="594" y="165" rot="-50"/>
<obj type="plank50" x="626" y="127" rot="-70"/>
<obj type="plank50" x="98" y="225" rot="-100"/>
<obj type="plank50" x="90" y="178" rot="-120"/>
<obj type="plank50" x="67" y="137" rot="-110"/>
<obj type="plank50" x="51" y="92" rot="-90"/>
<obj type="plank50" x="50" y="44" rot="-60"/>
</level>
<!-- MEDIUM levels (category 1) -->
<level name="Shotgun" category="1" frequency="0.5" max="10" quota="18" time="50" balltypes="1,2,3">
<helpscreen frame="16"/>
<obj type="ballstart" x="108" y="185" rot="0"/>
<obj type="hinge" x="66" y="337" rot="0"/>
<obj type="pin" x="103" y="415" rot="0"/>
<obj type="bouncer2" x="221" y="481" rot="20"/>
<obj type="mover50" x="246" y="412" rot="-70"/>
<obj type="mover50" x="263" y="369" rot="-70"/>
<obj type="mover50" x="280" y="327" rot="-70"/>
<obj type="mover50" x="299" y="280" rot="-70"/>
<obj type="plank50_smooth" x="458" y="286" rot="20"/>
<obj type="hopper" x="528" y="302" rot="0"/>
<obj type="plank100" x="553" y="306" rot="-50"/>
<obj type="plank100" x="616" y="229" rot="-90"/>
<obj type="plank100" x="616" y="129" rot="-130"/>
<obj type="mover50" x="329" y="444" rot="-80"/>
<obj type="mover50" x="337" y="396" rot="-80"/>
<obj type="mover50" x="344" y="349" rot="-80"/>
<obj type="mover50" x="352" y="302" rot="-80"/>
<obj type="bouncer2" x="321" y="505" rot="0"/>
<obj type="bouncer2" x="421" y="52" rot="150"/>
<obj type="bouncer2" x="421" y="52" rot="150"/>
<obj type="plank50" x="213" y="520" rot="0"/>
<obj type="plank50" x="324" y="535" rot="0"/>
<obj type="plank50" x="354" y="51" rot="-30"/>
<obj type="stick01" x="634" y="339" rot="200"/>
<obj type="stick01" x="336" y="-33" rot="398"/>
<obj type="gem" x="68" y="310" rot="0"/>
</level>
<level name="Pint Able" category="1" frequency="1" max="12" quota="30" time="45" balltypes="1,2,3">
<obj type="ballstart" x="163" y="100" rot="0"/>
<obj type="ballstart" x="329" y="96" rot="0"/>
<obj type="ballstart" x="488" y="96" rot="0"/>
<obj type="hopper" x="164" y="455" rot="0"/>
<obj type="hopper" x="332" y="453" rot="0"/>
<obj type="hopper" x="494" y="453" rot="0"/>
<obj type="pin_disappear" x="163" y="183" rot="0"/>
<obj type="pin_disappear" x="135" y="215" rot="0"/>
<obj type="pin_disappear" x="194" y="215" rot="0"/>
<obj type="pin_disappear" x="154" y="253" rot="0"/>
<obj type="pin_disappear" x="182" y="250" rot="0"/>
<obj type="pin_disappear" x="170" y="295" rot="0"/>
<obj type="pin_disappear" x="144" y="329" rot="0"/>
<obj type="pin_disappear" x="188" y="326" rot="0"/>
<obj type="pin_disappear" x="141" y="372" rot="0"/>
<obj type="pin_disappear" x="191" y="373" rot="0"/>
<obj type="pin_disappear" x="165" y="411" rot="0"/>
<obj type="pin_disappear" x="121" y="290" rot="0"/>
<obj type="pin_disappear" x="216" y="293" rot="0"/>
<obj type="pin_disappear" x="321" y="173" rot="0"/>
<obj type="pin_disappear" x="298" y="218" rot="0"/>
<obj type="pin_disappear" x="368" y="201" rot="0"/>
<obj type="pin_disappear" x="353" y="233" rot="0"/>
<obj type="pin_disappear" x="327" y="261" rot="0"/>
<obj type="pin_disappear" x="283" y="319" rot="0"/>
<obj type="pin_disappear" x="356" y="341" rot="0"/>
<obj type="pin_disappear" x="370" y="276" rot="0"/>
<obj type="pin_disappear" x="322" y="303" rot="0"/>
<obj type="pin_disappear" x="305" y="364" rot="0"/>
<obj type="pin_disappear" x="335" y="408" rot="0"/>
<obj type="pin_disappear" x="385" y="406" rot="0"/>
<obj type="pin_disappear" x="288" y="412" rot="0"/>
<obj type="pin_disappear" x="490" y="167" rot="0"/>
<obj type="pin_disappear" x="494" y="215" rot="0"/>
<obj type="pin_disappear" x="435" y="236" rot="0"/>
<obj type="pin_disappear" x="533" y="213" rot="0"/>
<obj type="pin_disappear" x="477" y="244" rot="0"/>
<obj type="pin_disappear" x="511" y="299" rot="0"/>
<obj type="pin_disappear" x="472" y="313" rot="0"/>
<obj type="pin_disappear" x="514" y="263" rot="0"/>
<obj type="pin_disappear" x="512" y="346" rot="0"/>
<obj type="pin_disappear" x="475" y="346" rot="0"/>
<obj type="pin_disappear" x="530" y="400" rot="0"/>
<obj type="pin_disappear" x="484" y="401" rot="0"/>
<obj type="pin_disappear" x="433" y="369" rot="0"/>
<obj type="pin_disappear" x="552" y="356" rot="0"/>
<obj type="pin_disappear" x="560" y="284" rot="0"/>
<obj type="pin_disappear" x="219" y="347" rot="0"/>
<obj type="pin_disappear" x="104" y="382" rot="0"/>
<obj type="plank50" x="111" y="420" rot="50"/>
<obj type="plank50" x="277" y="423" rot="50"/>
<obj type="plank50" x="441" y="420" rot="50"/>
<obj type="plank50" x="219" y="424" rot="130"/>
<obj type="plank50" x="389" y="423" rot="130"/>
<obj type="plank50" x="552" y="424" rot="130"/>
<obj type="gem" x="249" y="325" rot="0"/>
</level>
<level name="The Lone Gunman" category="1" frequency="1" max="5" quota="5" time="40" balltypes="1,2,3">
<obj type="ballstart_no_random_offsets" x="45" y="203" rot="0"/>
<obj type="plank100" x="-19" y="269" rot="10"/>
<obj type="conveyor100" x="77" y="280" rot="0"/>
<obj type="hopper" x="56" y="418" rot="20"/>
<obj type="domino" x="102" y="418" rot="0"/>
<obj type="conveyor100" x="225" y="429" rot="180"/>
<obj type="conveyor100" x="522" y="429" rot="180"/>
<obj type="conveyor100" x="175" y="280" rot="0"/>
<obj type="conveyor100" x="274" y="280" rot="0"/>
<obj type="hinge" x="472" y="287" rot="-70"/>
<obj type="hammer" x="581" y="223" rot="298"/>
<obj type="plank50" x="639" y="313" rot="94"/>
<obj type="mover50" x="354" y="371" rot="189"/>
<obj type="mover50" x="308" y="368" rot="186"/>
<obj type="mover50" x="262" y="365" rot="186"/>
<obj type="mover50" x="217" y="362" rot="187"/>
<obj type="mover50" x="170" y="361" rot="186"/>
<obj type="pin" x="540" y="228" rot="0"/>
<obj type="plank100" x="539" y="362" rot="0"/>
<obj type="pin_disappear" x="630" y="158" rot="0"/>
<obj type="piston2" x="352" y="264" rot="0"/>
<obj type="pin" x="382" y="304" rot="0"/>
<obj type="mover50" x="519" y="359" rot="180"/>
<obj type="mover50" x="534" y="359" rot="180"/>
<obj type="mover50" x="533" y="359" rot="180"/>
<obj type="mover50" x="534" y="359" rot="180"/>
<obj type="plank50" x="493" y="352" rot="11"/>
<obj type="plank50_smooth" x="532" y="286" rot="20"/>
<obj type="plank50" x="482" y="287" rot="0"/>
<obj type="plank50_smooth" x="373" y="422" rot="0"/>
<obj type="plank50_smooth" x="323" y="422" rot="0"/>
<obj type="plank50_smooth" x="273" y="422" rot="0"/>
<obj type="plank50_smooth" x="224" y="422" rot="0"/>
<obj type="plank50" x="75" y="423" rot="0"/>
<obj type="mover50" x="372" y="418" rot="180"/>
<obj type="plank50_smooth" x="324" y="366" rot="0"/>
<obj type="plank50_smooth" x="275" y="366" rot="0"/>
<obj type="gem" x="294" y="342" rot="0"/>
</level>
<level name="High Jump" category="1" frequency="1" max="4" quota="5" time="60" balltypes="1,2,3">
<obj type="bouncer2" x="16" y="507" rot="20"/>
<obj type="plank100" x="2" y="544" rot="0"/>
<obj type="ballstart" x="42" y="34" rot="0"/>
<obj type="cross" x="379" y="179" rot="0"/>
<obj type="cog8" x="460" y="198" rot="0"/>
<obj type="bridge2" x="573" y="225" rot="90"/>
<obj type="hopper" x="537" y="485" rot="0"/>
<obj type="plank100" x="463" y="400" rot="60"/>
<obj type="gem" x="487" y="404" rot="0"/>
</level>
<level name="Pump Action" category="1" frequency="3" max="5" quota="10" time="50" balltypes="1,2,3">
<obj type="ballstart" x="87" y="96" rot="0"/>
<obj type="plank100" x="53" y="167" rot="8"/>
<obj type="plank100" x="183" y="201" rot="10"/>
<obj type="plank100" x="282" y="240" rot="10"/>
<obj type="plank100" x="413" y="280" rot="10"/>
<obj type="plank100" x="508" y="304" rot="80"/>
<obj type="plank100" x="596" y="304" rot="100"/>
<obj type="hopper" x="553" y="464" rot="0"/>
<obj type="plank50" x="524" y="405" rot="70"/>
<obj type="plank50" x="579" y="404" rot="100"/>
<obj type="piston2" x="386" y="322" rot="12"/>
<obj type="piston2" x="156" y="245" rot="10"/>
<obj type="gem" x="491" y="176" rot="0"/>
</level>
<level name="Crypton Factor" category="1" frequency="4" max="10" quota="10" time="100" balltypes="1,2,3">
<obj type="conveyor100" x="17" y="499" rot="0"/>
<obj type="bouncer2" x="118" y="511" rot="0"/>
<obj type="ballstart_no_random_offsets" x="40" y="401" rot="0"/>
<obj type="hopper" x="574" y="152" rot="0"/>
<obj type="hinge" x="187" y="515" rot="-90"/>
<obj type="plank100" x="100" y="538" rot="0"/>
<obj type="pin" x="252" y="506" rot="0"/>
<obj type="mover50" x="18" y="448" rot="0"/>
<obj type="mover50" x="165" y="422" rot="0"/>
<obj type="hinge" x="428" y="514" rot="-90"/>
<obj type="pin" x="369" y="507" rot="0"/>
<obj type="bouncer2" x="440" y="514" rot="0"/>
<obj type="plank100" x="420" y="542" rot="0"/>
<obj type="bridge" x="406" y="421" rot="0"/>
<obj type="mover50" x="526" y="504" rot="-107"/>
<obj type="conveyor100" x="402" y="409" rot="200"/>
<obj type="conveyor100" x="310" y="376" rot="200"/>
<obj type="conveyor100" x="216" y="341" rot="200"/>
<obj type="mover50" x="402" y="390" rot="200"/>
<obj type="mover50" x="308" y="359" rot="200"/>
<obj type="mover50" x="201" y="319" rot="200"/>
<obj type="bridge" x="23" y="304" rot="0"/>
<obj type="mover50" x="509" y="438" rot="-100"/>
<obj type="plank100" x="18" y="300" rot="-90"/>
<obj type="plank100" x="18" y="199" rot="-90"/>
<obj type="mover50" x="50" y="175" rot="-70"/>
<obj type="mover50" x="81" y="115" rot="-40"/>
<obj type="bridge" x="148" y="135" rot="0"/>
<obj type="conveyor100" x="248" y="129" rot="0"/>
<obj type="conveyor100" x="347" y="129" rot="0"/>
<obj type="bouncer2" x="440" y="197" rot="20"/>
<obj type="plank100" x="635" y="14" rot="90"/>
<obj type="plank100" x="505" y="252" rot="200"/>
<obj type="mover50" x="420" y="353" rot="-158"/>
<obj type="mover50" x="47" y="253" rot="-90"/>
<obj type="mover50" x="25" y="90" rot="0"/>
<obj type="plank50" x="601" y="142" rot="-40"/>
<obj type="gem" x="75" y="186" rot="0"/>
</level>
<level name="Sorting Orifice" category="1" frequency="3" max="5" quota="10" time="47" balltypes="1,2">
<helpscreen frame="18"/>
<obj type="plunger100r" x="191" y="245" rot="30"/>
<obj type="plunger100r" x="144" y="345" rot="-36"/>
<obj type="plunger100" x="301" y="218" rot="80"/>
<obj type="plunger100" x="400" y="160" rot="60"/>
<obj type="plank100" x="280" y="126" rot="16"/>
<obj type="plank100" x="187" y="91" rot="20"/>
<obj type="plank100" x="404" y="176" rot="20"/>
<obj type="ballstart" x="235" y="45" rot="0"/>
<obj type="plank100" x="497" y="213" rot="90"/>
<obj type="plank100" x="547" y="214" rot="87"/>
<obj type="plank100" x="495" y="313" rot="62"/>
<obj type="plank100" x="551" y="313" rot="60"/>
<obj type="plank50" x="600" y="400" rot="99"/>
<obj type="plank50" x="542" y="401" rot="81"/>
<obj type="hopper1" x="570" y="451" rot="0"/>
<obj type="plunger100" x="373" y="347" rot="82"/>
<obj type="plunger100r" x="258" y="362" rot="67"/>
<obj type="plunger100r" x="150" y="408" rot="40"/>
<obj type="hopper2" x="416" y="381" rot="0"/>
<obj type="plank50" x="364" y="199" rot="60"/>
<obj type="plank50" x="406" y="200" rot="60"/>
<obj type="plank50" x="431" y="243" rot="56"/>
<obj type="plank50" x="455" y="284" rot="150"/>
<obj type="plank50" x="386" y="237" rot="60"/>
<obj type="plank50" x="405" y="277" rot="150"/>
<obj type="guard_100x100" x="83" y="358" rot="0"/>
<obj type="guard_100x100" x="-17" y="358" rot="0"/>
<obj type="guard_100x100" x="182" y="297" rot="0"/>
<obj type="guard_100x100" x="282" y="242" rot="0"/>
<obj type="guard_100x100" x="83" y="259" rot="0"/>
<obj type="guard_100x100" x="182" y="197" rot="0"/>
<obj type="guard_100x100" x="281" y="142" rot="0"/>
<obj type="plank50" x="138" y="448" rot="-30"/>
<obj type="plank50" x="214" y="404" rot="-20"/>
<obj type="plank50" x="261" y="387" rot="-10"/>
<obj type="plank50" x="311" y="377" rot="-2"/>
<obj type="guard_100x100" x="181" y="97" rot="0"/>
<obj type="guard_100x100" x="83" y="160" rot="0"/>
<obj type="guard_100x100" x="83" y="61" rot="0"/>
<obj type="gem" x="519" y="242" rot="0"/>
<obj type="guard_100x100" x="-16" y="258" rot="0"/>
<obj type="guard_100x100" x="-17" y="158" rot="0"/>
<obj type="guard_100x100" x="-16" y="59" rot="0"/>
<obj type="plank100" x="547" y="216" rot="-80"/>
<obj type="plank100" x="565" y="118" rot="-40"/>
<obj type="greystick01" x="467" y="484" rot="280"/>
<obj type="greystick01" x="477" y="543" rot="110"/>
<obj type="greystick01" x="572" y="542" rot="-290"/>
</level>
<level name="Hinge And Bracket" category="1" frequency="1.5" max="10" quota="10" time="60" balltypes="1,2,3">
<helpscreen frame="18"/>
<obj type="hinge" x="291" y="209" rot="-51"/>
<obj type="hinge" x="269" y="291" rot="-58"/>
<obj type="hinge" x="148" y="422" rot="-110"/>
<obj type="hinge" x="374" y="424" rot="-121"/>
<obj type="hinge" x="456" y="357" rot="-123"/>
<obj type="plank100" x="169" y="459" rot="0"/>
<obj type="plank100" x="270" y="460" rot="-20"/>
<obj type="plank100" x="69" y="441" rot="10"/>
<obj type="pin" x="173" y="200" rot="0"/>
<obj type="pin" x="203" y="211" rot="0"/>
<obj type="pin" x="354" y="264" rot="0"/>
<obj type="pin" x="253" y="315" rot="0"/>
<obj type="pin" x="105" y="355" rot="0"/>
<obj type="pin" x="446" y="387" rot="0"/>
<obj type="hopper" x="580" y="394" rot="0"/>
<obj type="ballstart" x="287" y="35" rot="0"/>
<obj type="plank100" x="170" y="110" rot="-10"/>
<obj type="plank100" x="269" y="91" rot="-10"/>
<obj type="mover50" x="174" y="406" rot="0"/>
<obj type="mover50" x="225" y="405" rot="0"/>
<obj type="mover50" x="265" y="403" rot="-20"/>
<obj type="mover50" x="309" y="384" rot="-20"/>
<obj type="mover50" x="349" y="368" rot="-40"/>
<obj type="mover50" x="385" y="337" rot="-40"/>
<obj type="mover50" x="416" y="311" rot="-60"/>
<obj type="hinge90" x="113" y="142" rot="-142"/>
<obj type="pin" x="31" y="101" rot="0"/>
<obj type="plank100" x="77" y="254" rot="-30"/>
<obj type="spikes" x="10" y="249" rot="0"/>
<obj type="pin" x="356" y="158" rot="0"/>
<obj type="spikes" x="214" y="218" rot="0"/>
<obj type="pin_disappear" x="318" y="242" rot="0"/>
<obj type="hinge90" x="165" y="328" rot="-83"/>
<obj type="pin_disappear" x="229" y="351" rot="0"/>
<obj type="pin" x="311" y="359" rot="0"/>
<obj type="hinge" x="553" y="386" rot="-135"/>
<obj type="pin" x="483" y="367" rot="0"/>
<obj type="pin" x="395" y="304" rot="0"/>
<obj type="pin" x="572" y="194" rot="0"/>
<obj type="hinge90" x="557" y="265" rot="-100"/>
<obj type="spikes" x="540" y="239" rot="-130"/>
<obj type="spikes" x="229" y="364" rot="-30"/>
<obj type="gem" x="130" y="436" rot="0"/>
<obj type="plank100" x="606" y="395" rot="-80"/>
<obj type="spikes" x="445" y="259" rot="-180"/>
<obj type="spikes" x="300" y="318" rot="-30"/>
</level>
<level name="Spread Em" category="1" frequency="1" max="5" quota="10" time="60" balltypes="1,2,3">
<obj type="guard_100x100" x="110" y="90" rot="0"/>
<obj type="ballstart" x="368" y="81" rot="0"/>
<obj type="pin_disappear_broken" x="211" y="195" rot="0"/>
<obj type="pin_disappear_broken" x="184" y="205" rot="0"/>
<obj type="plunger100" x="342" y="353" rot="0"/>
<obj type="hinge" x="311" y="342" rot="12"/>
<obj type="plank100" x="100" y="281" rot="10"/>
<obj type="plank100" x="197" y="300" rot="10"/>
<obj type="hopper" x="194" y="403" rot="27"/>
<obj type="plank100" x="215" y="410" rot="-20"/>
<obj type="guard_100x100" x="211" y="289" rot="0"/>
<obj type="guard_100x100" x="311" y="289" rot="0"/>
<obj type="guard_100x100" x="411" y="289" rot="0"/>
<obj type="plank50" x="303" y="376" rot="50"/>
<obj type="plank50" x="347" y="415" rot="-30"/>
<obj type="plank50" x="390" y="392" rot="30"/>
<obj type="plank50" x="432" y="418" rot="50"/>
<obj type="plank50" x="460" y="457" rot="130"/>
<obj type="plank50" x="458" y="360" rot="60"/>
<obj type="plank50" x="483" y="404" rot="60"/>
<obj type="plank50" x="507" y="447" rot="120"/>
<obj type="guard_100x100" x="210" y="389" rot="0"/>
<obj type="guard_100x100" x="310" y="389" rot="0"/>
<obj type="guard_100x100" x="410" y="389" rot="0"/>
<obj type="plank50" x="204" y="214" rot="-20"/>
<obj type="plank50" x="251" y="197" rot="-20"/>
<obj type="plank50" x="298" y="180" rot="-20"/>
<obj type="plank50" x="343" y="163" rot="-20"/>
<obj type="plank50" x="390" y="146" rot="-30"/>
<obj type="plank50" x="433" y="121" rot="-50"/>
<obj type="plank50" x="465" y="83" rot="-70"/>
<obj type="plank50" x="482" y="35" rot="-90"/>
<obj type="pin_disappear" x="108" y="264" rot="0"/>
<obj type="guard_100x100" x="110" y="190" rot="0"/>
<obj type="guard_100x100" x="10" y="130" rot="0"/>
<obj type="guard_100x100" x="10" y="30" rot="0"/>
<obj type="plank50" x="204" y="215" rot="160"/>
<obj type="guard_100x100" x="210" y="190" rot="0"/>
<obj type="guard_100x100" x="210" y="90" rot="0"/>
<obj type="gem" x="370" y="320" rot="0"/>
</level>
<level name="Salopian Tubes" category="1" frequency="2" max="5" quota="9" time="30" balltypes="1,2">
<obj type="ballstart" x="91" y="385" rot="0"/>
<obj type="ballstart" x="559" y="377" rot="0"/>
<obj type="mover50" x="272" y="527" rot="-90"/>
<obj type="mover50" x="272" y="477" rot="-90"/>
<obj type="mover50" x="272" y="427" rot="-90"/>
<obj type="mover50" x="272" y="378" rot="-90"/>
<obj type="mover50" x="273" y="328" rot="-90"/>
<obj type="mover50" x="273" y="278" rot="-90"/>
<obj type="mover50" x="273" y="228" rot="-90"/>
<obj type="plank100" x="266" y="410" rot="90"/>
<obj type="plank100" x="265" y="311" rot="90"/>
<obj type="plank100" x="329" y="314" rot="90"/>
<obj type="plank100" x="329" y="407" rot="90"/>
<obj type="plank100" x="337" y="87" rot="110"/>
<obj type="plank100" x="248" y="94" rot="60"/>
<obj type="chain" x="298" y="180" rot="0"/>
<obj type="hopper1" x="108" y="273" rot="30"/>
<obj type="hopper2" x="469" y="265" rot="-40"/>
<obj type="plank100" x="85" y="265" rot="-80"/>
<obj type="plank100" x="489" y="254" rot="-100"/>
<obj type="gem" x="234" y="113" rot="0"/>
<obj type="ballstart" x="500" y="390" rot="0"/>
<obj type="plank50" x="161" y="256" rot="140"/>
<obj type="plank50" x="206" y="250" rot="170"/>
<obj type="plank50" x="243" y="274" rot="210"/>
<obj type="plank50" x="265" y="315" rot="240"/>
<obj type="plank50" x="416" y="256" rot="390"/>
<obj type="plank50" x="373" y="242" rot="380"/>
<obj type="plank50" x="339" y="273" rot="320"/>
<obj type="plank50" x="329" y="317" rot="285"/>
<obj type="plank50" x="102" y="167" rot="290"/>
<obj type="plank50" x="118" y="121" rot="320"/>
<obj type="plank50" x="155" y="89" rot="350"/>
<obj type="plank50" x="202" y="81" rot="380"/>
<obj type="plank50" x="335" y="89" rot="340"/>
<obj type="plank50" x="381" y="73" rot="370"/>
<obj type="plank50" x="428" y="82" rot="410"/>
<obj type="plank50" x="458" y="116" rot="430"/>
<obj type="mover50" x="239" y="271" rot="-120"/>
<obj type="mover50" x="240" y="220" rot="-120"/>
<obj type="mover50" x="313" y="243" rot="-70"/>
<obj type="mover50" x="316" y="184" rot="-50"/>
<obj type="plank100" x="249" y="541" rot="0"/>
<obj type="plank100" x="348" y="541" rot="-20"/>
<obj type="plank100" x="442" y="507" rot="-20"/>
<obj type="plank100" x="535" y="473" rot="-20"/>
<obj type="plank100" x="247" y="540" rot="-160"/>
<obj type="plank100" x="153" y="505" rot="-160"/>
<obj type="plank100" x="60" y="471" rot="-160"/>
</level>
<level name="Incredibly Stupid Machine" category="1" frequency="1" max="5" quota="10" time="60" balltypes="1,2,3">
<obj type="ballstart" x="110" y="104" rot="0"/>
<obj type="plank50" x="43" y="162" rot="50"/>
<obj type="plank50" x="76" y="202" rot="20"/>
<obj type="plank50" x="123" y="220" rot="20"/>
<obj type="plank50" x="170" y="237" rot="20"/>
<obj type="plank50" x="217" y="255" rot="20"/>
<obj type="plank50" x="263" y="274" rot="90"/>
<obj type="plank50" x="301" y="342" rot="-55"/>
<obj type="plank50" x="331" y="305" rot="36"/>
<obj type="hopper" x="499" y="456" rot="-54"/>
<obj type="spikes" x="252" y="326" rot="0"/>
<obj type="plank50" x="419" y="147" rot="0"/>
<obj type="plank50" x="390" y="188" rot="-50"/>
<obj type="plank50" x="360" y="223" rot="-50"/>
<obj type="plank50" x="332" y="258" rot="-50"/>
<obj type="heavyball" x="440" y="115" rot="0"/>
<obj type="hexcog" x="575" y="90" rot="0"/>
<obj type="hexcog" x="548" y="179" rot="0"/>
<obj type="hexcog" x="584" y="261" rot="0"/>
<obj type="cross" x="485" y="73" rot="0"/>
<obj type="guard_100x100" x="361" y="1" rot="0"/>
<obj type="guard_100x100" x="460" y="1" rot="0"/>
<obj type="guard_100x100" x="558" y="2" rot="0"/>
<obj type="guard_100x100" x="362" y="100" rot="0"/>
<obj type="guard_100x100" x="461" y="101" rot="0"/>
<obj type="guard_100x100" x="560" y="102" rot="0"/>
<obj type="guard_100x100" x="463" y="201" rot="0"/>
<obj type="guard_100x100" x="563" y="202" rot="0"/>
<obj type="guard_100x100" x="364" y="200" rot="0"/>
<obj type="plank100" x="418" y="248" rot="0"/>
<obj type="chain" x="191" y="127" rot="0"/>
<obj type="chain" x="229" y="141" rot="0"/>
<obj type="stick02" x="184" y="75" rot="-130"/>
<obj type="stick02" x="246" y="93" rot="-110"/>
<obj type="stick02" x="254" y="20" rot="-170"/>
<obj type="stick02" x="194" y="21" rot="-80"/>
<obj type="stick02" x="127" y="21" rot="-110"/>
<obj type="gem" x="85" y="188" rot="0"/>
<obj type="plank50" x="370" y="333" rot="60"/>
<obj type="plank50" x="395" y="376" rot="70"/>
<obj type="plank50" x="411" y="423" rot="50"/>
<obj type="plank50" x="443" y="462" rot="20"/>
<obj type="plank50" x="466" y="413" rot="30"/>
<obj type="plank50" x="469" y="411" rot="250"/>
<obj type="plank50" x="452" y="364" rot="230"/>
<obj type="plank50" x="422" y="325" rot="240"/>
<obj type="plank50" x="395" y="282" rot="310"/>
</level>
<level name="Bridge Of Sighs" category="1" frequency="1" max="10" quota="10" time="120" balltypes="1,2,3">
<obj type="bridge" x="42" y="416" rot="0"/>
<obj type="plank50" x="504" y="279" rot="20"/>
<obj type="plank50" x="458" y="261" rot="20"/>
<obj type="plank50" x="412" y="245" rot="20"/>
<obj type="piston" x="565" y="279" rot="-70"/>
<obj type="plank50" x="341" y="248" rot="40"/>
<obj type="plank50" x="302" y="214" rot="40"/>
<obj type="plank50" x="217" y="199" rot="30"/>
<obj type="plank50" x="174" y="175" rot="30"/>
<obj type="piston" x="403" y="274" rot="-50"/>
<obj type="piston" x="281" y="217" rot="-60"/>
<obj type="hopper" x="155" y="187" rot="0"/>
<obj type="plank100" x="118" y="87" rot="80"/>
<obj type="ballstart" x="91" y="61" rot="0"/>
<obj type="plank100" x="67" y="87" rot="80"/>
<obj type="plank100" x="82" y="185" rot="130"/>
<obj type="plank100" x="129" y="219" rot="130"/>
<obj type="plank100" x="18" y="264" rot="77"/>
<obj type="plank50" x="65" y="296" rot="60"/>
<obj type="plank100" x="638" y="251" rot="90"/>
<obj type="plank100" x="622" y="154" rot="80"/>
<obj type="plank100" x="583" y="62" rot="67"/>
<obj type="gem" x="288" y="319" rot="0"/>
<obj type="bridge" x="148" y="418" rot="0"/>
<obj type="bridge" x="254" y="423" rot="0"/>
<obj type="bridge" x="362" y="425" rot="0"/>
<obj type="bridge" x="467" y="429" rot="0"/>
<obj type="bouncer2" x="570" y="467" rot="0"/>
<obj type="mover50" x="582" y="351" rot="-90"/>
<obj type="mover50" x="584" y="303" rot="-90"/>
<obj type="plank100" x="637" y="352" rot="90"/>
<obj type="plank100" x="636" y="452" rot="90"/>
<obj type="mover50" x="584" y="260" rot="-106"/>
</level>
<level name="Spin Spin" category="1" frequency="3" max="3" quota="5" time="60" balltypes="1,2,3">
<obj type="hopper1" x="209" y="479" rot="10"/>
<obj type="ballstart" x="201" y="57" rot="0"/>
<obj type="ballstart" x="280" y="57" rot="0"/>
<obj type="ballstart" x="364" y="55" rot="0"/>
<obj type="cog4" x="223" y="136" rot="0"/>
<obj type="cog4" x="320" y="155" rot="0"/>
<obj type="cog4" x="435" y="124" rot="0"/>
<obj type="cog4" x="368" y="287" rot="0"/>
<obj type="cog4" x="256" y="291" rot="0"/>
<obj type="cog4" x="275" y="420" rot="0"/>
<obj type="cog4" x="141" y="375" rot="0"/>
<obj type="cog4" x="450" y="344" rot="0"/>
<obj type="cog4" x="509" y="203" rot="0"/>
<obj type="cog4" x="274" y="210" rot="0"/>
<obj type="cog4" x="394" y="191" rot="0"/>
<obj type="cog4" x="340" y="227" rot="0"/>
<obj type="cog4" x="192" y="247" rot="0"/>
<obj type="cog4" x="308" y="344" rot="0"/>
<obj type="cog4" x="213" y="353" rot="0"/>
<obj type="cog4" x="371" y="386" rot="0"/>
<obj type="cog4" x="440" y="259" rot="0"/>
<obj type="cog4" x="512" y="294" rot="0"/>
<obj type="cog4" x="441" y="410" rot="0"/>
<obj type="hopper2" x="341" y="482" rot="0"/>
<obj type="hopper3" x="471" y="480" rot="0"/>
<obj type="cog4" x="152" y="170" rot="0"/>
<obj type="cog4" x="129" y="299" rot="0"/>
<obj type="cog4" x="581" y="247" rot="0"/>
<obj type="cog4" x="535" y="369" rot="0"/>
<obj type="cog4" x="201" y="420" rot="0"/>
<obj type="plank50" x="141" y="447" rot="30"/>
<obj type="plank50" x="271" y="454" rot="150"/>
<obj type="plank50" x="278" y="457" rot="30"/>
<obj type="plank50" x="404" y="456" rot="150"/>
<obj type="plank50" x="407" y="458" rot="26"/>
<obj type="plank50" x="533" y="449" rot="150"/>
<obj type="ballstart" x="459" y="55" rot="0"/>
<obj type="greystick01" x="39" y="124" rot="-120"/>
<obj type="greystick01" x="45" y="176" rot="-50"/>
<obj type="greystick01" x="24" y="278" rot="-270"/>
<obj type="greystick01" x="56" y="405" rot="-50"/>
<obj type="greystick01" x="4" y="172" rot="30"/>
<obj type="greystick01" x="51" y="43" rot="-80"/>
<obj type="greystick01" x="7" y="376" rot="40"/>
<obj type="greystick01" x="0" y="446" rot="280"/>
<obj type="gem" x="540" y="320" rot="0"/>
</level>
<level name="Domino Pizzaz" category="1" frequency="1" max="10" quota="7" time="60" balltypes="1,2,3">
<obj type="plank100" x="154" y="264" rot="0"/>
<obj type="plank100" x="264" y="327" rot="0"/>
<obj type="plank100" x="375" y="402" rot="0"/>
<obj type="domino" x="181" y="257" rot="0"/>
<obj type="domino" x="236" y="257" rot="0"/>
<obj type="domino" x="461" y="396" rot="0"/>
<obj type="plank100" x="67" y="214" rot="30"/>
<obj type="heavyball" x="292" y="76" rot="0"/>
<obj type="pin" x="546" y="410" rot="0"/>
<obj type="plank50" x="487" y="484" rot="-106"/>
<obj type="plank50" x="527" y="483" rot="-73"/>
<obj type="plank100" x="540" y="130" rot="-150"/>
<obj type="plank100" x="611" y="148" rot="-200"/>
<obj type="plank100" x="527" y="239" rot="-140"/>
<obj type="ballstart" x="515" y="42" rot="0"/>
<obj type="domino" x="345" y="318" rot="0"/>
<obj type="plank100" x="141" y="138" rot="-10"/>
<obj type="plank100" x="241" y="121" rot="-10"/>
<obj type="cross" x="157" y="49" rot="0"/>
<obj type="hinge" x="592" y="250" rot="120"/>
<obj type="pin" x="623" y="317" rot="0"/>
<obj type="hopper" x="507" y="488" rot="0"/>
<obj type="gem" x="582" y="186" rot="0"/>
</level>
<level name="Timing" category="1" frequency="3" max="3" quota="5" time="60" balltypes="1,2,3">
<obj type="plank50_smooth" x="94" y="170" rot="60"/>
<obj type="plank50_smooth" x="119" y="215" rot="50"/>
<obj type="plank50_smooth" x="150" y="255" rot="40"/>
<obj type="plank50_smooth" x="188" y="288" rot="30"/>
<obj type="plank50_smooth" x="232" y="315" rot="20"/>
<obj type="plank50_smooth" x="279" y="334" rot="10"/>
<obj type="plank50_smooth" x="329" y="344" rot="0"/>
<obj type="plank50_smooth" x="380" y="345" rot="-10"/>
<obj type="plank50_smooth" x="430" y="337" rot="-30"/>
<obj type="plank50_smooth" x="78" y="123" rot="70"/>
<obj type="plank50_smooth" x="69" y="74" rot="80"/>
<obj type="ballstart" x="95" y="53" rot="0"/>
<obj type="mover50" x="249" y="266" rot="20"/>
<obj type="mover50" x="295" y="283" rot="10"/>
<obj type="mover50" x="338" y="289" rot="0"/>
<obj type="hinge" x="486" y="308" rot="-90"/>
<obj type="plank100" x="549" y="325" rot="-20"/>
<obj type="plank100" x="623" y="294" rot="-70"/>
<obj type="plank100" x="638" y="144" rot="-100"/>
<obj type="hopper" x="521" y="166" rot="-180"/>
<obj type="plank50_smooth" x="547" y="165" rot="70"/>
<obj type="plank50_smooth" x="501" y="169" rot="80"/>
<obj type="mover50" x="518" y="231" rot="-110"/>
<obj type="mover50" x="528" y="258" rot="-110"/>
<obj type="mover50" x="512" y="210" rot="-110"/>
<obj type="plank100" x="463" y="96" rot="10"/>
<obj type="plank100" x="363" y="79" rot="10"/>
<obj type="plank100" x="261" y="79" rot="0"/>
<obj type="mediumball" x="341" y="46" rot="0"/>
<obj type="domino" x="267" y="71" rot="0"/>
<obj type="plunger100r" x="253" y="47" rot="40"/>
<obj type="cog8" x="147" y="189" rot="0"/>
<obj type="guard_100x100" x="486" y="250" rot="0"/>
<obj type="guard_100x100" x="588" y="250" rot="0"/>
<obj type="guard_100x100" x="485" y="352" rot="0"/>
<obj type="guard_100x100" x="587" y="352" rot="0"/>
<obj type="gem" x="439" y="303" rot="0"/>
</level>
<!-- TRICKY levels (category 2) -->
<level name="Wheel Of Fortune" category="2" frequency="2" max="4" quota="8" time="60" balltypes="1,3">
<obj type="plank50_smooth" x="575" y="408" rot="-180"/>
<obj type="plank50_smooth" x="525" y="408" rot="-180"/>
<obj type="plank50_smooth" x="475" y="407" rot="-154"/>
<obj type="plank50_smooth" x="410" y="402" rot="-128"/>
<obj type="plank50_smooth" x="380" y="363" rot="-140"/>
<obj type="plank50_smooth" x="341" y="330" rot="-130"/>
<obj type="plank50_smooth" x="309" y="290" rot="-120"/>
<obj type="plank50_smooth" x="353" y="263" rot="-120"/>
<obj type="plank50_smooth" x="385" y="300" rot="-130"/>
<obj type="hexcog" x="508" y="344" rot="0"/>
<obj type="plank50_smooth" x="576" y="408" rot="-2"/>
<obj type="ballstart" x="604" y="340" rot="0"/>
<obj type="mover50" x="368" y="353" rot="-130"/>
<obj type="mover50" x="336" y="319" rot="-130"/>
<obj type="mover50" x="303" y="280" rot="-110"/>
<obj type="plank50_smooth" x="624" y="407" rot="0"/>
<obj type="mover50" x="632" y="403" rot="-180"/>
<obj type="plank50_smooth" x="283" y="246" rot="-100"/>
<obj type="plank50_smooth" x="274" y="196" rot="-70"/>
<obj type="plank50_smooth" x="293" y="150" rot="-20"/>
<obj type="plank50_smooth" x="330" y="222" rot="-70"/>
<obj type="plank50_smooth" x="348" y="179" rot="0"/>
<obj type="plank50_smooth" x="393" y="180" rot="30"/>
<obj type="plank50_smooth" x="339" y="132" rot="0"/>
<obj type="plank50_smooth" x="389" y="132" rot="30"/>
<obj type="plank50_smooth" x="435" y="208" rot="40"/>
<obj type="plank50_smooth" x="471" y="244" rot="10"/>
<obj type="plank50_smooth" x="520" y="253" rot="-20"/>
<obj type="plank50_smooth" x="565" y="235" rot="-40"/>
<obj type="plank50_smooth" x="602" y="202" rot="-80"/>
<obj type="plank50_smooth" x="609" y="151" rot="-100"/>
<obj type="plank50_smooth" x="597" y="99" rot="-130"/>
<obj type="plank50_smooth" x="561" y="60" rot="-150"/>
<obj type="plank50_smooth" x="472" y="185" rot="-140"/>
<obj type="plank50_smooth" x="514" y="209" rot="-150"/>
<obj type="plank50_smooth" x="558" y="188" rot="-200"/>
<obj type="plank50_smooth" x="563" y="141" rot="-260"/>
<obj type="plank50_smooth" x="535" y="103" rot="-300"/>
<obj type="plank50_smooth" x="498" y="75" rot="-320"/>
<obj type="plank50_smooth" x="450" y="78" rot="-360"/>
<obj type="plank50_smooth" x="472" y="36" rot="-360"/>
<obj type="plank50_smooth" x="420" y="35" rot="-360"/>
<obj type="plank50_smooth" x="402" y="80" rot="-360"/>
<obj type="mover50" x="279" y="222" rot="-80"/>
<obj type="mover50" x="299" y="151" rot="-30"/>
<obj type="mover50" x="368" y="126" rot="20"/>
<obj type="mover50" x="427" y="149" rot="40"/>
<obj type="mover50" x="522" y="203" rot="-30"/>
<obj type="mover50" x="550" y="189" rot="-70"/>
<obj type="mover50" x="560" y="161" rot="-100"/>
<obj type="mover50" x="546" y="119" rot="-130"/>
<obj type="mover50" x="529" y="89" rot="-170"/>
<obj type="plank50_smooth" x="352" y="80" rot="0"/>
<obj type="plank50_smooth" x="299" y="80" rot="0"/>
<obj type="plank50_smooth" x="246" y="80" rot="0"/>
<obj type="plank50_smooth" x="196" y="80" rot="0"/>
<obj type="plank50_smooth" x="146" y="79" rot="0"/>
<obj type="hexcog" x="108" y="136" rot="0"/>
<obj type="hexcog" x="107" y="230" rot="-30"/>
<obj type="hexcog" x="108" y="330" rot="0"/>
<obj type="hexcog" x="110" y="429" rot="-30"/>
<obj type="plank50_smooth" x="64" y="85" rot="-90"/>
<obj type="plank50_smooth" x="65" y="35" rot="-20"/>
<obj type="plank50_smooth" x="146" y="181" rot="20"/>
<obj type="plank50_smooth" x="193" y="199" rot="56"/>
<obj type="plank50_smooth" x="278" y="245" rot="100"/>
<obj type="plank50_smooth" x="225" y="241" rot="80"/>
<obj type="guard_100x100" x="108" y="376" rot="0"/>
<obj type="guard_100x100" x="8" y="375" rot="0"/>
<obj type="guard_100x100" x="6" y="276" rot="0"/>
<obj type="guard_100x100" x="109" y="278" rot="0"/>
<obj type="hopper1" x="14" y="184" rot="20"/>
<obj type="plank50_smooth" x="6" y="161" rot="-90"/>
<obj type="plank50_smooth" x="10" y="107" rot="-30"/>
<obj type="hopper3" x="251" y="299" rot="0"/>
<obj type="plank50_smooth" x="29" y="203" rot="-30"/>
<obj type="guard_100x100" x="7" y="176" rot="0"/>
<obj type="guard_100x100" x="109" y="176" rot="0"/>
<obj type="guard_100x100" x="109" y="74" rot="0"/>
<obj type="guard_100x100" x="6" y="74" rot="0"/>
<obj type="gem" x="232" y="221" rot="0"/>
</level>
<level name="Triple Tipple" category="2" frequency="4" max="5" quota="10" time="60" balltypes="1,2,3">
<obj type="ballstart" x="156" y="56" rot="0"/>
<obj type="plank100" x="262" y="161" rot="20"/>
<obj type="plank100" x="395" y="237" rot="20"/>
<obj type="plank100" x="175" y="110" rot="30"/>
<obj type="piston2" x="336" y="260" rot="53"/>
<obj type="plank100" x="268" y="350" rot="-20"/>
<obj type="plank100" x="133" y="429" rot="-30"/>
<obj type="plank100" x="253" y="474" rot="-110"/>
<obj type="piston2" x="294" y="428" rot="-30"/>
<obj type="hopper1" x="120" y="420" rot="46"/>
<obj type="hopper2" x="275" y="474" rot="0"/>
<obj type="hopper3" x="507" y="262" rot="-33"/>
<obj type="plank100" x="83" y="75" rot="20"/>
<obj type="plank50" x="389" y="287" rot="-80"/>
<obj type="plank50" x="358" y="321" rot="-50"/>
<obj type="hanger01" x="535" y="354" rot="170"/>
<obj type="hanger01" x="549" y="494" rot="180"/>
<obj type="hanger01" x="324" y="552" rot="140"/>
<obj type="hanger01" x="41" y="485" rot="230"/>
<obj type="hanger01" x="56" y="546" rot="170"/>
<obj type="gem" x="453" y="216" rot="0"/>
</level>
<level name="What" category="2" frequency="1" max="8" quota="4" time="60" balltypes="1,2,3">
<obj type="domino" x="233" y="303" rot="0"/>
<obj type="plank100" x="84" y="310" rot="0"/>
<obj type="mediumball" x="290" y="277" rot="0"/>
<obj type="mediumball" x="374" y="277" rot="0"/>
<obj type="heavyball" x="326" y="96" rot="0"/>
<obj type="plank50" x="192" y="310" rot="0"/>
<obj type="plank50" x="360" y="310" rot="0"/>
<obj type="plank50" x="248" y="309" rot="0"/>
<obj type="plank50" x="136" y="272" rot="0"/>
<obj type="domino" x="165" y="264" rot="0"/>
<obj type="plank100" x="4" y="277" rot="70"/>
<obj type="plank100" x="37" y="371" rot="60"/>
<obj type="plank100" x="84" y="313" rot="60"/>
<obj type="seesaw20" x="151" y="452" rot="0"/>
<obj type="domino" x="186" y="445" rot="0"/>
<obj type="pin" x="209" y="412" rot="0"/>
<obj type="seesaw20" x="232" y="341" rot="0"/>
<obj type="heavyball" x="70" y="210" rot="0"/>
<obj type="plank50_smooth" x="62" y="242" rot="0"/>
<obj type="domino" x="270" y="446" rot="0"/>
<obj type="pin" x="250" y="381" rot="0"/>
<obj type="pin" x="291" y="382" rot="0"/>
<obj type="pin" x="291" y="435" rot="0"/>
<obj type="pin" x="249" y="434" rot="0"/>
<obj type="seesaw20" x="310" y="454" rot="0"/>
<obj type="plank50_smooth" x="360" y="497" rot="-40"/>
<obj type="bouncer2" x="408" y="526" rot="1"/>
<obj type="bouncer2" x="560" y="501" rot="-4"/>
<obj type="hinge90" x="551" y="245" rot="-90"/>
<obj type="pin" x="636" y="263" rot="0"/>
<obj type="ballstart" x="592" y="56" rot="0"/>
<obj type="plank50_smooth" x="512" y="71" rot="10"/>
<obj type="plank50_smooth" x="463" y="65" rot="10"/>
<obj type="plank50_smooth" x="442" y="157" rot="31"/>
<obj type="plank50_smooth" x="142" y="50" rot="0"/>
<obj type="plank50_smooth" x="89" y="60" rot="-10"/>
<obj type="plank50_smooth" x="40" y="82" rot="-26"/>
<obj type="plank50_smooth" x="46" y="124" rot="10"/>
<obj type="plank50_smooth" x="95" y="136" rot="10"/>
<obj type="plank50_smooth" x="147" y="147" rot="10"/>
<obj type="hopper" x="46" y="106" rot="90"/>
<obj type="plank50_smooth" x="194" y="50" rot="0"/>
<obj type="plank50_smooth" x="246" y="51" rot="0"/>
<obj type="plank50_smooth" x="296" y="51" rot="0"/>
<obj type="plank50_smooth" x="347" y="50" rot="0"/>
<obj type="plank50_smooth" x="396" y="52" rot="10"/>
<obj type="plank50_smooth" x="394" y="157" rot="0"/>
<obj type="plank50_smooth" x="354" y="157" rot="0"/>
<obj type="plank50_smooth" x="246" y="153" rot="0"/>
<obj type="plank50_smooth" x="196" y="154" rot="0"/>
<obj type="plank50_smooth" x="609" y="94" rot="-160"/>
<obj type="plank50_smooth" x="639" y="86" rot="-260"/>
<obj type="mover50" x="518" y="168" rot="-170"/>
<obj type="mover50" x="473" y="119" rot="-170"/>
<obj type="mover50" x="418" y="152" rot="-180"/>
<obj type="mover50" x="283" y="105" rot="-180"/>
<obj type="mover50" x="282" y="152" rot="-180"/>
<obj type="mover50" x="224" y="152" rot="-170"/>
<obj type="mover50" x="231" y="102" rot="-180"/>
<obj type="mover50" x="177" y="123" rot="-180"/>
<obj type="mover50" x="135" y="125" rot="-180"/>
<obj type="mover50" x="96" y="127" rot="-180"/>
<obj type="mover50" x="466" y="158" rot="-170"/>
<obj type="mover50" x="516" y="128" rot="-170"/>
<obj type="mover50" x="416" y="112" rot="-170"/>
<obj type="pin_disappear" x="326" y="177" rot="0"/>
<obj type="pin_disappear_broken" x="308" y="127" rot="0"/>
<obj type="pin_disappear_broken" x="344" y="128" rot="0"/>
<obj type="pin_disappear_broken" x="583" y="553" rot="0"/>
<obj type="pin" x="489" y="203" rot="0"/>
<obj type="plank50" x="403" y="308" rot="60"/>
<obj type="pin" x="166" y="411" rot="0"/>
<obj type="pin_disappear_broken" x="306" y="202" rot="0"/>
<obj type="pin_disappear_broken" x="349" y="216" rot="0"/>
<obj type="pin_disappear_broken" x="323" y="229" rot="0"/>
<obj type="gem" x="626" y="163" rot="0"/>
</level>
<level name="Spinning Around" category="2" frequency="4" max="10" quota="7" time="60" balltypes="1,2,3">
<obj type="ballstart" x="45" y="69" rot="0"/>
<obj type="plank100" x="8" y="372" rot="70"/>
<obj type="plank100" x="41" y="462" rot="40"/>
<obj type="plank100" x="112" y="525" rot="10"/>
<obj type="plank100" x="203" y="545" rot="-20"/>
<obj type="plank100" x="292" y="516" rot="-50"/>
<obj type="mover50" x="65" y="365" rot="70"/>
<obj type="mover50" x="93" y="435" rot="40"/>
<obj type="mover50" x="218" y="479" rot="-20"/>
<obj type="mover50" x="252" y="468" rot="-50"/>
<obj type="plank50" x="468" y="345" rot="0"/>
<obj type="plank50" x="519" y="346" rot="-30"/>
<obj type="plank50" x="561" y="321" rot="-60"/>
<obj type="plank50" x="584" y="286" rot="-89"/>
<obj type="plank50" x="588" y="238" rot="-140"/>
<obj type="plank50" x="338" y="236" rot="-180"/>
<obj type="plank50" x="287" y="237" rot="-150"/>
<obj type="plank50" x="247" y="211" rot="-120"/>
<obj type="plank50" x="223" y="172" rot="-90"/>
<obj type="plank50" x="221" y="128" rot="-60"/>
<obj type="plank50" x="240" y="92" rot="-40"/>
<obj type="plank50" x="276" y="64" rot="-10"/>
<obj type="plank50" x="321" y="56" rot="0"/>
<obj type="plank50" x="461" y="129" rot="0"/>
<obj type="hopper" x="536" y="127" rot="0"/>
<obj type="mover50" x="463" y="290" rot="0"/>
<obj type="mover50" x="499" y="295" rot="-50"/>
<obj type="mover50" x="533" y="270" rot="-100"/>
<obj type="mover50" x="520" y="251" rot="-170"/>
<obj type="mover50" x="337" y="233" rot="-170"/>
<obj type="mover50" x="262" y="209" rot="-130"/>
<obj type="mover50" x="235" y="132" rot="-70"/>
<obj type="mover50" x="293" y="65" rot="0"/>
<obj type="mover50" x="284" y="429" rot="-50"/>
<obj type="cross" x="403" y="377" rot="0"/>
<obj type="bridge" x="344" y="233" rot="0"/>
<obj type="conveyor100" x="360" y="122" rot="0"/>
<obj type="mover50" x="374" y="258" rot="0"/>
<obj type="mover50" x="326" y="259" rot="0"/>
<obj type="gem" x="485" y="270" rot="0"/>
</level>
<level name="Machinery" category="2" frequency="2" max="20" quota="10" time="60" balltypes="1,2">
<obj type="seesaw" x="288" y="293" rot="0"/>
<obj type="plank50_smooth" x="305" y="333" rot="-32"/>
<obj type="mediumball" x="329" y="259" rot="0"/>
<obj type="plank50_smooth" x="284" y="233" rot="96"/>
<obj type="plank50_smooth" x="237" y="243" rot="83"/>
<obj type="plank50_smooth" x="293" y="184" rot="100"/>
<obj type="plank50_smooth" x="237" y="210" rot="87"/>
<obj type="plank50" x="383" y="374" rot="92"/>
<obj type="plank50" x="376" y="423" rot="180"/>
<obj type="plank50" x="318" y="383" rot="175"/>
<obj type="plank50" x="322" y="378" rot="91"/>
<obj type="spikes" x="317" y="414" rot="0"/>
<obj type="plank50_smooth" x="381" y="374" rot="30"/>
<obj type="plank50_smooth" x="420" y="396" rot="10"/>
<obj type="plank50_smooth" x="462" y="404" rot="-10"/>
<obj type="plank50_smooth" x="507" y="398" rot="-40"/>
<obj type="plank50_smooth" x="544" y="369" rot="-60"/>
<obj type="plank50_smooth" x="567" y="331" rot="-80"/>
<obj type="plank50_smooth" x="574" y="285" rot="-80"/>
<obj type="plank50_smooth" x="581" y="241" rot="-83"/>
<obj type="ballstart_no_random_offsets" x="556" y="56" rot="0"/>
<obj type="plank50_smooth" x="401" y="351" rot="-40"/>
<obj type="plank100" x="388" y="197" rot="13"/>
<obj type="plank100" x="289" y="179" rot="11"/>
<obj type="hinge" x="479" y="223" rot="-30"/>
<obj type="pin" x="539" y="229" rot="0"/>
<obj type="mover50" x="477" y="213" rot="-164"/>
<obj type="mover50" x="434" y="203" rot="-166"/>
<obj type="hopper1" x="243" y="398" rot="0"/>
<obj type="hopper2" x="87" y="396" rot="0"/>
<obj type="hinge" x="223" y="216" rot="-178"/>
<obj type="pin" x="145" y="233" rot="0"/>
<obj type="plank100" x="123" y="348" rot="-80"/>
<obj type="plank100" x="56" y="346" rot="-92"/>
<obj type="plank100" x="54" y="246" rot="-90"/>
<obj type="plank50" x="221" y="351" rot="90"/>
<obj type="plank50" x="123" y="348" rot="110"/>
<obj type="plank50" x="57" y="346" rot="80"/>
<obj type="pin" x="234" y="115" rot="0"/>
<obj type="mover50" x="365" y="187" rot="-170"/>
<obj type="plank100" x="254" y="119" rot="0"/>
<obj type="pin" x="459" y="128" rot="0"/>
<obj type="plank50_smooth" x="210" y="358" rot="-20"/>
<obj type="plank50_smooth" x="597" y="141" rot="100"/>
<obj type="plank50_smooth" x="606" y="93" rot="100"/>
<obj type="gem" x="234" y="134" rot="0"/>
<obj type="plank50" x="53" y="147" rot="-60"/>
<obj type="plank50" x="76" y="104" rot="-40"/>
<obj type="plank50" x="114" y="74" rot="-30"/>
<obj type="plank50" x="157" y="48" rot="-10"/>
<obj type="plank50" x="204" y="39" rot="0"/>
<obj type="plank50" x="254" y="39" rot="-20"/>
<obj type="plank50" x="301" y="22" rot="0"/>
<obj type="plank50" x="349" y="21" rot="20"/>
<obj type="plank50" x="395" y="37" rot="30"/>
<obj type="plank50" x="439" y="62" rot="30"/>
<obj type="plank50" x="482" y="86" rot="20"/>
<obj type="plank50" x="529" y="104" rot="10"/>
<obj type="guard_100x100" x="264" y="273" rot="0"/>
<obj type="guard_100x100" x="162" y="273" rot="0"/>
<obj type="guard_100x100" x="162" y="374" rot="0"/>
<obj type="guard_100x100" x="263" y="374" rot="0"/>
</level>
<level name="The Ball Of Death" category="2" frequency="2" max="5" quota="5" time="60" balltypes="1,2,3">
<obj type="plank100" x="471" y="209" rot="0"/>
<obj type="plank100" x="372" y="208" rot="0"/>
<obj type="plank100" x="276" y="225" rot="-10"/>
<obj type="plank100" x="179" y="242" rot="-10"/>
<obj type="domino" x="152" y="234" rot="0"/>
<obj type="heavyball" x="455" y="177" rot="0"/>
<obj type="bouncer2" x="64" y="497" rot="30"/>
<obj type="ballstart" x="357" y="48" rot="0"/>
<obj type="hammer" x="475" y="66" rot="0"/>
<obj type="hopper" x="423" y="421" rot="0"/>
<obj type="pin_disappear" x="583" y="91" rot="0"/>
<obj type="plank100" x="311" y="113" rot="-10"/>
<obj type="piston2" x="296" y="108" rot="-20"/>
<obj type="plank50" x="141" y="241" rot="0"/>
<obj type="plank100" x="33" y="538" rot="0"/>
<obj type="plank50" x="571" y="254" rot="-90"/>
<obj type="plank50" x="571" y="293" rot="-90"/>
<obj type="plank100" x="574" y="288" rot="128"/>
<obj type="plank100" x="216" y="237" rot="120"/>
<obj type="plank50" x="165" y="317" rot="83"/>
<obj type="chain" x="514" y="363" rot="0"/>
<obj type="gem" x="278" y="332" rot="0"/>
</level>
<level name="Bouncy Bouncy" category="2" frequency="2" max="5" quota="5" time="60" balltypes="1,2,3">
<obj type="bouncer" x="63" y="407" rot="20"/>
<obj type="bouncer" x="223" y="383" rot="0"/>
<obj type="bouncer" x="296" y="449" rot="17"/>
<obj type="ballstart_no_random_offsets" x="88" y="91" rot="0"/>
<obj type="bouncer2" x="399" y="475" rot="0"/>
<obj type="bouncer2" x="488" y="473" rot="4"/>
<obj type="bouncer2" x="562" y="367" rot="-10"/>
<obj type="bouncer2" x="436" y="294" rot="-10"/>
<obj type="bouncer" x="277" y="256" rot="-12"/>
<obj type="bouncer2" x="153" y="275" rot="-4"/>
<obj type="hopper" x="173" y="156" rot="179"/>
<obj type="piston2" x="161" y="328" rot="-38"/>
<obj type="piston2" x="377" y="406" rot="0"/>
<obj type="piston2" x="386" y="86" rot="0"/>
<obj type="gem" x="380" y="488" rot="0"/>
</level>
<level name="Hammered" category="2" frequency="9" max="1" quota="1" time="30" balltypes="1,2,3">
<obj type="plank100" x="59" y="531" rot="0"/>
<obj type="plank100" x="156" y="531" rot="-10"/>
<obj type="plank100" x="253" y="513" rot="-30"/>
<obj type="plank100" x="338" y="465" rot="-50"/>
<obj type="plank100" x="0" y="531" rot="0"/>
<obj type="hammer" x="94" y="392" rot="260"/>
<obj type="pin_disappear" x="75" y="365" rot="0"/>
<obj type="mover50" x="224" y="467" rot="-30"/>
<obj type="mover50" x="264" y="442" rot="-30"/>
<obj type="mover50" x="300" y="418" rot="-40"/>
<obj type="bridge" x="504" y="324" rot="0"/>
<obj type="plank100" x="358" y="170" rot="30"/>
<obj type="plank100" x="261" y="153" rot="10"/>
<obj type="plank100" x="163" y="137" rot="10"/>
<obj type="hopper" x="79" y="152" rot="7"/>
<obj type="mover50" x="435" y="208" rot="210"/>
<obj type="mover50" x="567" y="245" rot="230"/>
<obj type="mover50" x="348" y="166" rot="190"/>
<obj type="mover50" x="246" y="147" rot="190"/>
<obj type="plank50" x="400" y="392" rot="-50"/>
<obj type="gem" x="542" y="253" rot="0"/>
<obj type="mover50" x="537" y="211" rot="-140"/>
<obj type="ballstart_no_random_offsets" x="129" y="423" rot="0"/>
<obj type="bouncer2" x="595" y="298" rot="-30"/>
<obj type="plank50" x="636" y="212" rot="90"/>
</level>
<level name="Evil Foursome" category="2" frequency="3" max="8" quota="16" time="66" balltypes="1,2,3">
<obj type="plank100" x="306" y="0" rot="90"/>
<obj type="plank100" x="306" y="98" rot="90"/>
<obj type="plank100" x="306" y="197" rot="90"/>
<obj type="plank100" x="306" y="297" rot="90"/>
<obj type="plank100" x="306" y="396" rot="90"/>
<obj type="plank100" x="306" y="496" rot="90"/>
<obj type="plank100" x="312" y="294" rot="0"/>
<obj type="plank100" x="413" y="294" rot="0"/>
<obj type="plank100" x="514" y="294" rot="0"/>
<obj type="plank100" x="614" y="293" rot="0"/>
<obj type="plank100" x="199" y="293" rot="0"/>
<obj type="plank100" x="98" y="293" rot="0"/>
<obj type="plank100" x="-2" y="293" rot="0"/>
<obj type="ballstart" x="50" y="53" rot="0"/>
<obj type="ballstart" x="505" y="54" rot="0"/>
<obj type="ballstart" x="508" y="349" rot="0"/>
<obj type="ballstart" x="134" y="345" rot="0"/>
<obj type="plank100" x="15" y="105" rot="20"/>
<obj type="piston2" x="122" y="197" rot="0"/>
<obj type="plank50" x="137" y="156" rot="20"/>
<obj type="plank50" x="184" y="174" rot="20"/>
<obj type="hopper" x="249" y="204" rot="0"/>
<obj type="plank50" x="287" y="155" rot="110"/>
<obj type="spikes" x="7" y="258" rot="0"/>
<obj type="spikes" x="79" y="258" rot="0"/>
<obj type="spikes" x="152" y="257" rot="0"/>
<obj type="spikes" x="228" y="255" rot="0"/>
<obj type="hexcog" x="503" y="154" rot="0"/>
<obj type="hopper" x="570" y="240" rot="0"/>
<obj type="spikes" x="596" y="261" rot="0"/>
<obj type="spikes" x="476" y="259" rot="0"/>
<obj type="spikes" x="402" y="257" rot="0"/>
<obj type="spikes" x="325" y="256" rot="0"/>
<obj type="plank50" x="618" y="193" rot="120"/>
<obj type="plank50" x="618" y="144" rot="90"/>
<obj type="hopper" x="46" y="513" rot="0"/>
<obj type="plank50" x="26" y="509" rot="-110"/>
<obj type="plank50" x="9" y="462" rot="-80"/>
<obj type="plank50" x="69" y="516" rot="-60"/>
<obj type="hinge" x="465" y="438" rot="0"/>
<obj type="hopper" x="602" y="512" rot="0"/>
<obj type="gem" x="125" y="53" rot="0"/>
<obj type="seesaw" x="145" y="457" rot="0"/>
<obj type="plank50" x="623" y="513" rot="-80"/>
<obj type="plank50" x="632" y="466" rot="-90"/>
</level>
<level name="Crossed Wires" category="2" frequency="1" max="4" quota="10" time="60" balltypes="1,2,3">
<obj type="plank100" x="429" y="210" rot="-20"/>
<obj type="plank100" x="352" y="254" rot="-20"/>
<obj type="plank100" x="267" y="282" rot="-10"/>
<obj type="ballstart" x="505" y="93" rot="0"/>
<obj type="plunger100" x="253" y="284" rot="0"/>
<obj type="plunger100" x="229" y="284" rot="0"/>
<obj type="plunger100" x="204" y="285" rot="0"/>
<obj type="plunger100" x="180" y="285" rot="0"/>
<obj type="plank100" x="94" y="367" rot="-44"/>
<obj type="plank100" x="55" y="367" rot="-110"/>
<obj type="hopper" x="76" y="366" rot="0"/>
<obj type="plunger100" x="205" y="401" rot="30"/>
<obj type="plunger100" x="257" y="400" rot="20"/>
<obj type="plunger100" x="229" y="404" rot="-20"/>
<obj type="plunger100" x="177" y="402" rot="0"/>
<obj type="guard_100x100" x="103" y="359" rot="0"/>
<obj type="guard_100x100" x="202" y="359" rot="0"/>
<obj type="guard_100x100" x="204" y="259" rot="0"/>
<obj type="guard_100x100" x="104" y="259" rot="0"/>
<obj type="gem" x="209" y="249" rot="0"/>
</level>
<level name="A Bridge Too Near" category="2" frequency="2" max="6" quota="5" time="60" balltypes="1,2,3">
<obj type="movable_platform" x="266" y="163" rot="0"/>
<obj type="ballstart" x="54" y="72" rot="0"/>
<obj type="plank100" x="19" y="104" rot="70"/>
<obj type="plank100" x="21" y="195" rot="20"/>
<obj type="plank100" x="82" y="233" rot="10"/>
<obj type="plank100" x="306" y="338" rot="14"/>
<obj type="plank100" x="406" y="359" rot="76"/>
<obj type="plank100" x="481" y="166" rot="90"/>
<obj type="plank100" x="483" y="268" rot="90"/>
<obj type="plank100" x="483" y="356" rot="97"/>
<obj type="hopper" x="448" y="452" rot="0"/>
<obj type="piston2" x="124" y="208" rot="0"/>
<obj type="gem" x="366" y="248" rot="0"/>
</level>
<level name="Multi Colored Pot Shop" category="2" frequency="1" max="5" quota="10" time="30" balltypes="1,2,3">
<obj type="ballstart" x="309" y="55" rot="0"/>
<obj type="pin" x="307" y="125" rot="0"/>
<obj type="pin" x="263" y="143" rot="0"/>
<obj type="pin" x="354" y="148" rot="0"/>
<obj type="pin" x="307" y="172" rot="0"/>
<obj type="pin" x="389" y="185" rot="0"/>
<obj type="pin" x="243" y="194" rot="0"/>
<obj type="pin" x="311" y="217" rot="0"/>
<obj type="hopper1" x="312" y="467" rot="0"/>
<obj type="hopper2" x="153" y="466" rot="0"/>
<obj type="hopper3" x="477" y="465" rot="0"/>
<obj type="plank50" x="100" y="430" rot="50"/>
<obj type="plank50" x="70" y="394" rot="50"/>
<obj type="plank50" x="262" y="430" rot="50"/>
<obj type="plank50" x="234" y="395" rot="50"/>
<obj type="plank50" x="423" y="435" rot="50"/>
<obj type="plank50" x="392" y="399" rot="50"/>
<obj type="plank50" x="360" y="435" rot="130"/>
<obj type="plank50" x="394" y="402" rot="130"/>
<obj type="plank50" x="235" y="399" rot="130"/>
<obj type="plank50" x="204" y="433" rot="130"/>
<obj type="plank50" x="529" y="429" rot="130"/>
<obj type="plank50" x="557" y="397" rot="130"/>
<obj type="plank50" x="581" y="357" rot="120"/>
<obj type="plank50" x="53" y="347" rot="70"/>
<obj type="seesaw" x="311" y="279" rot="0"/>
<obj type="seesaw" x="309" y="351" rot="0"/>
<obj type="seesaw" x="205" y="314" rot="0"/>
<obj type="seesaw" x="157" y="253" rot="0"/>
<obj type="seesaw" x="440" y="247" rot="0"/>
<obj type="seesaw" x="433" y="318" rot="0"/>
<obj type="gem" x="503" y="375" rot="0"/>
</level>
<level name="Clock Stupid" category="2" frequency="0.5" max="10" quota="20" time="45" balltypes="1,2,3">
<obj type="ballstart" x="215" y="52" rot="0"/>
<obj type="hopper" x="461" y="488" rot="0"/>
<obj type="domino" x="428" y="476" rot="0"/>
<obj type="cross_rot_ccw" x="219" y="220" rot="0"/>
<obj type="cross_rot_ccw" x="221" y="373" rot="0"/>
<obj type="cross_rot_ccw" x="325" y="216" rot="0"/>
<obj type="hinge" x="429" y="351" rot="0"/>
<obj type="pin" x="514" y="375" rot="0"/>
<obj type="conveyor100" x="63" y="217" rot="0"/>
<obj type="conveyor100" x="478" y="219" rot="180"/>
<obj type="plank50" x="118" y="363" rot="10"/>
<obj type="plank50" x="115" y="149" rot="10"/>
<obj type="spikes" x="76" y="89" rot="60"/>
<obj type="spikes" x="62" y="331" rot="30"/>
<obj type="plank100" x="35" y="349" rot="30"/>
<obj type="plank100" x="41" y="94" rot="60"/>
<obj type="bridge" x="208" y="430" rot="20"/>
<obj type="plank50" x="393" y="483" rot="0"/>
<obj type="conveyor100" x="303" y="460" rot="10"/>
<obj type="gem" x="322" y="336" rot="0"/>
</level>
<level name="Quick Or slow, Cha Cha Cha" category="2" frequency="2" max="10" quota="10" time="50" balltypes="1,2,3">
<obj type="ballstart" x="61" y="57" rot="0"/>
<obj type="hopper" x="277" y="420" rot="0"/>
<obj type="plank100" x="410" y="429" rot="50"/>
<obj type="piston" x="494" y="503" rot="-40"/>
<obj type="conveyor100" x="406" y="429" rot="180"/>
<obj type="bridge" x="187" y="295" rot="0"/>
<obj type="plank50" x="323" y="293" rot="-167"/>
<obj type="bridge" x="16" y="225" rot="10"/>
<obj type="plank100" x="11" y="120" rot="81"/>
<obj type="cog8" x="73" y="356" rot="0"/>
<obj type="cog8" x="113" y="381" rot="0"/>
<obj type="bouncer" x="141" y="443" rot="-340"/>
<obj type="pin" x="138" y="273" rot="0"/>
<obj type="pin" x="508" y="434" rot="0"/>
<obj type="plank100" x="325" y="294" rot="40"/>
<obj type="plank100" x="572" y="467" rot="140"/>
<obj type="plank100" x="76" y="485" rot="0"/>
<obj type="spikes" x="198" y="463" rot="0"/>
<obj type="plank100" x="178" y="494" rot="0"/>
<obj type="gem" x="231" y="220" rot="0"/>
</level>
<level name="Sweet Chariot" category="2" frequency="0.5" max="15" quota="5" time="30" balltypes="1,2,3">
<obj type="movable_platform" x="210" y="129" rot="31"/>
<obj type="bridge" x="59" y="250" rot="0"/>
<obj type="ballstart" x="84" y="87" rot="0"/>
<obj type="pin_disappear_broken" x="235" y="134" rot="0"/>
<obj type="plank100" x="316" y="379" rot="20"/>
<obj type="plank100" x="410" y="414" rot="20"/>
<obj type="plank100" x="445" y="354" rot="40"/>
<obj type="plank100" x="431" y="258" rot="80"/>
<obj type="hopper" x="513" y="433" rot="-50"/>
<obj type="heavyball" x="373" y="81" rot="0"/>
<obj type="plank50_smooth" x="339" y="91" rot="50"/>
<obj type="plank50_smooth" x="371" y="130" rot="40"/>
<obj type="plank50_smooth" x="409" y="163" rot="20"/>
<obj type="plank50_smooth" x="457" y="180" rot="10"/>
<obj type="plank50_smooth" x="507" y="189" rot="-10"/>
<obj type="plank50_smooth" x="557" y="179" rot="-30"/>
<obj type="plank50_smooth" x="600" y="152" rot="-50"/>
<obj type="plank50_smooth" x="632" y="113" rot="-70"/>
<obj type="plank50" x="304" y="330" rot="75"/>
<obj type="gem" x="121" y="143" rot="0"/>
</level>
<collision>
<pair a="ball" b="spikes" func="Collision_BallVsSpikes"/>
<pair a="ball" b="hopper" func="Collision_BallVsSpikes"/>
</collision>
<physobj name="pellet">
<body name="pellet" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="11" pos="0,0" rot="0" shadow="false"/>
<shape type="circle" pos="0,0" name="" col="4,1" radius="1" density="10" friction="1" restitution="0"/>
</body>
</physobj>
<physobj name="ball">
<body name="ball" pos="0,0" fixed="false" sensor="false" angulardamping="0.5" lineardamping="0.5">
<graphic clip="BlockBits" frame="10" pos="0,0" rot="0" zoffset="-100" gameobjfunction="InitObj_Ball"/>
<shape type="circle" pos="0,0" name="" col="2,3" radius="7" density="0.1" friction="1" restitution="0.5"/>
</body>
</physobj>
<physobj name="movable_platform">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="27" pos="0,0" rot="0"/>
<shape type="poly" name="" col="0,0" vertices="-100,0, 100,0, 100,10, -100,10" density="0.1" friction="1" restitution="0"/>
</body>
<body name="plunger" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="20" pos="0,0" rot="0" zoffset="-2"/>
<shape type="poly" name="" col="1,7" vertices="-14,-14,14,-14,14,14,-14,14" density="0.5" friction="1" restitution="0"/>
</body>
<body name="platform" pos="0,0" fixed="false" sensor="false" angulardamping="0.3" lineardamping="0.3">
<graphic clip="BlockBits" frame="28" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="-50,0, 50,0, 50,10, -50,10" density="0.2" friction="1" restitution="0"/>
</body>
<joint type="prismatic" name="joint1" body0="fix" body1="plunger" pos="0,0" axisangle="90" enablelimit="true" lowertranslation="-100" uppertranslation="100" enablemotor="false" motorspeed="0" maxmotorforce="0"/>
<joint type="distance" name="joint2" body0="plunger" body1="platform" pos="0,0" pos1="-50,50" distance="100" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint3" body0="plunger" body1="platform" pos="0,0" pos1="50,50" distance="100" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<physobj name="semi_scales">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="lever" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="1" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,4" vertices="-50,-10, 50,-10, 50,10, -50,10" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="platform" pos="-50,0" fixed="false" sensor="false" angulardamping="0.01" lineardamping="0.1">
<graphic clip="BlockBits" frame="28" pos="0,0" rot="0"/>
<shape type="poly" name="" col="0,0" vertices="-50,0, 50,0, 50,10, -50,10" density="0.1" friction="1" restitution="0"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="lever" pos="0,0" enablelimit="true" lowerangle="-45" upperangle="45" enablemotor="true" motorspeed="3" maxmotortorque="10000"/>
<joint type="distance" name="joint2" body0="lever" body1="platform" pos="-50,0" pos1="-100,50" distance="50" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint3" body0="lever" body1="platform" pos="-50,0" pos1="0,50" distance="50" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<physobj name="pin">
<sound hitball="1"/>
<body name="pin" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="14" pos="0,0" rot="0"/>
<shape type="circle" pos="0,0" name="" col="1,7" radius="11" density="0.1" friction="1" restitution="0.5"/>
</body>
</physobj>
<physobj name="gem">
<sound hitball="1"/>
<body name="pin" pos="0,0" fixed="true" sensor="true">
<graphic clip="BlockBits" frame="46" pos="0,0" rot="0"/>
<shape type="circle" pos="0,0" name="" col="1,7" radius="11" density="0.1" friction="1" restitution="0.5"/>
</body>
</physobj>
<physobj name="pin_disappear">
<sound hitball="1"/>
<body name="pin" pos="0,0" fixed="true" sensor="false">
<graphic clip="DisappearingPin" frame="1" pos="0,0" rot="0" gameobjfunction="InitPinDisappear"/>
<shape type="circle" pos="0,0" name="" col="1,7" radius="7" density="0.1" friction="1" restitution="0.5"/>
</body>
</physobj>
<physobj name="pin_disappear_broken">
<sound hitball="1"/>
<body name="pin" pos="0,0" fixed="true" sensor="false">
<graphic clip="DisappearingPin" frame="1" pos="0,0" rot="0" gameobjfunction="InitPinDisappear_Broken"/>
<shape type="circle" pos="0,0" name="" col="1,7" radius="7" density="0.1" friction="1" restitution="0.5"/>
</body>
</physobj>
<physobj name="ballstart">
<body name="pin" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="22" pos="0,0" rot="0" gameobjfunction="InitBallGenerator"/>
</body>
</physobj>
<physobj name="ballstart_no_random_offsets">
<body name="pin" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="22" pos="0,0" rot="0" gameobjfunction="InitBallGenerator_NoRandomOffsets"/>
</body>
</physobj>
<physobj name="heavyball">
<sound hitball="1"/>
<body name="pin" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="17" pos="0,0" rot="0"/>
<shape type="circle" pos="0,0" name="" col="2,7" radius="25" density="1" friction="1" restitution="0"/>
</body>
</physobj>
<physobj name="mediumball">
<sound hitball="1"/>
<body name="pin" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="45" pos="0,0" rot="0"/>
<shape type="circle" pos="0,0" name="" col="2,7" radius="25" density="0.05" friction="0.1" restitution="0"/>
</body>
</physobj>
<physobj name="domino">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="18" pos="0,0" rot="0"/>
<shape type="poly" name="" col="2,7" vertices="-8,0,-8,-100,8,-100,8,0" density="0.1" friction="1" restitution="0"/>
</body>
</physobj>
<physobj name="conveyor100">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="23" pos="0,0" rot="0" gameobjfunction="InitObj_Conveyor"/>
<shape type="poly" name="" col="1,7" vertices="0,0,100,0,100,12,0,12" density="1" friction="1" restitution="0"/>
</body>
</physobj>
<physobj name="mover50">
<body name="fix" pos="0,0" fixed="true" sensor="true">
<graphic clip="BlockBits" frame="38" pos="0,0" rot="0" zoffset="400" shadow="false"/>
<shape type="poly" name="" col="1,2" vertices="0,0, 50,0, 50,50, 0,50" density="1" friction="1" restitution="0"/>
</body>
</physobj>
<physobj name="plunger100r">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="34" pos="0,0" rot="0"/>
<shape type="poly" name="" col="0,0" vertices="-8,0,-8,-100,8,-100,8,0" density="0.1" friction="1" restitution="0"/>
</body>
<body name="plunger" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="37" pos="0,0" rot="0" zoffset="-2"/>
<shape type="poly" name="" col="1,7" vertices="-8,-8, 8,0, 8,8, -8,8" density="0.2" friction="0" restitution="0"/>
<shape type="poly" name="" col="1,7" vertices="-8,92, 8,92, 8,108, -8,108" density="0.2" friction="0" restitution="0"/>
</body>
<joint type="prismatic" name="joint1" body0="fix" body1="plunger" pos="0,0" axisangle="0" enablelimit="true" lowertranslation="-10" uppertranslation="10" enablemotor="true" motorspeed="0" maxmotorforce="1"/>
</physobj>
<physobj name="plunger100">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="34" pos="0,0" rot="0"/>
<shape type="poly" name="" col="0,0" vertices="-8,0,-8,-100,8,-100,8,0" density="0.1" friction="1" restitution="0"/>
</body>
<body name="plunger" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="35" pos="0,0" rot="0" zoffset="-2"/>
<shape type="poly" name="" col="1,7" vertices="-8,0, 8,-8, 8,8, -8,8" density="0.2" friction="0" restitution="0"/>
<shape type="poly" name="" col="1,7" vertices="-8,92, 8,92, 8,108, -8,108" density="0.2" friction="0" restitution="0"/>
</body>
<joint type="prismatic" name="joint1" body0="fix" body1="plunger" pos="0,0" axisangle="0" enablelimit="true" lowertranslation="-10" uppertranslation="10" enablemotor="true" motorspeed="0" maxmotorforce="1"/>
</physobj>
<physobj name="piston">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="19" pos="0,0" rot="0"/>
</body>
<body name="plunger" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="20" pos="0,0" rot="0" zoffset="-2"/>
<shape type="poly" name="" col="1,7" vertices="-14,-14,14,-14,14,14,-14,14" density="0.1" friction="1" restitution="0"/>
</body>
<joint type="prismatic" name="joint1" body0="fix" body1="plunger" pos="0,0" axisangle="0" enablelimit="true" lowertranslation="0" uppertranslation="140" enablemotor="false" motorspeed="0" maxmotorforce="0"/>
</physobj>
<physobj name="piston2">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="26" pos="0,0" rot="0"/>
<shape type="poly" name="" col="0,0" vertices="-8,0,-8,-100,8,-100,8,0" density="0.1" friction="1" restitution="0"/>
</body>
<body name="plunger" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="20" pos="0,0" rot="0" zoffset="-2"/>
<shape type="poly" name="" col="1,7" vertices="-14,-14,14,-14,14,14,-14,14" density="0.1" friction="1" restitution="0"/>
</body>
<joint type="prismatic" name="joint1" body0="fix" body1="plunger" pos="0,0" axisangle="0" enablelimit="true" lowertranslation="0" uppertranslation="70" enablemotor="false" motorspeed="0" maxmotorforce="0"/>
</physobj>
<physobj name="hinge">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<body name="rotator" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="15" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,7" vertices="0,-6, 95,-6, 95,6, 0,6" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="rotator" pos="0,0" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="true" motorspeed="0" maxmotortorque="1"/>
</physobj>
<physobj name="hinge90">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<body name="rotator" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="47" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,7" vertices="0,-6, 95,-6, 95,6, 0,6" density="0.5" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,7" vertices="0,-6, 95,-6, 95,6, 0,6" rot="90" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="rotator" pos="0,0" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="true" motorspeed="0" maxmotortorque="1"/>
</physobj>
<physobj name="hammer">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="rotator" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="16" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,7" vertices="0,-6, 95,-6, 95,6, 0,6" density="1" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,7" vertices="96,-31, 132,-35, 136,17, 96,14" density="1" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="rotator" pos="0,0" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="3"/>
</physobj>
<physobj name="spikes">
<body name="body" pos="0,0" fixed="true" sensor="true">
<graphic clip="BlockBits" frame="13" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,2" vertices="0,0, 70,0, 70,30, 0,30" density="1" friction="1" restitution="0" sensor="true"/>
</body>
</physobj>
<!-- multi coloured -->
<physobj name="hopper">
<body name="body1" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="9" pos="0,0" rot="0" zoffset="200"/>
<shape type="poly" name="" col="1,6" vertices="-20,4,-15,4,-15,40,-20,40" density="1" friction="1" restitution="0"/>
<shape type="poly" name="" col="1,6" vertices="15,4,20,4,20,40,15,40" density="1" friction="1" restitution="0"/>
<shape type="poly" name="" col="1,6" vertices="-20,35,20,35,20,40,-20,40" density="1" friction="1" restitution="0"/>
</body>
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="43" pos="0,0" zoffset="-400" rot="0"/>
</body>
<body name="inner" pos="0,0" fixed="true" sensor="true">
<shape type="poly" name="" col="1,6" vertices="-15,25, 15,25, 15,35, -15,35" density="1" friction="1" restitution="0"/>
</body>
</physobj>
<!-- orange -->
<physobj name="hopper1">
<body name="body1" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="32" pos="0,0" rot="0" zoffset="200"/>
<shape type="poly" name="" col="1,6" vertices="-20,4,-15,4,-15,40,-20,40" density="1" friction="1" restitution="0"/>
<shape type="poly" name="" col="1,6" vertices="15,4,20,4,20,40,15,40" density="1" friction="1" restitution="0"/>
<shape type="poly" name="" col="1,6" vertices="-20,35,20,35,20,40,-20,40" density="1" friction="1" restitution="0"/>
</body>
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="42" pos="0,0" zoffset="-400" rot="0"/>
</body>
<body name="inner" pos="0,0" fixed="true" sensor="true">
<shape type="poly" name="" col="1,6" vertices="-15,25, 15,25, 15,35, -15,35" density="1" friction="1" restitution="0"/>
</body>
</physobj>
<!-- green -->
<physobj name="hopper2">
<body name="body1" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="30" pos="0,0" rot="0" zoffset="200"/>
<shape type="poly" name="" col="1,6" vertices="-20,4,-15,4,-15,40,-20,40" density="1" friction="1" restitution="0"/>
<shape type="poly" name="" col="1,6" vertices="15,4,20,4,20,40,15,40" density="1" friction="1" restitution="0"/>
<shape type="poly" name="" col="1,6" vertices="-20,35,20,35,20,40,-20,40" density="1" friction="1" restitution="0"/>
</body>
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="40" zoffset="-400" pos="0,0" rot="0"/>
</body>
<body name="inner" pos="0,0" fixed="true" sensor="true">
<shape type="poly" name="" col="1,6" vertices="-15,25, 15,25, 15,35, -15,35" density="1" friction="1" restitution="0"/>
</body>
</physobj>
<!-- blue -->
<physobj name="hopper3">
<body name="body1" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="31" pos="0,0" rot="0" zoffset="200"/>
<shape type="poly" name="" col="1,6" vertices="-20,4,-15,4,-15,40,-20,40" density="1" friction="1" restitution="0"/>
<shape type="poly" name="" col="1,6" vertices="15,4,20,4,20,40,15,40" density="1" friction="1" restitution="0"/>
<shape type="poly" name="" col="1,6" vertices="-20,35,20,35,20,40,-20,40" density="1" friction="1" restitution="0"/>
</body>
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="41" pos="0,0" zoffset="-400" rot="0"/>
</body>
<body name="inner" pos="0,0" fixed="true" sensor="true">
<shape type="poly" name="" col="1,6" vertices="-15,25, 15,25, 15,35, -15,35" density="1" friction="1" restitution="0"/>
</body>
</physobj>
<physobj name="screenborder">
<body name="body" pos="0,0" fixed="true" sensor="true">
<graphic clip="inGameWaves" frame="1" pos="0,510" rot="0" zoffset="-500" gameobjfunction="InitObj_Waves"/>
<shape type="poly" name="" col="1,6" vertices="0,-32,640,-32,640,0,0,0" density="1" friction="1" restitution="0"/>
<shape type="poly" name="" col="1,6" vertices="-50,540,740,540,740,580,-50,580" density="1" friction="1" restitution="0"/>
<shape type="poly" name="" col="1,6" vertices="-30,0,-20,0,-20,580,-20,580" density="1" friction="1" restitution="0"/>
<shape type="poly" name="" col="1,6" vertices="660,0,680,0,680,580,660,580" density="1" friction="1" restitution="0"/>
</body>
</physobj>
<physobj name="bouncer">
<sound hitball="2"/>
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="36" pos="0,0" rot="0" gameobjfunction="InitObj_Bouncer"/>
<shape type="poly" name="" col="1,6" vertices="0,0, 60,0, 60,30, 0,30" density="1" friction="1" restitution="1"/>
</body>
</physobj>
<physobj name="bouncer2">
<sound hitball="1"/>
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="12" pos="0,0" rot="0" gameobjfunction="InitObj_Bouncer"/>
<shape type="poly" name="" col="1,6" vertices="0,0, 60,0, 60,30, 0,30" density="1" friction="1" restitution="2"/>
</body>
</physobj>
<physobj name="plank100">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="7" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5,100,-5,100,5,0,5" density="1" friction="1" restitution="0"/>
</body>
</physobj>
<physobj name="plank50">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="8" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5,50,-5,50,5,0,5" density="1" friction="1" restitution="0"/>
</body>
</physobj>
<physobj name="plank50_smooth">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="44" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5,50,-5,50,5,0,5" density="1" friction="0" restitution="0"/>
</body>
</physobj>
<physobj name="seesaw">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="lever" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="1" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="-50,-5, 50,-5, 50,5, -50,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="lever" pos="0,0" enablelimit="true" lowerangle="-45" upperangle="45" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<physobj name="seesaw20">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="lever" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="1" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="-50,-5, 50,-5, 50,5, -50,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="lever" pos="0,0" enablelimit="true" lowerangle="-20" upperangle="20" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<physobj name="hexcog">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="rotator" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="33" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,7" vertices="-60,-5, 60,-5, 60,5, -60,5" rot="0" density="0.5" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,7" vertices="-60,-5, 60,-5, 60,5, -60,5" rot="120" density="0.5" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,7" vertices="-60,-5, 60,-5, 60,5, -60,5" rot="240" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="rotator" pos="0,0" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<physobj name="hexcog_limited">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="rotator" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="48" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,7" vertices="-60,-5, 60,-5, 60,5, -60,5" rot="0" density="0.5" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,7" vertices="-60,-5, 60,-5, 60,5, -60,5" rot="120" density="0.5" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,7" vertices="-60,-5, 60,-5, 60,5, -60,5" rot="240" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="rotator" pos="0,0" enablelimit="true" lowerangle="-180" upperangle="180" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<physobj name="cross">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="1,6" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="rotator" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="3" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,7" vertices="-50,-5, 50,-5, 50,5, -50,5" density="0.5" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,7" vertices="-5,-50, 5,-50, 5,50, -5,50" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="rotator" pos="0,0" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<physobj name="cross_rot_cw">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="1,6" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="rotator" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="3" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,7" vertices="-50,-5, 50,-5, 50,5, -50,5" density="0.5" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,7" vertices="-10,-50, 10,-50, 10,50, -10,50" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="rotator" pos="0,0" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="true" motorspeed="1" maxmotortorque="1000"/>
</physobj>
<physobj name="cross_rot_ccw">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="1,6" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="rotator" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="3" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,7" vertices="-50,-5, 50,-5, 50,5, -50,5" density="0.5" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,7" vertices="-10,-50, 10,-50, 10,50, -10,50" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="rotator" pos="0,0" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="true" motorspeed="-1" maxmotortorque="1000"/>
</physobj>
<physobj name="chain">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="1,6" vertices="-5,-5, 5,-5, 5,5, -5,5" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<body name="piece0" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="4" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="-5,0, 5,0, 5,25, -5,25" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<body name="piece1" pos="0,25" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="4" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="-5,0, 5,0, 5,25, -5,25" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<body name="piece2" pos="0,50" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="4" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="-5,0, 5,0, 5,25, -5,25" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<body name="piece3" pos="0,75" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="4" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="-5,0, 5,0, 5,25, -5,25" density="0.5" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="piece0" pos="0,0" enablelimit="true" lowerangle="-30" upperangle="30" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="rev" name="joint2" body0="piece0" body1="piece1" pos="0,25" enablelimit="true" lowerangle="-30" upperangle="30" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="rev" name="joint3" body0="piece1" body1="piece2" pos="0,50" enablelimit="true" lowerangle="-30" upperangle="30" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="rev" name="joint3" body0="piece2" body1="piece3" pos="0,75" enablelimit="true" lowerangle="-30" upperangle="30" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<physobj name="hose">
<body name="nozzle" pos="0,0" fixed="false" sensor="false" angulardamping="1" lineardamping="1">
<graphic clip="BlockBits" frame="29" pos="0,0" rot="0" zoffset="-500" gameobjfunction="InitObj_HoseNozzle"/>
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece0" pos="0,0" fixed="false" sensor="false" angulardamping="3" lineardamping="1">
<graphic clip="BlockBits" frame="21" pos="0,0" rot="0" gameobjfunction="InitObj_Hose"/>
<shape type="poly" name="" col="0,0" vertices="-10,0,10,0,10,50,-10,50" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece1" pos="0,50" fixed="false" sensor="false" angulardamping="3" lineardamping="1">
<graphic clip="BlockBits" frame="21" pos="0,0" rot="0" gameobjfunction="InitObj_Hose"/>
<shape type="poly" name="" col="0,0" vertices="-10,0,10,0,10,50,-10,50" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece2" pos="0,100" fixed="false" sensor="false" angulardamping="1" lineardamping="1">
<graphic clip="BlockBits" frame="21" pos="0,0" rot="0" gameobjfunction="InitObj_Hose"/>
<shape type="poly" name="" col="0,0" vertices="-10,0,10,0,10,50,-10,50" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece4" pos="0,200" fixed="false" sensor="false" angulardamping="1" lineardamping="1">
<graphic clip="BlockBits" frame="21" pos="0,0" rot="0" gameobjfunction="InitObj_Hose"/>
<shape type="poly" name="" col="0,0" vertices="-10,0,10,0,10,50,-10,50" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece6" pos="0,300" fixed="false" sensor="false" angulardamping="1" lineardamping="1">
<graphic clip="BlockBits" frame="21" pos="0,0" rot="0" gameobjfunction="InitObj_Hose"/>
<shape type="poly" name="" col="0,0" vertices="-10,0,10,0,10,50,-10,50" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece8" pos="0,400" fixed="false" sensor="false" angulardamping="1" lineardamping="1">
<graphic clip="BlockBits" frame="21" pos="0,0" rot="0" gameobjfunction="InitObj_Hose"/>
<shape type="poly" name="" col="0,0" vertices="-10,0,10,0,10,50,-10,50" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece10" pos="0,500" fixed="false" sensor="false" angulardamping="1" lineardamping="1">
<graphic clip="BlockBits" frame="21" pos="0,0" rot="0" gameobjfunction="InitObj_Hose"/>
<shape type="poly" name="" col="0,0" vertices="-10,0,10,0,10,50,-10,50" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="fix1" pos="0,600" fixed="true" sensor="false">
<graphic clip="BlockBits" frame="21" pos="0,0" rot="0"/>
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<joint type="mouse" name="joint0" body0="nozzle" body1="nozzle" pos="0,0"/>
<joint type="distance" name="joint1" body0="nozzle" body1="piece0" pos="0,0" pos1="0,0" distance="1" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint2" body0="piece0" body1="piece1" pos="0,50" pos1="0,50" distance="1" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint2a" body0="piece1" body1="piece2" pos="0,100" pos1="0,100" distance="1" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint4" body0="piece2" body1="piece4" pos="0,200" pos1="0,200" distance="1" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint6" body0="piece4" body1="piece6" pos="0,300" pos1="0,300" distance="1" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint8" body0="piece6" body1="piece8" pos="0,400" pos1="0,400" distance="1" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint10" body0="piece8" body1="piece10" pos="0,500" pos1="0,500" distance="1" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint13" body0="piece10" body1="fix1" pos="0,600" pos1="0,600" distance="1" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<physobj name="bridge">
<sound hitball="1"/>
<body name="fixl" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece0" pos="0,0" fixed="false" sensor="false" angulardamping="0.5" lineardamping="0.5">
<graphic clip="BlockBits" frame="5" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5, 25,-5, 25,5, 0,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece1" pos="25,0" fixed="false" sensor="false" angulardamping="0.5" lineardamping="0.5">
<graphic clip="BlockBits" frame="5" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5, 25,-5, 25,5, 0,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece2" pos="50,0" fixed="false" sensor="false" angulardamping="0.5" lineardamping="0.5">
<graphic clip="BlockBits" frame="5" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5, 25,-5, 25,5, 0,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece3" pos="75,0" fixed="false" sensor="false" angulardamping="0.5" lineardamping="0.5">
<graphic clip="BlockBits" frame="5" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5, 25,-5, 25,5, 0,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="fixr" pos="100,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<joint type="distance" name="joint1" body0="fixl" body1="piece0" pos="0,0" pos1="5,0" distance="3" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint2" body0="piece0" body1="piece1" pos="20,0" pos1="30,0" distance="3" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint3" body0="piece1" body1="piece2" pos="45,0" pos1="55,0" distance="3" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint4" body0="piece2" body1="piece3" pos="70,0" pos1="80,0" distance="3" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint5" body0="piece3" body1="fixr" pos="95,0" pos1="105,0" distance="3" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<physobj name="bridge2">
<sound hitball="1"/>
<body name="fixl" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece0" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="5" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5, 25,-5, 25,5, 0,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece1" pos="25,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="5" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5, 25,-5, 25,5, 0,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece2" pos="50,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="5" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5, 25,-5, 25,5, 0,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece3" pos="75,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="5" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5, 25,-5, 25,5, 0,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece4" pos="100,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="5" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5, 25,-5, 25,5, 0,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece5" pos="125,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="5" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5, 25,-5, 25,5, 0,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece6" pos="150,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="5" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5, 25,-5, 25,5, 0,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="piece7" pos="175,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="5" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="0,-5, 25,-5, 25,5, 0,5" density="0.1" friction="0.5" restitution="0.2"/>
</body>
<body name="fixr" pos="200,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-5,-5, 5,-5, 5,5, -5,5" density="1" friction="0.5" restitution="0.2"/>
</body>
<joint type="distance" name="joint1" body0="fixl" body1="piece0" pos="0,0" pos1="5,0" distance="2" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint2" body0="piece0" body1="piece1" pos="20,0" pos1="30,0" distance="2" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint3" body0="piece1" body1="piece2" pos="45,0" pos1="55,0" distance="2" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint4" body0="piece2" body1="piece3" pos="70,0" pos1="80,0" distance="2" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint5" body0="piece3" body1="piece4" pos="95,0" pos1="105,0" distance="2" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint6" body0="piece4" body1="piece5" pos="120,0" pos1="130,0" distance="2" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint7" body0="piece5" body1="piece6" pos="145,0" pos1="155,0" distance="2" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint8" body0="piece6" body1="piece7" pos="170,0" pos1="180,0" distance="2" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
<joint type="distance" name="joint9" body0="piece7" body1="fixr" pos="195,0" pos1="205,0" distance="2" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<physobj name="cog8">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-2,-2, 2,-2, 2,2, -2,2" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="rotator" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="6" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="-25,-2.5, 25,-2.5, 25,2.5, -25,2.5" rot="0" density="0.3" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,6" vertices="-25,-2.5, 25,-2.5, 25,2.5, -25,2.5" rot="45" density="0.3" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,6" vertices="-25,-2.5, 25,-2.5, 25,2.5, -25,2.5" rot="90" density="0.3" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,6" vertices="-25,-2.5, 25,-2.5, 25,2.5, -25,2.5" rot="135" density="0.3" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="rotator" pos="0,0" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<physobj name="cog4">
<sound hitball="1"/>
<body name="fix" pos="0,0" fixed="true" sensor="false">
<shape type="poly" name="" col="0,0" vertices="-2,-2, 2,-2, 2,2, -2,2" density="1" friction="0.5" restitution="0.2"/>
</body>
<body name="rotator" pos="0,0" fixed="false" sensor="false">
<graphic clip="BlockBits" frame="39" pos="0,0" rot="0"/>
<shape type="poly" name="" col="1,6" vertices="-25,-2.5, 25,-2.5, 25,2.5, -25,2.5" rot="0" density="0.3" friction="0.5" restitution="0.2"/>
<shape type="poly" name="" col="1,6" vertices="-25,-2.5, 25,-2.5, 25,2.5, -25,2.5" rot="90" density="0.3" friction="0.5" restitution="0.2"/>
</body>
<joint type="rev" name="joint1" body0="fix" body1="rotator" pos="0,0" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/>
</physobj>
<!-- Non-physics objects -->
<physobj name="hanger01">
<body name="pin" pos="0,0" fixed="true" sensor="false">
<graphic clip="BackgroundBits" frame="1" pos="0,0" zoffset="1000" rot="0" shadow="false"/>
</body>
</physobj>
<physobj name="stick01">
<body name="pin" pos="0,0" fixed="true" sensor="false">
<graphic clip="BackgroundBits" frame="2" pos="0,0" zoffset="1000" rot="0" shadow="false"/>
</body>
</physobj>
<physobj name="stick02">
<body name="pin" pos="0,0" fixed="true" sensor="false">
<graphic clip="BackgroundBits" frame="4" pos="0,0" zoffset="1000" rot="0" shadow="false"/>
</body>
</physobj>
<physobj name="greystick01">
<body name="pin" pos="0,0" fixed="true" sensor="false">
<graphic clip="BackgroundBits" frame="3" pos="0,0" zoffset="1000" rot="0" shadow="false"/>
</body>
</physobj>
<physobj name="guard_100x100">
<body name="pin" pos="0,0" fixed="true" sensor="false">
<graphic clip="BackgroundBits" frame="5" pos="0,0" rot="0" zoffset="-300" shadow="false"/>
</body>
</physobj>
</data>
;
static var xmlLoader:URLLoader;
static var cb:Function;
public static function Load(_arg1:Function){
cb = _arg1;
XmlLoadedInternal();
}
static function XmlLoadedInternal(){
var _local1:int;
XML.ignoreWhitespace = true;
xml = new XML(xxx);
cb(xml);
}
public static function xmlLoaded(_arg1:Event){
var _local2:int;
XML.ignoreWhitespace = true;
xml = new XML(_arg1.target.data);
cb(xml);
}
}
}//package
Section 114
//Eye (Eye)
package {
import flash.display.*;
public dynamic class Eye extends MovieClip {
}
}//package
Section 115
//Eyelid (Eyelid)
package {
import flash.display.*;
public dynamic class Eyelid extends MovieClip {
}
}//package
Section 116
//EyelidBlue (EyelidBlue)
package {
import flash.display.*;
public dynamic class EyelidBlue extends MovieClip {
}
}//package
Section 117
//EyelidGreen (EyelidGreen)
package {
import flash.display.*;
public dynamic class EyelidGreen extends MovieClip {
}
}//package
Section 118
//Font20 (Font20)
package {
import flash.text.*;
public dynamic class Font20 extends Font {
}
}//package
Section 119
//Game (Game)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
import flash.ui.*;
import flash.filters.*;
public class Game {
static const levelFinishedState_WON = 1;
static const editMode_Eraser:int = 2;
static const colCategory_Pellet:int = 4;
static const levelFinishedState_NOT = 0;
static const levelState_Editor = 3;
static const editMode_Normal:int = 0;
static const levelFinishedState_LOST = 2;
static const levelState_Play = 1;
static const colCategory_Ball:int = 2;
static const levelState_Null = 2;
static const editMode_Library:int = 1;
static const editMode_Adjust:int = 4;
static const levelState_LevelStart = 0;
static const colCategory_Background:int = 1;
static const editMode_Commands:int = 3;
static var panelRect:Rectangle = new Rectangle(200, 560, 200, 10);
static var nextHopperIndex:int;
static var boxNumH:Number = 4;
static var showingInstructions:Boolean;
static var dibsSpeechTimer:int;
static var levelFinishedState:int;
static var prevEditMode:int = 0;
static var levelTimer:int;
static var bgFrame:int;
static var nextBallTypeIndex:int;
public static var gravity;
public static var firstTime_Powerup1:Boolean;
public static var firstTime_Powerup3:Boolean;
public static var firstTime_Powerup2:Boolean;
public static var firstTime_Powerup4:Boolean;
static var cg:Number = 0;
static var collectedBonus:Boolean;
static var invincibleTimer:int;
public static var currentStartPointIndex:int;
static var numBallsHome:int;
static var scrollAcc:Number;
static var x:XML;
static var numBallsHomeNeeded:int;
static var squelchSfxTimer:int;
static var wheelAngVelDec:Number;
static var editor_currentPiece:int = 0;
public static var maxFallSpeed;
static var objCols:Array;
public static var numBallsKilled:int;
public static var nozzleSpreadAng:Number = 10;
static var physObjs:PhysObjs;
public static var nozzleSpreadAngMin:Number = 3;
static var numLevels:int;
static var numBlimps:int;
static var currentScore:int;
static var wheelAngVel:Number;
public static var playerExtraJumpYvel = -4;
public static var LevelUpdateCallback:Object;
static var canShootPellet:Boolean;
public static var heightMap:Array;
static var scrollMaxVel:Number;
static var mousePosX:Number = 0;
static var mousePosY:Number = 0;
static var showingOverlay:Boolean;
static var version:Number = 1.041;
public static var nozzleSpreadAngKeyChange:Number = 2;
static var instructionIndex:int;
static var mouseJoint:b2MouseJoint = null;
static var pauseGameplayInput:Boolean;
static var editMode:int = 0;
static var p2w:Number = 5;
static var bikeInited:Boolean;
public static var polygonList:Array;
static var wheelAngVelAcc:Number;
static var numCreds:int;
static var sitelocked:Boolean = false;
public static var exitPoint:Point;
public static var numBallsActive:int;
public static var bossGO:GameObj;
static var numWeenies:int;
public static var scrollH:Number;
static var countdownTimer0:int;
static var countdownTimer1:int;
static var invincibleTimerMax:int;
static var numLives:int;
static var showingOverlayID:int;
static var speedupTimerMax:int;
public static var scrollX:Number;
static var usedebug:Boolean = false;
static var soundon:Boolean = true;
public static var scrollW:Number;
public static var scrollY:Number;
static var w2p:Number = (1 / p2w);
static var speedupTimer:int;
public static var numCollisionTests:int;
public static var ballList:Array;
static var boxSizeH:Number = (Defs.displayarea_h / boxNumH);
static var physNumIterations:int = 10;
static var levelState:int;
static var levels:Array;
static var physObjInstances:PhysObj_Instances;
static var boxSizeW:Number = (Defs.displayarea_w / boxNumW);
static var countupTimer:int;
public static var numKilledInWaveList:Array;
static var level_instances:Array;
static var currentLevel:int;
static var hoseBubbles:Array = null;
public static var nozzleSpreadAngMax:Number = 45;
public static var world:b2World;
static var scrollVel:Number;
static var library_page:int = 0;
static var dibsSpeechFlag:Boolean;
static var zsortoffset:Number = 0;
static var main:Main;
static var mousetimer:int = 0;
static var multiplier:int;
static var cursorX:Number = 0;
static var cursorY:Number = 0;
public static var currentAdjustObject:PhysObj_Instance;
static var initHopperIndex:int;
static var editor_currentPieceRot:Number = 0;
static var lastGeneratedGameObj:GameObj;
static var totalBlimps:int;
static var xb_body:XML;
public static var startPointObjs:Array;
static var levelStateTimer:int;
static var scrollMaxX;
static var nextPieceGO:GameObj;
public static var startPoints:Array;
static var wheelAngVelMax:Number;
static var goPlayer:GameObj;
public static var playerJumpYvel = -6;
static var overlayMC:MovieClip;
static var scrollMaxY;
static var nextBallType:int;
static var levelResults:Array;
static var pause:Boolean;
public static var deadFlag:Boolean;
static var instructionsMC:MovieClip;
static var boxNumW:Number = 5;
public static function TestMousePressMovingNozzleSlider():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local1 = (20 + 20);
_local2 = (20 + 140);
_local3 = 5;
_local4 = (5 + 25);
_local5 = MouseControl.mousePosX;
_local6 = MouseControl.mousePosY;
if ((((((((_local5 >= _local1)) && ((_local5 <= _local2)))) && ((_local6 >= _local3)))) && ((_local6 <= _local4)))){
nozzleSpreadAng = Utils.ScaleTo(nozzleSpreadAngMin, nozzleSpreadAngMax, _local1, _local2, _local5);
return (true);
};
return (false);
}
static function GetCurrentLevel():Level{
return (levels[currentLevel]);
}
public static function RemoveObj_BallInHopper(_arg1:PhysObj_Instance){
physObjInstances.Remove(_arg1);
numBallsActive--;
numBallsHome++;
SoundPlayer.PlayRandomBetween("sfx_woohoo1", "sfx_woohoo2");
}
public static function CalcLevelEndResults(_arg1:Boolean){
var _local2:Level;
var _local3:LevelResult;
var _local4:Number;
var _local5:Number;
var _local6:*;
var _local7:Number;
var _local8:Number;
CalculateTotalScore();
if (_arg1 == false){
return;
};
_local2 = GetCurrentLevel();
_local3 = GetCurrentLevelResult();
_local3.complete = true;
if (collectedBonus){
_local3.bonus = true;
};
_local4 = (Math.floor((_local2.time - (countupTimer / Defs.fps))) * 100);
_local5 = (5000 - (numBallsKilled * 500));
if (_local5 < 0){
_local5 = 0;
};
_local6 = 0;
if (collectedBonus){
_local6 = 3000;
};
trace(("time bonus " + _local4));
trace(("death bonus " + _local5));
_local7 = 5000;
_local3.lastTimeBonus = _local4;
_local3.lastNumKilledBonus = _local5;
_local3.lastLevelCompleteBonus = _local7;
_local3.lastLevelGemBonus = _local6;
_local8 = (((_local7 + _local4) + _local5) + _local6);
trace(("score: " + _local8));
_local3.lastScore = _local8;
if (_local8 > _local3.bestScore){
_local3.bestScore = _local8;
};
_local3.lastNumKilled = numBallsKilled;
if (numBallsKilled < _local3.bestNumKilled){
_local3.bestNumKilled = numBallsKilled;
};
_local3.lastTime = countupTimer;
if (countupTimer < _local3.bestTime){
_local3.bestTime = countupTimer;
};
CalculateTotalScore();
}
static function InitBox2D():void{
var _local1:b2AABB;
var _local2:b2Vec2;
var _local3:Boolean;
var _local4:b2BodyDef;
var _local5:b2Body;
var _local6:b2PolygonDef;
var _local7:ContactListener;
_local1 = new b2AABB();
_local1.lowerBound.Set(-1000, -100);
_local1.upperBound.Set(1000, 1000);
_local2 = new b2Vec2(0, 50);
_local3 = true;
world = new b2World(_local1, _local2, _local3);
world.GetGroundBody().SetUserData(-1);
wheelAngVel = 0;
wheelAngVelMax = 40;
wheelAngVelAcc = 4;
wheelAngVelDec = -4;
bikeInited = false;
ExternalData.Load(XmlLoaded);
_local7 = new ContactListener();
world.SetContactListener(_local7);
}
public static function LoadLevels(){
var _local1:XML;
var _local2:*;
var _local3:int;
levels = new Array();
_local1 = ExternalData.xml;
_local2 = _local1.level.length();
_local3 = 0;
while (_local3 < _local2) {
LoadLevel(_local3);
_local3++;
};
}
static function AddPhysObjAt(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:String=""):PhysObj_Instance{
var _local6:PhysObj;
var _local7:PhysObj_Instance;
var _local8:Number;
var _local9:b2BodyDef;
var _local10:b2Body;
var _local11:b2PolygonDef;
var _local12:b2CircleDef;
var _local13:int;
var _local14:b2Joint;
var _local15:Matrix;
var _local16:PhysObj_Body;
var _local17:PhysObj_Joint;
var _local18:Number;
var _local19:Number;
var _local20:Point;
var _local21:PhysObj_BodyUserData;
var _local22:PhysObj_Shape;
var _local23:PhysObj_Graphic;
var _local24:b2FilterData;
var _local25:Point;
var _local26:Number;
var _local27:Number;
var _local28:int;
var _local29:int;
var _local30:b2Body;
var _local31:b2Body;
var _local32:b2RevoluteJointDef;
var _local33:Number;
var _local34:Number;
var _local35:b2PrismaticJointDef;
var _local36:Number;
var _local37:b2Vec2;
var _local38:b2DistanceJointDef;
var _local39:Number;
var _local40:Number;
var _local41:b2MouseJointDef;
_local6 = physObjs.FindByName(_arg1);
_local7 = new PhysObj_Instance();
_local7.typeName = _arg1;
_local7.x = _arg2;
_local7.y = _arg3;
_local7.rot = _arg4;
_local7.bodies = new Array();
_local7.instanceName = _arg5;
_local7.hitballsound = _local6.hitballsound;
physObjInstances.list.push(_local7);
_local8 = Utils.DegToRad(_arg4);
_arg2 = (_arg2 * w2p);
_arg3 = (_arg3 * w2p);
_local15 = new Matrix();
_local15.rotate(_local8);
for each (_local16 in _local6.bodies) {
_local9 = new b2BodyDef();
_local18 = (_local16.pos.x * w2p);
_local19 = (_local16.pos.y * w2p);
_local20 = new Point(_local18, _local19);
_local20 = _local15.transformPoint(_local20);
_local18 = _local20.x;
_local19 = _local20.y;
_local9.position.Set((_arg2 + _local18), (_arg3 + _local19));
_local9.angularDamping = _local16.angularDamping;
_local9.linearDamping = _local16.linearDamping;
_local9.angle = _local8;
_local10 = world.CreateBody(_local9);
_local21 = new PhysObj_BodyUserData();
_local21.type = _arg1;
_local21.bodyName = _local16.name;
_local21.instance = _local7;
_local10.SetUserData(_local21);
if (_local16.graphics.length != 0){
_local23 = _local16.graphics[0];
_local21.gameObjectID = InitPhysicsGO(_local23, _local23.graphicID, _local23.frame, 1000);
};
for each (_local22 in _local16.shapes) {
_local24 = new b2FilterData();
_local24.categoryBits = _local22.collisionCategory;
_local24.maskBits = _local22.collisionMask;
if (_local22.type == PhysObj_Shape.Type_Poly){
_local11 = new b2PolygonDef();
_local11.vertexCount = _local22.poly_points.length;
_local11.filter = _local24;
_local11.isSensor = _local16.sensor;
_local13 = 0;
while (_local13 < _local22.poly_points.length) {
_local25 = _local22.poly_points[_local13].clone();
_local26 = (_local25.x * w2p);
_local27 = (_local25.y * w2p);
_local11.vertices[_local13].Set(_local26, _local27);
_local13++;
};
_local11.friction = _local22.friction;
_local11.restitution = _local22.restitution;
_local11.density = _local22.density;
_local10.CreateShape(_local11);
} else {
if (_local22.type == PhysObj_Shape.Type_Circle){
_local12 = new b2CircleDef();
_local12.radius = (_local22.circle_radius * w2p);
_local12.filter = _local24;
_local12.isSensor = _local16.sensor;
_local12.localPosition.x = _local22.circle_pos.x;
_local12.localPosition.y = _local22.circle_pos.y;
_local12.friction = _local22.friction;
_local12.restitution = _local22.restitution;
_local12.density = _local22.density;
_local10.CreateShape(_local12);
};
};
};
if (_local16.fixed){
_local10.PutToSleep();
_local10.SetMass(new b2MassData());
} else {
_local10.SetMassFromShapes();
};
_local7.bodies.push(_local10);
};
for each (_local17 in _local6.joints) {
_local28 = _local6.BodyIndexFromName(_local17.obj0Name);
_local29 = _local6.BodyIndexFromName(_local17.obj1Name);
_local30 = _local7.bodies[_local28];
_local31 = _local7.bodies[_local29];
if (_local17.type == PhysObj_Joint.Type_Rev){
_local32 = new b2RevoluteJointDef();
_local33 = (_local17.rev_pos.x * w2p);
_local34 = (_local17.rev_pos.y * w2p);
_local20 = new Point(_local33, _local34);
_local20 = _local15.transformPoint(_local20);
_local33 = _local20.x;
_local34 = _local20.y;
_local32.Initialize(_local30, _local31, new b2Vec2((_arg2 + _local33), (_arg3 + _local34)));
_local32.enableLimit = _local17.rev_enableLimit;
_local32.lowerAngle = _local17.rev_lowerAngle;
_local32.upperAngle = _local17.rev_upperAngle;
_local32.enableMotor = _local17.rev_enableMotor;
_local32.motorSpeed = _local17.rev_motorSpeed;
_local32.maxMotorTorque = _local17.rev_maxMotorTorque;
_local32.collideConnected = false;
_local14 = world.CreateJoint(_local32);
};
if (_local17.type == PhysObj_Joint.Type_Prismatic){
_local35 = new b2PrismaticJointDef();
_local33 = (_local17.prism_pos.x * w2p);
_local34 = (_local17.prism_pos.y * w2p);
_local20 = new Point(_local33, _local34);
_local20 = _local15.transformPoint(_local20);
_local33 = _local20.x;
_local34 = _local20.y;
_local36 = Utils.DegToRad(_local17.prism_axisangle);
_local36 = (_local36 + _local8);
_local37 = new b2Vec2(Math.cos(_local36), Math.sin(_local36));
_local35.Initialize(_local30, _local31, new b2Vec2((_arg2 + _local33), (_arg3 + _local34)), _local37);
_local35.enableLimit = _local17.prism_enableLimit;
_local35.lowerTranslation = (_local17.prism_lowerTranslation * w2p);
_local35.upperTranslation = (_local17.prism_upperTranslation * w2p);
_local35.enableMotor = _local17.prism_enableMotor;
_local35.motorSpeed = _local17.prism_motorSpeed;
_local35.maxMotorForce = _local17.prism_maxMotorForce;
_local35.collideConnected = false;
_local14 = world.CreateJoint(_local35);
};
if (_local17.type == PhysObj_Joint.Type_Distance){
_local38 = new b2DistanceJointDef();
_local33 = (_local17.dist_pos0.x * w2p);
_local34 = (_local17.dist_pos0.y * w2p);
_local39 = (_local17.dist_pos1.x * w2p);
_local40 = (_local17.dist_pos1.y * w2p);
_local20 = new Point(_local33, _local34);
_local20 = _local15.transformPoint(_local20);
_local33 = _local20.x;
_local34 = _local20.y;
_local20 = new Point(_local39, _local40);
_local20 = _local15.transformPoint(_local20);
_local39 = _local20.x;
_local40 = _local20.y;
_local38.Initialize(_local30, _local31, new b2Vec2((_arg2 + _local33), (_arg3 + _local34)), new b2Vec2((_arg2 + _local39), (_arg3 + _local40)));
_local38.length = (_local38.length + (_local17.dist_distance * w2p));
_local38.dampingRatio = 0.1;
_local38.collideConnected = false;
_local14 = world.CreateJoint(_local38);
};
if (_local17.type == PhysObj_Joint.Type_Mouse){
_local41 = new b2MouseJointDef();
_local41.target.Set(_local30.GetPosition().x, _local30.GetPosition().y);
_local41.body1 = world.GetGroundBody();
_local41.body2 = _local30;
_local41.maxForce = (30000 * _local30.GetMass());
_local41.dampingRatio = 0.7;
_local41.frequencyHz = 10;
_local41.timeStep = (1 / 60);
_local14 = world.CreateJoint(_local41);
mouseJoint = (_local14 as b2MouseJoint);
};
_local7.joints.push(_local14);
};
return (_local7);
}
static function GetInitialStartPoint():Point{
var _local1:Point;
var _local2:Point;
var _local3:Number;
_local1 = null;
_local3 = 999999;
for each (_local2 in startPoints) {
if (_local2.x < _local3){
_local3 = _local2.x;
_local1 = _local2;
};
};
return (_local1);
}
public static function LoadLevel(_arg1:int){
var _local2:XML;
var _local3:Level;
var _local4:int;
var _local5:XML;
var _local6:XML;
var _local7:String;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:PhysObj_Instance;
_local2 = ExternalData.xml;
_local2 = _local2.level[_arg1];
_local3 = new Level();
_local3.name = XmlHelper.GetAttrString(_local2.@name, "undefined");
_local3.frequency = XmlHelper.GetAttrNumber(_local2.@frequency);
_local3.quota = XmlHelper.GetAttrInt(_local2.@quota);
_local3.maxballsactive = XmlHelper.GetAttrInt(_local2.@max, 5);
_local3.time = XmlHelper.GetAttrNumber(_local2.@time);
_local3.ballTypesString = XmlHelper.GetAttrString(_local2.@balltypes, "1,2,3");
_local3.category = XmlHelper.GetAttrInt(_local2.@category, 0);
_local4 = 0;
while (_local4 < _local2.helpscreen.length()) {
_local5 = _local2.helpscreen[_local4];
_local3.helpscreenFrames.push(XmlHelper.GetAttrInt(_local5.@frame, 0));
_local4++;
};
_local3.Calculate();
_local4 = 0;
while (_local4 < _local2.obj.length()) {
_local6 = _local2.obj[_local4];
_local7 = _local6.@type;
_local8 = Number(_local6.@x);
_local9 = Number(_local6.@y);
_local10 = Number(_local6.@rot);
_local11 = CreatePhysObjInstanceAt(_local7, _local8, _local9, _local10, "");
_local3.instances.push(_local11);
_local4++;
};
levels.push(_local3);
}
static function InitPhysicsGO(_arg1:PhysObj_Graphic, _arg2:int=0, _arg3:int=0, _arg4:Number=1000):int{
var _local5:GameObj;
_arg4 = (_arg4 + _arg1.zoffset);
if (_arg1 == null){
_local5 = GameObjects.AddObj(0, 0, (_arg4 + zsortoffset));
_local5.InitPhysicsObject(_arg2, _arg3, 0, 0, false);
} else {
if (_arg1.goInitFuntion == ""){
_local5 = GameObjects.AddObj(0, 0, (_arg4 + zsortoffset));
_local5.InitPhysicsObject(_arg2, _arg3, _arg1.offset.x, _arg1.offset.y, _arg1.hasShadow);
} else {
_local5 = GameObjects.AddObj(0, 0, (_arg4 + zsortoffset));
_local5.InitPhysicsObject(_arg2, _arg3, _arg1.offset.x, _arg1.offset.y, _arg1.hasShadow);
var _local6 = _local5;
_local6[_arg1.goInitFuntion]();
};
};
lastGeneratedGameObj = _local5;
return (GameObjects.lastGenIndex);
}
static function RenderPanel(){
var _local1:Level;
var _local2:Number;
var _local3:Number;
var _local4:String;
var _local5:int;
var _local6:Number;
var _local7:int;
_local1 = GetCurrentLevel();
_local2 = (Defs.displayarea_w - 110);
_local3 = 10;
_local4 = countdownTimer0.toString();
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font2, _local2, _local3, _local4, null);
_local4 = _local1.name;
_local5 = GraphicObjects.GetStringWidth(main.screenBD, GraphicObjects.gfx_font1, _local2, _local3, _local4, null, -1);
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, (_local2 - (_local5 + 10)), _local3, _local4, null, -1);
_local2 = 10;
_local3 = 550;
GraphicObjects.RenderAt(GraphicObjects.gfx_panelbits, 0, main.screenBD, _local2, _local3);
GraphicObjects.RenderAt(GraphicObjects.gfx_panelbits, 1, main.screenBD, (_local2 + 10), (_local3 - 5));
GraphicObjects.RenderAt(GraphicObjects.gfx_panelbits, 2, main.screenBD, (_local2 + 6), (_local3 + 4));
_local2 = (_local2 + 20);
_local4 = ((numBallsHome.toString() + "/") + numBallsHomeNeeded.toString());
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local2, (_local3 - 5), _local4, null, -1);
_local2 = (_local2 + 80);
GraphicObjects.RenderAt(GraphicObjects.gfx_panelbits, 3, main.screenBD, _local2, _local3);
_local2 = (_local2 + 16);
_local4 = numBallsKilled.toString();
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local2, (_local3 - 5), _local4, null, -1);
_local2 = 20;
_local3 = 5;
GraphicObjects.RenderAt(GraphicObjects.gfx_sprayslider, 0, main.screenBD, _local2, _local3);
_local6 = Utils.ScaleTo((_local2 + 20), (_local2 + 140), nozzleSpreadAngMin, nozzleSpreadAngMax, nozzleSpreadAng);
GraphicObjects.RenderAt(GraphicObjects.gfx_sprayslider, 1, main.screenBD, _local6, (_local3 + 13));
_local7 = 4;
if (SoundPlayer.doSFX){
_local7 = 0;
};
_local2 = (Defs.displayarea_w - 30);
_local3 = (Defs.displayarea_h - 25);
GraphicObjects.RenderAt(GraphicObjects.gfx_soundtoggle, _local7, main.screenBD, _local2, _local3);
_local2 = (Defs.displayarea_w - 97);
_local3 = (Defs.displayarea_h - 20);
GraphicObjects.RenderAt(GraphicObjects.gfx_restart, 0, main.screenBD, _local2, _local3);
_local2 = (Defs.displayarea_w - 165);
_local3 = (Defs.displayarea_h - 20);
GraphicObjects.RenderAt(GraphicObjects.gfx_menu, 0, main.screenBD, _local2, _local3);
if (levelState == levelState_Play){
if ((((MouseControl.mousePosY < 40)) || ((MouseControl.mousePosY > (Defs.displayarea_h - 40))))){
GraphicObjects.RenderAt(GraphicObjects.gfx_cursor, 0, main.screenBD, MouseControl.mousePosX, MouseControl.mousePosY);
};
};
}
public static function UpdateGameplay():void{
var _local1:int;
var _local2:int;
var _local3:PhysObj_Instance;
var _local4:LevelResult;
if (pause){
return;
};
if (levelState == levelState_Editor){
UpdateEditor();
return;
};
if (KeyReader.Down(KeyReader.KEY_LEFT)){
nozzleSpreadAng = (nozzleSpreadAng - nozzleSpreadAngKeyChange);
if (nozzleSpreadAng < nozzleSpreadAngMin){
nozzleSpreadAng = nozzleSpreadAngMin;
};
};
if (KeyReader.Down(KeyReader.KEY_RIGHT)){
nozzleSpreadAng = (nozzleSpreadAng + nozzleSpreadAngKeyChange);
if (nozzleSpreadAng > nozzleSpreadAngMax){
nozzleSpreadAng = nozzleSpreadAngMax;
};
};
if (usedebug){
if (KeyReader.Pressed(KeyReader.KEY_SPACE)){
InitLevelState(levelState_Editor);
};
};
if (levelState == levelState_Null){
return;
};
if (!showingInstructions){
if (TestIngameButtons() == false){
if (MouseControl.buttonPressed){
if (TestMousePressMovingNozzleSlider() == false){
InitObjectAtMouse();
};
};
};
};
if (canShootPellet == true){
UpdateHoseBubbles(MouseControl.buttonPressed);
};
if (LevelUpdateCallback != null){
LevelUpdateCallback();
};
_local1 = 1;
if (usedebug){
if (KeyReader.Pressed(KeyReader.KEY_1)){
Debug.debugMode = (Debug.debugMode ^ 1);
};
if (KeyReader.Pressed(KeyReader.KEY_2)){
Debug.debugMode = (Debug.debugMode ^ 2);
};
if (KeyReader.Pressed(KeyReader.KEY_3)){
Debug.debugMode = (Debug.debugMode ^ 4);
};
if (KeyReader.Pressed(KeyReader.KEY_4)){
Debug.debugMode = (Debug.debugMode ^ 8);
};
if (KeyReader.Down(KeyReader.KEY_5)){
_local1 = 5;
};
if (KeyReader.Down(KeyReader.KEY_6)){
_local1 = 20;
};
if (KeyReader.Pressed(KeyReader.KEY_9)){
currentLevel++;
if (currentLevel >= (levels.length - 1)){
currentLevel = 0;
};
StartLevelPlay();
};
if (KeyReader.Pressed(KeyReader.KEY_8)){
currentLevel--;
if (currentLevel < 0){
currentLevel = (levels.length - 1);
};
StartLevelPlay();
};
};
if (levelFinishedState == levelFinishedState_WON){
};
if (levelFinishedState == levelFinishedState_LOST){
};
if (levelState == levelState_LevelStart){
};
_local2 = 0;
while (_local2 < _local1) {
levelTimer++;
if (levelState == levelState_Play){
UpdateMouseControl();
if (mouseJoint != null){
mouseJoint.SetTarget(new b2Vec2((cursorX * w2p), ((cursorY + 20) * w2p)));
};
};
deadFlag = false;
numCollisionTests = 0;
world.Step((1 / Defs.fps), physNumIterations);
UpdateGOsFromPhysics();
MakeBallList();
if (levelState == levelState_Play){
GameObjects.Update();
};
Particles.Update(1);
if (levelState == levelState_Play){
countupTimer++;
countdownTimer1--;
if (countdownTimer1 <= 0){
countdownTimer1 = Defs.fps;
countdownTimer0--;
if (countdownTimer0 <= 0){
countdownTimer0 = 0;
CalcLevelEndResults(false);
SaveData.Save();
WriteKongStats();
TitleScreenState.InitEndLevelScreen(false);
};
};
};
_local2++;
};
for each (_local3 in physObjInstances.list) {
if (_local3.timer != 0){
_local3.timer++;
if (_local3.timer >= 5){
if (_local3.collideFunction != null){
_local3.collideFunction(_local3);
};
};
};
};
if (numBallsHome >= numBallsHomeNeeded){
SoundPlayer.Play("sfx_bling");
_local4 = GetCurrentLevelResult();
if (_local4.complete == false){
UnlockNextLockedLevel();
UnlockNextLockedLevel();
};
CalcLevelEndResults(true);
SaveData.Save();
WriteKongStats();
TitleScreenState.InitEndLevelScreen(true);
};
}
static function GetCurrentLevelResult():LevelResult{
return (levelResults[currentLevel]);
}
public static function InitLevel(){
ExternalData.Load(InitLevel1);
}
static function InitHoseBubbles(){
var _local1:int;
var _local2:HoseBubble;
hoseBubbles = new Array();
_local1 = 0;
while (_local1 < 20) {
_local2 = new HoseBubble();
_local2.position = Utils.RandBetweenFloat(0, 1);
_local2.alpha = 0;
_local2.maxalpha = Utils.RandBetweenFloat(0.6, 1);
_local2.maxvelocity = Utils.RandBetweenFloat(0.01, 0.04);
_local2.frame = Utils.RandBetweenInt(0, (GraphicObjects.GetNumFrames(GraphicObjects.gfx_hosespline) - 1));
_local2.velocity = 0;
hoseBubbles.push(_local2);
_local1++;
};
}
public static function StartLevelPlay2():void{
var _local1:Level;
KeyReader.InitOnce(main.stage);
main.InitStageForGame();
_local1 = GetCurrentLevel();
Particles.Reset();
Game.main.effectsScreenBD.fillRect(Defs.screenRect, 0);
InitBox2D();
mouseJoint = null;
initHopperIndex = 0;
nextHopperIndex = 0;
GameObjects.ClearAll();
physObjInstances = new PhysObj_Instances();
InitLevelPlayFromEditorObjects();
AddPhysObjAt("screenborder", 0, 0, 0, "border");
AddPhysObjAt("hose", 320, 50, 0, "border");
InitLevelState(levelState_Play);
countdownTimer0 = int(Math.floor(_local1.time));
countdownTimer1 = Defs.fps;
countupTimer = 0;
numBallsHome = 0;
numBallsHomeNeeded = _local1.quota;
numBallsActive = 0;
numBallsKilled = 0;
nextBallType = 0;
nextBallTypeIndex = 0;
InitHoseBubbles();
bgFrame = ((currentLevel / 3) % 12);
collectedBonus = false;
pause = false;
pauseGameplayInput = false;
Mouse.hide();
InitLevelInstructions();
}
public static function GetPolyByName(_arg1:String):Poly{
var _local2:Poly;
for each (_local2 in polygonList) {
if (((_local2.active) && ((_local2.name == _arg1)))){
return (_local2);
};
};
return (null);
}
static function GetLastStartPoint(_arg1:Number):Point{
var _local2:Point;
var _local3:Point;
var _local4:Number;
_local2 = startPoints[0];
_local4 = -1000;
for each (_local3 in startPoints) {
if (_local3.x < _arg1){
if (_local3.x > _local4){
_local4 = _local3.x;
_local2 = _local3;
};
};
};
return (_local2);
}
static function CreatePhysObjInstanceAt(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:String=""):PhysObj_Instance{
var _local6:PhysObj_Instance;
_local6 = new PhysObj_Instance();
_local6.typeName = _arg1;
_local6.x = _arg2;
_local6.y = _arg3;
_local6.rot = _arg4;
_local6.bodies = new Array();
_local6.instanceName = _arg5;
return (_local6);
}
static function GetNumLibraryPages():int{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
_local1 = (boxNumW * boxNumH);
_local2 = physObjs.GetNum();
_local3 = (_local2 / _local1);
_local4 = (_local2 % _local1);
if (_local4 != 0){
_local3++;
};
return (_local3);
}
static function RenderHose(){
var _local1:Point;
var _local2:Array;
var _local3:Number;
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:GameObj;
var _local10:Poly;
var _local11:Number;
var _local12:HoseBubble;
var _local13:Number;
var _local14:Number;
_local2 = new Array();
_local3 = 40;
_local4 = 0;
_local5 = MouseControl.mousePosX;
_local6 = MouseControl.mousePosY;
_local7 = 0;
_local8 = 0;
for each (_local9 in GameObjects.objs) {
if (((_local9.active) && (_local9.colFlag_isHose))){
_local7 = (_local9.xpos - _local5);
_local8 = (_local9.ypos - _local6);
break;
};
};
for each (_local9 in GameObjects.objs) {
if (((_local9.active) && (_local9.colFlag_isHose))){
_local13 = (_local9.xpos - _local7);
_local14 = (_local9.ypos - _local8);
if (_local4 == 0){
_local2.push(new Point(_local13, (_local14 + 2)));
_local2.push(new Point(_local13, (_local14 + 8)));
};
_local2.push(new Point(_local13, (_local14 + _local3)));
_local4++;
};
};
_local10 = Poly.MakeSplineFromPointList(_local2);
main.hoseScreenMC.graphics.clear();
main.hoseScreenMC.graphics.lineStyle(11, 4283457744, 0.25, false, LineScaleMode.NORMAL, CapsStyle.SQUARE);
_local1 = _local10.GetPointOnCatmullRom(0);
main.hoseScreenMC.graphics.moveTo(_local1.x, _local1.y);
_local11 = 0;
while (_local11 < 1) {
_local1 = _local10.GetPointOnCatmullRom(_local11);
main.hoseScreenMC.graphics.lineTo(_local1.x, _local1.y);
_local11 = (_local11 + 0.02);
};
for each (_local12 in hoseBubbles) {
_local1 = _local10.GetPointOnCatmullRom((1 - _local12.position));
GraphicObjects.RenderAtAlpha(GraphicObjects.gfx_hosespline, _local12.frame, main.screenBD, _local1.x, _local1.y, _local12.alpha);
};
}
static function AddBallAt(_arg1:int, _arg2:Number, _arg3:Number){
var _local4:b2BodyDef;
var _local5:b2Body;
var _local6:b2PolygonDef;
var _local7:int;
var _local8:b2MassData;
var _local9:b2CircleDef;
_local4 = new b2BodyDef();
_local4.position.Set((_arg2 * w2p), (_arg3 * w2p));
_local5 = world.CreateBody(_local4);
_local9 = new b2CircleDef();
_local9.radius = 1;
_local9.density = 1;
_local9.friction = 0.5;
_local9.restitution = 0;
_local9.filter.groupIndex = -1;
_local5.CreateShape(_local9);
_local5.SetUserData(InitPhysicsGO(null, GraphicObjects.gfx_blockbits, 10, 1000));
_local8 = new b2MassData();
_local8.center = new b2Vec2(0, 0);
_local8.I = 1;
_local8.mass = 0.1;
_local5.SetMass(_local8);
}
public static function ExportLevelAsXml(){
var _local1:Level;
var _local2:int;
var _local3:PhysObj_Instance;
_local1 = GetCurrentLevel();
trace((((((((((((((("<level name=\"" + _local1.name) + "\" category=\"") + _local1.category.toString()) + "\" frequency=\"") + _local1.frequency) + "\" max=\"") + _local1.maxballsactive) + "\" quota=\"") + _local1.quota) + "\" time=\"") + _local1.time) + "\" balltypes=\"") + _local1.ballTypesString) + "\" >"));
for each (_local2 in _local1.helpscreenFrames) {
trace((("<helpscreen frame=\"" + _local2) + "\" />"));
};
level_instances = GetCurrentLevelInstances();
for each (_local3 in level_instances) {
trace((((((((("<obj type=\"" + _local3.typeName) + "\" x=\"") + _local3.x) + "\" y=\"") + _local3.y) + "\" rot=\"") + _local3.rot) + "\" />"));
};
trace("</level>");
}
public static function ShowSign(_arg1:int){
if (showingOverlay){
return;
};
showingOverlay = true;
showingOverlayID = _arg1;
}
public static function InitLevel1(_arg1:XML){
LoadLevels();
InitLevelResults();
SaveData.Load();
CalculateTotalScore();
WriteKongStats();
currentLevel = 0;
currentLevel = FindHighestAvailableLevel();
InitLevel2();
}
public static function InitLevel2(){
var _local1:GameObj;
KeyReader.InitOnce(main.stage);
Particles.Reset();
ObjectDefs.Init();
GameObjects.ClearAll();
levelFinishedState = levelFinishedState_NOT;
scrollX = 0;
scrollY = 0;
LevelUpdateCallback = null;
scrollW = 10000;
scrollH = 1000;
scrollMaxX = (scrollW - Defs.displayarea_w);
scrollMaxY = (scrollH - Defs.displayarea_h);
gravity = 0.2;
maxFallSpeed = 6;
showingOverlay = false;
showingOverlayID = 0;
invincibleTimer = 0;
invincibleTimerMax = (Defs.fps * 10);
speedupTimer = 0;
speedupTimerMax = (Defs.fps * 10);
numWeenies = 0;
numCreds = 0;
dibsSpeechFlag = false;
dibsSpeechTimer = 0;
firstTime_Powerup1 = false;
firstTime_Powerup2 = false;
firstTime_Powerup3 = false;
firstTime_Powerup4 = false;
Game.main.effectsScreenBD.fillRect(Defs.screenRect, 0);
bossGO = null;
totalBlimps = 0;
numBlimps = 0;
polygonList = new Array();
startPoints = new Array();
squelchSfxTimer = 0;
InitBox2D();
levelTimer = 0;
physObjs = new PhysObjs();
physObjs.InitFromXml(ExternalData.xml);
scrollAcc = 0.01;
scrollVel = 0;
scrollMaxVel = 2;
physObjInstances = new PhysObj_Instances();
pause = false;
StartLevelPlay();
}
public static function RemoveObj_BallInWrongHopper(_arg1:PhysObj_Instance){
physObjInstances.Remove(_arg1);
numBallsActive--;
numBallsKilled++;
numBallsHome--;
if (numBallsHome <= 0){
numBallsHome = 0;
};
SoundPlayer.PlayRandomBetween("sfx_scream1", "sfx_scream3");
}
static function UpdateMouseControl(){
var _local1:Number;
var _local2:Number;
_local1 = cursorX;
_local2 = cursorY;
cursorX = (cursorX + ((MouseControl.mousePosX - cursorX) * 0.4));
cursorY = (cursorY + ((MouseControl.mousePosY - cursorY) * 0.4));
}
public static function RenderPhysObjAt(_arg1:PhysObj, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:BitmapData){
var _local6:Number;
var _local7:Number;
var _local8:PhysObj_Body;
var _local9:PhysObj_Graphic;
var _local10:Point;
var _local11:Matrix;
var _local12:Number;
_local6 = _arg2;
_local7 = _arg3;
for each (_local8 in _arg1.bodies) {
for each (_local9 in _local8.graphics) {
_local10 = new Point((_local8.pos.x + _local9.offset.x), (_local8.pos.y + _local9.offset.y));
_local11 = new Matrix();
_local11.rotate(Utils.DegToRad(_arg4));
_local10 = _local11.transformPoint(_local10);
_local6 = (_arg2 + _local10.x);
_local7 = (_arg3 + _local10.y);
_local12 = Utils.DegToRad((_arg4 + _local9.rot));
GraphicObjects.RenderAtRotScaled(_local9.graphicID, _local9.frame, _arg5, _local6, _local7, false, 1, _local12);
};
};
}
static function Library_PickPiece(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
_local1 = MouseControl.mousePosX;
_local2 = MouseControl.mousePosY;
_local3 = (_local1 / boxSizeW);
_local4 = (_local2 / boxSizeH);
_local5 = (_local3 + (_local4 * boxNumW));
_local6 = (boxNumW * boxNumH);
_local5 = (_local5 + (library_page * _local6));
_local7 = (physObjs.GetNum() - 1);
if (_local5 > _local7){
_local5 = _local7;
};
editor_currentPiece = _local5;
editor_currentPieceRot = 0;
}
public static function AddScore(_arg1:int):void{
currentScore = (currentScore + (_arg1 * multiplier));
}
static function GetJointXml(_arg1:XML, _arg2:String):XML{
var _local3:int;
var _local4:XML;
_local3 = 0;
while (_local3 < _arg1.joint.length()) {
_local4 = _arg1.joint[_local3];
if (_local4.@name == _arg2){
return (_local4);
};
_local3++;
};
return (null);
}
public static function RemoveGO(_arg1:String){
var _local2:GameObj;
_local2 = GetGOByName(_arg1);
if (_local2){
_local2.active = false;
};
}
static function ExamineBox2D():void{
var _local1:int;
var _local2:b2Body;
var _local3:b2Vec2;
return;
}
static function InitObjectAtMouse():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:PhysObj_Instance;
var _local5:PhysObj_Instance;
var _local6:*;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Body;
var _local11:b2Shape;
canShootPellet = true;
_local1 = MouseControl.mousePosX;
_local2 = (MouseControl.mousePosY - 10);
if (mousetimer > 0){
mousetimer--;
return;
};
mousetimer = 0;
_local3 = _local2;
for each (_local4 in level_instances) {
if (_local4.typeName == "guard_100x100"){
if ((((_local1 >= _local4.x)) && ((_local1 <= (_local4.x + 102))))){
if ((((_local3 >= _local4.y)) && ((_local3 <= (_local4.y + 102))))){
canShootPellet = false;
return;
};
};
};
};
zsortoffset = 0;
_local5 = AddPhysObjAt("pellet", _local1, _local2, 0, "");
_local6 = Utils.DegToRad(nozzleSpreadAng);
_local7 = Utils.RandBetweenFloat(-(_local6), _local6);
_local7 = (_local7 - (Math.PI / 2));
_local8 = (Math.cos(_local7) * 60);
_local9 = (Math.sin(_local7) * 60);
_local5.SetLinearVelocity(_local8, _local9);
for each (_local10 in _local5.bodies) {
_local11 = _local10.GetShapeList();
_local11.SetUserData(_local5);
};
}
public static function StartLevelPlay(_arg1:Boolean=true):void{
pause = true;
if (_arg1){
TitleScreenState.InitLevelSelectScreen();
} else {
StartLevelPlay2();
};
}
public static function RemoveObj_BallDie_Splash(_arg1:PhysObj_Instance){
var _local2:b2Body;
var _local3:Number;
var _local4:Number;
var _local5:int;
var _local6:Particle;
_local2 = _arg1.bodies[0];
_local3 = (_local2.GetPosition().x * p2w);
_local4 = (_local2.GetPosition().y * p2w);
_local5 = 0;
while (_local5 < 10) {
_local6 = Particles.Add(_local3, _local4);
_local6.InitWater();
_local5++;
};
physObjInstances.Remove(_arg1);
numBallsActive--;
numBallsKilled++;
SoundPlayer.PlayRandomBetween("sfx_scream1", "sfx_scream3");
SoundPlayer.Play("sfx_watersplash");
}
static function InitFloor(){
var _local1:b2BodyDef;
var _local2:b2Body;
var _local3:b2PolygonDef;
var _local4:Poly;
var _local5:int;
var _local6:Array;
var _local7:Array;
var _local8:int;
var _local9:int;
var _local10:Number;
var _local11:int;
var _local12:Line;
var _local13:b2Vec2;
var _local14:b2Vec2;
var _local15:b2Vec2;
var _local16:b2Vec2;
for each (_local4 in polygonList) {
_local5 = _local4.GetNumPoints();
_local6 = _local4.pointList;
_local7 = _local4.lineList;
_local8 = _local7.length;
_local9 = 0;
_local10 = 3;
_local11 = 0;
for each (_local12 in _local4.lineList) {
_local13 = new b2Vec2(_local12.x0, _local12.y0);
_local14 = new b2Vec2(_local12.x1, _local12.y1);
_local15 = new b2Vec2((_local12.x1 - (_local12.nx * _local10)), (_local12.y1 - (_local12.ny * _local10)));
_local16 = new b2Vec2((_local12.x0 - (_local12.nx * _local10)), (_local12.y0 - (_local12.ny * _local10)));
_local1 = new b2BodyDef();
_local1.position.Set(0, 0);
_local2 = world.CreateBody(_local1);
_local3 = new b2PolygonDef();
_local3.vertexCount = 4;
_local3.vertices[0].Set((_local13.x * w2p), (_local13.y * w2p));
_local3.vertices[1].Set((_local14.x * w2p), (_local14.y * w2p));
_local3.vertices[2].Set((_local15.x * w2p), (_local15.y * w2p));
_local3.vertices[3].Set((_local16.x * w2p), (_local16.y * w2p));
_local3.friction = x.friction.@floor;
_local3.restitution = 0;
_local3.density = 1;
_local2.CreateShape(_local3);
_local2.SetUserData(-1);
_local9++;
};
};
}
public static function InitLevelState(_arg1:int){
levelState = _arg1;
levelStateTimer = 0;
if (levelState == levelState_LevelStart){
};
if (levelState == levelState_Play){
};
if (levelState == levelState_Editor){
InitEditor();
};
}
public static function InitEditor():void{
Mouse.show();
InitBox2D();
Game.main.effectsScreenBD.fillRect(Defs.screenRect, 0);
GameObjects.ClearAll();
}
public static function RemoveObj_Gem(_arg1:PhysObj_Instance){
SoundPlayer.Play("sfx_bling");
physObjInstances.Remove(_arg1);
collectedBonus = true;
}
public static function InitLevelPlayFromEditorObjects(){
var _local1:PhysObj_Instance;
zsortoffset = 0;
level_instances = GetCurrentLevelInstances();
for each (_local1 in level_instances) {
AddPhysObjAt(_local1.typeName, _local1.x, _local1.y, _local1.rot, _local1.instanceName);
zsortoffset = (zsortoffset + 0.01);
};
}
public static function HitTestPhysObjGraphics(_arg1:Number, _arg2:Number):PhysObj_Instance{
var _local3:PhysObj_Instance;
var _local4:BitmapData;
var _local5:PhysObj;
var _local6:uint;
level_instances = GetCurrentLevelInstances();
for each (_local3 in level_instances) {
_local4 = main.screenBD;
_local4.fillRect(Defs.screenRect, 0);
_local5 = physObjs.FindByName(_local3.typeName);
RenderPhysObjAt(_local5, _local3.x, _local3.y, _local3.rot, _local4);
_local6 = _local4.getPixel32(_arg1, _arg2);
if (_local6 != 0){
return (_local3);
};
};
return (null);
}
static function UpdateGOsFromPhysics():void{
var _local1:Number;
var _local2:GameObj;
var _local3:b2Body;
var _local4:PhysObj_BodyUserData;
var _local5:int;
var _local6:b2Vec2;
var _local7:Number;
_local1 = p2w;
_local3 = world.GetBodyList();
while (_local3) {
_local4 = (_local3.GetUserData() as PhysObj_BodyUserData);
if (_local4 != null){
_local5 = _local4.gameObjectID;
if (_local5 != -1){
_local6 = _local3.GetPosition();
_local7 = _local3.GetAngle();
_local2 = GameObjects.objs[_local5];
_local2.xpos = ((_local6.x * _local1) + _local2.physObjOffsetX);
_local2.ypos = ((_local6.y * _local1) + _local2.physObjOffsetY);
_local2.dir = _local7;
};
};
_local3 = _local3.GetNext();
};
}
static function XmlLoaded(_arg1:XML){
}
static function Editor_RenderObjects_AdjustMode(){
var _local1:BitmapData;
var _local2:PhysObj_Instance;
var _local3:PhysObj;
level_instances = GetCurrentLevelInstances();
_local1 = main.screenBD;
for each (_local2 in level_instances) {
_local3 = physObjs.FindByName(_local2.typeName);
if (_local2 == currentAdjustObject){
if ((levelTimer & 2)){
RenderPhysObjAt(_local3, _local2.x, _local2.y, _local2.rot, _local1);
};
} else {
RenderPhysObjAt(_local3, _local2.x, _local2.y, _local2.rot, _local1);
};
};
}
public static function ExportAllLevelsAsXml(){
var _local1:int;
var _local2:int;
_local2 = currentLevel;
_local1 = 0;
while (_local1 < levels.length) {
currentLevel = _local1;
ExportLevelAsXml();
_local1++;
};
currentLevel = _local2;
}
static function buttonRestartPressed(){
StartLevelPlay(false);
}
public static function RemovePoly(_arg1:String){
var _local2:Poly;
_local2 = GetPolyByName(_arg1);
if (_local2){
_local2.active = false;
};
}
static function UpdateHoseBubbles(_arg1:Boolean){
var _local2:HoseBubble;
for each (_local2 in hoseBubbles) {
if (_arg1){
_local2.velocity = (_local2.velocity + 0.002);
if (_local2.velocity > _local2.maxvelocity){
_local2.velocity = _local2.maxvelocity;
};
_local2.position = (_local2.position + _local2.velocity);
_local2.alpha = (_local2.alpha + 0.1);
if (_local2.alpha > _local2.maxalpha){
_local2.alpha = _local2.maxalpha;
};
} else {
_local2.velocity = (_local2.velocity - 0.002);
if (_local2.velocity < 0){
_local2.velocity = 0;
};
_local2.position = (_local2.position + _local2.velocity);
_local2.alpha = (_local2.alpha - 0.1);
if (_local2.alpha < 0){
_local2.alpha = 0;
};
};
if (_local2.position >= 0.9){
_local2.position = 0;
_local2.maxalpha = Utils.RandBetweenFloat(0.3, 1);
_local2.maxvelocity = Utils.RandBetweenFloat(0.01, 0.04);
_local2.frame = Utils.RandBetweenInt(0, (GraphicObjects.GetNumFrames(GraphicObjects.gfx_hosespline) - 1));
};
};
}
static function RenderEditor(){
var _local1:int;
var _local2:int;
var _local3:Number;
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:PhysObj;
var _local15:PhysObj;
_local5 = MouseControl.mousePosX;
_local6 = MouseControl.mousePosY;
if (editMode == editMode_Commands){
main.screenBD.fillRect(Defs.screenRect, 4285542576);
};
if (editMode == editMode_Library){
main.screenBD.fillRect(Defs.screenRect, 4284498112);
_local7 = 0;
_local8 = 0;
_local7 = 0;
while (_local7 < Defs.displayarea_w) {
Utils.RenderDotLine(main.screenBD, _local7, 0, _local7, 640, 100, 4282433600);
_local7 = (_local7 + boxSizeW);
};
_local7 = 0;
while (_local7 < Defs.displayarea_h) {
Utils.RenderDotLine(main.screenBD, 0, _local7, 640, _local7, 100, 4282433600);
_local7 = (_local7 + boxSizeH);
};
_local9 = (boxNumW * boxNumH);
_local10 = (library_page * _local9);
_local11 = (_local10 + (_local9 - 1));
_local7 = 0;
_local8 = 0;
_local12 = physObjs.GetNum();
_local13 = 0;
for each (_local14 in physObjs.list) {
if ((((_local13 >= _local10)) && ((_local13 <= _local11)))){
RenderPhysObjAt(_local14, (_local7 + (boxSizeW / 2)), (_local8 + (boxSizeH / 2)), 0, main.screenBD);
_local4 = _local14.name;
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, (_local7 + 8), ((_local8 + boxSizeH) - 16), _local4, null);
_local7 = (_local7 + boxSizeW);
if (_local7 >= Defs.displayarea_w){
_local7 = 0;
_local8 = (_local8 + boxSizeH);
};
};
_local13++;
};
};
if (editMode == editMode_Eraser){
main.screenBD.fillRect(Defs.screenRect, 4283453632);
Editor_RenderObjects();
};
if (editMode == editMode_Normal){
main.screenBD.fillRect(Defs.screenRect, 4282409152);
Editor_RenderObjects();
_local15 = physObjs.GetByIndex(editor_currentPiece);
RenderPhysObjAt(_local15, _local5, _local6, editor_currentPieceRot, main.screenBD);
};
if (editMode == editMode_Adjust){
main.screenBD.fillRect(Defs.screenRect, 4282409152);
Editor_RenderObjects_AdjustMode();
};
RenderPanel_Editor();
}
static function InitPhysicsFloorGO(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number):int{
var _local5:GameObj;
_local5 = GameObjects.AddObj(_arg2, _arg3, 1000);
_local5.InitPhysicsFloorObject(_arg1, _arg4);
return (GameObjects.lastGenIndex);
}
static function GetBodyXml(_arg1:XML, _arg2:String):XML{
var _local3:int;
var _local4:XML;
_local3 = 0;
while (_local3 < _arg1.body.length()) {
_local4 = _arg1.body[_local3];
if (_local4.@name == _arg2){
return (_local4);
};
_local3++;
};
return (null);
}
static function RenderPanel_Editor(){
var _local1:Number;
var _local2:Number;
var _local3:String;
if (editMode == editMode_Commands){
_local3 = "Editor: Mode = Commands";
_local1 = 10;
_local2 = 10;
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local1 = 500;
_local2 = 10;
_local3 = "1: Erase Level";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "2: Add New Level (at end)";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "4: Export current level";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "5: Export all levels";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "0: Cancel";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
return;
};
_local3 = "Editor: Mode = ";
if (editMode == editMode_Normal){
_local3 = (_local3 + "Placement");
};
if (editMode == editMode_Library){
_local3 = (_local3 + ((("Library Page " + int((library_page + 1)).toString()) + " / ") + int(GetNumLibraryPages()).toString()));
};
if (editMode == editMode_Eraser){
_local3 = (_local3 + "Eraser");
};
if (editMode == editMode_Adjust){
_local3 = (_local3 + "Adjust");
};
_local1 = 10;
_local2 = 10;
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
if (editMode == editMode_Adjust){
_local3 = "Arrows: Move Piece";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "6: Rotate Left";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "7: Rotate Right";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
};
_local1 = 350;
_local3 = ("Level=" + currentLevel.toString());
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local1 = 500;
_local2 = 10;
_local3 = "1: Place Pieces";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "2: Library (cycle)";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "3: Eraser";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "4: Commands";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "5: Adjust Placement";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "8: Prev Level";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "9: Next Level";
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
}
public static function buttonOverlayClosedPressed(_arg1:MouseEvent){
Overlay_Remove();
InitLevelState(levelState_Play);
}
public static function InitLevelResults(){
var _local1:int;
levelResults = new Array();
_local1 = 0;
while (_local1 < 100) {
levelResults.push(new LevelResult());
_local1++;
};
levelResults[0].locked = false;
}
public static function Init(_arg1:Main){
main = _arg1;
currentScore = 0;
multiplier = 1;
numLevels = 8;
currentLevel = 0;
}
public static function GetNextPiece():int{
return (0);
}
static function buttonMutePressed(){
MusicPlayer.ToggleMute();
SoundPlayer.ToggleMute();
}
static function buttonMenuPressed(){
StartLevelPlay(true);
}
public static function InitGame(){
Debug.debugMode = 0;
numLives = 3;
Shop.InitOnce();
polygonList = new Array();
startPoints = new Array();
startPointObjs = new Array();
currentStartPointIndex = 0;
currentLevel = 0;
WaveDefs.InitOnce();
pause = true;
editMode = 0;
numBallsActive = 0;
}
static function RenderBox2D():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:b2Body;
var _local6:b2Shape;
var _local7:b2Vec2;
var _local8:Number;
var _local9:*;
var _local10:b2PolygonShape;
var _local11:Array;
var _local12:int;
var _local13:int;
var _local14:b2Vec2;
var _local15:b2Vec2;
var _local16:Matrix;
var _local17:Point;
var _local18:Point;
var _local19:b2CircleShape;
var _local20:Number;
if (Debug.IsSet(1) == false){
return;
};
_local1 = scrollX;
_local2 = scrollY;
_local3 = p2w;
_local5 = world.GetBodyList();
while (_local5) {
_local7 = _local5.GetPosition();
_local8 = _local5.GetAngle();
_local6 = _local5.GetShapeList();
while (_local6) {
_local9 = _local6.GetType();
if (_local9 == b2Shape.e_polygonShape){
_local10 = b2PolygonShape(_local6);
_local11 = _local10.GetVertices();
_local12 = _local10.GetVertexCount();
_local4 = 0;
while (_local4 < _local12) {
_local13 = (_local4 + 1);
if (_local13 >= _local12){
_local13 = 0;
};
_local14 = _local11[_local4].Copy();
_local15 = _local11[_local13].Copy();
_local16 = new Matrix();
_local16.rotate(_local8);
_local17 = new Point(_local14.x, _local14.y);
_local18 = new Point(_local15.x, _local15.y);
_local17 = _local16.transformPoint(_local17);
_local18 = _local16.transformPoint(_local18);
_local14.x = _local17.x;
_local14.y = _local17.y;
_local15.x = _local18.x;
_local15.y = _local18.y;
_local14.Add(_local7);
_local15.Add(_local7);
Utils.RenderDotLine(main.screenBD, ((_local14.x * _local3) - _local1), ((_local14.y * _local3) - _local2), ((_local15.x * _local3) - _local1), ((_local15.y * _local3) - _local2), 50, 4294967295);
_local4++;
};
};
if (_local9 == b2Shape.e_circleShape){
_local19 = b2CircleShape(_local6);
_local20 = (_local19.GetRadius() * _local3);
Utils.RenderCircle(main.screenBD, ((_local7.x * _local3) - _local1), ((_local7.y * _local3) - _local2), _local20, 4294967295);
};
_local6 = _local6.GetNext();
};
_local5 = _local5.GetNext();
};
}
public static function Editor_ClearLevel():void{
level_instances = GetCurrentLevelInstances();
level_instances = new Array();
levels[currentLevel].instances = level_instances;
}
static function instructionsContinuePressed(_arg1:MouseEvent){
var _local2:Level;
_local2 = GetCurrentLevel();
instructionIndex++;
if (instructionIndex > _local2.helpscreenFrames.length){
pauseGameplayInput = false;
instructionsMC.gotoAndPlay("stop");
InitLevelState(levelState_Play);
Mouse.hide();
showingInstructions = false;
} else {
instructionsMC.inner.gotoAndStop(_local2.helpscreenFrames[instructionIndex]);
instructionsMC.inner.buttonContinue.visible = false;
if (_local2.helpscreenFrames.length > (instructionIndex + 1)){
instructionsMC.inner.buttonContinue.visible = true;
};
instructionsMC.inner.buttonDone.visible = (instructionsMC.inner.buttonContinue.visible == false);
};
}
public static function RemoveObj_BallDie(_arg1:PhysObj_Instance){
physObjInstances.Remove(_arg1);
numBallsActive--;
numBallsKilled++;
SoundPlayer.PlayRandomBetween("sfx_scream1", "sfx_scream3");
}
static function TestIngameButtons():Boolean{
var _local1:Number;
var _local2:Number;
_local1 = MouseControl.mousePosX;
_local2 = MouseControl.mousePosY;
if (MouseControl.buttonReleased == false){
return (false);
};
MouseControl.buttonReleased = false;
if (_local2 < (Defs.displayarea_h - 20)){
return (false);
};
if (_local1 > (Defs.displayarea_w - 30)){
buttonMutePressed();
return (true);
};
if (_local1 > (Defs.displayarea_w - 97)){
buttonRestartPressed();
return (true);
};
if (_local1 > (Defs.displayarea_w - 165)){
buttonMenuPressed();
return (true);
};
return (false);
}
static function Editor_RenderObjects(){
var _local1:BitmapData;
var _local2:PhysObj_Instance;
var _local3:PhysObj;
level_instances = GetCurrentLevelInstances();
_local1 = main.screenBD;
for each (_local2 in level_instances) {
_local3 = physObjs.FindByName(_local2.typeName);
RenderPhysObjAt(_local3, _local2.x, _local2.y, _local2.rot, _local1);
};
}
static function instructionsClosePressed(_arg1:MouseEvent){
pauseGameplayInput = false;
instructionsMC.gotoAndPlay("stop");
InitLevelState(levelState_Play);
Mouse.hide();
showingInstructions = false;
}
static function InitHeightMap(){
var _local1:int;
var _local2:Number;
heightMap = new Array();
_local1 = 0;
while (_local1 < scrollW) {
_local2 = Collision.FindHighestFloorPos(_local1);
heightMap.push(_local2);
_local1++;
};
}
public static function InitDibsSpeech(_arg1:int){
}
public static function MakeBallList(){
var _local1:GameObj;
ballList = new Array();
for each (_local1 in GameObjects.objs) {
if (((_local1.active) && (_local1.colFlag_isBall))){
ballList.push(_local1);
};
};
}
static function RemoveFromLevelInstances(_arg1:PhysObj_Instance){
var _local2:Array;
var _local3:PhysObj_Instance;
level_instances = GetCurrentLevelInstances();
_local2 = new Array();
for each (_local3 in level_instances) {
if (_local3 == _arg1){
} else {
_local2.push(_local3);
};
};
level_instances = _local2;
levels[currentLevel].instances = level_instances;
}
public static function GetGOFrame(_arg1:String):int{
var _local2:GameObj;
_local2 = GetGOByName(_arg1);
if (_local2){
return (int(_local2.frame));
};
return (-1);
}
public static function Editor_PreviousLevel():void{
currentLevel--;
if (currentLevel < 0){
currentLevel = 0;
};
}
public static function Overlay_Remove(){
if (overlayMC != null){
main.removeChild(overlayMC);
overlayMC = null;
KeyReader.InitOnce(main.stage);
};
}
static function GetCurrentLevelInstances():Array{
return (levels[currentLevel].instances);
}
static function CalculateTotalScore(){
var _local1:int;
var _local2:Level;
var _local3:LevelResult;
currentScore = 0;
_local1 = 0;
for each (_local2 in levels) {
_local3 = levelResults[_local1];
if (_local3.complete){
currentScore = (currentScore + _local3.bestScore);
};
_local1++;
};
}
public static function WriteKongStats(){
var _local1:int;
var _local2:int;
var _local3:LevelResult;
Kong.SubmitScore(currentScore, "Score");
for each (_local3 in levelResults) {
if (_local3.complete){
_local1++;
};
if (_local3.bonus){
_local2++;
};
};
Kong.SubmitStat(_local1, "NumLevelsComplete");
Kong.SubmitStat(_local2, "NumGems");
}
public static function FindHighestAvailableLevel():int{
var _local1:int;
var _local2:LevelResult;
_local1 = 1;
while (_local1 < levels.length) {
_local2 = levelResults[_local1];
if (_local2.locked == true){
return ((_local1 - 1));
};
_local1++;
};
return (0);
}
public static function UnlockNextLockedLevel(){
var _local1:int;
var _local2:LevelResult;
_local1 = 0;
while (_local1 < levels.length) {
_local2 = levelResults[_local1];
if (_local2.locked == true){
_local2.locked = false;
return;
};
_local1++;
};
}
public static function UpdateEditor():void{
var _local1:int;
var _local2:int;
var _local3:PhysObj;
var _local4:PhysObj_Instance;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:String;
levelTimer++;
_local1 = MouseControl.mousePosX;
_local2 = MouseControl.mousePosY;
if (editMode == editMode_Commands){
if (KeyReader.Pressed(KeyReader.KEY_1)){
Editor_ClearLevel();
editMode = prevEditMode;
};
if (KeyReader.Pressed(KeyReader.KEY_2)){
Editor_AddLevel();
editMode = prevEditMode;
};
if (KeyReader.Pressed(KeyReader.KEY_0)){
editMode = prevEditMode;
};
if (KeyReader.Pressed(KeyReader.KEY_4)){
ExportLevelAsXml();
editMode = prevEditMode;
};
if (KeyReader.Pressed(KeyReader.KEY_5)){
ExportAllLevelsAsXml();
editMode = prevEditMode;
};
return;
};
if (KeyReader.Pressed(KeyReader.KEY_8)){
Editor_PreviousLevel();
};
if (KeyReader.Pressed(KeyReader.KEY_9)){
Editor_NextLevel();
};
if (KeyReader.Pressed(KeyReader.KEY_SPACE)){
StartLevelPlay();
return;
};
if (KeyReader.Pressed(KeyReader.KEY_1)){
editMode = editMode_Normal;
};
if (KeyReader.Pressed(KeyReader.KEY_2)){
editMode = editMode_Library;
library_page++;
if (library_page >= GetNumLibraryPages()){
library_page = 0;
};
};
if (KeyReader.Pressed(KeyReader.KEY_3)){
editMode = editMode_Eraser;
};
if (KeyReader.Pressed(KeyReader.KEY_4)){
prevEditMode = editMode;
editMode = editMode_Commands;
};
if (KeyReader.Pressed(KeyReader.KEY_5)){
currentAdjustObject = null;
editMode = editMode_Adjust;
};
if (editMode == editMode_Library){
if (MouseControl.buttonPressed){
MouseControl.buttonPressed = false;
Library_PickPiece();
editMode = editMode_Normal;
};
return;
};
if (editMode == editMode_Eraser){
if (MouseControl.buttonPressed){
MouseControl.buttonPressed = false;
_local4 = HitTestPhysObjGraphics(_local1, _local2);
if (_local4){
RemoveFromLevelInstances(_local4);
};
};
return;
};
if (editMode == editMode_Adjust){
if (MouseControl.buttonPressed){
MouseControl.buttonPressed = false;
_local4 = HitTestPhysObjGraphics(_local1, _local2);
if (_local4){
currentAdjustObject = _local4;
} else {
currentAdjustObject = null;
};
};
if (currentAdjustObject != null){
_local5 = 1;
_local6 = 1;
_local7 = 0;
_local8 = 0;
_local9 = 0;
if (KeyReader.Down(KeyReader.KEY_LEFT)){
_local8 = -(_local5);
};
if (KeyReader.Down(KeyReader.KEY_RIGHT)){
_local8 = _local5;
};
if (KeyReader.Down(KeyReader.KEY_UP)){
_local9 = -(_local5);
};
if (KeyReader.Down(KeyReader.KEY_DOWN)){
_local9 = _local5;
};
currentAdjustObject.x = (currentAdjustObject.x + _local8);
currentAdjustObject.y = (currentAdjustObject.y + _local9);
if (KeyReader.Down(KeyReader.KEY_6)){
_local7 = -(_local6);
};
if (KeyReader.Down(KeyReader.KEY_7)){
_local7 = _local6;
};
currentAdjustObject.rot = (currentAdjustObject.rot + _local7);
};
return;
};
if (editMode == editMode_Normal){
if (KeyReader.Pressed(KeyReader.KEY_UP)){
editor_currentPiece++;
if (editor_currentPiece > (physObjs.GetNum() - 1)){
editor_currentPiece = 0;
};
};
if (KeyReader.Pressed(KeyReader.KEY_DOWN)){
editor_currentPiece--;
if (editor_currentPiece < 0){
editor_currentPiece = (physObjs.GetNum() - 1);
};
};
if (KeyReader.Down(KeyReader.KEY_LEFT)){
editor_currentPieceRot = (editor_currentPieceRot - 10);
};
if (KeyReader.Down(KeyReader.KEY_RIGHT)){
editor_currentPieceRot = (editor_currentPieceRot + 10);
};
_local3 = physObjs.GetByIndex(editor_currentPiece);
_local10 = _local3.name;
if (MouseControl.buttonPressed){
MouseControl.buttonPressed = false;
level_instances = GetCurrentLevelInstances();
level_instances.push(CreatePhysObjInstanceAt(_local10, _local1, _local2, editor_currentPieceRot, ""));
};
};
}
static function Render(){
var _local1:int;
var _local2:int;
var _local3:Number;
if (pause){
return;
};
if (levelState == levelState_Editor){
RenderEditor();
return;
};
main.effectsScreenBD.lock();
main.screenBD.lock();
main.effectsScreenBD.scroll(0, 3);
main.effectsScreenBD.applyFilter(main.effectsScreenBD, Defs.screenRect, Defs.pointZero, new BlurFilter(8, 8, 1));
GraphicObjects.RenderAt(GraphicObjects.gfx_backgrounds, bgFrame, main.screenBD, 0, 0);
GameObjects.Render();
if (!showingInstructions){
RenderHose();
};
Particles.Render(Game.main);
if (showingInstructions){
main.screenBD.applyFilter(main.screenBD, Defs.screenRect, Defs.pointZero, new BlurFilter(8, 8, 1));
};
main.screenBD.copyPixels(main.effectsScreenBD, Defs.screenRect, Defs.pointZero, null, null, true);
RenderPanel();
RenderBox2D();
main.effectsScreenBD.unlock();
main.screenBD.unlock();
}
public static function GetGOByName(_arg1:String):GameObj{
var _local2:GameObj;
for each (_local2 in GameObjects.objs) {
if (((_local2.active) && ((_local2.name == _arg1)))){
return (_local2);
};
};
return (null);
}
static function InitBallAt(_arg1:Number, _arg2:Number){
var _local3:PhysObj_Instance;
var _local4:Level;
zsortoffset = 0;
_local3 = AddPhysObjAt("ball", _arg1, _arg2, 0, "");
_local4 = GetCurrentLevel();
nextBallType = _local4.ballTypes[nextBallTypeIndex];
nextBallType--;
lastGeneratedGameObj.PostInitBall(nextBallType);
nextBallTypeIndex++;
if (nextBallTypeIndex >= _local4.ballTypes.length){
nextBallTypeIndex = 0;
};
SoundPlayer.Play("sfx_ballappear");
}
public static function RemoveObj_Pellet(_arg1:PhysObj_Instance){
var _local2:b2Body;
var _local3:Number;
var _local4:Number;
var _local5:int;
var _local6:Particle;
_local2 = _arg1.bodies[0];
_local3 = (_local2.GetPosition().x * p2w);
_local4 = (_local2.GetPosition().y * p2w);
_local5 = 0;
while (_local5 < 3) {
_local6 = Particles.Add(_local3, _local4);
_local6.InitWater();
_local5++;
};
physObjInstances.Remove(_arg1);
}
public static function Overlay_Show(_arg1:int){
}
public static function Editor_AddLevel():void{
var _local1:Level;
_local1 = new Level();
currentLevel = levels.length;
levels.push(_local1);
}
public static function RemoveObj_Standard(_arg1:PhysObj_Instance){
physObjInstances.Remove(_arg1);
}
static function InitLevelInstructions(){
var _local1:Level;
showingInstructions = false;
_local1 = GetCurrentLevel();
if (_local1.helpscreenFrames.length == 0){
InitLevelState(levelState_Play);
return;
};
Mouse.show();
showingInstructions = true;
instructionIndex = 0;
instructionsMC = new InstructionsScreen();
instructionsMC.inner.buttonContinue.addEventListener(MouseEvent.CLICK, instructionsContinuePressed, false, 0, true);
instructionsMC.inner.buttonClose.addEventListener(MouseEvent.CLICK, instructionsClosePressed, false, 0, true);
instructionsMC.inner.buttonDone.addEventListener(MouseEvent.CLICK, instructionsClosePressed, false, 0, true);
main.addChild(instructionsMC);
instructionsMC.inner.buttonContinue.visible = false;
instructionsMC.inner.buttonContinue.visible = false;
if (_local1.helpscreenFrames.length > (instructionIndex + 1)){
instructionsMC.inner.buttonContinue.visible = true;
};
instructionsMC.inner.buttonDone.visible = (instructionsMC.inner.buttonContinue.visible == false);
instructionsMC.visible = true;
instructionsMC.gotoAndPlay("start");
instructionsMC.inner.gotoAndStop(_local1.helpscreenFrames[instructionIndex]);
pauseGameplayInput = true;
InitLevelState(levelState_LevelStart);
}
public static function ExitDibsSpeech(){
}
public static function Editor_NextLevel():void{
currentLevel++;
if (currentLevel > (levels.length - 1)){
currentLevel = (levels.length - 1);
};
}
}
}//package
Section 120
//GameObj (GameObj)
package {
import flash.events.*;
import flash.geom.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class GameObj {
public var graphicID:int;
public var xvel:Number;
var path:Poly;
public var todir:Number;
var minFrame:int;
var rotVel:Number;
public var speed:Number;
public var colFlag_isEnemy:Boolean;
public var yoffset:Number;
var objectDef:ObjectDef;
var waveDef:WaveDef;
public var startx:Number;
public var ypos2:Number;
public var startz:Number;
public var colFlag_canBeShot:Boolean;
var health:Number;
public var starty:Number;
public var colFlag_playercanbekilled:Boolean;
public var frame1:Number;
public var movementVec:Vec;
var maxFrame:int;
var ct:ColorTransform;
public var visible:Boolean;
var ballstateTimer:int;
var eyelidframe:Number;
public var yvel:Number;
public var name:String;
public var dir:Number;
public var graphicID1:int;
public var radius:Number;
public var colFlag_canBePickedUp:Boolean;
public var colFlag_isPowerup:Boolean;
public var colFlag_isBullet:Boolean;
public var controlMode:int;
public var colFlag_isHose:Boolean;
public var colFlag_isCheckpoint:Boolean;
public var origspeed:Number;
var ballstate_otherGO:GameObj;
var uniqueID:int;
var EnemyUpdateFunctionCallback:Function;
var EnemyHitByBulletFunctionCallback:Function;
public var xpos2:Number;
public var colFlag_isPlatform:Boolean;
public var xpos:Number;
public var renderShadowFlag:Boolean;
public var zvel:Number;
var xflip:Boolean;
var currentPoly:Poly;
public var frameVel:Number;
public var colFlag_killPlayer:Boolean;
var currentWeapon:int;
var shotControllers:Array;
public var colFlag_isBall:Boolean;
var hopperIndex:int;
public var xacc:Number;
public var xoffset:Number;
public var active:Boolean;
public var count:int;
public var colFlag_jumpon:Boolean;
var blinkFrames:Array;
public var colFlag_isEnemyBullet:Boolean;
var flashTimer:int;
public var type:int;
public var ypos:Number;
var maxSpeed:Number;
public var timer:Number;
var pupilVec:Vec;
var scale:Number;
var alpha:Number;
public var yacc:Number;
var bulletTimer:int;
public var frame:Number;
public var hitTimer:Number;
public var controlIndex:int;
public var subtype:int;
var flashFlag:Boolean;
var nearestBall:GameObj;
public var oldxpos:Number;
public var timer1:Number;
public var renderFunction:Function;
public var zpos:Number;
public var toPosX:Number;
public var toPosY:Number;
public var colFlag_isBouncyPad:Boolean;
var dist:Number;
public var driveVec:Vec;
public var main:Main;
var playerWeapons:Array;
public var updateFunction:Function;
public var additive:Boolean;
var inFrontZone:Poly;
public var colFlag_isShop:Boolean;
var currentMaxSpeed:Number;
public var timerMax:Number;
public var physObjOffsetY:Number;
public var oldypos:Number;
public var physObjOffsetX:Number;
var parentObj:GameObj;
var flashTimerMax:int;
var ballstate:int;
var isPhysObj:Boolean;
static const ballstate_sad:int = 2;
static const ballstate_happy_with_ball:int = 6;
static const ballstate_angry_with_ball:int = 5;
static const ballstate_laughing:int = 4;
static const ballstate_happy:int = 1;
static const ballstate_null:int = 0;
static const ballstate_angry:int = 3;
public function GameObj(_arg1, _arg2, _arg3){
ct = new ColorTransform(0.1, 0.1, 0.1, 0.3);
blinkFrames = new Array(1, 2, 3, 0, 3, 2, 1);
super();
xpos = _arg2;
ypos = _arg3;
zpos = 1;
starty = _arg2;
startx = _arg2;
active = false;
main = _arg1;
zpos = 0;
graphicID = 0;
frame = 0;
frameVel = 0;
controlIndex = 0;
timer = 0;
timer1 = 0;
radius = 14;
minFrame = 0;
maxFrame = 0;
movementVec = new Vec();
}
function PostInitBall(_arg1:int){
type = _arg1;
graphicID = (GraphicObjects.gfx_ball1 + type);
}
function InitPlayer():void{
}
function ClearColFlags(){
colFlag_jumpon = false;
colFlag_killPlayer = false;
colFlag_playercanbekilled = false;
colFlag_canBePickedUp = false;
colFlag_canBeShot = false;
colFlag_isBullet = false;
colFlag_isPlatform = false;
colFlag_isPowerup = false;
colFlag_isBouncyPad = false;
colFlag_isCheckpoint = false;
colFlag_isShop = false;
colFlag_isEnemyBullet = false;
colFlag_isEnemy = false;
colFlag_isBall = false;
colFlag_isHose = false;
}
function RenderPlayer(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
RenderNormally();
}
function InitObj_Bouncer(){
xoffset = 0;
yoffset = 0;
updateFunction = UpdateBouncer;
renderFunction = RenderBouncer;
controlMode = 0;
timer = 0;
}
public function InitBallGenerator(){
var _local1:Level;
updateFunction = UpdateBallGenerator;
_local1 = Game.GetCurrentLevel();
timer = (_local1.frequency * Defs.fps);
count = 0;
hopperIndex = Game.initHopperIndex;
Game.initHopperIndex++;
}
public function GetOffsetObjectRectangle():Rectangle{
var _local1:Rectangle;
_local1 = objectDef.colRects[0].clone();
_local1.x = (_local1.x + xpos);
_local1.y = (_local1.y + ypos);
return (_local1);
}
function RenderBouncer(){
var _local1:Number;
var _local2:Number;
_local1 = xpos;
_local2 = ypos;
xpos = (xpos + xoffset);
ypos = (ypos + yoffset);
RenderNormally();
xpos = _local1;
ypos = _local2;
}
public function PlayerHitEnemyBullet(_arg1:GameObj){
}
function RenderWallCollision():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:Number;
if ((Debug.debugMode & 8) == 0){
return;
};
if (objectDef == null){
return;
};
if (objectDef.collisionCircleOffsets.length == 0){
return;
};
_local1 = 0;
while (_local1 < objectDef.collisionCircleOffsets.length) {
_local2 = objectDef.collisionCircleOffsets[_local1].x;
_local3 = objectDef.collisionCircleOffsets[_local1].y;
_local4 = objectDef.collisionCircleRadii[_local1];
_local2 = (_local2 + xpos);
_local2 = (_local2 - Game.scrollX);
_local3 = (_local3 + ypos);
_local3 = (_local3 - Game.scrollY);
Utils.RenderCircle(main.screenBD, _local2, _local3, _local4, 4294967295);
_local1++;
};
}
function RenderBlockCollision():void{
var _local1:Rectangle;
var _local2:Rectangle;
if ((Debug.debugMode & 4) == 0){
return;
};
if (objectDef == null){
return;
};
if (objectDef.colRects.length == 0){
return;
};
for each (_local2 in objectDef.colRects) {
_local1 = _local2.clone();
_local1.x = (_local1.x + xpos);
_local1.y = (_local1.y + ypos);
_local1.x = (_local1.x - Game.scrollX);
_local1.y = (_local1.y - Game.scrollY);
main.screenBD.fillRect(_local1, 1082163328);
};
for each (_local2 in objectDef.shieldColRects) {
_local1 = _local2.clone();
_local1.x = (_local1.x + xpos);
_local1.y = (_local1.y + ypos);
_local1.x = (_local1.x - Game.scrollX);
_local1.y = (_local1.y - Game.scrollY);
main.screenBD.fillRect(_local1, 1082163200);
};
}
function InitObj_Conveyor(){
graphicID = GraphicObjects.gfx_conveyor;
frame = 0;
frameVel = 0.5;
updateFunction = UpdateObj_Conveyor;
}
public function RenderShadow():void{
var _local1:Number;
var _local2:Number;
if (renderShadowFlag == false){
return;
};
if (visible == false){
return;
};
_local1 = (xpos - Game.scrollX);
_local2 = (ypos - Game.scrollY);
GraphicObjects.RenderAtRotScaled(graphicID, frame, main.screenBD, (_local1 + 5), (_local2 + 5), true, 1, dir);
}
function UpdateBallGenerator_NoRandomOffsets(){
var _local1:Level;
_local1 = Game.GetCurrentLevel();
if (Game.numBallsActive >= _local1.maxballsactive){
return;
};
if (hopperIndex != Game.nextHopperIndex){
return;
};
timer--;
if (timer < 0){
timer = (_local1.frequency * Defs.fps);
Game.InitBallAt(xpos, ypos);
Game.nextHopperIndex++;
if (Game.nextHopperIndex >= Game.initHopperIndex){
Game.nextHopperIndex = 0;
};
};
}
function UpdateBall(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
timer1++;
if (timer1 > 1){
timer1 = 1;
visible = true;
};
eyelidframe = (eyelidframe + 0.1);
if (eyelidframe > 5){
eyelidframe = 0;
};
eyelidframe = 1;
timer--;
if (timer <= 0){
timer = Utils.RandBetweenInt(5, 50);
};
if (timer < blinkFrames.length){
eyelidframe = blinkFrames[timer];
} else {
eyelidframe = 1;
};
_local1 = (MouseControl.mousePosX - xpos);
_local2 = (MouseControl.mousePosY - ypos);
if ((((ballstate == ballstate_angry_with_ball)) || ((ballstate == ballstate_happy_with_ball)))){
if ((((ballstate_otherGO.active == true)) && (ballstate_otherGO.colFlag_isBall))){
_local1 = (ballstate_otherGO.xpos - xpos);
_local2 = (ballstate_otherGO.ypos - ypos);
};
};
_local3 = Math.atan2(_local2, _local1);
pupilVec.SetAng(_local3);
ballstateTimer--;
if (ballstateTimer <= 0){
ballstateTimer = 0;
SetBallState(ballstate_null, true);
};
if (ballstate == ballstate_null){
frame = 0;
};
if (ballstate == ballstate_happy){
frame = 1;
};
if (ballstate == ballstate_sad){
frame = 4;
};
if (ballstate == ballstate_angry){
frame = 3;
};
if (ballstate == ballstate_laughing){
frame = 2;
};
if (ballstate == ballstate_angry_with_ball){
frame = 4;
};
if (ballstate == ballstate_happy_with_ball){
frame = 2;
};
}
public function PlayAnimation():Boolean{
var _local1:int;
_local1 = (GraphicObjects.GetNumFrames(graphicID) - 1);
frame = (frame + frameVel);
if (frame >= _local1){
frame = _local1;
return (true);
};
return (false);
}
function RenderNormally(){
var _local1:Number;
var _local2:Number;
_local1 = xpos;
_local2 = ypos;
if (((!((scale == 1))) || (!((dir == 0))))){
GraphicObjects.RenderAtRotScaled(graphicID, frame, main.screenBD, _local1, _local2, false, scale, dir);
} else {
if (additive){
GraphicObjects.RenderAtAdditive(graphicID, frame, main.screenBD, _local1, _local2, alpha);
} else {
GraphicObjects.RenderAt(graphicID, frame, main.screenBD, _local1, _local2, false);
};
};
}
public function InitNextPieceGO(){
subtype = 0;
graphicID = GraphicObjects.gfx_blockbits;
frame = subtype;
updateFunction = UpdateNextPieceGO;
dir = 0;
}
public function GetDirBetween(_arg1, _arg2, _arg3, _arg4):Number{
var _local5:*;
_local5 = Math.atan2((_arg4 - _arg2), (_arg3 - _arg1));
return (_local5);
}
public function InitObj_HoseNozzle(){
renderShadowFlag = false;
updateFunction = updateHozeNozzle;
frame = 0;
graphicID = GraphicObjects.gfx_hozenozzle;
}
public function InitPinDisappear_Broken(){
health = 32;
frame = (health / 2);
}
public function CycleAnimationEx():Boolean{
var _local1:Boolean;
var _local2:*;
_local1 = false;
frame = (frame + frameVel);
_local2 = (maxFrame - minFrame);
if (frame > maxFrame){
frame = (frame - _local2);
_local1 = true;
};
if (frame < minFrame){
frame = (frame + _local2);
_local1 = true;
};
return (_local1);
}
function IsInWorld(_arg1:Number):Boolean{
if (xpos < (0 - _arg1)){
return (false);
};
if (ypos < (0 - _arg1)){
return (false);
};
if (xpos > (Defs.displayarea_w + _arg1)){
return (false);
};
if (ypos > (Defs.displayarea_h + _arg1)){
return (false);
};
return (true);
}
public function updateHozeNozzle(){
var _local1:Number;
xpos = MouseControl.mousePosX;
ypos = MouseControl.mousePosY;
_local1 = GraphicObjects.GetNumFrames(graphicID);
frame = Math.floor(Utils.ScaleTo(0, (_local1 - 1), Game.nozzleSpreadAngMin, Game.nozzleSpreadAngMax, Game.nozzleSpreadAng));
}
function UpdateObj_Conveyor(){
CycleAnimation();
}
function RenderHomingBullet(){
GraphicObjects.RenderAtRotScaled(graphicID, frame, main.screenBD, xpos, ypos, false, scale, movementVec.rot);
}
function RenderBall(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:int;
var _local6:Point;
var _local7:Point;
var _local8:Matrix;
RenderNormally();
_local8 = new Matrix();
_local8.rotate(dir);
_local6 = _local8.transformPoint(new Point(0, -3));
_local1 = (xpos + _local6.x);
_local2 = (ypos + _local6.y);
_local5 = GraphicObjects.gfx_eye;
GraphicObjects.RenderAtRotScaled(_local5, 0, main.screenBD, _local1, _local2, false, 1, dir);
_local7 = new Point(pupilVec.GetXComponent(), pupilVec.GetYComponent());
_local3 = ((xpos + _local6.x) + _local7.x);
_local4 = ((ypos + _local6.y) + _local7.y);
GraphicObjects.RenderAtRotScaled(_local5, 1, main.screenBD, _local3, _local4, false, 1, dir);
_local5 = (GraphicObjects.gfx_eyelid + type);
GraphicObjects.RenderAtRotScaled(_local5, int(eyelidframe), main.screenBD, _local1, _local2, false, 1, dir);
}
function RenderWaves(){
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = GraphicObjects.GetNumFrames(graphicID);
_local2 = ypos;
_local3 = frame;
RenderNormally();
frame = (frame + 40);
if (frame >= _local1){
frame = (frame - _local1);
};
ypos = (ypos + 10);
RenderNormally();
frame = (frame + 40);
if (frame >= _local1){
frame = (frame - _local1);
};
ypos = (ypos + 10);
RenderNormally();
ypos = _local2;
frame = _local3;
}
public function InitPinDisappear(){
health = 0;
frame = (health / 2);
}
public function GetObjectRectangle():Rectangle{
return (objectDef.colRects[0]);
}
public function Update():void{
oldxpos = xpos;
oldypos = ypos;
if (updateFunction != null){
updateFunction();
};
}
public function InitPhysicsFloorObject(_arg1:int, _arg2:Number){
graphicID = GraphicObjects.gfx_blockbits;
frame = _arg1;
dir = _arg2;
}
public function RenderPellet(){
GraphicObjects.RenderAt(GraphicObjects.gfx_waterparticle, frame, Game.main.effectsScreenBD, xpos, ypos);
}
public function PinDisappearHit():Boolean{
health++;
frame = (health / 2);
if (health > 40){
health = 40;
frame = (health / 2);
return (true);
};
return (false);
}
function RenderEnemyBullet(){
RenderNormally();
if (timer == 0){
GraphicObjects.RenderAt(graphicID, frame, main.effectsScreenBD, xpos, ypos, xflip);
};
}
public function InitPhysicsObject(_arg1:int, _arg2:int, _arg3:Number=0, _arg4:Number=0, _arg5:Boolean=false){
physObjOffsetX = _arg3;
physObjOffsetY = _arg4;
isPhysObj = true;
graphicID = _arg1;
frame = _arg2;
updateFunction = UpdatePhysicsObject;
renderShadowFlag = _arg5;
if ((((graphicID == GraphicObjects.gfx_blockbits)) && ((frame == 10)))){
updateFunction = null;
renderFunction = RenderPellet;
renderShadowFlag = false;
visible = true;
frame = Utils.RandBetweenInt(0, 19);
};
}
function UpdatePlayer():void{
var _local1:Boolean;
var _local2:Boolean;
var _local3:Boolean;
var _local4:Boolean;
var _local5:Boolean;
var _local6:Boolean;
var _local7:Boolean;
oldxpos = xpos;
oldypos = ypos;
_local1 = false;
_local2 = false;
_local3 = false;
_local4 = false;
_local5 = true;
_local6 = false;
_local7 = false;
if (KeyReader.Down(KeyReader.KEY_LEFT)){
_local1 = true;
};
if (KeyReader.Down(KeyReader.KEY_RIGHT)){
_local2 = true;
};
if (KeyReader.Pressed(KeyReader.KEY_UP)){
_local4 = true;
};
if (KeyReader.Down(KeyReader.KEY_SPACE)){
_local5 = false;
};
if (KeyReader.Pressed(KeyReader.KEY_DOWN)){
_local7 = true;
};
xpos = (xpos + ((MouseControl.mousePosX - xpos) * 0.5));
ypos = (ypos + ((MouseControl.mousePosY - ypos) * 0.5));
if (xpos < 0){
xpos = 0;
};
if (xpos > Defs.displayarea_w){
xpos = Defs.displayarea_w;
};
if (ypos < 0){
ypos = 0;
};
if (ypos > Defs.displayarea_h){
ypos = Defs.displayarea_h;
};
}
function UpdateBallGenerator(){
var _local1:Level;
_local1 = Game.GetCurrentLevel();
if (Game.numBallsActive >= _local1.maxballsactive){
return;
};
if (hopperIndex != Game.nextHopperIndex){
return;
};
timer--;
if (timer < 0){
timer = (_local1.frequency * Defs.fps);
Game.InitBallAt((xpos + Utils.RandBetweenFloat(-5, 5)), ypos);
Game.nextHopperIndex++;
if (Game.nextHopperIndex >= Game.initHopperIndex){
Game.nextHopperIndex = 0;
};
};
}
public function Init(_arg1:int):void{
var _local2:int;
var _local3:Number;
_local2 = 0;
_local3 = 0;
type = _arg1;
controlMode = _local2;
xvel = _local3;
yvel = _local3;
frame = _local3;
frameVel = _local3;
timer = _local3;
hitTimer = _local3;
flashTimer = _local2;
flashFlag = false;
dir = 0;
todir = 0;
health = 1;
zvel = 0;
name = "";
scale = 1;
objectDef = null;
xflip = false;
updateFunction = null;
renderFunction = null;
visible = true;
renderShadowFlag = false;
ClearColFlags();
isPhysObj = false;
additive = false;
alpha = 1;
}
function UpdateWaves(){
CycleAnimation();
}
public function UpdateNextPieceGO(){
var _local1:Number;
var _local2:Number;
_local1 = MouseControl.mousePosX;
_local2 = MouseControl.mousePosY;
xpos = (_local1 + Game.scrollX);
ypos = (_local2 + Game.scrollY);
if (MouseControl.delta != 0){
dir = (dir + (Number(MouseControl.delta) * 0.1));
MouseControl.delta = 0;
};
}
public function InitObj_Hose(){
colFlag_isHose = true;
renderFunction = null;
visible = false;
renderShadowFlag = false;
}
public function PlayAnimationEx():Boolean{
var _local1:Boolean;
var _local2:*;
_local1 = false;
frame = (frame + frameVel);
_local2 = (maxFrame - minFrame);
if (frame > maxFrame){
if (frame > maxFrame){
frame = maxFrame;
_local1 = true;
};
};
if (frame < minFrame){
frame = minFrame;
_local1 = true;
};
return (_local1);
}
function Anim_FromVel():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:*;
_local1 = GraphicObjects.GetNumFrames(graphicID);
_local2 = xvel;
_local3 = yvel;
_local4 = Math.atan2(_local3, _local2);
frame = ((_local1 / (Math.PI * 2)) * -(_local4));
if (frame < 0){
frame = (frame + _local1);
};
if (frame > _local1){
frame = (frame - _local1);
};
frame = (frame + (_local1 / 2));
if (frame > _local1){
frame = (frame - _local1);
};
}
function SetAnim(_arg1:int){
var _local2:int;
graphicID = _arg1;
_local2 = (GraphicObjects.GetNumFrames(graphicID) - 1);
if (frame >= _local2){
frame = 0;
};
}
public function CycleAnimation():void{
var _local1:Number;
var _local2:int;
_local1 = frameVel;
_local2 = GraphicObjects.GetNumFrames(graphicID);
frame = (frame + _local1);
if (frame >= _local2){
frame = (frame - _local2);
};
if (frame < 0){
frame = (frame + _local2);
};
}
function RenderEnemy(){
if (movementVec == null){
RenderNormally();
return;
};
GraphicObjects.RenderAtRotScaled(graphicID, frame, main.screenBD, xpos, ypos, false, scale, movementVec.rot);
}
public function InitBallGenerator_NoRandomOffsets(){
var _local1:Level;
updateFunction = UpdateBallGenerator_NoRandomOffsets;
_local1 = Game.GetCurrentLevel();
timer = (_local1.frequency * Defs.fps);
count = 0;
hopperIndex = Game.initHopperIndex;
Game.initHopperIndex++;
}
public function SetBallState(_arg1:int, _arg2:Boolean=false):Boolean{
if (_arg2 == false){
if (ballstate == ballstate_angry_with_ball){
return (false);
};
if (ballstate == ballstate_happy_with_ball){
return (false);
};
};
ballstate = _arg1;
ballstateTimer = 100;
return (true);
}
public function Render():void{
if (visible == false){
return;
};
if (renderFunction != null){
renderFunction();
} else {
RenderNormally();
};
RenderBlockCollision();
RenderWallCollision();
}
function InitObj_Ball(){
Game.numBallsActive++;
colFlag_isBall = true;
updateFunction = UpdateBall;
renderFunction = RenderBall;
eyelidframe = 0;
pupilVec = new Vec();
pupilVec.Set(Utils.RandBetweenFloat(0, 6), 3);
timer = 10;
graphicID = GraphicObjects.gfx_ball1;
frame = 0;
ballstate = ballstate_happy;
ballstateTimer = 1000;
visible = false;
timer1 = 0;
}
function UpdateBouncer(){
var _local1:Number;
if (controlMode == 1){
_local1 = (dir - (Math.PI * 0.5));
xoffset = ((Math.cos(_local1) * timer) * 2);
yoffset = ((Math.sin(_local1) * timer) * 2);
timer++;
if (timer > 3){
yoffset = 0;
xoffset = 0;
controlMode = 0;
};
};
}
public function PlayerHitEnemy(_arg1:GameObj){
}
function InitObj_Waves(){
updateFunction = UpdateWaves;
renderFunction = RenderWaves;
eyelidframe = 0;
frame = 0;
frameVel = 1;
}
function BouncerBounce(){
if (controlMode == 0){
timer = 0;
controlMode = 1;
};
}
public function UpdatePellet(){
}
public function GetVelFromDir(_arg1:Number){
xvel = (Math.cos(dir) * _arg1);
yvel = (Math.sin(dir) * _arg1);
}
public function UpdatePhysicsObject(){
}
}
}//package
Section 121
//GameObjects (GameObjects)
package {
import flash.events.*;
class GameObjects {
public static var numobjs;
static var m:Main;
public static var zorder:Array;
public static var objs:Array;
public static var lastGenIndex:int;
public function GameObjGroup(){
}
public static function Update():void{
var _local1:int;
_local1 = 0;
while (_local1 < objs.length) {
if (objs[_local1].active == true){
objs[_local1].Update();
};
_local1++;
};
}
public static function Render():void{
var _local1:GameObj;
var _local2:Array;
_local2 = new Array();
for each (_local1 in objs) {
if (((_local1.active) && (_local1.visible))){
_local2.push(_local1);
};
};
_local2.sortOn("zpos", (Array.NUMERIC | Array.DESCENDING));
if (Debug.IsSet(4) == false){
for each (_local1 in _local2) {
_local1.RenderShadow();
};
};
for each (_local1 in _local2) {
_local1.Render();
};
}
public static function InitOnce(_arg1:Main, _arg2:int){
var _local3:*;
numobjs = _arg2;
m = _arg1;
objs = new Array();
zorder = new Array(numobjs);
_local3 = 0;
while (_local3 < numobjs) {
objs.push(new GameObj(m, 0, 0));
_local3++;
};
}
public static function ClearAll(){
var _local1:int;
_local1 = 0;
while (_local1 < numobjs) {
objs[_local1].active = false;
_local1++;
};
}
public static function CountActive():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 0;
while (_local2 < objs.length) {
if (objs[_local2].active == true){
_local1++;
};
_local2++;
};
return (_local1);
}
public static function AddObj(_arg1:Number, _arg2:Number, _arg3:Number):GameObj{
var _local4:int;
var _local5:GameObj;
_local4 = 0;
while (_local4 < numobjs) {
if (objs[_local4].active == false){
_local5 = objs[_local4];
_local5.active = true;
_local5.zpos = _arg3;
_local5.xpos = _arg1;
_local5.ypos = _arg2;
_local5.startx = _arg1;
_local5.starty = _arg2;
_local5.startz = _arg3;
_local5.Init(0);
lastGenIndex = _local4;
return (objs[_local4]);
};
_local4++;
};
trace("ERROR! NO FREE OBJECTS");
lastGenIndex = -1;
return (null);
}
public static function ForEachActive(_arg1:Function):void{
var _local2:GameObj;
var _local3:Array;
_local3 = new Array();
for each (_local2 in objs) {
if (_local2.active){
_arg1(_local2);
};
};
}
public static function GetGOByIndex(_arg1:int):GameObj{
return (objs[_arg1]);
}
}
}//package
Section 122
//GraphicObjects (GraphicObjects)
package {
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
public class GraphicObjects {
public static const gfx_sprayslider = 131;
public static const gfx_disappearingpin = 120;
public static const gfx_eyelidb = 92;
public static const gfx_eyelidg = 91;
public static const gfx_hosespline = 110;
public static const gfx_font2black = 193;
public static const gfx_eyelid = 90;
public static const gfx_backgrounds = 70;
public static const gfx_backgroundbits = 61;
public static const gfx_panelbits = 134;
public static const gfx_restart = 140;
public static const gfx_ball2 = 101;
public static const gfx_ball3 = 102;
public static const gfx_conveyor = 133;
public static const gfx_ball1 = 100;
public static const gfx_blockbits = 60;
public static const gfx_waterparticle = 130;
public static const gfx_fontblack = 191;
public static const gfx_waves = 71;
public static const gfx_cursor = 135;
public static const gfx_menu = 141;
public static const gfx_eye = 80;
public static const gfx_soundtoggle = 142;
public static const gfx_hozenozzle = 132;
public static const gfx_font1 = 190;
public static const gfx_font2 = 192;
public static var stringCharY:Number;
static var count:int;
public static var stringCharBitmap:Bitmap;
static var main:Main;
public static var stringCharX:Number;
static var nameList:Array;
static var graphicobjs:Array;
static var idList:Array;
public static function Add(_arg1:int, _arg2:String, _arg3:int):void{
var _local4:Class;
var _local5:MovieClip;
_local4 = (getDefinitionByName(_arg2) as Class);
_local5 = (new (_local4) as MovieClip);
Add1(_arg1, new DisplayObj(_local5, 1, _arg3), _arg2);
}
public static function GetBitmap(_arg1:int, _arg2:int):Bitmap{
var _local3:int;
_local3 = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].bitmaps[0]);
}
public static function RenderNumberAt(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int){
var _local6:Array;
var _local7:int;
var _local8:int;
var _local9:Boolean;
var _local10:int;
var _local11:int;
var _local12:Bitmap;
_local6 = new Array();
_local7 = _arg5;
_local8 = 0;
while (_local8 < 11) {
_local10 = (_local7 % 10);
_local6.push(_local10);
_local7 = (_local7 / 10);
_local8++;
};
_local9 = false;
_local8 = (_local6.length - 1);
while (_local8--) {
_local11 = _local6[_local8];
if ((((_local9 == false)) && (!((_local11 == 0))))){
_local9 = true;
};
if (_local9){
RenderAt(_arg2, (_local11 + 48), _arg1, _arg3, _arg4);
_local12 = GetBitmap(_arg2, (_local11 + 48));
_arg3 = (_arg3 + _local12.width);
};
(_local8 >= 0);
};
return (_arg3);
}
public static function RenderAt(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Boolean=false){
var _local7:int;
_local7 = idList[_arg1];
graphicobjs[_local7].frames[_arg2].RenderAt(_arg3, _arg4, _arg5, _arg6);
}
public static function RenderAtRot(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean){
var _local8:int;
_local8 = idList[_arg1];
if (_arg7){
graphicobjs[_local8].frames[_arg2].RenderAtRotBurned(_arg3, _arg4, _arg5, _arg6);
} else {
graphicobjs[_local8].frames[_arg2].RenderAtRot(_arg3, _arg4, _arg5, _arg6);
};
}
public static function RenderAtSplit(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number){
var _local6:int;
_local6 = idList[_arg1];
graphicobjs[_local6].frames[_arg2].RenderAtSplit(_arg3, _arg4, _arg5);
}
public static function GetStringWidth(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Object=null, _arg7:int=0):int{
var _local8:int;
var _local9:int;
var _local10:int;
stringCharX = _arg3;
stringCharY = _arg4;
_local8 = 0;
_local9 = 0;
while (_local9 < _arg5.length) {
_local10 = int(_arg5.charCodeAt(_local9));
if (_local10 < 0){
_local10 = 0;
};
if (_local10 > 127){
_local10 = 127;
};
stringCharBitmap = GetBitmap(_arg2, _local10);
if (_arg6 != null){
} else {
_local8 = (_local8 + (stringCharBitmap.width - 3));
_local8 = (_local8 + _arg7);
};
_local9++;
};
return (_local8);
}
public static function RenderStringAt(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Object=null, _arg7:int=0){
var _local8:int;
var _local9:int;
stringCharX = _arg3;
stringCharY = _arg4;
_local8 = 0;
while (_local8 < _arg5.length) {
_local9 = int(_arg5.charCodeAt(_local8));
if (_local9 < 0){
_local9 = 0;
};
if (_local9 > 127){
_local9 = 127;
};
RenderAt((_arg2 + 1), _local9, _arg1, (stringCharX + 1), (stringCharY + 1));
RenderAt(_arg2, _local9, _arg1, stringCharX, stringCharY);
stringCharBitmap = GetBitmap(_arg2, _local9);
if (_arg6 != null){
_arg6();
} else {
stringCharX = (stringCharX + (stringCharBitmap.width - 3));
stringCharX = (stringCharX + _arg7);
};
_local8++;
};
}
public static function RenderAtRotScaled(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Boolean=false, _arg7:Number=1, _arg8:Number=0, _arg9:ColorTransform=null){
var _local10:int;
_local10 = idList[_arg1];
graphicobjs[_local10].frames[_arg2].RenderAtRotScaled(_arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
}
public static function GetNumFrames(_arg1:int):int{
var _local2:int;
_local2 = idList[_arg1];
return (graphicobjs[_local2].frames.length);
}
public static function GetWidth(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].bitmaps[0].width);
}
public static function RenderAtScaled(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Boolean=false, _arg7:Number=1){
var _local8:int;
_local8 = idList[_arg1];
graphicobjs[_local8].frames[_arg2].RenderAtScaled(_arg3, _arg4, _arg5, _arg6, _arg7);
}
public static function GetPixelAt(_arg1:int, _arg2:int, _arg3:int, _arg4:int):uint{
var _local5:int;
var _local6:Bitmap;
var _local7:uint;
_local5 = idList[_arg1];
_local6 = graphicobjs[_local5].frames[_arg2].bitmaps[0];
_local7 = _local6.bitmapData.getPixel32(_arg3, _arg4);
return (_local7);
}
public static function RenderAtAlpha(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number){
var _local7:int;
_local7 = idList[_arg1];
graphicobjs[_local7].frames[_arg2].RenderAtAlpha(_arg3, _arg4, _arg5, _arg6);
}
public static function InitOnce(_arg1:Main):void{
var _local2:int;
main = _arg1;
graphicobjs = new Array();
idList = new Array(200);
nameList = new Array(200);
_local2 = 0;
while (_local2 < 200) {
idList[_local2] = int(0);
nameList[_local2] = String("");
_local2++;
};
count = 0;
AddFont(gfx_font1, main.tf_scorespr);
AddFont(gfx_font2, main.tf_scorespr1);
AddFont(gfx_fontblack, main.tf_scoresprblack);
AddFont(gfx_font2black, main.tf_scorespr2);
Add(gfx_blockbits, "BlockBits", 3);
Add(gfx_backgroundbits, "BackgroundBits", 3);
Add(gfx_backgrounds, "Backgrounds", 0);
Add(gfx_waves, "inGameWaves", 0);
Add(gfx_eye, "Eye", 0);
Add(gfx_eyelid, "Eyelid", 0);
Add(gfx_eyelidb, "EyelidBlue", 0);
Add(gfx_eyelidg, "EyelidGreen", 0);
Add(gfx_ball1, "Ball1", 3);
Add(gfx_ball2, "Ball2", 3);
Add(gfx_ball3, "Ball3", 3);
Add(gfx_hosespline, "HoseSplinePiece", 0);
Add(gfx_disappearingpin, "DisappearingPin", 3);
Add(gfx_waterparticle, "WaterParticle", 0);
Add(gfx_sprayslider, "SpraySlider", 0);
Add(gfx_hozenozzle, "HozeNozzle", 0);
Add(gfx_conveyor, "Conveyor_Animated", 0);
Add(gfx_panelbits, "Panel_Bits", 0);
Add(gfx_cursor, "Cursor", 0);
Add(gfx_restart, "ingame_RestartButton", 0);
Add(gfx_menu, "ingame_MenuButton", 0);
Add(gfx_soundtoggle, "mc_soundtoggle", 0);
}
public static function GetIndexByName(_arg1:String):int{
var _local2:int;
var _local3:String;
_local2 = 0;
for each (_local3 in nameList) {
if (_local3 == _arg1){
return (_local2);
};
_local2++;
};
trace(("cant find graphic obj by name: " + _arg1));
return (0);
}
public static function Add1(_arg1:int, _arg2:DisplayObj, _arg3:String=""):void{
idList[_arg1] = count;
nameList[_arg1] = _arg3;
graphicobjs.push(_arg2);
count++;
}
public static function AddFont(_arg1:int, _arg2:TextFormat):void{
var _local3:DisplayObj;
_local3 = new DisplayObj(null, 0, 0);
_local3.CreateFont(_arg2);
idList[_arg1] = count;
graphicobjs.push(_local3);
count++;
}
public static function GetHeught(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].bitmaps[0].height);
}
public static function RenderAtAdditive(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number){
var _local7:int;
_local7 = idList[_arg1];
graphicobjs[_local7].frames[_arg2].RenderAtAdditive(_arg3, _arg4, _arg5, _arg6);
}
}
}//package
Section 123
//HighScore (HighScore)
package {
import flash.events.*;
import flash.display.*;
public class HighScore {
public static const hiscoretype_NONE = 0;
public static const hiscoretype_MOCHI = 1;
public static const hiscoretype_GAMEZHERO = 4;
public static const hiscoretype_MINDJOLT_VIRAL = 3;
public static const hiscoretype_CANDYSTAND = 6;
public static const hiscoretype_SHOCKWAVE = 5;
public static const hiscoretype_MINDJOLT = 2;
static var difficulty:int;
static var callback:Object;
static var shockwave_HighscoreObject:Object;
static var newButton;
static var mochiConnectIDs:Array;
static var mochiBoardIDs:Array;
static var main:Main;
static var s:int;
static var SubmitScore_mc:MovieClip;
static var mochiMovieClip:MovieClip;
static function buttonShockwaveBackPressed(_arg1:MouseEvent){
Game.main.removeChild(SubmitScore_mc);
SubmitScore_mc = null;
if (callback != null){
callback();
};
}
public static function ViewScores_Shockwave():void{
difficulty = 0;
if (Licensors.GetHighScoreType() == hiscoretype_SHOCKWAVE){
Shockwave_createHSobj();
shockwave_HighscoreObject.openHub("view", 0);
};
}
public static function InitOnce(_arg1:Main){
main = _arg1;
}
public static function SubmitScore(_arg1:int, _arg2:int, _arg3=null):void{
s = _arg1;
difficulty = _arg2;
callback = _arg3;
}
static function Shockwave_createHSobj():void{
var _local1:Object;
_local1 = new Object();
_local1.gameTitle = "Drift Runners";
_local1.gameId = "driftrunners";
_local1.screenWidth = 640;
_local1.screenHeight = 480;
_local1.scoreDescriptor = "Points";
}
static function buttonShockwaveSubmitPressed(_arg1:MouseEvent){
SubmitScore_mc.buttonSubmit.visible = false;
Shockwave_createHSobj();
trace("jsopening hub");
shockwave_HighscoreObject.openHub("submit", s);
trace("jsopened hub");
}
public static function PlayAgain():void{
trace("shockwave play again");
main.SetGameState(Main.gameState_TITLE);
}
}
}//package
Section 124
//HoseBubble (HoseBubble)
package {
public class HoseBubble {
var maxvelocity:Number;
var position:Number;
var frame:int;
var maxalpha:Number;
var velocity:Number;
var alpha:Number;
public function HoseBubble(){
position = 0;
frame = 0;
alpha = 0;
maxalpha = 0;
velocity = 0;
maxvelocity = 0;
}
}
}//package
Section 125
//HoseSplinePiece (HoseSplinePiece)
package {
import flash.display.*;
public dynamic class HoseSplinePiece extends MovieClip {
}
}//package
Section 126
//HozeNozzle (HozeNozzle)
package {
import flash.display.*;
public dynamic class HozeNozzle extends MovieClip {
}
}//package
Section 127
//ingame_MenuButton (ingame_MenuButton)
package {
import flash.display.*;
public dynamic class ingame_MenuButton extends MovieClip {
}
}//package
Section 128
//ingame_RestartButton (ingame_RestartButton)
package {
import flash.display.*;
public dynamic class ingame_RestartButton extends MovieClip {
}
}//package
Section 129
//inGameWaves (inGameWaves)
package {
import flash.display.*;
public dynamic class inGameWaves extends MovieClip {
}
}//package
Section 130
//InstructionsScreen (InstructionsScreen)
package {
import flash.display.*;
public dynamic class InstructionsScreen extends MovieClip {
public var inner:MovieClip;
public function InstructionsScreen(){
addFrameScript(14, frame15, 29, frame30);
}
function frame15(){
stop();
}
function frame30(){
stop();
visible = false;
}
}
}//package
Section 131
//KeyReader (KeyReader)
package {
import flash.events.*;
import flash.display.*;
public class KeyReader {
static const KEY_LEFT = 37;
static const KEY_UP = 38;
static const KEY_DOWN = 40;
static const KEY_3 = 51;
static const KEY_5 = 53;
static const KEY_7 = 55;
static const KEY_1 = 49;
static const KEY_2 = 50;
static const KEY_4 = 52;
static const KEY_6 = 54;
static const KEY_8 = 56;
static const KEY_9 = 57;
static const KEY_A = 65;
static const KEY_B = 66;
static const KEY_C = 67;
static const KEY_E = 69;
static const KEY_F = 70;
static const KEY_G = 71;
static const KEY_H = 72;
static const KEY_I = 73;
static const KEY_J = 74;
static const KEY_D = 68;
static const KEY_M = 77;
static const KEY_N = 78;
static const KEY_O = 79;
static const KEY_P = 80;
static const KEY_Q = 81;
static const KEY_R = 82;
static const KEY_L = 76;
static const KEY_T = 84;
static const KEY_U = 85;
static const KEY_V = 86;
static const KEY_W = 87;
static const KEY_X = 88;
static const KEY_Y = 89;
static const KEY_K = 75;
static const KEY_0 = 58;
static const KEY_Z = 90;
static const KEY_S = 83;
static const KEY_SPACE = 32;
static const KEY_RIGHT = 39;
static var keysPressed:Array;
static var keysDown:Array;
public static function Pressed(_arg1:int):Boolean{
return (keysPressed[_arg1]);
}
static function keyUpListener(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = _arg1.keyCode;
keysDown[_local2] = 0;
}
public static function Down(_arg1:int):Boolean{
return (!((keysDown[_arg1] == 0)));
}
static function keyDownListener(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = _arg1.keyCode;
var _local3 = keysDown;
var _local4 = _local2;
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
}
public static function UpdateOncePerFrame():void{
var _local1:int;
_local1 = 0;
while (_local1 < 0x0100) {
if (keysDown[_local1] == 1){
keysPressed[_local1] = true;
var _local2 = keysDown;
var _local3 = _local1;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
} else {
keysPressed[_local1] = false;
};
_local1++;
};
}
public static function InitOnce(_arg1:Stage){
var _local2:int;
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyUpListener);
_arg1.focus = _arg1;
keysDown = new Array(0x0100);
keysPressed = new Array(0x0100);
_local2 = 0;
while (_local2 < 0x0100) {
keysDown[_local2] = int(0);
keysPressed[_local2] = Boolean(false);
_local2++;
};
}
}
}//package
Section 132
//Kong (Kong)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class Kong {
static var root:Object;
static var kongregate;
public static function InitOnce(_arg1:Object){
var _local2:Object;
var _local3:Object;
var _local4:String;
var _local5:URLRequest;
var _local6:Loader;
if (Licensors.IsAtKongregate() == false){
return;
};
root = _arg1;
_local2 = root.loaderInfo.loader;
_local3 = LoaderInfo(root.loaderInfo).parameters;
_local4 = ((_local3.api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf"));
trace(("API path: " + _local4));
_local5 = new URLRequest(_local4);
_local6 = new Loader();
_local6.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
_local6.load(_local5);
root.addChild(_local6);
}
public static function SubmitScore(_arg1:Number, _arg2:String){
trace(((("Kong Score: " + _arg2) + " ") + _arg1));
if (Licensors.IsAtKongregate() == false){
return;
};
kongregate.scores.submit(_arg1, _arg2);
}
public static function SubmitStat(_arg1:Number, _arg2:String){
trace(((("Kong Stat: " + _arg2) + " ") + _arg1));
if (Licensors.IsAtKongregate() == false){
return;
};
kongregate.stats.submit(_arg2, _arg1);
}
static function loadComplete(_arg1:Event):void{
kongregate = _arg1.target.content;
kongregate.services.connect();
trace(("\n" + kongregate.services));
trace(("\n" + kongregate.user));
trace(("\n" + kongregate.scores));
trace(("\n" + kongregate.stats));
}
}
}//package
Section 133
//KongregateKongAIAd (KongregateKongAIAd)
package {
import flash.events.*;
import flash.display.*;
public dynamic class KongregateKongAIAd extends MovieClip {
public var flash:MovieClip;
public function KongregateKongAIAd(){
addFrameScript(0, frame1, 219, frame220);
}
function frame220(){
stop();
dispatchEvent(new Event("finished"));
}
function frame1(){
this.stage.frameRate = 30;
}
}
}//package
Section 134
//Level (Level)
package {
public class Level {
var instances:Array;
var ballTypes:Array;
var name:String;
var time:Number;
var ballTypesString:String;
var helpscreenFrames:Array;
var quota:int;
var frequency:Number;
var maxballsactive:int;
var category:int;
public function Level(){
name = "";
frequency = 1;
quota = 10;
time = 60;
maxballsactive = 5;
instances = new Array();
ballTypesString = "1,2,3";
ballTypes = new Array();
helpscreenFrames = new Array();
}
public function Calculate(){
var _local1:Array;
var _local2:String;
ballTypes = new Array();
_local1 = ballTypesString.split(",");
for each (_local2 in _local1) {
ballTypes.push(int(_local2));
};
}
}
}//package
Section 135
//LevelCompleteScreen (LevelCompleteScreen)
package {
import flash.display.*;
import flash.text.*;
public dynamic class LevelCompleteScreen extends MovieClip {
public var text6a:TextField;
public var textTitle:TextField;
public var background:Backgrounds;
public var text1a:TextField;
public var buttonMoreGames:SimpleButton;
public var text2a:TextField;
public var buttonKong:SimpleButton;
public var text3a:TextField;
public var text4a:TextField;
public var buttonRetry:SimpleButton;
public var text3:TextField;
public var text4:TextField;
public var text5:TextField;
public var text6:TextField;
public var text2:TextField;
public var text1:TextField;
public var text5a:TextField;
public var buttonGuide:SimpleButton;
public var buttonContinue:SimpleButton;
}
}//package
Section 136
//LevelResult (LevelResult)
package {
public class LevelResult {
var complete:Boolean;
var lastTime:int;
var locked:Boolean;
var bestScore:int;
var bestTime:int;
var bestNumKilled:int;
var lastTimeBonus:int;
var bonus:Boolean;
var lastScore:int;
var lastNumKilled:int;
var lastLevelCompleteBonus:int;
var lastNumKilledBonus:int;
var lastLevelGemBonus:int;
public function LevelResult(){
locked = true;
complete = false;
bestTime = 9999999;
bestNumKilled = 9999999;
bestScore = 0;
bonus = false;
lastTime = 0;
lastScore = 0;
lastNumKilled = 0;
lastTimeBonus = 0;
lastNumKilledBonus = 0;
lastLevelCompleteBonus = 0;
lastLevelGemBonus = 0;
}
}
}//package
Section 137
//LevelSelectButton (LevelSelectButton)
package {
import flash.display.*;
import flash.text.*;
public dynamic class LevelSelectButton extends MovieClip {
public var selectedOutline:MovieClip;
public var complete:MovieClip;
public var gem:MovieClip;
public var textLevelNumber:TextField;
public var overOutline:MovieClip;
}
}//package
Section 138
//LevelSelectScreen (LevelSelectScreen)
package {
import flash.display.*;
import flash.text.*;
public dynamic class LevelSelectScreen extends MovieClip {
public var backgrounds:Backgrounds;
public var textTotalScorea:TextField;
public var textLevelInfo1:TextField;
public var buttonMoreGames:SimpleButton;
public var buttonKong:SimpleButton;
public var textLevelInfo:TextField;
public var textClip1:MovieClip;
public var textTotalScore:TextField;
public var buttonGuide:SimpleButton;
public var buttonContinue:SimpleButton;
}
}//package
Section 139
//Licensors (Licensors)
package {
public class Licensors {
public static const LICENSOR_BIGFISH = 6;
public static const LICENSOR_SHOCKWAVE = 11;
public static const LICENSOR_ANDKON = 5;
public static const LICENSOR_NOBRANDING = 12;
public static const LICENSOR_KING = 10;
public static const LICENSOR_KONGREGATE = 1;
public static const LICENSOR_KIBA = 13;
public static const LICENSOR_MINDJOLT = 4;
public static const LICENSOR_ARMORGAMES = 8;
public static const LICENSOR_MINICLIP = 2;
public static const LICENSOR_DOOF = 3;
public static const LICENSOR_BUBBLEBOX = 7;
public static const LICENSOR_GAMEZHERO = 9;
public static const LICENSOR_NONE = 0;
static var licensor:int = 1;
public static function IsHosted():Boolean{
if (licensor == LICENSOR_NONE){
return (false);
};
if (licensor == LICENSOR_ANDKON){
return (true);
};
if (licensor == LICENSOR_BIGFISH){
return (true);
};
if (licensor == LICENSOR_KONGREGATE){
if (SiteLock.GetDomain() == "kongregate.com"){
return (true);
};
return (false);
};
if (licensor == LICENSOR_MINICLIP){
if (SiteLock.GetDomain() == "miniclip.com"){
return (true);
};
return (false);
};
if (licensor == LICENSOR_DOOF){
if (SiteLock.GetDomain() == "doof.com"){
return (true);
};
return (false);
};
if (licensor == LICENSOR_MINDJOLT){
return (false);
};
return (false);
}
public static function InitOnce():void{
var _local1:String;
_local1 = Domain.GetDomain(Main.theStage);
if ((((licensor == LICENSOR_KONGREGATE)) && ((_local1 == "addictinggames.com")))){
licensor = LICENSOR_NOBRANDING;
};
if ((((licensor == LICENSOR_KONGREGATE)) && ((_local1 == "kaisergames.de")))){
licensor = LICENSOR_KIBA;
};
if ((((licensor == LICENSOR_KONGREGATE)) && ((_local1 == "bubblebox.com")))){
licensor = LICENSOR_BUBBLEBOX;
};
if (licensor == LICENSOR_MINDJOLT){
};
}
public static function IsAtKongregate():Boolean{
if (licensor != LICENSOR_KONGREGATE){
return (false);
};
if (SiteLock.GetDomain() == "kongregate.com"){
return (true);
};
return (false);
}
public static function GetHighScoreType():int{
if (licensor == LICENSOR_SHOCKWAVE){
return (HighScore.hiscoretype_SHOCKWAVE);
};
return (HighScore.hiscoretype_NONE);
}
public static function GetLicensor():int{
return (licensor);
}
public static function CanUseMochiAds():Boolean{
if (licensor == LICENSOR_NONE){
return (true);
};
if (licensor == LICENSOR_KONGREGATE){
return (true);
};
if (licensor == LICENSOR_MINICLIP){
return (false);
};
if (licensor == LICENSOR_DOOF){
return (false);
};
if (licensor == LICENSOR_MINDJOLT){
return (true);
};
if (licensor == LICENSOR_ANDKON){
return (false);
};
if (licensor == LICENSOR_BIGFISH){
return (false);
};
if (licensor == LICENSOR_ARMORGAMES){
return (false);
};
if (licensor == LICENSOR_GAMEZHERO){
return (false);
};
if (licensor == LICENSOR_KING){
return (false);
};
if (licensor == LICENSOR_SHOCKWAVE){
return (false);
};
return (true);
}
public static function SetLicensor(_arg1:int):void{
licensor = _arg1;
}
public static function CanUseMochiBot():Boolean{
if (licensor == LICENSOR_ARMORGAMES){
return (false);
};
if (licensor == LICENSOR_SHOCKWAVE){
return (false);
};
return (true);
}
}
}//package
Section 140
//Line (Line)
package {
import flash.geom.*;
public class Line {
public var udx:Number;
public var nx:Number;
public var ny:Number;
public var dir:Number;
public var udy:Number;
public var dy:Number;
public var y0:Number;
public var y1:Number;
public var dx:Number;
public var normalDir:Number;
public var length:Number;
public var boundingRect:Rectangle;
public var x0:Number;
public var x1:Number;
public function Line(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
x0 = _arg1;
y0 = _arg2;
x1 = _arg3;
y1 = _arg4;
CalcNormal();
CalcBoundingRect();
}
function CalcNormal():void{
dir = Math.atan2((y1 - y0), (x1 - x0));
normalDir = (dir - (Math.PI * 0.5));
nx = Math.cos(normalDir);
ny = Math.sin(normalDir);
dx = (x1 - x0);
dy = (y1 - y0);
length = Math.sqrt(((dx * dx) + (dy * dy)));
udx = Math.cos(dir);
udy = Math.sin(dir);
}
function CalcBoundingRect():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = x0;
_local2 = x1;
if (_local1 > _local2){
_local1 = x1;
_local2 = x0;
};
_local3 = y0;
_local4 = y1;
if (_local3 > _local4){
_local3 = y1;
_local4 = y0;
};
boundingRect = new Rectangle(_local1, _local3, ((_local2 - _local1) + 1), ((_local4 - _local3) + 1));
}
}
}//package
Section 141
//LongAnimalsLogo (LongAnimalsLogo)
package {
import flash.display.*;
public dynamic class LongAnimalsLogo extends SimpleButton {
}
}//package
Section 142
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
public class Main extends MovieClip {
var secondCounter:Number;// = 0
public var tf_scorespr:TextFormat;
var framecounter:int;// = 0
public var tf_scorespr2:TextFormat;
var cheatMode:Boolean;
private var effectsScreenB:Bitmap;
var levelTimer:Number;
var ftime:Number;
var scrollY:Number;// = 0
public var tf_scorespr1:TextFormat;
private var screenB:Bitmap;
public var backgroundMC:MovieClip;
var levelTimerMax:Number;
public var mochiScores;
public var screenBD:BitmapData;
public var hoseScreenMC:MovieClip;
var gameState:int;// = 0
public var effectsScreenBD:BitmapData;
var currentTime:Number;// = 0
public var fps:Number;
public var tf_scoresprblack:TextFormat;
static const gameState_HIGHSCORES = 5;
static const gameState_TITLE = 0;
static const gameState_LEVEL_PLAY = 2;
public static var theStage:Stage;
static var theRoot:MovieClip;
public function Main(){
currentTime = 0;
gameState = gameState_TITLE;
scrollY = 0;
framecounter = 0;
secondCounter = 0;
super();
theRoot = this;
theStage = this.root.stage;
SetEverythingUpOnce();
}
function calcFrameTime(){
var _local1:Number;
_local1 = currentTime;
currentTime = getTimer();
if (currentTime < _local1){
_local1 = (currentTime - 100);
};
if (currentTime > (_local1 + (100 * 10))){
_local1 = (100 * 10);
};
ftime = ((1 / (1000 / Defs.fps)) * (currentTime - _local1));
framecounter++;
secondCounter = (secondCounter + (currentTime - _local1));
if (secondCounter > 1000){
fps = ((Number(framecounter) / secondCounter) * 1000);
framecounter = 0;
secondCounter = 0;
};
ftime = 1;
}
function addedToStage(_arg1:Event){
SetEverythingUpOnce2();
}
private function CreateTextField(_arg1:TextFormat, _arg2:Number, _arg3:Number, _arg4:String):TextField{
var _local5:TextField;
_local5 = new TextField();
_local5.selectable = false;
_local5.embedFonts = true;
_local5.autoSize = TextFieldAutoSize.CENTER;
_local5.x = _arg2;
_local5.y = _arg3;
_local5.text = _arg4;
_local5.setTextFormat(_arg1);
addChild(_local5);
return (_local5);
}
function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
addChild(_arg3);
return (_arg3);
}
function InitLevel(){
InitStageForGame();
Particles.Reset();
MouseControl.Reset();
Particles.Reset();
GameObjects.ClearAll();
Game.InitLevel();
}
function run(_arg1:Event):void{
KeyReader.UpdateOncePerFrame();
SoundPlayer.UpdateOncePerFrame();
MusicPlayer.UpdateOncePerFrame();
if (Game.sitelocked){
if (Domain.IsLockedOut()){
return;
};
};
calcFrameTime();
switch (gameState){
case gameState_TITLE:
TitleScreenState.Update(this);
break;
case gameState_HIGHSCORES:
break;
case gameState_LEVEL_PLAY:
RunLevel();
break;
};
}
function InitStageNoBackground(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
}
function SetEverythingUpOnce2():void{
theRoot = this;
theStage = this.root.stage;
Licensors.InitOnce();
Kong.InitOnce(this.root);
MusicPlayer.InitOnce();
KeyReader.InitOnce(theStage);
MouseControl.InitOnce(theStage);
SoundPlayer.InitOnce(this);
PauseMenu.InitOnce(this);
Particles.InitOnce(this, 500);
GameObjects.InitOnce(this, 1000);
InitDrawScreen();
InitFonts();
GraphicObjects.InitOnce(this);
MochiBot.track(this, "c7eba6b2");
addEventListener(Event.ENTER_FRAME, run);
InitStage();
Game.Init(this);
SetGameState(gameState_TITLE);
}
function RunTitle(){
}
function SetEverythingUpOnce():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
} else {
SetEverythingUpOnce2();
};
}
function InitStage(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
addChild(screenB);
screenB.x = 0;
screenB.y = 0;
}
function InitFonts():void{
var _local1:Font;
_local1 = new Font20();
tf_scorespr = new TextFormat();
tf_scorespr1 = new TextFormat();
tf_scorespr2 = new TextFormat();
tf_scoresprblack = new TextFormat();
tf_scorespr.font = _local1.fontName;
tf_scorespr.size = 20;
tf_scorespr.color = 4294967295;
tf_scorespr1.font = _local1.fontName;
tf_scorespr1.size = 50;
tf_scorespr1.color = 4294967295;
tf_scorespr2.font = _local1.fontName;
tf_scorespr2.size = 50;
tf_scorespr2.color = 0;
tf_scoresprblack.font = _local1.fontName;
tf_scoresprblack.size = 20;
tf_scoresprblack.color = 0;
}
function Render(){
this.x = 0;
this.y = 0;
Game.Render();
}
function InitDrawScreen():void{
screenBD = new BitmapData(Defs.displayarea_w, Defs.displayarea_h, true, 0);
screenB = new Bitmap(screenBD);
effectsScreenBD = new BitmapData(Defs.displayarea_w, Defs.displayarea_h, true, 0);
effectsScreenB = new Bitmap(effectsScreenBD);
hoseScreenMC = new MovieClip();
hoseScreenMC.x = 0;
hoseScreenMC.y = 0;
}
function SetGameState(_arg1:int):void{
gameState = _arg1;
Mouse.show();
switch (gameState){
case gameState_TITLE:
TitleScreenState.Init(this);
break;
case gameState_HIGHSCORES:
break;
case gameState_LEVEL_PLAY:
InitLevel();
break;
};
}
function InitStageForGame(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
addChild(screenB);
addChild(hoseScreenMC);
screenB.x = 0;
screenB.y = 0;
}
function RunLevel(){
if (PauseMenu.IsPaused() == false){
Game.UpdateGameplay();
};
Render();
}
}
}//package
Section 143
//mc_soundtoggle (mc_soundtoggle)
package {
import flash.display.*;
public dynamic class mc_soundtoggle extends MovieClip {
public function mc_soundtoggle(){
addFrameScript(0, frame1, 4, frame5);
}
function frame1(){
stop();
}
function frame5(){
stop();
}
}
}//package
Section 144
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.3");
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.parent._mochiad_ctr_failed){
options.ad_failed();
_local3 = true;
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("5cc6f7dfb67f2f08341c831480f7c2a7".length == 0){
options.ad_started();
options.ad_finished();
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
options.ad_failed();
_local4 = true;
};
};
};
if (this.parent._mochiad_ctr_failed){
options.ad_failed();
_local4 = true;
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 145
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 146
//MouseControl (MouseControl)
package {
import flash.events.*;
import flash.display.*;
public class MouseControl {
public static var mouseVelX:Number = 0;
public static var mouseVelY:Number = 0;
public static var mouseOldPosX:Number = 0;
public static var mouseOldPosY:Number = 0;
public static var mousePosX:Number = 0;
public static var mousePosY:Number = 0;
public static var buttonPressed:Boolean = false;
public static var buttonReleased:Boolean = false;
public static var delta:int = 0;
public static function MouseHandler(_arg1:MouseEvent):void{
mousePosX = _arg1.stageX;
mousePosY = _arg1.stageY;
mouseVelX = (mousePosX - mouseOldPosX);
mouseVelY = (mousePosY - mouseOldPosY);
mouseOldPosX = mousePosX;
mouseOldPosY = mousePosY;
}
public static function MouseClickHandler(_arg1:MouseEvent):void{
buttonPressed = true;
buttonReleased = false;
}
public static function InitOnce(_arg1:Stage):void{
_arg1.addEventListener(MouseEvent.MOUSE_MOVE, MouseHandler);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, MouseClickHandler);
_arg1.addEventListener(MouseEvent.MOUSE_UP, MouseUpHandler);
_arg1.addEventListener(MouseEvent.MOUSE_WHEEL, MouseWheelHandler);
}
public static function MouseUpHandler(_arg1:MouseEvent):void{
buttonPressed = false;
buttonReleased = true;
}
public static function MouseWheelHandler(_arg1:MouseEvent):void{
delta = _arg1.delta;
}
public static function Reset():void{
buttonPressed = false;
buttonReleased = false;
}
}
}//package
Section 147
//music_lapping (music_lapping)
package {
import flash.media.*;
public dynamic class music_lapping extends Sound {
}
}//package
Section 148
//MusicPlayer (MusicPlayer)
package {
import flash.utils.*;
import flash.media.*;
import flash.net.*;
public class MusicPlayer {
static var musicSound1:Sound;
static var lastMusicID = -1;
static var musicSoundTransform1:SoundTransform;
static var musicChannel1:SoundChannel = null;
static var currentMusicID:int = -1;
static var doMusic:Boolean;
static var musicChannel:SoundChannel = null;
static var streamChannelFlags:Array;
static var musicSoundTransform:SoundTransform;
static var musicSound:Sound;
static var streamSound:Sound = null;
static var streamChannels:Array;
static var streamChannelVolumes:Array;
public static var currentStreamID:int = -1;
public static function StartMusic(_arg1:String){
var classRef:Class;
var m:Sound;
var musicName = _arg1;
if (doMusic == false){
return;
};
if (musicChannel != null){
musicChannel.stop();
};
try {
classRef = (getDefinitionByName(musicName) as Class);
} catch(e:Object) {
classRef = null;
};
if (classRef == null){
trace(("Music Error: Can't find sound " + musicName));
} else {
m = (new (classRef) as Sound);
musicSoundTransform = new SoundTransform(1, 0);
musicSound = m;
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
};
lastMusicID = 0;
}
public static function InitOnce():void{
doMusic = Game.soundon;
lastMusicID = -1;
currentMusicID = -1;
streamChannels = new Array();
streamChannelFlags = new Array();
streamChannelVolumes = new Array();
}
public static function StopMusic(){
var _local1:int;
var _local2:SoundChannel;
var _local3:int;
_local1 = 0;
while (_local1 < streamChannels.length) {
_local3 = streamChannelFlags[_local1];
if ((((_local3 == 0)) || ((_local3 == 1)))){
_local3 = 2;
};
streamChannelFlags[_local1] = _local3;
_local1++;
};
if (musicChannel != null){
musicChannel.stop();
};
}
public static function ToggleMute(){
doMusic = (doMusic == false);
}
public static function StartStream(_arg1:int){
var _local2:URLRequest;
var _local3:SoundLoaderContext;
var _local4:SoundTransform;
streamSound = new Sound();
if (_arg1 == 0){
_local2 = new URLRequest("http://games.mochiads.com/c/g/water-werks/WaterWerks_Tune0.mp3");
};
if (_arg1 == 1){
_local2 = new URLRequest("http://games.mochiads.com/c/g/water-werks/WaterWerks_Tune1.mp3");
};
if (_arg1 == 2){
_local2 = new URLRequest("http://games.mochiads.com/c/g/water-werks/WaterWerks_Tune2.mp3");
};
if (_arg1 == 3){
_local2 = new URLRequest("http://games.mochiads.com/c/g/water-werks/WaterWerks_Tune3.mp3");
};
if (_arg1 == 4){
_local2 = new URLRequest("http://games.mochiads.com/c/g/water-werks/WaterWerks_Tune4.mp3");
};
if (_arg1 == 5){
_local2 = new URLRequest("http://games.mochiads.com/c/g/water-werks/WaterWerks_Tune5.mp3");
};
currentStreamID = _arg1;
_local3 = new SoundLoaderContext(1000, true);
_local4 = new SoundTransform(0);
streamSound.load(_local2, _local3);
streamChannels.push(streamSound.play(0, 999999, _local4));
streamChannelFlags.push(int(0));
streamChannelVolumes.push(Number(0));
}
public static function UpdateOncePerFrame(){
var _local1:Number;
var _local2:Boolean;
var _local3:int;
var _local4:SoundChannel;
var _local5:int;
var _local6:Number;
var _local7:SoundTransform;
var _local8:*;
var _local9:*;
var _local10:*;
_local1 = 0.02;
_local2 = false;
_local3 = 0;
while (_local3 < streamChannels.length) {
_local4 = streamChannels[_local3];
_local5 = streamChannelFlags[_local3];
_local6 = streamChannelVolumes[_local3];
if (_local5 == 0){
_local7 = _local4.soundTransform;
_local6 = (_local6 + _local1);
if (_local6 >= 1){
_local6 = 1;
_local5 = 1;
};
_local7.volume = _local6;
_local4.soundTransform = _local7;
} else {
if (_local5 == 1){
_local7 = _local4.soundTransform;
_local7.volume = _local6;
_local4.soundTransform = _local7;
} else {
if (_local5 == 2){
_local7 = _local4.soundTransform;
_local6 = (_local6 - _local1);
if (_local6 <= 0){
_local4.stop();
_local5 = 3;
_local2 = true;
};
_local7.volume = _local6;
_local4.soundTransform = _local7;
} else {
if (_local5 == 3){
};
};
};
};
streamChannelFlags[_local3] = _local5;
streamChannels[_local3] = _local4;
streamChannelVolumes[_local3] = _local6;
if (!doMusic){
_local7 = _local4.soundTransform;
_local7.volume = 0;
_local4.soundTransform = _local7;
};
_local3++;
};
if (_local2){
_local8 = new Array();
_local9 = new Array();
_local10 = new Array();
_local3 = 0;
while (_local3 < streamChannels.length) {
_local4 = streamChannels[_local3];
_local5 = streamChannelFlags[_local3];
_local6 = streamChannelVolumes[_local3];
if (_local5 != 3){
_local8.push(_local5);
_local9.push(_local4);
_local10.push(_local6);
};
_local3++;
};
streamChannelFlags = _local8;
streamChannels = _local9;
streamChannelVolumes = _local10;
};
if (!doMusic){
if (musicChannel != null){
_local7 = musicChannel.soundTransform;
_local7.volume = 0;
musicChannel.soundTransform = _local7;
};
} else {
if (musicChannel != null){
_local7 = musicChannel.soundTransform;
_local7.volume = 1;
musicChannel.soundTransform = _local7;
};
};
}
}
}//package
Section 149
//ObjectDef (ObjectDef)
package {
import flash.geom.*;
public class ObjectDef {
var type:int;
var exportName:String;
var collisionCircleOffsets:Array;
var animIDs:Array;
var particleExplodeID:int;
var initFuncName:String;
var maxHealth:Number;
var colRects:Array;
var collisionCircleRadii:Array;
var animNames:Array;
var shieldColRects:Array;
var shotControllers:Array;
var pathAnimType:int;
public function ObjectDef(_arg1:String, _arg2:int, _arg3:Rectangle){
animNames = new Array();
animIDs = new Array();
colRects = new Array();
shieldColRects = new Array();
collisionCircleOffsets = new Array();
collisionCircleRadii = new Array();
exportName = _arg1;
type = _arg2;
colRects.push(_arg3.clone());
maxHealth = 1;
initFuncName = "";
shotControllers = new Array();
}
public function AddColRect(_arg1:Rectangle){
colRects.push(_arg1.clone());
}
public function GetAnimIDFromName(_arg1:String):int{
var _local2:int;
var _local3:int;
_local2 = animNames.length;
_local3 = 0;
while (_local3 < _local2) {
if (animNames[_local3] == _arg1){
return (animIDs[_local3]);
};
_local3++;
};
trace(((("ERROR: Can't find anim name " + _arg1) + " on object ") + exportName));
return (40);
}
public function SetPathAnimType(_arg1:int){
pathAnimType = _arg1;
}
public function AddShotController(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number){
var _local5:ShotController;
_local5 = new ShotController();
_local5.Set(_arg1, _arg2, _arg3, _arg4);
shotControllers.push(_local5);
}
public function DoesAnimIDExist(_arg1:String):Boolean{
var _local2:int;
var _local3:int;
_local2 = animNames.length;
_local3 = 0;
while (_local3 < _local2) {
if (animNames[_local3] == _arg1){
return (true);
};
_local3++;
};
return (false);
}
public function AddShieldColRect(_arg1:Rectangle){
shieldColRects.push(_arg1.clone());
}
public function SetInitFunc(_arg1:String){
initFuncName = _arg1;
}
public function AddCollisionCircle(_arg1:Number, _arg2:Number, _arg3:Number){
collisionCircleOffsets.push(new Point(_arg1, _arg2));
collisionCircleRadii.push(_arg3);
}
public function SetParticle(_arg1:int){
particleExplodeID = _arg1;
}
public function SetHealth(_arg1:Number){
maxHealth = _arg1;
}
public function AddAnim(_arg1:String, _arg2:int){
animNames.push(_arg1);
animIDs.push(_arg2);
}
}
}//package
Section 150
//ObjectDefs (ObjectDefs)
package {
import flash.geom.*;
public class ObjectDefs {
static var list:Array;
public static function Init(){
var _local1:ObjectDef;
list = new Array();
_local1 = new ObjectDef("Player", 0, new Rectangle(-10, -30, 20, 40));
_local1.AddCollisionCircle(0, -17, 15);
_local1.AddCollisionCircle(0, -31, 15);
_local1.AddCollisionCircle(0, -45, 15);
list.push(_local1);
}
public static function GetObjectDefByExportName(_arg1:String){
var _local2:ObjectDef;
var _local3:int;
var _local4:int;
_local4 = list.length;
_local3 = 0;
while (_local3 < _local4) {
_local2 = list[_local3];
if (_local2.exportName == _arg1){
return (_local2);
};
_local3++;
};
trace(("ERROR: ObjectDefs can't find object exportname " + _arg1));
return (null);
}
}
}//package
Section 151
//Panel_Bits (Panel_Bits)
package {
import flash.display.*;
public dynamic class Panel_Bits extends MovieClip {
}
}//package
Section 152
//PanelPieces (PanelPieces)
package {
import flash.display.*;
public dynamic class PanelPieces extends MovieClip {
}
}//package
Section 153
//Particle (Particle)
package {
class Particle {
var graphicID:int;
public var yvel:Number;
var active:Boolean;
var maxframe:int;
var dir:Number;
var mode:int;
public var xvel:Number;
var ypos:Number;
var updateFunction:Function;
var timer:Number;
var speed:Number;
var startx:Number;
var starty:Number;
var xpos:Number;
var alpha:Number;
var alphaAdd:Number;
var color:uint;
var frame:Number;
var frameVel:Number;
var visible:Boolean;
var counter:int;
function UpdateVelsTimer(){
xpos = (xpos + xvel);
ypos = (ypos + yvel);
timer--;
if (timer <= 0){
active = false;
};
}
function PlayAnimation():Boolean{
frame = (frame + frameVel);
if (frame >= maxframe){
frame = maxframe;
return (true);
};
return (false);
}
public function UpdateWater():void{
xpos = (xpos + xvel);
ypos = (ypos + yvel);
yvel = (yvel + 0.3);
timer--;
if (timer <= 0){
};
frame++;
if (frame >= 29){
frame = 29;
active = false;
};
}
public function InitWater():void{
var _local1:Number;
var _local2:Number;
_local1 = Utils.RandCircle();
_local2 = Utils.RandBetweenFloat(3, 5);
xvel = (Math.cos(_local1) * _local2);
yvel = (Math.sin(_local1) * _local2);
frame = 0;
updateFunction = UpdateWater;
mode = 0;
color = 4278190335;
timer = 10;
graphicID = GraphicObjects.gfx_waterparticle;
frame = 20;
}
function UpdateSlime():void{
}
function CycleAnimation():Boolean{
frame = (frame + frameVel);
if (frame >= maxframe){
frame = 0;
return (true);
};
return (false);
}
public function InitSlime():void{
var _local1:Number;
var _local2:Number;
_local1 = (Utils.RandBetweenFloat(-1, 1) - (Math.PI * 0.5));
_local2 = Utils.RandBetweenFloat(11, 19);
xvel = (Math.cos(_local1) * _local2);
yvel = (Math.sin(_local1) * _local2);
frame = 0;
graphicID = 0;
updateFunction = UpdateSlime;
mode = 0;
}
function UpdateAnimAndStop(){
xpos = (xpos + xvel);
ypos = (ypos + yvel);
if (PlayAnimation()){
active = false;
};
}
}
}//package
Section 154
//Particles (Particles)
package {
import flash.geom.*;
public class Particles {
public static const type_dust = 0;
static var max:int;
static var list:Array;
static var main:Main;
static var nextIndex:int;
public function Particles():void{
}
public static function Add(_arg1:Number, _arg2:Number):Particle{
var _local3:Number;
var _local4:Number;
var _local5:Particle;
_local5 = list[nextIndex];
nextIndex++;
if (nextIndex >= max){
nextIndex = 0;
};
_local5.active = true;
_local5.timer = 0;
_local5.alpha = 1;
_local5.alphaAdd = 0;
_local5.visible = true;
_local5.xpos = _arg1;
_local5.ypos = _arg2;
return (_local5);
}
public static function GetNextIndex():int{
return (nextIndex);
}
public static function Reset(){
var _local1:int;
nextIndex = 0;
_local1 = 0;
while (_local1 < max) {
list[_local1].active = false;
_local1++;
};
}
public static function Update(_arg1:Number){
var _local2:int;
var _local3:Particle;
_local2 = 0;
while (_local2 < max) {
_local3 = list[_local2];
if (_local3.active == true){
_local3.updateFunction();
};
_local2++;
};
}
public static function InitOnce(_arg1:Main, _arg2:int):void{
var _local3:int;
var _local4:int;
main = _arg1;
max = _arg2;
nextIndex = 0;
list = new Array(max);
_local3 = 0;
while (_local3 < max) {
list[_local3] = new Particle();
list[_local3].active = false;
_local3++;
};
}
public static function CountActive():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 0;
while (_local2 < max) {
if (list[_local2].active){
_local1++;
};
_local2++;
};
return (_local1);
}
public static function Render(_arg1:Main){
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:int;
var _local10:Particle;
var _local11:Number;
var _local12:Number;
_local2 = (0 - 16);
_local3 = (Defs.displayarea_w + 16);
_local4 = (0 - 16);
_local5 = (Defs.displayarea_h + 16);
_local6 = 0;
_local7 = 0;
_local8 = 0;
while (_local8 < max) {
_local10 = list[_local8];
if (((_local10.active) && (_local10.visible))){
_local11 = (_local10.xpos - _local6);
_local12 = (_local10.ypos - _local7);
GraphicObjects.RenderAt(_local10.graphicID, int(_local10.frame), _arg1.effectsScreenBD, _local11, _local12);
};
_local8++;
};
}
}
}//package
Section 155
//PauseMenu (PauseMenu)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import flash.net.*;
import flash.ui.*;
public class PauseMenu {
static var active:Boolean;
static var pauseMC:MovieClip;
static var main:Main;
public function PauseMenu():void{
}
public static function buttonSoundPressed(_arg1:MouseEvent){
if (SoundPlayer.doSFX == false){
pauseMC.soundToggle.gotoAndStop("on");
SoundPlayer.doSFX = true;
} else {
pauseMC.soundToggle.gotoAndStop("off");
SoundPlayer.doSFX = false;
};
}
static function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
main.addChild(_arg3);
return (_arg3);
}
public static function InitOnce(_arg1:Main):void{
main = _arg1;
active = false;
}
public static function Pause():void{
Mouse.show();
main.addChild(pauseMC);
pauseMC.soundBtn.addEventListener(MouseEvent.CLICK, buttonSoundPressed);
active = true;
}
public static function IsPaused():Boolean{
return (active);
}
public static function Unpause():void{
Mouse.hide();
active = false;
main.removeChild(pauseMC);
}
}
}//package
Section 156
//PhysObj (PhysObj)
package {
import flash.geom.*;
public class PhysObj {
public var bodies:Array;
public var joints:Array;
public var name:String;
public var hitballsound:int;
public function PhysObj(){
hitballsound = 0;
}
function PointFromString(_arg1:String):Point{
var _local2:Array;
var _local3:Point;
_local2 = _arg1.split(",");
_local3 = new Point(0, 0);
if (_local2.length != 2){
trace(((("PointfromString. Error, numpoints=" + _local2.length) + " ") + _arg1));
return (_local3);
};
_local3.x = Number(_local2[0]);
_local3.y = Number(_local2[1]);
return (_local3);
}
function PointArrayFromString(_arg1:String):Array{
var _local2:Array;
var _local3:Array;
var _local4:int;
var _local5:int;
var _local6:Point;
_local2 = new Array();
_local3 = _arg1.split(",");
if ((((_local3.length < 2)) || (((_local3.length % 2) == 1)))){
trace(((("PointArrayFromString. Error, numpoints=" + _local3.length) + " , string= ") + _arg1));
return (_local2);
};
_local5 = (_local3.length / 2);
_local4 = 0;
while (_local4 < _local5) {
_local6 = new Point(0, 0);
_local6.x = Number(_local3[((_local4 * 2) + 0)]);
_local6.y = Number(_local3[((_local4 * 2) + 1)]);
_local2.push(_local6);
_local4++;
};
return (_local2);
}
public function BodyIndexFromName(_arg1:String):int{
var _local2:int;
var _local3:PhysObj_Body;
_local2 = 0;
while (_local2 < bodies.length) {
_local3 = bodies[_local2];
if (_local3.name == _arg1){
return (_local2);
};
_local2++;
};
trace(("ERROR PhysObj BodyIndexFromName " + _arg1));
return (0);
}
function BooleanFromString(_arg1:String):Boolean{
var _local2:Boolean;
_local2 = false;
_arg1 = _arg1.toUpperCase();
if (_arg1 == "1"){
_local2 = true;
};
if (_arg1 == "TRUE"){
_local2 = true;
};
return (_local2);
}
public function JointIndexFromName(_arg1:String):int{
var _local2:int;
var _local3:PhysObj_Joint;
_local2 = 0;
while (_local2 < joints.length) {
_local3 = joints[_local2];
if (_local3.name == _arg1){
return (_local2);
};
_local2++;
};
trace(("ERROR PhysObj JointIndexFromName " + _arg1));
return (0);
}
public function FromXml(_arg1:XML):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:String;
var _local6:XML;
var _local7:PhysObj_Body;
var _local8:XML;
var _local9:PhysObj_Graphic;
var _local10:XML;
var _local11:PhysObj_Shape;
var _local12:Point;
var _local13:XML;
var _local14:PhysObj_Joint;
bodies = new Array();
joints = new Array();
name = _arg1.@name;
_local2 = 0;
while (_local2 < _arg1.sound.length()) {
hitballsound = int(_arg1.sound[_local2].@hitball);
_local2++;
};
_local2 = 0;
while (_local2 < _arg1.body.length()) {
_local6 = _arg1.body[_local2];
_local7 = new PhysObj_Body();
_local7.name = _local6.@name;
_local7.fixed = BooleanFromString(_local6.@fixed);
_local7.sensor = BooleanFromString(_local6.@sensor);
_local7.pos = PointFromString(_local6.@pos);
if (_local6.@lineardamping != undefined){
_local7.linearDamping = Number(_local6.@lineardamping);
};
if (_local6.@angulardamping != undefined){
_local7.angularDamping = Number(_local6.@angulardamping);
};
_local3 = 0;
while (_local3 < _local6.graphic.length()) {
_local8 = _local6.graphic[_local3];
_local9 = new PhysObj_Graphic();
_local9.goInitFuntion = _local8.@gameobjfunction;
_local9.graphicName = _local8.@clip;
_local9.graphicID = 0;
_local9.frame = (int(_local8.@frame) - 1);
_local9.offset = PointFromString(_local8.@pos);
_local9.zoffset = XmlHelper.GetAttrNumber(_local8.@zoffset, 0);
_local9.hasShadow = XmlHelper.GetAttrBoolean(_local8.@shadow, true);
_local9.rot = Number(_local8.@rot);
_local9.Calculate();
_local7.graphics.push(_local9);
_local3++;
};
_local3 = 0;
while (_local3 < _local6.shape.length()) {
_local10 = _local6.shape[_local3];
_local11 = new PhysObj_Shape();
_local11.name = _local10.@name;
_local5 = _local10.@type;
_local12 = PointFromString(_local10.@col);
_local11.collisionCategory = int(_local12.x);
_local11.collisionMask = int(_local12.y);
_local11.density = Number(_local10.@density);
_local11.friction = Number(_local10.@friction);
_local11.restitution = Number(_local10.@restitution);
if (_local5 == "circle"){
_local11.type = PhysObj_Shape.Type_Circle;
_local11.circle_pos = PointFromString(_local10.@pos);
_local11.circle_radius = Number(_local10.@radius);
} else {
if (_local5 == "poly"){
_local11.type = PhysObj_Shape.Type_Poly;
_local11.poly_points = PointArrayFromString(_local10.@vertices);
_local11.poly_rot = Utils.DegToRad(Number(_local10.@rot));
};
};
_local11.Caclulate();
_local7.shapes.push(_local11);
_local3++;
};
bodies.push(_local7);
_local2++;
};
_local2 = 0;
while (_local2 < _arg1.joint.length()) {
_local13 = _arg1.joint[_local2];
_local14 = new PhysObj_Joint();
_local14.name = _local13.@name;
_local14.obj0Name = _local13.@body0;
_local14.obj1Name = _local13.@body1;
_local5 = _local13.@type;
if (_local5 == "rev"){
_local14.type = PhysObj_Joint.Type_Rev;
_local14.rev_pos = PointFromString(_local13.@pos);
_local14.rev_enableLimit = BooleanFromString(_local13.@enablelimit);
_local14.rev_lowerAngle = Utils.DegToRad(Number(_local13.@lowerangle));
_local14.rev_upperAngle = Utils.DegToRad(Number(_local13.@upperangle));
_local14.rev_enableMotor = BooleanFromString(_local13.@enablemotor);
_local14.rev_motorSpeed = Number(_local13.@motorspeed);
_local14.rev_maxMotorTorque = Number(_local13.@maxmotortorque);
} else {
if (_local5 == "distance"){
_local14.type = PhysObj_Joint.Type_Distance;
_local14.dist_pos0 = PointFromString(_local13.@pos);
_local14.dist_pos1 = PointFromString(_local13.@pos1);
_local14.dist_distance = Number(_local13.@distance);
} else {
if (_local5 == "mouse"){
_local14.type = PhysObj_Joint.Type_Mouse;
} else {
if (_local5 == "prismatic"){
_local14.type = PhysObj_Joint.Type_Prismatic;
_local14.prism_pos = PointFromString(_local13.@pos);
_local14.prism_enableLimit = BooleanFromString(_local13.@enablelimit);
_local14.prism_lowerTranslation = Number(_local13.@lowertranslation);
_local14.prism_upperTranslation = Number(_local13.@uppertranslation);
_local14.prism_enableMotor = BooleanFromString(_local13.@enablemotor);
_local14.prism_axisangle = (Number(_local13.@axisangle) - Number(90));
_local14.prism_motorSpeed = Number(_local13.@motorspeed);
_local14.prism_maxMotorForce = Number(_local13.@maxmotorforce);
};
};
};
};
joints.push(_local14);
_local2++;
};
}
}
}//package
Section 157
//PhysObj_Body (PhysObj_Body)
package {
import flash.geom.*;
public class PhysObj_Body {
public var angularDamping:Number;
public var name:String;
public var graphics:Array;
public var linearDamping:Number;
public var pos:Point;
public var shapes:Array;
public var fixed:Boolean;
public var sensor:Boolean;
public function PhysObj_Body(){
shapes = new Array();
graphics = new Array();
name = "";
pos = new Point();
fixed = true;
sensor = false;
linearDamping = 0.1;
angularDamping = 0.1;
}
}
}//package
Section 158
//PhysObj_BodyUserData (PhysObj_BodyUserData)
package {
public class PhysObj_BodyUserData {
public var type:String;
public var gameObjectID:int;
public var bodyName:String;
public var instance:PhysObj_Instance;
public function PhysObj_BodyUserData(){
type = "";
bodyName = "";
gameObjectID = -1;
instance = null;
}
}
}//package
Section 159
//PhysObj_Graphic (PhysObj_Graphic)
package {
import flash.geom.*;
public class PhysObj_Graphic {
public var graphicName:String;
public var graphicID:int;
public var frame:int;
public var hasShadow:Boolean;
public var offset:Point;
public var zoffset:Number;
public var rot:Number;
public var goInitFuntion:String;
public function PhysObj_Graphic(){
graphicName = "";
graphicID = 0;
frame = 0;
offset = new Point(0, 0);
rot = 0;
goInitFuntion = "";
zoffset = 0;
hasShadow = true;
}
public function Calculate(){
graphicID = GraphicObjects.GetIndexByName(graphicName);
if (frame < 0){
trace("ERROR: PhysObj Graphic has negative frame. Are you counting from 0 or 1?");
frame = 0;
};
}
}
}//package
Section 160
//PhysObj_Instance (PhysObj_Instance)
package {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
public class PhysObj_Instance {
public var instanceName:String;
public var timer:int;
public var bodies:Array;
public var rot:Number;
public var typeName:String;
public var joints:Array;
public var collideFunction:Function;
public var x:Number;
public var y:Number;
public var hitballsound:int;
public function PhysObj_Instance(){
bodies = new Array();
joints = new Array();
timer = 0;
collideFunction = null;
hitballsound = 0;
}
public function SetLinearVelocity(_arg1:Number, _arg2:Number):void{
var _local3:b2Body;
for each (_local3 in bodies) {
_local3.SetLinearVelocity(new b2Vec2(_arg1, _arg2));
};
}
public function SetPos(_arg1:Number, _arg2:Number):void{
var _local3:b2Body;
var _local4:b2Vec2;
var _local5:Number;
var _local6:b2Vec2;
x = _arg1;
y = _arg2;
for each (_local3 in bodies) {
_local4 = _local3.GetPosition();
_local5 = Utils.DistBetweenPoints(x, y, _local4.x, _local4.y);
if (_local5 > 1){
_local5 = 1;
};
_local6 = new b2Vec2(((x - _local4.x) * 0.1), ((y - _local4.y) * 0.01));
_local3.ApplyImpulse(_local6, new b2Vec2(0, 0));
};
}
public function Remove(){
var _local1:b2Joint;
var _local2:b2Body;
var _local3:PhysObj_BodyUserData;
var _local4:int;
var _local5:GameObj;
for each (_local1 in joints) {
Game.world.DestroyJoint(_local1);
};
for each (_local2 in bodies) {
_local3 = (_local2.GetUserData() as PhysObj_BodyUserData);
if (_local3 != null){
_local4 = _local3.gameObjectID;
if (_local4 != -1){
_local5 = GameObjects.objs[_local4];
_local5.active = false;
};
};
Game.world.DestroyBody(_local2);
};
}
}
}//package
Section 161
//PhysObj_Instances (PhysObj_Instances)
package {
public class PhysObj_Instances {
public var list:Array;
public function PhysObj_Instances(){
list = new Array();
}
public function Exists(_arg1:PhysObj_Instance):Boolean{
var _local2:PhysObj_Instance;
for each (_local2 in list) {
if (_local2 == _arg1){
return (true);
};
};
return (false);
}
public function GetByIndex(_arg1:int):PhysObj_Instance{
return (list[_arg1]);
}
public function RemoveByName(_arg1:String):void{
var _local2:PhysObj_Instance;
_local2 = FindByName(_arg1);
if (_local2 == null){
return;
};
Remove(_local2);
}
public function FindByName(_arg1:String):PhysObj_Instance{
var _local2:PhysObj_Instance;
for each (_local2 in list) {
if (_local2.instanceName == _arg1){
return (_local2);
};
};
return (null);
}
public function Remove(_arg1:PhysObj_Instance):Boolean{
var _local2:Array;
var _local3:PhysObj_Instance;
if (Exists(_arg1) == false){
return (false);
};
_arg1.Remove();
_local2 = new Array();
for each (_local3 in list) {
if (_local3 == _arg1){
} else {
_local2.push(_local3);
};
};
list = _local2;
return (true);
}
}
}//package
Section 162
//PhysObj_Joint (PhysObj_Joint)
package {
import flash.geom.*;
public class PhysObj_Joint {
public var prism_pos:Point;
public var obj0Name:String;
public var obj1Name:String;
public var dist_distance:Number;
public var name:String;
public var prism_lowerTranslation:Number;
public var prism_enableLimit:Boolean;
public var prism_maxMotorForce:Number;
public var dist_pos0:Point;
public var prism_enableMotor:Boolean;
public var prism_axisangle:Number;
public var rev_enableMotor:Boolean;
public var prism_motorSpeed:Number;
public var rev_enableLimit:Boolean;
public var dist_pos1:Point;
public var rev_upperAngle:Number;
public var rev_lowerAngle:Number;
public var rev_maxMotorTorque:Number;
public var rev_pos:Point;
public var type:int;
public var prism_upperTranslation:Number;
public var rev_motorSpeed:Number;
public static const Type_Mouse:int = 3;
public static const Type_Prismatic:int = 2;
public static const Type_Distance:int = 1;
public static const Type_Rev:int = 0;
public function PhysObj_Joint(){
type = 0;
name = "";
obj0Name = "";
obj1Name = "";
rev_pos = new Point(0, 0);
rev_enableLimit = false;
rev_lowerAngle = 0;
rev_upperAngle = 0;
rev_enableMotor = false;
rev_motorSpeed = 0;
rev_maxMotorTorque = 0;
prism_pos = new Point(0, 0);
prism_lowerTranslation = 0;
prism_upperTranslation = 0;
prism_enableLimit = false;
prism_enableMotor = false;
prism_motorSpeed = 0;
prism_maxMotorForce = 0;
prism_axisangle = 0;
dist_pos0 = new Point(0, 0);
dist_pos1 = new Point(0, 0);
dist_distance = 1;
}
}
}//package
Section 163
//PhysObj_Shape (PhysObj_Shape)
package {
import flash.geom.*;
public class PhysObj_Shape {
public var type:int;
public var name:String;
public var collisionCategory:int;
public var circle_radius:Number;
public var poly_rot:Number;
public var circle_pos:Point;
public var density:Number;
public var restitution:Number;
public var poly_points:Array;
public var friction:Number;
public var collisionMask:int;
public static const Type_Poly:int = 0;
public static const Type_Circle:int = 1;
public function PhysObj_Shape(){
type = 0;
name = "";
poly_points = new Array();
circle_pos = new Point();
circle_radius = 0;
poly_rot = 0;
collisionCategory = 0;
collisionMask = 0;
}
public function Caclulate(){
var _local1:Matrix;
var _local2:Array;
var _local3:Point;
var _local4:Point;
if (type == Type_Poly){
_local1 = new Matrix();
_local1.rotate(poly_rot);
_local2 = new Array();
for each (_local3 in poly_points) {
_local4 = _local1.transformPoint(_local3);
_local2.push(_local4);
};
poly_points = _local2;
};
}
}
}//package
Section 164
//PhysObjs (PhysObjs)
package {
public class PhysObjs {
public var list:Array;
public function PhysObjs(){
list = new Array();
}
public function GetNum():int{
return (list.length);
}
public function GetByIndex(_arg1:int):PhysObj{
return (list[_arg1]);
}
public function FindByName(_arg1:String):PhysObj{
var _local2:PhysObj;
for each (_local2 in list) {
if (_local2.name == _arg1){
return (_local2);
};
};
trace(("ERROR PhysObjs FindByName " + _arg1));
return (null);
}
public function InitFromXml(_arg1:XML):void{
var _local2:int;
var _local3:XML;
var _local4:PhysObj;
list = new Array();
_local2 = 0;
while (_local2 < _arg1.physobj.length()) {
_local3 = _arg1.physobj[_local2];
_local4 = new PhysObj();
_local4.FromXml(_local3);
list.push(_local4);
_local2++;
};
}
}
}//package
Section 165
//PlayerWeapon (PlayerWeapon)
package {
public class PlayerWeapon {
var type:int;
var homingSpeed:Array;
var speed:Number;
var bulletDamage:Array;
var powerChargeRates:Array;
var angle:Number;
var homingRates:Array;
var powerCharge:Number;
var homingTurnRates:Array;
var rate:int;
var homingDamage:Array;
var bulletSpeed:Array;
var damage:Number;
var bulletRates:Array;
var levels:Array;
var turnRate:Number;
var fireTimer:int;
static const type_power = 2;
static const type_homing = 1;
static const lev_speed = 1;
static const type_bullet = 0;
static const lev_max = 5;
static const lev_damage = 2;
static const lev_charge = 4;
static const lev_rate = 0;
static const lev_turnRate = 3;
public function PlayerWeapon(){
levels = new Array(lev_max);
levels[lev_rate] = 0;
levels[lev_damage] = 0;
levels[lev_speed] = 0;
levels[lev_turnRate] = 0;
levels[lev_charge] = 0;
bulletRates = new Array();
bulletDamage = new Array();
bulletSpeed = new Array();
homingRates = new Array();
homingSpeed = new Array();
homingTurnRates = new Array();
homingDamage = new Array();
powerChargeRates = new Array();
bulletRates.push(0, 15, 11, 9, 7, 5);
bulletDamage.push(0, 1, 2, 3, 4, 5);
bulletSpeed.push(0, 6, 12, 18, 24, 30);
homingRates.push(0, 50, 40, 30, 20, 10);
homingSpeed.push(0, 3, 6, 9, 12, 15);
homingTurnRates.push(0, 0.05, 0.1, 0.15, 0.2, 0.25);
homingDamage.push(0, 2, 3, 4, 5, 6);
powerChargeRates.push(0, 500, 500, 500, 500, 500);
}
public function IncreaseLevel(_arg1:int, _arg2:int){
levels[_arg1] = (levels[_arg1] + _arg2);
if (levels[_arg1] >= 4){
levels[_arg1] = 4;
};
}
public function SetLevel(_arg1:int, _arg2:int){
levels[_arg1] = _arg2;
}
public function SetHoming(){
type = type_homing;
angle = (-(Math.PI) / 2);
Reset();
}
public function GetFireRate():int{
var _local1:int;
_local1 = levels[lev_rate];
if (type == type_bullet){
return (bulletRates[_local1]);
};
if (type == type_homing){
return (homingRates[_local1]);
};
return (0);
}
public function GetDamage():Number{
var _local1:*;
var _local2:int;
_local1 = 1;
_local2 = levels[lev_damage];
if (type == type_bullet){
return ((_local1 * bulletDamage[_local2]));
};
if (type == type_homing){
return ((_local1 * homingDamage[_local2]));
};
return (0);
}
public function Reset(){
fireTimer = 0;
}
public function SetPower(){
type = type_power;
angle = 0;
Reset();
}
public function SetBullet(_arg1:Number){
type = type_bullet;
angle = _arg1;
Reset();
}
public function GetFireAngle():Number{
return (angle);
}
public function IsActive():Boolean{
var _local1:int;
_local1 = levels[lev_rate];
if (_local1 == 0){
return (false);
};
return (true);
}
public function GetSpeed():Number{
var _local1:int;
_local1 = levels[lev_speed];
if (type == type_bullet){
return (bulletSpeed[_local1]);
};
if (type == type_homing){
return (homingSpeed[_local1]);
};
return (0);
}
}
}//package
Section 166
//Poly (Poly)
package {
import flash.display.*;
import flash.geom.*;
public class Poly {
var param0:String;
var param1:String;
var subTypeName:String;
var active:Boolean;
var name:String;
var pointList:Array;
var typeName:String;
var boundingRectangle:Rectangle;
var iparam0:int;
var lineList:Array;
var closed:Boolean;
var hitCallback:Object;
var type:int;
var catmullRomLength:Number;
public static const polytype_WALL = 1;
public static const polytype_CEILING = 6;
public static const polytype_ZONE = 3;
public static const polytype_PATH = 0;
public static const polytype_FLOOR = 5;
public static const polytype_OVERLAY = 4;
public static const polytype_TRIGGER = 2;
public function Poly(_arg1:String, _arg2:int, _arg3:Number, _arg4:Number):void{
lineList = new Array();
active = true;
type = _arg2;
name = _arg1;
boundingRectangle = null;
hitCallback = null;
closed = false;
pointList = new Array();
pointList.push(new Point(_arg3, _arg4));
}
function PointOnCurve(_arg1:Number, _arg2:Point, _arg3:Point, _arg4:Point, _arg5:Point):Point{
var _local6:Point;
var _local7:Number;
var _local8:Number;
_local6 = new Point();
_local7 = (_arg1 * _arg1);
_local8 = (_local7 * _arg1);
_local6.x = (0.5 * ((((2 * _arg3.x) + ((-(_arg2.x) + _arg4.x) * _arg1)) + (((((2 * _arg2.x) - (5 * _arg3.x)) + (4 * _arg4.x)) - _arg5.x) * _local7)) + ((((-(_arg2.x) + (3 * _arg3.x)) - (3 * _arg4.x)) + _arg5.x) * _local8)));
_local6.y = (0.5 * ((((2 * _arg3.y) + ((-(_arg2.y) + _arg4.y) * _arg1)) + (((((2 * _arg2.y) - (5 * _arg3.y)) + (4 * _arg4.y)) - _arg5.y) * _local7)) + ((((-(_arg2.y) + (3 * _arg3.y)) - (3 * _arg4.y)) + _arg5.y) * _local8)));
return (_local6);
}
public function GetPoint(_arg1:int):Point{
return (new Point(pointList[_arg1].x, pointList[_arg1].y));
}
public function GetPointNormal(_arg1:int):Point{
return (new Point(lineList[_arg1].nx, lineList[_arg1].ny));
}
public function GetPointOnCatmullRom(_arg1:Number):Point{
var _local2:int;
var _local3:int;
var _local4:Point;
var _local5:Point;
var _local6:Point;
var _local7:Point;
var _local8:Number;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Point;
_local2 = GetNumPoints();
if (_local2 < 4){
return (new Point(0, 0));
};
_local3 = (_local2 - 1);
_local8 = (Number(_local3) * _arg1);
_local9 = _local8;
_local10 = (_local9 - 1);
_local11 = _local9;
_local12 = (_local9 + 1);
_local13 = (_local9 + 2);
if (_local10 < 0){
_local10 = 0;
};
if (_local12 > (_local2 - 1)){
_local12 = (_local2 - 1);
};
if (_local13 > (_local2 - 1)){
_local13 = (_local2 - 1);
};
_local4 = pointList[_local10];
_local5 = pointList[_local11];
_local6 = pointList[_local12];
_local7 = pointList[_local13];
_local14 = (_local9 + 1);
_local15 = ((1 / Number(_local3)) * _local9);
_local16 = ((1 / Number(_local3)) * _local14);
_local17 = ((1 / (_local16 - _local15)) * (_arg1 - _local15));
_local18 = PointOnCurve(_local17, _local4, _local5, _local6, _local7);
return (_local18);
}
public function AddLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Line;
var _local6:Rectangle;
_local5 = new Line(_arg1, _arg2, _arg3, _arg4);
lineList.push(_local5);
pointList.push(new Point(_arg3, _arg4));
if (boundingRectangle == null){
boundingRectangle = _local5.boundingRect;
} else {
_local6 = boundingRectangle.clone();
boundingRectangle = _local6.union(_local5.boundingRect);
};
}
public function GetLine(_arg1:int):Line{
return (lineList[_arg1]);
}
public function CalculateCatmullRomLength(){
var _local1:Array;
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:Point;
var _local6:Point;
var _local7:Point;
_local1 = new Array();
_local3 = GetNumPoints();
if (_local3 < 4){
catmullRomLength = 0;
} else {
_local4 = 0;
while (_local4 < 1) {
_local5 = GetPointOnCatmullRom(_local4);
_local1.push(_local5);
_local4 = (_local4 + 0.025);
};
};
catmullRomLength = 0;
_local2 = 0;
while (_local2 < (_local1.length - 2)) {
_local6 = _local1[_local2];
_local7 = _local1[(_local2 + 1)];
catmullRomLength = (catmullRomLength + Utils.DistBetweenPoints(_local6.x, _local6.y, _local7.x, _local7.y));
_local2++;
};
_local1 = null;
}
public function Finish(_arg1:Boolean){
var _local2:Line;
var _local3:Line;
var _local4:Line;
var _local5:Rectangle;
if (_arg1){
_local2 = lineList[0];
_local3 = lineList[(lineList.length - 1)];
_local4 = new Line(_local3.x1, _local3.y1, _local2.x0, _local2.y0);
lineList.push(_local4);
_local5 = boundingRectangle.clone();
boundingRectangle = _local5.union(_local4.boundingRect);
};
closed = _arg1;
}
public function GetCatmullRomLength():Number{
return (catmullRomLength);
}
public function GetNumLines():int{
return (lineList.length);
}
public function OffsetFromStartPoint(){
var _local1:*;
var _local2:*;
var _local3:int;
var _local4:Line;
_local1 = -(pointList[0].x);
_local2 = -(pointList[0].y);
_local3 = 0;
while (_local3 < pointList.length) {
pointList[_local3].x = (pointList[_local3].x + _local1);
pointList[_local3].y = (pointList[_local3].y + _local2);
_local3++;
};
_local3 = 0;
while (_local3 < lineList.length) {
_local4 = lineList[_local3];
lineList[_local3].x0 = (_local4.x0 + _local1);
_local4.x1 = (_local4.x1 + _local1);
_local4.y0 = (_local4.y0 + _local2);
_local4.y1 = (_local4.y1 + _local2);
_local3++;
};
}
public function DrawCatmullRom(_arg1:BitmapData, _arg2:uint, _arg3:Number, _arg4:Number){
var _local5:int;
var _local6:Number;
var _local7:Point;
_local5 = GetNumPoints();
if (_local5 < 4){
return;
};
_local6 = 0;
while (_local6 < 1) {
_local7 = GetPointOnCatmullRom(_local6);
_arg1.setPixel32((_local7.x + _arg3), (_local7.y + _arg4), _arg2);
_local6 = (_local6 + 0.001);
};
}
public function GetNumPoints():int{
return (pointList.length);
}
public static function MakeSplineFromPointList(_arg1:Array):Poly{
var _local2:Point;
var _local3:Point;
var _local4:Poly;
var _local5:int;
var _local6:int;
_local2 = _arg1[0];
_local4 = new Poly("", 0, _local2.x, _local2.y);
_local5 = _arg1.length;
_local6 = 0;
while (_local6 < (_local5 - 1)) {
_local2 = _arg1[_local6];
_local3 = _arg1[(_local6 + 1)];
_local4.AddLine(_local2.x, _local2.y, _local3.x, _local3.y);
_local6++;
};
_local4.Finish(false);
_local4.CalculateCatmullRomLength();
return (_local4);
}
public static function FindAllByType(_arg1:int, _arg2:Array):Array{
var _local3:Array;
var _local4:Poly;
_local3 = new Array();
for each (_local4 in _arg2) {
if (_local4.type == _arg1){
_local3.push(_local4);
};
};
return (_local3);
}
public static function FindByName(_arg1:String, _arg2:Array):Poly{
var _local3:Poly;
for each (_local3 in _arg2) {
if (_local3.name == _arg1){
return (_local3);
};
};
return (null);
}
public static function FindIndexByName(_arg1:String, _arg2:Array):int{
var _local3:int;
var _local4:Poly;
_local3 = 0;
for each (_local4 in _arg2) {
if (_local4.name == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
}
}//package
Section 167
//SaveData (SaveData)
package {
import flash.net.*;
public class SaveData {
static var id:String = "WaterWerks";
public static function Clear():void{
var _local1:SharedObject;
_local1 = SharedObject.getLocal(id);
_local1.clear();
_local1.close();
_local1.flush();
trace("SaveData Data Cleared");
trace(("len: " + _local1.size));
}
public static function Save():void{
var _local1:int;
var _local2:SharedObject;
var _local3:Array;
var _local4:LevelResult;
var _local5:Object;
_local2 = SharedObject.getLocal(id);
if (_local2 == null){
trace("SO null");
return;
};
if (_local2.size == 0){
trace("SO size 0");
};
_local2.clear();
_local3 = new Array();
_local1 = 0;
while (_local1 < 60) {
_local4 = Game.levelResults[_local1];
_local5 = new Object();
_local5.bestTime = _local4.bestTime;
_local5.bestScore = _local4.bestScore;
_local5.bestNumKilled = _local4.bestNumKilled;
_local5.bonus = _local4.bonus;
_local5.complete = _local4.complete;
_local5.locked = _local4.locked;
_local3.push(_local5);
_local1++;
};
_local2.data.results = _local3;
_local2.close();
trace("Saved Data OK");
}
public static function Load():void{
var _local1:SharedObject;
var _local2:int;
var _local3:Object;
var _local4:LevelResult;
_local1 = SharedObject.getLocal(id);
if (_local1 == null){
trace((("Shared Object: " + id) + " is null"));
return;
};
if (_local1.size == 0){
trace((("Shared Object: " + id) + " size=0"));
_local1.close();
return;
};
_local2 = 0;
while (_local2 < 60) {
_local3 = _local1.data.results[_local2];
_local4 = Game.levelResults[_local2];
_local4.bestTime = _local3.bestTime;
_local4.bestScore = _local3.bestScore;
_local4.bestNumKilled = _local3.bestNumKilled;
_local4.bonus = _local3.bonus;
_local4.complete = _local3.complete;
_local4.locked = _local3.locked;
_local2++;
};
_local1.close();
trace("Loaded data OK");
}
public static function DontLoad():void{
}
public static function Exists():Boolean{
var _local1:SharedObject;
_local1 = SharedObject.getLocal(id);
if (_local1 == null){
trace((("Shared Object: " + id) + " null"));
return (false);
};
if (_local1.size == 0){
trace((("Shared Object: " + id) + " size 0"));
_local1.close();
return (false);
};
_local1.close();
return (true);
}
public static function DontSave():void{
}
}
}//package
Section 168
//sfx_ballappear (sfx_ballappear)
package {
import flash.media.*;
public dynamic class sfx_ballappear extends Sound {
}
}//package
Section 169
//sfx_big_thud (sfx_big_thud)
package {
import flash.media.*;
public dynamic class sfx_big_thud extends Sound {
}
}//package
Section 170
//sfx_bling (sfx_bling)
package {
import flash.media.*;
public dynamic class sfx_bling extends Sound {
}
}//package
Section 171
//sfx_boing (sfx_boing)
package {
import flash.media.*;
public dynamic class sfx_boing extends Sound {
}
}//package
Section 172
//sfx_bounce0 (sfx_bounce0)
package {
import flash.media.*;
public dynamic class sfx_bounce0 extends Sound {
}
}//package
Section 173
//sfx_bounce1 (sfx_bounce1)
package {
import flash.media.*;
public dynamic class sfx_bounce1 extends Sound {
}
}//package
Section 174
//sfx_bounce2 (sfx_bounce2)
package {
import flash.media.*;
public dynamic class sfx_bounce2 extends Sound {
}
}//package
Section 175
//sfx_clunk (sfx_clunk)
package {
import flash.media.*;
public dynamic class sfx_clunk extends Sound {
}
}//package
Section 176
//sfx_impact (sfx_impact)
package {
import flash.media.*;
public dynamic class sfx_impact extends Sound {
}
}//package
Section 177
//sfx_removepin (sfx_removepin)
package {
import flash.media.*;
public dynamic class sfx_removepin extends Sound {
}
}//package
Section 178
//sfx_scream1 (sfx_scream1)
package {
import flash.media.*;
public dynamic class sfx_scream1 extends Sound {
}
}//package
Section 179
//sfx_scream2 (sfx_scream2)
package {
import flash.media.*;
public dynamic class sfx_scream2 extends Sound {
}
}//package
Section 180
//sfx_scream3 (sfx_scream3)
package {
import flash.media.*;
public dynamic class sfx_scream3 extends Sound {
}
}//package
Section 181
//sfx_smallhit (sfx_smallhit)
package {
import flash.media.*;
public dynamic class sfx_smallhit extends Sound {
}
}//package
Section 182
//sfx_turning (sfx_turning)
package {
import flash.media.*;
public dynamic class sfx_turning extends Sound {
}
}//package
Section 183
//sfx_watersplash (sfx_watersplash)
package {
import flash.media.*;
public dynamic class sfx_watersplash extends Sound {
}
}//package
Section 184
//sfx_woohoo1 (sfx_woohoo1)
package {
import flash.media.*;
public dynamic class sfx_woohoo1 extends Sound {
}
}//package
Section 185
//sfx_woohoo2 (sfx_woohoo2)
package {
import flash.media.*;
public dynamic class sfx_woohoo2 extends Sound {
}
}//package
Section 186
//Shop (Shop)
package {
import flash.events.*;
import flash.display.*;
public class Shop {
static var buttons:Array;
static var costs:Array;
static var titleMC:MovieClip;
static var levels:Array;
public static function buttonOut(_arg1:MouseEvent){
titleMC.textInfo.text = "...";
}
static function GetLevels(){
var _local1:int;
var _local2:String;
var _local3:int;
var _local4:int;
var _local5:PlayerWeapon;
_local1 = 0;
for each (_local2 in buttons) {
_local3 = parseInt(_local2.charAt(2), 10);
_local4 = parseInt(_local2.charAt(4), 10);
if (_local3 != 6){
_local5 = Game.goPlayer.playerWeapons[_local3];
_local5.Reset();
_local5.SetLevel(_local4, levels[_local1]);
};
_local1++;
};
}
static function GetCost(_arg1:int):int{
var _local2:*;
_local2 = (costs[_arg1] * (levels[_arg1] + 1));
return (_local2);
}
static function UpdateStuff():void{
var _local1:String;
var _local2:int;
var _local3:int;
titleMC.textCreds.text = ("Creds: " + Game.numCreds);
_local2 = 0;
while (_local2 < buttons.length) {
_local1 = buttons[_local2];
_local3 = levels[_local2];
titleMC[_local1].gotoAndStop((_local3 + 1));
_local2++;
};
}
public static function buttonOver(_arg1:MouseEvent){
var _local2:String;
var _local3:int;
var _local4:String;
var _local5:*;
_local2 = _arg1.currentTarget.name;
_local3 = 0;
while (_local3 < buttons.length) {
_local4 = buttons[_local3];
if (_local4 == _local2){
_local5 = GetCost(_local3);
titleMC.textInfo.text = (("Cost: " + _local5) + " creds");
};
_local3++;
};
}
public static function Init(){
var _local1:String;
var _local2:int;
Game.pause = true;
_local2 = 0;
while (_local2 < buttons.length) {
_local1 = buttons[_local2];
titleMC[_local1].addEventListener(MouseEvent.CLICK, buttonBuyPressed);
titleMC[_local1].addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
titleMC[_local1].addEventListener(MouseEvent.MOUSE_OUT, buttonOut);
_local2++;
};
titleMC.buttonExit.addEventListener(MouseEvent.CLICK, buttonExitPressed);
UpdateStuff();
}
public static function InitOnce(){
var _local1:int;
levels = new Array(100);
buttons = new Array();
costs = new Array();
buttons.push("b_0_0", "b_1_0", "b_2_0", "b_3_0", "b_4_0");
buttons.push("b_0_1", "b_1_1", "b_2_1", "b_3_1", "b_4_1");
buttons.push("b_0_2", "b_1_2", "b_2_2", "b_3_2", "b_4_2");
buttons.push("b_5_0", "b_5_1", "b_5_2", "b_5_3");
buttons.push("b_6_0");
costs.push(10, 10, 10, 10, 10);
costs.push(5, 5, 5, 5, 5);
costs.push(5, 5, 5, 5, 5);
costs.push(10, 10, 10, 10);
costs.push(50);
_local1 = 0;
while (_local1 < 100) {
levels[_local1] = 1;
_local1++;
};
levels[1] = 0;
levels[2] = 0;
levels[3] = 0;
levels[4] = 0;
levels[15] = 0;
}
public static function buttonExitPressed(_arg1:MouseEvent){
GetLevels();
Game.pause = false;
Game.main.removeChild(titleMC);
titleMC = null;
KeyReader.InitOnce(Game.main.stage);
}
public static function buttonBuyPressed(_arg1:MouseEvent){
var _local2:String;
var _local3:int;
var _local4:String;
var _local5:*;
_local2 = _arg1.currentTarget.name;
_local3 = 0;
while (_local3 < buttons.length) {
_local4 = buttons[_local3];
if (_local4 == _local2){
if (levels[_local3] >= 5){
return;
};
_local5 = GetCost(_local3);
if (Game.numCreds >= _local5){
var _local6 = levels;
var _local7 = _local3;
var _local8 = (_local6[_local7] + 1);
_local6[_local7] = _local8;
Game.numCreds = (Game.numCreds - _local5);
break;
};
};
_local3++;
};
UpdateStuff();
buttonOver(_arg1);
}
}
}//package
Section 187
//ShotController (ShotController)
package {
public class ShotController {
public var timer:int;
public var shotTypeName:String;
public var yoff:Number;
public var xoff:Number;
public var shotDefIndex:int;
public function Set(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number){
timer = 0;
shotTypeName = _arg1;
shotDefIndex = WaveDefs.GetShotDefIndexByName(_arg2);
xoff = _arg3;
yoff = _arg4;
}
public function clone():ShotController{
var _local1:ShotController;
_local1 = new ShotController();
_local1.timer = timer;
_local1.shotTypeName = shotTypeName;
_local1.shotDefIndex = shotDefIndex;
_local1.xoff = xoff;
_local1.yoff = yoff;
return (_local1);
}
}
}//package
Section 188
//ShotDef (ShotDef)
package {
public class ShotDef {
var spreadRange:Number;
var name:String;
var spreadAng:Number;
var intervalTicks:Number;
var numShots:int;
var type:int;
public function ShotDef(_arg1:String){
name = _arg1;
type = 0;
intervalTicks = 0;
}
public function SetSpreadPulse(_arg1:Number, _arg2:int, _arg3:Number, _arg4=-1){
intervalTicks = (Defs.fps * _arg1);
type = 1;
numShots = _arg2;
spreadRange = Utils.DegToRad(_arg3);
spreadAng = -1;
if (_arg4 != -1){
spreadAng = Utils.DegToRad(_arg4);
};
}
public function SetNormal(_arg1:Number){
intervalTicks = (Defs.fps * _arg1);
type = 0;
}
}
}//package
Section 189
//SiteLock (SiteLock)
package {
import flash.events.*;
public class SiteLock {
static var miniclip_locked:Boolean = false;
static var sitelockActive:Boolean = false;
public static function InitOnce():void{
}
static function onValidDomain(_arg1:Event):void{
trace("Miniclip sitelock OK");
miniclip_locked = false;
}
public static function IsLocked():Boolean{
var _local1:String;
_local1 = GetDomain();
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
if (_local1 != "kongregate.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_SHOCKWAVE){
if (_local1 != "shockwave.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_KING){
if (((!((_local1 == "king.com"))) && (!((_local1 == "midasplayer.com"))))){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMEZHERO){
if (_local1 != "gamezhero.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_ARMORGAMES){
if (_local1 != "armorgames.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_BUBBLEBOX){
if (_local1 != "bubblebox.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_ANDKON){
if (_local1 != "andkon.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_BIGFISH){
if (((((((((((!((_local1 == "bigfishgames.com"))) && (!((_local1 == "bigfishgames.de"))))) && (!((_local1 == "bigfishgames.fr"))))) && (!((_local1 == "bigfishgames.es"))))) && (!((_local1 == "bigfishgames.mx"))))) && (!((_local1 == "bigfishgames.jp"))))){
return (true);
};
return (false);
};
return (false);
}
public static function GetDomain():String{
var _local1:String;
var _local2:Number;
var _local3:Number;
var _local4:String;
var _local5:Number;
var _local6:Number;
_local1 = Main.theStage.loaderInfo.url;
_local2 = (_local1.indexOf("://") + 3);
_local3 = _local1.indexOf("/", _local2);
_local4 = _local1.substring(_local2, _local3);
_local5 = (_local4.lastIndexOf(".") - 1);
_local6 = (_local4.lastIndexOf(".", _local5) + 1);
_local4 = _local4.substring(_local6, _local4.length);
return (_local4);
}
public static function GetDomainFromUrl(_arg1:String):String{
var _local2:Number;
var _local3:Number;
var _local4:String;
var _local5:Number;
var _local6:Number;
_local2 = (_arg1.indexOf("://") + 3);
_local3 = _arg1.indexOf("/", _local2);
_local4 = _arg1.substring(_local2, _local3);
_local5 = (_local4.lastIndexOf(".") - 1);
_local6 = (_local4.lastIndexOf(".", _local5) + 1);
_local4 = _local4.substring(_local6, _local4.length);
return (_local4);
}
static function onInvalidDomain(_arg1:Event):void{
trace("Miniclip sitelock INVALID");
miniclip_locked = true;
}
}
}//package
Section 190
//SoundPlayer (SoundPlayer)
package {
import flash.utils.*;
import flash.media.*;
public class SoundPlayer {
public static const minPlayTime = 3;
static var doSFX:Boolean;
static var channel:SoundChannel;
public static var startTimes:Array;
static var timer:Timer;
static var active = false;
public static var sounds:Array;
public static var sound:Sound;
public static var times:Array;
public static var volumes:Array;
public static var lengths:Array;
public static var soundTransform:SoundTransform;
static var Instances:Array;
public static var names:Array;
public static var soundTransforms:Array;
static var main:Main;
static var playingFlag:Boolean;
public static var soundChannels:Array;
static function AddSound(_arg1:String){
var classRef:Class;
var s:Sound;
var _soundName = _arg1;
try {
classRef = (getDefinitionByName(_soundName) as Class);
} catch(e:Object) {
classRef = null;
};
if (classRef == null){
trace(("AddSound Error: Can't find sound " + _soundName));
sounds.push(null);
} else {
s = (new (classRef) as Sound);
sounds.push(s);
};
names.push(_soundName);
startTimes.push(0);
lengths.push(0);
volumes.push(1);
times.push(0);
}
public static function InitOnce(_arg1:Main):void{
doSFX = Game.soundon;
main = _arg1;
startTimes = new Array();
lengths = new Array();
sounds = new Array();
names = new Array();
times = new Array();
volumes = new Array();
soundChannels = new Array();
soundTransforms = new Array();
AddSound("sfx_big_thud");
AddSound("sfx_bling");
AddSound("sfx_boing");
AddSound("sfx_bounce0");
AddSound("sfx_bounce1");
AddSound("sfx_bounce2");
AddSound("sfx_clunk");
AddSound("sfx_impact");
AddSound("sfx_scream1");
AddSound("sfx_scream2");
AddSound("sfx_scream3");
AddSound("sfx_smallhit");
AddSound("sfx_turning");
AddSound("sfx_watersplash");
AddSound("sfx_woohoo1");
AddSound("sfx_woohoo2");
AddSound("sfx_ballappear");
AddSound("sfx_removepin");
soundTransform = new SoundTransform(1, 0);
active = true;
playingFlag = false;
}
public static function UpdateOncePerFrame():void{
var _local1:int;
var _local2:int;
_local2 = times.length;
_local1 = 0;
while (_local1 < _local2) {
if (times[_local1] > 0){
var _local3 = times;
var _local4 = _local1;
var _local5 = (_local3[_local4] - 1);
_local3[_local4] = _local5;
};
_local1++;
};
}
public static function PlayRandomBetween(_arg1:String, _arg2:String, _arg3:Number=1):void{
var _local4:int;
var _local5:int;
var _local6:int;
if (doSFX == false){
return;
};
_local4 = names.indexOf(_arg1);
_local5 = names.indexOf(_arg2);
_local6 = Utils.RandBetweenInt(_local4, _local5);
PlayById(_local6, _arg3);
}
public static function Play(_arg1:String, _arg2:Number=1):void{
var _local3:int;
if (doSFX == false){
return;
};
_local3 = names.indexOf(_arg1);
PlayById(_local3, _arg2);
}
public static function PlayById(_arg1:int, _arg2:Number=1):void{
var _local3:SoundTransform;
var _local4:Sound;
if (doSFX == false){
return;
};
if (times[_arg1] > 0){
return;
};
if (sounds[_arg1] != null){
_local4 = sounds[_arg1];
_local3 = new SoundTransform();
_local3.volume = _arg2;
_local4.play(0, 0, _local3);
times[_arg1] = 5;
} else {
trace(("SoundPlayer: Cant find sound " + _arg1));
};
}
public static function ToggleMute(){
doSFX = (doSFX == false);
}
public static function GetId(_arg1:String):int{
var _local2:int;
_local2 = names.indexOf(_arg1);
return (_local2);
}
}
}//package
import flash.events.*;
import flash.utils.*;
import flash.media.*;
class SoundPlay {
private var channel:SoundChannel;
private var timer:Timer;
private var playingFlag;
private function SoundPlay(){
}
private function timerHandler(_arg1:TimerEvent):void{
timer.stop();
channel.stop();
playingFlag = false;
}
public function Clear():void{
playingFlag = false;
timer = null;
}
public function Active():Boolean{
return (playingFlag);
}
public function Play(_arg1:int):void{
channel = SoundPlayer.sound.play(SoundPlayer.startTimes[_arg1], 1, SoundPlayer.soundTransform);
timer = new Timer(SoundPlayer.lengths[_arg1]);
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.start();
playingFlag = true;
}
}
Section 191
//SpraySlider (SpraySlider)
package {
import flash.display.*;
public dynamic class SpraySlider extends MovieClip {
}
}//package
Section 192
//TitleScreen (TitleScreen)
package {
import flash.display.*;
import flash.text.*;
public dynamic class TitleScreen extends MovieClip {
public var textVersion:TextField;
public var sky:MovieClip;
public var buttonMoreGames:SimpleButton;
public var buttonKong:SimpleButton;
public var kibaLogo:MovieClip;
public var buttonPlay:SimpleButton;
public var bubbleBoxLogo:MovieClip;
public function TitleScreen(){
addFrameScript(79, frame80);
}
function frame80(){
stop();
}
}
}//package
Section 193
//TitleScreenState (TitleScreenState)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.ui.*;
public class TitleScreenState {
static var main:Main;
static var levelSelections:Array;
static var levelMusicIndex:int = 0;
static var titleMC:MovieClip;
static var creditsMC:MovieClip;
public static function buttonStart1Pressed(_arg1:MouseEvent){
Game.main.removeChild(titleMC);
titleMC = null;
Game.InitGame();
main.SetGameState(Main.gameState_LEVEL_PLAY);
}
static function LevelSelectScreen_levelOver(_arg1:MouseEvent){
var _local2:MovieClip;
_local2 = (_arg1.currentTarget as MovieClip);
_local2.overOutline.gotoAndPlay("in");
}
public static function buttonCreditsPressed(_arg1:MouseEvent){
creditsMC = new CreditsScreen();
Game.main.addChild(creditsMC);
creditsMC.buttonClose.addEventListener(MouseEvent.CLICK, buttonCreditsBackPressed);
}
static function LevelSelectScreen_levelSelected(_arg1:MouseEvent){
var _local2:MovieClip;
var _local3:LevelResult;
_local2 = (_arg1.currentTarget as MovieClip);
LevelSelectScreen_DisplaySelectedInfo(_local2);
_local3 = Game.GetCurrentLevelResult();
if (Game.usedebug){
titleMC.buttonContinue.visible = true;
} else {
titleMC.buttonContinue.visible = false;
if (_local3.locked == false){
titleMC.buttonContinue.visible = true;
};
};
}
public static function LevelSelectScreen_ClearAllSelections(){
var _local1:MovieClip;
for each (_local1 in levelSelections) {
_local1.selectedOutline.visible = false;
};
}
static function KongButton(_arg1:MovieClip, _arg2:Boolean=false){
if (Licensors.GetLicensor() == Licensors.LICENSOR_NOBRANDING){
_arg1.buttonKong.visible = false;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_KIBA){
_arg1.buttonKong.visible = false;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
if (((Licensors.IsAtKongregate()) && ((_arg2 == false)))){
_arg1.buttonKong.visible = false;
} else {
_arg1.buttonKong.visible = true;
_arg1.buttonKong.addEventListener(MouseEvent.CLICK, buttonKongregateGamePressed, false, 0, true);
};
} else {
_arg1.buttonKong.visible = false;
};
};
};
}
public static function buttonCreditsBackPressed(_arg1:MouseEvent){
Game.main.removeChild(creditsMC);
creditsMC = null;
}
public static function InitEndLevelScreen(_arg1:Boolean){
var _local2:Level;
var _local3:LevelResult;
Mouse.show();
Game.pause = true;
_local2 = Game.GetCurrentLevel();
_local3 = Game.GetCurrentLevelResult();
titleMC = new LevelCompleteScreen();
main.addChild(titleMC);
KongButton(titleMC);
MoreGamesButton(titleMC);
GuideButton(titleMC);
titleMC.background.gotoAndStop((Game.bgFrame + 1));
titleMC.buttonRetry.addEventListener(MouseEvent.CLICK, buttonRetryPressed);
titleMC.buttonContinue.addEventListener(MouseEvent.CLICK, buttonContinuePressed);
if (_arg1){
titleMC.textTitle.text = (("LEVEL " + int((Game.currentLevel + 1)).toString()) + " COMPLETE");
titleMC.text1.text = (((("Time Taken: " + Utils.CounterToSecondsString(_local3.lastTime)) + " / ") + _local2.time.toString()) + ":00");
titleMC.text1a.text = (_local3.lastTimeBonus.toString() + " pts");
titleMC.text2.text = ("Balls lost: " + _local3.lastNumKilled);
titleMC.text2a.text = (_local3.lastNumKilledBonus.toString() + " pts");
titleMC.text3.text = "Completion Bonus:";
titleMC.text3a.text = (_local3.lastLevelCompleteBonus.toString() + " pts");
titleMC.text4.text = "Collected Gem:";
titleMC.text4a.text = (_local3.lastLevelGemBonus.toString() + " pts");
titleMC.text5.text = "Level Score:";
titleMC.text5a.text = (_local3.lastScore.toString() + " pts");
titleMC.text6.text = "Total Score:";
titleMC.text6a.text = (Game.currentScore + " pts");
} else {
titleMC.buttonContinue.visible = false;
titleMC.textTitle.text = (("LEVEL " + int((Game.currentLevel + 1)).toString()) + " FAILED");
titleMC.text1.text = "You ran out of time";
titleMC.text1a.text = "";
titleMC.text2.text = "";
titleMC.text2a.text = "";
titleMC.text3.text = "";
titleMC.text3a.text = "";
titleMC.text4.text = "";
titleMC.text4a.text = "";
titleMC.text5.text = "";
titleMC.text5a.text = "";
titleMC.text6.text = "";
titleMC.text6a.text = "";
};
}
public static function buttonBubbleBoxPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.bubblebox.com"), "_blank");
}
public static function buttonGuidePressed(_arg1:MouseEvent){
if (Licensors.GetLicensor() == Licensors.LICENSOR_BUBBLEBOX){
navigateToURL(new URLRequest("http://www.bubblebox.com/gameinfo/water-werks.htm"), "_blank");
} else {
navigateToURL(new URLRequest(" http://www.kongregate.com/games/LongAnimals/water-werks-guide?gamereferral=waterwerks"), "_blank");
};
}
static function MoreGamesButton(_arg1:MovieClip){
if (Licensors.GetLicensor() == Licensors.LICENSOR_NOBRANDING){
_arg1.buttonMoreGames.addEventListener(MouseEvent.CLICK, buttonKongregatePressed, false, 0, true);
_arg1.buttonMoreGames.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_KIBA){
_arg1.buttonMoreGames.addEventListener(MouseEvent.CLICK, buttonKongregatePressed, false, 0, true);
_arg1.buttonMoreGames.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_BUBBLEBOX){
_arg1.buttonMoreGames.addEventListener(MouseEvent.CLICK, buttonBubbleBoxPressed, false, 0, true);
_arg1.buttonMoreGames.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
_arg1.buttonMoreGames.addEventListener(MouseEvent.CLICK, buttonKongregatePressed, false, 0, true);
if (Licensors.IsAtKongregate()){
_arg1.buttonMoreGames.visible = true;
} else {
_arg1.buttonMoreGames.visible = true;
};
};
};
};
};
}
public static function KongAIAdClicked(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.kongregate.com/games/Kongregate/Kongai?gamereferral=waterwerks"), "_blank");
}
public static function InitLevelSelectScreen(){
var _local1:LevelResult;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Array;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:Number;
var _local14:LevelResult;
var _local15:Level;
var _local16:MovieClip;
Mouse.show();
if (MusicPlayer.currentStreamID != 5){
MusicPlayer.StopMusic();
MusicPlayer.StartStream(5);
};
levelSelections = new Array();
titleMC = new LevelSelectScreen();
Game.main.addChild(titleMC);
titleMC.backgrounds.gotoAndStop(1);
titleMC.buttonContinue.addEventListener(MouseEvent.CLICK, LevelSelectScreen_buttonContinuePressed);
_local1 = Game.GetCurrentLevelResult();
titleMC.buttonContinue.visible = false;
if (_local1.locked == false){
titleMC.buttonContinue.visible = true;
};
titleMC.textLevelInfo.text = "";
titleMC.textLevelInfo1.text = "";
titleMC.textTotalScore.text = "Total Score:";
titleMC.textTotalScorea.text = (Game.currentScore + " pts");
KongButton(titleMC);
MoreGamesButton(titleMC);
GuideButton(titleMC);
_local2 = 30;
_local3 = _local2;
_local4 = 120;
_local5 = _local4;
_local6 = 60;
_local7 = 60;
_local8 = new Array(30, 230, 430);
_local9 = 0;
_local10 = 0;
while (_local10 < 3) {
_local3 = _local8[_local10];
_local2 = _local3;
_local5 = _local4;
_local12 = Game.levels.length;
_local13 = 0;
_local11 = 0;
while (_local11 < _local12) {
_local14 = Game.levelResults[_local11];
_local15 = Game.levels[_local11];
if (_local15.category == _local10){
_local16 = new LevelSelectButton();
_local16.textLevelNumber.text = int((_local9 + 1)).toString();
_local16.levelIndex = _local11;
_local16.levelNumber = _local9;
_local16.addEventListener(MouseEvent.CLICK, LevelSelectScreen_levelSelected);
_local16.addEventListener(MouseEvent.MOUSE_OVER, LevelSelectScreen_levelOver);
_local16.addEventListener(MouseEvent.MOUSE_OUT, LevelSelectScreen_levelOut);
if (_local14.complete){
_local16.complete.visible = true;
} else {
_local16.complete.visible = false;
};
if (_local14.bonus){
_local16.gem.visible = true;
} else {
_local16.gem.visible = false;
};
if (_local14.locked){
_local16.gotoAndStop(2);
} else {
_local16.gotoAndStop(1);
};
_local16.selectedOutline.visible = false;
_local16.overOutline.gotoAndStop(1);
levelSelections.push(_local16);
titleMC.addChild(_local16);
_local16.x = _local3;
_local16.y = _local5;
_local3 = (_local3 + _local6);
++_local13;
if (_local13 >= 3){
_local3 = _local2;
_local5 = (_local5 + _local7);
_local13 = 0;
};
_local9++;
};
_local11++;
};
_local5 = (_local5 + (_local7 + 10));
_local3 = _local2;
_local10++;
};
levelSelections[Game.currentLevel].selectedOutline.visible = true;
LevelSelectScreen_DisplaySelectedInfo(levelSelections[Game.currentLevel]);
}
static function buttonRobotJamPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.robotjamgames.com?referal=bike"), "_blank");
}
public static function Update(_arg1:Main){
}
public static function buttonKongregateGamePressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.kongregate.com/games/LongAnimals/water-werks?gamereferral=waterwerks"), "_blank");
}
public static function GameOverScreenComplete(){
main.removeChild(titleMC);
titleMC = null;
Game.main.SetGameState(Main.gameState_TITLE);
}
static function buttonRetryPressed(_arg1:MouseEvent){
main.removeChild(titleMC);
titleMC = null;
Game.pause = false;
Game.StartLevelPlay(false);
}
static function buttonNickPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.nick.com/kids-choice-awards/kca.jhtml"), "_blank");
}
static function buttonContinuePressed(_arg1:MouseEvent){
main.removeChild(titleMC);
titleMC = null;
Game.pause = false;
Game.currentLevel++;
if (Game.currentLevel >= (Game.levels.length - 1)){
Game.currentLevel = 0;
};
Game.StartLevelPlay(true);
}
public static function buttonStartPressed(_arg1:MouseEvent){
creditsMC = new InstructionsScreen();
Game.main.addChild(creditsMC);
creditsMC.buttonClose.addEventListener(MouseEvent.CLICK, buttonStart1Pressed);
}
static function KongTitlePageButton(_arg1:MovieClip, _arg2:Boolean=false){
if (Licensors.GetLicensor() == Licensors.LICENSOR_NOBRANDING){
_arg1.buttonKong.visible = false;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_KIBA){
_arg1.buttonKong.visible = false;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
if (((Licensors.IsAtKongregate()) && ((_arg2 == false)))){
_arg1.buttonKong.visible = true;
_arg1.buttonKong.addEventListener(MouseEvent.CLICK, buttonKongregatePressed, false, 0, true);
} else {
_arg1.buttonKong.visible = true;
_arg1.buttonKong.addEventListener(MouseEvent.CLICK, buttonKongregatePressed, false, 0, true);
};
} else {
_arg1.buttonKong.visible = false;
};
};
};
}
static function GuideButton(_arg1:MovieClip){
if (Licensors.GetLicensor() == Licensors.LICENSOR_NOBRANDING){
_arg1.buttonGuide.addEventListener(MouseEvent.CLICK, buttonGuidePressed, false, 0, true);
_arg1.buttonGuide.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_KIBA){
_arg1.buttonGuide.addEventListener(MouseEvent.CLICK, buttonGuidePressed, false, 0, true);
_arg1.buttonGuide.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_BUBBLEBOX){
_arg1.buttonGuide.addEventListener(MouseEvent.CLICK, buttonGuidePressed, false, 0, true);
_arg1.buttonGuide.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
_arg1.buttonGuide.addEventListener(MouseEvent.CLICK, buttonGuidePressed, false, 0, true);
if (Licensors.IsAtKongregate()){
_arg1.buttonGuide.visible = true;
} else {
_arg1.buttonGuide.visible = true;
};
};
};
};
};
}
static function LevelSelectScreen_buttonContinuePressed(_arg1:MouseEvent){
MusicPlayer.StopMusic();
MusicPlayer.StartMusic("music_lapping");
MusicPlayer.StartStream(levelMusicIndex);
levelMusicIndex++;
if (levelMusicIndex >= 5){
levelMusicIndex = 0;
};
Game.main.removeChild(titleMC);
titleMC = null;
Game.StartLevelPlay2();
}
public static function Init(_arg1:Main){
Mouse.show();
main = _arg1;
MusicPlayer.StopMusic();
MusicPlayer.StartMusic("music_lapping");
MusicPlayer.StartStream(5);
main.InitStage();
titleMC = main.AddMovieClip(0, 0, new TitleScreen());
titleMC.buttonPlay.addEventListener(MouseEvent.CLICK, buttonStart1Pressed);
titleMC.textVersion.text = ("V " + Game.version.toString());
titleMC.kibaLogo.visible = false;
titleMC.bubbleBoxLogo.visible = false;
if (Licensors.GetLicensor() == Licensors.LICENSOR_KIBA){
titleMC.kibaLogo.visible = true;
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_BUBBLEBOX){
titleMC.bubbleBoxLogo.visible = true;
titleMC.bubbleBoxLogo.addEventListener(MouseEvent.CLICK, buttonBubbleBoxPressed);
titleMC.bubbleBoxLogo.buttonMode = true;
titleMC.bubbleBoxLogo.useHandCursor = true;
};
KongTitlePageButton(titleMC);
MoreGamesButton(titleMC);
}
public static function InitEndGameScreen(){
}
static function buttonLonganimalsPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.longanimalsgames.com?referal=bike"), "_blank");
}
public static function MovieFinished(){
Game.InitGame();
main.SetGameState(Main.gameState_LEVEL_PLAY);
}
public static function buttonKongregatePressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.kongregate.com/?gamereferral=waterwerks"), "_blank");
}
static function LevelSelectScreen_levelOut(_arg1:MouseEvent){
var _local2:MovieClip;
_local2 = (_arg1.currentTarget as MovieClip);
_local2.overOutline.gotoAndPlay("out");
}
static function LevelSelectScreen_DisplaySelectedInfo(_arg1:MovieClip){
var _local2:String;
var _local3:Level;
var _local4:LevelResult;
LevelSelectScreen_ClearAllSelections();
_arg1.selectedOutline.visible = true;
_local2 = "";
_local3 = Game.levels[_arg1.levelIndex];
_local4 = Game.levelResults[_arg1.levelIndex];
_local2 = (_local2 + ("Level " + int((_arg1.levelNumber + 1))));
_local2 = (_local2 + ": ");
_local2 = (_local2 + _local3.name);
_local2 = (_local2 + " ");
if (_local4.locked){
_local2 = (_local2 + "[LOCKED]");
};
titleMC.textLevelInfo.text = _local2;
_local2 = "";
if (_local4.bestTime > 99999){
_local2 = (_local2 + "You haven't yet recorded a score on this level");
} else {
_local2 = (_local2 + ("Best Score: " + _local4.bestScore));
_local2 = (_local2 + " ");
_local2 = (_local2 + ("Best Time: " + Utils.CounterToSecondsString(_local4.bestTime)));
_local2 = (_local2 + " ");
_local2 = (_local2 + ("Least Killed: " + _local4.bestNumKilled));
_local2 = (_local2 + " ");
};
titleMC.textLevelInfo1.text = _local2;
Game.currentLevel = _arg1.levelIndex;
}
}
}//package
Section 194
//Utils (Utils)
package {
import flash.display.*;
import flash.geom.*;
public class Utils {
public static function CounterToSecondsString(_arg1:int):String{
var _local2:String;
var _local3:int;
var _local4:int;
var _local5:Number;
_local2 = "";
_local3 = (_arg1 / int(Defs.fps));
_local4 = (_arg1 % int(Defs.fps));
_local2 = (_local2 + (_local3.toString() + ":"));
_local5 = ((100 / Defs.fps) * Number(_local4));
_local2 = (_local2 + Math.floor(_local5).toString());
return (_local2);
}
public static function DegToRad(_arg1:Number):Number{
return ((((Math.PI * 2) / 360) * _arg1));
}
public static function LimitNumber(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg3 < _arg1){
_arg3 = _arg1;
};
if (_arg3 > _arg2){
_arg3 = _arg2;
};
return (_arg3);
}
public static function ScaleTo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Number{
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local6 = (_arg4 - _arg3);
_local7 = (_arg2 - _arg1);
_local8 = ((1 / _local6) * (_arg5 - _arg3));
_local8 = ((_local7 * _local8) + _arg1);
return (_local8);
}
public static function DP2(_arg1:Number):Number{
var _local2:Number;
_local2 = (Math.ceil((_arg1 * 100)) / 100);
return (_local2);
}
static function RenderDotLine(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:int, _arg7:uint):void{
var _local8:int;
var _local9:int;
var _local10:Number;
var _local11:Number;
_local9 = _arg6;
_local10 = ((_arg4 - _arg2) / Number(_local9));
_local11 = ((_arg5 - _arg3) / Number(_local9));
_local8 = 0;
while (_local8 < _local9) {
_arg2 = (_arg2 + _local10);
_arg3 = (_arg3 + _local11);
_arg1.setPixel32(int(_arg2), int(_arg3), _arg7);
_local8++;
};
}
static function RenderRectangle(_arg1:BitmapData, _arg2:Rectangle, _arg3:uint):void{
RenderDotLine(_arg1, _arg2.left, _arg2.top, _arg2.right, _arg2.top, 100, _arg3);
RenderDotLine(_arg1, _arg2.left, _arg2.bottom, _arg2.right, _arg2.bottom, 100, _arg3);
RenderDotLine(_arg1, _arg2.left, _arg2.top, _arg2.left, _arg2.bottom, 100, _arg3);
RenderDotLine(_arg1, _arg2.right, _arg2.top, _arg2.right, _arg2.bottom, 100, _arg3);
}
public static function NumberToString2DP(_arg1:Number):String{
var _local2:String;
var _local3:int;
var _local4:int;
_local2 = DP2(_arg1).toString();
_local3 = _local2.lastIndexOf(".");
if (_local3 == -1){
_local2.concat(".00");
} else {
_local4 = _local2.length;
if (_local3 == (_local4 - 1)){
_local2.concat("0");
};
};
return (_local2);
}
static function RandBetweenInt(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = (Math.random() * ((_arg2 - _arg1) + 1));
_local3 = (_local3 + _arg1);
return (_local3);
}
static function DotProduct(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
_local5 = ((_arg1 * _arg3) + (_arg2 * _arg4));
return (_local5);
}
static function SideOfLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Boolean{
var _local7:Number;
_local7 = DotProduct((_arg3 - _arg1), (_arg4 - _arg2), (_arg5 - _arg1), (_arg6 - _arg2));
if (_local7 < 0){
return (false);
};
return (true);
}
static function RenderCircle(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:uint):void{
var _local6:int;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_local6 = 50;
_local7 = ((Math.PI * 2) / _local6);
_local9 = 0;
_local8 = 0;
while (_local8 < _local6) {
_local10 = (_arg2 + (Math.cos(_local9) * _arg4));
_local11 = (_arg3 + (Math.sin(_local9) * _arg4));
_local9 = (_local9 + _local7);
_arg1.setPixel32(int(_local10), int(_local11), _arg5);
_local8++;
};
}
public static function DP1(_arg1:Number):Number{
var _local2:Number;
_local2 = (Math.ceil((_arg1 * 10)) / 10);
return (_local2);
}
public static function RandCircle():Number{
return ((Math.random() * (Math.PI * 2)));
}
public static function RadToDeg(_arg1:Number):Number{
return (((360 / (Math.PI * 2)) * _arg1));
}
static function RandBetweenFloat(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * (_arg2 - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
public static function LineLength(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
static function DotProductAng(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
_local5 = Math.cos(_arg2);
_local6 = Math.sin(_arg2);
_local7 = ((_local3 * _local5) + (_local4 * _local6));
return (_local7);
}
static function DistBetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
public static function ScaleBetween(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
_local4 = ((_arg2 - _arg1) * _arg3);
_local4 = (_arg1 + _local4);
return (_local4);
}
static function Dist2BetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (((_local5 * _local5) + (_local6 * _local6)));
}
}
}//package
Section 195
//WaterParticle (WaterParticle)
package {
import flash.display.*;
public dynamic class WaterParticle extends MovieClip {
}
}//package
Section 196
//WaveDef (WaveDef)
package {
public class WaveDef {
public var pathID:int;
public var absoluteGenTime:int;
public var gapSeconds:Number;
public var actionLen:Number;
public var actionType:Number;
public var pos:Number;
public var side:int;
public var waveID:int;
public var pathSpeed:Number;
public var numInWave:int;
public var typeName:String;
public var xflip:Boolean;
public var type:int;
public var actionPos:Number;
public var pathType:int;
public function WaveDef(_arg1:int, _arg2:int, _arg3:Number, _arg4:String, _arg5:int, _arg6:int, _arg7:Number){
type = 0;
side = _arg2;
pos = _arg3;
typeName = _arg4;
pathID = _arg5;
pathType = _arg6;
absoluteGenTime = _arg1;
pathSpeed = _arg7;
numInWave = 0;
waveID = -1;
actionLen = 0;
actionPos = 0;
actionType = -1;
xflip = false;
}
public function SetID(_arg1:int, _arg2:int){
waveID = _arg1;
numInWave = _arg2;
}
}
}//package
Section 197
//WaveDefs (WaveDefs)
package {
public class WaveDefs {
static const s_bxf = 4;
static const p_sm = 1;
static const s_b = 3;
static const s_txf = 5;
static const s_l = 0;
static const s_r = 1;
static const p_sp = 2;
static const s_t = 2;
static const p_ln = 0;
static var startTime:int;
static var startPos:int;
static var waveID:int;
public static var currentPos:int;
static var list:Array;
static var currentTime:int;
static var shotDefList:Array;
public static var nextWaveDef:WaveDef;
static function WaitForBoss(_arg1:Number){
var _local2:WaveDef;
var _local3:int;
currentTime = (currentTime + (_arg1 * Defs.fps));
_local3 = currentTime;
_local2 = new WaveDef(_local3, 2, 0, "WaitForBoss", 0, 0, 0);
list.push(_local2);
waveID++;
currentPos = (currentPos + 1);
}
static function addPause1(_arg1:WaveDef){
_arg1.actionPos = 400;
_arg1.actionLen = (Defs.fps * 2);
_arg1.actionType = 0;
}
public static function GetCurrentDef():WaveDef{
return (nextWaveDef);
}
public static function InitOnce(){
}
static function AddShop(_arg1:Number, _arg2:Number){
var _local3:WaveDef;
var _local4:int;
currentTime = (currentTime + (_arg1 * Defs.fps));
_local4 = currentTime;
_local3 = new WaveDef(_local4, 2, _arg2, "Shop", 0, 0, 0);
_local3.SetID(waveID, 1);
list.push(_local3);
waveID++;
currentPos = (currentPos + 1);
}
static function AddWave(_arg1:Number, _arg2:int, _arg3:Object, _arg4:int, _arg5:Number, _arg6:String, _arg7:String, _arg8:int, _arg9:Number, _arg10:Function=null){
var _local11:WaveDef;
var _local12:int;
var _local13:Array;
var _local14:int;
var _local15:Number;
var _local16:int;
if ((_arg3 is Array)){
_local13 = (_arg3 as Array);
};
if ((_arg3 is Number)){
_local13 = new Array();
_local13.push(Number(_arg3));
};
_local14 = Poly.FindIndexByName(_arg7, Game.polygonList);
if (_local14 == -1){
_local14 = 0;
trace(("ERROR: AddWave = Path not found: " + _arg7));
};
currentTime = (currentTime + (_arg1 * Defs.fps));
for each (_local15 in _local13) {
_local12 = 0;
while (_local12 < _arg4) {
_local16 = currentTime;
_local16 = (_local16 + ((_local12 * _arg5) * Defs.fps));
if (_arg2 == s_t){
_local11 = new WaveDef(_local16, 2, _local15, _arg6, _local14, _arg8, _arg9);
_local11.SetID(waveID, (_arg4 * _local13.length));
if (_arg10 != null){
_arg10(_local11);
};
list.push(_local11);
};
if (_arg2 == s_txf){
_local11 = new WaveDef(_local16, 2, _local15, _arg6, _local14, _arg8, _arg9);
_local11.xflip = true;
_local11.SetID(waveID, (_arg4 * _local13.length));
if (_arg10 != null){
_arg10(_local11);
};
list.push(_local11);
};
if (_arg2 == s_b){
_local11 = new WaveDef(_local16, 3, _local15, _arg6, _local14, _arg8, _arg9);
_local11.SetID(waveID, (_arg4 * _local13.length));
if (_arg10 != null){
_arg10(_local11);
};
list.push(_local11);
};
if (_arg2 == s_bxf){
_local11 = new WaveDef(_local16, 4, _local15, _arg6, _local14, _arg8, _arg9);
_local11.xflip = true;
_local11.SetID(waveID, (_arg4 * _local13.length));
if (_arg10 != null){
_arg10(_local11);
};
list.push(_local11);
};
if (_arg2 == s_l){
_local11 = new WaveDef(_local16, 0, _local15, _arg6, _local14, _arg8, _arg9);
_local11.SetID(waveID, (_arg4 * _local13.length));
if (_arg10 != null){
_arg10(_local11);
};
list.push(_local11);
};
if (_arg2 == s_r){
_local11 = new WaveDef(_local16, 1, _local15, _arg6, _local14, _arg8, _arg9);
_local11.xflip = true;
_local11.SetID(waveID, (_arg4 * _local13.length));
if (_arg10 != null){
_arg10(_local11);
};
list.push(_local11);
};
_local12++;
};
};
waveID++;
currentPos = (currentPos + (_arg4 * _local13.length));
}
public static function GetShotDefIndexByName(_arg1:String):int{
var _local2:int;
var _local3:int;
var _local4:ShotDef;
_local3 = shotDefList.length;
_local2 = 0;
while (_local2 < _local3) {
_local4 = shotDefList[_local2];
if (_local4.name == _arg1){
return (_local2);
};
_local2++;
};
return (0);
}
static function StartHere(){
startTime = currentTime;
startPos = currentPos;
trace(((startPos + " ") + startTime));
}
public static function AdvanceWave(){
currentPos++;
if (currentPos >= list.length){
nextWaveDef = null;
};
nextWaveDef = list[currentPos];
}
public static function Reset(){
currentPos = startPos;
nextWaveDef = list[currentPos];
}
}
}//package
Section 198
//Vec (Vec)
package {
import flash.geom.*;
public class Vec {
public var speed:Number;
public var rot:Number;
public function Vec(){
rot = 0;
speed = 0;
}
public function Add(_arg1:Vec){
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local2 = (Math.cos(rot) * speed);
_local3 = (Math.sin(rot) * speed);
_local4 = (Math.cos(_arg1.rot) * _arg1.speed);
_local5 = (Math.sin(_arg1.rot) * _arg1.speed);
_local6 = (_local2 + _local4);
_local7 = (_local3 + _local5);
rot = Math.atan2(_local7, _local6);
speed = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
}
public function Set(_arg1:Number, _arg2:Number){
rot = _arg1;
speed = _arg2;
}
public function GetUnitYComponent():Number{
return (Math.sin(rot));
}
public function dotRot(_arg1:Number):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = Math.cos(rot);
_local3 = Math.sin(rot);
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
_local6 = ((_local2 * _local4) + (_local3 * _local5));
return (_local6);
}
function NormalizeRot():void{
while (rot < 0) {
rot = (rot + (Math.PI * 2));
};
while (rot > (Math.PI * 2)) {
rot = (rot - (Math.PI * 2));
};
}
public function GetUnitTangent():Point{
var _local1:Number;
var _local2:Point;
_local1 = (rot + (Math.PI * 0.5));
_local2 = new Point(Math.cos(_local1), Math.sin(_local1));
return (_local2);
}
public function NearRot(_arg1:Number, _arg2:Number):Boolean{
var _local3:Number;
var _local4:Number;
_local3 = (rot - _arg1);
_local4 = Math.abs(_local3);
if (_local3 > Math.PI){
if (_arg1 < rot){
_arg1 = (_arg1 + (Math.PI * 2));
} else {
_arg1 = (_arg1 - (Math.PI * 2));
};
_local3 = (rot - _arg1);
};
if (Math.abs(_local3) <= _arg2){
return (true);
};
return (false);
}
public function SetAng(_arg1:Number){
rot = _arg1;
}
public function GetYComponent():Number{
return ((Math.sin(rot) * speed));
}
public function GetXComponent():Number{
return ((Math.cos(rot) * speed));
}
public function AddRot(_arg1:Number):void{
rot = (rot + _arg1);
NormalizeRot();
}
public function GetUnitXComponent():Number{
return (Math.cos(rot));
}
}
}//package
Section 199
//XmlHelper (XmlHelper)
package {
public class XmlHelper {
public static function GetAttrString(_arg1:Object, _arg2:String=""):String{
var _local3:String;
_local3 = _arg2;
if (_arg1 != undefined){
_local3 = String(_arg1);
};
return (_local3);
}
public static function GetAttrBoolean(_arg1:Object, _arg2:Boolean=false):Boolean{
var _local3:Boolean;
var _local4:String;
_local3 = _arg2;
if (_arg1 != undefined){
_local3 = false;
_local4 = String(_arg1);
_local4 = _local4.toLowerCase();
if (_arg1 == "true"){
_local3 = true;
};
};
return (_local3);
}
public static function GetAttrInt(_arg1:Object, _arg2:int=0):int{
var _local3:int;
_local3 = _arg2;
if (_arg1 != undefined){
_local3 = int(_arg1);
};
return (_local3);
}
public static function GetAttrNumber(_arg1:Object, _arg2:Number=0):Number{
var _local3:Number;
_local3 = _arg2;
if (_arg1 != undefined){
_local3 = Number(_arg1);
};
return (_local3);
}
}
}//package