Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2CircleDef extends b2ShapeDef {
public var radius:Number;
public var localPosition:b2Vec2;
public function b2CircleDef(){
localPosition = new b2Vec2(0, 0);
super();
type = b2Shape.e_circleShape;
radius = 1;
}
}
}//package Box2D.Collision.Shapes
Section 2
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape)
package Box2D.Collision.Shapes {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2CircleShape extends b2Shape {
public var m_localPosition:b2Vec2;
public var m_radius:Number;
public function b2CircleShape(_arg1:b2ShapeDef){
m_localPosition = new b2Vec2();
super(_arg1);
var _local2:b2CircleDef = (_arg1 as b2CircleDef);
m_type = e_circleShape;
m_localPosition.SetV(_local2.localPosition);
m_radius = _local2.radius;
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{
var _local10:Number;
var _local6:b2Mat22 = _arg1.R;
var _local7:Number = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y)));
var _local8:Number = (_arg1.position.y + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y)));
var _local9:Number = (_arg4.p1.x - _local7);
_local10 = (_arg4.p1.y - _local8);
var _local11:Number = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius));
if (_local11 < 0){
_arg2[0] = 0;
return (e_startsInsideCollide);
};
var _local12:Number = (_arg4.p2.x - _arg4.p1.x);
var _local13:Number = (_arg4.p2.y - _arg4.p1.y);
var _local14:Number = ((_local9 * _local12) + (_local10 * _local13));
var _local15:Number = ((_local12 * _local12) + (_local13 * _local13));
var _local16:Number = ((_local14 * _local14) - (_local15 * _local11));
if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){
return (e_missCollide);
};
var _local17:Number = -((_local14 + Math.sqrt(_local16)));
if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){
_local17 = (_local17 / _local15);
_arg2[0] = _local17;
_arg3.x = (_local9 + (_local17 * _local12));
_arg3.y = (_local10 + (_local17 * _local13));
_arg3.Normalize();
return (e_hitCollide);
};
return (e_missCollide);
}
public function GetLocalPosition():b2Vec2{
return (m_localPosition);
}
public function GetRadius():Number{
return (m_radius);
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2Mat22;
_local4 = _arg2.R;
var _local5:Number = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
var _local6:Number = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_local4 = _arg3.R;
var _local7:Number = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
var _local8:Number = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius));
_arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius));
}
override public function ComputeMass(_arg1:b2MassData):void{
_arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius);
_arg1.center.SetV(m_localPosition);
_arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y))));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:Number = (m_localPosition.x - _arg1.x);
var _local3:Number = (m_localPosition.y - _arg1.y);
_local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22 = _arg2.R;
var _local4:Number = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
var _local5:Number = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius));
_arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius));
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Mat22 = _arg1.R;
var _local4:Number = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
var _local5:Number = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_local4 = (_arg2.x - _local4);
_local5 = (_arg2.y - _local5);
return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius)));
}
}
}//package Box2D.Collision.Shapes
Section 3
//b2FilterData (Box2D.Collision.Shapes.b2FilterData)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2FilterData {
public var maskBits:uint;// = 0xFFFF
public var groupIndex:int;// = 0
public var categoryBits:uint;// = 1
public function Copy():b2FilterData{
var _local1:b2FilterData = new b2FilterData();
_local1.categoryBits = categoryBits;
_local1.maskBits = maskBits;
_local1.groupIndex = groupIndex;
return (_local1);
}
}
}//package Box2D.Collision.Shapes
Section 4
//b2MassData (Box2D.Collision.Shapes.b2MassData)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2MassData {
public var mass:Number;// = 0
public var center:b2Vec2;
public var I:Number;// = 0
public function b2MassData(){
center = new b2Vec2(0, 0);
super();
}
}
}//package Box2D.Collision.Shapes
Section 5
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PolygonDef extends b2ShapeDef {
public var vertices:Array;
public var vertexCount:int;
private static var s_mat:b2Mat22 = new b2Mat22();
public function b2PolygonDef(){
vertices = new Array(b2Settings.b2_maxPolygonVertices);
super();
type = b2Shape.e_polygonShape;
vertexCount = 0;
var _local1:int;
while (_local1 < b2Settings.b2_maxPolygonVertices) {
vertices[_local1] = new b2Vec2();
_local1++;
};
}
public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{
var _local5:b2Vec2;
var _local6:b2Mat22;
var _local7:int;
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
if (_arg3){
_local5 = _arg3;
_local6 = s_mat;
_local6.Set(_arg4);
_local7 = 0;
while (_local7 < vertexCount) {
_arg3 = vertices[_local7];
_arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y)));
_arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y)));
_arg3.x = _arg1;
_local7++;
};
};
}
public function SetAsBox(_arg1:Number, _arg2:Number):void{
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
}
}
}//package Box2D.Collision.Shapes
Section 6
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape)
package Box2D.Collision.Shapes {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolygonShape extends b2Shape {
public var m_coreVertices:Array;
public var m_vertices:Array;
private var s_supportVec:b2Vec2;
public var m_centroid:b2Vec2;
public var m_normals:Array;
public var m_obb:b2OBB;
public var m_vertexCount:int;
private static var s_computeMat:b2Mat22 = new b2Mat22();
private static var s_sweptAABB1:b2AABB = new b2AABB();
private static var s_sweptAABB2:b2AABB = new b2AABB();
public function b2PolygonShape(_arg1:b2ShapeDef){
var _local3:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
s_supportVec = new b2Vec2();
m_obb = new b2OBB();
m_vertices = new Array(b2Settings.b2_maxPolygonVertices);
m_normals = new Array(b2Settings.b2_maxPolygonVertices);
m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices);
super(_arg1);
m_type = e_polygonShape;
var _local2:b2PolygonDef = (_arg1 as b2PolygonDef);
m_vertexCount = _local2.vertexCount;
var _local4:int = _local3;
var _local5:int = _local3;
_local3 = 0;
while (_local3 < m_vertexCount) {
m_vertices[_local3] = _local2.vertices[_local3].Copy();
_local3++;
};
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = _local3;
_local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0;
_local6 = (m_vertices[_local5].x - m_vertices[_local4].x);
_local7 = (m_vertices[_local5].y - m_vertices[_local4].y);
_local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8));
_local3++;
};
m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount);
ComputeOBB(m_obb, m_vertices, m_vertexCount);
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1);
_local5 = _local3;
_local9 = m_normals[_local4].x;
_local10 = m_normals[_local4].y;
_local11 = m_normals[_local5].x;
_local12 = m_normals[_local5].y;
_local13 = (m_vertices[_local3].x - m_centroid.x);
_local14 = (m_vertices[_local3].y - m_centroid.y);
_local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop);
_local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop);
_local17 = (1 / ((_local9 * _local12) - (_local10 * _local11)));
m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y));
_local3++;
};
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2AABB = s_sweptAABB1;
var _local5:b2AABB = s_sweptAABB2;
ComputeAABB(_local4, _arg2);
ComputeAABB(_local5, _arg3);
_arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y);
_arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y);
}
public function GetVertices():Array{
return (m_vertices);
}
public function GetCoreVertices():Array{
return (m_coreVertices);
}
public function GetCentroid():b2Vec2{
return (m_centroid);
}
public function GetOBB():b2OBB{
return (m_obb);
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_coreVertices[0]));
}
public function Centroid(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_centroid));
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local20:Number;
var _local21:Number;
var _local6:Number = 0;
var _local7:Number = _arg5;
_local8 = (_arg4.p1.x - _arg1.position.x);
_local9 = (_arg4.p1.y - _arg1.position.y);
_local10 = _arg1.R;
var _local12:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
var _local13:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local8 = (_arg4.p2.x - _arg1.position.x);
_local9 = (_arg4.p2.y - _arg1.position.y);
_local10 = _arg1.R;
var _local14:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
var _local15:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
var _local16:Number = (_local14 - _local12);
var _local17:Number = (_local15 - _local13);
var _local18 = -1;
var _local19:int;
while (_local19 < m_vertexCount) {
_local11 = m_vertices[_local19];
_local8 = (_local11.x - _local12);
_local9 = (_local11.y - _local13);
_local11 = m_normals[_local19];
_local20 = ((_local11.x * _local8) + (_local11.y * _local9));
_local21 = ((_local11.x * _local16) + (_local11.y * _local17));
if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){
_local6 = (_local20 / _local21);
_local18 = _local19;
} else {
if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){
_local7 = (_local20 / _local21);
};
};
if (_local7 < _local6){
return (e_missCollide);
};
_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 (e_hitCollide);
};
_arg2[0] = 0;
return (e_startsInsideCollide);
}
override public function ComputeMass(_arg1:b2MassData):void{
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
var _local7:Number = 0;
var _local8:Number = (1 / 3);
var _local9:int;
while (_local9 < m_vertexCount) {
_local10 = m_vertices[_local9];
_local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0];
_local12 = (_local10.x - _local6);
_local13 = (_local10.y - _local7);
_local14 = (_local11.x - _local6);
_local15 = (_local11.y - _local7);
_local16 = ((_local12 * _local15) - (_local13 * _local14));
_local17 = (0.5 * _local16);
_local4 = (_local4 + _local17);
_local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x)));
_local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y)));
_local18 = _local6;
_local19 = _local7;
_local20 = _local12;
_local21 = _local13;
_local22 = _local14;
_local23 = _local15;
_local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18));
_local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19));
_local5 = (_local5 + (_local16 * (_local24 + _local25)));
_local9++;
};
_arg1.mass = (m_density * _local4);
_local2 = (_local2 * (1 / _local4));
_local3 = (_local3 * (1 / _local4));
_arg1.center.Set(_local2, _local3);
_arg1.I = (m_density * _local5);
}
public function GetNormals():Array{
return (m_normals);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local11:Number;
_local5 = _arg1.R;
var _local6:Number = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y));
var _local7:Number = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y));
var _local8:int;
_local4 = m_coreVertices[0];
var _local9:Number = ((_local4.x * _local6) + (_local4.y * _local7));
var _local10 = 1;
while (_local10 < m_vertexCount) {
_local4 = m_coreVertices[_local10];
_local11 = ((_local4.x * _local6) + (_local4.y * _local7));
if (_local11 > _local9){
_local8 = _local10;
_local9 = _local11;
};
_local10++;
};
_local5 = _arg1.R;
_local4 = m_coreVertices[_local8];
s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y)));
s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y)));
return (s_supportVec);
}
public function GetVertexCount():int{
return (m_vertexCount);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Mat22 = s_computeMat;
_local3 = _arg2.R;
_local4 = m_obb.R.col1;
_local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local4 = m_obb.R.col2;
_local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local5.Abs();
var _local6:b2Mat22 = _local5;
_local4 = m_obb.extents;
var _local7:Number = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y));
var _local8:Number = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y));
_local3 = _arg2.R;
_local4 = m_obb.center;
var _local9:Number = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)));
var _local10:Number = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)));
_arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8));
_arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:b2Vec2;
var _local4:Number;
var _local5:Number;
m_sweepRadius = 0;
var _local3:int;
while (_local3 < m_vertexCount) {
_local2 = m_coreVertices[_local3];
_local4 = (_local2.x - _arg1.x);
_local5 = (_local2.y - _arg1.y);
_local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
if (_local4 > m_sweepRadius){
m_sweepRadius = _local4;
};
_local3++;
};
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Vec2;
var _local10:Number;
var _local4:b2Mat22 = _arg1.R;
var _local5:Number = (_arg2.x - _arg1.position.x);
var _local6:Number = (_arg2.y - _arg1.position.y);
var _local7:Number = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y));
var _local8:Number = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y));
var _local9:int;
while (_local9 < m_vertexCount) {
_local3 = m_vertices[_local9];
_local5 = (_local7 - _local3.x);
_local6 = (_local8 - _local3.y);
_local3 = m_normals[_local9];
_local10 = ((_local3.x * _local5) + (_local3.y * _local6));
if (_local10 > 0){
return (false);
};
_local9++;
};
return (true);
}
public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{
var _local3:b2Vec2;
var _local7:Number;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local3 = new b2Vec2();
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
_local7 = (1 / 3);
var _local8:int;
while (_local8 < _arg2) {
_local9 = _arg1[_local8];
_local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0];
_local11 = (_local9.x - _local5);
_local12 = (_local9.y - _local6);
_local13 = (_local10.x - _local5);
_local14 = (_local10.y - _local6);
_local15 = ((_local11 * _local14) - (_local12 * _local13));
_local16 = (0.5 * _local15);
_local4 = (_local4 + _local16);
_local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x)));
_local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y)));
_local8++;
};
_local3.x = (_local3.x * (1 / _local4));
_local3.y = (_local3.y * (1 / _local4));
return (_local3);
}
public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{
var _local4:int;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:b2Mat22;
var _local5:Array = new Array((b2Settings.b2_maxPolygonVertices + 1));
_local4 = 0;
while (_local4 < _arg3) {
_local5[_local4] = _arg2[_local4];
_local4++;
};
_local5[_arg3] = _local5[0];
var _local6:Number = Number.MAX_VALUE;
_local4 = 1;
while (_local4 <= _arg3) {
_local7 = _local5[int((_local4 - 1))];
_local8 = (_local5[_local4].x - _local7.x);
_local9 = (_local5[_local4].y - _local7.y);
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local8 = (_local8 / _local10);
_local9 = (_local9 / _local10);
_local11 = -(_local9);
_local12 = _local8;
_local13 = Number.MAX_VALUE;
_local14 = Number.MAX_VALUE;
_local15 = -(Number.MAX_VALUE);
_local16 = -(Number.MAX_VALUE);
_local17 = 0;
while (_local17 < _arg3) {
_local19 = (_local5[_local17].x - _local7.x);
_local20 = (_local5[_local17].y - _local7.y);
_local21 = ((_local8 * _local19) + (_local9 * _local20));
_local22 = ((_local11 * _local19) + (_local12 * _local20));
if (_local21 < _local13){
_local13 = _local21;
};
if (_local22 < _local14){
_local14 = _local22;
};
if (_local21 > _local15){
_local15 = _local21;
};
if (_local22 > _local16){
_local16 = _local22;
};
_local17++;
};
_local18 = ((_local15 - _local13) * (_local16 - _local14));
if (_local18 < (0.95 * _local6)){
_local6 = _local18;
_arg1.R.col1.x = _local8;
_arg1.R.col1.y = _local9;
_arg1.R.col2.x = _local11;
_arg1.R.col2.y = _local12;
_local23 = (0.5 * (_local13 + _local15));
_local24 = (0.5 * (_local14 + _local16));
_local25 = _arg1.R;
_arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24)));
_arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24)));
_arg1.extents.x = (0.5 * (_local15 - _local13));
_arg1.extents.y = (0.5 * (_local16 - _local14));
};
_local4++;
};
}
}
}//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape)
package Box2D.Collision.Shapes {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2Shape {
public var m_next:b2Shape;
public var m_type:int;
public var m_sweepRadius:Number;
public var m_density:Number;
public var m_filter:b2FilterData;
public var m_friction:Number;
public var m_isSensor:Boolean;
public var m_restitution:Number;
public var m_userData;
public var m_proxyId:uint;
public var m_body:b2Body;
public static const e_polygonShape:int = 1;
public static const e_hitCollide:int = 1;
public static const e_missCollide:int = 0;
public static const e_unknownShape:int = -1;
public static const e_circleShape:int = 0;
public static const e_shapeTypeCount:int = 2;
public static const e_startsInsideCollide:int = -1;
private static var s_resetAABB:b2AABB = new b2AABB();
private static var s_syncAABB:b2AABB = new b2AABB();
private static var s_proxyAABB:b2AABB = new b2AABB();
public function b2Shape(_arg1:b2ShapeDef){
m_userData = _arg1.userData;
m_friction = _arg1.friction;
m_restitution = _arg1.restitution;
m_density = _arg1.density;
m_body = null;
m_sweepRadius = 0;
m_next = null;
m_proxyId = b2Pair.b2_nullProxy;
m_filter = _arg1.filter.Copy();
m_isSensor = _arg1.isSensor;
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetSweepRadius():Number{
return (m_sweepRadius);
}
public function GetNext():b2Shape{
return (m_next);
}
public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
}
public function GetType():int{
return (m_type);
}
public function GetRestitution():Number{
return (m_restitution);
}
public function GetFriction():Number{
return (m_friction);
}
public function GetFilterData():b2FilterData{
return (m_filter.Copy());
}
public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{
return (e_missCollide);
}
public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
_arg1.DestroyProxy(m_proxyId);
var _local3:b2AABB = s_resetAABB;
ComputeAABB(_local3, _arg2);
var _local4:Boolean = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetFilterData(_arg1:b2FilterData):void{
m_filter = _arg1.Copy();
}
public function GetUserData(){
return (m_userData);
}
public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{
if (m_proxyId == b2Pair.b2_nullProxy){
return (false);
};
var _local4:b2AABB = s_syncAABB;
ComputeSweptAABB(_local4, _arg2, _arg3);
if (_arg1.InRange(_local4)){
_arg1.MoveProxy(m_proxyId, _local4);
return (true);
};
return (false);
}
public function ComputeMass(_arg1:b2MassData):void{
}
public function IsSensor():Boolean{
return (m_isSensor);
}
public function DestroyProxy(_arg1:b2BroadPhase):void{
if (m_proxyId != b2Pair.b2_nullProxy){
_arg1.DestroyProxy(m_proxyId);
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function UpdateSweepRadius(_arg1:b2Vec2):void{
}
public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
}
public function GetBody():b2Body{
return (m_body);
}
public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB = s_proxyAABB;
ComputeAABB(_local3, _arg2);
var _local4:Boolean = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
return (false);
}
public static function Destroy(_arg1:b2Shape, _arg2):void{
}
public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{
switch (_arg1.type){
case e_circleShape:
return (new b2CircleShape(_arg1));
case e_polygonShape:
return (new b2PolygonShape(_arg1));
default:
return (null);
};
}
}
}//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2ShapeDef {
public var friction:Number;// = 0.2
public var isSensor:Boolean;// = false
public var density:Number;// = 0
public var restitution:Number;// = 0
public var userData;// = null
public var filter:b2FilterData;
public var type:int;
public function b2ShapeDef(){
type = b2Shape.e_unknownShape;
filter = new b2FilterData();
super();
}
}
}//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2AABB {
public var upperBound:b2Vec2;
public var lowerBound:b2Vec2;
public function b2AABB(){
lowerBound = new b2Vec2();
upperBound = new b2Vec2();
super();
}
public function IsValid():Boolean{
var _local1:Number = (upperBound.x - lowerBound.x);
var _local2:Number = (upperBound.y - lowerBound.y);
var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid()));
return (_local3);
}
}
}//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound)
package Box2D.Collision {
public class b2Bound {
public var value:uint;
public var proxyId:uint;
public var stabbingCount:uint;
public function Swap(_arg1:b2Bound):void{
var _local2:uint = value;
var _local3:uint = proxyId;
var _local4:uint = stabbingCount;
value = _arg1.value;
proxyId = _arg1.proxyId;
stabbingCount = _arg1.stabbingCount;
_arg1.value = _local2;
_arg1.proxyId = _local3;
_arg1.stabbingCount = _local4;
}
public function IsLower():Boolean{
return (((value & 1) == 0));
}
public function IsUpper():Boolean{
return (((value & 1) == 1));
}
}
}//package Box2D.Collision
Section 11
//b2BoundValues (Box2D.Collision.b2BoundValues)
package Box2D.Collision {
public class b2BoundValues {
public var lowerValues:Array;
public var upperValues:Array;
public function b2BoundValues(){
lowerValues = [0, 0];
upperValues = [0, 0];
super();
}
}
}//package Box2D.Collision
Section 12
//b2BroadPhase (Box2D.Collision.b2BroadPhase)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2BroadPhase {
public var m_bounds:Array;
public var m_worldAABB:b2AABB;
public var m_querySortKeys:Array;
public var m_freeProxy:uint;
public var m_quantizationFactor:b2Vec2;
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 _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_querySortKeys = new Array(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;
m_querySortKeys[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
var _local4:Number = (_arg1.upperBound.x - _arg1.lowerBound.x);
var _local5:Number = (_arg1.upperBound.y - _arg1.lowerBound.y);
m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4);
m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5);
_local3 = 0;
while (_local3 < (b2Settings.b2_maxProxies - 1)) {
_local6 = new b2Proxy();
m_proxyPool[_local3] = _local6;
_local6.SetNext((_local3 + 1));
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
_local3++;
};
_local6 = new b2Proxy();
m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6;
_local6.SetNext(b2Pair.b2_nullProxy);
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
m_freeProxy = 0;
m_timeStamp = 1;
m_queryResultCount = 0;
}
public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{
var _local6:uint;
var _local7:uint;
var _local12:b2Proxy;
var _local4:Array = new Array();
var _local5:Array = new Array();
ComputeBounds(_local4, _local5, _arg1);
var _local8:Array = [_local6];
var _local9:Array = [_local7];
Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0);
Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1);
var _local10:int;
var _local11:int;
while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) {
_local12 = m_proxyPool[m_queryResults[_local11]];
_arg2[_local11] = _local12.userData;
_local11++;
_local10++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local10);
}
public function Commit():void{
m_pairManager.Commit();
}
public function GetProxy(_arg1:int):b2Proxy{
var _local2:b2Proxy = m_proxyPool[_arg1];
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){
return (null);
};
return (_local2);
}
private function IncrementTimeStamp():void{
var _local1:uint;
if (m_timeStamp == b2Settings.USHRT_MAX){
_local1 = 0;
while (_local1 < b2Settings.b2_maxProxies) {
(m_proxyPool[_local1] as b2Proxy).timeStamp = 0;
_local1++;
};
m_timeStamp = 1;
} else {
m_timeStamp++;
};
}
private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{
var _local10:b2Bound;
var _local12:int;
var _local13:int;
var _local14:b2Proxy;
var _local8:uint = BinarySearch(_arg5, _arg6, _arg3);
var _local9:uint = BinarySearch(_arg5, _arg6, _arg4);
var _local11:uint = _local8;
while (_local11 < _local9) {
_local10 = _arg5[_local11];
if (_local10.IsLower()){
IncrementOverlapCount(_local10.proxyId);
};
_local11++;
};
if (_local8 > 0){
_local12 = (_local8 - 1);
_local10 = _arg5[_local12];
_local13 = _local10.stabbingCount;
while (_local13) {
_local10 = _arg5[_local12];
if (_local10.IsLower()){
_local14 = m_proxyPool[_local10.proxyId];
if (_local8 <= _local14.upperBounds[_arg7]){
IncrementOverlapCount(_local10.proxyId);
_local13--;
};
};
_local12--;
};
};
_arg1[0] = _local8;
_arg2[0] = _local9;
}
private function AddProxyResult(_arg1:uint, _arg2:b2Proxy, _arg3:Number, _arg4:Function):void{
var _local9:Number;
var _local10:uint;
var _local5:Number = _arg4(_arg2.userData);
if (_local5 < 0){
return;
};
var _local6:Number = 0;
while ((((_local6 < m_queryResultCount)) && ((m_querySortKeys[_local6] < _local5)))) {
_local6++;
};
var _local7:Number = _local5;
var _local8:uint = _arg1;
m_queryResultCount = (m_queryResultCount + 1);
if (m_queryResultCount > _arg3){
m_queryResultCount = _arg3;
};
while (_local6 < m_queryResultCount) {
_local9 = m_querySortKeys[_local6];
_local10 = m_queryResults[_local6];
m_querySortKeys[_local6] = _local7;
m_queryResults[_local6] = _local8;
_local7 = _local9;
_local8 = _local10;
_local6++;
};
}
private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{
var _local4:Array;
var _local5:b2Bound;
var _local6:b2Bound;
var _local3:int;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg1.lowerBounds[_local3]];
_local6 = _local4[_arg2.upperBounds[_local3]];
if (_local5.value > _local6.value){
return (false);
};
_local5 = _local4[_arg1.upperBounds[_local3]];
_local6 = _local4[_arg2.lowerBounds[_local3]];
if (_local5.value < _local6.value){
return (false);
};
_local3++;
};
return (true);
}
private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{
var _local4:Number = _arg3.lowerBound.x;
var _local5:Number = _arg3.lowerBound.y;
_local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x);
_local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y);
_local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x);
_local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y);
var _local6:Number = _arg3.upperBound.x;
var _local7:Number = _arg3.upperBound.y;
_local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x);
_local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y);
_local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x);
_local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y);
_arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1));
_arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1);
_arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1));
_arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1);
}
public function CreateProxy(_arg1:b2AABB, _arg2):uint{
var _local3:uint;
var _local4:b2Proxy;
var _local11:Array;
var _local12:uint;
var _local13:uint;
var _local14:Array;
var _local15:Array;
var _local16:Array;
var _local17:int;
var _local18:int;
var _local19:b2Bound;
var _local20:b2Bound;
var _local21:b2Bound;
var _local22:int;
var _local23:b2Proxy;
var _local5:uint = m_freeProxy;
_local4 = m_proxyPool[_local5];
m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
var _local6:uint = (2 * m_proxyCount);
var _local7:Array = new Array();
var _local8:Array = new Array();
ComputeBounds(_local7, _local8, _arg1);
var _local9:int;
while (_local9 < 2) {
_local11 = m_bounds[_local9];
_local14 = [_local12];
_local15 = [_local13];
Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9);
_local12 = _local14[0];
_local13 = _local15[0];
_local16 = new Array();
_local18 = (_local6 - _local13);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local13 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local13 + 2);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local16 = new Array();
_local18 = (_local13 - _local12);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local12 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local12 + 1);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local13++;
_local19 = _local11[_local12];
_local20 = _local11[_local13];
_local19.value = _local7[_local9];
_local19.proxyId = _local5;
_local20.value = _local8[_local9];
_local20.proxyId = _local5;
_local21 = _local11[int((_local12 - 1))];
_local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount;
_local21 = _local11[int((_local13 - 1))];
_local20.stabbingCount = _local21.stabbingCount;
_local3 = _local12;
while (_local3 < _local13) {
_local21 = _local11[_local3];
_local21.stabbingCount++;
_local3++;
};
_local3 = _local12;
while (_local3 < (_local6 + 2)) {
_local19 = _local11[_local3];
_local23 = m_proxyPool[_local19.proxyId];
if (_local19.IsLower()){
_local23.lowerBounds[_local9] = _local3;
} else {
_local23.upperBounds[_local9] = _local3;
};
_local3++;
};
_local9++;
};
m_proxyCount++;
var _local10:int;
while (_local10 < m_queryResultCount) {
m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]);
_local10++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local5);
}
public function DestroyProxy(_arg1:uint):void{
var _local2:b2Bound;
var _local3:b2Bound;
var _local8:Array;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:Array;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:uint;
var _local18:int;
var _local19:b2Proxy;
var _local4:b2Proxy = m_proxyPool[_arg1];
var _local5:int = (2 * m_proxyCount);
var _local6:int;
while (_local6 < 2) {
_local8 = m_bounds[_local6];
_local9 = _local4.lowerBounds[_local6];
_local10 = _local4.upperBounds[_local6];
_local2 = _local8[_local9];
_local11 = _local2.value;
_local3 = _local8[_local10];
_local12 = _local3.value;
_local13 = new Array();
_local15 = ((_local10 - _local9) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local9 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = _local9;
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local13 = new Array();
_local15 = ((_local5 - _local10) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local10 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = (_local10 - 1);
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = (_local5 - 2);
_local17 = _local9;
while (_local17 < _local15) {
_local2 = _local8[_local17];
_local19 = m_proxyPool[_local2.proxyId];
if (_local2.IsLower()){
_local19.lowerBounds[_local6] = _local17;
} else {
_local19.upperBounds[_local6] = _local17;
};
_local17++;
};
_local15 = (_local10 - 1);
_local18 = _local9;
while (_local18 < _local15) {
_local2 = _local8[_local18];
_local2.stabbingCount--;
_local18++;
};
Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6);
_local6++;
};
var _local7:int;
while (_local7 < m_queryResultCount) {
m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]);
_local7++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
_local4.userData = null;
_local4.overlapCount = b2_invalid;
_local4.lowerBounds[0] = b2_invalid;
_local4.lowerBounds[1] = b2_invalid;
_local4.upperBounds[0] = b2_invalid;
_local4.upperBounds[1] = b2_invalid;
_local4.SetNext(m_freeProxy);
m_freeProxy = _arg1;
m_proxyCount--;
}
public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{
var _local4:Array;
var _local5:b2Bound;
var _local3:int;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg2.upperBounds[_local3]];
if (_arg1.lowerValues[_local3] > _local5.value){
return (false);
};
_local5 = _local4[_arg2.lowerBounds[_local3]];
if (_arg1.upperValues[_local3] < _local5.value){
return (false);
};
_local3++;
};
return (true);
}
public function Validate():void{
var _local1:b2Pair;
var _local2:b2Proxy;
var _local3:b2Proxy;
var _local4:Boolean;
var _local6:b2Bound;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
var _local5:int;
while (_local5 < 2) {
_local6 = m_bounds[_local5];
_local7 = (2 * m_proxyCount);
_local8 = 0;
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local6[_local9];
if (_local10.IsLower() == true){
_local8++;
} else {
_local8--;
};
_local9++;
};
_local5++;
};
}
private function IncrementOverlapCount(_arg1:uint):void{
var _local2:b2Proxy = m_proxyPool[_arg1];
if (_local2.timeStamp < m_timeStamp){
_local2.timeStamp = m_timeStamp;
_local2.overlapCount = 1;
} else {
_local2.overlapCount = 2;
m_queryResults[m_queryResultCount] = _arg1;
m_queryResultCount++;
};
}
public function InRange(_arg1:b2AABB):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = _arg1.lowerBound.x;
_local3 = _arg1.lowerBound.y;
_local2 = (_local2 - m_worldAABB.upperBound.x);
_local3 = (_local3 - m_worldAABB.upperBound.y);
_local4 = m_worldAABB.lowerBound.x;
_local5 = m_worldAABB.lowerBound.y;
_local4 = (_local4 - _arg1.upperBound.x);
_local5 = (_local5 - _arg1.upperBound.y);
_local2 = b2Math.b2Max(_local2, _local4);
_local3 = b2Math.b2Max(_local3, _local5);
return ((b2Math.b2Max(_local2, _local3) < 0));
}
public function QuerySegment(_arg1:b2Segment, _arg2, _arg3:int, _arg4:Function):int{
var _local15:int;
var _local16:int;
var _local17:uint;
var _local18:b2Proxy;
var _local19:uint;
var _local20:uint;
var _local24:Number;
var _local25:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:uint;
var _local5:Number = 1;
var _local6:Number = ((_arg1.p2.x - _arg1.p1.x) * m_quantizationFactor.x);
var _local7:Number = ((_arg1.p2.y - _arg1.p1.y) * m_quantizationFactor.y);
var _local8:int = ((_local6 < -(Number.MIN_VALUE))) ? -1 : ((_local6 > Number.MIN_VALUE)) ? 1 : 0;
var _local9:int = ((_local7 < -(Number.MIN_VALUE))) ? -1 : ((_local7 > Number.MIN_VALUE)) ? 1 : 0;
var _local10:Number = (m_quantizationFactor.x * (_arg1.p1.x - m_worldAABB.lowerBound.x));
var _local11:Number = (m_quantizationFactor.y * (_arg1.p1.y - m_worldAABB.lowerBound.y));
var _local12:Array = new Array();
var _local13:Array = new Array();
_local12[0] = (uint(_local10) & (b2Settings.USHRT_MAX - 1));
_local12[1] = (uint(_local11) & (b2Settings.USHRT_MAX - 1));
_local13[0] = (_local12[0] + 1);
_local13[1] = (_local12[1] + 1);
var _local14:Array = new Array();
var _local21:Array = [_local19];
var _local22:Array = [_local20];
Query(_local21, _local22, _local12[0], _local13[0], m_bounds[0], (2 * m_proxyCount), 0);
if (_local8 >= 0){
_local15 = (_local22[0] - 1);
} else {
_local15 = _local21[0];
};
Query(_local21, _local22, _local12[1], _local13[1], m_bounds[1], (2 * m_proxyCount), 1);
if (_local9 >= 0){
_local16 = (_local22[0] - 1);
} else {
_local16 = _local21[0];
};
if (_arg4 != null){
_local27 = 0;
while (_local27 < m_queryResultCount) {
m_querySortKeys[_local27] = _arg4(m_proxyPool[m_queryResults[_local27]].userData);
_local27++;
};
_local27 = 0;
while (_local27 < (m_queryResultCount - 1)) {
_local28 = m_querySortKeys[_local27];
_local29 = m_querySortKeys[(_local27 + 1)];
if (((_local28)<0) ? (_local29 >= 0) : (((_local28 > _local29)) && ((_local29 >= 0)))){
m_querySortKeys[(_local27 + 1)] = _local28;
m_querySortKeys[_local27] = _local29;
_local30 = m_queryResults[(_local27 + 1)];
m_queryResults[(_local27 + 1)] = m_queryResults[_local27];
m_queryResults[_local27] = _local30;
--_local27;
if (_local27 == -1){
_local27 = 1;
};
} else {
_local27++;
};
};
while ((((m_queryResultCount > 0)) && ((m_querySortKeys[(m_queryResultCount - 1)] < 0)))) {
m_queryResultCount--;
};
};
var _local23:Boolean;
if ((((_local15 < 0)) || ((_local15 >= (m_proxyCount * 2))))){
_local23 = false;
};
if ((((_local16 < 0)) || ((_local16 >= (m_proxyCount * 2))))){
_local23 = false;
};
if (_local23){
if (_local8 != 0){
if (_local8 > 0){
_local15++;
if (_local15 == (m_proxyCount * 2)){
_local23 = false;
};
} else {
--_local15;
if (_local15 < 0){
_local23 = false;
};
};
_local24 = ((m_bounds[0][_local15].value - _local10) / _local6);
};
if (_local9 != 0){
if (_local9 > 0){
_local16++;
if (_local16 == (m_proxyCount * 2)){
_local23 = false;
};
} else {
--_local16;
if (_local16 < 0){
_local23 = false;
};
};
_local25 = ((m_bounds[1][_local16].value - _local11) / _local7);
};
};
while (_local23) {
if ((((_local9 == 0)) || (((!((_local8 == 0))) && ((_local24 < _local25)))))){
if (_local24 > _local5){
break;
};
if (((_local8 > 0)) ? m_bounds[0][_local15].IsLower() : m_bounds[0][_local15].IsUpper()){
_local17 = m_bounds[0][_local15].proxyId;
_local18 = m_proxyPool[_local17];
if (_local9 >= 0){
if ((((_local18.lowerBounds[1] <= (_local16 - 1))) && ((_local18.upperBounds[1] >= _local16)))){
if (_arg4 != null){
AddProxyResult(_local17, _local18, _arg3, _arg4);
} else {
m_queryResults[m_queryResultCount] = _local17;
m_queryResultCount++;
};
};
} else {
if ((((_local18.lowerBounds[1] <= _local16)) && ((_local18.upperBounds[1] >= (_local16 + 1))))){
if (_arg4 != null){
AddProxyResult(_local17, _local18, _arg3, _arg4);
} else {
m_queryResults[m_queryResultCount] = _local17;
m_queryResultCount++;
};
};
};
};
if (((((((!((_arg4 == null))) && ((m_queryResultCount == _arg3)))) && ((m_queryResultCount > 0)))) && ((_local24 > m_querySortKeys[(m_queryResultCount - 1)])))){
break;
};
if (_local8 > 0){
_local15++;
if (_local15 == (m_proxyCount * 2)){
break;
};
} else {
--_local15;
if (_local15 < 0){
break;
};
};
_local24 = ((m_bounds[0][_local15].value - _local10) / _local6);
} else {
if (_local25 > _local5){
break;
};
if (((_local9 > 0)) ? m_bounds[1][_local16].IsLower() : m_bounds[1][_local16].IsUpper()){
_local17 = m_bounds[1][_local16].proxyId;
_local18 = m_proxyPool[_local17];
if (_local8 >= 0){
if ((((_local18.lowerBounds[0] <= (_local15 - 1))) && ((_local18.upperBounds[0] >= _local15)))){
if (_arg4 != null){
AddProxyResult(_local17, _local18, _arg3, _arg4);
} else {
m_queryResults[m_queryResultCount] = _local17;
m_queryResultCount++;
};
};
} else {
if ((((_local18.lowerBounds[0] <= _local15)) && ((_local18.upperBounds[0] >= (_local15 + 1))))){
if (_arg4 != null){
AddProxyResult(_local17, _local18, _arg3, _arg4);
} else {
m_queryResults[m_queryResultCount] = _local17;
m_queryResultCount++;
};
};
};
};
if (((((((!((_arg4 == null))) && ((m_queryResultCount == _arg3)))) && ((m_queryResultCount > 0)))) && ((_local25 > m_querySortKeys[(m_queryResultCount - 1)])))){
break;
};
if (_local9 > 0){
_local16++;
if (_local16 == (m_proxyCount * 2)){
break;
};
} else {
--_local16;
if (_local16 < 0){
break;
};
};
_local25 = ((m_bounds[1][_local16].value - _local11) / _local7);
};
};
var _local26:int;
_local27 = 0;
while ((((_local27 < m_queryResultCount)) && ((_local26 < _arg3)))) {
_local18 = m_proxyPool[m_queryResults[_local27]];
_arg2[_local27] = _local18.userData;
_local27++;
_local26++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local26);
}
public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{
var _local3:Array;
var _local4:int;
var _local5:uint;
var _local6:uint;
var _local7:b2Bound;
var _local8:b2Bound;
var _local9:b2Bound;
var _local10:uint;
var _local11:b2Proxy;
var _local16:Array;
var _local17:uint;
var _local18:uint;
var _local19:uint;
var _local20:uint;
var _local21:int;
var _local22:int;
var _local23:uint;
var _local24:b2Proxy;
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){
return;
};
if (_arg2.IsValid() == false){
return;
};
var _local12:uint = (2 * m_proxyCount);
var _local13:b2Proxy = m_proxyPool[_arg1];
var _local14:b2BoundValues = new b2BoundValues();
ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2);
var _local15:b2BoundValues = new b2BoundValues();
_local5 = 0;
while (_local5 < 2) {
_local7 = m_bounds[_local5][_local13.lowerBounds[_local5]];
_local15.lowerValues[_local5] = _local7.value;
_local7 = m_bounds[_local5][_local13.upperBounds[_local5]];
_local15.upperValues[_local5] = _local7.value;
_local5++;
};
_local5 = 0;
while (_local5 < 2) {
_local16 = m_bounds[_local5];
_local17 = _local13.lowerBounds[_local5];
_local18 = _local13.upperBounds[_local5];
_local19 = _local14.lowerValues[_local5];
_local20 = _local14.upperValues[_local5];
_local7 = _local16[_local17];
_local21 = (_local19 - _local7.value);
_local7.value = _local19;
_local7 = _local16[_local18];
_local22 = (_local20 - _local7.value);
_local7.value = _local20;
if (_local21 < 0){
_local6 = _local17;
while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local8.proxyId];
_local8.stabbingCount++;
if (_local8.IsUpper() == true){
if (TestOverlap(_local14, _local24)){
m_pairManager.AddBufferedPair(_arg1, _local23);
};
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
if (_local22 > 0){
_local6 = _local18;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount++;
if (_local9.IsLower() == true){
if (TestOverlap(_local14, _local11)){
m_pairManager.AddBufferedPair(_arg1, _local10);
};
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local21 > 0){
_local6 = _local17;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount--;
if (_local9.IsUpper()){
if (TestOverlap(_local15, _local11)){
m_pairManager.RemoveBufferedPair(_arg1, _local10);
};
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local22 < 0){
_local6 = _local18;
while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local23];
_local8.stabbingCount--;
if (_local8.IsLower() == true){
if (TestOverlap(_local15, _local24)){
m_pairManager.RemoveBufferedPair(_arg1, _local23);
};
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
_local5++;
};
}
public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{
var _local6:int;
var _local7:b2Bound;
var _local4:int;
var _local5:int = (_arg2 - 1);
while (_local4 <= _local5) {
_local6 = ((_local4 + _local5) / 2);
_local7 = _arg1[_local6];
if (_local7.value > _arg3){
_local5 = (_local6 - 1);
} else {
if (_local7.value < _arg3){
_local4 = (_local6 + 1);
} else {
return (uint(_local6));
};
};
};
return (uint(_local4));
}
}
}//package Box2D.Collision
Section 13
//b2BufferedPair (Box2D.Collision.b2BufferedPair)
package Box2D.Collision {
public class b2BufferedPair {
public var proxyId1:uint;
public var proxyId2:uint;
}
}//package Box2D.Collision
Section 14
//b2Collision (Box2D.Collision.b2Collision)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.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 _local11:b2Mat22;
var _local12:b2Vec2;
var _local25:Number;
var _local6:int = _arg1.m_vertexCount;
var _local7:Array = _arg1.m_vertices;
var _local8:Array = _arg1.m_normals;
var _local9:int = _arg4.m_vertexCount;
var _local10:Array = _arg4.m_vertices;
_local11 = _arg2.R;
_local12 = _local8[_arg3];
var _local13:Number = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y));
var _local14:Number = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y));
_local11 = _arg5.R;
var _local15:Number = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14));
var _local16:Number = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14));
var _local17:int;
var _local18:Number = Number.MAX_VALUE;
var _local19:int;
while (_local19 < _local9) {
_local12 = _local10[_local19];
_local25 = ((_local12.x * _local15) + (_local12.y * _local16));
if (_local25 < _local18){
_local18 = _local25;
_local17 = _local19;
};
_local19++;
};
_local12 = _local7[_arg3];
_local11 = _arg2.R;
var _local20:Number = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
var _local21:Number = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local12 = _local10[_local17];
_local11 = _arg5.R;
var _local22:Number = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
var _local23:Number = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local22 = (_local22 - _local20);
_local23 = (_local23 - _local21);
var _local24:Number = ((_local22 * _local13) + (_local23 * _local14));
return (_local24);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2 = _arg2.lowerBound;
var _local4:b2Vec2 = _arg1.upperBound;
var _local5:Number = (_local3.x - _local4.x);
var _local6:Number = (_local3.y - _local4.y);
_local3 = _arg1.lowerBound;
_local4 = _arg2.upperBound;
var _local7:Number = (_local3.x - _local4.x);
var _local8:Number = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{
var _local12:b2Mat22;
var _local13:b2Vec2;
var _local20:ClipVertex;
var _local23:Number;
var _local7:int = _arg2.m_vertexCount;
var _local8:Array = _arg2.m_normals;
var _local9:int = _arg5.m_vertexCount;
var _local10:Array = _arg5.m_vertices;
var _local11:Array = _arg5.m_normals;
_local12 = _arg3.R;
_local13 = _local8[_arg4];
var _local14:Number = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y));
var _local15:Number = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y));
_local12 = _arg6.R;
var _local16:Number = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15));
_local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15));
_local14 = _local16;
var _local17:int;
var _local18:Number = Number.MAX_VALUE;
var _local19:int;
while (_local19 < _local9) {
_local13 = _local11[_local19];
_local23 = ((_local14 * _local13.x) + (_local15 * _local13.y));
if (_local23 < _local18){
_local18 = _local23;
_local17 = _local19;
};
_local19++;
};
var _local21:int = _local17;
var _local22:int = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0;
_local20 = _arg1[0];
_local13 = _local10[_local21];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local21;
_local20.id.features.incidentVertex = 0;
_local20 = _arg1[1];
_local13 = _local10[_local22];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local22;
_local20.id.features.incidentVertex = 1;
}
public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{
var _local6:ClipVertex;
var _local13:b2PolygonShape;
var _local14:b2PolygonShape;
var _local17:int;
var _local18:uint;
var _local34:int;
var _local37:b2Vec2;
var _local38:Number;
var _local39:b2ManifoldPoint;
_arg1.pointCount = 0;
var _local7:int;
var _local8:Array = [_local7];
var _local9:Number = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5);
_local7 = _local8[0];
if (_local9 > 0){
return;
};
var _local10:int;
var _local11:Array = [_local10];
var _local12:Number = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3);
_local10 = _local11[0];
if (_local12 > 0){
return;
};
var _local15:b2XForm = new b2XForm();
var _local16:b2XForm = new b2XForm();
var _local19:Number = 0.98;
var _local20:Number = 0.001;
if (_local12 > ((_local19 * _local9) + _local20)){
_local13 = _arg4;
_local14 = _arg2;
_local15.Set(_arg5);
_local16.Set(_arg3);
_local17 = _local10;
_local18 = 1;
} else {
_local13 = _arg2;
_local14 = _arg4;
_local15.Set(_arg3);
_local16.Set(_arg5);
_local17 = _local7;
_local18 = 0;
};
var _local21:Array = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16);
var _local22:int = _local13.m_vertexCount;
var _local23:Array = _local13.m_vertices;
var _local24:b2Vec2 = _local23[_local17];
var _local25:b2Vec2 = _local24.Copy();
if ((_local17 + 1) < _local22){
_local24 = _local23[int((_local17 + 1))];
_local37 = _local24.Copy();
} else {
_local24 = _local23[0];
_local37 = _local24.Copy();
};
var _local26:b2Vec2 = b2Math.SubtractVV(_local37, _local25);
var _local27:b2Vec2 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25));
_local27.Normalize();
var _local28:b2Vec2 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local37 = b2Math.b2MulX(_local15, _local37);
var _local29:Number = b2Math.b2Dot(_local28, _local25);
var _local30:Number = -(b2Math.b2Dot(_local27, _local25));
var _local31:Number = b2Math.b2Dot(_local27, _local37);
var _local32:Array = [new ClipVertex(), new ClipVertex()];
var _local33:Array = [new ClipVertex(), new ClipVertex()];
_local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30);
if (_local34 < 2){
return;
};
_local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31);
if (_local34 < 2){
return;
};
_arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy();
var _local35:int;
var _local36:int;
while (_local36 < b2Settings.b2_maxManifoldPoints) {
_local6 = _local33[_local36];
_local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29);
if (_local38 <= 0){
_local39 = _arg1.points[_local35];
_local39.separation = _local38;
_local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local39.id.key = _local6.id._key;
_local39.id.features.flip = _local18;
_local35++;
};
_local36++;
};
_arg1.pointCount = _local35;
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local8:b2Vec2;
var _local9:b2Mat22;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:Number;
var _local6:int = _arg2.m_vertexCount;
var _local7:Array = _arg2.m_normals;
_local9 = _arg5.R;
_local8 = _arg4.m_centroid;
var _local10:Number = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)));
var _local11:Number = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)));
_local9 = _arg3.R;
_local8 = _arg2.m_centroid;
_local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))));
_local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))));
var _local12:Number = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y));
var _local13:Number = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y));
var _local14:int;
var _local15:Number = -(Number.MAX_VALUE);
var _local16:int;
while (_local16 < _local6) {
_local8 = _local7[_local16];
_local25 = ((_local8.x * _local12) + (_local8.y * _local13));
if (_local25 > _local15){
_local15 = _local25;
_local14 = _local16;
};
_local16++;
};
var _local17:Number = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
var _local18:int = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1);
var _local19:Number = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5);
if (_local19 > 0){
return (_local19);
};
var _local20:int = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0;
var _local21:Number = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5);
if (_local21 > 0){
return (_local21);
};
if ((((_local19 > _local17)) && ((_local19 > _local21)))){
_local24 = -1;
_local22 = _local18;
_local23 = _local19;
} else {
if (_local21 > _local17){
_local24 = 1;
_local22 = _local20;
_local23 = _local21;
} else {
_arg1[0] = _local14;
return (_local17);
};
};
while (true) {
if (_local24 == -1){
_local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1);
} else {
_local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
if (_local17 > _local23){
_local22 = _local14;
_local23 = _local17;
} else {
break;
};
};
_arg1[0] = _local22;
return (_local23);
}
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:ClipVertex;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:Number;
var _local11:Number;
var _local12:b2Vec2;
var _local13:ClipVertex;
_local6 = 0;
_local5 = _arg2[0];
_local7 = _local5.v;
_local5 = _arg2[1];
_local8 = _local5.v;
_local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4);
var _local10:Number = (b2Math.b2Dot(_arg3, _local8) - _arg4);
if (_local9 <= 0){
var _temp1 = _local6;
_local6 = (_local6 + 1);
var _local14 = _temp1;
_arg1[_local14] = _arg2[0];
};
if (_local10 <= 0){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_local14 = _temp2;
_arg1[_local14] = _arg2[1];
};
if ((_local9 * _local10) < 0){
_local11 = (_local9 / (_local9 - _local10));
_local5 = _arg1[_local6];
_local12 = _local5.v;
_local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x)));
_local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y)));
_local5 = _arg1[_local6];
if (_local9 > 0){
_local13 = _arg2[0];
_local5.id = _local13.id;
} else {
_local13 = _arg2[1];
_local5.id = _local13.id;
};
_local6++;
};
return (_local6);
}
public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2Mat22;
var _local7:b2Vec2;
var _local18:Number;
var _local24:Number;
var _local25:Number;
_arg1.pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_localPosition;
var _local8:Number = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local9:Number = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_localPosition;
var _local10:Number = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local11:Number = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
var _local12:Number = (_local10 - _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = ((_local12 * _local12) + (_local13 * _local13));
var _local15:Number = _arg2.m_radius;
var _local16:Number = _arg4.m_radius;
var _local17:Number = (_local15 + _local16);
if (_local14 > (_local17 * _local17)){
return;
};
if (_local14 < Number.MIN_VALUE){
_local18 = -(_local17);
_arg1.normal.Set(0, 1);
} else {
_local24 = Math.sqrt(_local14);
_local18 = (_local24 - _local17);
_local25 = (1 / _local24);
_arg1.normal.x = (_local25 * _local12);
_arg1.normal.y = (_local25 * _local13);
};
_arg1.pointCount = 1;
var _local19:b2ManifoldPoint = _arg1.points[0];
_local19.id.key = 0;
_local19.separation = _local18;
_local8 = (_local8 + (_local15 * _arg1.normal.x));
_local9 = (_local9 + (_local15 * _arg1.normal.y));
_local10 = (_local10 - (_local16 * _arg1.normal.x));
_local11 = (_local11 - (_local16 * _arg1.normal.y));
var _local20:Number = (0.5 * (_local8 + _local10));
var _local21:Number = (0.5 * (_local9 + _local11));
var _local22:Number = (_local20 - _arg3.position.x);
var _local23:Number = (_local21 - _arg3.position.y);
_local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y));
_local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y));
_local22 = (_local20 - _arg5.position.x);
_local23 = (_local21 - _arg5.position.y);
_local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y));
_local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y));
}
public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2ManifoldPoint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local12:b2Mat22;
var _local17:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_arg1.pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_localPosition;
var _local13:Number = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
var _local14:Number = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)));
_local7 = (_local13 - _arg3.position.x);
_local8 = (_local14 - _arg3.position.y);
_local12 = _arg3.R;
var _local15:Number = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
var _local16:Number = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
var _local18:int;
var _local19:Number = -(Number.MAX_VALUE);
var _local20:Number = _arg4.m_radius;
var _local21:int = _arg2.m_vertexCount;
var _local22:Array = _arg2.m_vertices;
var _local23:Array = _arg2.m_normals;
var _local24:int;
while (_local24 < _local21) {
_local11 = _local22[_local24];
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local11 = _local23[_local24];
_local34 = ((_local11.x * _local7) + (_local11.y * _local8));
if (_local34 > _local20){
return;
};
if (_local34 > _local19){
_local19 = _local34;
_local18 = _local24;
};
_local24++;
};
if (_local19 < Number.MIN_VALUE){
_arg1.pointCount = 1;
_local11 = _local23[_local18];
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y));
_arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y));
_local6 = _arg1.points[0];
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local19 - _local20);
return;
};
var _local25:int = _local18;
var _local26:int = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
_local11 = _local22[_local25];
var _local27:b2Vec2 = _local22[_local26];
var _local28:Number = (_local27.x - _local11.x);
var _local29:Number = (_local27.y - _local11.y);
var _local30:Number = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
var _local31:Number = ((_local7 * _local28) + (_local8 * _local29));
_local6 = _arg1.points[0];
if (_local31 <= 0){
_local32 = _local11.x;
_local33 = _local11.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local25;
} else {
if (_local31 >= _local30){
_local32 = _local27.x;
_local33 = _local27.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local26;
} else {
_local32 = ((_local28 * _local31) + _local11.x);
_local33 = ((_local29 * _local31) + _local11.y);
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = 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 = new b2ContactID();
_local1.key = key;
return (_local1);
}
public function set key(_arg1:uint):void{
_key = _arg1;
features._referenceEdge = (_key & 0xFF);
features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF);
features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF);
features._flip = (((_key & 4278190080) >> 24) & 0xFF);
}
public function get key():uint{
return (_key);
}
}
}//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2ContactPoint {
public var friction:Number;
public var separation:Number;
public var normal:b2Vec2;
public var position:b2Vec2;
public var restitution:Number;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var id:b2ContactID;
public var velocity:b2Vec2;
public function b2ContactPoint(){
position = new b2Vec2();
velocity = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.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 _local6:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local4:Number = (100 * Number.MIN_VALUE);
var _local5:int;
while (_local5 < _arg3) {
_local6 = _arg2[_local5];
_local7 = Math.abs((_arg1.x - _local6.x));
_local8 = Math.abs((_arg1.y - _local6.y));
_local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x));
_local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y));
if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){
return (true);
};
_local5++;
};
return (false);
}
public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{
var _local7:b2Vec2;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:int;
var _local8:Array = s_p1s;
var _local9:Array = s_p2s;
var _local10:Array = s_points;
var _local11:int;
_arg1.SetV(_arg3.GetFirstVertex(_arg4));
_arg2.SetV(_arg5.GetFirstVertex(_arg6));
var _local12:Number = 0;
var _local13 = 20;
var _local14:int;
while (_local14 < _local13) {
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local17 = _arg3.Support(_arg4, _local15, _local16);
_local18 = _arg5.Support(_arg6, -(_local15), -(_local16));
_local12 = ((_local15 * _local15) + (_local16 * _local16));
_local19 = (_local18.x - _local17.x);
_local20 = (_local18.y - _local17.y);
_local21 = ((_local15 * _local19) + (_local16 * _local20));
if ((_local12 - ((_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 _local19:Number;
var _local20:Number;
_local7 = _arg4.R;
_local8 = _arg3.m_localPosition;
var _local9:Number = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
var _local10:Number = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local7 = _arg6.R;
_local8 = _arg5.m_localPosition;
var _local11:Number = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
var _local12:Number = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
var _local13:Number = (_local11 - _local9);
var _local14:Number = (_local12 - _local10);
var _local15:Number = ((_local13 * _local13) + (_local14 * _local14));
var _local16:Number = (_arg3.m_radius - b2Settings.b2_toiSlop);
var _local17:Number = (_arg5.m_radius - b2Settings.b2_toiSlop);
var _local18:Number = (_local16 + _local17);
if (_local15 > (_local18 * _local18)){
_local19 = Math.sqrt(((_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 _local35:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg5[2];
_local9 = _arg3[0];
_local10 = _arg3[1];
_local11 = _arg3[2];
_local12 = _arg4[0];
_local13 = _arg4[1];
var _local14:b2Vec2 = _arg4[2];
var _local15:Number = _local6.x;
var _local16:Number = _local6.y;
var _local17:Number = _local7.x;
var _local18:Number = _local7.y;
var _local19:Number = _local8.x;
var _local20:Number = _local8.y;
var _local21:Number = (_local17 - _local15);
var _local22:Number = (_local18 - _local16);
var _local23:Number = (_local19 - _local15);
var _local24:Number = (_local20 - _local16);
var _local25:Number = (_local19 - _local17);
var _local26:Number = (_local20 - _local18);
var _local27:Number = -(((_local15 * _local21) + (_local16 * _local22)));
var _local28:Number = ((_local17 * _local21) + (_local18 * _local22));
var _local29:Number = -(((_local15 * _local23) + (_local16 * _local24)));
var _local30:Number = ((_local19 * _local23) + (_local20 * _local24));
var _local31:Number = -(((_local17 * _local25) + (_local18 * _local26)));
var _local32:Number = ((_local19 * _local25) + (_local20 * _local26));
if ((((_local30 <= 0)) && ((_local32 <= 0)))){
_arg1.SetV(_local11);
_arg2.SetV(_local14);
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (1);
};
var _local33:Number = ((_local21 * _local24) - (_local22 * _local23));
var _local34:Number = (_local33 * ((_local15 * _local18) - (_local16 * _local17)));
var _local36:Number = (_local33 * ((_local17 * _local20) - (_local18 * _local19)));
if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){
_local35 = (_local31 / (_local31 + _local32));
_arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x)));
_arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y)));
_arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x)));
_arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y)));
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (2);
};
var _local37:Number = (_local33 * ((_local19 * _local16) - (_local20 * _local15)));
if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){
_local35 = (_local29 / (_local29 + _local30));
_arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x)));
_arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y)));
_arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x)));
_arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y)));
_local10.SetV(_local11);
_local13.SetV(_local14);
_local7.SetV(_local8);
return (2);
};
var _local38:Number = ((_local36 + _local37) + _local34);
_local38 = (1 / _local38);
var _local39:Number = (_local36 * _local38);
var _local40:Number = (_local37 * _local38);
var _local41:Number = ((1 - _local39) - _local40);
_arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x));
_arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y));
_arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x));
_arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y));
return (3);
}
public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local9:b2Point = gPoint;
_local8 = _arg5.m_localPosition;
_local7 = _arg6.R;
_local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
var _local10:Number = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity);
var _local11:Number = (_arg5.m_radius - b2Settings.b2_toiSlop);
if (_local10 > _local11){
_local10 = (_local10 - _local11);
_local12 = (_arg2.x - _arg1.x);
_local13 = (_arg2.y - _arg1.y);
_local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13)));
_local12 = (_local12 / _local14);
_local13 = (_local13 / _local14);
_arg2.x = (_arg2.x - (_local11 * _local12));
_arg2.y = (_arg2.y - (_local11 * _local13));
} else {
_local10 = 0;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
};
return (_local10);
}
public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{
var _local7:int = _arg3.m_type;
var _local8:int = _arg5.m_type;
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6));
};
return (0);
}
public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local17:Number;
var _local6:b2Vec2 = _arg5[0];
var _local7:b2Vec2 = _arg5[1];
var _local8:b2Vec2 = _arg3[0];
_local9 = _arg3[1];
_local10 = _arg4[0];
_local11 = _arg4[1];
var _local12:Number = -(_local7.x);
var _local13:Number = -(_local7.y);
var _local14:Number = (_local6.x - _local7.x);
var _local15:Number = (_local6.y - _local7.y);
var _local16:Number = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
_local14 = (_local14 / _local16);
_local15 = (_local15 / _local16);
_local17 = ((_local12 * _local14) + (_local13 * _local15));
if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){
_arg1.SetV(_local9);
_arg2.SetV(_local11);
_local8.SetV(_local9);
_local10.SetV(_local11);
_local6.SetV(_local7);
return (1);
};
_local17 = (_local17 / _local16);
_arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x)));
_arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y)));
_arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x)));
_arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y)));
return (2);
}
}
}//package Box2D.Collision
Section 18
//b2Manifold (Box2D.Collision.b2Manifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Manifold {
public var pointCount:int;// = 0
public var normal:b2Vec2;
public var points:Array;
public function b2Manifold(){
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ManifoldPoint();
_local1++;
};
normal = new b2Vec2();
}
public function Set(_arg1:b2Manifold):void{
pointCount = _arg1.pointCount;
var _local2:int;
while (_local2 < b2Settings.b2_maxManifoldPoints) {
(points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]);
_local2++;
};
normal.SetV(_arg1.normal);
}
public function Reset():void{
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
normal.SetZero();
pointCount = 0;
}
}
}//package Box2D.Collision
Section 19
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2ManifoldPoint {
public var separation:Number;
public var localPoint2:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var localPoint1:b2Vec2;
public var id:b2ContactID;
public function b2ManifoldPoint(){
localPoint1 = new b2Vec2();
localPoint2 = new b2Vec2();
id = new b2ContactID();
super();
}
public function Set(_arg1:b2ManifoldPoint):void{
localPoint1.SetV(_arg1.localPoint1);
localPoint2.SetV(_arg1.localPoint2);
separation = _arg1.separation;
normalImpulse = _arg1.normalImpulse;
tangentImpulse = _arg1.tangentImpulse;
id.key = _arg1.id.key;
}
public function Reset():void{
localPoint1.SetZero();
localPoint2.SetZero();
separation = 0;
normalImpulse = 0;
tangentImpulse = 0;
id.key = 0;
}
}
}//package Box2D.Collision
Section 20
//b2OBB (Box2D.Collision.b2OBB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2OBB {
public var R:b2Mat22;
public var center:b2Vec2;
public var extents:b2Vec2;
public function b2OBB(){
R = new b2Mat22();
center = new b2Vec2();
extents = new b2Vec2();
super();
}
}
}//package Box2D.Collision
Section 21
//b2Pair (Box2D.Collision.b2Pair)
package Box2D.Collision {
import Box2D.Common.*;
public class b2Pair {
public var proxyId1:uint;
public var userData;// = null
public var proxyId2:uint;
public var status:uint;
public var next:uint;
public static var e_pairFinal:uint = 4;
public static var b2_tableMask:int = (b2_tableCapacity - 1);
public static var e_pairRemoved:uint = 2;
public static var b2_nullPair:uint = b2Settings.USHRT_MAX;
public static var e_pairBuffered:uint = 1;
public static var b2_nullProxy:uint = b2Settings.USHRT_MAX;
public static var b2_tableCapacity:int = b2Settings.b2_maxPairs;
public function SetBuffered():void{
status = (status | e_pairBuffered);
}
public function IsBuffered():Boolean{
return (((status & e_pairBuffered) == e_pairBuffered));
}
public function IsFinal():Boolean{
return (((status & e_pairFinal) == e_pairFinal));
}
public function ClearRemoved():void{
status = (status & ~(e_pairRemoved));
}
public function SetFinal():void{
status = (status | e_pairFinal);
}
public function IsRemoved():Boolean{
return (((status & e_pairRemoved) == e_pairRemoved));
}
public function ClearBuffered():void{
status = (status & ~(e_pairBuffered));
}
public function SetRemoved():void{
status = (status | e_pairRemoved);
}
}
}//package Box2D.Collision
Section 22
//b2PairCallback (Box2D.Collision.b2PairCallback)
package Box2D.Collision {
public class b2PairCallback {
public function PairRemoved(_arg1, _arg2, _arg3):void{
}
public function PairAdded(_arg1, _arg2){
return (null);
}
}
}//package Box2D.Collision
Section 23
//b2PairManager (Box2D.Collision.b2PairManager)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PairManager {
public var m_pairCount:int;
public var m_pairBuffer:Array;
public var m_hashTable:Array;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_pairBufferCount:int;
public var m_broadPhase:b2BroadPhase;
public var m_freePair:uint;
public function b2PairManager(){
var _local1:uint;
super();
m_hashTable = new Array(b2Pair.b2_tableCapacity);
_local1 = 0;
while (_local1 < b2Pair.b2_tableCapacity) {
m_hashTable[_local1] = b2Pair.b2_nullPair;
_local1++;
};
m_pairs = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1] = new b2Pair();
_local1++;
};
m_pairBuffer = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairBuffer[_local1] = new b2BufferedPair();
_local1++;
};
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy;
m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy;
m_pairs[_local1].userData = null;
m_pairs[_local1].status = 0;
m_pairs[_local1].next = (_local1 + 1);
_local1++;
};
m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair;
m_pairCount = 0;
m_pairBufferCount = 0;
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:b2Pair;
var _local5:uint = m_hashTable[_arg3];
_local4 = m_pairs[_local5];
while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) {
_local5 = _local4.next;
_local4 = m_pairs[_local5];
};
if (_local5 == b2Pair.b2_nullPair){
return (null);
};
return (_local4);
}
private function Find(_arg1:uint, _arg2:uint):b2Pair{
var _local4:uint;
if (_arg1 > _arg2){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
return (FindHash(_arg1, _arg2, _local3));
}
private function ValidateBuffer():void{
}
public function Commit():void{
var _local1:b2BufferedPair;
var _local2:int;
var _local5:b2Pair;
var _local6:b2Proxy;
var _local7:b2Proxy;
var _local3:int;
var _local4:Array = m_broadPhase.m_proxyPool;
_local2 = 0;
while (_local2 < m_pairBufferCount) {
_local1 = m_pairBuffer[_local2];
_local5 = Find(_local1.proxyId1, _local1.proxyId2);
_local5.ClearBuffered();
_local6 = _local4[_local5.proxyId1];
_local7 = _local4[_local5.proxyId2];
if (_local5.IsRemoved()){
if (_local5.IsFinal() == true){
m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData);
};
_local1 = m_pairBuffer[_local3];
_local1.proxyId1 = _local5.proxyId1;
_local1.proxyId2 = _local5.proxyId2;
_local3++;
} else {
if (_local5.IsFinal() == false){
_local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData);
_local5.SetFinal();
};
};
_local2++;
};
_local2 = 0;
while (_local2 < _local3) {
_local1 = m_pairBuffer[_local2];
RemovePair(_local1.proxyId1, _local1.proxyId2);
_local2++;
};
m_pairBufferCount = 0;
if (b2BroadPhase.s_validate){
ValidateTable();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair = Find(_arg1, _arg2);
if (_local4 == null){
return;
};
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.SetRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function RemovePair(_arg1:uint, _arg2:uint){
var _local3:b2Pair;
var _local7:uint;
var _local8:uint;
var _local9:*;
if (_arg1 > _arg2){
_local7 = _arg1;
_arg1 = _arg2;
_arg2 = _local7;
};
var _local4:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local5:uint = m_hashTable[_local4];
var _local6:b2Pair;
while (_local5 != b2Pair.b2_nullPair) {
if (Equals(m_pairs[_local5], _arg1, _arg2)){
_local8 = _local5;
_local3 = m_pairs[_local5];
if (_local6){
_local6.next = _local3.next;
} else {
m_hashTable[_local4] = _local3.next;
};
_local3 = m_pairs[_local8];
_local9 = _local3.userData;
_local3.next = m_freePair;
_local3.proxyId1 = b2Pair.b2_nullProxy;
_local3.proxyId2 = b2Pair.b2_nullProxy;
_local3.userData = null;
_local3.status = 0;
m_freePair = _local8;
m_pairCount--;
return (_local9);
} else {
_local6 = m_pairs[_local5];
_local5 = _local6.next;
};
};
return (null);
}
public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{
m_broadPhase = _arg1;
m_callback = _arg2;
}
public function AddBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair = AddPair(_arg1, _arg2);
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.ClearRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function AddPair(_arg1:uint, _arg2:uint):b2Pair{
var _local6:uint;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local4 = FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
var _local5:uint = m_freePair;
_local4 = m_pairs[_local5];
m_freePair = _local4.next;
_local4.proxyId1 = _arg1;
_local4.proxyId2 = _arg2;
_local4.status = 0;
_local4.userData = null;
_local4.next = m_hashTable[_local3];
m_hashTable[_local3] = _local5;
m_pairCount++;
return (_local4);
}
private function ValidateTable():void{
}
public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{
return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2))));
}
public static function Hash(_arg1:uint, _arg2:uint):uint{
var _local3:uint = (((_arg2 << 16) & 4294901760) | _arg1);
_local3 = (~(_local3) + ((_local3 << 15) & 4294934528));
_local3 = (_local3 ^ ((_local3 >> 12) & 1048575));
_local3 = (_local3 + ((_local3 << 2) & 4294967292));
_local3 = (_local3 ^ ((_local3 >> 4) & 268435455));
_local3 = (_local3 * 2057);
_local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF));
return (_local3);
}
public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{
return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3))));
}
}
}//package Box2D.Collision
Section 24
//b2Point (Box2D.Collision.b2Point)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2Point {
public var p:b2Vec2;
public function b2Point(){
p = new b2Vec2();
super();
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (p);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
return (p);
}
}
}//package Box2D.Collision
Section 25
//b2Proxy (Box2D.Collision.b2Proxy)
package Box2D.Collision {
public class b2Proxy {
public var overlapCount:uint;
public var userData;// = null
public var lowerBounds:Array;
public var upperBounds:Array;
public var timeStamp:uint;
public function b2Proxy(){
lowerBounds = [uint(0), uint(0)];
upperBounds = [uint(0), uint(0)];
super();
}
public function GetNext():uint{
return (lowerBounds[0]);
}
public function IsValid():Boolean{
return (!((overlapCount == b2BroadPhase.b2_invalid)));
}
public function SetNext(_arg1:uint):void{
lowerBounds[0] = (_arg1 & 0xFFFF);
}
}
}//package Box2D.Collision
Section 26
//b2Segment (Box2D.Collision.b2Segment)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Segment {
public var p1:b2Vec2;
public var p2:b2Vec2;
public function b2Segment(){
p1 = new b2Vec2();
p2 = new b2Vec2();
super();
}
public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local5:b2Vec2 = _arg3.p1;
var _local6:Number = (_arg3.p2.x - _local5.x);
var _local7:Number = (_arg3.p2.y - _local5.y);
var _local8:Number = (p2.x - p1.x);
var _local9:Number = (p2.y - p1.y);
var _local10:Number = _local9;
var _local11:Number = -(_local8);
var _local12:Number = (100 * Number.MIN_VALUE);
var _local13:Number = -(((_local6 * _local10) + (_local7 * _local11)));
if (_local13 > _local12){
_local14 = (_local5.x - p1.x);
_local15 = (_local5.y - p1.y);
_local16 = ((_local14 * _local10) + (_local15 * _local11));
if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){
_local17 = ((-(_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);
}
public function Extend(_arg1:b2AABB):void{
ExtendForward(_arg1);
ExtendBackward(_arg1);
}
public function ExtendForward(_arg1:b2AABB):void{
var aabb = _arg1;
var dX:Number = (p2.x - p1.x);
var dY:Number = (p2.y - p1.y);
var greaterthan0:* = function (_arg1){
return ((_arg1 > 0));
};
var lambda:Number = Math.min(((dX > 0)) ? ((aabb.upperBound.x - p1.x) / dX) : ((dX < 0)) ? ((aabb.lowerBound.x - p1.x) / dX) : Number.POSITIVE_INFINITY, ((dY > 0)) ? ((aabb.upperBound.y - p1.y) / dY) : ((dY < 0)) ? ((aabb.lowerBound.y - p1.y) / dY) : Number.POSITIVE_INFINITY);
p2.x = (p1.x + (dX * lambda));
p2.y = (p1.y + (dY * lambda));
}
public function ExtendBackward(_arg1:b2AABB):void{
var dY:Number;
var lambda:Number;
var aabb = _arg1;
var dX:Number = (-(p2.x) + p1.x);
dY = (-(p2.y) + p1.y);
var greaterthan0:* = function (_arg1){
return ((_arg1 > 0));
};
lambda = Math.min(((dX > 0)) ? ((aabb.upperBound.x - p2.x) / dX) : ((dX < 0)) ? ((aabb.lowerBound.x - p2.x) / dX) : Number.POSITIVE_INFINITY, ((dY > 0)) ? ((aabb.upperBound.y - p2.y) / dY) : ((dY < 0)) ? ((aabb.lowerBound.y - p2.y) / dY) : Number.POSITIVE_INFINITY);
p1.x = (p2.x + (dX * lambda));
p1.y = (p2.y + (dY * lambda));
}
}
}//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 _local25:Number;
var _local26:b2XForm;
var _local27:b2XForm;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local7:Number = _arg1.m_sweepRadius;
var _local8:Number = _arg3.m_sweepRadius;
var _local9:Number = _arg2.t0;
var _local10:Number = (_arg2.c.x - _arg2.c0.x);
var _local11:Number = (_arg2.c.y - _arg2.c0.y);
var _local12:Number = (_arg4.c.x - _arg4.c0.x);
var _local13:Number = (_arg4.c.y - _arg4.c0.y);
var _local14:Number = (_arg2.a - _arg2.a0);
var _local15:Number = (_arg4.a - _arg4.a0);
var _local16:Number = 0;
var _local17:b2Vec2 = s_p1;
var _local18:b2Vec2 = s_p2;
var _local19 = 20;
var _local20:int;
var _local21:Number = 0;
var _local22:Number = 0;
var _local23:Number = 0;
var _local24:Number = 0;
while (true) {
_local25 = (((1 - _local16) * _local9) + _local16);
_local26 = s_xf1;
_local27 = s_xf2;
_arg2.GetXForm(_local26, _local25);
_arg4.GetXForm(_local27, _local25);
_local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27);
if (_local20 == 0){
if (_local23 > (2 * b2Settings.b2_toiSlop)){
_local24 = (1.5 * b2Settings.b2_toiSlop);
} else {
_local5 = (0.05 * b2Settings.b2_toiSlop);
_local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop));
_local24 = ((_local5 > _local6)) ? _local5 : _local6;
};
};
if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){
break;
};
_local21 = (_local18.x - _local17.x);
_local22 = (_local18.y - _local17.y);
_local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22)));
_local21 = (_local21 / _local28);
_local22 = (_local22 / _local28);
_local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8));
if (_local29 == 0){
_local16 = 1;
break;
};
_local30 = ((_local23 - _local24) / _local29);
_local31 = (_local16 + _local30);
if ((((_local31 < 0)) || ((1 < _local31)))){
_local16 = 1;
break;
};
if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){
break;
};
_local16 = _local31;
_local20++;
};
return (_local16);
}
}
}//package Box2D.Collision
Section 28
//ClipVertex (Box2D.Collision.ClipVertex)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class ClipVertex {
public var id:b2ContactID;
public var v:b2Vec2;
public function ClipVertex(){
v = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features)
package Box2D.Collision {
public class Features {
public var _referenceEdge:int;
public var _incidentEdge:int;
public var _flip:int;
public var _incidentVertex:int;
public var _m_id:b2ContactID;
public function get referenceEdge():int{
return (_referenceEdge);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
public function get flip():int{
return (_flip);
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set referenceEdge(_arg1:int):void{
_referenceEdge = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
}
}//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22)
package Box2D.Common.Math {
import Box2D.Common.*;
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){
var _local4:Number;
var _local5:Number;
col1 = new b2Vec2();
col2 = new b2Vec2();
super();
if (((!((_arg2 == null))) && (!((_arg3 == null))))){
col1.SetV(_arg2);
col2.SetV(_arg3);
} else {
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
col1.x = _local4;
col2.x = -(_local5);
col1.y = _local5;
col2.y = _local4;
};
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function Set(_arg1:Number):void{
var _local2:Number;
_local2 = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function SetM(_arg1:b2Mat22):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local4:Number;
var _local6:Number;
_local2 = col1.x;
var _local3:Number = col2.x;
_local4 = col1.y;
var _local5:Number = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
_local6 = (1 / _local6);
_arg1.col1.x = (_local6 * _local5);
_arg1.col2.x = (-(_local6) * _local3);
_arg1.col1.y = (-(_local6) * _local4);
_arg1.col2.y = (_local6 * _local2);
return (_arg1);
}
public function GetAngle():Number{
return (Math.atan2(col1.y, col1.x));
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number = col1.x;
var _local5:Number = col2.x;
var _local6:Number = col1.y;
var _local7:Number = col2.y;
var _local8:Number = ((_local4 * _local7) - (_local5 * _local6));
_local8 = (1 / _local8);
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
}
}//package Box2D.Common.Math
Section 31
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1));
public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity);
public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0);
public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = b2MulMV(_arg1.R, _arg2);
_local3.x = (_local3.x + _arg1.position.x);
_local3.y = (_local3.y + _arg1.position.y);
return (_local3);
}
public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number = (_arg1.x - _arg2.x);
var _local4:Number = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:* = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
_local3 = SubtractVV(_arg2, _arg1.position);
_local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y));
_local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y));
_local3.x = _local4;
return (_local3);
}
public static function b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number = (_arg1.x - _arg2.x);
var _local4:Number = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
var _local4:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
var _local5:b2Mat22 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2NextPowerOfTwo(_arg1:uint):uint{
_arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647));
_arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823));
_arg1 = (_arg1 | ((_arg1 >> 4) & 268435455));
_arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF));
_arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF));
return ((_arg1 + 1));
}
public static function b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
}
}//package Box2D.Common.Math
Section 32
//b2Sweep (Box2D.Common.Math.b2Sweep)
package Box2D.Common.Math {
import Box2D.Common.*;
public class b2Sweep {
public var localCenter:b2Vec2;
public var a:Number;
public var c:b2Vec2;
public var a0:Number;
public var c0:b2Vec2;
public var t0:Number;
public function b2Sweep(){
localCenter = new b2Vec2();
c0 = new b2Vec2();
c = new b2Vec2();
super();
}
public function Advance(_arg1:Number):void{
var _local2:Number;
if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){
_local2 = ((_arg1 - t0) / (1 - t0));
c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x));
c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y));
a0 = (((1 - _local2) * a0) + (_local2 * a));
t0 = _arg1;
};
}
public function GetXForm(_arg1:b2XForm, _arg2:Number):void{
var _local4:Number;
var _local5:Number;
if ((1 - t0) > Number.MIN_VALUE){
_local4 = ((_arg2 - t0) / (1 - t0));
_arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x));
_arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y));
_local5 = (((1 - _local4) * a0) + (_local4 * a));
_arg1.R.Set(_local5);
} else {
_arg1.position.SetV(c);
_arg1.R.Set(a);
};
var _local3:b2Mat22 = _arg1.R;
_arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y)));
_arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y)));
}
}
}//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2)
package Box2D.Common.Math {
import Box2D.Common.*;
public class b2Vec2 {
public var y:Number;
public var x:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function LengthSquared():Number{
return (((x * x) + (y * y)));
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function SetZero():void{
x = 0;
y = 0;
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function Normalize():Number{
var _local1:Number = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
var _local2:Number = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function CrossVF(_arg1:Number):void{
var _local2:Number = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function CrossFV(_arg1:Number):void{
var _local2:Number = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm)
package Box2D.Common.Math {
import Box2D.Common.*;
public class b2XForm {
public var position:b2Vec2;
public var R:b2Mat22;
public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{
position = new b2Vec2();
R = new b2Mat22();
super();
if (_arg1){
position.SetV(_arg1);
R.SetM(_arg2);
};
}
public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{
position.SetV(_arg1);
R.SetM(_arg2);
}
public function Set(_arg1:b2XForm):void{
position.SetV(_arg1.position);
R.SetM(_arg1.R);
}
public function SetIdentity():void{
position.SetZero();
R.SetIdentity();
}
}
}//package Box2D.Common.Math
Section 35
//b2Color (Box2D.Common.b2Color)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Color {
private var _r:uint;// = 0
private var _g:uint;// = 0
private var _b:uint;// = 0
public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function set b(_arg1:Number):void{
_b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function get color():uint{
return (((_r | (_g << 8)) | (_b << 16)));
}
public function set r(_arg1:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set g(_arg1:Number):void{
_g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
}
}//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static const b2_linearSleepTolerance:Number = 0.01;
public static const b2_angularSlop:Number = ((2 / 180) * b2_pi);
public static const b2_linearSlop:Number = 0.005;
public static const b2_pi:Number = Math.PI;
public static const b2_maxProxies:int = 0x0400;
public static const b2_maxAngularVelocitySquared:Number = 62500;
public static const b2_maxPolygonVertices:int = 16;
public static const b2_velocityThreshold:Number = 1;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_maxPairs:int = 8192;
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 = ((8 / 180) * b2_pi);
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.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2CircleContact extends b2Contact {
private var m_manifolds:Array;
public var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
var _local3:b2ManifoldPoint = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local8:b2ManifoldPoint;
var _local5:b2Body = m_shape1.m_body;
var _local6:b2Body = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf);
var _local7:b2ContactPoint = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
m_manifoldCount = 1;
_local8 = m_manifold.points[0];
if (m0.pointCount == 0){
_local8.normalImpulse = 0;
_local8.tangentImpulse = 0;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Add(_local7);
};
} else {
_local4 = m0.points[0];
_local8.normalImpulse = _local4.normalImpulse;
_local8.tangentImpulse = _local4.tangentImpulse;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Persist(_local7);
};
};
} else {
m_manifoldCount = 0;
if ((((m0.pointCount > 0)) && (_arg1))){
_local4 = m0.points[0];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2CircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2Contact {
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_prev:b2Contact;
public var m_toi:Number;
public var m_next:b2Contact;
public var m_friction:Number;
public var m_manifoldCount:int;
public var m_node1:b2ContactEdge;
public var m_node2:b2ContactEdge;
public var m_restitution:Number;
public var m_flags:uint;
public static var e_toiFlag:uint = 8;
public static var e_nonSolidFlag:uint = 1;
public static var e_slowFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var s_registers:Array;
public static var s_initialized:Boolean = false;
public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){
m_node1 = new b2ContactEdge();
m_node2 = new b2ContactEdge();
super();
m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
m_shape1 = null;
m_shape2 = null;
return;
};
if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){
m_flags = (m_flags | e_nonSolidFlag);
};
m_shape1 = _arg1;
m_shape2 = _arg2;
m_manifoldCount = 0;
m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction));
m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution);
m_prev = null;
m_next = null;
m_node1.contact = null;
m_node1.prev = null;
m_node1.next = null;
m_node1.other = null;
m_node2.contact = null;
m_node2.prev = null;
m_node2.next = null;
m_node2.other = null;
}
public function IsSolid():Boolean{
return (((m_flags & e_nonSolidFlag) == 0));
}
public function GetShape1():b2Shape{
return (m_shape1);
}
public function GetShape2():b2Shape{
return (m_shape2);
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetManifoldCount():int{
return (m_manifoldCount);
}
public function GetManifolds():Array{
return (null);
}
public function Update(_arg1:b2ContactListener):void{
var _local2:int = m_manifoldCount;
Evaluate(_arg1);
var _local3:int = m_manifoldCount;
var _local4:b2Body = m_shape1.m_body;
var _local5:b2Body = m_shape2.m_body;
if ((((_local3 == 0)) && ((_local2 > 0)))){
_local4.WakeUp();
_local5.WakeUp();
};
if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){
m_flags = (m_flags & ~(e_slowFlag));
} else {
m_flags = (m_flags | e_slowFlag);
};
}
public function Evaluate(_arg1:b2ContactListener):void{
}
public static function InitializeRegisters():void{
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
var _local1:int;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_registers[_local1][_local2] = new b2ContactRegister();
_local2++;
};
_local1++;
};
AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape);
AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape);
AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
if (_arg1.m_manifoldCount > 0){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
var _local3:int = _arg1.m_shape1.m_type;
var _local4:int = _arg1.m_shape2.m_type;
var _local5:b2ContactRegister = s_registers[_local3][_local4];
var _local6:Function = _local5.destroyFcn;
_local6(_arg1, _arg2);
}
public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{
s_registers[_arg3][_arg4].createFcn = _arg1;
s_registers[_arg3][_arg4].destroyFcn = _arg2;
s_registers[_arg3][_arg4].primary = true;
if (_arg3 != _arg4){
s_registers[_arg4][_arg3].createFcn = _arg1;
s_registers[_arg4][_arg3].destroyFcn = _arg2;
s_registers[_arg4][_arg3].primary = false;
};
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local8:b2Contact;
var _local9:int;
var _local10:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
var _local4:int = _arg1.m_type;
var _local5:int = _arg2.m_type;
var _local6:b2ContactRegister = s_registers[_local4][_local5];
var _local7:Function = _local6.createFcn;
if (_local7 != null){
if (_local6.primary){
return (_local7(_arg1, _arg2, _arg3));
};
_local8 = _local7(_arg2, _arg1, _arg3);
_local9 = 0;
while (_local9 < _local8.m_manifoldCount) {
_local10 = _local8.GetManifolds()[_local9];
_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.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var normal:b2Vec2;
public var restitution:Number;
public var body1:b2Body;
public var manifold:b2Manifold;
public var body2:b2Body;
public var friction:Number;
public var pointCount:int;
public function b2ContactConstraint(){
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var r2:b2Vec2;
public var separation:Number;
public var positionImpulse:Number;
public var normalImpulse:Number;
public var tangentMass:Number;
public var equalizedMass:Number;
public var tangentImpulse:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var normalMass:Number;
public var velocityBias:Number;
public var r1:b2Vec2;
public function b2ContactConstraintPoint(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
r1 = new b2Vec2();
r2 = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2ContactEdge {
public var other:b2Body;
public var prev:b2ContactEdge;
public var contact:b2Contact;
public var next:b2ContactEdge;
}
}//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var primary:Boolean;
public var createFcn:Function;
public var destroyFcn:Function;
}
}//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
public class b2ContactResult {
public var position:b2Vec2;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var normalImpulse:Number;
public var normal:b2Vec2;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ContactResult(){
position = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactSolver {
public var m_constraintCount:int;
public var m_constraints:Array;
public var m_allocator;
public var m_step:b2TimeStep;
public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){
var _local5:b2Contact;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _local10:b2Body;
var _local11:b2Body;
var _local12:int;
var _local13:Array;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:int;
var _local23:b2Manifold;
var _local24:Number;
var _local25:Number;
var _local26:b2ContactConstraint;
var _local27:uint;
var _local28:b2ManifoldPoint;
var _local29:b2ContactConstraintPoint;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:Number;
var _local44:Number;
var _local45:Number;
var _local46:Number;
var _local47:Number;
m_step = new b2TimeStep();
m_constraints = new Array();
super();
m_step.dt = _arg1.dt;
m_step.inv_dt = _arg1.inv_dt;
m_step.maxIterations = _arg1.maxIterations;
m_allocator = _arg4;
m_constraintCount = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
m_constraintCount = (m_constraintCount + _local5.m_manifoldCount);
_local6++;
};
_local6 = 0;
while (_local6 < m_constraintCount) {
m_constraints[_local6] = new b2ContactConstraint();
_local6++;
};
var _local9:int;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
_local10 = _local5.m_shape1.m_body;
_local11 = _local5.m_shape2.m_body;
_local12 = _local5.m_manifoldCount;
_local13 = _local5.GetManifolds();
_local14 = _local5.m_friction;
_local15 = _local5.m_restitution;
_local16 = _local10.m_linearVelocity.x;
_local17 = _local10.m_linearVelocity.y;
_local18 = _local11.m_linearVelocity.x;
_local19 = _local11.m_linearVelocity.y;
_local20 = _local10.m_angularVelocity;
_local21 = _local11.m_angularVelocity;
_local22 = 0;
while (_local22 < _local12) {
_local23 = _local13[_local22];
_local24 = _local23.normal.x;
_local25 = _local23.normal.y;
_local26 = m_constraints[_local9];
_local26.body1 = _local10;
_local26.body2 = _local11;
_local26.manifold = _local23;
_local26.normal.x = _local24;
_local26.normal.y = _local25;
_local26.pointCount = _local23.pointCount;
_local26.friction = _local14;
_local26.restitution = _local15;
_local27 = 0;
while (_local27 < _local26.pointCount) {
_local28 = _local23.points[_local27];
_local29 = _local26.points[_local27];
_local29.normalImpulse = _local28.normalImpulse;
_local29.tangentImpulse = _local28.tangentImpulse;
_local29.separation = _local28.separation;
_local29.positionImpulse = 0;
_local29.localAnchor1.SetV(_local28.localPoint1);
_local29.localAnchor2.SetV(_local28.localPoint2);
_local8 = _local10.m_xf.R;
_local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x);
_local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33));
_local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33));
_local32 = _local30;
_local29.r1.Set(_local32, _local33);
_local8 = _local11.m_xf.R;
_local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x);
_local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35));
_local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35));
_local34 = _local30;
_local29.r2.Set(_local34, _local35);
_local36 = ((_local32 * _local32) + (_local33 * _local33));
_local37 = ((_local34 * _local34) + (_local35 * _local35));
_local38 = ((_local32 * _local24) + (_local33 * _local25));
_local39 = ((_local34 * _local24) + (_local35 * _local25));
_local40 = (_local10.m_invMass + _local11.m_invMass);
_local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39)))));
_local29.normalMass = (1 / _local40);
_local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass));
_local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39)))));
_local29.equalizedMass = (1 / _local41);
_local42 = _local25;
_local43 = -(_local24);
_local44 = ((_local32 * _local42) + (_local33 * _local43));
_local45 = ((_local34 * _local42) + (_local35 * _local43));
_local46 = (_local10.m_invMass + _local11.m_invMass);
_local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45)))));
_local29.tangentMass = (1 / _local46);
_local29.velocityBias = 0;
if (_local29.separation > 0){
_local29.velocityBias = (-60 * _local29.separation);
};
_local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33));
_local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32));
_local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31));
if (_local47 < -(b2Settings.b2_velocityThreshold)){
_local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47));
};
_local27++;
};
_local9++;
_local22++;
};
_local6++;
};
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:b2ContactConstraintPoint;
var _local21:Number;
var _local22:Number;
var _local23:b2ContactConstraintPoint;
var _local5:int;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_invMass;
_local10 = _local7.m_invI;
_local11 = _local8.m_invMass;
_local12 = _local8.m_invI;
_local13 = _local6.normal.x;
_local14 = _local6.normal.y;
_local15 = _local14;
_local16 = -(_local13);
if (_arg1.warmStarting){
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local20 = _local6.points[_local18];
_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 _local3:b2Mat22;
var _local4:b2Vec2;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:b2Vec2;
var _local10:Number;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:int;
var _local20:int;
var _local21:b2ContactConstraintPoint;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local2:Number = 0;
var _local5:int;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_sweep.c;
_local10 = _local7.m_sweep.a;
_local11 = _local8.m_sweep.c;
_local12 = _local8.m_sweep.a;
_local13 = (_local7.m_mass * _local7.m_invMass);
_local14 = (_local7.m_mass * _local7.m_invI);
_local15 = (_local8.m_mass * _local8.m_invMass);
_local16 = (_local8.m_mass * _local8.m_invI);
_local17 = _local6.normal.x;
_local18 = _local6.normal.y;
_local19 = _local6.pointCount;
_local20 = 0;
while (_local20 < _local19) {
_local21 = _local6.points[_local20];
_local3 = _local7.m_xf.R;
_local4 = _local7.m_sweep.localCenter;
_local22 = (_local21.localAnchor1.x - _local4.x);
_local23 = (_local21.localAnchor1.y - _local4.y);
_local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23));
_local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23));
_local22 = _local26;
_local3 = _local8.m_xf.R;
_local4 = _local8.m_sweep.localCenter;
_local24 = (_local21.localAnchor2.x - _local4.x);
_local25 = (_local21.localAnchor2.y - _local4.y);
_local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25));
_local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25));
_local24 = _local26;
_local27 = (_local9.x + _local22);
_local28 = (_local9.y + _local23);
_local29 = (_local11.x + _local24);
_local30 = (_local11.y + _local25);
_local31 = (_local29 - _local27);
_local32 = (_local30 - _local28);
_local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation);
_local2 = b2Math.b2Min(_local2, _local33);
_local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0));
_local35 = (-(_local21.equalizedMass) * _local34);
_local36 = _local21.positionImpulse;
_local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0);
_local35 = (_local21.positionImpulse - _local36);
_local37 = (_local35 * _local17);
_local38 = (_local35 * _local18);
_local9.x = (_local9.x - (_local13 * _local37));
_local9.y = (_local9.y - (_local13 * _local38));
_local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37))));
_local7.m_sweep.a = _local10;
_local7.SynchronizeTransform();
_local11.x = (_local11.x + (_local15 * _local37));
_local11.y = (_local11.y + (_local15 * _local38));
_local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37))));
_local8.m_sweep.a = _local12;
_local8.SynchronizeTransform();
_local20++;
};
_local5++;
};
return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop)));
}
public function SolveVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraintPoint;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:b2Mat22;
var _local18:b2Vec2;
var _local20:b2ContactConstraint;
var _local21:b2Body;
var _local22:b2Body;
var _local23:Number;
var _local24:Number;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:int;
var _local38:Number;
var _local19:int;
while (_local19 < m_constraintCount) {
_local20 = m_constraints[_local19];
_local21 = _local20.body1;
_local22 = _local20.body2;
_local23 = _local21.m_angularVelocity;
_local24 = _local22.m_angularVelocity;
_local25 = _local21.m_linearVelocity;
_local26 = _local22.m_linearVelocity;
_local27 = _local21.m_invMass;
_local28 = _local21.m_invI;
_local29 = _local22.m_invMass;
_local30 = _local22.m_invI;
_local31 = _local20.normal.x;
_local32 = _local20.normal.y;
_local33 = _local32;
_local34 = -(_local31);
_local35 = _local20.friction;
_local37 = _local20.pointCount;
_local1 = 0;
while (_local1 < _local37) {
_local2 = _local20.points[_local1];
_local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y));
_local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x));
_local9 = ((_local7 * _local31) + (_local8 * _local32));
_local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias));
_local10 = ((_local7 * _local33) + (_local8 * _local34));
_local12 = (_local2.tangentMass * -(_local10));
_local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0);
_local11 = (_local13 - _local2.normalImpulse);
_local38 = (_local35 * _local2.normalImpulse);
_local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38);
_local12 = (_local14 - _local2.tangentImpulse);
_local15 = ((_local11 * _local31) + (_local12 * _local33));
_local16 = ((_local11 * _local32) + (_local12 * _local34));
_local25.x = (_local25.x - (_local27 * _local15));
_local25.y = (_local25.y - (_local27 * _local16));
_local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15))));
_local26.x = (_local26.x + (_local29 * _local15));
_local26.y = (_local26.y + (_local29 * _local16));
_local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15))));
_local2.normalImpulse = _local13;
_local2.tangentImpulse = _local14;
_local1++;
};
_local21.m_angularVelocity = _local23;
_local22.m_angularVelocity = _local24;
_local19++;
};
}
public function FinalizeVelocityConstraints():void{
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
var _local1:int;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2NullContact extends b2Contact {
override public function Evaluate(_arg1:b2ContactListener):void{
}
override public function GetManifolds():Array{
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolyAndCircleContact extends b2Contact {
private var m_manifolds:Array;
public var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape));
b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape));
m_manifold.pointCount = 0;
var _local3:b2ManifoldPoint = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2ManifoldPoint;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local6:b2Body = m_shape1.m_body;
var _local7:b2Body = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf);
var _local8:Array = [false, false];
var _local9:b2ContactPoint = s_evalCP;
_local9.shape1 = m_shape1;
_local9.shape2 = m_shape2;
_local9.friction = m_friction;
_local9.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local2 = 0;
while (_local2 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local2];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local8[_local13] == true){
} else {
_local5 = m0.points[_local13];
if (_local5.id._key == _local12){
_local8[_local13] = true;
_local10.normalImpulse = _local5.normalImpulse;
_local10.tangentImpulse = _local5.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Persist(_local9);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Add(_local9);
};
_local2++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local2 = 0;
while (_local2 < m0.pointCount) {
if (_local8[_local2]){
} else {
_local5 = m0.points[_local2];
_local9.position = _local6.GetWorldPoint(_local5.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m0.normal);
_local9.separation = _local5.separation;
_local9.id.key = _local5.id._key;
_arg1.Remove(_local9);
};
_local2++;
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndCircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolygonContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{
m0 = new b2Manifold();
m_manifolds = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local7:b2ContactPoint;
var _local8:int;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local5:b2Body = m_shape1.m_body;
var _local6:b2Body = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf);
var _local9:Array = [false, false];
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local8 = 0;
while (_local8 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local8];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local9[_local13] == true){
} else {
_local4 = m0.points[_local13];
if (_local4.id._key == _local12){
_local9[_local13] = true;
_local10.normalImpulse = _local4.normalImpulse;
_local10.tangentImpulse = _local4.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Persist(_local7);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Add(_local7);
};
_local8++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local8 = 0;
while (_local8 < m0.pointCount) {
if (_local9[_local8]){
} else {
_local4 = m0.points[_local8];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
_local8++;
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolygonContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2DistanceJoint extends b2Joint {
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_bias:Number;
public var m_gamma:Number;
public var m_u:b2Vec2;
public var m_mass:Number;
public var m_impulse:Number;
public var m_dampingRatio:Number;
public var m_frequencyHz:Number;
public var m_length:Number;
public function b2DistanceJoint(_arg1:b2DistanceJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u = new b2Vec2();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_length = _arg1.length;
m_frequencyHz = _arg1.frequencyHz;
m_dampingRatio = _arg1.dampingRatio;
m_impulse = 0;
m_gamma = 0;
m_bias = 0;
m_inv_dt = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local8:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
m_inv_dt = _arg1.inv_dt;
_local4 = m_body1;
_local5 = m_body2;
_local2 = _local4.m_xf.R;
_local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7));
_local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7));
_local6 = _local3;
_local2 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6);
m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7);
var _local10:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y)));
if (_local10 > b2Settings.b2_linearSlop){
m_u.Multiply((1 / _local10));
} else {
m_u.SetZero();
};
var _local11:Number = ((_local6 * m_u.y) - (_local7 * m_u.x));
var _local12:Number = ((_local8 * m_u.y) - (_local9 * m_u.x));
var _local13:Number = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12));
m_mass = (1 / _local13);
if (m_frequencyHz > 0){
_local14 = (_local10 - m_length);
_local15 = ((2 * Math.PI) * m_frequencyHz);
_local16 = (((2 * m_mass) * m_dampingRatio) * _local15);
_local17 = ((m_mass * _local15) * _local15);
m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17))));
m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma);
m_mass = (1 / (_local13 + m_gamma));
};
if (_arg1.warmStarting){
m_impulse = (m_impulse * _arg1.dtRatio);
_local18 = (m_impulse * m_u.x);
_local19 = (m_impulse * m_u.y);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19));
_local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18))));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19));
_local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18))));
} else {
m_impulse = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = new b2Vec2();
_local1.SetV(m_u);
_local1.Multiply((m_inv_dt * m_impulse));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
if (m_frequencyHz > 0){
return (true);
};
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local1 = _local2.m_xf.R;
var _local4:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local5:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local6:Number = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5));
_local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5));
_local4 = _local6;
_local1 = _local3.m_xf.R;
var _local7:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8));
_local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8));
_local7 = _local6;
var _local9:Number = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4);
var _local10:Number = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5);
var _local11:Number = Math.sqrt(((_local9 * _local9) + (_local10 * _local10)));
_local9 = (_local9 / _local11);
_local10 = (_local10 / _local11);
var _local12:Number = (_local11 - m_length);
_local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local13:Number = (-(m_mass) * _local12);
m_u.Set(_local9, _local10);
var _local14:Number = (_local13 * m_u.x);
var _local15:Number = (_local13 * m_u.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14))));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15));
_local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14))));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
_local2 = _local3.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
var _local7:Number = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6));
_local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6));
_local5 = _local7;
_local2 = _local4.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6));
var _local11:Number = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5));
var _local12:Number = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9));
var _local13:Number = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8));
var _local14:Number = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11)));
var _local15:Number = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse)));
m_impulse = (m_impulse + _local15);
var _local16:Number = (_local15 * m_u.x);
var _local17:Number = (_local15 * m_u.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16))));
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17));
_local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
}
}
}//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2DistanceJointDef extends b2JointDef {
public var localAnchor1:b2Vec2;
public var length:Number;
public var dampingRatio:Number;
public var localAnchor2:b2Vec2;
public var frequencyHz:Number;
public function b2DistanceJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_distanceJoint;
length = 1;
frequencyHz = 0;
dampingRatio = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1.SetV(body1.GetLocalPoint(_arg3));
localAnchor2.SetV(body2.GetLocalPoint(_arg4));
var _local5:Number = (_arg4.x - _arg3.x);
var _local6:Number = (_arg4.y - _arg3.y);
length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
frequencyHz = 0;
dampingRatio = 0;
}
}
}//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2GearJoint extends b2Joint {
public var m_ground2:b2Body;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_ratio:Number;
public var m_revolute2:b2RevoluteJoint;
public var m_force:Number;
public var m_mass:Number;
public var m_prismatic2:b2PrismaticJoint;
public var m_ground1:b2Body;
public var m_revolute1:b2RevoluteJoint;
public var m_prismatic1:b2PrismaticJoint;
public var m_constant:Number;
public var m_J:b2Jacobian;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local4:Number;
var _local5:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_J = new b2Jacobian();
super(_arg1);
var _local2:int = _arg1.joint1.m_type;
var _local3:int = _arg1.joint2.m_type;
m_revolute1 = null;
m_prismatic1 = null;
m_revolute2 = null;
m_prismatic2 = null;
m_ground1 = _arg1.joint1.m_body1;
m_body1 = _arg1.joint1.m_body2;
if (_local2 == b2Joint.e_revoluteJoint){
m_revolute1 = (_arg1.joint1 as b2RevoluteJoint);
m_groundAnchor1.SetV(m_revolute1.m_localAnchor1);
m_localAnchor1.SetV(m_revolute1.m_localAnchor2);
_local4 = m_revolute1.GetJointAngle();
} else {
m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint);
m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1);
m_localAnchor1.SetV(m_prismatic1.m_localAnchor2);
_local4 = m_prismatic1.GetJointTranslation();
};
m_ground2 = _arg1.joint2.m_body1;
m_body2 = _arg1.joint2.m_body2;
if (_local3 == b2Joint.e_revoluteJoint){
m_revolute2 = (_arg1.joint2 as b2RevoluteJoint);
m_groundAnchor2.SetV(m_revolute2.m_localAnchor1);
m_localAnchor2.SetV(m_revolute2.m_localAnchor2);
_local5 = m_revolute2.GetJointAngle();
} else {
m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint);
m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1);
m_localAnchor2.SetV(m_prismatic2.m_localAnchor2);
_local5 = m_prismatic2.GetJointTranslation();
};
m_ratio = _arg1.ratio;
m_constant = (_local4 + (m_ratio * _local5));
m_force = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local15:Number;
var _local2:b2Body = m_ground1;
var _local3:b2Body = m_ground2;
var _local4:b2Body = m_body1;
var _local5:b2Body = m_body2;
var _local14:Number = 0;
m_J.SetZero();
if (m_revolute1){
m_J.angular1 = -1;
_local14 = (_local14 + _local4.m_invI);
} else {
_local10 = _local2.m_xf.R;
_local11 = m_prismatic1.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local4.m_xf.R;
_local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear1.Set(-(_local6), -(_local7));
m_J.angular1 = -(_local12);
_local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12)));
};
if (m_revolute2){
m_J.angular2 = -(m_ratio);
_local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI));
} else {
_local10 = _local3.m_xf.R;
_local11 = m_prismatic2.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7));
m_J.angular2 = (-(m_ratio) * _local12);
_local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12))));
};
m_mass = (1 / _local14);
if (_arg1.warmStarting){
_local15 = (_arg1.dt * m_force);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2));
} else {
m_force = 0;
};
}
override public function GetReactionTorque():Number{
var _local1:b2Mat22 = m_body2.m_xf.R;
var _local2:Number = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x);
var _local3:Number = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y);
var _local4:Number = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3));
_local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3));
_local2 = _local4;
_local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x))));
return (_local4);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local4:Number;
var _local5:Number;
var _local1:Number = 0;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
if (m_revolute1){
_local4 = m_revolute1.GetJointAngle();
} else {
_local4 = m_prismatic1.GetJointTranslation();
};
if (m_revolute2){
_local5 = m_revolute2.GetJointAngle();
} else {
_local5 = m_prismatic2.GetJointTranslation();
};
var _local6:Number = (m_constant - (_local4 + (m_ratio * _local5)));
var _local7:Number = (-(m_mass) * _local6);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y));
_local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((_local1 < b2Settings.b2_linearSlop));
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local5:Number = ((-(_arg1.inv_dt) * m_mass) * _local4);
m_force = (m_force + _local5);
var _local6:Number = (_arg1.dt * _local5);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2));
}
}
}//package Box2D.Dynamics.Joints
Section 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2GearJointDef extends b2JointDef {
public var joint1:b2Joint;
public var joint2:b2Joint;
public var ratio:Number;
public function b2GearJointDef(){
type = b2Joint.e_gearJoint;
joint1 = null;
joint2 = null;
ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2Jacobian {
public var linear1:b2Vec2;
public var linear2:b2Vec2;
public var angular1:Number;
public var angular2:Number;
public function b2Jacobian(){
linear1 = new b2Vec2();
linear2 = new b2Vec2();
super();
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linear1.SetV(_arg1);
angular1 = _arg2;
linear2.SetV(_arg3);
angular2 = _arg4;
}
public function SetZero():void{
linear1.SetZero();
angular1 = 0;
linear2.SetZero();
angular2 = 0;
}
public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{
return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4)));
}
}
}//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Joint {
public var m_islandFlag:Boolean;
public var m_body1:b2Body;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_type:int;
public var m_collideConnected:Boolean;
public var m_node1:b2JointEdge;
public var m_node2:b2JointEdge;
public var m_inv_dt:Number;
public var m_userData;
public var m_body2:b2Body;
public static const e_unknownJoint:int = 0;
public static const e_inactiveLimit:int = 0;
public static const e_atUpperLimit:int = 2;
public static const e_atLowerLimit:int = 1;
public static const e_gearJoint:int = 6;
public static const e_revoluteJoint:int = 1;
public static const e_equalLimits:int = 3;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_prismaticJoint:int = 2;
public static const e_mouseJoint:int = 5;
public function b2Joint(_arg1:b2JointDef){
m_node1 = new b2JointEdge();
m_node2 = new b2JointEdge();
super();
m_type = _arg1.type;
m_prev = null;
m_next = null;
m_body1 = _arg1.body1;
m_body2 = _arg1.body2;
m_collideConnected = _arg1.collideConnected;
m_islandFlag = false;
m_userData = _arg1.userData;
}
public function GetBody2():b2Body{
return (m_body2);
}
public function GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetType():int{
return (m_type);
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
}
public function GetReactionTorque():Number{
return (0);
}
public function GetUserData(){
return (m_userData);
}
public function GetReactionForce():b2Vec2{
return (null);
}
public function SolvePositionConstraints():Boolean{
return (false);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetBody1():b2Body{
return (m_body1);
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function InitPositionConstraints():void{
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
switch (_arg1.type){
case e_distanceJoint:
_local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef));
break;
case e_mouseJoint:
_local3 = new b2MouseJoint((_arg1 as b2MouseJointDef));
break;
case e_prismaticJoint:
_local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef));
break;
case e_revoluteJoint:
_local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef));
break;
case e_pulleyJoint:
_local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef));
break;
case e_gearJoint:
_local3 = new b2GearJoint((_arg1 as b2GearJointDef));
break;
default:
break;
};
return (_local3);
}
}
}//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2JointDef {
public var body2:b2Body;
public var type:int;
public var userData;
public var collideConnected:Boolean;
public var body1:b2Body;
public function b2JointDef(){
type = b2Joint.e_unknownJoint;
userData = null;
body1 = null;
body2 = null;
collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointEdge {
public var other:b2Body;
public var next:b2JointEdge;
public var prev:b2JointEdge;
public var joint:b2Joint;
}
}//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2MouseJoint extends b2Joint {
private var K1:b2Mat22;
private var K:b2Mat22;
public var m_beta:Number;
public var m_mass:b2Mat22;
private var K2:b2Mat22;
public var m_target:b2Vec2;
public var m_gamma:Number;
public var m_impulse:b2Vec2;
public var m_C:b2Vec2;
public var m_localAnchor:b2Vec2;
public var m_maxForce:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
var _local3:Number;
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
m_localAnchor = new b2Vec2();
m_target = new b2Vec2();
m_impulse = new b2Vec2();
m_mass = new b2Mat22();
m_C = new b2Vec2();
super(_arg1);
m_target.SetV(_arg1.target);
var _local2:Number = (m_target.x - m_body2.m_xf.position.x);
_local3 = (m_target.y - m_body2.m_xf.position.y);
var _local4:b2Mat22 = m_body2.m_xf.R;
m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y));
m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y));
m_maxForce = _arg1.maxForce;
m_impulse.SetZero();
var _local5:Number = m_body2.m_mass;
var _local6:Number = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
var _local7:Number = (((2 * _local5) * _arg1.dampingRatio) * _local6);
var _local8:Number = ((_arg1.timeStep * _local5) * (_local6 * _local6));
m_gamma = (1 / (_local7 + _local8));
m_beta = (_local8 / (_local7 + _local8));
}
public function SetTarget(_arg1:b2Vec2):void{
if (m_body2.IsSleeping()){
m_body2.WakeUp();
};
m_target = _arg1;
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local7:Number;
var _local8:Number;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local7 = _local2.m_invMass;
_local8 = _local2.m_invI;
K1.col1.x = _local7;
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = _local7;
K2.col1.x = ((_local8 * _local5) * _local5);
K2.col2.x = ((-(_local8) * _local4) * _local5);
K2.col1.y = ((-(_local8) * _local4) * _local5);
K2.col2.y = ((_local8 * _local4) * _local4);
K.SetM(K1);
K.AddM(K2);
K.col1.x = (K.col1.x + m_gamma);
K.col2.y = (K.col2.y + m_gamma);
K.Invert(m_mass);
m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x);
m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y);
_local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98);
var _local9:Number = (_arg1.dt * m_impulse.x);
var _local10:Number = (_arg1.dt * m_impulse.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9))));
}
override public function GetAnchor1():b2Vec2{
return (m_target);
}
override public function GetReactionTorque():Number{
return (0);
}
override public function GetReactionForce():b2Vec2{
return (m_impulse);
}
override public function SolvePositionConstraints():Boolean{
return (true);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local2:b2Body = m_body2;
_local3 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7));
_local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7));
_local6 = _local4;
var _local8:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7));
var _local9:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6));
_local3 = m_mass;
_local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x));
_local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y));
var _local10:Number = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)));
var _local11:Number = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)));
var _local12:Number = m_impulse.x;
var _local13:Number = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
var _local14:Number = m_impulse.Length();
if (_local14 > m_maxForce){
m_impulse.Multiply((m_maxForce / _local14));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
var _local15:Number = (_arg1.dt * _local10);
var _local16:Number = (_arg1.dt * _local11);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
}
}
}//package Box2D.Dynamics.Joints
Section 57
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2MouseJointDef extends b2JointDef {
public var timeStep:Number;
public var target:b2Vec2;
public var maxForce:Number;
public var dampingRatio:Number;
public var frequencyHz:Number;
public function b2MouseJointDef(){
target = new b2Vec2();
super();
type = b2Joint.e_mouseJoint;
maxForce = 0;
frequencyHz = 5;
dampingRatio = 0.7;
timeStep = (1 / 60);
}
}
}//package Box2D.Dynamics.Joints
Section 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PrismaticJoint extends b2Joint {
public var m_limitForce:Number;
public var m_lowerTranslation:Number;
public var m_localXAxis1:b2Vec2;
public var m_refAngle:Number;
public var m_torque:Number;
public var m_motorForce:Number;
public var m_enableLimit:Boolean;
public var m_angularMass:Number;
public var m_maxMotorForce:Number;
public var m_localYAxis1:b2Vec2;
public var m_force:Number;
public var m_motorMass:Number;
public var m_upperTranslation:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_limitState:int;
public var m_linearMass:Number;
public var m_motorJacobian:b2Jacobian;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_enableMotor:Boolean;
public var m_linearJacobian:b2Jacobian;
public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_localXAxis1 = new b2Vec2();
m_localYAxis1 = new b2Vec2();
m_linearJacobian = new b2Jacobian();
m_motorJacobian = new b2Jacobian();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_localXAxis1.SetV(_arg1.localAxis1);
m_localYAxis1.x = -(m_localXAxis1.y);
m_localYAxis1.y = m_localXAxis1.x;
m_refAngle = _arg1.referenceAngle;
m_linearJacobian.SetZero();
m_linearMass = 0;
m_force = 0;
m_angularMass = 0;
m_torque = 0;
m_motorJacobian.SetZero();
m_motorMass = 0;
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerTranslation = _arg1.lowerTranslation;
m_upperTranslation = _arg1.upperTranslation;
m_maxMotorForce = _arg1.maxMotorForce;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local8:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = _local2.m_invMass;
var _local5:Number = _local3.m_invMass;
var _local6:Number = _local2.m_invI;
var _local7:Number = _local3.m_invI;
var _local9:Number = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local10:Number = ((-(_arg1.inv_dt) * m_linearMass) * _local9);
m_force = (m_force + _local10);
var _local11:Number = (_arg1.dt * _local10);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2));
var _local12:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity);
var _local13:Number = ((-(_arg1.inv_dt) * m_angularMass) * _local12);
m_torque = (m_torque + _local13);
var _local14:Number = (_arg1.dt * _local13);
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed);
_local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15);
_local17 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce);
_local16 = (m_motorForce - _local17);
_local11 = (_arg1.dt * _local16);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local19);
} else {
if (m_limitState == e_atLowerLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
} else {
if (m_limitState == e_atUpperLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
};
};
};
_local11 = (_arg1.dt * _local19);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function GetUpperLimit():Number{
return (m_upperTranslation);
}
public function GetLowerLimit():Number{
return (m_lowerTranslation);
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetJointTranslation():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
var _local4:b2Vec2 = _local1.GetWorldPoint(m_localAnchor1);
var _local5:b2Vec2 = _local2.GetWorldPoint(m_localAnchor2);
var _local6:Number = (_local5.x - _local4.x);
var _local7:Number = (_local5.y - _local4.y);
var _local8:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local9:Number = ((_local8.x * _local6) + (_local8.y * _local7));
return (_local9);
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Mat22 = m_body1.m_xf.R;
var _local2:Number = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y)));
var _local3:Number = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y)));
var _local4:Number = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y)));
var _local5:Number = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y)));
return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5))));
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local9:b2Mat22;
var _local10:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = _local3.m_invMass;
var _local6:Number = _local4.m_invMass;
var _local7:Number = _local3.m_invI;
var _local8:Number = _local4.m_invI;
_local9 = _local3.m_xf.R;
var _local11:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local12:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
var _local13:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local14:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
var _local15:Number = (_local3.m_sweep.c.x + _local11);
var _local16:Number = (_local3.m_sweep.c.y + _local12);
var _local17:Number = (_local4.m_sweep.c.x + _local13);
var _local18:Number = (_local4.m_sweep.c.y + _local14);
var _local19:Number = (_local17 - _local15);
var _local20:Number = (_local18 - _local16);
_local9 = _local3.m_xf.R;
var _local21:Number = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
var _local22:Number = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
var _local23:Number = ((_local21 * _local19) + (_local22 * _local20));
_local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local24:Number = (-(m_linearMass) * _local23);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2));
var _local25:Number = b2Math.b2Abs(_local23);
var _local26:Number = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle);
_local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
var _local27:Number = (-(m_angularMass) * _local26);
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
var _local28:Number = b2Math.b2Abs(_local26);
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y));
_local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y));
_local31 = ((_local29 * _local19) + (_local30 * _local20));
_local32 = 0;
if (m_limitState == e_equalLimits){
_local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26));
} else {
if (m_limitState == e_atLowerLimit){
_local1 = (_local31 - m_lowerTranslation);
_local25 = b2Math.b2Max(_local25, -(_local1));
_local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
} else {
if (m_limitState == e_atUpperLimit){
_local1 = (_local31 - m_upperTranslation);
_local25 = b2Math.b2Max(_local25, _local1);
_local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
};
};
};
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop))));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetJointSpeed():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_xf.R;
var _local4:Number = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
var _local5:Number = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local3 = _local2.m_xf.R;
var _local7:Number = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8));
_local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8));
_local7 = _local6;
var _local9:Number = (_local1.m_sweep.c.x + _local4);
var _local10:Number = (_local1.m_sweep.c.y + _local5);
var _local11:Number = (_local2.m_sweep.c.x + _local7);
var _local12:Number = (_local2.m_sweep.c.y + _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = (_local12 - _local10);
var _local15:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local16:b2Vec2 = _local1.m_linearVelocity;
var _local17:b2Vec2 = _local2.m_linearVelocity;
var _local18:Number = _local1.m_angularVelocity;
var _local19:Number = _local2.m_angularVelocity;
var _local20:Number = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4)))));
return (_local20);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local10:Number = _local2.m_invMass;
var _local11:Number = _local3.m_invMass;
var _local12:Number = _local2.m_invI;
var _local13:Number = _local3.m_invI;
_local4 = _local2.m_xf.R;
var _local14:Number = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y));
var _local15:Number = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y));
var _local16:Number = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x);
var _local17:Number = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y);
m_linearJacobian.linear1.x = -(_local14);
m_linearJacobian.linear1.y = -(_local15);
m_linearJacobian.linear2.x = _local14;
m_linearJacobian.linear2.y = _local15;
m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14)));
m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14));
m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2));
m_linearMass = (1 / m_linearMass);
m_angularMass = (_local12 + _local13);
if (m_angularMass > Number.MIN_VALUE){
m_angularMass = (1 / m_angularMass);
};
if (((m_enableLimit) || (m_enableMotor))){
_local4 = _local2.m_xf.R;
_local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y));
_local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y));
m_motorJacobian.linear1.x = -(_local18);
m_motorJacobian.linear1.y = -(_local19);
m_motorJacobian.linear2.x = _local18;
m_motorJacobian.linear2.y = _local19;
m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18)));
m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18));
m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2));
m_motorMass = (1 / m_motorMass);
if (m_enableLimit){
_local20 = (_local16 - _local6);
_local21 = (_local17 - _local7);
_local22 = ((_local18 * _local20) + (_local19 * _local21));
if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local22 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local22 >= m_upperTranslation){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
};
};
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit == false){
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x)));
_local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y)));
_local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x)));
_local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y)));
_local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1)));
_local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2)));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28));
} else {
m_force = 0;
m_torque = 0;
m_limitForce = 0;
m_motorForce = 0;
};
m_limitPositionImpulse = 0;
}
public function GetMotorForce():Number{
return (m_motorForce);
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
public function SetMaxMotorForce(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
override public function GetReactionTorque():Number{
return (m_torque);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerTranslation = _arg1;
m_upperTranslation = _arg2;
}
}
}//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2PrismaticJointDef extends b2JointDef {
public var motorSpeed:Number;
public var localAxis1:b2Vec2;
public var referenceAngle:Number;
public var upperTranslation:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public var maxMotorForce:Number;
public var lowerTranslation:Number;
public function b2PrismaticJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
localAxis1 = new b2Vec2();
super();
type = b2Joint.e_prismaticJoint;
localAxis1.Set(1, 0);
referenceAngle = 0;
enableLimit = false;
lowerTranslation = 0;
upperTranslation = 0;
enableMotor = false;
maxMotorForce = 0;
motorSpeed = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
localAxis1 = body1.GetLocalVector(_arg4);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PulleyJoint extends b2Joint {
public var m_limitState1:int;
public var m_limitState2:int;
public var m_ground:b2Body;
public var m_maxLength2:Number;
public var m_maxLength1:Number;
public var m_limitPositionImpulse1:Number;
public var m_limitPositionImpulse2:Number;
public var m_force:Number;
public var m_constant:Number;
public var m_positionImpulse:Number;
public var m_state:int;
public var m_ratio:Number;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_limitMass1:Number;
public var m_limitMass2:Number;
public var m_pulleyMass:Number;
public var m_u1:b2Vec2;
public var m_limitForce1:Number;
public var m_limitForce2:Number;
public var m_u2:b2Vec2;
public static const b2_minPulleyLength:Number = 2;
public function b2PulleyJoint(_arg1:b2PulleyJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u1 = new b2Vec2();
m_u2 = new b2Vec2();
super(_arg1);
m_ground = m_body1.m_world.m_groundBody;
m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x);
m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y);
m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x);
m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_ratio = _arg1.ratio;
m_constant = (_arg1.length1 + (m_ratio * _arg1.length2));
m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength)));
m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio));
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
}
public function GetGroundAnchor2():b2Vec2{
var _local1:b2Vec2 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor2);
return (_local1);
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = m_u2.Copy();
_local1.Multiply(m_force);
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local3:b2Mat22;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
var _local4:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local5:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local6:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local7:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
var _local23:Number = 0;
if (m_state == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local16 = m_u1.Length();
_local17 = m_u2.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local16));
} else {
m_u1.SetZero();
};
if (_local17 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = ((m_constant - _local16) - (m_ratio * _local17));
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_pulleyMass) * _local18);
_local20 = m_positionImpulse;
m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19));
_local19 = (m_positionImpulse - _local20);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local14 = ((-(m_ratio) * _local19) * m_u2.x);
_local15 = ((-(m_ratio) * _local19) * m_u2.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local1.SynchronizeTransform();
_local2.SynchronizeTransform();
};
if (m_limitState1 == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
_local16 = m_u1.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.x = (m_u1.x * (1 / _local16));
m_u1.y = (m_u1.y * (1 / _local16));
} else {
m_u1.SetZero();
};
_local18 = (m_maxLength1 - _local16);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass1) * _local18);
_local21 = m_limitPositionImpulse1;
m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19));
_local19 = (m_limitPositionImpulse1 - _local21);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local1.SynchronizeTransform();
};
if (m_limitState2 == e_atUpperLimit){
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local17 = m_u2.Length();
if (_local17 > b2Settings.b2_linearSlop){
m_u2.x = (m_u2.x * (1 / _local17));
m_u2.y = (m_u2.y * (1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = (m_maxLength2 - _local17);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass2) * _local18);
_local21 = m_limitPositionImpulse2;
m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19));
_local19 = (m_limitPositionImpulse2 - _local21);
_local14 = (-(_local19) * m_u2.x);
_local15 = (-(_local19) * m_u2.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local2.SynchronizeTransform();
};
return ((_local23 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (_local2.m_sweep.c.x + _local5);
var _local11:Number = (_local2.m_sweep.c.y + _local6);
var _local12:Number = (_local3.m_sweep.c.x + _local8);
var _local13:Number = (_local3.m_sweep.c.y + _local9);
var _local14:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local15:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local16:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local17:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
m_u1.Set((_local10 - _local14), (_local11 - _local15));
m_u2.Set((_local12 - _local16), (_local13 - _local17));
var _local18:Number = m_u1.Length();
var _local19:Number = m_u2.Length();
if (_local18 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local18));
} else {
m_u1.SetZero();
};
if (_local19 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local19));
} else {
m_u2.SetZero();
};
var _local20:Number = ((m_constant - _local18) - (m_ratio * _local19));
if (_local20 > 0){
m_state = e_inactiveLimit;
m_force = 0;
} else {
m_state = e_atUpperLimit;
m_positionImpulse = 0;
};
if (_local18 < m_maxLength1){
m_limitState1 = e_inactiveLimit;
m_limitForce1 = 0;
} else {
m_limitState1 = e_atUpperLimit;
m_limitPositionImpulse1 = 0;
};
if (_local19 < m_maxLength2){
m_limitState2 = e_inactiveLimit;
m_limitForce2 = 0;
} else {
m_limitState2 = e_atUpperLimit;
m_limitPositionImpulse2 = 0;
};
var _local21:Number = ((_local5 * m_u1.y) - (_local6 * m_u1.x));
var _local22:Number = ((_local8 * m_u2.y) - (_local9 * m_u2.x));
m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21));
m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22));
m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2));
m_limitMass1 = (1 / m_limitMass1);
m_limitMass2 = (1 / m_limitMass2);
m_pulleyMass = (1 / m_pulleyMass);
if (_arg1.warmStarting){
_local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x);
_local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y);
_local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x);
_local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25))));
} else {
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
if (m_state == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13))));
_local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18);
_local20 = m_force;
m_force = b2Math.b2Max(0, (m_force + _local19));
_local19 = (m_force - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x);
_local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
if (m_limitState1 == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18);
_local20 = m_limitForce1;
m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19));
_local19 = (m_limitForce1 - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
};
if (m_limitState2 == e_atUpperLimit){
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18);
_local20 = m_limitForce2;
m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19));
_local19 = (m_limitForce2 - _local20);
_local16 = ((-(_arg1.dt) * _local19) * m_u2.x);
_local17 = ((-(_arg1.dt) * _local19) * m_u2.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
}
public function GetLength1():Number{
var _local1:b2Vec2 = m_body1.GetWorldPoint(m_localAnchor1);
var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local4:Number = (_local1.x - _local2);
var _local5:Number = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetLength2():Number{
var _local1:b2Vec2 = m_body2.GetWorldPoint(m_localAnchor2);
var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
var _local4:Number = (_local1.x - _local2);
var _local5:Number = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetGroundAnchor1():b2Vec2{
var _local1:b2Vec2 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor1);
return (_local1);
}
}
}//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2PulleyJointDef extends b2JointDef {
public var maxLength1:Number;
public var maxLength2:Number;
public var length1:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var groundAnchor1:b2Vec2;
public var groundAnchor2:b2Vec2;
public var ratio:Number;
public var length2:Number;
public function b2PulleyJointDef(){
groundAnchor1 = new b2Vec2();
groundAnchor2 = new b2Vec2();
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_pulleyJoint;
groundAnchor1.Set(-1, 1);
groundAnchor2.Set(1, 1);
localAnchor1.Set(-1, 0);
localAnchor2.Set(1, 0);
length1 = 0;
maxLength1 = 0;
length2 = 0;
maxLength2 = 0;
ratio = 1;
collideConnected = true;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{
body1 = _arg1;
body2 = _arg2;
groundAnchor1.SetV(_arg3);
groundAnchor2.SetV(_arg4);
localAnchor1 = body1.GetLocalPoint(_arg5);
localAnchor2 = body2.GetLocalPoint(_arg6);
var _local8:Number = (_arg5.x - _arg3.x);
var _local9:Number = (_arg5.y - _arg3.y);
length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
var _local10:Number = (_arg6.x - _arg4.x);
var _local11:Number = (_arg6.y - _arg4.y);
length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
ratio = _arg7;
var _local12:Number = (length1 + (ratio * length2));
maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength));
maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio);
}
}
}//package Box2D.Dynamics.Joints
Section 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2RevoluteJoint extends b2Joint {
public var m_limitForce:Number;
public var m_pivotMass:b2Mat22;
public var m_motorForce:Number;
public var m_enableLimit:Boolean;
public var m_limitState:int;
public var m_motorMass:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K3:b2Mat22;
private var K:b2Mat22;
public var m_pivotForce:b2Vec2;
public var m_enableMotor:Boolean;
public var m_referenceAngle:Number;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_upperAngle:Number;
public var m_lowerAngle:Number;
public var m_maxMotorTorque:Number;
public static var tImpulse:b2Vec2 = new b2Vec2();
public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
K3 = new b2Mat22();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_pivotForce = new b2Vec2();
m_pivotMass = new b2Mat22();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_referenceAngle = _arg1.referenceAngle;
m_pivotForce.Set(0, 0);
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerAngle = _arg1.lowerAngle;
m_upperAngle = _arg1.upperAngle;
m_maxMotorTorque = _arg1.maxMotorTorque;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local10:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local11:Number = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7));
var _local12:Number = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6));
var _local13:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12)));
var _local14:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12)));
m_pivotForce.x = (m_pivotForce.x + _local13);
m_pivotForce.y = (m_pivotForce.y + _local14);
var _local15:Number = (_arg1.dt * _local13);
_local16 = (_arg1.dt * _local14);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15))));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed);
_local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17);
_local19 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque);
_local18 = (m_motorForce - _local19);
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local21);
} else {
if (m_limitState == e_atLowerLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
} else {
if (m_limitState == e_atUpperLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
};
};
};
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21));
};
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function GetUpperLimit():Number{
return (m_upperAngle);
}
public function GetLowerLimit():Number{
return (m_lowerAngle);
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
return (m_pivotForce);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local6:b2Mat22;
var _local25:Number;
var _local26:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = 0;
_local6 = _local3.m_xf.R;
var _local7:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
var _local9:Number = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8));
_local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8));
_local7 = _local9;
_local6 = _local4.m_xf.R;
var _local10:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local11:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11));
_local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11));
_local10 = _local9;
var _local12:Number = (_local3.m_sweep.c.x + _local7);
var _local13:Number = (_local3.m_sweep.c.y + _local8);
var _local14:Number = (_local4.m_sweep.c.x + _local10);
var _local15:Number = (_local4.m_sweep.c.y + _local11);
var _local16:Number = (_local14 - _local12);
var _local17:Number = (_local15 - _local13);
_local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17)));
var _local18:Number = _local3.m_invMass;
var _local19:Number = _local4.m_invMass;
var _local20:Number = _local3.m_invI;
var _local21:Number = _local4.m_invI;
K1.col1.x = (_local18 + _local19);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local18 + _local19);
K2.col1.x = ((_local20 * _local8) * _local8);
K2.col2.x = ((-(_local20) * _local7) * _local8);
K2.col1.y = ((-(_local20) * _local7) * _local8);
K2.col2.y = ((_local20 * _local7) * _local7);
K3.col1.x = ((_local21 * _local11) * _local11);
K3.col2.x = ((-(_local21) * _local10) * _local11);
K3.col1.y = ((-(_local21) * _local10) * _local11);
K3.col2.y = ((_local21 * _local10) * _local10);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Solve(tImpulse, -(_local16), -(_local17));
var _local22:Number = tImpulse.x;
var _local23:Number = tImpulse.y;
_local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23));
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22))));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22))));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
var _local24:Number = 0;
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle);
_local26 = 0;
if (m_limitState == e_equalLimits){
_local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local24 = b2Math.b2Abs(_local2);
} else {
if (m_limitState == e_atLowerLimit){
_local2 = (_local25 - m_lowerAngle);
_local24 = b2Math.b2Max(0, -(_local2));
_local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
} else {
if (m_limitState == e_atUpperLimit){
_local2 = (_local25 - m_upperAngle);
_local24 = b2Math.b2Max(0, _local2);
_local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
};
};
};
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop))));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function SetMaxMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
public function GetJointAngle():Number{
return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle));
}
public function GetMotorTorque():Number{
return (m_motorForce);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local7:Number;
var _local14:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local10:Number = _local2.m_invMass;
var _local11:Number = _local3.m_invMass;
var _local12:Number = _local2.m_invI;
var _local13:Number = _local3.m_invI;
K1.col1.x = (_local10 + _local11);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local10 + _local11);
K2.col1.x = ((_local12 * _local7) * _local7);
K2.col2.x = ((-(_local12) * _local6) * _local7);
K2.col1.y = ((-(_local12) * _local6) * _local7);
K2.col2.y = ((_local12 * _local6) * _local6);
K3.col1.x = ((_local13 * _local9) * _local9);
K3.col2.x = ((-(_local13) * _local8) * _local9);
K3.col1.y = ((-(_local13) * _local8) * _local9);
K3.col2.y = ((_local13 * _local8) * _local8);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Invert(m_pivotMass);
m_motorMass = (1 / (_local12 + _local13));
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit){
_local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle);
if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
m_limitState = e_equalLimits;
} else {
if (_local14 <= m_lowerAngle){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local14 >= m_upperAngle){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
} else {
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
} else {
m_pivotForce.SetZero();
m_motorForce = 0;
m_limitForce = 0;
};
m_limitPositionImpulse = 0;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
override public function GetReactionTorque():Number{
return (m_limitForce);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerAngle = _arg1;
m_upperAngle = _arg2;
}
}
}//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2RevoluteJointDef extends b2JointDef {
public var upperAngle:Number;
public var enableMotor:Boolean;
public var referenceAngle:Number;
public var motorSpeed:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var lowerAngle:Number;
public var maxMotorTorque:Number;
public function b2RevoluteJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_revoluteJoint;
localAnchor1.Set(0, 0);
localAnchor2.Set(0, 0);
referenceAngle = 0;
lowerAngle = 0;
upperAngle = 0;
maxMotorTorque = 0;
motorSpeed = 0;
enableLimit = false;
enableMotor = false;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 64
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2Body {
public var m_next:b2Body;
public var m_xf:b2XForm;
public var m_contactList:b2ContactEdge;
public var m_angularVelocity:Number;
public var m_shapeList:b2Shape;
public var m_force:b2Vec2;
public var m_mass:Number;
public var m_sweep:b2Sweep;
public var m_torque:Number;
public var m_userData;
public var m_flags:uint;
public var m_world:b2World;
public var m_prev:b2Body;
public var m_invMass:Number;
public var m_type:int;
public var m_linearDamping:Number;
public var m_shapeCount:int;
public var m_angularDamping:Number;
public var m_invI:Number;
public var m_linearVelocity:b2Vec2;
public var m_sleepTime:Number;
public var m_jointList:b2JointEdge;
public var m_I:Number;
public static var e_fixedRotationFlag:uint = 64;
public static var e_frozenFlag:uint = 2;
public static var e_maxTypes:uint = 3;
public static var e_sleepFlag:uint = 8;
private static var s_massData:b2MassData = new b2MassData();
public static var e_bulletFlag:uint = 32;
public static var e_staticType:uint = 1;
public static var e_islandFlag:uint = 4;
public static var e_allowSleepFlag:uint = 16;
private static var s_xf1:b2XForm = new b2XForm();
public static var e_dynamicType:uint = 2;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
m_xf = new b2XForm();
m_sweep = new b2Sweep();
m_linearVelocity = new b2Vec2();
m_force = new b2Vec2();
super();
m_flags = 0;
if (_arg1.isBullet){
m_flags = (m_flags | e_bulletFlag);
};
if (_arg1.fixedRotation){
m_flags = (m_flags | e_fixedRotationFlag);
};
if (_arg1.allowSleep){
m_flags = (m_flags | e_allowSleepFlag);
};
if (_arg1.isSleeping){
m_flags = (m_flags | e_sleepFlag);
};
m_world = _arg2;
m_xf.position.SetV(_arg1.position);
m_xf.R.Set(_arg1.angle);
m_sweep.localCenter.SetV(_arg1.massData.center);
m_sweep.t0 = 1;
m_sweep.a0 = (m_sweep.a = _arg1.angle);
var _local3:b2Mat22 = m_xf.R;
var _local4:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_jointList = null;
m_contactList = null;
m_prev = null;
m_next = null;
m_linearDamping = _arg1.linearDamping;
m_angularDamping = _arg1.angularDamping;
m_force.Set(0, 0);
m_torque = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_sleepTime = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.massData.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.massData.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
m_userData = _arg1.userData;
m_shapeList = null;
m_shapeCount = 0;
}
public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.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{
m_xf.R.Set(m_sweep.a);
var _local1:b2Mat22 = m_xf.R;
var _local2:b2Vec2 = m_sweep.localCenter;
m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y)));
m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y)));
}
public function GetInertia():Number{
return (m_I);
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function SetMassFromShapes():void{
var _local1:b2Shape;
if (m_world.m_lock == true){
return;
};
m_mass = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:b2MassData = s_massData;
_local1 = m_shapeList;
while (_local1) {
_local1.ComputeMass(_local4);
m_mass = (m_mass + _local4.mass);
_local2 = (_local2 + (_local4.mass * _local4.center.x));
_local3 = (_local3 + (_local4.mass * _local4.center.y));
m_I = (m_I + _local4.I);
_local1 = _local1.m_next;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
_local2 = (_local2 * m_invMass);
_local3 = (_local3 * m_invMass);
};
if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){
m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3))));
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
m_sweep.localCenter.Set(_local2, _local3);
var _local5:b2Mat22 = m_xf.R;
var _local6:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local1 = m_shapeList;
while (_local1) {
_local1.UpdateSweepRadius(m_sweep.localCenter);
_local1 = _local1.m_next;
};
var _local7:int = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local7 != m_type){
_local1 = m_shapeList;
while (_local1) {
_local1.RefilterProxy(m_world.m_broadPhase, m_xf);
_local1 = _local1.m_next;
};
};
}
public function PutToSleep():void{
m_flags = (m_flags | e_sleepFlag);
m_sleepTime = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_force.SetZero();
m_torque = 0;
}
public function GetJointList():b2JointEdge{
return (m_jointList);
}
public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{
var _local3:b2Shape;
var _local7:Boolean;
if (m_world.m_lock == true){
return (true);
};
if (IsFrozen()){
return (false);
};
m_xf.R.Set(_arg2);
if (_arg1 != null){
m_xf.position.SetV(_arg1);
};
var _local4:b2Mat22 = m_xf.R;
var _local5:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y));
m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_sweep.a0 = (m_sweep.a = _arg2);
var _local6:Boolean;
_local3 = m_shapeList;
while (_local3) {
_local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf);
if (_local7 == false){
_local6 = true;
break;
};
_local3 = _local3.m_next;
};
if (_local6 == true){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local3 = m_shapeList;
while (_local3) {
_local3.DestroyProxy(m_world.m_broadPhase);
_local3 = _local3.m_next;
};
return (false);
};
m_world.m_broadPhase.Commit();
return (true);
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(m_xf, _arg1));
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_force.x = (m_force.x + _arg1.x);
m_force.y = (m_force.y + _arg1.y);
m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)));
}
public function SynchronizeShapes():Boolean{
var _local4:b2Shape;
var _local1:b2XForm = s_xf1;
_local1.R.Set(m_sweep.a0);
var _local2:b2Mat22 = _local1.R;
var _local3:b2Vec2 = m_sweep.localCenter;
_local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y)));
_local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y)));
var _local5:Boolean;
_local4 = m_shapeList;
while (_local4) {
_local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf);
if (_local5 == false){
break;
};
_local4 = _local4.m_next;
};
if (_local5 == false){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local4 = m_shapeList;
while (_local4) {
_local4.DestroyProxy(m_world.m_broadPhase);
_local4 = _local4.m_next;
};
return (false);
};
return (true);
}
public function GetAngle():Number{
return (m_sweep.a);
}
public function GetXForm():b2XForm{
return (m_xf);
}
public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = m_xf.R;
var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x)))));
}
public function GetNext():b2Body{
return (m_next);
}
public function GetMass():Number{
return (m_mass);
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x));
m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y));
m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))));
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SetMass(_arg1:b2MassData):void{
var _local2:b2Shape;
if (m_world.m_lock == true){
return;
};
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
m_sweep.localCenter.SetV(_arg1.center);
var _local3:b2Mat22 = m_xf.R;
var _local4:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local2 = m_shapeList;
while (_local2) {
_local2.UpdateSweepRadius(m_sweep.localCenter);
_local2 = _local2.m_next;
};
var _local5:int = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local5 != m_type){
_local2 = m_shapeList;
while (_local2) {
_local2.RefilterProxy(m_world.m_broadPhase, m_xf);
_local2 = _local2.m_next;
};
};
}
public function IsStatic():Boolean{
return ((m_type == e_staticType));
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_xf.R, _arg1));
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function Advance(_arg1:Number):void{
m_sweep.Advance(_arg1);
m_sweep.c.SetV(m_sweep.c0);
m_sweep.a = m_sweep.a0;
SynchronizeTransform();
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_bulletFlag);
} else {
m_flags = (m_flags & ~(e_bulletFlag));
};
}
public function CreateShape(_arg1:b2ShapeDef):b2Shape{
if (m_world.m_lock == true){
return (null);
};
var _local2:b2Shape = b2Shape.Create(_arg1, m_world.m_blockAllocator);
_local2.m_next = m_shapeList;
m_shapeList = _local2;
m_shapeCount++;
_local2.m_body = this;
_local2.CreateProxy(m_world.m_broadPhase, m_xf);
_local2.UpdateSweepRadius(m_sweep.localCenter);
return (_local2);
}
public function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointEdge = m_jointList;
while (_local2) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
public function DestroyShape(_arg1:b2Shape):void{
if (m_world.m_lock == true){
return;
};
_arg1.DestroyProxy(m_world.m_broadPhase);
var _local2:b2Shape = m_shapeList;
var _local3:b2Shape;
var _local4:Boolean;
while (_local2 != null) {
if (_local2 == _arg1){
if (_local3){
_local3.m_next = _arg1.m_next;
} else {
m_shapeList = _arg1.m_next;
};
_local4 = true;
break;
};
_local3 = _local2;
_local2 = _local2.m_next;
};
_arg1.m_body = null;
_arg1.m_next = null;
m_shapeCount--;
b2Shape.Destroy(_arg1, m_world.m_blockAllocator);
}
public function GetUserData(){
return (m_userData);
}
public function IsBullet():Boolean{
return (((m_flags & e_bulletFlag) == e_bulletFlag));
}
public function GetWorldCenter():b2Vec2{
return (m_sweep.c);
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_xf.R, _arg1));
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = m_xf.R;
var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (_local3);
}
public function GetWorld():b2World{
return (m_world);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
}
}//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2BodyDef {
public var angularDamping:Number;
public var angle:Number;
public var isSleeping:Boolean;
public var position:b2Vec2;
public var isBullet:Boolean;
public var allowSleep:Boolean;
public var userData;
public var fixedRotation:Boolean;
public var linearDamping:Number;
public var massData:b2MassData;
public function b2BodyDef(){
massData = new b2MassData();
position = new b2Vec2();
super();
massData.center.SetZero();
massData.mass = 0;
massData.I = 0;
userData = null;
position.Set(0, 0);
angle = 0;
linearDamping = 0;
angularDamping = 0;
allowSleep = true;
isSleeping = false;
fixedRotation = false;
isBullet = false;
}
}
}//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactFilter {
public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter);
;
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData = _arg1.GetFilterData();
var _local4:b2FilterData = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
var _local5:Boolean = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
public function RayCollide(_arg1, _arg2:b2Shape):Boolean{
if (!_arg1){
return (true);
};
return (ShouldCollide((_arg1 as b2Shape), _arg2));
}
}
}//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.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
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 PairRemoved(_arg1, _arg2, _arg3):void{
if (_arg3 == null){
return;
};
var _local4:b2Contact = (_arg3 as b2Contact);
if (_local4 == m_nullContact){
return;
};
Destroy(_local4);
}
public function Destroy(_arg1:b2Contact):void{
var _local7:b2Body;
var _local8:b2Body;
var _local9:Array;
var _local10:b2ContactPoint;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2Vec2;
var _local16:b2Vec2;
var _local2:b2Shape = _arg1.m_shape1;
var _local3:b2Shape = _arg1.m_shape2;
var _local4:int = _arg1.m_manifoldCount;
if ((((_local4 > 0)) && (m_world.m_contactListener))){
_local7 = _local2.m_body;
_local8 = _local3.m_body;
_local9 = _arg1.GetManifolds();
_local10 = s_evalCP;
_local10.shape1 = _arg1.m_shape1;
_local10.shape2 = _arg1.m_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;
};
var _local5:b2Body = _local2.m_body;
var _local6:b2Body = _local3.m_body;
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local5.m_contactList){
_local5.m_contactList = _arg1.m_node1.next;
};
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local6.m_contactList){
_local6.m_contactList = _arg1.m_node2.next;
};
b2Contact.Destroy(_arg1, m_world.m_blockAllocator);
m_world.m_contactCount--;
}
override public function PairAdded(_arg1, _arg2){
var _local5:b2Body;
var _local3:b2Shape = (_arg1 as b2Shape);
var _local4:b2Shape = (_arg2 as b2Shape);
_local5 = _local3.m_body;
var _local6:b2Body = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (m_nullContact);
};
if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){
return (m_nullContact);
};
var _local7:b2Contact = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator);
if (_local7 == null){
return (m_nullContact);
};
_local3 = _local7.m_shape1;
_local4 = _local7.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local7.m_prev = null;
_local7.m_next = m_world.m_contactList;
if (m_world.m_contactList != null){
m_world.m_contactList.m_prev = _local7;
};
m_world.m_contactList = _local7;
_local7.m_node1.contact = _local7;
_local7.m_node1.other = _local6;
_local7.m_node1.prev = null;
_local7.m_node1.next = _local5.m_contactList;
if (_local5.m_contactList != null){
_local5.m_contactList.prev = _local7.m_node1;
};
_local5.m_contactList = _local7.m_node1;
_local7.m_node2.contact = _local7;
_local7.m_node2.other = _local5;
_local7.m_node2.prev = null;
_local7.m_node2.next = _local6.m_contactList;
if (_local6.m_contactList != null){
_local6.m_contactList.prev = _local7.m_node2;
};
_local6.m_contactList = _local7.m_node2;
m_world.m_contactCount++;
return (_local7);
}
public function Collide():void{
var _local2:b2Body;
var _local3:b2Body;
var _local1:b2Contact = m_world.m_contactList;
while (_local1) {
_local2 = _local1.m_shape1.m_body;
_local3 = _local1.m_shape2.m_body;
if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){
} else {
_local1.Update(m_world.m_contactListener);
};
_local1 = _local1.m_next;
};
}
}
}//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
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_drawFlags:uint;
public var m_lineThickness:Number;// = 1
public var m_drawScale:Number;// = 1
public var m_sprite:Sprite;
public static var e_coreShapeBit:uint = 4;
public static var e_shapeBit:uint = 1;
public static var e_centerOfMassBit:uint = 64;
public static var e_aabbBit:uint = 8;
public static var e_obbBit:uint = 16;
public static var e_pairBit:uint = 32;
public static var e_jointBit:uint = 2;
public function b2DebugDraw(){
m_drawFlags = 0;
}
public function ClearFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags & ~(_arg1));
}
public function SetFlags(_arg1:uint):void{
m_drawFlags = _arg1;
}
public function AppendFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags | _arg1);
}
public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale));
}
public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha);
var _local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.endFill();
}
public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
}
public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
var _local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
}
public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha);
m_sprite.graphics.moveTo(0, 0);
m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
m_sprite.graphics.endFill();
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale));
}
public function GetFlags():uint{
return (m_drawFlags);
}
public function DrawXForm(_arg1:b2XForm):void{
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale));
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale));
}
}
}//package Box2D.Dynamics
Section 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener)
package Box2D.Dynamics {
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
public class b2DestructionListener {
public function SayGoodbyeShape(_arg1:b2Shape):void{
}
public function SayGoodbyeJoint(_arg1:b2Joint):void{
}
}
}//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2Island {
public var m_listener:b2ContactListener;
public var m_positionIterationCount:int;
public var m_bodyCapacity:int;
public var m_bodies:Array;
public var m_joints:Array;
public var m_jointCapacity:int;
public var m_contactCount:int;
public var m_contacts:Array;
public var m_contactCapacity:int;
public var m_jointCount:int;
public var m_allocator;
public var m_bodyCount:int;
private static var s_reportCR:b2ContactResult = new b2ContactResult();
public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){
var _local6:int;
super();
m_bodyCapacity = _arg1;
m_contactCapacity = _arg2;
m_jointCapacity = _arg3;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_allocator = _arg4;
m_listener = _arg5;
m_bodies = new Array(_arg1);
_local6 = 0;
while (_local6 < _arg1) {
m_bodies[_local6] = null;
_local6++;
};
m_contacts = new Array(_arg2);
_local6 = 0;
while (_local6 < _arg2) {
m_contacts[_local6] = null;
_local6++;
};
m_joints = new Array(_arg3);
_local6 = 0;
while (_local6 < _arg3) {
m_joints[_local6] = null;
_local6++;
};
m_positionIterationCount = 0;
}
public function AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
public function Report(_arg1:Array):void{
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local5:b2Contact;
var _local6:b2ContactConstraint;
var _local7:b2ContactResult;
var _local8:b2Body;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2ContactConstraintPoint;
if (m_listener == null){
return;
};
var _local4:int;
while (_local4 < m_contactCount) {
_local5 = m_contacts[_local4];
_local6 = _arg1[_local4];
_local7 = s_reportCR;
_local7.shape1 = _local5.m_shape1;
_local7.shape2 = _local5.m_shape2;
_local8 = _local7.shape1.m_body;
_local9 = _local5.m_manifoldCount;
_local10 = _local5.GetManifolds();
_local11 = 0;
while (_local11 < _local9) {
_local12 = _local10[_local11];
_local7.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local15 = _local6.points[_local13];
_local7.position = _local8.GetWorldPoint(_local14.localPoint1);
_local7.normalImpulse = _local15.normalImpulse;
_local7.tangentImpulse = _local15.tangentImpulse;
_local7.id.key = _local14.id.key;
m_listener.Result(_local7);
_local13++;
};
_local11++;
};
_local4++;
};
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{
var _local5:int;
var _local6:b2Body;
var _local7:b2Joint;
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y))));
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_force.SetZero();
_local6.m_torque = 0;
_local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity);
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity);
};
if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity);
} else {
_local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity;
};
};
};
_local5++;
};
var _local8:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local8.InitVelocityConstraints(_arg1);
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitVelocityConstraints(_arg1);
_local5++;
};
_local5 = 0;
while (_local5 < _arg1.maxIterations) {
_local8.SolveVelocityConstraints();
_local9 = 0;
while (_local9 < m_jointCount) {
_local7 = m_joints[_local9];
_local7.SolveVelocityConstraints(_arg1);
_local9++;
};
_local5++;
};
_local8.FinalizeVelocityConstraints();
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_sweep.c0.SetV(_local6.m_sweep.c);
_local6.m_sweep.a0 = _local6.m_sweep.a;
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y));
_local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity));
_local6.SynchronizeTransform();
};
_local5++;
};
if (_arg3){
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitPositionConstraints();
_local5++;
};
m_positionIterationCount = 0;
while (m_positionIterationCount < _arg1.maxIterations) {
_local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local11 = true;
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local12 = _local7.SolvePositionConstraints();
_local11 = ((_local11) && (_local12));
_local5++;
};
if (((_local10) && (_local11))){
break;
};
m_positionIterationCount++;
};
};
Report(_local8.m_constraints);
if (_arg4){
_local13 = Number.MAX_VALUE;
_local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.m_invMass == 0){
} else {
if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){
_local6.m_sleepTime = 0;
_local13 = 0;
};
if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){
_local6.m_sleepTime = 0;
_local13 = 0;
} else {
_local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt);
_local13 = b2Math.b2Min(_local13, _local6.m_sleepTime);
};
};
_local5++;
};
if (_local13 >= b2Settings.b2_timeToSleep){
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag);
_local6.m_linearVelocity.SetZero();
_local6.m_angularVelocity = 0;
_local5++;
};
};
};
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:int;
var _local5:b2Body;
var _local6:Boolean;
var _local3:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local3.SolveVelocityConstraints();
_local2++;
};
_local2 = 0;
while (_local2 < m_bodyCount) {
_local5 = m_bodies[_local2];
if (_local5.IsStatic()){
} else {
_local5.m_sweep.c0.SetV(_local5.m_sweep.c);
_local5.m_sweep.a0 = _local5.m_sweep.a;
_local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y));
_local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity));
_local5.SynchronizeTransform();
};
_local2++;
};
var _local4:Number = 0.75;
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local6 = _local3.SolvePositionConstraints(_local4);
if (_local6){
break;
};
_local2++;
};
Report(_local3.m_constraints);
}
}
}//package Box2D.Dynamics
Section 73
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var warmStarting:Boolean;
public var positionCorrection:Boolean;
public var dt:Number;
public var maxIterations:int;
public var dtRatio:Number;
public var inv_dt:Number;
}
}//package Box2D.Dynamics
Section 74
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
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_raycastSegment:b2Segment;
public var m_broadPhase:b2BroadPhase;
public var m_destructionListener:b2DestructionListener;
public var m_jointCount:int;
public var m_lock:Boolean;
public var m_bodyCount:int;
public var m_raycastUserData;
public var m_allowSleep:Boolean;
public var m_positionIterationCount:int;
public var m_groundBody:b2Body;
public var m_contactCount:int;
public var m_raycastNormal:b2Vec2;
public var m_contactFilter:b2ContactFilter;
public var m_bodyList:b2Body;
public var m_debugDraw:b2DebugDraw;
public var m_stackAllocator;
public var m_jointList:b2Joint;
public var m_gravity:b2Vec2;
public var m_contactManager:b2ContactManager;
private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8);
public static var m_continuousPhysics:Boolean;
public static var m_warmStarting:Boolean;
private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6);
public static var m_positionCorrection:Boolean;
private static var s_xf:b2XForm = new b2XForm();
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
m_raycastNormal = new b2Vec2();
m_contactManager = new b2ContactManager();
super();
m_destructionListener = null;
m_boundaryListener = null;
m_contactFilter = b2ContactFilter.b2_defaultFilter;
m_contactListener = null;
m_debugDraw = null;
m_bodyList = null;
m_contactList = null;
m_jointList = null;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_positionCorrection = true;
m_warmStarting = true;
m_continuousPhysics = true;
m_allowSleep = _arg3;
m_gravity = _arg2;
m_lock = false;
m_inv_dt0 = 0;
m_contactManager.m_world = this;
m_broadPhase = new b2BroadPhase(_arg1, m_contactManager);
var _local4:b2BodyDef = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function DrawJoint(_arg1:b2Joint):void{
var _local11:b2PulleyJoint;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local2:b2Body = _arg1.m_body1;
var _local3:b2Body = _arg1.m_body2;
var _local4:b2XForm = _local2.m_xf;
var _local5:b2XForm = _local3.m_xf;
var _local6:b2Vec2 = _local4.position;
var _local7:b2Vec2 = _local5.position;
var _local8:b2Vec2 = _arg1.GetAnchor1();
var _local9:b2Vec2 = _arg1.GetAnchor2();
var _local10:b2Color = s_jointColor;
switch (_arg1.m_type){
case b2Joint.e_distanceJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
case b2Joint.e_pulleyJoint:
_local11 = (_arg1 as b2PulleyJoint);
_local12 = _local11.GetGroundAnchor1();
_local13 = _local11.GetGroundAnchor2();
m_debugDraw.DrawSegment(_local12, _local8, _local10);
m_debugDraw.DrawSegment(_local13, _local9, _local10);
m_debugDraw.DrawSegment(_local12, _local13, _local10);
break;
case b2Joint.e_mouseJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
default:
if (_local2 != m_groundBody){
m_debugDraw.DrawSegment(_local6, _local8, _local10);
};
m_debugDraw.DrawSegment(_local8, _local9, _local10);
if (_local3 != m_groundBody){
m_debugDraw.DrawSegment(_local7, _local9, _local10);
};
};
}
public function Refilter(_arg1:b2Shape):void{
_arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf);
}
public function SetDebugDraw(_arg1:b2DebugDraw):void{
m_debugDraw = _arg1;
}
public function SetContinuousPhysics(_arg1:Boolean):void{
m_continuousPhysics = _arg1;
}
public function GetProxyCount():int{
return (m_broadPhase.m_proxyCount);
}
public function DrawDebugData():void{
var _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
var _local5:b2Joint;
var _local6:b2BroadPhase;
var _local11:b2XForm;
var _local15:Boolean;
var _local16:uint;
var _local17:b2Pair;
var _local18:b2Proxy;
var _local19:b2Proxy;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:b2Proxy;
var _local23:b2PolygonShape;
var _local24:b2OBB;
var _local25:b2Vec2;
var _local26:b2Mat22;
var _local27:b2Vec2;
var _local28:Number;
if (m_debugDraw == null){
return;
};
m_debugDraw.m_sprite.graphics.clear();
var _local1:uint = m_debugDraw.GetFlags();
var _local7:b2Vec2 = new b2Vec2();
var _local8:b2Vec2 = new b2Vec2();
var _local9:b2Vec2 = new b2Vec2();
var _local10:b2Color = new b2Color(0, 0, 0);
var _local12:b2AABB = new b2AABB();
var _local13:b2AABB = new b2AABB();
var _local14:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
if ((_local1 & b2DebugDraw.e_shapeBit)){
_local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local3.IsStatic()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15);
} else {
if (_local3.IsSleeping()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15);
} else {
DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15);
};
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_jointBit)){
_local5 = m_jointList;
while (_local5) {
DrawJoint(_local5);
_local5 = _local5.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local6 = m_broadPhase;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.9, 0.3);
_local2 = 0;
while (_local2 < b2Pair.b2_tableCapacity) {
_local16 = _local6.m_pairManager.m_hashTable[_local2];
while (_local16 != b2Pair.b2_nullPair) {
_local17 = _local6.m_pairManager.m_pairs[_local16];
_local18 = _local6.m_proxyPool[_local17.proxyId1];
_local19 = _local6.m_proxyPool[_local17.proxyId2];
_local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value));
_local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value));
_local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value));
_local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value));
_local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value));
_local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value));
_local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value));
_local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value));
_local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x));
_local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y));
_local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x));
_local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y));
m_debugDraw.DrawSegment(_local8, _local9, _local10);
_local16 = _local17.next;
};
_local2++;
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local6 = m_broadPhase;
_local20 = _local6.m_worldAABB.lowerBound;
_local21 = _local6.m_worldAABB.upperBound;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.3, 0.9);
_local2 = 0;
while (_local2 < b2Settings.b2_maxProxies) {
_local22 = _local6.m_proxyPool[_local2];
if (_local22.IsValid() == false){
} else {
_local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value));
_local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value));
_local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value));
_local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value));
_local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y);
_local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y);
_local14[2].Set(_local12.upperBound.x, _local12.upperBound.y);
_local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y);
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local2++;
};
_local14[0].Set(_local20.x, _local20.y);
_local14[1].Set(_local21.x, _local20.y);
_local14[2].Set(_local21.x, _local21.y);
_local14[3].Set(_local20.x, _local21.y);
m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9));
};
if ((_local1 & b2DebugDraw.e_obbBit)){
_local10.Set(0.5, 0.3, 0.5);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local4.m_type != b2Shape.e_polygonShape){
} else {
_local23 = (_local4 as b2PolygonShape);
_local24 = _local23.GetOBB();
_local25 = _local24.extents;
_local14[0].Set(-(_local25.x), -(_local25.y));
_local14[1].Set(_local25.x, -(_local25.y));
_local14[2].Set(_local25.x, _local25.y);
_local14[3].Set(-(_local25.x), _local25.y);
_local2 = 0;
while (_local2 < 4) {
_local26 = _local24.R;
_local27 = _local14[_local2];
_local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local26 = _local11.R;
_local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local2++;
};
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_centerOfMassBit)){
_local3 = m_bodyList;
while (_local3) {
_local11 = s_xf;
_local11.R = _local3.m_xf.R;
_local11.position = _local3.GetWorldCenter();
m_debugDraw.DrawXForm(_local11);
_local3 = _local3.m_next;
};
};
}
public function DestroyBody(_arg1:b2Body):void{
var _local4:b2JointEdge;
var _local5:b2Shape;
if (m_lock == true){
return;
};
var _local2:b2JointEdge = _arg1.m_jointList;
while (_local2) {
_local4 = _local2;
_local2 = _local2.next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeJoint(_local4.joint);
};
DestroyJoint(_local4.joint);
};
var _local3:b2Shape = _arg1.m_shapeList;
while (_local3) {
_local5 = _local3;
_local3 = _local3.m_next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeShape(_local5);
};
_local5.DestroyProxy(m_broadPhase);
b2Shape.Destroy(_local5, m_blockAllocator);
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_bodyList){
m_bodyList = _arg1.m_next;
};
m_bodyCount--;
}
public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{
var _local6:b2CircleShape;
var _local7:b2Vec2;
var _local8:Number;
var _local9:b2Vec2;
var _local10:int;
var _local11:b2PolygonShape;
var _local12:int;
var _local13:Array;
var _local14:Array;
var _local15:Array;
var _local5:b2Color = s_coreColor;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local6 = (_arg1 as b2CircleShape);
_local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition);
_local8 = _local6.m_radius;
_local9 = _arg2.R.col1;
m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3);
if (_arg4){
m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5);
};
break;
case b2Shape.e_polygonShape:
_local11 = (_arg1 as b2PolygonShape);
_local12 = _local11.GetVertexCount();
_local13 = _local11.GetVertices();
_local14 = new Array(b2Settings.b2_maxPolygonVertices);
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]);
_local10++;
};
m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3);
if (_arg4){
_local15 = _local11.GetCoreVertices();
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]);
_local10++;
};
m_debugDraw.DrawPolygon(_local14, _local12, _local5);
};
break;
};
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
public function SetContactFilter(_arg1:b2ContactFilter):void{
m_contactFilter = _arg1;
}
public function Solve(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local9:int;
var _local10:int;
var _local11:b2Body;
var _local12:b2ContactEdge;
var _local13:b2JointEdge;
var _local14:Boolean;
m_positionIterationCount = 0;
var _local3:b2Island = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2 = _local2.m_next;
};
var _local4:b2Contact = m_contactList;
while (_local4) {
_local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag));
_local4 = _local4.m_next;
};
var _local5:b2Joint = m_jointList;
while (_local5) {
_local5.m_islandFlag = false;
_local5 = _local5.m_next;
};
var _local6:int = m_bodyCount;
var _local7:Array = new Array(_local6);
var _local8:b2Body = m_bodyList;
while (_local8) {
if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){
} else {
if (_local8.IsStatic()){
} else {
_local3.Clear();
_local9 = 0;
var _temp1 = _local9;
_local9 = (_local9 + 1);
var _local15 = _temp1;
_local7[_local15] = _local8;
_local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag);
while (_local9 > 0) {
--_local9;
_local2 = _local7[_local9];
_local3.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local12 = _local2.m_contactList;
while (_local12) {
if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){
} else {
if (_local12.contact.m_manifoldCount == 0){
} else {
_local3.AddContact(_local12.contact);
_local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag);
_local11 = _local12.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local9;
_local9 = (_local9 + 1);
var _local16 = _temp2;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
};
_local12 = _local12.next;
};
_local13 = _local2.m_jointList;
while (_local13) {
if (_local13.joint.m_islandFlag == true){
} else {
_local3.AddJoint(_local13.joint);
_local13.joint.m_islandFlag = true;
_local11 = _local13.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local9;
_local9 = (_local9 + 1);
_local16 = _temp3;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
_local13 = _local13.next;
};
};
};
_local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep);
if (_local3.m_positionIterationCount > m_positionIterationCount){
m_positionIterationCount = _local3.m_positionIterationCount;
};
_local10 = 0;
while (_local10 < _local3.m_bodyCount) {
_local2 = _local3.m_bodies[_local10];
if (_local2.IsStatic()){
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
};
_local10++;
};
};
};
_local8 = _local8.m_next;
};
_local2 = m_bodyList;
while (_local2) {
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local14 = _local2.SynchronizeShapes();
if ((((_local14 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
};
};
_local2 = _local2.m_next;
};
m_broadPhase.Commit();
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array = new Array(_arg3);
var _local5:int = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
var _local6:int;
while (_local6 < _local5) {
_arg2[_local6] = _local4[_local6];
_local6++;
};
return (_local5);
}
public function GetContactCount():int{
return (m_contactCount);
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local11:b2Contact;
var _local12:b2Contact;
var _local13:Number;
var _local14:b2Body;
var _local15:int;
var _local16:b2TimeStep;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:b2Body;
var _local21:Boolean;
var _local8:b2Island = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener);
var _local9:int = m_bodyCount;
var _local10:Array = new Array(_local9);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2.m_sweep.t0 = 0;
_local2 = _local2.m_next;
};
_local11 = m_contactList;
while (_local11) {
_local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local11 = _local11.m_next;
};
while (true) {
_local12 = null;
_local13 = 1;
_local11 = m_contactList;
for (;_local11;(_local11 = _local11.m_next)) {
if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){
} else {
_local18 = 1;
if ((_local11.m_flags & b2Contact.e_toiFlag)){
_local18 = _local11.m_toi;
} else {
_local3 = _local11.m_shape1;
_local4 = _local11.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){
continue;
};
_local19 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local19 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local19);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local19 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local19);
};
};
_local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep);
if ((((_local18 > 0)) && ((_local18 < 1)))){
_local18 = (((1 - _local18) * _local19) + _local18);
if (_local18 > 1){
_local18 = 1;
};
};
_local11.m_toi = _local18;
_local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){
_local12 = _local11;
_local13 = _local18;
};
};
};
if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){
break;
};
_local3 = _local12.m_shape1;
_local4 = _local12.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local5.Advance(_local13);
_local6.Advance(_local13);
_local12.Update(m_contactListener);
_local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag));
if (_local12.m_manifoldCount == 0){
} else {
_local14 = _local5;
if (_local14.IsStatic()){
_local14 = _local6;
};
_local8.Clear();
_local15 = 0;
var _temp1 = _local15;
_local15 = (_local15 + 1);
var _local22 = _temp1;
_local10[_local22] = _local14;
_local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag);
while (_local15 > 0) {
--_local15;
_local2 = _local10[_local15];
_local8.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local8.m_contactCount == _local8.m_contactCapacity){
} else {
if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){
} else {
if (_local7.contact.m_manifoldCount == 0){
} else {
_local8.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local20 = _local7.other;
if ((_local20.m_flags & b2Body.e_islandFlag)){
} else {
if (_local20.IsStatic() == false){
_local20.Advance(_local13);
_local20.WakeUp();
};
var _temp2 = _local15;
_local15 = (_local15 + 1);
var _local23 = _temp2;
_local10[_local23] = _local20;
_local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local7 = _local7.next;
};
};
};
_local16 = new b2TimeStep();
_local16.dt = ((1 - _local13) * _arg1.dt);
_local16.inv_dt = (1 / _local16.dt);
_local16.maxIterations = _arg1.maxIterations;
_local8.SolveTOI(_local16);
_local17 = 0;
while (_local17 < _local8.m_bodyCount) {
_local2 = _local8.m_bodies[_local17];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local21 = _local2.SynchronizeShapes();
if ((((_local21 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
_local7 = _local2.m_contactList;
while (_local7) {
_local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag));
_local7 = _local7.next;
};
};
};
_local17++;
};
_local17 = 0;
while (_local17 < _local8.m_contactCount) {
_local11 = _local8.m_contacts[_local17];
_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 SetGravity(_arg1:b2Vec2):void{
m_gravity = _arg1;
}
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 _local3:b2Body;
var _local4:b2Shape;
var _local2:b2Joint = b2Joint.Create(_arg1, m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_node1.joint = _local2;
_local2.m_node1.other = _local2.m_body2;
_local2.m_node1.prev = null;
_local2.m_node1.next = _local2.m_body1.m_jointList;
if (_local2.m_body1.m_jointList){
_local2.m_body1.m_jointList.prev = _local2.m_node1;
};
_local2.m_body1.m_jointList = _local2.m_node1;
_local2.m_node2.joint = _local2;
_local2.m_node2.other = _local2.m_body1;
_local2.m_node2.prev = null;
_local2.m_node2.next = _local2.m_body2.m_jointList;
if (_local2.m_body2.m_jointList){
_local2.m_body2.m_jointList.prev = _local2.m_node2;
};
_local2.m_body2.m_jointList = _local2.m_node2;
if (_arg1.collideConnected == false){
_local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.RefilterProxy(m_broadPhase, _local3.m_xf);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local5:b2Body;
var _local6:b2Shape;
var _local2:Boolean = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_jointList){
m_jointList = _arg1.m_next;
};
var _local3:b2Body = _arg1.m_body1;
var _local4:b2Body = _arg1.m_body2;
_local3.WakeUp();
_local4.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local4.m_jointList){
_local4.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, m_blockAllocator);
m_jointCount--;
if (_local2 == false){
_local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.RefilterProxy(m_broadPhase, _local5.m_xf);
_local6 = _local6.m_next;
};
};
}
public function SetContactListener(_arg1:b2ContactListener):void{
m_contactListener = _arg1;
}
public function Raycast(_arg1:b2Segment, _arg2:Array, _arg3:int, _arg4):int{
var _local5:Array = new Array(_arg3);
m_raycastSegment = _arg1;
m_raycastUserData = _arg4;
var _local6:int = m_broadPhase.QuerySegment(_arg1, _local5, _arg3, RaycastSortKey);
var _local7:int;
while (_local7 < _local6) {
_arg2[_local7] = _local5[_local7];
_local7++;
};
return (_local6);
}
public function RaycastOne(_arg1:b2Segment, _arg2:Array, _arg3:b2Vec2, _arg4):b2Shape{
var _local5:Array = new Array(1);
var _local6:Number = Raycast(_arg1, _local5, 1, _arg4);
if (_local6 == 0){
return (null);
};
if (_local6 > 1){
trace(_local6);
};
var _local7:b2Shape = _local5[0];
var _local8:b2XForm = _local7.GetBody().GetXForm();
_local7.TestSegment(_local8, _arg2, _arg3, _arg1, 1);
return (_local7);
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
if (m_lock == true){
return (null);
};
var _local2:b2Body = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
public function RaycastSortKey(_arg1:b2Shape){
if (((m_contactFilter) && (!(m_contactFilter.RayCollide(m_raycastUserData, _arg1))))){
return (-1);
};
var _local2:b2Body = _arg1.GetBody();
var _local3:b2XForm = _local2.GetXForm();
var _local4:Array = [0];
if (!_arg1.TestSegment(_local3, _local4, m_raycastNormal, m_raycastSegment, 1)){
return (-1);
};
return (_local4[0]);
}
public function SetBoundaryListener(_arg1:b2BoundaryListener):void{
m_boundaryListener = _arg1;
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function Step(_arg1:Number, _arg2:int):void{
m_lock = true;
var _local3:b2TimeStep = new b2TimeStep();
_local3.dt = _arg1;
_local3.maxIterations = _arg2;
if (_arg1 > 0){
_local3.inv_dt = (1 / _arg1);
} else {
_local3.inv_dt = 0;
};
_local3.dtRatio = (m_inv_dt0 * _arg1);
_local3.positionCorrection = m_positionCorrection;
_local3.warmStarting = m_warmStarting;
m_contactManager.Collide();
if (_local3.dt > 0){
Solve(_local3);
};
if (((m_continuousPhysics) && ((_local3.dt > 0)))){
SolveTOI(_local3);
};
DrawDebugData();
m_inv_dt0 = _local3.inv_dt;
m_lock = false;
}
public function GetBodyCount():int{
return (m_bodyCount);
}
public function GetJointCount():int{
return (m_jointCount);
}
}
}//package Box2D.Dynamics
Section 75
//webbliWorldGameAPI (com.webbliworld.api.webbliWorldGameAPI)
package com.webbliworld.api {
import flash.events.*;
import flash.net.*;
public class webbliWorldGameAPI extends EventDispatcher {
private static const AWARD_ACHIEVEMENT:String = "AWARD_ACHIEVEMENT";
private static const SUBMIT_SCORE:String = "SUBMIT_SCORE";
private static const LEVEL_START:String = "LEVEL_START";
private static const START_ERROR:String = "startError";
private static const LINK_CREDITS:String = "LINK_CREDITS";
private static const START_SUCCESS:String = "startSuccess";
private static const LEVEL_END:String = "LEVEL_END";
private static const LINK_OTHER:String = "LINK_OTHER";
private static const LINK_MOREGAMES:String = "LINK_MOREGAMES";
public static const API_VERSION:String = "1.0";
private static var responder:Responder;
private static var gameObjectsRaw:Array;
private static var gameID:int;
public static var error:String;
private static var gameAchievementsRaw:Object;
private static var userGameAchievements:Array;
private static var userID:int;
private static var onCompleteFunction:Function;
private static var gameAchievements:Array;
private static var loadSuccess:Boolean;
private static var gateway:String = "http://gateway.webbliworld.com/amfphp/gateway.php";
private static var userGameAchievementsRaw:Object;
private static var gameObjects:Array;
private static var online:Boolean = false;
private static var username:String;
private static var connection:NetConnection;
private static var gameSessionID:String;
private static var onErrorFunction:Function;
public static function storeObject(_arg1:String, _arg2):Boolean{
var _local3:Object = new Object();
_local3.name = _arg1;
_local3.value = _arg2;
var _local4:Boolean = storeObjectLocally(_local3);
return (_local4);
}
public static function get wwGameSessionID():String{
return (gameSessionID);
}
private static function onLoadFault(_arg1:Object):void{
error = String(_arg1);
connection.removeEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.close();
if ((onErrorFunction is Function)){
onErrorFunction();
};
}
private static function awardAchievementResponse(_arg1:Object):void{
connection.removeEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.close();
if (_arg1.error){
error = _arg1.error;
if ((onErrorFunction is Function)){
onErrorFunction();
};
} else {
if (_arg1.achievementID){
userGameAchievements[int(_arg1.achievementID)] = true;
};
if ((onCompleteFunction is Function)){
onCompleteFunction();
};
};
}
public static function gameStart(_arg1:String, _arg2:String, _arg3:Function, _arg4:Function):void{
onCompleteFunction = _arg3;
onErrorFunction = _arg4;
responder = new Responder(gameStartResponse, onLoadFault);
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.connect(gateway);
connection.call("Game.start", responder, _arg1, _arg2);
}
private static function storeObjectLocally(_arg1:Object):Boolean{
var _local3:Array;
var _local2:Boolean;
for each (_local3 in gameObjects) {
if (_local3[0] == _arg1.name){
_local3[1] = _arg1.value;
_local2 = true;
break;
};
};
if (_local2 == false){
gameObjects.push([_arg1.name, _arg1.value, 0]);
};
return (_local2);
}
public static function awardAchievement(_arg1:int, _arg2:Function=null, _arg3:Function=null):void{
if (checkStatus() == false){
return;
};
onCompleteFunction = _arg2;
onErrorFunction = _arg3;
if (playerHasAchievement(_arg1) == false){
responder = new Responder(awardAchievementResponse, onLoadFault);
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.connect(gateway);
connection.call("Game.awardAchievement", responder, gameID, gameSessionID, userID, _arg1);
};
}
public static function get wwGameID():int{
return (gameID);
}
public static function get storedGameObjects():Array{
return (gameObjects);
}
private static function externalLinkHandler(_arg1:String, _arg2:String):void{
if (checkStatus() == false){
return;
};
responder = new Responder(noReturnedValueResponseHandler, onLoadFault);
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.connect(gateway);
connection.call("Game.recordLinkEvent", responder, gameID, gameSessionID, userID, _arg1, _arg2);
navigateToURL(new URLRequest(_arg2), "_blank");
}
public static function getAchievementAsObject(_arg1:int):Object{
var _local2:Object = new Object();
_local2.value = _arg1;
_local2.id = _arg1;
_local2.code = _arg1;
_local2.title = getAchievementTitle(_arg1);
_local2.label = getAchievementTitle(_arg1);
_local2.description = getAchievementDescription(_arg1);
_local2.userHasWon = playerHasAchievement(_arg1);
return (_local2);
}
private static function checkStatus():Boolean{
if (online){
return (true);
};
error = "API not initilised";
return (false);
}
public static function get achievements():Array{
return (gameAchievements);
}
public static function linkMoreGames(_arg1:String):void{
externalLinkHandler(LINK_MOREGAMES, _arg1);
}
private static function processUserGameAchievements():void{
var _local1:Object;
userGameAchievements = new Array();
for each (_local1 in userGameAchievementsRaw) {
userGameAchievements[_local1.id] = new Array(_local1.achieved_on);
};
}
public static function getAchievementDescription(_arg1:int):String{
return (gameAchievements[_arg1][2]);
}
private static function processGameAchievements():void{
var _local1:Object;
gameAchievements = new Array();
for each (_local1 in gameAchievementsRaw) {
gameAchievements[_local1.id] = new Array(_local1.id, _local1.title, _local1.description);
};
}
public static function levelEnd(_arg1:int, _arg2:Number, _arg3:Function=null, _arg4:Function=null):void{
if (checkStatus() == false){
return;
};
onCompleteFunction = _arg3;
onErrorFunction = _arg4;
responder = new Responder(noReturnedValueResponseHandler, onLoadFault);
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.connect(gateway);
connection.call("Game.endLevel", responder, gameID, gameSessionID, userID, _arg1, _arg2);
}
private static function loadObjectResponse(_arg1:Object):void{
connection.removeEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.close();
if (_arg1.error){
error = _arg1.error;
if ((onErrorFunction is Function)){
onErrorFunction();
};
} else {
storeObjectLocally(_arg1);
if ((onCompleteFunction is Function)){
onCompleteFunction(_arg1.value);
};
};
}
public static function levelStart(_arg1:int, _arg2:Number, _arg3:Function=null, _arg4:Function=null):void{
if (checkStatus() == false){
return;
};
onCompleteFunction = _arg3;
onErrorFunction = _arg4;
responder = new Responder(noReturnedValueResponseHandler, onLoadFault);
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.connect(gateway);
connection.call("Game.startLevel", responder, gameID, gameSessionID, userID, _arg1, _arg2);
}
public static function linkCredits(_arg1:String):void{
externalLinkHandler(LINK_CREDITS, _arg1);
}
public static function loadObject(_arg1:String, _arg2:Function=null, _arg3:Function=null):void{
if (checkStatus() == false){
return;
};
onCompleteFunction = _arg2;
onErrorFunction = _arg3;
responder = new Responder(loadObjectResponse, onLoadFault);
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.connect(gateway);
connection.call("Game.getObject", responder, gameID, userID, _arg1);
}
public static function getObject(_arg1:String){
var _local3:Array;
var _local2:* = null;
for each (_local3 in gameObjects) {
if (_local3[0] == _arg1){
_local2 = _local3[1];
break;
};
};
return (_local2);
}
public static function linkOther(_arg1:String):void{
externalLinkHandler(LINK_OTHER, _arg1);
}
private static function processGameObjects():void{
var _local1:Object;
gameObjects = new Array();
for each (_local1 in gameObjectsRaw) {
gameObjects.push([_local1.name, _local1.value, _local1.created]);
};
}
public static function commitObjects(_arg1:Function=null, _arg2:Function=null):void{
if (checkStatus() == false){
return;
};
onCompleteFunction = _arg1;
onErrorFunction = _arg2;
responder = new Responder(noReturnedValueResponseHandler, onLoadFault);
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.connect(gateway);
connection.call("Game.saveObjects", responder, gameID, userID, gameObjects);
}
private static function noReturnedValueResponseHandler(_arg1:Object):void{
connection.removeEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.close();
if (_arg1.error){
error = _arg1.error;
if ((onErrorFunction is Function)){
onErrorFunction();
};
} else {
if ((onCompleteFunction is Function)){
onCompleteFunction();
};
};
}
public static function submitScore(_arg1:Number, _arg2:uint=0, _arg3:uint=0, _arg4:Function=null, _arg5:Function=null):void{
if (checkStatus() == false){
return;
};
onCompleteFunction = _arg4;
onErrorFunction = _arg5;
responder = new Responder(noReturnedValueResponseHandler, onLoadFault);
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.connect(gateway);
trace(("sscore = " + _arg1));
connection.call("Game.submitFinalScore", responder, gameID, gameSessionID, userID, _arg1, _arg2, _arg3);
}
public static function get playerUsername():String{
return (username);
}
private static function gameStartResponse(_arg1:Object):void{
connection.removeEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.close();
if (_arg1.error){
error = _arg1.error;
if ((onErrorFunction is Function)){
onErrorFunction();
};
} else {
gameID = _arg1.game_id;
gameSessionID = _arg1.session_id;
userID = _arg1.user_id;
username = _arg1.username;
gameAchievementsRaw = _arg1.game_achievements;
processGameAchievements();
userGameAchievementsRaw = _arg1.user_achievements;
processUserGameAchievements();
gameObjectsRaw = _arg1.game_objects;
processGameObjects();
online = true;
if ((onCompleteFunction is Function)){
onCompleteFunction();
};
};
}
private static function connectFailed(_arg1:NetStatusEvent):void{
trace(("NetStatusEvent Connection Failed: " + _arg1.toString()));
}
public static function playerHasAchievement(_arg1:int):Boolean{
if (userGameAchievements[_arg1]){
return (true);
};
return (false);
}
public static function getAchievementTitle(_arg1:int):String{
return (gameAchievements[_arg1][1]);
}
public static function commitSingleObject(_arg1:String, _arg2:Function=null, _arg3:Function=null):void{
if (checkStatus() == false){
return;
};
onCompleteFunction = _arg2;
onErrorFunction = _arg3;
responder = new Responder(noReturnedValueResponseHandler, onLoadFault);
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, connectFailed);
connection.connect(gateway);
connection.call("Game.saveObject", responder, gameID, userID, _arg1, getObject(_arg1));
}
}
}//package com.webbliworld.api
Section 76
//achievementpanel_92 (IntroLib_fla.achievementpanel_92)
package IntroLib_fla {
import flash.display.*;
public dynamic class achievementpanel_92 extends MovieClip {
public function achievementpanel_92(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package IntroLib_fla
Section 77
//bonustext_107 (IntroLib_fla.bonustext_107)
package IntroLib_fla {
import flash.display.*;
import flash.text.*;
public dynamic class bonustext_107 extends MovieClip {
public var textAchievementName:TextField;
public var textBonusName:TextField;
public var textBonusScore:TextField;
}
}//package IntroLib_fla
Section 78
//BttnMute_85 (IntroLib_fla.BttnMute_85)
package IntroLib_fla {
import flash.display.*;
public dynamic class BttnMute_85 extends MovieClip {
public function BttnMute_85(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package IntroLib_fla
Section 79
//ButtonHolder_84 (IntroLib_fla.ButtonHolder_84)
package IntroLib_fla {
import flash.display.*;
public dynamic class ButtonHolder_84 extends MovieClip {
public var buttonBack:SimpleButton;
public var buttonMute:MovieClip;
public var buttonQuit:SimpleButton;
}
}//package IntroLib_fla
Section 80
//camperrollover_73 (IntroLib_fla.camperrollover_73)
package IntroLib_fla {
import flash.display.*;
public dynamic class camperrollover_73 extends MovieClip {
public var panel:MovieClip;
public function camperrollover_73(){
addFrameScript(0, frame1, 1, frame2, 6, frame7);
}
function frame7(){
stop();
}
function frame1(){
stop();
visible = false;
}
function frame2(){
visible = true;
}
}
}//package IntroLib_fla
Section 81
//camperrolloverpanel_74 (IntroLib_fla.camperrolloverpanel_74)
package IntroLib_fla {
import flash.display.*;
public dynamic class camperrolloverpanel_74 extends MovieClip {
public var buttonRace:SimpleButton;
public var buttonCustomise:SimpleButton;
}
}//package IntroLib_fla
Section 82
//challengesclip_27 (IntroLib_fla.challengesclip_27)
package IntroLib_fla {
import flash.display.*;
import flash.text.*;
public dynamic class challengesclip_27 extends MovieClip {
public var text0a:TextField;
public var tick0:MovieClip;
public var tick2:MovieClip;
public var tick3:MovieClip;
public var tick1:MovieClip;
public var text1a:TextField;
public var text2a:TextField;
public var text3a:TextField;
public var text3:TextField;
public var text2:TextField;
public var text1:TextField;
public var text0:TextField;
}
}//package IntroLib_fla
Section 83
//colourmonster_18 (IntroLib_fla.colourmonster_18)
package IntroLib_fla {
import flash.display.*;
public dynamic class colourmonster_18 extends MovieClip {
public var popup:MovieClip;
public var spray:MovieClip;
public function colourmonster_18(){
addFrameScript(28, frame29, 36, frame37, 61, frame62, 67, frame68);
}
function frame29(){
stop();
}
function frame37(){
spray.gotoAndPlay(1);
spray.visible = true;
TitleScreenState.StartSpray();
}
function frame62(){
stop();
spray.visible = false;
TitleScreenState.SprayComplete();
}
function frame68(){
stop();
}
}
}//package IntroLib_fla
Section 84
//colourpopup_23 (IntroLib_fla.colourpopup_23)
package IntroLib_fla {
import flash.display.*;
public dynamic class colourpopup_23 extends MovieClip {
public function colourpopup_23(){
addFrameScript(0, frame1, 6, frame7);
}
function frame7(){
stop();
}
function frame1(){
stop();
}
}
}//package IntroLib_fla
Section 85
//cursorkeys_89 (IntroLib_fla.cursorkeys_89)
package IntroLib_fla {
import flash.display.*;
public dynamic class cursorkeys_89 extends MovieClip {
public function cursorkeys_89(){
addFrameScript(65, frame66);
}
function frame66(){
stop();
}
}
}//package IntroLib_fla
Section 86
//exitpopup_45 (IntroLib_fla.exitpopup_45)
package IntroLib_fla {
import flash.display.*;
public dynamic class exitpopup_45 extends MovieClip {
public function exitpopup_45(){
addFrameScript(8, frame9, 23, frame24, 29, frame30);
}
function frame24(){
stop();
}
function frame9(){
stop();
}
function frame30(){
stop();
}
}
}//package IntroLib_fla
Section 87
//introcamper_50 (IntroLib_fla.introcamper_50)
package IntroLib_fla {
import flash.display.*;
public dynamic class introcamper_50 extends MovieClip {
public var body:MovieClip;
}
}//package IntroLib_fla
Section 88
//introcamperbody_51 (IntroLib_fla.introcamperbody_51)
package IntroLib_fla {
import flash.display.*;
public dynamic class introcamperbody_51 extends MovieClip {
public var fill:MovieClip;
public function introcamperbody_51(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package IntroLib_fla
Section 89
//introforeground_81 (IntroLib_fla.introforeground_81)
package IntroLib_fla {
import flash.display.*;
public dynamic class introforeground_81 extends MovieClip {
public var buttonWebbliLogo:SimpleButton;
public function introforeground_81(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package IntroLib_fla
Section 90
//introracer_55 (IntroLib_fla.introracer_55)
package IntroLib_fla {
import flash.display.*;
public dynamic class introracer_55 extends MovieClip {
public var body:MovieClip;
}
}//package IntroLib_fla
Section 91
//introracerbody_56 (IntroLib_fla.introracerbody_56)
package IntroLib_fla {
import flash.display.*;
public dynamic class introracerbody_56 extends MovieClip {
public var fill:MovieClip;
public function introracerbody_56(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package IntroLib_fla
Section 92
//introtoaster_59 (IntroLib_fla.introtoaster_59)
package IntroLib_fla {
import flash.display.*;
public dynamic class introtoaster_59 extends MovieClip {
public var body:MovieClip;
}
}//package IntroLib_fla
Section 93
//introtoasterbody_60 (IntroLib_fla.introtoasterbody_60)
package IntroLib_fla {
import flash.display.*;
public dynamic class introtoasterbody_60 extends MovieClip {
public var fill:MovieClip;
public function introtoasterbody_60(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package IntroLib_fla
Section 94
//level2button_42 (IntroLib_fla.level2button_42)
package IntroLib_fla {
import flash.display.*;
public dynamic class level2button_42 extends MovieClip {
public function level2button_42(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package IntroLib_fla
Section 95
//level3button_43 (IntroLib_fla.level3button_43)
package IntroLib_fla {
import flash.display.*;
public dynamic class level3button_43 extends MovieClip {
public function level3button_43(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package IntroLib_fla
Section 96
//level4button_44 (IntroLib_fla.level4button_44)
package IntroLib_fla {
import flash.display.*;
public dynamic class level4button_44 extends MovieClip {
public function level4button_44(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package IntroLib_fla
Section 97
//levelmonster_26 (IntroLib_fla.levelmonster_26)
package IntroLib_fla {
import flash.display.*;
public dynamic class levelmonster_26 extends MovieClip {
public var webbliPopUp:MovieClip;
public var buttonTrack4:MovieClip;
public var trackrollover:MovieClip;
public var buttonTrack3:MovieClip;
public var buttonTrack1:MovieClip;
public var buttonTrack2:MovieClip;
public var challenges:MovieClip;
public var speechbubble:MovieClip;
public function levelmonster_26(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package IntroLib_fla
Section 98
//levelscreenspeechbubble_48 (IntroLib_fla.levelscreenspeechbubble_48)
package IntroLib_fla {
import flash.display.*;
import flash.text.*;
public dynamic class levelscreenspeechbubble_48 extends MovieClip {
public var challengeText:TextField;
public function levelscreenspeechbubble_48(){
addFrameScript(0, frame1, 1, frame2, 13, frame14, 27, frame28);
}
function frame14(){
challengeText.visible = true;
}
function frame1(){
stop();
challengeText.visible = false;
}
function frame2(){
challengeText.visible = false;
}
function frame28(){
stop();
}
}
}//package IntroLib_fla
Section 99
//previewflash_32 (IntroLib_fla.previewflash_32)
package IntroLib_fla {
import flash.display.*;
public dynamic class previewflash_32 extends MovieClip {
public function previewflash_32(){
addFrameScript(11, frame12);
}
function frame12(){
stop();
}
}
}//package IntroLib_fla
Section 100
//propsystemrollovers_79 (IntroLib_fla.propsystemrollovers_79)
package IntroLib_fla {
import flash.display.*;
public dynamic class propsystemrollovers_79 extends MovieClip {
public var text:MovieClip;
public function propsystemrollovers_79(){
addFrameScript(0, frame1, 9, frame10, 18, frame19);
}
function frame10(){
stop();
}
function frame1(){
stop();
}
function frame19(){
stop();
}
}
}//package IntroLib_fla
Section 101
//propsystemtextholder_80 (IntroLib_fla.propsystemtextholder_80)
package IntroLib_fla {
import flash.display.*;
public dynamic class propsystemtextholder_80 extends MovieClip {
public function propsystemtextholder_80(){
addFrameScript(0, frame1, 8, frame9, 18, frame19, 28, frame29, 38, frame39);
}
function frame1(){
stop();
}
function frame19(){
stop();
}
function frame9(){
stop();
}
function frame29(){
stop();
}
function frame39(){
stop();
}
}
}//package IntroLib_fla
Section 102
//racerrollover_70 (IntroLib_fla.racerrollover_70)
package IntroLib_fla {
import flash.display.*;
public dynamic class racerrollover_70 extends MovieClip {
public var panel:MovieClip;
public function racerrollover_70(){
addFrameScript(0, frame1, 1, frame2, 6, frame7);
}
function frame7(){
stop();
}
function frame1(){
stop();
visible = false;
}
function frame2(){
visible = true;
}
}
}//package IntroLib_fla
Section 103
//racerrolloverpanel_71 (IntroLib_fla.racerrolloverpanel_71)
package IntroLib_fla {
import flash.display.*;
public dynamic class racerrolloverpanel_71 extends MovieClip {
public var buttonRace:SimpleButton;
public var buttonCustomise:SimpleButton;
}
}//package IntroLib_fla
Section 104
//scorepanel_106 (IntroLib_fla.scorepanel_106)
package IntroLib_fla {
import flash.display.*;
import flash.text.*;
public dynamic class scorepanel_106 extends MovieClip {
public var bonusText:MovieClip;
public var textScore:TextField;
public function scorepanel_106(){
addFrameScript(0, frame1, 24, frame25, 74, frame75);
}
function frame75(){
stop();
}
function frame1(){
stop();
}
function frame25(){
stop();
}
}
}//package IntroLib_fla
Section 105
//selectorshell_17 (IntroLib_fla.selectorshell_17)
package IntroLib_fla {
import flash.display.*;
public dynamic class selectorshell_17 extends MovieClip {
public var proprollover:MovieClip;
public var buttonPropulsion02:SimpleButton;
public var buttonPropulsion03:SimpleButton;
public var levelselect:MovieClip;
public var buttonPropulsion01:SimpleButton;
public var rollover01:MovieClip;
public var rollover02:MovieClip;
public var buttonPropulsion04:SimpleButton;
public var rollover03:MovieClip;
public var colorpicker:MovieClip;
public var instructions:MovieClip;
public var car01:MovieClip;
public var car02:MovieClip;
public var car03:MovieClip;
public function selectorshell_17(){
addFrameScript(38, frame39, 78, frame79, 118, frame119, 159, frame160, 198, frame199, 238, frame239, 278, frame279, 319, frame320, 358, frame359, 398, frame399, 438, frame439, 479, frame480, 538, frame539, 578, frame579, 618, frame619, 658, frame659, 698, frame699, 738, frame739);
}
function frame399(){
stop();
}
function frame279(){
stop();
}
function frame439(){
stop();
}
function frame79(){
stop();
}
function frame160(){
stop();
TitleScreenState.CarGoneOut();
}
function frame320(){
stop();
TitleScreenState.CarGoneOut();
}
function frame699(){
stop();
}
function frame739(){
stop();
TitleScreenState.CarGoneOut();
}
function frame359(){
stop();
}
function frame619(){
stop();
}
function frame480(){
stop();
TitleScreenState.CarGoneOut();
}
function frame199(){
stop();
}
function frame239(){
stop();
}
function frame119(){
stop();
}
function frame39(){
stop();
}
function frame659(){
stop();
TitleScreenState.CarGoneOut();
}
function frame539(){
stop();
}
function frame579(){
stop();
TitleScreenState.CarGoneOut();
}
}
}//package IntroLib_fla
Section 106
//toasterrollover_76 (IntroLib_fla.toasterrollover_76)
package IntroLib_fla {
import flash.display.*;
public dynamic class toasterrollover_76 extends MovieClip {
public var panel:MovieClip;
public function toasterrollover_76(){
addFrameScript(0, frame1, 1, frame2, 6, frame7);
}
function frame7(){
stop();
}
function frame1(){
stop();
visible = false;
}
function frame2(){
visible = true;
}
}
}//package IntroLib_fla
Section 107
//toasterrolloverpanel_77 (IntroLib_fla.toasterrolloverpanel_77)
package IntroLib_fla {
import flash.display.*;
public dynamic class toasterrolloverpanel_77 extends MovieClip {
public var buttonRace:SimpleButton;
public var buttonCustomise:SimpleButton;
}
}//package IntroLib_fla
Section 108
//trackrollovers_29 (IntroLib_fla.trackrollovers_29)
package IntroLib_fla {
import flash.display.*;
public dynamic class trackrollovers_29 extends MovieClip {
public function trackrollovers_29(){
addFrameScript(0, frame1, 9, frame10, 18, frame19, 28, frame29, 38, frame39, 49, frame50);
}
function frame10(){
stop();
}
function frame1(){
stop();
}
function frame19(){
stop();
}
function frame29(){
stop();
}
function frame39(){
stop();
}
function frame50(){
stop();
}
}
}//package IntroLib_fla
Section 109
//FlashConnect (org.flashdevelop.utils.FlashConnect)
package org.flashdevelop.utils {
import flash.events.*;
import flash.xml.*;
import flash.utils.*;
import flash.net.*;
public class FlashConnect {
public static var onReturnData:Function;
public static var port:Number = 1978;
private static var interval:Number;
private static var messages:Array;
public static var onConnection:Function;
public static var host:String = "localhost";
public static var status:Number = 0;
private static var socket:XMLSocket;
public static var limit:Number = 1000;
private static var counter:Number;
private static function onIOError(_arg1:IOErrorEvent):void{
_slot1.status = -1;
if (_slot1.onConnection != null){
_slot1.onConnection();
};
}
public static function atrace(... _args):void{
var _local2:String = _args.join(",");
var _local3:XMLNode = createMsgNode(_local2, TraceLevel.DEBUG);
_slot1.send(_local3);
}
private static function createMsgNode(_arg1:String, _arg2:Number):XMLNode{
if (isNaN(_arg2)){
_arg2 = TraceLevel.DEBUG;
};
var _local3:XMLNode = new XMLNode(1, null);
var _local4:XMLNode = new XMLNode(3, encodeURI(_arg1));
_local3.attributes.state = _arg2.toString();
_local3.attributes.cmd = "trace";
_local3.nodeName = "message";
_local3.appendChild(_local4);
return (_local3);
}
public static function send(_arg1:XMLNode):void{
if (messages == null){
initialize();
};
messages.push(_arg1);
}
private static function onSecurityError(_arg1:SecurityErrorEvent):void{
_slot1.status = -1;
if (_slot1.onConnection != null){
_slot1.onConnection();
};
}
private static function onConnect(_arg1:Event):void{
_slot1.status = 1;
if (_slot1.onConnection != null){
_slot1.onConnection();
};
}
public static function trace(_arg1:Object, _arg2:Number=1):void{
var _local3:XMLNode = createMsgNode(_arg1.toString(), _arg2);
_slot1.send(_local3);
}
private static function initialize():void{
counter = 0;
messages = new Array();
socket = new XMLSocket();
socket.addEventListener(DataEvent.DATA, onData);
socket.addEventListener(Event.CONNECT, onConnect);
socket.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
interval = setInterval(sendStack, 50);
socket.connect(host, port);
}
private static function sendStack():void{
var _local1:XMLDocument;
var _local2:XMLNode;
var _local3:String;
var _local4:XMLNode;
var _local5:XMLNode;
if ((((messages.length > 0)) && ((status == 1)))){
_local1 = new XMLDocument();
_local2 = _local1.createElement("flashconnect");
while (messages.length != 0) {
counter++;
if (counter > limit){
clearInterval(interval);
_local3 = new String("FlashConnect aborted. You have reached the limit of maximum messages.");
_local4 = createMsgNode(_local3, TraceLevel.ERROR);
_local2.appendChild(_local4);
break;
} else {
_local5 = XMLNode(messages.shift());
_local2.appendChild(_local5);
};
};
_local1.appendChild(_local2);
socket.send(_local1);
};
}
private static function onData(_arg1:DataEvent):void{
_slot1.status = 1;
if (_slot1.onReturnData != null){
_slot1.onReturnData(_arg1.data);
};
}
public static function mtrace(_arg1:Object, _arg2:String, _arg3:String, _arg4:Number):void{
var _local5:String = _arg3.split("/").join("\\");
var _local6:String = ((((_local5 + ":") + _arg4) + ":") + _arg1);
_slot1.trace(_local6, TraceLevel.DEBUG);
}
}
}//package org.flashdevelop.utils
Section 110
//TraceLevel (org.flashdevelop.utils.TraceLevel)
package org.flashdevelop.utils {
public class TraceLevel {
public static const DEBUG:Number = 1;
public static const FATAL:Number = 4;
public static const WARNING:Number = 2;
public static const INFO:Number = 0;
public static const ERROR:Number = 3;
}
}//package org.flashdevelop.utils
Section 111
//percentclip_54 (WebbliRacersLibrary_Viral_fla.percentclip_54)
package WebbliRacersLibrary_Viral_fla {
import flash.display.*;
import flash.text.*;
public dynamic class percentclip_54 extends MovieClip {
public var percentText:TextField;
}
}//package WebbliRacersLibrary_Viral_fla
Section 112
//percentmoveclip_53 (WebbliRacersLibrary_Viral_fla.percentmoveclip_53)
package WebbliRacersLibrary_Viral_fla {
import flash.display.*;
public dynamic class percentmoveclip_53 extends MovieClip {
public var percent:MovieClip;
public function percentmoveclip_53(){
addFrameScript(0, frame1);
}
function frame1(){
TitleScreenState.SetPercent();
}
}
}//package WebbliRacersLibrary_Viral_fla
Section 113
//Achievement (Achievement)
package {
public class Achievement {
var passFunction:String;
var testFunction:String;
var name:String;
var passFunctionParams:String;
var testFunctionParams:String;
var complete:Boolean;
var wwID:int;
var description:String;
var levelID:int;
public function Achievement(){
wwID = 0;
name = "undefined";
description = "undefined";
complete = false;
testFunction = null;
passFunction = null;
passFunctionParams = null;
testFunctionParams = null;
levelID = -1;
}
}
}//package
Section 114
//achievementPanel (achievementPanel)
package {
import flash.display.*;
public dynamic class achievementPanel extends MovieClip {
public var panel:MovieClip;
public function achievementPanel(){
addFrameScript(94, frame95);
}
function frame95(){
stop();
}
}
}//package
Section 115
//Achievements (Achievements)
package {
import org.flashdevelop.utils.*;
public class Achievements {
var paramValues:Array;
public var achievementsAwardedThisTimeList:Array;
public var list:Array;
var paramNames:Array;
public function Achievements(){
list = new Array();
}
function AchTest_BestSkid():Boolean{
var _local1:int = GetParamInt("score");
trace(((("BestSkid: " + Game.playerBestLevelSkidScore) + " / ") + _local1));
if (Game.playerBestLevelSkidScore >= _local1){
return (true);
};
return (false);
}
function GetParamBool(_arg1:String, _arg2:Boolean=false):Boolean{
var _local4:String;
var _local3:int = paramNames.indexOf(_arg1);
if (_local3 != -1){
_local4 = paramValues[_local3];
if (_local4 == "true"){
return (true);
};
return (false);
};
return (_arg2);
}
function AchTest_OffTrack():Boolean{
if (Game.goneOffTrack == false){
return (true);
};
return (false);
}
function AchTest_AvoidGloop():Boolean{
if (Game.hitGloop == false){
return (true);
};
return (false);
}
function AchPass_UnlockVehicle():void{
trace((" unlocked vehicle " + GetParamInt("unlockvehicle")));
}
function AchTest_FinishInPlace():Boolean{
var _local1:int = (GetParamInt("place") - 1);
var _local2:* = Game.GetPlaceByCarIndex(Game.playerCarIndex);
trace(((("player Place = " + _local2) + " / ") + _local1));
if (_local2 == _local1){
return (true);
};
return (false);
}
function LoadAchievement(_arg1:int){
var _local3:Achievement;
var _local2:XML = ExternalData.xml;
_local2 = _local2.achievements.achievement[_arg1];
_local3 = new Achievement();
_local3.levelID = XmlHelper.GetAttrInt(_local2.@level, 0);
_local3.name = XmlHelper.GetAttrString(_local2.@name, "undefined");
_local3.description = XmlHelper.GetAttrString(_local2.@desc, "undefined");
_local3.wwID = XmlHelper.GetAttrInt(_local2.@wwid, 0);
_local3.testFunction = XmlHelper.GetAttrString(_local2.testfunction.@name, "undefined");
_local3.testFunctionParams = XmlHelper.GetAttrString(_local2.testfunction.@vars, "undefined");
_local3.passFunction = XmlHelper.GetAttrString(_local2.passfunction.@name, "undefined");
_local3.passFunctionParams = XmlHelper.GetAttrString(_local2.passfunction.@vars, "undefined");
list.push(_local3);
}
function LoadAchievements():void{
list = new Array();
var _local1:XML = ExternalData.xml;
var _local2:* = _local1.achievements.achievement.length();
var _local3:int;
while (_local3 < _local2) {
LoadAchievement(_local3);
VerifyAchievement(_local3);
_local3++;
};
InitFromWW();
}
function AchTest_HitEveryTurboOnEveryLap():Boolean{
if (Game.HitEveryTurboOnEachLap()){
return (true);
};
return (false);
}
public function InitOnce():void{
LoadAchievements();
}
function AchTest_AvoidAllCars():Boolean{
if (Game.numCarCollisions == 0){
return (true);
};
return (false);
}
function AchTest_HitAllCones():Boolean{
trace(((("AchTest_HitAllCones: " + Game.numConesHit) + " / ") + Game.totalCones));
if (Game.numConesHit >= Game.totalCones){
return (true);
};
return (false);
}
public function TestAll(){
var _local1:Achievement;
var _local2:int;
var _local3:Boolean;
achievementsAwardedThisTimeList = new Array();
for each (_local1 in list) {
if (_local1.levelID == Game.currentLevel){
_local2 = _local1.wwID;
if (_local1.complete == false){
GetParams(_local1.testFunctionParams);
_local3 = this[_local1.testFunction]();
if (_local3){
achievementsAwardedThisTimeList.push(_local1);
_local1.complete = true;
FlashConnect.trace(((("awarding ach " + _local1.wwID) + " ") + _local1.name));
if (WWorld.IsActive()){
webbliWorldGameAPI.awardAchievement(_local2);
};
};
};
};
};
}
function AchPass_UnlockLevel():void{
trace((" unlocked level " + GetParamInt("unlocklevel")));
}
function AchTest_FinishInTime():Boolean{
var _local1:int = (GetParamNumber("time") * Defs.fps);
var _local2:* = Game.playerFinishedTime;
if (_local2 <= _local1){
return (true);
};
return (false);
}
public function InitFromWW(){
var _local1:Achievement;
var _local2:int;
if (WWorld.IsActive() == false){
return;
};
for each (_local1 in list) {
_local2 = _local1.wwID;
_local1.name = webbliWorldGameAPI.getAchievementTitle(_local2);
_local1.description = webbliWorldGameAPI.getAchievementDescription(_local2);
_local1.complete = webbliWorldGameAPI.playerHasAchievement(_local2);
};
}
function GetParams(_arg1:String):void{
var _local3:String;
var _local4:Array;
paramNames = new Array();
paramValues = new Array();
_arg1 = Utils.RemoveWhiteSpace(_arg1);
_arg1 = _arg1.toLowerCase();
var _local2:Array = _arg1.split(",");
for each (_local3 in _local2) {
_local4 = _local3.split("=");
paramNames.push(_local4[0]);
paramValues.push(_local4[1]);
};
}
public function VerifyAchievement(_arg1:int){
var ach:Achievement;
var tempFunction:Function;
var achIndex = _arg1;
ach = list[achIndex];
try {
tempFunction = this[ach.testFunction];
} catch(err:Error) {
trace(((("ERROR: Achievement " + achIndex) + ". Complete Function Doesn't exist: ") + ach.testFunction));
};
try {
tempFunction = this[ach.passFunction];
} catch(err:Error) {
trace(((("ERROR: Achievement " + achIndex) + ". Pass Function Doesn't exist: ") + ach.passFunction));
};
}
function GetParamNumber(_arg1:String, _arg2:Number=0):Number{
var _local3:int = paramNames.indexOf(_arg1);
if (_local3 != -1){
return (Number(paramValues[_local3]));
};
return (_arg2);
}
function AchTest_CollectAllCoins():Boolean{
trace(((("AchTest_CollectAllCoins " + Game.numPickupsCollected) + " / ") + Game.numPickups));
if (Game.numPickupsCollected >= Game.numPickups){
return (true);
};
return (false);
}
function AchTest_Skid():Boolean{
var _local1:int = GetParamInt("score");
if (Game.levscore_skids >= _local1){
return (true);
};
return (false);
}
function AchPass_Points():void{
trace((" added points " + GetParamInt("unlockpoints")));
}
function AchTest_AvoidAllCones():Boolean{
if (Game.numConesHit == 0){
return (true);
};
return (false);
}
function AchTest_FinishInPlaceWithVehicle():Boolean{
trace(("selected car " + Game.selectedCarType));
var _local1:int = GetParamInt("vehicle");
if (Game.selectedCarType != _local1){
return (false);
};
var _local2:int = (GetParamInt("place") - 1);
var _local3:* = Game.GetPlaceByCarIndex(Game.playerCarIndex);
trace(((("player Place = " + _local3) + " / ") + _local2));
if (_local3 == _local2){
return (true);
};
return (false);
}
public function GetNumUnlocked():int{
var _local2:Achievement;
var _local1:int;
for each (_local2 in list) {
if (_local2.complete){
_local1++;
};
};
return (_local1);
}
public function GetThisLevelAchievements(_arg1:int):Array{
var _local3:Achievement;
var _local2:Array = new Array();
for each (_local3 in list) {
if (_local3.levelID == _arg1){
_local2.push(_local3);
};
};
return (_local2);
}
function GetParam(_arg1:String, _arg2:String=""):String{
var _local3:int = paramNames.indexOf(_arg1);
if (_local3 != -1){
return (paramValues[_local3]);
};
return (_arg2);
}
function GetParamInt(_arg1:String, _arg2:int=0):int{
var _local3:int = paramNames.indexOf(_arg1);
if (_local3 != -1){
return (int(paramValues[_local3]));
};
return (_arg2);
}
function AchTest_HitEveryJump():Boolean{
if (Game.HitEveryJumpOnEachLap()){
return (true);
};
return (false);
}
function AchTest_CollectAll():Boolean{
if (Game.numPickupsCollected >= Game.numPickups){
return (true);
};
return (false);
}
}
}//package
Section 116
//arrow_clip (arrow_clip)
package {
import flash.display.*;
public dynamic class arrow_clip extends MovieClip {
}
}//package
Section 117
//BackgroundLevel01 (BackgroundLevel01)
package {
import flash.display.*;
public dynamic class BackgroundLevel01 extends MovieClip {
}
}//package
Section 118
//BackgroundLevel01_Collision (BackgroundLevel01_Collision)
package {
import flash.display.*;
public dynamic class BackgroundLevel01_Collision extends MovieClip {
}
}//package
Section 119
//BackgroundLevel02 (BackgroundLevel02)
package {
import flash.display.*;
public dynamic class BackgroundLevel02 extends MovieClip {
}
}//package
Section 120
//BackgroundLevel02_Collision (BackgroundLevel02_Collision)
package {
import flash.display.*;
public dynamic class BackgroundLevel02_Collision extends MovieClip {
}
}//package
Section 121
//Bonus (Bonus)
package {
public class Bonus {
var points:int;
var type:int;
var name:String;
public function Bonus(_arg1:String, _arg2:int, _arg3:int=0){
name = _arg1;
points = _arg2;
type = _arg3;
}
}
}//package
Section 122
//CantPlayScreen (CantPlayScreen)
package {
import flash.display.*;
public dynamic class CantPlayScreen extends MovieClip {
}
}//package
Section 123
//Car01 (Car01)
package {
import flash.display.*;
public dynamic class Car01 extends MovieClip {
}
}//package
Section 124
//Car02 (Car02)
package {
import flash.display.*;
public dynamic class Car02 extends MovieClip {
}
}//package
Section 125
//Car03 (Car03)
package {
import flash.display.*;
public dynamic class Car03 extends MovieClip {
}
}//package
Section 126
//characterpopup (characterpopup)
package {
import flash.display.*;
import flash.text.*;
public dynamic class characterpopup extends MovieClip {
public var buttonWebbliWorld:SimpleButton;
public var textA:TextField;
public function characterpopup(){
addFrameScript(0, frame1, 19, frame20, 29, frame30);
}
function frame1(){
textA.visible = false;
buttonWebbliWorld.visible = false;
}
function frame20(){
textA.visible = true;
buttonWebbliWorld.visible = true;
}
function frame30(){
stop();
}
}
}//package
Section 127
//ColorPickerClip (ColorPickerClip)
package {
import flash.display.*;
public dynamic class ColorPickerClip extends MovieClip {
}
}//package
Section 128
//cone_clip (cone_clip)
package {
import flash.display.*;
public dynamic class cone_clip extends MovieClip {
}
}//package
Section 129
//ConeHitClip (ConeHitClip)
package {
import flash.display.*;
public dynamic class ConeHitClip extends MovieClip {
}
}//package
Section 130
//ContactListener (ContactListener)
package {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class ContactListener extends b2ContactListener {
override public function Add(_arg1:b2ContactPoint):void{
var _local2:GameObj;
var _local3:PhysObj_Instance;
var _local4:b2Body = _arg1.shape1.GetBody();
var _local5:PhysObj_BodyUserData = _local4.GetUserData();
var _local6:b2Body = _arg1.shape2.GetBody();
var _local7:PhysObj_BodyUserData = _local6.GetUserData();
var _local8:b2Vec2 = new b2Vec2(0, 0);
Game.numCollisionTests++;
if (((_local5.type.match("vehicle")) && ((_local7.type == "playervehicle")))){
_local7.instance.PlayerHitVehicle();
};
if (((_local7.type.match("vehicle")) && ((_local5.type == "playervehicle")))){
_local5.instance.PlayerHitVehicle();
};
if ((((_local5.type == "pickup01")) && ((_local7.type == "playervehicle")))){
_local5.instance.PickupHit();
};
if ((((_local7.type == "pickup01")) && ((_local5.type == "playervehicle")))){
_local7.instance.PickupHit();
};
if ((((_local5.type == "turbopickup")) && ((_local7.type == "playervehicle")))){
if (_local5.instance.TurboPickupHit()){
_local7.instance.PlayerCarHitTurbo(_local5.instance);
};
};
if ((((_local7.type == "turbopickup")) && ((_local5.type == "playervehicle")))){
if (_local7.instance.TurboPickupHit()){
_local5.instance.PlayerCarHitTurbo(_local7.instance);
};
};
if ((((_local5.bodyName == "checkpoint")) && (_local7.type.match("vehicle")))){
_local7.instance.CarEnteredCheckpoint(_local5.id);
};
if ((((_local7.bodyName == "checkpoint")) && (_local5.type.match("vehicle")))){
_local5.instance.CarEnteredCheckpoint(_local7.id);
};
if ((((_local5.type == "mushroom")) && (_local7.type.match("vehicle")))){
_local5.instance.ConeHit(_local7.instance);
};
if ((((_local7.type == "mushroom")) && (_local5.type.match("vehicle")))){
_local7.instance.ConeHit(_local5.instance);
};
if ((((_local5.type == "cone")) && (_local7.type.match("vehicle")))){
_local5.instance.ConeHit(_local7.instance);
};
if ((((_local7.type == "cone")) && (_local5.type.match("vehicle")))){
_local7.instance.ConeHit(_local5.instance);
};
if ((((_local5.type == "mallow")) && (_local7.type.match("vehicle")))){
_local5.instance.ConeHit(_local7.instance);
};
if ((((_local7.type == "mallow")) && (_local5.type.match("vehicle")))){
_local7.instance.ConeHit(_local5.instance);
};
if ((((_local5.type == "icecream")) && (_local7.type.match("vehicle")))){
_local5.instance.ConeHit(_local7.instance);
};
if ((((_local7.type == "icecream")) && (_local5.type.match("vehicle")))){
_local7.instance.ConeHit(_local5.instance);
};
if ((((_local5.bodyName == "hump")) && (_local7.type.match("vehicle")))){
_local7.instance.DoHump();
};
if ((((_local7.bodyName == "hump")) && (_local5.type.match("vehicle")))){
_local5.instance.DoHump();
};
if ((((_local5.bodyName == "gloop")) && (_local7.type.match("playervehicle")))){
_local7.instance.DoGloop(_local5.id);
};
if ((((_local7.bodyName == "gloop")) && (_local5.type.match("playervehicle")))){
_local5.instance.DoGloop(_local7.id);
};
if ((((_local5.bodyName == "arrow")) && ((_local7.type == "playervehicle")))){
_local7.instance.DoArrow();
};
if ((((_local7.bodyName == "arrow")) && ((_local5.type == "playervehicle")))){
_local5.instance.DoArrow();
};
if ((((_local5.bodyName == "bridge")) && ((_local7.type == "playervehicle")))){
_local7.instance.OnBridge();
};
if ((((_local7.bodyName == "bridge")) && ((_local5.type == "playervehicle")))){
_local5.instance.OnBridge();
};
if ((((_local5.bodyName == "ramp")) && (_local7.type.match("vehicle")))){
_local7.instance.DoJump(_local5.id);
};
if ((((_local7.bodyName == "ramp")) && (_local5.type.match("vehicle")))){
_local5.instance.DoJump(_local7.id);
};
}
override public function Persist(_arg1:b2ContactPoint):void{
var _local2:GameObj;
var _local3:PhysObj_Instance;
var _local4:b2Body = _arg1.shape1.GetBody();
var _local5:PhysObj_BodyUserData = _local4.GetUserData();
var _local6:b2Body = _arg1.shape2.GetBody();
var _local7:PhysObj_BodyUserData = _local6.GetUserData();
if ((((_local5.bodyName == "bridge")) && ((_local7.type == "playervehicle")))){
_local7.instance.OnBridge();
};
if ((((_local7.bodyName == "bridge")) && ((_local5.type == "playervehicle")))){
_local5.instance.OnBridge();
};
}
}
}//package
Section 131
//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 _local3:int;
var _local4:uint;
var _local5:Line;
var _local6:Line;
var _local8:Poly;
return;
}
public static function RenderPlayerInfo(){
var _local1:String;
}
}
}//package
Section 132
//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 = 480;
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 133
//DisplayObj (DisplayObj)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.text.*;
public class DisplayObj {
var frames:Array;
var flags:int;
public var frame:int;
public function DisplayObj(_arg1:MovieClip, _arg2:Number, _arg3:int):void{
flags = _arg3;
frame = 0;
if (_arg1 != null){
CreateBitmapsFromMovieClip(_arg1, flags);
};
}
public function GetHeight():Number{
return (frames[frame].bitmap.height);
}
function CreateAsciiStringTable():Array{
var _local1:Array = 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_Sheet(_arg1:MovieClip, _arg2:int):void{
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Matrix;
var _local11:Rectangle;
var _local12:Bitmap;
var _local13:BitmapData;
var _local14:Bitmap;
var _local15:BitmapData;
var _local20:*;
var _local3:Boolean;
var _local4:Boolean;
var _local5:Boolean;
frames = new Array();
_arg1.gotoAndStop(1);
_local11 = _arg1.getBounds(null);
_local11.x = Math.floor(_local11.x);
_local11.y = Math.floor(_local11.y);
_local11.width = Math.ceil(_local11.width);
_local11.height = Math.ceil(_local11.height);
_local9 = Math.floor(_local9);
_local10 = new Matrix();
_local8 = _local11.left;
_local9 = _local11.top;
_local10.translate(-(_local8), -(_local9));
var _local16:int;
var _local17:int;
var _local18 = 14;
var _local19 = 14;
if (_arg2 == 11){
_local18 = 8;
_local19 = 8;
};
_local13 = new BitmapData((_local18 * 100), (_local19 * 100), true, 0);
_local6 = 0;
while (_local6 < _arg1.totalFrames) {
_local20 = new DisplayObjFrame();
_local20.mat = new Matrix();
_local20.colTrans = new ColorTransform();
_local20.xoffset = (Number(_local8) - (_local16 * 100));
_local20.yoffset = (Number(_local9) - (_local17 * 100));
_local20.sourceRect = new Rectangle(0, 0, 100, 100);
_local10.identity();
_local10.translate((_local16 * 100), (_local17 * 100));
_local8 = _local11.left;
_local9 = _local11.top;
_local10.translate(-(_local8), -(_local9));
_local13.draw(_arg1, _local10);
_local20.bitmapData = _local13;
frames.push(_local20);
_arg1.nextFrame();
_local16++;
if (_local16 >= _local18){
_local17++;
_local16 = 0;
};
_local6++;
};
}
public function GetFrameWidth(_arg1:int):Number{
return (frames[_arg1].bitmap.width);
}
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 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 _local11:TextField;
var _local12:*;
frames = new Array();
var _local10:Array = 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.mat = new Matrix();
_local12.colTrans = new ColorTransform();
_local7 = _local11.getBounds(null);
_local6 = new Matrix();
_local6.translate(-(_local7.x), -(_local7.y));
_local12.xoffset = 0;
_local12.yoffset = 0;
_local9 = new BitmapData(_local7.width, _local7.height, true, 0);
_local9.draw(_local11, _local6, null, null, null, true);
_local12.bitmapData = _local9;
frames.push(_local12);
_local2++;
};
}
public function GetMaxFrames():int{
return (frames.length);
}
public function CreateBitmapsFromMovieClip(_arg1:MovieClip, _arg2:int):void{
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Matrix;
var _local11:Rectangle;
var _local12:BitmapData;
var _local16:*;
var _local3:Boolean;
var _local4:Boolean;
var _local5:Boolean;
if ((((_arg2 == 10)) || ((_arg2 == 11)))){
CreateBitmapsFromMovieClip_Sheet(_arg1, _arg2);
return;
};
if (_arg2 == 99){
_local5 = true;
_arg2 = 0;
};
frames = new Array();
_arg1.gotoAndStop(1);
var _local13 = 32;
B = new Bitmap();
_local10 = new Matrix();
var _local14:Matrix = new Matrix();
var _local15:ColorTransform = new ColorTransform();
_local6 = 0;
while (_local6 < _arg1.totalFrames) {
_local16 = new DisplayObjFrame();
_local16.mat = new Matrix();
_local16.colTrans = new ColorTransform();
_local11 = _arg1.getBounds(null);
_local11.x = Math.floor(_local11.x);
_local11.y = Math.floor(_local11.y);
_local11.width = Math.ceil(_local11.width);
_local11.height = Math.ceil(_local11.height);
_local9 = Math.floor(_local9);
_local10.identity();
_local8 = _local11.left;
_local9 = _local11.top;
_local10.translate(-(_local8), -(_local9));
_local16.xoffset = Number(_local8);
_local16.yoffset = Number(_local9);
if (((!((_arg1.width == 0))) && (!((_arg1.height == 0))))){
_local12 = new BitmapData(_local11.width, _local11.height, true, 0);
_local12.draw(_arg1, _local10);
_local16.bitmapData = _local12;
} else {
_local16.bitmapData = null;
};
frames.push(_local16);
_arg1.nextFrame();
_local6++;
};
}
public function GetYOffset():Number{
return (frames[frame].yoffset);
}
public function GetFrame():int{
return (frame);
}
public function GetXOffset():Number{
return (frames[frame].xoffset);
}
public function GetWidth():Number{
return (frames[frame].bitmap.width);
}
}
}//package
import flash.events.*;
import flash.display.*;
import flash.geom.*;
class DisplayObjFrame {
public var mat:Matrix;
public var colTrans:ColorTransform;
public var xoffset:Number;
public var yoffset:Number;
public var bitmapData:BitmapData;
public var sourceRect:Rectangle;// = null
private function DisplayObjFrame(){
}
public function RenderAt(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
_arg1.copyPixels(bitmapData, new Rectangle(0, 0, bitmapData.width, bitmapData.height), new Point((_arg2 + xoffset), (_arg3 + yoffset)), null, null, true);
}
public function RenderAtRotScaled(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=0, _arg7:ColorTransform=null, _arg8:Boolean=false):void{
mat.identity();
mat.translate(xoffset, yoffset);
mat.rotate(_arg6);
mat.translate(-(xoffset), -(yoffset));
mat.scale(_arg5, _arg5);
mat.translate((_arg2 + (xoffset * _arg5)), (_arg3 + (yoffset * _arg5)));
_arg1.draw(bitmapData, mat, _arg7, null, null, _arg8);
}
public function RenderAtColTrans(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:ColorTransform, _arg5:Boolean=false):void{
mat.identity();
mat.translate((_arg2 + xoffset), (_arg3 + yoffset));
_arg1.draw(bitmap.bitmapData, mat, _arg4);
}
public function RenderAtAlpha(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
mat.identity();
mat.translate((_arg2 + xoffset), (_arg3 + yoffset));
colTrans.alphaMultiplier = _arg4;
_arg1.draw(bitmapData, mat, colTrans);
}
public function RenderAtRotScaled_SourceRect(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=0, _arg7:ColorTransform=null, _arg8:Boolean=false, _arg9:Rectangle=null, _arg10:int=0, _arg11:int=0):void{
mat.identity();
mat.translate(xoffset, yoffset);
mat.rotate(_arg6);
mat.translate(-(xoffset), -(yoffset));
mat.scale(_arg5, _arg5);
mat.translate((_arg2 + ((xoffset - _arg10) * _arg5)), (_arg3 + ((yoffset - _arg11) * _arg5)));
_arg9.x = _arg2;
_arg9.y = _arg3;
_arg1.draw(bitmapData, mat, _arg7, null, _arg9, _arg8);
}
}
Section 134
//Domain (Domain)
package {
public class Domain {
public static function GetDomain(_arg1:Object):String{
var _local2:String = _arg1.loaderInfo.url;
var _local3:Number = (_local2.indexOf("://") + 3);
var _local4:Number = _local2.indexOf("/", _local3);
var _local5:String = _local2.substring(_local3, _local4);
var _local6:Number = (_local5.lastIndexOf(".") - 1);
var _local7:Number = (_local5.lastIndexOf(".", _local6) + 1);
_local5 = _local5.substring(_local7, _local5.length);
return (_local5);
}
public static function IsLockedOut():Boolean{
var _local1:String = GetDomain(Main.theStage);
if (((!((_local1 == "flashgamelicense.com"))) && (!((_local1 == "longanimalsgames.com"))))){
return (true);
};
return (false);
}
}
}//package
Section 135
//ExternalData (ExternalData)
package {
import flash.events.*;
import flash.net.*;
import flash.system.*;
public class ExternalData {
static var xmlLoader:URLLoader;
public static var constants:Object;
public static var xml:XML;
static var xxx:XML = <data>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsCamperBase.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsCamperBaseCamperBase_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsCamperDetails.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsCamperDetailsCamperDetails_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsCamperEngineBattery.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsCamperEngineBatteryCamperEngineBattery_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsCamperEngineFlower.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsCamperEngineFlowerCamperEngineFlower_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsCamperEngineHorns.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsCamperEngineHornsCamperEngineHorns_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsCamperEngineSpoiler.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsCamperEngineSpoilerCamperEngineSpoiler_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsCamperShadow.png" cellsw="8" cellsh="8" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsCamperShadowCamperShadow_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsRacerBase.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsRacerBaseRacer_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsRacerDetails.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsRacerDetailsRacerDetails_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsRacerEngineBattery.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsRacerEngineBatteryRacerEngineBattery_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsRacerEngineFlower.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsRacerEngineFlowerRacerEngineFlower_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsRacerEngineHorns.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsRacerEngineHornsRacerEngineHorns_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsRacerEngineSpoiler.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsRacerEngineSpoilerRacerEngineSpoiler_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsRacerShadow.png" cellsw="8" cellsh="8" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsRacerShadowRacerShadow_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsToastBase.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsToastBaseToastBase_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsToastDetails.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsToastDetailsToastDetails_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsToastEngineBattery.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsToastEngineBatteryToastEngineBattery_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsToastEngineFlower.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsToastEngineFlowerToastEngineFlower_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsToastEngineHorns.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsToastEngineHornsToastEngineHorns_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsToastEngineSpoiler.png" cellsw="14" cellsh="14" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsToastEngineSpoilerToastEngineSpoiler_"/>
</spritesheet>
<spritesheet name="C:FlashWebbliRacersAardmanCarsCarsToastShadow.png" cellsw="8" cellsh="8" cellw="100" cellh="100">
<filelist name="C:FlashWebbliRacersAardmanCarsCarsToastShadowToastShadow_"/>
</spritesheet>
<constants>
<constant name="hoseangdamp" value="0"/>
<constant name="hoselindamp" value="0"/>
<constant name="hoselowerang" value="-7"/>
<constant name="hoseupperang" value="7"/>
<constant name="hosedensity" value="0.4"/>
</constants>
<gameconstants>
<constant name="swingdist" value="30"/>
<constant name="swingforce" value="4"/>
<constant name="swingreleaseforce" value="0.2"/>
</gameconstants>
<!--
SWITCHES
type =
once
timed
time=x (seconds)
2way
CANNON
mode = static (only option available at the moment)
switch = name of switch. empty string for no switch.
minang = minimum angle in degrees
maxang = maximum angle in degrees
speed = speed of rotation between angles.
PATHBLOCK
line = name of line (empty for no line)
speed = speed of movement along line
loop = true / false
switch = name of switch. empty string for no switch.
endreset = true / false
2way = true / false. Set to true if switch reverses movement along line.
LINES:
type = 0 : normal filled in polygon. (don't join up the ends)
type = 1 : path lines (2 points or more are needed)
type = 2 : path spline (4 points or more are needed)
MAGNET
polarity = true/false - starting polarity
mode=
static (default)
timed
time=x (seconds)
switch
switch=switchname
-->
<!-- *************************************************************************************** -->
<!-- START OF EASY LEVELS -->
<!-- *************************************************************************************** -->
<level name="Level01" category="0" fillframe="13" surfaceframe="5" surfacethickness="10" type="none" opponents="" win="1" exclusivechar="1">
<times gold="10" silver="20"/>
<obj type="startpos" x="1857" y="1932" rot="0" params=""/>
<obj type="cone" x="2192" y="1061" rot="0" params=""/>
<obj type="cone" x="2220" y="1118" rot="0" params=""/>
<obj type="cone" x="2187" y="1170" rot="0" params=""/>
<obj type="cone" x="2107" y="1186" rot="0" params=""/>
<obj type="cone" x="2039" y="1175" rot="0" params=""/>
<obj type="lev01_overlay01" x="662" y="1240" rot="0" params=""/>
<obj type="lev01_overlay02" x="1529" y="736" rot="0" params=""/>
<obj type="lev01_overlay03" x="1765" y="889" rot="0" params=""/>
<obj type="lev01_overlay04" x="1985" y="996" rot="0" params=""/>
<obj type="lev01_overlay05" x="1673" y="1456" rot="0" params=""/>
<obj type="lev01_overlay06" x="2137" y="1436" rot="0" params=""/>
<obj type="lev01_overlay07" x="557" y="1708" rot="0" params=""/>
<obj type="pickup01" x="1203" y="646" rot="0" params=""/>
<obj type="pickup01" x="1279" y="596" rot="0" params=""/>
<obj type="pickup01" x="1388" y="551" rot="0" params=""/>
<obj type="pickup01" x="1498" y="537" rot="0" params=""/>
<obj type="pickup01" x="2319" y="1113" rot="0" params=""/>
<obj type="pickup01" x="2392" y="1108" rot="0" params=""/>
<obj type="pickup01" x="2460" y="1105" rot="0" params=""/>
<obj type="pickup01" x="1780" y="1227" rot="0" params=""/>
<obj type="pickup01" x="1560" y="1238" rot="0" params=""/>
<obj type="pickup01" x="1679" y="1210" rot="0" params=""/>
<obj type="pickup01" x="1470" y="1296" rot="0" params=""/>
<obj type="pickup01" x="1013" y="1696" rot="0" params=""/>
<obj type="pickup01" x="895" y="1696" rot="0" params=""/>
<obj type="pickup01" x="783" y="1690" rot="0" params=""/>
<obj type="pickup01" x="311" y="1262" rot="0" params=""/>
<obj type="pickup01" x="418" y="1196" rot="0" params=""/>
<obj type="pickup01" x="542" y="1154" rot="0" params=""/>
<obj type="pickup01" x="479" y="1171" rot="0" params=""/>
<obj type="pickup01" x="366" y="1226" rot="0" params=""/>
<obj type="pickup01" x="1326" y="842" rot="0" params=""/>
<obj type="pickup01" x="1450" y="880" rot="0" params=""/>
<obj type="pickup01" x="1575" y="874" rot="0" params=""/>
<obj type="pickup01" x="1680" y="830" rot="0" params=""/>
<obj type="playervehicle" x="553" y="1016" rot="0" params=""/>
<obj type="aivehicle" x="637" y="962" rot="0" params=""/>
<obj type="aivehicle" x="688" y="998" rot="0" params=""/>
<obj type="aivehicle" x="730" y="1033" rot="0" params=""/>
<obj type="aivehicle" x="642" y="1066" rot="0" params=""/>
<obj type="aivehicle" x="600" y="1036" rot="0" params=""/>
<obj type="turbopickup" x="2209" y="904" rot="0" params=""/>
<obj type="turbopickup" x="1530" y="1207" rot="0" params=""/>
<obj type="turbopickup" x="383" y="1151" rot="0" params=""/>
<obj type="cone" x="1175" y="845" rot="0" params=""/>
<obj type="cone" x="1230" y="818" rot="0" params=""/>
<obj type="cone" x="1268" y="799" rot="0" params=""/>
<obj type="cone" x="1769" y="811" rot="0" params=""/>
<obj type="cone" x="1805" y="835" rot="0" params=""/>
<obj type="cone" x="1930" y="1374" rot="0" params=""/>
<obj type="cone" x="1879" y="1356" rot="0" params=""/>
<obj type="cone" x="1825" y="1337" rot="0" params=""/>
<obj type="cone" x="1773" y="1317" rot="0" params=""/>
<obj type="cone" x="1723" y="1305" rot="0" params=""/>
<obj type="lev01_overlay08" x="630" y="909" rot="0" params=""/>
<obj type="lev01_overlay09" x="843" y="1037" rot="0" params=""/>
<obj type="pickup01" x="647" y="1490" rot="0" params=""/>
<obj type="pickup01" x="707" y="1513" rot="0" params=""/>
<obj type="cone" x="775" y="1532" rot="0" params=""/>
<line type="0" name="" fill="0" fillscale="1">
<points a="707,829, 1056,619, 1226,517, 1305,485, 1378,466, 1454,457, 1529,455, 1595,460, 1677,476, 1737,496"/>
<points a="1813,535, 2003,649, 2210,775, 2449,919, 2514,968, 2551,1013, 2573,1066, 2580,1114, 2573,1159, 2557,1209"/>
<points a="2524,1252, 2484,1286, 2429,1325, 2370,1355, 2296,1380, 2224,1396, 2148,1405, 2072,1406, 1993,1397, 1926,1390"/>
<points a="1833,1389, 1766,1395, 1669,1416, 1598,1445, 1539,1477, 1496,1512, 1444,1557, 1391,1592, 1328,1623, 1256,1652"/>
<points a="1185,1675, 1094,1693, 1014,1703, 940,1707, 855,1705, 760,1698, 681,1684, 610,1667, 523,1635, 429,1590"/>
<points a="344,1533, 281,1469, 246,1411, 225,1351, 222,1284, 228,1231, 251,1168, 279,1123, 325,1073, 383,1024"/>
<points a="446,986, 525,939, 627,877"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="806,1078, 921,1010, 1037,941, 1127,888, 1177,860, 1202,852, 1239,847, 1283,849, 1322,859, 1365,884"/>
<points a="1412,901, 1485,911, 1569,907, 1626,890, 1677,863, 1717,851, 1776,846, 1828,858, 1873,882, 1934,918"/>
<points a="2069,1000, 2097,1021, 2112,1052, 2108,1077, 2091,1100, 2057,1120, 2018,1134, 1962,1135, 1895,1121, 1808,1103"/>
<points a="1721,1099, 1643,1101, 1547,1113, 1451,1141, 1376,1176, 1311,1222, 1270,1264, 1239,1318, 1228,1352, 1203,1387"/>
<points a="1171,1415, 1116,1450, 1050,1474, 980,1487, 925,1520, 877,1522, 799,1480, 749,1467, 695,1445, 637,1406"/>
<points a="600,1362, 580,1312, 586,1263, 609,1212, 650,1173, 710,1136, 765,1103"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1355,749, 1401,727, 1446,718, 1496,711, 1547,715, 1590,724, 1629,736, 1655,752, 1684,769, 1703,781"/>
<points a="1702,791, 1664,800, 1629,814, 1593,831, 1554,846, 1502,853, 1457,847, 1409,830, 1376,812, 1328,797"/>
<points a="1308,793, 1302,781, 1333,763"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="704,909, 1078,674, 1306,549, 1570,517, 1817,631, 2388,990, 2382,1212, 2259,1311, 1947,1303, 1663,1251"/>
<points a="1455,1380, 1207,1594, 851,1635, 525,1551, 330,1386, 373,1151, 604,976"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="736,930, 1157,670, 1360,564, 1574,547, 1822,675, 2166,883, 2376,1022, 2369,1192, 2251,1268, 1931,1261"/>
<points a="1612,1233, 1436,1334, 1316,1488, 1131,1578, 840,1600, 519,1481, 386,1288, 448,1128, 645,997"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="770,956, 1127,742, 1440,585, 1664,623, 1891,762, 2268,986, 2327,1138, 2240,1257, 1938,1232, 1607,1199"/>
<points a="1377,1363, 1140,1560, 804,1558, 538,1467, 439,1245, 564,1091, 682,1011"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="796,1001, 1036,841, 1210,819, 1404,858, 1582,864, 1705,819, 1826,815, 2008,855, 2226,1006, 2198,1158"/>
<points a="1985,1209, 1737,1169, 1497,1202, 1282,1410, 1041,1536, 724,1520, 511,1361, 556,1132, 726,1024"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="1685,751, 1798,685, 1850,719, 1738,784"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="2035,811, 2149,743, 2200,776, 2089,842"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="2269,1193, 2389,1264, 2336,1295, 2223,1232"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="1233,1460, 1350,1528, 1296,1562, 1182,1496"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="609,874, 891,1044"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="865,713, 1124,908"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1144,527, 1315,867"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1507,435, 1506,926"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1815,493, 1682,881"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2117,690, 1847,882"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2318,824, 2036,997"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2540,974, 2091,1049"/>
</line>
<line type="2" name="1" fill="0" fillscale="1">
<points a="2513,1278, 2071,1092"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2037,1424, 2004,1120"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1734,1425, 1684,1082"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1505,1524, 1277,1236"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1232,1680, 1081,1439"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="827,1729, 848,1471"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="499,1645, 678,1418"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="268,1487, 601,1340"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="216,1200, 605,1242"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="434,968, 726,1146"/>
</line>
<line type="0" name="tyre" fill="0" fillscale="1">
<points a="667,857, 657,904, 637,917, 560,911, 662,849"/>
</line>
<line type="0" name="tyre" fill="0" fillscale="1">
<points a="809,1083, 815,1023, 844,1008, 916,1023, 846,1080"/>
</line>
</level>
<level name="Level02" category="0" fillframe="13" surfaceframe="5" surfacethickness="10" type="none" opponents="" win="1" exclusivechar="1">
<times gold="10" silver="20"/>
<obj type="lev02_overlay01" x="1446" y="1473" rot="0" params=""/>
<obj type="lev02_overlay02" x="1842" y="564" rot="0" params=""/>
<obj type="lev02_overlay03" x="2130" y="673" rot="0" params=""/>
<obj type="lev02_overlay04" x="2402" y="685" rot="0" params=""/>
<obj type="lev02_overlay05" x="2722" y="972" rot="0" params=""/>
<obj type="lev02_overlay06" x="2098" y="1208" rot="0" params=""/>
<obj type="lev02_overlay07" x="2122" y="920" rot="0" params=""/>
<obj type="lev02_overlay08" x="1918" y="1301" rot="0" params=""/>
<obj type="lev02_overlay09" x="1438" y="1429" rot="0" params=""/>
<obj type="lev02_overlay10" x="1446" y="1557" rot="0" params=""/>
<obj type="lev02_overlay11" x="690" y="1701" rot="0" params=""/>
<obj type="lev02_overlay12" x="1386" y="1601" rot="0" params=""/>
<obj type="lev02_overlay13" x="2154" y="1713" rot="0" params=""/>
<obj type="lev02_overlay14" x="2682" y="1897" rot="0" params=""/>
<obj type="lev02_overlay15" x="2090" y="2185" rot="0" params=""/>
<obj type="lev02_overlay16" x="666" y="2225" rot="0" params=""/>
<obj type="lev02_overlay17" x="762" y="2061" rot="0" params=""/>
<obj type="pickup01" x="1853" y="1258" rot="0" params=""/>
<obj type="pickup01" x="1948" y="1161" rot="0" params=""/>
<obj type="pickup01" x="1987" y="1068" rot="0" params=""/>
<obj type="pickup01" x="1874" y="653" rot="0" params=""/>
<obj type="pickup01" x="1890" y="500" rot="0" params=""/>
<obj type="pickup01" x="2037" y="415" rot="0" params=""/>
<obj type="pickup01" x="2218" y="403" rot="0" params=""/>
<obj type="pickup01" x="2366" y="472" rot="0" params=""/>
<obj type="pickup01" x="2411" y="700" rot="0" params=""/>
<obj type="pickup01" x="2272" y="1107" rot="0" params=""/>
<obj type="pickup01" x="2302" y="1159" rot="0" params=""/>
<obj type="pickup01" x="2578" y="1249" rot="0" params=""/>
<obj type="pickup01" x="2588" y="1336" rot="0" params=""/>
<obj type="pickup01" x="2570" y="1389" rot="0" params=""/>
<obj type="pickup01" x="2259" y="1437" rot="0" params=""/>
<obj type="pickup01" x="2246" y="1478" rot="0" params=""/>
<obj type="pickup01" x="2249" y="1536" rot="0" params=""/>
<obj type="pickup01" x="2361" y="1964" rot="0" params=""/>
<obj type="pickup01" x="2259" y="1986" rot="0" params=""/>
<obj type="pickup01" x="2176" y="1988" rot="0" params=""/>
<obj type="pickup01" x="1736" y="1577" rot="0" params=""/>
<obj type="pickup01" x="933" y="983" rot="0" params=""/>
<obj type="pickup01" x="856" y="953" rot="0" params=""/>
<obj type="pickup01" x="777" y="936" rot="0" params=""/>
<obj type="pickup01" x="129" y="1168" rot="0" params=""/>
<obj type="pickup01" x="144" y="1238" rot="0" params=""/>
<obj type="pickup01" x="198" y="1303" rot="0" params=""/>
<obj type="pickup01" x="948" y="1928" rot="0" params=""/>
<obj type="pickup01" x="929" y="2060" rot="0" params=""/>
<obj type="pickup01" x="808" y="2142" rot="0" params=""/>
<obj type="pickup01" x="669" y="2161" rot="0" params=""/>
<obj type="pickup01" x="537" y="2142" rot="0" params=""/>
<obj type="pickup01" x="430" y="2071" rot="0" params=""/>
<obj type="pickup01" x="412" y="1953" rot="0" params=""/>
<obj type="aivehicle" x="459" y="1644" rot="0" params=""/>
<obj type="aivehicle" x="545" y="1644" rot="0" params=""/>
<obj type="aivehicle" x="619" y="1644" rot="0" params=""/>
<obj type="aivehicle" x="459" y="1700" rot="0" params=""/>
<obj type="aivehicle" x="615" y="1702" rot="0" params=""/>
<obj type="playervehicle" x="539" y="1700" rot="0" params=""/>
<obj type="turbopickup" x="617" y="932" rot="0" params=""/>
<obj type="mushroom" x="1812" y="693" rot="0" params=""/>
<obj type="mushroom" x="1862" y="686" rot="0" params=""/>
<obj type="mushroom" x="1913" y="682" rot="0" params=""/>
<obj type="mushroom" x="929" y="1816" rot="0" params=""/>
<obj type="mushroom" x="493" y="1912" rot="0" params=""/>
<obj type="mushroom" x="448" y="1888" rot="0" params=""/>
<obj type="mushroom" x="415" y="1864" rot="0" params=""/>
<obj type="mushroom" x="407" y="879" rot="0" params=""/>
<obj type="mushroom" x="493" y="855" rot="0" params=""/>
<obj type="mushroom" x="573" y="840" rot="0" params=""/>
<obj type="mushroom" x="2296" y="1541" rot="0" params=""/>
<obj type="mushroom" x="2298" y="1486" rot="0" params=""/>
<obj type="mushroom" x="2309" y="1421" rot="0" params=""/>
<obj type="mushroom" x="2606" y="961" rot="0" params=""/>
<obj type="mushroom" x="2615" y="905" rot="0" params=""/>
<obj type="pickup01" x="2655" y="954" rot="0" params=""/>
<obj type="pickup01" x="2668" y="892" rot="0" params=""/>
<obj type="pickup01" x="2670" y="830" rot="0" params=""/>
<obj type="lev02_overlay18" x="107" y="1291" rot="0" params=""/>
<obj type="pickup01" x="1788" y="1620" rot="0" params=""/>
<obj type="pickup01" x="1827" y="1668" rot="0" params=""/>
<obj type="pickup01" x="1862" y="1722" rot="0" params=""/>
<obj type="turbopickup" x="2444" y="1780" rot="0" params=""/>
<obj type="mushroom" x="2565" y="1298" rot="0" params=""/>
<obj type="turbopickup" x="1708" y="1207" rot="0" params=""/>
<obj type="mushroom" x="1787" y="1042" rot="0" params=""/>
<obj type="mushroom" x="1875" y="1044" rot="0" params=""/>
<obj type="pickup01" x="1133" y="1578" rot="0" params=""/>
<obj type="pickup01" x="1034" y="1643" rot="0" params=""/>
<obj type="pickup01" x="932" y="1709" rot="0" params=""/>
<obj type="mushroom" x="865" y="1768" rot="0" params=""/>
<obj type="mushroom" x="822" y="1711" rot="0" params=""/>
<obj type="startpos" x="889" y="1452" rot="0" params=""/>
<obj type="startpos" x="947" y="1906" rot="0" params=""/>
<obj type="startpos" x="949" y="1914" rot="0" params=""/>
<obj type="startpos" x="946" y="1912" rot="0" params=""/>
<obj type="pickup01" x="954" y="1854" rot="0" params=""/>
<line type="0" name="" fill="0" fillscale="1">
<points a="603,809, 750,811, 881,830, 996,867, 1119,933, 1183,977, 1248,1045, 1274,1094, 1298,1155, 1408,1263"/>
<points a="1463,1264, 1499,1228, 1599,1177, 1723,1106, 1739,1088, 1738,1067, 1727,1054, 1659,1018, 1602,970, 1562,905"/>
<points a="1556,853, 1577,805, 1617,759, 1678,715, 1754,681, 1831,657, 1842,629, 1840,535, 1857,462, 1904,420"/>
<points a="1966,382, 2063,355, 2164,350, 2265,364, 2352,404, 2403,444, 2431,494, 2438,537, 2435,689, 2446,691"/>
<points a="2455,666, 2544,688, 2637,736, 2683,778, 2708,822, 2717,873, 2704,933, 2662,988, 2605,1029, 2550,1056"/>
<points a="2482,1075, 2463,1081, 2457,1092, 2462,1104, 2483,1113, 2561,1140, 2625,1176, 2670,1217, 2694,1265, 2698,1304"/>
<points a="2688,1345, 2657,1396, 2612,1433, 2565,1462, 2509,1478, 2477,1483, 2464,1491, 2458,1504, 2466,1515, 2506,1538"/>
<points a="2577,1587, 2611,1644, 2638,1724, 2627,1803, 2581,1873, 2515,1930, 2431,1976, 2331,2007, 2180,2026, 2076,2019"/>
<points a="1946,1997, 1838,1952, 1756,1895, 1697,1816, 1682,1749, 1680,1702, 1669,1669, 1636,1639, 1549,1586, 1527,1548"/>
<points a="1526,1521, 1446,1477, 1353,1522, 1352,1551, 1346,1576, 1308,1604, 1052,1757, 1010,1790, 986,1829, 985,1884"/>
<points a="994,2031, 951,2097, 847,2177, 705,2218, 566,2200, 445,2143, 388,2070, 377,2007, 376,1822, 380,1668"/>
<points a="381,1531, 374,1493, 344,1456, 272,1408, 152,1317, 115,1263, 90,1184, 92,1114, 118,1043, 159,987"/>
<points a="228,928, 309,880, 387,849, 477,824, 546,814"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="682,1009, 783,1013, 844,1028, 921,1065, 967,1106, 985,1128, 1002,1183, 1034,1244, 1081,1302, 1132,1337"/>
<points a="1172,1346, 1239,1350, 1278,1366, 1278,1420, 1224,1450, 1187,1449, 1124,1462, 761,1679, 732,1690, 704,1688"/>
<points a="689,1678, 679,1659, 679,1522, 670,1475, 645,1420, 614,1376, 559,1333, 487,1285, 449,1248, 430,1205"/>
<points a="430,1154, 447,1116, 483,1083, 537,1050, 583,1030, 621,1019, 655,1013"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="667,1939, 739,1929, 788,1911, 824,1892, 882,1858, 905,1845, 923,1857, 927,1906, 919,1984, 902,2033"/>
<points a="868,2071, 814,2096, 747,2115, 671,2121, 593,2111, 529,2087, 476,2050, 448,1978, 448,1924, 469,1908"/>
<points a="495,1917, 551,1934, 601,1941, 639,1943"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1847,1277, 1964,1208, 2010,1164, 2028,1115, 2034,1060, 2022,997, 1986,953, 1922,917, 1868,888, 1860,870"/>
<points a="1864,851, 1893,841, 1983,833, 2181,835, 2276,833, 2383,837, 2414,853, 2422,870, 2418,887, 2400,903"/>
<points a="2295,931, 2210,985, 2166,1049, 2163,1112, 2189,1175, 2232,1218, 2281,1247, 2347,1273, 2377,1279, 2393,1286"/>
<points a="2401,1296, 2400,1305, 2388,1316, 2342,1327, 2264,1359, 2191,1415, 2163,1476, 2161,1524, 2175,1568, 2213,1615"/>
<points a="2254,1643, 2288,1658, 2331,1693, 2339,1733, 2328,1782, 2290,1811, 2237,1835, 2170,1845, 2102,1839, 2045,1819"/>
<points a="1997,1787, 1976,1740, 1978,1697, 1970,1646, 1948,1603, 1894,1547, 1822,1497, 1749,1455, 1659,1447, 1606,1416"/>
<points a="1609,1348, 1636,1345, 1686,1345, 1725,1343, 1767,1326, 1817,1297"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="2057,657, 1935,658, 1903,638, 1890,595, 1910,547, 1985,483, 2069,452, 2181,441, 2261,457, 2340,496"/>
<points a="2373,536, 2385,692, 2373,690, 2360,658, 2227,658, 2119,659"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="903,1654, 952,1623, 1063,1689, 1012,1722"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="1001,1596, 1056,1564, 1165,1629, 1114,1662"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="1101,1538, 1155,1503, 1265,1568, 1212,1603"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="1699,771, 1709,804, 1685,816, 1642,806, 1663,775"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="1691,840, 1718,841, 1738,869, 1711,884, 1671,871"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="1804,857, 1833,860, 1850,889, 1820,901, 1785,887"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="1828,928, 1866,925, 1877,962, 1832,967, 1812,949"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="2272,1135, 2261,1155, 2207,1145, 2222,1110, 2257,1109"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="2290,1176, 2303,1211, 2275,1221, 2236,1209, 2252,1182"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="2362,1195, 2397,1192, 2417,1226, 2398,1243, 2349,1231"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="2396,1271, 2429,1260, 2450,1290, 2418,1309"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="2505,1289, 2538,1282, 2558,1314, 2536,1326, 2492,1314"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="2529,1356, 2564,1346, 2586,1375, 2558,1392, 2519,1384"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="457,1581, 311,1285, 325,1010, 743,911, 1117,1050, 1685,1496, 1939,1792, 2124,1873, 2334,1831, 2373,1697"/>
<points a="2340,1449, 2413,1303, 2324,1082, 2443,885, 2404,764, 2286,731, 1969,781, 1823,870, 1766,1151, 1670,1288"/>
<points a="907,1785, 698,1871, 513,1842, 463,1669"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="499,1579, 421,1394, 352,1085, 565,903, 922,901, 1144,1125, 1576,1469, 1893,1796, 2201,1915, 2400,1808"/>
<points a="2401,1634, 2420,1416, 2486,1265, 2411,1064, 2494,869, 2462,772, 2273,713, 1908,769, 1729,881, 1786,1038"/>
<points a="1696,1193, 1320,1447, 799,1744, 578,1795, 518,1650"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="550,1576, 340,1253, 419,998, 673,927, 961,985, 1131,1155, 1526,1465, 1791,1774, 2036,1905, 2331,1887"/>
<points a="2452,1775, 2386,1525, 2528,1269, 2388,1066, 2545,870, 2497,760, 2253,724, 1893,793, 1784,918, 1758,1145"/>
<points a="1581,1305, 1190,1545, 842,1780, 551,1828, 555,1649"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="615,1571, 474,1382, 367,1085, 611,868, 868,949, 1234,1281, 1663,1593, 1863,1846, 2190,1952, 2502,1792"/>
<points a="2429,1571, 2471,1335, 2403,1070, 2485,857, 2402,781, 2252,708, 1862,787, 1764,898, 1740,1170, 1160,1581"/>
<points a="880,1775, 633,1745, 623,1630"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1863,850, 1938,810, 1990,804, 2107,794, 2153,781, 2198,756, 2236,751, 2271,775, 2400,838, 2411,861"/>
<points a="2050,874"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="2311,693, 2246,688, 2162,700, 2116,720, 2080,739, 2023,740, 1929,687, 1913,653, 1952,637, 2323,630"/>
<points a="2374,648, 2377,684, 2348,695"/>
</line>
<line type="6" name="display arrow" fill="0" fillscale="1">
<points a="1276,1376, 1439,1257, 1617,1383, 1442,1493"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="367,1586, 686,1587"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="231,1395, 489,1270"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="80,1147, 445,1161"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="327,853, 518,1081"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="670,796, 679,1027"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="975,841, 868,1064"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1193,968, 962,1136"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1363,1191, 1156,1352"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1637,1408, 1481,1519"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1860,1506, 1623,1658"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1987,1683, 1696,1844"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2071,1817, 2020,2020"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2219,1828, 2278,2021"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2316,1773, 2559,1913"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2322,1704, 2615,1638"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2152,1471, 2482,1494"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2383,1301, 2716,1286"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2146,1096, 2478,1093"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2402,875, 2723,814"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2313,846, 2368,389"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2088,845, 2089,337"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1895,857, 1756,660"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1883,885, 1540,884"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2038,999, 1716,1077"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1850,1297, 1649,1133"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1651,1362, 1482,1220"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1352,1596, 1200,1436"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1159,1710, 936,1556"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1010,1824, 819,1633"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="771,2213, 749,1668"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="374,2084, 692,1660"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="364,1674, 685,1640"/>
</line>
<line type="0" name="wormhump" fill="0" fillscale="1">
<points a="1829,1183, 1858,1226, 1835,1244, 1763,1203, 1787,1180"/>
</line>
<line type="7" name="bridge" fill="0" fillscale="1">
<points a="1985,743, 2283,681, 2288,752, 2097,824, 1985,808"/>
</line>
</level>
<level name="Level03" category="0" fillframe="13" surfaceframe="5" surfacethickness="10" type="none" opponents="" win="1" exclusivechar="1">
<times gold="10" silver="20"/>
<obj type="lev03_overlay01" x="2015" y="687" rot="0" params=""/>
<obj type="lev03_overlay02" x="2199" y="751" rot="0" params=""/>
<obj type="lev03_overlay03" x="2575" y="831" rot="0" params=""/>
<obj type="lev03_overlay04" x="671" y="1087" rot="0" params=""/>
<obj type="lev03_overlay05" x="947" y="1127" rot="0" params=""/>
<obj type="lev03_overlay06" x="871" y="1544" rot="0" params=""/>
<obj type="lev03_overlay07" x="2263" y="2079" rot="0" params=""/>
<obj type="aivehicle" x="277" y="1162" rot="0" params=""/>
<obj type="aivehicle" x="336" y="1162" rot="0" params=""/>
<obj type="aivehicle" x="390" y="1162" rot="0" params=""/>
<obj type="aivehicle" x="276" y="1226" rot="0" params=""/>
<obj type="playervehicle" x="337" y="1224" rot="0" params=""/>
<obj type="aivehicle" x="396" y="1226" rot="0" params=""/>
<obj type="pickup01" x="788" y="801" rot="0" params=""/>
<obj type="pickup01" x="875" y="816" rot="0" params=""/>
<obj type="pickup01" x="967" y="826" rot="0" params=""/>
<obj type="pickup01" x="1054" y="839" rot="0" params=""/>
<obj type="pickup01" x="1715" y="1278" rot="0" params=""/>
<obj type="pickup01" x="1780" y="1246" rot="0" params=""/>
<obj type="pickup01" x="1826" y="1194" rot="0" params=""/>
<obj type="pickup01" x="1839" y="1129" rot="0" params=""/>
<obj type="pickup01" x="1770" y="533" rot="0" params=""/>
<obj type="pickup01" x="2163" y="619" rot="0" params=""/>
<obj type="pickup01" x="2230" y="653" rot="0" params=""/>
<obj type="pickup01" x="2116" y="607" rot="0" params=""/>
<obj type="pickup01" x="2277" y="1223" rot="0" params=""/>
<obj type="pickup01" x="2351" y="1269" rot="0" params=""/>
<obj type="pickup01" x="2409" y="1287" rot="0" params=""/>
<obj type="pickup01" x="2472" y="1163" rot="0" params=""/>
<obj type="pickup01" x="2543" y="1197" rot="0" params=""/>
<obj type="pickup01" x="2584" y="1250" rot="0" params=""/>
<obj type="pickup01" x="2581" y="1510" rot="0" params=""/>
<obj type="pickup01" x="2517" y="1555" rot="0" params=""/>
<obj type="pickup01" x="2457" y="1581" rot="0" params=""/>
<obj type="pickup01" x="2371" y="1450" rot="0" params=""/>
<obj type="pickup01" x="2309" y="1481" rot="0" params=""/>
<obj type="pickup01" x="1268" y="1879" rot="0" params=""/>
<obj type="pickup01" x="1246" y="1830" rot="0" params=""/>
<obj type="pickup01" x="1244" y="1780" rot="0" params=""/>
<obj type="pickup01" x="1368" y="1588" rot="0" params=""/>
<obj type="pickup01" x="1320" y="1570" rot="0" params=""/>
<obj type="pickup01" x="1264" y="1565" rot="0" params=""/>
<obj type="pickup01" x="1028" y="1388" rot="0" params=""/>
<obj type="pickup01" x="972" y="1368" rot="0" params=""/>
<obj type="pickup01" x="913" y="1360" rot="0" params=""/>
<obj type="pickup01" x="518" y="1428" rot="0" params=""/>
<obj type="pickup01" x="459" y="1406" rot="0" params=""/>
<obj type="pickup01" x="386" y="1372" rot="0" params=""/>
<obj type="pickup01" x="326" y="1332" rot="0" params=""/>
<obj type="startpos" x="2425" y="793" rot="0" params=""/>
<obj type="turbopickup" x="1655" y="745" rot="0" params=""/>
<obj type="icecream" x="1300" y="1019" rot="0" params=""/>
<obj type="icecream" x="1316" y="1064" rot="0" params=""/>
<obj type="icecream" x="1446" y="915" rot="0" params=""/>
<obj type="icecream" x="1464" y="849" rot="0" params=""/>
<obj type="icecream" x="2249" y="680" rot="0" params=""/>
<obj type="icecream" x="2295" y="673" rot="0" params=""/>
<obj type="icecream" x="1683" y="1949" rot="0" params=""/>
<obj type="icecream" x="1730" y="1932" rot="0" params=""/>
<obj type="icecream" x="1775" y="1919" rot="0" params=""/>
<obj type="icecream" x="1298" y="1768" rot="0" params=""/>
<obj type="icecream" x="1345" y="1768" rot="0" params=""/>
<obj type="icecream" x="1388" y="1768" rot="0" params=""/>
<obj type="icecream" x="1435" y="1768" rot="0" params=""/>
<obj type="icecream" x="740" y="1438" rot="0" params=""/>
<obj type="icecream" x="668" y="1438" rot="0" params=""/>
<obj type="icecream" x="605" y="1427" rot="0" params=""/>
<obj type="lev03_overlay08" x="2288" y="953" rot="0" params=""/>
<obj type="turbopickup" x="1306" y="1108" rot="0" params=""/>
<obj type="pickup01" x="1716" y="591" rot="0" params=""/>
<obj type="pickup01" x="1672" y="647" rot="0" params=""/>
<obj type="turbopickup" x="2252" y="1539" rot="0" params=""/>
<obj type="pickup01" x="2119" y="1929" rot="0" params=""/>
<obj type="pickup01" x="2056" y="1965" rot="0" params=""/>
<obj type="pickup01" x="1976" y="1989" rot="0" params=""/>
<line type="0" name="" fill="0" fillscale="1">
<points a="1940,443, 2064,441, 2186,453, 2291,476, 2402,517, 2475,557, 2545,608, 2594,657, 2627,718, 2644,775"/>
<points a="2648,833, 2634,902, 2608,955, 2561,1016, 2513,1053, 2462,1088, 2391,1100, 2352,1078, 2340,1079, 2345,1087"/>
<points a="2365,1106, 2400,1117, 2460,1132, 2515,1155, 2575,1196, 2602,1232, 2618,1265, 2621,1295, 2618,1334, 2608,1358"/>
<points a="2623,1380, 2632,1415, 2633,1458, 2616,1502, 2591,1532, 2552,1563, 2491,1595, 2416,1616, 2368,1622, 2347,1634"/>
<points a="2351,1651, 2382,1662, 2414,1678, 2435,1713, 2432,1793, 2405,1863, 2360,1921, 2298,1977, 2210,2030, 2126,2064"/>
<points a="1997,2101, 1890,2115, 1775,2116, 1631,2102, 1524,2077, 1420,2037, 1331,1985, 1264,1932, 1208,1858, 1180,1783"/>
<points a="1177,1731, 1192,1691, 1231,1678, 1266,1675, 1273,1663, 1269,1652, 1229,1645, 1144,1633, 1084,1610, 1013,1568"/>
<points a="969,1528, 942,1472, 932,1452, 906,1447, 888,1449, 883,1467, 867,1496, 842,1501, 749,1503, 643,1495"/>
<points a="551,1476, 445,1444, 350,1399, 263,1334, 200,1266, 167,1190, 157,1130, 162,1075, 184,1008, 215,963"/>
<points a="257,918, 314,878, 368,840, 452,803, 529,778, 612,760, 708,750, 809,747, 900,752, 974,763"/>
<points a="1062,783, 1118,793, 1186,797, 1254,789, 1326,765, 1378,737, 1434,673, 1464,638, 1508,595, 1560,560"/>
<points a="1625,524, 1707,489, 1791,465, 1878,448"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="2142,676, 2185,692, 2232,722, 2260,751, 2281,797, 2284,835, 2270,875, 2241,907, 2198,934, 2163,966"/>
<points a="2163,999, 2205,1025, 2224,1048, 2215,1066, 2200,1110, 2204,1171, 2223,1209, 2278,1261, 2334,1288, 2405,1310"/>
<points a="2459,1331, 2496,1351, 2501,1362, 2490,1376, 2424,1413, 2367,1428, 2303,1458, 2247,1499, 2218,1536, 2203,1583"/>
<points a="2202,1619, 2191,1638, 2142,1656, 2099,1686, 2077,1734, 2066,1782, 2041,1820, 1978,1857, 1906,1881, 1833,1894"/>
<points a="1761,1891, 1696,1880, 1624,1850, 1578,1815, 1549,1754, 1540,1708, 1516,1675, 1474,1646, 1453,1637, 1428,1597"/>
<points a="1400,1578, 1359,1556, 1301,1541, 1245,1533, 1221,1535, 1172,1557, 1151,1556, 1120,1544, 1093,1529, 1081,1497"/>
<points a="1104,1473, 1118,1438, 1102,1405, 1056,1370, 1020,1353, 968,1338, 937,1334, 929,1319, 863,1292, 806,1279"/>
<points a="732,1278, 668,1271, 601,1238, 551,1196, 530,1157, 522,1105, 534,1069, 572,1028, 611,1003, 665,980"/>
<points a="737,964, 793,961, 859,964, 950,989, 1006,1011, 1034,1036, 1050,1087, 1059,1126, 1071,1162, 1097,1187"/>
<points a="1142,1207, 1170,1205, 1200,1241, 1243,1274, 1285,1297, 1352,1324, 1438,1339, 1503,1344, 1589,1339, 1652,1326"/>
<points a="1724,1300, 1782,1268, 1833,1222, 1855,1187, 1868,1148, 1868,1101, 1854,1057, 1871,1021, 1873,979, 1854,946"/>
<points a="1817,920, 1774,885, 1748,830, 1751,784, 1777,739, 1825,702, 1875,679, 1935,661, 1992,654, 2051,655"/>
<points a="2100,663"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="2363,1168, 2397,1177, 2441,1193, 2482,1215, 2517,1251, 2525,1271, 2518,1282, 2485,1270, 2414,1246, 2353,1225"/>
<points a="2312,1188, 2290,1152, 2295,1143, 2316,1153, 2340,1164"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="2360,1503, 2397,1488, 2438,1472, 2472,1461, 2503,1447, 2529,1432, 2541,1439, 2526,1481, 2490,1518, 2449,1541"/>
<points a="2391,1557, 2338,1566, 2312,1571, 2305,1561, 2326,1529"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1045,779, 1121,800, 1179,822, 1247,860, 1297,894, 1354,954, 1392,1008, 1409,1051, 1415,1101, 1407,1151"/>
<points a="1379,1179, 1378,1196, 1423,1219, 1491,1231, 1567,1225, 1627,1206, 1669,1171, 1689,1133, 1679,1092, 1638,1101"/>
<points a="1594,1100, 1482,1027, 1416,944, 1386,848, 1392,776, 1402,683, 1106,757"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="968,764, 935,800, 903,803, 885,782, 884,745"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1456,724, 1497,784, 1480,806, 1375,773, 1345,739, 1430,653"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1531,560, 1593,624, 1631,625, 1628,646, 1585,671, 1540,661, 1477,606"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1686,1863, 1651,1935, 1546,1933, 1517,1858, 1494,1810, 1477,1770, 1528,1735, 1580,1753"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="273,1099, 359,964, 668,837, 1020,843, 1269,967, 1327,1177, 1457,1250, 1669,1210, 1718,1118, 1551,942"/>
<points a="1529,698, 1743,541, 2058,482, 2387,560, 2530,685, 2425,963, 2321,1035, 2325,1109, 2464,1165, 2566,1257"/>
<points a="2570,1359, 2529,1541, 2367,1589, 2279,1718, 2134,1945, 1813,2044, 1484,1975, 1324,1831, 1305,1664, 1234,1605"/>
<points a="1044,1563, 946,1408, 698,1407, 297,1286, 267,1183"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="407,1103, 522,955, 772,878, 1083,916, 1168,1046, 1361,1292, 1622,1281, 1788,1168, 1699,940, 1689,689"/>
<points a="1898,608, 2287,643, 2378,857, 2281,998, 2273,1164, 2364,1263, 2509,1312, 2514,1386, 2389,1457, 2276,1527"/>
<points a="2242,1630, 2121,1844, 1956,1945, 1580,1986, 1446,1814, 1396,1634, 1228,1577, 1083,1552, 1008,1416, 671,1343"/>
<points a="433,1256, 414,1181"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="309,1103, 567,858, 1040,835, 1228,1041, 1384,1247, 1608,1239, 1725,1153, 1627,932, 1697,648, 2048,552"/>
<points a="2389,671, 2344,973, 2248,1130, 2310,1238, 2495,1317, 2573,1422, 2499,1550, 2311,1601, 2259,1686, 2114,1986"/>
<points a="1768,2008, 1558,2002, 1368,1820, 1295,1630, 1075,1577, 940,1427, 676,1422, 374,1327, 317,1180"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="360,1105, 519,875, 887,868, 1219,985, 1300,1258, 1573,1265, 1753,1160, 1598,873, 1633,675, 1927,536"/>
<points a="2326,620, 2392,872, 2310,1079, 2416,1161, 2542,1222, 2546,1324, 2490,1430, 2319,1484, 2267,1594, 2099,1907"/>
<points a="1793,1980, 1604,1981.5, 1467,1897, 1385,1674, 1267,1603, 1044,1518, 950,1387, 708,1381, 412,1300, 368,1178"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="2325,691, 2356,715, 2342,740, 2291,743, 2267,720, 2290,695"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="2483,858, 2549,872, 2563,906, 2531,934, 2480,934, 2432,920, 2422,881, 2451,865"/>
</line>
<line type="5" name="" fill="0" fillscale="1">
<points a="849,1287, 840,1323, 793,1356, 759,1376.5, 716,1375.25, 693,1350, 710,1299, 726,1265"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="147,1111, 536,1109"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="374,821, 588,1032"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="729,738, 747,979"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1089,777, 961,1011"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1312,882, 1028,1056"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1432,1074, 1138,1232"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1449,1215, 1420,1360"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1594,1203, 1698,1329"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1672,1121, 1877,1119"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1440,1000, 1788,877"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1434,646, 1773,765"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1754,460, 1861,697"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2089,426, 2065,673"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2404,503, 2193,711"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2638,722, 2254,779"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2544,1045, 2229,881"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2474,1124, 2189,1202"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2633,1277, 2414,1326"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2620,1528, 2399,1402"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2416,1637, 2251,1472"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2458,1752, 2083,1672"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2334,1966, 2038,1792"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1984,2118, 1926,1855"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1703,2129, 1746,1871"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1416,2053, 1634,1818"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1181,1823, 1571,1739"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1152,1671, 1298,1529"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="956,1550, 1132,1422"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="715,1513, 902,1285"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="440,1463, 668,1245"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="187,1285, 576,1191"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="2457,717, 2502,695, 2553,701, 2579,731, 2539,768, 2475,808, 2429,811, 2402,794, 2397,764, 2421,743"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="2442,912, 2480,919, 2497,944, 2486,969, 2453,975, 2419,970, 2396,950, 2406,922"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="2643,707, 2621,790, 2603,842, 2563,836, 2535,795, 2550,762, 2621,694"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="2309,889, 2327,916, 2324,948, 2294,959, 2250,943, 2247,914, 2275,890"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="1863,1948, 1904,2023, 1899,2052, 1857,2066, 1814,2044, 1762,1990, 1746,1948, 1772,1930, 1827,1924"/>
</line>
<line type="7" name="undefined" fill="0" fillscale="1">
<points a="1137,1134, 1334,1128, 1399,1202, 1236,1336"/>
</line>
<line type="7" name="undefined" fill="0" fillscale="1">
<points a="1394,1198, 1781,979, 1882,1091, 1845,1288, 1575,1375, 1304,1362"/>
</line>
<line type="7" name="undefined" fill="0" fillscale="1">
<points a="2224,1033, 2349,1056, 2368,1101, 2194,1186, 2189,1053"/>
</line>
<line type="7" name="undefined" fill="0" fillscale="1">
<points a="2372,1102, 2638,1180, 2624,1692, 2309,1643, 2179,1608"/>
</line>
<line type="7" name="undefined" fill="0" fillscale="1">
<points a="804,1452, 869,1320, 1191,1367, 1447,1614, 1108,1697"/>
</line>
</level>
<level name="Level04" category="0" fillframe="13" surfaceframe="5" surfacethickness="10" type="none" opponents="" win="1" exclusivechar="1">
<times gold="10" silver="20"/>
<obj type="lev04_overlay01" x="1517" y="609" rot="0" params=""/>
<obj type="lev04_overlay02" x="660" y="971" rot="0" params=""/>
<obj type="lev04_overlay03" x="858" y="1364" rot="0" params=""/>
<obj type="lev04_overlay04" x="1468" y="1621" rot="0" params=""/>
<obj type="lev04_overlay05" x="2322" y="1432" rot="0" params=""/>
<obj type="lev04_overlay06" x="1777" y="1951" rot="0" params=""/>
<obj type="lev04_overlay07" x="2402" y="2196" rot="0" params=""/>
<obj type="lev04_overlay08" x="751" y="2266" rot="0" params=""/>
<obj type="aivehicle" x="1520" y="1677" rot="0" params=""/>
<obj type="aivehicle" x="1521" y="1716" rot="0" params=""/>
<obj type="aivehicle" x="1520" y="1755" rot="0" params=""/>
<obj type="aivehicle" x="1444" y="1752" rot="0" params=""/>
<obj type="aivehicle" x="1446" y="1715" rot="0" params=""/>
<obj type="playervehicle" x="1444" y="1679" rot="0" params=""/>
<obj type="pickup01" x="2127" y="1773" rot="0" params=""/>
<obj type="pickup01" x="2168" y="1815" rot="0" params=""/>
<obj type="pickup01" x="2200" y="1857" rot="0" params=""/>
<obj type="pickup01" x="2212" y="1907" rot="0" params=""/>
<obj type="pickup01" x="1602" y="2173" rot="0" params=""/>
<obj type="pickup01" x="1535" y="2155" rot="0" params=""/>
<obj type="pickup01" x="1460" y="2124" rot="0" params=""/>
<obj type="pickup01" x="1028" y="1863" rot="0" params=""/>
<obj type="pickup01" x="973" y="1845" rot="0" params=""/>
<obj type="pickup01" x="912" y="1831" rot="0" params=""/>
<obj type="pickup01" x="377" y="1961" rot="0" params=""/>
<obj type="pickup01" x="365" y="2013" rot="0" params=""/>
<obj type="pickup01" x="401" y="2055" rot="0" params=""/>
<obj type="pickup01" x="448" y="2072" rot="0" params=""/>
<obj type="pickup01" x="498" y="2077" rot="0" params=""/>
<obj type="pickup01" x="634" y="1710" rot="0" params=""/>
<obj type="pickup01" x="594" y="1671" rot="0" params=""/>
<obj type="pickup01" x="536" y="1631" rot="0" params=""/>
<obj type="pickup01" x="503" y="1258" rot="0" params=""/>
<obj type="pickup01" x="552" y="1230" rot="0" params=""/>
<obj type="pickup01" x="595" y="1212" rot="0" params=""/>
<obj type="pickup01" x="1401" y="1343" rot="0" params=""/>
<obj type="pickup01" x="1465" y="1322" rot="0" params=""/>
<obj type="pickup01" x="1506" y="1287" rot="0" params=""/>
<obj type="pickup01" x="1539" y="1246" rot="0" params=""/>
<obj type="pickup01" x="1552" y="1191" rot="0" params=""/>
<obj type="pickup01" x="1292" y="965" rot="0" params=""/>
<obj type="pickup01" x="1235" y="931" rot="0" params=""/>
<obj type="pickup01" x="1185" y="903" rot="0" params=""/>
<obj type="pickup01" x="1140" y="876" rot="0" params=""/>
<obj type="pickup01" x="1029" y="939" rot="0" params=""/>
<obj type="pickup01" x="1081" y="975" rot="0" params=""/>
<obj type="pickup01" x="1124" y="1003" rot="0" params=""/>
<obj type="pickup01" x="1177" y="1032" rot="0" params=""/>
<obj type="pickup01" x="841" y="611" rot="0" params=""/>
<obj type="pickup01" x="892" y="581" rot="0" params=""/>
<obj type="pickup01" x="966" y="561" rot="0" params=""/>
<obj type="pickup01" x="1032" y="552" rot="0" params=""/>
<obj type="pickup01" x="1628" y="811" rot="0" params=""/>
<obj type="pickup01" x="1686" y="798" rot="0" params=""/>
<obj type="pickup01" x="1736" y="773" rot="0" params=""/>
<obj type="pickup01" x="2282" y="732" rot="0" params=""/>
<obj type="pickup01" x="2266" y="788" rot="0" params=""/>
<obj type="pickup01" x="2230" y="816" rot="0" params=""/>
<obj type="pickup01" x="2183" y="851" rot="0" params=""/>
<obj type="pickup01" x="1779" y="1111" rot="0" params=""/>
<obj type="pickup01" x="1775" y="1156" rot="0" params=""/>
<obj type="pickup01" x="1772" y="1215" rot="0" params=""/>
<obj type="pickup01" x="2516" y="1594" rot="0" params=""/>
<obj type="pickup01" x="2580" y="1572" rot="0" params=""/>
<obj type="pickup01" x="2623" y="1530" rot="0" params=""/>
<obj type="pickup01" x="2640" y="1475" rot="0" params=""/>
<obj type="pickup01" x="2645" y="1405" rot="0" params=""/>
<obj type="pickup01" x="2611" y="1351" rot="0" params=""/>
<obj type="pickup01" x="2560" y="1313" rot="0" params=""/>
<obj type="pickup01" x="1699" y="1560" rot="0" params=""/>
<obj type="pickup01" x="1626" y="1563" rot="0" params=""/>
<obj type="pickup01" x="1568" y="1568" rot="0" params=""/>
<obj type="pickup01" x="1133" y="1532" rot="0" params=""/>
<obj type="pickup01" x="1092" y="1565" rot="0" params=""/>
<obj type="pickup01" x="1082" y="1616" rot="0" params=""/>
<obj type="pickup01" x="1097" y="1673" rot="0" params=""/>
<obj type="mallow" x="598" y="1784" rot="0" params=""/>
<obj type="mallow" x="669" y="1782" rot="0" params=""/>
<obj type="mallow" x="734" y="1781" rot="0" params=""/>
<obj type="mallow" x="794" y="1782" rot="0" params=""/>
<obj type="mallow" x="850" y="1786" rot="0" params=""/>
<obj type="mallow" x="1255" y="1120" rot="0" params=""/>
<obj type="mallow" x="1304" y="1085" rot="0" params=""/>
<obj type="mallow" x="1361" y="1045" rot="0" params=""/>
<obj type="mallow" x="1420" y="1014" rot="0" params=""/>
<obj type="mallow" x="1800" y="1441" rot="0" params=""/>
<obj type="mallow" x="1848" y="1477" rot="0" params=""/>
<obj type="mallow" x="1898" y="1508" rot="0" params=""/>
<obj type="mallow" x="1959" y="1551" rot="0" params=""/>
<obj type="mallow" x="2450" y="1518" rot="0" params=""/>
<obj type="pickup01" x="1316" y="569" rot="0" params=""/>
<obj type="pickup01" x="1418" y="571" rot="0" params=""/>
<obj type="pickup01" x="1517" y="571" rot="0" params=""/>
<obj type="pickup01" x="1629" y="573" rot="0" params=""/>
<obj type="pickup01" x="1712" y="573" rot="0" params=""/>
<obj type="turbopickup" x="999" y="1922" rot="0" params=""/>
<obj type="turbopickup" x="1421" y="1129" rot="0" params=""/>
<obj type="turbopickup" x="1904" y="933" rot="0" params=""/>
<obj type="lev04_overlay10" x="1890" y="1085" rot="0" params=""/>
<obj type="lev04_overlay09" x="1810" y="1265" rot="0" params=""/>
<line type="0" name="" fill="0" fillscale="1">
<points a="1964,492, 2038,497, 2074,502, 2081,575, 2124,618, 2180,639, 2221,651, 2321,657, 2334,700, 2329,748"/>
<points a="2306,799, 2270,835, 2181,894, 2022,987, 2005,1000, 2001,1014, 1998,1119, 1999,1284, 2007,1294, 2033,1283"/>
<points a="2089,1251, 2165,1224, 2254,1209, 2327,1207, 2411,1213, 2495,1231, 2570,1261, 2621,1292, 2663,1330, 2697,1378"/>
<points a="2709,1427, 2705,1472, 2687,1523, 2664,1552, 2609,1598, 2547,1630, 2491,1651, 2427,1667, 2357,1674, 2271,1673"/>
<points a="2186,1663, 2093,1631, 1972,1563, 1889,1588, 1794,1604, 1705,1612, 1261,1607, 1248,1615, 1253,1626, 1308,1628"/>
<points a="1710,1624, 1797,1626, 1898,1641, 1989,1666, 2068,1701, 2138,1743, 2192,1787, 2233,1835, 2253,1872, 2274,1957"/>
<points a="2264,2031, 2221,2109, 2178,2153, 2113,2199, 2044,2237, 1966,2267, 1889,2287, 1797,2300, 1696,2306, 1610,2302"/>
<points a="1512,2287, 1437,2267, 1360,2237, 1281,2193, 1191,2137, 1181.5,2073, 1155,2029, 1107.5,1988.5, 1027.25,1977.25, 947,1992"/>
<points a="902,1967, 880,1959, 870,1965, 869,2020, 848,2076, 806,2137, 748,2177, 636,2213, 543,2229, 415,2230"/>
<points a="299,2206, 209,2169, 134,2110, 96,2042, 89,1981, 110,1919, 156,1864, 227,1819, 291,1791, 365,1775"/>
<points a="436,1765, 527,1766, 568,1764, 568,1730, 556,1697, 529,1667, 485,1642, 411,1589, 357,1527, 332,1457"/>
<points a="328,1402, 348,1335, 391,1276, 438,1232, 513,1187, 579,1205, 653,1211, 714,1204, 775,1189, 832.5,1158.5"/>
<points a="880,1114, 965,1124, 1045,1140, 1109,1161, 1182,1192, 1220,1218, 1245,1229, 1285,1229, 1315,1215, 1325,1200"/>
<points a="1324,1182, 1310,1169, 1191,1100, 1097,1041, 939,946, 842,890, 731,815, 697,755, 696,695, 724,622"/>
<points a="775,573, 850,531, 913,510, 998,497, 1096,495, 1208,515, 1250,529, 1259,548, 1769,551, 1777,528"/>
<points a="1850,507, 1925,496"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1529,601, 1724,598, 1727,604, 1653,647, 1575,664, 1484,669, 1387,653, 1330,626, 1301,604, 1302,597"/>
<points a="1478,602"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1532,846, 1625,837, 1725,805, 1823,752, 1944,679, 1973,675, 2000,677, 2022,687, 2034,703, 2028,726"/>
<points a="1987,752, 1812,858, 1762,894, 1723,938, 1701,998, 1699,1100, 1699,1320, 1712,1365, 1731,1396, 1747,1414"/>
<points a="1742,1427, 1725,1434, 1233,1442, 1161,1455, 1098,1482, 1028,1529, 1000,1569, 989,1624, 997,1664, 1034,1715"/>
<points a="1093,1760, 1171,1788, 1237,1799, 1363,1798, 1649,1798, 1798,1805, 1859,1830, 1912,1858, 1953,1898, 1970,1937"/>
<points a="1973,1976, 1962,2010, 1934,2047, 1879,2087, 1829,2107, 1728,2125, 1657,2123, 1590,2111, 1538,2092, 1507.375,2077.375"/>
<points a="1395.75,2079.75, 1310.5,2047.5, 1262.125,1995.375, 1266.75,1930.25, 1117,1839, 1073,1819, 1014,1797, 965,1785, 908,1774, 870,1768"/>
<points a="866,1703, 851,1655, 826,1618, 789,1578, 743,1543, 692,1513, 648,1476, 632,1440, 633,1397, 654,1362"/>
<points a="696,1331, 738,1311, 831,1293, 880,1294, 942,1312, 1011,1345, 1072,1376, 1142,1398, 1226,1408, 1326,1408"/>
<points a="1434,1386, 1517,1351, 1565,1313, 1599,1276, 1624,1224, 1624,1169, 1600,1113, 1556,1064, 1411,976, 1007,734"/>
<points a="993,711, 994,698, 1015,681, 1042,675, 1073,675, 1098,686, 1255,780, 1329,816, 1407,838, 1476,844"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="485,1944, 567,1944, 568,2005, 554,2029, 531,2042, 499,2052, 460,2052, 415,2037, 391,2011, 390,1988"/>
<points a="403,1967, 425,1954, 457,1945"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="2240,1413, 2267,1397, 2320,1390, 2362,1398, 2397,1409, 2407,1431, 2403,1460, 2380,1483, 2341,1494, 2290,1490"/>
<points a="2249,1476, 2228,1448, 2230,1427"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1413,979, 1372,1003, 1326,975, 1364,944"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1241,1082, 1198,1104, 1154,1076, 1187,1050"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1202,953, 1159,977, 1115,953, 1155,922"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1158,824, 1117,851, 1067,824, 1112,797"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="989,928, 946,950, 903,922, 945,902"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="1637,1697, 1920,1757, 2065,1956, 1945,2191, 1582,2234, 1239,2089, 1107,1947, 897,1879, 555,1850, 342,1928"/>
<points a="371,2069, 556,2135, 656,1950, 634,1678, 543,1409, 719,1229, 1078,1246, 1301,1255, 1375,1156, 1108,972"/>
<points a="913,753, 998,642, 1261,701, 1638,745, 1968,571, 2122,756, 1821,977, 1792,1076.5, 1869,1170, 1952,1438"/>
<points a="2364,1567, 2480,1408, 2296,1288, 1944,1492, 1527,1514, 1228,1530, 1209,1667, 1505,1695"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="1635,1717, 1967,1800, 1988,2057, 1785,2226, 1418,2152, 1098,1963, 794,1889, 448,1851, 267,1973, 408,2140"/>
<points a="609,2097, 734,1857, 719,1645, 582,1420, 658,1268, 1038,1280, 1337,1310, 1449,1163, 1239,967, 1007,822"/>
<points a="955,656, 1101,610, 1328,739, 1585,770, 1856,594, 2071,627, 2124,793, 1947,930, 1800,1020, 1818,1136.5"/>
<points a="1905,1233.75, 1928,1331, 2127,1530, 2417,1582, 2564,1436, 2391,1281, 2101,1329, 1800,1507, 1364,1538, 1143,1587"/>
<points a="1162,1672, 1370,1718, 1508,1719"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="1636,1683, 1933,1731, 2163,1976, 2014,2185, 1509,2224, 1140,1990, 848,1875, 342,1888, 303,2051, 494,2125"/>
<points a="696,2021, 663,1665, 501,1419, 657,1246, 1004,1228, 1268,1312, 1426,1194, 1223,1008, 1112,978, 929,850"/>
<points a="806,653, 1018,558, 1248,615, 1480,740, 1729,669, 2041,635, 2098,740, 1988,904, 1980,1004.5, 1974,1203"/>
<points a="1992,1435, 2245,1557, 2481,1510, 2489,1383, 2365,1305, 2159,1369, 1822,1536, 1471,1557, 1157,1563, 1231,1668"/>
<points a="1509,1680"/>
</line>
<line type="1" name="" fill="0" fillscale="1">
<points a="1647,1736, 1926,1791, 2061,2024, 1983,2134, 1646,2174, 1394,2121, 1089,1915, 792,1840, 263,1915, 256,2077"/>
<points a="518,2129, 723,1998, 694,1685, 481,1446, 596,1281, 913,1195, 1137,1328, 1389,1278, 1430,1105, 1250,962"/>
<points a="1064,844, 886,732, 969,613, 1173,636, 1448,776, 1725,709, 2003,626, 2098,683, 1988,818, 1793,1007"/>
<points a="1818.5,1153.5, 1900,1222, 2052,1524, 2310,1590, 2546,1476, 2468,1323, 2180,1311, 1898,1462, 1735,1497, 1319,1509"/>
<points a="1150,1623, 1255,1706, 1491,1731"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="1635,1472, 1690,1475, 1690,1524, 1634,1523"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="1249,1714, 1301,1712, 1303,1764, 1246,1767"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="2396,1464, 2479,1513, 2487,1527, 2475,1539, 2449,1536, 2360,1484"/>
</line>
<line type="5" name="" fill="1" fillscale="1">
<points a="1584,703, 1564,739, 1501,746, 1445,735, 1388,747, 1349,728, 1347,697, 1381,680, 1437,683, 1471,667"/>
<points a="1556,672"/>
</line>
<line type="5" name="" fill="2" fillscale="1">
<points a="1824,2147, 1817,2185, 1773,2204, 1712,2196, 1683,2162, 1720,2108, 1781,2113"/>
</line>
<line type="5" name="" fill="3" fillscale="1">
<points a="2260,1217, 2298,1242, 2292,1273, 2247,1295, 2181,1284, 2162,1252, 2191,1220"/>
</line>
<line type="2" name="0" fill="0" fillscale="1">
<points a="1577,1617, 1579,1808"/>
</line>
<line type="2" name="1" fill="0" fillscale="1">
<points a="1952,1636, 1850,1837"/>
</line>
<line type="2" name="2" fill="0" fillscale="1">
<points a="2276,1919, 1951,1945"/>
</line>
<line type="2" name="3" fill="0" fillscale="1">
<points a="2026,2258, 1883,2067"/>
</line>
<line type="2" name="4" fill="0" fillscale="1">
<points a="1630,2320, 1678,2107"/>
</line>
<line type="2" name="5" fill="0" fillscale="1">
<points a="1239,2187, 1373,2042"/>
</line>
<line type="2" name="6" fill="0" fillscale="1">
<points a="887,1982, 909,1762"/>
</line>
<line type="2" name="7" fill="0" fillscale="1">
<points a="558,1955, 546,1735"/>
</line>
<line type="2" name="8" fill="0" fillscale="1">
<points a="404,1999, 69,1992"/>
</line>
<line type="2" name="9" fill="0" fillscale="1">
<points a="456,2025, 438,2249"/>
</line>
<line type="2" name="10" fill="0" fillscale="1">
<points a="560,1965, 877,2004"/>
</line>
<line type="2" name="11" fill="0" fillscale="1">
<points a="556,1737, 874,1709"/>
</line>
<line type="2" name="12" fill="0" fillscale="1">
<points a="403,1597, 677,1485"/>
</line>
<line type="2" name="13" fill="0" fillscale="1">
<points a="415,1223, 671,1373"/>
</line>
<line type="2" name="14" fill="0" fillscale="1">
<points a="922,1101, 900,1317"/>
</line>
<line type="2" name="15" fill="0" fillscale="1">
<points a="1220,1189, 1213,1423"/>
</line>
<line type="2" name="16" fill="0" fillscale="1">
<points a="1312,1196, 1559,1341"/>
</line>
<line type="2" name="17" fill="0" fillscale="1">
<points a="1283,1169, 1512,1022"/>
</line>
<line type="2" name="18" fill="0" fillscale="1">
<points a="1024,1015, 1220,842"/>
</line>
<line type="2" name="19" fill="0" fillscale="1">
<points a="723,835, 1010,716"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="784,541, 1024,695"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1226,492, 1113,717"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1454,530, 1449,864"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1675,520, 1774,795"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1958,481, 1946,701"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2163,609, 2008,712"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2264,867, 1961,749"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2025,1014, 1687,974"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2019,1192, 1685,1233"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2011,1271, 1724,1413"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2245,1441, 2046,1630"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2381,1465, 2534,1661"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2392,1424, 2582,1243"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2299,1403, 2289,1184"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="2241,1446, 2016,1266"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1867,1619, 1705,1417"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1547,1614, 1542,1420"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1322,1616, 1245,1428"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1255,1620, 975,1629"/>
</line>
<line type="2" name="" fill="0" fillscale="1">
<points a="1342,1622, 1332,1814"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="306,1874, 323,1892, 297,1900, 277,1884"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="244,1911, 262,1929, 240,1940, 218,1926"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="306,1945, 322,1961, 299,1972, 278,1954"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="190,1964, 211,1982, 188,1993, 165,1977"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="262,1990, 283,2009, 261,2024, 237,2007"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="211,2033, 234,2049, 211,2062, 186,2048"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="314,2044, 332,2059, 310,2073, 289,2056"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="370,2053, 391,2068, 368,2083, 346,2064"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="361,2111, 383,2128, 362,2144, 336,2129"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="272,2092, 293,2106, 268,2121, 245,2105"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="363,1988, 385,2005, 366,2022, 334,2007"/>
</line>
<line type="4" name="" fill="0" fillscale="1">
<points a="396,2017, 420,2036, 389,2048, 373,2031"/>
</line>
<line type="3" name="" fill="0" fillscale="1">
<points a="1968,762, 2089,845, 2030,879, 1915,808"/>
</line>
<line type="5" name="" fill="5" fillscale="1">
<points a="2097,846, 2135,857, 2146,887, 2121,909, 2067,910, 2038,888"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1822,1051, 1960,1052, 1961,1085, 1819,1085"/>
</line>
<line type="0" name="" fill="0" fillscale="1">
<points a="1744,1223, 1878,1225, 1882,1266, 1736,1266"/>
</line>
</level>
<!-- *************************** Dynamic Objects ******************************* -->
<physobj name="startpos" inlibrary="true" initfunction="InitPhysObj_StartPos">
<body name="body" pos="0,0" fixed="false" sensor="false">
</body>
</physobj>
<physobj name="playervehicle" inlibrary="true" initfunction="InitPhysObj_PlayerVehicle">
<body name="body" pos="0,0" fixed="false" sensor="false">
<graphic clip="Car01" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitPlayerVehicle"/>
<shape type="poly" name="" col="4,7" vertices="-20,-11, 15,-7, 20,0, 15,7, -20,11" density="0.1" friction="0.2" restitution="0.1"/>
</body>
</physobj>
<physobj name="aivehicle" inlibrary="true" initfunction="InitPhysObj_AIVehicle">
<body name="body" pos="0,0" fixed="false" sensor="false">
<graphic clip="Car02" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitAIVehicle"/>
<shape type="poly" name="" col="4,7" vertices="-20,-11, 15,-7, 20,0, 15,7, -20,11" density="0.1" friction="0.2" restitution="0.1"/>
</body>
</physobj>
<!-- *************************** Overlay objects level 1****************************** -->
<physobj name="lev01_overlay01" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level01_Overlays" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev01_overlay02" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level01_Overlays" frame="2" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev01_overlay03" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level01_Overlays" frame="3" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev01_overlay04" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level01_Overlays" frame="4" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev01_overlay05" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level01_Overlays" frame="5" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev01_overlay06" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level01_Overlays" frame="6" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev01_overlay07" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level01_Overlays" frame="7" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev01_overlay08" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level01_Overlays" frame="8" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev01_overlay09" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level01_Overlays" frame="9" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<!-- *************************** Overlay objects Level 2******************************* -->
<physobj name="lev02_overlay01" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay02" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="2" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay03" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="3" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay04" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="4" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay05" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="5" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay06" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="6" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay07" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="7" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay08" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="8" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay09" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="9" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay10" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="10" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay11" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="11" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay12" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="12" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay13" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="13" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay14" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="14" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay15" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="15" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay16" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="16" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay17" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="17" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev02_overlay18" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level02_Overlays" frame="18" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<!-- *************************** Overlay objects level 3****************************** -->
<physobj name="lev03_overlay01" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level03_Overlays" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev03_overlay02" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level03_Overlays" frame="2" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev03_overlay03" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level03_Overlays" frame="3" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev03_overlay04" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level03_Overlays" frame="4" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev03_overlay05" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level03_Overlays" frame="5" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev03_overlay06" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level03_Overlays" frame="6" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev03_overlay07" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level03_Overlays" frame="7" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev03_overlay08" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level03_Overlays" frame="8" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<!-- *************************** Overlay objects Level 4******************************* -->
<physobj name="lev04_overlay01" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level04_Overlays" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev04_overlay02" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level04_Overlays" frame="2" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev04_overlay03" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level04_Overlays" frame="3" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev04_overlay04" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level04_Overlays" frame="4" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev04_overlay05" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level04_Overlays" frame="5" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev04_overlay06" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level04_Overlays" frame="6" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev04_overlay07" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level04_Overlays" frame="7" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev04_overlay08" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level04_Overlays" frame="8" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev04_overlay09" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level04_Overlays" frame="9" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<physobj name="lev04_overlay10" inlibrary="true">
<body name="body" pos="0,0" fixed="true" sensor="false">
<graphic clip="Level04_Overlays" frame="10" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitOverlay"/>
</body>
</physobj>
<!-- *************************** Movable Objects ******************************* -->
<physobj name="cone" inlibrary="true" initfunction="InitPhysObj_Cone">
<body name="body" pos="0,0" fixed="false" sensor="false" lineardamping="2" angulardamping="1">
<graphic clip="cone_clip" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitSortByY"/>
<shape type="circle" pos="0,0" name="" col="1,15" radius="12" density="0.1" friction="0.1" restitution="0.5"/>
</body>
</physobj>
<physobj name="mallow" inlibrary="true" initfunction="InitPhysObj_Cone">
<body name="body" pos="0,0" fixed="false" sensor="false" lineardamping="2" angulardamping="1">
<graphic clip="mallow_clip" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitSortByY"/>
<shape type="circle" pos="0,0" name="" col="1,15" radius="12" density="0.1" friction="0.1" restitution="0.5"/>
</body>
</physobj>
<physobj name="icecream" inlibrary="true" initfunction="InitPhysObj_Cone">
<body name="body" pos="0,0" fixed="false" sensor="false" lineardamping="2" angulardamping="1">
<graphic clip="icecream_clip" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitSortByY"/>
<shape type="circle" pos="0,0" name="" col="1,15" radius="12" density="0.1" friction="0.1" restitution="0.5"/>
</body>
</physobj>
<physobj name="mushroom" inlibrary="true" initfunction="InitPhysObj_Cone">
<body name="body" pos="0,0" fixed="false" sensor="false" lineardamping="2" angulardamping="1">
<graphic clip="mushroom_clip" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitSortByY"/>
<shape type="circle" pos="0,0" name="" col="1,15" radius="12" density="0.1" friction="0.1" restitution="0.5"/>
</body>
</physobj>
<!-- *************************** Pickups ******************************* -->
<physobj name="pickup01" inlibrary="true" initfunction="InitPhysObj_Pickup">
<body name="body" pos="0,0" fixed="true" sensor="true" lineardamping="1" angulardamping="1">
<graphic clip="Pickup" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitPickup"/>
<shape type="circle" pos="0,0" name="" col="1,15" radius="20" density="0.5" friction="1" restitution="0.5"/>
</body>
</physobj>
<physobj name="turbopickup" inlibrary="true" initfunction="InitPhysObj_TurboPickup">
<body name="body" pos="0,0" fixed="true" sensor="true" lineardamping="1" angulardamping="1">
<graphic clip="turbo_clip" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitPickup"/>
<shape type="circle" pos="0,0" name="" col="1,15" radius="20" density="0.5" friction="1" restitution="0.5"/>
</body>
</physobj>
<achievements>
<achievement level="0" name="Win The Race" desc="Come first place" wwid="4">
<testfunction name="AchTest_FinishInPlace" vars="place=1"/>
<passfunction name="AchPass_UnlockLevel" vars="unlocklevel=1"/>
</achievement>
<achievement level="0" name="Cone Collider" desc="Hit all of the cones" wwid="8">
<testfunction name="AchTest_HitAllCones"/>
<passfunction name="AchPass_UnlockLevel" vars="unlocklevel=1"/>
</achievement>
<achievement level="0" name="Bouncy Bouncy" desc="Hit every jump on each lap" wwid="9">
<testfunction name="AchTest_HitEveryJump"/>
<passfunction name="AchPass_Points" vars="unlockpoints=1000"/>
</achievement>
<achievement level="0" name="Racing Line" desc="Don't go off the track" wwid="10">
<testfunction name="AchTest_OffTrack"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
<achievement level="1" name="Win The Race" desc="Come first place" wwid="5">
<testfunction name="AchTest_FinishInPlace" vars="place=1"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
<achievement level="1" name="Toaster Triumph" desc="Win with Wez's Toastarossa" wwid="11">
<testfunction name="AchTest_FinishInPlaceWithVehicle" vars="place=1,vehicle=2"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
<achievement level="1" name="Rush Room" desc="Avoid all the mushrooms" wwid="12">
<testfunction name="AchTest_AvoidAllCones"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
<achievement level="1" name="Hidden Treasure" desc="Collect all of the coins" wwid="13">
<testfunction name="AchTest_CollectAllCoins"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
<achievement level="2" name="Win The Race" desc="Come first place" wwid="6">
<testfunction name="AchTest_FinishInPlace" vars="place=1"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
<achievement level="2" name="Sandy Skids" desc="Score over 80 for a skid" wwid="14">
<testfunction name="AchTest_BestSkid" vars="score=80"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
<achievement level="2" name="Turbo Island" desc="Collect all the Turbos on every lap" wwid="15">
<testfunction name="AchTest_HitEveryTurboOnEveryLap"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
<achievement level="2" name="I Scream" desc="Avoid all the ice cream cones" wwid="16">
<testfunction name="AchTest_AvoidAllCones"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
<achievement level="3" name="Win The Race" desc="Come first place" wwid="7">
<testfunction name="AchTest_FinishInPlace" vars="place=1"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
<achievement level="3" name="Avoid the Crush" desc="Don't get bashed by another car" wwid="17">
<testfunction name="AchTest_AvoidAllCars"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
<achievement level="3" name="I Like Silver" desc="Come exactly second place" wwid="18">
<testfunction name="AchTest_FinishInPlace" vars="place=2"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
<achievement level="3" name="Sticky Situations" desc="Avoid all the gloop" wwid="19">
<testfunction name="AchTest_AvoidGloop"/>
<passfunction name="AchPass_UnlockVehicle" vars="unlockvehicle=1"/>
</achievement>
</achievements>
</data>
;
public static var gameconstants:Object;
static var cb:Function;
public static function GetConstants(){
var _local3:XML;
constants = new Object();
var _local1:int = xml.constants.constant.length();
var _local2:int;
while (_local2 < _local1) {
_local3 = xml.constants.constant[_local2];
constants[_local3.@name] = _local3.@value;
_local2++;
};
gameconstants = new Object();
_local1 = xml.gameconstants.constant.length();
_local2 = 0;
while (_local2 < _local1) {
_local3 = xml.gameconstants.constant[_local2];
gameconstants[_local3.@name] = _local3.@value;
_local2++;
};
}
public static function Load(_arg1:Function){
cb = _arg1;
XmlLoadedInternal();
}
public static function OutputString(_arg1:String){
System.setClipboard(_arg1);
}
static function XmlLoadedInternal(){
var _local1:int;
XML.ignoreWhitespace = true;
xml = new XML(xxx);
GetConstants();
cb();
}
public static function xmlLoaded(_arg1:Event){
var _local2:int;
XML.ignoreWhitespace = true;
xml = new XML(_arg1.target.data);
GetConstants();
cb();
}
}
}//package
Section 136
//Font20 (Font20)
package {
import flash.text.*;
public dynamic class Font20 extends Font {
}
}//package
Section 137
//Game (Game)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
import flash.utils.*;
import org.flashdevelop.utils.*;
import flash.ui.*;
import flash.system.*;
public class Game {
static const levelFinishedState_WON = 1;
static const levelState_Play = 1;
static const colCategory_Background:int = 1;
static const levelState_Complete = 4;
static const colCategory_Pellet:int = 4;
static const levelFinishedState_NOT = 0;
static const levelState_Editor = 3;
static const levelState_EndScreen = 5;
static const levelFinishedState_LOST = 2;
static const colCategory_Ball:int = 2;
static const levelState_Null = 2;
static const levelState_LevelStart = 0;
public static var scrollCX:Number;
public static var scrollCY:Number;
static var currentBikeIndex:int = 0;
static var goReadySetGo:GameObj;
static var playerRecording:Array;
public static var backWheelUpTimer:int = 0;
static var playerTurnDiff:Number;
static var bgFrame:int;
public static var bikeWheelUpTimer:int;
static var levelAchievementAwarded:int;
public static var playerHitFloorTimerMax:int;
static var player_calculated_boostmul:Number;
static var currentStartPointIndex:int;
public static var numVehicles:int;
public static var currentWorldID:int = 0;
static var pickupHitTimerMax:int;
public static var maxFallSpeed;
static var physObjs:PhysObjs;
static var numLevels:int;
static var numCarCollisions:int;
static var currentScore:int;
static var wrongWayFlag:Boolean;
public static var boostTimerMax:int;
public static var frontWheelieTimer:int = 0;
static var score_hitCone:int = 10;
public static var playerHitFloorMaxRot:Number;
public static var LevelUpdateCallback:Object;
static var canShootPellet:Boolean;
static var playerVehiclePropulsionType:int = 0;
static var readySetGoFrame:int;
public static var gettingReady:Boolean;
static var switchFlag:int = 0;
static var scrollMaxVel:Number;
static var playerTotalCheckpointIndex:int;
public static var levelForwardSomersaults:int = 0;
static var scrollToDX:Number = 0;
static var numBikes:int;
public static var oldPlayerRot:Number = 0;
static var totalCones:int;
static var scrollToDY:Number = 0;
static var shootHeldTime:int = 0;
public static var bikeWheelDownTimer:int;
static var frameAngs:Array;
public static var polygonList:Array;
static var pvar02:Number = 0;
static var numCreds:int;
static var pvar03:Number = 0;
public static var timesList:Array;
static var sitelocked:Boolean = false;
static var pvar01:Number = 0;
static var numLives:int;
public static var playerHitFloorTimer:int;
public static var playerCurrentSkidDist:int;
static var usedebug:Boolean = false;
static var w2p:Number = (1 / p2w);
static var numTurbos:int;
static var shakeCamDX:Number = 0;
static var shakeCamDY:Number = 0;
static var mouseox:Number = 0;
static var playerTurnDiffAbs:Number;
static var hoseTimer:int = 0;
static var numConesHit:int;
static var levels:Array;
public static var backWheelDown:Boolean;
public static var boostTimer:int;
public static var playerBestLevelSkidScore:int;
static var previousStaticPoints:Array;
static var currentLevel:int;
static var playerOldX:Number = 0;
static var shakeCamToX:Number = 0;
static var shakeCamToY:Number = 0;
static var playerX:Number = 0;
static var fr_edit:Number;
public static var boostLevel:Number;
static var levelStateCount:int;
static var scrollVel:Number;
static var panelOverlay:MovieClip;
static var numBallsActiveMax:int = 5;
static var canUseObject:Boolean = false;
static var main:Main;
static var score_jump:int = 5;
static var multiplier:int;
public static var boostMultiplier:int;
static var mousetimer:int = 0;
static var everyTurboTable:Array;
static var levscore_pickups:int;
static var lastGeneratedGameObj:GameObj;
static var shakeCamTimer:int = 50;
static var goPlayer:GameObj;
static var shakeCamTimerMax:int = 50;
static var pause:Boolean;
public static var currentCarIndex:int;
public static var playerRotMode:int;
static var oldRecordPosX:Number;
static var oldRecordPosY:Number;
static var backgroundBD:BitmapData;
static var doRender:Boolean;
static var pickupHitTimer:int;
public static var playerRotLeaveGround:Number;
static var selectedCarType:int;
static var levelFinishedState:int;
static var challengesAchievementAwarded:int;
static var numJumps:int;
static var panelRect:Rectangle = new Rectangle(200, 10, 200, 10);
static var levelTimer:int;
static var player_acc:Number = 200;
public static var finalRaceOrder:Array;
static var bgTimer:Number = 0;
static var plungerHeldTimer:int = 0;
public static var playerHitFloor:Boolean;
public static var gravity;
static var shootMode:int = 0;
static var pickupHitInRowCount:int;
public static var frontWheelDown:Boolean;
public static var frontWheelUpTimer:int = 0;
static var scrollAcc:Number;
static var score_hitPickup:int = 5;
static var scrollScale:Number = 1;
static var shakeCamY:Number = 0;
public static var scrollXa:Number;
public static var levelBackSomersaults:int = 0;
static var levscore_obstacles:int;
static var currentProjectileType:int = 0;
static var shakeCamX:Number = 0;
public static var scrollYa:Number;
static var player_maxvel:Number = 30;
static var physGravity:Number = 0;
public static var levelFrontWheelieTime:int = 0;
static var hoseMode:int = 0;
static var mouseJoint:b2MouseJoint = null;
public static var numLaps:int;
static var pauseGameplayInput:Boolean;
static var goneOffTrack:Boolean;
static var raceTimer:int;
static var p2w:Number = 20;
static var numPigsSacrificed:int = 0;
static var score_skid:Number = 0.5;
public static var raceOrder:Array;
static var selectedCarPropulsion:int;
static var playerFrame:int;
static var player_calculated_brake:Number;
public static var levelAirTime:int = 0;
static var numBallsActive:int = 0;
static var numPickups:int;
public static var scrollH:Number;
public static var levelWheelieTime:int = 0;
public static var achievements:Achievements;
static var panelRect1:Rectangle = new Rectangle(200, 3, 200, 5);
public static var scrollW:Number;
public static var scrollX:Number;
public static var scrollY:Number;
static var soundon:Boolean = true;
static var playerPosition:int = 0;
static var cash:int;
static var levscore_skids:int;
static var numPickupsCollected:int;
public static var playerRot:Number = 0;
static var dustAccum:Number = 0;
static var player_calculated_angvel:Number;
public static var numCollisionTests:int;
public static var playerCarIndex:int;
static var miniMapH:int = 160;
static var everyJumpTable:Array;
static var physNumIterations:int = 20;
static var levelState:int;
static var numWeapons:int = 5;
static var numBalloonsActive:int = 0;
static var physObjInstances:PhysObj_Instances;
static var player_calculated_maxvel:Number;
static var miniMapW:int = 140;
static var level_instances:Array;
public static var playerRotCount:int;
public static var world:b2World;
static var playerRecordingFlag:int = 0;
static var player_calculated_acc:Number;
static var selectedCarColor:uint = 0;
static var zsortoffset:Number = 0;
static var plungerMaxTime:int = (Defs.fps * 1);
static var hitGloop:Boolean;
public static var playerTotalSkidDist:int;
static var cursorY:Number = 0;
public static var maxBoostMultiplier:int = 5;
static var groundBody:b2Body;
public static var bikeWheelDown:Boolean;
public static var wheelieTimer:int = 0;
static var cursorX:Number = 0;
static var levelStateTimer:int;
static var currentGameMusic:int;
static var levscore_jumps:int;
static var playerFinishedTime:int = 0;
static var scrollMaxX;
static var startPoints:Array;
public static var boostMode:int;
static var scrollMaxY;
static var oldSelectedCarColor:uint = 0;
public static var currentAiCarIndex:int;
public static function GetPlayerPosition(){
var _local1:int;
var _local2:int;
var _local3:PhysObj_Instance;
var _local4:Point;
var _local5:Point;
_local1 = 0;
playerPosition = -1;
for each (_local3 in physObjInstances.list) {
if (((_local3.isVehicle) && (_local3.isPlayer))){
raceOrder[_local1].x = _local1;
raceOrder[_local1].y = _local3.totalVehicleCheckpointIndex;
_local1++;
};
};
for each (_local3 in physObjInstances.list) {
if (((_local3.isVehicle) && ((_local3.isPlayer == false)))){
raceOrder[_local1].x = _local1;
raceOrder[_local1].y = _local3.totalVehicleCheckpointIndex;
_local1++;
};
};
_local1 = 0;
while (_local1 < (6 - 1)) {
_local2 = (_local1 + 1);
while (_local2 < 6) {
_local4 = raceOrder[_local1].clone();
_local5 = raceOrder[_local2].clone();
if (_local5.y > _local4.y){
raceOrder[_local1] = _local5;
raceOrder[_local2] = _local4;
};
_local2++;
};
_local1++;
};
_local1 = 0;
while (_local1 < 6) {
if (raceOrder[_local1].x == 0){
playerPosition = _local1;
};
_local1++;
};
}
public static function RemoveObj_Standard(_arg1:PhysObj_Instance){
physObjInstances.Remove(_arg1);
}
public static function RemoveObj_BallInHopper(_arg1:PhysObj_Instance){
physObjInstances.Remove(_arg1);
}
public static function ApplyImpulseToObjectsFromPoint(_arg1:PhysObj_Instance, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:Number;
var _local7:b2Body;
var _local8:PhysObj_BodyUserData;
var _local9:PhysObj_Instance;
var _local10:int;
var _local11:b2Vec2;
var _local12:Number;
_local7 = world.GetBodyList();
while (_local7) {
if (_local7.GetUserData() != -1){
_local8 = _local7.GetUserData();
_local9 = _local8.instance;
if (_local9 != null){
_local10 = _local9.colflags;
if (_local9 != _arg1){
_local11 = new b2Vec2((_local7.GetWorldCenter().x - _arg2), (_local7.GetWorldCenter().y - _arg3));
_local6 = _local11.Length();
if (_local10 == 0){
if (_local6 <= _arg5){
_local11.Normalize();
_local12 = Utils.ScaleTo(0, _arg4, 0, _arg5, (_arg5 - _local6));
_local11.Multiply(_local12);
_local7.ApplyImpulse(_local11, _local7.GetWorldCenter());
};
} else {
if (_local10 == 1){
} else {
if (_local10 == 2){
_local9.BreakObject(_local6);
};
};
};
};
};
};
_local7 = _local7.GetNext();
};
}
static function AddPhysObjAt(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:String="", _arg6:String=""):PhysObj_Instance{
var _local10:Number;
var _local11:Number;
var _local12:b2BodyDef;
var _local13:b2Body;
var _local14:b2PolygonDef;
var _local15:b2CircleDef;
var _local16:int;
var _local17:b2Joint;
var _local19:PhysObj_Body;
var _local20:PhysObj_Joint;
var _local21:Number;
var _local22:Number;
var _local23:Point;
var _local24:PhysObj_BodyUserData;
var _local25:PhysObj_Shape;
var _local26:PhysObj_Graphic;
var _local27:b2FilterData;
var _local28:Point;
var _local29:Number;
var _local30:Number;
var _local31:Point;
var _local32:int;
var _local33:int;
var _local34:b2Body;
var _local35:b2Body;
var _local36:b2RevoluteJointDef;
var _local37:b2PrismaticJointDef;
var _local38:Number;
var _local39:b2Vec2;
var _local40:b2DistanceJointDef;
var _local41:Number;
var _local42:Number;
var _local43:b2MouseJointDef;
var _local7:PhysObj = physObjs.FindByName(_arg1);
var _local8:PhysObj_Instance = new PhysObj_Instance();
_local8.typeName = _arg1;
_local8.x = _arg2;
_local8.y = _arg3;
_local8.rot = _arg4;
_local8.bodies = new Array();
_local8.instanceName = _arg5;
_local8.initParams = _arg6;
_local8.hitballsound = _local7.hitballsound;
physObjInstances.list.push(_local8);
_local8.Init();
var _local9:Number = Utils.DegToRad(_arg4);
_arg2 = (_arg2 * w2p);
_arg3 = (_arg3 * w2p);
var _local18:Matrix = new Matrix();
_local18.rotate(_local9);
for each (_local19 in _local7.bodies) {
_local12 = new b2BodyDef();
_local21 = (_local19.pos.x * w2p);
_local22 = (_local19.pos.y * w2p);
_local23 = new Point(_local21, _local22);
_local23 = _local18.transformPoint(_local23);
_local21 = _local23.x;
_local22 = _local23.y;
_local12.position.Set((_arg2 + _local21), (_arg3 + _local22));
_local12.angularDamping = _local19.angularDamping;
_local12.linearDamping = _local19.linearDamping;
_local12.angle = _local9;
_local13 = world.CreateBody(_local12);
_local24 = new PhysObj_BodyUserData();
_local24.type = _arg1;
_local24.bodyName = _local19.name;
_local24.instance = _local8;
_local13.SetUserData(_local24);
if (_local19.graphics.length != 0){
_local26 = _local19.graphics[0];
_local24.gameObjectID = InitPhysicsGO(_arg2, _arg3, _local26, _local26.graphicID, _local26.frame, 1000);
};
for each (_local25 in _local19.shapes) {
_local27 = new b2FilterData();
_local27.categoryBits = _local25.collisionCategory;
_local27.maskBits = _local25.collisionMask;
if (_local25.type == PhysObj_Shape.Type_Poly){
_local14 = new b2PolygonDef();
_local14.vertexCount = _local25.poly_points.length;
_local14.filter = _local27;
_local14.isSensor = _local19.sensor;
_local16 = 0;
while (_local16 < _local25.poly_points.length) {
_local28 = _local25.poly_points[_local16].clone();
_local29 = (_local28.x * w2p);
_local30 = (_local28.y * w2p);
if (_local19.fixed){
_local31 = AlignWithPreviousVerts(_local29, _local30, _arg2, _arg3, _local9);
if (_local31 != null){
_local29 = (_local29 + _local31.x);
_local30 = (_local30 + _local31.y);
};
};
_local14.vertices[_local16].Set(_local29, _local30);
_local16++;
};
_local14.friction = _local25.friction;
_local14.restitution = _local25.restitution;
_local14.density = _local25.density;
_local13.CreateShape(_local14);
} else {
if (_local25.type == PhysObj_Shape.Type_Circle){
_local15 = new b2CircleDef();
_local15.radius = (_local25.circle_radius * w2p);
_local15.filter = _local27;
_local15.isSensor = _local19.sensor;
_local15.localPosition.x = _local25.circle_pos.x;
_local15.localPosition.y = _local25.circle_pos.y;
_local15.friction = _local25.friction;
_local15.restitution = _local25.restitution;
_local15.density = _local25.density;
_local13.CreateShape(_local15);
};
};
};
if (_local19.fixed){
_local13.PutToSleep();
_local13.SetMass(new b2MassData());
} else {
_local13.SetMassFromShapes();
_local13.SetBullet(true);
};
_local8.bodies.push(_local13);
};
for each (_local20 in _local7.joints) {
_local32 = _local7.BodyIndexFromName(_local20.obj0Name);
_local33 = _local7.BodyIndexFromName(_local20.obj1Name);
_local34 = _local8.bodies[_local32];
_local35 = _local8.bodies[_local33];
if (_local20.type == PhysObj_Joint.Type_Rev){
_local36 = new b2RevoluteJointDef();
_local10 = (_local20.rev_pos.x * w2p);
_local11 = (_local20.rev_pos.y * w2p);
_local23 = new Point(_local10, _local11);
_local23 = _local18.transformPoint(_local23);
_local10 = _local23.x;
_local11 = _local23.y;
_local36.Initialize(_local34, _local35, new b2Vec2((_arg2 + _local10), (_arg3 + _local11)));
_local36.enableLimit = _local20.rev_enableLimit;
_local36.lowerAngle = _local20.rev_lowerAngle;
_local36.upperAngle = _local20.rev_upperAngle;
_local36.enableMotor = _local20.rev_enableMotor;
_local36.motorSpeed = _local20.rev_motorSpeed;
_local36.maxMotorTorque = _local20.rev_maxMotorTorque;
_local36.collideConnected = false;
_local17 = world.CreateJoint(_local36);
};
if (_local20.type == PhysObj_Joint.Type_Prismatic){
_local37 = new b2PrismaticJointDef();
_local10 = (_local20.prism_pos.x * w2p);
_local11 = (_local20.prism_pos.y * w2p);
_local23 = new Point(_local10, _local11);
_local23 = _local18.transformPoint(_local23);
_local10 = _local23.x;
_local11 = _local23.y;
_local38 = Utils.DegToRad(_local20.prism_axisangle);
_local38 = (_local38 + _local9);
_local39 = new b2Vec2(Math.cos(_local38), Math.sin(_local38));
_local37.Initialize(_local34, _local35, new b2Vec2((_arg2 + _local10), (_arg3 + _local11)), _local39);
_local37.enableLimit = _local20.prism_enableLimit;
_local37.lowerTranslation = (_local20.prism_lowerTranslation * w2p);
_local37.upperTranslation = (_local20.prism_upperTranslation * w2p);
_local37.enableMotor = _local20.prism_enableMotor;
_local37.motorSpeed = _local20.prism_motorSpeed;
_local37.maxMotorForce = _local20.prism_maxMotorForce;
_local37.collideConnected = false;
_local17 = world.CreateJoint(_local37);
};
if (_local20.type == PhysObj_Joint.Type_Distance){
_local40 = new b2DistanceJointDef();
_local10 = (_local20.dist_pos0.x * w2p);
_local11 = (_local20.dist_pos0.y * w2p);
_local41 = (_local20.dist_pos1.x * w2p);
_local42 = (_local20.dist_pos1.y * w2p);
_local23 = new Point(_local10, _local11);
_local23 = _local18.transformPoint(_local23);
_local10 = _local23.x;
_local11 = _local23.y;
_local23 = new Point(_local41, _local42);
_local23 = _local18.transformPoint(_local23);
_local41 = _local23.x;
_local42 = _local23.y;
_local40.Initialize(_local34, _local35, new b2Vec2((_arg2 + _local10), (_arg3 + _local11)), new b2Vec2((_arg2 + _local41), (_arg3 + _local42)));
_local40.length = (_local40.length + (_local20.dist_distance * w2p));
_local40.dampingRatio = 0.1;
_local40.collideConnected = false;
_local17 = world.CreateJoint(_local40);
};
if (_local20.type == PhysObj_Joint.Type_Mouse){
_local43 = new b2MouseJointDef();
_local43.target.Set(_local34.GetPosition().x, _local34.GetPosition().y);
_local43.body1 = world.GetGroundBody();
_local43.body2 = _local34;
_local43.maxForce = (30000 * _local34.GetMass());
_local43.dampingRatio = 0.7;
_local43.frequencyHz = 10;
_local43.timeStep = (1 / 60);
_local17 = world.CreateJoint(_local43);
mouseJoint = (_local17 as b2MouseJoint);
};
_local8.joints.push(_local17);
};
return (_local8);
}
public static function CollideWithMincer(_arg1:PhysObj_Instance){
_arg1.collideFunction = null;
_arg1.collidetimer = 0;
physObjInstances.Remove(_arg1);
numBallsActive--;
numPigsSacrificed++;
_arg1.collideWithInstance.TriggerPhysObj_Mincer();
}
static function GetInitialStartPoint():Point{
var _local2:Point;
var _local1:Point;
var _local3:Number = 999999;
for each (_local2 in startPoints) {
if (_local2.x < _local3){
_local3 = _local2.x;
_local1 = _local2;
};
};
return (_local1);
}
public static function CollideWithCannon(_arg1:PhysObj_Instance){
DoCannon(_arg1);
_arg1.collideFunction = null;
_arg1.collidetimer = 0;
}
static function NextLevel():void{
currentLevel++;
if (currentLevel >= levels.length){
currentLevel = 0;
};
StartLevelPlay();
}
public static function InitLevel(){
InitLevel1();
}
public static function CarFinishedRace(_arg1:int):void{
finalRaceOrder.push(_arg1);
if (_arg1 == playerCarIndex){
InitLevelState(levelState_Complete);
};
}
static function UpdateControl(){
var _local1:PhysObj_Instance = physObjInstances.FindByTypeName("playervehicle");
if (_local1 == null){
return;
};
var _local2:b2Vec2 = _local1.GetBodyWorldPos(0);
}
public static function StartLevelPlay2():void{
var _local5:GameObj;
var _local6:int;
var _local1:Number = getTimer();
KeyReader.InitOnce(main.stage);
main.InitStageForGame();
var _local2:Level = GetCurrentLevel();
startPoints = new Array();
Particles.Reset();
InitBox2D();
previousStaticPoints = new Array();
mouseJoint = null;
numVehicles = 0;
currentCarIndex = 0;
currentAiCarIndex = 0;
numPickups = 0;
numConesHit = 0;
numCarCollisions = 0;
totalCones = 0;
goneOffTrack = false;
hitGloop = false;
numTurbos = 0;
playerVehiclePropulsionType = selectedCarPropulsion;
GameObjects.ClearAll();
physObjInstances = new PhysObj_Instances();
InitLevelPlayFromEditorObjects();
InitLevelState(levelState_LevelStart);
var _local3:Number = 100;
var _local4:Number = 100;
if (startPoints.length != 0){
_local3 = GetInitialStartPoint().x;
_local4 = GetInitialStartPoint().y;
};
InitFloor();
bgFrame = 0;
pause = false;
pauseGameplayInput = false;
playerHitFloor = false;
playerHitFloorTimer = 0;
bikeWheelDown = false;
ResetBoost();
playerBestLevelSkidScore = 0;
levelAirTime = 0;
levelWheelieTime = 0;
levelFrontWheelieTime = 0;
levelBackSomersaults = 0;
levelForwardSomersaults = 0;
levelTimer = 0;
playerOldX = 0;
playerX = 0;
dustAccum = 0;
numBallsActive = 0;
numPigsSacrificed = 0;
gettingReady = true;
goReadySetGo = GameObjects.AddObj(320, 200, 0);
goReadySetGo.InitReadyGetSetGo();
numLaps = 3;
finalRaceOrder = new Array();
raceOrder = new Array();
_local6 = 0;
while (_local6 < 16) {
raceOrder.push(new Point(-1, -1));
_local6++;
};
var _local7:int = GraphicObjects.GetIndexByName("BackgroundLevel01");
_local7 = (_local7 + currentLevel);
GraphicObjects.RenderAt(_local7, 0, backgroundBD, 0, 0);
pickupHitTimer = 0;
pickupHitTimerMax = 20;
pickupHitInRowCount = 0;
numPickupsCollected = 0;
playerTotalSkidDist = 0;
wrongWayFlag = false;
playerTotalCheckpointIndex = 0;
fr_edit = 1.6;
MakeAngs();
levscore_jumps = 0;
levscore_pickups = 0;
levscore_skids = 0;
levscore_obstacles = 0;
currentScore = 0;
panelOverlay.gotoAndStop((currentLevel + 1));
main.addChild(panelOverlay);
panelOverlay.visible = false;
readySetGoFrame = -1;
InitBackgroundSounds();
QuietAllSounds();
MusicPlayer.StopMusic();
MusicPlayer.StartStream(currentLevel);
InitEveryJumpStuff();
InitEveryTurboStuff();
WWorld.StartLevel();
doRender = true;
panelOverlay.visible = true;
if (SoundPlayer.doSFX){
panelOverlay.buttonHolder.buttonMute.gotoAndStop("on");
} else {
panelOverlay.buttonHolder.buttonMute.gotoAndStop("off");
};
}
static function buttonQuitPressed(_arg1:MouseEvent){
TitleScreenState.restart_at_levelselect = true;
main.SetGameState(Main.gameState_TITLE);
}
static function UpdateBoost(){
if (boostMode == 1){
boostTimer--;
if (boostTimer <= 0){
BoostFinished();
};
};
}
public static function RemoveObj_BubbleSplat(_arg1:PhysObj_Instance){
physObjInstances.Remove(_arg1);
var _local2:b2Vec2 = _arg1.GetBodyWorldPos(0);
var _local3:GameObj = GameObjects.AddObj((_local2.x * p2w), (_local2.y * p2w), 10);
var _local4:Number = _arg1.GetBodyAngleFromLinearVelocity(0);
_local3.InitBubbleSplatDrip(_local4);
}
static function StartLevelSounds(){
var _local1:SoundChannel;
}
static function CreatePhysObjInstanceAt(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:String="", _arg6:String=""):PhysObj_Instance{
var _local7:PhysObj_Instance = new PhysObj_Instance();
_local7.typeName = _arg1;
_local7.x = _arg2;
_local7.y = _arg3;
_local7.rot = _arg4;
_local7.bodies = new Array();
_local7.instanceName = _arg5;
_local7.initParams = _arg6;
return (_local7);
}
static function InitBoost(){
boostMode = 1;
boostTimer = (Defs.fps * 10);
boostTimerMax = boostTimer;
}
public static function CollideWithSpringboard(_arg1:PhysObj_Instance){
var _local2:Number = _arg1.collideWithInstance.GetBodyAngle(0);
_local2 = (_local2 - (Math.PI / 2));
var _local3:Number = 2;
var _local4:Number = (Math.cos(_local2) * _local3);
var _local5:Number = (Math.sin(_local2) * _local3);
_arg1.ApplyImpulse(_local4, _local5);
_arg1.collideWithInstance.TriggerPhysObj_Springboard();
_arg1.collideFunction = null;
_arg1.collidetimer = 0;
}
static function UpdateMouseControl(){
var _local1:Number = cursorX;
var _local2:Number = cursorY;
cursorX = (cursorX + ((MouseControl.x - cursorX) * 0.4));
cursorY = (cursorY + ((MouseControl.y - cursorY) * 0.4));
}
static function UpdatePhysObjs():void{
var _local1:PhysObj_Instance;
for each (_local1 in physObjInstances.list) {
_local1.Update();
};
}
static function SetTurboDone(_arg1:int, _arg2:int){
if (_arg1 < 1){
return;
};
var _local3:int = (_arg1 - 1);
var _local4:int = ((_local3 * numTurbos) + _arg2);
everyTurboTable[_local4] = true;
trace(("turbo = " + _local4));
}
public static function BackWheelIsDown():void{
backWheelDown = true;
}
static function InitEveryTurboStuff(){
var _local1:int;
trace(("numTurbos = " + numTurbos));
everyTurboTable = new Array((numTurbos * numLaps));
_local1 = 0;
while (_local1 < everyTurboTable.length) {
everyTurboTable[_local1] = Boolean(false);
_local1++;
};
}
static function InitObjectAtMouse():void{
var _local10:Number;
var _local16:b2Body;
var _local17:b2Shape;
var _local1:Point = new Point(MouseControl.x, MouseControl.y);
var _local2:Matrix = new Matrix();
_local2.translate(scrollX, scrollY);
_local2.translate(-(scrollCX), -(scrollCY));
_local2.scale((1 / scrollScale), (1 / scrollScale));
_local2.translate(scrollCX, scrollCY);
_local1 = _local2.transformPoint(_local1);
var _local3:Number = _local1.x;
var _local4:Number = _local1.y;
var _local5:Array = new Array();
_local5.push("cannonball0");
_local5.push("cannonball1");
_local5.push("cannonball2");
_local5.push("cannonball3");
_local5.push("cannonball4");
_local5.push("cannonball0");
_local5.push("cannonball1");
_local5.push("cannonball2");
_local5.push("cannonball3");
_local5.push("cannonball4");
if (mousetimer > 0){
return;
};
canShootPellet = true;
mousetimer = 10;
var _local6:int = _local10;
zsortoffset = 0;
var _local7:PhysObj_Instance = GetPhysObjInstanceByName("player");
var _local8:b2Vec2 = _local7.GetBodyWorldPos(0);
var _local9:Number = (_local8.x * p2w);
_local10 = (_local8.y * p2w);
var _local11:Number = Utils.RandCircle();
var _local12:PhysObj_Instance = AddPhysObjAt(_local5[currentProjectileType], _local9, _local10, Utils.RadToDeg(_local11), "");
var _local13:Number = Utils.ScaleTo(50, 100, 0, 100, shootHeldTime);
_local11 = Math.atan2((_local4 - _local10), (_local3 - _local9));
var _local14:Number = (Math.cos(_local11) * _local13);
var _local15:Number = (Math.sin(_local11) * _local13);
_local12.SetLinearVelocity(_local14, _local15);
for each (_local16 in _local12.bodies) {
_local16.SetBullet(true);
_local17 = _local16.GetShapeList();
_local17.SetUserData(_local12);
};
}
static function RenderCursor(){
var _local1:BitmapData;
var _local2:int;
var _local3:int;
if (TitleScreenState.showingInstructions){
return;
};
_local1 = main.screenBD;
_local2 = GraphicObjects.GetIndexByName("Cursors");
_local3 = 0;
if (canUseObject){
_local3 = 2;
};
GraphicObjects.RenderAt(_local2, _local3, _local1, MouseControl.x, MouseControl.y);
}
static function InitMessage(_arg1:String, _arg2:Number=320, _arg3:Number=100){
var _local4:GameObj;
_local4 = GameObjects.AddObj(0, 0, 100);
_local4.InitTextMessage(_arg1, _arg2, _arg3);
}
static function InitFloor(){
var _local1:b2BodyDef;
var _local2:b2Body;
var _local3:b2PolygonDef;
var _local4:Point;
var _local5:Point;
var _local6:Point;
var _local7:Point;
var _local8:Point;
var _local9:int;
var _local17:PhysLine;
var _local18:Array;
var _local19:int;
var _local20:PhysObj_BodyUserData;
var _local21:PhysObj_BodyUserData;
var _local22:PhysObj_BodyUserData;
var _local23:PhysObj_BodyUserData;
var _local24:int;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:PhysObj_BodyUserData;
var _local10:PhysObj_BodyUserData = new PhysObj_BodyUserData();
var _local11:PhysObj_BodyUserData = new PhysObj_BodyUserData();
_local11.bodyName = "hump";
var _local12:int;
var _local13:Number = 50;
var _local14:Level = GetCurrentLevel();
var _local15:b2FilterData = new b2FilterData();
_local15.categoryBits = 1;
_local15.maskBits = 15;
var _local16:b2FilterData = new b2FilterData();
_local16.categoryBits = 2;
_local16.maskBits = 2;
numJumps = 0;
for each (_local17 in _local14.lines) {
_local18 = _local17.points;
_local19 = _local17.type;
if (_local19 == 3){
_local1.position.Set(0, 0);
_local2 = world.CreateBody(_local1);
if (_local2 != null){
_local3 = new b2PolygonDef();
_local3.filter = _local15;
_local3.vertexCount = _local18.length;
_local3.isSensor = true;
_local9 = 0;
while (_local9 < _local18.length) {
_local5 = _local18[_local9].clone();
_local3.vertices[_local9].Set((_local5.x * w2p), (_local5.y * w2p));
_local9++;
};
_local3.friction = 0.1;
_local3.restitution = 0.1;
_local3.density = 1;
_local2.CreateShape(_local3);
_local20 = new PhysObj_BodyUserData();
_local20.bodyName = "ramp";
_local20.id = numJumps;
numJumps++;
_local2.SetUserData(_local20);
};
};
if (_local19 == 4){
_local1.position.Set(0, 0);
_local2 = world.CreateBody(_local1);
if (_local2 != null){
_local3 = new b2PolygonDef();
_local3.filter = _local15;
_local3.vertexCount = _local18.length;
_local3.isSensor = true;
_local9 = 0;
while (_local9 < _local18.length) {
_local5 = _local18[_local9].clone();
_local3.vertices[_local9].Set((_local5.x * w2p), (_local5.y * w2p));
_local9++;
};
_local3.friction = 0.1;
_local3.restitution = 0.1;
_local3.density = 1;
_local2.CreateShape(_local3);
_local2.SetUserData(_local11);
};
};
if (_local19 == 5){
_local1.position.Set(0, 0);
_local2 = world.CreateBody(_local1);
if (_local2 != null){
_local3 = new b2PolygonDef();
_local3.filter = _local15;
_local3.vertexCount = _local18.length;
_local3.isSensor = true;
_local9 = 0;
while (_local9 < _local18.length) {
_local5 = _local18[_local9].clone();
_local3.vertices[_local9].Set((_local5.x * w2p), (_local5.y * w2p));
_local9++;
};
_local3.friction = 0.1;
_local3.restitution = 0.1;
_local3.density = 1;
_local2.CreateShape(_local3);
_local21 = new PhysObj_BodyUserData();
_local21.bodyName = "gloop";
_local21.id = _local17.fill;
_local2.SetUserData(_local21);
};
};
if (_local19 == 6){
_local1.position.Set(0, 0);
_local2 = world.CreateBody(_local1);
if (_local2 != null){
_local3 = new b2PolygonDef();
_local3.filter = _local15;
_local3.vertexCount = _local18.length;
_local3.isSensor = true;
_local9 = 0;
while (_local9 < _local18.length) {
_local5 = _local18[_local9].clone();
_local3.vertices[_local9].Set((_local5.x * w2p), (_local5.y * w2p));
_local9++;
};
_local3.friction = 0.1;
_local3.restitution = 0.1;
_local3.density = 1;
_local2.CreateShape(_local3);
_local22 = new PhysObj_BodyUserData();
_local22.bodyName = "arrow";
_local22.id = _local17.fill;
_local2.SetUserData(_local22);
};
};
if (_local19 == 7){
_local1.position.Set(0, 0);
_local2 = world.CreateBody(_local1);
if (_local2 != null){
_local3 = new b2PolygonDef();
_local3.filter = _local15;
_local3.vertexCount = _local18.length;
_local3.isSensor = true;
_local9 = 0;
while (_local9 < _local18.length) {
_local5 = _local18[_local9].clone();
_local3.vertices[_local9].Set((_local5.x * w2p), (_local5.y * w2p));
_local9++;
};
_local3.friction = 0.1;
_local3.restitution = 0.1;
_local3.density = 1;
_local2.CreateShape(_local3);
_local23 = new PhysObj_BodyUserData();
_local23.bodyName = "bridge";
_local2.SetUserData(_local23);
};
};
if (_local19 == 2){
_local9 = 0;
while (_local9 < (_local18.length - 1)) {
_local5 = _local18[_local9].clone();
_local24 = (_local9 + 1);
_local24 = (_local24 % _local18.length);
_local6 = _local18[_local24].clone();
_local7 = _local6.clone();
_local8 = _local5.clone();
_local25 = Math.atan2((_local6.y - _local5.y), (_local6.x - _local5.x));
_local25 = (_local25 + (Math.PI / 2));
_local26 = 30;
_local27 = (Math.cos(_local25) * _local26);
_local28 = (Math.sin(_local25) * _local26);
_local7.x = (_local7.x + _local27);
_local7.y = (_local7.y + _local28);
_local8.x = (_local8.x + _local27);
_local8.y = (_local8.y + _local28);
_local1 = new b2BodyDef();
_local1.position.Set(0, 0);
_local2 = world.CreateBody(_local1);
if (_local2 != null){
_local3 = new b2PolygonDef();
_local3.filter = _local15;
_local3.vertexCount = 4;
_local3.vertices[0].Set((_local5.x * w2p), (_local5.y * w2p));
_local3.vertices[1].Set((_local6.x * w2p), (_local6.y * w2p));
_local3.vertices[2].Set((_local7.x * w2p), (_local7.y * w2p));
_local3.vertices[3].Set((_local8.x * w2p), (_local8.y * w2p));
_local3.isSensor = true;
_local3.friction = 0.1;
_local3.restitution = 0.1;
_local3.density = 1;
_local2.CreateShape(_local3);
_local29 = new PhysObj_BodyUserData();
_local29.bodyName = "checkpoint";
_local29.id = _local12;
trace(("adding checkpoint " + _local12));
_local12++;
_local2.SetUserData(_local29);
};
_local9++;
};
};
if (_local19 <= 0){
if (_local18.length >= 2){
_local9 = 0;
while (_local9 < _local18.length) {
_local5 = _local18[_local9].clone();
_local24 = (_local9 + 1);
_local24 = (_local24 % _local18.length);
_local6 = _local18[_local24].clone();
_local7 = _local6.clone();
_local8 = _local5.clone();
_local25 = Math.atan2((_local6.y - _local5.y), (_local6.x - _local5.x));
_local25 = (_local25 + (Math.PI / 2));
_local26 = 5;
_local27 = (Math.cos(_local25) * _local26);
_local28 = (Math.sin(_local25) * _local26);
_local7.x = (_local7.x + _local27);
_local7.y = (_local7.y + _local28);
_local8.x = (_local8.x + _local27);
_local8.y = (_local8.y + _local28);
_local1 = new b2BodyDef();
_local1.position.Set(0, 0);
_local2 = world.CreateBody(_local1);
if (_local2 != null){
_local3 = new b2PolygonDef();
_local3.filter = _local15;
if (_local19 == 1){
_local3.filter = _local16;
};
_local3.vertexCount = 4;
_local3.vertices[0].Set((_local5.x * w2p), (_local5.y * w2p));
_local3.vertices[1].Set((_local6.x * w2p), (_local6.y * w2p));
_local3.vertices[2].Set((_local7.x * w2p), (_local7.y * w2p));
_local3.vertices[3].Set((_local8.x * w2p), (_local8.y * w2p));
_local3.friction = 0.1;
if (_local19 == 1){
_local3.friction = 0;
};
_local3.restitution = 0.1;
_local3.density = 1;
_local2.CreateShape(_local3);
_local2.SetUserData(_local10);
};
_local9++;
};
};
};
};
}
public static function InitLevelState(_arg1:int){
levelState = _arg1;
levelStateTimer = 0;
if (levelState == levelState_LevelStart){
levelState = levelState_Play;
};
if (levelState == levelState_Complete){
levelStateTimer = (Defs.fps * 2);
playerFinishedTime = levelTimer;
goReadySetGo.ReadySetGoFinishedRace();
};
if (levelState == levelState_EndScreen){
FlashConnect.trace("Level State = EndScreen");
DoEndLevelStuff();
SaveData.Save();
TitleScreenState.InitLevelEndScreen();
};
if (levelState == levelState_Play){
raceTimer = 0;
};
if (levelState == levelState_Editor){
PhysEditor.InitEditor();
PhysEditor.currentLevel = currentLevel;
};
}
static function LevelFailed(){
InitLevelState(levelState_Null);
TitleScreenState.InitLevelFailScreen();
}
static function InitNinjaProjectile(_arg1:Number, _arg2:Number){
var _local14:b2Body;
var _local15:b2Shape;
var _local3:Number = (_arg1 * p2w);
var _local4:Number = (_arg2 * p2w);
var _local5:PhysObj_Instance = GetPhysObjInstanceByName("player");
var _local6:b2Vec2 = _local5.GetBodyWorldPos(0);
var _local7:Number = (_local6.x * p2w);
var _local8:Number = (_local6.y * p2w);
_local8 = (_local8 - 300);
var _local9:Number = Utils.RandCircle();
var _local10:PhysObj_Instance = AddPhysObjAt("ninja_projectile", _local3, _local4, 0, "");
var _local11:Number = Utils.RandBetweenFloat(20, 50);
_local9 = Math.atan2((_local8 - _local4), (_local7 - _local3));
var _local12:Number = (Math.cos(_local9) * _local11);
var _local13:Number = (Math.sin(_local9) * _local11);
_local10.SetLinearVelocity(_local12, _local13);
for each (_local14 in _local10.bodies) {
_local14.SetBullet(true);
_local15 = _local14.GetShapeList();
_local15.SetUserData(_local10);
};
}
static function SetWeapon(_arg1:int):void{
currentProjectileType = _arg1;
}
static function MakeAngs(){
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
frameAngs = new Array(192);
_local1 = 0;
while (_local1 < 64) {
_local2 = (((Math.PI * 2) / 64) * _local1);
_local3 = (Math.cos(_local2) * fr_edit);
_local4 = Math.sin(_local2);
_local5 = Math.atan2(_local4, _local3);
frameAngs[(_local1 + 64)] = _local5;
frameAngs[_local1] = (_local5 - (Math.PI * 2));
frameAngs[(_local1 + 128)] = (_local5 + (Math.PI * 2));
_local1++;
};
trace(fr_edit);
}
static function GetLevelAward(_arg1:Level):int{
var _local2 = -1;
if (_arg1.complete){
_local2 = 0;
if (_arg1.bestTimeTotal < _arg1.silverTime){
_local2 = 1;
};
if (_arg1.bestTimeTotal < _arg1.goldTime){
_local2 = 2;
};
};
return (_local2);
}
static function BoostFinished(){
boostMode = 0;
boostTimer = 0;
boostMultiplier = 0;
}
static function UpdateScroll(){
var _local1:PhysObj_Instance;
var _local3:Number;
var _local4:Number;
var _local14:Number;
_local1 = physObjInstances.FindByTypeName("playervehicle");
if (_local1 == null){
return;
};
var _local2:b2Vec2 = _local1.GetBodyWorldPos(0);
var _local5:Number = (_local2.x * p2w);
var _local6:Number = (_local2.y * p2w);
var _local7:Number = 320;
var _local8:Number = 240;
scrollCX = _local5;
scrollCY = _local6;
var _local9:b2Vec2 = _local1.GetBodyLinearVelocity(0);
var _local10:Number = Math.atan2(_local9.y, _local9.x);
var _local11:Number = _local9.Length();
if (_local11 < 3){
_local3 = 0;
_local4 = 0;
} else {
_local11 = Utils.LimitNumber(3, 30, _local11);
_local14 = Utils.ScaleTo(0, 150, 0, 30, _local11);
_local3 = (Math.cos(_local10) * _local14);
_local4 = (Math.sin(_local10) * _local14);
};
scrollToDX = (scrollToDX + ((_local3 - scrollToDX) * 0.1));
scrollToDY = (scrollToDY + ((_local4 - scrollToDY) * 0.1));
scrollX = ((_local5 - _local7) + scrollToDX);
scrollY = ((_local6 - _local8) + scrollToDY);
scrollX = (scrollX + shakeCamX);
scrollY = (scrollY + shakeCamY);
scrollScale = 1;
var _local12:Number = (backgroundBD.width - Defs.displayarea_w);
var _local13:Number = (backgroundBD.height - Defs.displayarea_h);
if (scrollX < 0){
scrollX = 0;
};
if (scrollY < 0){
scrollY = 0;
};
if (scrollX > _local12){
scrollX = _local12;
};
if (scrollY > _local13){
scrollY = _local13;
};
}
static function AlignWithPreviousVerts(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Point{
var _local9:Point;
var _local10:Number;
var _local11:Number;
var _local6:Matrix = new Matrix();
_local6.rotate(_arg5);
var _local7:Point = new Point(_arg1, _arg2);
var _temp1 = _local6.transformPoint(_local7);
_local7 = _local6.transformPoint(_local7);
_temp1.x = (_local7.x + _arg3);
_local7.y = (_local7.y + _arg4);
var _local8:Number = (2 * w2p);
for each (_local9 in previousStaticPoints) {
if (Math.abs((_local9.x - _local7.x)) < _local8){
if (Math.abs((_local9.y - _local7.y)) < _local8){
_local10 = (_local9.x - _local7.x);
_local11 = (_local9.y - _local7.y);
return (new Point(_local10, _local11));
};
};
};
previousStaticPoints.push(_local7.clone());
return (null);
}
public static function GetPlaceByCarIndex(_arg1:int):int{
var _local2:int;
_local2 = 0;
while (_local2 < finalRaceOrder.length) {
if (finalRaceOrder[_local2] == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
static function DoEndLevelStuff(){
var _local1:Level = GetCurrentLevel();
achievements.TestAll();
levelAchievementAwarded = -1;
challengesAchievementAwarded = -1;
levelAchievementAwarded = WWorld.TestAchievement_StartLevel(currentLevel);
challengesAchievementAwarded = WWorld.TestAchievement_CompleteAllChallenges(currentLevel);
TestLevelsAvailable();
}
public static function Init(_arg1:Main){
main = _arg1;
currentScore = 0;
multiplier = 1;
numLevels = 8;
currentLevel = 0;
LoadLevels();
Player.InitOnce();
SaveData.Load();
backgroundBD = new BitmapData(2800, 2800, false, 4278190080);
panelOverlay = new Panel();
TestLevelsAvailable();
panelOverlay.buttonHolder.buttonMute.useHandCursor = true;
panelOverlay.buttonHolder.buttonMute.addEventListener(MouseEvent.CLICK, buttonMutePressed, false, 0, true);
panelOverlay.buttonHolder.buttonBack.addEventListener(MouseEvent.CLICK, buttonBackPressed, false, 0, true);
panelOverlay.buttonHolder.buttonQuit.addEventListener(MouseEvent.CLICK, buttonQuitPressed, false, 0, true);
panelOverlay.textInfo.text = "";
doRender = false;
}
static function buttonMutePressed(_arg1:MouseEvent){
SoundPlayer.ToggleMute();
MusicPlayer.ToggleMute();
if (SoundPlayer.doSFX){
panelOverlay.buttonHolder.buttonMute.gotoAndStop("on");
} else {
panelOverlay.buttonHolder.buttonMute.gotoAndStop("off");
};
}
public static function InitGame(){
Debug.debugMode = 0;
numLives = 3;
polygonList = new Array();
startPoints = new Array();
currentStartPointIndex = 0;
pause = true;
cash = 0;
currentGameMusic = 0;
}
static function GetLastLevelAward(_arg1:Level):int{
var _local2 = -1;
if (_arg1.complete){
_local2 = 0;
if (_arg1.lastTimeTotal < _arg1.silverTime){
_local2 = 1;
};
if (_arg1.lastTimeTotal < _arg1.goldTime){
_local2 = 2;
};
};
return (_local2);
}
static function RenderBox2D(_arg1:BitmapData):void{
var _local5:int;
var _local6:b2Body;
var _local7:b2Shape;
var _local8:b2Vec2;
var _local9:Number;
var _local10:*;
var _local11:b2PolygonShape;
var _local12:Array;
var _local13:int;
var _local14:int;
var _local15:b2Vec2;
var _local16:b2Vec2;
var _local17:Matrix;
var _local18:Point;
var _local19:Point;
var _local20:b2CircleShape;
var _local21:Number;
if (Debug.IsSet(1) == false){
return;
};
var _local2:Number = scrollX;
var _local3:Number = scrollY;
var _local4:Number = p2w;
_local6 = world.GetBodyList();
while (_local6) {
_local8 = _local6.GetPosition();
_local9 = _local6.GetAngle();
_local7 = _local6.GetShapeList();
while (_local7) {
_local10 = _local7.GetType();
if (_local10 == b2Shape.e_polygonShape){
_local11 = b2PolygonShape(_local7);
_local12 = _local11.GetVertices();
_local13 = _local11.GetVertexCount();
_local5 = 0;
while (_local5 < _local13) {
_local14 = (_local5 + 1);
if (_local14 >= _local13){
_local14 = 0;
};
_local15 = _local12[_local5].Copy();
_local16 = _local12[_local14].Copy();
_local17 = new Matrix();
_local17.rotate(_local9);
_local18 = new Point(_local15.x, _local15.y);
_local19 = new Point(_local16.x, _local16.y);
_local18 = _local17.transformPoint(_local18);
_local19 = _local17.transformPoint(_local19);
_local15.x = _local18.x;
_local15.y = _local18.y;
_local16.x = _local19.x;
_local16.y = _local19.y;
_local15.Add(_local8);
_local16.Add(_local8);
Utils.RenderDotLine(_arg1, ((_local15.x * _local4) - _local2), ((_local15.y * _local4) - _local3), ((_local16.x * _local4) - _local2), ((_local16.y * _local4) - _local3), 50, 4294967295);
_local5++;
};
};
if (_local10 == b2Shape.e_circleShape){
_local20 = b2CircleShape(_local7);
_local21 = (_local20.GetRadius() * _local4);
Utils.RenderCircle(_arg1, ((_local8.x * _local4) - _local2), ((_local8.y * _local4) - _local3), _local21, 4294967295);
};
_local7 = _local7.GetNext();
};
_local6 = _local6.GetNext();
};
}
static function GetFloorCollision(_arg1:Number, _arg2:Number):int{
var _local3:int;
_local3 = GraphicObjects.GetIndexByName("BackgroundLevel01_Collision");
_local3 = (_local3 + currentLevel);
var _local4:BitmapData = GraphicObjects.GetBitmapData(_local3, 0);
var _local5:uint = _local4.getPixel(_arg1, _arg2);
_local5 = (_local5 & 0xFF);
if (_local5 < 128){
return (1);
};
return (0);
}
static function InitBackgroundSounds(){
SoundPlayer.Reset();
if (playerVehiclePropulsionType == 0){
SoundPlayer.Play("sfx_engine02", 0, 999999, "engine");
};
if (playerVehiclePropulsionType == 1){
SoundPlayer.Play("sfx_engine01", 0, 999999, "engine");
};
if (playerVehiclePropulsionType == 2){
SoundPlayer.Play("sfx_engine03", 0, 999999, "engine");
};
if (playerVehiclePropulsionType == 3){
SoundPlayer.Play("sfx_engine04", 0, 999999, "engine");
};
SoundPlayer.Play("sfx_skid", 0, 999999, "skid");
SoundPlayer.Play("sfx_bridge", 0, 999999, "bridge");
}
static function GetNumLinesByType(_arg1:int):int{
var _local4:PhysLine;
var _local2:int;
var _local3:Level = GetCurrentLevel();
for each (_local4 in _local3.lines) {
if (_local4.type == _arg1){
_local2++;
};
};
return (_local2);
}
public static function RemoveObj_KillGuinea(_arg1:PhysObj_Instance){
SoundPlayer.Play("baddie");
SoundPlayer.PlayRandomBetween("guineadie01", "guineadie03", 1);
_slot1.numBallsActive--;
_slot1.numPigsSacrificed++;
physObjInstances.Remove(_arg1);
}
public static function DoCannon(_arg1:PhysObj_Instance){
var _local2:PhysObj_Instance = physObjInstances.FindByTypeName("cannon");
var _local3:b2Vec2 = _arg1.GetBodyWorldPos(0);
var _local4:b2Vec2 = _local2.GetBodyWorldPos(0);
var _local5:Number = 50;
var _local6:Number = _local2.GetBodyAngle(0);
_local6 = (_local6 - (Math.PI / 2));
var _local7:Number = (Math.cos(_local6) * _local5);
var _local8:Number = (Math.sin(_local6) * _local5);
var _local9:PhysObj_Instance = AddPhysObjAt("cannonball", (_local4.x * p2w), (_local4.y * p2w), 0, "", "");
_local9.ApplyImpulse(_local7, _local8);
_local2.cannon_firing = true;
SoundPlayer.Play("cannonwav");
numBallsActive--;
numPigsSacrificed++;
physObjInstances.Remove(_arg1);
}
public static function ZeroStuntTimers():void{
bikeWheelDownTimer = 0;
bikeWheelUpTimer = 0;
frontWheelieTimer = 0;
wheelieTimer = 0;
playerHitFloorTimer = 0;
backWheelUpTimer = 0;
frontWheelUpTimer = 0;
}
static function Reload(_arg1:Function){
ExternalData.Load(_arg1);
}
static function Render(){
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:int;
var _local6:int;
var _local11:Graphics;
if (pause){
return;
};
if (levelState == levelState_EndScreen){
return;
};
if (levelState == levelState_Null){
return;
};
if (levelState == levelState_Editor){
_local11 = main.fillScreenMC.graphics;
_local11.clear();
PhysEditor.RenderEditor();
return;
};
var _local1:BitmapData = main.screenBD;
var _local7:Level = GetCurrentLevel();
var _local8:Rectangle = new Rectangle(int(scrollX), int(scrollY), 640, 480);
main.screenBD.copyPixels(backgroundBD, _local8, new Point(0, 0));
GameObjects.Render(main.screenBD);
RenderBox2D(main.screenBD);
RenderLines(main.screenBD);
RenderMiniMap();
var _local9:Number = (Defs.displayarea_w - 12);
var _local10:Number = (Defs.displayarea_h - 10);
if (currentLevel == 0){
_local9 = (_local9 - 114);
_local10 = (_local10 - 104);
};
if (currentLevel == 1){
_local9 = (_local9 - 127);
_local10 = (_local10 - 114);
};
if (currentLevel == 2){
_local9 = (_local9 - 123);
_local10 = (_local10 - 137);
};
if (currentLevel == 3){
_local9 = (_local9 - 129);
_local10 = (_local10 - 147);
};
main.screenBD.copyPixels(main.minimapScreenBD, new Rectangle(0, 0, miniMapW, miniMapH), new Point(_local9, _local10), null, null, true);
RenderPanel();
}
public static function RemoveObj_Pellet(_arg1:PhysObj_Instance){
physObjInstances.Remove(_arg1);
}
static function PreUpdatePhysObjs():void{
var _local1:PhysObj_Instance;
for each (_local1 in physObjInstances.list) {
_local1.PreUpdate();
};
}
static function HitEveryJumpOnEachLap():Boolean{
var _local1:int;
var _local2:int;
_local1 = 0;
while (_local1 < everyJumpTable.length) {
if (everyJumpTable[_local1] == true){
_local2++;
};
_local1++;
};
trace(((("jumped " + _local2) + " / ") + everyJumpTable.length));
if (_local2 == everyJumpTable.length){
return (true);
};
return (false);
}
static function GetLevel(_arg1:int):Level{
if (_arg1 >= levels.length){
return (null);
};
return (levels[_arg1]);
}
static function RenderPanel(){
var _local2:Number;
var _local3:Number;
var _local4:String;
var _local5:Number;
var _local7:PhysObj_Instance;
var _local8:int;
var _local1:Level = GetCurrentLevel();
var _local6:BitmapData = main.screenBD;
if (usedebug == true){
_local2 = 10;
_local3 = 460;
_local4 = ("FPS: " + Utils.DP2(main.fps).toString());
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local2, _local3, _local4, null);
_local3 = (_local3 - 20);
_local4 = "";
if (Licensors.GetLicensor() == Licensors.LICENSOR_WEBBLIWORLD_LOCKED){
_local4 = "Version: Webbbliworld";
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_WEBBLIWORLD_VIRAL){
_local4 = "Version: Viral";
};
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local2, _local3, _local4, null);
};
panelOverlay.textInfo.text = "";
panelOverlay.textScore.text = Utils.IntToNumDigits(currentScore, 6);
panelOverlay.textPosition.text = (playerPosition + 1).toString();
_local7 = physObjInstances.FindByTypeName("playervehicle");
if (_local7 != null){
_local8 = _local7.vehicleCurrentLap;
if (_local8 < 1){
_local8 = 1;
};
if (_local8 > 3){
_local8 = 3;
};
panelOverlay.textLap.text = _local8.toString();
};
if (wrongWayFlag){
panelOverlay.textInfo.text = "WRONG WAY";
} else {
if (readySetGoFrame != -1){
if (readySetGoFrame == 0){
panelOverlay.textInfo.text = "ON YOUR MARKS";
};
if (readySetGoFrame == 1){
panelOverlay.textInfo.text = "GET SET";
};
if (readySetGoFrame == 2){
panelOverlay.textInfo.text = "GO";
};
};
};
if (levelState == levelState_Play){
panelOverlay.buttonHolder.visible = true;
} else {
panelOverlay.buttonHolder.visible = false;
};
if (gettingReady){
panelOverlay.buttonHolder.visible = false;
};
}
static function HitEveryTurboOnEachLap():Boolean{
var _local1:int;
var _local2:int;
_local1 = 0;
while (_local1 < everyTurboTable.length) {
if (everyTurboTable[_local1] == true){
_local2++;
};
_local1++;
};
trace(((("turbo'd " + _local2) + " / ") + everyTurboTable.length));
if (_local2 == everyTurboTable.length){
return (true);
};
return (false);
}
static function InitBox2D():void{
var _local1:b2AABB = new b2AABB();
_local1.lowerBound.Set(-250000, -250000);
_local1.upperBound.Set(250000, 250000);
var _local2:b2Vec2 = new b2Vec2(0, physGravity);
var _local3:Boolean;
world = new b2World(_local1, _local2, _local3);
groundBody = world.GetGroundBody();
groundBody.SetUserData(-1);
var _local4:ContactListener = new ContactListener();
world.SetContactListener(_local4);
}
public static function LoadLevels(){
levels = new Array();
var _local1:XML = ExternalData.xml;
var _local2:* = _local1.level.length();
var _local3:int;
while (_local3 < _local2) {
LoadLevel(_local3);
_local3++;
};
_local3 = 0;
while (_local3 < levels.length) {
GetLevel(_local3).available = false;
GetLevel(_local3).complete = false;
_local3++;
};
GetLevel(0).available = true;
}
public static function LoadLevel(_arg1:int){
var _local4:int;
var _local5:int;
var _local6:XML;
var _local7:XML;
var _local8:int;
var _local9:String;
var _local10:int;
var _local11:PhysLine;
var _local12:XML;
var _local13:String;
var _local14:Array;
var _local15:Point;
var _local16:XML;
var _local17:String;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:String;
var _local22:PhysObj_Instance;
var _local2:XML = ExternalData.xml;
_local2 = _local2.level[_arg1];
var _local3:Level = new Level();
_local3.name = XmlHelper.GetAttrString(_local2.@name, "undefined");
_local3.category = XmlHelper.GetAttrInt(_local2.@category, 0);
_local3.fillFrame = XmlHelper.GetAttrInt(_local2.@fillframe, 1);
_local3.surfaceFrame = XmlHelper.GetAttrInt(_local2.@surfaceframe, 2);
_local3.surfaceThickness = XmlHelper.GetAttrInt(_local2.@surfacethickness, 10);
_local3.eventType = XmlHelper.GetAttrString(_local2.@type, "race");
_local3.eventOpponentsString = XmlHelper.GetAttrString(_local2.@opponents, "1");
_local3.exclusiveChar = XmlHelper.GetAttrInt(_local2.@exclusivechar, -1);
_local3.eventWinParam = XmlHelper.GetAttrNumber(_local2.@win, 1);
_local3.goldTime = (XmlHelper.GetAttrNumber(_local2.times.@gold, 10) * Defs.fps);
_local3.silverTime = (XmlHelper.GetAttrNumber(_local2.times.@silver, 20) * Defs.fps);
_local4 = 0;
while (_local4 < _local2.helpscreen.length()) {
_local6 = _local2.helpscreen[_local4];
_local3.helpscreenFrames.push(XmlHelper.GetAttrInt(_local6.@frame, 0));
_local4++;
};
_local3.Calculate();
_local3.lines = new Array();
_local4 = 0;
while (_local4 < _local2.line.length()) {
_local7 = _local2.line[_local4];
_local8 = XmlHelper.GetAttrInt(_local7.@type, 0);
_local9 = XmlHelper.GetAttrString(_local7.@name, "");
_local10 = XmlHelper.GetAttrInt(_local7.@fill, 1);
_local11 = new PhysLine();
_local11.type = _local8;
_local11.name = _local9;
_local11.fill = _local10;
_local11.fillScaleX = XmlHelper.GetAttrNumber(_local7.@fillscale, 1);
_local11.fillScaleY = XmlHelper.GetAttrNumber(_local7.@fillscale, 1);
_local5 = 0;
while (_local5 < _local7.points.length()) {
_local12 = _local7.points[_local5];
_local13 = XmlHelper.GetAttrString(_local12.@a, "");
_local14 = Utils.PointArrayFromString(_local13);
for each (_local15 in _local14) {
_local11.points.push(_local15);
};
_local5++;
};
_local3.lines.push(_local11);
_local4++;
};
_local4 = 0;
while (_local4 < _local2.obj.length()) {
_local16 = _local2.obj[_local4];
_local17 = _local16.@type;
_local18 = Number(_local16.@x);
_local19 = Number(_local16.@y);
_local20 = Number(_local16.@rot);
_local21 = XmlHelper.GetAttrString(_local16.@params, "");
_local22 = CreatePhysObjInstanceAt(_local17, _local18, _local19, _local20, "", _local21);
_local3.instances.push(_local22);
_local4++;
};
levels.push(_local3);
}
static function UpdateRecordPlayer(){
var _local1:PlayerRecord;
var _local4:PlayerRecord;
var _local5:Number;
var _local6:Number;
if (playerRecordingFlag != 2){
return;
};
var _local2:GameObj;
var _local3:int;
for each (_local2 in GameObjects.objs) {
if (((_local2.active) && (_local2.colFlag_isPlayer))){
if (playerRecording.length == 0){
oldRecordPosX = Math.floor(_local2.xpos);
oldRecordPosY = Math.floor(_local2.ypos);
_local1 = new PlayerRecord(oldRecordPosX, oldRecordPosY, Utils.DP2(_local2.dir), _local2.frame);
} else {
_local4 = playerRecording[(playerRecording.length - 1)];
_local5 = Math.floor(_local2.xpos);
_local6 = Math.floor(_local2.ypos);
_local1 = new PlayerRecord((_local5 - oldRecordPosX), (_local6 - oldRecordPosY), Utils.DP2(_local2.dir), _local2.frame);
oldRecordPosX = Math.floor(_local2.xpos);
oldRecordPosY = Math.floor(_local2.ypos);
};
playerRecording.push(_local1);
};
};
}
static function InitPhysicsGO(_arg1:Number, _arg2:Number, _arg3:PhysObj_Graphic, _arg4:int=0, _arg5:int=0, _arg6:Number=1000):int{
var _local7:GameObj;
_arg6 = (_arg6 + _arg3.zoffset);
if (_arg3 == null){
_local7 = GameObjects.AddObj((_arg1 * p2w), (_arg2 * p2w), (_arg6 + zsortoffset));
_local7.InitPhysicsObject(_arg4, _arg5, 0, 0, "", false);
} else {
if (_arg3.goInitFuntion == ""){
_local7 = GameObjects.AddObj((_arg1 * p2w), (_arg2 * p2w), (_arg6 + zsortoffset));
_local7.InitPhysicsObject(_arg4, _arg5, _arg3.offset.x, _arg3.offset.y, _arg3.goInitFuntionVarString, _arg3.hasShadow);
} else {
_local7 = GameObjects.AddObj((_arg1 * p2w), (_arg2 * p2w), (_arg6 + zsortoffset));
_local7.InitPhysicsObject(_arg4, _arg5, _arg3.offset.x, _arg3.offset.y, _arg3.goInitFuntionVarString, _arg3.hasShadow);
var _local8 = _local7;
_local8[_arg3.goInitFuntion]();
};
};
lastGeneratedGameObj = _local7;
return (GameObjects.lastGenIndex);
}
public static function UpdateGameplay():void{
var _local3:PhysObj_Instance;
var _local4:Array;
if (pause){
return;
};
if (levelState == levelState_EndScreen){
TitleScreenState.UpdateLevelEndScreen();
return;
};
if (levelState == levelState_Editor){
PhysEditor.UpdateEditor();
return;
};
if (usedebug){
if (KeyReader.Pressed(KeyReader.KEY_SPACE)){
InitLevelState(levelState_Editor);
};
};
if (levelState == levelState_Null){
return;
};
if (mousetimer > 0){
mousetimer--;
};
if (PauseMenu.IsPaused() == false){
if (KeyReader.Pressed(KeyReader.KEY_P)){
PauseMenu.Pause();
};
};
if (LevelUpdateCallback != null){
LevelUpdateCallback();
};
var _local1 = 1;
if (usedebug){
if (KeyReader.Pressed(KeyReader.KEY_1)){
};
if (KeyReader.Down(KeyReader.KEY_2)){
fr_edit = (fr_edit + 0.05);
MakeAngs();
};
if (KeyReader.Pressed(KeyReader.KEY_3)){
Debug.debugMode = (Debug.debugMode ^ 1);
};
if (KeyReader.Pressed(KeyReader.KEY_5)){
Debug.debugMode = (Debug.debugMode ^ 1);
};
if (KeyReader.Pressed(KeyReader.KEY_6)){
};
if (KeyReader.Pressed(KeyReader.KEY_7)){
Reload(InitLevel);
};
if (KeyReader.Pressed(KeyReader.KEY_8)){
currentLevel--;
if (currentLevel < 0){
currentLevel = (levels.length - 1);
};
StartLevelPlay();
};
if (KeyReader.Pressed(KeyReader.KEY_9)){
currentLevel++;
if (currentLevel >= levels.length){
currentLevel = 0;
};
StartLevelPlay();
};
};
if (levelFinishedState == levelFinishedState_WON){
};
if (levelFinishedState == levelFinishedState_LOST){
};
if (levelState == levelState_Complete){
levelStateTimer--;
if (levelStateTimer <= 0){
InitLevelState(levelState_EndScreen);
};
};
if (pickupHitTimer > 0){
pickupHitTimer--;
};
PreUpdatePhysObjs();
var _local2:int;
while (_local2 < _local1) {
numCollisionTests = 0;
world.Step((1 / 60), physNumIterations);
world.Step((1 / 60), physNumIterations);
UpdateGOsFromPhysics();
if ((((((levelState == levelState_Play)) || ((levelState == levelState_LevelStart)))) || ((levelState == levelState_Complete)))){
GameObjects.Update();
};
_local2++;
};
UpdatePhysObjs();
if (levelState == levelState_Play){
levelTimer++;
UpdateControl();
};
for each (_local3 in physObjInstances.list) {
if (_local3.collidetimer != 0){
_local3.collidetimer++;
if (_local3.collidetimer >= 5){
if (_local3.collideFunction != null){
_local3.collideFunction(_local3);
};
};
};
};
_local4 = new Array();
for each (_local3 in physObjInstances.list) {
if (_local3.removeFlag){
_local4.push(_local3);
};
};
for each (_local3 in _local4) {
physObjInstances.Remove(_local3);
};
if ((((levelState == levelState_Play)) || ((levelState == levelState_LevelStart)))){
GetPlayerPosition();
};
UpdateScroll();
}
static function GetNearestPathLine(_arg1:Number, _arg2:Number):int{
var _local7:PhysLine;
var _local8:Number;
var _local3:Number = 999999;
var _local4:int;
var _local5:int;
var _local6:Level = GetCurrentLevel();
for each (_local7 in _local6.lines) {
if (_local7.type == 1){
_local8 = Utils.DistBetweenPoints(_arg1, _arg2, _local7.points[0].x, _local7.points[0].y);
if (_local8 < _local3){
_local3 = _local8;
_local4 = _local5;
};
};
_local5++;
};
return (_local4);
}
static function AddToBoost(_arg1:Number):Number{
if (playerRecordingFlag == 2){
return (0);
};
boostLevel = (boostLevel + _arg1);
do {
if (boostLevel >= 1){
boostLevel = (boostLevel - 1);
InitBoost();
boostMultiplier++;
if (boostMultiplier > maxBoostMultiplier){
boostMultiplier = maxBoostMultiplier;
};
};
} while (boostLevel > 1);
return ((_arg1 * 100));
}
static function GetLineListByType(_arg1:int):Array{
var _local4:PhysLine;
var _local2:Array = new Array();
var _local3:Level = GetCurrentLevel();
for each (_local4 in _local3.lines) {
if (_local4.type == _arg1){
_local2.push(_local4);
};
};
return (_local2);
}
static function GetLastStartPoint(_arg1:Number):Point{
var _local3:Point;
var _local2:Point = startPoints[0];
var _local4:Number = -1000;
for each (_local3 in startPoints) {
if (_local3.x < _arg1){
if (_local3.x > _local4){
_local4 = _local3.x;
_local2 = _local3;
};
};
};
return (_local2);
}
public static function FrontWheelIsDown():void{
frontWheelDown = true;
}
public static function RemoveObj_BallInWrongHopper(_arg1:PhysObj_Instance){
physObjInstances.Remove(_arg1);
}
public static function InitLevel1(){
InitLevel2();
}
public static function InitLevel2(){
var _local2:GameObj;
var _local1:Number = getTimer();
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;
polygonList = new Array();
startPoints = new Array();
InitBox2D();
levelTimer = 0;
physObjs = new PhysObjs();
physObjs.InitFromXml(ExternalData.xml);
scrollAcc = 0.01;
scrollVel = 0;
scrollMaxVel = 2;
physObjInstances = new PhysObj_Instances();
pause = false;
var _local3:Number = getTimer();
trace(("InitLevel Time= " + ((_local3 - _local1) / 1000).toString()));
StartLevelPlay();
}
public static function SwitchToFront(){
switchFlag = 2;
}
static function CycleWeapon(_arg1:int):void{
currentProjectileType = (currentProjectileType + _arg1);
if (currentProjectileType >= numWeapons){
currentProjectileType = 0;
};
if (currentProjectileType < 0){
currentProjectileType = (numWeapons - 1);
};
}
static function QuietAllSounds(){
var _local1:SoundChannel;
_local1 = SoundPlayer.GetSoundChannelByName("engine");
SoundPlayer.SetSoundChannelVolume(_local1, 0);
_local1 = SoundPlayer.GetSoundChannelByName("skid");
SoundPlayer.SetSoundChannelVolume(_local1, 0);
_local1 = SoundPlayer.GetSoundChannelByName("bridge");
SoundPlayer.SetSoundChannelVolume(_local1, 0);
}
public static function CollideWithMagnet(_arg1:PhysObj_Instance){
_arg1.collideFunction = null;
_arg1.collidetimer = 0;
var _local2:b2Vec2 = _arg1.GetBodyWorldPos(0);
var _local3:b2Vec2 = _arg1.collideWithInstance.GetBodyWorldPos(0);
var _local4:Boolean = _arg1.collideWithInstance.magnet_polarity;
var _local5:Number = Utils.DistBetweenPoints(_local2.x, _local2.y, _local3.x, _local3.y);
_local5 = (_local5 * _slot1.p2w);
_local5 = Utils.LimitNumber(0, 110, _local5);
_local5 = (150 - _local5);
_local5 = Utils.ScaleTo(0, 1, 0, 110, _local5);
var _local6:Number = Math.atan2((_local3.y - _local2.y), (_local3.x - _local2.x));
var _local7:Number = (20 * _local5);
var _local8:Number = (Math.cos(_local6) * _local7);
var _local9:Number = (Math.sin(_local6) * _local7);
if (_local4 == true){
_arg1.ApplyForce(_local8, _local9);
} else {
_arg1.ApplyForce(-(_local8), -(_local9));
};
}
public static function SwitchToBack(){
switchFlag = 1;
trace("SwitchToBack");
}
public static function AddScore(_arg1:int):void{
currentScore = (currentScore + _arg1);
}
public static function DoSwitchToBack(){
var _local1:PhysObj_Instance;
_local1 = GetPhysObjInstanceByName("player");
if (_local1 == null){
return;
};
_local1.SetBodyCollisionMask(-1, 7);
}
public static function RemoveObj_Pickup(_arg1:PhysObj_Instance){
cash++;
physObjInstances.Remove(_arg1);
}
static function buttonBackPressed(_arg1:MouseEvent){
StartLevelPlay();
}
public static function RemoveObj_Gem(_arg1:PhysObj_Instance){
physObjInstances.Remove(_arg1);
}
static function ExamineBox2D():void{
var _local1:int;
var _local2:b2Body;
var _local3:b2Vec2;
return;
}
public static function StartLevelPlay():void{
panelOverlay.visible = false;
doRender = false;
StartLevelPlay2();
}
static function RenderSkidMark(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:int, _arg7:Number){
var _local23:Number;
var _local24:Number;
var _local8:Array = new Array();
_local8.push(48, 77, 80);
_local8.push(102, 51, 0);
_local8.push(102, 51, 0);
_local8.push(102, 51, 51);
var _local9:int = _local8[((currentLevel * 3) + 0)];
var _local10:int = _local8[((currentLevel * 3) + 1)];
var _local11:int = _local8[((currentLevel * 3) + 2)];
var _local12:BitmapData = backgroundBD;
_local12.lock();
var _local13:int = GraphicObjects.GetIndexByName("SkidMarks");
var _local14:* = Utils.ScaleTo(0xFF, 240, 0, 1, _arg7);
_arg7 = (_arg7 * 0.02);
var _local15:BitmapData = GraphicObjects.GetBitmapData(_local13, _arg6);
var _local16:ColorTransform = new ColorTransform(1, 1, 1, _arg7, _local9, _local10, _local11, 0);
var _local17:Matrix = new Matrix();
var _local18:Number = Utils.DistBetweenPoints(_arg1, _arg2, _arg3, _arg4);
var _local19:Number = _local18;
_local18 = (_local18 / 4);
_local18 = Math.round(_local18);
_local18 = Utils.LimitNumber(1, 4, _local18);
var _local20:Number = ((_arg1 - _arg3) / _local18);
var _local21:Number = ((_arg2 - _arg4) / _local18);
_arg1 = _arg3;
_arg2 = _arg4;
var _local22:int;
_local22 = 0;
while (_local22 < _local18) {
_local23 = (_arg1 - 50);
_local24 = (_arg2 - 70);
_local17.identity();
_local17.translate(_local23, _local24);
_local12.draw(_local15, _local17, _local16);
_arg1 = (_arg1 + _local20);
_arg2 = (_arg2 + _local21);
_local22++;
};
_local12.unlock();
}
static function GetPhysObjInstanceByName(_arg1:String):PhysObj_Instance{
var _local2:PhysObj_Instance;
for each (_local2 in physObjInstances.list) {
if (_local2.instanceName == _arg1){
return (_local2);
};
};
return (null);
}
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, _local1.initParams);
zsortoffset = (zsortoffset + 0.01);
};
}
static function RestartLevel():void{
StartLevelPlay();
}
static function UpdateGOsFromPhysics():void{
var _local2:GameObj;
var _local3:b2Body;
var _local4:PhysObj_BodyUserData;
var _local5:int;
var _local6:b2Vec2;
var _local7:Number;
var _local1:Number = 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.oldxpos = _local2.xpos;
_local2.oldypos = _local2.ypos;
_local2.xpos = ((_local6.x * _local1) + _local2.physObjOffsetX);
_local2.ypos = ((_local6.y * _local1) + _local2.physObjOffsetY);
_local2.dir = _local7;
};
};
_local3 = _local3.GetNext();
};
}
static function RenderLines(_arg1:BitmapData):void{
var _local5:PhysLine;
var _local6:int;
var _local7:int;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
if (Debug.IsSet(1) == false){
return;
};
var _local2:Number = scrollX;
var _local3:Number = scrollY;
var _local4:Level = GetCurrentLevel();
for each (_local5 in _local4.lines) {
_local7 = _local5.points.length;
_local6 = 0;
while (_local6 < (_local7 - 1)) {
_local8 = (_local5.points[(_local6 + 0)].x - _local2);
_local9 = (_local5.points[(_local6 + 0)].y - _local3);
_local10 = (_local5.points[(_local6 + 1)].x - _local2);
_local11 = (_local5.points[(_local6 + 1)].y - _local3);
if (_local5.type == 1){
Utils.RenderDotLine(_arg1, _local8, _local9, _local10, _local11, 300, 4294967040);
GraphicObjects.RenderStringAt(_arg1, GraphicObjects.gfx_font1, _local8, _local9, _local6.toString());
};
_local6++;
};
};
}
static function InitEveryJumpStuff(){
var _local1:int;
trace(("numJumps = " + numJumps));
everyJumpTable = new Array((numJumps * numLaps));
_local1 = 0;
while (_local1 < everyJumpTable.length) {
everyJumpTable[_local1] = Boolean(false);
_local1++;
};
}
static function RenderMiniMap(){
var _local1:int;
var _local8:GameObj;
var _local9:Number;
var _local10:Number;
_local1 = GraphicObjects.GetIndexByName("MiniMaps");
var _local2:BitmapData = main.minimapScreenBD;
var _local3:BitmapData = GraphicObjects.GetBitmapData(_local1, currentLevel);
_local2.fillRect(new Rectangle(0, 0, miniMapW, miniMapH), 0);
_local2.draw(_local3);
var _local4:Number = (1 / 20);
var _local5:Number = (1 / 20);
_local5 = (_local5 * 1.6666);
var _local6:Number = -10;
var _local7:Number = -37;
if (currentLevel == 1){
_local6 = -5;
_local7 = -55;
};
if (currentLevel == 2){
_local6 = -9;
_local7 = -37;
};
if (currentLevel == 3){
_local6 = -4;
_local7 = -42;
};
for each (_local8 in GameObjects.objs) {
if (((_local8.active) && (_local8.isVehicle))){
_local9 = (_local8.xpos * _local4);
_local10 = (_local8.ypos * _local5);
_local9 = (_local9 + _local6);
_local10 = (_local10 + _local7);
if (_local8.colFlag_isPlayer){
GraphicObjects.RenderAt(_local1, 4, _local2, _local9, _local10);
} else {
GraphicObjects.RenderAt(_local1, 5, _local2, _local9, _local10);
};
};
};
}
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 UpdateShakeCam(_arg1:Number):void{
var _local2:Number;
shakeCamTimer--;
if (shakeCamTimer <= 0){
shakeCamTimer = Utils.RandBetweenInt(5, 20);
shakeCamTimerMax = shakeCamTimer;
_local2 = Utils.ScaleTo(2, 20, 0, 30, _arg1);
shakeCamToX = Utils.RandBetweenFloat(-(_local2), _local2);
shakeCamToY = Utils.RandBetweenFloat(-(_local2), _local2);
shakeCamDX = ((shakeCamToX - shakeCamX) / shakeCamTimer);
shakeCamDY = ((shakeCamToY - shakeCamY) / shakeCamTimer);
};
shakeCamX = (shakeCamX + shakeCamDX);
shakeCamY = (shakeCamY + shakeCamDY);
}
static function GetLineByIndex(_arg1:int):PhysLine{
var _local2:Level = GetCurrentLevel();
if (_local2.lines.length == 0){
return (null);
};
return (_local2.lines[_arg1]);
}
static function TestLevelsAvailable(){
var _local1:* = achievements.GetNumUnlocked();
if (_local1 >= 2){
GetLevel(1).available = true;
};
if (_local1 >= 4){
GetLevel(2).available = true;
};
if (_local1 >= 6){
GetLevel(3).available = true;
};
}
static function InitPlayerUpdateRot(){
playerRotLeaveGround = playerRot;
playerRotMode = 0;
playerRotCount = 0;
}
static function PrintPlayerPosition(){
var _local1:PhysObj_Instance;
_local1 = GetPhysObjInstanceByName("player");
if (_local1 == null){
return;
};
var _local2:b2Vec2 = _local1.GetBodyWorldPos(0);
trace((((("x=\"" + int((_local2.x * p2w))) + "\" y=\"") + int((_local2.y * p2w))) + "\""));
}
static function SetJumpDone(_arg1:int, _arg2:int){
if (_arg1 < 1){
return;
};
var _local3:int = (_arg1 - 1);
var _local4:int = ((_local3 * numJumps) + _arg2);
everyJumpTable[_local4] = true;
}
public static function RemoveObj_BallDie(_arg1:PhysObj_Instance){
physObjInstances.Remove(_arg1);
}
static function GetLineIndexByTypeIndex(_arg1:int, _arg2:int):int{
var _local6:PhysLine;
var _local3:int;
var _local4:int;
var _local5:Level = GetCurrentLevel();
for each (_local6 in _local5.lines) {
if (_local6.type == _arg1){
if (_local3 == _arg2){
return (_local4);
};
_local3++;
};
_local4++;
};
return (0);
}
static function GetCurrentLevelInstances():Array{
return (levels[currentLevel].instances);
}
static function GetPhysObjInstanceByTypeName(_arg1:String):PhysObj_Instance{
var _local2:PhysObj_Instance;
for each (_local2 in physObjInstances.list) {
if (_local2.typeName == _arg1){
return (_local2);
};
};
return (null);
}
static function RenderGloopTrail(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:int, _arg7:Number, _arg8:int){
var _local22:Number;
var _local23:Number;
var _local9:Array = new Array();
_local9.push(0xFF, 153, 0);
_local9.push(164, 0xFF, 191);
_local9.push(254, 171, 230);
_local9.push(205, 245, 244);
_local9.push(205, 245, 244);
_local9.push(204, 153, 51);
var _local10:int = _local9[((_arg8 * 3) + 0)];
var _local11:int = _local9[((_arg8 * 3) + 1)];
var _local12:int = _local9[((_arg8 * 3) + 2)];
var _local13:BitmapData = backgroundBD;
_local13.lock();
var _local14:int = GraphicObjects.GetIndexByName("SkidMarks");
var _local15:* = Utils.ScaleTo(128, 0xFF, 0, 1, _arg7);
var _local16:BitmapData = GraphicObjects.GetBitmapData(_local14, _arg6);
var _local17:ColorTransform = new ColorTransform(1, 1, 1, 1, _local10, _local11, _local12, -(_local15));
var _local18:Matrix = new Matrix();
var _local19:Number = ((_arg1 - _arg3) / 3);
var _local20:Number = ((_arg2 - _arg4) / 3);
_arg1 = _arg3;
_arg2 = _arg4;
var _local21:int;
_local21 = 0;
while (_local21 < 3) {
_local22 = (_arg1 - 50);
_local23 = (_arg2 - 70);
_local18.identity();
_local18.translate(_local22, _local23);
_local13.draw(_local16, _local18, _local17);
_arg1 = (_arg1 + _local19);
_arg2 = (_arg2 + _local20);
_local21++;
};
_local13.unlock();
}
public static function DoSwitchToFront(){
var _local1:PhysObj_Instance;
_local1 = GetPhysObjInstanceByName("player");
if (_local1 == null){
return;
};
_local1.SetBodyCollisionMask(-1, 3);
trace("SwitchToFront");
}
static function ResetBoost(){
boostMode = 0;
boostTimer = 0;
boostLevel = 0;
boostMultiplier = 0;
}
public static function DoSwitch(_arg1:String){
var _local2:PhysObj_Instance;
for each (_local2 in physObjInstances.list) {
if (_local2.switchFunction != null){
if (_local2.switchName == _arg1){
_local2.switchFunction();
};
if (_local2.switchName1 == _arg1){
_local2.switchFunction();
};
};
};
}
static function StopRecordPlayer(){
var _local7:PlayerRecord;
playerRecordingFlag = 0;
var _local1 = "";
var _local2 = "";
_local1 = (("StartData(" + currentLevel) + ");");
_local2 = (_local2 + (_local1 + "\n"));
var _local3:int = (playerRecording.length - 1);
var _local4:int;
var _local5 = "";
var _local6:int;
for each (_local7 in playerRecording) {
if (_local6 != 0){
_local5 = (_local5 + ", ");
} else {
_local5 = (_local5 + "AddData(new Array(");
};
_local5 = (_local5 + ((((_local7.x + ",") + _local7.y) + ",") + _local7.rot));
_local6++;
if (_local6 == 500){
_local5 = (_local5 + "));");
_local6 = 0;
_local2 = (_local2 + (_local5 + "\n"));
_local5 = "";
};
};
if (_local6 != 0){
_local5 = (_local5 + "));");
_local6 = 0;
_local2 = (_local2 + (_local5 + "\n"));
_local5 = "";
};
_local5 = "StopData();";
_local2 = (_local2 + (_local5 + "\n"));
trace("Player recording copied to clipboard");
System.setClipboard(_local2);
}
static function GetCurrentLevel():Level{
return (levels[currentLevel]);
}
static function StartRecordPlayer(){
playerRecording = new Array();
playerRecordingFlag = 1;
}
public static function HaveAllAnimalsBeenBubbled():Boolean{
var _local2:PhysObj_Instance;
var _local1:int;
for each (_local2 in physObjInstances.list) {
if (_local2.type == 1){
_local1++;
if (_local2.animal_rescued == false){
return (false);
};
};
};
if (_local1 == 0){
return (false);
};
return (true);
}
}
}//package
Section 138
//GameObj (GameObj)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class GameObj {
public var graphicID:int;
var textMessage:String;
var carDrive:int;
var bikeBodyGraphicID:int;
public var xvel:Number;
var path:Poly;
public var todir:Number;
var minFrame:int;
var bd:BitmapData;
var rotVel:Number;
public var speed:Number;
public var colFlag_isEnemy:Boolean;
public var yoffset:Number;
var objectDef:ObjectDef;
var waveDef:WaveDef;
public var ypos1:Number;
public var ypos2:Number;
public var startz:Number;
public var colFlag_canBeShot:Boolean;
var health:Number;
public var startx:Number;
public var starty:Number;
var aiRouteIndex:int;
public var colFlag_playercanbekilled:Boolean;
public var frame1:Number;
public var movementVec:Vec;
var maxFrame:int;
var ct:ColorTransform;
public var visible:Boolean;
var sortByY:Boolean;
public var colFlag_isPlayer:Boolean;
public var yvel:Number;
public var name:String;
public var dir:Number;
public var graphicID1:int;
public var colFlag_isPhysObj:Boolean;
public var radius:Number;
public var controlMode:int;
var isVehicle:Boolean;
public var colFlag_isHose:Boolean;
var aiPlayerSpeed:Number;
public var origspeed:Number;
public var colFlag_canBePickedUp:Boolean;
var uniqueID:int;
var EnemyUpdateFunctionCallback:Function;
var EnemyHitByBulletFunctionCallback:Function;
var aiWheelRot:Number;
public var colFlag_isCheckpoint:Boolean;
public var xpos1:Number;
public var xpos2:Number;
public var colFlag_isPlatform:Boolean;
public var xpos:Number;
public var renderShadowFlag:Boolean;
public var zvel:Number;
var xflip:Boolean;
public var colFlag_isPowerup:Boolean;
var currentPoly:Poly;
public var frameVel:Number;
var renderSmooth:Boolean;
public var colFlag_killPlayer:Boolean;
var currentWeapon:int;
var shotControllers:Array;
public var colFlag_isBall:Boolean;
var aiLegsFrame:Number;
public var colFlag_isBullet:Boolean;
var childGO:GameObj;
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 height:Number;
public var colFlag_isEnemyBullet:Boolean;
var flashTimer:int;
public var type:int;
public var ypos:Number;
var aiPhysObj:PhysObj;
public var frameVel1:Number;
var maxSpeed:Number;
public var timer:Number;
var scale:Number;
var alpha:Number;
public var physObjInitVarString:String;
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 vehicleCheckpointIndex:int;
public var oldxpos:Number;
var bikeBodyOffsetX:Number;
var bikeBodyOffsetY:Number;
public var timer1:Number;
public var renderFunction:Function;
var aiRoutePos:Number;
var aiLegRotSpeed:Number;
var showArrowTimer:int;
public var zpos:Number;
public var toPosX:Number;
public var toPosY:Number;
var aiUpperBodyLean:Number;
var aiBodyFrame:Number;
var dist:Number;
public var colFlag_isBouncyPad:Boolean;
var aiBikeSpecialType:int;
var vehicleCurrentLap:int;
public var driveVec:Vec;
var playerWeapons:Array;
public var main:Main;
public var updateFunction:Function;
var totalVehicleCheckpointIndex:int;
public var additive:Boolean;
var inFrontZone:Poly;
var oldAiPosX:Number;
var oldAiPosY:Number;
var aiBikeOffsets:Array;
var currentMaxSpeed:Number;
public var timerMax:Number;
public var oldypos:Number;
public var physObjOffsetX:Number;
public var physObjOffsetY:Number;
public var colFlag_isShop:Boolean;
var parentObj:GameObj;
var flashTimerMax:int;
var isPhysObj:Boolean;
public function GameObj(_arg1, _arg2, _arg3){
ct = new ColorTransform(0.1, 0.1, 0.1, 0.3);
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();
}
public function UpdatePellet(){
}
function InitWheel():void{
renderSmooth = true;
}
function UpdateSmoke():void{
xpos = (xpos + xvel);
ypos = (ypos + yvel);
if (PlayAnimation()){
active = false;
};
}
function InitSmoke(_arg1:GameObj, _arg2:Number, _arg3:Boolean):void{
sortByY = true;
frame = 0;
frameVel = Utils.RandBetweenFloat(0.6, 1);
alpha = 0.5;
updateFunction = UpdateSmoke;
if (Game.currentLevel == 0){
graphicID = GraphicObjects.GetIndexByName("smoke_level01");
};
if (Game.currentLevel == 1){
graphicID = GraphicObjects.GetIndexByName("smoke_level02");
};
if (Game.currentLevel == 2){
graphicID = GraphicObjects.GetIndexByName("smoke_level03");
};
if (Game.currentLevel == 3){
graphicID = GraphicObjects.GetIndexByName("smoke_level04");
};
var _local4:Point = new Point(-30, 15);
if (_arg3 == true){
_local4 = new Point(-15, 24);
};
var _local5:Matrix = new Matrix();
_local5.rotate(_arg2);
_local4 = _local5.transformPoint(_local4);
xpos = (xpos + _local4.x);
ypos = (ypos + _local4.y);
xvel = Utils.RandBetweenFloat(-0.5, 0.5);
yvel = Utils.RandBetweenFloat(-0.5, 0.5);
}
function UpdateBubbleSplatDrip():void{
ypos = (ypos + yvel);
if (PlayAnimation()){
active = false;
};
}
function InitPlayer():void{
colFlag_isPlayer = true;
updateFunction = UpdatePlayer;
renderFunction = RenderPlayer;
frame = 0;
frameVel = 0;
frame1 = 7;
renderSmooth = true;
var _local1:Array = physObjInitVarString.split(",");
bikeBodyGraphicID = GraphicObjects.GetIndexByName((_local1[0] as String));
bikeBodyOffsetX = Number(_local1[1]);
bikeBodyOffsetY = Number(_local1[2]);
}
function RenderPlayer():void{
RenderNormally();
var _local1:Number = frame;
var _local2:int = graphicID;
var _local3:Number = xpos;
var _local4:Number = ypos;
var _local5:Point = new Point(bikeBodyOffsetX, bikeBodyOffsetY);
var _local6:Matrix = new Matrix();
_local6.rotate(dir);
_local5 = _local6.transformPoint(_local5);
xpos = (xpos + _local5.x);
ypos = (ypos + _local5.y);
frame = frame1;
graphicID = bikeBodyGraphicID;
RenderNormally();
frame = _local1;
graphicID = _local2;
xpos = _local3;
ypos = _local4;
}
function InitObj_Bouncer(){
xoffset = 0;
yoffset = 0;
updateFunction = UpdateBouncer;
renderFunction = RenderBouncer;
controlMode = 0;
timer = 0;
}
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;
colFlag_isPlayer = false;
colFlag_isPhysObj = false;
}
function RenderBouncer(){
var _local1:Number = xpos;
var _local2:Number = ypos;
xpos = (xpos + xoffset);
ypos = (ypos + yoffset);
RenderNormally();
xpos = _local1;
ypos = _local2;
}
function InitAIPlayer(_arg1:int, _arg2:int, _arg3:int):void{
colFlag_isEnemy = true;
aiBikeOffsets = new Array();
aiBikeOffsets.push(new Point(0, 0), 0);
aiBikeOffsets.push(new Point(0, -10), 0);
aiBikeOffsets.push(new Point(0, -8), 0);
aiBikeOffsets.push(new Point(0, -10), 10);
aiBikeOffsets.push(new Point(0, -6), 0);
aiBikeOffsets.push(new Point(0, -7), 0);
aiBikeOffsets.push(new Point(0, -4), -2);
aiBikeOffsets.push(new Point(0, 7), -5);
aiBikeOffsets.push(new Point(0, -10), 0);
aiBikeOffsets.push(new Point(0, 0), 0);
aiBikeOffsets.push(new Point(0, -1), -3);
aiBikeOffsets.push(new Point(0, -7), -5);
aiBikeOffsets.push(new Point(0, -8), 0);
aiBikeOffsets.push(new Point(0, -8), -10);
aiBikeOffsets.push(new Point(0, -10), 0);
aiBikeOffsets.push(new Point(0, 0), 0);
aiBikeOffsets.push(new Point(0, 0), 0);
aiBikeOffsets.push(new Point(0, 0), 0);
aiBikeOffsets.push(new Point(0, 0), 0);
aiBikeOffsets.push(new Point(0, 0), 0);
aiBikeOffsets.push(new Point(0, 0), 0);
type = (_arg3 - 1);
renderSmooth = true;
zpos = (zpos + (500 + type));
aiRouteIndex = PlayerRecordings.GetRouteIndex(Game.currentLevel, _arg1);
aiRoutePos = 0;
updateFunction = UpdateAIPlayer;
renderFunction = RenderAIPlayer;
frame = 0;
frameVel = 1;
aiPlayerSpeed = 1;
if (type < 20){
aiPhysObj = Game.physObjs.FindByName(("bike" + int((type + 1)).toString()));
};
timer = _arg2;
var _local4:PlayerRecord = PlayerRecordings.GetItem(aiRouteIndex, int(aiRoutePos));
xpos = (oldAiPosX = _local4.x);
ypos = (oldAiPosY = _local4.y);
aiRoutePos = 1;
UpdateAIPlayer_Step(_arg2);
aiBodyFrame = 0;
aiLegsFrame = 0;
aiWheelRot = 0;
aiUpperBodyLean = 0.5;
aiLegRotSpeed = 0;
aiBikeSpecialType = 0;
if (type == 20){
aiBikeSpecialType = 1;
graphicID = GraphicObjects.GetIndexByName("Bubble");
frame = 0;
frameVel = 1;
renderFunction = RenderAIPlayerSpecial;
};
if (type == 21){
aiBikeSpecialType = 2;
graphicID = GraphicObjects.GetIndexByName("WallOfFire");
frame = 0;
frameVel = 1;
renderFunction = RenderAIPlayerSpecial;
};
if (type == 22){
aiBikeSpecialType = 3;
graphicID = GraphicObjects.GetIndexByName("Walrus");
frame = 0;
frameVel = 1;
renderFunction = RenderAIPlayerSpecial;
};
}
public function GetOffsetObjectRectangle():Rectangle{
var _local1:Rectangle = objectDef.colRects[0].clone();
_local1.x = (_local1.x + xpos);
_local1.y = (_local1.y + ypos);
return (_local1);
}
public function PlayerHitEnemyBullet(_arg1:GameObj){
}
function GameObj_UpdateCycleAnim():void{
CycleAnimation();
}
function InitObj_Conveyor(){
frame = 0;
frameVel = 0.5;
updateFunction = UpdateObj_Conveyor;
}
public function RenderShadow():void{
if (renderShadowFlag == false){
return;
};
if (visible == false){
return;
};
var _local1:Number = (xpos - Game.scrollX);
var _local2:Number = (ypos - Game.scrollY);
GraphicObjects.RenderAtRotScaled(graphicID, frame, bd, (_local1 + 5), (_local2 + 5), true, 1, dir);
}
function UpdateBall():void{
if (controlMode == 0){
};
if (controlMode == 1){
frameVel = 0.5;
PlayAnimation();
if (frame >= 22){
SoundPlayer.Play("blowwav");
controlMode = 2;
};
} else {
if (controlMode == 2){
frameVel = 0.5;
PlayAnimation();
frameVel1 = 1;
PlayAnimation1();
if (frame1 >= 40){
visible = false;
controlMode = 3;
SoundPlayer.Play("popwav");
};
} else {
if (controlMode == 3){
if (PlayAnimation1()){
childGO.active = false;
};
};
};
};
}
public function PlayAnimation():Boolean{
var _local1:int = (GraphicObjects.GetNumFrames(graphicID) - 1);
frame = (frame + frameVel);
if (frame >= _local1){
frame = _local1;
return (true);
};
if (frame <= 0){
frame = 0;
return (true);
};
return (false);
}
function RenderNormally(_arg1:Boolean=true){
var _local2:Number = (int(xpos) - int(Game.scrollX));
var _local3:Number = (int(ypos) - int(Game.scrollY));
if (_arg1 == false){
_local2 = int(xpos);
_local3 = int(ypos);
};
if (_local2 < -1000){
return;
};
if (_local2 > (Defs.displayarea_w + 500)){
return;
};
if (_local3 < -1000){
return;
};
if (_local3 > (Defs.displayarea_h + 500)){
return;
};
if (((!((scale == 1))) || (!((dir == 0))))){
GraphicObjects.RenderAtRotScaled(graphicID, frame, bd, _local2, _local3, false, scale, dir, null, renderSmooth);
} else {
if (additive){
GraphicObjects.RenderAtAdditive(graphicID, frame, bd, _local2, _local3, alpha);
} else {
GraphicObjects.RenderAt(graphicID, frame, bd, _local2, _local3, false);
};
};
}
public function InitNextPieceGO(){
subtype = 0;
frame = subtype;
updateFunction = UpdateNextPieceGO;
dir = 0;
}
function RenderTextMessage(){
var _local1:Number = (xpos - Game.scrollX);
var _local2:Number = (ypos - Game.scrollY);
var _local3:Number = GraphicObjects.GetStringWidth(bd, GraphicObjects.gfx_font2, _local1, _local2, textMessage, null);
GraphicObjects.RenderStringAt(bd, GraphicObjects.gfx_font2, (_local1 - (_local3 / 2)), _local2, textMessage, null);
}
public function InitSparks(_arg1:Boolean){
if (_arg1){
graphicID = GraphicObjects.GetIndexByName("portalINsparks");
} else {
graphicID = GraphicObjects.GetIndexByName("portalOUTsparks");
};
frame = 0;
frameVel = 1;
updateFunction = UpdateSparks;
}
function InitReadyGetSetGo():void{
zpos = 0;
graphicID = GraphicObjects.GetIndexByName("trafficlight_clip");
updateFunction = UpdateReadyGetSetGo;
renderFunction = RenderReadyGetSetGo;
frame = 0;
frameVel = 1;
Game.readySetGoFrame = -1;
if (Game.currentLevel == 0){
xpos = 780;
ypos = 989;
};
if (Game.currentLevel == 1){
xpos = 685;
ypos = 1678;
};
if (Game.currentLevel == 2){
xpos = 531;
ypos = 1208;
};
if (Game.currentLevel == 3){
xpos = 1641;
ypos = 1656;
};
controlMode = 0;
}
public function GetDirBetween(_arg1, _arg2, _arg3, _arg4):Number{
var _local5:* = Math.atan2((_arg4 - _arg2), (_arg3 - _arg1));
return (_local5);
}
function UpdateObj_Ship(){
timer++;
var _local1:Number = (Math.sin((timer * 0.1)) * 5);
ypos1 = _local1;
}
public function InitPinDisappear_Broken(){
health = 32;
frame = (health / 2);
}
function InitAIVehicle():void{
sortByY = true;
updateFunction = UpdatePlayerVehicle;
renderFunction = RenderPlayerVehicle;
isVehicle = true;
SetRandomCarColor();
type = Utils.RandBetweenInt(0, 2);
height = 0;
frame1 = 0;
}
public function InitMessage(_arg1:int):void{
updateFunction = UpdateMessage;
timer = (Defs.fps * 0.8);
frame = _arg1;
graphicID = GraphicObjects.GetIndexByName("StartRaceText");
}
function UpdatePlayerVehicle():void{
if (showArrowTimer > 0){
showArrowTimer--;
};
}
public function CycleAnimationEx():Boolean{
var _local1:Boolean;
frame = (frame + frameVel);
var _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);
}
function UpdatePickup():void{
CycleAnimation();
}
function SetRandomCarColor(){
var _local1:Number = 1;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:int = Utils.RandBetweenInt(0, 5);
if (_local4 == 0){
_local1 = 1;
_local2 = 0;
_local3 = 0;
};
if (_local4 == 1){
_local1 = 0;
_local2 = 1;
_local3 = 0;
};
if (_local4 == 2){
_local1 = 0;
_local2 = 0;
_local3 = 1;
};
if (_local4 == 3){
_local1 = 1;
_local2 = 1;
_local3 = 0;
};
if (_local4 == 4){
_local1 = 1;
_local2 = 0;
_local3 = 1;
};
if (_local4 == 5){
_local1 = 0;
_local2 = 1;
_local3 = 1;
};
ct = new ColorTransform(1, 1, 1, 1, (0xFF * _local1), (0xFF * _local2), (0xFF * _local3), 0);
}
public function InitTextMessage(_arg1:String, _arg2:Number, _arg3:Number):void{
textMessage = _arg1;
updateFunction = UpdateTextMessage;
renderFunction = RenderTextMessage;
timer = 30;
xpos = _arg2;
ypos = _arg3;
}
function UpdateObj_Conveyor(){
CycleAnimation();
}
function InitCheckpoint():void{
Game.startPoints.push(new Point(xpos, ypos));
}
function UpdateMessage(){
xpos = (320 + Game.scrollX);
ypos = (100 + Game.scrollY);
timer--;
if (timer <= 0){
active = false;
};
}
function RenderAIPlayer(){
var _local9:PhysObj_Body;
var _local11:PhysObj_Graphic;
var _local1:Number = frame;
var _local2:int = graphicID;
var _local3:Number = xpos;
var _local4:Number = ypos;
var _local5:Number = xpos;
var _local6:Number = ypos;
var _local7:Number = dir;
var _local8:Number = dir;
var _local10:Point = new Point(0, 0);
var _local12:Point = aiBikeOffsets[((type * 2) + 0)];
var _local13:Number = aiBikeOffsets[((type * 2) + 1)];
_local3 = (_local3 + _local12.x);
_local4 = (_local4 + _local12.y);
dir = (dir + Utils.DegToRad(_local13));
_local7 = dir;
var _local14:Matrix = new Matrix();
_local14.rotate(dir);
_local9 = aiPhysObj.BodyFromName("body");
_local11 = _local9.graphics[0];
_local10.x = _local9.pos.x;
_local10.y = _local9.pos.y;
_local10 = _local14.transformPoint(_local10);
xpos = (_local3 + _local10.x);
ypos = (_local4 + _local10.y);
graphicID = _local11.graphicID;
var _local15:int = GraphicObjects.GetNumFrames(graphicID);
aiLegsFrame = (aiLegsFrame + aiLegRotSpeed);
if (aiLegsFrame >= _local15){
aiLegsFrame = 0;
};
frame = aiLegsFrame;
RenderNormally();
_local9 = aiPhysObj.BodyFromName("wheel1");
_local11 = _local9.graphics[0];
_local10.x = _local9.pos.x;
_local10.y = _local9.pos.y;
_local10 = _local14.transformPoint(_local10);
xpos = (_local3 + _local10.x);
ypos = (_local4 + _local10.y);
frame = _local11.frame;
graphicID = _local11.graphicID;
dir = aiWheelRot;
RenderNormally();
_local9 = aiPhysObj.BodyFromName("wheel2");
_local11 = _local9.graphics[0];
_local10.x = _local9.pos.x;
_local10.y = _local9.pos.y;
_local10 = _local14.transformPoint(_local10);
xpos = (_local3 + _local10.x);
ypos = (_local4 + _local10.y);
frame = _local11.frame;
graphicID = _local11.graphicID;
dir = aiWheelRot;
RenderNormally();
dir = _local7;
_local9 = aiPhysObj.BodyFromName("body");
_local11 = _local9.graphics[0];
var _local16:Array = _local11.goInitFuntionVarString.split(",");
bikeBodyGraphicID = GraphicObjects.GetIndexByName((_local16[0] as String));
bikeBodyOffsetX = Number(_local16[1]);
bikeBodyOffsetY = Number(_local16[2]);
_local10.x = (_local9.pos.x + bikeBodyOffsetX);
_local10.y = (_local9.pos.y + bikeBodyOffsetY);
_local10 = _local14.transformPoint(_local10);
xpos = (_local3 + _local10.x);
ypos = (_local4 + _local10.y);
graphicID = bikeBodyGraphicID;
_local15 = GraphicObjects.GetNumFrames(graphicID);
frame = Utils.ScaleTo(0, (_local15 - 1), 0, 1, aiUpperBodyLean);
RenderNormally();
frame = _local1;
graphicID = _local2;
xpos = _local5;
ypos = _local6;
dir = _local8;
}
function RenderAIPlayerSpecial(){
RenderNormally();
}
public function Update():void{
if (updateFunction != null){
updateFunction();
};
if (sortByY){
zpos = (3000 - ypos);
};
}
function RenderBall():void{
RenderNormally();
}
public function GetObjectRectangle():Rectangle{
return (objectDef.colRects[0]);
}
function RenderPlayerVehicle():void{
var _local4:int;
var _local5:int;
var _local6:String;
var _local1:Number = (xpos - 50);
var _local2:Number = (ypos - 70);
var _local3:int = (frame + frame1);
if (type == 0){
graphicID = GraphicObjects.GetIndexByName("Car01");
};
if (type == 1){
graphicID = GraphicObjects.GetIndexByName("Car02");
};
if (type == 2){
graphicID = GraphicObjects.GetIndexByName("Car03");
};
RenderCarObjAt(_local1, _local2, graphicID, 6, frame, null, 8);
RenderCarObjAt(_local1, (_local2 + height), graphicID, 0, _local3, ct);
RenderCarObjAt(_local1, (_local2 + height), graphicID, 1, _local3);
RenderCarObjAt(_local1, (_local2 + height), graphicID, (2 + carDrive), _local3);
if (showArrowTimer != 0){
_local4 = GraphicObjects.GetIndexByName("arrow_clip");
_local5 = GraphicObjects.GetNumFrames(_local4);
RenderObjAt(xpos, (ypos - 50), _local4, (showArrowTimer % _local5));
};
if (Debug.IsSet(1) == true){
_local6 = (((((("Lap " + vehicleCurrentLap) + " (") + vehicleCheckpointIndex) + ", ") + totalVehicleCheckpointIndex) + ")");
GraphicObjects.RenderStringAt(bd, GraphicObjects.gfx_font1, (xpos - Game.scrollX), ((ypos - Game.scrollY) - 50), _local6, null, -1);
};
}
public function InitPinDisappear(){
health = 0;
frame = (health / 2);
}
function InitBubbleSplatDrip(_arg1:Number):void{
graphicID = GraphicObjects.GetIndexByName("BubbleSplat");
frame = 3;
frameVel = Utils.RandBetweenFloat(0.1, 0.2);
yvel = Utils.RandBetweenFloat(0.01, 0.1);
updateFunction = UpdateBubbleSplatDrip;
}
public function RenderPellet(){
}
function InitOverlay():void{
sortByY = true;
}
public function PinDisappearHit():Boolean{
health++;
frame = (health / 2);
if (health > 40){
health = 40;
frame = (health / 2);
return (true);
};
return (false);
}
function UpdateAIPlayer(){
var _local2:int;
var _local3:PlayerRecord;
var _local4:Number;
var _local5:Number;
var _local1:Number = dir;
oldxpos = xpos;
oldypos = ypos;
if (Game.levelState == Game.levelState_Play){
_local2 = int(aiRoutePos);
_local3 = PlayerRecordings.GetItem(aiRouteIndex, _local2);
if (_local3){
dir = _local3.rot;
if (_local2 != 0){
xpos = (_local3.x + oldAiPosX);
ypos = (_local3.y + oldAiPosY);
} else {
xpos = _local3.x;
ypos = _local3.y;
};
oldAiPosX = xpos;
oldAiPosY = ypos;
};
aiRoutePos = (aiRoutePos + aiPlayerSpeed);
};
if (aiBikeSpecialType == 0){
CycleAnimation();
_local4 = Utils.DistBetweenPoints(xpos, ypos, oldxpos, oldypos);
_local4 = Utils.LimitNumber(0, 20, _local4);
aiLegRotSpeed = Utils.ScaleTo(0, 1, 0, 3, _local4);
aiWheelRot = (aiWheelRot + (_local4 * 0.1));
_local5 = (dir - _local1);
if (Math.abs(_local5) < 0.2){
if (_local5 > 0){
aiUpperBodyLean = (aiUpperBodyLean + 0.11);
if (aiUpperBodyLean > 1){
aiUpperBodyLean = 1;
};
} else {
if (_local5 < 0){
aiUpperBodyLean = (aiUpperBodyLean - 0.1);
if (aiUpperBodyLean < 0){
aiUpperBodyLean = 0;
};
} else {
if (aiUpperBodyLean < 0.5){
aiUpperBodyLean = (aiUpperBodyLean + 0.1);
if (aiUpperBodyLean > 0.5){
aiUpperBodyLean = 0.5;
};
} else {
if (aiUpperBodyLean > 0.5){
aiUpperBodyLean = (aiUpperBodyLean - 0.1);
if (aiUpperBodyLean < 0.5){
aiUpperBodyLean = 0.5;
};
};
};
};
};
};
} else {
if (aiBikeSpecialType == 1){
CycleAnimation();
} else {
if (aiBikeSpecialType == 2){
CycleAnimation();
dir = 0;
} else {
if (aiBikeSpecialType == 3){
CycleAnimation();
};
};
};
};
}
function InitSortByY():void{
sortByY = true;
}
public function InitPhysicsObject(_arg1:int, _arg2:int, _arg3:Number=0, _arg4:Number=0, _arg5:String="", _arg6:Boolean=false){
colFlag_isPhysObj = true;
physObjOffsetX = _arg3;
physObjOffsetY = _arg4;
isPhysObj = true;
graphicID = _arg1;
frame = _arg2;
updateFunction = UpdatePhysicsObject;
renderShadowFlag = _arg6;
physObjInitVarString = _arg5;
}
public function InitPhysicsFloorObject(_arg1:int, _arg2:Number){
frame = _arg1;
dir = _arg2;
}
function ReadySetGoFinishedRace():void{
controlMode = 2;
}
public function Init(_arg1:int):void{
var _local2:int;
var _local3:Number = 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;
xpos1 = 0;
ypos1 = 0;
renderSmooth = true;
sortByY = false;
isVehicle = false;
}
function UpdatePlayer():void{
CycleAnimation();
var _local1:Boolean;
var _local2:Boolean;
var _local3:Boolean;
var _local4:Boolean;
if (KeyReader.Down(KeyReader.KEY_LEFT)){
_local1 = true;
};
if (KeyReader.Down(KeyReader.KEY_RIGHT)){
_local2 = true;
};
if (KeyReader.Down(KeyReader.KEY_UP)){
_local3 = true;
};
if (KeyReader.Down(KeyReader.KEY_DOWN)){
_local4 = true;
};
var _local5:Number = 0.1;
if (_local3){
frameVel = (frameVel + _local5);
if (frameVel > 4){
frameVel = 4;
};
} else {
if (_local4){
frameVel = (frameVel - _local5);
if (frameVel < -4){
frameVel = -4;
};
} else {
if (frameVel > 0){
frameVel = (frameVel - _local5);
if (frameVel <= 0){
frameVel = 0;
};
} else {
if (frameVel < 0){
frameVel = (frameVel + _local5);
if (frameVel >= 0){
frameVel = 0;
};
};
};
};
};
var _local6:Number = 0.5;
if (_local2){
frame1 = (frame1 - _local6);
if (frame1 <= 0){
frame1 = 0;
};
} else {
if (_local1){
frame1 = (frame1 + _local6);
if (frame1 >= 14){
frame1 = 14;
};
} else {
if (frame1 < 7){
frame1 = (frame1 + _local6);
if (frame1 >= 7){
frame1 = 7;
};
};
if (frame1 > 7){
frame1 = (frame1 - _local6);
if (frame1 <= 7){
frame1 = 7;
};
};
};
};
Game.oldPlayerRot = Game.playerRot;
Game.playerRot = dir;
}
public function UpdateNextPieceGO(){
var _local1:Number = MouseControl.x;
var _local2:Number = MouseControl.y;
xpos = (_local1 + Game.scrollX);
ypos = (_local2 + Game.scrollY);
if (MouseControl.delta != 0){
dir = (dir + (Number(MouseControl.delta) * 0.1));
MouseControl.delta = 0;
};
}
function InitBall():void{
updateFunction = UpdateBall;
renderFunction = RenderBall;
controlMode = 0;
frame1 = 0;
graphicID1 = GraphicObjects.GetIndexByName("Bubble");
var _local1:int = GameObjects.lastGenIndex;
childGO = GameObjects.AddObj(xpos, ypos, -1000);
childGO.InitBallBubble(this);
GameObjects.lastGenIndex = _local1;
}
public function PlayAnimationEx():Boolean{
var _local1:Boolean;
frame = (frame + frameVel);
var _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 = GraphicObjects.GetNumFrames(graphicID);
var _local2:Number = xvel;
var _local3:Number = yvel;
var _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 GameObj_UpdateHoseSwitch():void{
if (controlMode == 0){
} else {
if (controlMode == 1){
frameVel = 1;
if (PlayAnimation()){
frame = 0;
controlMode = 0;
};
};
};
}
function UpdateTextMessage(){
ypos = (ypos - 0.2);
timer--;
if (timer <= 0){
active = false;
};
}
function SetAnim(_arg1:int){
graphicID = _arg1;
var _local2:int = (GraphicObjects.GetNumFrames(graphicID) - 1);
if (frame >= _local2){
frame = 0;
};
}
function RenderObjAt(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int, _arg5:ColorTransform=null){
var _local6:Number = (int(_arg1) - int(Game.scrollX));
var _local7:Number = (int(_arg2) - int(Game.scrollY));
if (_local6 < -1000){
return;
};
if (_local6 > (Defs.displayarea_w + 500)){
return;
};
if (_local7 < -1000){
return;
};
if (_local7 > (Defs.displayarea_h + 500)){
return;
};
if (_arg5 != null){
GraphicObjects.RenderAtRotScaled(_arg3, _arg4, bd, _local6, _local7, false, scale, dir, _arg5, renderSmooth);
} else {
if (((!((scale == 1))) || (!((dir == 0))))){
GraphicObjects.RenderAtRotScaled(_arg3, _arg4, bd, _local6, _local7, false, scale, dir, null, renderSmooth);
} else {
if (additive){
GraphicObjects.RenderAtAdditive(_arg3, _arg4, bd, _local6, _local7, alpha);
} else {
GraphicObjects.RenderAt(_arg3, _arg4, bd, _local6, _local7, false);
};
};
};
}
public function CycleAnimation():void{
var _local1:Number = frameVel;
var _local2:int = GraphicObjects.GetNumFrames(graphicID);
frame = (frame + _local1);
if (frame >= _local2){
frame = (frame - _local2);
};
if (frame < 0){
frame = (frame + _local2);
};
}
function GameObj_InitHoseSwitch():void{
updateFunction = GameObj_UpdateHoseSwitch;
graphicID = GraphicObjects.GetIndexByName("SnakeEnd");
frame = 0;
controlMode = 0;
}
function GameObj_InitSwitch():void{
updateFunction = GameObj_UpdateSwitch;
frameVel = 1;
controlMode = 0;
frame = 0;
}
function UpdateSparks():void{
if (PlayAnimation()){
active = false;
};
}
function GameObj_InitCycleAnim():void{
updateFunction = GameObj_UpdateCycleAnim;
frameVel = 1;
}
function UpdateReadyGetSetGo():void{
var _local1:int;
if (controlMode == 0){
PlayAnimation();
_local1 = int(frame);
if (_local1 == 20){
SoundPlayer.Play("sfx_readyset");
Game.readySetGoFrame = 0;
Game.panelOverlay.cursorkeys.visible = true;
Game.panelOverlay.cursorkeys.gotoAndPlay(1);
};
if (_local1 == 50){
SoundPlayer.Play("sfx_readyset");
Game.readySetGoFrame = 1;
};
if (_local1 == 80){
SoundPlayer.Play("sfx_go");
Game.readySetGoFrame = 2;
Game.gettingReady = false;
};
if (_local1 == 138){
controlMode = 1;
Game.readySetGoFrame = -1;
};
} else {
if (controlMode == 1){
} else {
if (controlMode == 2){
PlayAnimation();
};
};
};
}
public function PlayAnimation1():Boolean{
var _local1:int = (GraphicObjects.GetNumFrames(graphicID1) - 1);
frame1 = (frame1 + frameVel1);
if (frame1 >= _local1){
frame1 = _local1;
return (true);
};
return (false);
}
public function Render(_arg1:BitmapData):void{
bd = _arg1;
if (visible == false){
return;
};
if (renderFunction != null){
renderFunction();
} else {
RenderNormally();
};
}
function InitPlayerVehicle():void{
sortByY = true;
colFlag_isPlayer = true;
updateFunction = UpdatePlayerVehicle;
renderFunction = RenderPlayerVehicle;
isVehicle = true;
var _local1:uint = Game.selectedCarColor;
var _local2 = ((_local1 >> 16) & 0xFF);
var _local3 = ((_local1 >> 8) & 0xFF);
var _local4 = (_local1 & 0xFF);
ct = new ColorTransform(1, 1, 1, 1, _local2, _local3, _local4, 0);
type = Utils.RandBetweenInt(0, 2);
height = 0;
frame1 = 0;
showArrowTimer = (Defs.fps * 5);
}
public function PlayerHitEnemy(_arg1:GameObj){
}
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;
};
};
}
function InitPickup():void{
sortByY = true;
frame = 0;
frameVel = 1;
updateFunction = UpdatePickup;
}
function RenderReadyGetSetGo():void{
RenderNormally(true);
}
function RenderCarObjAt(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int, _arg5:int, _arg6:ColorTransform=null, _arg7:int=14){
var _local8:Number = (int(_arg1) - int(Game.scrollX));
var _local9:Number = (int(_arg2) - int(Game.scrollY));
if (_local8 < -1000){
return;
};
if (_local8 > (Defs.displayarea_w + 500)){
return;
};
if (_local9 < -1000){
return;
};
if (_local9 > (Defs.displayarea_h + 500)){
return;
};
var _local10:int = (_arg5 % _arg7);
var _local11:int = (_arg5 / _arg7);
var _local12:int = (_local10 * 100);
var _local13:int = (_local11 * 100);
var _local14:Rectangle = new Rectangle(0, 0, 100, 100);
GraphicObjects.RenderAtRotScaled_SourceRect(_arg3, _arg4, bd, _local8, _local9, false, scale, dir, _arg6, renderSmooth, _local14, _local12, _local13);
}
function BouncerBounce(){
if (controlMode == 0){
timer = 0;
controlMode = 1;
};
}
function InitObj_Ship(){
updateFunction = UpdateObj_Ship;
timer = 0;
}
function GameObj_UpdateSwitch():void{
if (controlMode == 0){
} else {
if (controlMode == 1){
frameVel = 1;
if (PlayAnimation()){
controlMode = 0;
};
} else {
if (controlMode == 2){
frameVel = -1;
if (PlayAnimation()){
controlMode = 0;
};
} else {
if (controlMode == 3){
frame = 0;
controlMode = 0;
};
};
};
};
}
function UpdateAIPlayer_Step(_arg1:int){
var _local2:int;
var _local3:int;
var _local4:PlayerRecord;
_local2 = 0;
while (_local2 < _arg1) {
_local3 = int(aiRoutePos);
_local4 = PlayerRecordings.GetItem(aiRouteIndex, _local3);
xpos = (_local4.x + oldAiPosX);
ypos = (_local4.y + oldAiPosY);
oldAiPosX = xpos;
oldAiPosY = ypos;
aiRoutePos = (aiRoutePos + aiPlayerSpeed);
_local2++;
};
}
public function GetVelFromDir(_arg1:Number){
xvel = (Math.cos(dir) * _arg1);
yvel = (Math.sin(dir) * _arg1);
}
public function UpdatePhysicsObject(){
}
}
}//package
Section 139
//GameObjects (GameObjects)
package {
import flash.events.*;
import flash.display.*;
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(_arg1:BitmapData):void{
var _local2:GameObj;
var _local3:Array = new Array();
for each (_local2 in objs) {
if (((_local2.active) && (_local2.visible))){
_local3.push(_local2);
};
};
_local3.sortOn("zpos", (Array.NUMERIC | Array.DESCENDING));
for each (_local2 in _local3) {
_local2.Render(_arg1);
};
}
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 _local2:int;
var _local1:int;
_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 = new Array();
for each (_local2 in objs) {
if (_local2.active){
_arg1(_local2);
};
};
}
public static function GetGOByIndex(_arg1:int):GameObj{
return (objs[_arg1]);
}
}
}//package
Section 140
//GraphicObjects (GraphicObjects)
package {
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import org.flashdevelop.utils.*;
public class GraphicObjects {
public static var gfx_fills:int;
static var count:int;
static var loader:Loader;
public static var gfx_font2black:int;
public static var stringCharX:Number;
static var main:Main;
public static var gfx_backgrounds:int;
static var nameList:Array;
static var graphicobjs:Array;
static var nextID:int;
public static var gfx_fontblack:int;
public static var stringCharY:Number;
static var idList:Array;
static var cb:Function;
public static var stringCharBitmapData:BitmapData;
public static var gfx_outlines:int;
public static var gfx_font1:int;
public static var gfx_font2:int;
public static function Add(_arg1:String, _arg2:int):int{
var _local3:* = nextID;
nextID++;
var _local4:Class = (getDefinitionByName(_arg1) as Class);
var _local5:MovieClip = (new (_local4) as MovieClip);
Add1(_local3, new DisplayObj(_local5, 1, _arg2), _arg1);
_local4 = null;
return (_local3);
}
public static function RenderAt(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Boolean=false){
var _local7:int = 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 = idList[_arg1];
if (_arg7){
graphicobjs[_local8].frames[_arg2].RenderAtRotBurned(_arg3, _arg4, _arg5, _arg6);
} else {
graphicobjs[_local8].frames[_arg2].RenderAtRot(_arg3, _arg4, _arg5, _arg6);
};
}
static function InitOnceA():void{
var _local1:int;
graphicobjs = new Array();
idList = new Array(200);
nameList = new Array(200);
_local1 = 0;
while (_local1 < 200) {
idList[_local1] = int(0);
nameList[_local1] = String("");
_local1++;
};
count = 0;
nextID = 0;
gfx_font1 = AddFont(main.tf_scorespr);
gfx_fontblack = AddFont(main.tf_scoresprblack);
gfx_font2 = AddFont(main.tf_scorespr1);
gfx_font2black = AddFont(main.tf_scorespr2);
var _local2:Number = getTimer();
if (Licensors.GetLicensor() == Licensors.LICENSOR_WEBBLIWORLD_LOCKED){
Add("BackgroundLevel03", 0);
Add("BackgroundLevel04", 0);
Add("BackgroundLevel03_Collision", 0);
Add("BackgroundLevel04_Collision", 0);
Add("Level03_Overlays", 0);
Add("Level04_Overlays", 0);
Add("mallow_clip", 0);
Add("icecream_clip", 0);
Add("smoke_level03", 0);
Add("smoke_level04", 0);
};
Add("BackgroundLevel01", 0);
Add("BackgroundLevel02", 0);
Add("BackgroundLevel01_Collision", 99);
Add("BackgroundLevel02_Collision", 0);
var _local3:Number = getTimer();
Add("Car01", 0);
Add("Car02", 0);
Add("Car03", 0);
var _local4:Number = getTimer();
Add("Level01_Overlays", 0);
Add("Level02_Overlays", 0);
Add("ReadyGetSetGo", 0);
Add("Pickup", 0);
Add("arrow_clip", 0);
Add("SkidMarks", 0);
Add("cone_clip", 0);
Add("ConeHitClip", 0);
Add("mushroom_clip", 0);
Add("turbo_clip", 0);
Add("smoke_level01", 0);
Add("smoke_level02", 0);
Add("MiniMaps", 0);
Add("trafficlight_clip", 0);
Add("ColorPickerClip", 0);
var _local5:Number = getTimer();
FlashConnect.trace(("GR Time = " + ((_local3 - _local2) / 1000).toString()));
FlashConnect.trace(("GR Time = " + ((_local4 - _local3) / 1000).toString()));
FlashConnect.trace(("GR Time = " + ((_local5 - _local4) / 1000).toString()));
FlashConnect.trace(("GR Time total= " + ((_local5 - _local2) / 1000).toString()));
}
public static function RenderAtSplit(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number){
var _local6:int = idList[_arg1];
graphicobjs[_local6].frames[_arg2].RenderAtSplit(_arg3, _arg4, _arg5);
}
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, _arg10:Boolean=false){
var _local11:int = idList[_arg1];
graphicobjs[_local11].frames[_arg2].RenderAtRotScaled(_arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
}
public static function GetStringWidth(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Object=null, _arg7:int=0):int{
var _local9:int;
var _local10:int;
stringCharX = _arg3;
stringCharY = _arg4;
var _local8:int;
_local9 = 0;
while (_local9 < _arg5.length) {
_local10 = int(_arg5.charCodeAt(_local9));
if (_local10 < 0){
_local10 = 0;
};
if (_local10 > 127){
_local10 = 127;
};
stringCharBitmapData = GetBitmapData(_arg2, _local10);
if (_arg6 != null){
} else {
_local8 = (_local8 + (stringCharBitmapData.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);
stringCharBitmapData = GetBitmapData(_arg2, _local9);
if (_arg6 != null){
_arg6();
} else {
stringCharX = (stringCharX + (stringCharBitmapData.width - 3));
stringCharX = (stringCharX + _arg7);
};
_local8++;
};
}
public static function GetWidth(_arg1:int, _arg2:int):int{
var _local3:int = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].bitmapData.width);
}
public static function RenderNumberAt(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int){
var _local8:int;
var _local10:int;
var _local11:int;
var _local12:BitmapData;
var _local6:Array = new Array();
var _local7:int = _arg5;
_local8 = 0;
while (_local8 < 11) {
_local10 = (_local7 % 10);
_local6.push(_local10);
_local7 = (_local7 / 10);
_local8++;
};
var _local9:Boolean;
_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 = GetBitmapData(_arg2, (_local11 + 48));
_arg3 = (_arg3 + _local12.width);
};
(_local8 >= 0);
};
return (_arg3);
}
public static function GetNumFrames(_arg1:int):int{
var _local2:int = idList[_arg1];
return (graphicobjs[_local2].frames.length);
}
public static function RenderAtScaled(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Boolean=false, _arg7:Number=1){
var _local8:int = 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 = idList[_arg1];
var _local6:BitmapData = graphicobjs[_local5].frames[_arg2].bitmapData;
var _local7:uint = _local6.getPixel32(_arg3, _arg4);
return (_local7);
}
public static function GetBitmapData(_arg1:int, _arg2:int):BitmapData{
var _local3:int = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].bitmapData);
}
public static function Add1(_arg1:int, _arg2:DisplayObj, _arg3:String=""):void{
idList[_arg1] = count;
nameList[_arg1] = _arg3;
graphicobjs.push(_arg2);
count++;
}
public static function RenderAtAlpha(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number){
var _local7:int = idList[_arg1];
graphicobjs[_local7].frames[_arg2].RenderAtAlpha(_arg3, _arg4, _arg5, _arg6);
}
public static function RenderAtRotScaled_SourceRect(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Boolean=false, _arg7:Number=1, _arg8:Number=0, _arg9:ColorTransform=null, _arg10:Boolean=false, _arg11:Rectangle=null, _arg12:int=0, _arg13:int=0){
var _local14:int = idList[_arg1];
graphicobjs[_local14].frames[_arg2].RenderAtRotScaled_SourceRect(_arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13);
}
public static function InitOnce(_arg1:Main, _arg2:Function):void{
cb = _arg2;
main = _arg1;
InitOnceA();
cb();
}
public static function GetIndexByName(_arg1:String):int{
var _local3:String;
var _local2:int;
for each (_local3 in nameList) {
if (_local3 == _arg1){
return (_local2);
};
_local2++;
};
trace(("cant find graphic obj by name: " + _arg1));
return (0);
}
public static function AddFont(_arg1:TextFormat):int{
var _local2:* = nextID;
nextID++;
var _local3:DisplayObj = new DisplayObj(null, 0, 0);
_local3.CreateFont(_arg1);
idList[_local2] = count;
graphicobjs.push(_local3);
count++;
return (_local2);
}
public static function GetHeught(_arg1:int, _arg2:int):int{
var _local3:int = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].bitmapData.height);
}
public static function RenderAtAdditive(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number){
var _local7:int = idList[_arg1];
graphicobjs[_local7].frames[_arg2].RenderAtAdditive(_arg3, _arg4, _arg5, _arg6);
}
}
}//package
Section 141
//HighScore (HighScore)
package {
import flash.net.*;
public class HighScore {
public static const hiscoretype_SHOCKWAVE = 5;
public static const hiscoretype_NONE = 0;
public static const hiscoretype_MOCHI = 1;
public static const hiscoretype_CANDYSTAND = 6;
public static const hiscoretype_GAMEZHERO = 4;
public static const hiscoretype_MINDJOLT = 2;
public static const hiscoretype_MINDJOLT_VIRAL = 3;
static var callback:Object;
static var s:int;
static var main:Main;
static var difficulty:int;
public static function InitOnce(_arg1:Main){
main = _arg1;
}
public static function SubmitScore(_arg1:int, _arg2:int, _arg3=null):void{
var _local4:String;
var _local5:String;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:int;
var _local10:URLRequest;
s = _arg1;
difficulty = _arg2;
callback = _arg3;
if (Licensors.GetLicensor() == Licensors.LICENSOR_SIKIDS){
_local4 = "http://www.sikids.com/sikscores";
_local4 = (_local4 + "?");
_local5 = "";
_local5 = ("sid=" + Licensors.sikids_sid);
_local4 = (_local4 + _local5);
_local4 = (_local4 + "&");
_local5 = ("nid=" + Licensors.sikids_nid);
_local4 = (_local4 + _local5);
_local4 = (_local4 + "&");
_local5 = "kid=1";
_local4 = (_local4 + _local5);
_local4 = (_local4 + "&");
_local6 = s.toString();
_local5 = "k=";
_local5 = (_local5 + _local6.charAt(0));
_local7 = _local6.charAt(0);
_local8 = _local6.charAt((_local6.length - 1));
_local9 = (int(_local7) + int(_local8));
_local5 = (_local5 + _local9.toString());
_local4 = (_local4 + _local5);
_local4 = (_local4 + "&");
_local5 = ("s=" + s.toString());
_local4 = (_local4 + _local5);
trace(("SIKIDS URL: " + _local4));
_local10 = new URLRequest(_local4);
navigateToURL(_local10, "_blank");
callback();
};
}
}
}//package
Section 142
//introscreensholder (introscreensholder)
package {
import flash.display.*;
public dynamic class introscreensholder extends MovieClip {
public var shell:MovieClip;
public var foreground:MovieClip;
public var buttonHolder:MovieClip;
public function introscreensholder(){
addFrameScript(38, frame39, 78, frame79, 118, frame119, 159, frame160);
}
function frame79(){
stop();
TitleScreenState.CarStep2_Complete();
}
function frame160(){
stop();
TitleScreenState.CarStep3_Complete();
}
function frame39(){
stop();
TitleScreenState.CarStep1_Complete();
}
function frame119(){
stop();
TitleScreenState.CarStep3_Complete();
}
}
}//package
Section 143
//KeyReader (KeyReader)
package {
import flash.events.*;
import flash.display.*;
public class KeyReader {
static const KEY_LEFT = 37;
static const KEY_HASH = 222;
static const KEY_LEFTSQUAREBRACKET = 219;
static const KEY_0 = 58;
static const KEY_1 = 49;
static const KEY_2 = 50;
static const KEY_3 = 51;
static const KEY_4 = 52;
static const KEY_5 = 53;
static const KEY_7 = 55;
static const KEY_8 = 56;
static const KEY_9 = 57;
static const KEY_6 = 54;
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_L = 76;
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_S = 83;
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_RIGHTSQUAREBRACKET = 221;
static const KEY_Z = 90;
static const KEY_SHIFT = 16;
static const KEY_CONTROL = 17;
static const KEY_SEMICOLON = 186;
static const KEY_NUM_0 = 96;
static const KEY_NUM_2 = 98;
static const KEY_UP = 38;
static const KEY_NUM_6 = 102;
static const KEY_NUM_1 = 97;
static const KEY_NUM_3 = 99;
static const KEY_DOWN = 40;
static const KEY_NUM_5 = 101;
static const KEY_NUM_7 = 103;
static const KEY_NUM_9 = 105;
static const KEY_NUM_4 = 100;
static const KEY_NUM_8 = 104;
static const KEY_TOPLEFT = 223;
static const KEY_BACKSLASH = 220;
static const KEY_FORWARDSLASH = 191;
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 = _arg1.keyCode;
keysDown[_local2] = 0;
}
static function keyDownListener(_arg1:KeyboardEvent):void{
var _local2:int = _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 Down(_arg1:int):Boolean{
return (!((keysDown[_arg1] == 0)));
}
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 144
//Level (Level)
package {
public class Level {
var surfaceFrame:uint;
var lastTimeTotal:int;
var instances:Array;
var available:Boolean;
var lastTime:int;
var name:String;
var surfaceThickness:int;
var bestTime:int;
var exclusiveChar:int;
var goldTime:int;
var eventWinParam:Number;
var silverTime:int;
var fillFrame:int;
var eventOpponentsString:String;
var helpscreenFrames:Array;
var eventType:String;
var complete:Boolean;
var bestTimeTotal:int;
var category:int;
var lines:Array;
public function Level(){
name = "";
instances = new Array();
helpscreenFrames = new Array();
lines = new Array();
category = 0;
fillFrame = 1;
surfaceFrame = 5;
surfaceThickness = 10;
available = false;
complete = false;
eventType = "none";
eventOpponentsString = "";
eventWinParam = 1;
exclusiveChar = 1;
lastTime = 9999999;
lastTimeTotal = 9999999;
bestTime = 9999999;
bestTimeTotal = 9999999;
goldTime = (10 * Defs.fps);
silverTime = (20 * Defs.fps);
}
public function Calculate(){
}
}
}//package
Section 145
//Level01_Overlays (Level01_Overlays)
package {
import flash.display.*;
public dynamic class Level01_Overlays extends MovieClip {
}
}//package
Section 146
//Level02_Overlays (Level02_Overlays)
package {
import flash.display.*;
public dynamic class Level02_Overlays extends MovieClip {
}
}//package
Section 147
//LevelEndScreen (LevelEndScreen)
package {
import flash.display.*;
import flash.text.*;
public dynamic class LevelEndScreen extends MovieClip {
public var info1:TextField;
public var info2:TextField;
public var buttonNext:SimpleButton;
public var info3:TextField;
public var info5:TextField;
public var buttonAchievements:SimpleButton;
public var info0:TextField;
public var info4:TextField;
}
}//package
Section 148
//Licensors (Licensors)
package {
import flash.display.*;
public class Licensors {
public static const LICENSOR_BIGFISH = 6;
public static const LICENSOR_NOBRANDING = 12;
public static const LICENSOR_ANDKON = 5;
public static const LICENSOR_GAMENINJA = 17;
public static const LICENSOR_KONGREGATE = 1;
public static const LICENSOR_MINDJOLT = 4;
public static const LICENSOR_ARMORGAMES = 8;
public static const LICENSOR_MINIJUEGOS = 15;
public static const LICENSOR_WEBBLIWORLD_VIRAL = 19;
public static const LICENSOR_WEBBLIWORLD_LOCKED = 18;
public static const LICENSOR_SHOCKWAVE = 11;
public static const LICENSOR_KING = 10;
public static const LICENSOR_KIBA = 13;
public static const LICENSOR_DOOF = 3;
public static const LICENSOR_MINICLIP = 2;
public static const LICENSOR_MOUSEBREAKER = 16;
public static const LICENSOR_BUBBLEBOX = 7;
public static const LICENSOR_GAMEZHERO = 9;
public static const LICENSOR_NONE = 0;
public static const LICENSOR_SIKIDS = 14;
public static var sikids_nid:String;
static var licensor:int = 19;
public static var sikids_sid:String;
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(_arg1:Main):void{
var _local3:Object;
var _local2:String = Domain.GetDomain(Main.theStage);
if (licensor == LICENSOR_SIKIDS){
_local3 = LoaderInfo(_arg1.root.loaderInfo).parameters;
sikids_sid = _local3.sid;
sikids_nid = _local3.nid;
};
if ((((licensor == LICENSOR_KONGREGATE)) && ((_local2 == "addictinggames.com")))){
licensor = LICENSOR_NOBRANDING;
};
if ((((licensor == LICENSOR_KONGREGATE)) && ((_local2 == "kaisergames.de")))){
licensor = LICENSOR_KIBA;
};
}
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 149
//Line (Line)
package {
import flash.geom.*;
public class Line {
public var udx:Number;
public var udy:Number;
public var ny:Number;
public var dir:Number;
public var nx: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 150
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import org.flashdevelop.utils.*;
import flash.net.*;
import flash.ui.*;
public class Main extends MovieClip {
var levelTimerMax:Number;
public var tf_scorespr:TextFormat;
public var mochiScores;
var cheatMode:Boolean;
var preparingCarsMC:MovieClip;
var levelTimer:Number;
public var tf_scorespr2:TextFormat;
public var fillScreenMC:MovieClip;
public var tf_scorespr1:TextFormat;
public var screenBD:BitmapData;
var ftime:Number;
var gameState:int;// = 0
var timer:Timer;
public var backgroundMC:MovieClip;
var scrollY:Number;// = 0
public var screenB:Bitmap;
var currentTime:Number;// = 0
var secondCounter:Number;// = 0
public var fps:Number;
public var tf_scoresprblack:TextFormat;
public var minimapScreenBD:BitmapData;
var framecounter:int;// = 0
static const gameState_HIGHSCORES = 5;
static const gameState_LOCKED = 6;
static const gameState_LEVEL_PLAY = 2;
static const gameState_TITLE = 0;
public static var theStage:Stage;
static var theRoot:MovieClip;
public function Main(){
if (stage){
init();
} else {
addEventListener(Event.ADDED_TO_STAGE, init);
};
}
function SetEverythingUpOnce2ABC():void{
ClearStage();
preparingCarsMC = new PreparingCars();
preparingCarsMC.addEventListener(Event.ADDED_TO_STAGE, SetEverythingUpOnce_12345);
preparingCarsMC.gotoAndStop(1);
stage.addChild(preparingCarsMC);
stage.invalidate();
}
function calcFrameTime(){
var _local1:Number = 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 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_LOCKED:
break;
case gameState_LEVEL_PLAY:
RunLevel();
break;
};
}
private function CreateTextField(_arg1:TextFormat, _arg2:Number, _arg3:Number, _arg4:String):TextField{
var _local5:TextField = 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 init(_arg1:Event){
removeEventListener(Event.ADDED_TO_STAGE, init);
theRoot = this;
theStage = this.root.stage;
FlashConnect.trace("Main start");
SetEverythingUpOnce();
}
function InitStageNoBackground(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
}
function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
addChild(_arg3);
return (_arg3);
}
function addedToStage(_arg1:Event){
SetEverythingUpOnce2();
}
function SetGameState(_arg1:int):void{
gameState = _arg1;
switch (gameState){
case gameState_TITLE:
Mouse.show();
TitleScreenState.Init(this);
break;
case gameState_HIGHSCORES:
break;
case gameState_LEVEL_PLAY:
InitLevel();
break;
case gameState_LOCKED:
InitLocked();
break;
};
}
function InitDrawScreen():void{
screenBD = new BitmapData(Defs.displayarea_w, Defs.displayarea_h, true, 0);
screenB = new Bitmap(screenBD);
minimapScreenBD = new BitmapData(140, 160, true, 0);
fillScreenMC = new MovieClip();
fillScreenMC.x = 0;
fillScreenMC.y = 0;
}
function SetEverythingUpOnce3():void{
trace("HERE1");
MusicPlayer.InitOnce();
KeyReader.InitOnce(theStage);
MouseControl.InitOnce(theStage);
SoundPlayer.InitOnce(this);
PauseMenu.InitOnce(this);
Particles.InitOnce(this, 1);
GameObjects.InitOnce(this, 300);
InitDrawScreen();
Stats.InitOnce();
if (Licensors.GetLicensor() == Licensors.LICENSOR_WEBBLIWORLD_VIRAL){
MochiBot.track(this, "aadd4bd7");
};
FlashConnect.trace("everything 3");
stage.removeChild(preparingCarsMC);
preparingCarsMC = null;
ExternalData.Load(SetEverythingUpOnce4);
}
function SetEverythingUpOnce4(){
Game.achievements = new Achievements();
Game.achievements.InitOnce();
InitStage();
Game.Init(this);
addEventListener(Event.ENTER_FRAME, run);
SetGameState(gameState_TITLE);
}
function RunTitle(){
}
function InitStage(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
addChild(screenB);
screenB.x = 0;
screenB.y = 0;
}
function SetEverythingUpOnce2():void{
Game.main = this;
WWorld.InitWWApi(this, SetEverythingUpOnce2ABC);
}
function SetEverythingUpOnce():void{
FlashConnect.trace(("stage " + stage));
if (stage == null){
FlashConnect.trace("stage A");
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
} else {
FlashConnect.trace("stage B");
SetEverythingUpOnce2();
};
}
function InitFonts():void{
var _local1:Font = 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 = 12;
tf_scorespr.color = 4294967295;
tf_scorespr1.font = _local1.fontName;
tf_scorespr1.size = 20;
tf_scorespr1.color = 4294967295;
tf_scorespr2.font = _local1.fontName;
tf_scorespr2.size = 20;
tf_scorespr2.color = 0;
tf_scoresprblack.font = _local1.fontName;
tf_scoresprblack.size = 12;
tf_scoresprblack.color = 0;
}
function Render(){
this.x = 0;
this.y = 0;
Game.Render();
}
function SetEverythingUpOnce_12345(_arg1:Event){
timer = new Timer(100, 0);
timer.start();
timer.addEventListener(TimerEvent.TIMER, SetEverythingUpOnce_6789);
}
function SetEverythingUpOnce2A():void{
InitFonts();
GraphicObjects.InitOnce(this, SetEverythingUpOnce3);
trace("HERE");
}
function InitLevel(){
InitStageForGame();
Particles.Reset();
MouseControl.Reset();
Particles.Reset();
GameObjects.ClearAll();
Game.InitLevel();
}
function InitStageForGame(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
addChild(screenB);
screenB.x = 0;
screenB.y = 0;
}
function SetEverythingUpOnce_6789(_arg1:Event){
timer.removeEventListener(TimerEvent.TIMER, SetEverythingUpOnce_6789);
timer = null;
SetEverythingUpOnce2A();
}
function ClearStage(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
FlashConnect.trace(("num children " + numChildren));
}
function RunLevel(){
if (PauseMenu.IsPaused() == false){
Game.UpdateGameplay();
};
Render();
}
function InitLocked():void{
ClearStage();
var _local1:MovieClip = new CantPlayScreen();
addChild(_local1);
_local1.addEventListener(MouseEvent.CLICK, TitleScreenState.buttonWebbliworldClicked);
}
}
}//package
Section 151
//MiniMaps (MiniMaps)
package {
import flash.display.*;
public dynamic class MiniMaps extends MovieClip {
}
}//package
Section 152
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var _local3:MochiBot = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var _local4 = "http://core.mochibot.com/my/core.swf";
var _local5:URLVariables = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
var _local6:String = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
var _local7:URLRequest = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
var _local8:Loader = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 153
//MouseControl (MouseControl)
package {
import flash.events.*;
import flash.display.*;
public class MouseControl {
public static var buttonReleased:Boolean = false;
public static var buttonPressed:Boolean = false;
public static var wheelFunction:Function = null;
public static var mouseVelX:Number = 0;
public static var mouseVelY:Number = 0;
public static var ox:Number = 0;
public static var oy:Number = 0;
public static var x:Number = 0;
public static var y:Number = 0;
public static var delta:int = 0;
public static function MouseHandler(_arg1:MouseEvent):void{
x = _arg1.stageX;
y = _arg1.stageY;
mouseVelX = (x - ox);
mouseVelY = (y - oy);
ox = x;
oy = y;
}
public static function MouseClickHandler(_arg1:MouseEvent):void{
buttonPressed = true;
buttonReleased = false;
}
public static function SetWheelHandler(_arg1:Function){
wheelFunction = _arg1;
}
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);
wheelFunction = null;
}
public static function MouseWheelHandler(_arg1:MouseEvent):void{
delta = _arg1.delta;
if (wheelFunction != null){
wheelFunction(delta);
};
}
public static function Reset():void{
buttonPressed = false;
buttonReleased = false;
}
public static function MouseUpHandler(_arg1:MouseEvent):void{
buttonPressed = false;
buttonReleased = true;
}
}
}//package
Section 154
//mushroom_clip (mushroom_clip)
package {
import flash.display.*;
public dynamic class mushroom_clip extends MovieClip {
}
}//package
Section 155
//MusicPlayer (MusicPlayer)
package {
import flash.media.*;
import flash.utils.*;
public class MusicPlayer {
static var musicSound1:Sound;
static var volumeMod:Number = 1;
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 _local3:Class;
var _local2 = "";
if (_arg1 == 0){
_local2 = "tune_0";
};
if (_arg1 == 1){
_local2 = "tune_1";
};
if (_arg1 == 2){
_local2 = "tune_2";
};
if (_arg1 == 3){
_local2 = "tune_3";
};
if (_arg1 == 4){
_local2 = "tune_menu";
};
_local3 = (getDefinitionByName(_local2) as Class);
var _local4:Sound = (new (_local3) as Sound);
var _local5:SoundTransform = new SoundTransform(0);
streamChannels.push(_local4.play(0, 999999, _local5));
streamChannelFlags.push(int(0));
streamChannelVolumes.push(Number(0));
}
public static function UpdateOncePerFrame(){
var _local3:SoundTransform;
var _local4:int;
var _local5:SoundChannel;
var _local6:int;
var _local7:Number;
var _local8:*;
var _local9:*;
var _local10:*;
var _local1:Number = 0.02;
var _local2:Boolean;
_local4 = 0;
while (_local4 < streamChannels.length) {
_local5 = streamChannels[_local4];
_local6 = streamChannelFlags[_local4];
_local7 = streamChannelVolumes[_local4];
if (_local6 == 0){
_local3 = _local5.soundTransform;
_local7 = (_local7 + _local1);
if (_local7 >= 1){
_local7 = 1;
_local6 = 1;
};
_local3.volume = (_local7 * volumeMod);
_local5.soundTransform = _local3;
} else {
if (_local6 == 1){
_local3 = _local5.soundTransform;
_local3.volume = (_local7 * volumeMod);
_local5.soundTransform = _local3;
} else {
if (_local6 == 2){
_local3 = _local5.soundTransform;
_local7 = (_local7 - _local1);
if (_local7 <= 0){
_local5.stop();
_local6 = 3;
_local2 = true;
};
_local3.volume = (_local7 * volumeMod);
_local5.soundTransform = _local3;
} else {
if (_local6 == 3){
};
};
};
};
streamChannelFlags[_local4] = _local6;
streamChannels[_local4] = _local5;
streamChannelVolumes[_local4] = _local7;
if (!doMusic){
_local3 = _local5.soundTransform;
_local3.volume = 0;
_local5.soundTransform = _local3;
};
_local4++;
};
if (_local2){
_local8 = new Array();
_local9 = new Array();
_local10 = new Array();
_local4 = 0;
while (_local4 < streamChannels.length) {
_local5 = streamChannels[_local4];
_local6 = streamChannelFlags[_local4];
_local7 = streamChannelVolumes[_local4];
if (_local6 != 3){
_local8.push(_local6);
_local9.push(_local5);
_local10.push(_local7);
};
_local4++;
};
streamChannelFlags = _local8;
streamChannels = _local9;
streamChannelVolumes = _local10;
};
if (!doMusic){
if (musicChannel != null){
_local3 = musicChannel.soundTransform;
_local3.volume = 0;
musicChannel.soundTransform = _local3;
};
} else {
if (musicChannel != null){
_local3 = musicChannel.soundTransform;
_local3.volume = 1;
musicChannel.soundTransform = _local3;
};
};
}
}
}//package
Section 156
//MyTest (MyTest)
package {
import flash.display.*;
public dynamic class MyTest extends MovieClip {
}
}//package
Section 157
//ObjectDef (ObjectDef)
package {
import flash.geom.*;
public class ObjectDef {
var type:int;
var animNames:Array;
var animIDs:Array;
var exportName:String;
var particleExplodeID:int;
var initFuncName:String;
var maxHealth:Number;
var colRects:Array;
var pathAnimType:int;
var collisionCircleRadii:Array;
var shieldColRects:Array;
var shotControllers:Array;
var collisionCircleOffsets:Array;
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 _local3:int;
var _local2:int = 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 = new ShotController();
_local5.Set(_arg1, _arg2, _arg3, _arg4);
shotControllers.push(_local5);
}
public function DoesAnimIDExist(_arg1:String):Boolean{
var _local3:int;
var _local2:int = 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 158
//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 = 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 159
//Panel (Panel)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Panel extends MovieClip {
public var textLap:TextField;
public var textPosition:TextField;
public var cursorkeys:MovieClip;
public var textInfo:TextField;
public var textScore:TextField;
public var buttonHolder:MovieClip;
}
}//package
Section 160
//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 angle:Number;
var startx:Number;
var starty:Number;
var xpos:Number;
var alpha:Number;
var color:uint;
var alphaAdd:Number;
var frame:Number;
var frameVel:Number;
var visible:Boolean;
var counter:int;
function PlayAnimation():Boolean{
frame = (frame + frameVel);
if (frame >= maxframe){
frame = maxframe;
return (true);
};
return (false);
}
function UpdateVelsTimer(){
xpos = (xpos + xvel);
ypos = (ypos + yvel);
timer--;
if (timer <= 0){
active = 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 = Utils.RandCircle();
var _local2:Number = Utils.RandBetweenFloat(3, 5);
xvel = (Math.cos(_local1) * _local2);
yvel = (Math.sin(_local1) * _local2);
frame = 0;
updateFunction = UpdateWater;
mode = 0;
color = 4278190335;
timer = 10;
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 = (Utils.RandBetweenFloat(-1, 1) - (Math.PI * 0.5));
var _local2:Number = 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 161
//Particles (Particles)
package {
import flash.display.*;
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 = 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;
_local5.angle = 0;
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 _local2:int;
var _local1:int;
_local2 = 0;
while (_local2 < max) {
if (list[_local2].active){
_local1++;
};
_local2++;
};
return (_local1);
}
public static function Render(_arg1:Main){
var _local8:int;
var _local9:int;
var _local11:Particle;
var _local12:Number;
var _local13:Number;
var _local2:Number = (0 - 16);
var _local3:Number = (Defs.displayarea_w + 16);
var _local4:Number = (0 - 16);
var _local5:Number = (Defs.displayarea_h + 16);
var _local6:Number = Game.scrollX;
var _local7:Number = Game.scrollY;
var _local10:BitmapData = Game.main.screenBD;
_local8 = 0;
while (_local8 < max) {
_local11 = list[_local8];
if (((_local11.active) && (_local11.visible))){
_local12 = (_local11.xpos - _local6);
_local13 = (_local11.ypos - _local7);
if (_local11.angle == 0){
GraphicObjects.RenderAt(_local11.graphicID, int(_local11.frame), _local10, _local12, _local13);
} else {
GraphicObjects.RenderAtRotScaled(_local11.graphicID, int(_local11.frame), _local10, _local12, _local13, false, 1, _local11.angle);
};
};
_local8++;
};
}
}
}//package
Section 162
//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 pressed_buttonRestartLevel(_arg1:MouseEvent){
Unpause();
Game.StartLevelPlay();
}
public static function pressed_buttonMusic(_arg1:MouseEvent){
MusicPlayer.ToggleMute();
SetTicks();
}
public static function IsPaused():Boolean{
return (active);
}
public static function pressed_buttonContinue(_arg1:MouseEvent){
Unpause();
}
public static function pressed_buttonHelp(_arg1:MouseEvent){
}
public static function InitOnce(_arg1:Main):void{
main = _arg1;
active = false;
}
static function SetTicks(){
if (SoundPlayer.doSFX){
pauseMC.tickSFX.gotoAndStop(1);
} else {
pauseMC.tickSFX.gotoAndStop(2);
};
if (MusicPlayer.doMusic){
pauseMC.tickMusic.gotoAndStop(1);
} else {
pauseMC.tickMusic.gotoAndStop(2);
};
}
public static function Unpause():void{
Mouse.hide();
active = false;
main.removeChild(pauseMC);
pauseMC = null;
KeyReader.InitOnce(Game.main.stage);
}
public static function pressed_buttonSFX(_arg1:MouseEvent){
SoundPlayer.ToggleMute();
SetTicks();
}
public static function Pause():void{
Mouse.show();
main.addChild(pauseMC);
pauseMC.buttonSFX.addEventListener(MouseEvent.CLICK, pressed_buttonSFX);
pauseMC.buttonMusic.addEventListener(MouseEvent.CLICK, pressed_buttonMusic);
pauseMC.buttonQuit.addEventListener(MouseEvent.CLICK, pressed_buttonQuit);
pauseMC.buttonRestartLevel.addEventListener(MouseEvent.CLICK, pressed_buttonRestartLevel);
pauseMC.buttonContinue.addEventListener(MouseEvent.CLICK, pressed_buttonContinue);
pauseMC.buttonHelp.addEventListener(MouseEvent.CLICK, pressed_buttonHelp);
pauseMC.buttonHints.addEventListener(MouseEvent.CLICK, pressed_buttonHelp);
pauseMC.buttonHelp.visible = false;
pauseMC.buttonHints.visible = false;
active = true;
SetTicks();
}
public static function pressed_buttonQuit(_arg1:MouseEvent){
Unpause();
Game.main.SetGameState(Main.gameState_TITLE);
}
static function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
main.addChild(_arg3);
return (_arg3);
}
}
}//package
Section 163
//PhysEditor (PhysEditor)
package {
import flash.display.*;
import flash.geom.*;
import flash.ui.*;
public class PhysEditor {
static const editMode_Library:int = 1;
static const editMode_PickPiece:int = 7;
static const editMode_GridCommands:int = 8;
static const editMode_Eraser:int = 2;
static const editMode_Adjust:int = 5;
static const editMode_Commands1:int = 4;
static const editMode_Normal:int = 0;
static const editMode_Commands:int = 3;
static const editMode_Lines:int = 6;
static var boxNumW:Number = 5;
static var updateTimer:int = 0;
static var renderMiniMap:Boolean = true;
static var gridsnap:int = 8;
static var prevEditMode:int = 0;
static var scrollX:Number = 0;
static var scrollY:Number = 0;
static var boxSizeH:Number = (Defs.displayarea_h / boxNumH);
static var guideLines:Array;
static var boxSizeW:Number = (Defs.displayarea_w / boxNumW);
static var currentPointIndex:int;
static var editor_currentPiece:int = 0;
static var currentLevel:int = 0;
static var library_page:int = 0;
static var renderObjects:Boolean = true;
static var currentLineIndex:int;
public static var currentAdjustObject:PhysObj_Instance;
static var editMode:int = 0;
static var editor_currentPieceRot:Number = 0;
static var boxNumH:Number = 4;
static var gridMode_active:Boolean = false;
static function Editor_GetNearbyGuidelines(_arg1:PhysObj_Instance, _arg2:Number, _arg3:Number, _arg4:Number=50){
var _local6:PhysObj_Body;
var _local7:PhysObj_Shape;
var _local8:Point;
var _local9:Point;
var _local13:PhysObj_Instance;
var _local14:PhysObj;
var _local15:Point;
var _local16:Point;
var _local17:PhysObj;
var _local18:Point;
var _local19:Number;
var _local20:Number;
var _local21:Boolean;
var _local22:PhysEd_GuideLine;
var _local5:Number = 3;
var _local10:Array = GetCurrentLevelInstances();
var _local11:Matrix = new Matrix();
var _local12:Array = new Array();
if (_arg1 != null){
_local14 = Game.physObjs.FindByName(_arg1.typeName);
if (_local14 != null){
for each (_local6 in _local14.bodies) {
for each (_local7 in _local6.shapes) {
if (_local7.type == PhysObj_Shape.Type_Poly){
for each (_local8 in _local7.poly_points) {
_local11.identity();
_local11.rotate(Utils.DegToRad(_arg1.rot));
_local15 = new Point(_local8.x, _local8.y);
_local15 = _local11.transformPoint(_local15);
_local16 = new Point(((_local15.x + _arg1.x) + _local6.pos.x), ((_local15.y + _arg1.y) + _local6.pos.y));
_local12.push(_local16);
};
};
};
};
};
} else {
_local12.push(new Point(_arg2, _arg3));
};
guideLines = new Array();
for each (_local13 in _local10) {
if (_local13 != _arg1){
_local17 = Game.physObjs.FindByName(_local13.typeName);
if (_local17 != null){
for each (_local6 in _local17.bodies) {
for each (_local7 in _local6.shapes) {
if (_local7.type == PhysObj_Shape.Type_Poly){
for each (_local8 in _local7.poly_points) {
_local11.identity();
_local11.rotate(Utils.DegToRad(_local13.rot));
_local15 = new Point(_local8.x, _local8.y);
_local15 = _local11.transformPoint(_local15);
_local18 = new Point(((_local15.x + _local13.x) + _local6.pos.x), ((_local15.y + _local13.y) + _local6.pos.y));
for each (_local9 in _local12) {
_local19 = Math.abs((_local18.x - _local9.x));
_local20 = Math.abs((_local18.y - _local9.y));
_local21 = false;
if ((((_local20 < _local5)) && ((_local19 < _arg4)))){
_local21 = false;
if (Math.floor(_local18.y) == Math.floor(_local9.y)){
_local21 = true;
};
_local22 = new PhysEd_GuideLine((_local18.x - 100), (_local18.x + 100), _local18.y, 0, _local21);
guideLines.push(_local22);
};
if ((((_local19 < _local5)) && ((_local20 < _arg4)))){
_local21 = false;
if (Math.floor(_local18.x) == Math.floor(_local9.x)){
_local21 = true;
};
_local22 = new PhysEd_GuideLine((_local18.y - 100), (_local18.y + 100), _local18.x, 1, _local21);
guideLines.push(_local22);
};
};
};
};
};
};
};
};
};
}
static function SetCurrentLevelInstances(_arg1:Array):void{
Game.levels[currentLevel].instances = _arg1;
}
public static function Editor_NextLevel():void{
currentLevel++;
if (currentLevel > (Game.levels.length - 1)){
currentLevel = (Game.levels.length - 1);
};
currentLineIndex = -1;
currentPointIndex = -1;
}
static function Lines_ScrollToLastPointOfSelectedLine(){
if (currentLineIndex == -1){
return;
};
var _local1:Level = GetCurrentLevel();
var _local2:Array = _local1.lines[currentLineIndex].points;
var _local3:Point = _local2[(_local2.length - 1)];
scrollX = (_local3.x - (Defs.displayarea_w * 0.5));
scrollY = (_local3.y - (Defs.displayarea_h * 0.5));
}
static function UpdateScroll(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
if (KeyReader.Down(KeyReader.KEY_SHIFT) == false){
_local1 = 50;
_local2 = 0;
_local3 = 0;
if (KeyReader.Down(KeyReader.KEY_CONTROL)){
_local1 = (_local1 * 0.2);
};
if (KeyReader.Down(KeyReader.KEY_LEFT)){
_local2 = -(_local1);
};
if (KeyReader.Down(KeyReader.KEY_RIGHT)){
_local2 = _local1;
};
if (KeyReader.Down(KeyReader.KEY_UP)){
_local3 = -(_local1);
};
if (KeyReader.Down(KeyReader.KEY_DOWN)){
_local3 = _local1;
};
scrollX = (scrollX + _local2);
scrollY = (scrollY + _local3);
};
}
static function Lines_DeletePoint(_arg1:Number, _arg2:Number){
var _local7:PhysLine;
var _local8:int;
var _local9:Point;
var _local10:Array;
var _local11:Array;
var _local12:int;
var _local13:Array;
var _local3:Level = GetCurrentLevel();
var _local4:int;
var _local5 = -1;
var _local6 = -1;
for each (_local7 in _local3.lines) {
_local8 = 0;
for each (_local9 in _local7.points) {
if (Utils.DistBetweenPoints(_local9.x, _local9.y, _arg1, _arg2) < 3){
_local5 = _local4;
_local6 = _local8;
};
_local8++;
};
_local4++;
};
if (((!((_local5 == -1))) && (!((_local6 == -1))))){
_local10 = _local3.lines[_local5].points;
_local11 = new Array();
_local12 = 0;
while (_local12 < _local10.length) {
if (_local12 != _local6){
_local11.push(_local10[_local12].clone());
};
_local12++;
};
_local3.lines[_local5].points = _local11;
_local13 = new Array();
for each (_local7 in _local3.lines) {
if (_local7.points.length != 0){
_local13.push(_local7.Clone());
} else {
currentLineIndex = -1;
};
};
_local3.lines = _local13;
currentPointIndex = -1;
};
}
static function Editor_RenderNearbyGuidelines(){
var _local2:PhysEd_GuideLine;
var _local3:uint;
var _local1:BitmapData = Game.main.screenBD;
for each (_local2 in guideLines) {
_local3 = 4294901760;
if (_local2.level){
_local3 = 4278255615;
};
Utils.RenderDotLine(_local1, (_local2.x0 - scrollX), (_local2.y0 - scrollY), (_local2.x1 - scrollX), (_local2.y1 - scrollY), 100, _local3);
};
}
static function CountLibraryPieces():int{
var _local2:PhysObj;
var _local1:int;
for each (_local2 in Game.physObjs.list) {
if (_local2.displayInLibrary){
_local1++;
};
};
return (_local1);
}
static function Lines_NewLine(){
var _local1:PhysLine = new PhysLine();
var _local2:Level = GetCurrentLevel();
_local2.lines.push(_local1);
currentLineIndex = (_local2.lines.length - 1);
}
static function Editor_RenderLines(){
var _local4:PhysLine;
var _local5:uint;
var _local6:int;
var _local7:Point;
var _local8:Point;
var _local9:Rectangle;
var _local1:Level = GetCurrentLevel();
var _local2:BitmapData = Game.main.screenBD;
var _local3:int;
for each (_local4 in _local1.lines) {
_local5 = 4290822336;
if (_local3 == currentLineIndex){
_local5 = 4294967295;
};
if (_local4.points.length >= 2){
_local6 = 0;
while (_local6 < (_local4.points.length - 1)) {
_local7 = _local4.points[_local6].clone();
_local8 = _local4.points[(_local6 + 1)].clone();
Utils.RenderDotLine(_local2, (_local7.x - scrollX), (_local7.y - scrollY), (_local8.x - scrollX), (_local8.y - scrollY), 200, _local5);
_local6++;
};
};
_local6 = 0;
while (_local6 < _local4.points.length) {
_local5 = 4294901760;
if ((((_local3 == currentLineIndex)) && ((currentPointIndex == _local6)))){
_local5 = 4294967040;
};
_local9 = new Rectangle(((_local4.points[_local6].x - 2) - scrollX), ((_local4.points[_local6].y - 2) - scrollY), 4, 4);
Utils.RenderRectangle(_local2, _local9, _local5);
_local6++;
};
_local3++;
};
}
static function Lines_Subdivide(_arg1:Number, _arg2:Number){
var _local7:PhysLine;
var _local8:int;
var _local9:Point;
var _local10:int;
var _local11:int;
var _local12:Array;
var _local13:int;
var _local14:Array;
var _local15:Array;
var _local16:int;
var _local17:Point;
var _local18:Point;
var _local19:Point;
if ((((currentLineIndex == -1)) || ((currentPointIndex == -1)))){
return;
};
var _local3:Level = GetCurrentLevel();
var _local4:int;
var _local5 = -1;
var _local6 = -1;
for each (_local7 in _local3.lines) {
_local8 = 0;
for each (_local9 in _local7.points) {
if (Utils.DistBetweenPoints(_local9.x, _local9.y, _arg1, _arg2) < 3){
_local5 = _local4;
_local6 = _local8;
};
_local8++;
};
_local4++;
};
if (((!((_local5 == -1))) && (!((_local6 == -1))))){
if (_local6 == currentPointIndex){
return;
};
_local10 = currentPointIndex;
_local11 = _local6;
if (_local11 < _local10){
_local16 = _local10;
_local11 = _local10;
_local10 = _local16;
};
_local12 = new Array();
_local14 = _local3.lines[_local5].points;
_local13 = _local10;
while (_local13 < _local11) {
_local17 = _local14[_local13].clone();
_local18 = _local14[(_local13 + 1)].clone();
_local19 = new Point(((_local17.x + _local18.x) / 2), ((_local17.y + _local18.y) / 2));
_local12.push(_local19);
_local12.push(_local18);
_local13++;
};
_local15 = new Array();
_local13 = 0;
while (_local13 <= _local10) {
_local15.push(_local14[_local13].clone());
_local13++;
};
for each (_local19 in _local12) {
_local15.push(_local19.clone());
};
_local13 = (_local11 + 1);
while (_local13 < _local14.length) {
_local15.push(_local14[_local13].clone());
_local13++;
};
_local3.lines[_local5].points = _local15;
};
}
public static function Editor_ClearLevel():void{
var _local1:Array = new Array();
Game.levels[currentLevel].instances = _local1;
currentLineIndex = -1;
currentPointIndex = -1;
}
static function Editor_RenderObjects(){
var _local3:PhysObj_Instance;
var _local4:PhysObj;
var _local1:Array = GetCurrentLevelInstances();
var _local2:BitmapData = Game.main.screenBD;
for each (_local3 in _local1) {
_local4 = Game.physObjs.FindByName(_local3.typeName);
if (_local4 != null){
PhysObj.RenderAt(_local4, (_local3.x - scrollX), (_local3.y - scrollY), _local3.rot, _local2);
};
};
}
static function Lines_ScrollToFirstPointOfSelectedLine(){
if (currentLineIndex == -1){
return;
};
var _local1:Level = GetCurrentLevel();
var _local2:Array = _local1.lines[currentLineIndex].points;
var _local3:Point = _local2[0];
scrollX = (_local3.x - (Defs.displayarea_w * 0.5));
scrollY = (_local3.y - (Defs.displayarea_h * 0.5));
}
static function SnapToObjects(_arg1:Number, _arg2:Number):Point{
var _local3:PhysObj;
var _local9:PhysEd_GuideLine;
var _local10:Point;
_local3 = Game.physObjs.GetByIndex(editor_currentPiece);
if (_local3 == null){
return (null);
};
var _local4:PhysObj_Instance = Game.CreatePhysObjInstanceAt(_local3.name, _arg1, _arg2, editor_currentPieceRot, "");
Editor_GetNearbyGuidelines(null, _arg1, _arg2, 20);
trace(("guidelines: " + guideLines.length));
var _local5:BitmapData = Game.main.screenBD;
var _local6 = 99999999;
var _local7:Number = _local6;
var _local8:Number = _local6;
for each (_local9 in guideLines) {
if (_local9.type == 1){
if (Math.abs((_local9.x0 - _arg1)) < _local7){
_local7 = _local9.x0;
};
} else {
if (Math.abs((_local9.y0 - _arg2)) < _local8){
_local8 = _local9.y0;
};
};
};
if (((!((_local7 == _local6))) && (!((_local8 == _local6))))){
_local10 = new Point(_local7, _local8);
return (_local10);
};
return (null);
}
public static function ExportLevelAsXml(){
var _local4:int;
var _local5:Array;
var _local6:PhysObj_Instance;
var _local7:Point;
var _local8:PhysLine;
var _local9:int;
var _local10:int;
var _local11:Array;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:String;
var _local1:Level = GetCurrentLevel();
var _local2 = "";
var _local3 = "";
_local2 = (("<level name=\"" + _local1.name) + "\"");
_local2 = (_local2 + ((" category=\"" + _local1.category.toString()) + "\""));
_local2 = (_local2 + ((" fillframe=\"" + _local1.fillFrame.toString()) + "\""));
_local2 = (_local2 + ((" surfaceframe=\"" + _local1.surfaceFrame.toString()) + "\""));
_local2 = (_local2 + ((" surfacethickness=\"" + _local1.surfaceThickness.toString()) + "\""));
_local2 = (_local2 + ((" type=\"" + _local1.eventType.toString()) + "\""));
_local2 = (_local2 + ((" opponents=\"" + _local1.eventOpponentsString.toString()) + "\""));
_local2 = (_local2 + ((" win=\"" + _local1.eventWinParam.toString()) + "\""));
_local2 = (_local2 + ((" exclusivechar=\"" + _local1.exclusiveChar.toString()) + "\""));
_local2 = (_local2 + " >");
_local3 = (_local3 + (_local2 + "\n"));
trace(_local2);
_local2 = (((("<times gold=\"" + (_local1.goldTime / Defs.fps)) + "\" silver=\"") + (_local1.silverTime / Defs.fps)) + "\" />");
_local3 = (_local3 + (_local2 + "\n"));
trace(_local2);
for each (_local4 in _local1.helpscreenFrames) {
_local2 = (("<helpscreen frame=\"" + _local4) + "\" />");
_local3 = (_local3 + (_local2 + "\n"));
trace(_local2);
};
_local5 = GetCurrentLevelInstances();
for each (_local6 in _local5) {
_local2 = (((((((((("<obj type=\"" + _local6.typeName) + "\" x=\"") + _local6.x) + "\" y=\"") + _local6.y) + "\" rot=\"") + _local6.rot) + "\" params=\"") + _local6.initParams) + "\" />");
_local3 = (_local3 + (_local2 + "\n"));
trace(_local2);
};
for each (_local8 in _local1.lines) {
_local2 = (((((((("<line type=\"" + _local8.type) + "\" name=\"") + _local8.name) + "\" fill=\"") + _local8.fill) + "\" fillscale=\"") + _local8.fillScaleX) + "\">");
_local3 = (_local3 + (_local2 + "\n"));
trace(_local2);
_local11 = _local8.points;
_local12 = _local11.length;
_local13 = 10;
_local14 = (_local12 / _local13);
_local15 = (_local12 % _local13);
_local16 = 0;
_local9 = 0;
while (_local9 < _local14) {
_local17 = "<points a=\"";
_local10 = 0;
while (_local10 < _local13) {
var _temp1 = _local16;
_local16 = (_local16 + 1);
_local7 = _local11[_temp1];
_local17 = (_local17 + ((_local7.x + ",") + _local7.y));
if (_local10 != (_local13 - 1)){
_local17 = (_local17 + ", ");
};
_local10++;
};
_local17 = (_local17 + "\" />");
_local2 = _local17;
_local3 = (_local3 + (_local2 + "\n"));
trace(_local2);
_local9++;
};
if (_local15 != 0){
_local17 = "<points a=\"";
_local10 = 0;
while (_local10 < _local15) {
var _temp2 = _local16;
_local16 = (_local16 + 1);
_local7 = _local11[_temp2];
_local17 = (_local17 + ((_local7.x + ",") + _local7.y));
if (_local10 != (_local15 - 1)){
_local17 = (_local17 + ", ");
};
_local10++;
};
_local17 = (_local17 + "\" />");
_local2 = _local17;
_local3 = (_local3 + (_local2 + "\n"));
trace(_local2);
};
_local2 = "</line>";
_local3 = (_local3 + (_local2 + "\n"));
trace(_local2);
};
_local2 = "</level>";
_local3 = (_local3 + (_local2 + "\n"));
trace(_local2);
ExternalData.OutputString(_local3);
}
static function GetNumLibraryPages():int{
var _local1:int = (boxNumW * boxNumH);
var _local2:int = CountLibraryPieces();
var _local3:int = (_local2 / _local1);
var _local4:int = (_local2 % _local1);
if (_local4 != 0){
_local3++;
};
return (_local3);
}
static function RemoveFromLevelInstances(_arg1:PhysObj_Instance){
var _local4:PhysObj_Instance;
var _local2:Array = GetCurrentLevelInstances();
var _local3:Array = new Array();
for each (_local4 in _local2) {
if (_local4 == _arg1){
} else {
_local3.push(_local4);
};
};
_local2 = _local3;
Game.levels[currentLevel].instances = _local2;
}
static function Lines_SelectPoint(_arg1:Number, _arg2:Number){
var _local5:PhysLine;
var _local6:int;
var _local7:Point;
var _local3:Level = GetCurrentLevel();
var _local4:int;
currentLineIndex = -1;
currentPointIndex = -1;
for each (_local5 in _local3.lines) {
_local6 = 0;
for each (_local7 in _local5.points) {
if (Utils.DistBetweenPoints(_local7.x, _local7.y, _arg1, _arg2) < 3){
currentLineIndex = _local4;
currentPointIndex = _local6;
return;
};
_local6++;
};
_local4++;
};
}
public static function Editor_PreviousLevel():void{
currentLevel--;
if (currentLevel < 0){
currentLevel = 0;
};
currentLineIndex = -1;
currentPointIndex = -1;
}
static function RenderBackground(_arg1:BitmapData){
var _local2:int = GraphicObjects.GetIndexByName("BackgroundLevel01");
_local2 = (_local2 + Game.currentLevel);
GraphicObjects.RenderAt(_local2, 0, _arg1, -(scrollX), -(scrollY));
}
static function Library_PickPiece(){
var _local11:PhysObj;
var _local1:int = MouseControl.x;
var _local2:int = MouseControl.y;
var _local3:int = (_local1 / boxSizeW);
var _local4:int = (_local2 / boxSizeH);
var _local5:int = (_local3 + (_local4 * boxNumW));
var _local6:int = (boxNumW * boxNumH);
_local5 = (_local5 + (library_page * _local6));
var _local7:int = (Game.physObjs.GetNum() - 1);
if (_local5 > _local7){
_local5 = _local7;
};
var _local8:int;
var _local9:int;
var _local10:int;
for each (_local11 in Game.physObjs.list) {
if (_local8 == _local5){
_local10 = _local9;
};
if (_local11.displayInLibrary){
_local8++;
};
_local9++;
};
editor_currentPiece = _local10;
editor_currentPieceRot = 0;
}
static function Editor_RenderLineToCursor(){
var _local1:Level = GetCurrentLevel();
if (currentLineIndex == -1){
return;
};
var _local2:PhysLine = _local1.lines[currentLineIndex];
var _local3:int = MouseControl.x;
var _local4:int = MouseControl.y;
var _local5:int = (_local2.points.length - 1);
var _local6:Point = _local2.points[_local5].clone();
_local2.points[_local5].clone().x = (_local6.x - scrollX);
_local6.y = (_local6.y - scrollY);
var _local7:BitmapData = Game.main.screenBD;
Utils.RenderDotLine(_local7, _local3, _local4, _local6.x, _local6.y, 200, 4278255615);
}
static function Lines_SelectLine(_arg1:Number, _arg2:Number){
var _local5:PhysLine;
var _local6:Point;
var _local3:Level = GetCurrentLevel();
var _local4:int;
currentLineIndex = -1;
for each (_local5 in _local3.lines) {
for each (_local6 in _local5.points) {
if (Utils.DistBetweenPoints(_local6.x, _local6.y, _arg1, _arg2) < 3){
currentLineIndex = _local4;
return;
};
};
_local4++;
};
}
static function Lines_ChangeType(){
if (currentLineIndex == -1){
return;
};
var _local1:Level = GetCurrentLevel();
var _local2:PhysLine = _local1.lines[currentLineIndex];
_local2.type++;
_local2.type = (_local2.type % 8);
}
static function Lines_MovePoints(_arg1:Number, _arg2:Number){
var _local6:Number;
var _local7:Point;
if (currentLineIndex == -1){
return;
};
var _local3:Level = GetCurrentLevel();
var _local4:Array = _local3.lines[currentLineIndex].points;
var _local5:Number = 100;
for each (_local7 in _local4) {
_local6 = Utils.DistBetweenPoints(_local7.x, _local7.y, _arg1, _arg2);
if (_local6 < _local5){
_local6 = (_local5 - _local6);
_local6 = Utils.ScaleTo(0, 5, 0, _local5, _local6);
if (_local7.y < _arg2){
_local7.y = (_local7.y - _local6);
} else {
if (_local7.y > _arg2){
_local7.y = (_local7.y + _local6);
};
};
};
};
}
static function EditorWheelHandler(_arg1:int){
var _local2:int;
if (editMode == editMode_Normal){
if (_arg1 > 0){
IncCurrentPiece();
};
if (_arg1 < 0){
DecCurrentPiece();
};
};
if (editMode == editMode_Adjust){
if (currentAdjustObject != null){
if (_arg1 > 0){
_local2 = Game.physObjs.FindIndexByName(currentAdjustObject.typeName);
_local2++;
if (_local2 >= Game.physObjs.GetNum()){
_local2 = 0;
};
currentAdjustObject.typeName = Game.physObjs.GetByIndex(_local2).name;
};
if (_arg1 < 0){
_local2 = Game.physObjs.FindIndexByName(currentAdjustObject.typeName);
_local2--;
if (_local2 < 0){
_local2 = (Game.physObjs.GetNum() - 1);
};
currentAdjustObject.typeName = Game.physObjs.GetByIndex(_local2).name;
};
};
};
if (editMode == editMode_Library){
if (_arg1 > 0){
library_page++;
if (library_page >= GetNumLibraryPages()){
library_page = 0;
};
};
if (_arg1 < 0){
library_page--;
if (library_page < 0){
library_page = (GetNumLibraryPages() - 1);
};
};
};
}
static function GetCurrentLevelInstances():Array{
return (Game.levels[currentLevel].instances);
}
static function GenerateFloorTileGrid(){
var _local2:int;
var _local3:int;
var _local1:Array = GetCurrentLevelInstances();
_local2 = 0;
while (_local2 < 3000) {
_local3 = -2000;
while (_local3 < 2000) {
_local1.push(Game.CreatePhysObjInstanceAt("floortile01", _local2, _local3, 0, ""));
_local3 = (_local3 + 104);
};
_local2 = (_local2 + 160);
};
SetCurrentLevelInstances(_local1);
}
public static function UpdateEditor():void{
var _local7:PhysObj;
var _local9:PhysObj_Instance;
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:Point;
var _local19:String;
var _local20:Array;
var _local21:Number;
var _local22:Number;
var _local23:Point;
updateTimer++;
var _local1:int = MouseControl.x;
var _local2:int = MouseControl.y;
if (gridMode_active){
_local1 = Math.floor(_local1);
_local2 = Math.floor(_local2);
_local1 = (int((_local1 / gridsnap)) * int(gridsnap));
_local2 = (int((_local2 / gridsnap)) * int(gridsnap));
};
var _local3:Number = scrollX;
var _local4:Number = scrollY;
if (gridMode_active){
_local3 = Math.floor(_local3);
_local4 = Math.floor(_local4);
_local3 = (int((_local3 / gridsnap)) * int(gridsnap));
_local4 = (int((_local4 / gridsnap)) * int(gridsnap));
};
var _local5:int = (_local1 + _local3);
var _local6:int = (_local2 + _local4);
var _local8:Level = GetCurrentLevel();
if (editMode == editMode_Commands){
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_5)){
currentAdjustObject = null;
editMode = editMode_Adjust;
};
if (KeyReader.Pressed(KeyReader.KEY_6)){
editMode = editMode_Lines;
};
if (KeyReader.Pressed(KeyReader.KEY_7)){
editMode = editMode_PickPiece;
};
if (KeyReader.Pressed(KeyReader.KEY_SPACE)){
editMode = editMode_Commands1;
};
return;
};
if (editMode == editMode_Commands1){
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_9)){
Game.StartLevelPlay();
return;
};
if (KeyReader.Pressed(KeyReader.KEY_4)){
ExportLevelAsXml();
editMode = prevEditMode;
};
if (KeyReader.Pressed(KeyReader.KEY_5)){
ExportAllLevelsAsXml();
editMode = prevEditMode;
};
if (KeyReader.Pressed(KeyReader.KEY_SPACE)){
editMode = editMode_GridCommands;
};
if (KeyReader.Pressed(KeyReader.KEY_8)){
Editor_PreviousLevel();
};
if (KeyReader.Pressed(KeyReader.KEY_9)){
Editor_NextLevel();
};
return;
};
if (editMode == editMode_GridCommands){
if (KeyReader.Pressed(KeyReader.KEY_1)){
gridMode_active = (gridMode_active == false);
};
if (KeyReader.Pressed(KeyReader.KEY_9)){
GenerateFloorTileGrid();
};
if (KeyReader.Pressed(KeyReader.KEY_SPACE)){
editMode = prevEditMode;
};
return;
};
if (KeyReader.Pressed(KeyReader.KEY_X)){
renderMiniMap = (renderMiniMap == false);
};
if (KeyReader.Pressed(KeyReader.KEY_SPACE)){
prevEditMode = editMode;
editMode = editMode_Commands;
};
if (editMode == editMode_Library){
if (MouseControl.buttonPressed){
MouseControl.buttonPressed = false;
Library_PickPiece();
editMode = editMode_Normal;
};
if (KeyReader.Pressed(KeyReader.KEY_DOWN)){
library_page++;
if (library_page >= GetNumLibraryPages()){
library_page = 0;
};
};
if (KeyReader.Pressed(KeyReader.KEY_UP)){
library_page--;
if (library_page < 0){
library_page = (GetNumLibraryPages() - 1);
};
};
return;
};
if (editMode == editMode_PickPiece){
if (MouseControl.buttonPressed){
MouseControl.buttonPressed = false;
_local9 = HitTestPhysObjGraphics(_local1, _local2);
if (_local9){
editor_currentPiece = Game.physObjs.FindIndexByName(_local9.typeName);
editor_currentPieceRot = 0;
editMode = editMode_Normal;
};
};
UpdateScroll();
return;
};
if (editMode == editMode_Eraser){
if (MouseControl.buttonPressed){
MouseControl.buttonPressed = false;
_local9 = HitTestPhysObjGraphics(_local1, _local2);
if (_local9){
RemoveFromLevelInstances(_local9);
};
};
UpdateScroll();
return;
};
if (editMode == editMode_Adjust){
if (MouseControl.buttonPressed){
MouseControl.buttonPressed = false;
_local9 = HitTestPhysObjGraphics(_local1, _local2);
if (_local9){
currentAdjustObject = _local9;
} else {
currentAdjustObject = null;
};
};
if (currentAdjustObject != null){
_local10 = 1;
_local11 = 1;
_local12 = 0;
_local13 = 0;
_local14 = 0;
if (KeyReader.Down(KeyReader.KEY_CONTROL)){
_local10 = (_local10 * 10);
_local11 = (_local11 * 10);
};
if (KeyReader.Down(KeyReader.KEY_SHIFT)){
if (KeyReader.Down(KeyReader.KEY_LEFT)){
_local13 = -(_local10);
};
if (KeyReader.Down(KeyReader.KEY_RIGHT)){
_local13 = _local10;
};
if (KeyReader.Down(KeyReader.KEY_UP)){
_local14 = -(_local10);
};
if (KeyReader.Down(KeyReader.KEY_DOWN)){
_local14 = _local10;
};
currentAdjustObject.x = (currentAdjustObject.x + _local13);
currentAdjustObject.y = (currentAdjustObject.y + _local14);
};
if (KeyReader.Down(KeyReader.KEY_6)){
_local12 = -(_local11);
};
if (KeyReader.Down(KeyReader.KEY_7)){
_local12 = _local11;
};
currentAdjustObject.rot = (currentAdjustObject.rot + _local12);
};
UpdateScroll();
return;
};
if (editMode == editMode_Lines){
if (MouseControl.buttonPressed){
if (KeyReader.Down(KeyReader.KEY_7)){
Lines_MovePoints(_local5, _local6);
return;
};
MouseControl.buttonPressed = false;
if (KeyReader.Down(KeyReader.KEY_1)){
Lines_SelectLine(_local5, _local6);
return;
};
if (KeyReader.Down(KeyReader.KEY_2)){
Lines_DeletePoint(_local5, _local6);
return;
};
if (KeyReader.Down(KeyReader.KEY_3)){
Lines_InsertPoint(_local5, _local6);
return;
};
if (KeyReader.Down(KeyReader.KEY_4)){
Lines_SelectPoint(_local5, _local6);
return;
};
if (KeyReader.Down(KeyReader.KEY_5)){
Lines_NewLine();
};
if (KeyReader.Down(KeyReader.KEY_6)){
Lines_Subdivide(_local5, _local6);
return;
};
Lines_AddPoint(_local5, _local6);
};
if (KeyReader.Pressed(KeyReader.KEY_8)){
Lines_ChangeType();
return;
};
if (KeyReader.Pressed(KeyReader.KEY_LEFTSQUAREBRACKET)){
Lines_ScrollToFirstPointOfSelectedLine();
};
if (KeyReader.Pressed(KeyReader.KEY_RIGHTSQUAREBRACKET)){
Lines_ScrollToLastPointOfSelectedLine();
};
if (((!((currentLineIndex == -1))) && (!((currentPointIndex == -1))))){
_local15 = 1;
_local16 = 0;
_local17 = 0;
if (KeyReader.Down(KeyReader.KEY_CONTROL)){
_local15 = (_local15 * 10);
};
if (KeyReader.Down(KeyReader.KEY_SHIFT)){
if (KeyReader.Down(KeyReader.KEY_LEFT)){
_local16 = -(_local15);
};
if (KeyReader.Down(KeyReader.KEY_RIGHT)){
_local16 = _local15;
};
if (KeyReader.Down(KeyReader.KEY_UP)){
_local17 = -(_local15);
};
if (KeyReader.Down(KeyReader.KEY_DOWN)){
_local17 = _local15;
};
};
_local18 = _local8.lines[currentLineIndex].points[currentPointIndex];
_local8.lines[currentLineIndex].points[currentPointIndex].x = (_local18.x + _local16);
_local18.y = (_local18.y + _local17);
};
UpdateScroll();
return;
};
if (editMode == editMode_Normal){
if (KeyReader.Down(KeyReader.KEY_SHIFT) == true){
if (KeyReader.Pressed(KeyReader.KEY_UP)){
IncCurrentPiece();
};
if (KeyReader.Pressed(KeyReader.KEY_DOWN)){
DecCurrentPiece();
};
_local11 = 1;
if (KeyReader.Down(KeyReader.KEY_CONTROL) == false){
_local11 = (_local11 * 10);
};
if (KeyReader.Down(KeyReader.KEY_LEFT)){
editor_currentPieceRot = (editor_currentPieceRot - _local11);
};
if (KeyReader.Down(KeyReader.KEY_RIGHT)){
editor_currentPieceRot = (editor_currentPieceRot + _local11);
};
};
_local7 = Game.physObjs.GetByIndex(editor_currentPiece);
_local19 = _local7.name;
if (MouseControl.buttonPressed){
MouseControl.buttonPressed = false;
_local20 = GetCurrentLevelInstances();
_local21 = _local5;
_local22 = _local6;
if (KeyReader.Down(KeyReader.KEY_1)){
_local23 = SnapToObjects(_local5, _local6);
if (_local23 != null){
trace(((((((("snapped to point :" + _local5) + " ") + _local6) + " -> ") + _local23.x) + " ") + _local23.y));
_local21 = _local23.x;
_local22 = _local23.y;
};
};
_local20.push(Game.CreatePhysObjInstanceAt(_local19, _local21, _local22, editor_currentPieceRot, ""));
SetCurrentLevelInstances(_local20);
};
UpdateScroll();
};
}
public static function InitEditor():void{
Mouse.show();
Game.InitBox2D();
GameObjects.ClearAll();
updateTimer = 0;
editMode = editMode_Normal;
currentLineIndex = -1;
currentPointIndex = -1;
currentLevel = Game.currentLevel;
var _local1:Level = GetCurrentLevel();
currentLineIndex = (_local1.lines.length - 1);
MouseControl.SetWheelHandler(EditorWheelHandler);
}
static function RenderEditor(){
var _local1:int;
var _local2:int;
var _local3:Number;
var _local4:String;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:int;
var _local18:int;
var _local19:PhysObj;
var _local20:PhysObj;
var _local21:PhysObj_Instance;
var _local5:BitmapData = Game.main.screenBD;
var _local6:int = MouseControl.x;
var _local7:int = MouseControl.y;
if (gridMode_active){
_local6 = Math.floor(_local6);
_local7 = Math.floor(_local7);
_local6 = (int((_local6 / gridsnap)) * int(gridsnap));
_local7 = (int((_local7 / gridsnap)) * int(gridsnap));
};
var _local8:Number = scrollX;
var _local9:Number = scrollY;
if (gridMode_active){
_local8 = Math.floor(_local8);
_local9 = Math.floor(_local9);
_local8 = (int((_local8 / gridsnap)) * int(gridsnap));
_local9 = (int((_local9 / gridsnap)) * int(gridsnap));
};
var _local10:int = (_local6 + _local8);
var _local11:int = (_local7 + _local9);
if (editMode == editMode_Commands){
_local5.fillRect(Defs.screenRect, 4285542576);
};
if (editMode == editMode_Commands1){
_local5.fillRect(Defs.screenRect, 4285542592);
};
if (editMode == editMode_GridCommands){
_local5.fillRect(Defs.screenRect, 4285542592);
};
if (editMode == editMode_Library){
_local5.fillRect(Defs.screenRect, 4284498112);
_local12 = 0;
_local13 = 0;
_local12 = 0;
while (_local12 < Defs.displayarea_w) {
Utils.RenderDotLine(_local5, _local12, 0, _local12, 640, 100, 4282433600);
_local12 = (_local12 + boxSizeW);
};
_local12 = 0;
while (_local12 < Defs.displayarea_h) {
Utils.RenderDotLine(_local5, 0, _local12, 640, _local12, 100, 4282433600);
_local12 = (_local12 + boxSizeH);
};
_local14 = (boxNumW * boxNumH);
_local15 = (library_page * _local14);
_local16 = (_local15 + (_local14 - 1));
_local12 = 0;
_local13 = 0;
_local17 = Game.physObjs.GetNum();
_local18 = 0;
for each (_local19 in Game.physObjs.list) {
if (_local19.displayInLibrary){
if ((((_local18 >= _local15)) && ((_local18 <= _local16)))){
PhysObj.RenderAt(_local19, (_local12 + (boxSizeW / 2)), (_local13 + (boxSizeH / 2)), 0, _local5, true, 1, new Rectangle((_local12 + 8), (_local13 + 8), (boxSizeW - 16), (boxSizeH - 16)));
_local4 = _local19.name;
GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, (_local12 + 8), ((_local13 + boxSizeH) - 16), _local4, null);
_local12 = (_local12 + boxSizeW);
if (_local12 >= Defs.displayarea_w){
_local12 = 0;
_local13 = (_local13 + boxSizeH);
};
};
};
_local18++;
};
};
if (editMode == editMode_Eraser){
_local5.fillRect(Defs.screenRect, 4281549909);
RenderBackground(_local5);
if (renderObjects){
Editor_RenderObjects();
};
if (renderMiniMap){
Editor_RenderMiniMap();
};
Editor_RenderLines();
};
if (editMode == editMode_PickPiece){
_local5.fillRect(Defs.screenRect, 4281549909);
RenderBackground(_local5);
if (renderObjects){
Editor_RenderObjects();
};
if (renderMiniMap){
Editor_RenderMiniMap();
};
Editor_RenderLines();
};
if (editMode == editMode_Normal){
_local5.fillRect(Defs.screenRect, 4282668390);
RenderBackground(_local5);
if (renderObjects){
Editor_RenderObjects();
};
if (renderMiniMap){
Editor_RenderMiniMap();
};
Editor_RenderLines();
_local20 = Game.physObjs.GetByIndex(editor_currentPiece);
PhysObj.RenderAt(_local20, (_local10 - scrollX), (_local11 - scrollY), editor_currentPieceRot, _local5);
if (_local20 != null){
_local21 = Game.CreatePhysObjInstanceAt(_local20.name, _local10, _local11, editor_currentPieceRot, "");
Editor_GetNearbyGuidelines(_local21, 0, 0);
Editor_RenderNearbyGuidelines();
};
};
if (editMode == editMode_Adjust){
_local5.fillRect(Defs.screenRect, 4282668390);
RenderBackground(_local5);
if (renderObjects){
Editor_RenderObjects_AdjustMode();
};
if (renderMiniMap){
Editor_RenderMiniMap();
};
Editor_RenderLines();
if (currentAdjustObject != null){
Editor_GetNearbyGuidelines(currentAdjustObject, 0, 0);
Editor_RenderNearbyGuidelines();
};
};
if (editMode == editMode_Lines){
_local5.fillRect(Defs.screenRect, 4282668390);
RenderBackground(_local5);
if (renderObjects){
Editor_RenderObjects();
};
if (renderMiniMap){
Editor_RenderMiniMap();
};
Editor_RenderLines();
Editor_RenderLineToCursor();
};
RenderPanel_Editor();
}
static function Editor_RenderMiniMap(){
var _local4:PhysObj_Instance;
var _local5:PhysObj;
var _local1:Number = (1 / 20);
var _local2:Array = GetCurrentLevelInstances();
var _local3:BitmapData = Game.main.screenBD;
for each (_local4 in _local2) {
_local5 = Game.physObjs.FindByName(_local4.typeName);
if (_local5 != null){
PhysObj.RenderAt(_local5, (_local4.x - scrollX), ((_local4.y - scrollY) + (240 / _local1)), _local4.rot, _local3, false, _local1);
};
};
}
public static function HitTestPhysObjGraphics(_arg1:Number, _arg2:Number):PhysObj_Instance{
var _local4:int;
var _local5:PhysObj_Instance;
var _local6:BitmapData;
var _local7:PhysObj;
var _local8:uint;
var _local3:Array = GetCurrentLevelInstances();
_local4 = (_local3.length - 1);
while (_local4 >= 0) {
_local5 = _local3[_local4];
_local6 = Game.main.screenBD;
_local6.fillRect(Defs.screenRect, 0);
_local7 = Game.physObjs.FindByName(_local5.typeName);
PhysObj.RenderAt(_local7, (_local5.x - scrollX), (_local5.y - scrollY), _local5.rot, _local6);
_local8 = _local6.getPixel32(_arg1, _arg2);
if (_local8 != 0){
return (_local5);
};
_local4--;
};
return (null);
}
static function Editor_RenderObjects_AdjustMode(){
var _local3:PhysObj_Instance;
var _local4:PhysObj;
var _local1:Array = GetCurrentLevelInstances();
var _local2:BitmapData = Game.main.screenBD;
for each (_local3 in _local1) {
_local4 = Game.physObjs.FindByName(_local3.typeName);
if (_local3 == currentAdjustObject){
if ((updateTimer & 2)){
PhysObj.RenderAt(_local4, (_local3.x - scrollX), (_local3.y - scrollY), _local3.rot, _local2);
};
} else {
PhysObj.RenderAt(_local4, (_local3.x - scrollX), (_local3.y - scrollY), _local3.rot, _local2);
};
};
}
static function IncCurrentPiece(){
editor_currentPiece++;
if (editor_currentPiece > (Game.physObjs.GetNum() - 1)){
editor_currentPiece = 0;
};
}
static function Lines_InsertPoint(_arg1:Number, _arg2:Number){
var _local7:PhysLine;
var _local8:int;
var _local9:Point;
var _local10:Array;
var _local11:Point;
var _local12:Point;
var _local13:Point;
var _local3:Level = GetCurrentLevel();
var _local4:int;
var _local5 = -1;
var _local6 = -1;
for each (_local7 in _local3.lines) {
_local8 = 0;
for each (_local9 in _local7.points) {
if (Utils.DistBetweenPoints(_local9.x, _local9.y, _arg1, _arg2) < 3){
_local5 = _local4;
_local6 = _local8;
};
_local8++;
};
_local4++;
};
if (((!((_local5 == -1))) && (!((_local6 == -1))))){
_local10 = _local3.lines[_local5].points;
if (_local6 == (_local10.length - 1)){
return;
};
_local11 = _local10[_local6].clone();
_local12 = _local10[(_local6 + 1)].clone();
_local13 = new Point(0, 0);
_local13.x = ((_local11.x + _local12.x) * 0.5);
_local13.y = ((_local11.y + _local12.y) * 0.5);
_local10.splice((_local6 + 1), 0, _local13);
_local3.lines[_local5].points = _local10;
};
}
static function GetCurrentLevel():Level{
return (Game.levels[currentLevel]);
}
static function Lines_AddPoint(_arg1:Number, _arg2:Number){
if (currentLineIndex == -1){
return;
};
var _local3:Level = GetCurrentLevel();
var _local4:Point = new Point(_arg1, _arg2);
var _local5:Array = _local3.lines[currentLineIndex].points;
_local5.push(_local4);
_local3.lines[currentLineIndex].points = _local5;
}
public static function ExportAllLevelsAsXml(){
var _local1:int;
var _local2:int = currentLevel;
_local1 = 0;
while (_local1 < Game.levels.length) {
currentLevel = _local1;
ExportLevelAsXml();
_local1++;
};
currentLevel = _local2;
}
public static function Editor_AddLevel():void{
var _local1:Level = new Level();
currentLevel = Game.levels.length;
Game.levels.push(_local1);
currentLineIndex = -1;
currentPointIndex = -1;
}
static function DecCurrentPiece(){
editor_currentPiece--;
if (editor_currentPiece < 0){
editor_currentPiece = (Game.physObjs.GetNum() - 1);
};
}
static function RenderPanel_Editor(){
var _local1:Number;
var _local2:Number;
var _local3:String;
var _local5:PhysLine;
var _local4:BitmapData = Game.main.screenBD;
if (editMode == editMode_Commands){
_local3 = "Editor: Mode = Commands";
_local1 = 10;
_local2 = 10;
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local1 = 50;
_local2 = 50;
_local3 = "1: Place Pieces";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "2: Library (cycle)";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "3: Eraser";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "4: Commands";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "5: Adjust Placement";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "6: Edit Lines";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "7: Pick Piece";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "8: Prev Level";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "9: Next Level";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
return;
};
if (editMode == editMode_Commands1){
_local3 = "Editor: Mode = Commands1";
_local1 = 10;
_local2 = 10;
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local1 = 50;
_local2 = 50;
_local3 = "1: Erase Level";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "2: Add New Level (at end)";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "4: Export current level";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "5: Export all levels";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "9: Quit To Game";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
return;
};
if (editMode == editMode_GridCommands){
_local3 = "Editor: Mode = Grid Commands";
_local1 = 10;
_local2 = 10;
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local1 = 50;
_local2 = 50;
_local3 = ("1: Toggle Grid: " + gridMode_active);
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
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");
};
if (editMode == editMode_Lines){
_local3 = (_local3 + "Lines");
};
if (editMode == editMode_PickPiece){
_local3 = (_local3 + "PickPiece");
};
_local1 = 10;
_local2 = 10;
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
if (editMode == editMode_Lines){
_local3 = "1: Select Line (hold and click on point)";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "2: Delete Point (hold and click to delete)";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "3: Insert Point after clicked point";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "4: Select Point for editing with arrow keys";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "5: New line (hold and click new point)";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "6: Subdivide between this point and selected point";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "7: Push line points";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "8: Change Type";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "[ and ]: Move to first / last point of selected line";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = ((("ScrollPos: " + scrollX) + " ") + scrollY);
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = ((("CursorPos: " + int((MouseControl.x + scrollX))) + " ") + int((MouseControl.y + scrollY)));
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
if (currentLineIndex != -1){
_local5 = GetCurrentLevel().lines[currentLineIndex];
_local3 = ("Type: " + _local5.type);
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
};
};
if (editMode == editMode_Adjust){
_local3 = "Shift + Arrows: Move Piece";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "6: Rotate Left";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "7: Rotate Right";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
};
if (editMode == editMode_Normal){
_local3 = ((("ScrollPos: " + scrollX) + " ") + scrollY);
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = ((("CursorPos: " + int((MouseControl.x + scrollX))) + " ") + int((MouseControl.y + scrollY)));
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
_local3 = "1: Snap to nearby objects";
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
};
if (editMode == editMode_Adjust){
if (currentAdjustObject != null){
_local3 = ((((("Pos: " + currentAdjustObject.x) + " ") + currentAdjustObject.y) + " Rot: ") + currentAdjustObject.rot);
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
_local2 = (_local2 + 15);
};
};
_local1 = 350;
_local3 = ("Level=" + currentLevel.toString());
GraphicObjects.RenderStringAt(_local4, GraphicObjects.gfx_font1, _local1, _local2, _local3, null);
}
}
}//package
class PhysEd_GuideLine {
private var level:Boolean;
private var y1:Number;
private var y0:Number;
private var x0:Number;
private var x1:Number;
private var type:int;
private function PhysEd_GuideLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean){
type = _arg4;
level = _arg5;
if (type == 0){
x0 = _arg1;
x1 = _arg2;
y0 = _arg3;
y1 = _arg3;
} else {
y0 = _arg1;
y1 = _arg2;
x0 = _arg3;
x1 = _arg3;
};
}
}
Section 164
//PhysLine (PhysLine)
package {
import flash.display.*;
import flash.geom.*;
public class PhysLine {
var fill:int;
public var points:Array;
var name:String;
var fillScaleX:Number;
var fillScaleY:Number;
var type:int;
var catmullRomLength:Number;
public function PhysLine(){
name = "undefined";
type = 0;
points = new Array();
fill = 0;
fillScaleX = 1;
fillScaleY = 1;
}
function PointOnCurve(_arg1:Number, _arg2:Point, _arg3:Point, _arg4:Point, _arg5:Point):Point{
var _local6:Point = new Point();
var _local7:Number = (_arg1 * _arg1);
var _local8:Number = (_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 DrawCatmullRom(_arg1:BitmapData, _arg2:uint, _arg3:Number, _arg4:Number){
var _local6:Number;
var _local7:Point;
var _local5:int = 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 GetPointOnCatmullRom(_arg1:Number):Point{
var _local4:Point;
var _local5:Point;
var _local6:Point;
var _local7:Point;
var _local2:int = GetNumPoints();
if (_local2 < 4){
return (new Point(0, 0));
};
var _local3:int = (_local2 - 1);
var _local8:Number = (Number(_local3) * _arg1);
var _local9:int = _local8;
var _local10:int = (_local9 - 1);
var _local11:int = _local9;
var _local12:int = (_local9 + 1);
var _local13:int = (_local9 + 2);
if (_local10 < 0){
_local10 = 0;
};
if (_local12 > (_local2 - 1)){
_local12 = (_local2 - 1);
};
if (_local13 > (_local2 - 1)){
_local13 = (_local2 - 1);
};
_local4 = points[_local10];
_local5 = points[_local11];
_local6 = points[_local12];
_local7 = points[_local13];
var _local14:int = (_local9 + 1);
var _local15:Number = ((1 / Number(_local3)) * _local9);
var _local16:Number = ((1 / Number(_local3)) * _local14);
var _local17:Number = ((1 / (_local16 - _local15)) * (_arg1 - _local15));
var _local18:Point = PointOnCurve(_local17, _local4, _local5, _local6, _local7);
return (_local18);
}
public function GetNumPoints():int{
return (points.length);
}
public function GetInterpolatedPoint(_arg1:Number, _arg2:Boolean):Point{
if (type == 2){
return (GetPointOnCatmullRom(_arg1));
};
if (_arg2 == true){
var _local3:int = points.length;
var _local4:Number = (1 / _local3);
var _local5:int = Math.floor((_local3 * _arg1));
var _local6:int = ((_local5 + 1) % _local3);
var _local7:Number = (_local5 * _local4);
var _local8:Number = ((_local5 + 1) * _local4);
var _local9:Number = Utils.ScaleTo(points[_local5].x, points[_local6].x, _local7, _local8, _arg1);
var _local10:Number = Utils.ScaleTo(points[_local5].y, points[_local6].y, _local7, _local8, _arg1);
var _local11:Point = new Point(_local9, _local10);
return (_local11);
};
_local3 = points.length;
_local4 = (1 / (_local3 - 1));
_local5 = Math.floor(((_local3 - 1) * _arg1));
_local6 = ((_local5 + 1) % _local3);
_local7 = (_local5 * _local4);
_local8 = ((_local5 + 1) * _local4);
_local9 = Utils.ScaleTo(points[_local5].x, points[_local6].x, _local7, _local8, _arg1);
_local10 = Utils.ScaleTo(points[_local5].y, points[_local6].y, _local7, _local8, _arg1);
_local11 = new Point(_local9, _local10);
return (_local11);
}
public function SetPointArray(_arg1:Array){
points = _arg1;
}
public function Clone():PhysLine{
var _local2:Point;
var _local1:PhysLine = new PhysLine();
_local1.name = name;
_local1.type = type;
_local1.fill = fill;
_local1.fillScaleX = fillScaleX;
_local1.fillScaleY = fillScaleY;
for each (_local2 in points) {
_local1.points.push(_local2.clone());
};
return (_local1);
}
public function CalculateCatmullRomLength(){
var _local2:int;
var _local4:Number;
var _local5:Point;
var _local6:Point;
var _local7:Point;
var _local1:Array = new Array();
var _local3:int = 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;
}
}
}//package
Section 165
//PhysObj (PhysObj)
package {
import flash.display.*;
import flash.geom.*;
import Box2D.Common.Math.*;
public class PhysObj {
public var bodies:Array;
public var joints:Array;
public var name:String;
public var initFunctionName:String;
public var displayInLibrary:Boolean;
public var hitballsound:int;
public function PhysObj(){
hitballsound = 0;
}
function PointFromString(_arg1:String):Point{
var _local2:Array = _arg1.split(",");
var _local3:Point = 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 _local4:int;
var _local6:Point;
var _local2:Array = new Array();
var _local3:Array = _arg1.split(",");
if ((((_local3.length < 2)) || (((_local3.length % 2) == 1)))){
trace(((("PointArrayFromString. Error, numpoints=" + _local3.length) + " , string= ") + _arg1));
return (_local2);
};
var _local5:int = (_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 _local3:PhysObj_Body;
var _local2:int;
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;
_arg1 = _arg1.toUpperCase();
if (_arg1 == "1"){
_local2 = true;
};
if (_arg1 == "TRUE"){
_local2 = true;
};
return (_local2);
}
public function JointIndexFromName(_arg1:String):int{
var _local3:PhysObj_Joint;
var _local2:int;
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;
displayInLibrary = XmlHelper.GetAttrBoolean(_arg1.@inlibrary, false);
initFunctionName = XmlHelper.GetAttrString(_arg1.@initfunction, null);
_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);
_local7.linearDamping = XmlHelper.GetAttrNumber(_local6.@lineardamping, _local7.linearDamping);
_local7.angularDamping = XmlHelper.GetAttrNumber(_local6.@angulardamping, _local7.angularDamping);
_local3 = 0;
while (_local3 < _local6.graphic.length()) {
_local8 = _local6.graphic[_local3];
_local9 = new PhysObj_Graphic();
_local9.goInitFuntion = _local8.@gameobjfunction;
_local9.goInitFuntionVarString = _local8.@gameobjvars;
_local9.graphicName = _local8.@clip;
_local9.graphicID = 0;
_local9.frame = (XmlHelper.GetAttrInt(_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 = XmlHelper.GetAttrInt(_local12.x);
_local11.collisionMask = XmlHelper.GetAttrInt(_local12.y);
_local11.density = XmlHelper.GetAttrNumber(_local10.@density);
_local11.friction = XmlHelper.GetAttrNumber(_local10.@friction);
_local11.restitution = XmlHelper.GetAttrNumber(_local10.@restitution);
if (_local5 == "circle"){
_local11.type = PhysObj_Shape.Type_Circle;
_local11.circle_pos = PointFromString(_local10.@pos);
_local11.circle_radius = XmlHelper.GetAttrNumber(_local10.@radius);
} else {
if (_local5 == "poly"){
_local11.type = PhysObj_Shape.Type_Poly;
_local11.poly_points = PointArrayFromString(_local10.@vertices);
_local11.poly_rot = Utils.DegToRad(XmlHelper.GetAttrNumber(_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(XmlHelper.GetAttrNumber(_local13.@lowerangle));
_local14.rev_upperAngle = Utils.DegToRad(XmlHelper.GetAttrNumber(_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++;
};
}
public function BodyFromName(_arg1:String):PhysObj_Body{
var _local3:PhysObj_Body;
var _local2:int;
while (_local2 < bodies.length) {
_local3 = bodies[_local2];
if (_local3.name == _arg1){
return (_local3);
};
_local2++;
};
trace(("ERROR PhysObj BodyFromName " + _arg1));
return (null);
}
public static function RenderAt(_arg1:PhysObj, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:BitmapData, _arg6:Boolean=true, _arg7:Number=1, _arg8:Rectangle=null){
var _local11:Number;
var _local12:Number;
var _local13:Matrix;
var _local14:PhysObj_Body;
var _local15:PhysObj_Graphic;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:BitmapData;
var _local22:Matrix;
var _local23:Point;
var _local24:Matrix;
var _local25:Number;
var _local26:int;
var _local27:int;
var _local28:PhysObj_Shape;
var _local29:Number;
var _local30:Array;
var _local31:int;
var _local32:b2Vec2;
var _local33:b2Vec2;
var _local34:Point;
var _local35:Point;
var _local9:Boolean = _arg6;
var _local10:Number = _arg7;
_local11 = _arg2;
_local12 = _arg3;
for each (_local14 in _arg1.bodies) {
for each (_local15 in _local14.graphics) {
if (_arg8 != null){
_local16 = GraphicObjects.GetWidth(_local15.graphicID, _local15.frame);
_local17 = GraphicObjects.GetHeught(_local15.graphicID, _local15.frame);
_local18 = (_arg8.width / _local16);
_local19 = (_arg8.height / _local17);
_local20 = _local18;
if (_local19 < _local18){
_local20 = _local19;
};
_local11 = (_local11 - (_arg8.width / 2));
_local12 = (_local12 - (_arg8.height / 2));
_local21 = GraphicObjects.GetBitmapData(_local15.graphicID, _local15.frame);
_local22 = new Matrix();
_local22.identity();
_local22.scale(_local20, _local20);
_local22.translate(_local11, _local12);
if (_local21 != null){
_arg5.draw(_local21, _local22, null, null, null, true);
};
} else {
_local23 = new Point((_local14.pos.x + _local15.offset.x), (_local14.pos.y + _local15.offset.y));
_local24 = new Matrix();
_local24.rotate(Utils.DegToRad(_arg4));
_local24.scale(_local10, _local10);
_local23 = _local24.transformPoint(_local23);
_local11 = ((_arg2 * _local10) + _local23.x);
_local12 = ((_arg3 * _local10) + _local23.y);
_local25 = Utils.DegToRad((_arg4 + _local15.rot));
GraphicObjects.RenderAtRotScaled(_local15.graphicID, _local15.frame, _arg5, _local11, _local12, false, _local10, _local25);
};
};
if (_local9){
for each (_local28 in _local14.shapes) {
if (_local28.type == PhysObj_Shape.Type_Circle){
_local29 = _local28.circle_radius;
Utils.RenderCircle(_arg5, (_arg2 + _local28.circle_pos.x), (_arg3 + _local28.circle_pos.y), _local29, 4294967295);
};
if (_local28.type == PhysObj_Shape.Type_Poly){
_local30 = _local28.poly_points;
_local31 = _local28.poly_points.length;
_local26 = 0;
while (_local26 < _local31) {
_local27 = (_local26 + 1);
if (_local27 >= _local31){
_local27 = 0;
};
_local32 = new b2Vec2(_local30[_local26].x, _local30[_local26].y);
_local33 = new b2Vec2(_local30[_local27].x, _local30[_local27].y);
_local22 = new Matrix();
_local22.rotate(Utils.DegToRad(_arg4));
_local34 = new Point(_local32.x, _local32.y);
_local35 = new Point(_local33.x, _local33.y);
_local34 = _local22.transformPoint(_local34);
_local35 = _local22.transformPoint(_local35);
_local32.x = _local34.x;
_local32.y = _local34.y;
_local33.x = _local35.x;
_local33.y = _local35.y;
_local32.x = (_local32.x + _arg2);
_local33.x = (_local33.x + _arg2);
_local32.y = (_local32.y + _arg3);
_local33.y = (_local33.y + _arg3);
Utils.RenderDotLine(_arg5, _local32.x, _local32.y, _local33.x, _local33.y, 50, 4294967295);
_local26++;
};
};
};
};
};
}
}
}//package
Section 166
//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 pos:Point;
public var shapes:Array;
public var fixed:Boolean;
public var sensor:Boolean;
public var linearDamping:Number;
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 167
//PhysObj_BodyUserData (PhysObj_BodyUserData)
package {
public class PhysObj_BodyUserData {
public var type:String;
public var instance:PhysObj_Instance;
public var id:int;
public var gameObjectID:int;
public var bodyName:String;
public function PhysObj_BodyUserData(){
type = "";
bodyName = "";
gameObjectID = -1;
instance = null;
id = 0;
}
}
}//package
Section 168
//PhysObj_Graphic (PhysObj_Graphic)
package {
import flash.geom.*;
public class PhysObj_Graphic {
public var offset:Point;
public var graphicID:int;
public var hasShadow:Boolean;
public var graphicName:String;
public var frame:int;
public var rot:Number;
public var goInitFuntion:String;
public var zoffset:Number;
public var goInitFuntionVarString:String;
public function PhysObj_Graphic(){
graphicName = "";
graphicID = 0;
frame = 0;
offset = new Point(0, 0);
rot = 0;
goInitFuntion = "";
goInitFuntionVarString = "";
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 169
//PhysObj_Instance (PhysObj_Instance)
package {
import flash.geom.*;
import flash.media.*;
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class PhysObj_Instance {
var animal_rescued:Boolean;
var paramValues:Array;
public var removeFlag:Boolean;
var ai_accel:Number;
var carDrive:int;
var generator_object:String;
var switchName1:String;
public var collideFunction:Function;
var gateTime:int;
public var hitballsound:int;
var gloopTrailTimerMax:int;
var stopcount:int;
var skidOverTime:int;
var hosedir:int;// = 0
var finishedRace:Boolean;
public var movementVec:Vec;
var hitVehicleSoundTimer:int;
public var x:Number;
public var y:Number;
var switch_timer:int;
var vehicleSpeed:Number;
var hoseID:int;// = 0
var vehicleType:int;
public var doSwitchFunction:Function;
var controlMode:int;
var isVehicle:Boolean;
var godir:Number;// = 0
var isPlayer:Boolean;
var posy:Number;
var lineResetAtEnd:Boolean;
var lineSpeed:Number;
var lastCheckpointIndex:int;
public var initParams:String;
var slideAmt0:Number;// = 0.04
var slideAmt1:Number;// = 0.07
var posx:Number;
var lineLoop:Boolean;
public var instanceName:String;
var paramNames:Array;
var gateVel:Number;
var carSpeed:Number;
var magnet_time:int;
public var collideWithInstance:PhysObj_Instance;
var guineaPig_type:int;
var generator_time:int;
var gloopTrailTimer:int;
var zvel:Number;
public var typeName:String;
var ai_nextLineNode:int;
var mover_xvel:Number;
var skidTime:int;
var cannon_firing:Boolean;
var cannon_angvel:Number;
var mover_x1:Number;
var colflags:int;
var gateMode:String;
var portalName:String;
var mover_x0:Number;
public var joints:Array;
var oldx:Number;
var oldy:Number;
public var switchFunction:Function;
var animaltype:int;
public var type:int;
var lineIndex:int;
public var preUpdateFunction:Function;
public var timer:int;
var mincer_numtogenerate:int;
var magnet_mode:String;
var lineLinearPos:Number;
var beenHitByPlayer:Boolean;
var vehicleCheckpointIndex:int;
var carIndex:int;
var cannon_maxang:Number;
var ai_maxSpeed:Number;
var turboIndex:int;
var cannon_ang:Number;
var zpos:Number;
var ball_hitcount:int;
var cannon_mode:String;
var aiCarIndex:int;
public var driveVec:Vec;
var vehicleCurrentLap:int;
var skidDist:int;
public var bodies:Array;
public var updateFunction:Function;
var totalVehicleCheckpointIndex:int;
var turboTimer:int;
var displayFrame:int;
public var collidetimer:int;
var cannon_minang:Number;
public var rot:Number;
var onBridgeTimer:int;
var magnet_polarity:Boolean;
var gloopID:int;
public var updateFunctionName:String;
var ai_lineIndex:int;
var switchName:String;
var engineVolume:Number;
public function PhysObj_Instance(){
bodies = new Array();
joints = new Array();
timer = 0;
collidetimer = 0;
collideFunction = null;
updateFunction = null;
preUpdateFunction = null;
switchFunction = null;
doSwitchFunction = null;
hitballsound = 0;
removeFlag = false;
updateFunctionName = null;
initParams = "";
type = 0;
}
public function SetLinearVelocity(_arg1:Number, _arg2:Number):void{
var _local3:b2Body;
for each (_local3 in bodies) {
_local3.SetLinearVelocity(new b2Vec2(_arg1, _arg2));
};
}
function UpdatePhysObj_Mover(){
var _local1:b2Vec2 = GetBodyWorldPos(0);
this.ApplyForce(mover_xvel, 0);
this.LimitLinearVelocity(10);
if (mover_xvel > 0){
if (_local1.x > mover_x1){
mover_xvel = (mover_xvel * -1);
};
} else {
if (_local1.x < mover_x0){
mover_xvel = (mover_xvel * -1);
};
};
}
function SwitchFunction_Path_2way(){
if (controlMode == 0){
controlMode = 1;
} else {
if (controlMode == 1){
controlMode = 2;
} else {
controlMode = 1;
};
};
}
function UpdatePhysObj_Path_2way(){
var _local1:Point;
if (controlMode == 0){
_local1 = UpdateLine(0);
SetBodyXForm(0, (_local1.x * Game.w2p), (_local1.y * Game.w2p), 0);
} else {
if (controlMode == 1){
_local1 = UpdateLine(lineSpeed);
SetBodyXForm(0, (_local1.x * Game.w2p), (_local1.y * Game.w2p), 0);
} else {
if (controlMode == 2){
_local1 = UpdateLine(-(lineSpeed));
SetBodyXForm(0, (_local1.x * Game.w2p), (_local1.y * Game.w2p), 0);
};
};
};
}
function InitPhysObj_TurboPickup(){
controlMode = 0;
updateFunction = UpdatePhysObj_TurboPickup;
timer = 0;
turboIndex = Game.numTurbos;
Game.numTurbos++;
}
function DoArrow(){
var _local1:GameObj = GetGameObject(0);
_local1.showArrowTimer = (Defs.fps * 3);
}
function SwitchedPhysObj_Switch():Boolean{
var _local1:GameObj = GetGameObject(0);
if (_local1.controlMode == 0){
SoundPlayer.Play("switchwav");
_local1.controlMode = 1;
return (true);
};
return (false);
}
function InitPhysObj_Generator(){
updateFunction = UpdatePhysObj_Generator;
GetParams(initParams);
generator_time = (GetParamNumber("delay") * Defs.fps);
generator_object = GetParam("object");
timer = generator_time;
}
function InitPhysObj_Breakable(){
colflags = 2;
updateFunction = UpdatePhysObj_Breakable;
}
function UpdateVehicleGameObject(_arg1:Number){
var _local3:int;
var _local6:Number;
var _local7:int;
var _local8:Number;
var _local2:GameObj = GetGameObject(0);
_local2.type = vehicleType;
_local2.frame = 0;
_arg1 = NormalizeDir(_arg1);
_local2.dir = 0;
godir = _arg1;
_arg1 = ((Math.PI * 2) - _arg1);
var _local4:Number = 99999;
var _local5 = 99999;
_local3 = 0;
for each (_local6 in Game.frameAngs) {
_local8 = Math.abs((_local6 - _arg1));
if (_local8 < _local4){
_local4 = _local8;
_local5 = _local3;
};
_local3++;
};
_local7 = (_local5 % 64);
_local7 = (_local7 - 8);
if (_local7 < 0){
_local7 = (_local7 + 64);
};
_local2.frame = _local7;
_local2.frame1 = 0;
if (zvel < -0.5){
_local2.frame1 = 64;
};
if (zvel > 0.5){
_local2.frame1 = 128;
};
_local2.height = zpos;
_local2.vehicleCurrentLap = vehicleCurrentLap;
_local2.vehicleCheckpointIndex = vehicleCheckpointIndex;
_local2.totalVehicleCheckpointIndex = totalVehicleCheckpointIndex;
Game.playerTotalCheckpointIndex = totalVehicleCheckpointIndex;
displayFrame = _local7;
Game.playerFrame = _local7;
_local2.carDrive = carDrive;
}
public function SetXForm(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local5:b2Body;
var _local4:b2Vec2 = new b2Vec2(_arg1, _arg2);
for each (_local5 in bodies) {
_local5.SetXForm(_local4, _arg3);
};
}
public function ApplyForce(_arg1:Number, _arg2:Number):void{
var _local3:b2Body;
for each (_local3 in bodies) {
_local3.ApplyForce(new b2Vec2(_arg1, _arg2), _local3.GetWorldCenter());
};
}
function InitPhysObj_Cone(){
updateFunction = UpdatePhysObj_Cone;
controlMode = 0;
beenHitByPlayer = false;
Game.totalCones++;
}
function UpdatePhysObj_TwoWaySwitch(){
var _local1:GameObj = GetGameObject(0);
if (controlMode == 0){
_local1.controlMode = 2;
} else {
_local1.controlMode = 1;
};
}
function GetLineIndexByName(_arg1:String):int{
var _local4:PhysLine;
var _local2:Level = Game.GetCurrentLevel();
var _local3:int;
for each (_local4 in _local2.lines) {
if (_local4.name == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function SetAngularVelocity(_arg1:int, _arg2:Number):void{
var _local3:b2Body;
if (_arg1 == -1){
for each (_local3 in bodies) {
_local3.SetAngularVelocity(_arg2);
};
} else {
_local3 = bodies[_arg1];
_local3.SetAngularVelocity(_arg2);
};
}
function SetSkidVolume(_arg1:Number){
var _local2:SoundChannel;
_local2 = SoundPlayer.GetSoundChannelByName("skid");
SoundPlayer.SetSoundChannelVolume(_local2, _arg1);
}
public function GetNumBodies():int{
return (bodies.length);
}
function UpdatePhysObj_Cone(){
var _local1:GameObj = GetGameObject(0);
_local1.dir = 0;
if (controlMode == 1){
_local1.frameVel = 1;
if (_local1.PlayAnimation()){
_local1.frame = 0;
controlMode = 0;
};
};
}
function GetParams(_arg1:String):void{
var _local3:String;
var _local4:Array;
paramNames = new Array();
paramValues = new Array();
_arg1 = Utils.RemoveWhiteSpace(_arg1);
_arg1 = _arg1.toLowerCase();
var _local2:Array = _arg1.split(",");
trace(_local2.length);
for each (_local3 in _local2) {
_local4 = _local3.split("=");
paramNames.push(_local4[0]);
paramValues.push(_local4[1]);
};
}
function UpdatePhysObj_Animal(){
var _local3:int;
var _local1:GameObj = GetGameObject(0);
if (controlMode == 0){
timer--;
if (timer <= 0){
controlMode = 1;
};
} else {
if (controlMode == 1){
_local3 = (GraphicObjects.GetNumFrames(_local1.graphicID) - 1);
_local1.frame = (_local1.frame + 0.5);
if (_local1.frame >= _local3){
_local1.frame = 0;
timer = Utils.RandBetweenInt(Defs.fps, (Defs.fps * 2));
if (animaltype == 1){
timer = 0;
};
controlMode = 0;
};
} else {
if (controlMode == 2){
_local1.frame = (GraphicObjects.GetNumFrames(_local1.graphicID) - 1);
};
};
};
var _local2:b2Vec2 = GetBodyWorldPos(0);
if (_local2.y > (800 * Game.w2p)){
Game.LevelFailed();
collideFunction = Game.RemoveObj_Standard;
collidetimer = 10;
};
}
function NormalizeDir(_arg1:Number):Number{
while (_arg1 < 0) {
_arg1 = (_arg1 + (Math.PI * 2));
};
while (_arg1 > (Math.PI * 2)) {
_arg1 = (_arg1 - (Math.PI * 2));
};
return (_arg1);
}
function InitPhysObj_Animal(){
type = 1;
colflags = 3;
updateFunction = UpdatePhysObj_Animal;
animal_rescued = false;
controlMode = 0;
timer = Utils.RandBetweenInt(Defs.fps, (Defs.fps * 2));
}
function OnBridge(){
onBridgeTimer = 1;
}
public function NearRot(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number = (_arg1 - _arg2);
var _local5:Number = Math.abs(_local4);
if (_local4 > Math.PI){
if (_arg2 < _arg1){
_arg2 = (_arg2 + (Math.PI * 2));
} else {
_arg2 = (_arg2 - (Math.PI * 2));
};
_local4 = (_arg1 - _arg2);
};
if (Math.abs(_local4) <= _arg3){
return (true);
};
return (false);
}
function UpdatePhysObj_Movable(){
var _local1:GameObj = GetGameObject(0);
_local1.dir = 0;
}
function UpdatePhysObj_BubbleSplat(){
timer--;
if (timer <= 0){
collideFunction = Game.RemoveObj_Standard;
collidetimer = 10;
};
}
function InitPhysObj_StartPos(){
}
function UpdateLine(_arg1:Number):Point{
lineLinearPos = (lineLinearPos + _arg1);
if (lineLinearPos > 1){
if (lineLoop == true){
lineLinearPos = (lineLinearPos - 1);
} else {
lineLinearPos = 1;
};
};
if (lineLinearPos < 0){
if (lineLoop == true){
lineLinearPos = (lineLinearPos + 1);
} else {
lineLinearPos = 0;
};
};
var _local2:PhysLine = Game.GetCurrentLevel().lines[lineIndex];
if (_local2 == null){
return (new Point(0, 0));
};
var _local3:Point = _local2.GetInterpolatedPoint(lineLinearPos, lineLoop);
return (_local3);
}
function PlayerCarHitTurbo(_arg1:PhysObj_Instance){
Game.SetTurboDone(vehicleCurrentLap, _arg1.turboIndex);
turboTimer = (Defs.fps * 5);
}
function SwitchedPhysObj_TimedSwitch():Boolean{
var _local1:GameObj = GetGameObject(0);
var _local2:Boolean;
if (controlMode == 0){
_local1.controlMode = 1;
controlMode = 1;
timer = switch_timer;
SoundPlayer.Play("switchwav");
_local2 = true;
} else {
_local2 = false;
};
return (_local2);
}
public function GetBodyAngleFromLinearVelocity(_arg1:int):Number{
var _local2:b2Vec2 = new b2Vec2(0, 0);
var _local3:b2Body = bodies[_arg1];
var _local4:b2Vec2 = _local3.GetLinearVelocity();
var _local5:Number = Math.atan2(_local4.y, _local4.x);
return (_local5);
}
function RotateToRequiredRot(_arg1:Number, _arg2:Number):Boolean{
var _local3:Number = (_arg2 + (Math.PI / 2));
var _local4:Number = Utils.DotProduct(Math.cos(movementVec.rot), Math.sin(movementVec.rot), Math.cos(_local3), Math.sin(_local3));
if (movementVec.NearRot(_arg2, _arg1)){
movementVec.rot = _arg2;
return (true);
};
if (_local4 < 0){
movementVec.AddRot(_arg1);
} else {
movementVec.AddRot(-(_arg1));
};
return (false);
}
function UpdatePhysObj_Springboard(){
var _local1:GameObj = GetGameObject(0);
if (controlMode == 0){
_local1.frame = 0;
};
if (controlMode == 1){
if (_local1.PlayAnimation()){
controlMode = 0;
};
};
}
function GetParamBool(_arg1:String, _arg2:Boolean=false):Boolean{
var _local4:String;
var _local3:int = paramNames.indexOf(_arg1);
if (_local3 != -1){
_local4 = paramValues[_local3];
if (_local4 == "true"){
return (true);
};
return (false);
};
return (_arg2);
}
public function GetDirBetween(_arg1, _arg2, _arg3, _arg4):Number{
var _local5:* = Math.atan2((_arg4 - _arg2), (_arg3 - _arg1));
return (_local5);
}
function InitPhysObj_Hose(){
colflags = 1;
updateFunction = UpdatePhysObj_Hose;
hosedir = 1;
controlMode = 0;
guineaPig_type = Utils.RandBetweenInt(0, 2);
}
function UpdatePhysObj_MiniBall(){
var _local2:GameObj;
var _local4:Number;
var _local5:int;
var _local6:PhysObj_Instance;
var _local7:Number;
var _local8:Number;
var _local1:PhysObj_BodyUserData = (bodies[0].GetUserData() as PhysObj_BodyUserData);
_local2 = GameObjects.objs[_local1.gameObjectID];
var _local3:b2Vec2 = GetBodyWorldPos(0);
posx = _local3.x;
posy = _local3.y;
if (_local2.controlMode == 0){
_local4 = Utils.DistBetweenPoints(oldx, oldy, posx, posy);
if (_local4 < 0.01){
stopcount++;
if (stopcount > 10){
_local2.controlMode = 1;
_local2.timer = 0;
SetAngularVelocity(0, 0);
SetLinearVelocity(0, 0);
};
} else {
stopcount = 0;
};
};
if (_local2.controlMode == 2){
Game.ApplyImpulseToObjectsFromPoint(this, _local3.x, _local3.y, 20, (200 * Game.w2p));
_local5 = 0;
while (_local5 < 20) {
_local6 = Game.AddPhysObjAt("bubblesplat", (_local3.x * Game.p2w), (_local3.y * Game.p2w), 0, "");
_local7 = (_local5 * ((Math.PI * 2) / 20));
_local8 = Utils.RandBetweenFloat(0.3, 0.4);
_local6.ApplyImpulse((Math.cos(_local7) * _local8), (Math.sin(_local7) * _local8));
_local5++;
};
collideFunction = Game.RemoveObj_Standard;
collidetimer = 10;
};
}
public function SetBodyCollisionMask(_arg1:int, _arg2:int):void{
var _local3:b2Body;
var _local4:b2Shape;
var _local5:b2FilterData;
if (_arg1 == -1){
for each (_local3 in bodies) {
_local4 = _local3.GetShapeList();
while (_local4) {
_local5 = _local4.GetFilterData();
_local5.maskBits = _arg2;
_local4.SetFilterData(_local5);
Game.world.Refilter(_local4);
_local4 = _local4.GetNext();
};
};
} else {
_local3 = bodies[_arg1];
_local4 = _local3.GetShapeList();
while (_local4) {
_local5 = _local4.GetFilterData();
_local5.maskBits = _arg2;
_local4.SetFilterData(_local5);
Game.world.Refilter(_local4);
_local4 = _local4.GetNext();
};
};
}
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);
};
}
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 SetBodyXForm(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:b2Vec2 = new b2Vec2(_arg2, _arg3);
var _local6:b2Body = bodies[_arg1];
_local6.SetXForm(_local5, _arg4);
}
function DoHump(){
if (zpos >= 0){
if (isPlayer){
SoundPlayer.Play("sfx_jump_small");
};
zvel = -2;
};
}
function UpdatePhysObj_AIVehicle(){
WakeUp();
var _local1:b2Body = bodies[0];
var _local2:PhysLine = Game.GetLineByIndex(ai_lineIndex);
if (_local2 == null){
return;
};
var _local3:Point = _local2.points[ai_nextLineNode].clone();
_local3.x = (_local3.x * Game.w2p);
_local3.y = (_local3.y * Game.w2p);
var _local4:b2Vec2 = GetBodyWorldPos(0);
var _local5:Number = Math.atan2((_local3.y - _local4.y), (_local3.x - _local4.x));
var _local6:Number = _local1.GetMass();
var _local7:Number = (1 / _local6);
var _local8:Number = _local1.GetAngle();
if (AIVehicle_CheckCrossedPoint()){
ai_nextLineNode++;
if (ai_nextLineNode >= _local2.points.length){
ai_nextLineNode = 0;
};
};
var _local9:Number = AIVehicle_FollowPath();
var _local10:Number = Math.abs(_local9);
if (finishedRace){
ai_maxSpeed = (ai_maxSpeed - 0.5);
if (ai_maxSpeed <= 0){
ai_maxSpeed = 0;
};
};
var _local11:Number = (0.5 * _local7);
var _local12:Number = ai_maxSpeed;
if (Game.gettingReady){
_local12 = 0;
};
if (totalVehicleCheckpointIndex > (Game.playerTotalCheckpointIndex + 1)){
_local12 = (_local12 * 0.8);
};
if (totalVehicleCheckpointIndex < (Game.playerTotalCheckpointIndex - 1)){
_local12 = (_local12 * 1.2);
};
var _local13:Number = (1 - (_local10 * 0.5));
_local12 = (_local12 * _local13);
if (_local12 > carSpeed){
carSpeed = (carSpeed + 1);
if (carSpeed > _local12){
carSpeed = _local12;
};
};
if (_local12 < carSpeed){
carSpeed = (carSpeed - 1);
if (carSpeed < _local12){
carSpeed = _local12;
};
};
_local5 = GetBodyAngle(0);
var _local14:Number = Math.cos(_local5);
var _local15:Number = Math.sin(_local5);
_local1.m_linearVelocity.Add(new b2Vec2((_local14 * _local11), (_local15 * _local11)));
LimitLinearVelocity(carSpeed);
UpdateHeight();
_local10 = (1 - _local10);
UpdateSkidmarks(_local10, 0.4);
UpdateVehicleGameObjectAI(_local8);
}
function UpdatePhysObj_TimedSwitch(){
var _local1:GameObj;
if (controlMode == 1){
timer--;
if (timer <= 0){
SoundPlayer.Play("switchwav");
_local1 = GetGameObject(0);
_local1.controlMode = 2;
controlMode = 0;
};
};
}
function UpdateSkidmarks(_arg1:Number, _arg2:Number){
var _local3:GameObj;
var _local4:int;
var _local5:Number;
var _local6:GameObj;
var _local7:Number;
var _local8:b2Vec2;
if (zpos != 0){
return;
};
if (_arg1 < _arg2){
_local3 = GetGameObject(0);
skidTime++;
skidDist = (skidDist + 1);
_local4 = Utils.LimitNumber(0, 5, skidTime);
_local5 = Utils.ScaleTo(0, 1, 0, 5, _local4);
Game.RenderSkidMark(_local3.xpos, _local3.ypos, _local3.oldxpos, _local3.oldypos, driveVec.rot, displayFrame, _local5);
if ((skidTime & 1) == 0){
_local6 = GameObjects.AddObj(_local3.xpos, _local3.ypos, _local3.zpos);
_local6.InitSmoke(_local3, godir, false);
} else {
_local6 = GameObjects.AddObj(_local3.xpos, _local3.ypos, _local3.zpos);
_local6.InitSmoke(_local3, godir, true);
};
if (isPlayer){
Game.playerTotalSkidDist++;
Game.playerCurrentSkidDist++;
SetSkidVolume(_local5);
};
skidOverTime = 10;
} else {
if (skidOverTime > 0){
skidOverTime--;
_local5 = Utils.ScaleTo(0, 1, 0, 10, skidOverTime);
_local3 = GetGameObject(0);
Game.RenderSkidMark(_local3.xpos, _local3.ypos, _local3.oldxpos, _local3.oldypos, driveVec.rot, displayFrame, _local5);
if (isPlayer){
SetSkidVolume(_local5);
};
} else {
if (isPlayer){
if (Game.playerCurrentSkidDist > 10){
_local7 = Math.round((Game.score_skid * Game.playerCurrentSkidDist));
if (_local7 > Game.playerBestLevelSkidScore){
Game.playerBestLevelSkidScore = _local7;
};
_local8 = GetBodyWorldPos(0);
Game.InitMessage(("Skid " + _local7.toString()), (_local8.x * Game.p2w), (_local8.y * Game.p2w));
Game.levscore_skids = (Game.levscore_skids + _local7);
Game.AddScore(_local7);
};
Game.playerCurrentSkidDist = 0;
SetSkidVolume(0);
};
skidTime = 0;
};
};
}
function InitPhysObj_BubbleSplat(){
colflags = 1;
timer = 10;
updateFunction = UpdatePhysObj_BubbleSplat;
}
function InitPhysObj_Springboard(){
GetParams(initParams);
updateFunction = UpdatePhysObj_Springboard;
controlMode = 0;
}
function UpdatePhysObj_Hose(){
var _local1:b2Body;
var _local2:PhysObj_BodyUserData;
var _local3:GameObj;
_local3 = GetGameObject((bodies.length - 2));
_local3.graphicID = GraphicObjects.GetIndexByName("Objects");
_local3.frame = 1;
_local3 = GetGameObject((bodies.length - 1));
if (guineaPig_type == 0){
_local3.graphicID = GraphicObjects.GetIndexByName("guinea_pig_hanging");
};
if (guineaPig_type == 1){
_local3.graphicID = GraphicObjects.GetIndexByName("guinea_pig2_hanging");
};
if (guineaPig_type == 2){
_local3.graphicID = GraphicObjects.GetIndexByName("guinea_pig3_hanging");
};
_local3.frameVel = 0.2;
_local3.CycleAnimation();
if (controlMode == 1){
_local3.visible = false;
} else {
_local3.visible = true;
};
if (controlMode == 1){
timer--;
if (timer <= 0){
timer = 0;
if (Game.numBallsActive < Game.numBallsActiveMax){
controlMode = 2;
guineaPig_type = Utils.RandBetweenInt(0, 2);
_local3.scale = 0.1;
};
};
} else {
if (controlMode == 2){
_local3.scale = (_local3.scale + 0.05);
if (_local3.scale >= 1){
_local3.scale = 1;
controlMode = 0;
};
};
};
}
function AIVehicle_FollowPath():Number{
var _local1:PhysLine = Game.GetLineByIndex(ai_lineIndex);
var _local2:Point = _local1.points[ai_nextLineNode].clone();
_local2.x = (_local2.x * Game.w2p);
_local2.y = (_local2.y * Game.w2p);
var _local3:b2Vec2 = GetBodyWorldPos(0);
var _local4:Number = 0.1;
var _local5:Number = movementVec.rot;
var _local6:Number = GetDirBetween(_local3.x, _local3.y, _local2.x, _local2.y);
var _local7:Number = (_local6 + (Math.PI / 2));
_local7 = NormalizeDir(_local7);
var _local8:Number = Utils.DotProduct(Math.cos(_local5), Math.sin(_local5), Math.cos(_local7), Math.sin(_local7));
if (movementVec.NearRot(_local6, _local4)){
movementVec.SetAng(_local6);
_local8 = 0;
} else {
if (_local8 < 0){
movementVec.AddRot(_local4);
} else {
movementVec.AddRot(-(_local4));
};
};
var _local9:b2Body = bodies[0];
_local9.SetXForm(null, movementVec.rot);
return (_local8);
}
function PreUpdatePhysObj_MiniBall(){
var _local1:b2Vec2 = GetBodyWorldPos(0);
oldx = _local1.x;
oldy = _local1.y;
}
function UpdatePhysObj_Pickup(){
}
function InitPhysObj_MiniBall(){
colflags = 1;
ball_hitcount = 0;
updateFunction = UpdatePhysObj_MiniBall;
preUpdateFunction = PreUpdatePhysObj_MiniBall;
timer = (Defs.fps * 3);
posx = 0;
oldx = 100;
posy = 0;
oldy = 100;
stopcount = 0;
}
function InitPhysObj_Pickup(){
Game.numPickups++;
updateFunction = UpdatePhysObj_Pickup;
controlMode = 0;
}
function InitPhysObj_Ball(){
colflags = 1;
Game.numBallsActive++;
ball_hitcount = 0;
updateFunction = UpdatePhysObj_Ball;
preUpdateFunction = PreUpdatePhysObj_Ball;
timer = (Defs.fps * 3);
posx = 0;
oldx = 100;
posy = 0;
oldy = 100;
stopcount = 0;
}
function InitPhysObj_Animal05(){
animaltype = 5;
InitPhysObj_Animal();
}
function EngineVolumeChange(_arg1:Number){
var _local2:SoundChannel;
engineVolume = (engineVolume + _arg1);
if (engineVolume >= 0.25){
engineVolume = 0.25;
};
if (engineVolume <= 0){
engineVolume = 0;
};
_local2 = SoundPlayer.GetSoundChannelByName("engine");
SoundPlayer.SetSoundChannelVolume(_local2, engineVolume);
}
function InitPhysObj_Animal01(){
animaltype = 1;
InitPhysObj_Animal();
}
public function Update(){
if (updateFunction != null){
updateFunction();
};
}
function InitPhysObj_Animal04(){
animaltype = 4;
InitPhysObj_Animal();
}
function InitPhysObj_Animal06(){
animaltype = 6;
InitPhysObj_Animal();
}
function InitPhysObj_Animal03(){
animaltype = 3;
InitPhysObj_Animal();
}
function PreUpdatePhysObj_Ball(){
var _local1:b2Vec2 = GetBodyWorldPos(0);
oldx = _local1.x;
oldy = _local1.y;
}
function GetParam(_arg1:String, _arg2:String=""):String{
var _local3:int = paramNames.indexOf(_arg1);
if (_local3 != -1){
return (paramValues[_local3]);
};
return (_arg2);
}
function InitAnyVehicle(){
isPlayer = false;
isVehicle = true;
vehicleType = 0;
movementVec = new Vec();
driveVec = new Vec();
skidDist = 0;
skidTime = 0;
skidOverTime = 0;
carIndex = Game.currentCarIndex;
Game.currentCarIndex++;
Game.numVehicles++;
totalVehicleCheckpointIndex = 0;
vehicleCheckpointIndex = 0;
lastCheckpointIndex = -1;
vehicleCurrentLap = 0;
vehicleSpeed = 0;
finishedRace = false;
zpos = 0;
zvel = 0;
gloopTrailTimerMax = 0;
gloopTrailTimer = 0;
}
function InitPhysObj_Animal02(){
animaltype = 2;
InitPhysObj_Animal();
}
function UpdateGloopTrail(){
if (gloopTrailTimer <= 0){
return;
};
gloopTrailTimer--;
if (gloopTrailTimer > gloopTrailTimerMax){
return;
};
if (zpos != 0){
return;
};
var _local1:Number = Utils.ScaleTo(1, 0, 0, gloopTrailTimerMax, gloopTrailTimer);
var _local2:GameObj = GetGameObject(0);
Game.RenderGloopTrail(_local2.xpos, _local2.ypos, _local2.oldxpos, _local2.oldypos, driveVec.rot, displayFrame, _local1, gloopID);
}
function CarEnteredCheckpoint(_arg1:int){
var _local2:int;
if (_arg1 == lastCheckpointIndex){
return;
};
if (_arg1 == vehicleCheckpointIndex){
lastCheckpointIndex = vehicleCheckpointIndex;
vehicleCheckpointIndex++;
totalVehicleCheckpointIndex++;
_local2 = Game.GetNumLinesByType(2);
if (vehicleCheckpointIndex >= _local2){
vehicleCheckpointIndex = 0;
};
if (isPlayer){
Game.wrongWayFlag = false;
};
if (vehicleCheckpointIndex == 1){
vehicleCurrentLap++;
if (vehicleCurrentLap > Game.numLaps){
finishedRace = true;
Game.CarFinishedRace(carIndex);
};
};
} else {
if (isPlayer){
if (vehicleCurrentLap != 0){
if (Game.wrongWayFlag == false){
SoundPlayer.Play("sfx_wrongway");
};
Game.wrongWayFlag = true;
};
};
};
}
function BreakObject(_arg1:Number){
if ((_arg1 * Game.p2w) > 100){
return;
};
var _local2:PhysObj_BodyUserData = (bodies[0].GetUserData() as PhysObj_BodyUserData);
var _local3:GameObj = GameObjects.objs[_local2.gameObjectID];
_local3.frame++;
var _local4:int = GraphicObjects.GetNumFrames(_local3.graphicID);
if (_local3.frame >= _local4){
_local3.frame = (_local4 - 1);
collideFunction = Game.RemoveObj_Standard;
collidetimer = 10;
};
SoundPlayer.Play("objectbreakwav");
}
function InitPhysObj_Path(){
GetParams(initParams);
var _local1:String = GetParam("line", "");
if (_local1 == ""){
lineIndex = -1;
} else {
lineIndex = GetLineIndexByName(_local1);
};
if (lineIndex == -1){
updateFunction = null;
};
trace(("lineIndex" + lineIndex));
lineSpeed = Number(GetParam("speed"));
lineLoop = GetParamBool("loop");
switchName = GetParam("switch", "");
lineResetAtEnd = GetParamBool("endreset");
lineLinearPos = 0;
var _local2:Number = GetParamNumber("startpos", 0);
lineLinearPos = _local2;
var _local3:Boolean = GetParamBool("2way");
controlMode = 1;
switchFunction = null;
updateFunction = null;
if (lineIndex != -1){
if (switchName != ""){
controlMode = 0;
switchFunction = SwitchFunction_Path;
} else {
controlMode = 1;
};
updateFunction = UpdatePhysObj_Path;
};
if (_local3){
if (switchName != ""){
switchFunction = SwitchFunction_Path_2way;
};
updateFunction = UpdatePhysObj_Path_2way;
};
}
function TurboPickupHit():Boolean{
var _local1:b2Vec2;
if (controlMode == 0){
_local1 = GetBodyWorldPos(0);
Game.InitMessage("TURBO", (_local1.x * Game.p2w), (_local1.y * Game.p2w));
controlMode = 1;
timer = (Defs.fps * 10);
GetGameObject(0).visible = false;
SoundPlayer.Play("sfx_turbo");
return (true);
};
return (false);
}
function InitPhysObj_Mover(){
updateFunction = UpdatePhysObj_Mover;
mover_x0 = (249 * Game.w2p);
mover_x1 = (250 * Game.w2p);
mover_xvel = 350;
}
function GetParamNumber(_arg1:String, _arg2:Number=0):Number{
var _local3:int = paramNames.indexOf(_arg1);
if (_local3 != -1){
return (Number(paramValues[_local3]));
};
return (_arg2);
}
function UpdatePhysObj_Mincer(){
var _local1:b2Vec2;
var _local2:int;
if (mincer_numtogenerate > 0){
timer--;
if (timer <= 0){
mincer_numtogenerate--;
timer = 10;
_local1 = GetBodyWorldPos(0);
_local2 = (-27 + ((mincer_numtogenerate % 4) * 17));
trace(((mincer_numtogenerate + " : ") + _local2));
SoundPlayer.Play("mincerplopwav");
Game.AddPhysObjAt("miniguineapig", ((_local1.x * Game.p2w) + _local2), (_local1.y * Game.p2w), 0, "", "");
};
};
}
function UpdatePhysObj_Ball(){
var _local3:Number;
var _local4:int;
var _local5:PhysObj_Instance;
var _local6:Number;
var _local7:Number;
var _local1:GameObj = GetGameObject(0);
if (guineaPig_type == 0){
_local1.graphicID = GraphicObjects.GetIndexByName("guinea_pig");
};
if (guineaPig_type == 1){
_local1.graphicID = GraphicObjects.GetIndexByName("guinea_pig2");
};
if (guineaPig_type == 2){
_local1.graphicID = GraphicObjects.GetIndexByName("guinea_pig3");
};
var _local2:b2Vec2 = GetBodyWorldPos(0);
posx = _local2.x;
posy = _local2.y;
if (_local1.controlMode == 0){
_local3 = Utils.DistBetweenPoints(oldx, oldy, posx, posy);
if (_local3 < 0.01){
stopcount++;
if (stopcount > 10){
_local1.controlMode = 1;
_local1.timer = 0;
SetAngularVelocity(0, 0);
SetLinearVelocity(0, 0);
};
} else {
stopcount = 0;
};
};
if (_local1.controlMode == 3){
Game.ApplyImpulseToObjectsFromPoint(this, _local2.x, _local2.y, 20, (200 * Game.w2p));
_local4 = 0;
while (_local4 < 20) {
_local5 = Game.AddPhysObjAt("bubblesplat", (_local2.x * Game.p2w), (_local2.y * Game.p2w), 0, "");
_local6 = (_local4 * ((Math.PI * 2) / 20));
_local7 = Utils.RandBetweenFloat(0.3, 0.4);
_local5.ApplyImpulse((Math.cos(_local6) * _local7), (Math.sin(_local6) * _local7));
_local4++;
};
Game.numBallsActive--;
Game.numPigsSacrificed++;
collideFunction = Game.RemoveObj_Standard;
collidetimer = 10;
};
if (posy > (800 * Game.w2p)){
SoundPlayer.PlayRandomBetween("guineadie01", "guineadie03", 1);
Game.numBallsActive--;
Game.numPigsSacrificed++;
collideFunction = Game.RemoveObj_Standard;
collidetimer = 10;
};
}
function InitPhysObj_Mincer(){
updateFunction = UpdatePhysObj_Mincer;
GetParams(initParams);
mincer_numtogenerate = 0;
timer = 0;
}
function GetFloorCol():int{
var _local1:b2Vec2 = GetBodyWorldPos(0);
var _local2:* = Game.GetFloorCollision((_local1.x * Game.p2w), (_local1.y * Game.p2w));
return (_local2);
}
public function PreUpdate(){
if (preUpdateFunction != null){
preUpdateFunction();
};
}
public function Init(){
isVehicle = false;
switchName = "";
switchName1 = "";
colflags = 0;
var _local1:PhysObj = Game.physObjs.FindByName(typeName);
if (_local1.initFunctionName != null){
var _local2 = this;
_local2[_local1.initFunctionName]();
};
}
function UpdatePhysObj_BadguyTimed(){
timer--;
if (timer <= 0){
collideFunction = Game.RemoveObj_Standard;
collidetimer = 10;
};
}
function InitPhysObj_PortalEntry(){
GetParams(initParams);
}
public function GetBodyLinearVelocity(_arg1:int):b2Vec2{
var _local2:b2Vec2 = new b2Vec2(0, 0);
var _local3:b2Body = bodies[_arg1];
var _local4:b2Vec2 = _local3.GetLinearVelocity();
return (_local4);
}
function UpdatePhysObj_PlayerVehicle(){
var _local17:SoundChannel;
WakeUp();
var _local1:Boolean;
var _local2:Boolean;
var _local3:Boolean;
var _local4:Boolean;
if (KeyReader.Down(KeyReader.KEY_UP)){
_local1 = true;
};
if (KeyReader.Down(KeyReader.KEY_DOWN)){
_local4 = true;
};
if (KeyReader.Down(KeyReader.KEY_LEFT)){
_local2 = true;
};
if (KeyReader.Down(KeyReader.KEY_RIGHT)){
_local3 = true;
};
var _local5:b2Body = bodies[0];
var _local6:Number = _local5.GetMass();
var _local7:Number = (1 / _local6);
var _local8:Number = GetBodyAngle(0);
var _local9:Number = Math.cos(_local8);
var _local10:Number = Math.sin(_local8);
var _local11:Number = (0.5 * _local7);
var _local12:Number = (10 * _local7);
if (Game.gettingReady){
UpdateVehicleGameObject(driveVec.rot);
return;
};
if (finishedRace){
_local1 = false;
_local4 = false;
_local2 = false;
_local3 = false;
};
var _local13:Number = ai_maxSpeed;
if (turboTimer > 0){
_local13 = (_local13 + 3);
};
if (_local1){
EngineVolumeChange(0.02);
vehicleSpeed = (vehicleSpeed + ai_accel);
if (vehicleSpeed >= ai_maxSpeed){
vehicleSpeed = _local13;
};
_local5.m_linearVelocity.Add(new b2Vec2((_local9 * _local11), (_local10 * _local11)));
} else {
if (_local4){
EngineVolumeChange(-0.02);
vehicleSpeed = (vehicleSpeed + 1);
if (vehicleSpeed >= 6){
vehicleSpeed = 6;
};
_local5.m_linearVelocity.Add(new b2Vec2((_local9 * -(_local11)), (_local10 * -(_local11))));
} else {
EngineVolumeChange(-0.01);
if (vehicleSpeed < 0){
vehicleSpeed = (vehicleSpeed + 1);
if (vehicleSpeed >= 0){
vehicleSpeed = 0;
};
} else {
vehicleSpeed = (vehicleSpeed - 1);
if (vehicleSpeed <= 0){
vehicleSpeed = 0;
};
};
_local5.m_linearVelocity.Normalize();
_local5.m_linearVelocity.Multiply(vehicleSpeed);
};
};
var _local14:Number = 0.1;
_local5 = bodies[0];
var _local15:Number = driveVec.dotRot(movementVec.rot);
if (zpos == 0){
if (_local15 > 0){
if (_local2){
driveVec.AddRot(-(_local14));
} else {
if (_local3){
driveVec.AddRot(_local14);
};
};
};
};
driveVec.speed = vehicleSpeed;
UpdateHeight();
var _local16:Number = MoveMovementVecTowardsDriveVec();
Game.playerTurnDiff = _local16;
Game.playerTurnDiffAbs = Math.abs(_local16);
_local5.SetXForm(null, movementVec.rot);
SetAngularVelocity(0, 0);
if (GetFloorCol() == 1){
Game.goneOffTrack = true;
LimitLinearVelocity((vehicleSpeed * 0.8));
} else {
LimitLinearVelocity(vehicleSpeed);
};
UpdateVehicleGameObject(driveVec.rot);
UpdateGloopTrail();
UpdateSkidmarks(_local16, 0.8);
Game.pvar01 = Game.playerTurnDiffAbs;
if (onBridgeTimer > 0){
onBridgeTimer--;
if (movementVec.speed > 1){
_local17 = SoundPlayer.GetSoundChannelByName("bridge");
SoundPlayer.SetSoundChannelVolume(_local17, 1);
} else {
_local17 = SoundPlayer.GetSoundChannelByName("bridge");
SoundPlayer.SetSoundChannelVolume(_local17, 0);
};
} else {
_local17 = SoundPlayer.GetSoundChannelByName("bridge");
SoundPlayer.SetSoundChannelVolume(_local17, 0);
};
if (turboTimer > 0){
turboTimer--;
};
if (hitVehicleSoundTimer > 0){
hitVehicleSoundTimer--;
};
}
function ConeHit(_arg1:PhysObj_Instance){
var _local2:Number;
var _local3:b2Vec2;
var _local4:GameObj;
if (controlMode == 0){
if (_arg1.isPlayer){
if (beenHitByPlayer == false){
Game.numConesHit++;
_local4 = GetGameObject(0);
if (_local4.graphicID == GraphicObjects.GetIndexByName("cone_clip")){
_local4.graphicID = GraphicObjects.GetIndexByName("ConeHitClip");
};
};
beenHitByPlayer = true;
_local2 = Game.score_hitCone;
_local3 = GetBodyWorldPos(0);
Game.InitMessage(_local2.toString(), (_local3.x * Game.p2w), (_local3.y * Game.p2w));
Game.levscore_obstacles = (Game.levscore_obstacles + _local2);
Game.AddScore(_local2);
SoundPlayer.Play("sfx_hitobject01");
};
controlMode = 1;
};
}
function MoveMovementVecTowardsDriveVec():Number{
var _local1:Number = movementVec.speed;
var _local2:Number = driveVec.speed;
var _local3:Number = movementVec.rot;
var _local4:Number = driveVec.rot;
var _local5:Number = Utils.DotProduct(driveVec.GetUnitXComponent(), driveVec.GetUnitYComponent(), movementVec.GetUnitXComponent(), movementVec.GetUnitYComponent());
var _local6:Number = (_local4 + (Math.PI / 2));
_local6 = NormalizeDir(_local6);
var _local7:Number = Utils.DotProduct(Math.cos(_local3), Math.sin(_local3), Math.cos(_local6), Math.sin(_local6));
var _local8:Number = slideAmt1;
if (movementVec.NearRot(_local4, _local8)){
movementVec.rot = _local4;
movementVec.speed = _local2;
return (1);
};
if (driveVec.speed < 2){
movementVec.rot = _local4;
movementVec.speed = _local2;
return (1);
};
if (_local7 > 0){
_local3 = (_local3 - _local8);
} else {
_local3 = (_local3 + _local8);
};
_local3 = NormalizeDir(_local3);
var _local9:* = Utils.DotProductAng(_local3, _local4);
_local1 = _local2;
movementVec.speed = _local1;
movementVec.rot = _local3;
return (_local9);
}
function SwitchedPhysObj_TwoWaySwitch():Boolean{
var _local1:GameObj = GetGameObject(0);
SoundPlayer.Play("switchwav");
if (controlMode == 0){
controlMode = 1;
return (true);
};
controlMode = 0;
return (true);
}
function UpdatePhysObj_Path(){
var _local1:Point;
if (controlMode == 0){
_local1 = UpdateLine(0);
SetBodyXForm(0, (_local1.x * Game.w2p), (_local1.y * Game.w2p), 0);
} else {
_local1 = UpdateLine(lineSpeed);
SetBodyXForm(0, (_local1.x * Game.w2p), (_local1.y * Game.w2p), 0);
if (lineLoop == false){
if (lineLinearPos >= 1){
lineLinearPos = 1;
if (lineResetAtEnd){
lineLinearPos = 0;
};
controlMode = 0;
};
};
};
}
function InitPhysObj_AIVehicle(){
var _local3:Number;
InitAnyVehicle();
carDrive = Utils.RandBetweenInt(0, 3);
aiCarIndex = Game.currentAiCarIndex;
Game.currentAiCarIndex++;
updateFunction = UpdatePhysObj_AIVehicle;
ai_nextLineNode = 0;
var _local1:Number = 16;
ai_maxSpeed = (_local1 - (aiCarIndex * 0.3));
if (Game.currentLevel == 0){
_local1 = 15;
ai_maxSpeed = (_local1 - (aiCarIndex * 0.1));
};
ai_lineIndex = Game.GetNearestPathLine(x, y);
var _local2:PhysLine = Game.GetLineByIndex(ai_lineIndex);
if (_local2 != null){
_local3 = Math.atan2((_local2.points[0].y - y), (_local2.points[0].x - x));
movementVec.SetAng(_local3);
driveVec.SetAng(_local3);
};
carSpeed = 0;
}
function AIVehicle_CheckCrossedPoint():Boolean{
var _local1:PhysLine = Game.GetLineByIndex(ai_lineIndex);
var _local2:int = (ai_nextLineNode - 1);
if (_local2 < 0){
_local2 = (_local1.points.length - 1);
};
var _local3:Point = _local1.points[_local2].clone();
var _local4:Point = _local1.points[ai_nextLineNode].clone();
var _local5:Number = Math.atan2((_local4.y - _local3.y), (_local4.x - _local3.x));
_local5 = (_local5 + (Math.PI / 2));
var _local6:Number = Math.cos(_local5);
var _local7:Number = Math.sin(_local5);
var _local8:b2Vec2 = GetBodyWorldPos(0);
var _local9:Boolean = Utils.SideOfLine(_local4.x, _local4.y, (_local4.x + _local6), (_local4.y + _local7), (_local8.x * Game.p2w), (_local8.y * Game.p2w));
return ((_local9 == false));
}
function UpdatePhysObj_Cannonball(){
timer--;
if (timer <= 0){
collideFunction = Game.RemoveObj_Standard;
collidetimer = 10;
};
}
function UpdatePhysObj_Cannon(){
if (controlMode == 0){
} else {
if (controlMode == 1){
cannon_ang = (cannon_ang + cannon_angvel);
} else {
if (controlMode == 2){
cannon_ang = (cannon_ang - cannon_angvel);
};
};
};
if (cannon_ang >= cannon_maxang){
cannon_ang = cannon_maxang;
};
if (cannon_ang <= cannon_minang){
cannon_ang = cannon_minang;
};
var _local1:b2Body = bodies[0];
var _local2:b2Vec2 = GetBodyWorldPos(0);
_local1.SetXForm(_local2, cannon_ang);
var _local3:GameObj = GetGameObject(0);
if (cannon_firing){
_local3.frameVel = 1;
if (_local3.PlayAnimation()){
cannon_firing = false;
_local3.frame = 1;
};
};
}
function InitPhysObj_PlayerVehicle(){
var _local2:Number;
Game.playerCarIndex = Game.currentCarIndex;
type = 1;
updateFunction = UpdatePhysObj_PlayerVehicle;
InitAnyVehicle();
carDrive = Game.playerVehiclePropulsionType;
isPlayer = true;
onBridgeTimer = 0;
engineVolume = 0;
EngineVolumeChange(0);
Game.playerCurrentSkidDist = 0;
hitVehicleSoundTimer = 0;
vehicleType = Game.selectedCarType;
if (vehicleType == 1){
ai_maxSpeed = 15;
ai_accel = 2;
slideAmt1 = 0.07;
};
if (vehicleType == 0){
ai_maxSpeed = 14.5;
ai_accel = 4;
slideAmt1 = 0.06;
};
if (vehicleType == 2){
ai_maxSpeed = 14;
ai_accel = 1;
slideAmt1 = 0.05;
};
var _local1:PhysLine = Game.GetLineByIndex(Game.GetNearestPathLine(x, y));
if (_local1 != null){
_local2 = Math.atan2((_local1.points[0].y - y), (_local1.points[0].x - x));
movementVec.SetAng(_local2);
driveVec.SetAng(_local2);
};
}
function UpdateVehicleGameObjectAI(_arg1:Number){
var _local3:int;
var _local6:Number;
var _local7:int;
var _local8:Number;
var _local2:GameObj = GetGameObject(0);
_local2.frame = 0;
_arg1 = NormalizeDir(_arg1);
_local2.dir = 0;
godir = _arg1;
_arg1 = ((Math.PI * 2) - _arg1);
var _local4:Number = 99999;
var _local5 = 99999;
_local3 = 0;
for each (_local6 in Game.frameAngs) {
_local8 = Math.abs((_local6 - _arg1));
if (_local8 < _local4){
_local4 = _local8;
_local5 = _local3;
};
_local3++;
};
_local7 = (_local5 % 64);
_local7 = (_local7 - 8);
if (_local7 < 0){
_local7 = (_local7 + 64);
};
_local2.frame = _local7;
_local2.frame1 = 0;
if (zvel < -0.5){
_local2.frame1 = 64;
};
if (zvel > 0.5){
_local2.frame1 = 128;
};
_local2.height = zpos;
_local2.vehicleCurrentLap = vehicleCurrentLap;
_local2.vehicleCheckpointIndex = vehicleCheckpointIndex;
_local2.totalVehicleCheckpointIndex = totalVehicleCheckpointIndex;
_local2.carDrive = carDrive;
}
function TriggerPhysObj_Springboard(){
controlMode = 1;
var _local1:GameObj = GetGameObject(0);
_local1.frame = 0;
_local1.frameVel = 1;
SoundPlayer.Play("springboardwav");
}
function InitPhysObj_Cannon(){
GetParams(initParams);
updateFunction = UpdatePhysObj_Cannon;
switchFunction = SwitchFunction_Cannon;
cannon_minang = Utils.DegToRad(GetParamNumber("minang"));
cannon_maxang = Utils.DegToRad(GetParamNumber("maxang"));
cannon_angvel = GetParamNumber("speed");
switchName = GetParam("switch");
cannon_mode = GetParam("mode");
cannon_ang = cannon_minang;
cannon_firing = false;
controlMode = 0;
}
function PickupHit():Boolean{
var _local1:b2Vec2 = GetBodyWorldPos(0);
var _local2:int;
if (Game.pickupHitTimer > 0){
Game.pickupHitInRowCount++;
_local2 = (Game.score_hitPickup * (Game.pickupHitInRowCount + 1));
} else {
_local2 = Game.score_hitPickup;
Game.pickupHitInRowCount = 0;
};
if (Game.playerTurnDiffAbs < 0.7){
_local2 = (_local2 * 2);
};
Game.levscore_pickups = (Game.levscore_pickups + _local2);
Game.AddScore(_local2);
Game.InitMessage(_local2.toString(), (_local1.x * Game.p2w), (_local1.y * Game.p2w));
Game.pickupHitTimer = Game.pickupHitTimerMax;
controlMode = 1;
Game.numPickupsCollected++;
collideFunction = Game.RemoveObj_Standard;
collidetimer = 10;
SoundPlayer.Play("sfx_coin");
return (true);
}
function InitPhysObj_Movable(){
updateFunction = UpdatePhysObj_Movable;
controlMode = 0;
}
function UpdateHeight(){
zvel = (zvel + 0.5);
zpos = (zpos + zvel);
if (zpos >= 0){
zvel = 0;
zpos = 0;
};
}
function DoJump(_arg1:int){
var _local2:Number;
var _local3:b2Vec2;
if (zpos >= 0){
zvel = -5;
if (isPlayer){
_local2 = Game.score_jump;
_local3 = GetBodyWorldPos(0);
Game.InitMessage(_local2.toString(), (_local3.x * Game.p2w), (_local3.y * Game.p2w));
Game.levscore_jumps = (Game.levscore_jumps + _local2);
Game.AddScore(_local2);
SoundPlayer.Play("sfx_jump");
Game.SetJumpDone(vehicleCurrentLap, _arg1);
};
};
}
function HitAnimal(){
var _local1:PhysObj_BodyUserData = (bodies[0].GetUserData() as PhysObj_BodyUserData);
controlMode = 2;
animal_rescued = true;
if (animaltype == 1){
SoundPlayer.Play("animal_elephant");
};
if (animaltype == 2){
SoundPlayer.Play("animal_tortoise");
};
if (animaltype == 3){
SoundPlayer.Play("animal_gorilla");
};
if (animaltype == 4){
SoundPlayer.Play("animal_hippo");
};
if (animaltype == 5){
SoundPlayer.Play("animal_giraffe");
};
if (animaltype == 6){
SoundPlayer.Play("animal_penguin");
};
}
public function WakeUp():void{
var _local1:b2Body;
for each (_local1 in bodies) {
_local1.WakeUp();
};
}
public function GetBodyWorldPos(_arg1:int):b2Vec2{
var _local4:b2Body;
var _local2:b2Vec2 = new b2Vec2(0, 0);
var _local3:int;
for each (_local4 in bodies) {
if (_local3 == _arg1){
_local2 = _local4.GetWorldCenter().Copy();
};
_local3++;
};
return (_local2);
}
function SwitchFunction_Path(){
if (controlMode == 0){
controlMode = 1;
};
}
function SwitchFunction_Cannon(){
if (controlMode == 0){
controlMode = 1;
} else {
if (controlMode == 1){
controlMode = 2;
} else {
if (controlMode == 2){
controlMode = 1;
};
};
};
}
function TriggerPhysObj_Mincer(){
mincer_numtogenerate = (mincer_numtogenerate + 4);
SoundPlayer.Play("mincerwav");
}
function UpdatePhysObj_Generator(){
var _local1:b2Vec2;
timer--;
if (timer <= 0){
timer = generator_time;
_local1 = GetBodyWorldPos(0);
Game.AddPhysObjAt(generator_object, (_local1.x * Game.p2w), (_local1.y * Game.p2w), 0, "", "");
SoundPlayer.Play("generatewav");
};
}
public function LimitLinearVelocity(_arg1:Number):void{
var _local2:b2Body;
var _local3:b2Vec2;
for each (_local2 in bodies) {
_local3 = _local2.GetLinearVelocity();
if (_local3.Length() > _arg1){
_local3.Normalize();
_local3.Multiply(_arg1);
_local2.SetLinearVelocity(_local3);
};
};
}
function InitPhysObj_Switch(){
GetParams(initParams);
var _local1:String = GetParam("type");
if (_local1 == ""){
_local1 = "once";
};
if (_local1 == "once"){
doSwitchFunction = SwitchedPhysObj_Switch;
updateFunction = null;
};
if (_local1 == "timed"){
switch_timer = (GetParamNumber("time") * Defs.fps);
doSwitchFunction = SwitchedPhysObj_TimedSwitch;
updateFunction = UpdatePhysObj_TimedSwitch;
};
if (_local1 == "2way"){
doSwitchFunction = SwitchedPhysObj_TwoWaySwitch;
updateFunction = UpdatePhysObj_TwoWaySwitch;
controlMode = 0;
};
}
function InitPhysObj_BadguyTimed(){
updateFunction = UpdatePhysObj_BadguyTimed;
timer = (Defs.fps * 3);
}
function DoGloop(_arg1:int){
Game.hitGloop = true;
if (vehicleSpeed > 6){
vehicleSpeed = 6;
};
gloopID = _arg1;
if (gloopTrailTimer == 0){
SoundPlayer.Play("sfx_paint");
};
gloopTrailTimer = 60;
gloopTrailTimerMax = gloopTrailTimer;
}
public function GetGameObject(_arg1:int):GameObj{
var _local2:PhysObj_BodyUserData = (bodies[_arg1].GetUserData() as PhysObj_BodyUserData);
var _local3:GameObj = GameObjects.objs[_local2.gameObjectID];
return (_local3);
}
public function ApplyAngularVelocity(_arg1:int, _arg2:Number):void{
var _local3:b2Body;
if (_arg1 == -1){
for each (_local3 in bodies) {
_local3.ApplyTorque(_arg2);
};
} else {
bodies[_arg1].ApplyTorque(_arg2);
};
}
function UpdatePhysObj_TurboPickup(){
if (controlMode == 1){
timer--;
if (timer <= 0){
controlMode = 0;
GetGameObject(0).visible = true;
};
};
}
function UpdatePhysObj_Breakable(){
}
public function GetBodyAngle(_arg1:int):Number{
var _local2:b2Vec2 = new b2Vec2(0, 0);
var _local3:b2Body = bodies[_arg1];
return (_local3.GetAngle());
}
function InitPhysObj_Gate(){
GetParams(initParams);
switchName = GetParam("switch");
switchName1 = GetParam("switch1");
var _local1:String = GetParam("start");
gateMode = GetParam("mode", "once");
gateTime = (GetParamNumber("timer", 1) * Defs.fps);
updateFunction = UpdatePhysObj_Gate;
switchFunction = SwitchFunction_Gate;
controlMode = 0;
if (_local1 == "left"){
controlMode = 0;
};
if (_local1 == "right"){
controlMode = 1;
};
gateVel = GetParamNumber("strength", 100);
}
public function LimitAngularVelocity(_arg1:int, _arg2:Number):void{
var _local3:b2Body;
var _local4:Number;
if (_arg1 == -1){
for each (_local3 in bodies) {
_local4 = _local3.GetAngularVelocity();
if (_local4 >= _arg2){
_local4 = _arg2;
};
if (_local4 <= -(_arg2)){
_local4 = -(_arg2);
};
_local3.SetAngularVelocity(_local4);
};
} else {
_local3 = bodies[_arg1];
_local4 = _local3.GetAngularVelocity();
if (_local4 >= _arg2){
_local4 = _arg2;
};
if (_local4 <= -(_arg2)){
_local4 = -(_arg2);
};
_local3.SetAngularVelocity(_local4);
};
}
public function GetXForm(_arg1:int):b2XForm{
var _local2:b2Body = bodies[_arg1];
return (_local2.GetXForm());
}
function InitPhysObj_Magnet(){
GetParams(initParams);
magnet_polarity = GetParamBool("polarity");
magnet_mode = GetParam("mode", "static");
magnet_time = (Defs.fps * GetParamNumber("time"));
switchName = "";
switchFunction = null;
if (magnet_mode == "switch"){
switchName = GetParam("switch");
switchFunction = SwitchFunction_Magnet;
};
updateFunction = UpdatePhysObj_Magnet;
timer = 0;
}
public function ApplyImpulse(_arg1:Number, _arg2:Number):void{
var _local3:b2Body;
for each (_local3 in bodies) {
_local3.ApplyImpulse(new b2Vec2(_arg1, _arg2), _local3.GetWorldCenter());
};
}
public function AddToPos(_arg1:int, _arg2:b2Vec2):void{
var _local3:b2XForm;
var _local4:b2Body;
if (_arg1 == -1){
for each (_local4 in bodies) {
_local3 = _local4.GetXForm();
_local3.position.Add(_arg2);
_local4.SetXForm(_local3.position, 0);
};
} else {
_local3 = _local4.GetXForm();
_local3.position.Add(_arg2);
_local4.SetXForm(_local3.position, 0);
};
}
function UpdatePhysObj_Magnet(){
if (magnet_mode == "static"){
} else {
if (magnet_mode == "timed"){
timer++;
if (timer >= magnet_time){
timer = 0;
magnet_polarity = (magnet_polarity == false);
SoundPlayer.Play("magnetwav");
};
};
};
var _local1:GameObj = GetGameObject(0);
if (magnet_polarity == false){
_local1.frameVel = -0.5;
};
if (magnet_polarity == true){
_local1.frameVel = 0.5;
};
_local1.CycleAnimation();
}
public function GetBodyAngularVelocity(_arg1:int):Number{
var _local2:b2Body = bodies[_arg1];
return (_local2.GetAngularVelocity());
}
function SwitchFunction_Magnet(){
SoundPlayer.Play("magnetwav");
magnet_polarity = (magnet_polarity == false);
}
function InitPhysObj_Cannonball(){
timer = (Defs.fps * 3);
updateFunction = UpdatePhysObj_Cannonball;
}
function UpdatePhysObj_Gate(){
if (controlMode == 1){
ApplyAngularVelocity(1, -(gateVel));
};
if (controlMode == 2){
ApplyAngularVelocity(1, gateVel);
};
}
function PlayerHitVehicle(){
Game.numCarCollisions++;
if (hitVehicleSoundTimer == 0){
hitVehicleSoundTimer = Utils.RandBetweenInt(6, 12);
SoundPlayer.PlayRandomBetween("sfx_hitcar01", "sfx_hitcar03");
};
}
function SwitchFunction_Gate(){
if (controlMode == 0){
controlMode = 1;
} else {
if (controlMode == 1){
controlMode = 2;
} else {
if (controlMode == 2){
controlMode = 1;
};
};
};
}
}
}//package
Section 170
//PhysObj_Instances (PhysObj_Instances)
package {
public class PhysObj_Instances {
public var list:Array;
public function PhysObj_Instances(){
list = new Array();
}
public function Remove(_arg1:PhysObj_Instance):Boolean{
var _local3:PhysObj_Instance;
if (Exists(_arg1) == false){
return (false);
};
_arg1.Remove();
var _local2:Array = new Array();
for each (_local3 in list) {
if (_local3 == _arg1){
} else {
_local2.push(_local3);
};
};
list = _local2;
return (true);
}
public function GetAllByTypeNameContaining(_arg1:String):Array{
var _local3:PhysObj_Instance;
var _local2:Array = new Array();
for each (_local3 in list) {
if (_local3.typeName.match(_arg1)){
_local2.push(_local3);
};
};
return (_local2);
}
public function FindByTypeName(_arg1:String):PhysObj_Instance{
var _local2:PhysObj_Instance;
for each (_local2 in list) {
if (_local2.typeName == _arg1){
return (_local2);
};
};
return (null);
}
public function RemoveByName(_arg1:String):void{
var _local2:PhysObj_Instance = FindByName(_arg1);
if (_local2 == null){
return;
};
Remove(_local2);
}
public function GetAllByTypeName(_arg1:String):Array{
var _local3:PhysObj_Instance;
var _local2:Array = new Array();
for each (_local3 in list) {
if (_local3.typeName == _arg1){
_local2.push(_local3);
};
};
return (_local2);
}
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 FindByName(_arg1:String):PhysObj_Instance{
var _local2:PhysObj_Instance;
for each (_local2 in list) {
if (_local2.instanceName == _arg1){
return (_local2);
};
};
return (null);
}
public function GetByIndex(_arg1:int):PhysObj_Instance{
return (list[_arg1]);
}
}
}//package
Section 171
//PhysObj_Joint (PhysObj_Joint)
package {
import flash.geom.*;
public class PhysObj_Joint {
public var prism_enableLimit:Boolean;
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_maxMotorForce:Number;
public var dist_pos0:Point;
public var dist_pos1:Point;
public var prism_enableMotor:Boolean;
public var prism_axisangle:Number;
public var prism_motorSpeed:Number;
public var rev_enableLimit:Boolean;
public var rev_enableMotor:Boolean;
public var rev_upperAngle:Number;
public var rev_lowerAngle:Number;
public var rev_maxMotorTorque:Number;
public var type:int;
public var prism_upperTranslation:Number;
public var rev_motorSpeed:Number;
public var rev_pos:Point;
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 172
//PhysObj_Shape (PhysObj_Shape)
package {
import flash.geom.*;
public class PhysObj_Shape {
public var type:int;
public var poly_rot:Number;
public var circle_pos:Point;
public var density:Number;
public var restitution:Number;
public var name:String;
public var collisionCategory:int;
public var circle_radius:Number;
public var friction:Number;
public var poly_points:Array;
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 173
//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 FindIndexByName(_arg1:String):int{
var _local3:PhysObj;
var _local2:int;
for each (_local3 in list) {
if (_local3.name == _arg1){
return (_local2);
};
_local2++;
};
trace(("ERROR PhysObjs FindByName " + _arg1));
return (0);
}
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 174
//Pickup (Pickup)
package {
import flash.display.*;
public dynamic class Pickup extends MovieClip {
}
}//package
Section 175
//Player (Player)
package {
public class Player {
static const upg_total:int = 5;
static const upg_speed:int = 0;
static const upg_accel:int = 1;
static const upg_boost:int = 3;
static const upg_brake:int = 2;
static const upg_spin:int = 4;
static var levels:Array;
public static function GetCost(_arg1):int{
var _local2:int = levels[_arg1];
var _local3:int = (_local2 + 1);
return (_local3);
}
public static function Upgrade(_arg1):void{
var _local2:int = levels[_arg1];
_local2++;
if (_local2 > 10){
_local2 = 0;
};
levels[_arg1] = _local2;
}
public static function GetLevel(_arg1:int):int{
return (levels[_arg1]);
}
public static function InitOnce(){
levels = new Array();
levels.push(0, 0, 0, 0, 0);
}
public static function SetLevel(_arg1:int, _arg2:int):void{
levels[_arg1] = _arg2;
}
}
}//package
Section 176
//PlayerRecord (PlayerRecord)
package {
public class PlayerRecord {
var rot:Number;
var x:Number;
var y:Number;
var frame:int;
public function PlayerRecord(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int){
x = _arg1;
y = _arg2;
rot = _arg3;
frame = _arg4;
}
}
}//package
Section 177
//PlayerRecordings (PlayerRecordings)
package {
public class PlayerRecordings {
static var recordings:Array;
static var currentData:Array;
static var routeInfo:Array;
static var pr:PlayerRecord = new PlayerRecord(0, 0, 0, 0);
static function AddData(_arg1:Array){
var _local2:Number;
for each (_local2 in _arg1) {
currentData.push(_local2);
};
}
static function StopData(){
recordings.push(currentData);
}
static function Load(){
InitOnce();
}
static function GetItem(_arg1:int, _arg2:int):PlayerRecord{
if ((((_arg1 < 0)) || ((_arg1 >= recordings.length)))){
return (null);
};
var _local3:Array = recordings[_arg1];
if ((((_arg2 < 0)) || ((_arg2 >= (_local3.length / 3))))){
return (null);
};
pr.x = (_local3[((_arg2 * 3) + 0)] as Number);
pr.y = (_local3[((_arg2 * 3) + 1)] as Number);
pr.rot = (_local3[((_arg2 * 3) + 2)] as Number);
pr.frame = 0;
return (pr);
}
static function InitOnce(){
recordings = new Array();
routeInfo = new Array();
}
static function StartData(_arg1:int){
currentData = new Array();
routeInfo.push(_arg1);
}
public static function GetRouteIndex(_arg1:int, _arg2:int){
var _local6:int;
var _local7:int;
var _local3:int;
var _local4:int;
var _local5:Array = new Array();
_local4 = 0;
while (_local4 < 100) {
_local5.push(0);
_local4++;
};
for each (_local6 in routeInfo) {
var _local10 = _local5;
var _local11 = _local6;
var _local12 = (_local10[_local11] + 1);
_local10[_local11] = _local12;
};
_local4 = 0;
_local7 = _local5[_arg1];
for each (_local6 in routeInfo) {
if (_local6 == _arg1){
if (_local3 == _arg2){
return (_local4);
};
_local3++;
if (_local3 >= _local7){
_local3 = 0;
};
};
_local4++;
};
return (0);
}
}
}//package
Section 178
//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 closed:Boolean;
var lineList:Array;
var iparam0:int;
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 = new Point();
var _local7:Number = (_arg1 * _arg1);
var _local8:Number = (_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 _local4:Point;
var _local5:Point;
var _local6:Point;
var _local7:Point;
var _local2:int = GetNumPoints();
if (_local2 < 4){
return (new Point(0, 0));
};
var _local3:int = (_local2 - 1);
var _local8:Number = (Number(_local3) * _arg1);
var _local9:int = _local8;
var _local10:int = (_local9 - 1);
var _local11:int = _local9;
var _local12:int = (_local9 + 1);
var _local13:int = (_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];
var _local14:int = (_local9 + 1);
var _local15:Number = ((1 / Number(_local3)) * _local9);
var _local16:Number = ((1 / Number(_local3)) * _local14);
var _local17:Number = ((1 / (_local16 - _local15)) * (_arg1 - _local15));
var _local18:Point = PointOnCurve(_local17, _local4, _local5, _local6, _local7);
return (_local18);
}
public function AddLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local6:Rectangle;
var _local5:Line = 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 _local2:int;
var _local4:Number;
var _local5:Point;
var _local6:Point;
var _local7:Point;
var _local1:Array = new Array();
var _local3:int = 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 _local3:int;
var _local4:Line;
var _local1:* = -(pointList[0].x);
var _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 _local6:Number;
var _local7:Point;
var _local5:int = 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 _local6:int;
_local2 = _arg1[0];
var _local4:Poly = new Poly("", 0, _local2.x, _local2.y);
var _local5:int = _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 _local4:Poly;
var _local3:Array = 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 _local4:Poly;
var _local3:int;
for each (_local4 in _arg2) {
if (_local4.name == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
}
}//package
Section 179
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Preloader extends MovieClip {
var timer:Timer;
var percentString:String;// = "0%"
static var loader:MovieClip = null;
public function Preloader(){
addEventListener(Event.ENTER_FRAME, checkFrame);
loaderInfo.addEventListener(ProgressEvent.PROGRESS, progress);
loader = new preloader01();
addChild(loader);
loader.gotoAndPlay(1);
percentString = "0%";
loader.percent.percent.percentText.text = percentString;
}
private function checkFrame(_arg1:Event):void{
if (currentFrame == totalFrames){
removeEventListener(Event.ENTER_FRAME, checkFrame);
loader.gotoAndPlay("loaded");
timer = new Timer(2000, 0);
timer.start();
timer.addEventListener(TimerEvent.TIMER, timerComplete);
};
}
private function progress(_arg1:ProgressEvent):void{
var _local2:Number = Math.round(Utils.ScaleTo(0, 100, 0, _arg1.bytesTotal, _arg1.bytesLoaded));
percentString = (_local2.toString() + "%");
loader.percent.percent.percentText.text = percentString;
}
private function timerComplete(_arg1:TimerEvent):void{
timer.removeEventListener(TimerEvent.TIMER, timerComplete);
timer = null;
startup();
}
private function startup():void{
stop();
removeChild(loader);
loader = null;
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progress);
var _local1:Class = (getDefinitionByName("Main") as Class);
addChild((new (_local1) as DisplayObject));
}
public static function UpdateText(){
}
}
}//package
Section 180
//preloader01 (preloader01)
package {
import flash.display.*;
public dynamic class preloader01 extends MovieClip {
public var percent:MovieClip;
public function preloader01(){
addFrameScript(30, frame31, 80, frame81);
}
function frame81(){
stop();
}
function frame31(){
stop();
}
}
}//package
Section 181
//PreparingCars (PreparingCars)
package {
import flash.display.*;
public dynamic class PreparingCars extends MovieClip {
}
}//package
Section 182
//ReadyGetSetGo (ReadyGetSetGo)
package {
import flash.display.*;
public dynamic class ReadyGetSetGo extends MovieClip {
}
}//package
Section 183
//SaveData (SaveData)
package {
import flash.net.*;
public class SaveData {
static var id:String = "WebbliRacers999";
public static function Clear():void{
var _local1:SharedObject = SharedObject.getLocal(id);
_local1.clear();
_local1.close();
_local1.flush();
trace("SaveData Data Cleared");
trace(("len: " + _local1.size));
}
public static function Save():void{
}
public static function Load():void{
}
public static function DontLoad():void{
}
public static function Exists():Boolean{
var _local1:SharedObject = 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 184
//scorePanelHolder (scorePanelHolder)
package {
import flash.display.*;
public dynamic class scorePanelHolder extends MovieClip {
public var scorePanel:MovieClip;
public function scorePanelHolder(){
addFrameScript(10, frame11, 94, frame95);
}
function frame95(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 185
//sfx_bonus (sfx_bonus)
package {
import flash.media.*;
public dynamic class sfx_bonus extends Sound {
}
}//package
Section 186
//sfx_bridge (sfx_bridge)
package {
import flash.media.*;
public dynamic class sfx_bridge extends Sound {
}
}//package
Section 187
//sfx_coin (sfx_coin)
package {
import flash.media.*;
public dynamic class sfx_coin extends Sound {
}
}//package
Section 188
//sfx_colorspray (sfx_colorspray)
package {
import flash.media.*;
public dynamic class sfx_colorspray extends Sound {
}
}//package
Section 189
//sfx_engine01 (sfx_engine01)
package {
import flash.media.*;
public dynamic class sfx_engine01 extends Sound {
}
}//package
Section 190
//sfx_engine02 (sfx_engine02)
package {
import flash.media.*;
public dynamic class sfx_engine02 extends Sound {
}
}//package
Section 191
//sfx_engine03 (sfx_engine03)
package {
import flash.media.*;
public dynamic class sfx_engine03 extends Sound {
}
}//package
Section 192
//sfx_engine04 (sfx_engine04)
package {
import flash.media.*;
public dynamic class sfx_engine04 extends Sound {
}
}//package
Section 193
//sfx_go (sfx_go)
package {
import flash.media.*;
public dynamic class sfx_go extends Sound {
}
}//package
Section 194
//sfx_hitcar01 (sfx_hitcar01)
package {
import flash.media.*;
public dynamic class sfx_hitcar01 extends Sound {
}
}//package
Section 195
//sfx_hitcar02 (sfx_hitcar02)
package {
import flash.media.*;
public dynamic class sfx_hitcar02 extends Sound {
}
}//package
Section 196
//sfx_hitcar03 (sfx_hitcar03)
package {
import flash.media.*;
public dynamic class sfx_hitcar03 extends Sound {
}
}//package
Section 197
//sfx_hitobject01 (sfx_hitobject01)
package {
import flash.media.*;
public dynamic class sfx_hitobject01 extends Sound {
}
}//package
Section 198
//sfx_jump (sfx_jump)
package {
import flash.media.*;
public dynamic class sfx_jump extends Sound {
}
}//package
Section 199
//sfx_jump_small (sfx_jump_small)
package {
import flash.media.*;
public dynamic class sfx_jump_small extends Sound {
}
}//package
Section 200
//sfx_paint (sfx_paint)
package {
import flash.media.*;
public dynamic class sfx_paint extends Sound {
}
}//package
Section 201
//sfx_readyset (sfx_readyset)
package {
import flash.media.*;
public dynamic class sfx_readyset extends Sound {
}
}//package
Section 202
//sfx_rollover (sfx_rollover)
package {
import flash.media.*;
public dynamic class sfx_rollover extends Sound {
}
}//package
Section 203
//sfx_select (sfx_select)
package {
import flash.media.*;
public dynamic class sfx_select extends Sound {
}
}//package
Section 204
//sfx_skid (sfx_skid)
package {
import flash.media.*;
public dynamic class sfx_skid extends Sound {
}
}//package
Section 205
//sfx_turbo (sfx_turbo)
package {
import flash.media.*;
public dynamic class sfx_turbo extends Sound {
}
}//package
Section 206
//sfx_window_appear (sfx_window_appear)
package {
import flash.media.*;
public dynamic class sfx_window_appear extends Sound {
}
}//package
Section 207
//sfx_wrongway (sfx_wrongway)
package {
import flash.media.*;
public dynamic class sfx_wrongway extends Sound {
}
}//package
Section 208
//ShotController (ShotController)
package {
public class ShotController {
public var timer:int;
public var shotDefIndex:int;
public var yoff:Number;
public var xoff:Number;
public var shotTypeName:String;
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 = new ShotController();
_local1.timer = timer;
_local1.shotTypeName = shotTypeName;
_local1.shotDefIndex = shotDefIndex;
_local1.xoff = xoff;
_local1.yoff = yoff;
return (_local1);
}
}
}//package
Section 209
//ShotDef (ShotDef)
package {
public class ShotDef {
var spreadAng:Number;
var spreadRange:Number;
var name:String;
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 210
//SingleAchievementClip (SingleAchievementClip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class SingleAchievementClip extends MovieClip {
public var textTitle:TextField;
public var textDesc:TextField;
}
}//package
Section 211
//SiteLock (SiteLock)
package {
import flash.events.*;
public class SiteLock {
static var miniclip_locked:Boolean = false;
static var sitelockActive:Boolean = false;
public static function GetFullDomain():String{
var _local1:String = Main.theStage.loaderInfo.url;
var _local2:Number = (_local1.indexOf("://") + 3);
var _local3:Number = _local1.indexOf("/", _local2);
var _local4:String = _local1.substring(_local2, _local3);
return (_local4);
}
public static function InitOnce():void{
}
public static function IsLocked():Boolean{
var _local1:String;
_local1 = GetDomain();
var _local2:String = GetFullDomain();
if (Licensors.GetLicensor() == Licensors.LICENSOR_SIKIDS){
if (((!((_local1 == "timeforkids.com"))) && (!((_local1 == "sikids.com"))))){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMENINJA){
if (_local1 != "gameninja.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
if (_local1 != "kongregate.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_MINIJUEGOS){
if (_local1 == "minijuegos.com"){
return (false);
};
if (_local1 == "minijuegosgratis.com"){
return (false);
};
if (_local2 == "72.36.157.12"){
return (false);
};
if (_local2 == "72.36.157.13"){
return (false);
};
if (_local2 == "72.36.157.16"){
return (false);
};
if (_local2 == "72.36.157.14"){
return (false);
};
if (_local2 == "72.36.157.26"){
return (false);
};
if (_local2 == "72.36.157.50"){
return (false);
};
if (_local2 == "72.36.157.11"){
return (false);
};
if (_local2 == "72.36.157.10"){
return (false);
};
if (_local2 == "72.36.157.9"){
return (false);
};
if (_local2 == "72.36.157.8"){
return (false);
};
return (true);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_MOUSEBREAKER){
if (_local1 != "mousebreaker.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 = Main.theStage.loaderInfo.url;
var _local2:Number = (_local1.indexOf("://") + 3);
var _local3:Number = _local1.indexOf("/", _local2);
var _local4:String = _local1.substring(_local2, _local3);
var _local5:Number = (_local4.lastIndexOf(".") - 1);
var _local6:Number = (_local4.lastIndexOf(".", _local5) + 1);
_local4 = _local4.substring(_local6, _local4.length);
return (_local4);
}
public static function GetDomainFromUrl(_arg1:String):String{
var _local2:Number = (_arg1.indexOf("://") + 3);
var _local3:Number = _arg1.indexOf("/", _local2);
var _local4:String = _arg1.substring(_local2, _local3);
var _local5:Number = (_local4.lastIndexOf(".") - 1);
var _local6:Number = (_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;
}
static function onValidDomain(_arg1:Event):void{
trace("Miniclip sitelock OK");
miniclip_locked = false;
}
}
}//package
Section 212
//SkidMarks (SkidMarks)
package {
import flash.display.*;
public dynamic class SkidMarks extends MovieClip {
}
}//package
Section 213
//smoke_level01 (smoke_level01)
package {
import flash.display.*;
public dynamic class smoke_level01 extends MovieClip {
}
}//package
Section 214
//smoke_level02 (smoke_level02)
package {
import flash.display.*;
public dynamic class smoke_level02 extends MovieClip {
}
}//package
Section 215
//SoundPlayer (SoundPlayer)
package {
import flash.media.*;
import flash.utils.*;
public class SoundPlayer {
public static const minPlayTime = 3;
static var channel:SoundChannel;
public static var startTimes:Array;
static var active = false;
public static var sound:Sound;
public static var volumes:Array;
public static var soundTransform:SoundTransform;
public static var playingChannels:Array;
static var main:Main;
public static var playingNames:Array;
public static var sounds:Array;
static var timer:Timer;
public static var times:Array;
public static var names:Array;
static var playingFlag:Boolean;
public static var lengths:Array;
static var Instances:Array;
public static var soundTransforms:Array;
static var doSFX:Boolean;
public static var soundChannels:Array;
public static function UpdateOncePerFrame():void{
var _local1:int;
var _local2:int = 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++;
};
}
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 SetSoundChannelVolume(_arg1:SoundChannel, _arg2:Number){
if (_arg1 == null){
return;
};
if (doSFX == false){
_arg2 = 0;
};
var _local3:SoundTransform = _arg1.soundTransform;
_local3.volume = _arg2;
_arg1.soundTransform = _local3;
}
public static function ToggleMute(){
doSFX = (doSFX == false);
}
public static function Reset():void{
SoundMixer.stopAll();
playingChannels = new Array();
playingNames = new Array();
}
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_engine01");
AddSound("sfx_engine02");
AddSound("sfx_engine03");
AddSound("sfx_engine04");
AddSound("sfx_skid");
AddSound("sfx_bridge");
AddSound("sfx_bonus");
AddSound("sfx_coin");
AddSound("sfx_paint");
AddSound("sfx_hitobject01");
AddSound("sfx_hitcar01");
AddSound("sfx_hitcar02");
AddSound("sfx_hitcar03");
AddSound("sfx_colorspray");
AddSound("sfx_rollover");
AddSound("sfx_select");
AddSound("sfx_readyset");
AddSound("sfx_go");
AddSound("sfx_turbo");
AddSound("sfx_window_appear");
AddSound("sfx_jump");
AddSound("sfx_jump_small");
AddSound("sfx_wrongway");
soundTransform = new SoundTransform(1, 0);
active = true;
playingFlag = false;
Reset();
}
public static function Play(_arg1:String, _arg2:Number=1, _arg3:int=0, _arg4:String=""):void{
if (doSFX == false){
_arg2 = 0;
};
var _local5:int = names.indexOf(_arg1);
PlayById(_local5, _arg2, _arg3, _arg4);
}
public static function PlayById(_arg1:int, _arg2:Number=1, _arg3:int=0, _arg4:String=""):void{
var _local5:SoundTransform;
var _local6:Sound;
var _local7:SoundChannel;
if (doSFX == false){
_arg2 = 0;
};
if (times[_arg1] > 0){
return;
};
if (sounds[_arg1] != null){
_local6 = sounds[_arg1];
_local5 = new SoundTransform();
_local5.volume = _arg2;
_local7 = _local6.play(0, _arg3, _local5);
times[_arg1] = 5;
if (_arg4 != ""){
trace(("adding " + _arg4));
playingNames.push(_arg4);
playingChannels.push(_local7);
};
} else {
trace(("SoundPlayer: Cant find sound " + _arg1));
};
}
public static function PlayRandomBetween(_arg1:String, _arg2:String, _arg3:Number=1, _arg4:int=0, _arg5:String=""):void{
if (doSFX == false){
return;
};
var _local6:int = names.indexOf(_arg1);
var _local7:int = names.indexOf(_arg2);
var _local8:int = Utils.RandBetweenInt(_local6, _local7);
PlayById(_local8, _arg3, _arg4, _arg5);
}
public static function GetId(_arg1:String):int{
var _local2:int = names.indexOf(_arg1);
return (_local2);
}
public static function GetSoundChannelByName(_arg1:String):SoundChannel{
var _local2:int;
var _local3:String;
_local2 = 0;
while (_local2 < playingChannels.length) {
_local3 = playingNames[_local2];
if (_local3 == _arg1){
return (playingChannels[_local2]);
};
_local2++;
};
return (null);
}
}
}//package
Section 216
//Stat (Stat)
package {
public class Stat {
var value:Number;
var name:String;
public function Stat(_arg1:String, _arg2:Number){
name = _arg1;
value = _arg2;
}
}
}//package
Section 217
//Stats (Stats)
package {
public class Stats {
static var list:Array;
public static function InitOnce(){
list = new Array();
}
public static function Add(_arg1:String, _arg2:Number){
var _local3:Stat = FindByName(_arg1);
_local3.value = (_local3.value + _arg2);
}
public static function FindByName(_arg1:String):Stat{
var _local2:Stat;
for each (_local2 in list) {
if (_local2.name == _arg1){
return (_local2);
};
};
return (null);
}
public static function Create(_arg1:String, _arg2:Number){
list.push(new Stat(_arg1, _arg2));
}
}
}//package
Section 218
//Symbol1 (Symbol1)
package {
import flash.display.*;
public dynamic class Symbol1 extends MovieClip {
}
}//package
Section 219
//titleScreen (titleScreen)
package {
import flash.display.*;
public dynamic class titleScreen extends MovieClip {
public var buttonAchievements:SimpleButton;
public var buttonPlay:SimpleButton;
}
}//package
Section 220
//TitleScreenState (TitleScreenState)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import org.flashdevelop.utils.*;
import flash.filters.*;
import flash.net.*;
import flash.ui.*;
public class TitleScreenState {
var charPopup:MovieClip;
var achievementBonuses:Array;
static const numLevelsPerWorld:int = 5;
static var colorChangeColor0:uint;
static var colorChangeColor1:uint;
static var doFastTrack:Boolean;
static var webblibuttonActive:Boolean;
static var showingInstructions:Boolean;
static var colorChangeTimer:int;
static var carSelection:int = -1;
static var updateLevelEndFlag:Boolean = false;
static var propulsionHelpCharacter:int = 0;
static var bonusCount:int;
static var currentAch:int;
static var panelScoreAmtNeeded:int;
static var canPressCar:Boolean = false;
static var achievementPanelMC:MovieClip;
static var canPressTrack:Boolean;
static var origCarColor0:uint;
static var origCarColor2:uint;
static var instructionIndex:int;
static var origCarColor1:uint;
static var levelBonuses:Array;
static var bonuses:Array;
static var bonusCountMax:int;
static var selectedBikeIndex:int;
static var greyFilter:ColorMatrixFilter = new ColorMatrixFilter([0.3086, 0.6094, 0.082, 0, 0, 0.3086, 0.6094, 0.082, 0, 0, 0.3086, 0.6094, 0.082, 0, 0, 0, 0, 0, 1, 0]);
static var timer:int = 0;
static var levelSelect_selectedLevel:int;
static var doColorChange:Boolean = false;
static var canPressColorPicker:Boolean = false;
static var selectedAchievementIndex:int;
static var mode:int = 0;
static var scorePanelMC:MovieClip;
static var canPressPropulsion:Boolean = false;
public static var restart_at_levelselect:Boolean = false;
static var creditsMC:MovieClip;
static var main:Main;
static var achievementsMC:MovieClip;
static var carPropulsion:int = -1;
static var overlayMC:MovieClip = null;
static var rolledOverID:int = -1;
static var titleMC:MovieClip;
static var carColor:uint = 0;
static var colorChangeTimerMax:int;
static var panelScoreAmt:int;
static var instructionsMC:MovieClip;
public static function buttonCreditsPressed(_arg1:MouseEvent){
}
public static function SprayComplete1(_arg1:MouseEvent){
canPressColorPicker = false;
titleMC.gotoAndPlay("move 2");
if (carSelection == 0){
titleMC.shell.gotoAndPlay("move 2 toaster");
};
if (carSelection == 1){
titleMC.shell.gotoAndPlay("move 2 racer");
};
if (carSelection == 2){
titleMC.shell.gotoAndPlay("move 2 camper");
};
titleMC.shell.colorpicker.gotoAndPlay("out");
canPressPropulsion = false;
}
static function RemoveTitleEventListeners(){
if (Licensors.GetLicensor() == Licensors.LICENSOR_WEBBLIWORLD_LOCKED){
titleMC.shell.levelselect.buttonTrack1.removeEventListener(MouseEvent.CLICK, Track01_Pressed);
titleMC.shell.levelselect.buttonTrack2.removeEventListener(MouseEvent.CLICK, Track02_Pressed);
titleMC.shell.levelselect.buttonTrack3.removeEventListener(MouseEvent.CLICK, Track03_Pressed);
titleMC.shell.levelselect.buttonTrack4.removeEventListener(MouseEvent.CLICK, Track04_Pressed);
titleMC.shell.levelselect.buttonTrack1.removeEventListener(MouseEvent.MOUSE_OVER, Track01_Over);
titleMC.shell.levelselect.buttonTrack2.removeEventListener(MouseEvent.MOUSE_OVER, Track02_Over);
titleMC.shell.levelselect.buttonTrack3.removeEventListener(MouseEvent.MOUSE_OVER, Track03_Over);
titleMC.shell.levelselect.buttonTrack4.removeEventListener(MouseEvent.MOUSE_OVER, Track04_Over);
titleMC.shell.levelselect.buttonTrack1.removeEventListener(MouseEvent.MOUSE_OUT, Track_Out);
titleMC.shell.levelselect.buttonTrack2.removeEventListener(MouseEvent.MOUSE_OUT, Track_Out);
titleMC.shell.levelselect.buttonTrack3.removeEventListener(MouseEvent.MOUSE_OUT, Track_Out);
titleMC.shell.levelselect.buttonTrack4.removeEventListener(MouseEvent.MOUSE_OUT, Track_Out);
} else {
titleMC.shell.levelselect.buttonTrack1.removeEventListener(MouseEvent.CLICK, Track01_Pressed);
titleMC.shell.levelselect.buttonTrack2.removeEventListener(MouseEvent.CLICK, Track02_Pressed);
titleMC.shell.levelselect.buttonTrack1.removeEventListener(MouseEvent.MOUSE_OVER, Track01_Over);
titleMC.shell.levelselect.buttonTrack2.removeEventListener(MouseEvent.MOUSE_OVER, Track02_Over);
titleMC.shell.levelselect.buttonTrack1.removeEventListener(MouseEvent.MOUSE_OUT, Track_Out);
titleMC.shell.levelselect.buttonTrack2.removeEventListener(MouseEvent.MOUSE_OUT, Track_Out);
titleMC.foreground.buttonWebbliLogo.removeEventListener(MouseEvent.CLICK, buttonWebbliworldClicked);
};
}
public static function Propulsion01_Pressed(_arg1:MouseEvent){
carPropulsion = 0;
PropulsionPressed();
}
public static function Propulsion03_Pressed(_arg1:MouseEvent){
carPropulsion = 2;
PropulsionPressed();
}
public static function buttonWebbliworldClicked(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.webbliworld.com/?referrer=webbliracers"), "_blank");
}
public static function Track_Out(_arg1:MouseEvent){
titleMC.shell.levelselect.trackrollover.gotoAndStop("blank");
titleMC.shell.levelselect.challenges.text0.text = "";
titleMC.shell.levelselect.challenges.text1.text = "";
titleMC.shell.levelselect.challenges.text2.text = "";
titleMC.shell.levelselect.challenges.text3.text = "";
titleMC.shell.levelselect.challenges.text0a.text = "";
titleMC.shell.levelselect.challenges.text1a.text = "";
titleMC.shell.levelselect.challenges.text2a.text = "";
titleMC.shell.levelselect.challenges.text3a.text = "";
titleMC.shell.levelselect.challenges.tick0.gotoAndStop(1);
titleMC.shell.levelselect.challenges.tick1.gotoAndStop(1);
titleMC.shell.levelselect.challenges.tick2.gotoAndStop(1);
titleMC.shell.levelselect.challenges.tick3.gotoAndStop(1);
titleMC.shell.levelselect.challenges.tick0.visible = false;
titleMC.shell.levelselect.challenges.tick1.visible = false;
titleMC.shell.levelselect.challenges.tick2.visible = false;
titleMC.shell.levelselect.challenges.tick3.visible = false;
titleMC.shell.levelselect.speechbubble.challengeText.text = "";
titleMC.shell.levelselect.speechbubble.gotoAndStop(1);
}
public static function LevelSelect_buttonNextPressed(_arg1:MouseEvent){
var _local5:int;
var _local6:String;
var _local7:MovieClip;
var _local2:Boolean;
var _local3:int = _arg1.currentTarget.levelID;
var _local4:Level = Game.GetLevel(_local3);
if (_local4.available){
_local2 = true;
};
if (Game.usedebug){
_local2 = true;
};
if (_local2 == false){
return;
};
_local5 = 0;
while (_local5 < Game.levels.length) {
_local6 = ("level" + _local5);
_local7 = (titleMC.getChildByName(_local6) as MovieClip);
_local7.removeEventListener(MouseEvent.CLICK, LevelSelect_buttonNextPressed);
_local7.removeEventListener(MouseEvent.MOUSE_OVER, LevelSelect_levelOver);
_local7.removeEventListener(MouseEvent.MOUSE_OUT, LevelSelect_levelOut);
_local5++;
};
Game.main.removeChild(titleMC);
titleMC = null;
SaveData.Save();
Mouse.hide();
Game.main.SetGameState(Main.gameState_LEVEL_PLAY);
}
static function Cheats(_arg1:SimpleButton):void{
_arg1.addEventListener(MouseEvent.CLICK, buttonEnterCheatsPressed, false, 0, true);
_arg1.visible = false;
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
_arg1.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_KIBA){
_arg1.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_BUBBLEBOX){
_arg1.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_ANDKON){
_arg1.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_SIKIDS){
_arg1.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_SHOCKWAVE){
_arg1.visible = false;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_ARMORGAMES){
_arg1.visible = false;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_MINIJUEGOS){
_arg1.visible = false;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_MOUSEBREAKER){
_arg1.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMENINJA){
_arg1.visible = true;
};
};
};
};
};
};
};
};
};
};
}
public static function PropulsionPressed(){
if (canPressPropulsion == false){
return;
};
SFX_Click();
SetGameCarPropulsion();
titleMC.gotoAndPlay("move 3");
if (carSelection == 0){
titleMC.shell.gotoAndPlay("move 3 toaster");
};
if (carSelection == 1){
titleMC.shell.gotoAndPlay("move 3 racer");
};
if (carSelection == 2){
titleMC.shell.gotoAndPlay("move 3 camper");
};
SetCarPropulsion();
}
public static function Track03_Over(_arg1:MouseEvent){
titleMC.shell.levelselect.trackrollover.gotoAndStop("level03");
Track_Over(2);
}
public static function Propulsion_Over(){
SFX_Rollover();
if (propulsionHelpCharacter == 0){
titleMC.shell.proprollover.gotoAndPlay("boy");
};
if (propulsionHelpCharacter == 1){
titleMC.shell.proprollover.gotoAndPlay("girl");
};
propulsionHelpCharacter++;
if (propulsionHelpCharacter >= 2){
propulsionHelpCharacter = 0;
};
}
public static function Track04_Pressed(_arg1:MouseEvent){
Game.currentLevel = 3;
Track_Pressed();
}
public static function SFX_Spray(){
SoundPlayer.Play("sfx_colorspray");
}
public static function Track02_Pressed(_arg1:MouseEvent){
Game.currentLevel = 1;
Track_Pressed();
}
public static function buttonAndkonPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.andkon.com/arcade/"), "_blank");
}
public static function Car01_Over(_arg1:MouseEvent){
if (rolledOverID == 0){
return;
};
SFX_Rollover();
rolledOverID = 0;
titleMC.shell.rollover01.gotoAndPlay(2);
titleMC.shell.rollover02.gotoAndStop(1);
titleMC.shell.rollover03.gotoAndStop(1);
titleMC.shell.instructions.visible = false;
}
public static function CarStep1_Complete(){
canPressColorPicker = true;
}
public static function buttonAndkonGuidePressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("guide.html"), "_blank");
}
public static function InitLevelSelect(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local9:int;
var _local10:Level;
var _local11:MovieClip;
var _local12:int;
Mouse.show();
levelSelect_selectedLevel = -1;
SponsorBar(titleMC.sponsorBar);
var _local6 = 650;
_local2 = 30;
_local1 = _local2;
_local3 = 50;
_local4 = 70;
_local5 = 70;
var _local7:int;
var _local8:int;
while (_local8 < 1) {
_local9 = 0;
while (_local9 < Game.levels.length) {
_local10 = Game.GetLevel(_local9);
_local11.name = ("level" + _local9);
_local11.levelID = _local9;
_local11.gotoAndStop(1);
_local11.clipComplete.visible = false;
_local11.clipSelected.visible = false;
_local11.clipLocked.visible = false;
if (_local10.available == false){
_local11.clipLocked.visible = true;
};
if (_local10.complete == true){
_local11.clipComplete.visible = true;
_local12 = Game.GetLevelAward(_local10);
if (_local12 == 0){
_local11.clipComplete.gotoAndStop(1);
};
if (_local12 == 1){
_local11.clipComplete.gotoAndStop(2);
};
if (_local12 == 2){
_local11.clipComplete.gotoAndStop(3);
};
};
_local11.textLevelNumber.text = (_local9 + 1).toString();
_local11.x = _local1;
_local11.y = _local3;
_local11.addEventListener(MouseEvent.CLICK, LevelSelect_buttonNextPressed, false, 0, true);
_local11.addEventListener(MouseEvent.MOUSE_OVER, LevelSelect_levelOver, false, 0, true);
_local11.addEventListener(MouseEvent.MOUSE_OUT, LevelSelect_levelOut, false, 0, true);
_local11.useHandCursor = true;
_local11.buttonMode = true;
titleMC.addChild(_local11);
_local1 = (_local1 + _local4);
if (_local1 > _local6){
if (_local7 == 0){
_local7 = 25;
} else {
_local7 = 0;
};
_local1 = (_local2 + _local7);
_local3 = (_local3 + _local5);
};
_local9++;
};
_local3 = (_local3 + (_local5 + 20));
_local1 = _local2;
_local8++;
};
titleMC.textScore.text = ("Score: " + Game.currentScore);
titleMC.textTrackName.text = "";
titleMC.textStat0.text = "";
titleMC.textStat1.text = "";
LevelSelect_Update();
}
public static function SetCarColor(_arg1:uint, _arg2:int):ColorTransform{
var _local3 = ((_arg1 >> 16) & 0xFF);
var _local4 = ((_arg1 >> 8) & 0xFF);
var _local5 = (_arg1 & 0xFF);
var _local6:ColorTransform = new ColorTransform(1, 1, 1, 1, _local3, _local4, _local5, 0);
if (_arg2 == 0){
titleMC.shell.car01.body.fill.transform.colorTransform = _local6;
};
if (_arg2 == 1){
titleMC.shell.car02.body.fill.transform.colorTransform = _local6;
};
if (_arg2 == 2){
titleMC.shell.car03.body.fill.transform.colorTransform = _local6;
};
return (_local6);
}
public static function AchievementScreen_achievementPressed(_arg1:MouseEvent){
var _local4:MovieClip;
selectedAchievementIndex = _arg1.currentTarget.achID;
var _local2:Achievement = Game.achievements.list[selectedAchievementIndex];
overlayMC.textName.text = _local2.name;
overlayMC.textDescription.text = _local2.description;
var _local3:int;
for each (_local2 in Game.achievements.list) {
_local4 = (overlayMC.getChildByName(("ach" + _local3.toString())) as MovieClip);
if (_local4 != null){
_local4.selectedClip.visible = false;
if (_local3 == selectedAchievementIndex){
_local4.selectedClip.visible = true;
};
};
_local3++;
};
}
public static function Propulsion04_Over(_arg1:MouseEvent){
titleMC.shell.proprollover.text.gotoAndStop("biofuel");
Propulsion_Over();
}
public static function LevelEnd_buttonAchievementsPressed(_arg1:MouseEvent){
InitViewAchievements();
}
public static function Car03_PressedRace(_arg1:MouseEvent){
trace("race");
carSelection = 2;
CarPressedRace();
}
public static function WorldSelect_worldOut(_arg1:MouseEvent){
Game.currentWorldID = -1;
WorldSelect_Update();
titleMC.textInfo.text = "";
}
public static function Car01_Pressed(_arg1:MouseEvent){
trace("customise");
carSelection = 0;
Game.oldSelectedCarColor = origCarColor0;
CarPressed();
}
static function buttonLonganimalsPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.longanimalsgames.com?referal=bike"), "_blank");
}
public static function Car03_Pressed(_arg1:MouseEvent){
carSelection = 2;
Game.oldSelectedCarColor = origCarColor2;
CarPressed();
}
public static function LevelStart_buttonNextPressed(_arg1:MouseEvent){
Game.main.removeChild(titleMC);
titleMC = null;
Game.pause = false;
KeyReader.InitOnce(Game.main.stage);
}
public static function InitLevelFailScreen(){
Mouse.show();
var _local1:Level = Game.GetCurrentLevel();
titleMC.buttonNext.addEventListener(MouseEvent.CLICK, LevelFail_buttonNextPressed, false, 0, true);
titleMC.buttonMainMenu.addEventListener(MouseEvent.CLICK, LevelFail_buttonMenuPressed, false, 0, true);
SponsorBar(titleMC.sponsorBar);
}
public static function LevelSelect_levelOver(_arg1:MouseEvent){
var _local2:int = _arg1.currentTarget.levelID;
levelSelect_selectedLevel = _local2;
Game.currentLevel = _local2;
LevelSelect_Update();
}
public static function Propulsion01_Over(_arg1:MouseEvent){
titleMC.shell.proprollover.text.gotoAndStop("solar");
Propulsion_Over();
}
public static function CarStep3_Complete(){
titleMC.buttonHolder.buttonBack.visible = true;
}
static function LevelSelect_Update(){
var _local1:int;
var _local2:Level;
var _local3:int;
var _local4:String;
var _local5:MovieClip;
if (levelSelect_selectedLevel == -1){
titleMC.textTrackName.text = "";
titleMC.textStat0.text = "";
titleMC.textStat1.text = "";
} else {
_local2 = Game.GetLevel(levelSelect_selectedLevel);
titleMC.textTrackName.text = _local2.name;
titleMC.textStat0.text = "";
titleMC.textStat1.text = "";
if (_local2.complete){
titleMC.textStat0.text = (((((("Best Time: " + Utils.CounterToSecondsString(_local2.bestTimeTotal)) + " ( Gold = ") + Utils.CounterToSecondsString(_local2.goldTime)) + " Silver = ") + Utils.CounterToSecondsString(_local2.silverTime)) + " )");
_local3 = Game.GetLevelAward(_local2);
if (_local3 == 0){
titleMC.textStat1.text = "Bronze Medal";
};
if (_local3 == 1){
titleMC.textStat1.text = "Silver Medal";
};
if (_local3 == 2){
titleMC.textStat1.text = "Gold Medal";
};
} else {
titleMC.textStat0.text = (((("( Gold = " + Utils.CounterToSecondsString(_local2.goldTime)) + " Silver = ") + Utils.CounterToSecondsString(_local2.silverTime)) + " )");
};
};
_local1 = 0;
while (_local1 < Game.levels.length) {
_local4 = ("level" + _local1);
_local5 = (titleMC.getChildByName(_local4) as MovieClip);
if (_local1 == levelSelect_selectedLevel){
_local5.clipSelected.visible = true;
} else {
_local5.clipSelected.visible = false;
};
_local1++;
};
}
public static function buttonGameNinjaPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.gameninja.com"), "_blank");
}
public static function InitLevelStartScreen(){
var _local3:Achievement;
var _local4:TextField;
Mouse.show();
Game.pause = true;
var _local1:Level = Game.GetCurrentLevel();
titleMC.textTitle.text = ("Starting Level " + (Game.currentLevel + 1));
titleMC.textAchievement0.text = "";
titleMC.textAchievement1.text = "";
titleMC.textAchievement2.text = "";
titleMC.complete0.gotoAndStop(1);
titleMC.complete1.gotoAndStop(1);
titleMC.complete2.gotoAndStop(1);
var _local2:int;
for each (_local3 in Game.achievements.list) {
if ((_local3.levelID - 1) == Game.currentLevel){
_local4 = titleMC[("textAchievement" + _local2)];
_local4.text = _local3.name;
_local4.text = (_local4.text + "\n");
_local4.text = (_local4.text + _local3.description);
_local2++;
};
};
titleMC.textBest.text = "Best Time: 1.23";
titleMC.buttonNext.addEventListener(MouseEvent.CLICK, LevelStart_buttonNextPressed, false, 0, true);
}
static function buttonBackPressed(_arg1:MouseEvent){
main.removeChild(titleMC);
titleMC = null;
InitSelector(0, true);
}
static function buttonNickPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.nick.com/kids-choice-awards/kca.jhtml"), "_blank");
}
public static function buttonKongregatePressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.kongregate.com/?gamereferral=cyclomaniacs"), "_blank");
}
static function SponsorBar(_arg1:MovieClip):void{
if (_arg1 == null){
return;
};
_arg1.visible = false;
}
public static function LevelFail_buttonNextPressed(_arg1:MouseEvent){
Mouse.hide();
Game.main.removeChild(titleMC);
titleMC = null;
Game.RestartLevel();
}
public static function SetCarPropulsion(){
if (carSelection == 0){
if (carPropulsion == 0){
titleMC.shell.car01.body.gotoAndStop("solar");
};
if (carPropulsion == 1){
titleMC.shell.car01.body.gotoAndStop("electric");
};
if (carPropulsion == 2){
titleMC.shell.car01.body.gotoAndStop("methane");
};
if (carPropulsion == 3){
titleMC.shell.car01.body.gotoAndStop("bio");
};
};
if (carSelection == 1){
if (carPropulsion == 0){
titleMC.shell.car02.body.gotoAndStop("solar");
};
if (carPropulsion == 1){
titleMC.shell.car02.body.gotoAndStop("electric");
};
if (carPropulsion == 2){
titleMC.shell.car02.body.gotoAndStop("methane");
};
if (carPropulsion == 3){
titleMC.shell.car02.body.gotoAndStop("bio");
};
};
if (carSelection == 2){
if (carPropulsion == 0){
titleMC.shell.car03.body.gotoAndStop("solar");
};
if (carPropulsion == 1){
titleMC.shell.car03.body.gotoAndStop("electric");
};
if (carPropulsion == 2){
titleMC.shell.car03.body.gotoAndStop("methane");
};
if (carPropulsion == 3){
titleMC.shell.car03.body.gotoAndStop("bio");
};
};
}
public static function Track04_Over(_arg1:MouseEvent){
titleMC.shell.levelselect.trackrollover.gotoAndStop("level04");
Track_Over(3);
}
public static function buttonSIKidsPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.sikids.com"), "_blank");
}
public static function LevelFail_buttonMenuPressed(_arg1:MouseEvent){
Game.main.removeChild(titleMC);
titleMC = null;
InitLevelSelect();
}
public static function buttonBubbleBoxPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.bubblebox.com"), "_blank");
}
public static function SponsorBar_moreGamesPressed(_arg1:MouseEvent){
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
navigateToURL(new URLRequest("http://www.kongregate.com/?gamereferral=cyclomaniacs"), "_blank");
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_KIBA){
navigateToURL(new URLRequest("http://www.kongregate.com/?gamereferral=cyclomaniacs"), "_blank");
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_ANDKON){
buttonAndkonPressed(_arg1);
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_BUBBLEBOX){
buttonBubbleBoxPressed(_arg1);
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_SIKIDS){
navigateToURL(new URLRequest("http://www.sikids.com/games"), "_blank");
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_SHOCKWAVE){
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_ARMORGAMES){
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMENINJA){
buttonGameNinjaPressed(_arg1);
};
};
};
};
};
};
};
}
public static function Car02_Over(_arg1:MouseEvent){
if (rolledOverID == 1){
return;
};
SFX_Rollover();
rolledOverID = 1;
titleMC.shell.rollover01.gotoAndStop(1);
titleMC.shell.rollover02.gotoAndPlay(2);
titleMC.shell.rollover03.gotoAndStop(1);
titleMC.shell.instructions.visible = false;
}
public static function KongAIAdClicked(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.kongregate.com/games/Kongregate/Kongai?gamereferral=cyclomaniacs"), "_blank");
}
public static function ExitLevelEndScreen(){
Game.currentScore = panelScoreAmt;
WWorld.EndLevel();
updateLevelEndFlag = false;
main.removeChild(scorePanelMC);
main.removeChild(achievementPanelMC);
achievementPanelMC = null;
scorePanelMC = null;
if (charPopup != null){
main.removeChild(charPopup);
charPopup = null;
};
InitLevelEndScreenOld();
}
public static function buttonEnterCheatsPressed(_arg1:MouseEvent){
}
public static function SprayComplete(){
titleMC.shell.colorpicker.popup.gotoAndPlay(2);
titleMC.shell.colorpicker.popup.addEventListener(MouseEvent.CLICK, SprayComplete1);
Game.oldSelectedCarColor = colorChangeColor1;
canPressColorPicker = true;
}
public static function Track01_Over(_arg1:MouseEvent){
titleMC.shell.levelselect.trackrollover.gotoAndStop("level01");
Track_Over(0);
}
public static function Update(_arg1:Main){
}
public static function buttonKongregateGamePressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.kongregate.com/games/LongAnimals/cyclomaniacs?gamereferral=cyclomaniacs"), "_blank");
}
public static function Track_Pressed(){
if (Game.usedebug == false){
if (Licensors.GetLicensor() == Licensors.LICENSOR_WEBBLIWORLD_LOCKED){
if (Game.GetLevel(Game.currentLevel).available == false){
return;
};
};
};
if (canPressTrack == false){
return;
};
canPressTrack = false;
trace("track pressed");
SFX_Click();
if (doFastTrack == false){
if (carSelection == 0){
titleMC.shell.gotoAndPlay("out");
};
if (carSelection == 1){
titleMC.shell.gotoAndPlay("out racer");
};
if (carSelection == 2){
titleMC.shell.gotoAndPlay("out camper");
};
} else {
if (carSelection == 0){
titleMC.shell.gotoAndPlay("quick race out toaster");
};
if (carSelection == 1){
titleMC.shell.gotoAndPlay("quick race out racer");
};
if (carSelection == 2){
titleMC.shell.gotoAndPlay("quick race out camper");
};
};
}
public static function SetGameCarPropulsion(){
if (carPropulsion == 0){
Game.selectedCarPropulsion = 3;
};
if (carPropulsion == 1){
Game.selectedCarPropulsion = 0;
};
if (carPropulsion == 2){
Game.selectedCarPropulsion = 2;
};
if (carPropulsion == 3){
Game.selectedCarPropulsion = 1;
};
}
public static function InitEndGameScreen(){
}
public static function SponsorBar_cheatsPressed(_arg1:MouseEvent){
SponsorBar_GoToCheatsUrl();
}
public static function buttonStart1Pressed(_arg1:MouseEvent){
}
public static function LevelSelect_levelOut(_arg1:MouseEvent){
levelSelect_selectedLevel = -1;
Game.currentLevel = levelSelect_selectedLevel;
LevelSelect_Update();
}
public static function SFX_Click(){
SoundPlayer.Play("sfx_select");
}
public static function buttonSkipPressed(_arg1:MouseEvent){
titleMC.stop();
main.removeChild(titleMC);
titleMC = null;
MusicPlayer.StartStream(4);
InitLevelSelect();
}
public static function buttonCreditsBackPressed(_arg1:MouseEvent){
Game.main.removeChild(creditsMC);
creditsMC = null;
}
public static function Propulsion02_Pressed(_arg1:MouseEvent){
carPropulsion = 1;
PropulsionPressed();
}
public static function Propulsion04_Pressed(_arg1:MouseEvent){
carPropulsion = 3;
PropulsionPressed();
}
static function instructionsContinuePressed(_arg1:MouseEvent){
var _local2:Level = Game.GetCurrentLevel();
instructionIndex++;
if (instructionIndex > _local2.helpscreenFrames.length){
Game.main.removeChild(instructionsMC);
instructionsMC = null;
showingInstructions = false;
Game.InitLevelState(Game.levelState_Play);
Mouse.hide();
} else {
instructionsMC.gotoAndStop(_local2.helpscreenFrames[instructionIndex]);
instructionsMC.buttonContinue.visible = false;
if (_local2.helpscreenFrames.length > (instructionIndex + 1)){
instructionsMC.buttonContinue.visible = true;
};
instructionsMC.buttonDone.visible = (instructionsMC.buttonContinue.visible == false);
};
}
static function MainLogo(_arg1:MovieClip):void{
_arg1.logoKongregate.visible = false;
_arg1.logoKiba.visible = false;
_arg1.logoBubbleBox.visible = false;
_arg1.logoAndkon.visible = false;
_arg1.logoSIKids.visible = false;
_arg1.logoShockwave.visible = false;
_arg1.logoArmorGames.visible = false;
_arg1.logoMinijuegos.visible = false;
_arg1.logoMousebreaker.visible = false;
_arg1.logoGameNinja.visible = false;
_arg1.logoKongregate.addEventListener(MouseEvent.CLICK, SponsorBar_logoPressed, false, 0, true);
_arg1.logoBubbleBox.addEventListener(MouseEvent.CLICK, SponsorBar_logoPressed, false, 0, true);
_arg1.logoAndkon.addEventListener(MouseEvent.CLICK, SponsorBar_logoPressed, false, 0, true);
_arg1.logoSIKids.addEventListener(MouseEvent.CLICK, SponsorBar_logoPressed, false, 0, true);
_arg1.logoArmorGames.addEventListener(MouseEvent.CLICK, SponsorBar_logoPressed, false, 0, true);
_arg1.logoGameNinja.addEventListener(MouseEvent.CLICK, SponsorBar_logoPressed, false, 0, true);
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
_arg1.logoKongregate.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_KIBA){
_arg1.logoKiba.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_BUBBLEBOX){
_arg1.logoBubbleBox.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_ANDKON){
_arg1.logoAndkon.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_SIKIDS){
_arg1.logoSIKids.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_SHOCKWAVE){
_arg1.logoShockwave.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_ARMORGAMES){
_arg1.logoArmorGames.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_MINIJUEGOS){
_arg1.logoMinijuegos.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_MOUSEBREAKER){
_arg1.logoMousebreaker.visible = true;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMENINJA){
_arg1.logoGameNinja.visible = true;
};
};
};
};
};
};
};
};
};
};
}
public static function Propulsion02_Over(_arg1:MouseEvent){
titleMC.shell.proprollover.text.gotoAndStop("electric");
Propulsion_Over();
}
public static function InitAchievementScreen(){
}
public static function InitSelector(_arg1:int, _arg2:Boolean=false){
if (restart_at_levelselect){
_arg1 = 1;
restart_at_levelselect = false;
};
if (_arg2 == false){
MusicPlayer.StopMusic();
MusicPlayer.StartStream(4);
};
main.InitStage();
titleMC = main.AddMovieClip(1258, 245, new introscreensholder());
titleMC.shell.gotoAndStop("step 1 toaster");
rolledOverID = -1;
doColorChange = false;
titleMC.addEventListener(Event.ENTER_FRAME, UpdateSelector);
titleMC.buttonHolder.buttonMute.visible = true;
titleMC.buttonHolder.buttonBack.visible = false;
titleMC.buttonHolder.buttonQuit.visible = false;
titleMC.buttonHolder.buttonMute.addEventListener(MouseEvent.CLICK, buttonMutePressed, false, 0, true);
titleMC.buttonHolder.buttonBack.addEventListener(MouseEvent.CLICK, buttonBackPressed, false, 0, true);
titleMC.shell.rollover01.gotoAndStop(1);
titleMC.shell.rollover02.gotoAndStop(1);
titleMC.shell.rollover03.gotoAndStop(1);
titleMC.shell.instructions.gotoAndPlay(1);
titleMC.shell.instructions.visible = false;
titleMC.shell.car01.addEventListener(MouseEvent.MOUSE_OVER, Car01_Over, false, 0, true);
titleMC.shell.car02.addEventListener(MouseEvent.MOUSE_OVER, Car02_Over, false, 0, true);
titleMC.shell.car03.addEventListener(MouseEvent.MOUSE_OVER, Car03_Over, false, 0, true);
titleMC.shell.rollover01.panel.buttonRace.addEventListener(MouseEvent.CLICK, Car01_PressedRace, false, 0, true);
titleMC.shell.rollover01.panel.buttonCustomise.addEventListener(MouseEvent.CLICK, Car01_Pressed, false, 0, true);
titleMC.shell.rollover02.panel.buttonRace.addEventListener(MouseEvent.CLICK, Car02_PressedRace, false, 0, true);
titleMC.shell.rollover02.panel.buttonCustomise.addEventListener(MouseEvent.CLICK, Car02_Pressed, false, 0, true);
titleMC.shell.rollover03.panel.buttonRace.addEventListener(MouseEvent.CLICK, Car03_PressedRace, false, 0, true);
titleMC.shell.rollover03.panel.buttonCustomise.addEventListener(MouseEvent.CLICK, Car03_Pressed, false, 0, true);
titleMC.shell.rollover01.panel.buttonRace.addEventListener(MouseEvent.MOUSE_OVER, Race_Over, false, 0, true);
titleMC.shell.rollover01.panel.buttonCustomise.addEventListener(MouseEvent.MOUSE_OVER, Race_Over, false, 0, true);
titleMC.shell.rollover02.panel.buttonRace.addEventListener(MouseEvent.MOUSE_OVER, Race_Over, false, 0, true);
titleMC.shell.rollover02.panel.buttonCustomise.addEventListener(MouseEvent.MOUSE_OVER, Race_Over, false, 0, true);
titleMC.shell.rollover03.panel.buttonRace.addEventListener(MouseEvent.MOUSE_OVER, Race_Over, false, 0, true);
titleMC.shell.rollover03.panel.buttonCustomise.addEventListener(MouseEvent.MOUSE_OVER, Race_Over, false, 0, true);
titleMC.shell.colorpicker.addEventListener(MouseEvent.CLICK, ColorPicker_Pressed, false, 0, true);
titleMC.shell.buttonPropulsion01.addEventListener(MouseEvent.CLICK, Propulsion01_Pressed, false, 0, true);
titleMC.shell.buttonPropulsion02.addEventListener(MouseEvent.CLICK, Propulsion02_Pressed, false, 0, true);
titleMC.shell.buttonPropulsion03.addEventListener(MouseEvent.CLICK, Propulsion03_Pressed, false, 0, true);
titleMC.shell.buttonPropulsion04.addEventListener(MouseEvent.CLICK, Propulsion04_Pressed, false, 0, true);
titleMC.shell.buttonPropulsion01.addEventListener(MouseEvent.MOUSE_OVER, Propulsion01_Over, false, 0, true);
titleMC.shell.buttonPropulsion02.addEventListener(MouseEvent.MOUSE_OVER, Propulsion02_Over, false, 0, true);
titleMC.shell.buttonPropulsion03.addEventListener(MouseEvent.MOUSE_OVER, Propulsion03_Over, false, 0, true);
titleMC.shell.buttonPropulsion04.addEventListener(MouseEvent.MOUSE_OVER, Propulsion04_Over, false, 0, true);
titleMC.shell.buttonPropulsion01.addEventListener(MouseEvent.MOUSE_OUT, Propulsion_Out, false, 0, true);
titleMC.shell.buttonPropulsion02.addEventListener(MouseEvent.MOUSE_OUT, Propulsion_Out, false, 0, true);
titleMC.shell.buttonPropulsion03.addEventListener(MouseEvent.MOUSE_OUT, Propulsion_Out, false, 0, true);
titleMC.shell.buttonPropulsion04.addEventListener(MouseEvent.MOUSE_OUT, Propulsion_Out, false, 0, true);
if (Licensors.GetLicensor() == Licensors.LICENSOR_WEBBLIWORLD_LOCKED){
titleMC.shell.levelselect.gotoAndStop("standard version");
titleMC.foreground.buttonWebbliLogo.useHandCursor = false;
titleMC.shell.levelselect.buttonTrack1.addEventListener(MouseEvent.CLICK, Track01_Pressed, false, 0, true);
titleMC.shell.levelselect.buttonTrack2.addEventListener(MouseEvent.CLICK, Track02_Pressed, false, 0, true);
titleMC.shell.levelselect.buttonTrack3.addEventListener(MouseEvent.CLICK, Track03_Pressed, false, 0, true);
titleMC.shell.levelselect.buttonTrack4.addEventListener(MouseEvent.CLICK, Track04_Pressed, false, 0, true);
titleMC.shell.levelselect.buttonTrack1.addEventListener(MouseEvent.MOUSE_OVER, Track01_Over, false, 0, true);
titleMC.shell.levelselect.buttonTrack2.addEventListener(MouseEvent.MOUSE_OVER, Track02_Over, false, 0, true);
titleMC.shell.levelselect.buttonTrack3.addEventListener(MouseEvent.MOUSE_OVER, Track03_Over, false, 0, true);
titleMC.shell.levelselect.buttonTrack4.addEventListener(MouseEvent.MOUSE_OVER, Track04_Over, false, 0, true);
titleMC.shell.levelselect.buttonTrack1.addEventListener(MouseEvent.MOUSE_OUT, Track_Out, false, 0, true);
titleMC.shell.levelselect.buttonTrack2.addEventListener(MouseEvent.MOUSE_OUT, Track_Out, false, 0, true);
titleMC.shell.levelselect.buttonTrack3.addEventListener(MouseEvent.MOUSE_OUT, Track_Out, false, 0, true);
titleMC.shell.levelselect.buttonTrack4.addEventListener(MouseEvent.MOUSE_OUT, Track_Out, false, 0, true);
titleMC.shell.levelselect.buttonTrack2.gotoAndStop(1);
titleMC.shell.levelselect.buttonTrack3.gotoAndStop(1);
titleMC.shell.levelselect.buttonTrack4.gotoAndStop(1);
if (Game.GetLevel(1).available){
titleMC.shell.levelselect.buttonTrack2.gotoAndStop(6);
};
if (Game.GetLevel(2).available){
titleMC.shell.levelselect.buttonTrack3.gotoAndStop(6);
};
if (Game.GetLevel(3).available){
titleMC.shell.levelselect.buttonTrack4.gotoAndStop(6);
};
} else {
titleMC.shell.levelselect.buttonTrack3.visible = true;
titleMC.shell.levelselect.buttonTrack4.visible = true;
titleMC.shell.levelselect.webbliPopUp.gotoAndPlay("idle");
titleMC.shell.levelselect.webbliPopUp.addEventListener(MouseEvent.CLICK, buttonWebbliworldClicked, false, 0, true);
titleMC.shell.levelselect.webbliPopUp.useHandCursor = true;
titleMC.shell.levelselect.webbliPopUp.buttonMode = true;
webblibuttonActive = false;
titleMC.shell.levelselect.buttonTrack3.addEventListener(MouseEvent.MOUSE_OVER, WebbliButton_Over, false, 0, true);
titleMC.shell.levelselect.buttonTrack4.addEventListener(MouseEvent.MOUSE_OVER, WebbliButton_Over, false, 0, true);
titleMC.shell.levelselect.buttonTrack1.addEventListener(MouseEvent.CLICK, Track01_Pressed, false, 0, true);
titleMC.shell.levelselect.buttonTrack2.addEventListener(MouseEvent.CLICK, Track02_Pressed, false, 0, true);
titleMC.shell.levelselect.buttonTrack1.addEventListener(MouseEvent.MOUSE_OVER, Track01_Over, false, 0, true);
titleMC.shell.levelselect.buttonTrack2.addEventListener(MouseEvent.MOUSE_OVER, Track02_Over, false, 0, true);
titleMC.shell.levelselect.buttonTrack1.addEventListener(MouseEvent.MOUSE_OUT, Track_Out, false, 0, true);
titleMC.shell.levelselect.buttonTrack2.addEventListener(MouseEvent.MOUSE_OUT, Track_Out, false, 0, true);
titleMC.shell.levelselect.buttonTrack2.gotoAndStop(6);
titleMC.foreground.buttonWebbliLogo.addEventListener(MouseEvent.CLICK, buttonWebbliworldClicked, false, 0, true);
titleMC.shell.levelselect.gotoAndStop("seeded version");
};
titleMC.shell.levelselect.challenges.tick0.visible = false;
titleMC.shell.levelselect.challenges.tick1.visible = false;
titleMC.shell.levelselect.challenges.tick2.visible = false;
titleMC.shell.levelselect.challenges.tick3.visible = false;
titleMC.shell.levelselect.challenges.text0.text = "";
titleMC.shell.levelselect.challenges.text1.text = "";
titleMC.shell.levelselect.challenges.text2.text = "";
titleMC.shell.levelselect.challenges.text3.text = "";
titleMC.shell.levelselect.challenges.text0a.text = "";
titleMC.shell.levelselect.challenges.text1a.text = "";
titleMC.shell.levelselect.challenges.text2a.text = "";
titleMC.shell.levelselect.challenges.text3a.text = "";
titleMC.shell.levelselect.challenges.tick0.gotoAndStop(1);
titleMC.shell.levelselect.challenges.tick1.gotoAndStop(1);
titleMC.shell.levelselect.challenges.tick2.gotoAndStop(1);
titleMC.shell.levelselect.challenges.tick3.gotoAndStop(1);
titleMC.shell.levelselect.speechbubble.challengeText.text = "";
titleMC.shell.levelselect.speechbubble.gotoAndStop(1);
canPressColorPicker = true;
propulsionHelpCharacter = 0;
canPressTrack = true;
if (_arg1 == 0){
origCarColor0 = 16723515;
origCarColor1 = 16736704;
origCarColor2 = 0xFF9900;
SetCarColor(origCarColor0, 0);
SetCarColor(origCarColor1, 1);
SetCarColor(origCarColor2, 2);
carPropulsion = 0;
SetGameCarPropulsion();
carSelection = -1;
canPressCar = true;
titleMC.gotoAndStop("step 1");
} else {
titleMC.gotoAndStop("step 4");
titleMC.buttonHolder.buttonBack.visible = true;
SetCarPropulsion();
if (carSelection == 0){
titleMC.shell.gotoAndPlay("move 3 toaster");
SetCarColor(Game.selectedCarColor, 0);
};
if (carSelection == 1){
titleMC.shell.gotoAndPlay("move 3 racer");
SetCarColor(Game.selectedCarColor, 1);
};
if (carSelection == 2){
titleMC.shell.gotoAndPlay("move 3 camper");
SetCarColor(Game.selectedCarColor, 2);
};
doFastTrack = false;
canPressCar = false;
};
trace("here shit");
}
public static function Init(_arg1:Main){
Mouse.show();
main = _arg1;
InitSelector(0);
}
public static function Track03_Pressed(_arg1:MouseEvent){
Game.currentLevel = 2;
Track_Pressed();
}
public static function Track01_Pressed(_arg1:MouseEvent){
Game.currentLevel = 0;
Track_Pressed();
}
static function buttonMutePressed(_arg1:MouseEvent){
SoundPlayer.ToggleMute();
MusicPlayer.ToggleMute();
if (SoundPlayer.doSFX){
titleMC.buttonHolder.buttonMute.gotoAndStop("on");
} else {
titleMC.buttonHolder.buttonMute.gotoAndStop("off");
};
}
public static function WorldSelect_Update(){
var _local1:int;
var _local2:MovieClip;
_local1 = 0;
while (_local1 < 5) {
_local2 = titleMC[("level" + (_local1 + 1).toString())];
_local2.selectedMC.visible = false;
if (_local1 == Game.currentWorldID){
_local2.selectedMC.visible = true;
};
_local1++;
};
}
public static function WebbliButton_Over(_arg1:MouseEvent){
if (webblibuttonActive == false){
titleMC.shell.levelselect.trackrollover.gotoAndStop("exit button");
webblibuttonActive = true;
titleMC.shell.levelselect.webbliPopUp.gotoAndPlay("in");
Track_Over(-1);
};
}
public static function SponsorBar_andkonPressed(_arg1:MouseEvent){
buttonAndkonPressed(_arg1);
}
public static function UpdateLevelEndScreen(){
var _local1:*;
var _local2:Bonus;
Game.QuietAllSounds();
if (updateLevelEndFlag == false){
return;
};
if (mode == 0){
timer--;
if (timer <= 0){
_local1 = levelBonuses[bonusCount];
_local2 = bonuses[_local1];
if (_local2.type == 0){
scorePanelMC.scorePanel.bonusText.textAchievementName.text = "";
scorePanelMC.scorePanel.bonusText.textBonusName.text = _local2.name;
scorePanelMC.scorePanel.bonusText.textBonusScore.text = _local2.points.toString();
} else {
scorePanelMC.scorePanel.bonusText.textAchievementName.text = _local2.name;
scorePanelMC.scorePanel.bonusText.textBonusName.text = "";
scorePanelMC.scorePanel.bonusText.textBonusScore.text = "";
};
scorePanelMC.scorePanel.gotoAndPlay("bonusIn");
mode = 1;
trace(("mode = " + mode));
panelScoreAmtNeeded = (panelScoreAmt + _local2.points);
timer = (Defs.fps * 0.1);
SoundPlayer.Play("sfx_bonus");
};
} else {
if (mode == 1){
timer--;
if (timer <= 0){
timer = (Defs.fps * 3);
mode = 2;
trace(("mode = " + mode));
};
} else {
if (mode == 2){
timer--;
panelScoreAmt = (panelScoreAmt + 30);
if (panelScoreAmt >= panelScoreAmtNeeded){
panelScoreAmt = panelScoreAmtNeeded;
};
if ((((panelScoreAmt >= panelScoreAmtNeeded)) && ((timer <= 0)))){
timer = (Defs.fps * 0.5);
scorePanelMC.scorePanel.gotoAndPlay("bonusOut");
mode = 3;
trace(("mode = " + mode));
};
scorePanelMC.scorePanel.textScore.text = Utils.IntToNumDigits(panelScoreAmt, 6);
Game.panelOverlay.textScore.text = Utils.IntToNumDigits(panelScoreAmt, 6);
} else {
if (mode == 3){
timer--;
if (timer <= 0){
bonusCount++;
if (bonusCount >= bonusCountMax){
mode = 4;
scorePanelMC.gotoAndPlay("off");
timer = (Defs.fps * 1);
} else {
mode = 0;
timer = 1;
};
};
} else {
if (mode == 4){
timer--;
if (timer <= 0){
if (achievementBonuses.length == 0){
ExitLevelEndScreen();
} else {
mode = 10;
currentAch = -1;
};
};
} else {
if (mode == 10){
currentAch++;
if (currentAch >= achievementBonuses.length){
ExitLevelEndScreen();
} else {
achievementPanelMC.panel.gotoAndStop(achievementBonuses[currentAch]);
achievementPanelMC.gotoAndPlay(1);
timer = 100;
mode = 11;
};
} else {
if (mode == 11){
timer--;
if (timer <= 0){
mode = 10;
};
};
};
};
};
};
};
};
}
static function instructionsClosePressed(_arg1:MouseEvent){
Game.main.removeChild(instructionsMC);
instructionsMC = null;
Mouse.hide();
showingInstructions = false;
Game.InitLevelState(Game.levelState_Play);
}
static function AddBonuses(){
var _local1:Achievement;
var _local2:*;
achievementBonuses = new Array();
if (Game.levelAchievementAwarded == 20){
achievementBonuses.push(1);
};
if (Game.levelAchievementAwarded == 21){
achievementBonuses.push(2);
};
if (Game.levelAchievementAwarded == 22){
achievementBonuses.push(3);
};
if (Game.levelAchievementAwarded == 23){
achievementBonuses.push(4);
};
if (Game.challengesAchievementAwarded == 24){
achievementBonuses.push(5);
};
if (Game.challengesAchievementAwarded == 25){
achievementBonuses.push(6);
};
if (Game.challengesAchievementAwarded == 26){
achievementBonuses.push(7);
};
if (Game.challengesAchievementAwarded == 27){
achievementBonuses.push(8);
};
bonuses = new Array();
levelBonuses = new Array();
bonuses.push(new Bonus("First Place", 1000));
bonuses.push(new Bonus("Second Place", 500));
bonuses.push(new Bonus("Third Place", 250));
bonuses.push(new Bonus("Super Skidder Bonus", 1000));
bonuses.push(new Bonus("Coin Collector Bonus", 1000));
bonuses.push(new Bonus("Bumpy Ride Bonus", 1000));
bonuses.push(new Bonus("Super Smasher Bonus", 1000));
bonuses.push(new Bonus("Finished Race", 250));
levelBonuses.push(7);
for each (_local1 in Game.achievements.achievementsAwardedThisTimeList) {
bonuses.push(new Bonus((("Unlocked '" + _local1.name) + "'"), 0, 1));
levelBonuses.push((bonuses.length - 1));
};
_local2 = Game.GetPlaceByCarIndex(Game.playerCarIndex);
if (_local2 == 0){
levelBonuses.push(0);
};
if (_local2 == 1){
levelBonuses.push(1);
};
if (_local2 == 2){
levelBonuses.push(2);
};
var _local3:int = Game.playerTotalSkidDist;
var _local4:int = Game.numPickupsCollected;
var _local5:int = Game.playerTotalSkidDist;
var _local6:int = Game.playerTotalSkidDist;
_local6 = Game.levscore_obstacles;
_local4 = Game.levscore_pickups;
var _local7:int = Game.levscore_skids;
_local5 = Game.levscore_jumps;
if (Game.currentLevel == 0){
if (_local7 >= 125){
levelBonuses.push(3);
};
if (_local4 >= 250){
levelBonuses.push(4);
};
if (_local5 >= 90){
levelBonuses.push(5);
};
if (_local6 >= 200){
levelBonuses.push(6);
};
};
if (Game.currentLevel == 1){
if (_local7 >= 275){
levelBonuses.push(3);
};
if (_local4 >= 500){
levelBonuses.push(4);
};
if (_local5 >= 60){
levelBonuses.push(5);
};
if (_local6 >= 250){
levelBonuses.push(6);
};
};
if (Game.currentLevel == 2){
if (_local7 >= 400){
levelBonuses.push(3);
};
if (_local4 >= 200){
levelBonuses.push(4);
};
if (_local5 >= 500){
levelBonuses.push(5);
};
if (_local6 >= 125){
levelBonuses.push(6);
};
};
if (Game.currentLevel == 3){
if (_local7 >= 1000){
levelBonuses.push(3);
};
if (_local4 >= 200){
levelBonuses.push(4);
};
if (_local5 >= 600){
levelBonuses.push(5);
};
if (_local6 >= 100){
levelBonuses.push(6);
};
};
}
public static function InitLevelEndScreen(){
Game.QuietAllSounds();
trace("HERERER");
AddBonuses();
Mouse.show();
SoundPlayer.Play("sfx_window_appear");
var _local1:Level = Game.GetCurrentLevel();
scorePanelMC = main.AddMovieClip(0, 0, new scorePanelHolder());
achievementPanelMC = main.AddMovieClip(0, 0, new achievementPanel());
achievementPanelMC.stop();
scorePanelMC.gotoAndPlay("start");
panelScoreAmt = Game.currentScore;
scorePanelMC.scorePanel.textScore.text = Utils.IntToNumDigits(panelScoreAmt, 6);
scorePanelMC.scorePanel.gotoAndStop(1);
Game.panelOverlay.textScore.text = Utils.IntToNumDigits(panelScoreAmt, 6);
charPopup = null;
if (Licensors.GetLicensor() == Licensors.LICENSOR_WEBBLIWORLD_VIRAL){
charPopup = new characterpopup();
charPopup.buttonWebbliWorld.addEventListener(MouseEvent.CLICK, buttonWebbliworldClicked, false, 0, true);
main.addChild(charPopup);
charPopup.gotoAndPlay(1);
};
bonusCount = 0;
bonusCountMax = levelBonuses.length;
timer = (Defs.fps * 1);
mode = 0;
updateLevelEndFlag = true;
if ((((bonusCountMax == 0)) && ((achievementBonuses.length == 0)))){
ExitLevelEndScreen();
} else {
if ((((bonusCountMax == 0)) && (!((achievementBonuses.length == 0))))){
mode = 10;
currentAch = -1;
};
};
}
public static function CarStep2_Complete(){
canPressPropulsion = true;
}
public static function Car01_PressedRace(_arg1:MouseEvent){
trace("race");
carSelection = 0;
CarPressedRace();
}
public static function GameOverScreenComplete(){
main.removeChild(titleMC);
titleMC = null;
Game.main.SetGameState(Main.gameState_TITLE);
}
public static function SponsorBar_logoPressed(_arg1:MouseEvent){
if (Licensors.GetLicensor() == Licensors.LICENSOR_KONGREGATE){
navigateToURL(new URLRequest("http://www.kongregate.com/?gamereferral=cyclomaniacs"), "_blank");
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_ANDKON){
buttonAndkonPressed(_arg1);
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_BUBBLEBOX){
buttonBubbleBoxPressed(_arg1);
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_KIBA){
navigateToURL(new URLRequest("http://www.kongregate.com/?gamereferral=cyclomaniacs"), "_blank");
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_SIKIDS){
buttonSIKidsPressed(_arg1);
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_SHOCKWAVE){
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_ARMORGAMES){
buttonArmorGamesPressed(_arg1);
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMENINJA){
buttonGameNinjaPressed(_arg1);
};
};
};
};
};
};
};
};
}
public static function ColorPicker_Pressed(_arg1:MouseEvent){
if (canPressColorPicker == false){
return;
};
SFX_Click();
var _local2:BitmapData = GraphicObjects.GetBitmapData(GraphicObjects.GetIndexByName("ColorPickerClip"), 0);
var _local3:int = (_arg1.localX + 172);
var _local4:int = (_arg1.localY + 85);
if (_local3 < 0){
return;
};
if (_local4 < 0){
return;
};
if (_local3 > _local2.width){
return;
};
if (_local4 > _local2.height){
return;
};
titleMC.shell.colorpicker.gotoAndPlay("spray");
var _local5:uint = (Game.selectedCarColor = _local2.getPixel32(_local3, _local4));
var _local6 = ((_local5 >> 16) & 0xFF);
var _local7 = ((_local5 >> 8) & 0xFF);
var _local8 = (_local5 & 0xFF);
var _local9:ColorTransform = new ColorTransform(1, 1, 1, 1, _local6, _local7, _local8, 0);
titleMC.shell.colorpicker.spray.gotoAndPlay(1);
titleMC.shell.colorpicker.spray.transform.colorTransform = _local9;
canPressColorPicker = false;
}
static function PlayIntro(){
}
public static function Car02_Pressed(_arg1:MouseEvent){
carSelection = 1;
Game.oldSelectedCarColor = origCarColor1;
CarPressed();
}
public static function Car03_Over(_arg1:MouseEvent){
if (rolledOverID == 2){
return;
};
SFX_Rollover();
rolledOverID = 2;
titleMC.shell.rollover01.gotoAndStop(1);
titleMC.shell.rollover02.gotoAndStop(1);
titleMC.shell.rollover03.gotoAndPlay(2);
titleMC.shell.instructions.visible = false;
}
public static function Race_Over(_arg1:MouseEvent){
SFX_Rollover();
}
public static function Track02_Over(_arg1:MouseEvent){
titleMC.shell.levelselect.trackrollover.gotoAndStop("level02");
Track_Over(1);
}
public static function Track_Over(_arg1:int){
var _local3:Array;
var _local4:Achievement;
var _local5:int;
var _local6:*;
var _local7:int;
if ((((webblibuttonActive == true)) && (!((_arg1 == -1))))){
titleMC.shell.levelselect.webbliPopUp.gotoAndPlay("out");
webblibuttonActive = false;
};
SFX_Rollover();
titleMC.shell.levelselect.challenges.tick0.visible = false;
titleMC.shell.levelselect.challenges.tick1.visible = false;
titleMC.shell.levelselect.challenges.tick2.visible = false;
titleMC.shell.levelselect.challenges.tick3.visible = false;
if (_arg1 != -1){
titleMC.shell.levelselect.challenges.tick0.visible = true;
titleMC.shell.levelselect.challenges.tick1.visible = true;
titleMC.shell.levelselect.challenges.tick2.visible = true;
titleMC.shell.levelselect.challenges.tick3.visible = true;
_local3 = Game.achievements.GetThisLevelAchievements(_arg1);
_local4 = _local3[0];
titleMC.shell.levelselect.challenges.text0.text = _local4.name;
titleMC.shell.levelselect.challenges.text0a.text = _local4.description;
titleMC.shell.levelselect.challenges.tick0.gotoAndStop(1);
if (_local4.complete){
titleMC.shell.levelselect.challenges.tick0.gotoAndStop(2);
};
_local4 = _local3[1];
titleMC.shell.levelselect.challenges.text1.text = _local4.name;
titleMC.shell.levelselect.challenges.text1a.text = _local4.description;
titleMC.shell.levelselect.challenges.tick1.gotoAndStop(1);
if (_local4.complete){
titleMC.shell.levelselect.challenges.tick1.gotoAndStop(2);
};
_local4 = _local3[2];
titleMC.shell.levelselect.challenges.text2.text = _local4.name;
titleMC.shell.levelselect.challenges.text2a.text = _local4.description;
titleMC.shell.levelselect.challenges.tick2.gotoAndStop(1);
if (_local4.complete){
titleMC.shell.levelselect.challenges.tick2.gotoAndStop(2);
};
_local4 = _local3[3];
titleMC.shell.levelselect.challenges.text3.text = _local4.name;
titleMC.shell.levelselect.challenges.text3a.text = _local4.description;
titleMC.shell.levelselect.challenges.tick3.gotoAndStop(1);
if (_local4.complete){
titleMC.shell.levelselect.challenges.tick3.gotoAndStop(2);
};
};
var _local2 = "";
if (_arg1 == 0){
_local2 = "Unlocked";
} else {
_local5 = 2;
if (_arg1 == 2){
_local5 = 4;
};
if (_arg1 == 3){
_local5 = 6;
};
_local6 = Game.achievements.GetNumUnlocked();
if (_local6 >= _local5){
_local2 = "Unlocked";
} else {
_local7 = (_local5 - _local6);
if (_local7 == 1){
_local2 = (("Complete " + _local7) + " more challenge to unlock this level");
} else {
_local2 = (("Complete " + _local7) + " more challenges to unlock this level");
};
};
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_WEBBLIWORLD_VIRAL){
_local2 = "Start exploring WebbliWorld now and receive 100 extra coins!";
};
if (_local2 != "Unlocked"){
titleMC.shell.levelselect.speechbubble.challengeText.text = _local2;
titleMC.shell.levelselect.speechbubble.gotoAndPlay(2);
};
}
public static function SFX_Rollover(){
SoundPlayer.Play("sfx_rollover");
}
public static function InitBikeSelect(){
}
public static function StartSpray(){
SFX_Spray();
colorChangeTimer = 0;
colorChangeTimerMax = 25;
colorChangeColor0 = Game.oldSelectedCarColor;
colorChangeColor1 = Game.selectedCarColor;
doColorChange = true;
titleMC.shell.colorpicker.popup.gotoAndStop(1);
}
public static function WorldSelect_worldOver(_arg1:MouseEvent){
var _local2:int = _arg1.currentTarget.worldID;
Game.currentWorldID = _local2;
WorldSelect_Update();
titleMC.textInfo.text = ("World " + (_local2 + 1));
}
public static function buttonClearSaveDataPressed(_arg1:MouseEvent){
SaveData.Clear();
}
public static function MovieFinished(){
Game.InitGame();
main.SetGameState(Main.gameState_LEVEL_PLAY);
}
static function buttonRobotJamPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.robotjamgames.com?referal=bike"), "_blank");
}
public static function SetPercent(){
FlashConnect.trace("Set Percent");
Preloader.UpdateText();
}
public static function buttonStartPressed(_arg1:MouseEvent){
main.removeChild(titleMC);
titleMC = null;
Game.InitGame();
SaveData.Load();
Game.main.SetGameState(Main.gameState_LEVEL_PLAY);
}
public static function WorldSelect_Next(){
var _local1:int;
var _local2:MovieClip;
_local1 = 0;
while (_local1 < 5) {
_local2 = titleMC[("level" + (_local1 + 1).toString())];
_local2.removeEventListener(MouseEvent.CLICK, WorldSelect_worldPressed);
_local2.removeEventListener(MouseEvent.MOUSE_OVER, WorldSelect_worldOver);
_local2.removeEventListener(MouseEvent.MOUSE_OUT, WorldSelect_worldOut);
_local1++;
};
Game.main.removeChild(titleMC);
titleMC = null;
InitLevelSelect();
}
public static function LevelEnd_buttonNextPressed(_arg1:MouseEvent){
Mouse.hide();
Game.main.removeChild(titleMC);
titleMC = null;
Game.NextLevel();
}
public static function WorldSelect_buttonBackPressed(_arg1:MouseEvent){
}
public static function CarPressedRace(){
if (canPressCar == false){
return;
};
SFX_Click();
titleMC.foreground.gotoAndStop("quick race");
if (carSelection == 0){
Game.selectedCarType = 2;
};
if (carSelection == 1){
Game.selectedCarType = 1;
};
if (carSelection == 2){
Game.selectedCarType = 0;
};
if (carSelection == 0){
titleMC.shell.gotoAndPlay("quick race toaster");
};
if (carSelection == 1){
titleMC.shell.gotoAndPlay("quick race racer");
};
if (carSelection == 2){
titleMC.shell.gotoAndPlay("quick race camper");
};
if (carSelection == 0){
Game.selectedCarColor = origCarColor0;
};
if (carSelection == 1){
Game.selectedCarColor = origCarColor1;
};
if (carSelection == 2){
Game.selectedCarColor = origCarColor2;
};
titleMC.gotoAndPlay("move 1");
canPressColorPicker = false;
canPressCar = false;
doFastTrack = true;
titleMC.buttonHolder.buttonBack.visible = true;
}
public static function Propulsion03_Over(_arg1:MouseEvent){
titleMC.shell.proprollover.text.gotoAndStop("methane");
Propulsion_Over();
}
public static function LevelEnd_buttonClosePressed(_arg1:MouseEvent){
main.removeChild(achievementsMC);
achievementsMC = null;
}
public static function CarPressed(){
if (canPressCar == false){
return;
};
SFX_Click();
titleMC.foreground.gotoAndStop("customise");
if (carSelection == 0){
Game.selectedCarType = 2;
};
if (carSelection == 1){
Game.selectedCarType = 1;
};
if (carSelection == 2){
Game.selectedCarType = 0;
};
canPressColorPicker = false;
titleMC.gotoAndPlay("move 1");
if (carSelection == 0){
titleMC.shell.gotoAndPlay("move 1 toaster");
};
if (carSelection == 1){
titleMC.shell.gotoAndPlay("move 1 racer");
};
if (carSelection == 2){
titleMC.shell.gotoAndPlay("move 1 camper");
};
titleMC.shell.colorpicker.gotoAndPlay("idle");
titleMC.shell.colorpicker.spray.gotoAndStop(1);
canPressCar = false;
doFastTrack = false;
}
public static function WorldSelect_worldPressed(_arg1:MouseEvent){
WorldSelect_Next();
}
public static function InitViewAchievements(){
var _local3:Achievement;
var _local4:MovieClip;
Mouse.show();
achievementsMC = main.AddMovieClip(0, 0, new ViewAchievementsScreen());
achievementsMC.buttonClose.addEventListener(MouseEvent.CLICK, LevelEnd_buttonClosePressed, false, 0, true);
var _local1:Number = 40;
var _local2:Number = 60;
for each (_local3 in Game.achievements.list) {
if (_local3.levelID == Game.currentLevel){
_local4 = new SingleAchievementClip();
achievementsMC.addChild(_local4);
_local4.x = _local1;
_local4.y = _local2;
_local4.textTitle.text = _local3.name;
_local4.textDesc.text = _local3.description;
_local2 = (_local2 + 70);
if (_local3.complete){
_local4.gotoAndStop(2);
} else {
_local4.gotoAndStop(1);
};
};
};
}
public static function buttonAchievementsPressed(_arg1:MouseEvent){
InitAchievementScreen();
}
public static function InitLevelEndScreenOld(){
Mouse.show();
InitSelector(1);
}
public static function CarGoneOut(){
RemoveTitleEventListeners();
main.removeChild(titleMC);
titleMC = null;
Game.InitGame();
SaveData.Load();
Game.main.SetGameState(Main.gameState_LEVEL_PLAY);
}
public static function InitWorldSelect(){
var _local1:int;
var _local2:MovieClip;
Mouse.show();
titleMC.textInfo.text = "";
Game.currentWorldID = -1;
_local1 = 0;
while (_local1 < 5) {
_local2 = titleMC[("level" + (_local1 + 1).toString())];
_local2.addEventListener(MouseEvent.CLICK, WorldSelect_worldPressed, false, 0, true);
_local2.addEventListener(MouseEvent.MOUSE_OVER, WorldSelect_worldOver, false, 0, true);
_local2.addEventListener(MouseEvent.MOUSE_OUT, WorldSelect_worldOut, false, 0, true);
_local2.worldID = _local1;
_local2.gotoAndStop((_local1 + 1));
_local2.lock.visible = true;
_local2.selectedMC.visible = false;
_local1++;
};
WorldSelect_Update();
}
static function UpdateSelector(_arg1:Event){
var _local2:uint;
var _local3:uint;
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:uint;
if (doColorChange == true){
colorChangeTimer++;
_local2 = colorChangeColor0;
_local3 = colorChangeColor1;
_local4 = ((_local2 >> 16) & 0xFF);
_local5 = ((_local2 >> 8) & 0xFF);
_local6 = (_local2 & 0xFF);
_local7 = ((_local3 >> 16) & 0xFF);
_local8 = ((_local3 >> 8) & 0xFF);
_local9 = (_local3 & 0xFF);
_local10 = Utils.ScaleTo(_local4, _local7, 0, colorChangeTimerMax, colorChangeTimer);
_local11 = Utils.ScaleTo(_local5, _local8, 0, colorChangeTimerMax, colorChangeTimer);
_local12 = Utils.ScaleTo(_local6, _local9, 0, colorChangeTimerMax, colorChangeTimer);
_local13 = (((uint(_local10) << 16) | (uint(_local11) << 8)) | uint(_local12));
SetCarColor(_local13, carSelection);
if (colorChangeTimer >= colorChangeTimerMax){
doColorChange = false;
};
};
}
public static function Car02_PressedRace(_arg1:MouseEvent){
trace("race");
carSelection = 1;
CarPressedRace();
}
public static function SponsorBar_GoToCheatsUrl(){
if (Licensors.GetLicensor() == Licensors.LICENSOR_BUBBLEBOX){
navigateToURL(new URLRequest("http://www.bubblebox.com/gameinfo/cyclomaniacs.htm"), "_blank");
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_ANDKON){
buttonAndkonGuidePressed(null);
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_SIKIDS){
navigateToURL(new URLRequest("http://www.sikids.com/games/cyclo-maniacs-hints"), "_blank");
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_SHOCKWAVE){
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_ARMORGAMES){
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMENINJA){
navigateToURL(new URLRequest("http://www.gameninja.com/cyclomaniacs-guide.html"), "_blank");
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_MOUSEBREAKER){
navigateToURL(new URLRequest("http://www.mousebreaker.com/games/cyclomaniacsguide/playgame"), "_blank");
} else {
navigateToURL(new URLRequest("http://www.kongregate.com/games/LongAnimals/cyclomaniacs-guide?gamereferral=cyclomaniacs"), "_blank");
};
};
};
};
};
};
};
}
public static function buttonArmorGamesPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.armorgames.com"), "_blank");
}
static function InitLevelInstructions(){
showingInstructions = false;
var _local1:Level = Game.GetCurrentLevel();
if (_local1.helpscreenFrames.length == 0){
Game.InitLevelState(Game.levelState_Play);
return;
};
Mouse.show();
showingInstructions = true;
instructionIndex = 0;
instructionsMC.buttonContinue.addEventListener(MouseEvent.CLICK, instructionsContinuePressed, false, 0, true);
instructionsMC.buttonDone.addEventListener(MouseEvent.CLICK, instructionsClosePressed, false, 0, true);
Game.main.addChild(instructionsMC);
instructionsMC.buttonContinue.visible = false;
if (_local1.helpscreenFrames.length > (instructionIndex + 1)){
instructionsMC.buttonContinue.visible = true;
};
instructionsMC.buttonDone.visible = (instructionsMC.buttonContinue.visible == false);
instructionsMC.visible = true;
instructionsMC.gotoAndStop(_local1.helpscreenFrames[instructionIndex]);
}
public static function Propulsion_Out(_arg1:MouseEvent){
titleMC.shell.proprollover.gotoAndStop(1);
}
}
}//package
Section 221
//trafficlight_clip (trafficlight_clip)
package {
import flash.display.*;
public dynamic class trafficlight_clip extends MovieClip {
}
}//package
Section 222
//tune_0 (tune_0)
package {
import flash.media.*;
public dynamic class tune_0 extends Sound {
}
}//package
Section 223
//tune_1 (tune_1)
package {
import flash.media.*;
public dynamic class tune_1 extends Sound {
}
}//package
Section 224
//tune_menu (tune_menu)
package {
import flash.media.*;
public dynamic class tune_menu extends Sound {
}
}//package
Section 225
//turbo_clip (turbo_clip)
package {
import flash.display.*;
public dynamic class turbo_clip extends MovieClip {
}
}//package
Section 226
//Utils (Utils)
package {
import flash.display.*;
import flash.geom.*;
public class Utils {
public static function IntToNumDigits(_arg1:int, _arg2:int):String{
var _local3:int;
var _local6:int;
var _local4 = 1;
_local3 = 0;
while (_local3 < (_arg2 - 1)) {
_local4 = (_local4 * 10);
_local3++;
};
var _local5 = "";
_local3 = 0;
while (_local3 < _arg2) {
_local6 = (_arg1 / _local4);
_local5 = (_local5 + _local6.toString());
_arg1 = (_arg1 % _local4);
_local4 = (_local4 / 10);
_local3++;
};
return (_local5);
}
public static function PointArrayFromString(_arg1:String):Array{
var _local4:int;
var _local6:Point;
var _local2:Array = new Array();
var _local3:Array = _arg1.split(",");
if ((((_local3.length < 2)) || (((_local3.length % 2) == 1)))){
trace(((("PointArrayFromString. Error, numpoints=" + _local3.length) + " , string= ") + _arg1));
return (_local2);
};
var _local5:int = (_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 static function ScaleTo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Number{
var _local6:Number = (_arg4 - _arg3);
var _local7:Number = (_arg2 - _arg1);
var _local8:Number = ((1 / _local6) * (_arg5 - _arg3));
_local8 = ((_local7 * _local8) + _arg1);
return (_local8);
}
static function DotProduct(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number = ((_arg1 * _arg3) + (_arg2 * _arg4));
return (_local5);
}
static function RenderDotLine(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:int, _arg7:uint):void{
var _local8:int;
var _local9:int = _arg6;
var _local10:Number = ((_arg4 - _arg2) / Number(_local9));
var _local11:Number = ((_arg5 - _arg3) / Number(_local9));
_arg1.setPixel32(int(_arg2), int(_arg3), _arg7);
var _local12:Number = _arg2;
var _local13:Number = _arg3;
_local8 = 0;
while (_local8 < _local9) {
_arg2 = (_arg2 + _local10);
_arg3 = (_arg3 + _local11);
_arg1.setPixel32(int(_arg2), int(_arg3), _arg7);
_local8++;
};
}
static function SideOfLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Boolean{
var _local7:Number = CrossProduct((_arg3 - _arg1), (_arg4 - _arg2), (_arg5 - _arg1), (_arg6 - _arg2));
if (_local7 < 0){
return (false);
};
return (true);
}
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 rgbToHex(_arg1:uint):String{
var _local2:String = _arg1.toString(16);
var _local3:String = ("00000" + _local2);
var _local4:int = _local3.length;
_local3 = _local3.substring((_local4 - 6), _local4);
return (_local3.toUpperCase());
}
public static function DegToRad(_arg1:Number):Number{
return ((((Math.PI * 2) / 360) * _arg1));
}
public static function RadToDeg(_arg1:Number):Number{
return (((360 / (Math.PI * 2)) * _arg1));
}
static function RandBetweenFloat(_arg1:Number, _arg2:Number):Number{
var _local3:Number = (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 = (_arg3 - _arg1);
var _local6:Number = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
public static function GetRGBAString(_arg1:uint):String{
var _local2:uint = ((_arg1 >> 24) & 0xFF);
var _local3:uint = ((_arg1 >> 16) & 0xFF);
var _local4:uint = ((_arg1 >> 8) & 0xFF);
var _local5:uint = (_arg1 & 0xFF);
var _local6:String = ((((((("R:" + _local3) + " G:") + _local4) + " B:") + _local5) + " A:") + _local2);
return (_local6);
}
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 RemoveWhiteSpace(_arg1:String):String{
_arg1 = _arg1.replace(" ", "");
return (_arg1);
}
public static function DP1(_arg1:Number):Number{
var _local2:Number = (Math.ceil((_arg1 * 10)) / 10);
return (_local2);
}
public static function DP2(_arg1:Number):Number{
var _local2:Number = (Math.ceil((_arg1 * 100)) / 100);
return (_local2);
}
public static function NumberToString2DP(_arg1:Number):String{
var _local4:int;
var _local2:String = DP2(_arg1).toString();
var _local3:int = _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 = (Math.random() * ((_arg2 - _arg1) + 1));
_local3 = (_local3 + _arg1);
return (_local3);
}
static function RenderCircle(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:uint):void{
var _local8:int;
var _local10:Number;
var _local11:Number;
var _local6 = 50;
var _local7:Number = ((Math.PI * 2) / _local6);
var _local9:Number = 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++;
};
}
static function CrossProduct(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number = ((_arg1 * _arg4) - (_arg3 * _arg2));
return (_local5);
}
static function DotProductAng(_arg1:Number, _arg2:Number):Number{
var _local3:Number = Math.cos(_arg1);
var _local4:Number = Math.sin(_arg1);
var _local5:Number = Math.cos(_arg2);
var _local6:Number = Math.sin(_arg2);
var _local7:Number = ((_local3 * _local5) + (_local4 * _local6));
return (_local7);
}
public static function RandCircle():Number{
return ((Math.random() * (Math.PI * 2)));
}
public static function CounterToSecondsString(_arg1:int):String{
var _local2 = "";
var _local3:int = (_arg1 / int(Defs.fps));
var _local4:int = (_arg1 % int(Defs.fps));
_local2 = (_local2 + (_local3.toString() + ":"));
var _local5:Number = ((100 / Defs.fps) * Number(_local4));
_local2 = (_local2 + Math.floor(_local5).toString());
return (_local2);
}
static function DistBetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number = (_arg3 - _arg1);
var _local6:Number = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
public static function ScaleBetween(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:Number = ((_arg2 - _arg1) * _arg3);
_local4 = (_arg1 + _local4);
return (_local4);
}
static function Dist2BetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number = (_arg3 - _arg1);
var _local6:Number = (_arg4 - _arg2);
return (((_local5 * _local5) + (_local6 * _local6)));
}
}
}//package
Section 227
//WaveDef (WaveDef)
package {
public class WaveDef {
public var pathID:int;
public var absoluteGenTime:int;
public var gapSeconds:Number;
public var pathType:int;
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 actionLen:Number;
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 228
//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;
currentTime = (currentTime + (_arg1 * Defs.fps));
var _local3:int = 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;
currentTime = (currentTime + (_arg1 * Defs.fps));
var _local4:int = 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 _local15:Number;
var _local16:int;
if ((_arg3 is Array)){
_local13 = (_arg3 as Array);
};
if ((_arg3 is Number)){
_local13 = new Array();
_local13.push(Number(_arg3));
};
var _local14:int = 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 _local4:ShotDef;
var _local3:int = 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 229
//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 = (Math.cos(rot) * speed);
var _local3:Number = (Math.sin(rot) * speed);
var _local4:Number = (Math.cos(_arg1.rot) * _arg1.speed);
var _local5:Number = (Math.sin(_arg1.rot) * _arg1.speed);
var _local6:Number = (_local2 + _local4);
var _local7:Number = (_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;
}
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 = (rot + (Math.PI * 0.5));
var _local2:Point = new Point(Math.cos(_local1), Math.sin(_local1));
return (_local2);
}
public function NearRot(_arg1:Number, _arg2:Number):Boolean{
var _local3:Number = (rot - _arg1);
var _local4:Number = 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 AddRot(_arg1:Number):void{
rot = (rot + _arg1);
NormalizeRot();
}
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 dotRot(_arg1:Number):Number{
var _local2:Number = Math.cos(rot);
var _local3:Number = Math.sin(rot);
var _local4:Number = Math.cos(_arg1);
var _local5:Number = Math.sin(_arg1);
var _local6:Number = ((_local2 * _local4) + (_local3 * _local5));
return (_local6);
}
public function GetUnitYComponent():Number{
return (Math.sin(rot));
}
public function GetUnitXComponent():Number{
return (Math.cos(rot));
}
}
}//package
Section 230
//ViewAchievementsScreen (ViewAchievementsScreen)
package {
import flash.display.*;
public dynamic class ViewAchievementsScreen extends MovieClip {
public var buttonClose:SimpleButton;
}
}//package
Section 231
//WWorld (WWorld)
package {
import flash.display.*;
import org.flashdevelop.utils.*;
public class WWorld {
static var active:Boolean;
static var cb:Function = null;
static function TestAchievement_StartLevel(_arg1:int):int{
if (active == false){
return (-1);
};
var _local2 = -1;
if (_arg1 == 0){
_local2 = 20;
};
if (_arg1 == 1){
_local2 = 21;
};
if (_arg1 == 2){
_local2 = 22;
};
if (_arg1 == 3){
_local2 = 23;
};
if (_local2 == -1){
return (-1);
};
if (webbliWorldGameAPI.playerHasAchievement(_local2)){
return (-1);
};
webbliWorldGameAPI.awardAchievement(_local2);
return (_local2);
}
public static function StartLevel(){
if (active == false){
return;
};
FlashConnect.trace("WW Start Level");
webbliWorldGameAPI.levelStart((Game.currentLevel + 1), Game.currentScore);
}
public static function InitWWApi(_arg1:DisplayObject, _arg2:Function){
var _local3:LoaderInfo;
var _local4:Object;
var _local5:String;
var _local6:String;
cb = _arg2;
active = false;
if (Licensors.GetLicensor() != Licensors.LICENSOR_WEBBLIWORLD_LOCKED){
cb();
return;
};
active = true;
if (active == false){
cb();
} else {
_local3 = _arg1.loaderInfo;
FlashConnect.trace(_local3);
_local4 = _local3.parameters;
_local5 = _local4.userSUID;
FlashConnect.trace("Initialising WW API");
_local6 = Domain.GetDomain(_arg1);
if (_local6 != "webbliworld.com"){
_local5 = "b5bc86dc-2bd4-102d-bfcc-003048d1a1c6";
};
webbliWorldGameAPI.gameStart("42437a4987ebdced", _local5, InitWWApi_Complete, InitWWApi_Error);
};
}
static function InitWWApi_Complete(){
var _local2:Array;
FlashConnect.trace("WW Connection successful");
var _local1 = "";
for each (_local2 in webbliWorldGameAPI.achievements) {
_local1 = _local1.concat((("Achievement ID: " + _local2[0]) + "\n"));
_local1 = _local1.concat((("Achievement Title: " + _local2[1]) + "\n"));
_local1 = _local1.concat((("Achievement Description: " + _local2[2]) + "\n"));
_local1 = _local1.concat(("User has achievement?: " + webbliWorldGameAPI.playerHasAchievement(_local2[0])));
_local1 = _local1.concat("\n\n");
};
cb();
}
public static function IsActive():Boolean{
return (active);
}
static function InitWWApi_Error(){
FlashConnect.trace("WW Connection failed");
active = false;
Game.main.SetGameState(Main.gameState_LOCKED);
}
static function TestAchievement_CompleteAllChallenges(_arg1:int):int{
var _local3:Achievement;
if (active == false){
return (-1);
};
var _local2 = -1;
if (_arg1 == 0){
_local2 = 24;
};
if (_arg1 == 1){
_local2 = 25;
};
if (_arg1 == 2){
_local2 = 26;
};
if (_arg1 == 3){
_local2 = 27;
};
if (_local2 == -1){
return (-1);
};
for each (_local3 in Game.achievements.list) {
if (_local3.levelID == _arg1){
if (_local3.complete == false){
return (-1);
};
};
};
if (webbliWorldGameAPI.playerHasAchievement(_local2)){
return (-1);
};
webbliWorldGameAPI.awardAchievement(_local2);
return (_local2);
}
public static function EndLevel(){
if (active == false){
return;
};
trace("WW End Level");
webbliWorldGameAPI.levelEnd((Game.currentLevel + 1), Game.currentScore);
webbliWorldGameAPI.submitScore(Game.currentScore, (Game.currentLevel + 1), (Game.currentLevel + 1));
}
}
}//package
Section 232
//XmlHelper (XmlHelper)
package {
public class XmlHelper {
public static function GetAttrString(_arg1:Object, _arg2:String=""):String{
var _local3:String = _arg2;
if (_arg1 != undefined){
_local3 = String(_arg1);
};
return (_local3);
}
public static function GetAttrBoolean(_arg1:Object, _arg2:Boolean=false):Boolean{
var _local4:String;
var _local3:Boolean = _arg2;
if (_arg1 != null){
_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 = _arg2;
if (_arg1 != undefined){
_local3 = int(_arg1);
};
return (_local3);
}
public static function GetAttrNumber(_arg1:Object, _arg2:Number=0):Number{
var _local4:String;
var _local3:Number = _arg2;
if (_arg1 != undefined){
_local4 = String(_arg1);
if (_local4.charAt(0) == "%"){
_local4 = _local4.replace("%", "");
_local3 = Number(ExternalData.constants[_local4]);
} else {
_local3 = Number(_arg1);
};
};
return (_local3);
}
}
}//package