STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229595
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2595 · P5190

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/52048352?noj=FRM52048352-22DC" width="1" height="1"></div>

Morphing.swf

This is the info page for
Flash #99897

(Click the ID number above for more basic data on this flash file.)


Text
<p align="center"><font face="BirchCTT" size="24" color="#000000" letterSpacing="0.000000" kerning="1">CLICK TO CONTINUE</font></p>

<p align="left"><font face="Times New Roman" size="14" color="#000000" letterSpacing="0.000000" kerning="1">value</font></p>

<p align="left"><font face="Times New Roman" size="14" color="#000000" letterSpacing="0.000000" kerning="1">caption:</font></p>

PAUSE

CLICK TO CONTINUE

!"#$%&'()*+,-./0123456789:;<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

!"#$%&'()*+,-./0123456789:;<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

!

X

A

M

E

H

T

O

S

E

M

A

G

T

N

R

I

F

ActionScript [AS3]

Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2CircleDef extends b2ShapeDef { public var localPosition:b2Vec2; public var radius:Number; public function b2CircleDef(){ localPosition = new b2Vec2(0, 0); super(); type = b2Shape.e_circleShape; radius = 1; } } }//package Box2D.Collision.Shapes
Section 2
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2CircleShape extends b2Shape { public var m_radius:Number; public var m_localPosition:b2Vec2; public function b2CircleShape(_arg1:b2ShapeDef){ var _local2:b2CircleDef; m_localPosition = new b2Vec2(); super(_arg1); _local2 = (_arg1 as b2CircleDef); m_type = e_circleShape; m_localPosition.SetV(_local2.localPosition); m_radius = _local2.radius; } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local3:b2Mat22; var _local4:Number; var _local5:Number; _local3 = _arg1.R; _local4 = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y))); _local5 = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y))); _local4 = (_arg2.x - _local4); _local5 = (_arg2.y - _local5); return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius))); } public function GetLocalPosition():b2Vec2{ return (m_localPosition); } override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{ var _local6:b2Mat22; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; _local6 = _arg1.R; _local7 = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y))); _local8 = (_arg1.position.y + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y))); _local9 = (_arg4.p1.x - _local7); _local10 = (_arg4.p1.y - _local8); _local11 = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius)); if (_local11 < 0){ return (false); }; _local12 = (_arg4.p2.x - _arg4.p1.x); _local13 = (_arg4.p2.y - _arg4.p1.y); _local14 = ((_local9 * _local12) + (_local10 * _local13)); _local15 = ((_local12 * _local12) + (_local13 * _local13)); _local16 = ((_local14 * _local14) - (_local15 * _local11)); if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){ return (false); }; _local17 = -((_local14 + Math.sqrt(_local16))); if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){ _local17 = (_local17 / _local15); _arg2[0] = _local17; _arg3.x = (_local9 + (_local17 * _local12)); _arg3.y = (_local10 + (_local17 * _local13)); _arg3.Normalize(); return (true); }; return (false); } override public function ComputeMass(_arg1:b2MassData):void{ _arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius); _arg1.center.SetV(m_localPosition); _arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y)))); } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2Mat22; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; _local4 = _arg2.R; _local5 = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y))); _local6 = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y))); _local4 = _arg3.R; _local7 = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y))); _local8 = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y))); _arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius)); _arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius)); } public function GetRadius():Number{ return (m_radius); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:Number; var _local3:Number; _local2 = (m_localPosition.x - _arg1.x); _local3 = (m_localPosition.y - _arg1.y); _local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3))); m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop); } override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22; var _local4:Number; var _local5:Number; _local3 = _arg2.R; _local4 = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y))); _local5 = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y))); _arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius)); _arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius)); } } }//package Box2D.Collision.Shapes
Section 3
//b2FilterData (Box2D.Collision.Shapes.b2FilterData) package Box2D.Collision.Shapes { public class b2FilterData { public var maskBits:uint;// = 0xFFFF public var groupIndex:int;// = 0 public var categoryBits:uint;// = 1 public function b2FilterData(){ categoryBits = 1; maskBits = 0xFFFF; groupIndex = 0; super(); } public function Copy():b2FilterData{ var _local1:b2FilterData; _local1 = new b2FilterData(); _local1.categoryBits = categoryBits; _local1.maskBits = maskBits; _local1.groupIndex = groupIndex; return (_local1); } } }//package Box2D.Collision.Shapes
Section 4
//b2MassData (Box2D.Collision.Shapes.b2MassData) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2MassData { public var mass:Number;// = 0 public var center:b2Vec2; public var I:Number;// = 0 public function b2MassData(){ mass = 0; center = new b2Vec2(0, 0); I = 0; super(); } } }//package Box2D.Collision.Shapes
Section 5
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PolygonDef extends b2ShapeDef { public var vertexCount:int; public var vertices:Array; private static var s_mat:b2Mat22 = new b2Mat22(); public function b2PolygonDef(){ var _local1:int; vertices = new Array(b2Settings.b2_maxPolygonVertices); super(); type = b2Shape.e_polygonShape; vertexCount = 0; _local1 = 0; while (_local1 < b2Settings.b2_maxPolygonVertices) { vertices[_local1] = new b2Vec2(); _local1++; }; } public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{ var _local5:b2Vec2; var _local6:b2Mat22; var _local7:int; vertexCount = 4; vertices[0].Set(-(_arg1), -(_arg2)); vertices[1].Set(_arg1, -(_arg2)); vertices[2].Set(_arg1, _arg2); vertices[3].Set(-(_arg1), _arg2); if (_arg3){ _local5 = _arg3; _local6 = s_mat; _local6.Set(_arg4); _local7 = 0; while (_local7 < vertexCount) { _arg3 = vertices[_local7]; _arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y))); _arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y))); _arg3.x = _arg1; _local7++; }; }; } public function SetAsBox(_arg1:Number, _arg2:Number):void{ vertexCount = 4; vertices[0].Set(-(_arg1), -(_arg2)); vertices[1].Set(_arg1, -(_arg2)); vertices[2].Set(_arg1, _arg2); vertices[3].Set(-(_arg1), _arg2); } } }//package Box2D.Collision.Shapes
Section 6
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolygonShape extends b2Shape { public var m_vertices:Array; public var m_normals:Array; private var s_supportVec:b2Vec2; public var m_obb:b2OBB; public var m_coreVertices:Array; public var m_centroid:b2Vec2; public var m_vertexCount:int; private static var s_computeMat:b2Mat22 = new b2Mat22(); private static var s_sweptAABB1:b2AABB = new b2AABB(); private static var s_sweptAABB2:b2AABB = new b2AABB(); public function b2PolygonShape(_arg1:b2ShapeDef){ var _local2:b2PolygonDef; var _local3:int; var _local4:int; var _local5:int; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; s_supportVec = new b2Vec2(); m_obb = new b2OBB(); m_vertices = new Array(b2Settings.b2_maxPolygonVertices); m_normals = new Array(b2Settings.b2_maxPolygonVertices); m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices); super(_arg1); m_type = e_polygonShape; _local2 = (_arg1 as b2PolygonDef); m_vertexCount = _local2.vertexCount; _local4 = _local3; _local5 = _local3; _local3 = 0; while (_local3 < m_vertexCount) { m_vertices[_local3] = _local2.vertices[_local3].Copy(); _local3++; }; _local3 = 0; while (_local3 < m_vertexCount) { _local4 = _local3; _local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0; _local6 = (m_vertices[_local5].x - m_vertices[_local4].x); _local7 = (m_vertices[_local5].y - m_vertices[_local4].y); _local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7))); m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8)); _local3++; }; m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount); ComputeOBB(m_obb, m_vertices, m_vertexCount); _local3 = 0; while (_local3 < m_vertexCount) { _local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1); _local5 = _local3; _local9 = m_normals[_local4].x; _local10 = m_normals[_local4].y; _local11 = m_normals[_local5].x; _local12 = m_normals[_local5].y; _local13 = (m_vertices[_local3].x - m_centroid.x); _local14 = (m_vertices[_local3].y - m_centroid.y); _local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop); _local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop); _local17 = (1 / ((_local9 * _local12) - (_local10 * _local11))); m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y)); _local3++; }; } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local3:b2Vec2; var _local4:b2Mat22; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:int; var _local10:Number; _local4 = _arg1.R; _local5 = (_arg2.x - _arg1.position.x); _local6 = (_arg2.y - _arg1.position.y); _local7 = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y)); _local8 = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y)); _local9 = 0; while (_local9 < m_vertexCount) { _local3 = m_vertices[_local9]; _local5 = (_local7 - _local3.x); _local6 = (_local8 - _local3.y); _local3 = m_normals[_local9]; _local10 = ((_local3.x * _local5) + (_local3.y * _local6)); if (_local10 > 0){ return (false); }; _local9++; }; return (true); } public function GetCoreVertices():Array{ return (m_coreVertices); } override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{ var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:b2Mat22; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:int; var _local19:int; var _local20:Number; var _local21:Number; _local6 = 0; _local7 = _arg5; _local8 = (_arg4.p1.x - _arg1.position.x); _local9 = (_arg4.p1.y - _arg1.position.y); _local10 = _arg1.R; _local12 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); _local13 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); _local8 = (_arg4.p2.x - _arg1.position.x); _local9 = (_arg4.p2.y - _arg1.position.y); _local10 = _arg1.R; _local14 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); _local15 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); _local16 = (_local14 - _local12); _local17 = (_local15 - _local13); _local18 = -1; _local19 = 0; while (_local19 < m_vertexCount) { _local11 = m_vertices[_local19]; _local8 = (_local11.x - _local12); _local9 = (_local11.y - _local13); _local11 = m_normals[_local19]; _local20 = ((_local11.x * _local8) + (_local11.y * _local9)); _local21 = ((_local11.x * _local16) + (_local11.y * _local17)); if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){ _local6 = (_local20 / _local21); _local18 = _local19; } else { if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){ _local7 = (_local20 / _local21); }; }; if (_local7 < _local6){ return (false); }; _local19++; }; if (_local18 >= 0){ _arg2[0] = _local6; _local10 = _arg1.R; _local11 = m_normals[_local18]; _arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); return (true); }; return (false); } public function GetCentroid():b2Vec2{ return (m_centroid); } override public function ComputeMass(_arg1:b2MassData):void{ var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:int; var _local10:b2Vec2; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; _local2 = 0; _local3 = 0; _local4 = 0; _local5 = 0; _local6 = 0; _local7 = 0; _local8 = (1 / 3); _local9 = 0; while (_local9 < m_vertexCount) { _local10 = m_vertices[_local9]; _local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0]; _local12 = (_local10.x - _local6); _local13 = (_local10.y - _local7); _local14 = (_local11.x - _local6); _local15 = (_local11.y - _local7); _local16 = ((_local12 * _local15) - (_local13 * _local14)); _local17 = (0.5 * _local16); _local4 = (_local4 + _local17); _local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x))); _local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y))); _local18 = _local6; _local19 = _local7; _local20 = _local12; _local21 = _local13; _local22 = _local14; _local23 = _local15; _local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18)); _local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19)); _local5 = (_local5 + (_local16 * (_local24 + _local25))); _local9++; }; _arg1.mass = (m_density * _local4); _local2 = (_local2 * (1 / _local4)); _local3 = (_local3 * (1 / _local4)); _arg1.center.Set(_local2, _local3); _arg1.I = (m_density * _local5); } public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:b2Vec2; var _local5:b2Mat22; var _local6:Number; var _local7:Number; var _local8:int; var _local9:Number; var _local10:int; var _local11:Number; _local5 = _arg1.R; _local6 = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y)); _local7 = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y)); _local8 = 0; _local4 = m_coreVertices[0]; _local9 = ((_local4.x * _local6) + (_local4.y * _local7)); _local10 = 1; while (_local10 < m_vertexCount) { _local4 = m_coreVertices[_local10]; _local11 = ((_local4.x * _local6) + (_local4.y * _local7)); if (_local11 > _local9){ _local8 = _local10; _local9 = _local11; }; _local10++; }; _local5 = _arg1.R; _local4 = m_coreVertices[_local8]; s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y))); s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y))); return (s_supportVec); } public function GetVertexCount():int{ return (m_vertexCount); } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2AABB; var _local5:b2AABB; _local4 = s_sweptAABB1; _local5 = s_sweptAABB2; ComputeAABB(_local4, _arg2); ComputeAABB(_local5, _arg3); _arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y); _arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y); } public function GetVertices():Array{ return (m_vertices); } public function GetNormals():Array{ return (m_normals); } public function GetOBB():b2OBB{ return (m_obb); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, m_coreVertices[0])); } public function Centroid(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, m_centroid)); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:b2Vec2; var _local3:int; var _local4:Number; var _local5:Number; m_sweepRadius = 0; _local3 = 0; while (_local3 < m_vertexCount) { _local2 = m_coreVertices[_local3]; _local4 = (_local2.x - _arg1.x); _local5 = (_local2.y - _arg1.y); _local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5))); if (_local4 > m_sweepRadius){ m_sweepRadius = _local4; }; _local3++; }; } override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22; var _local4:b2Vec2; var _local5:b2Mat22; var _local6:b2Mat22; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; _local5 = s_computeMat; _local3 = _arg2.R; _local4 = m_obb.R.col1; _local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local4 = m_obb.R.col2; _local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local5.Abs(); _local6 = _local5; _local4 = m_obb.extents; _local7 = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y)); _local8 = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y)); _local3 = _arg2.R; _local4 = m_obb.center; _local9 = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y))); _local10 = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y))); _arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8)); _arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8)); } public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{ var _local3:b2Vec2; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:int; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; _local3 = new b2Vec2(); _local4 = 0; _local5 = 0; _local6 = 0; _local7 = (1 / 3); _local8 = 0; while (_local8 < _arg2) { _local9 = _arg1[_local8]; _local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0]; _local11 = (_local9.x - _local5); _local12 = (_local9.y - _local6); _local13 = (_local10.x - _local5); _local14 = (_local10.y - _local6); _local15 = ((_local11 * _local14) - (_local12 * _local13)); _local16 = (0.5 * _local15); _local4 = (_local4 + _local16); _local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x))); _local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y))); _local8++; }; _local3.x = (_local3.x * (1 / _local4)); _local3.y = (_local3.y * (1 / _local4)); return (_local3); } public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{ var _local4:int; var _local5:Array; var _local6:Number; var _local7:b2Vec2; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:int; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:b2Mat22; _local5 = new Array((b2Settings.b2_maxPolygonVertices + 1)); _local4 = 0; while (_local4 < _arg3) { _local5[_local4] = _arg2[_local4]; _local4++; }; _local5[_arg3] = _local5[0]; _local6 = Number.MAX_VALUE; _local4 = 1; while (_local4 <= _arg3) { _local7 = _local5[int((_local4 - 1))]; _local8 = (_local5[_local4].x - _local7.x); _local9 = (_local5[_local4].y - _local7.y); _local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); _local8 = (_local8 / _local10); _local9 = (_local9 / _local10); _local11 = -(_local9); _local12 = _local8; _local13 = Number.MAX_VALUE; _local14 = Number.MAX_VALUE; _local15 = -(Number.MAX_VALUE); _local16 = -(Number.MAX_VALUE); _local17 = 0; while (_local17 < _arg3) { _local19 = (_local5[_local17].x - _local7.x); _local20 = (_local5[_local17].y - _local7.y); _local21 = ((_local8 * _local19) + (_local9 * _local20)); _local22 = ((_local11 * _local19) + (_local12 * _local20)); if (_local21 < _local13){ _local13 = _local21; }; if (_local22 < _local14){ _local14 = _local22; }; if (_local21 > _local15){ _local15 = _local21; }; if (_local22 > _local16){ _local16 = _local22; }; _local17++; }; _local18 = ((_local15 - _local13) * (_local16 - _local14)); if (_local18 < (0.95 * _local6)){ _local6 = _local18; _arg1.R.col1.x = _local8; _arg1.R.col1.y = _local9; _arg1.R.col2.x = _local11; _arg1.R.col2.y = _local12; _local23 = (0.5 * (_local13 + _local15)); _local24 = (0.5 * (_local14 + _local16)); _local25 = _arg1.R; _arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24))); _arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24))); _arg1.extents.x = (0.5 * (_local15 - _local13)); _arg1.extents.y = (0.5 * (_local16 - _local14)); }; _local4++; }; } } }//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; public class b2Shape { public var m_type:int; public var m_sweepRadius:Number; public var m_density:Number; public var m_filter:b2FilterData; public var angle:Number;// = 0 public var m_friction:Number; public var center:b2Vec2; public var m_next:b2Shape; public var m_restitution:Number; public var m_userData; public var m_isSensor:Boolean; public var m_proxyId:uint; public var m_body:b2Body; public static const e_polygonShape:int = 1; public static const e_unknownShape:int = -1; public static const e_circleShape:int = 0; public static const e_shapeTypeCount:int = 2; private static var s_resetAABB:b2AABB = new b2AABB(); private static var s_syncAABB:b2AABB = new b2AABB(); private static var s_proxyAABB:b2AABB = new b2AABB(); public function b2Shape(_arg1:b2ShapeDef){ center = new b2Vec2(0, 0); angle = 0; super(); m_userData = _arg1.userData; m_friction = _arg1.friction; m_restitution = _arg1.restitution; m_density = _arg1.density; m_body = null; m_sweepRadius = 0; m_next = null; m_proxyId = b2Pair.b2_nullProxy; m_filter = _arg1.filter.Copy(); m_isSensor = _arg1.isSensor; } public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ return (false); } public function GetSweepRadius():Number{ return (m_sweepRadius); } public function GetNext():b2Shape{ return (m_next); } public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ } public function GetType():int{ return (m_type); } public function GetRestitution():Number{ return (m_restitution); } public function GetFriction():Number{ return (m_friction); } public function GetFilterData():b2FilterData{ return (m_filter.Copy()); } public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{ return (false); } public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ var _local3:b2AABB; var _local4:Boolean; if (m_proxyId == b2Pair.b2_nullProxy){ return; }; _arg1.DestroyProxy(m_proxyId); _local3 = s_resetAABB; ComputeAABB(_local3, _arg2); _local4 = _arg1.InRange(_local3); if (_local4){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function SetFilterData(_arg1:b2FilterData):void{ m_filter = _arg1.Copy(); } public function GetUserData(){ return (m_userData); } public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{ var _local4:b2AABB; if (m_proxyId == b2Pair.b2_nullProxy){ return (false); }; _local4 = s_syncAABB; ComputeSweptAABB(_local4, _arg2, _arg3); if (_arg1.InRange(_local4)){ _arg1.MoveProxy(m_proxyId, _local4); return (true); }; return (false); } public function ComputeMass(_arg1:b2MassData):void{ } public function IsSensor():Boolean{ return (m_isSensor); } public function DestroyProxy(_arg1:b2BroadPhase):void{ if (m_proxyId != b2Pair.b2_nullProxy){ _arg1.DestroyProxy(m_proxyId); m_proxyId = b2Pair.b2_nullProxy; }; } public function UpdateSweepRadius(_arg1:b2Vec2):void{ } public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ } public function GetBody():b2Body{ return (m_body); } public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ var _local3:b2AABB; var _local4:Boolean; _local3 = s_proxyAABB; ComputeAABB(_local3, _arg2); _local4 = _arg1.InRange(_local3); if (_local4){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function SetUserData(_arg1):void{ m_userData = _arg1; } public static function Destroy(_arg1:b2Shape, _arg2):void{ } public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{ switch (_arg1.type){ case e_circleShape: return (new b2CircleShape(_arg1)); case e_polygonShape: return (new b2PolygonShape(_arg1)); default: return (null); }; } } }//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef) package Box2D.Collision.Shapes { public class b2ShapeDef { public var isSensor:Boolean;// = false public var density:Number;// = 0 public var type:int; public var restitution:Number;// = 0 public var userData;// = null public var filter:b2FilterData; public var friction:Number;// = 0.2 public function b2ShapeDef(){ type = b2Shape.e_unknownShape; userData = null; friction = 0.2; restitution = 0; density = 0; isSensor = false; filter = new b2FilterData(); super(); } } }//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2AABB { public var upperBound:b2Vec2; public var lowerBound:b2Vec2; public function b2AABB(){ lowerBound = new b2Vec2(); upperBound = new b2Vec2(); super(); } public function IsValid():Boolean{ var _local1:Number; var _local2:Number; var _local3:Boolean; _local1 = (upperBound.x - lowerBound.x); _local2 = (upperBound.y - lowerBound.y); _local3 = (((_local1 >= 0)) && ((_local2 >= 0))); _local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid())); return (_local3); } } }//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound) package Box2D.Collision { public class b2Bound { public var proxyId:uint; public var stabbingCount:uint; public var value:uint; public function Swap(_arg1:b2Bound):void{ var _local2:uint; var _local3:uint; var _local4:uint; _local2 = value; _local3 = proxyId; _local4 = stabbingCount; value = _arg1.value; proxyId = _arg1.proxyId; stabbingCount = _arg1.stabbingCount; _arg1.value = _local2; _arg1.proxyId = _local3; _arg1.stabbingCount = _local4; } public function IsLower():Boolean{ return (((value & 1) == 0)); } public function IsUpper():Boolean{ return (((value & 1) == 1)); } } }//package Box2D.Collision
Section 11
//b2BoundValues (Box2D.Collision.b2BoundValues) package Box2D.Collision { public class b2BoundValues { public var lowerValues:Array; public var upperValues:Array; public function b2BoundValues(){ lowerValues = [0, 0]; upperValues = [0, 0]; super(); } } }//package Box2D.Collision
Section 12
//b2BroadPhase (Box2D.Collision.b2BroadPhase) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2BroadPhase { public var m_quantizationFactor:b2Vec2; public var m_worldAABB:b2AABB; public var m_bounds:Array; public var m_freeProxy:uint; public var m_proxyCount:int; public var m_proxyPool:Array; public var m_queryResultCount:int; public var m_pairManager:b2PairManager; public var m_timeStamp:uint; public var m_queryResults:Array; public static const b2_nullEdge:uint = 0xFFFF; public static const b2_invalid:uint = 0xFFFF; public static var s_validate:Boolean = false; public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){ var _local3:int; var _local4:Number; var _local5:Number; var _local6:b2Proxy; var _local7:int; m_pairManager = new b2PairManager(); m_proxyPool = new Array(b2Settings.b2_maxPairs); m_bounds = new Array((2 * b2Settings.b2_maxProxies)); m_queryResults = new Array(b2Settings.b2_maxProxies); m_quantizationFactor = new b2Vec2(); super(); m_pairManager.Initialize(this, _arg2); m_worldAABB = _arg1; m_proxyCount = 0; _local3 = 0; while (_local3 < b2Settings.b2_maxProxies) { m_queryResults[_local3] = 0; _local3++; }; m_bounds = new Array(2); _local3 = 0; while (_local3 < 2) { m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies)); _local7 = 0; while (_local7 < (2 * b2Settings.b2_maxProxies)) { m_bounds[_local3][_local7] = new b2Bound(); _local7++; }; _local3++; }; _local4 = (_arg1.upperBound.x - _arg1.lowerBound.x); _local5 = (_arg1.upperBound.y - _arg1.lowerBound.y); m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4); m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5); _local3 = 0; while (_local3 < (b2Settings.b2_maxProxies - 1)) { _local6 = new b2Proxy(); m_proxyPool[_local3] = _local6; _local6.SetNext((_local3 + 1)); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; _local3++; }; _local6 = new b2Proxy(); m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6; _local6.SetNext(b2Pair.b2_nullProxy); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; m_freeProxy = 0; m_timeStamp = 1; m_queryResultCount = 0; } public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{ var _local4:Array; var _local5:Array; var _local6:uint; var _local7:uint; var _local8:Array; var _local9:Array; var _local10:int; var _local11:int; var _local12:b2Proxy; _local4 = new Array(); _local5 = new Array(); ComputeBounds(_local4, _local5, _arg1); _local8 = [_local6]; _local9 = [_local7]; Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0); Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1); _local10 = 0; _local11 = 0; while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) { _local12 = m_proxyPool[m_queryResults[_local11]]; _arg2[_local11] = _local12.userData; _local11++; _local10++; }; m_queryResultCount = 0; IncrementTimeStamp(); return (_local10); } public function Commit():void{ m_pairManager.Commit(); } public function GetProxy(_arg1:int):b2Proxy{ var _local2:b2Proxy; _local2 = m_proxyPool[_arg1]; if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){ return (null); }; return (_local2); } private function IncrementTimeStamp():void{ var _local1:uint; if (m_timeStamp == b2Settings.USHRT_MAX){ _local1 = 0; while (_local1 < b2Settings.b2_maxProxies) { (m_proxyPool[_local1] as b2Proxy).timeStamp = 0; _local1++; }; m_timeStamp = 1; } else { m_timeStamp++; }; } private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{ var _local8:uint; var _local9:uint; var _local10:b2Bound; var _local11:uint; var _local12:int; var _local13:int; var _local14:b2Proxy; _local8 = BinarySearch(_arg5, _arg6, _arg3); _local9 = BinarySearch(_arg5, _arg6, _arg4); _local11 = _local8; while (_local11 < _local9) { _local10 = _arg5[_local11]; if (_local10.IsLower()){ IncrementOverlapCount(_local10.proxyId); }; _local11++; }; if (_local8 > 0){ _local12 = (_local8 - 1); _local10 = _arg5[_local12]; _local13 = _local10.stabbingCount; while (_local13) { _local10 = _arg5[_local12]; if (_local10.IsLower()){ _local14 = m_proxyPool[_local10.proxyId]; if (_local8 <= _local14.upperBounds[_arg7]){ IncrementOverlapCount(_local10.proxyId); _local13--; }; }; _local12--; }; }; _arg1[0] = _local8; _arg2[0] = _local9; } private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{ var _local3:int; var _local4:Array; var _local5:b2Bound; var _local6:b2Bound; _local3 = 0; while (_local3 < 2) { _local4 = m_bounds[_local3]; _local5 = _local4[_arg1.lowerBounds[_local3]]; _local6 = _local4[_arg2.upperBounds[_local3]]; if (_local5.value > _local6.value){ return (false); }; _local5 = _local4[_arg1.upperBounds[_local3]]; _local6 = _local4[_arg2.lowerBounds[_local3]]; if (_local5.value < _local6.value){ return (false); }; _local3++; }; return (true); } private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{ var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; _local4 = _arg3.lowerBound.x; _local5 = _arg3.lowerBound.y; _local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x); _local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y); _local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x); _local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y); _local6 = _arg3.upperBound.x; _local7 = _arg3.upperBound.y; _local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x); _local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y); _local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x); _local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y); _arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1)); _arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1); _arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1)); _arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1); } public function CreateProxy(_arg1:b2AABB, _arg2):uint{ var _local3:uint; var _local4:b2Proxy; var _local5:uint; var _local6:uint; var _local7:Array; var _local8:Array; var _local9:int; var _local10:int; var _local11:Array; var _local12:uint; var _local13:uint; var _local14:Array; var _local15:Array; var _local16:Array; var _local17:int; var _local18:int; var _local19:b2Bound; var _local20:b2Bound; var _local21:b2Bound; var _local22:int; var _local23:b2Proxy; _local5 = m_freeProxy; _local4 = m_proxyPool[_local5]; m_freeProxy = _local4.GetNext(); _local4.overlapCount = 0; _local4.userData = _arg2; _local6 = (2 * m_proxyCount); _local7 = new Array(); _local8 = new Array(); ComputeBounds(_local7, _local8, _arg1); _local9 = 0; while (_local9 < 2) { _local11 = m_bounds[_local9]; _local14 = [_local12]; _local15 = [_local13]; Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9); _local12 = _local14[0]; _local13 = _local15[0]; _local16 = new Array(); _local18 = (_local6 - _local13); _local17 = 0; while (_local17 < _local18) { _local16[_local17] = new b2Bound(); _local19 = _local16[_local17]; _local20 = _local11[int((_local13 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local22 = (_local13 + 2); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[int((_local22 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local16 = new Array(); _local18 = (_local13 - _local12); _local17 = 0; while (_local17 < _local18) { _local16[_local17] = new b2Bound(); _local19 = _local16[_local17]; _local20 = _local11[int((_local12 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local22 = (_local12 + 1); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[int((_local22 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local13++; _local19 = _local11[_local12]; _local20 = _local11[_local13]; _local19.value = _local7[_local9]; _local19.proxyId = _local5; _local20.value = _local8[_local9]; _local20.proxyId = _local5; _local21 = _local11[int((_local12 - 1))]; _local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount; _local21 = _local11[int((_local13 - 1))]; _local20.stabbingCount = _local21.stabbingCount; _local3 = _local12; while (_local3 < _local13) { _local21 = _local11[_local3]; _local21.stabbingCount++; _local3++; }; _local3 = _local12; while (_local3 < (_local6 + 2)) { _local19 = _local11[_local3]; _local23 = m_proxyPool[_local19.proxyId]; if (_local19.IsLower()){ _local23.lowerBounds[_local9] = _local3; } else { _local23.upperBounds[_local9] = _local3; }; _local3++; }; _local9++; }; m_proxyCount++; _local10 = 0; while (_local10 < m_queryResultCount) { m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]); _local10++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); return (_local5); } public function DestroyProxy(_arg1:uint):void{ var _local2:b2Bound; var _local3:b2Bound; var _local4:b2Proxy; var _local5:int; var _local6:int; var _local7:int; var _local8:Array; var _local9:uint; var _local10:uint; var _local11:uint; var _local12:uint; var _local13:Array; var _local14:int; var _local15:int; var _local16:int; var _local17:uint; var _local18:int; var _local19:b2Proxy; _local4 = m_proxyPool[_arg1]; _local5 = (2 * m_proxyCount); _local6 = 0; while (_local6 < 2) { _local8 = m_bounds[_local6]; _local9 = _local4.lowerBounds[_local6]; _local10 = _local4.upperBounds[_local6]; _local2 = _local8[_local9]; _local11 = _local2.value; _local3 = _local8[_local10]; _local12 = _local3.value; _local13 = new Array(); _local15 = ((_local10 - _local9) - 1); _local14 = 0; while (_local14 < _local15) { _local13[_local14] = new b2Bound(); _local2 = _local13[_local14]; _local3 = _local8[int(((_local9 + 1) + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = _local13.length; _local16 = _local9; _local14 = 0; while (_local14 < _local15) { _local3 = _local13[_local14]; _local2 = _local8[int((_local16 + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local13 = new Array(); _local15 = ((_local5 - _local10) - 1); _local14 = 0; while (_local14 < _local15) { _local13[_local14] = new b2Bound(); _local2 = _local13[_local14]; _local3 = _local8[int(((_local10 + 1) + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = _local13.length; _local16 = (_local10 - 1); _local14 = 0; while (_local14 < _local15) { _local3 = _local13[_local14]; _local2 = _local8[int((_local16 + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = (_local5 - 2); _local17 = _local9; while (_local17 < _local15) { _local2 = _local8[_local17]; _local19 = m_proxyPool[_local2.proxyId]; if (_local2.IsLower()){ _local19.lowerBounds[_local6] = _local17; } else { _local19.upperBounds[_local6] = _local17; }; _local17++; }; _local15 = (_local10 - 1); _local18 = _local9; while (_local18 < _local15) { _local2 = _local8[_local18]; _local2.stabbingCount--; _local18++; }; Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6); _local6++; }; _local7 = 0; while (_local7 < m_queryResultCount) { m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]); _local7++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); _local4.userData = null; _local4.overlapCount = b2_invalid; _local4.lowerBounds[0] = b2_invalid; _local4.lowerBounds[1] = b2_invalid; _local4.upperBounds[0] = b2_invalid; _local4.upperBounds[1] = b2_invalid; _local4.SetNext(m_freeProxy); m_freeProxy = _arg1; m_proxyCount--; } public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{ var _local3:int; var _local4:Array; var _local5:b2Bound; _local3 = 0; while (_local3 < 2) { _local4 = m_bounds[_local3]; _local5 = _local4[_arg2.upperBounds[_local3]]; if (_arg1.lowerValues[_local3] > _local5.value){ return (false); }; _local5 = _local4[_arg2.lowerBounds[_local3]]; if (_arg1.upperValues[_local3] < _local5.value){ return (false); }; _local3++; }; return (true); } public function Validate():void{ var _local1:b2Pair; var _local2:b2Proxy; var _local3:b2Proxy; var _local4:Boolean; var _local5:int; var _local6:b2Bound; var _local7:uint; var _local8:uint; var _local9:uint; var _local10:b2Bound; _local5 = 0; while (_local5 < 2) { _local6 = m_bounds[_local5]; _local7 = (2 * m_proxyCount); _local8 = 0; _local9 = 0; while (_local9 < _local7) { _local10 = _local6[_local9]; if (_local10.IsLower() == true){ _local8++; } else { _local8--; }; _local9++; }; _local5++; }; } private function IncrementOverlapCount(_arg1:uint):void{ var _local2:b2Proxy; _local2 = m_proxyPool[_arg1]; if (_local2.timeStamp < m_timeStamp){ _local2.timeStamp = m_timeStamp; _local2.overlapCount = 1; } else { _local2.overlapCount = 2; m_queryResults[m_queryResultCount] = _arg1; m_queryResultCount++; }; } public function InRange(_arg1:b2AABB):Boolean{ var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; _local2 = _arg1.lowerBound.x; _local3 = _arg1.lowerBound.y; _local2 = (_local2 - m_worldAABB.upperBound.x); _local3 = (_local3 - m_worldAABB.upperBound.y); _local4 = m_worldAABB.lowerBound.x; _local5 = m_worldAABB.lowerBound.y; _local4 = (_local4 - _arg1.upperBound.x); _local5 = (_local5 - _arg1.upperBound.y); _local2 = b2Math.b2Max(_local2, _local4); _local3 = b2Math.b2Max(_local3, _local5); return ((b2Math.b2Max(_local2, _local3) < 0)); } public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{ var _local3:Array; var _local4:int; var _local5:uint; var _local6:uint; var _local7:b2Bound; var _local8:b2Bound; var _local9:b2Bound; var _local10:uint; var _local11:b2Proxy; var _local12:uint; var _local13:b2Proxy; var _local14:b2BoundValues; var _local15:b2BoundValues; var _local16:Array; var _local17:uint; var _local18:uint; var _local19:uint; var _local20:uint; var _local21:int; var _local22:int; var _local23:uint; var _local24:b2Proxy; if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){ return; }; if (_arg2.IsValid() == false){ return; }; _local12 = (2 * m_proxyCount); _local13 = m_proxyPool[_arg1]; _local14 = new b2BoundValues(); ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2); _local15 = new b2BoundValues(); _local5 = 0; while (_local5 < 2) { _local7 = m_bounds[_local5][_local13.lowerBounds[_local5]]; _local15.lowerValues[_local5] = _local7.value; _local7 = m_bounds[_local5][_local13.upperBounds[_local5]]; _local15.upperValues[_local5] = _local7.value; _local5++; }; _local5 = 0; while (_local5 < 2) { _local16 = m_bounds[_local5]; _local17 = _local13.lowerBounds[_local5]; _local18 = _local13.upperBounds[_local5]; _local19 = _local14.lowerValues[_local5]; _local20 = _local14.upperValues[_local5]; _local7 = _local16[_local17]; _local21 = (_local19 - _local7.value); _local7.value = _local19; _local7 = _local16[_local18]; _local22 = (_local20 - _local7.value); _local7.value = _local20; if (_local21 < 0){ _local6 = _local17; while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) { _local7 = _local16[_local6]; _local8 = _local16[int((_local6 - 1))]; _local23 = _local8.proxyId; _local24 = m_proxyPool[_local8.proxyId]; _local8.stabbingCount++; if (_local8.IsUpper() == true){ if (TestOverlap(_local14, _local24)){ m_pairManager.AddBufferedPair(_arg1, _local23); }; _local3 = _local24.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount++; } else { _local3 = _local24.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount--; }; _local3 = _local13.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.Swap(_local8); _local6--; }; }; if (_local22 > 0){ _local6 = _local18; while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) { _local7 = _local16[_local6]; _local9 = _local16[int((_local6 + 1))]; _local10 = _local9.proxyId; _local11 = m_proxyPool[_local10]; _local9.stabbingCount++; if (_local9.IsLower() == true){ if (TestOverlap(_local14, _local11)){ m_pairManager.AddBufferedPair(_arg1, _local10); }; _local3 = _local11.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount++; } else { _local3 = _local11.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount--; }; _local3 = _local13.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.Swap(_local9); _local6++; }; }; if (_local21 > 0){ _local6 = _local17; while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) { _local7 = _local16[_local6]; _local9 = _local16[int((_local6 + 1))]; _local10 = _local9.proxyId; _local11 = m_proxyPool[_local10]; _local9.stabbingCount--; if (_local9.IsUpper()){ if (TestOverlap(_local15, _local11)){ m_pairManager.RemoveBufferedPair(_arg1, _local10); }; _local3 = _local11.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount--; } else { _local3 = _local11.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount++; }; _local3 = _local13.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.Swap(_local9); _local6++; }; }; if (_local22 < 0){ _local6 = _local18; while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) { _local7 = _local16[_local6]; _local8 = _local16[int((_local6 - 1))]; _local23 = _local8.proxyId; _local24 = m_proxyPool[_local23]; _local8.stabbingCount--; if (_local8.IsLower() == true){ if (TestOverlap(_local15, _local24)){ m_pairManager.RemoveBufferedPair(_arg1, _local23); }; _local3 = _local24.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount--; } else { _local3 = _local24.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount++; }; _local3 = _local13.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.Swap(_local8); _local6--; }; }; _local5++; }; } public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{ var _local4:int; var _local5:int; var _local6:int; var _local7:b2Bound; _local4 = 0; _local5 = (_arg2 - 1); while (_local4 <= _local5) { _local6 = ((_local4 + _local5) / 2); _local7 = _arg1[_local6]; if (_local7.value > _arg3){ _local5 = (_local6 - 1); } else { if (_local7.value < _arg3){ _local4 = (_local6 + 1); } else { return (uint(_local6)); }; }; }; return (uint(_local4)); } } }//package Box2D.Collision
Section 13
//b2BufferedPair (Box2D.Collision.b2BufferedPair) package Box2D.Collision { public class b2BufferedPair { public var proxyId1:uint; public var proxyId2:uint; } }//package Box2D.Collision
Section 14
//b2Collision (Box2D.Collision.b2Collision) package Box2D.Collision { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Collision { public static const b2_nullFeature:uint = 0xFF; private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2(); public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{ var _local6:int; var _local7:Array; var _local8:Array; var _local9:int; var _local10:Array; var _local11:b2Mat22; var _local12:b2Vec2; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:int; var _local18:Number; var _local19:int; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; _local6 = _arg1.m_vertexCount; _local7 = _arg1.m_vertices; _local8 = _arg1.m_normals; _local9 = _arg4.m_vertexCount; _local10 = _arg4.m_vertices; _local11 = _arg2.R; _local12 = _local8[_arg3]; _local13 = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)); _local14 = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)); _local11 = _arg5.R; _local15 = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14)); _local16 = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14)); _local17 = 0; _local18 = Number.MAX_VALUE; _local19 = 0; while (_local19 < _local9) { _local12 = _local10[_local19]; _local25 = ((_local12.x * _local15) + (_local12.y * _local16)); if (_local25 < _local18){ _local18 = _local25; _local17 = _local19; }; _local19++; }; _local12 = _local7[_arg3]; _local11 = _arg2.R; _local20 = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y))); _local21 = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y))); _local12 = _local10[_local17]; _local11 = _arg5.R; _local22 = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y))); _local23 = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y))); _local22 = (_local22 - _local20); _local23 = (_local23 - _local21); _local24 = ((_local22 * _local13) + (_local23 * _local14)); return (_local24); } public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{ var _local3:b2Vec2; var _local4:b2Vec2; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; _local3 = _arg2.lowerBound; _local4 = _arg1.upperBound; _local5 = (_local3.x - _local4.x); _local6 = (_local3.y - _local4.y); _local3 = _arg1.lowerBound; _local4 = _arg2.upperBound; _local7 = (_local3.x - _local4.x); _local8 = (_local3.y - _local4.y); if ((((_local5 > 0)) || ((_local6 > 0)))){ return (false); }; if ((((_local7 > 0)) || ((_local8 > 0)))){ return (false); }; return (true); } public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{ var _local7:int; var _local8:Array; var _local9:int; var _local10:Array; var _local11:Array; var _local12:b2Mat22; var _local13:b2Vec2; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:int; var _local18:Number; var _local19:int; var _local20:ClipVertex; var _local21:int; var _local22:int; var _local23:Number; _local7 = _arg2.m_vertexCount; _local8 = _arg2.m_normals; _local9 = _arg5.m_vertexCount; _local10 = _arg5.m_vertices; _local11 = _arg5.m_normals; _local12 = _arg3.R; _local13 = _local8[_arg4]; _local14 = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)); _local15 = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)); _local12 = _arg6.R; _local16 = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15)); _local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15)); _local14 = _local16; _local17 = 0; _local18 = Number.MAX_VALUE; _local19 = 0; while (_local19 < _local9) { _local13 = _local11[_local19]; _local23 = ((_local14 * _local13.x) + (_local15 * _local13.y)); if (_local23 < _local18){ _local18 = _local23; _local17 = _local19; }; _local19++; }; _local21 = _local17; _local22 = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0; _local20 = _arg1[0]; _local13 = _local10[_local21]; _local12 = _arg6.R; _local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y))); _local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y))); _local20.id.features.referenceEdge = _arg4; _local20.id.features.incidentEdge = _local21; _local20.id.features.incidentVertex = 0; _local20 = _arg1[1]; _local13 = _local10[_local22]; _local12 = _arg6.R; _local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y))); _local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y))); _local20.id.features.referenceEdge = _arg4; _local20.id.features.incidentEdge = _local22; _local20.id.features.incidentVertex = 1; } public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{ var _local6:ClipVertex; var _local7:int; var _local8:Array; var _local9:Number; var _local10:int; var _local11:Array; var _local12:Number; var _local13:b2PolygonShape; var _local14:b2PolygonShape; var _local15:b2XForm; var _local16:b2XForm; var _local17:int; var _local18:uint; var _local19:Number; var _local20:Number; var _local21:Array; var _local22:int; var _local23:Array; var _local24:b2Vec2; var _local25:b2Vec2; var _local26:b2Vec2; var _local27:b2Vec2; var _local28:b2Vec2; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Array; var _local33:Array; var _local34:int; var _local35:int; var _local36:int; var _local37:b2Vec2; var _local38:Number; var _local39:b2ManifoldPoint; _arg1.pointCount = 0; _local7 = 0; _local8 = [_local7]; _local9 = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5); _local7 = _local8[0]; if (_local9 > 0){ return; }; _local10 = 0; _local11 = [_local10]; _local12 = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3); _local10 = _local11[0]; if (_local12 > 0){ return; }; _local15 = new b2XForm(); _local16 = new b2XForm(); _local19 = 0.98; _local20 = 0.001; if (_local12 > ((_local19 * _local9) + _local20)){ _local13 = _arg4; _local14 = _arg2; _local15.Set(_arg5); _local16.Set(_arg3); _local17 = _local10; _local18 = 1; } else { _local13 = _arg2; _local14 = _arg4; _local15.Set(_arg3); _local16.Set(_arg5); _local17 = _local7; _local18 = 0; }; _local21 = [new ClipVertex(), new ClipVertex()]; FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16); _local22 = _local13.m_vertexCount; _local23 = _local13.m_vertices; _local24 = _local23[_local17]; _local25 = _local24.Copy(); if ((_local17 + 1) < _local22){ _local24 = _local23[int((_local17 + 1))]; _local37 = _local24.Copy(); } else { _local24 = _local23[0]; _local37 = _local24.Copy(); }; _local26 = b2Math.SubtractVV(_local37, _local25); _local27 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25)); _local27.Normalize(); _local28 = b2Math.b2CrossVF(_local27, 1); _local25 = b2Math.b2MulX(_local15, _local25); _local37 = b2Math.b2MulX(_local15, _local37); _local29 = b2Math.b2Dot(_local28, _local25); _local30 = -(b2Math.b2Dot(_local27, _local25)); _local31 = b2Math.b2Dot(_local27, _local37); _local32 = [new ClipVertex(), new ClipVertex()]; _local33 = [new ClipVertex(), new ClipVertex()]; _local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30); if (_local34 < 2){ return; }; _local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31); if (_local34 < 2){ return; }; _arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy(); _local35 = 0; _local36 = 0; while (_local36 < b2Settings.b2_maxManifoldPoints) { _local6 = _local33[_local36]; _local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29); if (_local38 <= 0){ _local39 = _arg1.points[_local35]; _local39.separation = _local38; _local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v); _local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v); _local39.id.key = _local6.id._key; _local39.id.features.flip = _local18; _local35++; }; _local36++; }; _arg1.pointCount = _local35; } public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{ var _local6:int; var _local7:Array; var _local8:b2Vec2; var _local9:b2Mat22; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:int; var _local15:Number; var _local16:int; var _local17:Number; var _local18:int; var _local19:Number; var _local20:int; var _local21:Number; var _local22:int; var _local23:Number; var _local24:int; var _local25:Number; _local6 = _arg2.m_vertexCount; _local7 = _arg2.m_normals; _local9 = _arg5.R; _local8 = _arg4.m_centroid; _local10 = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))); _local11 = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))); _local9 = _arg3.R; _local8 = _arg2.m_centroid; _local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)))); _local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)))); _local12 = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y)); _local13 = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y)); _local14 = 0; _local15 = -(Number.MAX_VALUE); _local16 = 0; while (_local16 < _local6) { _local8 = _local7[_local16]; _local25 = ((_local8.x * _local12) + (_local8.y * _local13)); if (_local25 > _local15){ _local15 = _local25; _local14 = _local16; }; _local16++; }; _local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5); if (_local17 > 0){ return (_local17); }; _local18 = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1); _local19 = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5); if (_local19 > 0){ return (_local19); }; _local20 = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0; _local21 = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5); if (_local21 > 0){ return (_local21); }; if ((((_local19 > _local17)) && ((_local19 > _local21)))){ _local24 = -1; _local22 = _local18; _local23 = _local19; } else { if (_local21 > _local17){ _local24 = 1; _local22 = _local20; _local23 = _local21; } else { _arg1[0] = _local14; return (_local17); }; }; while (true) { if (_local24 == -1){ _local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1); } else { _local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0; }; _local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5); if (_local17 > 0){ return (_local17); }; if (_local17 > _local23){ _local22 = _local14; _local23 = _local17; } else { break; }; }; _arg1[0] = _local22; return (_local23); } public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{ var _local5:ClipVertex; var _local6:int; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:b2Vec2; var _local13:ClipVertex; _local6 = 0; _local5 = _arg2[0]; _local7 = _local5.v; _local5 = _arg2[1]; _local8 = _local5.v; _local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4); _local10 = (b2Math.b2Dot(_arg3, _local8) - _arg4); if (_local9 <= 0){ var _temp1 = _local6; _local6 = (_local6 + 1); var _local14 = _temp1; _arg1[_local14] = _arg2[0]; }; if (_local10 <= 0){ var _temp2 = _local6; _local6 = (_local6 + 1); _local14 = _temp2; _arg1[_local14] = _arg2[1]; }; if ((_local9 * _local10) < 0){ _local11 = (_local9 / (_local9 - _local10)); _local5 = _arg1[_local6]; _local12 = _local5.v; _local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x))); _local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y))); _local5 = _arg1[_local6]; if (_local9 > 0){ _local13 = _arg2[0]; _local5.id = _local13.id; } else { _local13 = _arg2[1]; _local5.id = _local13.id; }; _local6++; }; return (_local6); } public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{ var _local6:b2Mat22; var _local7:b2Vec2; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:b2ManifoldPoint; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; _arg1.pointCount = 0; _local6 = _arg3.R; _local7 = _arg2.m_localPosition; _local8 = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y))); _local9 = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y))); _local6 = _arg5.R; _local7 = _arg4.m_localPosition; _local10 = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y))); _local11 = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y))); _local12 = (_local10 - _local8); _local13 = (_local11 - _local9); _local14 = ((_local12 * _local12) + (_local13 * _local13)); _local15 = _arg2.m_radius; _local16 = _arg4.m_radius; _local17 = (_local15 + _local16); if (_local14 > (_local17 * _local17)){ return; }; if (_local14 < Number.MIN_VALUE){ _local18 = -(_local17); _arg1.normal.Set(0, 1); } else { _local24 = Math.sqrt(_local14); _local18 = (_local24 - _local17); _local25 = (1 / _local24); _arg1.normal.x = (_local25 * _local12); _arg1.normal.y = (_local25 * _local13); }; _arg1.pointCount = 1; _local19 = _arg1.points[0]; _local19.id.key = 0; _local19.separation = _local18; _local8 = (_local8 + (_local15 * _arg1.normal.x)); _local9 = (_local9 + (_local15 * _arg1.normal.y)); _local10 = (_local10 - (_local16 * _arg1.normal.x)); _local11 = (_local11 - (_local16 * _arg1.normal.y)); _local20 = (0.5 * (_local8 + _local10)); _local21 = (0.5 * (_local9 + _local11)); _local22 = (_local20 - _arg3.position.x); _local23 = (_local21 - _arg3.position.y); _local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y)); _local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y)); _local22 = (_local20 - _arg5.position.x); _local23 = (_local21 - _arg5.position.y); _local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y)); _local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y)); } public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{ var _local6:b2ManifoldPoint; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:b2Vec2; var _local12:b2Mat22; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:int; var _local19:Number; var _local20:Number; var _local21:int; var _local22:Array; var _local23:Array; var _local24:int; var _local25:int; var _local26:int; var _local27:b2Vec2; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; _arg1.pointCount = 0; _local12 = _arg5.R; _local11 = _arg4.m_localPosition; _local13 = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y))); _local14 = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y))); _local7 = (_local13 - _arg3.position.x); _local8 = (_local14 - _arg3.position.y); _local12 = _arg3.R; _local15 = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local16 = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local18 = 0; _local19 = -(Number.MAX_VALUE); _local20 = _arg4.m_radius; _local21 = _arg2.m_vertexCount; _local22 = _arg2.m_vertices; _local23 = _arg2.m_normals; _local24 = 0; while (_local24 < _local21) { _local11 = _local22[_local24]; _local7 = (_local15 - _local11.x); _local8 = (_local16 - _local11.y); _local11 = _local23[_local24]; _local34 = ((_local11.x * _local7) + (_local11.y * _local8)); if (_local34 > _local20){ return; }; if (_local34 > _local19){ _local19 = _local34; _local18 = _local24; }; _local24++; }; if (_local19 < Number.MIN_VALUE){ _arg1.pointCount = 1; _local11 = _local23[_local18]; _local12 = _arg3.R; _arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)); _arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)); _local6 = _arg1.points[0]; _local6.id.features.incidentEdge = _local18; _local6.id.features.incidentVertex = b2_nullFeature; _local6.id.features.referenceEdge = 0; _local6.id.features.flip = 0; _local9 = (_local13 - (_local20 * _arg1.normal.x)); _local10 = (_local14 - (_local20 * _arg1.normal.y)); _local7 = (_local9 - _arg3.position.x); _local8 = (_local10 - _arg3.position.y); _local12 = _arg3.R; _local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local7 = (_local9 - _arg5.position.x); _local8 = (_local10 - _arg5.position.y); _local12 = _arg5.R; _local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local6.separation = (_local19 - _local20); return; }; _local25 = _local18; _local26 = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0; _local11 = _local22[_local25]; _local27 = _local22[_local26]; _local28 = (_local27.x - _local11.x); _local29 = (_local27.y - _local11.y); _local30 = Math.sqrt(((_local28 * _local28) + (_local29 * _local29))); _local28 = (_local28 / _local30); _local29 = (_local29 / _local30); _local7 = (_local15 - _local11.x); _local8 = (_local16 - _local11.y); _local31 = ((_local7 * _local28) + (_local8 * _local29)); _local6 = _arg1.points[0]; if (_local31 <= 0){ _local32 = _local11.x; _local33 = _local11.y; _local6.id.features.incidentEdge = b2_nullFeature; _local6.id.features.incidentVertex = _local25; } else { if (_local31 >= _local30){ _local32 = _local27.x; _local33 = _local27.y; _local6.id.features.incidentEdge = b2_nullFeature; _local6.id.features.incidentVertex = _local26; } else { _local32 = ((_local28 * _local31) + _local11.x); _local33 = ((_local29 * _local31) + _local11.y); _local6.id.features.incidentEdge = _local18; _local6.id.features.incidentVertex = b2_nullFeature; }; }; _local7 = (_local15 - _local32); _local8 = (_local16 - _local33); _local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8))); _local7 = (_local7 / _local17); _local8 = (_local8 / _local17); if (_local17 > _local20){ return; }; _arg1.pointCount = 1; _local12 = _arg3.R; _arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8)); _arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8)); _local9 = (_local13 - (_local20 * _arg1.normal.x)); _local10 = (_local14 - (_local20 * _arg1.normal.y)); _local7 = (_local9 - _arg3.position.x); _local8 = (_local10 - _arg3.position.y); _local12 = _arg3.R; _local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local7 = (_local9 - _arg5.position.x); _local8 = (_local10 - _arg5.position.y); _local12 = _arg5.R; _local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local6.separation = (_local17 - _local20); _local6.id.features.referenceEdge = 0; _local6.id.features.flip = 0; } } }//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID) package Box2D.Collision { public class b2ContactID { public var _key:uint; public var features:Features; public function b2ContactID(){ features = new Features(); super(); features._m_id = this; } public function Set(_arg1:b2ContactID):void{ key = _arg1._key; } public function Copy():b2ContactID{ var _local1:b2ContactID; _local1 = new b2ContactID(); _local1.key = key; return (_local1); } public function get key():uint{ return (_key); } public function set key(_arg1:uint):void{ _key = _arg1; features._referenceEdge = (_key & 0xFF); features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF); features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF); features._flip = (((_key & 4278190080) >> 24) & 0xFF); } } }//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint) package Box2D.Collision { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; public class b2ContactPoint { public var separation:Number; public var normal:b2Vec2; public var position:b2Vec2; public var restitution:Number; public var shape1:b2Shape; public var shape2:b2Shape; public var id:b2ContactID; public var friction:Number; public var velocity:b2Vec2; public function b2ContactPoint(){ position = new b2Vec2(); velocity = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance) package Box2D.Collision { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Distance { private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var gPoint:b2Point = new b2Point(); public static var g_GJK_Iterations:int = 0; public static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{ var _local4:Number; var _local5:int; var _local6:b2Vec2; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; _local4 = (100 * Number.MIN_VALUE); _local5 = 0; while (_local5 < _arg3) { _local6 = _arg2[_local5]; _local7 = Math.abs((_arg1.x - _local6.x)); _local8 = Math.abs((_arg1.y - _local6.y)); _local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x)); _local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y)); if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){ return (true); }; _local5++; }; return (false); } public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{ var _local7:b2Vec2; var _local8:Array; var _local9:Array; var _local10:Array; var _local11:int; var _local12:Number; var _local13:int; var _local14:int; var _local15:Number; var _local16:Number; var _local17:b2Vec2; var _local18:b2Vec2; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:int; _local8 = s_p1s; _local9 = s_p2s; _local10 = s_points; _local11 = 0; _arg1.SetV(_arg3.GetFirstVertex(_arg4)); _arg2.SetV(_arg5.GetFirstVertex(_arg6)); _local12 = 0; _local13 = 20; _local14 = 0; while (_local14 < _local13) { _local15 = (_arg2.x - _arg1.x); _local16 = (_arg2.y - _arg1.y); _local17 = _arg3.Support(_arg4, _local15, _local16); _local18 = _arg5.Support(_arg6, -(_local15), -(_local16)); _local12 = ((_local15 * _local15) + (_local16 * _local16)); _local19 = (_local18.x - _local17.x); _local20 = (_local18.y - _local17.y); _local21 = ((_local15 * _local19) + (_local16 * _local20)); if ((_local12 - _local21) <= (0.01 * _local12)){ if (_local11 == 0){ _arg1.SetV(_local17); _arg2.SetV(_local18); }; g_GJK_Iterations = _local14; return (Math.sqrt(_local12)); }; switch (_local11){ case 0: _local7 = _local8[0]; _local7.SetV(_local17); _local7 = _local9[0]; _local7.SetV(_local18); _local7 = _local10[0]; _local7.x = _local19; _local7.y = _local20; _arg1.SetV(_local8[0]); _arg2.SetV(_local9[0]); _local11++; break; case 1: _local7 = _local8[1]; _local7.SetV(_local17); _local7 = _local9[1]; _local7.SetV(_local18); _local7 = _local10[1]; _local7.x = _local19; _local7.y = _local20; _local11 = ProcessTwo(_arg1, _arg2, _local8, _local9, _local10); break; case 2: _local7 = _local8[2]; _local7.SetV(_local17); _local7 = _local9[2]; _local7.SetV(_local18); _local7 = _local10[2]; _local7.x = _local19; _local7.y = _local20; _local11 = ProcessThree(_arg1, _arg2, _local8, _local9, _local10); break; }; if (_local11 == 3){ g_GJK_Iterations = _local14; return (0); }; _local22 = -(Number.MAX_VALUE); _local23 = 0; while (_local23 < _local11) { _local7 = _local10[_local23]; _local22 = b2Math.b2Max(_local22, ((_local7.x * _local7.x) + (_local7.y * _local7.y))); _local23++; }; if ((((_local11 == 3)) || ((_local12 <= ((100 * Number.MIN_VALUE) * _local22))))){ g_GJK_Iterations = _local14; _local15 = (_arg2.x - _arg1.x); _local16 = (_arg2.y - _arg1.y); _local12 = ((_local15 * _local15) + (_local16 * _local16)); return (Math.sqrt(_local12)); }; _local14++; }; g_GJK_Iterations = _local13; return (Math.sqrt(_local12)); } public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{ var _local7:b2Mat22; var _local8:b2Vec2; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; _local7 = _arg4.R; _local8 = _arg3.m_localPosition; _local9 = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); _local10 = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); _local7 = _arg6.R; _local8 = _arg5.m_localPosition; _local11 = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); _local12 = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); _local13 = (_local11 - _local9); _local14 = (_local12 - _local10); _local15 = ((_local13 * _local13) + (_local14 * _local14)); _local16 = (_arg3.m_radius - b2Settings.b2_toiSlop); _local17 = (_arg5.m_radius - b2Settings.b2_toiSlop); _local18 = (_local16 + _local17); if (_local15 > (_local18 * _local18)){ _local19 = Math.sqrt(_local15); _local13 = (_local13 / _local19); _local14 = (_local14 / _local19); _local20 = (_local19 - _local18); _arg1.x = (_local9 + (_local16 * _local13)); _arg1.y = (_local10 + (_local16 * _local14)); _arg2.x = (_local11 - (_local17 * _local13)); _arg2.y = (_local12 - (_local17 * _local14)); return (_local20); }; if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){ _local19 = Math.sqrt(_local15); _local13 = (_local13 / _local19); _local14 = (_local14 / _local19); _arg1.x = (_local9 + (_local16 * _local13)); _arg1.y = (_local10 + (_local16 * _local14)); _arg2.x = _arg1.x; _arg2.y = _arg1.y; return (0); }; _arg1.x = _local9; _arg1.y = _local10; _arg2.x = _arg1.x; _arg2.y = _arg1.y; return (0); } public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{ var _local6:b2Vec2; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:b2Vec2; var _local12:b2Vec2; var _local13:b2Vec2; var _local14:b2Vec2; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; var _local39:Number; var _local40:Number; var _local41:Number; _local6 = _arg5[0]; _local7 = _arg5[1]; _local8 = _arg5[2]; _local9 = _arg3[0]; _local10 = _arg3[1]; _local11 = _arg3[2]; _local12 = _arg4[0]; _local13 = _arg4[1]; _local14 = _arg4[2]; _local15 = _local6.x; _local16 = _local6.y; _local17 = _local7.x; _local18 = _local7.y; _local19 = _local8.x; _local20 = _local8.y; _local21 = (_local17 - _local15); _local22 = (_local18 - _local16); _local23 = (_local19 - _local15); _local24 = (_local20 - _local16); _local25 = (_local19 - _local17); _local26 = (_local20 - _local18); _local27 = -(((_local15 * _local21) + (_local16 * _local22))); _local28 = ((_local17 * _local21) + (_local18 * _local22)); _local29 = -(((_local15 * _local23) + (_local16 * _local24))); _local30 = ((_local19 * _local23) + (_local20 * _local24)); _local31 = -(((_local17 * _local25) + (_local18 * _local26))); _local32 = ((_local19 * _local25) + (_local20 * _local26)); if ((((_local30 <= 0)) && ((_local32 <= 0)))){ _arg1.SetV(_local11); _arg2.SetV(_local14); _local9.SetV(_local11); _local12.SetV(_local14); _local6.SetV(_local8); return (1); }; _local33 = ((_local21 * _local24) - (_local22 * _local23)); _local34 = (_local33 * ((_local15 * _local18) - (_local16 * _local17))); _local36 = (_local33 * ((_local17 * _local20) - (_local18 * _local19))); if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){ _local35 = (_local31 / (_local31 + _local32)); _arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x))); _arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y))); _arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x))); _arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y))); _local9.SetV(_local11); _local12.SetV(_local14); _local6.SetV(_local8); return (2); }; _local37 = (_local33 * ((_local19 * _local16) - (_local20 * _local15))); if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){ _local35 = (_local29 / (_local29 + _local30)); _arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x))); _arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y))); _arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x))); _arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y))); _local10.SetV(_local11); _local13.SetV(_local14); _local7.SetV(_local8); return (2); }; _local38 = ((_local36 + _local37) + _local34); _local38 = (1 / _local38); _local39 = (_local36 * _local38); _local40 = (_local37 * _local38); _local41 = ((1 - _local39) - _local40); _arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x)); _arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y)); _arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x)); _arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y)); return (3); } public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{ var _local7:b2Mat22; var _local8:b2Vec2; var _local9:b2Point; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; _local9 = gPoint; _local8 = _arg5.m_localPosition; _local7 = _arg6.R; _local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); _local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); _local10 = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity); _local11 = (_arg5.m_radius - b2Settings.b2_toiSlop); if (_local10 > _local11){ _local10 = (_local10 - _local11); _local12 = (_arg2.x - _arg1.x); _local13 = (_arg2.y - _arg1.y); _local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13))); _local12 = (_local12 / _local14); _local13 = (_local13 / _local14); _arg2.x = (_arg2.x - (_local11 * _local12)); _arg2.y = (_arg2.y - (_local11 * _local13)); } else { _local10 = 0; _arg2.x = _arg1.x; _arg2.y = _arg1.y; }; return (_local10); } public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{ var _local7:int; var _local8:int; _local7 = _arg3.m_type; _local8 = _arg5.m_type; if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){ return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6)); }; if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){ return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6)); }; if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){ return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4)); }; if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){ return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6)); }; return (0); } public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{ var _local6:b2Vec2; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; _local6 = _arg5[0]; _local7 = _arg5[1]; _local8 = _arg3[0]; _local9 = _arg3[1]; _local10 = _arg4[0]; _local11 = _arg4[1]; _local12 = -(_local7.x); _local13 = -(_local7.y); _local14 = (_local6.x - _local7.x); _local15 = (_local6.y - _local7.y); _local16 = Math.sqrt(((_local14 * _local14) + (_local15 * _local15))); _local14 = (_local14 / _local16); _local15 = (_local15 / _local16); _local17 = ((_local12 * _local14) + (_local13 * _local15)); if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){ _arg1.SetV(_local9); _arg2.SetV(_local11); _local8.SetV(_local9); _local10.SetV(_local11); _local6.SetV(_local7); return (1); }; _local17 = (_local17 / _local16); _arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x))); _arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y))); _arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x))); _arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y))); return (2); } } }//package Box2D.Collision
Section 18
//b2Manifold (Box2D.Collision.b2Manifold) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Manifold { public var points:Array; public var pointCount:int;// = 0 public var normal:b2Vec2; public function b2Manifold(){ var _local1:int; pointCount = 0; super(); points = new Array(b2Settings.b2_maxManifoldPoints); _local1 = 0; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ManifoldPoint(); _local1++; }; normal = new b2Vec2(); } public function Set(_arg1:b2Manifold):void{ var _local2:int; pointCount = _arg1.pointCount; _local2 = 0; while (_local2 < b2Settings.b2_maxManifoldPoints) { (points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]); _local2++; }; normal.SetV(_arg1.normal); } public function Reset():void{ var _local1:int; _local1 = 0; while (_local1 < b2Settings.b2_maxManifoldPoints) { (points[_local1] as b2ManifoldPoint).Reset(); _local1++; }; normal.SetZero(); pointCount = 0; } } }//package Box2D.Collision
Section 19
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint) package Box2D.Collision { import Box2D.Common.Math.*; public class b2ManifoldPoint { public var separation:Number; public var localPoint2:b2Vec2; public var normalImpulse:Number; public var tangentImpulse:Number; public var localPoint1:b2Vec2; public var id:b2ContactID; public function b2ManifoldPoint(){ localPoint1 = new b2Vec2(); localPoint2 = new b2Vec2(); id = new b2ContactID(); super(); } public function Set(_arg1:b2ManifoldPoint):void{ localPoint1.SetV(_arg1.localPoint1); localPoint2.SetV(_arg1.localPoint2); separation = _arg1.separation; normalImpulse = _arg1.normalImpulse; tangentImpulse = _arg1.tangentImpulse; id.key = _arg1.id.key; } public function Reset():void{ localPoint1.SetZero(); localPoint2.SetZero(); separation = 0; normalImpulse = 0; tangentImpulse = 0; id.key = 0; } } }//package Box2D.Collision
Section 20
//b2OBB (Box2D.Collision.b2OBB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2OBB { public var R:b2Mat22; public var center:b2Vec2; public var extents:b2Vec2; public function b2OBB(){ R = new b2Mat22(); center = new b2Vec2(); extents = new b2Vec2(); super(); } } }//package Box2D.Collision
Section 21
//b2Pair (Box2D.Collision.b2Pair) package Box2D.Collision { public class b2Pair { public var userData;// = null public var proxyId1:uint; public var proxyId2:uint; public var status:uint; public var next:uint; public static var e_pairFinal:uint = 4; public static var b2_tableMask:int = (b2_tableCapacity - 1); public static var e_pairRemoved:uint = 2; public static var b2_nullPair:uint = 0xFFFF; public static var e_pairBuffered:uint = 1; public static var b2_nullProxy:uint = 0xFFFF; public static var b2_tableCapacity:int = 4096; public function b2Pair(){ userData = null; super(); } public function SetBuffered():void{ status = (status | e_pairBuffered); } public function IsBuffered():Boolean{ return (((status & e_pairBuffered) == e_pairBuffered)); } public function IsFinal():Boolean{ return (((status & e_pairFinal) == e_pairFinal)); } public function ClearRemoved():void{ status = (status & ~(e_pairRemoved)); } public function SetFinal():void{ status = (status | e_pairFinal); } public function IsRemoved():Boolean{ return (((status & e_pairRemoved) == e_pairRemoved)); } public function ClearBuffered():void{ status = (status & ~(e_pairBuffered)); } public function SetRemoved():void{ status = (status | e_pairRemoved); } } }//package Box2D.Collision
Section 22
//b2PairCallback (Box2D.Collision.b2PairCallback) package Box2D.Collision { public class b2PairCallback { public function PairRemoved(_arg1, _arg2, _arg3):void{ } public function PairAdded(_arg1, _arg2){ return (null); } } }//package Box2D.Collision
Section 23
//b2PairManager (Box2D.Collision.b2PairManager) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PairManager { public var m_pairCount:int; public var m_pairBuffer:Array; public var m_callback:b2PairCallback; public var m_pairs:Array; public var m_pairBufferCount:int; public var m_hashTable:Array; public var m_broadPhase:b2BroadPhase; public var m_freePair:uint; public function b2PairManager(){ var _local1:uint; super(); m_hashTable = new Array(b2Pair.b2_tableCapacity); _local1 = 0; while (_local1 < b2Pair.b2_tableCapacity) { m_hashTable[_local1] = b2Pair.b2_nullPair; _local1++; }; m_pairs = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1] = new b2Pair(); _local1++; }; m_pairBuffer = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairBuffer[_local1] = new b2BufferedPair(); _local1++; }; _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy; m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy; m_pairs[_local1].userData = null; m_pairs[_local1].status = 0; m_pairs[_local1].next = (_local1 + 1); _local1++; }; m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair; m_pairCount = 0; m_pairBufferCount = 0; } private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{ var _local4:b2Pair; var _local5:uint; _local5 = m_hashTable[_arg3]; _local4 = m_pairs[_local5]; while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) { _local5 = _local4.next; _local4 = m_pairs[_local5]; }; if (_local5 == b2Pair.b2_nullPair){ return (null); }; return (_local4); } private function Find(_arg1:uint, _arg2:uint):b2Pair{ var _local3:uint; var _local4:uint; if (_arg1 > _arg2){ _local4 = _arg1; _arg1 = _arg2; _arg2 = _local4; }; _local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); return (FindHash(_arg1, _arg2, _local3)); } private function ValidateBuffer():void{ } public function Commit():void{ var _local1:b2BufferedPair; var _local2:int; var _local3:int; var _local4:Array; var _local5:b2Pair; var _local6:b2Proxy; var _local7:b2Proxy; _local3 = 0; _local4 = m_broadPhase.m_proxyPool; _local2 = 0; while (_local2 < m_pairBufferCount) { _local1 = m_pairBuffer[_local2]; _local5 = Find(_local1.proxyId1, _local1.proxyId2); _local5.ClearBuffered(); _local6 = _local4[_local5.proxyId1]; _local7 = _local4[_local5.proxyId2]; if (_local5.IsRemoved()){ if (_local5.IsFinal() == true){ m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData); }; _local1 = m_pairBuffer[_local3]; _local1.proxyId1 = _local5.proxyId1; _local1.proxyId2 = _local5.proxyId2; _local3++; } else { if (_local5.IsFinal() == false){ _local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData); _local5.SetFinal(); }; }; _local2++; }; _local2 = 0; while (_local2 < _local3) { _local1 = m_pairBuffer[_local2]; RemovePair(_local1.proxyId1, _local1.proxyId2); _local2++; }; m_pairBufferCount = 0; if (b2BroadPhase.s_validate){ ValidateTable(); }; } public function RemoveBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2BufferedPair; var _local4:b2Pair; _local4 = Find(_arg1, _arg2); if (_local4 == null){ return; }; if (_local4.IsBuffered() == false){ _local4.SetBuffered(); _local3 = m_pairBuffer[m_pairBufferCount]; _local3.proxyId1 = _local4.proxyId1; _local3.proxyId2 = _local4.proxyId2; m_pairBufferCount++; }; _local4.SetRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function RemovePair(_arg1:uint, _arg2:uint){ var _local3:b2Pair; var _local4:uint; var _local5:uint; var _local6:b2Pair; var _local7:uint; var _local8:uint; var _local9:*; if (_arg1 > _arg2){ _local7 = _arg1; _arg1 = _arg2; _arg2 = _local7; }; _local4 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); _local5 = m_hashTable[_local4]; _local6 = null; while (_local5 != b2Pair.b2_nullPair) { if (Equals(m_pairs[_local5], _arg1, _arg2)){ _local8 = _local5; _local3 = m_pairs[_local5]; if (_local6){ _local6.next = _local3.next; } else { m_hashTable[_local4] = _local3.next; }; _local3 = m_pairs[_local8]; _local9 = _local3.userData; _local3.next = m_freePair; _local3.proxyId1 = b2Pair.b2_nullProxy; _local3.proxyId2 = b2Pair.b2_nullProxy; _local3.userData = null; _local3.status = 0; m_freePair = _local8; m_pairCount--; return (_local9); } else { _local6 = m_pairs[_local5]; _local5 = _local6.next; }; }; return (null); } public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{ m_broadPhase = _arg1; m_callback = _arg2; } public function AddBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2BufferedPair; var _local4:b2Pair; _local4 = AddPair(_arg1, _arg2); if (_local4.IsBuffered() == false){ _local4.SetBuffered(); _local3 = m_pairBuffer[m_pairBufferCount]; _local3.proxyId1 = _local4.proxyId1; _local3.proxyId2 = _local4.proxyId2; m_pairBufferCount++; }; _local4.ClearRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function AddPair(_arg1:uint, _arg2:uint):b2Pair{ var _local3:uint; var _local4:b2Pair; var _local5:uint; var _local6:uint; if (_arg1 > _arg2){ _local6 = _arg1; _arg1 = _arg2; _arg2 = _local6; }; _local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); _local4 = FindHash(_arg1, _arg2, _local3); if (_local4 != null){ return (_local4); }; _local5 = m_freePair; _local4 = m_pairs[_local5]; m_freePair = _local4.next; _local4.proxyId1 = _arg1; _local4.proxyId2 = _arg2; _local4.status = 0; _local4.userData = null; _local4.next = m_hashTable[_local3]; m_hashTable[_local3] = _local5; m_pairCount++; return (_local4); } private function ValidateTable():void{ } public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{ return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2)))); } public static function Hash(_arg1:uint, _arg2:uint):uint{ var _local3:uint; _local3 = (((_arg2 << 16) & 4294901760) | _arg1); _local3 = (~(_local3) + ((_local3 << 15) & 4294934528)); _local3 = (_local3 ^ ((_local3 >> 12) & 1048575)); _local3 = (_local3 + ((_local3 << 2) & 4294967292)); _local3 = (_local3 ^ ((_local3 >> 4) & 268435455)); _local3 = (_local3 * 2057); _local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF)); return (_local3); } public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{ return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3)))); } } }//package Box2D.Collision
Section 24
//b2Point (Box2D.Collision.b2Point) package Box2D.Collision { import Box2D.Common.Math.*; public class b2Point { public var p:b2Vec2; public function b2Point(){ p = new b2Vec2(); super(); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (p); } public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{ return (p); } } }//package Box2D.Collision
Section 25
//b2Proxy (Box2D.Collision.b2Proxy) package Box2D.Collision { public class b2Proxy { public var overlapCount:uint; public var lowerBounds:Array; public var upperBounds:Array; public var userData;// = null public var timeStamp:uint; public function b2Proxy(){ lowerBounds = [uint(0), uint(0)]; upperBounds = [uint(0), uint(0)]; userData = null; super(); } public function GetNext():uint{ return (lowerBounds[0]); } public function IsValid():Boolean{ return (!((overlapCount == b2BroadPhase.b2_invalid))); } public function SetNext(_arg1:uint):void{ lowerBounds[0] = (_arg1 & 0xFFFF); } } }//package Box2D.Collision
Section 26
//b2Segment (Box2D.Collision.b2Segment) package Box2D.Collision { import Box2D.Common.Math.*; public class b2Segment { public var p1:b2Vec2; public var p2:b2Vec2; public function b2Segment(){ p1 = new b2Vec2(); p2 = new b2Vec2(); super(); } public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{ var _local5:b2Vec2; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; _local5 = _arg3.p1; _local6 = (_arg3.p2.x - _local5.x); _local7 = (_arg3.p2.y - _local5.y); _local8 = (p2.x - p1.x); _local9 = (p2.y - p1.y); _local10 = _local9; _local11 = -(_local8); _local12 = (100 * Number.MIN_VALUE); _local13 = -(((_local6 * _local10) + (_local7 * _local11))); if (_local13 > _local12){ _local14 = (_local5.x - p1.x); _local15 = (_local5.y - p1.y); _local16 = ((_local14 * _local10) + (_local15 * _local11)); if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){ _local17 = ((-(_local6) * _local15) + (_local7 * _local14)); if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){ _local16 = (_local16 / _local13); _local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11))); _local10 = (_local10 / _local18); _local11 = (_local11 / _local18); _arg1[0] = _local16; _arg2.Set(_local10, _local11); return (true); }; }; }; return (false); } } }//package Box2D.Collision
Section 27
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact) package Box2D.Collision { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2TimeOfImpact { public static var s_xf1:b2XForm = new b2XForm(); public static var s_xf2:b2XForm = new b2XForm(); public static var s_p1:b2Vec2 = new b2Vec2(); public static var s_p2:b2Vec2 = new b2Vec2(); public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{ var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:b2Vec2; var _local18:b2Vec2; var _local19:int; var _local20:int; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:b2XForm; var _local27:b2XForm; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; _local7 = _arg1.m_sweepRadius; _local8 = _arg3.m_sweepRadius; _local9 = _arg2.t0; _local10 = (_arg2.c.x - _arg2.c0.x); _local11 = (_arg2.c.y - _arg2.c0.y); _local12 = (_arg4.c.x - _arg4.c0.x); _local13 = (_arg4.c.y - _arg4.c0.y); _local14 = (_arg2.a - _arg2.a0); _local15 = (_arg4.a - _arg4.a0); _local16 = 0; _local17 = s_p1; _local18 = s_p2; _local19 = 20; _local20 = 0; _local21 = 0; _local22 = 0; _local23 = 0; _local24 = 0; while (true) { _local25 = (((1 - _local16) * _local9) + _local16); _local26 = s_xf1; _local27 = s_xf2; _arg2.GetXForm(_local26, _local25); _arg4.GetXForm(_local27, _local25); _local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27); if (_local20 == 0){ if (_local23 > (2 * b2Settings.b2_toiSlop)){ _local24 = (1.5 * b2Settings.b2_toiSlop); } else { _local5 = (0.05 * b2Settings.b2_toiSlop); _local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop)); _local24 = ((_local5 > _local6)) ? _local5 : _local6; }; }; if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){ break; }; _local21 = (_local18.x - _local17.x); _local22 = (_local18.y - _local17.y); _local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22))); _local21 = (_local21 / _local28); _local22 = (_local22 / _local28); _local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8)); if (_local29 == 0){ _local16 = 1; break; }; _local30 = ((_local23 - _local24) / _local29); _local31 = (_local16 + _local30); if ((((_local31 < 0)) || ((1 < _local31)))){ _local16 = 1; break; }; if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){ break; }; _local16 = _local31; _local20++; }; return (_local16); } } }//package Box2D.Collision
Section 28
//ClipVertex (Box2D.Collision.ClipVertex) package Box2D.Collision { import Box2D.Common.Math.*; public class ClipVertex { public var v:b2Vec2; public var id:b2ContactID; public function ClipVertex(){ v = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features) package Box2D.Collision { public class Features { public var _referenceEdge:int; public var _incidentEdge:int; public var _flip:int; public var _incidentVertex:int; public var _m_id:b2ContactID; public function get referenceEdge():int{ return (_referenceEdge); } public function set incidentVertex(_arg1:int):void{ _incidentVertex = _arg1; _m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000)); } public function get flip():int{ return (_flip); } public function get incidentEdge():int{ return (_incidentEdge); } public function set referenceEdge(_arg1:int):void{ _referenceEdge = _arg1; _m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF)); } public function set flip(_arg1:int):void{ _flip = _arg1; _m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080)); } public function get incidentVertex():int{ return (_incidentVertex); } public function set incidentEdge(_arg1:int):void{ _incidentEdge = _arg1; _m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00)); } } }//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22) package Box2D.Common.Math { public class b2Mat22 { public var col1:b2Vec2; public var col2:b2Vec2; public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){ var _local4:Number; var _local5:Number; col1 = new b2Vec2(); col2 = new b2Vec2(); super(); if (((!((_arg2 == null))) && (!((_arg3 == null))))){ col1.SetV(_arg2); col2.SetV(_arg3); } else { _local4 = Math.cos(_arg1); _local5 = Math.sin(_arg1); col1.x = _local4; col2.x = -(_local5); col1.y = _local5; col2.y = _local4; }; } public function SetIdentity():void{ col1.x = 1; col2.x = 0; col1.y = 0; col2.y = 1; } public function Set(_arg1:Number):void{ var _local2:Number; var _local3:Number; _local2 = Math.cos(_arg1); _local3 = Math.sin(_arg1); col1.x = _local2; col2.x = -(_local3); col1.y = _local3; col2.y = _local2; } public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{ col1.SetV(_arg1); col2.SetV(_arg2); } public function SetZero():void{ col1.x = 0; col2.x = 0; col1.y = 0; col2.y = 0; } public function SetM(_arg1:b2Mat22):void{ col1.SetV(_arg1.col1); col2.SetV(_arg1.col2); } public function AddM(_arg1:b2Mat22):void{ col1.x = (col1.x + _arg1.col1.x); col1.y = (col1.y + _arg1.col1.y); col2.x = (col2.x + _arg1.col2.x); col2.y = (col2.y + _arg1.col2.y); } public function Abs():void{ col1.Abs(); col2.Abs(); } public function Copy():b2Mat22{ return (new b2Mat22(0, col1, col2)); } public function Invert(_arg1:b2Mat22):b2Mat22{ var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; _local2 = col1.x; _local3 = col2.x; _local4 = col1.y; _local5 = col2.y; _local6 = ((_local2 * _local5) - (_local3 * _local4)); _local6 = (1 / _local6); _arg1.col1.x = (_local6 * _local5); _arg1.col2.x = (-(_local6) * _local3); _arg1.col1.y = (-(_local6) * _local4); _arg1.col2.y = (_local6 * _local2); return (_arg1); } public function GetAngle():Number{ return (Math.atan2(col1.y, col1.x)); } public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; _local4 = col1.x; _local5 = col2.x; _local6 = col1.y; _local7 = col2.y; _local8 = ((_local4 * _local7) - (_local5 * _local6)); _local8 = (1 / _local8); _arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3))); _arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2))); return (_arg1); } public static function FromAngle(_arg1:Number):b2Mat22{ var _local2:b2Mat22; _local2 = new (b2Mat22); _local2.Set(_arg1); return (_local2); } public static function FromVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Mat22{ var _local3:b2Mat22; _local3 = new (b2Mat22); _local3.SetVV(_arg1, _arg2); return (_local3); } } }//package Box2D.Common.Math
Section 31
//b2Math (Box2D.Common.Math.b2Math) package Box2D.Common.Math { public class b2Math { public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1)); public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity); public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0); public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x)); return (_local3); } public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y)); return (_local3); } public static function b2IsValid(_arg1:Number):Boolean{ return (isFinite(_arg1)); } public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y)); return (_local3); } public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = b2MulMV(_arg1.R, _arg2); _local3.x = (_local3.x + _arg1.position.x); _local3.y = (_local3.y + _arg1.position.y); return (_local3); } public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{ var _local3:Number; var _local4:Number; _local3 = (_arg1.x - _arg2.x); _local4 = (_arg1.y - _arg2.y); return (((_local3 * _local3) + (_local4 * _local4))); } public static function b2Swap(_arg1:Array, _arg2:Array):void{ var _local3:*; _local3 = _arg1[0]; _arg1[0] = _arg2[0]; _arg2[0] = _local3; } public static function b2AbsM(_arg1:b2Mat22):b2Mat22{ var _local2:b2Mat22; _local2 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2)); return (_local2); } public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y)); return (_local3); } public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; var _local4:Number; _local3 = SubtractVV(_arg2, _arg1.position); _local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y)); _local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y)); _local3.x = _local4; return (_local3); } public static function b2Abs(_arg1:Number):Number{ return (((_arg1 > 0)) ? _arg1 : -(_arg1)); } public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{ return (b2Max(_arg2, b2Min(_arg1, _arg3))); } public static function b2AbsV(_arg1:b2Vec2):b2Vec2{ var _local2:b2Vec2; _local2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y)); return (_local2); } public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y)); return (_local3); } public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x))); } public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y))); } public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x)); return (_local3); } public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Mat22; _local3 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2)); return (_local3); } public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{ var _local3:Number; var _local4:Number; _local3 = (_arg1.x - _arg2.x); _local4 = (_arg1.y - _arg2.y); return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4)))); } public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Vec2; var _local4:b2Vec2; var _local5:b2Mat22; _local3 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1)); _local4 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2)); _local5 = new b2Mat22(0, _local3, _local4); return (_local5); } public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y)); return (_local3); } public static function b2IsPowerOfTwo(_arg1:uint):Boolean{ var _local2:Boolean; _local2 = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0))); return (_local2); } public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{ return (b2MaxV(_arg2, b2MinV(_arg1, _arg3))); } public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{ var _local3:Number; _local3 = Math.random(); _local3 = (((_arg2 - _arg1) * _local3) + _arg1); return (_local3); } public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2)); return (_local3); } public static function b2Min(_arg1:Number, _arg2:Number):Number{ return (((_arg1 < _arg2)) ? _arg1 : _arg2); } public static function b2Random():Number{ return (((Math.random() * 2) - 1)); } public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Mat22; _local3 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2)); return (_local3); } public static function b2NextPowerOfTwo(_arg1:uint):uint{ _arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647)); _arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823)); _arg1 = (_arg1 | ((_arg1 >> 4) & 268435455)); _arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF)); _arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF)); return ((_arg1 + 1)); } public static function b2Max(_arg1:Number, _arg2:Number):Number{ return (((_arg1 > _arg2)) ? _arg1 : _arg2); } public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y))); return (_local3); } } }//package Box2D.Common.Math
Section 32
//b2Sweep (Box2D.Common.Math.b2Sweep) package Box2D.Common.Math { public class b2Sweep { public var localCenter:b2Vec2; public var c:b2Vec2; public var a:Number; public var c0:b2Vec2; public var a0:Number; public var t0:Number; public function b2Sweep(){ localCenter = new b2Vec2(); c0 = new b2Vec2(); c = new b2Vec2(); super(); } public function Advance(_arg1:Number):void{ var _local2:Number; if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){ _local2 = ((_arg1 - t0) / (1 - t0)); c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x)); c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y)); a0 = (((1 - _local2) * a0) + (_local2 * a)); t0 = _arg1; }; } public function GetXForm(_arg1:b2XForm, _arg2:Number):void{ var _local3:b2Mat22; var _local4:Number; var _local5:Number; if ((1 - t0) > Number.MIN_VALUE){ _local4 = ((_arg2 - t0) / (1 - t0)); _arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x)); _arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y)); _local5 = (((1 - _local4) * a0) + (_local4 * a)); _arg1.R.Set(_local5); } else { _arg1.position.SetV(c); _arg1.R.Set(a); }; _local3 = _arg1.R; _arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y))); _arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y))); } } }//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2) package Box2D.Common.Math { public class b2Vec2 { public var x:Number; public var y:Number; public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function Set(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function Multiply(_arg1:Number):void{ x = (x * _arg1); y = (y * _arg1); } public function Length():Number{ return (Math.sqrt(((x * x) + (y * y)))); } public function Add(_arg1:b2Vec2):void{ x = (x + _arg1.x); y = (y + _arg1.y); } public function SetZero():void{ x = 0; y = 0; } public function LengthSquared():Number{ return (((x * x) + (y * y))); } public function MaxV(_arg1:b2Vec2):void{ x = ((x > _arg1.x)) ? x : _arg1.x; y = ((y > _arg1.y)) ? y : _arg1.y; } public function Subtracted(_arg1:b2Vec2):b2Vec2{ return (new b2Vec2((x - _arg1.x), (y - _arg1.y))); } public function SetV(_arg1:b2Vec2):void{ x = _arg1.x; y = _arg1.y; } public function Negative():b2Vec2{ return (new b2Vec2(-(x), -(y))); } public function CrossVF(_arg1:Number):void{ var _local2:Number; _local2 = x; x = (_arg1 * y); y = (-(_arg1) * _local2); } public function Abs():void{ if (x < 0){ x = -(x); }; if (y < 0){ y = -(y); }; } public function Copy():b2Vec2{ return (new b2Vec2(x, y)); } public function MulTM(_arg1:b2Mat22):void{ var _local2:Number; _local2 = b2Math.b2Dot(this, _arg1.col1); y = b2Math.b2Dot(this, _arg1.col2); x = _local2; } public function Normalized():b2Vec2{ var _local1:Number; var _local2:Number; _local1 = Math.sqrt(((x * x) + (y * y))); _local2 = (1 / _local1); return (new b2Vec2((x * _local2), (y * _local2))); } public function Added(_arg1:b2Vec2):b2Vec2{ return (new b2Vec2((x + _arg1.x), (y + _arg1.y))); } public function IsValid():Boolean{ return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y)))); } public function MinV(_arg1:b2Vec2):void{ x = ((x < _arg1.x)) ? x : _arg1.x; y = ((y < _arg1.y)) ? y : _arg1.y; } public function MulM(_arg1:b2Mat22):void{ var _local2:Number; _local2 = x; x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y)); y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y)); } public function Normalize():Number{ var _local1:Number; var _local2:Number; _local1 = Math.sqrt(((x * x) + (y * y))); if (_local1 < Number.MIN_VALUE){ return (0); }; _local2 = (1 / _local1); x = (x * _local2); y = (y * _local2); return (_local1); } public function CrossFV(_arg1:Number):void{ var _local2:Number; _local2 = x; x = (-(_arg1) * y); y = (_arg1 * _local2); } public function Multipled(_arg1:Number):b2Vec2{ return (new b2Vec2((x * _arg1), (y * _arg1))); } public function Subtract(_arg1:b2Vec2):void{ x = (x - _arg1.x); y = (y - _arg1.y); } public function GetAngle():Number{ var _local1:Number; var _local2:Number; _local1 = Math.sqrt(((x * x) + (y * y))); if (_local1 == 0){ _local1 = 1E-9; }; _local2 = 0; if (y > 0){ _local2 = Math.acos((x / _local1)); } else { _local2 = -(Math.acos((x / _local1))); }; return (_local2); } public static function Make(_arg1:Number, _arg2:Number):b2Vec2{ return (new b2Vec2(_arg1, _arg2)); } } }//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm) package Box2D.Common.Math { public class b2XForm { public var R:b2Mat22; public var position:b2Vec2; public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{ position = new b2Vec2(); R = new b2Mat22(); super(); if (_arg1){ position.SetV(_arg1); R.SetM(_arg2); }; } public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{ position.SetV(_arg1); R.SetM(_arg2); } public function Set(_arg1:b2XForm):void{ position.SetV(_arg1.position); R.SetM(_arg1.R); } public function SetIdentity():void{ position.SetZero(); R.SetIdentity(); } } }//package Box2D.Common.Math
Section 35
//b2Color (Box2D.Common.b2Color) package Box2D.Common { import Box2D.Common.Math.*; public class b2Color { private var _g:uint;// = 0 private var _b:uint;// = 0 private var _r:uint;// = 0 public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){ _r = 0; _g = 0; _b = 0; super(); _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function get color():uint{ return (((_r | (_g << 8)) | (_b << 16))); } public function set r(_arg1:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function set b(_arg1:Number):void{ _b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function set g(_arg1:Number):void{ _g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } } }//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings) package Box2D.Common { import Box2D.Common.Math.*; public class b2Settings { public static const b2_angularSleepTolerance:Number = 0.0111111111111111; public static const b2_linearSleepTolerance:Number = 0.01; public static const b2_angularSlop:Number = 0.0349065850398866; public static const b2_linearSlop:Number = 0.005; public static const b2_pi:Number = 3.14159265358979; public static const b2_maxProxies:int = 0x0200; public static const b2_maxAngularVelocitySquared:Number = 62500; public static const b2_maxPolygonVertices:int = 8; public static const b2_velocityThreshold:Number = 1; public static const b2_contactBaumgarte:Number = 0.2; public static const b2_maxPairs:int = 4096; public static const b2_maxTOIContactsPerIsland:int = 32; public static const b2_timeToSleep:Number = 0.5; public static const b2_maxManifoldPoints:int = 2; public static const b2_maxAngularVelocity:Number = 250; public static const b2_maxAngularCorrection:Number = 0.139626340159546; public static const USHRT_MAX:int = 0xFFFF; public static const b2_maxLinearVelocity:Number = 200; public static const b2_maxLinearCorrection:Number = 0.2; public static const b2_toiSlop:Number = 0.04; public static const b2_maxLinearVelocitySquared:Number = 40000; public static function b2Assert(_arg1:Boolean):void{ var _local2:b2Vec2; if (!_arg1){ _local2.x++; }; } } }//package Box2D.Common
Section 37
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact) package Box2D.Dynamics.Contacts { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; public class b2CircleContact extends b2Contact { private var m_manifolds:Array; private var m0:b2Manifold; public var m_manifold:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){ var _local3:b2ManifoldPoint; m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(_arg1, _arg2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; _local3 = m_manifold.points[0]; _local3.normalImpulse = 0; _local3.tangentImpulse = 0; } override public function GetManifolds():Array{ return (m_manifolds); } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2ManifoldPoint; var _local5:b2Body; var _local6:b2Body; var _local7:b2ContactPoint; var _local8:b2ManifoldPoint; _local5 = m_shape1.m_body; _local6 = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf); _local7 = s_evalCP; _local7.shape1 = m_shape1; _local7.shape2 = m_shape2; _local7.friction = m_friction; _local7.restitution = m_restitution; if (m_manifold.pointCount > 0){ m_manifoldCount = 1; _local8 = m_manifold.points[0]; if (m0.pointCount == 0){ _local8.normalImpulse = 0; _local8.tangentImpulse = 0; if (_arg1){ _local7.position = _local5.GetWorldPoint(_local8.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local8.separation; _local7.id.key = _local8.id._key; _arg1.Add(_local7); }; } else { _local4 = m0.points[0]; _local8.normalImpulse = _local4.normalImpulse; _local8.tangentImpulse = _local4.tangentImpulse; if (_arg1){ _local7.position = _local5.GetWorldPoint(_local8.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local8.separation; _local7.id.key = _local8.id._key; _arg1.Persist(_local7); }; }; } else { m_manifoldCount = 0; if ((((m0.pointCount > 0)) && (_arg1))){ _local4 = m0.points[0]; _local7.position = _local5.GetWorldPoint(_local4.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m0.normal); _local7.separation = _local4.separation; _local7.id.key = _local4.id._key; _arg1.Remove(_local7); }; }; } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2CircleContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact) package Box2D.Dynamics.Contacts { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2Contact { public var m_shape1:b2Shape; public var m_shape2:b2Shape; public var m_prev:b2Contact; public var m_toi:Number; public var m_next:b2Contact; public var m_friction:Number; public var m_manifoldCount:int; public var m_node1:b2ContactEdge; public var m_node2:b2ContactEdge; public var m_restitution:Number; public var m_flags:uint; public static var e_toiFlag:uint = 8; public static var e_nonSolidFlag:uint = 1; public static var e_slowFlag:uint = 2; public static var e_islandFlag:uint = 4; public static var s_registers:Array; public static var s_initialized:Boolean = false; public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){ m_node1 = new b2ContactEdge(); m_node2 = new b2ContactEdge(); super(); m_flags = 0; if (((!(_arg1)) || (!(_arg2)))){ m_shape1 = null; m_shape2 = null; return; }; if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){ m_flags = (m_flags | e_nonSolidFlag); }; m_shape1 = _arg1; m_shape2 = _arg2; m_manifoldCount = 0; m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction)); m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution); m_prev = null; m_next = null; m_node1.contact = null; m_node1.prev = null; m_node1.next = null; m_node1.other = null; m_node2.contact = null; m_node2.prev = null; m_node2.next = null; m_node2.other = null; } public function GetShape1():b2Shape{ return (m_shape1); } public function IsSolid():Boolean{ return (((m_flags & e_nonSolidFlag) == 0)); } public function GetNext():b2Contact{ return (m_next); } public function GetManifolds():Array{ return (null); } public function GetShape2():b2Shape{ return (m_shape2); } public function GetManifoldCount():int{ return (m_manifoldCount); } public function Update(_arg1:b2ContactListener):void{ var _local2:int; var _local3:int; var _local4:b2Body; var _local5:b2Body; _local2 = m_manifoldCount; Evaluate(_arg1); _local3 = m_manifoldCount; _local4 = m_shape1.m_body; _local5 = m_shape2.m_body; if ((((_local3 == 0)) && ((_local2 > 0)))){ _local4.WakeUp(); _local5.WakeUp(); }; if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){ m_flags = (m_flags & ~(e_slowFlag)); } else { m_flags = (m_flags | e_slowFlag); }; } public function Evaluate(_arg1:b2ContactListener):void{ } public static function InitializeRegisters():void{ var _local1:int; var _local2:int; s_registers = new Array(b2Shape.e_shapeTypeCount); _local1 = 0; while (_local1 < b2Shape.e_shapeTypeCount) { s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount); _local2 = 0; while (_local2 < b2Shape.e_shapeTypeCount) { s_registers[_local1][_local2] = new b2ContactRegister(); _local2++; }; _local1++; }; AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape); AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape); AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape); } public static function Destroy(_arg1:b2Contact, _arg2):void{ var _local3:int; var _local4:int; var _local5:b2ContactRegister; var _local6:Function; if (_arg1.m_manifoldCount > 0){ _arg1.m_shape1.m_body.WakeUp(); _arg1.m_shape2.m_body.WakeUp(); }; _local3 = _arg1.m_shape1.m_type; _local4 = _arg1.m_shape2.m_type; _local5 = s_registers[_local3][_local4]; _local6 = _local5.destroyFcn; _local6(_arg1, _arg2); } public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{ s_registers[_arg3][_arg4].createFcn = _arg1; s_registers[_arg3][_arg4].destroyFcn = _arg2; s_registers[_arg3][_arg4].primary = true; if (_arg3 != _arg4){ s_registers[_arg4][_arg3].createFcn = _arg1; s_registers[_arg4][_arg3].destroyFcn = _arg2; s_registers[_arg4][_arg3].primary = false; }; } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ var _local4:int; var _local5:int; var _local6:b2ContactRegister; var _local7:Function; var _local8:b2Contact; var _local9:int; var _local10:b2Manifold; if (s_initialized == false){ InitializeRegisters(); s_initialized = true; }; _local4 = _arg1.m_type; _local5 = _arg2.m_type; _local6 = s_registers[_local4][_local5]; _local7 = _local6.createFcn; if (_local7 != null){ if (_local6.primary){ return (_local7(_arg1, _arg2, _arg3)); }; _local8 = _local7(_arg2, _arg1, _arg3); _local9 = 0; while (_local9 < _local8.m_manifoldCount) { _local10 = _local8.GetManifolds()[_local9]; _local8.GetManifolds()[_local9].normal = _local10.normal.Negative(); _local9++; }; return (_local8); //unresolved jump }; return (null); } } }//package Box2D.Dynamics.Contacts
Section 39
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2ContactConstraint { public var points:Array; public var restitution:Number; public var body1:b2Body; public var manifold:b2Manifold; public var normal:b2Vec2; public var body2:b2Body; public var friction:Number; public var pointCount:int; public function b2ContactConstraint(){ var _local1:int; normal = new b2Vec2(); super(); points = new Array(b2Settings.b2_maxManifoldPoints); _local1 = 0; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ContactConstraintPoint(); _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; public class b2ContactConstraintPoint { public var r2:b2Vec2; public var separation:Number; public var positionImpulse:Number; public var normalImpulse:Number; public var equalizedMass:Number; public var tangentMass:Number; public var tangentImpulse:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var normalMass:Number; public var velocityBias:Number; public var r1:b2Vec2; public function b2ContactConstraintPoint(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); r1 = new b2Vec2(); r2 = new b2Vec2(); super(); } } }//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2ContactEdge { public var next:b2ContactEdge; public var other:b2Body; public var contact:b2Contact; public var prev:b2ContactEdge; } }//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister) package Box2D.Dynamics.Contacts { public class b2ContactRegister { public var primary:Boolean; public var createFcn:Function; public var destroyFcn:Function; } }//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult) package Box2D.Dynamics.Contacts { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Collision.*; public class b2ContactResult { public var normal:b2Vec2; public var position:b2Vec2; public var shape1:b2Shape; public var shape2:b2Shape; public var normalImpulse:Number; public var tangentImpulse:Number; public var id:b2ContactID; public function b2ContactResult(){ position = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2ContactSolver { public var m_constraintCount:int; public var m_constraints:Array; public var m_allocator; public var m_step:b2TimeStep; public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){ var _local5:b2Contact; var _local6:int; var _local7:b2Vec2; var _local8:b2Mat22; var _local9:int; var _local10:b2Body; var _local11:b2Body; var _local12:int; var _local13:Array; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:int; var _local23:b2Manifold; var _local24:Number; var _local25:Number; var _local26:b2ContactConstraint; var _local27:uint; var _local28:b2ManifoldPoint; var _local29:b2ContactConstraintPoint; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; var _local39:Number; var _local40:Number; var _local41:Number; var _local42:Number; var _local43:Number; var _local44:Number; var _local45:Number; var _local46:Number; var _local47:Number; m_step = new b2TimeStep(); m_constraints = new Array(); super(); m_step.dt = _arg1.dt; m_step.inv_dt = _arg1.inv_dt; m_step.maxIterations = _arg1.maxIterations; m_allocator = _arg4; m_constraintCount = 0; _local6 = 0; while (_local6 < _arg3) { _local5 = _arg2[_local6]; m_constraintCount = (m_constraintCount + _local5.m_manifoldCount); _local6++; }; _local6 = 0; while (_local6 < m_constraintCount) { m_constraints[_local6] = new b2ContactConstraint(); _local6++; }; _local9 = 0; _local6 = 0; while (_local6 < _arg3) { _local5 = _arg2[_local6]; _local10 = _local5.m_shape1.m_body; _local11 = _local5.m_shape2.m_body; _local12 = _local5.m_manifoldCount; _local13 = _local5.GetManifolds(); _local14 = _local5.m_friction; _local15 = _local5.m_restitution; _local16 = _local10.m_linearVelocity.x; _local17 = _local10.m_linearVelocity.y; _local18 = _local11.m_linearVelocity.x; _local19 = _local11.m_linearVelocity.y; _local20 = _local10.m_angularVelocity; _local21 = _local11.m_angularVelocity; _local22 = 0; while (_local22 < _local12) { _local23 = _local13[_local22]; _local24 = _local23.normal.x; _local25 = _local23.normal.y; _local26 = m_constraints[_local9]; _local26.body1 = _local10; _local26.body2 = _local11; _local26.manifold = _local23; _local26.normal.x = _local24; _local26.normal.y = _local25; _local26.pointCount = _local23.pointCount; _local26.friction = _local14; _local26.restitution = _local15; _local27 = 0; while (_local27 < _local26.pointCount) { _local28 = _local23.points[_local27]; _local29 = _local26.points[_local27]; _local29.normalImpulse = _local28.normalImpulse; _local29.tangentImpulse = _local28.tangentImpulse; _local29.separation = _local28.separation; _local29.positionImpulse = 0; _local29.localAnchor1.SetV(_local28.localPoint1); _local29.localAnchor2.SetV(_local28.localPoint2); _local8 = _local10.m_xf.R; _local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x); _local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y); _local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33)); _local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33)); _local32 = _local30; _local29.r1.Set(_local32, _local33); _local8 = _local11.m_xf.R; _local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x); _local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y); _local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35)); _local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35)); _local34 = _local30; _local29.r2.Set(_local34, _local35); _local36 = ((_local32 * _local32) + (_local33 * _local33)); _local37 = ((_local34 * _local34) + (_local35 * _local35)); _local38 = ((_local32 * _local24) + (_local33 * _local25)); _local39 = ((_local34 * _local24) + (_local35 * _local25)); _local40 = (_local10.m_invMass + _local11.m_invMass); _local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39))))); _local29.normalMass = (1 / _local40); _local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass)); _local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39))))); _local29.equalizedMass = (1 / _local41); _local42 = _local25; _local43 = -(_local24); _local44 = ((_local32 * _local42) + (_local33 * _local43)); _local45 = ((_local34 * _local42) + (_local35 * _local43)); _local46 = (_local10.m_invMass + _local11.m_invMass); _local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45))))); _local29.tangentMass = (1 / _local46); _local29.velocityBias = 0; if (_local29.separation > 0){ _local29.velocityBias = (-60 * _local29.separation); }; _local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33)); _local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32)); _local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31)); if (_local47 < -(b2Settings.b2_velocityThreshold)){ _local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47)); }; _local27++; }; _local9++; _local22++; }; _local6++; }; } public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2Mat22; var _local5:int; var _local6:b2ContactConstraint; var _local7:b2Body; var _local8:b2Body; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:int; var _local19:int; var _local20:b2ContactConstraintPoint; var _local21:Number; var _local22:Number; var _local23:b2ContactConstraintPoint; _local5 = 0; while (_local5 < m_constraintCount) { _local6 = m_constraints[_local5]; _local7 = _local6.body1; _local8 = _local6.body2; _local9 = _local7.m_invMass; _local10 = _local7.m_invI; _local11 = _local8.m_invMass; _local12 = _local8.m_invI; _local13 = _local6.normal.x; _local14 = _local6.normal.y; _local15 = _local14; _local16 = -(_local13); if (_arg1.warmStarting){ _local19 = _local6.pointCount; _local18 = 0; while (_local18 < _local19) { _local20 = _local6.points[_local18]; _local6.points[_local18].normalImpulse = (_local20.normalImpulse * _arg1.dtRatio); _local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio); _local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15)); _local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16)); _local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.r1.x * _local22) - (_local20.r1.y * _local21)))); _local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21)); _local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22)); _local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.r2.x * _local22) - (_local20.r2.y * _local21)))); _local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21)); _local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22)); _local18++; }; } else { _local19 = _local6.pointCount; _local18 = 0; while (_local18 < _local19) { _local23 = _local6.points[_local18]; _local23.normalImpulse = 0; _local23.tangentImpulse = 0; _local18++; }; }; _local5++; }; } public function SolvePositionConstraints(_arg1:Number):Boolean{ var _local2:Number; var _local3:b2Mat22; var _local4:b2Vec2; var _local5:int; var _local6:b2ContactConstraint; var _local7:b2Body; var _local8:b2Body; var _local9:b2Vec2; var _local10:Number; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:int; var _local20:int; var _local21:b2ContactConstraintPoint; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; _local2 = 0; _local5 = 0; while (_local5 < m_constraintCount) { _local6 = m_constraints[_local5]; _local7 = _local6.body1; _local8 = _local6.body2; _local9 = _local7.m_sweep.c; _local10 = _local7.m_sweep.a; _local11 = _local8.m_sweep.c; _local12 = _local8.m_sweep.a; _local13 = (_local7.m_mass * _local7.m_invMass); _local14 = (_local7.m_mass * _local7.m_invI); _local15 = (_local8.m_mass * _local8.m_invMass); _local16 = (_local8.m_mass * _local8.m_invI); _local17 = _local6.normal.x; _local18 = _local6.normal.y; _local19 = _local6.pointCount; _local20 = 0; while (_local20 < _local19) { _local21 = _local6.points[_local20]; _local3 = _local7.m_xf.R; _local4 = _local7.m_sweep.localCenter; _local22 = (_local21.localAnchor1.x - _local4.x); _local23 = (_local21.localAnchor1.y - _local4.y); _local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23)); _local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23)); _local22 = _local26; _local3 = _local8.m_xf.R; _local4 = _local8.m_sweep.localCenter; _local24 = (_local21.localAnchor2.x - _local4.x); _local25 = (_local21.localAnchor2.y - _local4.y); _local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25)); _local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25)); _local24 = _local26; _local27 = (_local9.x + _local22); _local28 = (_local9.y + _local23); _local29 = (_local11.x + _local24); _local30 = (_local11.y + _local25); _local31 = (_local29 - _local27); _local32 = (_local30 - _local28); _local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation); _local2 = b2Math.b2Min(_local2, _local33); _local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0)); _local35 = (-(_local21.equalizedMass) * _local34); _local36 = _local21.positionImpulse; _local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0); _local35 = (_local21.positionImpulse - _local36); _local37 = (_local35 * _local17); _local38 = (_local35 * _local18); _local9.x = (_local9.x - (_local13 * _local37)); _local9.y = (_local9.y - (_local13 * _local38)); _local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37)))); _local7.m_sweep.a = _local10; _local7.SynchronizeTransform(); _local11.x = (_local11.x + (_local15 * _local37)); _local11.y = (_local11.y + (_local15 * _local38)); _local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37)))); _local8.m_sweep.a = _local12; _local8.SynchronizeTransform(); _local20++; }; _local5++; }; return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop))); } public function SolveVelocityConstraints():void{ var _local1:int; var _local2:b2ContactConstraintPoint; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:b2Mat22; var _local18:b2Vec2; var _local19:int; var _local20:b2ContactConstraint; var _local21:b2Body; var _local22:b2Body; var _local23:Number; var _local24:Number; var _local25:b2Vec2; var _local26:b2Vec2; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:int; var _local38:Number; _local19 = 0; while (_local19 < m_constraintCount) { _local20 = m_constraints[_local19]; _local21 = _local20.body1; _local22 = _local20.body2; _local23 = _local21.m_angularVelocity; _local24 = _local22.m_angularVelocity; _local25 = _local21.m_linearVelocity; _local26 = _local22.m_linearVelocity; _local27 = _local21.m_invMass; _local28 = _local21.m_invI; _local29 = _local22.m_invMass; _local30 = _local22.m_invI; _local31 = _local20.normal.x; _local32 = _local20.normal.y; _local33 = _local32; _local34 = -(_local31); _local35 = _local20.friction; _local37 = _local20.pointCount; _local1 = 0; while (_local1 < _local37) { _local2 = _local20.points[_local1]; _local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y)); _local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x)); _local9 = ((_local7 * _local31) + (_local8 * _local32)); _local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias)); _local10 = ((_local7 * _local33) + (_local8 * _local34)); _local12 = (_local2.tangentMass * -(_local10)); _local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0); _local11 = (_local13 - _local2.normalImpulse); _local38 = (_local35 * _local2.normalImpulse); _local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38); _local12 = (_local14 - _local2.tangentImpulse); _local15 = ((_local11 * _local31) + (_local12 * _local33)); _local16 = ((_local11 * _local32) + (_local12 * _local34)); _local25.x = (_local25.x - (_local27 * _local15)); _local25.y = (_local25.y - (_local27 * _local16)); _local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15)))); _local26.x = (_local26.x + (_local29 * _local15)); _local26.y = (_local26.y + (_local29 * _local16)); _local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15)))); _local2.normalImpulse = _local13; _local2.tangentImpulse = _local14; _local1++; }; _local21.m_angularVelocity = _local23; _local22.m_angularVelocity = _local24; _local19++; }; } public function FinalizeVelocityConstraints():void{ var _local1:int; var _local2:b2ContactConstraint; var _local3:b2Manifold; var _local4:int; var _local5:b2ManifoldPoint; var _local6:b2ContactConstraintPoint; _local1 = 0; while (_local1 < m_constraintCount) { _local2 = m_constraints[_local1]; _local3 = _local2.manifold; _local4 = 0; while (_local4 < _local2.pointCount) { _local5 = _local3.points[_local4]; _local6 = _local2.points[_local4]; _local5.normalImpulse = _local6.normalImpulse; _local5.tangentImpulse = _local6.tangentImpulse; _local4++; }; _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2NullContact extends b2Contact { override public function GetManifolds():Array{ return (null); } override public function Evaluate(_arg1:b2ContactListener):void{ } } }//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact) package Box2D.Dynamics.Contacts { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolyAndCircleContact extends b2Contact { private var m_manifolds:Array; private var m0:b2Manifold; public var m_manifold:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){ var _local3:b2ManifoldPoint; m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(_arg1, _arg2); m_manifold = m_manifolds[0]; b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape)); b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape)); m_manifold.pointCount = 0; _local3 = m_manifold.points[0]; _local3.normalImpulse = 0; _local3.tangentImpulse = 0; } override public function GetManifolds():Array{ return (m_manifolds); } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:int; var _local3:b2Vec2; var _local4:b2Vec2; var _local5:b2ManifoldPoint; var _local6:b2Body; var _local7:b2Body; var _local8:Array; var _local9:b2ContactPoint; var _local10:b2ManifoldPoint; var _local11:Boolean; var _local12:uint; var _local13:int; _local6 = m_shape1.m_body; _local7 = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf); _local8 = [false, false]; _local9 = s_evalCP; _local9.shape1 = m_shape1; _local9.shape2 = m_shape2; _local9.friction = m_friction; _local9.restitution = m_restitution; if (m_manifold.pointCount > 0){ _local2 = 0; while (_local2 < m_manifold.pointCount) { _local10 = m_manifold.points[_local2]; _local10.normalImpulse = 0; _local10.tangentImpulse = 0; _local11 = false; _local12 = _local10.id._key; _local13 = 0; while (_local13 < m0.pointCount) { if (_local8[_local13] == true){ } else { _local5 = m0.points[_local13]; if (_local5.id._key == _local12){ _local8[_local13] = true; _local10.normalImpulse = _local5.normalImpulse; _local10.tangentImpulse = _local5.tangentImpulse; _local11 = true; if (_arg1 != null){ _local9.position = _local6.GetWorldPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m_manifold.normal); _local9.separation = _local10.separation; _local9.id.key = _local12; _arg1.Persist(_local9); }; break; }; }; _local13++; }; if ((((_local11 == false)) && (!((_arg1 == null))))){ _local9.position = _local6.GetWorldPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m_manifold.normal); _local9.separation = _local10.separation; _local9.id.key = _local12; _arg1.Add(_local9); }; _local2++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (_arg1 == null){ return; }; _local2 = 0; while (_local2 < m0.pointCount) { if (_local8[_local2]){ } else { _local5 = m0.points[_local2]; _local9.position = _local6.GetWorldPoint(_local5.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m0.normal); _local9.separation = _local5.separation; _local9.id.key = _local5.id._key; _arg1.Remove(_local9); }; _local2++; }; } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolyAndCircleContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact) package Box2D.Dynamics.Contacts { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; public class b2PolygonContact extends b2Contact { private var m_manifolds:Array; private var m0:b2Manifold; public var m_manifold:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{ m0 = new b2Manifold(); m_manifolds = [new b2Manifold()]; super(_arg1, _arg2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; } override public function GetManifolds():Array{ return (m_manifolds); } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2ManifoldPoint; var _local5:b2Body; var _local6:b2Body; var _local7:b2ContactPoint; var _local8:int; var _local9:Array; var _local10:b2ManifoldPoint; var _local11:Boolean; var _local12:uint; var _local13:int; _local5 = m_shape1.m_body; _local6 = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf); _local9 = [false, false]; _local7 = s_evalCP; _local7.shape1 = m_shape1; _local7.shape2 = m_shape2; _local7.friction = m_friction; _local7.restitution = m_restitution; if (m_manifold.pointCount > 0){ _local8 = 0; while (_local8 < m_manifold.pointCount) { _local10 = m_manifold.points[_local8]; _local10.normalImpulse = 0; _local10.tangentImpulse = 0; _local11 = false; _local12 = _local10.id._key; _local13 = 0; while (_local13 < m0.pointCount) { if (_local9[_local13] == true){ } else { _local4 = m0.points[_local13]; if (_local4.id._key == _local12){ _local9[_local13] = true; _local10.normalImpulse = _local4.normalImpulse; _local10.tangentImpulse = _local4.tangentImpulse; _local11 = true; if (_arg1 != null){ _local7.position = _local5.GetWorldPoint(_local10.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local10.separation; _local7.id.key = _local12; _arg1.Persist(_local7); }; break; }; }; _local13++; }; if ((((_local11 == false)) && (!((_arg1 == null))))){ _local7.position = _local5.GetWorldPoint(_local10.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local10.separation; _local7.id.key = _local12; _arg1.Add(_local7); }; _local8++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (_arg1 == null){ return; }; _local8 = 0; while (_local8 < m0.pointCount) { if (_local9[_local8]){ } else { _local4 = m0.points[_local8]; _local7.position = _local5.GetWorldPoint(_local4.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m0.normal); _local7.separation = _local4.separation; _local7.id.key = _local4.id._key; _arg1.Remove(_local7); }; _local8++; }; } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolygonContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2DistanceJoint extends b2Joint { public var m_mass:Number; public var m_u:b2Vec2; public var m_impulse:Number; public var m_dampingRatio:Number; public var m_localAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_frequencyHz:Number; public var m_bias:Number; public var m_gamma:Number; public var m_length:Number; public function b2DistanceJoint(_arg1:b2DistanceJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u = new b2Vec2(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_length = _arg1.length; m_frequencyHz = _arg1.frequencyHz; m_dampingRatio = _arg1.dampingRatio; m_impulse = 0; m_gamma = 0; m_bias = 0; m_inv_dt = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2; _local1 = new b2Vec2(); _local1.SetV(m_u); _local1.Multiply((m_inv_dt * m_impulse)); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local1:b2Mat22; var _local2:b2Body; var _local3:b2Body; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; if (m_frequencyHz > 0){ return (true); }; _local2 = m_body1; _local3 = m_body2; _local1 = _local2.m_xf.R; _local4 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); _local5 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local6 = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5)); _local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5)); _local4 = _local6; _local1 = _local3.m_xf.R; _local7 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); _local8 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8)); _local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8)); _local7 = _local6; _local9 = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4); _local10 = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5); _local11 = Math.sqrt(((_local9 * _local9) + (_local10 * _local10))); _local9 = (_local9 / _local11); _local10 = (_local10 / _local11); _local12 = (_local11 - m_length); _local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local13 = (-(m_mass) * _local12); m_u.Set(_local9, _local10); _local14 = (_local13 * m_u.x); _local15 = (_local13 * m_u.y); _local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14)))); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15)); _local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14)))); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Mat22; var _local3:Number; var _local4:b2Body; var _local5:b2Body; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; m_inv_dt = _arg1.inv_dt; _local4 = m_body1; _local5 = m_body2; _local2 = _local4.m_xf.R; _local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x); _local7 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y); _local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7)); _local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7)); _local6 = _local3; _local2 = _local5.m_xf.R; _local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x); _local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y); _local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9)); _local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9)); _local8 = _local3; m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6); m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7); _local10 = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y))); if (_local10 > b2Settings.b2_linearSlop){ m_u.Multiply((1 / _local10)); } else { m_u.SetZero(); }; _local11 = ((_local6 * m_u.y) - (_local7 * m_u.x)); _local12 = ((_local8 * m_u.y) - (_local9 * m_u.x)); _local13 = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12)); m_mass = (1 / _local13); if (m_frequencyHz > 0){ _local14 = (_local10 - m_length); _local15 = ((2 * Math.PI) * m_frequencyHz); _local16 = (((2 * m_mass) * m_dampingRatio) * _local15); _local17 = ((m_mass * _local15) * _local15); m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17)))); m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma); m_mass = (1 / (_local13 + m_gamma)); }; if (_arg1.warmStarting){ m_impulse = (m_impulse * _arg1.dtRatio); _local18 = (m_impulse * m_u.x); _local19 = (m_impulse * m_u.y); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19)); _local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18)))); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19)); _local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18)))); } else { m_impulse = 0; }; } override public function GetReactionTorque():Number{ return (0); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Mat22; var _local3:b2Body; var _local4:b2Body; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; _local3 = m_body1; _local4 = m_body2; _local2 = _local3.m_xf.R; _local5 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); _local6 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); _local7 = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6)); _local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6)); _local5 = _local7; _local2 = _local4.m_xf.R; _local8 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); _local9 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9)); _local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9)); _local8 = _local7; _local10 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6)); _local11 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5)); _local12 = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9)); _local13 = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8)); _local14 = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11))); _local15 = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse))); m_impulse = (m_impulse + _local15); _local16 = (_local15 * m_u.x); _local17 = (_local15 * m_u.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16)))); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17)); _local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); } } }//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2DistanceJointDef extends b2JointDef { public var length:Number; public var dampingRatio:Number; public var frequencyHz:Number; public var localAnchor2:b2Vec2; public var localAnchor1:b2Vec2; public function b2DistanceJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_distanceJoint; length = 1; frequencyHz = 0; dampingRatio = 0; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ var _local5:Number; var _local6:Number; body1 = _arg1; body2 = _arg2; localAnchor1.SetV(body1.GetLocalPoint(_arg3)); localAnchor2.SetV(body2.GetLocalPoint(_arg4)); _local5 = (_arg4.x - _arg3.x); _local6 = (_arg4.y - _arg3.y); length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6))); frequencyHz = 0; dampingRatio = 0; } } }//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2GearJoint extends b2Joint { public var m_force:Number; public var m_ratio:Number; public var m_mass:Number; public var m_prismatic1:b2PrismaticJoint; public var m_prismatic2:b2PrismaticJoint; public var m_ground1:b2Body; public var m_constant:Number; public var m_ground2:b2Body; public var m_groundAnchor2:b2Vec2; public var m_groundAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_revolute1:b2RevoluteJoint; public var m_revolute2:b2RevoluteJoint; public var m_localAnchor1:b2Vec2; public var m_J:b2Jacobian; public function b2GearJoint(_arg1:b2GearJointDef){ var _local2:int; var _local3:int; var _local4:Number; var _local5:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_J = new b2Jacobian(); super(_arg1); _local2 = _arg1.joint1.m_type; _local3 = _arg1.joint2.m_type; m_revolute1 = null; m_prismatic1 = null; m_revolute2 = null; m_prismatic2 = null; m_ground1 = _arg1.joint1.m_body1; m_body1 = _arg1.joint1.m_body2; if (_local2 == b2Joint.e_revoluteJoint){ m_revolute1 = (_arg1.joint1 as b2RevoluteJoint); m_groundAnchor1.SetV(m_revolute1.m_localAnchor1); m_localAnchor1.SetV(m_revolute1.m_localAnchor2); _local4 = m_revolute1.GetJointAngle(); } else { m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint); m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1); m_localAnchor1.SetV(m_prismatic1.m_localAnchor2); _local4 = m_prismatic1.GetJointTranslation(); }; m_ground2 = _arg1.joint2.m_body1; m_body2 = _arg1.joint2.m_body2; if (_local3 == b2Joint.e_revoluteJoint){ m_revolute2 = (_arg1.joint2 as b2RevoluteJoint); m_groundAnchor2.SetV(m_revolute2.m_localAnchor1); m_localAnchor2.SetV(m_revolute2.m_localAnchor2); _local5 = m_revolute2.GetJointAngle(); } else { m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint); m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1); m_localAnchor2.SetV(m_prismatic2.m_localAnchor2); _local5 = m_prismatic2.GetJointTranslation(); }; m_ratio = _arg1.ratio; m_constant = (_local4 + (m_ratio * _local5)); m_force = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2; _local1 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y)); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:b2Body; var _local3:b2Body; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; _local1 = 0; _local2 = m_body1; _local3 = m_body2; if (m_revolute1){ _local4 = m_revolute1.GetJointAngle(); } else { _local4 = m_prismatic1.GetJointTranslation(); }; if (m_revolute2){ _local5 = m_revolute2.GetJointAngle(); } else { _local5 = m_prismatic2.GetJointTranslation(); }; _local6 = (m_constant - (_local4 + (m_ratio * _local5))); _local7 = (-(m_mass) * _local6); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y)); _local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1)); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2)); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((_local1 < b2Settings.b2_linearSlop)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Body; var _local5:b2Body; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:b2Mat22; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; _local2 = m_ground1; _local3 = m_ground2; _local4 = m_body1; _local5 = m_body2; _local14 = 0; m_J.SetZero(); if (m_revolute1){ m_J.angular1 = -1; _local14 = (_local14 + _local4.m_invI); } else { _local10 = _local2.m_xf.R; _local11 = m_prismatic1.m_localXAxis1; _local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); _local10 = _local4.m_xf.R; _local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y); _local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9)); _local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9)); _local8 = _local13; _local12 = ((_local8 * _local7) - (_local9 * _local6)); m_J.linear1.Set(-(_local6), -(_local7)); m_J.angular1 = -(_local12); _local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12))); }; if (m_revolute2){ m_J.angular2 = -(m_ratio); _local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI)); } else { _local10 = _local3.m_xf.R; _local11 = m_prismatic2.m_localXAxis1; _local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); _local10 = _local5.m_xf.R; _local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x); _local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y); _local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9)); _local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9)); _local8 = _local13; _local12 = ((_local8 * _local7) - (_local9 * _local6)); m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7)); m_J.angular2 = (-(m_ratio) * _local12); _local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12)))); }; m_mass = (1 / _local14); if (_arg1.warmStarting){ _local15 = (_arg1.dt * m_force); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y)); _local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1)); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y)); _local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2)); } else { m_force = 0; }; } override public function GetReactionTorque():Number{ var _local1:b2Mat22; var _local2:Number; var _local3:Number; var _local4:Number; _local1 = m_body2.m_xf.R; _local2 = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x); _local3 = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y); _local4 = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3)); _local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3)); _local2 = _local4; _local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x)))); return (_local4); } public function GetRatio():Number{ return (m_ratio); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:Number; var _local5:Number; var _local6:Number; _local2 = m_body1; _local3 = m_body2; _local4 = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); _local5 = ((-(_arg1.inv_dt) * m_mass) * _local4); m_force = (m_force + _local5); _local6 = (_arg1.dt * _local5); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2)); } } }//package Box2D.Dynamics.Joints
Section 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef) package Box2D.Dynamics.Joints { public class b2GearJointDef extends b2JointDef { public var joint2:b2Joint; public var joint1:b2Joint; public var ratio:Number; public function b2GearJointDef(){ type = b2Joint.e_gearJoint; joint1 = null; joint2 = null; ratio = 1; } } }//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2Jacobian { public var linear1:b2Vec2; public var linear2:b2Vec2; public var angular2:Number; public var angular1:Number; public function b2Jacobian(){ linear1 = new b2Vec2(); linear2 = new b2Vec2(); super(); } public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{ linear1.SetV(_arg1); angular1 = _arg2; linear2.SetV(_arg3); angular2 = _arg4; } public function SetZero():void{ linear1.SetZero(); angular1 = 0; linear2.SetZero(); angular2 = 0; } public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{ return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4))); } } }//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2Joint { public var m_collideConnected:Boolean; public var m_next:b2Joint; public var m_node1:b2JointEdge; public var m_node2:b2JointEdge; public var m_localCenter1:b2Vec2; public var m_localCenter2:b2Vec2; public var m_userData; public var m_inv_dt:Number; public var m_islandFlag:Boolean; public var m_prev:b2Joint; public var m_type:int; public var m_invMass1:Number; public var m_invMass2:Number; public var m_invI1:Number; public var m_invI2:Number; public var m_body1:b2Body; public var m_body2:b2Body; public static const e_prismaticJoint:int = 2; public static const e_equalLimits:int = 3; public static const e_lineJoint:int = 7; public static const e_gearJoint:int = 6; public static const e_atUpperLimit:int = 2; public static const e_atLowerLimit:int = 1; public static const e_revoluteJoint:int = 1; public static const e_inactiveLimit:int = 0; public static const e_pulleyJoint:int = 4; public static const e_unknownJoint:int = 0; public static const e_distanceJoint:int = 3; public static const e_mouseJoint:int = 5; public function b2Joint(_arg1:b2JointDef){ m_node1 = new b2JointEdge(); m_node2 = new b2JointEdge(); m_localCenter1 = new b2Vec2(); m_localCenter2 = new b2Vec2(); super(); m_type = _arg1.type; m_prev = null; m_next = null; m_body1 = _arg1.body1; m_body2 = _arg1.body2; m_collideConnected = _arg1.collideConnected; m_islandFlag = false; m_userData = _arg1.userData; } public function GetAnchor1():b2Vec2{ return (null); } public function GetAnchor2():b2Vec2{ return (null); } public function InitPositionConstraints():void{ } public function GetType():int{ return (m_type); } public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ } public function GetReactionForce():b2Vec2{ return (null); } public function SolvePositionConstraints():Boolean{ return (false); } public function GetBody1():b2Body{ return (m_body1); } public function GetBody2():b2Body{ return (m_body2); } public function InitVelocityConstraints(_arg1:b2TimeStep):void{ } public function GetNext():b2Joint{ return (m_next); } public function GetReactionTorque():Number{ return (0); } public function GetUserData(){ return (m_userData); } public function SetUserData(_arg1):void{ m_userData = _arg1; } public static function Destroy(_arg1:b2Joint, _arg2):void{ _arg1 = null; } public static function Create(_arg1:b2JointDef, _arg2):b2Joint{ var _local3:b2Joint; _local3 = null; switch (_arg1.type){ case e_distanceJoint: _local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef)); break; case e_mouseJoint: _local3 = new b2MouseJoint((_arg1 as b2MouseJointDef)); break; case e_prismaticJoint: _local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef)); break; case e_revoluteJoint: _local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef)); break; case e_pulleyJoint: _local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef)); break; case e_gearJoint: _local3 = new b2GearJoint((_arg1 as b2GearJointDef)); break; case e_lineJoint: _local3 = new b2LineJoint((_arg1 as b2LineJointDef)); break; default: break; }; return (_local3); } } }//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointDef { public var collideConnected:Boolean; public var body1:b2Body; public var body2:b2Body; public var userData; public var type:int; public function b2JointDef(){ type = b2Joint.e_unknownJoint; userData = null; body1 = null; body2 = null; collideConnected = false; } } }//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointEdge { public var joint:b2Joint; public var other:b2Body; public var next:b2JointEdge; public var prev:b2JointEdge; } }//package Box2D.Dynamics.Joints
Section 56
//b2LineJoint (Box2D.Dynamics.Joints.b2LineJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2LineJoint extends b2Joint { private var m_a1:Number; private var m_a2:Number; private var m_enableLimit:Boolean; private var m_impulse:b2Vec2; private var m_localYAxis1:b2Vec2; private var m_s2:Number; private var m_s1:Number; private var m_axis:b2Vec2; private var m_motorImpulse:Number; private var m_upperTranslation:Number; private var m_lowerTranslation:Number; private var m_perp:b2Vec2; public var m_localXAxis1:b2Vec2; private var m_maxMotorForce:Number; private var m_motorMass:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; private var m_limitState:int; private var m_enableMotor:Boolean; private var m_motorSpeed:Number; private var m_K:b2Mat22; public function b2LineJoint(_arg1:b2LineJointDef){ 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_axis = new b2Vec2(); m_perp = new b2Vec2(); m_K = new b2Mat22(); m_impulse = new b2Vec2(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchorA); m_localAnchor2.SetV(_arg1.localAnchorB); m_localXAxis1.SetV(_arg1.localAxisA); m_localYAxis1.x = -(m_localXAxis1.y); m_localYAxis1.y = m_localXAxis1.x; m_impulse.SetZero(); m_motorMass = 0; m_motorImpulse = 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; m_limitState = e_inactiveLimit; m_axis.SetZero(); m_perp.SetZero(); } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerTranslation = _arg1; m_upperTranslation = _arg2; } public function GetLowerLimit():Number{ return (m_lowerTranslation); } public function GetUpperLimit():Number{ return (m_upperTranslation); } public function GetJointTranslation():Number{ var _local1:b2Body; var _local2:b2Body; var _local3:b2Mat22; var _local4:b2Vec2; var _local5:b2Vec2; var _local6:Number; var _local7:Number; var _local8:b2Vec2; var _local9:Number; _local1 = m_body1; _local2 = m_body2; _local4 = _local1.GetWorldPoint(m_localAnchor1); _local5 = _local2.GetWorldPoint(m_localAnchor2); _local6 = (_local5.x - _local4.x); _local7 = (_local5.y - _local4.y); _local8 = _local1.GetWorldVector(m_localXAxis1); _local9 = ((_local8.x * _local6) + (_local8.y * _local7)); return (_local9); } public function GetMotorForce():Number{ return (m_motorImpulse); } public function GetMaxMotorForce():Number{ return (m_maxMotorForce); } override public function GetReactionTorque():Number{ return (m_impulse.y); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Vec2; var _local5:Number; var _local6:b2Vec2; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:b2Vec2; var _local19:b2Vec2; var _local20:Number; var _local21:Number; var _local22:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_linearVelocity; _local5 = _local2.m_angularVelocity; _local6 = _local3.m_linearVelocity; _local7 = _local3.m_angularVelocity; if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local13 = ((((m_axis.x * (_local6.x - _local4.x)) + (m_axis.y * (_local6.y - _local4.y))) + (m_a2 * _local7)) - (m_a1 * _local5)); _local14 = (m_motorMass * (m_motorSpeed - _local13)); _local15 = m_motorImpulse; _local16 = (_arg1.dt * m_maxMotorForce); m_motorImpulse = b2Math.b2Clamp((m_motorImpulse + _local14), -(_local16), _local16); _local14 = (m_motorImpulse - _local15); _local8 = (_local14 * m_axis.x); _local9 = (_local14 * m_axis.y); _local10 = (_local14 * m_a1); _local11 = (_local14 * m_a2); _local4.x = (_local4.x - (m_invMass1 * _local8)); _local4.y = (_local4.y - (m_invMass1 * _local9)); _local5 = (_local5 - (m_invI1 * _local10)); _local6.x = (_local6.x + (m_invMass2 * _local8)); _local6.y = (_local6.y + (m_invMass2 * _local9)); _local7 = (_local7 + (m_invI2 * _local11)); }; _local12 = ((((m_perp.x * (_local6.x - _local4.x)) + (m_perp.y * (_local6.y - _local4.y))) + (m_s2 * _local7)) - (m_s1 * _local5)); if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local17 = ((((m_axis.x * (_local6.x - _local4.x)) + (m_axis.y * (_local6.y - _local4.y))) + (m_a2 * _local7)) - (m_a1 * _local5)); _local18 = m_impulse.Copy(); _local19 = m_K.Solve(new b2Vec2(), -(_local12), -(_local17)); m_impulse.Add(_local19); if (m_limitState == e_atLowerLimit){ m_impulse.y = b2Math.b2Max(m_impulse.y, 0); } else { if (m_limitState == e_atUpperLimit){ m_impulse.y = b2Math.b2Min(m_impulse.y, 0); }; }; _local20 = (-(_local12) - ((m_impulse.y - _local18.y) * m_K.col2.x)); if (m_K.col1.x != 0){ _local21 = ((_local20 / m_K.col1.x) + _local18.x); } else { _local21 = _local18.x; }; m_impulse.x = _local21; _local19.x = (m_impulse.x - _local18.x); _local19.y = (m_impulse.y - _local18.y); _local8 = ((_local19.x * m_perp.x) + (_local19.y * m_axis.x)); _local9 = ((_local19.x * m_perp.y) + (_local19.y * m_axis.y)); _local10 = ((_local19.x * m_s1) + (_local19.y * m_a1)); _local11 = ((_local19.x * m_s2) + (_local19.y * m_a2)); _local4.x = (_local4.x - (m_invMass1 * _local8)); _local4.y = (_local4.y - (m_invMass1 * _local9)); _local5 = (_local5 - (m_invI1 * _local10)); _local6.x = (_local6.x + (m_invMass2 * _local8)); _local6.y = (_local6.y + (m_invMass2 * _local9)); _local7 = (_local7 + (m_invI2 * _local11)); } else { if (m_K.col1.x != 0){ _local22 = (-(_local12) / m_K.col1.x); } else { _local22 = 0; }; m_impulse.x = (m_impulse.x + _local22); _local8 = (_local22 * m_perp.x); _local9 = (_local22 * m_perp.y); _local10 = (_local22 * m_s1); _local11 = (_local22 * m_s2); _local4.x = (_local4.x - (m_invMass1 * _local8)); _local4.y = (_local4.y - (m_invMass1 * _local9)); _local5 = (_local5 - (m_invI1 * _local10)); _local6.x = (_local6.x + (m_invMass2 * _local8)); _local6.y = (_local6.y + (m_invMass2 * _local9)); _local7 = (_local7 + (m_invI2 * _local11)); }; _local2.m_linearVelocity.SetV(_local4); _local2.m_angularVelocity = _local5; _local3.m_linearVelocity.SetV(_local6); _local3.m_angularVelocity = _local7; } public function EnableMotor(_arg1:Boolean):void{ m_enableMotor = _arg1; } public function GetMotorSpeed():Number{ return (m_motorSpeed); } override public function GetReactionForce():b2Vec2{ return (new b2Vec2((((m_impulse.x * m_perp.x) + m_motorImpulse) + (m_impulse.y * m_axis.x)), (((m_impulse.x * m_perp.y) + m_motorImpulse) + (m_impulse.y * m_axis.y)))); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local3:b2Body; var _local4:b2Body; var _local5:b2Vec2; var _local6:Number; var _local7:b2Vec2; var _local8:Number; var _local9:b2Mat22; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Boolean; var _local18:Number; var _local19:b2Mat22; var _local20:b2Mat22; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:b2Vec2; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; _local3 = m_body1; _local4 = m_body2; _local5 = _local3.m_sweep.c; _local6 = _local3.m_sweep.a; _local7 = _local4.m_sweep.c; _local8 = _local4.m_sweep.a; _local15 = 0; _local16 = 0; _local17 = false; _local18 = 0; _local19 = b2Mat22.FromAngle(_local6); _local20 = b2Mat22.FromAngle(_local8); _local9 = _local19; _local21 = (m_localAnchor1.x - m_localCenter1.x); _local22 = (m_localAnchor1.y - m_localCenter1.y); _local10 = ((_local9.col1.x * _local21) + (_local9.col2.x * _local22)); _local22 = ((_local9.col1.y * _local21) + (_local9.col2.y * _local22)); _local21 = _local10; _local9 = _local20; _local23 = (m_localAnchor2.x - m_localCenter2.x); _local24 = (m_localAnchor2.y - m_localCenter2.y); _local10 = ((_local9.col1.x * _local23) + (_local9.col2.x * _local24)); _local24 = ((_local9.col1.y * _local23) + (_local9.col2.y * _local24)); _local23 = _local10; _local25 = (((_local7.x + _local23) - _local5.x) - _local21); _local26 = (((_local7.y + _local24) - _local5.y) - _local22); if (m_enableLimit){ m_axis = b2Math.b2MulMV(_local19, m_localXAxis1); m_a1 = (((_local25 + _local21) * m_axis.y) - ((_local26 + _local22) * m_axis.x)); m_a2 = ((_local23 * m_axis.y) - (_local24 * m_axis.x)); _local33 = ((m_axis.x * _local25) + (m_axis.y * _local26)); if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){ _local18 = b2Math.b2Clamp(_local33, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local15 = b2Math.b2Abs(_local33); _local17 = true; } else { if (_local33 <= m_lowerTranslation){ _local18 = b2Math.b2Clamp(((_local33 - m_lowerTranslation) + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local15 = (m_lowerTranslation - _local33); _local17 = true; } else { if (_local33 >= m_upperTranslation){ _local18 = b2Math.b2Clamp(((_local33 - m_upperTranslation) + b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection); _local15 = (_local33 - m_upperTranslation); _local17 = true; }; }; }; }; m_perp = b2Math.b2MulMV(_local19, m_localYAxis1); m_s1 = (((_local25 + _local21) * m_perp.y) - ((_local26 + _local22) * m_perp.x)); m_s2 = ((_local23 * m_perp.y) - (_local24 * m_perp.x)); _local27 = new b2Vec2(); _local28 = ((m_perp.x * _local25) + (m_perp.y * _local26)); _local15 = b2Math.b2Max(_local15, b2Math.b2Abs(_local28)); _local16 = 0; if (_local17){ _local11 = m_invMass1; _local12 = m_invMass2; _local13 = m_invI1; _local14 = m_invI2; m_K.col1.x = (((_local11 + _local12) + ((_local13 * m_s1) * m_s1)) + ((_local14 * m_s2) * m_s2)); m_K.col1.y = (((_local13 * m_s1) * m_a1) + ((_local14 * m_s2) * m_a2)); m_K.col2.x = m_K.col1.y; m_K.col2.y = (((_local11 + _local12) + ((_local13 * m_a1) * m_a1)) + ((_local14 * m_a2) * m_a2)); m_K.Solve(_local27, -(_local28), -(_local18)); } else { _local11 = m_invMass1; _local12 = m_invMass2; _local13 = m_invI1; _local14 = m_invI2; _local34 = (((_local11 + _local12) + ((_local13 * m_s1) * m_s1)) + ((_local14 * m_s2) * m_s2)); if (_local34 != 0){ _local35 = (-(_local28) / _local34); } else { _local35 = 0; }; _local27.x = _local35; _local27.y = 0; }; _local29 = ((_local27.x * m_perp.x) + (_local27.y * m_axis.x)); _local30 = ((_local27.x * m_perp.y) + (_local27.y * m_axis.y)); _local31 = ((_local27.x * m_s1) + (_local27.y * m_a1)); _local32 = ((_local27.x * m_s2) + (_local27.y * m_a2)); _local5.x = (_local5.x - (m_invMass1 * _local29)); _local5.y = (_local5.y - (m_invMass1 * _local30)); _local6 = (_local6 - (m_invI1 * _local31)); _local7.x = (_local7.x + (m_invMass2 * _local29)); _local7.y = (_local7.y + (m_invMass2 * _local30)); _local8 = (_local8 + (m_invI2 * _local32)); _local3.m_sweep.a = _local6; _local4.m_sweep.a = _local8; _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); return ((((_local15 <= b2Settings.b2_linearSlop)) && ((_local16 <= b2Settings.b2_angularSlop)))); } public function GetJointSpeed():Number{ var _local1:b2Body; var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:b2Vec2; var _local16:b2Vec2; var _local17:b2Vec2; var _local18:Number; var _local19:Number; var _local20:Number; _local1 = m_body1; _local2 = m_body2; _local3 = _local1.m_xf.R; _local4 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local5 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); _local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local3 = _local2.m_xf.R; _local7 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local8 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8)); _local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8)); _local7 = _local6; _local9 = (_local1.m_sweep.c.x + _local4); _local10 = (_local1.m_sweep.c.y + _local5); _local11 = (_local2.m_sweep.c.x + _local7); _local12 = (_local2.m_sweep.c.y + _local8); _local13 = (_local11 - _local9); _local14 = (_local12 - _local10); _local15 = _local1.GetWorldVector(m_localXAxis1); _local16 = _local1.m_linearVelocity; _local17 = _local2.m_linearVelocity; _local18 = _local1.m_angularVelocity; _local19 = _local2.m_angularVelocity; _local20 = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4))))); return (_local20); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local6:b2XForm; var _local7:b2XForm; 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; _local2 = m_body1; _local3 = m_body2; m_localCenter1.SetV(_local2.GetLocalCenter()); m_localCenter2.SetV(_local3.GetLocalCenter()); _local6 = _local2.GetXForm(); _local7 = _local3.GetXForm(); _local4 = _local2.m_xf.R; _local8 = (m_localAnchor1.x - m_localCenter1.x); _local9 = (m_localAnchor1.y - m_localCenter1.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; _local4 = _local3.m_xf.R; _local10 = (m_localAnchor2.x - m_localCenter2.x); _local11 = (m_localAnchor2.y - m_localCenter2.y); _local5 = ((_local4.col1.x * _local10) + (_local4.col2.x * _local11)); _local11 = ((_local4.col1.y * _local10) + (_local4.col2.y * _local11)); _local10 = _local5; _local12 = (((_local3.m_sweep.c.x + _local10) - _local2.m_sweep.c.x) - _local8); _local13 = (((_local3.m_sweep.c.y + _local11) - _local2.m_sweep.c.y) - _local9); m_invMass1 = _local2.m_invMass; m_invMass2 = _local3.m_invMass; m_invI1 = _local2.m_invI; m_invI2 = _local3.m_invI; m_axis.SetV(b2Math.b2MulMV(_local6.R, m_localXAxis1)); m_a1 = (((_local12 + _local8) * m_axis.y) - ((_local13 + _local9) * m_axis.x)); m_a2 = ((_local10 * m_axis.y) - (_local11 * m_axis.x)); m_motorMass = (((m_invMass1 + m_invMass2) + ((m_invI1 * m_a1) * m_a1)) + ((m_invI2 * m_a2) * m_a2)); m_motorMass = ((m_motorMass > Number.MIN_VALUE)) ? (1 / m_motorMass) : 0; m_perp.SetV(b2Math.b2MulMV(_local6.R, m_localYAxis1)); m_s1 = (((_local12 + _local8) * m_perp.y) - ((_local13 + _local9) * m_perp.x)); m_s2 = ((_local10 * m_perp.y) - (_local11 * m_perp.x)); _local14 = m_invMass1; _local15 = m_invMass2; _local16 = m_invI1; _local17 = m_invI2; m_K.col1.x = (((_local14 + _local15) + ((_local16 * m_s1) * m_s1)) + ((_local17 * m_s2) * m_s2)); m_K.col1.y = (((_local16 * m_s1) * m_a1) + ((_local17 * m_s2) * m_a2)); m_K.col2.x = m_K.col1.y; m_K.col2.y = (((_local14 + _local15) + ((_local16 * m_a1) * m_a1)) + ((_local17 * m_a2) * m_a2)); if (m_enableLimit){ _local18 = ((m_axis.x * _local12) + (m_axis.y * _local13)); if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){ m_limitState = e_equalLimits; } else { if (_local18 <= m_lowerTranslation){ if (m_limitState != e_atLowerLimit){ m_limitState = e_atLowerLimit; m_impulse.y = 0; }; } else { if (_local18 >= m_upperTranslation){ if (m_limitState != e_atUpperLimit){ m_limitState = e_atUpperLimit; m_impulse.y = 0; }; } else { m_limitState = e_inactiveLimit; m_impulse.y = 0; }; }; }; } else { m_limitState = e_inactiveLimit; }; if (m_enableMotor == false){ m_motorImpulse = 0; }; if (_arg1.warmStarting){ m_impulse.x = (m_impulse.x * _arg1.dtRatio); m_impulse.y = (m_impulse.y * _arg1.dtRatio); m_motorImpulse = (m_motorImpulse * _arg1.dtRatio); _local19 = ((m_impulse.x * m_perp.x) + ((m_motorImpulse + m_impulse.y) * m_axis.x)); _local20 = ((m_impulse.x * m_perp.y) + ((m_motorImpulse + m_impulse.y) * m_axis.y)); _local21 = ((m_impulse.x * m_s1) + ((m_motorImpulse + m_impulse.y) * m_a1)); _local22 = ((m_impulse.x * m_s2) + ((m_motorImpulse + m_impulse.y) * m_a2)); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (m_invMass1 * _local19)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (m_invMass1 * _local20)); _local2.m_angularVelocity = (_local2.m_angularVelocity - (m_invI1 * _local21)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (m_invMass2 * _local19)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (m_invMass2 * _local20)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (m_invI2 * _local22)); } else { m_impulse.SetZero(); m_motorImpulse = 0; }; } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } public function SetMaxMotorForce(_arg1:Number):void{ m_maxMotorForce = _arg1; } } }//package Box2D.Dynamics.Joints
Section 57
//b2LineJointDef (Box2D.Dynamics.Joints.b2LineJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2LineJointDef extends b2JointDef { public var localAnchorA:b2Vec2; public var localAnchorB:b2Vec2; public var maxMotorForce:Number; public var motorSpeed:Number; public var localAxisA:b2Vec2; public var upperTranslation:Number; public var lowerTranslation:Number; public var enableMotor:Boolean; public var enableLimit:Boolean; public function b2LineJointDef(){ localAnchorA = new b2Vec2(); localAnchorB = new b2Vec2(); localAxisA = new b2Vec2(); super(); type = b2Joint.e_lineJoint; localAxisA.Set(1, 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; localAnchorA = body1.GetLocalPoint(_arg3); localAnchorB = body2.GetLocalPoint(_arg3); localAxisA = body1.GetLocalVector(_arg4); } } }//package Box2D.Dynamics.Joints
Section 58
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2MouseJoint extends b2Joint { public var m_beta:Number; public var m_mass:b2Mat22; public var m_target:b2Vec2; public var m_impulse:b2Vec2; public var m_localAnchor:b2Vec2; private var K2:b2Mat22; private var K:b2Mat22; private var K1:b2Mat22; public var m_gamma:Number; public var m_C:b2Vec2; public var m_maxForce:Number; public function b2MouseJoint(_arg1:b2MouseJointDef){ var _local2:Number; var _local3:Number; var _local4:b2Mat22; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); m_localAnchor = new b2Vec2(); m_target = new b2Vec2(); m_impulse = new b2Vec2(); m_mass = new b2Mat22(); m_C = new b2Vec2(); super(_arg1); m_target.SetV(_arg1.target); _local2 = (m_target.x - m_body2.m_xf.position.x); _local3 = (m_target.y - m_body2.m_xf.position.y); _local4 = m_body2.m_xf.R; m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y)); m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y)); m_maxForce = _arg1.maxForce; m_impulse.SetZero(); _local5 = m_body2.m_mass; _local6 = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz); _local7 = (((2 * _local5) * _arg1.dampingRatio) * _local6); _local8 = ((_arg1.timeStep * _local5) * (_local6 * _local6)); m_gamma = (1 / (_local7 + _local8)); m_beta = (_local8 / (_local7 + _local8)); } override public function GetAnchor1():b2Vec2{ return (m_target); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor)); } override public function GetReactionForce():b2Vec2{ return (m_impulse); } override public function SolvePositionConstraints():Boolean{ return (true); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; _local2 = m_body2; _local3 = _local2.m_xf.R; _local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x); _local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y); _local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local7 = _local2.m_invMass; _local8 = _local2.m_invI; K1.col1.x = _local7; K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = _local7; K2.col1.x = ((_local8 * _local5) * _local5); K2.col2.x = ((-(_local8) * _local4) * _local5); K2.col1.y = ((-(_local8) * _local4) * _local5); K2.col2.y = ((_local8 * _local4) * _local4); K.SetM(K1); K.AddM(K2); K.col1.x = (K.col1.x + m_gamma); K.col2.y = (K.col2.y + m_gamma); K.Invert(m_mass); m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x); m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y); _local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98); _local9 = (_arg1.dt * m_impulse.x); _local10 = (_arg1.dt * m_impulse.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9)))); } override public function GetReactionTorque():Number{ return (0); } public function SetTarget(_arg1:b2Vec2):void{ if (m_body2.IsSleeping()){ m_body2.WakeUp(); }; m_target = _arg1; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; _local2 = m_body2; _local3 = _local2.m_xf.R; _local6 = (m_localAnchor.x - _local2.m_sweep.localCenter.x); _local7 = (m_localAnchor.y - _local2.m_sweep.localCenter.y); _local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7)); _local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7)); _local6 = _local4; _local8 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7)); _local9 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6)); _local3 = m_mass; _local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x)); _local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y)); _local10 = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5))); _local11 = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5))); _local12 = m_impulse.x; _local13 = m_impulse.y; m_impulse.x = (m_impulse.x + _local10); m_impulse.y = (m_impulse.y + _local11); _local14 = m_impulse.Length(); if (_local14 > m_maxForce){ m_impulse.Multiply((m_maxForce / _local14)); }; _local10 = (m_impulse.x - _local12); _local11 = (m_impulse.y - _local13); _local15 = (_arg1.dt * _local10); _local16 = (_arg1.dt * _local11); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15)))); } } }//package Box2D.Dynamics.Joints
Section 59
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2MouseJointDef extends b2JointDef { public var frequencyHz:Number; public var dampingRatio:Number; public var maxForce:Number; public var target:b2Vec2; public var timeStep:Number; public function b2MouseJointDef(){ target = new b2Vec2(); super(); type = b2Joint.e_mouseJoint; maxForce = 0; frequencyHz = 5; dampingRatio = 0.7; timeStep = (1 / 60); } } }//package Box2D.Dynamics.Joints
Section 60
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2PrismaticJoint extends b2Joint { public var m_limitForce:Number; public var m_torque:Number; public var m_enableLimit:Boolean; public var m_localYAxis1:b2Vec2; public var m_upperTranslation:Number; public var m_angularMass:Number; public var m_motorJacobian:b2Jacobian; public var m_linearJacobian:b2Jacobian; public var m_lowerTranslation:Number; public var m_motorForce:Number; public var m_localXAxis1:b2Vec2; public var m_refAngle:Number; public var m_force:Number; public var m_maxMotorForce:Number; public var m_motorMass:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_limitState:int; public var m_linearMass:Number; public var m_enableMotor:Boolean; public var m_limitPositionImpulse:Number; public var m_motorSpeed:Number; public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_localXAxis1 = new b2Vec2(); m_localYAxis1 = new b2Vec2(); m_linearJacobian = new b2Jacobian(); m_motorJacobian = new b2Jacobian(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_localXAxis1.SetV(_arg1.localAxis1); m_localYAxis1.x = -(m_localXAxis1.y); m_localYAxis1.y = m_localXAxis1.x; m_refAngle = _arg1.referenceAngle; m_linearJacobian.SetZero(); m_linearMass = 0; m_force = 0; m_angularMass = 0; m_torque = 0; m_motorJacobian.SetZero(); m_motorMass = 0; m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerTranslation = _arg1.lowerTranslation; m_upperTranslation = _arg1.upperTranslation; m_maxMotorForce = _arg1.maxMotorForce; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerTranslation = _arg1; m_upperTranslation = _arg2; } public function GetLowerLimit():Number{ return (m_lowerTranslation); } public function GetUpperLimit():Number{ return (m_upperTranslation); } public function GetJointTranslation():Number{ var _local1:b2Body; var _local2:b2Body; var _local3:b2Mat22; var _local4:b2Vec2; var _local5:b2Vec2; var _local6:Number; var _local7:Number; var _local8:b2Vec2; var _local9:Number; _local1 = m_body1; _local2 = m_body2; _local4 = _local1.GetWorldPoint(m_localAnchor1); _local5 = _local2.GetWorldPoint(m_localAnchor2); _local6 = (_local5.x - _local4.x); _local7 = (_local5.y - _local4.y); _local8 = _local1.GetWorldVector(m_localXAxis1); _local9 = ((_local8.x * _local6) + (_local8.y * _local7)); return (_local9); } public function GetMotorForce():Number{ return (m_motorForce); } override public function GetReactionTorque():Number{ return (m_torque); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_invMass; _local5 = _local3.m_invMass; _local6 = _local2.m_invI; _local7 = _local3.m_invI; _local9 = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); _local10 = ((-(_arg1.inv_dt) * m_linearMass) * _local9); m_force = (m_force + _local10); _local11 = (_arg1.dt * _local10); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2)); _local12 = (_local3.m_angularVelocity - _local2.m_angularVelocity); _local13 = ((-(_arg1.inv_dt) * m_angularMass) * _local12); m_torque = (m_torque + _local13); _local14 = (_arg1.dt * _local13); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14)); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed); _local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15); _local17 = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce); _local16 = (m_motorForce - _local17); _local11 = (_arg1.dt * _local16); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); _local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + _local19); } else { if (m_limitState == e_atLowerLimit){ _local8 = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0); _local19 = (m_limitForce - _local8); } else { if (m_limitState == e_atUpperLimit){ _local8 = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0); _local19 = (m_limitForce - _local8); }; }; }; _local11 = (_arg1.dt * _local19); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2)); }; } public function EnableMotor(_arg1:Boolean):void{ m_enableMotor = _arg1; } public function GetMotorSpeed():Number{ return (m_motorSpeed); } override public function GetReactionForce():b2Vec2{ var _local1:b2Mat22; var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; _local1 = m_body1.m_xf.R; _local2 = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y))); _local3 = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y))); _local4 = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y))); _local5 = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y))); return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5)))); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local3:b2Body; var _local4:b2Body; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:b2Mat22; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; _local3 = m_body1; _local4 = m_body2; _local5 = _local3.m_invMass; _local6 = _local4.m_invMass; _local7 = _local3.m_invI; _local8 = _local4.m_invI; _local9 = _local3.m_xf.R; _local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); _local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12)); _local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12)); _local11 = _local10; _local9 = _local4.m_xf.R; _local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); _local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14)); _local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14)); _local13 = _local10; _local15 = (_local3.m_sweep.c.x + _local11); _local16 = (_local3.m_sweep.c.y + _local12); _local17 = (_local4.m_sweep.c.x + _local13); _local18 = (_local4.m_sweep.c.y + _local14); _local19 = (_local17 - _local15); _local20 = (_local18 - _local16); _local9 = _local3.m_xf.R; _local21 = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y)); _local22 = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y)); _local23 = ((_local21 * _local19) + (_local22 * _local20)); _local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local24 = (-(m_linearMass) * _local23); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2)); _local25 = b2Math.b2Abs(_local23); _local26 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle); _local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); _local27 = (-(m_angularMass) * _local26); _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); _local28 = b2Math.b2Abs(_local26); if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local9 = _local3.m_xf.R; _local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); _local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12)); _local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12)); _local11 = _local10; _local9 = _local4.m_xf.R; _local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); _local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14)); _local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14)); _local13 = _local10; _local15 = (_local3.m_sweep.c.x + _local11); _local16 = (_local3.m_sweep.c.y + _local12); _local17 = (_local4.m_sweep.c.x + _local13); _local18 = (_local4.m_sweep.c.y + _local14); _local19 = (_local17 - _local15); _local20 = (_local18 - _local16); _local9 = _local3.m_xf.R; _local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y)); _local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y)); _local31 = ((_local29 * _local19) + (_local30 * _local20)); _local32 = 0; if (m_limitState == e_equalLimits){ _local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local32 = (-(m_motorMass) * _local1); _local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26)); } else { if (m_limitState == e_atLowerLimit){ _local1 = (_local31 - m_lowerTranslation); _local25 = b2Math.b2Max(_local25, -(_local1)); _local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local32 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0); _local32 = (m_limitPositionImpulse - _local2); } else { if (m_limitState == e_atUpperLimit){ _local1 = (_local31 - m_upperTranslation); _local25 = b2Math.b2Max(_local25, _local1); _local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection); _local32 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0); _local32 = (m_limitPositionImpulse - _local2); }; }; }; _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop)))); } public function GetJointSpeed():Number{ var _local1:b2Body; var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:b2Vec2; var _local16:b2Vec2; var _local17:b2Vec2; var _local18:Number; var _local19:Number; var _local20:Number; _local1 = m_body1; _local2 = m_body2; _local3 = _local1.m_xf.R; _local4 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local5 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); _local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local3 = _local2.m_xf.R; _local7 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local8 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8)); _local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8)); _local7 = _local6; _local9 = (_local1.m_sweep.c.x + _local4); _local10 = (_local1.m_sweep.c.y + _local5); _local11 = (_local2.m_sweep.c.x + _local7); _local12 = (_local2.m_sweep.c.y + _local8); _local13 = (_local11 - _local9); _local14 = (_local12 - _local10); _local15 = _local1.GetWorldVector(m_localXAxis1); _local16 = _local1.m_linearVelocity; _local17 = _local2.m_linearVelocity; _local18 = _local1.m_angularVelocity; _local19 = _local2.m_angularVelocity; _local20 = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4))))); return (_local20); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_xf.R; _local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); _local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; _local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); _local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; _local10 = _local2.m_invMass; _local11 = _local3.m_invMass; _local12 = _local2.m_invI; _local13 = _local3.m_invI; _local4 = _local2.m_xf.R; _local14 = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y)); _local15 = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y)); _local16 = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x); _local17 = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y); m_linearJacobian.linear1.x = -(_local14); m_linearJacobian.linear1.y = -(_local15); m_linearJacobian.linear2.x = _local14; m_linearJacobian.linear2.y = _local15; m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14))); m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14)); m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2)); m_linearMass = (1 / m_linearMass); m_angularMass = (_local12 + _local13); if (m_angularMass > Number.MIN_VALUE){ m_angularMass = (1 / m_angularMass); }; if (((m_enableLimit) || (m_enableMotor))){ _local4 = _local2.m_xf.R; _local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y)); _local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y)); m_motorJacobian.linear1.x = -(_local18); m_motorJacobian.linear1.y = -(_local19); m_motorJacobian.linear2.x = _local18; m_motorJacobian.linear2.y = _local19; m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18))); m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18)); m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2)); m_motorMass = (1 / m_motorMass); if (m_enableLimit){ _local20 = (_local16 - _local6); _local21 = (_local17 - _local7); _local22 = ((_local18 * _local20) + (_local19 * _local21)); if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){ m_limitState = e_equalLimits; } else { if (_local22 <= m_lowerTranslation){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (_local22 >= m_upperTranslation){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; }; }; if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit == false){ m_limitForce = 0; }; if (_arg1.warmStarting){ _local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x))); _local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y))); _local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x))); _local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y))); _local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1))); _local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2))); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28)); } else { m_force = 0; m_torque = 0; m_limitForce = 0; m_motorForce = 0; }; m_limitPositionImpulse = 0; } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } public function SetMaxMotorForce(_arg1:Number):void{ m_maxMotorForce = _arg1; } } }//package Box2D.Dynamics.Joints
Section 61
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2PrismaticJointDef extends b2JointDef { public var localAxis1:b2Vec2; public var referenceAngle:Number; public var maxMotorForce:Number; public var motorSpeed:Number; public var upperTranslation:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var enableLimit:Boolean; public var enableMotor:Boolean; public var lowerTranslation:Number; public function b2PrismaticJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); localAxis1 = new b2Vec2(); super(); type = b2Joint.e_prismaticJoint; localAxis1.Set(1, 0); referenceAngle = 0; enableLimit = false; lowerTranslation = 0; upperTranslation = 0; enableMotor = false; maxMotorForce = 0; motorSpeed = 0; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1 = body1.GetLocalPoint(_arg3); localAnchor2 = body2.GetLocalPoint(_arg3); localAxis1 = body1.GetLocalVector(_arg4); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 62
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2PulleyJoint extends b2Joint { public var m_maxLength1:Number; public var m_maxLength2:Number; public var m_constant:Number; public var m_state:int; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; 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 var m_limitState1:int; public var m_limitState2:int; public var m_ground:b2Body; public var m_force:Number; public var m_limitPositionImpulse2:Number; public var m_limitPositionImpulse1:Number; public var m_ratio:Number; public var m_positionImpulse:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_limitMass1:Number; public var m_limitMass2:Number; public static const b2_minPulleyLength:Number = 2; public function b2PulleyJoint(_arg1:b2PulleyJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u1 = new b2Vec2(); m_u2 = new b2Vec2(); super(_arg1); m_ground = m_body1.m_world.m_groundBody; m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x); m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y); m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x); m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_ratio = _arg1.ratio; m_constant = (_arg1.length1 + (m_ratio * _arg1.length2)); m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength))); m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio)); m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; } public function GetGroundAnchor2():b2Vec2{ var _local1:b2Vec2; _local1 = m_ground.m_xf.position.Copy(); _local1.Add(m_groundAnchor2); return (_local1); } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionTorque():Number{ return (0); } public function GetRatio():Number{ return (m_ratio); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_xf.R; _local5 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); _local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local7 = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6)); _local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6)); _local5 = _local7; _local4 = _local3.m_xf.R; _local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); _local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local7; if (m_state == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13)))); _local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18); _local20 = m_force; m_force = b2Math.b2Max(0, (m_force + _local19)); _local19 = (m_force - _local20); _local14 = ((-(_arg1.dt) * _local19) * m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * m_u1.y); _local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x); _local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; if (m_limitState1 == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11))); _local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18); _local20 = m_limitForce1; m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19)); _local19 = (m_limitForce1 - _local20); _local14 = ((-(_arg1.dt) * _local19) * m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * m_u1.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14)))); }; if (m_limitState2 == e_atUpperLimit){ _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13))); _local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18); _local20 = m_limitForce2; m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19)); _local19 = (m_limitForce2 - _local20); _local16 = ((-(_arg1.dt) * _local19) * m_u2.x); _local17 = ((-(_arg1.dt) * _local19) * m_u2.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2; _local1 = m_u2.Copy(); _local1.Multiply(m_force); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local1:b2Body; var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; _local1 = m_body1; _local2 = m_body2; _local4 = (m_ground.m_xf.position.x + m_groundAnchor1.x); _local5 = (m_ground.m_xf.position.y + m_groundAnchor1.y); _local6 = (m_ground.m_xf.position.x + m_groundAnchor2.x); _local7 = (m_ground.m_xf.position.y + m_groundAnchor2.y); _local23 = 0; if (m_state == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9)); _local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9)); _local8 = _local22; _local3 = _local2.m_xf.R; _local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11)); _local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11)); _local10 = _local22; _local12 = (_local1.m_sweep.c.x + _local8); _local13 = (_local1.m_sweep.c.y + _local9); _local14 = (_local2.m_sweep.c.x + _local10); _local15 = (_local2.m_sweep.c.y + _local11); m_u1.Set((_local12 - _local4), (_local13 - _local5)); m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local16 = m_u1.Length(); _local17 = m_u2.Length(); if (_local16 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / _local16)); } else { m_u1.SetZero(); }; if (_local17 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / _local17)); } else { m_u2.SetZero(); }; _local18 = ((m_constant - _local16) - (m_ratio * _local17)); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_pulleyMass) * _local18); _local20 = m_positionImpulse; m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19)); _local19 = (m_positionImpulse - _local20); _local12 = (-(_local19) * m_u1.x); _local13 = (-(_local19) * m_u1.y); _local14 = ((-(m_ratio) * _local19) * m_u2.x); _local15 = ((-(m_ratio) * _local19) * m_u2.y); _local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12)); _local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13)); _local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12)))); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local1.SynchronizeTransform(); _local2.SynchronizeTransform(); }; if (m_limitState1 == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9)); _local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9)); _local8 = _local22; _local12 = (_local1.m_sweep.c.x + _local8); _local13 = (_local1.m_sweep.c.y + _local9); m_u1.Set((_local12 - _local4), (_local13 - _local5)); _local16 = m_u1.Length(); if (_local16 > b2Settings.b2_linearSlop){ m_u1.x = (m_u1.x * (1 / _local16)); m_u1.y = (m_u1.y * (1 / _local16)); } else { m_u1.SetZero(); }; _local18 = (m_maxLength1 - _local16); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass1) * _local18); _local21 = m_limitPositionImpulse1; m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19)); _local19 = (m_limitPositionImpulse1 - _local21); _local12 = (-(_local19) * m_u1.x); _local13 = (-(_local19) * m_u1.y); _local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12)); _local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13)); _local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12)))); _local1.SynchronizeTransform(); }; if (m_limitState2 == e_atUpperLimit){ _local3 = _local2.m_xf.R; _local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11)); _local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11)); _local10 = _local22; _local14 = (_local2.m_sweep.c.x + _local10); _local15 = (_local2.m_sweep.c.y + _local11); m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local17 = m_u2.Length(); if (_local17 > b2Settings.b2_linearSlop){ m_u2.x = (m_u2.x * (1 / _local17)); m_u2.y = (m_u2.y * (1 / _local17)); } else { m_u2.SetZero(); }; _local18 = (m_maxLength2 - _local17); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass2) * _local18); _local21 = m_limitPositionImpulse2; m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19)); _local19 = (m_limitPositionImpulse2 - _local21); _local14 = (-(_local19) * m_u2.x); _local15 = (-(_local19) * m_u2.y); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local2.SynchronizeTransform(); }; return ((_local23 < b2Settings.b2_linearSlop)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_xf.R; _local5 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); _local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local7 = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6)); _local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6)); _local5 = _local7; _local4 = _local3.m_xf.R; _local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); _local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local7; _local10 = (_local2.m_sweep.c.x + _local5); _local11 = (_local2.m_sweep.c.y + _local6); _local12 = (_local3.m_sweep.c.x + _local8); _local13 = (_local3.m_sweep.c.y + _local9); _local14 = (m_ground.m_xf.position.x + m_groundAnchor1.x); _local15 = (m_ground.m_xf.position.y + m_groundAnchor1.y); _local16 = (m_ground.m_xf.position.x + m_groundAnchor2.x); _local17 = (m_ground.m_xf.position.y + m_groundAnchor2.y); m_u1.Set((_local10 - _local14), (_local11 - _local15)); m_u2.Set((_local12 - _local16), (_local13 - _local17)); _local18 = m_u1.Length(); _local19 = m_u2.Length(); if (_local18 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / _local18)); } else { m_u1.SetZero(); }; if (_local19 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / _local19)); } else { m_u2.SetZero(); }; _local20 = ((m_constant - _local18) - (m_ratio * _local19)); if (_local20 > 0){ m_state = e_inactiveLimit; m_force = 0; } else { m_state = e_atUpperLimit; m_positionImpulse = 0; }; if (_local18 < m_maxLength1){ m_limitState1 = e_inactiveLimit; m_limitForce1 = 0; } else { m_limitState1 = e_atUpperLimit; m_limitPositionImpulse1 = 0; }; if (_local19 < m_maxLength2){ m_limitState2 = e_inactiveLimit; m_limitForce2 = 0; } else { m_limitState2 = e_atUpperLimit; m_limitPositionImpulse2 = 0; }; _local21 = ((_local5 * m_u1.y) - (_local6 * m_u1.x)); _local22 = ((_local8 * m_u2.y) - (_local9 * m_u2.x)); m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21)); m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22)); m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2)); m_limitMass1 = (1 / m_limitMass1); m_limitMass2 = (1 / m_limitMass2); m_pulleyMass = (1 / m_pulleyMass); if (_arg1.warmStarting){ _local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x); _local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y); _local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x); _local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25)))); } else { m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; }; } public function GetLength1():Number{ var _local1:b2Vec2; var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; _local1 = m_body1.GetWorldPoint(m_localAnchor1); _local2 = (m_ground.m_xf.position.x + m_groundAnchor1.x); _local3 = (m_ground.m_xf.position.y + m_groundAnchor1.y); _local4 = (_local1.x - _local2); _local5 = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetLength2():Number{ var _local1:b2Vec2; var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; _local1 = m_body2.GetWorldPoint(m_localAnchor2); _local2 = (m_ground.m_xf.position.x + m_groundAnchor2.x); _local3 = (m_ground.m_xf.position.y + m_groundAnchor2.y); _local4 = (_local1.x - _local2); _local5 = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetGroundAnchor1():b2Vec2{ var _local1:b2Vec2; _local1 = m_ground.m_xf.position.Copy(); _local1.Add(m_groundAnchor1); return (_local1); } } }//package Box2D.Dynamics.Joints
Section 63
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2PulleyJointDef extends b2JointDef { public var maxLength2:Number; public var length1:Number; public var length2:Number; public var maxLength1:Number; public var ratio:Number; public var groundAnchor1:b2Vec2; public var groundAnchor2:b2Vec2; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public function b2PulleyJointDef(){ groundAnchor1 = new b2Vec2(); groundAnchor2 = new b2Vec2(); localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_pulleyJoint; groundAnchor1.Set(-1, 1); groundAnchor2.Set(1, 1); localAnchor1.Set(-1, 0); localAnchor2.Set(1, 0); length1 = 0; maxLength1 = 0; length2 = 0; maxLength2 = 0; ratio = 1; collideConnected = true; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{ var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; body1 = _arg1; body2 = _arg2; groundAnchor1.SetV(_arg3); groundAnchor2.SetV(_arg4); localAnchor1 = body1.GetLocalPoint(_arg5); localAnchor2 = body2.GetLocalPoint(_arg6); _local8 = (_arg5.x - _arg3.x); _local9 = (_arg5.y - _arg3.y); length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); _local10 = (_arg6.x - _arg4.x); _local11 = (_arg6.y - _arg4.y); length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11))); ratio = _arg7; _local12 = (length1 + (ratio * length2)); maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength)); maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio); } } }//package Box2D.Dynamics.Joints
Section 64
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2RevoluteJoint extends b2Joint { public var m_limitForce:Number; public var m_pivotMass:b2Mat22; public var m_enableLimit:Boolean; private var K2:b2Mat22; private var K:b2Mat22; private var K1:b2Mat22; private var K3:b2Mat22; public var m_referenceAngle:Number; public var m_upperAngle:Number; public var m_lowerAngle:Number; public var m_motorForce:Number; public var m_limitState:int; public var m_motorMass:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_pivotForce:b2Vec2; public var m_enableMotor:Boolean; public var m_limitPositionImpulse:Number; public var m_motorSpeed: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 GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerAngle = _arg1; m_upperAngle = _arg2; } public function GetLowerLimit():Number{ return (m_lowerAngle); } public function GetUpperLimit():Number{ return (m_upperAngle); } public function GetJointAngle():Number{ return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle)); } override public function GetReactionTorque():Number{ return (m_limitForce); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_xf.R; _local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); _local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; _local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); _local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; _local11 = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7)); _local12 = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6)); _local13 = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12))); _local14 = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12))); m_pivotForce.x = (m_pivotForce.x + _local13); m_pivotForce.y = (m_pivotForce.y + _local14); _local15 = (_arg1.dt * _local13); _local16 = (_arg1.dt * _local14); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16)); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15)))); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed); _local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17); _local19 = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque); _local18 = (m_motorForce - _local19); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity); _local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + _local21); } else { if (m_limitState == e_atLowerLimit){ _local10 = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0); _local21 = (m_limitForce - _local10); } else { if (m_limitState == e_atUpperLimit){ _local10 = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0); _local21 = (m_limitForce - _local10); }; }; }; _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21)); }; } 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 _local3:b2Body; var _local4:b2Body; var _local5:Number; var _local6:b2Mat22; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; _local3 = m_body1; _local4 = m_body2; _local5 = 0; _local6 = _local3.m_xf.R; _local7 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); _local8 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); _local9 = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8)); _local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8)); _local7 = _local9; _local6 = _local4.m_xf.R; _local10 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); _local11 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11)); _local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11)); _local10 = _local9; _local12 = (_local3.m_sweep.c.x + _local7); _local13 = (_local3.m_sweep.c.y + _local8); _local14 = (_local4.m_sweep.c.x + _local10); _local15 = (_local4.m_sweep.c.y + _local11); _local16 = (_local14 - _local12); _local17 = (_local15 - _local13); _local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17))); _local18 = _local3.m_invMass; _local19 = _local4.m_invMass; _local20 = _local3.m_invI; _local21 = _local4.m_invI; K1.col1.x = (_local18 + _local19); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local18 + _local19); K2.col1.x = ((_local20 * _local8) * _local8); K2.col2.x = ((-(_local20) * _local7) * _local8); K2.col1.y = ((-(_local20) * _local7) * _local8); K2.col2.y = ((_local20 * _local7) * _local7); K3.col1.x = ((_local21 * _local11) * _local11); K3.col2.x = ((-(_local21) * _local10) * _local11); K3.col1.y = ((-(_local21) * _local10) * _local11); K3.col2.y = ((_local21 * _local10) * _local10); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Solve(tImpulse, -(_local16), -(_local17)); _local22 = tImpulse.x; _local23 = tImpulse.y; _local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23)); _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22)))); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22)))); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); _local24 = 0; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle); _local26 = 0; if (m_limitState == e_equalLimits){ _local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); _local26 = (-(m_motorMass) * _local2); _local24 = b2Math.b2Abs(_local2); } else { if (m_limitState == e_atLowerLimit){ _local2 = (_local25 - m_lowerAngle); _local24 = b2Math.b2Max(0, -(_local2)); _local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0); _local26 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0); _local26 = (m_limitPositionImpulse - _local1); } else { if (m_limitState == e_atUpperLimit){ _local2 = (_local25 - m_upperAngle); _local24 = b2Math.b2Max(0, _local2); _local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection); _local26 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0); _local26 = (m_limitPositionImpulse - _local1); }; }; }; _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop)))); } public function GetJointSpeed():Number{ return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity)); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function SetMaxMotorTorque(_arg1:Number):void{ m_maxMotorTorque = _arg1; } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_xf.R; _local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); _local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; _local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); _local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; _local10 = _local2.m_invMass; _local11 = _local3.m_invMass; _local12 = _local2.m_invI; _local13 = _local3.m_invI; K1.col1.x = (_local10 + _local11); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local10 + _local11); K2.col1.x = ((_local12 * _local7) * _local7); K2.col2.x = ((-(_local12) * _local6) * _local7); K2.col1.y = ((-(_local12) * _local6) * _local7); K2.col2.y = ((_local12 * _local6) * _local6); K3.col1.x = ((_local13 * _local9) * _local9); K3.col2.x = ((-(_local13) * _local8) * _local9); K3.col1.y = ((-(_local13) * _local8) * _local9); K3.col2.y = ((_local13 * _local8) * _local8); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Invert(m_pivotMass); m_motorMass = (1 / (_local12 + _local13)); if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit){ _local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle); if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){ m_limitState = e_equalLimits; } else { if (_local14 <= m_lowerAngle){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (_local14 >= m_upperAngle){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; } else { m_limitForce = 0; }; if (_arg1.warmStarting){ _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce))); } else { m_pivotForce.SetZero(); m_motorForce = 0; m_limitForce = 0; }; m_limitPositionImpulse = 0; } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } public function GetMotorTorque():Number{ return (m_motorForce); } } }//package Box2D.Dynamics.Joints
Section 65
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2RevoluteJointDef extends b2JointDef { public var referenceAngle:Number; public var upperAngle:Number; public var lowerAngle:Number; public var motorSpeed:Number; public var maxMotorTorque:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var enableLimit:Boolean; public var enableMotor:Boolean; public function b2RevoluteJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_revoluteJoint; localAnchor1.Set(0, 0); localAnchor2.Set(0, 0); referenceAngle = 0; lowerAngle = 0; upperAngle = 0; maxMotorTorque = 0; motorSpeed = 0; enableLimit = false; enableMotor = false; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1 = body1.GetLocalPoint(_arg3); localAnchor2 = body2.GetLocalPoint(_arg3); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 66
//b2Body (Box2D.Dynamics.b2Body) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2Body { public var m_next:b2Body; public var m_contactList:b2ContactEdge; public var m_angularVelocity:Number; public var m_shapeList:b2Shape; public var m_force:b2Vec2; public var m_mass:Number; public var m_sweep:b2Sweep; public var m_xf:b2XForm; public var m_torque:Number; public var m_userData; public var m_flags:uint; public var m_world:b2World; public var m_prev:b2Body; public var m_invMass:Number; public var m_linearDamping:Number; public var m_type:int; public var m_angularDamping:Number; public var m_invI:Number; public var m_sleepTime:Number; public var m_shapeCount:int; public var m_jointList:b2JointEdge; public var m_linearVelocity:b2Vec2; public var m_I:Number; public static var e_fixedRotationFlag:uint = 64; public static var e_frozenFlag:uint = 2; public static var e_maxTypes:uint = 3; public static var e_sleepFlag:uint = 8; private static var s_massData:b2MassData = new b2MassData(); public static var e_bulletFlag:uint = 32; public static var e_staticType:uint = 1; public static var e_islandFlag:uint = 4; public static var e_allowSleepFlag:uint = 16; private static var s_xf1:b2XForm = new b2XForm(); public static var e_dynamicType:uint = 2; public function b2Body(_arg1:b2BodyDef, _arg2:b2World){ var _local3:b2Mat22; var _local4:b2Vec2; m_xf = new b2XForm(); m_sweep = new b2Sweep(); m_linearVelocity = new b2Vec2(); m_force = new b2Vec2(); super(); m_flags = 0; if (_arg1.isBullet){ m_flags = (m_flags | e_bulletFlag); }; if (_arg1.fixedRotation){ m_flags = (m_flags | e_fixedRotationFlag); }; if (_arg1.allowSleep){ m_flags = (m_flags | e_allowSleepFlag); }; if (_arg1.isSleeping){ m_flags = (m_flags | e_sleepFlag); }; m_world = _arg2; m_xf.position.SetV(_arg1.position); m_xf.R.Set(_arg1.angle); m_sweep.localCenter.SetV(_arg1.massData.center); m_sweep.t0 = 1; m_sweep.a0 = (m_sweep.a = _arg1.angle); _local3 = m_xf.R; _local4 = m_sweep.localCenter; m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_jointList = null; m_contactList = null; m_prev = null; m_next = null; m_linearDamping = _arg1.linearDamping; m_angularDamping = _arg1.angularDamping; m_force.Set(0, 0); m_torque = 0; m_linearVelocity.SetZero(); m_angularVelocity = 0; m_sleepTime = 0; m_invMass = 0; m_I = 0; m_invI = 0; m_mass = _arg1.massData.mass; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if ((m_flags & b2Body.e_fixedRotationFlag) == 0){ m_I = _arg1.massData.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; m_userData = _arg1.userData; m_shapeList = null; m_shapeCount = 0; } public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{ return (new b2Vec2((m_linearVelocity.x - (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.y + (m_angularVelocity * (_arg1.x - m_sweep.c.x))))); } public function SetLinearVelocity(_arg1:b2Vec2):void{ m_linearVelocity.SetV(_arg1); } public function WakeUp():void{ m_flags = (m_flags & ~(e_sleepFlag)); m_sleepTime = 0; } public function GetLocalCenter():b2Vec2{ return (m_sweep.localCenter); } public function SetPosition(_arg1:b2Vec2):void{ m_xf.position = _arg1; } public function GetLinearVelocity():b2Vec2{ return (m_linearVelocity); } public function IsFrozen():Boolean{ return (((m_flags & e_frozenFlag) == e_frozenFlag)); } public function IsDynamic():Boolean{ return ((m_type == e_dynamicType)); } public function ApplyTorque(_arg1:Number):void{ if (IsSleeping()){ WakeUp(); }; m_torque = (m_torque + _arg1); } public function SynchronizeTransform():void{ var _local1:b2Mat22; var _local2:b2Vec2; m_xf.R.Set(m_sweep.a); _local1 = m_xf.R; _local2 = m_sweep.localCenter; m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y))); m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y))); } public function GetInertia():Number{ return (m_I); } public function IsSleeping():Boolean{ return (((m_flags & e_sleepFlag) == e_sleepFlag)); } public function GetJointList():b2JointEdge{ return (m_jointList); } 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 SetMassFromShapes():void{ var _local1:b2Shape; var _local2:Number; var _local3:Number; var _local4:b2MassData; var _local5:b2Mat22; var _local6:b2Vec2; var _local7:int; if (m_world.m_lock == true){ return; }; m_mass = 0; m_invMass = 0; m_I = 0; m_invI = 0; _local2 = 0; _local3 = 0; _local4 = s_massData; _local1 = m_shapeList; while (_local1) { _local1.ComputeMass(_local4); m_mass = (m_mass + _local4.mass); _local2 = (_local2 + (_local4.mass * _local4.center.x)); _local3 = (_local3 + (_local4.mass * _local4.center.y)); m_I = (m_I + _local4.I); _local1 = _local1.m_next; }; if (m_mass > 0){ m_invMass = (1 / m_mass); _local2 = (_local2 * m_invMass); _local3 = (_local3 * m_invMass); }; if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){ m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3)))); m_invI = (1 / m_I); } else { m_I = 0; m_invI = 0; }; m_sweep.localCenter.Set(_local2, _local3); _local5 = m_xf.R; _local6 = m_sweep.localCenter; m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)); m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); _local1 = m_shapeList; while (_local1) { _local1.UpdateSweepRadius(m_sweep.localCenter); _local1 = _local1.m_next; }; _local7 = m_type; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; if (_local7 != m_type){ _local1 = m_shapeList; while (_local1) { _local1.RefilterProxy(m_world.m_broadPhase, m_xf); _local1 = _local1.m_next; }; }; } public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{ var _local3:b2Shape; var _local4:b2Mat22; var _local5:b2Vec2; var _local6:Boolean; var _local7:Boolean; if (m_world.m_lock == true){ return (true); }; if (IsFrozen()){ return (false); }; m_xf.R.Set(_arg2); m_xf.position.SetV(_arg1); _local4 = m_xf.R; _local5 = m_sweep.localCenter; m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y)); m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_sweep.a0 = (m_sweep.a = _arg2); _local6 = false; _local3 = m_shapeList; while (_local3) { _local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf); if (_local7 == false){ _local6 = true; break; }; _local3 = _local3.m_next; }; if (_local6 == true){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local3 = m_shapeList; while (_local3) { _local3.DestroyProxy(m_world.m_broadPhase); _local3 = _local3.m_next; }; return (false); }; m_world.m_broadPhase.Commit(); return (true); } public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulXT(m_xf, _arg1)); } public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (IsSleeping()){ WakeUp(); }; m_force.x = (m_force.x + _arg1.x); m_force.y = (m_force.y + _arg1.y); m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))); } public function ApplyCenterImpulse(_arg1: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 * ((m_sweep.c.x * _arg1.y) - (m_sweep.c.y * _arg1.x)))); } public function SynchronizeShapes():Boolean{ var _local1:b2XForm; var _local2:b2Mat22; var _local3:b2Vec2; var _local4:b2Shape; var _local5:Boolean; _local1 = s_xf1; _local1.R.Set(m_sweep.a0); _local2 = _local1.R; _local3 = m_sweep.localCenter; _local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y))); _local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y))); _local5 = true; _local4 = m_shapeList; while (_local4) { _local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf); if (_local5 == false){ break; }; _local4 = _local4.m_next; }; if (_local5 == false){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local4 = m_shapeList; while (_local4) { _local4.DestroyProxy(m_world.m_broadPhase); _local4 = _local4.m_next; }; return (false); }; return (true); } public function GetAngle():Number{ return (m_sweep.a); } public function GetXForm():b2XForm{ return (m_xf); } public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{ var _local2:b2Mat22; var _local3:b2Vec2; _local2 = m_xf.R; _local3 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y))); _local3.x = (_local3.x + m_xf.position.x); _local3.y = (_local3.y + m_xf.position.y); return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x))))); } public function GetNext():b2Body{ return (m_next); } public function GetMass():Number{ return (m_mass); } public function SetAngularVelocity(_arg1:Number):void{ m_angularVelocity = _arg1; } 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 SetMass(_arg1:b2MassData):void{ var _local2:b2Shape; var _local3:b2Mat22; var _local4:b2Vec2; var _local5:int; if (m_world.m_lock == true){ return; }; m_invMass = 0; m_I = 0; m_invI = 0; m_mass = _arg1.mass; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if ((m_flags & b2Body.e_fixedRotationFlag) == 0){ m_I = _arg1.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; m_sweep.localCenter.SetV(_arg1.center); _local3 = m_xf.R; _local4 = m_sweep.localCenter; m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); _local2 = m_shapeList; while (_local2) { _local2.UpdateSweepRadius(m_sweep.localCenter); _local2 = _local2.m_next; }; _local5 = m_type; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; if (_local5 != m_type){ _local2 = m_shapeList; while (_local2) { _local2.RefilterProxy(m_world.m_broadPhase, m_xf); _local2 = _local2.m_next; }; }; } public function IsStatic():Boolean{ return ((m_type == e_staticType)); } public function GetWorldVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulMV(m_xf.R, _arg1)); } public function GetShapeList():b2Shape{ return (m_shapeList); } public function Advance(_arg1:Number):void{ m_sweep.Advance(_arg1); m_sweep.c.SetV(m_sweep.c0); m_sweep.a = m_sweep.a0; SynchronizeTransform(); } public function SetBullet(_arg1:Boolean):void{ if (_arg1){ m_flags = (m_flags | e_bulletFlag); } else { m_flags = (m_flags & ~(e_bulletFlag)); }; } public function CreateShape(_arg1:b2ShapeDef):b2Shape{ var _local2:b2Shape; if (m_world.m_lock == true){ return (null); }; _local2 = b2Shape.Create(_arg1, m_world.m_blockAllocator); _local2.m_next = m_shapeList; m_shapeList = _local2; m_shapeCount++; _local2.m_body = this; _local2.CreateProxy(m_world.m_broadPhase, m_xf); _local2.UpdateSweepRadius(m_sweep.localCenter); return (_local2); } public function IsConnected(_arg1:b2Body):Boolean{ var _local2:b2JointEdge; _local2 = m_jointList; while (_local2) { if (_local2.other == _arg1){ return ((_local2.joint.m_collideConnected == false)); }; _local2 = _local2.next; }; return (false); } public function DestroyShape(_arg1:b2Shape):void{ var _local2:b2Shape; var _local3:b2Shape; var _local4:Boolean; if (m_world.m_lock == true){ return; }; _arg1.DestroyProxy(m_world.m_broadPhase); _local2 = m_shapeList; _local3 = null; _local4 = false; while (_local2 != null) { if (_local2 == _arg1){ if (_local3){ _local3.m_next = _arg1.m_next; } else { m_shapeList = _arg1.m_next; }; _local4 = true; break; }; _local3 = _local2; _local2 = _local2.m_next; }; _arg1.m_body = null; _arg1.m_next = null; m_shapeCount--; b2Shape.Destroy(_arg1, m_world.m_blockAllocator); } public function ApplyCenterForce(_arg1: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 + ((m_sweep.c.x * _arg1.y) - (m_sweep.c.y * _arg1.x))); } public function LocalToGlobal(_arg1:b2Vec2):b2Vec2{ return (new b2Vec2(((Math.cos((_arg1.GetAngle() + GetAngle())) * _arg1.Length()) + GetPosition().x), ((Math.sin((_arg1.GetAngle() + GetAngle())) * _arg1.Length()) + GetPosition().y))); } public function GetUserData(){ return (m_userData); } public function IsBullet():Boolean{ return (((m_flags & e_bulletFlag) == e_bulletFlag)); } public function GlobalToLocal(_arg1:b2Vec2):b2Vec2{ var _local2:*; _local2 = new b2Vec2((_arg1.x - GetPosition().x), (_arg1.y - GetPosition().y)); return (new b2Vec2((Math.cos((_local2.GetAngle() - GetAngle())) * _local2.Length()), (Math.sin((_local2.GetAngle() - GetAngle())) * _local2.Length()))); } public function GetWorldCenter():b2Vec2{ return (m_sweep.c); } public function AllowSleeping(_arg1:Boolean):void{ if (_arg1){ m_flags = (m_flags | e_allowSleepFlag); } else { m_flags = (m_flags & ~(e_allowSleepFlag)); WakeUp(); }; } public function SetUserData(_arg1):void{ m_userData = _arg1; } public function GetLocalVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulTMV(m_xf.R, _arg1)); } public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{ var _local2:b2Mat22; var _local3:b2Vec2; _local2 = m_xf.R; _local3 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y))); _local3.x = (_local3.x + m_xf.position.x); _local3.y = (_local3.y + m_xf.position.y); return (_local3); } public function GetWorld():b2World{ return (m_world); } public function GetPosition():b2Vec2{ return (m_xf.position); } } }//package Box2D.Dynamics
Section 67
//b2BodyDef (Box2D.Dynamics.b2BodyDef) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; public class b2BodyDef { public var isSleeping:Boolean; public var position:b2Vec2; public var isBullet:Boolean; public var allowSleep:Boolean; public var userData; public var angularDamping:Number; public var fixedRotation:Boolean; public var angle:Number; public var linearDamping:Number; public var massData:b2MassData; public function b2BodyDef(){ massData = new b2MassData(); position = new b2Vec2(); super(); massData.center.SetZero(); massData.mass = 0; massData.I = 0; userData = null; position.Set(0, 0); angle = 0; linearDamping = 0; angularDamping = 0; allowSleep = true; isSleeping = false; fixedRotation = false; isBullet = false; } } }//package Box2D.Dynamics
Section 68
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener) package Box2D.Dynamics { public class b2BoundaryListener { public function Violation(_arg1:b2Body):void{ } } }//package Box2D.Dynamics
Section 69
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; public class b2ContactFilter { public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter); ; public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{ var _local3:b2FilterData; var _local4:b2FilterData; var _local5:Boolean; _local3 = _arg1.GetFilterData(); _local4 = _arg2.GetFilterData(); if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){ return ((_local3.groupIndex > 0)); }; _local5 = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0)))); return (_local5); } } }//package Box2D.Dynamics
Section 70
//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 71
//b2ContactManager (Box2D.Dynamics.b2ContactManager) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; public class b2ContactManager extends b2PairCallback { public var m_world:b2World; public var m_destroyImmediate:Boolean; public var m_nullContact:b2NullContact; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2ContactManager(){ m_nullContact = new b2NullContact(); super(); m_world = null; m_destroyImmediate = false; } override public function PairAdded(_arg1, _arg2){ var _local3:b2Shape; var _local4:b2Shape; var _local5:b2Body; var _local6:b2Body; var _local7:b2Contact; _local3 = (_arg1 as b2Shape); _local4 = (_arg2 as b2Shape); _local5 = _local3.m_body; _local6 = _local4.m_body; if (((_local5.IsStatic()) && (_local6.IsStatic()))){ return (m_nullContact); }; if (_local3.m_body == _local4.m_body){ return (m_nullContact); }; if (_local6.IsConnected(_local5)){ return (m_nullContact); }; if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){ return (m_nullContact); }; _local7 = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator); if (_local7 == null){ return (m_nullContact); }; _local3 = _local7.m_shape1; _local4 = _local7.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; _local7.m_prev = null; _local7.m_next = m_world.m_contactList; if (m_world.m_contactList != null){ m_world.m_contactList.m_prev = _local7; }; m_world.m_contactList = _local7; _local7.m_node1.contact = _local7; _local7.m_node1.other = _local6; _local7.m_node1.prev = null; _local7.m_node1.next = _local5.m_contactList; if (_local5.m_contactList != null){ _local5.m_contactList.prev = _local7.m_node1; }; _local5.m_contactList = _local7.m_node1; _local7.m_node2.contact = _local7; _local7.m_node2.other = _local5; _local7.m_node2.prev = null; _local7.m_node2.next = _local6.m_contactList; if (_local6.m_contactList != null){ _local6.m_contactList.prev = _local7.m_node2; }; _local6.m_contactList = _local7.m_node2; m_world.m_contactCount++; return (_local7); } override public function PairRemoved(_arg1, _arg2, _arg3):void{ var _local4:b2Contact; if (_arg3 == null){ return; }; _local4 = (_arg3 as b2Contact); if (_local4 == m_nullContact){ return; }; Destroy(_local4); } public function Destroy(_arg1:b2Contact):void{ var _local2:b2Shape; var _local3:b2Shape; var _local4:int; var _local5:b2Body; var _local6:b2Body; var _local7:b2Body; var _local8:b2Body; var _local9:Array; var _local10:b2ContactPoint; var _local11:int; var _local12:b2Manifold; var _local13:int; var _local14:b2ManifoldPoint; var _local15:b2Vec2; var _local16:b2Vec2; _local2 = _arg1.m_shape1; _local3 = _arg1.m_shape2; _local4 = _arg1.m_manifoldCount; if ((((_local4 > 0)) && (m_world.m_contactListener))){ _local7 = _local2.m_body; _local8 = _local3.m_body; _local9 = _arg1.GetManifolds(); _local10 = s_evalCP; _local10.shape1 = _arg1.m_shape1; _local10.shape2 = _arg1.m_shape2; _local10.friction = _arg1.m_friction; _local10.restitution = _arg1.m_restitution; _local11 = 0; while (_local11 < _local4) { _local12 = _local9[_local11]; _local10.normal.SetV(_local12.normal); _local13 = 0; while (_local13 < _local12.pointCount) { _local14 = _local12.points[_local13]; _local10.position = _local7.GetWorldPoint(_local14.localPoint1); _local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1); _local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2); _local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y)); _local10.separation = _local14.separation; _local10.id.key = _local14.id._key; m_world.m_contactListener.Remove(_local10); _local13++; }; _local11++; }; }; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_world.m_contactList){ m_world.m_contactList = _arg1.m_next; }; _local5 = _local2.m_body; _local6 = _local3.m_body; if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local5.m_contactList){ _local5.m_contactList = _arg1.m_node1.next; }; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local6.m_contactList){ _local6.m_contactList = _arg1.m_node2.next; }; b2Contact.Destroy(_arg1, m_world.m_blockAllocator); m_world.m_contactCount--; } public function Collide():void{ var _local1:b2Contact; var _local2:b2Body; var _local3:b2Body; _local1 = m_world.m_contactList; while (_local1) { _local2 = _local1.m_shape1.m_body; _local3 = _local1.m_shape2.m_body; if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){ } else { _local1.Update(m_world.m_contactListener); }; _local1 = _local1.m_next; }; } } }//package Box2D.Dynamics
Section 72
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import flash.display.*; 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_lineThickness:Number;// = 1 public var m_drawFlags:uint; public var m_sprite:Sprite; public var m_drawScale:Number;// = 1 public static var e_coreShapeBit:uint = 4; public static var e_shapeBit:uint = 1; public static var e_centerOfMassBit:uint = 64; public static var e_aabbBit:uint = 8; public static var e_obbBit:uint = 16; public static var e_pairBit:uint = 32; public static var e_jointBit:uint = 2; public function b2DebugDraw(){ m_drawScale = 1; m_lineThickness = 1; m_alpha = 1; m_fillAlpha = 1; m_xformScale = 1; super(); m_drawFlags = 0; } public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ var _local4:int; m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha); _local4 = 1; while (_local4 < _arg2) { m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale)); _local4++; }; m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); m_sprite.graphics.endFill(); } public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale)); } public function DrawXForm(_arg1:b2XForm):void{ m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha); m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale)); m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha); m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale)); } public function ClearFlags(_arg1:uint):void{ m_drawFlags = (m_drawFlags & ~(_arg1)); } public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha); m_sprite.graphics.moveTo(0, 0); m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha); m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale)); m_sprite.graphics.endFill(); m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale)); } public function SetFlags(_arg1:uint):void{ m_drawFlags = _arg1; } public function AppendFlags(_arg1:uint):void{ m_drawFlags = (m_drawFlags | _arg1); } public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, 9151693, m_alpha); m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale)); m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale)); } public function GetFlags():uint{ return (m_drawFlags); } public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ var _local4:int; m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); _local4 = 1; while (_local4 < _arg2) { m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale)); _local4++; }; m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); } } }//package Box2D.Dynamics
Section 73
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Joints.*; public class b2DestructionListener { public function SayGoodbyeJoint(_arg1:b2Joint):void{ } public function SayGoodbyeShape(_arg1:b2Shape):void{ } } }//package Box2D.Dynamics
Section 74
//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_joints:Array; public var m_listener:b2ContactListener; public var m_positionIterationCount:int; public var m_bodyCapacity:int; public var m_bodies:Array; public var m_jointCapacity:int; public var m_contactCount:int; public var m_contacts:Array; public var m_contactCapacity:int; public var m_jointCount:int; public var m_allocator; public var m_bodyCount:int; private static var s_reportCR:b2ContactResult = new b2ContactResult(); public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){ var _local6:int; super(); m_bodyCapacity = _arg1; m_contactCapacity = _arg2; m_jointCapacity = _arg3; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_allocator = _arg4; m_listener = _arg5; m_bodies = new Array(_arg1); _local6 = 0; while (_local6 < _arg1) { m_bodies[_local6] = null; _local6++; }; m_contacts = new Array(_arg2); _local6 = 0; while (_local6 < _arg2) { m_contacts[_local6] = null; _local6++; }; m_joints = new Array(_arg3); _local6 = 0; while (_local6 < _arg3) { m_joints[_local6] = null; _local6++; }; m_positionIterationCount = 0; } public function AddBody(_arg1:b2Body):void{ var _local2 = m_bodyCount++; m_bodies[_local2] = _arg1; } public function AddJoint(_arg1:b2Joint):void{ var _local2 = m_jointCount++; m_joints[_local2] = _arg1; } public function Report(_arg1:Array):void{ var _local2:b2Mat22; var _local3:b2Vec2; var _local4:int; var _local5:b2Contact; var _local6:b2ContactConstraint; var _local7:b2ContactResult; var _local8:b2Body; var _local9:int; var _local10:Array; var _local11:int; var _local12:b2Manifold; var _local13:int; var _local14:b2ManifoldPoint; var _local15:b2ContactConstraintPoint; if (m_listener == null){ return; }; _local4 = 0; while (_local4 < m_contactCount) { _local5 = m_contacts[_local4]; _local6 = _arg1[_local4]; _local7 = s_reportCR; _local7.shape1 = _local5.m_shape1; _local7.shape2 = _local5.m_shape2; _local8 = _local7.shape1.m_body; _local9 = _local5.m_manifoldCount; _local10 = _local5.GetManifolds(); _local11 = 0; while (_local11 < _local9) { _local12 = _local10[_local11]; _local7.normal.SetV(_local12.normal); _local13 = 0; while (_local13 < _local12.pointCount) { _local14 = _local12.points[_local13]; _local15 = _local6.points[_local13]; _local7.position = _local8.GetWorldPoint(_local14.localPoint1); _local7.normalImpulse = _local15.normalImpulse; _local7.tangentImpulse = _local15.tangentImpulse; _local7.id.key = _local14.id.key; m_listener.Result(_local7); _local13++; }; _local11++; }; _local4++; }; } public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{ var _local5:int; var _local6:b2Body; var _local7:b2Joint; var _local8:b2ContactSolver; var _local9:int; var _local10:Boolean; var _local11:Boolean; var _local12:Boolean; var _local13:Number; var _local14:Number; var _local15:Number; _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.IsStatic()){ } else { _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x)))); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y)))); _local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque)); _local6.m_force.SetZero(); _local6.m_torque = 0; _local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1)); _local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1)); if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){ _local6.m_linearVelocity.Normalize(); _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity); }; if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){ if (_local6.m_angularVelocity < 0){ _local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity); } else { _local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity; }; }; }; _local5++; }; _local8 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator); _local8.InitVelocityConstraints(_arg1); _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local7.InitVelocityConstraints(_arg1); _local5++; }; _local5 = 0; while (_local5 < _arg1.maxIterations) { _local8.SolveVelocityConstraints(); _local9 = 0; while (_local9 < m_jointCount) { _local7 = m_joints[_local9]; _local7.SolveVelocityConstraints(_arg1); _local9++; }; _local5++; }; _local8.FinalizeVelocityConstraints(); _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.IsStatic()){ } else { _local6.m_sweep.c0.SetV(_local6.m_sweep.c); _local6.m_sweep.a0 = _local6.m_sweep.a; _local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x)); _local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y)); _local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity)); _local6.SynchronizeTransform(); }; _local5++; }; if (_arg3){ _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local7.InitPositionConstraints(); _local5++; }; m_positionIterationCount = 0; while (m_positionIterationCount < _arg1.maxIterations) { _local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte); _local11 = true; _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local12 = _local7.SolvePositionConstraints(); _local11 = ((_local11) && (_local12)); _local5++; }; if (((_local10) && (_local11))){ break; }; m_positionIterationCount++; }; }; Report(_local8.m_constraints); if (_arg4){ _local13 = Number.MAX_VALUE; _local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance); _local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance); _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.m_invMass == 0){ } else { if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){ _local6.m_sleepTime = 0; _local13 = 0; }; if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){ _local6.m_sleepTime = 0; _local13 = 0; } else { _local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt); _local13 = b2Math.b2Min(_local13, _local6.m_sleepTime); }; }; _local5++; }; if (_local13 >= b2Settings.b2_timeToSleep){ _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag); _local6.m_linearVelocity.SetZero(); _local6.m_angularVelocity = 0; _local5++; }; }; }; } public function AddContact(_arg1:b2Contact):void{ var _local2 = m_contactCount++; m_contacts[_local2] = _arg1; } public function Clear():void{ m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:int; var _local3:b2ContactSolver; var _local4:Number; var _local5:b2Body; var _local6:Boolean; _local3 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator); _local2 = 0; while (_local2 < _arg1.maxIterations) { _local3.SolveVelocityConstraints(); _local2++; }; _local2 = 0; while (_local2 < m_bodyCount) { _local5 = m_bodies[_local2]; if (_local5.IsStatic()){ } else { _local5.m_sweep.c0.SetV(_local5.m_sweep.c); _local5.m_sweep.a0 = _local5.m_sweep.a; _local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x)); _local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y)); _local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity)); _local5.SynchronizeTransform(); }; _local2++; }; _local4 = 0.75; _local2 = 0; while (_local2 < _arg1.maxIterations) { _local6 = _local3.SolvePositionConstraints(_local4); if (_local6){ break; }; _local2++; }; Report(_local3.m_constraints); } } }//package Box2D.Dynamics
Section 75
//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 76
//b2World (Box2D.Dynamics.b2World) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; 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_allowSleep:Boolean; public var m_broadPhase:b2BroadPhase; public var m_destructionListener:b2DestructionListener; public var m_jointCount:int; public var m_bodyCount:int; public var m_lock:Boolean; public var m_positionIterationCount:int; public var m_groundBody:b2Body; public var m_contactCount:int; public var m_debugDraw:b2DebugDraw; public var m_contactFilter:b2ContactFilter; public var m_bodyList:b2Body; public var m_stackAllocator; public var m_jointList:b2Joint; public var m_gravity:b2Vec2; public var m_contactManager:b2ContactManager; private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8); public static var m_continuousPhysics:Boolean; public static var m_warmStarting:Boolean; private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6); public static var m_positionCorrection:Boolean; private static var s_xf:b2XForm = new b2XForm(); public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){ var _local4:b2BodyDef; m_contactManager = new b2ContactManager(); super(); m_destructionListener = null; m_boundaryListener = null; m_contactFilter = b2ContactFilter.b2_defaultFilter; m_contactListener = null; m_debugDraw = null; m_bodyList = null; m_contactList = null; m_jointList = null; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_positionCorrection = true; m_warmStarting = true; m_continuousPhysics = true; m_allowSleep = _arg3; m_gravity = _arg2; m_lock = false; m_inv_dt0 = 0; m_contactManager.m_world = this; m_broadPhase = new b2BroadPhase(_arg1, m_contactManager); _local4 = new b2BodyDef(); m_groundBody = CreateBody(_local4); } public function DrawJoint(_arg1:b2Joint):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2XForm; var _local5:b2XForm; var _local6:b2Vec2; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:b2Vec2; var _local10:b2Color; var _local11:b2PulleyJoint; var _local12:b2Vec2; var _local13:b2Vec2; _local2 = _arg1.m_body1; _local3 = _arg1.m_body2; _local4 = _local2.m_xf; _local5 = _local3.m_xf; _local6 = _local4.position; _local7 = _local5.position; _local8 = _arg1.GetAnchor1(); _local9 = _arg1.GetAnchor2(); _local10 = s_jointColor; switch (_arg1.m_type){ case b2Joint.e_distanceJoint: m_debugDraw.DrawSegment(_local8, _local9, _local10); break; case b2Joint.e_pulleyJoint: _local11 = (_arg1 as b2PulleyJoint); _local12 = _local11.GetGroundAnchor1(); _local13 = _local11.GetGroundAnchor2(); m_debugDraw.DrawSegment(_local12, _local8, _local10); m_debugDraw.DrawSegment(_local13, _local9, _local10); m_debugDraw.DrawSegment(_local12, _local13, _local10); break; case b2Joint.e_mouseJoint: m_debugDraw.DrawSegment(_local8, _local9, _local10); break; default: if (_local2 != m_groundBody){ m_debugDraw.DrawSegment(_local6, _local8, _local10); }; m_debugDraw.DrawSegment(_local8, _local9, _local10); if (_local3 != m_groundBody){ m_debugDraw.DrawSegment(_local7, _local9, _local10); }; }; } public function Refilter(_arg1:b2Shape):void{ _arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf); } public function SetDebugDraw(_arg1:b2DebugDraw):void{ m_debugDraw = _arg1; } public function SetContinuousPhysics(_arg1:Boolean):void{ m_continuousPhysics = _arg1; } public function GetProxyCount():int{ return (m_broadPhase.m_proxyCount); } public function DrawDebugData():void{ var _local1:uint; var _local2:int; var _local3:b2Body; var _local4:b2Shape; var _local5:b2Joint; var _local6:b2BroadPhase; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:b2Vec2; var _local10:b2Color; var _local11:b2XForm; var _local12:b2AABB; var _local13:b2AABB; var _local14:Array; var _local15:Boolean; var _local16:uint; var _local17:b2Pair; var _local18:b2Proxy; var _local19:b2Proxy; var _local20:b2Vec2; var _local21:b2Vec2; var _local22:b2Proxy; var _local23:b2PolygonShape; var _local24:b2OBB; var _local25:b2Vec2; var _local26:b2Mat22; var _local27:b2Vec2; var _local28:Number; if (m_debugDraw == null){ return; }; m_debugDraw.m_sprite.graphics.clear(); _local1 = m_debugDraw.GetFlags(); _local7 = new b2Vec2(); _local8 = new b2Vec2(); _local9 = new b2Vec2(); _local10 = new b2Color(0, 0, 0); _local12 = new b2AABB(); _local13 = new b2AABB(); _local14 = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()]; if ((_local1 & b2DebugDraw.e_shapeBit)){ _local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit); _local3 = m_bodyList; while (_local3) { _local11 = _local3.m_xf; _local4 = _local3.GetShapeList(); while (_local4) { if (_local3.IsStatic()){ DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15); } else { if (_local3.IsSleeping()){ DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15); } else { DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15); }; }; _local4 = _local4.m_next; }; _local3 = _local3.m_next; }; }; if ((_local1 & b2DebugDraw.e_jointBit)){ _local5 = m_jointList; while (_local5) { DrawJoint(_local5); _local5 = _local5.m_next; }; }; if ((_local1 & b2DebugDraw.e_pairBit)){ _local6 = m_broadPhase; _local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y)); _local10.Set(0.9, 0.9, 0.3); _local2 = 0; while (_local2 < b2Pair.b2_tableCapacity) { _local16 = _local6.m_pairManager.m_hashTable[_local2]; while (_local16 != b2Pair.b2_nullPair) { _local17 = _local6.m_pairManager.m_pairs[_local16]; _local18 = _local6.m_proxyPool[_local17.proxyId1]; _local19 = _local6.m_proxyPool[_local17.proxyId2]; _local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value)); _local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value)); _local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value)); _local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value)); _local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value)); _local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value)); _local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value)); _local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value)); _local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x)); _local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y)); _local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x)); _local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y)); m_debugDraw.DrawSegment(_local8, _local9, _local10); _local16 = _local17.next; }; _local2++; }; }; if ((_local1 & b2DebugDraw.e_aabbBit)){ _local6 = m_broadPhase; _local20 = _local6.m_worldAABB.lowerBound; _local21 = _local6.m_worldAABB.upperBound; _local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y)); _local10.Set(0.9, 0.3, 0.9); _local2 = 0; while (_local2 < b2Settings.b2_maxProxies) { _local22 = _local6.m_proxyPool[_local2]; if (_local22.IsValid() == false){ } else { _local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value)); _local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value)); _local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value)); _local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value)); _local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y); _local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y); _local14[2].Set(_local12.upperBound.x, _local12.upperBound.y); _local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y); m_debugDraw.DrawPolygon(_local14, 4, _local10); }; _local2++; }; _local14[0].Set(_local20.x, _local20.y); _local14[1].Set(_local21.x, _local20.y); _local14[2].Set(_local21.x, _local21.y); _local14[3].Set(_local20.x, _local21.y); m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9)); }; if ((_local1 & b2DebugDraw.e_obbBit)){ _local10.Set(0.5, 0.3, 0.5); _local3 = m_bodyList; while (_local3) { _local11 = _local3.m_xf; _local4 = _local3.GetShapeList(); while (_local4) { if (_local4.m_type != b2Shape.e_polygonShape){ } else { _local23 = (_local4 as b2PolygonShape); _local24 = _local23.GetOBB(); _local25 = _local24.extents; _local14[0].Set(-(_local25.x), -(_local25.y)); _local14[1].Set(_local25.x, -(_local25.y)); _local14[2].Set(_local25.x, _local25.y); _local14[3].Set(-(_local25.x), _local25.y); _local2 = 0; while (_local2 < 4) { _local26 = _local24.R; _local27 = _local14[_local2]; _local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y))); _local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y))); _local14[_local2].x = _local28; _local26 = _local11.R; _local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y))); _local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y))); _local14[_local2].x = _local28; _local2++; }; m_debugDraw.DrawPolygon(_local14, 4, _local10); }; _local4 = _local4.m_next; }; _local3 = _local3.m_next; }; }; if ((_local1 & b2DebugDraw.e_centerOfMassBit)){ _local3 = m_bodyList; while (_local3) { _local11 = s_xf; _local11.R = _local3.m_xf.R; _local11.position = _local3.GetWorldCenter(); m_debugDraw.DrawXForm(_local11); _local3 = _local3.m_next; }; }; } public function DestroyBody(_arg1:b2Body):void{ var _local2:b2JointEdge; var _local3:b2Shape; var _local4:b2JointEdge; var _local5:b2Shape; if (m_lock == true){ return; }; _local2 = _arg1.m_jointList; while (_local2) { _local4 = _local2; _local2 = _local2.next; if (m_destructionListener){ m_destructionListener.SayGoodbyeJoint(_local4.joint); }; DestroyJoint(_local4.joint); }; _local3 = _arg1.m_shapeList; while (_local3) { _local5 = _local3; _local3 = _local3.m_next; if (m_destructionListener){ m_destructionListener.SayGoodbyeShape(_local5); }; _local5.DestroyProxy(m_broadPhase); b2Shape.Destroy(_local5, m_blockAllocator); }; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_bodyList){ m_bodyList = _arg1.m_next; }; m_bodyCount--; } public function SetContactFilter(_arg1:b2ContactFilter):void{ m_contactFilter = _arg1; } public function GetGroundBody():b2Body{ return (m_groundBody); } public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{ var _local5:b2Color; var _local6:b2CircleShape; var _local7:b2Vec2; var _local8:Number; var _local9:b2Vec2; var _local10:int; var _local11:b2PolygonShape; var _local12:int; var _local13:Array; var _local14:Array; var _local15:Array; _local5 = s_coreColor; switch (_arg1.m_type){ case b2Shape.e_circleShape: _local6 = (_arg1 as b2CircleShape); _local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition); _local8 = _local6.m_radius; _local9 = _arg2.R.col1; m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3); if (_arg4){ m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5); }; break; case b2Shape.e_polygonShape: _local11 = (_arg1 as b2PolygonShape); _local12 = _local11.GetVertexCount(); _local13 = _local11.GetVertices(); _local14 = new Array(b2Settings.b2_maxPolygonVertices); _local10 = 0; while (_local10 < _local12) { _local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]); _local10++; }; m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3); if (_arg4){ _local15 = _local11.GetCoreVertices(); _local10 = 0; while (_local10 < _local12) { _local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]); _local10++; }; m_debugDraw.DrawPolygon(_local14, _local12, _local5); }; break; }; } public function GetContactCount():int{ return (m_contactCount); } public function Solve(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Island; var _local4:b2Contact; var _local5:b2Joint; var _local6:int; var _local7:Array; var _local8:b2Body; var _local9:int; var _local10:int; var _local11:b2Body; var _local12:b2ContactEdge; var _local13:b2JointEdge; var _local14:Boolean; m_positionIterationCount = 0; _local3 = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener); _local2 = m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2 = _local2.m_next; }; _local4 = m_contactList; while (_local4) { _local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag)); _local4 = _local4.m_next; }; _local5 = m_jointList; while (_local5) { _local5.m_islandFlag = false; _local5 = _local5.m_next; }; _local6 = m_bodyCount; _local7 = new Array(_local6); _local8 = m_bodyList; while (_local8) { if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){ } else { if (_local8.IsStatic()){ } else { _local3.Clear(); _local9 = 0; var _temp1 = _local9; _local9 = (_local9 + 1); var _local15 = _temp1; _local7[_local15] = _local8; _local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag); while (_local9 > 0) { --_local9; _local2 = _local7[_local9]; _local3.AddBody(_local2); _local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag)); if (_local2.IsStatic()){ } else { _local12 = _local2.m_contactList; while (_local12) { if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){ } else { if (_local12.contact.m_manifoldCount == 0){ } else { _local3.AddContact(_local12.contact); _local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag); _local11 = _local12.other; if ((_local11.m_flags & b2Body.e_islandFlag)){ } else { var _temp2 = _local9; _local9 = (_local9 + 1); var _local16 = _temp2; _local7[_local16] = _local11; _local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag); }; }; }; _local12 = _local12.next; }; _local13 = _local2.m_jointList; while (_local13) { if (_local13.joint.m_islandFlag == true){ } else { _local3.AddJoint(_local13.joint); _local13.joint.m_islandFlag = true; _local11 = _local13.other; if ((_local11.m_flags & b2Body.e_islandFlag)){ } else { var _temp3 = _local9; _local9 = (_local9 + 1); _local16 = _temp3; _local7[_local16] = _local11; _local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag); }; }; _local13 = _local13.next; }; }; }; _local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep); if (_local3.m_positionIterationCount > m_positionIterationCount){ m_positionIterationCount = _local3.m_positionIterationCount; }; _local10 = 0; while (_local10 < _local3.m_bodyCount) { _local2 = _local3.m_bodies[_local10]; if (_local2.IsStatic()){ _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); }; _local10++; }; }; }; _local8 = _local8.m_next; }; _local2 = m_bodyList; while (_local2) { if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (_local2.IsStatic()){ } else { _local14 = _local2.SynchronizeShapes(); if ((((_local14 == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(_local2); }; }; }; _local2 = _local2.m_next; }; m_broadPhase.Commit(); } public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{ var _local4:Array; var _local5:int; var _local6:int; _local4 = new Array(_arg3); _local5 = m_broadPhase.QueryAABB(_arg1, _local4, _arg3); _local6 = 0; while (_local6 < _local5) { _arg2[_local6] = _local4[_local6]; _local6++; }; return (_local5); } public function SetGravity(_arg1:b2Vec2):void{ m_gravity = _arg1; } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Shape; var _local4:b2Shape; var _local5:b2Body; var _local6:b2Body; var _local7:b2ContactEdge; var _local8:b2Island; var _local9:int; var _local10:Array; var _local11:b2Contact; var _local12:b2Contact; var _local13:Number; var _local14:b2Body; var _local15:int; var _local16:b2TimeStep; var _local17:int; var _local18:Number; var _local19:Number; var _local20:b2Body; var _local21:Boolean; _local8 = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener); _local9 = m_bodyCount; _local10 = new Array(_local9); _local2 = m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2.m_sweep.t0 = 0; _local2 = _local2.m_next; }; _local11 = m_contactList; while (_local11) { _local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); _local11 = _local11.m_next; }; while (true) { _local12 = null; _local13 = 1; _local11 = m_contactList; for (;_local11;(_local11 = _local11.m_next)) { if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){ } else { _local18 = 1; if ((_local11.m_flags & b2Contact.e_toiFlag)){ _local18 = _local11.m_toi; } else { _local3 = _local11.m_shape1; _local4 = _local11.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){ continue; }; _local19 = _local5.m_sweep.t0; if (_local5.m_sweep.t0 < _local6.m_sweep.t0){ _local19 = _local6.m_sweep.t0; _local5.m_sweep.Advance(_local19); } else { if (_local6.m_sweep.t0 < _local5.m_sweep.t0){ _local19 = _local5.m_sweep.t0; _local6.m_sweep.Advance(_local19); }; }; _local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep); if ((((_local18 > 0)) && ((_local18 < 1)))){ _local18 = (((1 - _local18) * _local19) + _local18); if (_local18 > 1){ _local18 = 1; }; }; _local11.m_toi = _local18; _local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag); }; if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){ _local12 = _local11; _local13 = _local18; }; }; }; if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){ break; }; _local3 = _local12.m_shape1; _local4 = _local12.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; _local5.Advance(_local13); _local6.Advance(_local13); _local12.Update(m_contactListener); _local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag)); if (_local12.m_manifoldCount == 0){ } else { _local14 = _local5; if (_local14.IsStatic()){ _local14 = _local6; }; _local8.Clear(); _local15 = 0; var _temp1 = _local15; _local15 = (_local15 + 1); var _local22 = _temp1; _local10[_local22] = _local14; _local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag); while (_local15 > 0) { --_local15; _local2 = _local10[_local15]; _local8.AddBody(_local2); _local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag)); if (_local2.IsStatic()){ } else { _local7 = _local2.m_contactList; while (_local7) { if (_local8.m_contactCount == _local8.m_contactCapacity){ } else { if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){ } else { if (_local7.contact.m_manifoldCount == 0){ } else { _local8.AddContact(_local7.contact); _local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag); _local20 = _local7.other; if ((_local20.m_flags & b2Body.e_islandFlag)){ } else { if (_local20.IsStatic() == false){ _local20.Advance(_local13); _local20.WakeUp(); }; var _temp2 = _local15; _local15 = (_local15 + 1); var _local23 = _temp2; _local10[_local23] = _local20; _local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag); }; }; }; }; _local7 = _local7.next; }; }; }; _local16 = new b2TimeStep(); _local16.dt = ((1 - _local13) * _arg1.dt); _local16.inv_dt = (1 / _local16.dt); _local16.maxIterations = _arg1.maxIterations; _local8.SolveTOI(_local16); _local17 = 0; while (_local17 < _local8.m_bodyCount) { _local2 = _local8.m_bodies[_local17]; _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (_local2.IsStatic()){ } else { _local21 = _local2.SynchronizeShapes(); if ((((_local21 == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(_local2); }; _local7 = _local2.m_contactList; while (_local7) { _local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag)); _local7 = _local7.next; }; }; }; _local17++; }; _local17 = 0; while (_local17 < _local8.m_contactCount) { _local11 = _local8.m_contacts[_local17]; _local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); _local17++; }; m_broadPhase.Commit(); }; }; } public function GetJointList():b2Joint{ return (m_jointList); } public function Validate():void{ m_broadPhase.Validate(); } public function GetPairCount():int{ return (m_broadPhase.m_pairManager.m_pairCount); } public function GetBodyList():b2Body{ return (m_bodyList); } public function SetWarmStarting(_arg1:Boolean):void{ m_warmStarting = _arg1; } public function SetPositionCorrection(_arg1:Boolean):void{ m_positionCorrection = _arg1; } public function CreateJoint(_arg1:b2JointDef):b2Joint{ var _local2:b2Joint; var _local3:b2Body; var _local4:b2Shape; _local2 = b2Joint.Create(_arg1, m_blockAllocator); _local2.m_prev = null; _local2.m_next = m_jointList; if (m_jointList){ m_jointList.m_prev = _local2; }; m_jointList = _local2; m_jointCount++; _local2.m_node1.joint = _local2; _local2.m_node1.other = _local2.m_body2; _local2.m_node1.prev = null; _local2.m_node1.next = _local2.m_body1.m_jointList; if (_local2.m_body1.m_jointList){ _local2.m_body1.m_jointList.prev = _local2.m_node1; }; _local2.m_body1.m_jointList = _local2.m_node1; _local2.m_node2.joint = _local2; _local2.m_node2.other = _local2.m_body1; _local2.m_node2.prev = null; _local2.m_node2.next = _local2.m_body2.m_jointList; if (_local2.m_body2.m_jointList){ _local2.m_body2.m_jointList.prev = _local2.m_node2; }; _local2.m_body2.m_jointList = _local2.m_node2; if (_arg1.collideConnected == false){ _local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2; _local4 = _local3.m_shapeList; while (_local4) { _local4.RefilterProxy(m_broadPhase, _local3.m_xf); _local4 = _local4.m_next; }; }; return (_local2); } public function DestroyJoint(_arg1:b2Joint):void{ var _local2:Boolean; var _local3:b2Body; var _local4:b2Body; var _local5:b2Body; var _local6:b2Shape; _local2 = _arg1.m_collideConnected; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_jointList){ m_jointList = _arg1.m_next; }; _local3 = _arg1.m_body1; _local4 = _arg1.m_body2; _local3.WakeUp(); _local4.WakeUp(); if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local3.m_jointList){ _local3.m_jointList = _arg1.m_node1.next; }; _arg1.m_node1.prev = null; _arg1.m_node1.next = null; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local4.m_jointList){ _local4.m_jointList = _arg1.m_node2.next; }; _arg1.m_node2.prev = null; _arg1.m_node2.next = null; b2Joint.Destroy(_arg1, m_blockAllocator); m_jointCount--; if (_local2 == false){ _local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4; _local6 = _local5.m_shapeList; while (_local6) { _local6.RefilterProxy(m_broadPhase, _local5.m_xf); _local6 = _local6.m_next; }; }; } public function SetContactListener(_arg1:b2ContactListener):void{ m_contactListener = _arg1; } public function CreateBody(_arg1:b2BodyDef):b2Body{ var _local2:b2Body; if (m_lock == true){ return (null); }; _local2 = new b2Body(_arg1, this); _local2.m_prev = null; _local2.m_next = m_bodyList; if (m_bodyList){ m_bodyList.m_prev = _local2; }; m_bodyList = _local2; m_bodyCount++; return (_local2); } public function SetBoundaryListener(_arg1:b2BoundaryListener):void{ m_boundaryListener = _arg1; } public function SetDestructionListener(_arg1:b2DestructionListener):void{ m_destructionListener = _arg1; } public function Step(_arg1:Number, _arg2:int):void{ var _local3:b2TimeStep; m_lock = true; _local3 = new b2TimeStep(); _local3.dt = _arg1; _local3.maxIterations = _arg2; if (_arg1 > 0){ _local3.inv_dt = (1 / _arg1); } else { _local3.inv_dt = 0; }; _local3.dtRatio = (m_inv_dt0 * _arg1); _local3.positionCorrection = m_positionCorrection; _local3.warmStarting = m_warmStarting; m_contactManager.Collide(); if (_local3.dt > 0){ Solve(_local3); }; if (((m_continuousPhysics) && ((_local3.dt > 0)))){ SolveTOI(_local3); }; 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 77
//sounds_7 (game_fla.sounds_7) package game_fla { import flash.display.*; public dynamic class sounds_7 extends MovieClip { public function sounds_7(){ addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package game_fla
Section 78
//MochiCoins (mochi.as3.MochiCoins) package mochi.as3 { public class MochiCoins { public static const STORE_HIDE:String = "StoreHide"; public static const NO_USER:String = "NoUser"; public static const IO_ERROR:String = "IOError"; public static const ITEM_NEW:String = "ItemNew"; public static const ITEM_OWNED:String = "ItemOwned"; public static const STORE_ITEMS:String = "StoreItems"; public static const ERROR:String = "Error"; public static const STORE_SHOW:String = "StoreShow"; public static var _inventory:MochiInventory; public static function triggerEvent(_arg1:String, _arg2:Object):void{ MochiSocial.triggerEvent(_arg1, _arg2); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ MochiSocial.removeEventListener(_arg1, _arg2); } public static function addEventListener(_arg1:String, _arg2:Function):void{ MochiSocial.addEventListener(_arg1, _arg2); } public static function getStoreItems():void{ MochiServices.send("coins_getStoreItems"); } public static function get inventory():MochiInventory{ return (_inventory); } public static function showStore(_arg1:Object=null):void{ MochiServices.bringToTop(); MochiServices.send("coins_showStore", {options:_arg1}, null, null); } public static function showItem(_arg1:Object=null):void{ if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){ trace("ERROR: showItem call must pass an Object with an item key"); return; }; MochiServices.bringToTop(); MochiServices.send("coins_showItem", {options:_arg1}, null, null); } public static function getVersion():String{ return (MochiServices.getVersion()); } public static function showVideo(_arg1:Object=null):void{ if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){ trace("ERROR: showVideo call must pass an Object with an item key"); return; }; MochiServices.bringToTop(); MochiServices.send("coins_showVideo", {options:_arg1}, null, null); } MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{ _inventory = new MochiInventory(); }); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{ _inventory = null; }); } }//package mochi.as3
Section 79
//MochiDigits (mochi.as3.MochiDigits) package mochi.as3 { public final class MochiDigits { private var Sibling:MochiDigits; private var Fragment:Number; private var Encoder:Number; public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{ Encoder = 0; setValue(_arg1, _arg2); } public function set value(_arg1:Number):void{ setValue(_arg1); } public function reencode():void{ var _local1:uint; _local1 = int((2147483647 * Math.random())); Fragment = (Fragment ^ (_local1 ^ Encoder)); Encoder = _local1; } public function toString():String{ var _local1:String; _local1 = String.fromCharCode((Fragment ^ Encoder)); if (Sibling != null){ _local1 = (_local1 + Sibling.toString()); }; return (_local1); } public function get value():Number{ return (Number(this.toString())); } public function setValue(_arg1:Number=0, _arg2:uint=0):void{ var _local3:String; _local3 = _arg1.toString(); var _temp1 = _arg2; _arg2 = (_arg2 + 1); Fragment = (_local3.charCodeAt(_temp1) ^ Encoder); if (_arg2 < _local3.length){ Sibling = new MochiDigits(_arg1, _arg2); } else { Sibling = null; }; reencode(); } public function addValue(_arg1:Number):void{ value = (value + _arg1); } } }//package mochi.as3
Section 80
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher) package mochi.as3 { public class MochiEventDispatcher { private var eventTable:Object; public function MochiEventDispatcher():void{ eventTable = {}; } public function triggerEvent(_arg1:String, _arg2:Object):void{ var _local3:Object; if (eventTable[_arg1] == undefined){ return; }; for (_local3 in eventTable[_arg1]) { var _local6 = eventTable[_arg1]; _local6[_local3](_arg2); }; } public function removeEventListener(_arg1:String, _arg2:Function):void{ var _local3:Object; if (eventTable[_arg1] == undefined){ eventTable[_arg1] = []; return; }; for (_local3 in eventTable[_arg1]) { if (eventTable[_arg1][_local3] != _arg2){ } else { eventTable[_arg1].splice(Number(_local3), 1); }; }; } public function addEventListener(_arg1:String, _arg2:Function):void{ removeEventListener(_arg1, _arg2); eventTable[_arg1].push(_arg2); } } }//package mochi.as3
Section 81
//MochiEvents (mochi.as3.MochiEvents) package mochi.as3 { import flash.display.*; public class MochiEvents { public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL"; public static const FORMAT_LONG:String = "LongForm"; public static const ALIGN_BOTTOM:String = "ALIGN_B"; public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived"; public static const FORMAT_SHORT:String = "ShortForm"; public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR"; public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR"; public static const ALIGN_TOP:String = "ALIGN_T"; public static const ALIGN_LEFT:String = "ALIGN_L"; public static const ALIGN_RIGHT:String = "ALIGN_R"; public static const ALIGN_TOP_LEFT:String = "ALIGN_TL"; public static const ALIGN_CENTER:String = "ALIGN_C"; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); private static var gameStart:Number; private static var levelStart:Number; public static function endPlay():void{ MochiServices.send("events_clearRoundID", null, null, null); } public static function addEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.addEventListener(_arg1, _arg2); } public static function trackEvent(_arg1:String, _arg2=null):void{ MochiServices.send("events_trackEvent", {tag:_arg1, value:_arg2}, null, null); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.removeEventListener(_arg1, _arg2); } public static function startSession(_arg1:String):void{ MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null); } public static function triggerEvent(_arg1:String, _arg2:Object):void{ _dispatcher.triggerEvent(_arg1, _arg2); } public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{ var _local3:Object; var _local4:Object; _local3 = {}; for (_local4 in _arg2) { _local3[_local4] = _arg2[_local4]; }; _local3.clip = _arg1; MochiServices.send("events_setNotifications", _local3, null, null); } public static function getVersion():String{ return (MochiServices.getVersion()); } public static function startPlay(_arg1:String="gameplay"):void{ MochiServices.send("events_setRoundID", {tag:String(_arg1)}, null, null); } } }//package mochi.as3
Section 82
//MochiInventory (mochi.as3.MochiInventory) package mochi.as3 { import flash.utils.*; import flash.events.*; public dynamic class MochiInventory extends Proxy { private var _timer:Timer; private var _names:Array; private var _consumableProperties:Object; private var _syncID:Number; private var _storeSync:Object; private var _outstandingID:Number; private var _syncPending:Boolean; public static const READY:String = "InvReady"; public static const ERROR:String = "Error"; public static const IO_ERROR:String = "IoError"; private static const KEY_SALT:String = " syncMaint"; public static const WRITTEN:String = "InvWritten"; public static const NOT_READY:String = "InvNotReady"; public static const VALUE_ERROR:String = "InvValueError"; private static const CONSUMER_KEY:String = "MochiConsumables"; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); public function MochiInventory():void{ MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned); MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems); MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut); _storeSync = new Object(); _syncPending = false; _outstandingID = 0; _syncID = 0; _timer = new Timer(1000); _timer.addEventListener(TimerEvent.TIMER, sync); _timer.start(); if (MochiSocial.loggedIn){ loggedIn(); } else { loggedOut(); }; } private function newItems(_arg1:Object):void{ if (!this[(_arg1.id + KEY_SALT)]){ this[(_arg1.id + KEY_SALT)] = 0; }; if (!this[_arg1.id]){ this[_arg1.id] = 0; }; this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count); this[_arg1.id] = (this[_arg1.id] + _arg1.count); if (_arg1.privateProperties.consumable){ if (!this[_arg1.privateProperties.tag]){ this[_arg1.privateProperties.tag] = 0; }; this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.count)); }; } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){ if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return (-1); }; if (_consumableProperties[_arg1]){ return (MochiDigits(_consumableProperties[_arg1]).value); }; return (undefined); } public function release():void{ MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems); MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn); MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{ if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return (false); }; if (_consumableProperties[_arg1] == undefined){ return (false); }; return (true); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{ return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1)); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{ var _local3:MochiDigits; if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return; }; if (!(_arg2 is Number)){ triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2}); return; }; if (_consumableProperties[_arg1]){ _local3 = MochiDigits(_consumableProperties[_arg1]); if (_local3.value == _arg2){ return; }; _local3.value = _arg2; } else { _names.push(_arg1); _consumableProperties[_arg1] = new MochiDigits(_arg2); }; _syncID++; } private function sync(_arg1:Event=null):void{ var _local2:Object; var _local3:String; if (((_syncPending) || ((_syncID == _outstandingID)))){ return; }; _outstandingID = _syncID; _local2 = {}; for (_local3 in _consumableProperties) { _local2[_local3] = MochiDigits(_consumableProperties[_local3]).value; }; MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag); _syncPending = true; } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{ return (_names[(_arg1 - 1)]); } private function loggedIn(_arg1:Object=null):void{ MochiUserData.get(CONSUMER_KEY, getConsumableBag); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{ if (!_consumableProperties[_arg1]){ return (false); }; _names.splice(_names.indexOf(_arg1), 1); delete _consumableProperties[_arg1]; return (true); } private function itemOwned(_arg1:Object):void{ _storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count}; } private function putConsumableBag(_arg1:MochiUserData):void{ _syncPending = false; if (_arg1.error){ triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error}); _outstandingID = -1; }; triggerEvent(WRITTEN, {}); } private function getConsumableBag(_arg1:MochiUserData):void{ var _local2:String; var _local3:Number; if (_arg1.error){ triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error}); return; }; _consumableProperties = {}; _names = new Array(); if (_arg1.data){ for (_local2 in _arg1.data) { _names.push(_local2); _consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]); }; }; for (_local2 in _storeSync) { _local3 = _storeSync[_local2].count; if (_consumableProperties[(_local2 + KEY_SALT)]){ _local3 = (_local3 - _consumableProperties[_local2]); }; if (_local3 == 0){ } else { newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties}); }; }; triggerEvent(READY, {}); } private function loggedOut(_arg1:Object=null):void{ _consumableProperties = null; } public static function triggerEvent(_arg1:String, _arg2:Object):void{ _dispatcher.triggerEvent(_arg1, _arg2); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.removeEventListener(_arg1, _arg2); } public static function addEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.addEventListener(_arg1, _arg2); } } }//package mochi.as3
Section 83
//MochiScores (mochi.as3.MochiScores) package mochi.as3 { import flash.display.*; import flash.text.*; public class MochiScores { private static var boardID:String; public static var onErrorHandler:Object; public static var onCloseHandler:Object; public static function showLeaderboard(_arg1:Object=null):void{ var n:Number; var options = _arg1; if (options != null){ delete options.clip; MochiServices.setContainer(); MochiServices.bringToTop(); if (options.name != null){ if ((options.name is TextField)){ if (options.name.text.length > 0){ options.name = options.name.text; }; }; }; if (options.score != null){ if ((options.score is TextField)){ if (options.score.text.length > 0){ options.score = options.score.text; }; } else { if ((options.score is MochiDigits)){ options.score = options.score.value; }; }; n = Number(options.score); if (isNaN(n)){ trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'")); } else { if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){ trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite")); } else { if (Math.floor(n) != n){ trace((("WARNING: Submitted score '" + options.score) + "' will be truncated")); }; options.score = n; }; }; }; if (options.onDisplay != null){ options.onDisplay(); } else { if (MochiServices.clip != null){ if ((MochiServices.clip is MovieClip)){ MochiServices.clip.stop(); } else { trace("Warning: Container is not a MovieClip, cannot call default onDisplay."); }; }; }; } else { options = {}; if ((MochiServices.clip is MovieClip)){ MochiServices.clip.stop(); } else { trace("Warning: Container is not a MovieClip, cannot call default onDisplay."); }; }; if (options.onClose != null){ onCloseHandler = options.onClose; } else { onCloseHandler = function ():void{ if ((MochiServices.clip is MovieClip)){ MochiServices.clip.play(); } else { trace("Warning: Container is not a MovieClip, cannot call default onClose."); }; }; }; if (options.onError != null){ onErrorHandler = options.onError; } else { onErrorHandler = null; }; if (options.boardID == null){ if (MochiScores.boardID != null){ options.boardID = MochiScores.boardID; }; }; MochiServices.warnID(options.boardID, true); trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal"); MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose); } public static function closeLeaderboard():void{ MochiServices.send("scores_closeLeaderboard"); } public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{ MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2); } public static function requestList(_arg1:Object, _arg2:Object=null):void{ MochiServices.send("scores_requestList", null, _arg1, _arg2); } public static function scoresArrayToObjects(_arg1:Object):Object{ var _local2:Object; var _local3:Number; var _local4:Number; var _local5:Object; var _local6:Object; var _local7:String; var _local8:String; _local2 = {}; for (_local7 in _arg1) { if (typeof(_arg1[_local7]) == "object"){ if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){ _local2[_local7] = []; _local5 = _arg1[_local7]; _local4 = 0; while (_local4 < _local5.rows.length) { _local6 = {}; _local3 = 0; while (_local3 < _local5.cols.length) { _local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3]; _local3++; }; _local2[_local7].push(_local6); _local4++; }; } else { _local2[_local7] = {}; for (_local8 in _arg1[_local7]) { _local2[_local7][_local8] = _arg1[_local7][_local8]; }; }; } else { _local2[_local7] = _arg1[_local7]; }; }; return (_local2); } public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{ _arg1 = Number(_arg1); if (isNaN(_arg1)){ trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'")); } else { if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){ trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite")); } else { if (Math.floor(_arg1) != _arg1){ trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated")); }; _arg1 = Number(_arg1); }; }; MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4); } public static function onClose(_arg1:Object=null):void{ if (((((_arg1) && ((_arg1.error == true)))) && (onErrorHandler))){ if (_arg1.errorCode == null){ _arg1.errorCode = "IOError"; }; onErrorHandler(_arg1.errorCode); MochiServices.doClose(); return; }; onCloseHandler(); MochiServices.doClose(); } public static function setBoardID(_arg1:String):void{ MochiServices.warnID(_arg1, true); MochiScores.boardID = _arg1; MochiServices.send("scores_setBoardID", {boardID:_arg1}); } } }//package mochi.as3
Section 84
//MochiServices (mochi.as3.MochiServices) package mochi.as3 { import flash.geom.*; import flash.display.*; import flash.utils.*; import flash.net.*; import flash.events.*; import flash.system.*; public class MochiServices { private static var _container:Object; private static var _connected:Boolean = false; private static var _queue:Array; private static var _swfVersion:String; private static var _preserved:Object; public static var netupAttempted:Boolean = false; private static var _sendChannel:LocalConnection; public static var servicesSync:MochiSync = new MochiSync(); private static var _nextCallbackID:Number; private static var _clip:MovieClip; private static var _id:String; private static var _services:String = "services.swf"; private static var _servURL:String = "http://www.mochiads.com/static/lib/services/"; public static var widget:Boolean = false; private static var _timer:Timer; private static var _sendChannelName:String; private static var _loader:Loader; private static var _callbacks:Object; private static var _connecting:Boolean = false; private static var _mochiLocalConnection:MovieClip; private static var _listenChannelName:String = "__ms_"; public static var onError:Object; public static var netup:Boolean = true; private static var _mochiLC:String = "MochiLC.swf"; public static function isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } public static function get connected():Boolean{ return (_connected); } private static function onReceive(_arg1:Object):void{ var cb:String; var cblst:Object; var method:*; var methodName:String; var obj:Object; var pkg = _arg1; cb = pkg.callbackID; cblst = _callbacks[cb]; if (!cblst){ return; }; method = cblst.callbackMethod; methodName = ""; obj = cblst.callbackObject; if (((obj) && ((typeof(method) == "string")))){ methodName = method; if (obj[method] != null){ method = obj[method]; } else { trace((("Error: Method " + method) + " does not exist.")); }; }; if (method != undefined){ try { method.apply(obj, pkg.args); } catch(error:Error) { trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString())); }; } else { if (obj != null){ try { obj(pkg.args); } catch(error:Error) { trace(("Error invoking method on object: " + error.toString())); }; }; }; delete _callbacks[cb]; } public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{ if (_connected){ _mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_nextCallbackID}); } else { if ((((_clip == null)) || (!(_connecting)))){ trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1)); handleError(_arg2, _arg3, _arg4); flush(true); return; }; _queue.push({methodName:_arg1, args:_arg2, callbackID:_nextCallbackID}); }; if (_clip != null){ if (_callbacks != null){ _callbacks[_nextCallbackID] = {callbackObject:_arg3, callbackMethod:_arg4}; _nextCallbackID++; }; }; } private static function init(_arg1:String, _arg2:Object):void{ _id = _arg1; if (_arg2 != null){ _container = _arg2; loadCommunicator(_arg1, _container); }; } public static function get childClip():Object{ return (_clip); } private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{ var _local3:Array; var _local4:int; var _local5:Array; var _local6:Array; var _local7:MovieClip; var _local8:LocalConnection; var _local9:String; var _local10:ByteArray; var _local11:ByteArray; var _local12:uint; var _local13:uint; var _local14:Loader; _local3 = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23]; _local5 = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3]; _local6 = [0, 64, 0, 0, 0]; _local7 = new MovieClip(); _local8 = new LocalConnection(); _local9 = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time)); _local8 = new LocalConnection(); _local7.lc = _local8; _local7.click = _arg2; _local8.client = _local7; _local8.connect(_local9); _local10 = new ByteArray(); _local11 = new ByteArray(); _local11.endian = Endian.LITTLE_ENDIAN; _local11.writeShort(1); _local11.writeUTFBytes(((_arg1 + " ") + _local9)); _local11.writeByte(0); _local12 = ((_local3.length + _local11.length) + 4); _local13 = (_local12 + 35); _local10.endian = Endian.LITTLE_ENDIAN; _local10.writeUTFBytes("FWS"); _local10.writeByte(8); _local10.writeUnsignedInt(_local13); for each (_local4 in _local5) { _local10.writeByte(_local4); }; _local10.writeUnsignedInt(_local12); _local10.writeByte(136); _local10.writeShort(_local11.length); _local10.writeBytes(_local11); for each (_local4 in _local3) { _local10.writeByte(_local4); }; for each (_local4 in _local6) { _local10.writeByte(_local4); }; _local14 = new Loader(); _local14.loadBytes(_local10); _local7.addChild(_local14); return (_local7); } public static function stayOnTop():void{ _container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true); if (_clip != null){ _clip.visible = true; }; } public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{ var vars:Object; var avm1Click:DisplayObject; var s:String; var i:Number; var x:String; var req:URLRequest; var loader:Loader; var setURL:Function; var err:Function; var complete:Function; var url = _arg1; var burl = _arg2; var btn = _arg3; var onClick = _arg4; vars = new Object(); vars["mav"] = getVersion(); vars["swfv"] = "9"; vars["swfurl"] = btn.loaderInfo.loaderURL; vars["fv"] = Capabilities.version; vars["os"] = Capabilities.os; vars["lang"] = Capabilities.language; vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY); s = "?"; i = 0; for (x in vars) { if (i != 0){ s = (s + "&"); }; i = (i + 1); s = (((s + x) + "=") + escape(vars[x])); }; req = new URLRequest("http://x.mochiads.com/linkping.swf"); loader = new Loader(); setURL = function (_arg1:String):void{ var _local2:Rectangle; if (avm1Click){ btn.removeChild(avm1Click); }; avm1Click = clickMovie(_arg1, onClick); _local2 = btn.getBounds(btn); btn.addChild(avm1Click); avm1Click.x = _local2.x; avm1Click.y = _local2.y; avm1Click.scaleX = (0.01 * _local2.width); avm1Click.scaleY = (0.01 * _local2.height); }; err = function (_arg1:Object):void{ netup = false; _arg1.target.removeEventListener(_arg1.type, arguments.callee); setURL(burl); }; complete = function (_arg1:Object):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); }; if (netup){ setURL((url + s)); } else { setURL(burl); }; if (!((netupAttempted) || (_connected))){ netupAttempted = true; loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete); loader.load(req); }; } public static function disconnect():void{ if (((_connected) || (_connecting))){ if (_clip != null){ if (_clip.parent != null){ if ((_clip.parent is Sprite)){ Sprite(_clip.parent).removeChild(_clip); _clip = null; }; }; }; _connecting = (_connected = false); flush(true); try { _mochiLocalConnection.close(); } catch(error:Error) { }; }; if (_timer != null){ try { _timer.stop(); } catch(error:Error) { }; }; } public static function allowDomains(_arg1:String):String{ var _local2:String; if (Security.sandboxType != "application"){ Security.allowDomain("*"); Security.allowInsecureDomain("*"); }; if (_arg1.indexOf("http://") != -1){ _local2 = _arg1.split("/")[2].split(":")[0]; if (Security.sandboxType != "application"){ Security.allowDomain(_local2); Security.allowInsecureDomain(_local2); }; }; return (_local2); } public static function getVersion():String{ return ("3.8 as3"); } public static function doClose():void{ _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); } public static function warnID(_arg1:String, _arg2:Boolean):void{ var _local3:Number; _arg1 = _arg1.toLowerCase(); if (_arg1.length != 16){ trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length")); return; } else { if (_arg1 == "1e113c7239048b3f"){ if (_arg2){ trace("WARNING: Using testing board ID"); } else { trace("WARNING: Using testing board ID as game ID"); }; return; } else { if (_arg1 == "84993a1de4031cd8"){ if (_arg2){ trace("WARNING: Using testing game ID as board ID"); } else { trace("WARNING: Using testing game ID"); }; return; }; }; }; _local3 = 0; while (_local3 < _arg1.length) { switch (_arg1.charAt(_local3)){ case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": case "a": case "b": case "c": case "d": case "e": case "f": break; default: trace(("WARNING: Board ID contains illegal characters: " + _arg1)); return; }; _local3++; }; } private static function flush(_arg1:Boolean):void{ var _local2:Object; var _local3:Object; if (((_clip) && (_queue))){ while (_queue.length > 0) { _local2 = _queue.shift(); _local3 = null; if (_local2 != null){ if (_local2.callbackID != null){ _local3 = _callbacks[_local2.callbackID]; }; delete _callbacks[_local2.callbackID]; if (((_arg1) && (!((_local3 == null))))){ handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod); }; }; }; }; } public static function get id():String{ return (_id); } private static function onEvent(_arg1:Object):void{ var _local2:String; var _local3:String; _local2 = _arg1.target; _local3 = _arg1.event; switch (_local2){ case "events": MochiEvents.triggerEvent(_arg1.event, _arg1.args); break; case "coins": MochiCoins.triggerEvent(_arg1.event, _arg1.args); break; case "sync": servicesSync.triggerEvent(_arg1.event, _arg1.args); break; }; } private static function urlOptions(_arg1:Object):Object{ var _local2:Object; var _local3:String; var _local4:Array; var _local5:Number; var _local6:Array; _local2 = {}; if (_arg1.stage){ _local3 = _arg1.stage.loaderInfo.parameters.mochiad_options; } else { _local3 = _arg1.loaderInfo.parameters.mochiad_options; }; if (_local3){ _local4 = _local3.split("&"); _local5 = 0; while (_local5 < _local4.length) { _local6 = _local4[_local5].split("="); _local2[unescape(_local6[0])] = unescape(_local6[1]); _local5++; }; }; return (_local2); } public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{ if (_clip.parent){ _clip.parent.removeChild(_clip); }; if (_arg1 != null){ if ((_arg1 is DisplayObjectContainer)){ _container = _arg1; }; }; if (_arg2){ if ((_container is DisplayObjectContainer)){ DisplayObjectContainer(_container).addChild(_clip); }; }; } private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{ var args = _arg1; var callbackObject = _arg2; var callbackMethod = _arg3; if (args != null){ if (args.onError != null){ args.onError.apply(null, ["NotConnected"]); }; if (((!((args.options == null))) && (!((args.options.onError == null))))){ args.options.onError.apply(null, ["NotConnected"]); }; }; if (callbackMethod != null){ args = {}; args.error = true; args.errorCode = "NotConnected"; if (((!((callbackObject == null))) && ((callbackMethod is String)))){ try { var _local5 = callbackObject; _local5[callbackMethod](args); } catch(error:Error) { }; } else { if (callbackMethod != null){ try { callbackMethod.apply(args); } catch(error:Error) { }; }; }; }; } private static function loadError(_arg1:Object):void{ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load."); MochiServices.disconnect(); MochiServices.onError("IOError"); } private static function initComChannels():void{ if (!_connected){ trace("[SERVICES_API] connected!"); _connecting = false; _connected = true; _mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"}); _mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL}); _clip.onReceive = onReceive; _clip.onEvent = onEvent; _clip.onError = function ():void{ MochiServices.onError("IOError"); }; while (_queue.length > 0) { _mochiLocalConnection.send(_sendChannelName, "onReceive", _queue.shift()); }; }; } private static function loadLCBridge(_arg1:Object):void{ var loader:Loader; var mochiLCURL:String; var req:URLRequest; var complete:Function; var clip = _arg1; loader = new Loader(); mochiLCURL = (_servURL + _mochiLC); req = new URLRequest(mochiLCURL); complete = function (_arg1:Object):void{ _mochiLocalConnection = MovieClip(loader.content); listen(); }; loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError); loader.load(req); clip.addChild(loader); } private static function listen():void{ _mochiLocalConnection.connect(_listenChannelName); _clip.handshake = function (_arg1:Object):void{ MochiServices.comChannelName = _arg1.newChannel; }; trace("Waiting for MochiAds services to connect..."); } public static function get clip():Object{ return (_container); } public static function set comChannelName(_arg1:String):void{ if (_arg1 != null){ if (_arg1.length > 3){ _sendChannelName = (_arg1 + "_fromgame"); initComChannels(); }; }; } private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{ var _local3:String; var _local4:URLRequest; var _local5:URLVariables; if (_clip != null){ return (_clip); }; if (!MochiServices.isNetworkAvailable()){ return (null); }; if (urlOptions(_arg2).servURL){ _servURL = urlOptions(_arg2).servURL; }; _local3 = (_servURL + _services); if (urlOptions(_arg2).servicesURL){ _local3 = urlOptions(_arg2).servicesURL; }; _listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999)))); MochiServices.allowDomains(_local3); _clip = new MovieClip(); loadLCBridge(_clip); _loader = new Loader(); _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError); _local4 = new URLRequest(_local3); _local5 = new URLVariables(); _local5.listenLC = _listenChannelName; _local5.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options; _local5.api_version = getVersion(); if (widget){ _local5.widget = true; }; _local4.data = _local5; _loader.load(_local4); _clip.addChild(_loader); _sendChannel = new LocalConnection(); _queue = []; _nextCallbackID = 0; _callbacks = {}; _timer = new Timer(10000, 1); _timer.addEventListener(TimerEvent.TIMER, connectWait); _timer.start(); return (_clip); } public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{ var id = _arg1; var clip = _arg2; var onError = _arg3; warnID(id, false); if ((clip is DisplayObject)){ if (clip.stage == null){ trace("MochiServices connect requires the containing clip be attached to the stage"); }; if (((!(_connected)) && ((_clip == null)))){ trace("MochiServices Connecting..."); _connecting = true; init(id, clip); }; } else { trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage."); }; if (onError != null){ MochiServices.onError = onError; } else { if (MochiServices.onError == null){ MochiServices.onError = function (_arg1:String):void{ trace(_arg1); }; }; }; } public static function updateCopy(_arg1:Object):void{ MochiServices.send("coins_updateCopy", _arg1, null, null); } public static function bringToTop(_arg1:Event=null):void{ var e = _arg1; if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){ try { if (MochiServices.clip.numChildren > 1){ MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1)); }; } catch(errorObject:Error) { trace("Warning: Depth sort error."); _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); }; }; } public static function connectWait(_arg1:TimerEvent):void{ if (!_connected){ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load. (timeout)"); MochiServices.disconnect(); MochiServices.onError("IOError"); }; } } }//package mochi.as3
Section 85
//MochiSocial (mochi.as3.MochiSocial) package mochi.as3 { public class MochiSocial { public static const LOGGED_IN:String = "LoggedIn"; public static const PROFILE_HIDE:String = "ProfileHide"; public static const NO_USER:String = "NoUser"; public static const PROPERTIES_SIZE:String = "PropertiesSize"; public static const IO_ERROR:String = "IOError"; public static const PROPERTIES_SAVED:String = "PropertySaved"; public static const WIDGET_LOADED:String = "WidgetLoaded"; public static const USER_INFO:String = "UserInfo"; public static const ERROR:String = "Error"; public static const LOGIN_SHOW:String = "LoginShow"; public static const LOGGED_OUT:String = "LoggedOut"; public static const PROFILE_SHOW:String = "ProfileShow"; public static const LOGIN_SHOWN:String = "LoginShown"; public static const LOGIN_HIDE:String = "LoginHide"; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); public static var _user_info:Object = null; public static function getVersion():String{ return (MochiServices.getVersion()); } public static function saveUserProperties(_arg1:Object):void{ MochiServices.send("coins_saveUserProperties", _arg1); } public static function get loggedIn():Boolean{ return (!((_user_info == null))); } public static function triggerEvent(_arg1:String, _arg2:Object):void{ _dispatcher.triggerEvent(_arg1, _arg2); } public static function addEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.addEventListener(_arg1, _arg2); } public static function getUserInfo():void{ MochiServices.send("coins_getUserInfo"); } public static function showLoginWidget(_arg1:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("coins_showLoginWidget", {options:_arg1}); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.removeEventListener(_arg1, _arg2); } public static function requestLogin():void{ MochiServices.send("coins_requestLogin"); } public static function getAPIURL():String{ if (!_user_info){ return (null); }; return (_user_info.api_url); } public static function hideLoginWidget():void{ MochiServices.send("coins_hideLoginWidget"); } public static function getAPIToken():String{ if (!_user_info){ return (null); }; return (_user_info.api_token); } MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{ _user_info = _arg1; }); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{ _user_info = null; }); } }//package mochi.as3
Section 86
//MochiSync (mochi.as3.MochiSync) package mochi.as3 { import flash.utils.*; public dynamic class MochiSync extends Proxy { private var _syncContainer:Object; public static var SYNC_PROPERTY:String = "UpdateProperty"; public static var SYNC_REQUEST:String = "SyncRequest"; public function MochiSync():void{ _syncContainer = {}; } public function triggerEvent(_arg1:String, _arg2:Object):void{ switch (_arg1){ case SYNC_REQUEST: MochiServices.send("sync_syncronize", _syncContainer); break; case SYNC_PROPERTY: _syncContainer[_arg2.name] = _arg2.value; break; }; } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){ return (_syncContainer[_arg1]); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{ var _local3:String; if (_syncContainer[_arg1] == _arg2){ return; }; _local3 = _arg1.toString(); _syncContainer[_local3] = _arg2; MochiServices.send("sync_propUpdate", {name:_local3, value:_arg2}); } } }//package mochi.as3
Section 87
//MochiUserData (mochi.as3.MochiUserData) package mochi.as3 { import flash.utils.*; import flash.net.*; import flash.events.*; public class MochiUserData extends EventDispatcher { public var callback:Function;// = null public var error:Event;// = null public var key:String;// = null public var operation:String;// = null public var data;// = null public var _loader:URLLoader; public function MochiUserData(_arg1:String="", _arg2:Function=null){ key = null; data = null; error = null; operation = null; callback = null; super(); this.key = _arg1; this.callback = _arg2; } public function securityErrorHandler(_arg1:SecurityErrorEvent):void{ errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString()))); } public function putEvent(_arg1):void{ request("put", serialize(_arg1)); } public function request(_arg1:String, _arg2:ByteArray):void{ var api_url:String; var api_token:String; var args:URLVariables; var req:URLRequest; var _operation = _arg1; var _data = _arg2; operation = _operation; api_url = MochiSocial.getAPIURL(); api_token = MochiSocial.getAPIToken(); if ((((api_url == null)) || ((api_token == null)))){ errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in")); return; }; _loader = new URLLoader(); args = new URLVariables(); args.op = _operation; args.key = key; req = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString())); req.method = URLRequestMethod.POST; req.contentType = "application/x-mochi-userdata"; req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)]; req.data = _data; _loader.dataFormat = URLLoaderDataFormat.BINARY; _loader.addEventListener(Event.COMPLETE, completeHandler); _loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); _loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); try { _loader.load(req); } catch(e:SecurityError) { errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString()))); }; } public function completeHandler(_arg1:Event):void{ var event = _arg1; try { if (_loader.data.length){ data = deserialize(_loader.data); } else { data = null; }; } catch(e:Error) { errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString()))); return; }; if (callback != null){ performCallback(); } else { dispatchEvent(event); }; close(); } public function performCallback():void{ try { callback(this); } catch(e:Error) { trace(("[MochiUserData] exception during callback: " + e)); }; } public function serialize(_arg1):ByteArray{ var _local2:ByteArray; _local2 = new ByteArray(); _local2.objectEncoding = ObjectEncoding.AMF3; _local2.writeObject(_arg1); _local2.compress(); return (_local2); } public function errorHandler(_arg1:IOErrorEvent):void{ data = null; error = _arg1; if (callback != null){ performCallback(); } else { dispatchEvent(_arg1); }; close(); } public function getEvent():void{ request("get", serialize(null)); } override public function toString():String{ return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]")); } public function close():void{ if (_loader){ _loader.removeEventListener(Event.COMPLETE, completeHandler); _loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler); _loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); _loader.close(); _loader = null; }; error = null; callback = null; } public function deserialize(_arg1:ByteArray){ _arg1.objectEncoding = ObjectEncoding.AMF3; _arg1.uncompress(); return (_arg1.readObject()); } public static function get(_arg1:String, _arg2:Function):void{ var _local3:MochiUserData; _local3 = new MochiUserData(_arg1, _arg2); _local3.getEvent(); } public static function put(_arg1:String, _arg2, _arg3:Function):void{ var _local4:MochiUserData; _local4 = new MochiUserData(_arg1, _arg3); _local4.putEvent(_arg2); } } }//package mochi.as3
Section 88
//IGetSetValue (src.interfaces.IGetSetValue) package src.interfaces { public interface IGetSetValue { function get value(); function set value(_arg1):void; } }//package src.interfaces
Section 89
//IPanelElement (src.interfaces.IPanelElement) package src.interfaces { import flash.geom.*; public interface IPanelElement { function setPosition(_arg1:Point):void; function getGabarites():Point; } }//package src.interfaces
Section 90
//mBar (src.interfaces.mBar) package src.interfaces { import flash.display.*; import src.*; public class mBar extends mBaseInterface implements IGetSetValue { public const BLINK_TTH = 30; public var bar:MovieClip; public var maxWidth:Number; public var blinkTtf;// = 0 public function mBar(_arg1:MovieClip, _arg2:String, _arg3:String, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number):void{ blinkTtf = 0; super(); x = _arg4; y = _arg5; _arg1.addChild(this); utils.drawTiles(this, _arg3, 1, (-(_arg6) / 2), (-(_arg7) / 2), _arg6, _arg7, 0); bar = new MovieClip(); utils.drawTiles(bar, _arg2, 1, 0, (-(_arg9) / 2), _arg8, _arg9, 0); bar.x = (-(_arg8) / 2); addChild(bar); maxWidth = _arg8; value = _arg10; } public function blink():void{ blinkTtf = BLINK_TTH; if (main.game.soundEngine){ }; } public function get value(){ return (Math.floor(((bar.width / maxWidth) * 100))); } override public function update():void{ super.update(); blinkTtf--; if (blinkTtf > 0){ bar.alpha = (0.75 + (0.25 * Math.sin(blinkTtf))); }; } public function set value(_arg1):void{ if (!isNaN(Number(_arg1))){ if (_arg1 < 0){ _arg1 = 0; }; if (_arg1 > 100){ _arg1 = 100; }; bar.width = ((maxWidth * _arg1) / 100); }; } } }//package src.interfaces
Section 91
//mBaseInterface (src.interfaces.mBaseInterface) package src.interfaces { import flash.display.*; import src.*; public class mBaseInterface extends MovieClip { public var prevInter; public var nextInter:mBaseInterface; public function mBaseInterface():void{ prevInter = null; nextInter = main.game.interfaceEngine.interList; if (main.game.interfaceEngine.interList){ main.game.interfaceEngine.interList.prevInter = this; }; main.game.interfaceEngine.interList = this; main.game.interfaceEngine.interCount++; } public function destroy():void{ if (prevInter){ prevInter.nextInter = nextInter; }; if (nextInter){ nextInter.prevInter = prevInter; }; if (this == main.game.interfaceEngine.interList){ main.game.interfaceEngine.interList = nextInter; }; main.game.interfaceEngine.interCount--; if (main.game.interfaceEngine.interCount == 0){ main.game.interfaceEngine.interList = null; }; } public function update():void{ } } }//package src.interfaces
Section 92
//mButton (src.interfaces.mButton) package src.interfaces { import flash.geom.*; import flash.display.*; import flash.utils.*; import flash.events.*; import src.*; public class mButton extends mBaseInterface implements IPanelElement { public var defH:Number; public var offMovie:MovieClip; public var parentClip:MovieClip; public var buttonText:mText; public var posX; public var onMovie; public var posY; public var buttonEnabled:Boolean;// = true public var downed:Boolean;// = false public var onClickProc:Function; public var defW; public function mButton(_arg1:MovieClip, _arg2:String, _arg3, _arg4:Number, _arg5, _arg6, _arg7, _arg8:Number, _arg9:Boolean, _arg10:String, _arg11:Number, _arg12:Function):void{ buttonEnabled = true; downed = false; super(); parentClip = _arg1; x = _arg5; y = _arg6; posX = _arg5; posY = _arg6; onClickProc = _arg12; buttonEnabled = _arg9; onMovie = new ((getDefinitionByName(_arg2) as Class)); onMovie.gotoAndStop(_arg3); onMovie.width = _arg7; onMovie.height = _arg8; onMovie.mouseChildren = false; addChild(onMovie); offMovie = new ((getDefinitionByName(_arg2) as Class)); offMovie.gotoAndStop(_arg4); offMovie.width = _arg7; offMovie.height = _arg8; offMovie.mouseChildren = false; addChild(offMovie); offMovie.visible = false; buttonText = new mText(this, 0, 0, _arg7, _arg8, _arg10, "center", ((_arg8 * 20) / 30), 0); buttonText.setFont("BirchCTT"); addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); defW = width; defH = height; setEnabling(buttonEnabled); parentClip.addChild(this); } public function setEnabling(_arg1:Boolean):void{ buttonEnabled = _arg1; if (buttonEnabled){ addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); buttonText.setColor(0); onMovie.alpha = 1; offMovie.alpha = 1; } else { removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); removeEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); buttonText.setColor(0xC3C3C3); onMovie.alpha = 0.5; offMovie.alpha = 0.5; }; } public function getGabarites():Point{ return (new Point(onMovie.width, onMovie.height)); } public function mouseUpHandler(_arg1:MouseEvent):void{ x = posX; y = posY; onMovie.visible = !(onMovie.visible); offMovie.visible = !(offMovie.visible); downed = false; onClickProc(null); if (main.game.soundEngine){ main.game.soundEngine.playSound("buttonUp"); }; if (main.game.particleEngine){ main.game.particleEngine.addExp(main.game.rootMovie.mouseX, main.game.rootMovie.mouseY, 6, 15, 20, 0xFFFFFF); }; } public function mouseDownHandler(_arg1:MouseEvent):void{ if (buttonEnabled){ x = (x + 2.5); y = (y + 2.5); }; } public function mouseOutHandler(_arg1:MouseEvent):void{ width = defW; height = defH; x = posX; y = posY; downed = false; main.game.mouse.setArrow(); } public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; posX = _arg1.x; posY = _arg1.y; } public function setOnOff(_arg1:Boolean):void{ onMovie.visible = _arg1; offMovie.visible = !(_arg1); } public function mouseOverHandler(_arg1:MouseEvent):void{ width = (defW + 2.5); height = (defH + 2.5); main.game.mouse.setHand(); } } }//package src.interfaces
Section 93
//mClickableBar (src.interfaces.mClickableBar) package src.interfaces { import flash.display.*; import flash.events.*; import src.*; public class mClickableBar extends mBar { private var proc:Function; private var downed:Boolean;// = false public function mClickableBar(_arg1:MovieClip, _arg2:String, _arg3:String, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Function):void{ downed = false; super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10); bar.mouseEnabled = false; addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); main.game.gameStage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); proc = _arg11; } public function mouseOverHandler(_arg1:MouseEvent):void{ main.game.mouse.setHand(); } public function mouseUpHandler(_arg1:MouseEvent):void{ downed = false; proc(value); } public function mouseDownHandler(_arg1:MouseEvent):void{ downed = true; } public function mouseOutHandler(_arg1:MouseEvent):void{ main.game.mouse.setArrow(); } override public function update():void{ if (downed){ value = (((mouseX + (maxWidth / 2)) / maxWidth) * 100); }; } } }//package src.interfaces
Section 94
//mComboBox (src.interfaces.mComboBox) package src.interfaces { import flash.geom.*; import flash.display.*; public class mComboBox extends mBaseInterface implements IPanelElement, IGetSetValue { public var minValue;// = 0 public var mainButton:mButton; public var maxValue;// = 0 public var buttons:Array; public function mComboBox(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:String, _arg5:Number, _arg6:Number, _arg7:Number):void{ var i:*; var tempButton:*; var fParent = _arg1; var fX = _arg2; var fY = _arg3; var fClassName = _arg4; var fDefaultValue = _arg5; var fMinValue = _arg6; var fMaxValue = _arg7; minValue = 0; maxValue = 0; buttons = new Array(); super(); fParent.addChild(this); minValue = fMinValue; maxValue = fMaxValue; mainButton = new mButton(this, fClassName, fDefaultValue, fDefaultValue, 0, 0, 110, 18, true, "", 14, function (){ clickMainHandler(); }); i = minValue; while (i < (maxValue + 1)) { tempButton = (buttons[buttons.length] = new mTagButton(this, fClassName, i, i, 0, (-20 * ((maxValue - i) + 1)), 110, 18, true, "", 15, clickHandler, i)); tempButton.visible = false; i = (i + 1); }; } public function get value(){ return (mainButton.onMovie.currentFrame); } public function getGabarites():Point{ return (new Point(width, 20)); } public function clickMainHandler():void{ var _local1:*; _local1 = 0; while (_local1 < buttons.length) { buttons[_local1].visible = !(buttons[_local1].visible); _local1++; }; } public function clickHandler(_arg1:Number):void{ var _local2:*; value = _arg1; _local2 = 0; while (_local2 < buttons.length) { buttons[_local2].visible = false; _local2++; }; } public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; } public function set value(_arg1):void{ if (!isNaN(Number(_arg1))){ mainButton.onMovie.gotoAndStop(Number(_arg1)); mainButton.offMovie.gotoAndStop(Number(_arg1)); }; } } }//package src.interfaces
Section 95
//mDialogWindow (src.interfaces.mDialogWindow) package src.interfaces { import flash.display.*; import flash.events.*; import src.*; public class mDialogWindow extends mWindow { public const WINDOW_HEIGHT = 200; public const WINDOW_WIDTH = 300; public var answered:Boolean;// = false public var tth:Number;// = 0 public function mDialogWindow(_arg1:MovieClip, _arg2:String, _arg3:String, ... _args):void{ var _local5:*; var _local6:*; answered = false; tth = 0; super(_arg1, WINDOW_WIDTH, WINDOW_HEIGHT); if (_arg3 == "top"){ new mText(this, (main.STAGE_WIDTH / 2), (main.STAGE_HEIGHT / 2), (WINDOW_WIDTH - 10), (WINDOW_HEIGHT - 20), _arg2, "center", 20, 0); } else { if (_arg3 == "middle"){ new mText(this, (main.STAGE_WIDTH / 2), (main.STAGE_HEIGHT / 2), (WINDOW_WIDTH - 10), (35 * _arg2.split(/\n/).length), _arg2, "center", 20, 0); } else { new mText(this, (main.STAGE_WIDTH / 2), (main.STAGE_HEIGHT / 2), (WINDOW_WIDTH - 10), (WINDOW_HEIGHT - 20), _arg2, "center", 20, 0); }; }; _local5 = 0; while (_local5 < _args.length) { _local6 = new mButton(this, "mButtonBack", 1, 1, (((main.STAGE_WIDTH - WINDOW_WIDTH) / 2) + ((WINDOW_WIDTH / _args.length) * (_local5 + 1))), (((main.STAGE_HEIGHT + WINDOW_HEIGHT) / 2) - 20), (((WINDOW_WIDTH / _args.length) * 2) - 10), 20, true, _args[_local5], 15, _args[(_local5 + 1)]); _local6.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); _local5 = (_local5 + 2); }; tth = 5; } public function mouseUpHandler(_arg1:MouseEvent):void{ answered = true; tth = 5; } override public function update():void{ if (answered){ tth--; if (tth == 0){ destroy(); }; }; } } }//package src.interfaces
Section 96
//mDivider (src.interfaces.mDivider) package src.interfaces { import flash.geom.*; import flash.display.*; public class mDivider extends mBaseInterface implements IPanelElement { public function mDivider(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{ x = _arg2; y = _arg3; width = _arg4; height = _arg5; _arg1.addChild(this); } public function getGabarites():Point{ return (new Point(width, height)); } public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; } } }//package src.interfaces
Section 97
//mDragButton (src.interfaces.mDragButton) package src.interfaces { import Box2D.Common.Math.*; import flash.display.*; import flash.events.*; public class mDragButton extends mBaseInterface { public var obj; public var dragObj:MovieClip; public var dragOn:Boolean;// = false public var proc:Function; public var rotating:Boolean;// = false public var rotated:Boolean;// = false public var draged:Boolean;// = false public function mDragButton(_arg1, _arg2, _arg3, _arg4:MovieClip, _arg5, _arg6, _arg7, _arg8, _arg9:Number, _arg10:Boolean, _arg11:Function):void{ var fParent = _arg1; var fDragParent = _arg2; var fObj = _arg3; var fDragObj = _arg4; var fX = _arg5; var fY = _arg6; var fW = _arg7; var fH = _arg8; var fR = _arg9; var fRotating = _arg10; var fProc = _arg11; dragOn = false; draged = false; rotated = false; rotating = false; super(); obj = fObj; obj.x = fX; obj.y = fY; obj.width = fW; obj.height = fH; obj.rotation = fR; fParent.addChild(obj); dragObj = fDragObj; dragObj.x = fX; dragObj.y = fY; dragObj.width = fW; dragObj.height = fH; dragObj.rotation = fR; dragObj.visible = false; fDragParent.addChild(dragObj); proc = fProc; rotating = fRotating; obj.addEventListener(MouseEvent.MOUSE_DOWN, function (){ dragOn = true; draged = false; rotated = false; }); dragObj.parent.addEventListener(MouseEvent.MOUSE_UP, function (){ if (rotated){ applyFunc(); }; }); dragObj.addEventListener(MouseEvent.MOUSE_UP, function (){ dragOn = false; draged = true; if (!rotating){ applyFunc(); }; }); } public function applyFunc():void{ draged = false; rotated = false; dragObj.visible = false; proc.call(null, dragObj.x, dragObj.y, dragObj.rotation); } override public function update():void{ var _local1:*; if (dragOn){ dragObj.visible = true; dragObj.x = dragObj.parent.mouseX; dragObj.y = dragObj.parent.mouseY; dragObj.rotation = obj.rotation; } else { if (draged){ rotated = true; if (rotating){ _local1 = new b2Vec2((dragObj.x - dragObj.parent.mouseX), (dragObj.y - dragObj.parent.mouseY)); dragObj.rotation = ((180 / Math.PI) * _local1.GetAngle()); } else { dragObj.rotation = 0; }; }; }; } } }//package src.interfaces
Section 98
//mEdit (src.interfaces.mEdit) package src.interfaces { import flash.geom.*; import flash.display.*; import flash.events.*; import flash.text.*; public class mEdit extends MovieClip implements IPanelElement, IGetSetValue { public var isNumber:Boolean;// = false public var text:TextField; public var minValue;// = 0 public var maxValue;// = 0 public var defaultValue;// = 0 public var caption:TextField; public function mEdit(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:String, _arg5:String, _arg6:Boolean, _arg7:Number, _arg8:Number):void{ isNumber = false; minValue = 0; maxValue = 0; defaultValue = 0; super(); x = _arg2; y = _arg3; _arg1.addChild(this); caption.text = _arg4; caption.selectable = false; isNumber = _arg6; minValue = _arg7; maxValue = _arg8; defaultValue = _arg5; text.text = defaultValue; text.multiline = false; if (isNumber){ text.restrict = "0-9"; } else { text.restrict = "A-Za-z0-9"; }; text.addEventListener(TextEvent.TEXT_INPUT, textInputHandler); } public function getGabarites():Point{ return (new Point(width, height)); } public function get value(){ if (isNumber){ if (!isNaN(Number(text.text))){ return (Number(text.text)); }; return (Number(defaultValue)); //unresolved jump }; return (text.text); } public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; } public function set value(_arg1):void{ text.text = String(_arg1); } public function textInputHandler(_arg1:TextEvent):void{ var _local2:String; var _local3:String; _local2 = text.text.substr(text.selectionBeginIndex, (text.selectionEndIndex - text.selectionBeginIndex)); if (_local2 != ""){ _local3 = text.text.replace(_local2, _arg1.text); } else { _local3 = text.text.concat(_arg1.text); }; if (isNumber){ if (Number(_local3) > maxValue){ _arg1.preventDefault(); }; if (Number(_local3) < minValue){ _arg1.preventDefault(); }; }; } } }//package src.interfaces
Section 99
//mElementPanel (src.interfaces.mElementPanel) package src.interfaces { import flash.geom.*; public class mElementPanel extends mPanel { private var nextHeight:Number;// = 0 public var startX; public var startY:Number; private var lastHeight:Number;// = 0 public var elementsArray:Array; private var lastWidth:Number;// = 0 public var allocation:mAllocation; public function mElementPanel(_arg1, _arg2:String, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9:Number, _arg10, _arg11:Number):void{ lastHeight = 0; nextHeight = 0; lastWidth = 0; elementsArray = new Array(); super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9); startX = _arg10; startY = _arg11; lastWidth = startX; lastHeight = startY; nextHeight = startY; allocation = new mAllocation(); allocation.x = startX; allocation.y = startY; addChild(allocation); allocation.visible = false; } public function addElementWithoutAlloc(_arg1:IPanelElement){ _arg1.setPosition(getNextXY(_arg1.getGabarites().x, _arg1.getGabarites().y)); return (_arg1); } public function addElement(_arg1:IPanelElement){ _arg1.setPosition(getNextXY(_arg1.getGabarites().x, _arg1.getGabarites().y)); elementsArray[elementsArray.length] = _arg1; return (_arg1); } public function refreshAllocation(_arg1:Number):void{ var _local2:*; _local2 = 0; while (_local2 < elementsArray.length) { if (elementsArray[_local2].tag == _arg1){ allocation.x = elementsArray[_local2].x; allocation.y = elementsArray[_local2].y; }; _local2++; }; } public function getNextXY(_arg1:Number, _arg2:Number):Point{ var _local3:*; if (((startX + lastWidth) + _arg1) > width){ lastWidth = startX; lastHeight = (nextHeight + 5); }; _local3 = new Point((lastWidth + (_arg1 / 2)), (lastHeight + (_arg2 / 2))); lastWidth = (lastWidth + (_arg1 + 5)); if (nextHeight < (lastHeight + _arg2)){ nextHeight = (lastHeight + _arg2); }; return (_local3); } public function addDivider():void{ addElementWithoutAlloc(new mDivider(this, 55, 10, 100, 15)); } public function refreshAll():void{ var _local1:*; lastWidth = startX; lastHeight = startY; nextHeight = startY; _local1 = 0; while (_local1 < elementsArray.length) { if (elementsArray[_local1].visible){ addElementWithoutAlloc(elementsArray[_local1]); }; _local1++; }; } } }//package src.interfaces
Section 100
//mGrid (src.interfaces.mGrid) package src.interfaces { import Box2D.Common.Math.*; import flash.display.*; import src.utilities.*; public class mGrid implements ISaveObject { public var sprite:Sprite; private var states:Number;// = 1 private var width:Number; private var height:Number; public var state:Number;// = 0 private var angle:Number;// = 45 private var ribLengths; public function mGrid(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Sprite, ... _args):void{ state = 0; states = 1; ribLengths = new Array(); angle = 45; super(); states = (_args.length + 1); state = (states - 1); angle = ((_arg1 * Math.PI) / 180); width = _arg2; height = _arg3; sprite = _arg4; ribLengths = _args; } public function getAngledPosition(_arg1:b2Vec2):b2Vec2{ var _local2:*; var _local3:*; _local2 = (Math.round((_arg1.GetAngle() / angle)) * angle); _local3 = new b2Vec2(_arg1.x, _arg1.y).Length(); return (new b2Vec2((_local3 * Math.cos(_local2)), (_local3 * Math.sin(_local2)))); } public function stateToXML():XML{ return (XML((("<xml><state state='" + state) + "'/></xml>"))); } public function clearAll():void{ sprite.graphics.clear(); } public function getBindedPosition(_arg1:b2Vec2):b2Vec2{ if ((state + 1) < states){ return (new b2Vec2((Math.round((_arg1.x / ribLengths[state])) * ribLengths[state]), (Math.round((_arg1.y / ribLengths[state])) * ribLengths[state]))); }; return (_arg1); } public function draw(_arg1:Sprite):void{ var _local2:*; _arg1.graphics.clear(); if ((state + 1) < states){ _arg1.graphics.lineStyle(1, 0xFF00, 1); _local2 = 0; while (_local2 < width) { _arg1.graphics.moveTo(_local2, 0); _arg1.graphics.lineTo(_local2, height); _local2 = (_local2 + ribLengths[state]); }; _local2 = 0; while (_local2 < height) { _arg1.graphics.moveTo(0, _local2); _arg1.graphics.lineTo(width, _local2); _local2 = (_local2 + ribLengths[state]); }; }; } public function switchState():void{ if (state == (states - 1)){ state = 0; } else { state = (state + 1); }; draw(sprite); } } }//package src.interfaces
Section 101
//mInputWindow (src.interfaces.mInputWindow) package src.interfaces { import flash.display.*; import src.*; public class mInputWindow extends mDialogWindow { private var editablesArray:Array; private var closed:Boolean;// = false private var defaultValuesArray:Array; private var oked:Boolean;// = false private var proc1:Function; private var proc2:Function; public function mInputWindow(_arg1:MovieClip, _arg2:String, _arg3, _arg4, ... _args):void{ var i:*; var fParent = _arg1; var fText = _arg2; var fProc1 = _arg3; var fProc2 = _arg4; var args = _args; closed = false; oked = false; editablesArray = new Array(); defaultValuesArray = new Array(); super(fParent, fText, "top", "Ok", function (){ oked = true; tth = 5; }, "No", function (){ closed = true; tth = 5; }); i = 0; while (i < args.length) { defaultValuesArray[defaultValuesArray.length] = args[(i + 1)]; editablesArray[editablesArray.length] = new mEdit(this, (width / 2), (((((main.STAGE_HEIGHT - WINDOW_HEIGHT) / 2) + (WINDOW_HEIGHT / 2)) - ((16 * args.length) / 4)) + (32 * (i / 2))), args[i], args[(i + 1)], false, 0, 0); editablesArray[(editablesArray.length - 1)].width = 250; i = (i + 2); }; tth = 5; proc1 = fProc1; proc2 = fProc2; } override public function update():void{ var _local1:Array; var _local2:*; if (closed){ tth--; if (tth == 0){ destroy(); proc2(); }; }; if (oked){ tth--; if (tth == 0){ _local1 = new Array(); _local2 = 0; while (_local2 < editablesArray.length) { if (editablesArray[_local2].text.text == ""){ _local1[_local1.length] = defaultValuesArray[_local2]; } else { _local1[_local1.length] = editablesArray[_local2].text.text; }; _local2++; }; proc1.apply(null, _local1); destroy(); }; }; } } }//package src.interfaces
Section 102
//mInterfaceEngine (src.interfaces.mInterfaceEngine) package src.interfaces { import flash.display.*; import flash.events.*; public class mInterfaceEngine extends MovieClip { public var interCount;// = 0 public var interList;// = null public function mInterfaceEngine(_arg1:MovieClip):void{ interCount = 0; interList = null; super(); _arg1.addChild(this); _arg1.addEventListener(Event.ENTER_FRAME, update, false, 0, true); } public function addPanel(_arg1:String, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8:Number):mPanel{ var _local9:*; _local9 = new mPanel(this, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8); return (_local9); } public function addDragButton(_arg1, _arg2, _arg3:MovieClip, _arg4, _arg5, _arg6, _arg7, _arg8:Number, _arg9, _arg10:Function):mDragButton{ var _local11:*; _local11 = new mDragButton(this, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10); return (_local11); } public function clearAll():void{ var _local1:mBaseInterface; _local1 = interList; while (_local1) { _local1.destroy(); _local1 = _local1.nextInter; }; while (0 < numChildren) { removeChildAt(0); }; } public function addText(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:String, _arg6:String, _arg7:Number, _arg8:uint):mText{ var _local9:*; _local9 = new mText(this, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8); return (_local9); } public function addButton(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Boolean, _arg9:String, _arg10:Number, _arg11:Function):mButton{ var _local12:*; _local12 = new mButton(this, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11); return (_local12); } public function addElementPanel(_arg1:String, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8:Number, _arg9, _arg10:Number):mElementPanel{ var _local11:*; _local11 = new mElementPanel(this, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10); return (_local11); } public function update(_arg1:Event):void{ var _local2:mBaseInterface; _local2 = interList; while (_local2) { _local2.update(); _local2 = _local2.nextInter; }; } } }//package src.interfaces
Section 103
//mMovie (src.interfaces.mMovie) package src.interfaces { import flash.display.*; import flash.utils.*; import flash.events.*; import src.*; public class mMovie extends mBaseInterface { public var movieParent:MovieClip; public var movie:MovieClip; public var proc:Function; public var completed:Boolean;// = false public var skipButton:mButton; public var tth:Number;// = 0 public function mMovie(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean, _arg8:Function, _arg9:String=""):void{ var fParent = _arg1; var fClassName = _arg2; var fX = _arg3; var fY = _arg4; var fWidth = _arg5; var fHeight = _arg6; var fSkip = _arg7; var fProc = _arg8; var fLink = _arg9; completed = false; tth = 0; super(); fParent.addChild(this); movie = new ((getDefinitionByName(fClassName) as Class)); movie.x = fX; movie.y = fY; if (fWidth != 0){ movie.width = fWidth; }; if (fHeight != 0){ movie.height = fHeight; }; addChild(movie); if (fSkip){ }; if (fLink){ movie.addEventListener(MouseEvent.CLICK, function (){ utils.goToUrl(fLink); }); movie.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); movie.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); }; proc = fProc; tth = 5; main.game.mouse.setHand(); } public function mouseMoveHandler(_arg1:MouseEvent):void{ main.game.mouse.setHand(); } public function movieComplete():void{ completed = true; tth = 5; } public function mouseOutHandler(_arg1:MouseEvent):void{ main.game.mouse.setArrow(); } override public function update():void{ if (completed){ tth--; if (tth == 0){ destroy(); proc(); }; } else { if (movie.currentFrame == movie.totalFrames){ movieComplete(); }; }; } override public function destroy():void{ super.destroy(); movie.stop(); removeChild(movie); if (skipButton){ removeChild(skipButton); }; parent.removeChild(this); } } }//package src.interfaces
Section 104
//mPanel (src.interfaces.mPanel) package src.interfaces { import src.utilities.*; import flash.events.*; import src.*; public class mPanel extends mBaseInterface implements ISaveObject { public var speedKoeff:Number; public var mouseOn:Boolean;// = false public var isFixed:Boolean;// = false public var tY1; public var tX; public var tY; public var tX1; public var fixButton:mButton; public function mPanel(_arg1, _arg2:String, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9:Number):void{ var fParent = _arg1; var fClassName = _arg2; var fX = _arg3; var fY = _arg4; var fX1 = _arg5; var fY1 = _arg6; var fWidth = _arg7; var fHeight = _arg8; var fSpeedKoeff = _arg9; mouseOn = false; isFixed = false; super(); utils.drawTiles(this, fClassName, 1, 0, 0, fWidth, fHeight, 0); tX = (x = fX); tY = (y = fY); tX1 = fX1; tY1 = fY1; speedKoeff = fSpeedKoeff; fParent.addChild(this); addEventListener(MouseEvent.MOUSE_OVER, function (){ mouseOn = true; }); addEventListener(MouseEvent.MOUSE_OUT, function (){ mouseOn = false; }); fixButton = new mButton(this, "mButtonButtonBack", 1, 2, 15, 15, 15, 15, true, "", 15, function (){ isFixed = !(isFixed); }); } public function get fixed():Boolean{ return (isFixed); } public function stateToXML():XML{ return (XML((((((("<xml><state x='" + x) + "' y='") + y) + "' fixed='") + fixed) + "'/></xml>"))); } override public function update():void{ if (!isFixed){ if (mouseOn){ x = (x + (speedKoeff * (tX1 - x))); y = (y + (speedKoeff * (tY1 - y))); } else { x = (x + (speedKoeff * (tX - x))); y = (y + (speedKoeff * (tY - y))); }; }; } public function set fixed(_arg1:Boolean):void{ isFixed = _arg1; fixButton.setOnOff(!(isFixed)); } } }//package src.interfaces
Section 105
//mTagButton (src.interfaces.mTagButton) package src.interfaces { import flash.display.*; public class mTagButton extends mButton { public var tag; public function mTagButton(_arg1:MovieClip, _arg2:String, _arg3, _arg4:Number, _arg5, _arg6, _arg7, _arg8, _arg9:Boolean, _arg10:String, _arg11:Number, _arg12:Function, ... _args):void{ var fParent = _arg1; var fClassName = _arg2; var fOnFrame = _arg3; var fOffFrame = _arg4; var fx = _arg5; var fy = _arg6; var fw = _arg7; var fh = _arg8; var fEnabled = _arg9; var fButtonText = _arg10; var fFontSize = _arg11; var fProc = _arg12; var args = _args; tag = args; super(fParent, fClassName, fOnFrame, fOffFrame, fx, fy, fw, fh, fEnabled, fButtonText, fFontSize, function (){ fProc.apply(null, tag); }); } } }//package src.interfaces
Section 106
//mText (src.interfaces.mText) package src.interfaces { import flash.display.*; import flash.text.*; public class mText extends TextField { private var format:TextFormat; public function mText(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:Number, _arg9:uint):void{ text = _arg6; format = new TextFormat(); format.font = "BirchCTT"; format.color = _arg9; format.size = _arg8; format.align = _arg7; _arg1.addChild(this); embedFonts = true; selectable = false; setTextFormat(format); width = _arg4; height = _arg5; x = (_arg2 - (width / 2)); y = (_arg3 - (height / 2)); mouseEnabled = false; } public function setBold(_arg1:Boolean):void{ var _local2:TextFormat; _local2 = getTextFormat(); _local2.bold = _arg1; format = _local2; setTextFormat(_local2); } public function setColor(_arg1:uint):void{ textColor = _arg1; } public function setFontSize(_arg1:Number):void{ var _local2:TextFormat; _local2 = getTextFormat(); _local2.size = _arg1; format = _local2; setTextFormat(_local2); } public function setFont(_arg1:String):void{ var _local2:TextFormat; _local2 = getTextFormat(); _local2.font = _arg1; format = _local2; setTextFormat(_local2); } public function newText(_arg1:String):void{ text = _arg1; setTextFormat(format); } } }//package src.interfaces
Section 107
//mTitle (src.interfaces.mTitle) package src.interfaces { import flash.display.*; import flash.events.*; public class mTitle extends MovieClip { public const DELAY_TTH:Number = 40; public const MORPH_TTH:Number = 30; public var delayTth:Number;// = 0 public var morphTth:Number;// = 0 public function mTitle(_arg1:Number, _arg2:Number):void{ delayTth = 0; morphTth = 0; super(); stop(); x = _arg1; y = _arg2; addEventListener(Event.ENTER_FRAME, update); } public function morph():void{ var _local1:*; morphTth = MORPH_TTH; _local1 = currentFrame; while (_local1 == currentFrame) { _local1 = Math.floor(((Math.random() * totalFrames) + 1)); }; gotoAndStop(_local1); } public function update(_arg1:Event):void{ if (delayTth == 0){ delayTth = DELAY_TTH; morph(); }; delayTth--; if (morphTth > 0){ morphTth--; scaleX = (1 + (((Math.sin((morphTth / 2)) * morphTth) / MORPH_TTH) * 0.1)); scaleY = (1 + (((Math.sin((morphTth / 2)) * morphTth) / MORPH_TTH) * 0.1)); }; } } }//package src.interfaces
Section 108
//mWindow (src.interfaces.mWindow) package src.interfaces { import flash.display.*; import src.*; public class mWindow extends mBaseInterface { public function mWindow(_arg1:MovieClip, _arg2:Number=0, _arg3:Number=0):void{ graphics.beginFill(0x555555, 0.5); utils.drawRect(graphics, 0, 0, main.STAGE_WIDTH, main.STAGE_HEIGHT); graphics.endFill(); _arg1.addChild(this); if ((((_arg2 > 0)) && ((_arg3 > 0)))){ utils.drawTiles(this, "mInterfaceTexture", 1, ((main.STAGE_WIDTH - _arg2) / 2), ((main.STAGE_HEIGHT - _arg3) / 2), _arg2, _arg3, 0); }; } override public function destroy():void{ super.destroy(); this.parent.removeChild(this); } } }//package src.interfaces
Section 109
//embedLevels (src.levels.embedLevels) package src.levels { public class embedLevels { static var level10:XML = <level> <layer> <src.units.mSun x="300" y="50"/> </layer> <layer> <src.units.mCloud x="150" y="300" frame="1"/> <src.units.mCloud x="475" y="325" frame="1"/> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="3"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="7" x="50" y="350" width="200" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="162.5" y="450" width="225" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="162.5" y="250" width="225" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="512.5" y="250" width="225" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="625" y="350" width="200" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="512.5" y="450" width="225" height="10" rotation="0" static="true"/> <src.units.mBomb x="100" y="400" radius="35.35533905932738" timer="5"/> <src.physics.mPhysWheel className="mWheel" frame="4" x="125" y="175" radius="50" static="false"/> <src.physics.mPhysBox className="mBox" frame="2" x="500" y="187.5" width="100" height="75" rotation="0" static="false"/> </layer> <layer> <src.units.mMorph x="200" y="400"/> </layer> <layer> <src.units.mRecycle x="500" y="400"/> </layer> <layer/> <layer/> </level> ; static var level11:XML = <level> <layer> <src.units.mSun x="327.5" y="80.5"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="2"/> <src.units.mCloud x="185" y="173" frame="2"/> <src.units.mCloud x="297" y="330" frame="4"/> <src.units.mCloud x="443" y="255" frame="1"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="5" x="381.25" y="350" width="162.5" height="10" rotation="176" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="343.75" y="443.75" width="587.6329636771579" height="10" rotation="180" static="true"/> <src.physics.mPhysBox className="mBox" frame="1" x="325" y="325" width="50" height="50" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="1" x="187.5" y="412.5" width="50" height="50" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="1" x="187.5" y="356.25" width="50" height="62.5" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="1" x="187.5" y="293.75" width="50" height="62.5" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="1" x="187.5" y="231.25" width="50" height="62.5" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="1" x="187.5" y="168.75" width="50" height="62.5" rotation="0" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="659.5" y="444" width="50" height="10" rotation="-180" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="4" x="242.5" y="408.5" radius="33.95585369269929" static="false"/> <src.units.mBomb x="675" y="425" radius="12.5" timer="5"/> </layer> <layer> <src.units.mMorph x="412.5" y="312.5"/> </layer> <layer> <src.units.mRecycle x="240.5" y="379"/> </layer> <layer/> <layer/> </level> ; static var level12:XML = <level> <layer> <src.units.mSun x="100" y="62.5"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="1"/> <src.units.mCloud x="175" y="112.5" frame="1"/> <src.units.mCloud x="575.5" y="134.5" frame="4"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="2" x="412" y="142.5" width="100" height="10" rotation="-180" static="true"/> <src.physics.mPhysTriangle className="mBalka" frame="2" x="413" y="125.5" width="100" height="25" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="336.75" y="171.75" width="88.38834764831844" height="10" rotation="-46" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="282.5" y="232.25" width="80.0390529679106" height="10" rotation="-52" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="581.25" y="512.5" width="112.5" height="10" rotation="0" static="true"/> <src.physics.mPhysBox className="mBox" frame="1" x="66.5" y="253.5" width="50" height="50" rotation="0" static="false"/> <src.physics.mPhysCircle className="mBalka" frame="4" x="126.5" y="255.5" radius="25" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="100" y="293.75" width="162.5" height="10" rotation="-177" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="216.5" y="344.5" width="127.47548783981962" height="10" rotation="50" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="293.75" y="412.5" width="87.5" height="10" rotation="-152" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="450" y="487.5" width="158.11388300841898" height="10" rotation="-162" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="378.5" y="435.5" width="97.12878049270464" height="10" rotation="-178" static="true"/> </layer> <layer> <src.units.mMorph x="390.5" y="42"/> </layer> <layer> <src.units.mRecycle x="581.5" y="451"/> </layer> <layer/> <layer/> </level> ; static var level13:XML = <level> <layer> <src.units.mSun x="80" y="60"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="2"/> <src.units.mCloud x="611" y="124" frame="1"/> <src.units.mCloud x="466" y="291" frame="2"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="4" x="343.75" y="338.5" width="662.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="617.5" y="361.5" width="50" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="643.75" y="387.5" width="62.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="670" y="359.5" width="50" height="10" rotation="90" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="4" x="600" y="275" radius="25" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="343.75" y="307" width="662.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="343.75" y="317.5" width="662.5" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="343.75" y="328" width="662.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="18" y="251.45" width="103.07764064044152" height="10" rotation="90" static="true"/> <src.units.mBomb x="644" y="364" radius="13.601470508735444" timer="5"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="142" y="251.5" width="97" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="82.5" y="180" width="137" height="10" rotation="-180" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="7" y="203.95" width="34.0147027033899" height="10" rotation="90" static="true"/> </layer> <layer> <src.units.mMorph x="338" y="243"/> </layer> <layer> <src.units.mRecycle x="80" y="249"/> </layer> <layer/> <layer/> </level> ; static var level14:XML = <level> <layer> <src.units.mSun x="75" y="125"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="1"/> <src.units.mCloud x="125" y="75" frame="4"/> <src.units.mCloud x="250" y="250" frame="2"/> <src.units.mCloud x="425" y="175" frame="4"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="1" x="131.25" y="75" width="139.75424859373686" height="10" rotation="-170" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="268.75" y="93.75" width="138.06701271484076" height="10" rotation="-175" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="580" y="232.25" width="362.5" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="670" y="230.25" width="362.5" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="625" y="412.5" width="100" height="10" rotation="-180" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="1" x="625" y="295" radius="37.107950630558946" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="466.5" y="222.5" width="139.29106216839614" height="10" rotation="-4" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="305" y="234.5" width="190.4442175546425" height="10" rotation="-4" static="true"/> <src.physics.mPhysBox className="mBox" frame="1" x="237.5" y="200" width="50" height="50" rotation="0" static="false"/> <src.physics.mPhysWheel className="mWheel" frame="2" x="625" y="212.5" radius="37.5" static="false"/> <src.physics.mPhysWheel className="mWheel" frame="5" x="625" y="137.5" radius="37.5" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="225" y="375" width="200" height="10" rotation="-171" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="4" x="625" y="362.5" radius="37.5" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="368.75" y="425" width="87.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="525" y="425" width="100" height="10" rotation="-180" static="true"/> </layer> <layer> <src.units.mMorph x="150" y="37.5"/> </layer> <layer> <src.units.mRecycle x="512.5" y="362.5"/> </layer> <layer/> <layer/> </level> ; static var level15:XML = <level> <layer> <src.units.mSun x="188" y="119"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="3"/> <src.units.mCloud x="452" y="159" frame="1"/> <src.units.mCloud x="175" y="274" frame="1"/> </layer> <layer> <src.physics.mPhysWheel className="mWheel" frame="3" x="305" y="272" radius="32.28002478313795" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="547" y="61" width="162" height="10" rotation="1" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="143" y="61.5" width="150.02999700059985" height="10" rotation="180" static="true"/> <src.physics.mPhysTriangle className="mBalka" frame="1" x="97" y="96" width="160" height="82" rotation="-45" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="316.5" y="168" width="159.0125781188394" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="438" y="193" width="104.9571341072154" height="10" rotation="-150" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="481" y="281.5" width="133.06013678032951" height="10" rotation="-89" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="2" x="342" y="128" radius="31.622776601683793" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="632" y="121.5" width="127.0157470552372" height="10" rotation="-91" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="436.5" y="348" width="99.02019995940222" height="10" rotation="1" static="true"/> <src.physics.mPhysBox className="mBox" frame="1" x="425" y="312.5" width="50" height="50" rotation="0" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="550.25" y="349" width="137.5" height="10" rotation="-180" static="true"/> </layer> <layer> <src.units.mMorph x="127" y="366"/> </layer> <layer> <src.units.mRecycle x="553" y="280"/> </layer> <layer/> <layer/> </level> ; static var level16:XML = <level> <layer> <src.units.mSun x="228" y="113"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="1"/> <src.units.mCloud x="385" y="264" frame="3"/> <src.units.mCloud x="475" y="125" frame="1"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="1" x="337.5" y="75" width="150" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="43.75" y="200" width="100.77822185373186" height="10" rotation="-98" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="62.5" y="293.75" width="91.00137361600648" height="10" rotation="-106" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="93.75" y="375" width="83.85254915624212" height="10" rotation="-117" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="131.25" y="437.5" width="62.5" height="10" rotation="-127" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="181.25" y="481.25" width="72.88689868556625" height="10" rotation="-150" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="262.5" y="500" width="100" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="375" y="500" width="125" height="10" rotation="-180" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="2" x="75" y="100" radius="25" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="131.25" y="193.75" width="88.38834764831844" height="10" rotation="-99" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="87.5" y="137.5" width="150" height="10" rotation="-180" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="637.5" y="106.25" width="112.5" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="581.25" y="162.5" width="112.5" height="10" rotation="0" static="true"/> <src.physics.mPhysBox className="mBox" frame="1" x="293.75" y="37.5" width="62.5" height="50" rotation="0" static="false"/> </layer> <layer> <src.units.mMorph x="376.5" y="36.5"/> </layer> <layer> <src.units.mRecycle x="575" y="100"/> </layer> <layer/> <layer/> </level> ; static var level17:XML = <level> <layer> <src.units.mSun x="500" y="50"/> </layer> <layer> <src.units.mCloud x="325" y="225" frame="3"/> <src.units.mCloud x="75" y="75" frame="1"/> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="1"/> <src.units.mCloud x="631" y="210" frame="4"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="7" x="50" y="237.5" width="375" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="410" y="330" width="400" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="215" y="186.5" width="275" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="132.5" y="43" width="175" height="10" rotation="0" static="true"/> <src.physics.mPhysBox className="mBox" frame="5" x="100" y="387.5" width="100" height="75" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="4" x="175" y="387.5" width="50" height="75" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="2" x="125" y="312.5" width="100" height="75" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="3" x="137.5" y="237.5" width="125" height="75" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="1" x="112.5" y="162.5" width="75" height="75" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="1" x="137.5" y="87.5" width="75" height="75" rotation="0" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="267.5" y="272.5" width="151.74320413119" height="10" rotation="-131" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="244.5" y="304" width="75.69015788066504" height="10" rotation="136" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="52" y="464.65000000000003" width="67.36467917239713" height="10" rotation="-91" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="334" y="499" width="566.0883323298582" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="610" y="482" width="26.0192236625154" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="137" y="471.5" width="180.5796223276591" height="10" rotation="162" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="305.5" y="470.5" width="169.49926253526883" height="10" rotation="-162" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="458" y="482" width="147.5127113166862" height="10" rotation="167" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="573.5" y="481.5" width="92.35799911215054" height="10" rotation="-161" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="563.5" y="485.5" width="88.60022573334675" height="10" rotation="159" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="451" y="479.5" width="154.12008305214476" height="10" rotation="18" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="300" y="479" width="166.48123017325406" height="10" rotation="-17" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="136" y="466" width="186.81541692269408" height="10" rotation="21" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="330.5" y="449.5" width="571.105944637245" height="10" rotation="-176" static="true"/> </layer> <layer> <src.units.mMorph x="150" y="125"/> </layer> <layer> <src.units.mRecycle x="550" y="400"/> </layer> <layer/> <layer/> </level> ; static var level18:XML = <level> <layer> <src.units.mSun x="365" y="70"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="3"/> <src.units.mCloud x="141" y="441" frame="4"/> <src.units.mCloud x="537.5" y="450" frame="2"/> </layer> <layer> <src.physics.mPhysWheel className="mWheel" frame="4" x="78.5" y="343" radius="50" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="78.75" y="424.5" width="112.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="314.75" y="453" width="369.3321675673539" height="10" rotation="-171" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="564.75" y="480.5" width="160.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="652" y="411.5" width="150" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="605.0" y="341.5" width="100.0" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="337.5" y="237.5" width="225" height="10" rotation="-180" static="true"/> <src.physics.mPhysBox className="mBox" frame="1" x="275" y="187.5" width="75" height="75" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="1" x="375" y="187.5" width="75" height="75" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="1" x="325" y="100" width="75" height="75" rotation="0" static="false"/> </layer> <layer> <src.units.mMorph x="575" y="87.5"/> </layer> <layer> <src.units.mRecycle x="584.5" y="412.5"/> </layer> <layer/> <layer/> </level> ; static var level19:XML = <level> <layer> <src.units.mSun x="187.5" y="75"/> </layer> <layer> <src.units.mCloud x="300" y="87.5" frame="3"/> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="2"/> <src.units.mCloud x="562.5" y="125" frame="1"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="7" x="80.25" y="370" width="87.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="125" y="331.25" width="87.5" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="37.5" y="331.25" width="87.5" height="10" rotation="90" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="3" x="81.5" y="325" radius="37.5" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="125" y="250" width="25" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="37.5" y="250" width="25" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="262.5" y="100" width="275" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="37.5" y="56.25" width="87.5" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="218.75" y="12.5" width="362.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="4" x="125" y="62.5" radius="27.95084971874737" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="81.25" y="275" width="137.5" height="10" rotation="-180" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="443.75" y="275" width="212.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="650" y="262.5" width="75" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="637.5" y="331.25" width="67.3145600891813" height="10" rotation="-69" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="600" y="387.5" width="70.71067811865476" height="10" rotation="-46" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="531.25" y="425" width="91.00137361600648" height="10" rotation="-16" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="431.25" y="437.5" width="112.5" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="181.25" y="237.5" width="112.5" height="10" rotation="-180" static="true"/> </layer> <layer> <src.units.mMorph x="487.5" y="175"/> </layer> <layer> <src.units.mRecycle x="187.5" y="300"/> </layer> <layer/> <layer/> </level> ; static var level1:XML = <level> <layer> <src.units.mSun x="473" y="111"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="1"/> <src.units.mCloud x="432" y="185" frame="1"/> <src.units.mCloud x="336" y="191" frame="2"/> <src.units.mCloud x="167" y="267" frame="3"/> </layer> <layer> <src.physics.mPhysBox className="mBox" frame="1" x="500" y="325" width="100" height="100" rotation="0" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="350" y="400" width="650" height="10" rotation="-180" static="true"/> </layer> <layer> <src.units.mMorph x="100" y="100"/> </layer> <layer> <src.units.mRecycle x="100" y="325"/> </layer> <layer/> <layer/> </level> ; static var level2:XML = <level> <layer> <src.units.mSun x="114" y="174"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="2"/> <src.units.mCloud x="407" y="381" frame="1"/> <src.units.mCloud x="176" y="341" frame="2"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="7" x="175" y="350" width="300" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="487.5" y="312.5" width="333.54160160315837" height="10" rotation="167" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="137.5" y="125" width="225" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="525" y="475" width="200" height="10" rotation="-180" static="true"/> <src.physics.mPhysCircle className="mBalka" frame="6" x="525" y="400" radius="50" static="false"/> <src.physics.mPhysBox className="mBox" frame="2" x="125" y="62.5" width="100" height="75" rotation="0" static="false"/> </layer> <layer> <src.units.mMorph x="575" y="125"/> </layer> <layer> <src.units.mRecycle x="125" y="275"/> </layer> <layer/> <layer/> </level> ; static var level3:XML = <level> <layer> <src.units.mSun x="300" y="100"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="3"/> <src.units.mCloud x="100" y="400" frame="1"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="2" x="425" y="412.5" width="175" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="562.5" y="325" width="275" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="150" y="325" width="250" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="275" y="412.5" width="175" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="400" y="162.5" width="225" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="300" y="162.5" width="225" height="10" rotation="90" static="true"/> <src.physics.mPhysCircle className="mBalka" frame="3" x="550" y="275" radius="25" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="150" y="300" width="200" height="10" rotation="-180" static="false"/> </layer> <layer> <src.units.mMorph x="350" y="50"/> </layer> <layer> <src.units.mRecycle x="350" y="325"/> </layer> <layer/> <layer/> </level> ; static var level4:XML = <level> <layer> <src.units.mSun x="548" y="126"/> </layer> <layer> <src.units.mCloud x="79" y="220" frame="2"/> <src.units.mCloud x="565" y="321" frame="4"/> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="1"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="4" x="152.5" y="164" width="232.69078194032525" height="10" rotation="-174" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="362.5" y="177.5" width="187.06683297688025" height="10" rotation="-179" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="523.5" y="382" width="137" height="10" rotation="-180" static="true"/> <src.physics.mPhysCircle className="mBalka" frame="6" x="76" y="305" radius="45.17742799230607" static="false"/> <src.physics.mDistanceJoint x="78" y="308" x1="126" y1="214"/> <src.physics.mPhysBox className="mBox" frame="1" x="213.75" y="304.75" width="61.51828996322965" height="61.51828996322962" rotation="0" static="false"/> <src.physics.mDistanceJoint x="198" y="289" x1="147.91008085452722" y1="238.91008085452722"/> <src.physics.mDistanceJoint x="226" y="291" x1="279.0094331227943" y1="237.9905668772057"/> </layer> <layer> <src.units.mMorph x="87" y="87"/> </layer> <layer> <src.units.mRecycle x="521" y="335"/> </layer> <layer/> <layer/> </level> ; static var level5:XML = <level> <layer> <src.units.mSun x="489" y="153"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="3"/> <src.units.mCloud x="151" y="386" frame="1"/> <src.units.mCloud x="464" y="435" frame="4"/> </layer> <layer> <src.physics.mPhysCircle className="mBalka" frame="6" x="256" y="102" radius="13.038404810405298" static="true"/> <src.physics.mPhysCircle className="mBalka" frame="6" x="406" y="104" radius="15.132745950421556" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="330" y="67.5" width="238.6063704095094" height="10" rotation="175" static="false"/> <src.physics.mPhysBox className="mBox" frame="2" x="327.5" y="6.5" width="95" height="77" rotation="0" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="98.5" y="298.5" width="131.30879635424276" height="10" rotation="-158" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="216" y="324" width="124.03628501370076" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="273" y="370.5" width="105" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="387" y="376.40000000000003" width="107.16809226630846" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="493" y="324" width="222.02026934494063" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="332" y="400" width="120.0041665943312" height="10" rotation="-180" static="true"/> <src.physics.mPhysCircle className="mBalka" frame="2" x="443" y="255" radius="53.009433122794285" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="330" y="422.5" width="118.3427226321923" height="10" rotation="-176" static="true"/> </layer> <layer> <src.units.mMorph x="104" y="180"/> </layer> <layer> <src.units.mRecycle x="547" y="256"/> </layer> <layer/> <layer/> </level> ; static var level6:XML = <level> <layer> <src.units.mSun x="325" y="20.5"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="1"/> <src.units.mCloud x="525" y="225" frame="1"/> <src.units.mCloud x="150" y="137.5" frame="4"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="7" x="87.5" y="400" width="90.13878188659972" height="10" rotation="-147" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="212.5" y="425" width="175" height="10" rotation="-180" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="1" x="200" y="375" radius="35.35533905932738" static="false"/> <src.physics.mPhysWheel className="mWheel" frame="1" x="25" y="187.5" radius="50" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="550" y="462.5" width="250" height="75" rotation="0" static="true"/> <src.physics.mPhysBox className="mBox" frame="4" x="562.5" y="75" width="66" height="100" rotation="0" static="false"/> <src.physics.mDistanceJoint x="25" y="187.5" x1="200" y1="100"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="562.5" y="150" width="175" height="10" rotation="-180" static="true"/> </layer> <layer> <src.units.mMorph x="200" y="275"/> </layer> <layer> <src.units.mRecycle x="487.5" y="375"/> </layer> <layer/> <layer/> </level> ; static var level7:XML = <level> <layer> <src.units.mSun x="575" y="100"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="2"/> </layer> <layer> <src.physics.mPhysWheel className="mWheel" frame="3" x="125" y="462.5" radius="37.5" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="318.75" y="212.5" width="562.5" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="50" y="187.5" width="75" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="137.5" y="175" width="213.60009363293827" height="10" rotation="-160" static="true"/> <src.physics.mPhysBox className="mBox" frame="4" x="431.25" y="150" width="62.5" height="100" rotation="0" static="false"/> <src.physics.mPhysWheel className="mWheel" frame="2" x="337.5" y="162.5" radius="39.528470752104745" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="618.75" y="331.25" width="197.64235376052372" height="10" rotation="-35" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="675" y="350" width="125" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="643.75" y="375" width="162.5" height="10" rotation="-180" static="true"/> </layer> <layer> <src.units.mMorph x="125" y="87.5"/> </layer> <layer> <src.units.mRecycle x="537.5" y="275"/> </layer> <layer/> <layer/> </level> ; static var level8:XML = <level> <layer> <src.units.mSun x="530" y="132"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="2"/> <src.units.mCloud x="355" y="120" frame="3"/> <src.units.mCloud x="50" y="459" frame="2"/> <src.units.mCloud x="429" y="408" frame="2"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="6" x="193.5" y="311.75" width="288.5849095153799" height="10" rotation="94" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="1" x="124" y="95.5" radius="63.73774391990981" static="false"/> <src.physics.mPhysWheel className="mWheel" frame="3" x="300" y="256.5" radius="50" static="false"/> <src.physics.mDistanceJoint x="300" y="300" x1="325" y1="400"/> <src.units.mBomb x="517" y="144" radius="54.147945482723536" timer="5"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="58.5" y="319" width="299.8216136305053" height="10" rotation="83" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="533.5" y="403" width="237.00210969525145" height="10" rotation="-180" static="true"/> <src.physics.mPhysBox className="mBox" frame="2" x="521" y="302.5" width="164" height="111" rotation="0" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="213.5" y="244" width="27" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="34.65" y="241" width="26.68332812825267" height="10" rotation="0" static="true"/> </layer> <layer> <src.units.mMorph x="133" y="360.5"/> </layer> <layer> <src.units.mRecycle x="125" y="160"/> </layer> <layer/> <layer/> </level> ; static var level9:XML = <level> <layer> <src.units.mSun x="187.5" y="112.5"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="3"/> <src.units.mCloud x="562.5" y="137.5" frame="1"/> <src.units.mCloud x="362.5" y="275" frame="4"/> <src.units.mCloud x="150" y="375" frame="1"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="6" x="131.25" y="112.5" width="162.5" height="10" rotation="-180" static="false"/> <src.physics.mDistanceJoint x="62.5" y="112.5" x1="62.5" y1="25"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="237.5" y="218.75" width="422.97310789221575" height="10" rotation="-162" static="true"/> <src.physics.mPhysBox className="mBox" frame="3" x="312.5" y="87.5" width="50" height="50" rotation="0" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="568.75" y="325" width="112.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="568.75" y="237.5" width="112.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="687.5" y="312.5" width="175" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="387.5" y="406.25" width="600.1301942078902" height="10" rotation="-2" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="287.5" y="137.5" width="75" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="275" y="125" width="150" height="10" rotation="-180" static="false"/> </layer> <layer> <src.units.mMorph x="150" y="50"/> </layer> <layer> <src.units.mRecycle x="150" y="350"/> </layer> <layer/> <layer/> </level> ; static var level20:XML = <level> <layer> <src.units.mSun x="287.5" y="100"/> </layer> <layer> <src.units.mCloud x="200" y="187.5" frame="3"/> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="3"/> <src.units.mCloud x="162.5" y="125" frame="1"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="4" x="127.5" y="511" width="150" height="25" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="270.25" y="512" width="137.5" height="25" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="408.75" y="512" width="137.5" height="25" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="547.25" y="512" width="137.5" height="25" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="87.5" y="68.75" width="100.77822185373186" height="10" rotation="-173" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="134.25" y="83.75" width="39.528470752104745" height="10" rotation="-173" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="497.5" y="124.25" width="27.95084971874737" height="10" rotation="-171" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="550" y="118.75" width="100.77822185373186" height="10" rotation="-173" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="658.75" y="164.25" width="88.38834764831844" height="10" rotation="-82" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="619.5" y="225.25" width="80.0390529679106" height="10" rotation="-30" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="548" y="244.75" width="76.03453162872775" height="10" rotation="-2" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="509.5" y="256.75" width="27.95084971874737" height="10" rotation="-4" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="113.5" y="268.25" width="51.53882032022076" height="10" rotation="-4" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="142" y="277.75" width="27.95084971874737" height="10" rotation="-4" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="21" y="317.25" width="67.3145600891813" height="10" rotation="-112" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="63.75" y="359" width="67.3145600891813" height="10" rotation="-159" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="154.5" y="374.75" width="125.62344526401112" height="10" rotation="-175" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="398" y="354" width="360.0055555126893" height="10" rotation="179" static="false"/> <src.physics.mPhysCircle className="mBalka" frame="2" x="51" y="46" radius="21.37755832643195" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="398" y="367.5" width="358.3141080113927" height="10" rotation="177" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="222.5" y="403" width="37.05401462729781" height="10" rotation="-177" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="578.5" y="414" width="33" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="624.5" y="396.5" width="81.05553651663777" height="10" rotation="-178" static="true"/> <src.physics.mPhysBox className="mBox" frame="1" x="100" y="475" width="50" height="50" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="1" x="150" y="475" width="50" height="50" rotation="0" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="355.5" y="406" width="237.1349826575573" height="10" rotation="-179" static="true"/> </layer> <layer> <src.units.mMorph x="318.5" y="49"/> </layer> <layer> <src.units.mRecycle x="607.5" y="452"/> </layer> <layer/> <layer/> </level> ; static var level21:XML = <level> <layer> <src.units.mSun x="188" y="96"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="3"/> <src.units.mCloud x="433" y="185" frame="1"/> <src.units.mCloud x="606" y="261" frame="4"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="3" x="562.5" y="487.5" width="175" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="644" y="268.75" width="437.5" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="562.5" y="50" width="175" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="480" y="268.75" width="437.5" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="137.5" y="475" width="125" height="25" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="362.5" y="475" width="150" height="25" rotation="0" static="true"/> <src.physics.mPhysTriangle className="mBalka" frame="7" x="112.5" y="131.25" width="175" height="87.5" rotation="-46" static="true"/> <src.physics.mPhysBox className="mBox" frame="4" x="137.5" y="62.5" width="50" height="75" rotation="0" static="false"/> <src.physics.mPhysWheel className="mWheel" frame="5" x="567" y="262" radius="45.35416188179427" static="false"/> </layer> <layer> <src.units.mMorph x="137.5" y="400"/> </layer> <layer> <src.units.mRecycle x="362.5" y="400"/> </layer> <layer/> <layer/> </level> ; static var level22:XML = <level> <layer> <src.units.mSun x="575" y="150"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="1"/> <src.units.mCloud x="75" y="400" frame="1"/> <src.units.mCloud x="287.5" y="350" frame="3"/> <src.units.mCloud x="487.5" y="62.5" frame="3"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="3" x="187.5" y="100" width="175" height="10" rotation="-180" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="4" x="250" y="50" radius="27.95084971874737" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="650" y="31.25" width="37.5" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="159.75" y="387.5" width="137.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="289" y="387.5" width="125" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="414" y="387.5" width="125" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="530.75" y="387.5" width="112.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="637" y="387.5" width="100" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="668.75" y="200" width="350.2231431530475" height="10" rotation="-93" static="false"/> <src.units.mBomb x="125" y="62.5" radius="25" timer="5"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="96" y="325.25" width="112.5" height="10" rotation="90" static="true"/> </layer> <layer> <src.units.mMorph x="600" y="175"/> </layer> <layer> <src.units.mRecycle x="157.5" y="324"/> </layer> <layer/> <layer/> </level> ; static var level23:XML = <level> <layer> <src.units.mSun x="617" y="61"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="2"/> <src.units.mCloud x="100" y="120" frame="1"/> <src.units.mCloud x="76" y="347" frame="4"/> <src.units.mCloud x="455" y="98" frame="1"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="3" x="62.5" y="275" width="100" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="231.25" y="275" width="87.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="112.5" y="312.5" width="75" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="187.5" y="312.5" width="75" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="150" y="62.5" width="175" height="10" rotation="-180" static="false"/> <src.physics.mPhysWheel className="mWheel" frame="4" x="237.5" y="237.5" radius="25" static="false"/> <src.units.mBomb x="37.5" y="250" radius="17.67766952966369" timer="5"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="506.25" y="331.25" width="53.033008588991066" height="10" rotation="-135" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="618.75" y="331.25" width="53.033008588991066" height="10" rotation="135" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="523" y="377.25" width="62.5" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="601" y="379.25" width="62.5" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="601" y="416.5" width="50" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="583.25" y="463.5" width="62.5" height="10" rotation="-54" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="536.25" y="493.75" width="63.73774391990981" height="10" rotation="-12" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="473.75" y="500" width="62.5" height="10" rotation="0" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="2" x="462.5" y="462.5" radius="25" static="false"/> <src.physics.mPhysWheel className="mWheel" frame="3" x="230.5" y="344.5" radius="35.35533905932738" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="112.5" y="125" width="100" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="187.5" y="125" width="100" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="455.5" y="31.25" width="37.5" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="529.25" y="17.5" width="137.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="388.5" y="17.5" width="125" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="601" y="44.5" width="63.00793600809345" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="322" y="36.05" width="46.17358552246078" height="10" rotation="-90" static="true"/> </layer> <layer> <src.units.mMorph x="150" y="112.5"/> </layer> <layer> <src.units.mRecycle x="387.5" y="75"/> </layer> <layer/> <layer/> </level> ; static var level25:XML = <level> <layer> <src.units.mSun x="625" y="75"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="1"/> <src.units.mCloud x="312.5" y="112.5" frame="2"/> <src.units.mCloud x="362.5" y="287.5" frame="1"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="1" x="106.25" y="462.5" width="112.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="106.25" y="400" width="112.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="500" y="337.5" width="175" height="10" rotation="90" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="1" x="100" y="350" radius="37.5" static="false"/> <src.physics.mPhysWheel className="mWheel" frame="1" x="200" y="37.5" radius="37.5" static="false"/> <src.units.mBomb x="100" y="437.5" radius="25" timer="5"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="625" y="337.5" width="175" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="562.5" y="425" width="125" height="10" rotation="-180" static="true"/> <src.physics.mDotJoint x="500" y="425" mot="0" dir="0"/> <src.physics.mDotJoint x="625" y="425" mot="0" dir="0"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="100" y="12.5" width="100" height="10" rotation="0" static="true"/> <src.units.mBomb x="100" y="50" radius="25" timer="6"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="162.5" y="75" width="225" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="625" y="212.5" width="75" height="10" rotation="90" static="true"/> </layer> <layer> <src.units.mMorph x="312.5" y="462.5"/> </layer> <layer> <src.units.mRecycle x="562.5" y="362.5"/> </layer> <layer/> <layer/> </level> ; static var level27:XML = <level> <layer> <src.units.mSun x="421" y="131"/> </layer> <layer> <src.units.mCloud x="488" y="98" frame="2"/> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="2"/> </layer> <layer> <src.physics.mPhysBox className="mBox" frame="3" x="213.5" y="127.75" width="50" height="37.5" rotation="0" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="573.5" y="278.5" width="79.05694150420949" height="10" rotation="-167" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="612.5" y="375" width="125" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="670" y="412.5" width="75" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="637.5" y="450" width="75" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="605" y="412.75" width="62.5" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="687.5" y="281.25" width="87.5" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="668.75" y="350" width="62.5" height="10" rotation="-54" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="5" x="637.5" y="415" radius="25" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="284.25" y="114.25" width="245.58603380485624" height="10" rotation="-166" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="238.25" y="163" width="321.37400330456103" height="10" rotation="13" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="284.95" y="436" width="362.00552481971874" height="10" rotation="0" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="1" x="240" y="405" radius="22.360679774997894" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="388" y="213.5" width="40.26164427839479" height="10" rotation="104" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="420" y="250.5" width="92.11405973031478" height="10" rotation="-148" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="127" y="279.45" width="77.02596964660685" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="5" x="179" y="281.45" width="79.00632886041473" height="10" rotation="90" static="true"/> <src.physics.mPhysBox className="mBox" frame="4" x="153" y="203" width="50" height="75" rotation="0" static="false"/> </layer> <layer> <src.units.mMorph x="125" y="75"/> </layer> <layer> <src.units.mRecycle x="148" y="372"/> </layer> <layer/> <layer/> </level> ; static var level29:XML = <level> <layer> <src.units.mSun x="287.5" y="62.5"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="2"/> <src.units.mCloud x="120" y="110" frame="1"/> <src.units.mCloud x="436" y="220" frame="1"/> <src.units.mCloud x="592" y="475" frame="2"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="3" x="131.25" y="268.75" width="107.52906583803284" height="10" rotation="144" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="181.25" y="331.25" width="107.52906583803284" height="10" rotation="144" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="109.25" y="335" width="97.6281209488332" height="10" rotation="-128" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="137" y="356" width="25" height="10" rotation="143" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="96" y="302" width="25" height="10" rotation="143" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="2" x="171" y="288.5" radius="28.0178514522438" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="581.25" y="350" width="137.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="581.25" y="412.5" width="137.5" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="512.5" y="381.25" width="62.5" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="650" y="381.25" width="62.5" height="10" rotation="-90" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="5" x="578" y="383" radius="25" static="false"/> <src.units.mBomb x="533" y="384" radius="17.029386365926403" timer="10"/> <src.units.mBomb x="625" y="391" radius="13.601470508735444" timer="5"/> </layer> <layer> <src.units.mMorph x="126" y="317.5"/> </layer> <layer> <src.units.mRecycle x="578" y="290"/> </layer> <layer/> <layer/> </level> ; static var level24:XML = <level> <layer> <src.units.mSun x="187.5" y="112.5"/> </layer> <layer> <src.units.mCloud x="412.5" y="312.5" frame="1"/> <src.units.mCloud x="137.5" y="412.5" frame="4"/> <src.units.mCloud x="562.5" y="112.5" frame="3"/> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="2"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="1" x="300" y="150" width="125" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="425" y="150" width="125" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="362.5" y="75" width="300" height="10" rotation="-180" static="false"/> <src.physics.mPhysWheel className="mWheel" frame="3" x="362.5" y="125" radius="37.5" static="false"/> <src.physics.mPhysBox className="mBox" frame="4" x="236.5" y="31" width="50" height="75" rotation="0" static="false"/> <src.physics.mPhysBox className="mBox" frame="4" x="489.5" y="33" width="50" height="75" rotation="0" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="300" y="437.5" width="50" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="425" y="437.5" width="50" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="1" x="476.25" y="208.5" width="112.5" height="10" rotation="-180" static="true"/> </layer> <layer> <src.units.mMorph x="362.5" y="487.5"/> </layer> <layer> <src.units.mRecycle x="362.5" y="362.5"/> </layer> <layer/> <layer/> </level> ; static var level26:XML = <level> <layer> <src.units.mSun x="100" y="112.5"/> </layer> <layer> <src.units.mCloud x="537.5" y="162.5" frame="4"/> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="3"/> <src.units.mCloud x="275" y="275" frame="3"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="3" x="418.5" y="167.75" width="62.5" height="10" rotation="90" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="3" x="600" y="363" radius="31.064449134018133" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="8" x="637" y="362.55" width="73.10950690573696" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="8" x="558" y="363" width="74.02702209328697" height="10" rotation="-90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="8" x="249" y="296" width="89.82204629154248" height="10" rotation="11" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="8" x="164.5" y="265.5" width="94.41398201537736" height="10" rotation="28" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="8" x="91.5" y="205.5" width="102.30347012687302" height="10" rotation="50" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="8" x="45" y="121.5" width="99.04039579888602" height="10" rotation="73" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="2" x="79" y="95" radius="33.06055050963308" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="318.5" y="167" width="64.00781202322104" height="10" rotation="-91" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="524.5" y="142" width="108.00462953040486" height="10" rotation="89" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="8" x="501" y="326.5" width="114.5294721894762" height="10" rotation="-175" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="550.5" y="105.5" width="189" height="43" rotation="-85" static="false"/> <src.physics.mDotJoint x="525" y="195" mot="0" dir="0"/> <src.physics.mPhysCircle className="mBalka" frame="6" x="687" y="138" radius="11" static="true"/> <src.physics.mPhysBox className="mBox" frame="3" x="596" y="300.5" width="84" height="49" rotation="0" static="false"/> <src.physics.mPhysTriangle className="mBalka" frame="8" x="286" y="329.25" width="75" height="62.5" rotation="12" static="true"/> <src.physics.mPhysTriangle className="mBalka" frame="8" x="441.5" y="347.25" width="75" height="62.5" rotation="6" static="true"/> <src.physics.mPhysTriangle className="mBalka" frame="7" x="375" y="112.5" width="150" height="125" rotation="179" static="false"/> </layer> <layer> <src.units.mMorph x="370.5" y="295"/> </layer> <layer> <src.units.mRecycle x="469" y="107.5"/> </layer> <layer/> <layer/> </level> ; static var level28:XML = <level> <layer> <src.units.mSun x="461" y="77"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="3"/> <src.units.mCloud x="136" y="154" frame="3"/> <src.units.mCloud x="461" y="67" frame="2"/> <src.units.mCloud x="225" y="443" frame="3"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="1" x="162.25" y="191" width="137.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="4" x="157.5" y="140" radius="37.5" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="131.25" y="68.75" width="123.74368670764582" height="10" rotation="135" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="84.5" y="72.75" width="87.5" height="10" rotation="90" static="true"/> <src.units.mBomb x="436" y="325.5" radius="35.35533905932738" timer="5"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="128.45" y="27" width="95.0473566176356" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="461.1" y="453" width="91.78779875342912" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="651" y="454" width="74.06078584514205" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="160.5" y="276.5" width="161.04968177553155" height="10" rotation="-180" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="648" y="445.45" width="21.02379604162863" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="473" y="443.5" width="17" height="10" rotation="-90" static="true"/> <src.physics.mDistanceJoint x="112.5" y="275" x1="112.5" y1="187.5"/> <src.physics.mDistanceJoint x="212.5" y="275" x1="212.5" y1="187.5"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="525" y="381.25" width="62.5" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="587.5" y="381.25" width="62.5" height="10" rotation="90" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="605.25" y="340.5" width="45.069390943299865" height="10" rotation="146" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="4" x="508.25" y="342.5" width="45.069390943299865" height="10" rotation="33" static="true"/> <src.physics.mPhysWheel className="mWheel" frame="2" x="111" y="54" radius="22.561028345356956" static="false"/> </layer> <layer> <src.units.mMorph x="161.5" y="241"/> </layer> <layer> <src.units.mRecycle x="561" y="442"/> </layer> <layer/> <layer/> </level> ; static var level30:XML = <level> <layer> <src.units.mSun x="530" y="132"/> </layer> <layer> <src.units.mStaticMovie className="mFon" x="350" y="262.5" width="700" height="525" frame="1"/> <src.units.mCloud x="355" y="120" frame="3"/> <src.units.mCloud x="50" y="459" frame="2"/> <src.units.mCloud x="429" y="408" frame="2"/> </layer> <layer> <src.physics.mPhysRectangle className="mBalka" frame="6" x="343.75" y="62.5" width="137.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="175" y="350" width="100" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="512.5" y="350" width="100" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="225" y="412.5" width="100" height="10" rotation="0" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="7" x="343.75" y="431.25" width="137.5" height="37.5" rotation="0" static="false"/> <src.physics.mSpringJoint x="300" y="437.5" x1="300" y1="500" springKoeff="1000" frictKoeff="100"/> <src.physics.mSpringJoint x="387.5" y="437.5" x1="387.5" y1="500" springKoeff="1000" frictKoeff="100"/> <src.physics.mPhysWheel className="mWheel" frame="5" x="337.5" y="37.5" radius="25" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="6" x="462.5" y="412.5" width="100" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="2" x="343.75" y="325" width="212.5" height="10" rotation="-180" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="493.75" y="337.5" width="137.5" height="10" rotation="-180" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="193.75" y="337.5" width="137.5" height="10" rotation="0" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="343.75" y="250" width="290" height="10" rotation="-180" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="487.5" y="287.5" width="75" height="10" rotation="-90" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="200" y="287.5" width="75" height="10" rotation="-90" static="false"/> <src.physics.mDotJoint x="487.5" y="250" mot="0" dir="0"/> <src.physics.mDotJoint x="200" y="250" mot="0" dir="0"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="462.5" y="275" width="70.71067811865476" height="10" rotation="-135" static="false"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="225" y="275" width="70.71067811865476" height="10" rotation="-46" static="false"/> <src.physics.mDotJoint x="437.5" y="250" mot="0" dir="0"/> <src.physics.mDotJoint x="487.5" y="300" mot="0" dir="0"/> <src.physics.mDotJoint x="250" y="250" mot="0" dir="0"/> <src.physics.mDotJoint x="200" y="300" mot="0" dir="0"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="468.75" y="137.5" width="87.5" height="10" rotation="-180" static="true"/> <src.physics.mPhysRectangle className="mBalka" frame="3" x="218.75" y="137.5" width="87.5" height="10" rotation="0" static="true"/> </layer> <layer> <src.units.mMorph x="344.5" y="216.5"/> </layer> <layer> <src.units.mRecycle x="344" y="125"/> </layer> <layer/> <layer/> </level> ; static var levelXML:Array = new Array(level1, level2, level3, level4, level5, level6, level7, level8, level9, level10, level11, level12, level13, level14, level15, level16, level17, level18, level19, level20, level21, level22, level23, level24, level25, level26, level27, level28, level29, level30); public static function getLevel(_arg1:Number):XML{ return (new XML(levelXML[(_arg1 - 1)])); } } }//package src.levels
Section 110
//IEditable (src.levels.IEditable) package src.levels { import flash.geom.*; public interface IEditable { function setRotation(_arg1:Number):void; function argsToXML():XML; function destroy():void; function setPosition(_arg1:Point):void; } }//package src.levels
Section 111
//mLayerEngine (src.levels.mLayerEngine) package src.levels { import flash.geom.*; import flash.display.*; import src.*; public class mLayerEngine extends MovieClip { public var layers:Array; public function mLayerEngine(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number):void{ var _local5:*; var _local6:*; layers = new Array(); super(); _local5 = new Matrix(); _local5.rotate(90); graphics.beginGradientFill(GradientType.LINEAR, new Array(9097977, 0xFFFFFF), new Array(1, 1), new Array(0, 0xFF), _local5); utils.drawRect(graphics, 0, 0, _arg2, _arg3); graphics.endFill(); _arg1.addChild(this); _local6 = 0; while (_local6 < _arg4) { layers[_local6] = addChild(new MovieClip()); _local6++; }; } public function removeAllObjsWithClassName(_arg1:String, _arg2:Boolean=false):void{ var _local3:*; var _local4:*; _local3 = 0; while (_local3 < layers.length) { _local4 = 0; while (_local4 < layers[_local3].numChildren) { if (utils.getClassName(layers[_local3].getChildAt(_local4), _arg2) == _arg1){ if ((layers[_local3].getChildAt(_local4) is IEditable)){ IEditable(layers[_local3].getChildAt(_local4)).destroy(); }; }; _local4++; }; _local3++; }; } public function clearAll():void{ var _local1:*; _local1 = 0; while (_local1 < layers.length) { while (0 < layers[_local1].numChildren) { layers[_local1].removeChildAt(0); layers[_local1].graphics.clear(); }; _local1++; }; } public function isInclude(_arg1:String, _arg2:Boolean=false):Boolean{ var _local3:*; var _local4:*; _local3 = 0; while (_local3 < layers.length) { _local4 = 0; while (_local4 < layers[_local3].numChildren) { if (utils.getClassName(layers[_local3].getChildAt(_local4), _arg2) == _arg1){ return (true); }; _local4++; }; _local3++; }; return (false); } public function isEmply():Boolean{ var _local1:*; _local1 = 0; while (_local1 < layers.length) { if (layers[_local1].numChildren > 0){ return (false); }; _local1++; }; return (true); } public function getChildren(_arg1:Number, _arg2:Number, _arg3:Array=null):MovieClip{ var _local4:*; var _local5:*; _local4 = (layers.length - 1); while (_local4 >= 0) { _local5 = (layers[_local4].numChildren - 1); while (_local5 >= 0) { if (layers[_local4].getChildAt(_local5).hitTestPoint(_arg1, _arg2, true)){ if (_arg3){ if (!utils.ArrayContain(_arg3, utils.getClassName(layers[_local4].getChildAt(_local5)))){ return (layers[_local4].getChildAt(_local5)); }; } else { return (layers[_local4].getChildAt(_local5)); }; }; _local5--; }; _local4--; }; return (null); } public function getMousedChildren(_arg1:Array=null):MovieClip{ return (getChildren(mouseX, mouseY, _arg1)); } public function toXML():XML{ var _local1:*; var _local2:*; var _local3:*; _local1 = <level></level> ; _local2 = 0; while (_local2 < layers.length) { _local1.appendChild(<layer></layer> ); _local3 = 0; while (_local3 < layers[_local2].numChildren) { _local1.layer[_local2].appendChild(IEditable(layers[_local2].getChildAt(_local3)).argsToXML()); _local3++; }; _local2++; }; return (_local1); } } }//package src.levels
Section 112
//mLevelButton (src.levels.mLevelButton) package src.levels { import flash.display.*; import src.interfaces.*; import flash.events.*; import src.*; public class mLevelButton extends mTagButton { public const HEIGHT = 125; public const WIDTH = 280; public var whileLoad:MovieClip; public function mLevelButton(_arg1:MovieClip, _arg2:String, _arg3, _arg4:Number, _arg5, _arg6, _arg7:String, _arg8:Number, _arg9, _arg10:Function, _arg11:String, _arg12:String):void{ var fParent = _arg1; var fClassName = _arg2; var fOnFrame = _arg3; var fOffFrame = _arg4; var fx = _arg5; var fy = _arg6; var fCreator = _arg7; var fRating = _arg8; var fPNGUrl = _arg9; var fProc = _arg10; var fUrl = _arg11; var fLevelName = _arg12; super(fParent, fClassName, fOnFrame, fOffFrame, fx, fy, WIDTH, HEIGHT, true, "", 15, fProc, fUrl, fLevelName); onMovie.scaleX = (onMovie.scaleX * (-1 + (2 * Math.round(Math.random())))); onMovie.scaleY = (onMovie.scaleY * (-1 + (2 * Math.round(Math.random())))); offMovie.scaleX = onMovie.scaleX; offMovie.scaleY = onMovie.scaleY; new mText(this, 70, ((-(HEIGHT) / 2) + 20), 120, 25, fLevelName, "left", 16, 0); new mText(this, 70, 0, 120, 25, ("by " + String(fCreator)), "left", 14, 0); utils.addRatingStars(this, 25, ((HEIGHT / 2) - 20), fRating); whileLoad = new mSmallWhileLoad(); whileLoad.x = ((-((WIDTH - 10)) / 2) + (WIDTH / 4)); whileLoad.y = ((-((HEIGHT - 10)) / 2) + ((HEIGHT - 10) / 2)); whileLoad.width = (WIDTH / 2); whileLoad.height = (HEIGHT - 10); addChild(whileLoad); utils.loadContent(this, fPNGUrl, (-((WIDTH - 10)) / 2), (-((HEIGHT - 10)) / 2), (WIDTH / 2), (HEIGHT - 10), function (){ }, loadImageIOErrorHandler); } public function loadImageIOErrorHandler(_arg1:IOErrorEvent):void{ whileLoad.gotoAndStop(17); } } }//package src.levels
Section 113
//mLevelEditor (src.levels.mLevelEditor) package src.levels { import flash.geom.*; import Box2D.Common.Math.*; import flash.display.*; import flash.utils.*; import src.interfaces.*; import flash.events.*; import src.*; public class mLevelEditor { public const MIN_LENGTH = 5; public var lineVec:b2Vec2; public var rotatedObject:MovieClip;// = null public var editablesArray:Array; public var upX:Number; public var upY:Number; public var pressed:Boolean;// = false public var lineWidth:Number; public var startY:Number; public var isStatic:Boolean;// = true public var lineHeight:Number; public var startX; public var lineAngle:Number; public var currentElement:Number;// = 0 public var grid:mGrid; public var necessaryArray:Array; public var rotatedDeltaAngle; public var elementsPanel:mElementPanel; public var draggedStartX; public var draggedStartY:Number;// = 0 public var draggedObject:MovieClip;// = null public var argsArray:Array; public var layerArray:Array; public var propertiesPanel:mElementPanel; public var editArgsArray:Array; public var paintArray:Array; public var parent:MovieClip; public var gridSprite:Sprite; public var aloneArray:Array; public var classArray:Array; public var paintSprite:Sprite; public var mainPanel:mPanel; public var draggedDeltaX; public var draggedDeltaY; public var rotatedStartAngle:Number;// = 0 public var editedLevel:XML; public var endX; public var endY:Number; public var PNGLevelScreenShot:ByteArray; public var lineX:Number; public var lineY:Number; public var downX:Number; public var downY:Number; public var lineLength:Number; public function mLevelEditor(_arg1:MovieClip, _arg2:MovieClip):void{ paintArray = new Array(); classArray = new Array(); layerArray = new Array(); aloneArray = new Array(); necessaryArray = new Array(); argsArray = new Array(); editArgsArray = new Array(); editablesArray = new Array(); pressed = false; isStatic = true; editedLevel = new XML(); draggedObject = null; draggedStartY = 0; rotatedObject = null; rotatedStartAngle = 0; currentElement = 0; super(); currentElement = 0; editedLevel = <level></level> ; paintSprite = _arg1; gridSprite = _arg2; } public function mouseUpHandler(_arg1:MouseEvent):void{ var _local2:Boolean; var _local3:Array; var _local4:*; var _local5:String; var _local6:String; if (pressed){ pressed = false; if (currentElement < 100){ _local2 = false; if (paintArray[currentElement] == 0){ _local2 = true; }; if ((((((paintArray[currentElement] == 1)) || ((paintArray[currentElement] == 2)))) || ((paintArray[currentElement] == 3)))){ if (lineLength > MIN_LENGTH){ _local2 = true; }; }; if (paintArray[currentElement] == 4){ if ((((lineWidth > MIN_LENGTH)) && ((lineHeight > MIN_LENGTH)))){ _local2 = true; }; }; if (_local2){ _local3 = new Array(); _local4 = 0; while (_local4 < argsArray[currentElement].length) { _local3[_local4] = argsArray[currentElement][_local4]; _local5 = String(_local3[_local4]).replace(/\*[\-a-zA-Z0-9_\.,]+$/, ""); _local6 = String(_local3[_local4]).replace(/^[\-a-zA-Z0-9_\.,]+[\*]?/, ""); if ((_local5 in this)){ _local3[_local4] = Number(this[_local5]); }; if (getIfEditableValue(String(_local5)) != null){ _local3[_local4] = getIfEditableValue(String(_local5)); }; if (_local6){ _local3[_local4] = (_local3[_local4] * Number(_local6)); }; _local4++; }; if (aloneArray[currentElement]){ main.game.layerEngine.removeAllObjsWithClassName(classArray[currentElement]); }; utils.createObjFromString(main.game.layerEngine.layers[layerArray[currentElement]], classArray[currentElement], _local3); }; } else { if (currentElement == 100){ if ((main.game.layerEngine.getMousedChildren() is IEditable)){ IEditable(main.game.layerEngine.getMousedChildren()).destroy(); }; }; if (currentElement == 101){ if (draggedObject){ draggedObject = null; }; }; if (currentElement == 102){ if (rotatedObject){ rotatedObject = null; }; }; }; }; } public function testLevel():void{ var i:*; if (main.game.layerEngine.isEmply()){ new mDialogWindow(main.game.rootMovie, "Level is empty! ", "middle", "Ok", function (){ }); return; }; i = 0; while (i < necessaryArray.length) { if (necessaryArray[i] != ""){ if (!main.game.layerEngine.isInclude(classArray[i])){ new mDialogWindow(main.game.rootMovie, ("Add " + necessaryArray[i]), "middle", "Ok", function (){ }); return; }; }; i = (i + 1); }; editedLevel = main.game.layerEngine.toXML(); main.game.levelEngine.loadLevel(editedLevel, "Test level", function (){ load(editedLevel); }, function (){ new mDialogWindow(main.game.interfaceEngine, "Level Completed!", "middle", "Edit level", function (){ load(editedLevel); }, "Send level", function (){ main.game.levelSender.send(editedLevel, PNGLevelScreenShot); }); }); main.game.interfaceEngine.visible = false; PNGLevelScreenShot = utils.PNGEncode(utils.decreaseBitmapData(utils.getBitmapData(main.game.rootMovie, main.STAGE_WIDTH, main.STAGE_HEIGHT), 3)); main.game.interfaceEngine.visible = true; } public function getIfEditableValue(_arg1:String){ if (_arg1.substr(0, 8) == "editable"){ return (utils.stringToType(editablesArray[Number(_arg1.substr(8, (_arg1.length - 8)))].value)); }; return (null); } public function clearAll():void{ var _local1:Array; var _local2:*; if (grid){ main.game.saveEngine.saveState("grid", grid); grid.clearAll(); }; if (mainPanel){ main.game.saveEngine.saveState("mainPanel", mainPanel); }; if (elementsPanel){ main.game.saveEngine.saveState("elementsPanel", elementsPanel); }; if (propertiesPanel){ main.game.saveEngine.saveState("propertiesPanel", propertiesPanel); }; main.game.saveEngine.saveVars("currentElement", currentElement); main.game.saveEngine.saveVars("isStatic", isStatic); _local1 = new Array(); _local2 = 0; while (_local2 < editablesArray.length) { _local1[_local1.length] = editablesArray[_local2].value; _local2++; }; if (_local1.length > 0){ main.game.saveEngine.saveVars("editablesArray", _local1); }; while (editablesArray.length > 0) { editablesArray.pop(); }; main.game.layerEngine.removeEventListener(Event.ENTER_FRAME, update); main.game.layerEngine.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); main.game.layerEngine.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } public function addEditable(... _args):void{ editArgsArray[editArgsArray.length] = _args; } public function addElement(_arg1:Number, _arg2:String, _arg3:Boolean, _arg4:String, _arg5:Number, ... _args):void{ paintArray[paintArray.length] = _arg1; classArray[classArray.length] = _arg2; layerArray[layerArray.length] = _arg5; aloneArray[aloneArray.length] = _arg3; necessaryArray[necessaryArray.length] = _arg4; argsArray[argsArray.length] = _args; } public function setAllEditablesInvisible():void{ var _local1:*; _local1 = 0; while (_local1 < editablesArray.length) { editablesArray[_local1].visible = false; _local1++; }; } public function loadState():void{ if (main.game.saveEngine.loadVar("currentElement")){ currentElement = main.game.saveEngine.loadVar("currentElement"); }; if (main.game.saveEngine.loadVar("isStatic") != undefined){ isStatic = main.game.saveEngine.loadVar("isStatic"); }; } public function mouseDownHandler(_arg1:MouseEvent):void{ var _local2:*; pressed = true; startX = grid.getBindedPosition(new b2Vec2(main.game.layerEngine.mouseX, main.game.layerEngine.mouseY)).x; startY = grid.getBindedPosition(new b2Vec2(main.game.layerEngine.mouseX, main.game.layerEngine.mouseY)).y; if (main.game.layerEngine.getMousedChildren()){ if (currentElement == 101){ draggedObject = main.game.layerEngine.getMousedChildren(); draggedStartX = draggedObject.x; draggedStartY = draggedObject.y; draggedDeltaX = (draggedObject.x - startX); draggedDeltaY = (draggedObject.y - startY); }; if (currentElement == 102){ rotatedObject = main.game.layerEngine.getMousedChildren(); rotatedStartAngle = rotatedObject.rotation; _local2 = new b2Vec2((startX - rotatedObject.x), (startY - rotatedObject.y)); rotatedDeltaAngle = (rotatedStartAngle - ((_local2.GetAngle() * 180) / Math.PI)); startX = rotatedObject.x; startY = rotatedObject.y; }; }; } public function refreshPanels(_arg1:Number):void{ mouseUpHandler(null); currentElement = _arg1; elementsPanel.refreshAllocation(_arg1); setAllEditablesInvisible(); if (_arg1 < 100){ setVisibleEditables(argsArray[_arg1]); }; propertiesPanel.refreshAll(); } public function setVisibleEditables(_arg1:Array):void{ var _local2:*; _local2 = 0; while (_local2 < _arg1.length) { if (String(_arg1[_local2]).substr(0, 8) == "editable"){ editablesArray[Number(_arg1[_local2].substr(8, (_arg1[_local2].length - 8)))].visible = true; }; _local2++; }; } public function update(_arg1:Event):void{ var _local2:*; var _local3:*; var _local4:*; var _local5:*; var _local6:*; var _local7:*; endX = main.game.layerEngine.mouseX; endY = main.game.layerEngine.mouseY; if (main.game.inputEngine.isKeyDown(16)){ _local2 = grid.getAngledPosition(new b2Vec2((endX - startX), (endY - startY))); endX = (startX + _local2.x); endY = (startY + _local2.y); }; _local2 = grid.getBindedPosition(new b2Vec2(endX, endY)); endX = _local2.x; endY = _local2.y; if (draggedObject){ IEditable(draggedObject).setPosition(new Point((endX + draggedDeltaX), (endY + draggedDeltaY))); }; if (rotatedObject){ _local3 = new b2Vec2((endX - rotatedObject.x), (endY - rotatedObject.y)); IEditable(rotatedObject).setRotation(Math.floor((((_local3.GetAngle() * 180) / Math.PI) + rotatedDeltaAngle))); }; if (paintSprite){ paintSprite.graphics.clear(); paintSprite.graphics.lineStyle(3, 0xFFFFFF); if (pressed){ calcEditLineParams(); if ((((paintArray[currentElement] == 1)) || (main.game.inputEngine.isKeyDown(16)))){ paintSprite.graphics.moveTo(startX, startY); paintSprite.graphics.lineTo(endX, endY); }; if (paintArray[currentElement] == 2){ paintSprite.graphics.moveTo(startX, startY); paintSprite.graphics.lineTo(endX, endY); paintSprite.graphics.drawCircle(startX, startY, lineLength); }; if (paintArray[currentElement] == 3){ _local4 = utils.getB2Vec2((((lineAngle / 180) * Math.PI) - (Math.PI / 2))).Multipled(50).x; _local5 = utils.getB2Vec2((((lineAngle / 180) * Math.PI) - (Math.PI / 2))).Multipled(50).y; _local6 = utils.getB2Vec2((((lineAngle / 180) * Math.PI) - (Math.PI / 2))).Multipled(-25).x; _local7 = utils.getB2Vec2((((lineAngle / 180) * Math.PI) - (Math.PI / 2))).Multipled(-25).y; paintSprite.graphics.moveTo((startX + _local6), (startY + _local7)); paintSprite.graphics.lineTo((endX + _local6), (endY + _local7)); paintSprite.graphics.lineTo(((lineX + _local4) + _local6), ((lineY + _local5) + _local7)); paintSprite.graphics.lineTo((startX + _local6), (startY + _local7)); paintSprite.graphics.moveTo(startX, startY); paintSprite.graphics.lineTo(endX, endY); }; if (paintArray[currentElement] == 4){ paintSprite.graphics.moveTo(downX, downY); paintSprite.graphics.lineTo(upX, upY); paintSprite.graphics.lineTo((downX + ((upX - downX) * 2)), downY); paintSprite.graphics.lineTo(downX, downY); }; }; }; } public function configure():void{ addElement(0, "src.units.mMorph", true, "a morphing", 3, "endX", "endY"); addElement(0, "src.units.mRecycle", true, "a target", 4, "endX", "endY"); addElement(2, "src.physics.mPhysCircle", false, "", 2, "mBalka", "editable0", "startX", "startY", "lineLength", "isStatic"); addElement(1, "src.physics.mPhysRectangle", false, "", 2, "mBalka", "editable0", "lineX", "lineY", "lineWidth", "lineHeight", 0, "isStatic"); addElement(1, "src.physics.mPhysRectangle", false, "", 2, "mBalka", "editable0", "lineX", "lineY", "lineLength", 10, "lineAngle", "isStatic"); addElement(1, "src.physics.mPhysBox", false, "", 2, "mBox", "editable1", "lineX", "lineY", "lineWidth", "lineHeight", 0, false); addElement(2, "src.physics.mPhysWheel", false, "", 2, "mWheel", "editable6", "startX", "startY", "lineLength", false); addElement(3, "src.physics.mPhysTriangle", false, "", 2, "mBalka", "editable0", "lineX", "lineY", "lineLength", 50, "lineAngle", "isStatic"); addElement(4, "src.physics.mPhysTriangle", false, "", 2, "mBalka", "editable0", "upX", "lineY", "lineWidth*2", "lineHeight", 0, "isStatic"); addElement(0, "src.physics.mDotJoint", false, "", 2, "endX", "endY", 0); addElement(0, "src.physics.mDotJoint", false, "", 2, "endX", "endY", "editable3", 1); addElement(0, "src.physics.mDotJoint", false, "", 2, "endX", "endY", "editable3", -1); addElement(1, "src.physics.mDistanceJoint", false, "", 2, "startX", "startY", "endX", "endY"); addElement(1, "src.physics.mPrismaticJoint", false, "", 2, "startX", "startY", "endX", "endY"); addElement(1, "src.physics.mSpringJoint", false, "", 2, "startX", "startY", "endX", "endY", "editable4", "editable5"); addElement(2, "src.units.mBomb", false, "", 2, "startX", "startY", "lineLength", "editable7"); addElement(0, "src.units.mCloud", false, "", 1, "endX", "endY"); addElement(0, "src.units.mSun", true, "", 0, "endX", "endY"); addElement(0, "src.units.mStaticMovie", true, "", 1, "mFon", 350, 262.5, 700, 525, "editable2"); addEditable(1, 1, 8, "mBalkaPreview"); addEditable(1, 1, 5, "mBoxPreview"); addEditable(1, 1, 3, "mFonPreview"); addEditable("Power", 1, true, 1, 300); addEditable("Rigidity", 2500, true, 1, 10000); addEditable("Atten.", 100, true, 1, 300); addEditable(1, 1, 5, "mWheelPreview"); addEditable("Timer", 1, true, 1, 10); } public function load(_arg1:XML):void{ var i:*; var tempArray:Array; var fXML = _arg1; main.game.clearAll(); grid = new mGrid(45, main.STAGE_WIDTH, main.STAGE_HEIGHT, gridSprite, 12.5, 25, 50); main.game.saveEngine.loadState("grid", grid); grid.draw(grid.sprite); mainPanel = main.game.interfaceEngine.addPanel("mInterfaceTexture", -65, 0, 0, 0, 75, 125, 0.3); main.game.saveEngine.loadState("mainPanel", mainPanel); elementsPanel = main.game.interfaceEngine.addElementPanel("mInterfaceTexture", (main.STAGE_WIDTH - 10), 0, (main.STAGE_WIDTH - 110), 0, 110, main.STAGE_HEIGHT, 0.3, 5, 20); main.game.saveEngine.loadState("elementsPanel", elementsPanel); propertiesPanel = main.game.interfaceEngine.addElementPanel("mInterfaceTexture", 0, (main.STAGE_HEIGHT - 10), 0, (main.STAGE_HEIGHT - 100), (main.STAGE_WIDTH - 100), 100, 0.3, 5, 35); main.game.saveEngine.loadState("propertiesPanel", propertiesPanel); new mButton(mainPanel, "mButtonBack", 1, 1, 35, 40, 50, 20, true, "test", 15, function (){ testLevel(); }); new mButton(mainPanel, "mButtonBack", 1, 1, 35, 62.5, 50, 20, true, "grid", 15, function (){ grid.switchState(); }); new mButton(mainPanel, "mButtonBack", 1, 1, 35, 85, 50, 20, true, "clear", 15, function (){ new mDialogWindow(main.game.rootMovie, "Clear all?", "middle", "yes", function (){ editedLevel = <level></level> ; load(editedLevel); }, "no", function (){ }); }); new mButton(mainPanel, "mButtonBack", 1, 1, 35, 107.5, 50, 20, true, "menu", 15, function (){ main.game.loadTitleMenu(); }); startX = (startY = 0); draggedObject = (rotatedObject = null); draggedDeltaX = (draggedDeltaY = (draggedStartX = (draggedStartY = 0))); rotatedDeltaAngle = 0; rotatedStartAngle = 0; elementsPanel.addDivider(); i = 0; while (i < classArray.length) { elementsPanel.addElement(new mTagButton(elementsPanel, "mLEButtonsBacks", (i + 1), (i + 1), 15, 15, 30, 30, true, "", 15, refreshPanels, i)); i = (i + 1); }; elementsPanel.allocation.visible = true; i = 0; while (i < editArgsArray.length) { if (editArgsArray[i].length == 5){ editablesArray[editablesArray.length] = propertiesPanel.addElement(new mEdit(propertiesPanel, 60, 10, editArgsArray[i][0], editArgsArray[i][1], editArgsArray[i][2], editArgsArray[i][3], editArgsArray[i][4])); }; if (editArgsArray[i].length == 4){ editablesArray[editablesArray.length] = propertiesPanel.addElement(new mComboBox(propertiesPanel, 60, 10, editArgsArray[i][3], editArgsArray[i][0], editArgsArray[i][1], editArgsArray[i][2])); }; i = (i + 1); }; if (main.game.saveEngine.loadVar("editablesArray")){ tempArray = main.game.saveEngine.loadVar("editablesArray"); i = 0; while (i < tempArray.length) { editablesArray[i].value = Number(tempArray[i]); i = (i + 1); }; }; elementsPanel.addDivider(); if (isStatic){ elementsPanel.addElementWithoutAlloc(new mButton(elementsPanel, "mDynStatButtonBack", 2, 1, 37.5, 10, 100, 20, true, "", 15, function (){ isStatic = !(isStatic); })); } else { elementsPanel.addElementWithoutAlloc(new mButton(elementsPanel, "mDynStatButtonBack", 1, 2, 37.5, 10, 100, 20, true, "", 15, function (){ isStatic = !(isStatic); })); }; elementsPanel.addDivider(); elementsPanel.addElement(new mTagButton(elementsPanel, "mLEEditButtonsBacks", 1, 1, 15, 15, 30, 30, true, "", 15, refreshPanels, 100)); elementsPanel.addElement(new mTagButton(elementsPanel, "mLEEditButtonsBacks", 2, 2, 15, 15, 30, 30, true, "", 15, refreshPanels, 101)); elementsPanel.addElement(new mTagButton(elementsPanel, "mLEEditButtonsBacks", 3, 3, 15, 15, 30, 30, true, "", 15, refreshPanels, 102)); elementsPanel.addDivider(); refreshPanels(currentElement); main.game.globalPause = true; main.game.levelEngine.loadXML(fXML); main.game.layerEngine.addEventListener(Event.ENTER_FRAME, update); main.game.layerEngine.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); main.game.layerEngine.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } public function calcEditLineParams():void{ lineX = ((startX + endX) / 2); lineY = ((startY + endY) / 2); lineVec = new b2Vec2((startX - endX), (startY - endY)); lineLength = lineVec.Length(); lineWidth = Math.abs((startX - endX)); lineHeight = Math.abs((startY - endY)); lineAngle = Math.floor(((lineVec.GetAngle() * 180) / Math.PI)); if (startY > endY){ upX = endX; downX = startX; upY = endY; downY = startY; } else { upX = startX; downX = endX; upY = startY; downY = endY; }; } } }//package src.levels
Section 114
//mLevelEngine (src.levels.mLevelEngine) package src.levels { import Box2D.Common.Math.*; import flash.display.*; import flash.utils.*; import flash.net.*; import src.interfaces.*; import src.units.*; import flash.events.*; import src.*; import flash.xml.*; public class mLevelEngine { public const TIMER_TTH = 120; public var timerCount:mText; public var currentLevelXML:XML; public var backProc:Function; public var currentWalk:String;// = "" public var timerTth:Number;// = 0 public var completeProc:Function; public var levelName:String;// = "Level" public function mLevelEngine(_arg1:MovieClip):void{ currentLevelXML = <level></level> ; levelName = "Level"; backProc = function (){ }; completeProc = function (){ }; currentWalk = ""; timerTth = 0; super(); _arg1.addEventListener(Event.ENTER_FRAME, update); } public function update(_arg1:Event):void{ if (((!(main.game.globalPause)) && (!(main.game.awayPause.visible)))){ if (timerCount){ if (timerTth > 0){ timerTth--; }; timerCount.newText(("Score: " + String(Math.floor((timerTth / main.game.gameStage.frameRate))))); }; }; } public function loadXML(_arg1:XML):void{ var _local2:*; var _local3:XML; var _local4:*; _local2 = 0; while (_local2 < _arg1.children().length()) { _local3 = XML(_arg1.children()[_local2]); _local4 = 0; while (_local4 < _local3.children().length()) { utils.createObjFromString(main.game.layerEngine.layers[_local2], String(_local3.children()[_local4].name()), utils.getArrFromXMLListAttrs(_local3.children()[_local4].attributes())); _local4++; }; _local2++; }; } public function levelComplete():void{ main.game.globalPause = true; main.game.soundEngine.playSound("fanfare"); completeProc(Math.floor((timerTth / main.game.gameStage.frameRate))); } public function resetLevel():void{ loadLevel(currentLevelXML, levelName, backProc, completeProc, currentWalk); } public function levelLose():void{ resetLevel(); main.game.soundEngine.playSound("lose"); } public function loadLevel(_arg1, _arg2:String, _arg3:Function, _arg4:Function, _arg5:String=""):Boolean{ var maybeLoaded:Boolean; var tempXML:XML; var fXML = _arg1; var fLevelName = _arg2; var fBackProc = _arg3; var fCompleteProc = _arg4; var fWalkthrough = _arg5; maybeLoaded = false; if ((fXML is String)){ if (((((!((fXML == ""))) && ((fXML.substr(0, 7) == "<level>")))) && ((fXML.substr((fXML.length - 8), 8) == "</level>")))){ maybeLoaded = true; tempXML = new XML(fXML); }; }; if ((fXML is XML)){ maybeLoaded = true; tempXML = fXML; }; if (maybeLoaded){ main.game.clearAll(); loadXML(tempXML); currentLevelXML = tempXML; levelName = fLevelName; backProc = fBackProc; completeProc = fCompleteProc; currentWalk = fWalkthrough; new mButton(main.game.interfaceEngine, "mButtonBack", 1, 1, 35, (main.STAGE_HEIGHT - 20), 50, 20, true, "back", 15, function (){ backProc(); }); new mButton(main.game.interfaceEngine, "mSmallSponsorLogo", 1, 1, 180, (main.STAGE_HEIGHT - 20), 200, 40, true, "", 15, function (){ main.game.toSponsorSite(); }); if (fWalkthrough){ new mButton(main.game.interfaceEngine, "mButtonBack", 1, 1, (main.STAGE_WIDTH / 2), (main.STAGE_HEIGHT - 20), 90, 20, true, "walkthrough", 15, function (){ utils.goToUrl(fWalkthrough); }); }; new mButton(main.game.interfaceEngine, "mButtonBack", 1, 1, (main.STAGE_WIDTH - 35), (main.STAGE_HEIGHT - 20), 50, 20, true, "reset", 15, function (){ resetLevel(); }); new mText(main.game.interfaceEngine, 160, 17.5, 300, 35, levelName, "left", 25, 0); timerTth = (TIMER_TTH * main.game.gameStage.frameRate); timerCount = new mText(main.game.interfaceEngine, (main.STAGE_WIDTH - 110), 17.5, 200, 35, ("Score: " + String(Math.floor((timerTth / main.game.gameStage.frameRate)))), "right", 25, 0); main.game.globalPause = false; main.game.soundEngine.playMusic("track2"); main.game.fader.applyOut(0xFFFFFF); } else { new mDialogWindow(main.game.rootMovie, "Error! ", "middle", "Ok", function (){ }); }; return (maybeLoaded); } } }//package src.levels
Section 115
//mLevelSelector (src.levels.mLevelSelector) package src.levels { import src.interfaces.*; import mochi.as3.*; import src.*; public class mLevelSelector { public const WALKTHROUGH_URL = "http://www.maxgames.com/guides/morphing.html"; public const ROWS = 5; public const START_X = 40; public const START_Y = 100; public const WIDTH; public const HEIGHT; public const COUNT = 30; public const COLUMNS = 6; public var currentLevel:Number;// = 0 public var levelsCompleted:Number;// = 0 public var scoresArray:Array; public function mLevelSelector():void{ WIDTH = (main.STAGE_WIDTH - 100); HEIGHT = (main.STAGE_HEIGHT - 210); levelsCompleted = 0; currentLevel = 0; scoresArray = new Array(); super(); } public function loadProgress():void{ clearProgress(); if (((!((main.game.saveEngine.loadVar("levComp") == "undefined"))) && (!((main.game.saveEngine.loadVar("scores") == "undefined"))))){ levelsCompleted = main.game.saveEngine.loadVar("levComp"); scoresArray = main.game.saveEngine.loadVar("scores"); }; } public function sendScores():void{ var _local1:*; var _local2:*; _local1 = 0; _local2 = 0; while (_local2 < COUNT) { _local1 = (_local1 + scoresArray[_local2]); _local2++; }; utils.loadLeaderBoard(main.game.MOCHI_LEADERBOARD_ID, _local1); } public function saveProgress():void{ main.game.saveEngine.saveVars("levComp", levelsCompleted, "scores", scoresArray); } public function loadSelectScreen():void{ var count:*; var deltaX:*; var deltaY:*; var j:*; var totalScores:*; var i:*; var tempButton:*; var tempText:*; main.game.clearAll(); main.game.loadMenusFon(); main.game.interfaceEngine.addText((main.STAGE_WIDTH / 2), 35, 200, 50, "Select a level", "center", 30, 0); count = COUNT; deltaX = Math.floor((WIDTH / (COLUMNS - 1))); deltaY = Math.floor((HEIGHT / (ROWS - 1))); j = 0; while (j < ROWS) { i = 0; while (i < COLUMNS) { if (count > 0){ tempButton = new mTagButton(main.game.interfaceEngine, "mButtonBack", 1, 1, (START_X + (deltaX * i)), (START_Y + (deltaY * j)), 35, 35, ((COUNT - count) < (levelsCompleted + 1)), String(((COUNT - count) + 1)), 15, loadEmbedLevel, ((COUNT - count) + 1)); if (levelsCompleted > (COUNT - count)){ tempText = new mText(main.game.interfaceEngine, (START_X + (deltaX * i)), ((START_Y + (deltaY * j)) + 25), 50, 15, scoresArray[String((COUNT - count))], "center", 15, 0); }; if ((COUNT - count) == levelsCompleted){ tempButton.setOnOff(false); }; }; count = (count - 1); i = (i + 1); }; j = (j + 1); }; tempButton = new mButton(main.game.interfaceEngine, "mButtonBack", 1, 1, 35, (main.STAGE_HEIGHT - 20), 50, 20, true, "back", 15, function (){ main.game.loadTitleMenu(); }); new mButton(main.game.interfaceEngine, "mSmallSponsorLogo", 1, 1, 170, (main.STAGE_HEIGHT - 20), 200, 40, true, "", 15, function (){ main.game.toSponsorSite(); }); totalScores = 0; i = 0; while (i < COUNT) { totalScores = (totalScores + scoresArray[i]); i = (i + 1); }; tempText = new mText(main.game.interfaceEngine, (main.STAGE_WIDTH / 2), (main.STAGE_HEIGHT - 50), 300, 50, ("Total score: " + String(totalScores)), "center", 30, 0); main.game.soundEngine.addButtons(main.game.interfaceEngine); main.game.soundEngine.playMusic("track1"); } public function clearProgress():void{ var _local1:*; scoresArray = new Array(); _local1 = 0; while (_local1 < COUNT) { scoresArray[_local1] = 0; _local1++; }; levelsCompleted = 0; } public function levelComplete(_arg1:Number):void{ var tempDialog:*; var fScores = _arg1; scoresArray[(currentLevel - 1)] = fScores; if ((currentLevel - 1) == levelsCompleted){ levelsCompleted++; }; if (currentLevel == COUNT){ tempDialog = new mDialogWindow(main.game.interfaceEngine, "Level Completed!", "middle", "More games", function (){ loadSelectScreen(); main.game.toSponsorSite(); }, "Select level", function (){ loadSelectScreen(); }); } else { tempDialog = new mDialogWindow(main.game.interfaceEngine, "Level Completed!", "middle", "More games", function (){ loadSelectScreen(); main.game.toSponsorSite(); }, "Select level", function (){ loadSelectScreen(); }, "NEXT LEVEL", function (){ loadEmbedLevel((currentLevel + 1)); }); }; new mButton(tempDialog, "mSmallSponsorLogo", 1, 1, (main.STAGE_WIDTH / 2), 200, 200, 40, true, "", 15, function (){ main.game.toSponsorSite(); }); saveProgress(); } public function loadEmbedLevel(_arg1:Number):void{ var fNumber = _arg1; if (main.game.levelEngine.loadLevel(embedLevels.getLevel(fNumber), ("Level " + String(fNumber)), function (){ loadSelectScreen(); }, levelComplete, WALKTHROUGH_URL)){ currentLevel = fNumber; if (currentLevel == 1){ new mText(main.game.interfaceEngine, (main.STAGE_WIDTH / 2), 180, 500, 60, "WELCOME TO \"MORPHING\"!!!\nClick on the box to morph in it", "left", 18, 0); }; }; } } }//package src.levels
Section 116
//mLevelSender (src.levels.mLevelSender) package src.levels { import flash.utils.*; import flash.net.*; import src.interfaces.*; import src.*; public class mLevelSender { private var sendedPNG:ByteArray; private var saveLevelScriptUrl:String; private var levelName:String; private var savePNGScriptUrl:String; private var sendedLevel:XML; private var gameCode:String; public function mLevelSender(_arg1:String, _arg2:String, _arg3:String):void{ saveLevelScriptUrl = _arg1; savePNGScriptUrl = _arg2; gameCode = _arg3; } public function processPNGSendResponse(_arg1:String):void{ var fResponse = _arg1; trace(fResponse); if (fResponse == "file recorded"){ new mDialogWindow(main.game.rootMovie, "Level have been sent!", "middle", "Ok", function (){ main.game.levelEditor.load(sendedLevel); }); } else { new mDialogWindow(main.game.rootMovie, "Error, try later", "middle", "Ok", function (){ main.game.levelEditor.load(sendedLevel); }); }; } public function send(_arg1:XML, _arg2:ByteArray):void{ var fXML = _arg1; var fByteArray = _arg2; sendedLevel = fXML; sendedPNG = fByteArray; new mInputWindow(main.game.rootMovie, "Send level:", sendLevel, function (){ main.game.levelEditor.load(sendedLevel); }, "Level name:", ("level" + String(Math.floor((Math.random() * 1000)))), "Your name:", "name"); } public function processLevelSendResponse(_arg1:String):void{ var fResponse = _arg1; trace(fResponse); if (fResponse == "file exist"){ new mDialogWindow(main.game.rootMovie, "This level name is occupied", "middle", "Ok", function (){ send(sendedLevel, sendedPNG); }); } else { if (fResponse == "file recorded"){ utils.sendByteArray(sendedPNG, ((((savePNGScriptUrl + "?filename=") + levelName) + ".png&code=") + gameCode), processPNGSendResponse); } else { new mDialogWindow(main.game.rootMovie, "Error, try later", "middle", "Ok", function (){ main.game.levelEditor.load(sendedLevel); }); }; }; } public function sendLevel(_arg1:String, _arg2:String):void{ var _local3:*; levelName = _arg1; _local3 = new URLVariables(); _local3.level = sendedLevel.toXMLString(); _local3.levelname = _arg1; _local3.creatorname = _arg2; _local3.code = gameCode; utils.sendUrlVariables(_local3, saveLevelScriptUrl, processLevelSendResponse); } } }//package src.levels
Section 117
//mLevelViewer (src.levels.mLevelViewer) package src.levels { import flash.net.*; import src.interfaces.*; import src.*; public class mLevelViewer { public const COLUMNS_PER_PAGE:Number = 2; public const END_X:Number; public const END_Y:Number; public const START_X:Number = 175; public const START_Y:Number = 110; public const ROWS_PER_PAGE:Number = 3; public var onErrorProc:Function; public var lastNow:Boolean; public var scriptUrl:String; public var currentPage:Number; public var gameCode:String; public function mLevelViewer(_arg1:String, _arg2:Function, _arg3:String):void{ END_X = (main.STAGE_WIDTH - 175); END_Y = (main.STAGE_HEIGHT - 110); super(); currentPage = 1; lastNow = true; scriptUrl = _arg1; onErrorProc = _arg2; gameCode = _arg3; } public function rateLevel(_arg1:Number):void{ sendLevelTask(((("RATE_LEVEL_" + main.game.levelEngine.levelName) + "_") + String(_arg1)), rateResponseHandler); } public function rateResponseHandler(_arg1:String):void{ var newRating:String; var tempDialog:*; var fResponse = _arg1; if (fResponse.substr(0, 10) == "NEW_RATING"){ newRating = fResponse.substr(11, (fResponse.length - 11)); tempDialog = new mDialogWindow(main.game.interfaceEngine, "New rating:", "middle", "ok", function (){ load(); }); utils.addRatingStars(tempDialog, ((main.STAGE_WIDTH / 2) - 47), ((main.STAGE_HEIGHT / 2) + 20), Number(newRating)); } else { new mDialogWindow(main.game.interfaceEngine, "Error!", "middle", "ok", function (){ load(); }); }; } public function loadRatingChanger():void{ new mDialogWindow(main.game.interfaceEngine, "Level Completed!\nPlease, rate it!", "middle", "1", function (){ rateLevel(1); }, "2", function (){ rateLevel(2); }, "3", function (){ rateLevel(3); }, "4", function (){ rateLevel(4); }, "5", function (){ rateLevel(5); }); } public function loadLevel(_arg1, _arg2:String):void{ var fXML = _arg1; var fName = _arg2; if (main.game.levelEngine.loadLevel(fXML, fName, function (){ load(); }, function (){ loadRatingChanger(); })){ } else { new mDialogWindow(main.game.interfaceEngine, "Error!", "middle", "ok", function (){ load(); }); }; } public function loadLevelFromUrl(_arg1:String, _arg2:String):void{ utils.sendUrlVariablesArg(null, _arg1, loadLevel, _arg2); } public function createPageButtons(_arg1:String):void{ var pages:*; var fResponse = _arg1; if (((!(isNaN(Number(fResponse)))) && (!((fResponse == ""))))){ pages = utils.getPages(Number(fResponse), (ROWS_PER_PAGE * COLUMNS_PER_PAGE)); new mText(main.game.interfaceEngine, (main.STAGE_WIDTH / 2), (main.STAGE_HEIGHT - 20), 250, 25, (((String(currentPage) + " of ") + String(pages)) + " pages"), "center", 20, 0); new mButton(main.game.interfaceEngine, "mButtonBack", 1, 1, ((main.STAGE_WIDTH / 2) - 150), (main.STAGE_HEIGHT - 20), 50, 20, (currentPage > 1), "prev", 15, function (){ currentPage--; load(); }); new mButton(main.game.interfaceEngine, "mButtonBack", 1, 1, ((main.STAGE_WIDTH / 2) + 150), (main.STAGE_HEIGHT - 20), 50, 20, (currentPage < pages), "next", 15, function (){ currentPage++; load(); }); } else { new mDialogWindow(main.game.interfaceEngine, "Error, try later", "middle", "Ok", function (){ onErrorProc(); }); }; } public function sendLevelTask(_arg1:String, _arg2:Function):void{ var _local3:*; _local3 = new URLVariables(); _local3.task = _arg1; _local3.code = gameCode; utils.sendUrlVariables(_local3, scriptUrl, _arg2); } public function load():void{ main.game.clearAll(); main.game.loadMenusFon(); new mButton(main.game.interfaceEngine, "mButtonBack", 1, 1, 35, (main.STAGE_HEIGHT - 20), 50, 20, true, "back", 15, function (){ main.game.loadTitleMenu(); }); if (lastNow){ new mText(main.game.interfaceEngine, 120, 30, 200, 50, "Last levels", "left", 30, 0); new mButton(main.game.interfaceEngine, "mButtonBack", 1, 1, 250, 25, 100, 20, false, "last levels", 15, function (){ lastNow = true; load(); }); new mButton(main.game.interfaceEngine, "mButtonBack", 1, 1, 360, 25, 100, 20, true, "top levels", 15, function (){ lastNow = false; load(); }); } else { new mText(main.game.interfaceEngine, 120, 30, 200, 50, "Top levels", "left", 30, 0); new mButton(main.game.interfaceEngine, "mButtonBack", 1, 1, 250, 25, 100, 20, true, "last levels", 15, function (){ lastNow = true; load(); }); new mButton(main.game.interfaceEngine, "mButtonBack", 1, 1, 360, 25, 100, 20, false, "top levels", 15, function (){ lastNow = false; load(); }); }; new mButton(main.game.interfaceEngine, "mSmallSponsorLogo", 1, 1, (main.STAGE_WIDTH - 105), 25, 200, 40, true, "", 15, function (){ main.game.toSponsorSite(); }); if (lastNow){ sendLevelTask(((("GET_LAST_LEVELS_" + String((((currentPage - 1) * ROWS_PER_PAGE) * COLUMNS_PER_PAGE))) + "_") + String((ROWS_PER_PAGE * COLUMNS_PER_PAGE))), createLevelButtons); } else { sendLevelTask(((("GET_TOP_LEVELS_" + String((((currentPage - 1) * ROWS_PER_PAGE) * COLUMNS_PER_PAGE))) + "_") + String((ROWS_PER_PAGE * COLUMNS_PER_PAGE))), createLevelButtons); }; main.game.soundEngine.playMusic("track1"); } public function createLevelButtons(_arg1:String):void{ var tempXML:XML; var deltaX:*; var deltaY:*; var i:*; var j:*; var k:*; var fResponse = _arg1; if (fResponse.substr(0, 8) == "<levels>"){ tempXML = new XML(fResponse); deltaX = ((END_X - START_X) / (COLUMNS_PER_PAGE - 1)); deltaY = ((END_Y - START_Y) / (ROWS_PER_PAGE - 1)); i = 0; while (i < COLUMNS_PER_PAGE) { j = 0; while (j < ROWS_PER_PAGE) { k = ((i * ROWS_PER_PAGE) + j); if (tempXML.level[k] != undefined){ new mLevelButton(main.game.interfaceEngine, "mInterfaceTexture", 1, 1, (START_X + (deltaX * i)), (START_Y + (deltaY * j)), tempXML.level[k].@creator, tempXML.level[k].@rating, tempXML.level[k].@pngurl, loadLevelFromUrl, tempXML.level[k].@levelurl, tempXML.level[k].@name); }; j = (j + 1); }; i = (i + 1); }; sendLevelTask("GET_LEVEL_COUNT", createPageButtons); } else { new mDialogWindow(main.game.interfaceEngine, "Error, try later", "middle", "Ok", function (){ main.game.loadTitleMenu(); }); }; } } }//package src.levels
Section 118
//mMovieParticle (src.particles.mMovieParticle) package src.particles { import flash.display.*; public class mMovieParticle extends mParticle { public var obj; public var incScale:Number; public var rot; public function mMovieParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14:Number, _arg15:uint):void{ super(_arg1, _arg4, _arg5, _arg7, _arg8, _arg9, _arg10, _arg14, _arg15); incScale = _arg13; paintedType = 1; obj = _arg2; obj.width = (obj.width * _arg6); obj.height = (obj.height * _arg6); obj.rotation = _arg11; rot = _arg12; if (_arg3 > 0){ obj.gotoAndStop(_arg3); }; alpha = 1; addChild(obj); cacheAsBitmap = true; } } }//package src.particles
Section 119
//mParticle (src.particles.mParticle) package src.particles { import flash.display.*; import src.*; public class mParticle extends MovieClip { public var parentClip:MovieClip; public var ay; public var ax; public var paintedType:Number;// = 0 public var color:uint; public var sy; public var timeLife:Number; public var sx; public var dy; public var nextParticle:mParticle; public var prevParticle; public function mParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8:Number, _arg9:uint):void{ paintedType = 0; super(); x = _arg2; y = _arg3; sx = _arg4; sy = _arg5; ax = _arg6; ay = _arg7; dy = 0; color = _arg9; timeLife = _arg8; parentClip = _arg1; prevParticle = null; nextParticle = main.game.particleEngine.particleList; if (main.game.particleEngine.particleList){ main.game.particleEngine.particleList.prevParticle = this; }; main.game.particleEngine.particleList = this; main.game.particleEngine.particleCount++; paintedType = 0; } public function destroy():void{ if (main.game.particleEngine.particleCount > 0){ if (prevParticle){ prevParticle.nextParticle = nextParticle; }; if (nextParticle){ nextParticle.prevParticle = prevParticle; }; if (this == main.game.particleEngine.particleList){ main.game.particleEngine.particleList = nextParticle; }; main.game.particleEngine.particleCount--; if (main.game.particleEngine.particleCount == 0){ main.game.particleEngine.particleList = null; }; parent.removeChild(this); } else { visible = false; }; } } }//package src.particles
Section 120
//mParticleEngine (src.particles.mParticleEngine) package src.particles { import flash.geom.*; import flash.display.*; import flash.events.*; import src.*; public class mParticleEngine { public var paintSprite:Sprite; public var particleList:mParticle; public var particleCount:Number;// = 0 public var parent:MovieClip; public function mParticleEngine(_arg1:MovieClip):void{ particleCount = 0; super(); parent = _arg1; paintSprite = new Sprite(); paintSprite.mouseEnabled = false; _arg1.addChild(paintSprite); _arg1.addEventListener(Event.ENTER_FRAME, update); } public function addMovieExp(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:uint):void{ var _local7:*; var _local8:*; _local7 = 0; while (_local7 < _arg3) { _local8 = new mMovieParticle(parent, new mSmoke1(), 1, _arg1, _arg2, 1, ((Math.random() * _arg4) - (_arg4 / 2)), ((Math.random() * _arg4) - (_arg4 / 2)), 0, 1.5, 0, 0.5, 0.5, _arg5, _arg6); parent.addChild(_local8); _local7++; }; } public function update(_arg1:Event):void{ var _local2:mParticle; paintSprite.graphics.clear(); _local2 = particleList; while (_local2) { _local2.x = (_local2.x + _local2.sx); _local2.y = (_local2.y + _local2.sy); _local2.sx = (_local2.sx + _local2.ax); _local2.sy = (_local2.sy + _local2.ay); if (_local2.paintedType == 1){ _local2.width = (_local2.width + mMovieParticle(_local2).incScale); _local2.height = (_local2.height + mMovieParticle(_local2).incScale); _local2.rotation = (_local2.rotation + mMovieParticle(_local2).rot); } else { if (_local2.paintedType == 2){ } else { paintSprite.graphics.lineStyle(2, _local2.color, (_local2.timeLife / 10)); paintSprite.graphics.moveTo(_local2.x, _local2.y); paintSprite.graphics.lineTo((_local2.x + _local2.sx), (_local2.y + _local2.sy)); }; }; _local2.timeLife = (_local2.timeLife - 1); if (_local2.timeLife < 0){ if (_local2.paintedType == 1){ mMovieParticle(_local2).alpha = (mMovieParticle(_local2).alpha - 0.09); if (mMovieParticle(_local2).alpha < 0.1){ _local2.destroy(); }; } else { if (_local2.paintedType == 2){ mTextParticle(_local2).alpha = (mTextParticle(_local2).alpha - 0.09); if (mTextParticle(_local2).alpha < 0.1){ mTextParticle(_local2).grad.mask = null; _local2.removeChild(mTextParticle(_local2).grad); _local2.removeChild(mTextParticle(_local2).obj); _local2.destroy(); }; } else { _local2.destroy(); }; }; }; _local2 = _local2.nextParticle; }; } public function addMovieParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13:Number):void{ var _local14:*; _local14 = new mMovieParticle(parent, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, 0); parent.addChild(_local14); } public function addTextParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15, _arg16:Number):void{ var _local17:*; _local17 = new mTextParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15, _arg16); _arg1.addChild(_local17); } public function addExp(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:uint):void{ var _local7:*; var _local8:*; _local7 = 0; while (_local7 < _arg3) { _local8 = new mParticle(parent, _arg1, _arg2, ((Math.random() * _arg4) - (_arg4 / 2)), ((Math.random() * _arg4) - (_arg4 / 2)), 0, 1.5, _arg5, _arg6); parent.addChild(_local8); _local7++; }; } } }//package src.particles
Section 121
//mTextParticle (src.particles.mTextParticle) package src.particles { import flash.display.*; import src.interfaces.*; import src.*; import flash.text.*; public class mTextParticle extends mParticle { public var obj; public var incScale:Number; public var grad; public var rot; public function mTextParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15, _arg16:Number):void{ super(_arg1, _arg4, _arg5, _arg10, _arg11, _arg12, _arg13, _arg16, 0); incScale = _arg15; paintedType = 2; obj = new mText(_arg1, 0, 0, _arg6, _arg7, _arg3, _arg9, _arg8, 0); obj.x = (width / 2); obj.autoSize = TextFieldAutoSize.LEFT; addChild(obj); grad = _arg2; grad.width = _arg6; grad.height = _arg7; grad.x = (width / 2); grad.y = 0; addChild(grad); grad.mask = obj; rot = _arg14; alpha = 1; } } }//package src.particles
Section 122
//mDistanceJoint (src.physics.mDistanceJoint) package src.physics { import flash.geom.*; import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.*; import flash.display.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; import src.*; public class mDistanceJoint extends mJoint { public var y1:Number; public var jointdef:b2DistanceJointDef; public var distanceMovie; public var joint:b2DistanceJoint; public var x1:Number; public var secondAnchorMovie; public function mDistanceJoint():void{ jointdef = new b2DistanceJointDef(); super(); } override public function destroy():void{ super.destroy(); if (((inited) && (joint))){ main.game.physEngine.world.DestroyJoint(joint); inited = false; }; } public function mDistanceJointInit(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):mDistanceJoint{ super.mJointInit(); secondAnchorMovie = new mJointMovie(); addChild(secondAnchorMovie); distanceMovie = new mDistJointMovie(); addChild(distanceMovie); x1 = _arg3; y1 = _arg4; setPosition(new Point(_arg1, _arg2)); return (this); } public function physInit(_arg1, _arg2, _arg3, _arg4:Number):Boolean{ var _local5:b2Body; _local5 = main.game.physEngine.world.m_bodyList; while (_local5) { if ((_local5.m_shapeList.m_userData is Sprite)){ if (_local5.m_shapeList.m_userData.hitTestPoint(_arg1, _arg2, true)){ body1 = _local5; }; if (_local5.m_shapeList.m_userData.hitTestPoint(_arg3, _arg4, true)){ if (_local5 != body1){ body2 = _local5; }; }; }; _local5 = _local5.m_next; }; if (body1 == null){ if (body2 != null){ body1 = main.game.physEngine.world.GetGroundBody(); jointdef.Initialize(main.game.physEngine.world.GetGroundBody(), body2, new b2Vec2((_arg1 / main.game.physEngine.physScale), (_arg2 / main.game.physEngine.physScale)), new b2Vec2((_arg3 / main.game.physEngine.physScale), (_arg4 / main.game.physEngine.physScale))); inited = true; }; } else { if (body2 == null){ if (body1 != null){ body2 = main.game.physEngine.world.GetGroundBody(); jointdef.Initialize(body1, main.game.physEngine.world.GetGroundBody(), new b2Vec2((_arg1 / main.game.physEngine.physScale), (_arg2 / main.game.physEngine.physScale)), new b2Vec2((_arg3 / main.game.physEngine.physScale), (_arg4 / main.game.physEngine.physScale))); inited = true; }; } else { if (body1 != null){ if (body2 != null){ jointdef.Initialize(body1, body2, new b2Vec2((_arg1 / main.game.physEngine.physScale), (_arg2 / main.game.physEngine.physScale)), new b2Vec2((_arg3 / main.game.physEngine.physScale), (_arg4 / main.game.physEngine.physScale))); inited = true; }; }; }; }; if (inited){ joint = (main.game.physEngine.world.CreateJoint(jointdef) as b2DistanceJoint); }; return (inited); } public function placeDistanceMovie(_arg1:Point):void{ var _local2:*; _local2 = new b2Vec2(_arg1.x, _arg1.y); distanceMovie.x = (_local2.x / 2); distanceMovie.y = (_local2.y / 2); distanceMovie.rotation = ((_local2.GetAngle() * 180) / Math.PI); distanceMovie.lineWidth.width = _local2.Length(); } override public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; secondAnchorMovie.x = (x1 - x); secondAnchorMovie.y = (y1 - y); placeDistanceMovie(new Point(secondAnchorMovie.x, secondAnchorMovie.y)); } override public function update():void{ if (inited){ x1 = (joint.GetAnchor2().x * main.game.physEngine.physScale); y1 = (joint.GetAnchor2().y * main.game.physEngine.physScale); setPosition(new Point((joint.GetAnchor1().x * main.game.physEngine.physScale), (joint.GetAnchor1().y * main.game.physEngine.physScale))); } else { if (physInit(x, y, x1, y1)){ inited = true; } else { destroy(); }; }; } override public function argsToXML():XML{ return (XML((((((((("<src.physics.mDistanceJoint x='" + x) + "' y='") + y) + "' x1='") + x1) + "' y1='") + y1) + "'/>"))); } } }//package src.physics
Section 123
//mDotJoint (src.physics.mDotJoint) package src.physics { import flash.geom.*; import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.*; import flash.display.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; import src.*; public class mDotJoint extends mJoint { public var mot:Number; public var jointdef:b2RevoluteJointDef; public var joint:b2RevoluteJoint; public var dir:Number; public function mDotJoint():void{ jointdef = new b2RevoluteJointDef(); super(); } override public function destroy():void{ super.destroy(); if (((inited) && (joint))){ main.game.physEngine.world.DestroyJoint(joint); inited = false; }; } public function physInit(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):Boolean{ var _local5:b2Body; _local5 = main.game.physEngine.world.m_bodyList; while (_local5) { if ((_local5.m_shapeList.m_userData is Sprite)){ if (_local5.m_shapeList.m_userData.hitTestPoint(_arg1, _arg2, true)){ if (body1 == null){ body1 = _local5; } else { if (body2 == null){ body2 = _local5; }; }; }; }; _local5 = _local5.m_next; }; if (body1 == null){ if (body2 != null){ body1 = main.game.physEngine.world.GetGroundBody(); jointdef.Initialize(main.game.physEngine.world.GetGroundBody(), body2, new b2Vec2((_arg1 / main.game.physEngine.physScale), (_arg2 / main.game.physEngine.physScale))); inited = true; }; } else { if (body2 == null){ if (body1 != null){ body2 = main.game.physEngine.world.GetGroundBody(); jointdef.Initialize(body1, main.game.physEngine.world.GetGroundBody(), new b2Vec2((_arg1 / main.game.physEngine.physScale), (_arg2 / main.game.physEngine.physScale))); inited = true; }; } else { if (body1 != null){ if (body2 != null){ jointdef.Initialize(body1, body2, new b2Vec2((_arg1 / main.game.physEngine.physScale), (_arg2 / main.game.physEngine.physScale))); inited = true; }; }; }; }; if (inited){ jointdef.motorSpeed = (((_arg3 * _arg4) / 10) * Math.PI); jointdef.maxMotorTorque = 50000; jointdef.enableMotor = true; if (_arg4 == 0){ jointdef.enableMotor = false; }; joint = (main.game.physEngine.world.CreateJoint(jointdef) as b2RevoluteJoint); }; return (inited); } public function mDotJointInit(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):mDotJoint{ super.mJointInit(); setPosition(new Point(_arg1, _arg2)); mot = _arg3; dir = _arg4; return (this); } override public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; } override public function update():void{ if (inited){ setPosition(new Point((joint.GetAnchor1().x * main.game.physEngine.physScale), (joint.GetAnchor1().y * main.game.physEngine.physScale))); } else { if (!physInit(x, y, mot, dir)){ destroy(); }; }; } override public function argsToXML():XML{ return (XML((((((((("<src.physics.mDotJoint x='" + x) + "' y='") + y) + "' mot='") + mot) + "' dir='") + dir) + "'/>"))); } } }//package src.physics
Section 124
//mJoint (src.physics.mJoint) package src.physics { import Box2D.Dynamics.*; public class mJoint extends mPhysObject { public var body1; public var body2:b2Body; public function mJoint():void{ } public function mJointInit():mJoint{ super.mPhysObjectInit(); return (this); } override public function destroy():void{ super.destroy(); } } }//package src.physics
Section 125
//mPhysBox (src.physics.mPhysBox) package src.physics { import flash.geom.*; import src.*; public class mPhysBox extends mPhysRectangle { public function mPhysBox():void{ } public function mPhysBoxInit(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Boolean):mPhysBox{ super.mPhysRectangleInit("", _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8); graphics.clear(); gotoAndStop(_arg2); width = _arg5; height = _arg6; return (this); } override public function update():void{ if (inited){ setPosition(new Point((body.LocalToGlobal(body.m_shapeList.center).x * main.game.physEngine.physScale), (body.LocalToGlobal(body.m_shapeList.center).y * main.game.physEngine.physScale))); setRotation((((body.GetAngle() + body.m_shapeList.angle) * 180) / Math.PI)); } else { if (!physInit(x, y, isStatic, vertexes)){ destroy(); } else { if (body){ if (frame == 3){ body.m_mass = (body.m_mass * 5); body.m_I = (body.m_I * 5); body.m_shapeList.m_friction = 0.0001; }; if (frame == 4){ body.m_mass = (body.m_mass * 5); body.m_I = (body.m_I * 5); body.m_shapeList.m_restitution = 0.01; }; if (frame == 5){ body.m_shapeList.m_restitution = 0.85; }; }; }; }; } override public function argsToXML():XML{ return (XML((((((((((((((((("<src.physics.mPhysBox className='" + className) + "' frame='") + frame) + "' x='") + x) + "' y='") + y) + "' width='") + initWidth) + "' height='") + initHeigth) + "' rotation='") + rotation) + "' static='") + isStatic) + "'/>"))); } } }//package src.physics
Section 126
//mPhysCircle (src.physics.mPhysCircle) package src.physics { import flash.geom.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import src.*; public class mPhysCircle extends mPhysShape { var className:String; var frame:Number; var radius:Number; public var initRadius:Number; public function mPhysCircle():void{ } public function physInit(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean):Boolean{ var _local5:b2BodyDef; var _local6:b2CircleDef; var _local7:*; _local5 = new b2BodyDef(); _local6 = new b2CircleDef(); _local7 = main.game.physEngine.physScale; _local5.position.Set((_arg1 / _local7), (_arg2 / _local7)); _local6.radius = (_arg3 / _local7); _local6.friction = 0.7; _local6.restitution = 0.3; if (!_arg4){ _local6.density = 10; }; body = main.game.physEngine.world.CreateBody(_local5); body.CreateShape(_local6); body.SetMassFromShapes(); body.m_shapeList.m_userData = this; inited = true; return (inited); } public function mPhysCircleInit(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean):mPhysCircle{ super.mPhysShapeInit(); className = _arg1; frame = _arg2; x = _arg3; y = _arg4; radius = _arg5; initRadius = _arg5; isStatic = _arg6; utils.drawTiles(this, _arg1, _arg2, 0, 0, _arg5, _arg5, 1); return (this); } override public function update():void{ if (inited){ setPosition(new Point((body.LocalToGlobal(body.m_shapeList.center).x * main.game.physEngine.physScale), (body.LocalToGlobal(body.m_shapeList.center).y * main.game.physEngine.physScale))); setRotation((((body.GetAngle() + body.m_shapeList.angle) * 180) / Math.PI)); } else { if (!physInit(x, y, radius, isStatic)){ destroy(); }; }; } override public function argsToXML():XML{ return (XML((((((((((((("<src.physics.mPhysCircle className='" + className) + "' frame='") + frame) + "' x='") + x) + "' y='") + y) + "' radius='") + initRadius) + "' static='") + isStatic) + "'/>"))); } } }//package src.physics
Section 127
//mPhysEngine (src.physics.mPhysEngine) package src.physics { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.*; import flash.display.*; import flash.utils.*; import Box2D.Collision.*; import flash.events.*; import Box2D.Dynamics.Contacts.*; import src.*; public class mPhysEngine { public const MIN_SIZE = 5; public var world:b2World; public var count:Number;// = 0 public var physScale:Number;// = 30 public var last:mPhysObject; public var list:mPhysObject; public var contactListener; public var iterations:int;// = 10 public var physSprite:Sprite; public var timeStep:Number;// = 0.0285714285714286 public function mPhysEngine(_arg1):void{ var _local2:b2AABB; var _local3:b2Vec2; var _local4:Boolean; physScale = 30; iterations = 10; timeStep = (1 / 35); contactListener = new b2ContactListener(); count = 0; super(); _local2 = new b2AABB(); _local2.lowerBound.Set(-100, -100); _local2.upperBound.Set(100, 100); _local3 = new b2Vec2(0, 9.8); _local4 = true; world = new b2World(_local2, _local3, _local4); world.SetContactListener(contactListener); _arg1.addEventListener(Event.ENTER_FRAME, update); } public function addExplode(_arg1:Number, _arg2:b2Vec2):void{ var _local3:b2Body; var _local4:*; _local3 = world.m_bodyList; while (_local3) { if (!_local3.IsStatic()){ _local4 = _local3.GetPosition().Subtracted(_arg2); _local3.ApplyImpulse(_local4.Normalized().Multipled((_arg1 / _local4.Length())), _local3.GetWorldCenter()); }; _local3 = _local3.m_next; }; } public function addPhysCircle(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean):mPhysCircle{ return (mPhysCircle(_arg1.addChild(new mPhysCircle().mPhysCircleInit(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7)))); } public function addPhysWheel(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean):mPhysWheel{ return (mPhysWheel(_arg1.addChild(new mPhysWheel().mPhysWheelInit(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7)))); } public function DebugPhysDraw(_arg1:MovieClip):void{ var _local2:b2DebugDraw; physSprite = _arg1; _local2 = new b2DebugDraw(); _local2.m_sprite = physSprite; _local2.m_drawScale = 30; _local2.m_fillAlpha = 0.3; _local2.m_lineThickness = 1; _local2.m_drawFlags = (b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit); world.SetDebugDraw(_local2); } public function concludeBodies(_arg1, _arg2:b2Body):void{ var _local3:*; var _local4:*; var _local5:b2PolygonDef; var _local6:*; var _local7:*; var _local8:b2CircleDef; _local3 = _arg2.m_shapeList; while (_local3) { if (_local3.m_type == b2Shape.e_polygonShape){ _local4 = _local3.GetVertices(); _local5 = new b2PolygonDef(); _local5.friction = 0.7; _local5.restitution = 0.3; _local5.density = 10; _local5.vertexCount = (_local4.length / 2); _local6 = 0; while (_local6 < (_local4.length / 2)) { _local5.vertices[_local6] = _arg1.GlobalToLocal(_arg2.LocalToGlobal(_local4[_local6])); _local6++; }; _local5.userData = _local3.m_userData; _local7 = _arg1.CreateShape(_local5); }; if (_local3.m_type == b2Shape.e_circleShape){ _local8 = new b2CircleDef(); _local8.friction = 0.7; _local8.restitution = 0.3; _local8.density = 10; _local8.radius = _local3.m_radius; _local8.localPosition = _arg1.GlobalToLocal(_arg2.LocalToGlobal(_local3.center)); _local8.userData = _local3.m_userData; _local7 = _arg1.CreateShape(_local8); }; _local7.center = _arg1.GlobalToLocal(_arg2.LocalToGlobal(_local3.center)); _local7.angle = ((_arg2.GetAngle() + _local3.angle) - _arg1.GetAngle()); _local3 = _local3.GetNext(); }; _arg1.SetMassFromShapes(); world.DestroyBody(_arg2); } public function tryToConnect(_arg1:b2Body, _arg2:Boolean):Boolean{ var _local3:*; var _local4:*; var _local5:b2ContactEdge; _local3 = false; while (getContactEdgesCount(_arg1, _arg2) > 0) { _local4 = false; _local5 = _arg1.m_contactList; while (_local5) { _local5.contact.Update(contactListener); if (_local5.contact.m_manifoldCount > 0){ if (!_local4){ if (_local5.other.IsStatic() == _arg2){ concludeBodies(_arg1, _local5.other); _local4 = true; _local3 = true; }; }; }; _local5 = _local5.next; }; }; return (_local3); } public function update(_arg1:Event):void{ var _local2:mPhysObject; if (((!(main.game.globalPause)) && (!(main.game.awayPause.visible)))){ world.Step(timeStep, iterations); _local2 = last; while (_local2) { _local2.update(); _local2 = _local2.prev; }; }; } public function clearAll():void{ var _local1:mPhysObject; var _local2:b2Body; _local1 = list; while (_local1) { _local1.destroy(); _local1 = _local1.next; }; _local2 = world.m_bodyList; while (_local2) { world.DestroyBody(_local2); _local2 = _local2.m_next; }; physSprite.graphics.clear(); } public function addPhysRectangle(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Boolean):mPhysRectangle{ return (mPhysRectangle(_arg1.addChild(new mPhysRectangle().mPhysRectangleInit(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9)))); } public function addPhysField(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):mPhysField{ return (mPhysField(_arg1.addChild(new mPhysField().mPhysFieldInit(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8)))); } public function getContactEdgesCount(_arg1:b2Body, _arg2:Boolean):Number{ var _local3:*; var _local4:b2ContactEdge; _local3 = 0; _local4 = _arg1.m_contactList; while (_local4) { if (_local4.other.IsStatic() == _arg2){ _local4.contact.Update(contactListener); if (_local4.contact.m_manifoldCount > 0){ _local3++; }; }; _local4 = _local4.next; }; return (_local3); } public function addPhysBox(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Boolean):mPhysBox{ return (mPhysBox(_arg1.addChild(new mPhysBox().mPhysBoxInit(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9)))); } public function addPhysTriangle(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Boolean):mPhysTriangle{ return (mPhysTriangle(_arg1.addChild(new mPhysTriangle().mPhysTriangleInit(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9)))); } public function connectBodiesFromArray(_arg1:Array):Boolean{ var _local2:*; var _local3:*; _local2 = false; _local3 = 1; while (_local3 < _arg1.length) { concludeBodies(_arg1[_local3], _arg1[(_local3 - 1)]); _local2 = true; _local3++; }; return (_local2); } public function destroyJoint(_arg1:mJoint):void{ if ((_arg1 is mSpringJoint)){ mSpringJoint(_arg1).destroy(); }; if ((_arg1 is mPrismaticJoint)){ mPrismaticJoint(_arg1).destroy(); }; if ((_arg1 is mDistanceJoint)){ mDistanceJoint(_arg1).destroy(); }; if ((_arg1 is mDotJoint)){ mDotJoint(_arg1).destroy(); }; } } }//package src.physics
Section 128
//mPhysField (src.physics.mPhysField) package src.physics { import flash.geom.*; import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.*; import flash.display.*; import flash.utils.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; import src.*; public class mPhysField extends mPhysObject { var force:Number; private var physScale:Number;// = 30 var initWidth:Number; var type:Number; var paintType:Number; var initHeigth:Number; public function mPhysField():void{ physScale = 30; super(); } override public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; } override public function update():void{ var _local1:b2Body; var _local2:*; _local1 = main.game.physEngine.world.m_bodyList; while (_local1) { if (hitTestPoint((_local1.GetPosition().x * physScale), (_local1.GetPosition().y * physScale), true)){ if (type == 0){ if (force > 0){ _local1.ApplyForce(new b2Vec2(0, (force / ((((_local1.GetPosition().y * physScale) + (initHeigth / 2)) - y) * (((_local1.GetPosition().y * physScale) + (initHeigth / 2)) - y)))), _local1.GetWorldCenter()); }; if (force < 0){ _local1.ApplyForce(new b2Vec2(0, (force / ((((_local1.GetPosition().y * physScale) - (initHeigth / 2)) - y) * (((_local1.GetPosition().y * physScale) - (initHeigth / 2)) - y)))), _local1.GetWorldCenter()); }; }; if (type == 1){ _local2 = new b2Vec2(((_local1.GetPosition().x * physScale) - x), ((_local1.GetPosition().y * physScale) - y)); _local1.ApplyForce(_local2.Normalized().Multipled((force / (_local2.Length() * _local2.Length()))), _local1.GetWorldCenter()); }; }; _local1 = _local1.m_next; }; } override public function argsToXML():XML{ return (XML((((((((((((((("<src.physics.mPhysField x='" + x) + "' y='") + y) + "' width='") + initWidth) + "' height='") + initHeigth) + "' paintType='") + paintType) + "' type='") + type) + "' force='") + force) + "'/>"))); } public function mPhysFieldInit(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):mPhysField{ super.mPhysObjectInit(); x = _arg1; y = _arg2; initWidth = _arg3; initHeigth = _arg4; paintType = _arg5; type = _arg6; force = _arg7; physScale = main.game.physEngine.physScale; graphics.beginFill(0xCC0000, 0.5); if (_arg5 == 0){ utils.drawRect(graphics, (-(_arg3) / 2), (-(_arg4) / 2), (_arg3 / 2), (_arg4 / 2)); } else { graphics.drawCircle(0, 0, (_arg3 / 2)); }; graphics.endFill(); return (this); } } }//package src.physics
Section 129
//mPhysObject (src.physics.mPhysObject) package src.physics { import flash.geom.*; import Box2D.Dynamics.*; import flash.display.*; import src.levels.*; import src.*; public class mPhysObject extends MovieClip implements IEditable { public var next:mPhysObject; public var prev; var inited:Boolean;// = false public function mPhysObject():void{ inited = false; super(); } public function setRotation(_arg1:Number):void{ } public function destroy():void{ if (prev){ prev.next = next; }; if (next){ next.prev = prev; }; if (this == main.game.physEngine.list){ main.game.physEngine.list = next; }; if (this == main.game.physEngine.last){ main.game.physEngine.last = prev; }; main.game.physEngine.count--; if (main.game.physEngine.count == 0){ main.game.physEngine.list = null; }; if (((parent) && (this))){ parent.removeChild(this); }; } public function mPhysObjectInit():mPhysObject{ prev = null; next = main.game.physEngine.list; if (main.game.physEngine.list){ main.game.physEngine.list.prev = this; } else { main.game.physEngine.last = this; }; main.game.physEngine.list = this; main.game.physEngine.count++; return (this); } public function setPosition(_arg1:Point):void{ } public function update():void{ } public function argsToXML():XML{ return (XML("<src.physics.mPhysObject/>")); } } }//package src.physics
Section 130
//mPhysPolygon (src.physics.mPhysPolygon) package src.physics { import flash.geom.*; import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.*; import flash.display.*; import flash.utils.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; import src.*; public class mPhysPolygon extends mPhysShape { var className:String; var vertexes:Array; var frame:Number; public function mPhysPolygon():void{ } public function physInit(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Array):Boolean{ var _local5:b2BodyDef; var _local6:b2PolygonDef; var _local7:*; if ((((Math.round((_arg4.length / 2)) == (_arg4.length / 2))) && ((_arg4.length >= 6)))){ _local5 = new b2BodyDef(); _local6 = new b2PolygonDef(); _local5.position.Set((_arg1 / physScale), (_arg2 / physScale)); _local6.vertexCount = (_arg4.length / 2); _local7 = 0; while (_local7 < (_arg4.length / 2)) { _local6.vertices[_local7] = new b2Vec2((_arg4[(_local7 * 2)] / physScale), (_arg4[((_local7 * 2) + 1)] / physScale)); _local7++; }; _local6.friction = 0.7; _local6.restitution = 0.3; if (!_arg3){ _local6.density = 10; }; body = main.game.physEngine.world.CreateBody(_local5); body.CreateShape(_local6); body.SetMassFromShapes(); body.m_shapeList.m_userData = this; inited = true; return (inited); } else { inited = false; }; return (!NULL!); } override public function update():void{ if (inited){ setPosition(new Point((body.LocalToGlobal(body.m_shapeList.center).x * main.game.physEngine.physScale), (body.LocalToGlobal(body.m_shapeList.center).y * main.game.physEngine.physScale))); setRotation((((body.GetAngle() + body.m_shapeList.angle) * 180) / Math.PI)); } else { if (!physInit(x, y, isStatic, vertexes)){ destroy(); }; }; } override public function argsToXML():XML{ var _local1:*; var _local2:*; _local1 = (((((((((("<src.physics.mPhysPolygon className='" + className) + "' frame='") + frame) + "' x='") + x) + "' y='") + y) + "' static='") + isStatic) + "'"); _local2 = 0; while (_local2 < (vertexes.length / 2)) { _local1 = _local1.concat(((((((((" x" + _local2) + "='") + vertexes[(_local2 * 2)]) + "' y") + _local2) + "='") + vertexes[((_local2 * 2) + 1)]) + "'")); _local2++; }; _local1 = _local1.concat("/>"); return (XML(_local1)); } public function mPhysPolygonInit(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean, ... _args):mPhysPolygon{ super.mPhysShapeInit(); className = _arg1; frame = _arg2; x = _arg3; y = _arg4; isStatic = _arg5; vertexes = _args; utils.drawTilesToPolygon(this, _arg1, _arg2, 0, 0, _args); return (this); } } }//package src.physics
Section 131
//mPhysRectangle (src.physics.mPhysRectangle) package src.physics { import src.*; public class mPhysRectangle extends mPhysPolygon { var initWidth:Number; var initHeigth:Number; public function mPhysRectangle():void{ } override public function physInit(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Array):Boolean{ if (super.physInit(_arg1, _arg2, _arg3, _arg4)){ body.SetXForm(body.GetPosition(), ((rotation * Math.PI) / 180)); return (true); }; return (false); } public function mPhysRectangleInit(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Boolean):mPhysRectangle{ super.mPhysPolygonInit(_arg1, _arg2, _arg3, _arg4, _arg8, (-(_arg5) / 2), (-(_arg6) / 2), (_arg5 / 2), (-(_arg6) / 2), (_arg5 / 2), (_arg6 / 2), (-(_arg5) / 2), (_arg6 / 2)); rotation = _arg7; initWidth = _arg5; initHeigth = _arg6; graphics.clear(); utils.drawTilesToPolygon(this, _arg1, _arg2, (-(_arg5) / 2), (-(_arg6) / 2), new Array((-(_arg5) / 2), (-(_arg6) / 2), (_arg5 / 2), (-(_arg6) / 2), (_arg5 / 2), (_arg6 / 2), (-(_arg5) / 2), (_arg6 / 2))); return (this); } override public function argsToXML():XML{ return (XML((((((((((((((((("<src.physics.mPhysRectangle className='" + className) + "' frame='") + frame) + "' x='") + x) + "' y='") + y) + "' width='") + initWidth) + "' height='") + initHeigth) + "' rotation='") + rotation) + "' static='") + isStatic) + "'/>"))); } } }//package src.physics
Section 132
//mPhysShape (src.physics.mPhysShape) package src.physics { import flash.geom.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import src.*; public class mPhysShape extends mPhysObject { public var isStatic:Boolean;// = false public var physScale:Number; public var body:b2Body; public function mPhysShape():void{ isStatic = false; super(); } override public function setRotation(_arg1:Number):void{ rotation = _arg1; } override public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; if (body){ body.SetXForm(new b2Vec2((_arg1.x / physScale), (_arg1.y / physScale)), body.GetAngle()); }; } public function mPhysShapeInit():mPhysShape{ super.mPhysObjectInit(); physScale = main.game.physEngine.physScale; return (this); } override public function destroy():void{ var _local1:mPhysObject; super.destroy(); if (((inited) && (body))){ _local1 = main.game.physEngine.last; while (_local1) { if ((_local1 is mJoint)){ if ((((mJoint(_local1).body1 == body)) || ((mJoint(_local1).body2 == body)))){ main.game.physEngine.destroyJoint(mJoint(_local1)); }; }; _local1 = _local1.prev; }; main.game.physEngine.world.DestroyBody(body); inited = false; }; } } }//package src.physics
Section 133
//mPhysTriangle (src.physics.mPhysTriangle) package src.physics { public class mPhysTriangle extends mPhysPolygon { var initWidth:Number; var initHeigth:Number; public function mPhysTriangle():void{ } public function mPhysTriangleInit(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Boolean):mPhysTriangle{ super.mPhysPolygonInit(_arg1, _arg2, _arg3, _arg4, _arg8, (-(_arg5) / 2), (_arg6 / 2), 0, (-(_arg6) / 2), (_arg5 / 2), (_arg6 / 2)); rotation = _arg7; initWidth = _arg5; initHeigth = _arg6; return (this); } override public function physInit(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Array):Boolean{ if (super.physInit(_arg1, _arg2, _arg3, _arg4)){ body.SetXForm(body.GetPosition(), ((rotation * Math.PI) / 180)); return (true); }; return (false); } override public function argsToXML():XML{ return (XML((((((((((((((((("<src.physics.mPhysTriangle className='" + className) + "' frame='") + frame) + "' x='") + x) + "' y='") + y) + "' width='") + initWidth) + "' height='") + initHeigth) + "' rotation='") + rotation) + "' static='") + isStatic) + "'/>"))); } } }//package src.physics
Section 134
//mPhysWheel (src.physics.mPhysWheel) package src.physics { import flash.geom.*; import Box2D.Common.Math.*; import src.*; public class mPhysWheel extends mPhysCircle { public function mPhysWheel():void{ } public function mPhysWheelInit(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean):mPhysWheel{ super.mPhysCircleInit("", _arg2, _arg3, _arg4, _arg5, _arg6); graphics.clear(); gotoAndStop(_arg2); width = (_arg5 * 2); height = (_arg5 * 2); return (this); } override public function update():void{ if (inited){ setPosition(new Point((body.LocalToGlobal(body.m_shapeList.center).x * main.game.physEngine.physScale), (body.LocalToGlobal(body.m_shapeList.center).y * main.game.physEngine.physScale))); setRotation((((body.GetAngle() + body.m_shapeList.angle) * 180) / Math.PI)); if (frame == 3){ body.ApplyForce(new b2Vec2(0, (-(body.GetMass()) * 30)), body.GetWorldCenter()); }; } else { if (!physInit(x, y, radius, isStatic)){ destroy(); } else { if (body){ if (frame == 1){ body.m_shapeList.m_restitution = 0.9; }; if (frame == 2){ body.m_mass = (body.m_mass * 5); body.m_I = (body.m_I * 5); body.m_shapeList.m_restitution = 0.01; }; if (frame == 3){ body.m_mass = (body.m_mass * 0.5); body.m_I = (body.m_I * 0.5); }; if (frame == 5){ body.m_shapeList.m_restitution = 1.05; }; }; }; }; } override public function argsToXML():XML{ return (XML((((((((((((("<src.physics.mPhysWheel className='" + className) + "' frame='") + frame) + "' x='") + x) + "' y='") + y) + "' radius='") + initRadius) + "' static='") + isStatic) + "'/>"))); } } }//package src.physics
Section 135
//mPrismaticJoint (src.physics.mPrismaticJoint) package src.physics { import flash.geom.*; import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.*; import flash.display.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; import src.*; public class mPrismaticJoint extends mJoint { public var y1:Number; public var jointdef:b2PrismaticJointDef; public var distanceMovie; public var joint:b2PrismaticJoint; public var x1:Number; public var secondAnchorMovie; public function mPrismaticJoint():void{ jointdef = new b2PrismaticJointDef(); super(); } override public function destroy():void{ super.destroy(); if (((inited) && (joint))){ main.game.physEngine.world.DestroyJoint(joint); inited = false; }; } public function mPrismaticJointInit(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):mPrismaticJoint{ super.mJointInit(); secondAnchorMovie = new mJointMovie(); addChild(secondAnchorMovie); distanceMovie = new mDistJointMovie(); addChild(distanceMovie); x1 = _arg3; y1 = _arg4; setPosition(new Point(_arg1, _arg2)); return (this); } public function physInit(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Boolean{ var _local5:b2Body; _local5 = main.game.physEngine.world.m_bodyList; while (_local5) { if ((_local5.m_shapeList.m_userData is Sprite)){ if (_local5.m_shapeList.m_userData.hitTestPoint(_arg1, _arg2, true)){ body1 = _local5; }; if (_local5.m_shapeList.m_userData.hitTestPoint(_arg3, _arg4, true)){ body1 = _local5; x = _arg3; y = _arg4; x1 = _arg1; y1 = _arg2; }; }; _local5 = _local5.m_next; }; if (body1){ body2 = main.game.physEngine.world.GetGroundBody(); jointdef.Initialize(body1, body2, new b2Vec2((x / main.game.physEngine.physScale), (y / main.game.physEngine.physScale)), new b2Vec2((x1 - x), (y1 - y)).Normalized()); inited = true; }; if (inited){ jointdef.enableLimit = true; jointdef.lowerTranslation = (-(new b2Vec2((x1 - x), (y1 - y)).Length()) / 30); jointdef.upperTranslation = 0; joint = (main.game.physEngine.world.CreateJoint(jointdef) as b2PrismaticJoint); }; return (inited); } public function placeDistanceMovie(_arg1:Point):void{ var _local2:*; _local2 = new b2Vec2(_arg1.x, _arg1.y); distanceMovie.x = (_local2.x / 2); distanceMovie.y = (_local2.y / 2); distanceMovie.rotation = ((_local2.GetAngle() * 180) / Math.PI); distanceMovie.lineWidth.width = _local2.Length(); } override public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; secondAnchorMovie.x = (x1 - x); secondAnchorMovie.y = (y1 - y); placeDistanceMovie(new Point(secondAnchorMovie.x, secondAnchorMovie.y)); } override public function update():void{ if (inited){ setPosition(new Point((joint.GetAnchor1().x * main.game.physEngine.physScale), (joint.GetAnchor1().y * main.game.physEngine.physScale))); } else { if (physInit(x, y, x1, y1)){ inited = true; } else { destroy(); }; }; } override public function argsToXML():XML{ return (XML((((((((("<src.physics.mPrismaticJoint x='" + x) + "' y='") + y) + "' x1='") + x1) + "' y1='") + y1) + "'/>"))); } } }//package src.physics
Section 136
//mSpringJoint (src.physics.mSpringJoint) package src.physics { import flash.geom.*; import Box2D.Common.Math.*; public class mSpringJoint extends mPrismaticJoint { var springKoeff:Number;// = 10000 var frictKoeff:Number;// = 100 public function mSpringJoint():void{ springKoeff = 10000; frictKoeff = 100; super(); } override public function physInit(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Boolean{ if (super.physInit(_arg1, _arg2, _arg3, _arg4)){ joint.m_upperTranslation = -(joint.m_lowerTranslation); return (true); }; return (false); } public function mSpringJointInit(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=10000, _arg6:Number=100):mSpringJoint{ super.mPrismaticJointInit(_arg1, _arg2, _arg3, _arg4); springKoeff = _arg5; frictKoeff = _arg6; removeChild(distanceMovie); distanceMovie = new mSpringJointMovie(); addChild(distanceMovie); setPosition(new Point(_arg1, _arg2)); return (this); } override public function update():void{ super.update(); if (inited){ body1.ApplyForce(joint.m_localXAxis1.Multipled((joint.GetJointTranslation() * springKoeff)), body1.GetWorldCenter()); body1.ApplyForce(body1.m_linearVelocity.Multipled(-(frictKoeff)), body1.GetWorldCenter()); }; } override public function argsToXML():XML{ return (XML((((((((((((("<src.physics.mSpringJoint x='" + x) + "' y='") + y) + "' x1='") + x1) + "' y1='") + y1) + "' springKoeff='") + springKoeff) + "' frictKoeff='") + frictKoeff) + "'/>"))); } } }//package src.physics
Section 137
//mBaseUnit (src.units.mBaseUnit) package src.units { import flash.display.*; import src.*; public class mBaseUnit extends MovieClip { public var nextUnit:mBaseUnit; public var prevUnit; public function mBaseUnit():void{ } public function destroy():void{ if (prevUnit){ prevUnit.nextUnit = nextUnit; }; if (nextUnit){ nextUnit.prevUnit = prevUnit; }; if (this == main.game.unitEngine.unitList){ main.game.unitEngine.unitList = nextUnit; }; main.game.unitEngine.unitCount--; if (main.game.unitEngine.unitCount == 0){ main.game.unitEngine.unitList = null; }; } public function mBaseUnitInit():mBaseUnit{ prevUnit = null; nextUnit = main.game.unitEngine.unitList; if (main.game.unitEngine.unitList){ main.game.unitEngine.unitList.prevUnit = this; }; main.game.unitEngine.unitList = this; main.game.unitEngine.unitCount++; return (this); } public function update():void{ } } }//package src.units
Section 138
//mBomb (src.units.mBomb) package src.units { import Box2D.Common.Math.*; import src.physics.*; import src.*; public class mBomb extends mPhysCircle { public const AMPLITUDE:Number = 0.05; public const SCALE_TTH:Number = 6.28318530717959; public var scaleTth:Number;// = 6.28318530717959 var timer:Number;// = 0 public var timerTth:Number;// = 60 public var bombTimer:mBombTimer; public function mBomb():void{ timerTth = 60; scaleTth = SCALE_TTH; timer = 0; super(); } public function mBombInit(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{ super.mPhysCircleInit("", 1, _arg1, _arg2, _arg3, false); timer = _arg4; bombTimer.gotoAndStop(timer); width = (width * (_arg3 / 30)); height = (height * (_arg3 / 30)); } override public function update():void{ super.update(); timerTth--; if (timerTth == 0){ timerTth = 60; timer--; }; if (bombTimer.currentFrame != timer){ bombTimer.gotoAndStop(timer); }; if (timer > 0){ if (scaleTth == 0){ scaleTth = SCALE_TTH; }; scaleTth = (scaleTth - 0.1); scaleX = ((initRadius / 30) + (AMPLITUDE * Math.sin(scaleTth))); scaleY = ((initRadius / 30) + (AMPLITUDE * Math.sin(scaleTth))); }; if (timer == 0){ main.game.physEngine.addExplode(((initRadius * initRadius) * 5), new b2Vec2((x / main.game.physEngine.physScale), (y / main.game.physEngine.physScale))); main.game.particleEngine.addMovieParticle(new mExp1(), 0, x, y, scaleX, 0, 0, 0, 0, (Math.random() * 360), 0, 0.5, 20); main.game.soundEngine.playSound("explosion"); destroy(); }; } override public function argsToXML():XML{ return (XML((((((((("<src.units.mBomb x='" + x) + "' y='") + y) + "' radius='") + initRadius) + "' timer='") + timer) + "'/>"))); } } }//package src.units
Section 139
//mCloud (src.units.mCloud) package src.units { import flash.geom.*; import src.levels.*; public class mCloud extends mBaseUnit implements IEditable { public const CLOUD_TTH:Number = 6.28318530717959; public var initY:Number;// = 0 public var frame:Number;// = 0 public var amplitude:Number;// = 10 public var cloudTth:Number;// = 6.28318530717959 public function mCloud():void{ initY = 0; frame = 0; cloudTth = CLOUD_TTH; amplitude = 10; super(); } public function setRotation(_arg1:Number):void{ } public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; initY = y; } override public function update():void{ super.update(); if (cloudTth < 0){ cloudTth = CLOUD_TTH; }; cloudTth = (cloudTth - 0.05); y = (initY + (amplitude * Math.sin(cloudTth))); } public function argsToXML():XML{ return (XML((((((("<src.units.mCloud x='" + x) + "' y='") + initY) + "' frame='") + frame) + "'/>"))); } override public function destroy():void{ parent.removeChild(this); super.destroy(); } public function mCloudInit(_arg1:Number, _arg2:Number, _arg3:Number=0):mCloud{ mBaseUnitInit(); x = _arg1; y = _arg2; initY = y; frame = _arg3; if (frame == 0){ frame = Math.floor(((Math.random() * totalFrames) + 1)); }; gotoAndStop(frame); amplitude = (((Math.random() * 10) + 5) * ((Math.round(Math.random()) * 2) - 1)); return (this); } } }//package src.units
Section 140
//mMorph (src.units.mMorph) package src.units { import flash.geom.*; import Box2D.Common.Math.*; import flash.display.*; import flash.events.*; import src.physics.*; import src.levels.*; import src.*; public class mMorph extends mBaseUnit implements IEditable { public const SCALE_TTH:Number = 6.28318530717959; public const EMO_TTH:Number = 50; public const AMPLITUDE:Number = 0.1; public const MORPH_TTH:Number = 30; public var eyeBrow:MovieClip; public var scaleTth:Number;// = 6.28318530717959 public var startScaleX:Number;// = 1 public var startScaleY:Number;// = 1 public var eyes:MovieClip; public var defaultMovie:MovieClip; public var prohibitedObjects:Array; public var emoTth:Number;// = 0 public var startMorphHeight:Number;// = 0 public var downed:Boolean;// = false public var startMorphWidth:Number;// = 0 public var morphTth:Number;// = 0 public var morphedObj:IEditable; public function mMorph():void{ scaleTth = SCALE_TTH; startScaleX = 1; startScaleY = 1; startMorphWidth = 0; startMorphHeight = 0; morphTth = 0; emoTth = 0; downed = false; super(); } public function setRotation(_arg1:Number):void{ } public function morph(_arg1:IEditable):void{ var _local2:mPhysObject; if (morphedObj){ morphedObj.destroy(); }; main.game.particleEngine.addMovieParticle(new mHoop(), 0, DisplayObject(_arg1).x, DisplayObject(_arg1).y, 1, 0, 0, 0, 0, 0, 0, 2, 20); morphedObj = _arg1; if ((morphedObj is mPhysShape)){ _local2 = main.game.physEngine.last; while (_local2) { if ((_local2 is mJoint)){ if ((((mJoint(_local2).body1 == mPhysShape(morphedObj).body)) || ((mJoint(_local2).body2 == mPhysShape(morphedObj).body)))){ main.game.physEngine.destroyJoint(mJoint(_local2)); }; }; _local2 = _local2.prev; }; mPhysShape(morphedObj).body.WakeUp(); }; IEditable(morphedObj).setPosition(new Point(x, y)); morphTth = MORPH_TTH; startScaleX = DisplayObject(morphedObj).scaleX; startScaleY = DisplayObject(morphedObj).scaleY; defaultMovie.visible = false; main.game.soundEngine.playSound("morph"); } public function mouseUpHandler(_arg1:MouseEvent):void{ downed = false; } public function mouseDownHandler(_arg1:MouseEvent):void{ downed = true; } public function emotionsUpdate():void{ if (emoTth == 0){ utils.runRandom(function (){ eyes.gotoAndPlay(2); }, function (){ eyes.gotoAndPlay(6); }, function (){ eyes.gotoAndPlay(51); }, function (){ eyes.gotoAndPlay(101); }, function (){ eyes.gotoAndPlay(151); }); emoTth = Math.round(((Math.random() * EMO_TTH) + EMO_TTH)); }; if (emoTth == 50){ utils.runRandom(function (){ eyeBrow.gotoAndPlay(2); }, function (){ eyeBrow.gotoAndPlay(11); }, function (){ eyeBrow.gotoAndPlay(51); }); }; emoTth--; } public function mMorphInit(_arg1:Number, _arg2:Number, _arg3:String="src.units.mRecycle,src.units.mMorph,src.units.mCloud,src.units.mSun,src.units.mStaticMovie,src.physics.mDotJoint,src.physics.mDistanceJoint,src.physics.mPrismaticJoint,src.physics.mSpringJoint"):mMorph{ super.mBaseUnitInit(); x = _arg1; y = _arg2; defaultMovie = new mMorphDefault(); addChild(defaultMovie); eyes = new mEyes(); eyes.y = -10; addChild(eyes); eyeBrow = new mEyeBrow(); eyeBrow.y = -30; addChild(eyeBrow); main.game.layerEngine.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); main.game.layerEngine.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); main.game.interfaceEngine.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); main.game.interfaceEngine.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); if (_arg3){ prohibitedObjects = _arg3.split(","); }; return (this); } public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; } override public function update():void{ var _local1:mBaseUnit; var _local2:*; var _local3:Boolean; super.update(); if (y > (main.STAGE_HEIGHT * 2)){ main.game.levelEngine.levelLose(); }; if (morphedObj){ if (MovieClip(morphedObj).parent){ setPosition(new Point(DisplayObject(morphedObj).x, DisplayObject(morphedObj).y)); if (morphTth > 0){ morphTth--; DisplayObject(morphedObj).scaleX = (startScaleX + (((Math.sin((morphTth / 2)) * morphTth) / MORPH_TTH) * 0.1)); DisplayObject(morphedObj).scaleY = (startScaleY + (((Math.sin((morphTth / 2)) * morphTth) / MORPH_TTH) * 0.1)); }; } else { defaultMovie.visible = true; }; }; emotionsUpdate(); _local1 = main.game.unitEngine.unitList; while (_local1) { if ((_local1 is mRecycle)){ if (_local1.hitTestPoint(x, y, true)){ mRecycle(_local1).recycled(); } else { mRecycle(_local1).restore(); }; }; _local1 = _local1.nextUnit; }; if (defaultMovie.visible){ if (scaleTth == 0){ scaleTth = SCALE_TTH; }; scaleTth = (scaleTth - 0.1); defaultMovie.scaleX = (defaultMovie.scaleY = (1 + (AMPLITUDE * Math.sin(scaleTth)))); }; _local2 = main.game.layerEngine.getMousedChildren(prohibitedObjects); _local3 = false; if (_local2){ if ((_local2 is mPhysShape)){ if (!_local2.isStatic){ _local3 = true; }; }; }; if (((((((_local2) && (!(utils.ArrayContain(prohibitedObjects, utils.getClassName(_local2)))))) && (!((_local2 == morphedObj))))) && (_local3))){ main.game.mouse.setHand(); if (downed){ morph(IEditable(_local2)); }; } else { main.game.mouse.setArrow(); }; } public function argsToXML():XML{ return (XML((((("<src.units.mMorph x='" + x) + "' y='") + y) + "'/>"))); } override public function destroy():void{ main.game.layerEngine.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); parent.removeChild(this); super.destroy(); } } }//package src.units
Section 141
//mRecycle (src.units.mRecycle) package src.units { import flash.geom.*; import src.levels.*; import src.*; public class mRecycle extends mBaseUnit implements IEditable { public const DELAY_TTH:Number = 20; public var delayTth:Number;// = 20 public function mRecycle():void{ delayTth = DELAY_TTH; super(); addFrameScript(0, frame1); } public function setRotation(_arg1:Number):void{ } public function recycled():void{ delayTth--; if (delayTth == 0){ nextFrame(); delayTth = DELAY_TTH; }; if (currentFrame == totalFrames){ main.game.levelEngine.levelComplete(); }; } function frame1(){ stop(); } public function restore():void{ gotoAndStop(1); } public function mRecycleInit(_arg1:Number, _arg2:Number):mRecycle{ mBaseUnitInit(); x = _arg1; y = _arg2; return (this); } public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; } override public function update():void{ super.update(); } public function argsToXML():XML{ return (XML((((("<src.units.mRecycle x='" + x) + "' y='") + y) + "'/>"))); } override public function destroy():void{ parent.removeChild(this); super.destroy(); } } }//package src.units
Section 142
//mStaticMovie (src.units.mStaticMovie) package src.units { import flash.geom.*; import src.levels.*; import src.*; public class mStaticMovie extends mBaseUnit implements IEditable { public var className:String; public var frame:Number;// = 0 public function mStaticMovie():void{ frame = 0; super(); } public function setRotation(_arg1:Number):void{ } public function mStaticMovieInit(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number=0):mStaticMovie{ mBaseUnitInit(); className = _arg1; x = _arg2; y = _arg3; frame = _arg6; if (frame == 0){ frame = Math.floor(((Math.random() * utils.getTotalFrames(className)) + 1)); }; utils.drawScaledMovie(this, className, frame, (-(_arg4) / 2), (-(_arg5) / 2), _arg4, _arg5); return (this); } public function setPosition(_arg1:Point):void{ } public function argsToXML():XML{ return (XML((((((((((((("<src.units.mStaticMovie className='" + className) + "' x='") + x) + "' y='") + y) + "' width='") + width) + "' height='") + height) + "' frame='") + frame) + "'/>"))); } override public function destroy():void{ parent.removeChild(this); super.destroy(); } } }//package src.units
Section 143
//mSun (src.units.mSun) package src.units { import flash.geom.*; import src.levels.*; public class mSun extends mBaseUnit implements IEditable { public const SCALE_TTH:Number = 6.28318530717959; public var scaleTth:Number;// = 6.28318530717959 public var amplitude:Number;// = 0.1 public function mSun():void{ scaleTth = SCALE_TTH; amplitude = 0.1; super(); } public function setRotation(_arg1:Number):void{ } public function mSunInit(_arg1:Number, _arg2:Number):mSun{ mBaseUnitInit(); x = _arg1; y = _arg2; return (this); } public function setPosition(_arg1:Point):void{ x = _arg1.x; y = _arg1.y; } override public function update():void{ super.update(); if (scaleTth == 0){ scaleTth = SCALE_TTH; }; scaleTth = (scaleTth - 0.025); scaleX = (scaleY = (1 + (amplitude * Math.sin(scaleTth)))); } public function argsToXML():XML{ return (XML((((("<src.units.mSun x='" + x) + "' y='") + y) + "'/>"))); } override public function destroy():void{ parent.removeChild(this); super.destroy(); } } }//package src.units
Section 144
//mUnitEngine (src.units.mUnitEngine) package src.units { import flash.display.*; import flash.events.*; import src.*; public class mUnitEngine { public var unitList;// = null public var parentMovie:MovieClip; public var unitCount;// = 0 public function mUnitEngine(_arg1:MovieClip):void{ unitCount = 0; unitList = null; super(); parentMovie = _arg1; parentMovie.addEventListener(Event.ENTER_FRAME, update); } public function addStaticMovie(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number=0):mStaticMovie{ var _local7:*; _local7 = parentMovie.addChild(new mStaticMovie().mStaticMovieInit(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6)); return (_local7); } public function update(_arg1:Event):void{ var _local2:mBaseUnit; _local2 = unitList; while (_local2) { if (((!(main.game.globalPause)) && (!(main.game.awayPause.visible)))){ _local2.update(); }; _local2 = _local2.nextUnit; }; } public function addMorph(_arg1:Number, _arg2:Number):mMorph{ var _local3:*; _local3 = parentMovie.addChild(new mMorph().mMorphInit(_arg1, _arg2)); return (_local3); } public function addRecycle(_arg1:Number, _arg2:Number):mRecycle{ var _local3:*; _local3 = parentMovie.addChild(new mRecycle().mRecycleInit(_arg1, _arg2)); return (_local3); } public function clearAll():void{ var _local1:mBaseUnit; _local1 = unitList; while (_local1) { _local1.destroy(); _local1 = _local1.nextUnit; }; } public function addSun(_arg1:Number, _arg2:Number):mSun{ var _local3:*; _local3 = parentMovie.addChild(new mSun().mSunInit(_arg1, _arg2)); return (_local3); } public function addCloud(_arg1:Number, _arg2:Number):mCloud{ var _local3:*; _local3 = parentMovie.addChild(new mCloud().mCloudInit(_arg1, _arg2)); return (_local3); } } }//package src.units
Section 145
//CPMStarAdLoader (src.utilities.CPMStarAdLoader) package src.utilities { import flash.display.*; import flash.net.*; import flash.events.*; import flash.system.*; public class CPMStarAdLoader extends Sprite { private var contentspotid:String; private var cpmstarLoader:Loader; public function CPMStarAdLoader(_arg1:String){ this.contentspotid = _arg1; addEventListener(Event.ADDED, addedHandler); } private function addedHandler(_arg1:Event):void{ var _local2:String; var _local3:DisplayObjectContainer; removeEventListener(Event.ADDED, addedHandler); Security.allowDomain("server.cpmstar.com"); _local2 = "http://server.cpmstar.com/adviewas3.swf"; _local3 = parent; cpmstarLoader = new Loader(); cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler); cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler); cpmstarLoader.load(new URLRequest(((_local2 + "?contentspotid=") + contentspotid))); addChild(cpmstarLoader); } private function dispatchHandler(_arg1:Event):void{ dispatchEvent(_arg1); } } }//package src.utilities
Section 146
//ISaveObject (src.utilities.ISaveObject) package src.utilities { public interface ISaveObject { function stateToXML():XML; } }//package src.utilities
Section 147
//mAwayPause (src.utilities.mAwayPause) package src.utilities { import flash.display.*; import flash.events.*; import src.*; public class mAwayPause extends MovieClip { public function mAwayPause(_arg1:MovieClip, _arg2:Number, _arg3:Number):void{ width = _arg2; height = _arg3; visible = false; _arg1.addChild(this); _arg1.addEventListener(Event.DEACTIVATE, deactivateHandler); addEventListener(MouseEvent.CLICK, mouseClickHandler); } private function deactivateHandler(_arg1:Event):void{ visible = true; main.game.soundEngine.pleaseStopAll(); } public function setVisible():void{ visible = true; } private function mouseClickHandler(_arg1:MouseEvent):void{ visible = false; stage.focus = main.game.rootMovie; main.game.soundEngine.checkMusic(); } } }//package src.utilities
Section 148
//mConsole (src.utilities.mConsole) package src.utilities { import flash.display.*; import src.interfaces.*; import flash.events.*; import src.*; import flash.text.*; public class mConsole extends TextField { private var gameStage:Stage; private var logger:mText; public var loggerDisappearKoeff:Number;// = 0.005 public var loggerDisappear:Boolean;// = true public function mConsole(_arg1:MovieClip, _arg2:Stage, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{ loggerDisappear = true; loggerDisappearKoeff = 0.005; super(); width = _arg5; height = _arg6; x = _arg3; y = _arg4; type = TextFieldType.INPUT; background = true; backgroundColor = 0xFFFFFF; visible = false; _arg1.addChild(this); gameStage = _arg2; logger = new mText(_arg1, (_arg3 + (_arg5 / 2)), (_arg4 + (_arg6 / 2)), _arg5, 20, "logger", "left", 12, 0xFF00); logger.alpha = 0; addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler); addEventListener(Event.ENTER_FRAME, update); } public function isFunction(_arg1:String):Boolean{ return (Boolean(_arg1.match(/^[0-9a-zA-Z._]+\([0-9a-zA-Z,._-]*\)$/))); } public function onKeyDownHandler(_arg1:KeyboardEvent):void{ if (visible){ if (_arg1.keyCode == uint("13")){ executeCommand(text); visible = false; }; }; } public function executeCommand(_arg1:String):void{ var _local2:*; var _local3:*; var _local4:*; var _local5:*; var _local6:*; _local2 = new String(_arg1).split("=", 2); if ((((_local2.length == 1)) || ((((_local2.length == 2)) && (((!(_local2[1])) || (!(_local2[0])))))))){ if ((((_local2.length == 1)) || (_local2[0]))){ _local3 = _local2[0]; } else { _local3 = _local2[1]; }; if (isFunction(_local3)){ if (getFunction(_local3) != null){ log(_arg1, true); }; return; } else { if (utils.getSampleLink(_local3).value != null){ log(utils.getSampleLink(_local3).value, true); return; }; }; } else { _local4 = _local2[0]; _local5 = _local2[1]; if (!isFunction(_local4)){ if (utils.getSampleLink(_local4).value != null){ if (isFunction(_local5)){ _local6 = getFunction(_local5); if (_local6 != null){ utils.getSampleLink(_local4).value = _local6; log(_arg1, true); return; }; } else { if (utils.getSampleLink(_local5).value != null){ utils.getSampleLink(_local4).value = utils.getSampleLink(_local5).value; log(_arg1, true); return; }; _local5 = utils.stringToType(_local5); utils.getSampleLink(_local4).value = _local5; log(_arg1, true); return; }; }; }; }; log(_arg1, false); } public function log(_arg1:String, _arg2:Boolean):void{ logger.newText(_arg1); logger.alpha = 1; if (_arg2){ logger.setColor(0xFF00); } else { logger.setColor(0xFF0000); }; } public function changeVisible():void{ visible = !(visible); if (visible){ logger.alpha = 0; text = ""; gameStage.stage.focus = this; }; } public function getFunction(_arg1:String){ var proc:String; var param:String; var functionReturn:*; var fString = _arg1; if (fString.match(/^[0-9a-zA-Z._]+\([0-9a-zA-Z,._-]*\)$/)){ proc = String(fString.match(/^[0-9a-zA-Z._]+/)); param = String(fString.match(/\([0-9a-zA-Z,._-]*\)$/)).replace("(", "").replace(")", ""); if (((!((utils.getSampleLink(proc).value == null))) && (!((getParams(param) == null))))){ if ((utils.getSampleLink(proc).value is Function)){ try { functionReturn = utils.getSampleLink(proc).value.apply(null, getParams(param)); if (functionReturn == null){ return (false); } else { return (functionReturn); }; } catch(e:ArgumentError) { log(e.toString(), false); return (null); }; } else { log((fString + " is not a Function"), false); return; }; }; }; log(fString, false); return (null); } public function getParams(_arg1:String):Array{ var _local2:*; var _local3:*; var _local4:*; if (_arg1 == ""){ return ([]); }; _local2 = _arg1.split(/,/); _local3 = 0; while (_local3 < _local2.length) { _local4 = utils.getSampleLink(_local2[_local3]); if (_local4.value != null){ _local2[_local3] = _local4.value; } else { if (_local2[_local3] == ""){ return (null); }; _local2[_local3] = utils.stringToType(_local2[_local3]); }; _local3++; }; return (_local2); } public function update(_arg1:Event):void{ if (loggerDisappear){ logger.alpha = (logger.alpha - loggerDisappearKoeff); }; } } }//package src.utilities
Section 149
//mDebugInformer (src.utilities.mDebugInformer) package src.utilities { import flash.display.*; import flash.utils.*; import src.interfaces.*; import flash.events.*; import flash.system.*; public class mDebugInformer { private const FPS_REFRESH_DELAY = 30; private var fpsCount:int;// = 0 public var memory:mText; public var fps:mText; private var gameStage:Stage; private var oldTime:uint; private var avgCount:int;// = 30 public function mDebugInformer(_arg1:MovieClip, _arg2, _arg3:Number, _arg4:Number):void{ fpsCount = 0; avgCount = FPS_REFRESH_DELAY; super(); gameStage = _arg2; oldTime = getTimer(); fps = new mText(_arg1, (_arg3 + 100), (_arg4 + 5), 200, 10, "0 fps", "left", 9, 0); memory = new mText(_arg1, (_arg3 + 100), (_arg4 + 15), 200, 10, "0 MB used", "left", 9, 0); _arg1.addEventListener(Event.ENTER_FRAME, update); } public function set visible(_arg1:Boolean):void{ fps.visible = _arg1; memory.visible = _arg1; } public function get visible():Boolean{ return (fps.visible); } public function update(_arg1:Event):void{ fpsCount = (fpsCount + (getTimer() - oldTime)); if (avgCount < 1){ fps.newText((String(Math.round((1000 / fpsCount))) + " fps")); avgCount = FPS_REFRESH_DELAY; }; avgCount--; fpsCount = 0; oldTime = getTimer(); memory.newText((Math.round((System.totalMemory / (0x0400 * 0x0400))) + " MB used")); } } }//package src.utilities
Section 150
//mFader (src.utilities.mFader) package src.utilities { import flash.geom.*; import flash.display.*; import flash.events.*; public class mFader extends MovieClip { private var out:Boolean; private var proc:Function; public function mFader(_arg1:MovieClip, _arg2:Number, _arg3:Number):void{ width = _arg2; height = _arg3; visible = false; _arg1.addChild(this); _arg1.addEventListener(Event.ENTER_FRAME, update); } public function applyOut(_arg1:uint):void{ var _local2:*; _local2 = new ColorTransform(); _local2.color = _arg1; transform.colorTransform = _local2; out = true; alpha = 1; proc = null; visible = true; } public function applyIn(_arg1:uint, _arg2:Function):void{ var _local3:*; _local3 = new ColorTransform(); _local3.color = _arg1; transform.colorTransform = _local3; out = false; alpha = 0; proc = _arg2; visible = true; } private function update(_arg1:Event):void{ if (visible){ if (out){ alpha = (alpha - 0.05); if (alpha < 0.1){ visible = false; }; } else { alpha = (alpha + 0.05); if (alpha > 0.9){ visible = false; proc(); }; }; }; } } }//package src.utilities
Section 151
//MochiBot (src.utilities.MochiBot) package src.utilities { import flash.display.*; import flash.net.*; import flash.system.*; public dynamic class MochiBot extends Sprite { public static function track(_arg1:Sprite, _arg2:String):MochiBot{ var _local3:MochiBot; var _local4:String; var _local5:URLVariables; var _local6:String; var _local7:URLRequest; var _local8:Loader; if (Security.sandboxType == "localWithFile"){ return (null); }; _local3 = new (MochiBot); _arg1.addChild(_local3); Security.allowDomain("*"); Security.allowInsecureDomain("*"); _local4 = "http://core.mochibot.com/my/core.swf"; _local5 = new URLVariables(); _local5["sb"] = Security.sandboxType; _local5["v"] = Capabilities.version; _local5["swfid"] = _arg2; _local5["mv"] = "8"; _local5["fv"] = "9"; _local6 = _local3.root.loaderInfo.loaderURL; if (_local6.indexOf("http") == 0){ _local5["url"] = _local6; } else { _local5["url"] = "local"; }; _local7 = new URLRequest(_local4); _local7.contentType = "application/x-www-form-urlencoded"; _local7.method = URLRequestMethod.POST; _local7.data = _local5; _local8 = new Loader(); _local3.addChild(_local8); _local8.load(_local7); return (_local3); } } }//package src.utilities
Section 152
//mSampleLink (src.utilities.mSampleLink) package src.utilities { import src.interfaces.*; public class mSampleLink implements IGetSetValue { private var sample:String; private var link; public function mSampleLink(_arg1, _arg2:String):void{ link = _arg1; sample = _arg2; } public function set value(_arg1):void{ if (link){ link[sample] = _arg1; }; } public function get value(){ if (link){ return (link[sample]); }; return (null); } } }//package src.utilities
Section 153
//mSaveEngine (src.utilities.mSaveEngine) package src.utilities { import flash.net.*; import src.*; public class mSaveEngine { private var sharedObjectName:String; public function mSaveEngine(_arg1:String):void{ sharedObjectName = _arg1; } public function saveState(_arg1:String, _arg2:ISaveObject):void{ saveVars(_arg1, String(_arg2.stateToXML())); } public function loadVar(_arg1:String){ var _local2:SharedObject; _local2 = SharedObject.getLocal(sharedObjectName); return (_local2.data[_arg1]); } public function saveVars(... _args):void{ var _local2:SharedObject; var _local3:*; _local2 = SharedObject.getLocal(sharedObjectName); _local3 = 0; while (_local3 < _args.length) { _local2.data[_args[_local3]] = _args[(_local3 + 1)]; _local3 = (_local3 + 2); }; _local2.flush(); } public function loadState(_arg1, _arg2:ISaveObject):void{ if (loadVar(_arg1)){ XMLToState(XML(loadVar(_arg1)), _arg2); }; } public function XMLToState(_arg1, _arg2:ISaveObject){ var _local3:*; var _local4:*; if ((_arg1 is XML)){ _local3 = _arg1.state[0].@*; _local4 = 0; while (_local4 < _local3.length()) { _arg2[String(_local3[_local4].name())] = utils.stringToType(String(_local3[_local4])); _local4++; }; }; } public function erase():void{ var _local1:SharedObject; _local1 = SharedObject.getLocal(sharedObjectName); _local1.clear(); } } }//package src.utilities
Section 154
//mWhileLoad (src.utilities.mWhileLoad) package src.utilities { import flash.display.*; public class mWhileLoad extends MovieClip { private var loadState:Number; public function mWhileLoad(_arg1:MovieClip, _arg2:Number, _arg3:Number):void{ width = _arg2; height = _arg3; visible = false; loadState = 0; _arg1.addChild(this); } public function dec():void{ loadState--; if (loadState == 0){ visible = false; }; } public function inc():void{ loadState++; visible = true; } } }//package src.utilities
Section 155
//main (src.main) package src { import flash.display.*; import src.interfaces.*; import flash.events.*; public dynamic class main extends MovieClip { public const CPMSTAR_CONTENT_SPOT_ID:String = ""; public const GAME_RUN_MOCHI_BOT:String = ""; public var preloader:mPreloader; public var splash:MovieClip; public var playButton:mButton; public var titleMovie:MovieClip; public var sponsorLogo:MovieClip; public static const STAGE_WIDTH = 700; public static const STAGE_HEIGHT = 525; public static var currentUrl:String; public static var game:mGame; public function main():void{ super(); addFrameScript(0, frame1); currentUrl = root.loaderInfo.url; preloader = new mPreloader((STAGE_WIDTH / 2), (STAGE_HEIGHT / 2), STAGE_WIDTH, STAGE_HEIGHT, function (){ loadSplash(); }, !(utils.checkDomains("http://flashgamelicense.com", "http://how-i-make-games.in")), CPMSTAR_CONTENT_SPOT_ID); addChild(preloader); titleMovie = new mTitle((STAGE_WIDTH / 2), 100); addChild(titleMovie); sponsorLogo = new mSponsorLogo(); sponsorLogo.x = (STAGE_WIDTH / 2); sponsorLogo.y = (STAGE_HEIGHT / 2); sponsorLogo.buttonMode = true; sponsorLogo.addEventListener(MouseEvent.CLICK, toSponsorSite); addChild(sponsorLogo); } public function toSponsorSite(_arg1:MouseEvent):void{ utils.goToUrl("http://maxgames.com"); } function frame1(){ stop(); } public function update(_arg1:Event):void{ if (splash.totalFrames == splash.currentFrame){ splash.removeEventListener(MouseEvent.CLICK, toSponsorSite); splash.stop(); removeChild(splash); removeEventListener(Event.ENTER_FRAME, update); stage.frameRate = 60; loadGame(); }; } public function loadSplash():void{ preloader.clearAll(); removeChild(titleMovie); sponsorLogo.removeEventListener(MouseEvent.CLICK, toSponsorSite); removeChild(sponsorLogo); gotoAndStop(3); splash = new MaxGames_MAXLOGOINTRO1(); splash.x = 93; splash.y = 200; addChild(splash); splash.addEventListener(MouseEvent.CLICK, toSponsorSite); addEventListener(Event.ENTER_FRAME, update); } public function loadGame():void{ gotoAndStop(4); contextMenu = utils.adjustContexMenu(); game = new mGame(this, stage); if (GAME_RUN_MOCHI_BOT){ utils.track(this, GAME_RUN_MOCHI_BOT); }; game.levelSelector.loadProgress(); game.levelEditor.configure(); game.levelEditor.loadState(); game.loadTitleMenu(); } } }//package src
Section 156
//mGame (src.mGame) package src { import flash.display.*; import src.interfaces.*; import src.utilities.*; import src.units.*; import src.physics.*; import mochi.as3.*; import src.levels.*; import src.particles.*; public dynamic class mGame extends MovieClip { public const MOCHI_GAME_ID:String = ""; public const SAVE_LEVEL_SCRIPT_URL:String = "http://morphing.maxgames.com/morphing/savelevel.php"; public const VIEWER_SCRIPT_URL:String = "http://morphing.maxgames.com/morphing/getlevels.php"; public const MOCHI_LEADERBOARD_ID:String = ""; public const SHARED_OBJECT_NAME:String = "moongame"; public const SAVE_PNG_SCRIPT_URL:String = "http://morphing.maxgames.com/morphing/savepng.php"; public const CODE:String = "j8Yuj6TfdG45Frg^t7Yu8I"; public var levelEngine:mLevelEngine; public var layerEngine:mLayerEngine; public var levelEditor:mLevelEditor; public var gameStage:Stage; public var saveEngine:mSaveEngine; public var soundEngine:mSoundEngine; public var currentUrl:String; public var physEngine:mPhysEngine; public var console:mConsole; public var unitEngine:mUnitEngine; public var debugInformer:mDebugInformer; public var rootMovie:MovieClip; public var fader:mFader; public var particleEngine:mParticleEngine; public var levelSelector:mLevelSelector; public var awayPause:mAwayPause; public var mouse:mMouse; public var inputEngine:mInputEngine; public var whileLoad:mWhileLoad; public var levelViewer:mLevelViewer; public var levelSender:mLevelSender; public var interfaceEngine:mInterfaceEngine; public function mGame(_arg1:MovieClip, _arg2):void{ var fParent = _arg1; var fStage = _arg2; super(); gameStage = fStage; fParent.addChild(this); rootMovie = new MovieClip(); addChild(rootMovie); rootMovie.focusRect = false; layerEngine = new mLayerEngine(rootMovie, main.STAGE_WIDTH, main.STAGE_HEIGHT, 7); unitEngine = new mUnitEngine(layerEngine.layers[2]); physEngine = new mPhysEngine(layerEngine.layers[2]); physEngine.DebugPhysDraw(layerEngine.layers[5]); interfaceEngine = new mInterfaceEngine(rootMovie); fader = new mFader(this, main.STAGE_WIDTH, main.STAGE_HEIGHT); whileLoad = new mWhileLoad(this, main.STAGE_WIDTH, main.STAGE_HEIGHT); particleEngine = new mParticleEngine(this); awayPause = new mAwayPause(this, main.STAGE_WIDTH, main.STAGE_HEIGHT); debugInformer = new mDebugInformer(this, gameStage, 5, 5); debugInformer.visible = false; mouse = new mMouse(this); levelEditor = new mLevelEditor(layerEngine.layers[5], layerEngine.layers[6]); levelEngine = new mLevelEngine(this); levelSelector = new mLevelSelector(); levelSender = new mLevelSender(SAVE_LEVEL_SCRIPT_URL, SAVE_PNG_SCRIPT_URL, CODE); levelViewer = new mLevelViewer(VIEWER_SCRIPT_URL, function (){ loadTitleMenu(); }, CODE); inputEngine = new mInputEngine(gameStage); soundEngine = new mSoundEngine(main.STAGE_WIDTH, main.STAGE_HEIGHT); saveEngine = new mSaveEngine(SHARED_OBJECT_NAME); saveEngine.loadState("soundEngine", soundEngine); if (MOCHI_GAME_ID){ MochiServices.connect(MOCHI_GAME_ID, interfaceEngine); }; } public function clearAll():void{ if (levelEditor){ levelEditor.clearAll(); }; if (soundEngine){ soundEngine.clearAll(); }; if (mouse){ mouse.clearAll(); }; if (physEngine){ physEngine.clearAll(); }; if (unitEngine){ unitEngine.clearAll(); }; if (layerEngine){ layerEngine.clearAll(); }; if (interfaceEngine){ interfaceEngine.clearAll(); }; main.game.globalPause = false; } public function toSponsorSite():void{ utils.goToUrl("http://maxgames.com"); } public function highScores():void{ utils.loadLeaderBoard(MOCHI_LEADERBOARD_ID); } public function hostThisGame():void{ utils.goToUrl("http://paegames.com"); } public function loadTitleMenu():void{ clearAll(); loadMenusFon(); new mButton(interfaceEngine, "mButtonBack", 1, 1, (main.STAGE_WIDTH / 2), 190, 120, 20, (levelSelector.levelsCompleted > 0), "CONTINUE", 15, function (){ levelSelector.loadSelectScreen(); }); new mButton(interfaceEngine, "mButtonBack", 1, 1, (main.STAGE_WIDTH / 2), 220, 120, 20, true, "NEW GAME", 15, function (){ newGame(); }); new mButton(interfaceEngine, "mButtonBack", 1, 1, (main.STAGE_WIDTH / 2), 250, 120, 20, true, "MORE GAMES", 15, function (){ toSponsorSite(); }); new mButton(interfaceEngine, "mButtonBack", 1, 1, (main.STAGE_WIDTH / 2), 280, 120, 20, true, "LEVEL EDITOR", 15, function (){ levelEditor.load(levelEditor.editedLevel); }); new mButton(interfaceEngine, "mButtonBack", 1, 1, (main.STAGE_WIDTH / 2), 310, 120, 20, true, "OTHER LEVELS", 15, function (){ levelViewer.load(); }); new mButton(interfaceEngine, "mButtonBack", 1, 1, (main.STAGE_WIDTH / 2), 340, 120, 20, true, "CREDITS", 15, function (){ credits(); }); new mButton(interfaceEngine, "mButtonBack", 1, 1, (main.STAGE_WIDTH / 2), 370, 120, 20, true, "ERASE MY DATA", 15, function (){ new mDialogWindow(main.game.interfaceEngine, "Your progress will be lost!\ndid it?", "middle", "yes", function (){ saveEngine.erase(); }, "No", function (){ }); }); new mButton(interfaceEngine, "mButtonBack", 2, 2, (main.STAGE_WIDTH - 45), 25, 90, 30, true, "(c) Plus", 18, function (){ toOurSite(); }); interfaceEngine.addChild(new mTitle((main.STAGE_WIDTH / 2), 100)); soundEngine.addButtons(interfaceEngine); soundEngine.playMusic("track1"); new mButton(interfaceEngine, "mSmallSponsorLogo", 1, 1, 105, (main.STAGE_HEIGHT - 25), 200, 40, true, "", 15, function (){ toSponsorSite(); }); } public function loadMenusFon():void{ var _local1:*; layerEngine.layers[0].addChild(new mSun().mSunInit(Math.floor((Math.random() * main.STAGE_WIDTH)), Math.floor(((Math.random() * main.STAGE_HEIGHT) / 2)))); layerEngine.layers[1].addChild(new mStaticMovie().mStaticMovieInit("mFon", (main.STAGE_WIDTH / 2), (main.STAGE_HEIGHT / 2), 700, 525, 1)); _local1 = 0; while (_local1 < 5) { layerEngine.layers[1].addChild(new mCloud().mCloudInit(Math.floor((Math.random() * main.STAGE_WIDTH)), Math.floor((Math.random() * main.STAGE_HEIGHT)))); _local1++; }; } public function credits():void{ new mDialogWindow(main.game.interfaceEngine, "Developed by\nPlus And Eric's Games", "middle", "Our site", function (){ toOurSite(); }, "Box2d.org", function (){ toBox2D(); }, "Back", function (){ }); } public function toBox2D():void{ utils.goToUrl("http://box2d.org"); } public function newGame():void{ if (levelSelector.levelsCompleted > 0){ new mDialogWindow(main.game.interfaceEngine, "Your progress will be lost!", "middle", "yes", function (){ levelSelector.clearProgress(); levelSelector.saveProgress(); levelSelector.loadSelectScreen(); }, "No", function (){ }); } else { levelSelector.clearProgress(); levelSelector.saveProgress(); levelSelector.loadSelectScreen(); }; } public function toOurSite():void{ utils.goToUrl("http://paegames.com"); } } }//package src
Section 157
//mInputEngine (src.mInputEngine) package src { import flash.display.*; import flash.events.*; public class mInputEngine { private var keyDown:Array; private var functions:Array; public function mInputEngine(_arg1:Stage){ keyDown = new Array(); functions = new Array(); super(); _arg1.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler); _arg1.addEventListener(KeyboardEvent.KEY_UP, onKeyUpHandler); } private function onKeyDownHandler(_arg1:KeyboardEvent){ keyDown[_arg1.keyCode] = true; } public function addFunction(_arg1:Number, _arg2:Function):Boolean{ if (functions[_arg1] == null){ functions[_arg1] = _arg2; return (true); }; return (false); } private function onKeyUpHandler(_arg1:KeyboardEvent){ keyDown[_arg1.keyCode] = false; if (_arg1.keyCode == 13){ _arg1.preventDefault(); }; if (functions[_arg1.keyCode]){ var _local2 = functions; _local2[_arg1.keyCode](); }; } public function isKeyDown(_arg1:Number):Boolean{ return (keyDown[_arg1]); } } }//package src
Section 158
//mMouse (src.mMouse) package src { import flash.display.*; import flash.ui.*; import flash.events.*; public class mMouse extends MovieClip { public function mMouse(_arg1:MovieClip):void{ mouseEnabled = false; x = _arg1.mouseX; y = _arg1.mouseY; _arg1.addChild(this); _arg1.addEventListener(Event.ENTER_FRAME, update); defaultCursorHide(); setArrow(); } public function clearAll():void{ setArrow(); } public function update(_arg1:Event):void{ x = parent.mouseX; y = parent.mouseY; } public function setArrow():void{ gotoAndStop(1); } public function defaultCursorHide():void{ Mouse.hide(); } public function setHand():void{ gotoAndStop(2); } } }//package src
Section 159
//mPreloader (src.mPreloader) package src { import flash.display.*; import src.utilities.*; import flash.events.*; import flash.text.*; public class mPreloader extends MovieClip { private var proc:Function; public var adBox:mAdBox; public var colorBar:mColorBar; public var clickText:TextField; public function mPreloader(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Function, _arg6:Boolean, _arg7){ var _local8:DisplayObject; super(); x = _arg1; y = _arg2; proc = _arg5; clickText.visible = false; clickText.selectable = false; if (((_arg6) && (_arg7))){ _local8 = new CPMStarAdLoader(_arg7); adBox.addChild(_local8); } else { adBox.visible = false; }; colorBar.width = 5; addEventListener(Event.ENTER_FRAME, update, false, 0, true); } public function clearAll():void{ removeEventListener(MouseEvent.CLICK, mouseClickHandler); parent.removeChild(this); } public function update(_arg1:Event):void{ var _local2:Number; var _local3:Number; _local2 = stage.loaderInfo.bytesLoaded; _local3 = stage.loaderInfo.bytesTotal; if (_local2 == _local3){ if (colorBar.width > 579){ colorBar.width = 600; clickText.visible = true; removeEventListener(Event.ENTER_FRAME, update); addEventListener(MouseEvent.CLICK, mouseClickHandler); } else { colorBar.width = (colorBar.width + 10); }; } else { colorBar.width = ((_local2 / _local3) * 500); }; } public function mouseClickHandler(_arg1:MouseEvent):void{ proc(); } } }//package src
Section 160
//mSoundEngine (src.mSoundEngine) package src { import flash.display.*; import src.interfaces.*; import src.utilities.*; import flash.events.*; import flash.media.*; public class mSoundEngine implements ISaveObject { public var globalMusic:Boolean; public var width:Number; public var currentPosition:Number;// = 0 public var musicPlayed:Boolean;// = false public var currentTrack:String;// = "" public var volume:Number;// = 1 public var musicChannel:SoundChannel; public var channelsArray:Array; public var soundLibrary:Object; public var height:Number; public var globalSound:Boolean; public var soundMixer:SoundMixer; public function mSoundEngine(_arg1:Number, _arg2:Number):void{ channelsArray = new Array(); currentTrack = ""; currentPosition = 0; musicPlayed = false; volume = 1; super(); soundMixer = new SoundMixer(); soundLibrary = new Object(); channelsArray[0] = new SoundChannel(); channelsArray[1] = new SoundChannel(); channelsArray[2] = new SoundChannel(); channelsArray[3] = new SoundChannel(); musicChannel = new SoundChannel(); width = _arg1; height = _arg2; soundLibrary["buttonUp"] = new sndButtonUp(); soundLibrary["track1"] = new sndTrack1(); soundLibrary["track2"] = new sndTrack2(); soundLibrary["fanfare"] = new sndFanfare(); soundLibrary["morph"] = new sndMorph(); soundLibrary["lose"] = new sndLose(); soundLibrary["explosion"] = new sndExplosion(); globalSound = true; globalMusic = true; } public function addSoundONOFFButton(_arg1:MovieClip, _arg2, _arg3:Number):mButton{ var tempButton:*; var fParent = _arg1; var fX = _arg2; var fY = _arg3; tempButton = new mButton(fParent, "mSoundButtonBack", 1, 2, fX, fY, 25, 25, true, "", 15, function (){ globalSound = !(globalSound); checkSounds(); }); tempButton.setOnOff(globalSound); return (tempButton); } public function playSound(_arg1:String):void{ if (globalSound){ soundLibrary[_arg1].play(0, 0, new SoundTransform(volume)); }; } public function checkVolume():void{ musicChannel.soundTransform = new SoundTransform(volume); channelsArray[0].soundTransform = new SoundTransform(volume); channelsArray[1].soundTransform = new SoundTransform(volume); channelsArray[2].soundTransform = new SoundTransform(volume); channelsArray[3].soundTransform = new SoundTransform(volume); } public function clearAll():void{ main.game.saveEngine.saveState("soundEngine", this); pleaseStopAll(); musicPlayed = false; } public function stopMusic():void{ if (musicChannel){ currentPosition = (musicChannel.position + 100); musicChannel.stop(); }; } public function setVolume(_arg1:Number):void{ volume = (_arg1 / 100); checkVolume(); } public function addButtons(_arg1:MovieClip):void{ addSoundONOFFButton(_arg1, (width - 25), (height - 25)); addMusicONOFFButton(_arg1, (width - 55), (height - 25)); } public function stopChannel(_arg1:Number):void{ channelsArray[_arg1].stop(); } public function stateToXML():XML{ return (XML((((((("<xml><state globalSound='" + globalSound) + "' globalMusic='") + globalMusic) + "' volume='") + volume) + "'/></xml>"))); } public function checkSounds():void{ if (!globalSound){ channelsArray[0].stop(); channelsArray[1].stop(); channelsArray[2].stop(); channelsArray[3].stop(); }; } public function addMusicONOFFButton(_arg1:MovieClip, _arg2, _arg3:Number):mButton{ var tempButton:*; var fParent = _arg1; var fX = _arg2; var fY = _arg3; tempButton = new mButton(fParent, "mMusicButtonBack", 1, 2, fX, fY, 25, 25, true, "", 15, function (){ globalMusic = !(globalMusic); checkMusic(); }); tempButton.setOnOff(globalMusic); return (tempButton); } public function playChannel(_arg1:Number, _arg2:String):void{ var fChannelNumber = _arg1; var fName = _arg2; if (globalSound){ channelsArray[fChannelNumber] = soundLibrary[fName].play(0, 0, new SoundTransform(volume)); channelsArray[fChannelNumber].addEventListener(Event.SOUND_COMPLETE, function (){ playChannel(fChannelNumber, fName); }); }; } public function pleaseStopAll():void{ stopMusic(); channelsArray[0].stop(); channelsArray[1].stop(); channelsArray[2].stop(); channelsArray[3].stop(); } public function addVolumeBar(_arg1:MovieClip, _arg2, _arg3:Number):mBar{ var _local4:*; _local4 = new mClickableBar(_arg1, "mBarTexture", "mInterfaceTexture", _arg2, _arg3, 80, 10, 70, 8, (volume * 100), setVolume); return (_local4); } public function checkMusic():void{ if (!globalMusic){ currentPosition = musicChannel.position; musicChannel.stop(); } else { if (musicPlayed){ playMusic(currentTrack); }; }; } public function playMusic(_arg1:String):void{ var fName = _arg1; if (musicChannel){ musicChannel.stop(); if (currentTrack == fName){ if (globalMusic){ musicChannel = soundLibrary[fName].play(currentPosition, 0, new SoundTransform(volume)); }; } else { currentTrack = fName; if (globalMusic){ musicChannel = soundLibrary[fName].play(0, 0, new SoundTransform(volume)); }; }; if (globalMusic){ musicChannel.addEventListener(Event.SOUND_COMPLETE, function (){ currentPosition = 0; playMusic(fName); }); }; musicPlayed = true; }; } } }//package src
Section 161
//utils (src.utils) package src { import flash.geom.*; import Box2D.Common.Math.*; import flash.display.*; import flash.utils.*; import flash.net.*; import src.interfaces.*; import flash.ui.*; import src.utilities.*; import flash.events.*; import mochi.as3.*; public class utils { private static var crcTableComputed:Boolean = false; private static var crcTable:Array; public static function getB2Vec2(_arg1:Number):b2Vec2{ return (new b2Vec2(Math.cos(_arg1), Math.sin(_arg1))); } public static function sendUrlVariablesArg(_arg1:URLVariables, _arg2:String, _arg3:Function, _arg4):URLLoader{ var tempURL:URLRequest; var tempLoader:URLLoader; var fUrlVariables = _arg1; var fUrl = _arg2; var fProc = _arg3; var fArg = _arg4; main.game.whileLoad.inc(); tempURL = new URLRequest(fUrl); tempURL.method = URLRequestMethod.POST; tempURL.data = fUrlVariables; tempLoader = new URLLoader(); tempLoader.dataFormat = URLLoaderDataFormat.TEXT; tempLoader.addEventListener(Event.COMPLETE, function (){ main.game.whileLoad.dec(); fProc(tempLoader.data, fArg); }); tempLoader.addEventListener(IOErrorEvent.IO_ERROR, function (){ main.game.whileLoad.dec(); fProc("error", fArg); }); tempLoader.load(tempURL); return (tempLoader); } public static function checkDomains(... _args):Boolean{ var _local2:Boolean; var _local3:*; _local2 = false; _local3 = 0; while (_local3 < _args.length) { if (main.currentUrl.substr(0, _args[_local3].length) == _args[_local3]){ _local2 = true; }; _local3++; }; return (_local2); } public static function drawRect(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{ _arg1.moveTo(_arg2, _arg3); _arg1.lineTo(_arg4, _arg3); _arg1.lineTo(_arg4, _arg5); _arg1.lineTo(_arg2, _arg5); _arg1.lineTo(_arg2, _arg3); } public static function sendByteArray(_arg1:ByteArray, _arg2:String, _arg3:Function):void{ var tempURL:URLRequest; var tempLoader:URLLoader; var fByteArray = _arg1; var fUrl = _arg2; var fProc = _arg3; main.game.whileLoad.inc(); tempURL = new URLRequest(fUrl); tempURL.method = URLRequestMethod.POST; tempURL.data = fByteArray; tempURL.contentType = "application/octet-stream"; tempLoader = new URLLoader(); tempLoader.addEventListener(Event.COMPLETE, function (){ main.game.whileLoad.dec(); fProc(tempLoader.data); }); tempLoader.addEventListener(IOErrorEvent.IO_ERROR, function (){ main.game.whileLoad.dec(); fProc("error"); }); tempLoader.load(tempURL); } public static function track(_arg1:Sprite, _arg2:String):void{ MochiBot.track(_arg1, _arg2); } public static function stringToType(_arg1:String){ if (!isNaN(Number(_arg1))){ return (Number(_arg1)); }; if (_arg1 == "true"){ return (true); }; if (_arg1 == "false"){ return (false); }; return (_arg1); } private static function writeChunk(_arg1:ByteArray, _arg2:uint, _arg3:ByteArray):void{ var _local4:uint; var _local5:uint; var _local6:uint; var _local7:int; var _local8:uint; var _local9:uint; var _local10:uint; if (!crcTableComputed){ crcTableComputed = true; crcTable = []; _local9 = 0; while (_local9 < 0x0100) { _local8 = _local9; _local10 = 0; while (_local10 < 8) { if ((_local8 & 1)){ _local8 = uint((uint(3988292384) ^ uint((_local8 >>> 1)))); } else { _local8 = uint((_local8 >>> 1)); }; _local10++; }; crcTable[_local9] = _local8; _local9++; }; }; _local4 = 0; if (_arg3 != null){ _local4 = _arg3.length; }; _arg1.writeUnsignedInt(_local4); _local5 = _arg1.position; _arg1.writeUnsignedInt(_arg2); if (_arg3 != null){ _arg1.writeBytes(_arg3); }; _local6 = _arg1.position; _arg1.position = _local5; _local8 = 4294967295; _local7 = 0; while (_local7 < (_local6 - _local5)) { _local8 = uint((crcTable[((_local8 ^ _arg1.readUnsignedByte()) & uint(0xFF))] ^ uint((_local8 >>> 8)))); _local7++; }; _local8 = uint((_local8 ^ uint(4294967295))); _arg1.position = _local6; _arg1.writeUnsignedInt(_local8); } public static function addMovie(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean, _arg8:Function, _arg9:String=""):mMovie{ var _local10:*; _local10 = new mMovie(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9); return (_local10); } public static function getBlue(_arg1:uint):uint{ return ((_arg1 & 0xFF)); } public static function div(_arg1, _arg2:Number):Number{ var _local3:*; var _local4:*; var _local5:*; _local3 = _arg1; _local4 = _arg2; _local5 = 0; while (_local3 >= _local4) { _local5++; _local3 = (_local3 - _local4); }; return (_local5); } public static function drawScaledMovie(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number=0, _arg7:Number=0):void{ var _local8:*; var _local9:*; if (_arg2){ _local8 = new ((getDefinitionByName(_arg2) as Class)); if (_arg6 == 0){ _arg6 = _local8.width; }; if (_arg7 == 0){ _arg7 = _local8.height; }; _local8.gotoAndStop(_arg3); _local9 = new BitmapData(_arg6, _arg7, true, 0); _local9.draw(_local8, new Matrix((_arg6 / _local8.width), 0, 0, (_arg7 / _local8.height), (_arg6 / 2), (_arg7 / 2)), null, null, null, true); _arg1.graphics.beginBitmapFill(_local9, new Matrix(1, 0, 0, 1, _arg4, _arg5), true, false); drawRect(_arg1.graphics, _arg4, _arg5, (_arg4 + _arg6), (_arg5 + _arg7)); _arg1.graphics.endFill(); }; } public static function adjustContexMenu():ContextMenu{ var _local1:ContextMenu; var _local2:*; _local1 = new ContextMenu(); _local1.hideBuiltInItems(); _local2 = new ContextMenuItem("plus © 2010"); _local1.customItems.push(_local2); return (_local1); } public static function getTotalFrames(_arg1:String):Number{ var _local2:*; _local2 = new ((getDefinitionByName(_arg1) as Class)); return (_local2.totalFrames); } public static function loadLeaderBoard(_arg1:String, _arg2:Number=0):void{ var o:Object; var boardID:String; var tempWindow:*; var fMochiLeaderBoardID = _arg1; var fScores = _arg2; if (fMochiLeaderBoardID){ trace(fScores); o = {n:[10, 6, 15, 5, 1, 11, 12, 10, 9, 14, 10, 2, 3, 9, 15, 6], f:function (_arg1:Number, _arg2:String):String{ if (_arg2.length == 16){ return (_arg2); }; return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16)))); }}; boardID = o.f(0, main.game.MOCHI_LEADERBOARD_ID); tempWindow = new mWindow(main.game.interfaceEngine); if (fScores != 0){ MochiScores.showLeaderboard({boardID:boardID, score:fScores, onDisplay:function (){ }, onClose:function (){ tempWindow.destroy(); }}); } else { MochiScores.showLeaderboard({boardID:boardID, onDisplay:function (){ }, onClose:function (){ tempWindow.destroy(); }}); }; }; } public static function getRed(_arg1:uint):uint{ return (((_arg1 >> 16) & 0xFF)); } public static function getGreen(_arg1:uint):uint{ return (((_arg1 >> 8) & 0xFF)); } public static function getPages(_arg1, _arg2):Number{ var _local3:*; _local3 = div(_arg1, _arg2); if ((_local3 * _arg2) != _arg1){ _local3++; }; return (_local3); } public static function drawTilesToPolygon(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Array):void{ var _local7:*; var _local8:*; if (_arg2){ _local7 = new ((getDefinitionByName(_arg2) as Class)); _local7.gotoAndStop(_arg3); _local8 = new BitmapData((_local7.width - 1), (_local7.height - 1), true, 0); _local8.draw(_local7, new Matrix(1, 0, 0, 1, (_local7.width / 2), (_local7.height / 2)), null, null, null, true); _arg1.graphics.lineStyle(1, _local8.getPixel32(0, 0)); _arg1.graphics.beginBitmapFill(_local8, new Matrix(1, 0, 0, 1, _arg4, _arg5), true, true); drawPolygon(_arg1.graphics, _arg6); _arg1.graphics.endFill(); }; } public static function getColorRGB(_arg1:uint=0, _arg2:uint=0, _arg3:uint=0):uint{ return ((((_arg1 << 16) | (_arg2 << 8)) | _arg3)); } public static function drawTiles(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):void{ var _local9:*; var _local10:*; if (_arg2){ _local9 = new ((getDefinitionByName(_arg2) as Class)); _local9.gotoAndStop(_arg3); _local10 = new BitmapData((_local9.width - 1), (_local9.height - 1), true, 0); _local10.draw(_local9, new Matrix(1, 0, 0, 1, (_local9.width / 2), (_local9.height / 2)), null, null, null, true); _arg1.graphics.lineStyle(1, _local10.getPixel32(0, 0)); _arg1.graphics.beginBitmapFill(_local10, new Matrix(1, 0, 0, 1, _arg4, _arg5), true, true); if (_arg8 == 0){ drawRect(_arg1.graphics, _arg4, _arg5, (_arg4 + _arg6), (_arg5 + _arg7)); }; if (_arg8 == 1){ _arg1.graphics.drawCircle(_arg4, _arg5, _arg6); }; _arg1.graphics.endFill(); }; } public static function addRatingStars(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number):void{ var _local5:*; var _local6:*; _local5 = new mRatingBack(); _local5.x = (_arg2 + 96); _local5.y = _arg3; _arg1.addChild(_local5); _local5 = new mRating(); _local5.x = (_arg2 + 96); _local5.y = _arg3; _arg1.addChild(_local5); _local6 = new mRatingMask(); _local6.x = _arg2; _local6.y = _arg3; _local6.width = (100 * (Number(_arg4) / 5)); _arg1.addChild(_local6); _local5.mask = _local6; } public static function createObjFromString(_arg1:MovieClip, _arg2:String, _arg3:Array):Object{ var tempObj:*; var classReference:Class; var fParent = _arg1; var fClassName = _arg2; var fArgs = _arg3; try { classReference = Class(getDefinitionByName(fClassName)); } catch(fError:Error) { trace(fError.toString()); return (null); }; tempObj = fParent.addChild(new (classReference)); if ((String((getClassName(tempObj, true) + "Init")) in tempObj)){ tempObj[(getClassName(tempObj, true) + "Init")].apply(null, fArgs); } else { return (null); }; return (tempObj); } public static function getArrFromXMLListAttrs(_arg1:XMLList):Array{ var _local2:Array; var _local3:*; _local2 = new Array(); _local3 = 0; while (_local3 < _arg1.length()) { _local2[_local3] = stringToType(_arg1[_local3]); _local3++; }; return (_local2); } public static function ArrayContain(_arg1:Array, _arg2):Boolean{ var _local3:*; _local3 = 0; while (_local3 < _arg1.length) { if (_arg1[_local3] == _arg2){ return (true); }; _local3++; }; return (false); } public static function goToUrl(_arg1:String):void{ navigateToURL(new URLRequest(_arg1), "_BLANK"); } public static function getClassName(_arg1:Object, _arg2:Boolean=false):String{ var _local3:*; _local3 = getQualifiedClassName(_arg1).replace("::", "."); if (_arg2){ _local3 = _local3.substr((_local3.lastIndexOf(".") + 1)); }; return (_local3); } public static function drawPolygon(_arg1:Graphics, _arg2:Array):void{ var _local3:*; _arg1.moveTo(_arg2[0], _arg2[1]); _local3 = 1; while (_local3 < (_arg2.length / 2)) { _arg1.lineTo(_arg2[(_local3 * 2)], _arg2[((_local3 * 2) + 1)]); _local3++; }; _arg1.lineTo(_arg2[0], _arg2[1]); } public static function getBitmapData(_arg1:Sprite, _arg2, _arg3:Number):BitmapData{ var _local4:*; _local4 = new BitmapData(_arg2, _arg3, false, 0xFFFFFF); _local4.draw(_arg1); return (_local4); } public static function sendUrlVariables(_arg1:URLVariables, _arg2:String, _arg3:Function):URLLoader{ var tempURL:URLRequest; var tempLoader:URLLoader; var fUrlVariables = _arg1; var fUrl = _arg2; var fProc = _arg3; main.game.whileLoad.inc(); tempURL = new URLRequest(fUrl); tempURL.method = URLRequestMethod.POST; tempURL.data = fUrlVariables; tempLoader = new URLLoader(); tempLoader.dataFormat = URLLoaderDataFormat.TEXT; tempLoader.addEventListener(Event.COMPLETE, function (){ main.game.whileLoad.dec(); fProc(tempLoader.data); }); tempLoader.addEventListener(IOErrorEvent.IO_ERROR, function (){ main.game.whileLoad.dec(); fProc("error"); }); tempLoader.load(tempURL); return (tempLoader); } public static function loadContent(_arg1:MovieClip, _arg2:String, _arg3, _arg4, _arg5, _arg6:Number, _arg7:Function, _arg8:Function):Loader{ var tempURL:URLRequest; var tempLoader:Loader; var fParent = _arg1; var fUrl = _arg2; var fX = _arg3; var fY = _arg4; var fWidth = _arg5; var fHeight = _arg6; var fCompleteProc = _arg7; var fIOErrorProc = _arg8; tempURL = new URLRequest(fUrl); tempLoader = new Loader(); tempLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function (){ tempLoader.x = fX; tempLoader.y = fY; tempLoader.width = fWidth; tempLoader.height = fHeight; fCompleteProc(); }); tempLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, fIOErrorProc); tempLoader.load(tempURL); fParent.addChild(tempLoader); return (tempLoader); } public static function runRandom(... _args):void{ var _local2:*; var _local3:*; _local2 = Math.random(); _local3 = 0; while (_local3 < _args.length) { if (((((_local3 / _args.length) <= _local2)) && ((((_local3 + 1) / _args.length) >= _local2)))){ var _local4 = _args; _local4[_local3](); }; _local3++; }; } public static function createButtonMatrix(_arg1:MovieClip, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10:Function):void{ var _local11:*; var _local12:*; var _local13:*; var _local14:*; var _local15:*; var _local16:*; _local11 = _arg8; _local12 = Math.floor((_arg4 / (_arg6 - 1))); _local13 = Math.floor((_arg5 / (_arg7 - 1))); _local14 = 0; while (_local14 < _arg7) { _local15 = 0; while (_local15 < _arg6) { if (_local11 > 0){ _local16 = new mTagButton(_arg1, "mButtonBack", 1, 1, (_arg2 + (_local12 * _local15)), (_arg3 + (_local13 * _local14)), 30, 30, ((_arg8 - _local11) < (_arg9 + 1)), String(((_arg8 - _local11) + 1)), 15, _arg10, ((_arg8 - _local11) + 1)); }; _local11--; _local15++; }; _local14++; }; } public static function decreaseBitmapData(_arg1:BitmapData, _arg2:Number):BitmapData{ var _local3:*; var _local4:*; _local3 = new Matrix(); _local3.scale((1 / _arg2), (1 / _arg2)); _local4 = new BitmapData(Math.floor((_arg1.width / _arg2)), Math.floor((_arg1.height / _arg2))); _local4.draw(_arg1, _local3); return (_local4); } public static function getSampleLink(_arg1:String):mSampleLink{ var _local2:*; var _local3:*; var _local4:*; var _local5:*; _local2 = _arg1.split(/\./); _local3 = main.game; _local4 = ""; if (_local2.length > 0){ _local5 = 0; while (_local5 < (_local2.length - 1)) { if ((String(_local2[_local5]) in _local3)){ _local3 = _local3[_local2[_local5]]; } else { _local3 = null; _local4 = ""; break; }; _local5++; }; if (_local3){ if ((String(_local2[(_local2.length - 1)]) in _local3)){ _local4 = _local2[(_local2.length - 1)]; } else { _local3 = null; _local4 = ""; }; }; } else { _local3 = null; _local4 = ""; }; return (new mSampleLink(_local3, _local4)); } public static function drawSlicedTiles(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{ var _local7:*; var _local8:*; _local7 = new ((getDefinitionByName(_arg2) as Class)); _local7.gotoAndStop(_arg3); _arg1.graphics.lineStyle(1, _local8.getPixel32(0, 0)); _local8 = new BitmapData((_local7.width - 1), (_local7.height - 1), true, 0); _local8.draw(_local7, new Matrix(1, 0, 0, 1, (_local7.width / 2), (_local7.height / 2))); _arg1.graphics.beginBitmapFill(_local8, new Matrix(1, 0, 0, 1, (-(_arg4) / 2), (-(_arg5) / 2))); drawRect(_arg1.graphics, (-(_arg4) / 2), (-(_arg5) / 2), ((-(_arg4) / 2) + _arg6), ((-(_arg5) / 2) + _arg6)); _arg1.graphics.endFill(); _arg1.graphics.beginBitmapFill(_local8, new Matrix(1, 0, 0, 1, (_arg4 / 2), (-(_arg5) / 2))); drawRect(_arg1.graphics, (_arg4 / 2), (-(_arg5) / 2), ((_arg4 / 2) - _arg6), ((-(_arg5) / 2) + _arg6)); _arg1.graphics.endFill(); _arg1.graphics.beginBitmapFill(_local8, new Matrix(1, 0, 0, 1, (-(_arg4) / 2), (_arg5 / 2))); drawRect(_arg1.graphics, ((-(_arg4) / 2) + _arg6), ((_arg5 / 2) - _arg6), (-(_arg4) / 2), (_arg5 / 2)); _arg1.graphics.endFill(); _arg1.graphics.beginBitmapFill(_local8, new Matrix(1, 0, 0, 1, (_arg4 / 2), (_arg5 / 2))); drawRect(_arg1.graphics, ((_arg4 / 2) - _arg6), ((_arg5 / 2) - _arg6), (_arg4 / 2), (_arg5 / 2)); _arg1.graphics.endFill(); _local8 = new BitmapData((_local7.width - (_arg6 * 2)), _arg6, true, 0); _local8.draw(_local7, new Matrix(1, 0, 0, 1, ((_local7.width / 2) - _arg6), (_local7.height / 2))); _arg1.graphics.beginBitmapFill(_local8, new Matrix(1, 0, 0, 1, (-(_arg4) / 2), (-(_arg5) / 2))); drawRect(_arg1.graphics, ((-(_arg4) / 2) + _arg6), (-(_arg5) / 2), ((_arg4 / 2) - _arg6), ((-(_arg5) / 2) + _arg6)); _arg1.graphics.endFill(); _local8 = new BitmapData((_local7.width - (_arg6 * 2)), _arg6, true, 0); _local8.draw(_local7, new Matrix(1, 0, 0, 1, ((_local7.width / 2) - _arg6), ((-(_local7.height) / 2) + _arg6))); _arg1.graphics.beginBitmapFill(_local8, new Matrix(1, 0, 0, 1, (-(_arg4) / 2), (_arg5 / 2))); drawRect(_arg1.graphics, ((-(_arg4) / 2) + _arg6), ((_arg5 / 2) - _arg6), ((_arg4 / 2) - _arg6), (_arg5 / 2)); _arg1.graphics.endFill(); _local8 = new BitmapData(_arg6, (_local7.height - (_arg6 * 2)), true, 0); _local8.draw(_local7, new Matrix(1, 0, 0, 1, (_local7.width / 2), ((_local7.height / 2) - _arg6))); _arg1.graphics.beginBitmapFill(_local8, new Matrix(1, 0, 0, 1, (-(_arg4) / 2), (-(_arg5) / 2))); drawRect(_arg1.graphics, (-(_arg4) / 2), ((-(_arg5) / 2) + _arg6), ((-(_arg4) / 2) + _arg6), ((_arg5 / 2) - _arg6)); _arg1.graphics.endFill(); _local8 = new BitmapData(_arg6, (_local7.height - (_arg6 * 2)), true, 0); _local8.draw(_local7, new Matrix(1, 0, 0, 1, ((-(_local7.width) / 2) + _arg6), ((_local7.height / 2) - _arg6))); _arg1.graphics.beginBitmapFill(_local8, new Matrix(1, 0, 0, 1, (_arg4 / 2), (-(_arg5) / 2))); drawRect(_arg1.graphics, ((_arg4 / 2) - _arg6), ((-(_arg5) / 2) + _arg6), (_arg4 / 2), ((_arg5 / 2) - _arg6)); _arg1.graphics.endFill(); _local8 = new BitmapData((_local7.width - (_arg6 * 2)), (_local7.height - (_arg6 * 2)), true, 0); _local8.draw(_local7, new Matrix(1, 0, 0, 1, ((_local7.width / 2) - _arg6), ((_local7.height / 2) - _arg6))); _arg1.graphics.beginBitmapFill(_local8, new Matrix(1, 0, 0, 1, (-(_arg4) / 2), ((-(_arg5) / 2) + _arg6))); drawRect(_arg1.graphics, ((-(_arg4) / 2) + _arg6), ((-(_arg5) / 2) + _arg6), ((_arg4 / 2) - _arg6), ((_arg5 / 2) - _arg6)); _arg1.graphics.endFill(); } public static function PNGEncode(_arg1:BitmapData):ByteArray{ var _local2:ByteArray; var _local3:ByteArray; var _local4:ByteArray; var _local5:int; var _local6:uint; var _local7:int; _local2 = new ByteArray(); _local2.writeUnsignedInt(2303741511); _local2.writeUnsignedInt(218765834); _local3 = new ByteArray(); _local3.writeInt(_arg1.width); _local3.writeInt(_arg1.height); _local3.writeUnsignedInt(134610944); _local3.writeByte(0); writeChunk(_local2, 1229472850, _local3); _local4 = new ByteArray(); _local5 = 0; while (_local5 < _arg1.height) { _local4.writeByte(0); if (!_arg1.transparent){ _local7 = 0; while (_local7 < _arg1.width) { _local6 = _arg1.getPixel(_local7, _local5); _local4.writeUnsignedInt(uint((((_local6 & 0xFFFFFF) << 8) | 0xFF))); _local7++; }; } else { _local7 = 0; while (_local7 < _arg1.width) { _local6 = _arg1.getPixel32(_local7, _local5); _local4.writeUnsignedInt(uint((((_local6 & 0xFFFFFF) << 8) | (_local6 >>> 24)))); _local7++; }; }; _local5++; }; _local4.compress(); writeChunk(_local2, 1229209940, _local4); writeChunk(_local2, 1229278788, null); return (_local2); } } }//package src
Section 162
//mAdBox (mAdBox) package { import flash.display.*; public dynamic class mAdBox extends MovieClip { } }//package
Section 163
//mAllocation (mAllocation) package { import flash.display.*; public dynamic class mAllocation extends MovieClip { } }//package
Section 164
//MaxGames_MAXLOGOINTRO1 (MaxGames_MAXLOGOINTRO1) package { import flash.display.*; public dynamic class MaxGames_MAXLOGOINTRO1 extends MovieClip { } }//package
Section 165
//mBalka (mBalka) package { import flash.display.*; public dynamic class mBalka extends MovieClip { } }//package
Section 166
//mBalkaPreview (mBalkaPreview) package { import flash.display.*; public dynamic class mBalkaPreview extends MovieClip { } }//package
Section 167
//mBarTexture (mBarTexture) package { import flash.display.*; public dynamic class mBarTexture extends MovieClip { } }//package
Section 168
//mBombTimer (mBombTimer) package { import flash.display.*; public dynamic class mBombTimer extends MovieClip { } }//package
Section 169
//mBoxPreview (mBoxPreview) package { import flash.display.*; public dynamic class mBoxPreview extends MovieClip { } }//package
Section 170
//mButtonBack (mButtonBack) package { import flash.display.*; public dynamic class mButtonBack extends MovieClip { } }//package
Section 171
//mButtonButtonBack (mButtonButtonBack) package { import flash.display.*; public dynamic class mButtonButtonBack extends MovieClip { } }//package
Section 172
//mColorBar (mColorBar) package { import flash.display.*; public dynamic class mColorBar extends MovieClip { } }//package
Section 173
//mDistJointMovie (mDistJointMovie) package { import flash.display.*; public dynamic class mDistJointMovie extends MovieClip { public var lineWidth:mDistJointWidth; } }//package
Section 174
//mDistJointWidth (mDistJointWidth) package { import flash.display.*; public dynamic class mDistJointWidth extends MovieClip { } }//package
Section 175
//mDynStatButtonBack (mDynStatButtonBack) package { import flash.display.*; public dynamic class mDynStatButtonBack extends MovieClip { } }//package
Section 176
//mExp1 (mExp1) package { import flash.display.*; public dynamic class mExp1 extends MovieClip { } }//package
Section 177
//mEyeBrow (mEyeBrow) package { import flash.display.*; public dynamic class mEyeBrow extends MovieClip { public function mEyeBrow(){ addFrameScript(0, frame1, 9, frame10, 49, frame50, 89, frame90); } function frame90(){ gotoAndStop(1); } function frame10(){ gotoAndStop(1); } function frame1(){ stop(); } function frame50(){ gotoAndStop(1); } } }//package
Section 178
//mEyes (mEyes) package { import flash.display.*; public dynamic class mEyes extends MovieClip { public function mEyes(){ addFrameScript(0, frame1, 4, frame5, 49, frame50, 99, frame100, 149, frame150, 156, frame157); } function frame157(){ gotoAndStop(1); } function frame1(){ stop(); } function frame5(){ gotoAndStop(1); } function frame100(){ gotoAndStop(1); } function frame50(){ gotoAndStop(1); } function frame150(){ gotoAndStop(1); } } }//package
Section 179
//mFon (mFon) package { import flash.display.*; public dynamic class mFon extends MovieClip { } }//package
Section 180
//mFonPreview (mFonPreview) package { import flash.display.*; public dynamic class mFonPreview extends MovieClip { } }//package
Section 181
//mHoop (mHoop) package { import flash.display.*; public dynamic class mHoop extends MovieClip { } }//package
Section 182
//mInterfaceTexture (mInterfaceTexture) package { import flash.display.*; public dynamic class mInterfaceTexture extends MovieClip { } }//package
Section 183
//mJointMovie (mJointMovie) package { import flash.display.*; public dynamic class mJointMovie extends MovieClip { } }//package
Section 184
//mLEButtonsBacks (mLEButtonsBacks) package { import flash.display.*; public dynamic class mLEButtonsBacks extends MovieClip { } }//package
Section 185
//mLEEditButtonsBacks (mLEEditButtonsBacks) package { import flash.display.*; public dynamic class mLEEditButtonsBacks extends MovieClip { } }//package
Section 186
//mMorphDefault (mMorphDefault) package { import flash.display.*; public dynamic class mMorphDefault extends MovieClip { } }//package
Section 187
//mMusicButtonBack (mMusicButtonBack) package { import flash.display.*; public dynamic class mMusicButtonBack extends MovieClip { } }//package
Section 188
//mOurSplash (mOurSplash) package { import flash.display.*; public dynamic class mOurSplash extends MovieClip { } }//package
Section 189
//mRating (mRating) package { import flash.display.*; public dynamic class mRating extends MovieClip { } }//package
Section 190
//mRatingBack (mRatingBack) package { import flash.display.*; public dynamic class mRatingBack extends MovieClip { } }//package
Section 191
//mRatingMask (mRatingMask) package { import flash.display.*; public dynamic class mRatingMask extends MovieClip { } }//package
Section 192
//mSmallSponsorLogo (mSmallSponsorLogo) package { import flash.display.*; public dynamic class mSmallSponsorLogo extends MovieClip { } }//package
Section 193
//mSmallWhileLoad (mSmallWhileLoad) package { import flash.display.*; public dynamic class mSmallWhileLoad extends MovieClip { public function mSmallWhileLoad(){ addFrameScript(15, frame16); } function frame16(){ gotoAndPlay(1); } } }//package
Section 194
//mSmoke1 (mSmoke1) package { import flash.display.*; public dynamic class mSmoke1 extends MovieClip { } }//package
Section 195
//mSoundButtonBack (mSoundButtonBack) package { import flash.display.*; public dynamic class mSoundButtonBack extends MovieClip { } }//package
Section 196
//mSponsorLogo (mSponsorLogo) package { import flash.display.*; public dynamic class mSponsorLogo extends MovieClip { } }//package
Section 197
//mSpringJointMovie (mSpringJointMovie) package { import flash.display.*; public dynamic class mSpringJointMovie extends MovieClip { public var lineWidth:mSpringJointWidth; } }//package
Section 198
//mSpringJointWidth (mSpringJointWidth) package { import flash.display.*; public dynamic class mSpringJointWidth extends MovieClip { } }//package
Section 199
//mWheelPreview (mWheelPreview) package { import flash.display.*; public dynamic class mWheelPreview extends MovieClip { } }//package
Section 200
//sndButtonUp (sndButtonUp) package { import flash.media.*; public dynamic class sndButtonUp extends Sound { } }//package
Section 201
//sndExplosion (sndExplosion) package { import flash.media.*; public dynamic class sndExplosion extends Sound { } }//package
Section 202
//sndFanfare (sndFanfare) package { import flash.media.*; public dynamic class sndFanfare extends Sound { } }//package
Section 203
//sndLoadEnd (sndLoadEnd) package { import flash.media.*; public dynamic class sndLoadEnd extends Sound { } }//package
Section 204
//sndLose (sndLose) package { import flash.media.*; public dynamic class sndLose extends Sound { } }//package
Section 205
//sndMorph (sndMorph) package { import flash.media.*; public dynamic class sndMorph extends Sound { } }//package
Section 206
//sndTrack1 (sndTrack1) package { import flash.media.*; public dynamic class sndTrack1 extends Sound { } }//package
Section 207
//sndTrack2 (sndTrack2) package { import flash.media.*; public dynamic class sndTrack2 extends Sound { } }//package

Library Items

Symbol 1 Sound {sndButtonUp}Used by:61
Symbol 2 GraphicUsed by:3
Symbol 3 MovieClip {mButtonBack}Uses:2
Symbol 4 GraphicUsed by:11
Symbol 5 GraphicUsed by:6
Symbol 6 MovieClip {mColorBar}Uses:5Used by:11
Symbol 7 GraphicUsed by:8 43 102
Symbol 8 MovieClip {mAdBox}Uses:7Used by:11
Symbol 9 FontUsed by:10 153
Symbol 10 EditableTextUses:9Used by:11
Symbol 11 MovieClip {src.mPreloader}Uses:4 6 8 10
Symbol 12 BitmapUsed by:13
Symbol 13 GraphicUses:12Used by:14
Symbol 14 MovieClip {mSponsorLogo}Uses:13Used by:Timeline
Symbol 15 GraphicUsed by:21
Symbol 16 GraphicUsed by:21
Symbol 17 GraphicUsed by:21
Symbol 18 GraphicUsed by:21
Symbol 19 GraphicUsed by:21
Symbol 20 GraphicUsed by:21
Symbol 21 MovieClip {src.interfaces.mTitle}Uses:15 16 17 18 19 20Used by:Timeline
Symbol 22 GraphicUsed by:Timeline
Symbol 23 GraphicUsed by:27 62 83 88
Symbol 24 FontUsed by:25 26
Symbol 25 EditableTextUses:24Used by:27
Symbol 26 EditableTextUses:24Used by:27
Symbol 27 MovieClip {src.interfaces.mEdit}Uses:23 25 26Used by:Timeline
Symbol 28 GraphicUsed by:29
Symbol 29 MovieClip {mAllocation}Uses:28Used by:Timeline
Symbol 30 GraphicUsed by:38
Symbol 31 GraphicUsed by:38
Symbol 32 GraphicUsed by:38
Symbol 33 GraphicUsed by:38
Symbol 34 GraphicUsed by:38
Symbol 35 GraphicUsed by:38
Symbol 36 GraphicUsed by:38
Symbol 37 GraphicUsed by:38
Symbol 38 MovieClip {mBalka}Uses:30 31 32 33 34 35 36 37Used by:Timeline
Symbol 39 GraphicUsed by:43
Symbol 40 GraphicUsed by:43
Symbol 41 GraphicUsed by:43
Symbol 42 GraphicUsed by:43
Symbol 43 MovieClip {mOurSplash}Uses:7 39 40 41 42Used by:Timeline
Symbol 44 GraphicUsed by:48
Symbol 45 GraphicUsed by:48
Symbol 46 GraphicUsed by:48
Symbol 47 GraphicUsed by:48
Symbol 48 MovieClip {mSmallWhileLoad}Uses:44 45 46 47Used by:Timeline
Symbol 49 GraphicUsed by:53
Symbol 50 GraphicUsed by:53
Symbol 51 GraphicUsed by:53
Symbol 52 GraphicUsed by:53
Symbol 53 MovieClip {src.utilities.mWhileLoad}Uses:49 50 51 52Used by:Timeline
Symbol 54 Sound {sndLoadEnd}Used by:61
Symbol 55 Sound {sndTrack2}Used by:61
Symbol 56 Sound {sndFanfare}Used by:61
Symbol 57 Sound {sndMorph}Used by:61
Symbol 58 Sound {sndLose}Used by:61
Symbol 59 Sound {sndTrack1}Used by:61
Symbol 60 Sound {sndExplosion}Used by:61
Symbol 61 MovieClip {game_fla.sounds_7}Uses:54 1 55 56 57 58 59 60Used by:Timeline
Symbol 62 MovieClip {src.utilities.mFader}Uses:23Used by:Timeline
Symbol 63 GraphicUsed by:67
Symbol 64 FontUsed by:65 66
Symbol 65 TextUses:64Used by:67
Symbol 66 TextUses:64Used by:67
Symbol 67 MovieClip {src.utilities.mAwayPause}Uses:63 65 66Used by:Timeline
Symbol 68 FontUsed by:69
Symbol 69 EditableTextUses:68Used by:Timeline
Symbol 70 GraphicUsed by:72
Symbol 71 GraphicUsed by:72
Symbol 72 MovieClip {src.mMouse}Uses:70 71Used by:Timeline
Symbol 73 GraphicUsed by:82
Symbol 74 GraphicUsed by:82
Symbol 75 GraphicUsed by:82
Symbol 76 GraphicUsed by:82
Symbol 77 GraphicUsed by:82
Symbol 78 GraphicUsed by:82
Symbol 79 GraphicUsed by:82
Symbol 80 GraphicUsed by:82
Symbol 81 GraphicUsed by:82
Symbol 82 MovieClip {src.units.mRecycle}Uses:73 74 75 76 77 78 79 80 81Used by:Timeline
Symbol 83 MovieClip {src.interfaces.mComboBox}Uses:23Used by:Timeline
Symbol 84 GraphicUsed by:85
Symbol 85 MovieClip {src.interfaces.mDivider}Uses:84Used by:Timeline
Symbol 86 GraphicUsed by:87
Symbol 87 MovieClip {mInterfaceTexture}Uses:86Used by:Timeline
Symbol 88 MovieClip {mBarTexture}Uses:23Used by:Timeline
Symbol 89 GraphicUsed by:90
Symbol 90 MovieClip {src.physics.mDotJoint}Uses:89Used by:Timeline
Symbol 91 GraphicUsed by:92
Symbol 92 MovieClip {src.physics.mDistanceJoint}Uses:91Used by:Timeline
Symbol 93 GraphicUsed by:94
Symbol 94 MovieClip {mJointMovie}Uses:93Used by:Timeline
Symbol 95 GraphicUsed by:96
Symbol 96 MovieClip {mDistJointWidth}Uses:95Used by:97
Symbol 97 MovieClip {mDistJointMovie}Uses:96Used by:Timeline
Symbol 98 GraphicUsed by:99
Symbol 99 MovieClip {mRatingBack}Uses:98Used by:Timeline
Symbol 100 GraphicUsed by:101
Symbol 101 MovieClip {mRating}Uses:100Used by:Timeline
Symbol 102 MovieClip {mRatingMask}Uses:7Used by:Timeline
Symbol 103 GraphicUsed by:104
Symbol 104 MovieClip {src.physics.mPrismaticJoint}Uses:103Used by:Timeline
Symbol 105 GraphicUsed by:106
Symbol 106 MovieClip {src.physics.mSpringJoint}Uses:105Used by:Timeline
Symbol 107 GraphicUsed by:108
Symbol 108 MovieClip {mSpringJointWidth}Uses:107Used by:109
Symbol 109 MovieClip {mSpringJointMovie}Uses:108Used by:Timeline
Symbol 110 GraphicUsed by:138
Symbol 111 GraphicUsed by:138
Symbol 112 GraphicUsed by:138
Symbol 113 GraphicUsed by:138
Symbol 114 GraphicUsed by:138
Symbol 115 GraphicUsed by:138
Symbol 116 GraphicUsed by:138
Symbol 117 GraphicUsed by:138
Symbol 118 GraphicUsed by:138
Symbol 119 GraphicUsed by:138
Symbol 120 GraphicUsed by:138
Symbol 121 GraphicUsed by:138
Symbol 122 GraphicUsed by:138
Symbol 123 GraphicUsed by:138
Symbol 124 GraphicUsed by:138
Symbol 125 GraphicUsed by:138
Symbol 126 GraphicUsed by:138
Symbol 127 GraphicUsed by:138
Symbol 128 GraphicUsed by:138
Symbol 129 GraphicUsed by:138
Symbol 130 GraphicUsed by:138
Symbol 131 GraphicUsed by:138
Symbol 132 GraphicUsed by:138
Symbol 133 GraphicUsed by:138
Symbol 134 GraphicUsed by:138
Symbol 135 GraphicUsed by:138
Symbol 136 GraphicUsed by:138
Symbol 137 GraphicUsed by:138
Symbol 138 MovieClip {mEyes}Uses:110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137Used by:Timeline
Symbol 139 GraphicUsed by:147
Symbol 140 GraphicUsed by:147
Symbol 141 GraphicUsed by:147
Symbol 142 GraphicUsed by:147
Symbol 143 GraphicUsed by:147
Symbol 144 GraphicUsed by:147
Symbol 145 GraphicUsed by:147
Symbol 146 GraphicUsed by:147
Symbol 147 MovieClip {mBalkaPreview}Uses:139 140 141 142 143 144 145 146Used by:Timeline
Symbol 148 GraphicUsed by:152
Symbol 149 GraphicUsed by:152
Symbol 150 GraphicUsed by:152
Symbol 151 GraphicUsed by:152
Symbol 152 MovieClip {src.units.mCloud}Uses:148 149 150 151Used by:Timeline
Symbol 153 EditableTextUses:9Used by:Timeline
Symbol 154 GraphicUsed by:155
Symbol 155 MovieClip {src.units.mSun}Uses:154Used by:Timeline
Symbol 156 GraphicUsed by:157
Symbol 157 MovieClip {mSmoke1}Uses:156Used by:Timeline
Symbol 158 GraphicUsed by:177
Symbol 159 GraphicUsed by:177
Symbol 160 GraphicUsed by:177
Symbol 161 GraphicUsed by:177
Symbol 162 GraphicUsed by:177
Symbol 163 GraphicUsed by:177
Symbol 164 GraphicUsed by:177
Symbol 165 GraphicUsed by:177
Symbol 166 GraphicUsed by:177
Symbol 167 GraphicUsed by:177
Symbol 168 GraphicUsed by:177
Symbol 169 GraphicUsed by:177
Symbol 170 GraphicUsed by:177
Symbol 171 GraphicUsed by:177
Symbol 172 GraphicUsed by:177
Symbol 173 GraphicUsed by:177
Symbol 174 GraphicUsed by:177
Symbol 175 GraphicUsed by:177
Symbol 176 GraphicUsed by:177
Symbol 177 MovieClip {mLEButtonsBacks}Uses:158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176Used by:Timeline
Symbol 178 GraphicUsed by:180
Symbol 179 GraphicUsed by:180
Symbol 180 MovieClip {mDynStatButtonBack}Uses:178 179Used by:Timeline
Symbol 181 GraphicUsed by:184
Symbol 182 GraphicUsed by:184
Symbol 183 GraphicUsed by:184
Symbol 184 MovieClip {mLEEditButtonsBacks}Uses:181 182 183Used by:Timeline
Symbol 185 GraphicUsed by:197
Symbol 186 GraphicUsed by:197
Symbol 187 GraphicUsed by:197
Symbol 188 GraphicUsed by:197
Symbol 189 GraphicUsed by:197
Symbol 190 GraphicUsed by:197
Symbol 191 GraphicUsed by:197
Symbol 192 GraphicUsed by:197
Symbol 193 GraphicUsed by:197
Symbol 194 GraphicUsed by:197
Symbol 195 GraphicUsed by:197
Symbol 196 GraphicUsed by:197
Symbol 197 MovieClip {mEyeBrow}Uses:185 186 187 188 189 190 191 192 193 194 195 196Used by:Timeline
Symbol 198 GraphicUsed by:199
Symbol 199 MovieClip {mMorphDefault}Uses:198Used by:Timeline
Symbol 200 GraphicUsed by:202
Symbol 201 GraphicUsed by:202
Symbol 202 MovieClip {mButtonButtonBack}Uses:200 201Used by:Timeline
Symbol 203 GraphicUsed by:205
Symbol 204 GraphicUsed by:205
Symbol 205 MovieClip {mMusicButtonBack}Uses:203 204Used by:Timeline
Symbol 206 GraphicUsed by:208
Symbol 207 GraphicUsed by:208
Symbol 208 MovieClip {mSoundButtonBack}Uses:206 207Used by:Timeline
Symbol 209 GraphicUsed by:214
Symbol 210 GraphicUsed by:214
Symbol 211 GraphicUsed by:214
Symbol 212 GraphicUsed by:214
Symbol 213 GraphicUsed by:214
Symbol 214 MovieClip {src.physics.mPhysBox}Uses:209 210 211 212 213Used by:Timeline
Symbol 215 GraphicUsed by:220
Symbol 216 GraphicUsed by:220
Symbol 217 GraphicUsed by:220
Symbol 218 GraphicUsed by:220
Symbol 219 GraphicUsed by:220
Symbol 220 MovieClip {mBoxPreview}Uses:215 216 217 218 219Used by:Timeline
Symbol 221 GraphicUsed by:224
Symbol 222 GraphicUsed by:224
Symbol 223 GraphicUsed by:224
Symbol 224 MovieClip {mFonPreview}Uses:221 222 223Used by:Timeline
Symbol 225 GraphicUsed by:230
Symbol 226 GraphicUsed by:230
Symbol 227 GraphicUsed by:230
Symbol 228 GraphicUsed by:230
Symbol 229 GraphicUsed by:230
Symbol 230 MovieClip {src.physics.mPhysWheel}Uses:225 226 227 228 229Used by:Timeline
Symbol 231 GraphicUsed by:236
Symbol 232 GraphicUsed by:236
Symbol 233 GraphicUsed by:236
Symbol 234 GraphicUsed by:236
Symbol 235 GraphicUsed by:236
Symbol 236 MovieClip {mWheelPreview}Uses:231 232 233 234 235Used by:Timeline
Symbol 237 GraphicUsed by:249
Symbol 238 GraphicUsed by:248
Symbol 239 GraphicUsed by:248
Symbol 240 GraphicUsed by:248
Symbol 241 GraphicUsed by:248
Symbol 242 GraphicUsed by:248
Symbol 243 GraphicUsed by:248
Symbol 244 GraphicUsed by:248
Symbol 245 GraphicUsed by:248
Symbol 246 GraphicUsed by:248
Symbol 247 GraphicUsed by:248
Symbol 248 MovieClip {mBombTimer}Uses:238 239 240 241 242 243 244 245 246 247Used by:249
Symbol 249 MovieClip {src.units.mBomb}Uses:237 248Used by:Timeline
Symbol 250 BitmapUsed by:251
Symbol 251 GraphicUses:250Used by:322
Symbol 252 BitmapUsed by:253
Symbol 253 GraphicUses:252Used by:322
Symbol 254 BitmapUsed by:255
Symbol 255 GraphicUses:254Used by:322
Symbol 256 BitmapUsed by:257
Symbol 257 GraphicUses:256Used by:322
Symbol 258 BitmapUsed by:259
Symbol 259 GraphicUses:258Used by:322
Symbol 260 BitmapUsed by:261
Symbol 261 GraphicUses:260Used by:322
Symbol 262 BitmapUsed by:263
Symbol 263 GraphicUses:262Used by:322
Symbol 264 BitmapUsed by:265
Symbol 265 GraphicUses:264Used by:322
Symbol 266 BitmapUsed by:267
Symbol 267 GraphicUses:266Used by:322
Symbol 268 BitmapUsed by:269
Symbol 269 GraphicUses:268Used by:322
Symbol 270 BitmapUsed by:271
Symbol 271 GraphicUses:270Used by:322
Symbol 272 BitmapUsed by:273
Symbol 273 GraphicUses:272Used by:322
Symbol 274 BitmapUsed by:275
Symbol 275 GraphicUses:274Used by:322
Symbol 276 BitmapUsed by:277
Symbol 277 GraphicUses:276Used by:322
Symbol 278 BitmapUsed by:279
Symbol 279 GraphicUses:278Used by:322
Symbol 280 BitmapUsed by:281
Symbol 281 GraphicUses:280Used by:322
Symbol 282 BitmapUsed by:283
Symbol 283 GraphicUses:282Used by:322
Symbol 284 BitmapUsed by:285
Symbol 285 GraphicUses:284Used by:322
Symbol 286 BitmapUsed by:287
Symbol 287 GraphicUses:286Used by:322
Symbol 288 BitmapUsed by:289
Symbol 289 GraphicUses:288Used by:322
Symbol 290 BitmapUsed by:291
Symbol 291 GraphicUses:290Used by:322
Symbol 292 BitmapUsed by:293
Symbol 293 GraphicUses:292Used by:322
Symbol 294 BitmapUsed by:295
Symbol 295 GraphicUses:294Used by:322
Symbol 296 BitmapUsed by:297
Symbol 297 GraphicUses:296Used by:322
Symbol 298 BitmapUsed by:299
Symbol 299 GraphicUses:298Used by:322
Symbol 300 BitmapUsed by:301
Symbol 301 GraphicUses:300Used by:322
Symbol 302 BitmapUsed by:303
Symbol 303 GraphicUses:302Used by:322
Symbol 304 BitmapUsed by:305
Symbol 305 GraphicUses:304Used by:322
Symbol 306 BitmapUsed by:307
Symbol 307 GraphicUses:306Used by:322
Symbol 308 BitmapUsed by:309
Symbol 309 GraphicUses:308Used by:322
Symbol 310 BitmapUsed by:311
Symbol 311 GraphicUses:310Used by:322
Symbol 312 BitmapUsed by:313
Symbol 313 GraphicUses:312Used by:322
Symbol 314 BitmapUsed by:315
Symbol 315 GraphicUses:314Used by:322
Symbol 316 BitmapUsed by:317
Symbol 317 GraphicUses:316Used by:322
Symbol 318 BitmapUsed by:319
Symbol 319 GraphicUses:318Used by:322
Symbol 320 BitmapUsed by:321
Symbol 321 GraphicUses:320Used by:322
Symbol 322 MovieClip {mExp1}Uses:251 253 255 257 259 261 263 265 267 269 271 273 275 277 279 281 283 285 287 289 291 293 295 297 299 301 303 305 307 309 311 313 315 317 319 321Used by:Timeline
Symbol 323 GraphicUsed by:324
Symbol 324 MovieClip {mHoop}Uses:323Used by:Timeline
Symbol 325 GraphicUsed by:328
Symbol 326 GraphicUsed by:328
Symbol 327 GraphicUsed by:328
Symbol 328 MovieClip {mFon}Uses:325 326 327Used by:Timeline
Symbol 329 FontUsed by:330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
Symbol 330 TextUses:329Used by:348 352
Symbol 331 TextUses:329Used by:348 352
Symbol 332 TextUses:329Used by:348 352
Symbol 333 TextUses:329Used by:348 352
Symbol 334 TextUses:329Used by:348 352
Symbol 335 TextUses:329Used by:348 352
Symbol 336 TextUses:329Used by:348 352
Symbol 337 TextUses:329Used by:348 352
Symbol 338 TextUses:329Used by:348 351
Symbol 339 TextUses:329Used by:348 349 350 351
Symbol 340 TextUses:329Used by:348 351
Symbol 341 TextUses:329Used by:348 351
Symbol 342 TextUses:329Used by:348 351
Symbol 343 TextUses:329Used by:348 350
Symbol 344 TextUses:329Used by:348 350
Symbol 345 TextUses:329Used by:348 349 350
Symbol 346 TextUses:329Used by:348 350
Symbol 347 TextUses:329Used by:348 349
Symbol 348 ButtonUses:330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347Used by:353
Symbol 349 MovieClipUses:339 345 347Used by:353
Symbol 350 MovieClipUses:343 339 344 345 346Used by:353
Symbol 351 MovieClipUses:338 339 340 341 342Used by:353
Symbol 352 MovieClipUses:330 331 332 333 334 335 336 337Used by:353
Symbol 353 MovieClipUses:348 349 350 351 352Used by:370
Symbol 354 GraphicUsed by:366 367 369
Symbol 355 GraphicUsed by:367 369
Symbol 356 GraphicUsed by:357
Symbol 357 MovieClipUses:356Used by:367
Symbol 358 GraphicUsed by:359 369
Symbol 359 MovieClipUses:358Used by:367
Symbol 360 GraphicUsed by:361 369
Symbol 361 MovieClipUses:360Used by:367
Symbol 362 GraphicUsed by:363 369
Symbol 363 MovieClipUses:362Used by:367
Symbol 364 GraphicUsed by:365 369
Symbol 365 MovieClipUses:364Used by:367
Symbol 366 MovieClipUses:354Used by:367
Symbol 367 MovieClipUses:354 355 357 359 361 363 365 366Used by:370
Symbol 368 GraphicUsed by:369
Symbol 369 ButtonUses:368 358 364 360 362 354 355Used by:370
Symbol 370 MovieClip {MaxGames_MAXLOGOINTRO1}Uses:353 367 369 SS1Used by:Timeline
Symbol 371 BitmapUsed by:372
Symbol 372 GraphicUses:371Used by:373
Symbol 373 MovieClip {mSmallSponsorLogo}Uses:372Used by:Timeline
Symbol 374 GraphicUsed by:Timeline
Streaming Sound 1Used by:Symbol 370 MovieClip {MaxGames_MAXLOGOINTRO1}

Instance Names

"colorBar"Symbol 11 MovieClip {src.mPreloader} Frame 1Symbol 6 MovieClip {mColorBar}
"adBox"Symbol 11 MovieClip {src.mPreloader} Frame 1Symbol 8 MovieClip {mAdBox}
"clickText"Symbol 11 MovieClip {src.mPreloader} Frame 1Symbol 10 EditableText
"text"Symbol 27 MovieClip {src.interfaces.mEdit} Frame 1Symbol 25 EditableText
"caption"Symbol 27 MovieClip {src.interfaces.mEdit} Frame 1Symbol 26 EditableText
"lineWidth"Symbol 97 MovieClip {mDistJointMovie} Frame 1Symbol 96 MovieClip {mDistJointWidth}
"lineWidth"Symbol 109 MovieClip {mSpringJointMovie} Frame 1Symbol 108 MovieClip {mSpringJointWidth}
"bombTimer"Symbol 249 MovieClip {src.units.mBomb} Frame 1Symbol 248 MovieClip {mBombTimer}

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata not present, AS3.




http://swfchan.com/20/99897/info.shtml
Created: 21/3 -2019 15:02:42 Last modified: 21/3 -2019 15:02:42 Server time: 22/12 -2024 09:18:22