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

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

Gen.swf

This is the info page for
Flash #99613

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


ActionScript [AS3]
Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2CircleDef extends b2ShapeDef { public var radius:Number; public var localPosition:b2Vec2; public function b2CircleDef(){ localPosition = new b2Vec2(0, 0); super(); type = b2Shape.e_circleShape; radius = 1; } } }//package Box2D.Collision.Shapes
Section 2
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2CircleShape extends b2Shape { public var m_localPosition:b2Vec2; public var m_radius:Number; public function b2CircleShape(_arg1:b2ShapeDef){ m_localPosition = new b2Vec2(); super(_arg1); var _local2:b2CircleDef = (_arg1 as b2CircleDef); m_type = e_circleShape; m_localPosition.SetV(_local2.localPosition); m_radius = _local2.radius; } override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{ var _local10:Number; var _local6:b2Mat22 = _arg1.R; var _local7:Number = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y))); var _local8:Number = (_arg1.position.y + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y))); var _local9:Number = (_arg4.p1.x - _local7); _local10 = (_arg4.p1.y - _local8); var _local11:Number = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius)); if (_local11 < 0){ _arg2[0] = 0; return (e_startsInsideCollide); }; var _local12:Number = (_arg4.p2.x - _arg4.p1.x); var _local13:Number = (_arg4.p2.y - _arg4.p1.y); var _local14:Number = ((_local9 * _local12) + (_local10 * _local13)); var _local15:Number = ((_local12 * _local12) + (_local13 * _local13)); var _local16:Number = ((_local14 * _local14) - (_local15 * _local11)); if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){ return (e_missCollide); }; var _local17:Number = -((_local14 + Math.sqrt(_local16))); if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){ _local17 = (_local17 / _local15); _arg2[0] = _local17; _arg3.x = (_local9 + (_local17 * _local12)); _arg3.y = (_local10 + (_local17 * _local13)); _arg3.Normalize(); return (e_hitCollide); }; return (e_missCollide); } override public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2XForm, _arg4:b2Vec2):Number{ var _local5:b2Vec2 = b2Math.b2MulX(_arg3, m_localPosition); var _local6:Number = -((b2Math.b2Dot(_arg1, _local5) - _arg2)); if (_local6 < (-(m_radius) + Number.MIN_VALUE)){ return (0); }; if (_local6 > m_radius){ _arg4.SetV(_local5); return (((b2Settings.b2_pi * m_radius) * m_radius)); }; var _local7:Number = (m_radius * m_radius); var _local8:Number = (_local6 * _local6); var _local9:Number = ((_local7 * (Math.asin((_local6 / m_radius)) + (b2Settings.b2_pi / 2))) + (_local6 * Math.sqrt((_local7 - _local8)))); var _local10:Number = (((-2 / 3) * Math.pow((_local7 - _local8), 1.5)) / _local9); _arg4.x = (_local5.x + (_arg1.x * _local10)); _arg4.y = (_local5.y + (_arg1.y * _local10)); return (_local9); } public function GetLocalPosition():b2Vec2{ return (m_localPosition); } public function GetRadius():Number{ return (m_radius); } override public function ComputeMass(_arg1:b2MassData):void{ _arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius); _arg1.center.SetV(m_localPosition); _arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y)))); } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2Mat22; _local4 = _arg2.R; var _local5:Number = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y))); var _local6:Number = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y))); _local4 = _arg3.R; var _local7:Number = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y))); var _local8:Number = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y))); _arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius)); _arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius)); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:Number = (m_localPosition.x - _arg1.x); var _local3:Number = (m_localPosition.y - _arg1.y); _local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3))); m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop); } override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22 = _arg2.R; var _local4:Number = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y))); var _local5:Number = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y))); _arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius)); _arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius)); } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local3:b2Mat22 = _arg1.R; var _local4:Number = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y))); var _local5:Number = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y))); _local4 = (_arg2.x - _local4); _local5 = (_arg2.y - _local5); return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius))); } } }//package Box2D.Collision.Shapes
Section 3
//b2FilterData (Box2D.Collision.Shapes.b2FilterData) package Box2D.Collision.Shapes { public class b2FilterData { public var maskBits:uint;// = 0xFFFF public var groupIndex:int;// = 0 public var categoryBits:uint;// = 1 public function Copy():b2FilterData{ var _local1:b2FilterData = new b2FilterData(); _local1.categoryBits = categoryBits; _local1.maskBits = maskBits; _local1.groupIndex = groupIndex; return (_local1); } } }//package Box2D.Collision.Shapes
Section 4
//b2MassData (Box2D.Collision.Shapes.b2MassData) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2MassData { public var mass:Number;// = 0 public var center:b2Vec2; public var I:Number;// = 0 public function b2MassData(){ center = new b2Vec2(0, 0); super(); } } }//package Box2D.Collision.Shapes
Section 5
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PolygonDef extends b2ShapeDef { public var vertices:Array; public var vertexCount:int; private static var s_mat:b2Mat22 = new b2Mat22(); public function b2PolygonDef(){ vertices = new Array(b2Settings.b2_maxPolygonVertices); super(); type = b2Shape.e_polygonShape; vertexCount = 0; var _local1:int; while (_local1 < b2Settings.b2_maxPolygonVertices) { vertices[_local1] = new b2Vec2(); _local1++; }; } public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{ var _local5:b2Vec2; var _local6:b2Mat22; var _local7:int; vertexCount = 4; vertices[0].Set(-(_arg1), -(_arg2)); vertices[1].Set(_arg1, -(_arg2)); vertices[2].Set(_arg1, _arg2); vertices[3].Set(-(_arg1), _arg2); if (_arg3){ _local5 = _arg3; _local6 = s_mat; _local6.Set(_arg4); _local7 = 0; while (_local7 < vertexCount) { _arg3 = vertices[_local7]; _arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y))); _arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y))); _arg3.x = _arg1; _local7++; }; }; } public function SetAsBox(_arg1:Number, _arg2:Number):void{ vertexCount = 4; vertices[0].Set(-(_arg1), -(_arg2)); vertices[1].Set(_arg1, -(_arg2)); vertices[2].Set(_arg1, _arg2); vertices[3].Set(-(_arg1), _arg2); } } }//package Box2D.Collision.Shapes
Section 6
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2PolygonShape extends b2Shape { public var m_coreVertices:Array; public var m_vertices:Array; private var s_supportVec:b2Vec2; public var m_centroid:b2Vec2; public var m_normals:Array; public var m_obb:b2OBB; public var m_vertexCount:int; private static var s_computeMat:b2Mat22 = new b2Mat22(); private static var s_sweptAABB1:b2AABB = new b2AABB(); private static var s_sweptAABB2:b2AABB = new b2AABB(); public function b2PolygonShape(_arg1:b2ShapeDef){ var _local3:int; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; s_supportVec = new b2Vec2(); m_obb = new b2OBB(); m_vertices = new Array(b2Settings.b2_maxPolygonVertices); m_normals = new Array(b2Settings.b2_maxPolygonVertices); m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices); super(_arg1); m_type = e_polygonShape; var _local2:b2PolygonDef = (_arg1 as b2PolygonDef); m_vertexCount = _local2.vertexCount; var _local4:int = _local3; var _local5:int = _local3; _local3 = 0; while (_local3 < m_vertexCount) { m_vertices[_local3] = _local2.vertices[_local3].Copy(); _local3++; }; _local3 = 0; while (_local3 < m_vertexCount) { _local4 = _local3; _local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0; _local6 = (m_vertices[_local5].x - m_vertices[_local4].x); _local7 = (m_vertices[_local5].y - m_vertices[_local4].y); _local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7))); m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8)); _local3++; }; m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount); ComputeOBB(m_obb, m_vertices, m_vertexCount); _local3 = 0; while (_local3 < m_vertexCount) { _local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1); _local5 = _local3; _local9 = m_normals[_local4].x; _local10 = m_normals[_local4].y; _local11 = m_normals[_local5].x; _local12 = m_normals[_local5].y; _local13 = (m_vertices[_local3].x - m_centroid.x); _local14 = (m_vertices[_local3].y - m_centroid.y); _local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop); _local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop); _local17 = (1 / ((_local9 * _local12) - (_local10 * _local11))); m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y)); _local3++; }; } override public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2XForm, _arg4:b2Vec2):Number{ var _local13:int; var _local22:b2Vec2; var _local24:Boolean; var _local25:b2MassData; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local5:b2Vec2 = b2Math.b2MulTMV(_arg3.R, _arg1); var _local6:Number = (_arg2 - b2Math.b2Dot(_arg1, _arg3.position)); var _local7:Array = []; var _local8:int; var _local9 = -1; var _local10 = -1; var _local11:b2Vec2; var _local12:Boolean; _local13 = 0; while (_local13 < m_vertexCount) { _local11 = m_vertices[_local13]; _local7[_local13] = (((_local5.x * _local11.x) + (_local5.y * _local11.y)) - _local6); _local24 = (_local7[_local13] < -(Number.MIN_VALUE)); if (_local13 > 0){ if (_local24){ if (!_local12){ _local9 = (_local13 - 1); _local8++; }; } else { if (_local12){ _local10 = (_local13 - 1); _local8++; }; }; }; _local12 = _local24; _local13++; }; switch (_local8){ case 0: if (_local12){ _local25 = new b2MassData(); ComputeMass(_local25); _arg4.SetV(b2Math.b2MulX(_arg3, _local25.center)); return ((_local25.mass / m_density)); }; return (0); case 1: if (_local9 == -1){ _local9 = (m_vertexCount - 1); } else { _local10 = (m_vertexCount - 1); }; break; }; var _local14:int = ((_local9 + 1) % m_vertexCount); var _local15:int = ((_local10 + 1) % m_vertexCount); var _local16:Number = ((0 - _local7[_local9]) / (_local7[_local14] - _local7[_local9])); var _local17:Number = ((0 - _local7[_local10]) / (_local7[_local15] - _local7[_local10])); var _local18:b2Vec2 = new b2Vec2(((m_vertices[_local9].x * (1 - _local16)) + (m_vertices[_local14].x * _local16)), ((m_vertices[_local9].y * (1 - _local16)) + (m_vertices[_local14].y * _local16))); var _local19:b2Vec2 = new b2Vec2(((m_vertices[_local10].x * (1 - _local17)) + (m_vertices[_local15].x * _local17)), ((m_vertices[_local10].y * (1 - _local17)) + (m_vertices[_local15].y * _local17))); var _local20:Number = 0; _arg4.Set(0, 0); var _local21:b2Vec2 = m_vertices[_local14]; var _local23:Number = (1 / 3); _local13 = _local14; while (_local13 != _local15) { _local13 = ((_local13 + 1) % m_vertexCount); if (_local13 == _local15){ _local22 = _local19; } else { _local22 = m_vertices[_local13]; }; _local26 = (_local21.x - _local18.x); _local27 = (_local21.y - _local18.y); _local28 = (_local22.x - _local18.x); _local29 = (_local22.y - _local18.y); _local30 = ((_local26 * _local29) - (_local27 * _local28)); _local31 = (0.5 * _local30); _local20 = (_local20 + _local31); _arg4.x = (_arg4.x + ((_local31 * _local23) * ((_local18.x + _local21.x) + _local22.x))); _arg4.y = (_arg4.y + ((_local31 * _local23) * ((_local18.y + _local21.y) + _local22.y))); _local21 = _local22; }; _arg4.x = (_arg4.x / _local20); _arg4.y = (_arg4.y / _local20); _arg4.SetV(b2Math.b2MulX(_arg3, _arg4)); return (_local20); } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2AABB = s_sweptAABB1; var _local5:b2AABB = s_sweptAABB2; ComputeAABB(_local4, _arg2); ComputeAABB(_local5, _arg3); _arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y); _arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y); } public function GetVertices():Array{ return (m_vertices); } public function GetCoreVertices():Array{ return (m_coreVertices); } public function GetCentroid():b2Vec2{ return (m_centroid); } public function GetOBB():b2OBB{ return (m_obb); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, m_coreVertices[0])); } public function Centroid(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, m_centroid)); } override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{ var _local8:Number; var _local9:Number; var _local10:b2Mat22; var _local11:b2Vec2; var _local20:Number; var _local21:Number; var _local6:Number = 0; var _local7:Number = _arg5; _local8 = (_arg4.p1.x - _arg1.position.x); _local9 = (_arg4.p1.y - _arg1.position.y); _local10 = _arg1.R; var _local12:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); var _local13:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); _local8 = (_arg4.p2.x - _arg1.position.x); _local9 = (_arg4.p2.y - _arg1.position.y); _local10 = _arg1.R; var _local14:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); var _local15:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); var _local16:Number = (_local14 - _local12); var _local17:Number = (_local15 - _local13); var _local18 = -1; var _local19:int; while (_local19 < m_vertexCount) { _local11 = m_vertices[_local19]; _local8 = (_local11.x - _local12); _local9 = (_local11.y - _local13); _local11 = m_normals[_local19]; _local20 = ((_local11.x * _local8) + (_local11.y * _local9)); _local21 = ((_local11.x * _local16) + (_local11.y * _local17)); if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){ _local6 = (_local20 / _local21); _local18 = _local19; } else { if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){ _local7 = (_local20 / _local21); }; }; if (_local7 < _local6){ return (e_missCollide); }; _local19++; }; if (_local18 >= 0){ _arg2[0] = _local6; _local10 = _arg1.R; _local11 = m_normals[_local18]; _arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); return (e_hitCollide); }; _arg2[0] = 0; return (e_startsInsideCollide); } override public function ComputeMass(_arg1:b2MassData):void{ var _local10:b2Vec2; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local2:Number = 0; var _local3:Number = 0; var _local4:Number = 0; var _local5:Number = 0; var _local6:Number = 0; var _local7:Number = 0; var _local8:Number = (1 / 3); var _local9:int; while (_local9 < m_vertexCount) { _local10 = m_vertices[_local9]; _local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0]; _local12 = (_local10.x - _local6); _local13 = (_local10.y - _local7); _local14 = (_local11.x - _local6); _local15 = (_local11.y - _local7); _local16 = ((_local12 * _local15) - (_local13 * _local14)); _local17 = (0.5 * _local16); _local4 = (_local4 + _local17); _local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x))); _local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y))); _local18 = _local6; _local19 = _local7; _local20 = _local12; _local21 = _local13; _local22 = _local14; _local23 = _local15; _local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18)); _local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19)); _local5 = (_local5 + (_local16 * (_local24 + _local25))); _local9++; }; _arg1.mass = (m_density * _local4); _local2 = (_local2 * (1 / _local4)); _local3 = (_local3 * (1 / _local4)); _arg1.center.Set(_local2, _local3); _arg1.I = (m_density * _local5); } public function GetNormals():Array{ return (m_normals); } public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:b2Vec2; var _local5:b2Mat22; var _local11:Number; _local5 = _arg1.R; var _local6:Number = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y)); var _local7:Number = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y)); var _local8:int; _local4 = m_coreVertices[0]; var _local9:Number = ((_local4.x * _local6) + (_local4.y * _local7)); var _local10 = 1; while (_local10 < m_vertexCount) { _local4 = m_coreVertices[_local10]; _local11 = ((_local4.x * _local6) + (_local4.y * _local7)); if (_local11 > _local9){ _local8 = _local10; _local9 = _local11; }; _local10++; }; _local5 = _arg1.R; _local4 = m_coreVertices[_local8]; s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y))); s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y))); return (s_supportVec); } public function GetVertexCount():int{ return (m_vertexCount); } override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22; var _local4:b2Vec2; var _local5:b2Mat22 = s_computeMat; _local3 = _arg2.R; _local4 = m_obb.R.col1; _local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local4 = m_obb.R.col2; _local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local5.Abs(); var _local6:b2Mat22 = _local5; _local4 = m_obb.extents; var _local7:Number = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y)); var _local8:Number = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y)); _local3 = _arg2.R; _local4 = m_obb.center; var _local9:Number = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y))); var _local10:Number = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y))); _arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8)); _arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8)); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:b2Vec2; var _local4:Number; var _local5:Number; m_sweepRadius = 0; var _local3:int; while (_local3 < m_vertexCount) { _local2 = m_coreVertices[_local3]; _local4 = (_local2.x - _arg1.x); _local5 = (_local2.y - _arg1.y); _local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5))); if (_local4 > m_sweepRadius){ m_sweepRadius = _local4; }; _local3++; }; } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local3:b2Vec2; var _local10:Number; var _local4:b2Mat22 = _arg1.R; var _local5:Number = (_arg2.x - _arg1.position.x); var _local6:Number = (_arg2.y - _arg1.position.y); var _local7:Number = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y)); var _local8:Number = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y)); var _local9:int; while (_local9 < m_vertexCount) { _local3 = m_vertices[_local9]; _local5 = (_local7 - _local3.x); _local6 = (_local8 - _local3.y); _local3 = m_normals[_local9]; _local10 = ((_local3.x * _local5) + (_local3.y * _local6)); if (_local10 > 0){ return (false); }; _local9++; }; return (true); } public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{ var _local3:b2Vec2; var _local7:Number; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; _local3 = new b2Vec2(); var _local4:Number = 0; var _local5:Number = 0; var _local6:Number = 0; _local7 = (1 / 3); var _local8:int; while (_local8 < _arg2) { _local9 = _arg1[_local8]; _local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0]; _local11 = (_local9.x - _local5); _local12 = (_local9.y - _local6); _local13 = (_local10.x - _local5); _local14 = (_local10.y - _local6); _local15 = ((_local11 * _local14) - (_local12 * _local13)); _local16 = (0.5 * _local15); _local4 = (_local4 + _local16); _local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x))); _local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y))); _local8++; }; _local3.x = (_local3.x * (1 / _local4)); _local3.y = (_local3.y * (1 / _local4)); return (_local3); } public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{ var _local4:int; var _local7:b2Vec2; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:int; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:b2Mat22; var _local5:Array = new Array((b2Settings.b2_maxPolygonVertices + 1)); _local4 = 0; while (_local4 < _arg3) { _local5[_local4] = _arg2[_local4]; _local4++; }; _local5[_arg3] = _local5[0]; var _local6:Number = Number.MAX_VALUE; _local4 = 1; while (_local4 <= _arg3) { _local7 = _local5[int((_local4 - 1))]; _local8 = (_local5[_local4].x - _local7.x); _local9 = (_local5[_local4].y - _local7.y); _local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); _local8 = (_local8 / _local10); _local9 = (_local9 / _local10); _local11 = -(_local9); _local12 = _local8; _local13 = Number.MAX_VALUE; _local14 = Number.MAX_VALUE; _local15 = -(Number.MAX_VALUE); _local16 = -(Number.MAX_VALUE); _local17 = 0; while (_local17 < _arg3) { _local19 = (_local5[_local17].x - _local7.x); _local20 = (_local5[_local17].y - _local7.y); _local21 = ((_local8 * _local19) + (_local9 * _local20)); _local22 = ((_local11 * _local19) + (_local12 * _local20)); if (_local21 < _local13){ _local13 = _local21; }; if (_local22 < _local14){ _local14 = _local22; }; if (_local21 > _local15){ _local15 = _local21; }; if (_local22 > _local16){ _local16 = _local22; }; _local17++; }; _local18 = ((_local15 - _local13) * (_local16 - _local14)); if (_local18 < (0.95 * _local6)){ _local6 = _local18; _arg1.R.col1.x = _local8; _arg1.R.col1.y = _local9; _arg1.R.col2.x = _local11; _arg1.R.col2.y = _local12; _local23 = (0.5 * (_local13 + _local15)); _local24 = (0.5 * (_local14 + _local16)); _local25 = _arg1.R; _arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24))); _arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24))); _arg1.extents.x = (0.5 * (_local15 - _local13)); _arg1.extents.y = (0.5 * (_local16 - _local14)); }; _local4++; }; } } }//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; public class b2Shape { public var m_next:b2Shape; public var m_type:int; public var m_sweepRadius:Number; public var m_density:Number; public var m_filter:b2FilterData; public var m_friction:Number; public var m_isSensor:Boolean; public var m_restitution:Number; public var m_userData; public var m_proxyId:uint; public var m_body:b2Body; public static const e_polygonShape:int = 1; public static const e_hitCollide:int = 1; public static const e_missCollide:int = 0; public static const e_unknownShape:int = -1; public static const e_circleShape:int = 0; public static const e_shapeTypeCount:int = 2; public static const e_startsInsideCollide:int = -1; private static var s_resetAABB:b2AABB = new b2AABB(); private static var s_syncAABB:b2AABB = new b2AABB(); private static var s_proxyAABB:b2AABB = new b2AABB(); public function b2Shape(_arg1:b2ShapeDef){ m_userData = _arg1.userData; m_friction = _arg1.friction; m_restitution = _arg1.restitution; m_density = _arg1.density; m_body = null; m_sweepRadius = 0; m_next = null; m_proxyId = b2Pair.b2_nullProxy; m_filter = _arg1.filter.Copy(); m_isSensor = _arg1.isSensor; } public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2XForm, _arg4:b2Vec2):Number{ return (0); } public function SetUserData(_arg1):void{ m_userData = _arg1; } public function GetSweepRadius():Number{ return (m_sweepRadius); } public function GetNext():b2Shape{ return (m_next); } public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ } public function GetType():int{ return (m_type); } public function GetRestitution():Number{ return (m_restitution); } public function GetFriction():Number{ return (m_friction); } public function GetFilterData():b2FilterData{ return (m_filter.Copy()); } public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{ return (e_missCollide); } public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ if (m_proxyId == b2Pair.b2_nullProxy){ return; }; _arg1.DestroyProxy(m_proxyId); var _local3:b2AABB = s_resetAABB; ComputeAABB(_local3, _arg2); var _local4:Boolean = _arg1.InRange(_local3); if (_local4){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function SetFilterData(_arg1:b2FilterData):void{ m_filter = _arg1.Copy(); } public function GetUserData(){ return (m_userData); } public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{ if (m_proxyId == b2Pair.b2_nullProxy){ return (false); }; var _local4:b2AABB = s_syncAABB; ComputeSweptAABB(_local4, _arg2, _arg3); if (_arg1.InRange(_local4)){ _arg1.MoveProxy(m_proxyId, _local4); return (true); }; return (false); } public function ComputeMass(_arg1:b2MassData):void{ } public function IsSensor():Boolean{ return (m_isSensor); } public function DestroyProxy(_arg1:b2BroadPhase):void{ if (m_proxyId != b2Pair.b2_nullProxy){ _arg1.DestroyProxy(m_proxyId); m_proxyId = b2Pair.b2_nullProxy; }; } public function UpdateSweepRadius(_arg1:b2Vec2):void{ } public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ } public function GetBody():b2Body{ return (m_body); } public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ var _local3:b2AABB = s_proxyAABB; ComputeAABB(_local3, _arg2); var _local4:Boolean = _arg1.InRange(_local3); if (_local4){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ return (false); } public static function Destroy(_arg1:b2Shape, _arg2):void{ } public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{ switch (_arg1.type){ case e_circleShape: return (new b2CircleShape(_arg1)); case e_polygonShape: return (new b2PolygonShape(_arg1)); default: return (null); }; } } }//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef) package Box2D.Collision.Shapes { public class b2ShapeDef { public var friction:Number;// = 0.2 public var isSensor:Boolean;// = false public var density:Number;// = 0 public var restitution:Number;// = 0 public var userData;// = null public var filter:b2FilterData; public var type:int; public function b2ShapeDef(){ type = b2Shape.e_unknownShape; filter = new b2FilterData(); super(); } } }//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2AABB { public var upperBound:b2Vec2; public var lowerBound:b2Vec2; public function b2AABB(){ lowerBound = new b2Vec2(); upperBound = new b2Vec2(); super(); } public function IsValid():Boolean{ var _local1:Number = (upperBound.x - lowerBound.x); var _local2:Number = (upperBound.y - lowerBound.y); var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0))); _local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid())); return (_local3); } } }//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound) package Box2D.Collision { public class b2Bound { public var value:uint; public var proxyId:uint; public var stabbingCount:uint; public function Swap(_arg1:b2Bound):void{ var _local2:uint = value; var _local3:uint = proxyId; var _local4:uint = stabbingCount; value = _arg1.value; proxyId = _arg1.proxyId; stabbingCount = _arg1.stabbingCount; _arg1.value = _local2; _arg1.proxyId = _local3; _arg1.stabbingCount = _local4; } public function IsLower():Boolean{ return (((value & 1) == 0)); } public function IsUpper():Boolean{ return (((value & 1) == 1)); } } }//package Box2D.Collision
Section 11
//b2BoundValues (Box2D.Collision.b2BoundValues) package Box2D.Collision { public class b2BoundValues { public var lowerValues:Array; public var upperValues:Array; public function b2BoundValues(){ lowerValues = [0, 0]; upperValues = [0, 0]; super(); } } }//package Box2D.Collision
Section 12
//b2BroadPhase (Box2D.Collision.b2BroadPhase) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2BroadPhase { public var m_bounds:Array; public var m_worldAABB:b2AABB; public var m_querySortKeys:Array; public var m_freeProxy:uint; public var m_quantizationFactor:b2Vec2; public var m_proxyCount:int; public var m_proxyPool:Array; public var m_queryResultCount:int; public var m_pairManager:b2PairManager; public var m_timeStamp:uint; public var m_queryResults:Array; public static const b2_nullEdge:uint = 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 _local6:b2Proxy; var _local7:int; m_pairManager = new b2PairManager(); m_proxyPool = new Array(b2Settings.b2_maxPairs); m_bounds = new Array((2 * b2Settings.b2_maxProxies)); m_querySortKeys = new Array(b2Settings.b2_maxProxies); m_queryResults = new Array(b2Settings.b2_maxProxies); m_quantizationFactor = new b2Vec2(); super(); m_pairManager.Initialize(this, _arg2); m_worldAABB = _arg1; m_proxyCount = 0; _local3 = 0; while (_local3 < b2Settings.b2_maxProxies) { m_queryResults[_local3] = 0; m_querySortKeys[_local3] = 0; _local3++; }; m_bounds = new Array(2); _local3 = 0; while (_local3 < 2) { m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies)); _local7 = 0; while (_local7 < (2 * b2Settings.b2_maxProxies)) { m_bounds[_local3][_local7] = new b2Bound(); _local7++; }; _local3++; }; var _local4:Number = (_arg1.upperBound.x - _arg1.lowerBound.x); var _local5:Number = (_arg1.upperBound.y - _arg1.lowerBound.y); m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4); m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5); _local3 = 0; while (_local3 < (b2Settings.b2_maxProxies - 1)) { _local6 = new b2Proxy(); m_proxyPool[_local3] = _local6; _local6.SetNext((_local3 + 1)); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; _local3++; }; _local6 = new b2Proxy(); m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6; _local6.SetNext(b2Pair.b2_nullProxy); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; m_freeProxy = 0; m_timeStamp = 1; m_queryResultCount = 0; } public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{ var _local6:uint; var _local7:uint; var _local12:b2Proxy; var _local4:Array = new Array(); var _local5:Array = new Array(); ComputeBounds(_local4, _local5, _arg1); var _local8:Array = [_local6]; var _local9:Array = [_local7]; Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0); Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1); var _local10:int; var _local11:int; while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) { _local12 = m_proxyPool[m_queryResults[_local11]]; _arg2[_local11] = _local12.userData; _local11++; _local10++; }; m_queryResultCount = 0; IncrementTimeStamp(); return (_local10); } public function Commit():void{ m_pairManager.Commit(); } public function GetProxy(_arg1:int):b2Proxy{ var _local2:b2Proxy = m_proxyPool[_arg1]; if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){ return (null); }; return (_local2); } private function IncrementTimeStamp():void{ var _local1:uint; if (m_timeStamp == b2Settings.USHRT_MAX){ _local1 = 0; while (_local1 < b2Settings.b2_maxProxies) { (m_proxyPool[_local1] as b2Proxy).timeStamp = 0; _local1++; }; m_timeStamp = 1; } else { m_timeStamp++; }; } private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{ var _local10:b2Bound; var _local12:int; var _local13:int; var _local14:b2Proxy; var _local8:uint = BinarySearch(_arg5, _arg6, _arg3); var _local9:uint = BinarySearch(_arg5, _arg6, _arg4); var _local11:uint = _local8; while (_local11 < _local9) { _local10 = _arg5[_local11]; if (_local10.IsLower()){ IncrementOverlapCount(_local10.proxyId); }; _local11++; }; if (_local8 > 0){ _local12 = (_local8 - 1); _local10 = _arg5[_local12]; _local13 = _local10.stabbingCount; while (_local13) { _local10 = _arg5[_local12]; if (_local10.IsLower()){ _local14 = m_proxyPool[_local10.proxyId]; if (_local8 <= _local14.upperBounds[_arg7]){ IncrementOverlapCount(_local10.proxyId); _local13--; }; }; _local12--; }; }; _arg1[0] = _local8; _arg2[0] = _local9; } private function AddProxyResult(_arg1:uint, _arg2:b2Proxy, _arg3:Number, _arg4:Function):void{ var _local9:Number; var _local10:uint; var _local5:Number = _arg4(_arg2.userData); if (_local5 < 0){ return; }; var _local6:Number = 0; while ((((_local6 < m_queryResultCount)) && ((m_querySortKeys[_local6] < _local5)))) { _local6++; }; var _local7:Number = _local5; var _local8:uint = _arg1; m_queryResultCount = (m_queryResultCount + 1); if (m_queryResultCount > _arg3){ m_queryResultCount = _arg3; }; while (_local6 < m_queryResultCount) { _local9 = m_querySortKeys[_local6]; _local10 = m_queryResults[_local6]; m_querySortKeys[_local6] = _local7; m_queryResults[_local6] = _local8; _local7 = _local9; _local8 = _local10; _local6++; }; } private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{ var _local4:Array; var _local5:b2Bound; var _local6:b2Bound; var _local3:int; while (_local3 < 2) { _local4 = m_bounds[_local3]; _local5 = _local4[_arg1.lowerBounds[_local3]]; _local6 = _local4[_arg2.upperBounds[_local3]]; if (_local5.value > _local6.value){ return (false); }; _local5 = _local4[_arg1.upperBounds[_local3]]; _local6 = _local4[_arg2.lowerBounds[_local3]]; if (_local5.value < _local6.value){ return (false); }; _local3++; }; return (true); } private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{ var _local4:Number = _arg3.lowerBound.x; var _local5:Number = _arg3.lowerBound.y; _local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x); _local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y); _local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x); _local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y); var _local6:Number = _arg3.upperBound.x; var _local7:Number = _arg3.upperBound.y; _local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x); _local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y); _local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x); _local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y); _arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1)); _arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1); _arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1)); _arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1); } public function CreateProxy(_arg1:b2AABB, _arg2):uint{ var _local3:uint; var _local4:b2Proxy; var _local11:Array; var _local12:uint; var _local13:uint; var _local14:Array; var _local15:Array; var _local16:Array; var _local17:int; var _local18:int; var _local19:b2Bound; var _local20:b2Bound; var _local21:b2Bound; var _local22:int; var _local23:b2Proxy; var _local5:uint = m_freeProxy; _local4 = m_proxyPool[_local5]; m_freeProxy = _local4.GetNext(); _local4.overlapCount = 0; _local4.userData = _arg2; var _local6:uint = (2 * m_proxyCount); var _local7:Array = new Array(); var _local8:Array = new Array(); ComputeBounds(_local7, _local8, _arg1); var _local9:int; while (_local9 < 2) { _local11 = m_bounds[_local9]; _local14 = [_local12]; _local15 = [_local13]; Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9); _local12 = _local14[0]; _local13 = _local15[0]; _local16 = new Array(); _local18 = (_local6 - _local13); _local17 = 0; while (_local17 < _local18) { _local16[_local17] = new b2Bound(); _local19 = _local16[_local17]; _local20 = _local11[int((_local13 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local22 = (_local13 + 2); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[int((_local22 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local16 = new Array(); _local18 = (_local13 - _local12); _local17 = 0; while (_local17 < _local18) { _local16[_local17] = new b2Bound(); _local19 = _local16[_local17]; _local20 = _local11[int((_local12 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local22 = (_local12 + 1); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[int((_local22 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local13++; _local19 = _local11[_local12]; _local20 = _local11[_local13]; _local19.value = _local7[_local9]; _local19.proxyId = _local5; _local20.value = _local8[_local9]; _local20.proxyId = _local5; _local21 = _local11[int((_local12 - 1))]; _local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount; _local21 = _local11[int((_local13 - 1))]; _local20.stabbingCount = _local21.stabbingCount; _local3 = _local12; while (_local3 < _local13) { _local21 = _local11[_local3]; _local21.stabbingCount++; _local3++; }; _local3 = _local12; while (_local3 < (_local6 + 2)) { _local19 = _local11[_local3]; _local23 = m_proxyPool[_local19.proxyId]; if (_local19.IsLower()){ _local23.lowerBounds[_local9] = _local3; } else { _local23.upperBounds[_local9] = _local3; }; _local3++; }; _local9++; }; m_proxyCount++; var _local10:int; while (_local10 < m_queryResultCount) { m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]); _local10++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); return (_local5); } public function DestroyProxy(_arg1:uint):void{ var _local2:b2Bound; var _local3:b2Bound; var _local8:Array; var _local9:uint; var _local10:uint; var _local11:uint; var _local12:uint; var _local13:Array; var _local14:int; var _local15:int; var _local16:int; var _local17:uint; var _local18:int; var _local19:b2Proxy; var _local4:b2Proxy = m_proxyPool[_arg1]; var _local5:int = (2 * m_proxyCount); var _local6:int; while (_local6 < 2) { _local8 = m_bounds[_local6]; _local9 = _local4.lowerBounds[_local6]; _local10 = _local4.upperBounds[_local6]; _local2 = _local8[_local9]; _local11 = _local2.value; _local3 = _local8[_local10]; _local12 = _local3.value; _local13 = new Array(); _local15 = ((_local10 - _local9) - 1); _local14 = 0; while (_local14 < _local15) { _local13[_local14] = new b2Bound(); _local2 = _local13[_local14]; _local3 = _local8[int(((_local9 + 1) + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = _local13.length; _local16 = _local9; _local14 = 0; while (_local14 < _local15) { _local3 = _local13[_local14]; _local2 = _local8[int((_local16 + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local13 = new Array(); _local15 = ((_local5 - _local10) - 1); _local14 = 0; while (_local14 < _local15) { _local13[_local14] = new b2Bound(); _local2 = _local13[_local14]; _local3 = _local8[int(((_local10 + 1) + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = _local13.length; _local16 = (_local10 - 1); _local14 = 0; while (_local14 < _local15) { _local3 = _local13[_local14]; _local2 = _local8[int((_local16 + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = (_local5 - 2); _local17 = _local9; while (_local17 < _local15) { _local2 = _local8[_local17]; _local19 = m_proxyPool[_local2.proxyId]; if (_local2.IsLower()){ _local19.lowerBounds[_local6] = _local17; } else { _local19.upperBounds[_local6] = _local17; }; _local17++; }; _local15 = (_local10 - 1); _local18 = _local9; while (_local18 < _local15) { _local2 = _local8[_local18]; _local2.stabbingCount--; _local18++; }; Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6); _local6++; }; var _local7:int; while (_local7 < m_queryResultCount) { m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]); _local7++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); _local4.userData = null; _local4.overlapCount = b2_invalid; _local4.lowerBounds[0] = b2_invalid; _local4.lowerBounds[1] = b2_invalid; _local4.upperBounds[0] = b2_invalid; _local4.upperBounds[1] = b2_invalid; _local4.SetNext(m_freeProxy); m_freeProxy = _arg1; m_proxyCount--; } public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{ var _local4:Array; var _local5:b2Bound; var _local3:int; while (_local3 < 2) { _local4 = m_bounds[_local3]; _local5 = _local4[_arg2.upperBounds[_local3]]; if (_arg1.lowerValues[_local3] > _local5.value){ return (false); }; _local5 = _local4[_arg2.lowerBounds[_local3]]; if (_arg1.upperValues[_local3] < _local5.value){ return (false); }; _local3++; }; return (true); } public function Validate():void{ var _local1:b2Pair; var _local2:b2Proxy; var _local3:b2Proxy; var _local4:Boolean; var _local6:b2Bound; var _local7:uint; var _local8:uint; var _local9:uint; var _local10:b2Bound; var _local5:int; while (_local5 < 2) { _local6 = m_bounds[_local5]; _local7 = (2 * m_proxyCount); _local8 = 0; _local9 = 0; while (_local9 < _local7) { _local10 = _local6[_local9]; if (_local10.IsLower() == true){ _local8++; } else { _local8--; }; _local9++; }; _local5++; }; } private function IncrementOverlapCount(_arg1:uint):void{ var _local2:b2Proxy = m_proxyPool[_arg1]; if (_local2.timeStamp < m_timeStamp){ _local2.timeStamp = m_timeStamp; _local2.overlapCount = 1; } else { _local2.overlapCount = 2; m_queryResults[m_queryResultCount] = _arg1; m_queryResultCount++; }; } public function InRange(_arg1:b2AABB):Boolean{ var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; _local2 = _arg1.lowerBound.x; _local3 = _arg1.lowerBound.y; _local2 = (_local2 - m_worldAABB.upperBound.x); _local3 = (_local3 - m_worldAABB.upperBound.y); _local4 = m_worldAABB.lowerBound.x; _local5 = m_worldAABB.lowerBound.y; _local4 = (_local4 - _arg1.upperBound.x); _local5 = (_local5 - _arg1.upperBound.y); _local2 = b2Math.b2Max(_local2, _local4); _local3 = b2Math.b2Max(_local3, _local5); return ((b2Math.b2Max(_local2, _local3) < 0)); } public function QuerySegment(_arg1:b2Segment, _arg2, _arg3:int, _arg4:Function):int{ var _local15:int; var _local16:int; var _local17:uint; var _local18:b2Proxy; var _local19:uint; var _local20:uint; var _local24:Number; var _local25:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:uint; var _local5:Number = 1; var _local6:Number = ((_arg1.p2.x - _arg1.p1.x) * m_quantizationFactor.x); var _local7:Number = ((_arg1.p2.y - _arg1.p1.y) * m_quantizationFactor.y); var _local8:int = ((_local6 < -(Number.MIN_VALUE))) ? -1 : ((_local6 > Number.MIN_VALUE)) ? 1 : 0; var _local9:int = ((_local7 < -(Number.MIN_VALUE))) ? -1 : ((_local7 > Number.MIN_VALUE)) ? 1 : 0; var _local10:Number = (m_quantizationFactor.x * (_arg1.p1.x - m_worldAABB.lowerBound.x)); var _local11:Number = (m_quantizationFactor.y * (_arg1.p1.y - m_worldAABB.lowerBound.y)); var _local12:Array = new Array(); var _local13:Array = new Array(); _local12[0] = (uint(_local10) & (b2Settings.USHRT_MAX - 1)); _local12[1] = (uint(_local11) & (b2Settings.USHRT_MAX - 1)); _local13[0] = (_local12[0] + 1); _local13[1] = (_local12[1] + 1); var _local14:Array = new Array(); var _local21:Array = [_local19]; var _local22:Array = [_local20]; Query(_local21, _local22, _local12[0], _local13[0], m_bounds[0], (2 * m_proxyCount), 0); if (_local8 >= 0){ _local15 = (_local22[0] - 1); } else { _local15 = _local21[0]; }; Query(_local21, _local22, _local12[1], _local13[1], m_bounds[1], (2 * m_proxyCount), 1); if (_local9 >= 0){ _local16 = (_local22[0] - 1); } else { _local16 = _local21[0]; }; if (_arg4 != null){ _local27 = 0; while (_local27 < m_queryResultCount) { m_querySortKeys[_local27] = _arg4(m_proxyPool[m_queryResults[_local27]].userData); _local27++; }; _local27 = 0; while (_local27 < (m_queryResultCount - 1)) { _local28 = m_querySortKeys[_local27]; _local29 = m_querySortKeys[(_local27 + 1)]; if (((_local28)<0) ? (_local29 >= 0) : (((_local28 > _local29)) && ((_local29 >= 0)))){ m_querySortKeys[(_local27 + 1)] = _local28; m_querySortKeys[_local27] = _local29; _local30 = m_queryResults[(_local27 + 1)]; m_queryResults[(_local27 + 1)] = m_queryResults[_local27]; m_queryResults[_local27] = _local30; --_local27; if (_local27 == -1){ _local27 = 1; }; } else { _local27++; }; }; while ((((m_queryResultCount > 0)) && ((m_querySortKeys[(m_queryResultCount - 1)] < 0)))) { m_queryResultCount--; }; }; var _local23:Boolean; if ((((_local15 < 0)) || ((_local15 >= (m_proxyCount * 2))))){ _local23 = false; }; if ((((_local16 < 0)) || ((_local16 >= (m_proxyCount * 2))))){ _local23 = false; }; if (_local23){ if (_local8 != 0){ if (_local8 > 0){ _local15++; if (_local15 == (m_proxyCount * 2)){ _local23 = false; }; } else { --_local15; if (_local15 < 0){ _local23 = false; }; }; _local24 = ((m_bounds[0][_local15].value - _local10) / _local6); }; if (_local9 != 0){ if (_local9 > 0){ _local16++; if (_local16 == (m_proxyCount * 2)){ _local23 = false; }; } else { --_local16; if (_local16 < 0){ _local23 = false; }; }; _local25 = ((m_bounds[1][_local16].value - _local11) / _local7); }; }; while (_local23) { if ((((_local9 == 0)) || (((!((_local8 == 0))) && ((_local24 < _local25)))))){ if (_local24 > _local5){ break; }; if (((_local8 > 0)) ? m_bounds[0][_local15].IsLower() : m_bounds[0][_local15].IsUpper()){ _local17 = m_bounds[0][_local15].proxyId; _local18 = m_proxyPool[_local17]; if (_local9 >= 0){ if ((((_local18.lowerBounds[1] <= (_local16 - 1))) && ((_local18.upperBounds[1] >= _local16)))){ if (_arg4 != null){ AddProxyResult(_local17, _local18, _arg3, _arg4); } else { m_queryResults[m_queryResultCount] = _local17; m_queryResultCount++; }; }; } else { if ((((_local18.lowerBounds[1] <= _local16)) && ((_local18.upperBounds[1] >= (_local16 + 1))))){ if (_arg4 != null){ AddProxyResult(_local17, _local18, _arg3, _arg4); } else { m_queryResults[m_queryResultCount] = _local17; m_queryResultCount++; }; }; }; }; if (((((((!((_arg4 == null))) && ((m_queryResultCount == _arg3)))) && ((m_queryResultCount > 0)))) && ((_local24 > m_querySortKeys[(m_queryResultCount - 1)])))){ break; }; if (_local8 > 0){ _local15++; if (_local15 == (m_proxyCount * 2)){ break; }; } else { --_local15; if (_local15 < 0){ break; }; }; _local24 = ((m_bounds[0][_local15].value - _local10) / _local6); } else { if (_local25 > _local5){ break; }; if (((_local9 > 0)) ? m_bounds[1][_local16].IsLower() : m_bounds[1][_local16].IsUpper()){ _local17 = m_bounds[1][_local16].proxyId; _local18 = m_proxyPool[_local17]; if (_local8 >= 0){ if ((((_local18.lowerBounds[0] <= (_local15 - 1))) && ((_local18.upperBounds[0] >= _local15)))){ if (_arg4 != null){ AddProxyResult(_local17, _local18, _arg3, _arg4); } else { m_queryResults[m_queryResultCount] = _local17; m_queryResultCount++; }; }; } else { if ((((_local18.lowerBounds[0] <= _local15)) && ((_local18.upperBounds[0] >= (_local15 + 1))))){ if (_arg4 != null){ AddProxyResult(_local17, _local18, _arg3, _arg4); } else { m_queryResults[m_queryResultCount] = _local17; m_queryResultCount++; }; }; }; }; if (((((((!((_arg4 == null))) && ((m_queryResultCount == _arg3)))) && ((m_queryResultCount > 0)))) && ((_local25 > m_querySortKeys[(m_queryResultCount - 1)])))){ break; }; if (_local9 > 0){ _local16++; if (_local16 == (m_proxyCount * 2)){ break; }; } else { --_local16; if (_local16 < 0){ break; }; }; _local25 = ((m_bounds[1][_local16].value - _local11) / _local7); }; }; var _local26:int; _local27 = 0; while ((((_local27 < m_queryResultCount)) && ((_local26 < _arg3)))) { _local18 = m_proxyPool[m_queryResults[_local27]]; _arg2[_local27] = _local18.userData; _local27++; _local26++; }; m_queryResultCount = 0; IncrementTimeStamp(); return (_local26); } public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{ var _local3:Array; var _local4:int; var _local5:uint; var _local6:uint; var _local7:b2Bound; var _local8:b2Bound; var _local9:b2Bound; var _local10:uint; var _local11:b2Proxy; var _local16:Array; var _local17:uint; var _local18:uint; var _local19:uint; var _local20:uint; var _local21:int; var _local22:int; var _local23:uint; var _local24:b2Proxy; if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){ return; }; if (_arg2.IsValid() == false){ return; }; var _local12:uint = (2 * m_proxyCount); var _local13:b2Proxy = m_proxyPool[_arg1]; var _local14:b2BoundValues = new b2BoundValues(); ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2); var _local15:b2BoundValues = new b2BoundValues(); _local5 = 0; while (_local5 < 2) { _local7 = m_bounds[_local5][_local13.lowerBounds[_local5]]; _local15.lowerValues[_local5] = _local7.value; _local7 = m_bounds[_local5][_local13.upperBounds[_local5]]; _local15.upperValues[_local5] = _local7.value; _local5++; }; _local5 = 0; while (_local5 < 2) { _local16 = m_bounds[_local5]; _local17 = _local13.lowerBounds[_local5]; _local18 = _local13.upperBounds[_local5]; _local19 = _local14.lowerValues[_local5]; _local20 = _local14.upperValues[_local5]; _local7 = _local16[_local17]; _local21 = (_local19 - _local7.value); _local7.value = _local19; _local7 = _local16[_local18]; _local22 = (_local20 - _local7.value); _local7.value = _local20; if (_local21 < 0){ _local6 = _local17; while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) { _local7 = _local16[_local6]; _local8 = _local16[int((_local6 - 1))]; _local23 = _local8.proxyId; _local24 = m_proxyPool[_local8.proxyId]; _local8.stabbingCount++; if (_local8.IsUpper() == true){ if (TestOverlap(_local14, _local24)){ m_pairManager.AddBufferedPair(_arg1, _local23); }; _local3 = _local24.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount++; } else { _local3 = _local24.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount--; }; _local3 = _local13.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.Swap(_local8); _local6--; }; }; if (_local22 > 0){ _local6 = _local18; while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) { _local7 = _local16[_local6]; _local9 = _local16[int((_local6 + 1))]; _local10 = _local9.proxyId; _local11 = m_proxyPool[_local10]; _local9.stabbingCount++; if (_local9.IsLower() == true){ if (TestOverlap(_local14, _local11)){ m_pairManager.AddBufferedPair(_arg1, _local10); }; _local3 = _local11.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount++; } else { _local3 = _local11.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount--; }; _local3 = _local13.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.Swap(_local9); _local6++; }; }; if (_local21 > 0){ _local6 = _local17; while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) { _local7 = _local16[_local6]; _local9 = _local16[int((_local6 + 1))]; _local10 = _local9.proxyId; _local11 = m_proxyPool[_local10]; _local9.stabbingCount--; if (_local9.IsUpper()){ if (TestOverlap(_local15, _local11)){ m_pairManager.RemoveBufferedPair(_arg1, _local10); }; _local3 = _local11.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount--; } else { _local3 = _local11.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount++; }; _local3 = _local13.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.Swap(_local9); _local6++; }; }; if (_local22 < 0){ _local6 = _local18; while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) { _local7 = _local16[_local6]; _local8 = _local16[int((_local6 - 1))]; _local23 = _local8.proxyId; _local24 = m_proxyPool[_local23]; _local8.stabbingCount--; if (_local8.IsLower() == true){ if (TestOverlap(_local15, _local24)){ m_pairManager.RemoveBufferedPair(_arg1, _local23); }; _local3 = _local24.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount--; } else { _local3 = _local24.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount++; }; _local3 = _local13.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.Swap(_local8); _local6--; }; }; _local5++; }; } public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{ var _local6:int; var _local7:b2Bound; var _local4:int; var _local5:int = (_arg2 - 1); while (_local4 <= _local5) { _local6 = ((_local4 + _local5) / 2); _local7 = _arg1[_local6]; if (_local7.value > _arg3){ _local5 = (_local6 - 1); } else { if (_local7.value < _arg3){ _local4 = (_local6 + 1); } else { return (uint(_local6)); }; }; }; return (uint(_local4)); } } }//package Box2D.Collision
Section 13
//b2BufferedPair (Box2D.Collision.b2BufferedPair) package Box2D.Collision { public class b2BufferedPair { public var proxyId1:uint; public var proxyId2:uint; } }//package Box2D.Collision
Section 14
//b2Collision (Box2D.Collision.b2Collision) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Collision { public static const b2_nullFeature:uint = 0xFF; private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2(); public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{ var _local11:b2Mat22; var _local12:b2Vec2; var _local25:Number; var _local6:int = _arg1.m_vertexCount; var _local7:Array = _arg1.m_vertices; var _local8:Array = _arg1.m_normals; var _local9:int = _arg4.m_vertexCount; var _local10:Array = _arg4.m_vertices; _local11 = _arg2.R; _local12 = _local8[_arg3]; var _local13:Number = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)); var _local14:Number = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)); _local11 = _arg5.R; var _local15:Number = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14)); var _local16:Number = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14)); var _local17:int; var _local18:Number = Number.MAX_VALUE; var _local19:int; while (_local19 < _local9) { _local12 = _local10[_local19]; _local25 = ((_local12.x * _local15) + (_local12.y * _local16)); if (_local25 < _local18){ _local18 = _local25; _local17 = _local19; }; _local19++; }; _local12 = _local7[_arg3]; _local11 = _arg2.R; var _local20:Number = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y))); var _local21:Number = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y))); _local12 = _local10[_local17]; _local11 = _arg5.R; var _local22:Number = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y))); var _local23:Number = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y))); _local22 = (_local22 - _local20); _local23 = (_local23 - _local21); var _local24:Number = ((_local22 * _local13) + (_local23 * _local14)); return (_local24); } public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{ var _local3:b2Vec2 = _arg2.lowerBound; var _local4:b2Vec2 = _arg1.upperBound; var _local5:Number = (_local3.x - _local4.x); var _local6:Number = (_local3.y - _local4.y); _local3 = _arg1.lowerBound; _local4 = _arg2.upperBound; var _local7:Number = (_local3.x - _local4.x); var _local8:Number = (_local3.y - _local4.y); if ((((_local5 > 0)) || ((_local6 > 0)))){ return (false); }; if ((((_local7 > 0)) || ((_local8 > 0)))){ return (false); }; return (true); } public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{ var _local12:b2Mat22; var _local13:b2Vec2; var _local20:ClipVertex; var _local23:Number; var _local7:int = _arg2.m_vertexCount; var _local8:Array = _arg2.m_normals; var _local9:int = _arg5.m_vertexCount; var _local10:Array = _arg5.m_vertices; var _local11:Array = _arg5.m_normals; _local12 = _arg3.R; _local13 = _local8[_arg4]; var _local14:Number = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)); var _local15:Number = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)); _local12 = _arg6.R; var _local16:Number = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15)); _local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15)); _local14 = _local16; var _local17:int; var _local18:Number = Number.MAX_VALUE; var _local19:int; while (_local19 < _local9) { _local13 = _local11[_local19]; _local23 = ((_local14 * _local13.x) + (_local15 * _local13.y)); if (_local23 < _local18){ _local18 = _local23; _local17 = _local19; }; _local19++; }; var _local21:int = _local17; var _local22:int = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0; _local20 = _arg1[0]; _local13 = _local10[_local21]; _local12 = _arg6.R; _local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y))); _local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y))); _local20.id.features.referenceEdge = _arg4; _local20.id.features.incidentEdge = _local21; _local20.id.features.incidentVertex = 0; _local20 = _arg1[1]; _local13 = _local10[_local22]; _local12 = _arg6.R; _local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y))); _local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y))); _local20.id.features.referenceEdge = _arg4; _local20.id.features.incidentEdge = _local22; _local20.id.features.incidentVertex = 1; } public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{ var _local6:ClipVertex; var _local13:b2PolygonShape; var _local14:b2PolygonShape; var _local17:int; var _local18:uint; var _local34:int; var _local37:b2Vec2; var _local38:Number; var _local39:b2ManifoldPoint; _arg1.pointCount = 0; var _local7:int; var _local8:Array = [_local7]; var _local9:Number = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5); _local7 = _local8[0]; if (_local9 > 0){ return; }; var _local10:int; var _local11:Array = [_local10]; var _local12:Number = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3); _local10 = _local11[0]; if (_local12 > 0){ return; }; var _local15:b2XForm = new b2XForm(); var _local16:b2XForm = new b2XForm(); var _local19:Number = 0.98; var _local20:Number = 0.001; if (_local12 > ((_local19 * _local9) + _local20)){ _local13 = _arg4; _local14 = _arg2; _local15.Set(_arg5); _local16.Set(_arg3); _local17 = _local10; _local18 = 1; } else { _local13 = _arg2; _local14 = _arg4; _local15.Set(_arg3); _local16.Set(_arg5); _local17 = _local7; _local18 = 0; }; var _local21:Array = [new ClipVertex(), new ClipVertex()]; FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16); var _local22:int = _local13.m_vertexCount; var _local23:Array = _local13.m_vertices; var _local24:b2Vec2 = _local23[_local17]; var _local25:b2Vec2 = _local24.Copy(); if ((_local17 + 1) < _local22){ _local24 = _local23[int((_local17 + 1))]; _local37 = _local24.Copy(); } else { _local24 = _local23[0]; _local37 = _local24.Copy(); }; var _local26:b2Vec2 = b2Math.SubtractVV(_local37, _local25); var _local27:b2Vec2 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25)); _local27.Normalize(); var _local28:b2Vec2 = b2Math.b2CrossVF(_local27, 1); _local25 = b2Math.b2MulX(_local15, _local25); _local37 = b2Math.b2MulX(_local15, _local37); var _local29:Number = b2Math.b2Dot(_local28, _local25); var _local30:Number = -(b2Math.b2Dot(_local27, _local25)); var _local31:Number = b2Math.b2Dot(_local27, _local37); var _local32:Array = [new ClipVertex(), new ClipVertex()]; var _local33:Array = [new ClipVertex(), new ClipVertex()]; _local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30); if (_local34 < 2){ return; }; _local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31); if (_local34 < 2){ return; }; _arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy(); var _local35:int; var _local36:int; while (_local36 < b2Settings.b2_maxManifoldPoints) { _local6 = _local33[_local36]; _local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29); if (_local38 <= 0){ _local39 = _arg1.points[_local35]; _local39.separation = _local38; _local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v); _local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v); _local39.id.key = _local6.id._key; _local39.id.features.flip = _local18; _local35++; }; _local36++; }; _arg1.pointCount = _local35; } public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{ var _local8:b2Vec2; var _local9:b2Mat22; var _local22:int; var _local23:Number; var _local24:int; var _local25:Number; var _local6:int = _arg2.m_vertexCount; var _local7:Array = _arg2.m_normals; _local9 = _arg5.R; _local8 = _arg4.m_centroid; var _local10:Number = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))); var _local11:Number = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))); _local9 = _arg3.R; _local8 = _arg2.m_centroid; _local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)))); _local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)))); var _local12:Number = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y)); var _local13:Number = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y)); var _local14:int; var _local15:Number = -(Number.MAX_VALUE); var _local16:int; while (_local16 < _local6) { _local8 = _local7[_local16]; _local25 = ((_local8.x * _local12) + (_local8.y * _local13)); if (_local25 > _local15){ _local15 = _local25; _local14 = _local16; }; _local16++; }; var _local17:Number = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5); if (_local17 > 0){ return (_local17); }; var _local18:int = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1); var _local19:Number = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5); if (_local19 > 0){ return (_local19); }; var _local20:int = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0; var _local21:Number = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5); if (_local21 > 0){ return (_local21); }; if ((((_local19 > _local17)) && ((_local19 > _local21)))){ _local24 = -1; _local22 = _local18; _local23 = _local19; } else { if (_local21 > _local17){ _local24 = 1; _local22 = _local20; _local23 = _local21; } else { _arg1[0] = _local14; return (_local17); }; }; while (true) { if (_local24 == -1){ _local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1); } else { _local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0; }; _local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5); if (_local17 > 0){ return (_local17); }; if (_local17 > _local23){ _local22 = _local14; _local23 = _local17; } else { break; }; }; _arg1[0] = _local22; return (_local23); } public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{ var _local5:ClipVertex; var _local6:int; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:Number; var _local11:Number; var _local12:b2Vec2; var _local13:ClipVertex; _local6 = 0; _local5 = _arg2[0]; _local7 = _local5.v; _local5 = _arg2[1]; _local8 = _local5.v; _local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4); var _local10:Number = (b2Math.b2Dot(_arg3, _local8) - _arg4); if (_local9 <= 0){ var _temp1 = _local6; _local6 = (_local6 + 1); var _local14 = _temp1; _arg1[_local14] = _arg2[0]; }; if (_local10 <= 0){ var _temp2 = _local6; _local6 = (_local6 + 1); _local14 = _temp2; _arg1[_local14] = _arg2[1]; }; if ((_local9 * _local10) < 0){ _local11 = (_local9 / (_local9 - _local10)); _local5 = _arg1[_local6]; _local12 = _local5.v; _local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x))); _local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y))); _local5 = _arg1[_local6]; if (_local9 > 0){ _local13 = _arg2[0]; _local5.id = _local13.id; } else { _local13 = _arg2[1]; _local5.id = _local13.id; }; _local6++; }; return (_local6); } public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{ var _local6:b2Mat22; var _local7:b2Vec2; var _local18:Number; var _local24:Number; var _local25:Number; _arg1.pointCount = 0; _local6 = _arg3.R; _local7 = _arg2.m_localPosition; var _local8:Number = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y))); var _local9:Number = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y))); _local6 = _arg5.R; _local7 = _arg4.m_localPosition; var _local10:Number = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y))); var _local11:Number = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y))); var _local12:Number = (_local10 - _local8); var _local13:Number = (_local11 - _local9); var _local14:Number = ((_local12 * _local12) + (_local13 * _local13)); var _local15:Number = _arg2.m_radius; var _local16:Number = _arg4.m_radius; var _local17:Number = (_local15 + _local16); if (_local14 > (_local17 * _local17)){ return; }; if (_local14 < Number.MIN_VALUE){ _local18 = -(_local17); _arg1.normal.Set(0, 1); } else { _local24 = Math.sqrt(_local14); _local18 = (_local24 - _local17); _local25 = (1 / _local24); _arg1.normal.x = (_local25 * _local12); _arg1.normal.y = (_local25 * _local13); }; _arg1.pointCount = 1; var _local19:b2ManifoldPoint = _arg1.points[0]; _local19.id.key = 0; _local19.separation = _local18; _local8 = (_local8 + (_local15 * _arg1.normal.x)); _local9 = (_local9 + (_local15 * _arg1.normal.y)); _local10 = (_local10 - (_local16 * _arg1.normal.x)); _local11 = (_local11 - (_local16 * _arg1.normal.y)); var _local20:Number = (0.5 * (_local8 + _local10)); var _local21:Number = (0.5 * (_local9 + _local11)); var _local22:Number = (_local20 - _arg3.position.x); var _local23:Number = (_local21 - _arg3.position.y); _local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y)); _local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y)); _local22 = (_local20 - _arg5.position.x); _local23 = (_local21 - _arg5.position.y); _local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y)); _local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y)); } public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{ var _local6:b2ManifoldPoint; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:b2Vec2; var _local12:b2Mat22; var _local17:Number; var _local32:Number; var _local33:Number; var _local34:Number; _arg1.pointCount = 0; _local12 = _arg5.R; _local11 = _arg4.m_localPosition; var _local13:Number = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y))); var _local14:Number = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y))); _local7 = (_local13 - _arg3.position.x); _local8 = (_local14 - _arg3.position.y); _local12 = _arg3.R; var _local15:Number = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); var _local16:Number = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); var _local18:int; var _local19:Number = -(Number.MAX_VALUE); var _local20:Number = _arg4.m_radius; var _local21:int = _arg2.m_vertexCount; var _local22:Array = _arg2.m_vertices; var _local23:Array = _arg2.m_normals; var _local24:int; while (_local24 < _local21) { _local11 = _local22[_local24]; _local7 = (_local15 - _local11.x); _local8 = (_local16 - _local11.y); _local11 = _local23[_local24]; _local34 = ((_local11.x * _local7) + (_local11.y * _local8)); if (_local34 > _local20){ return; }; if (_local34 > _local19){ _local19 = _local34; _local18 = _local24; }; _local24++; }; if (_local19 < Number.MIN_VALUE){ _arg1.pointCount = 1; _local11 = _local23[_local18]; _local12 = _arg3.R; _arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)); _arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)); _local6 = _arg1.points[0]; _local6.id.features.incidentEdge = _local18; _local6.id.features.incidentVertex = b2_nullFeature; _local6.id.features.referenceEdge = 0; _local6.id.features.flip = 0; _local9 = (_local13 - (_local20 * _arg1.normal.x)); _local10 = (_local14 - (_local20 * _arg1.normal.y)); _local7 = (_local9 - _arg3.position.x); _local8 = (_local10 - _arg3.position.y); _local12 = _arg3.R; _local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local7 = (_local9 - _arg5.position.x); _local8 = (_local10 - _arg5.position.y); _local12 = _arg5.R; _local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local6.separation = (_local19 - _local20); return; }; var _local25:int = _local18; var _local26:int = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0; _local11 = _local22[_local25]; var _local27:b2Vec2 = _local22[_local26]; var _local28:Number = (_local27.x - _local11.x); var _local29:Number = (_local27.y - _local11.y); var _local30:Number = Math.sqrt(((_local28 * _local28) + (_local29 * _local29))); _local28 = (_local28 / _local30); _local29 = (_local29 / _local30); _local7 = (_local15 - _local11.x); _local8 = (_local16 - _local11.y); var _local31:Number = ((_local7 * _local28) + (_local8 * _local29)); _local6 = _arg1.points[0]; if (_local31 <= 0){ _local32 = _local11.x; _local33 = _local11.y; _local6.id.features.incidentEdge = b2_nullFeature; _local6.id.features.incidentVertex = _local25; } else { if (_local31 >= _local30){ _local32 = _local27.x; _local33 = _local27.y; _local6.id.features.incidentEdge = b2_nullFeature; _local6.id.features.incidentVertex = _local26; } else { _local32 = ((_local28 * _local31) + _local11.x); _local33 = ((_local29 * _local31) + _local11.y); _local6.id.features.incidentEdge = _local18; _local6.id.features.incidentVertex = 0; }; }; _local7 = (_local15 - _local32); _local8 = (_local16 - _local33); _local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8))); _local7 = (_local7 / _local17); _local8 = (_local8 / _local17); if (_local17 > _local20){ return; }; _arg1.pointCount = 1; _local12 = _arg3.R; _arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8)); _arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8)); _local9 = (_local13 - (_local20 * _arg1.normal.x)); _local10 = (_local14 - (_local20 * _arg1.normal.y)); _local7 = (_local9 - _arg3.position.x); _local8 = (_local10 - _arg3.position.y); _local12 = _arg3.R; _local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local7 = (_local9 - _arg5.position.x); _local8 = (_local10 - _arg5.position.y); _local12 = _arg5.R; _local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local6.separation = (_local17 - _local20); _local6.id.features.referenceEdge = 0; _local6.id.features.flip = 0; } } }//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID) package Box2D.Collision { public class b2ContactID { public var _key:uint; public var features:Features; public function b2ContactID(){ features = new Features(); super(); features._m_id = this; } public function Set(_arg1:b2ContactID):void{ key = _arg1._key; } public function Copy():b2ContactID{ var _local1:b2ContactID = new b2ContactID(); _local1.key = key; return (_local1); } public function set key(_arg1:uint):void{ _key = _arg1; features._referenceEdge = (_key & 0xFF); features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF); features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF); features._flip = (((_key & 4278190080) >> 24) & 0xFF); } public function get key():uint{ return (_key); } } }//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; public class b2ContactPoint { public var friction:Number; public var separation:Number; public var normal:b2Vec2; public var position:b2Vec2; public var restitution:Number; public var shape1:b2Shape; public var shape2:b2Shape; public var id:b2ContactID; public var velocity:b2Vec2; public function b2ContactPoint(){ position = new b2Vec2(); velocity = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Distance { private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var gPoint:b2Point = new b2Point(); public static var g_GJK_Iterations:int = 0; public static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{ var _local6:b2Vec2; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local4:Number = (100 * Number.MIN_VALUE); var _local5:int; while (_local5 < _arg3) { _local6 = _arg2[_local5]; _local7 = Math.abs((_arg1.x - _local6.x)); _local8 = Math.abs((_arg1.y - _local6.y)); _local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x)); _local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y)); if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){ return (true); }; _local5++; }; return (false); } public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{ var _local7:b2Vec2; var _local15:Number; var _local16:Number; var _local17:b2Vec2; var _local18:b2Vec2; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:int; var _local8:Array = s_p1s; var _local9:Array = s_p2s; var _local10:Array = s_points; var _local11:int; _arg1.SetV(_arg3.GetFirstVertex(_arg4)); _arg2.SetV(_arg5.GetFirstVertex(_arg6)); var _local12:Number = 0; var _local13 = 20; var _local14:int; while (_local14 < _local13) { _local15 = (_arg2.x - _arg1.x); _local16 = (_arg2.y - _arg1.y); _local17 = _arg3.Support(_arg4, _local15, _local16); _local18 = _arg5.Support(_arg6, -(_local15), -(_local16)); _local12 = ((_local15 * _local15) + (_local16 * _local16)); _local19 = (_local18.x - _local17.x); _local20 = (_local18.y - _local17.y); _local21 = ((_local15 * _local19) + (_local16 * _local20)); if ((_local12 - ((_local15 * _local19) + (_local16 * _local20))) <= (0.01 * _local12)){ if (_local11 == 0){ _arg1.SetV(_local17); _arg2.SetV(_local18); }; g_GJK_Iterations = _local14; return (Math.sqrt(_local12)); }; switch (_local11){ case 0: _local7 = _local8[0]; _local7.SetV(_local17); _local7 = _local9[0]; _local7.SetV(_local18); _local7 = _local10[0]; _local7.x = _local19; _local7.y = _local20; _arg1.SetV(_local8[0]); _arg2.SetV(_local9[0]); _local11++; break; case 1: _local7 = _local8[1]; _local7.SetV(_local17); _local7 = _local9[1]; _local7.SetV(_local18); _local7 = _local10[1]; _local7.x = _local19; _local7.y = _local20; _local11 = ProcessTwo(_arg1, _arg2, _local8, _local9, _local10); break; case 2: _local7 = _local8[2]; _local7.SetV(_local17); _local7 = _local9[2]; _local7.SetV(_local18); _local7 = _local10[2]; _local7.x = _local19; _local7.y = _local20; _local11 = ProcessThree(_arg1, _arg2, _local8, _local9, _local10); break; }; if (_local11 == 3){ g_GJK_Iterations = _local14; return (0); }; _local22 = -(Number.MAX_VALUE); _local23 = 0; while (_local23 < _local11) { _local7 = _local10[_local23]; _local22 = b2Math.b2Max(_local22, ((_local7.x * _local7.x) + (_local7.y * _local7.y))); _local23++; }; if ((((_local11 == 3)) || ((_local12 <= ((100 * Number.MIN_VALUE) * _local22))))){ g_GJK_Iterations = _local14; _local15 = (_arg2.x - _arg1.x); _local16 = (_arg2.y - _arg1.y); _local12 = ((_local15 * _local15) + (_local16 * _local16)); return (Math.sqrt(_local12)); }; _local14++; }; g_GJK_Iterations = _local13; return (Math.sqrt(_local12)); } public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{ var _local7:b2Mat22; var _local8:b2Vec2; var _local19:Number; var _local20:Number; _local7 = _arg4.R; _local8 = _arg3.m_localPosition; var _local9:Number = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); var _local10:Number = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); _local7 = _arg6.R; _local8 = _arg5.m_localPosition; var _local11:Number = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); var _local12:Number = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); var _local13:Number = (_local11 - _local9); var _local14:Number = (_local12 - _local10); var _local15:Number = ((_local13 * _local13) + (_local14 * _local14)); var _local16:Number = (_arg3.m_radius - b2Settings.b2_toiSlop); var _local17:Number = (_arg5.m_radius - b2Settings.b2_toiSlop); var _local18:Number = (_local16 + _local17); if (_local15 > (_local18 * _local18)){ _local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14))); _local13 = (_local13 / _local19); _local14 = (_local14 / _local19); _local20 = (_local19 - _local18); _arg1.x = (_local9 + (_local16 * _local13)); _arg1.y = (_local10 + (_local16 * _local14)); _arg2.x = (_local11 - (_local17 * _local13)); _arg2.y = (_local12 - (_local17 * _local14)); return (_local20); }; if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){ _local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14))); _local13 = (_local13 / _local19); _local14 = (_local14 / _local19); _arg1.x = (_local9 + (_local16 * _local13)); _arg1.y = (_local10 + (_local16 * _local14)); _arg2.x = _arg1.x; _arg2.y = _arg1.y; return (0); }; _arg1.x = _local9; _arg1.y = _local10; _arg2.x = _arg1.x; _arg2.y = _arg1.y; return (0); } public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{ var _local6:b2Vec2; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:b2Vec2; var _local12:b2Vec2; var _local13:b2Vec2; var _local35:Number; _local6 = _arg5[0]; _local7 = _arg5[1]; _local8 = _arg5[2]; _local9 = _arg3[0]; _local10 = _arg3[1]; _local11 = _arg3[2]; _local12 = _arg4[0]; _local13 = _arg4[1]; var _local14:b2Vec2 = _arg4[2]; var _local15:Number = _local6.x; var _local16:Number = _local6.y; var _local17:Number = _local7.x; var _local18:Number = _local7.y; var _local19:Number = _local8.x; var _local20:Number = _local8.y; var _local21:Number = (_local17 - _local15); var _local22:Number = (_local18 - _local16); var _local23:Number = (_local19 - _local15); var _local24:Number = (_local20 - _local16); var _local25:Number = (_local19 - _local17); var _local26:Number = (_local20 - _local18); var _local27:Number = -(((_local15 * _local21) + (_local16 * _local22))); var _local28:Number = ((_local17 * _local21) + (_local18 * _local22)); var _local29:Number = -(((_local15 * _local23) + (_local16 * _local24))); var _local30:Number = ((_local19 * _local23) + (_local20 * _local24)); var _local31:Number = -(((_local17 * _local25) + (_local18 * _local26))); var _local32:Number = ((_local19 * _local25) + (_local20 * _local26)); if ((((_local30 <= 0)) && ((_local32 <= 0)))){ _arg1.SetV(_local11); _arg2.SetV(_local14); _local9.SetV(_local11); _local12.SetV(_local14); _local6.SetV(_local8); return (1); }; var _local33:Number = ((_local21 * _local24) - (_local22 * _local23)); var _local34:Number = (_local33 * ((_local15 * _local18) - (_local16 * _local17))); var _local36:Number = (_local33 * ((_local17 * _local20) - (_local18 * _local19))); if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){ _local35 = (_local31 / (_local31 + _local32)); _arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x))); _arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y))); _arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x))); _arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y))); _local9.SetV(_local11); _local12.SetV(_local14); _local6.SetV(_local8); return (2); }; var _local37:Number = (_local33 * ((_local19 * _local16) - (_local20 * _local15))); if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){ _local35 = (_local29 / (_local29 + _local30)); _arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x))); _arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y))); _arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x))); _arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y))); _local10.SetV(_local11); _local13.SetV(_local14); _local7.SetV(_local8); return (2); }; var _local38:Number = ((_local36 + _local37) + _local34); _local38 = (1 / _local38); var _local39:Number = (_local36 * _local38); var _local40:Number = (_local37 * _local38); var _local41:Number = ((1 - _local39) - _local40); _arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x)); _arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y)); _arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x)); _arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y)); return (3); } public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{ var _local7:b2Mat22; var _local8:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local9:b2Point = gPoint; _local8 = _arg5.m_localPosition; _local7 = _arg6.R; _local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); _local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); var _local10:Number = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity); var _local11:Number = (_arg5.m_radius - b2Settings.b2_toiSlop); if (_local10 > _local11){ _local10 = (_local10 - _local11); _local12 = (_arg2.x - _arg1.x); _local13 = (_arg2.y - _arg1.y); _local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13))); _local12 = (_local12 / _local14); _local13 = (_local13 / _local14); _arg2.x = (_arg2.x - (_local11 * _local12)); _arg2.y = (_arg2.y - (_local11 * _local13)); } else { _local10 = 0; _arg2.x = _arg1.x; _arg2.y = _arg1.y; }; return (_local10); } public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{ var _local7:int = _arg3.m_type; var _local8:int = _arg5.m_type; if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){ return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6)); }; if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){ return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6)); }; if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){ return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4)); }; if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){ return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6)); }; return (0); } public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{ var _local9:b2Vec2; var _local10:b2Vec2; var _local11:b2Vec2; var _local17:Number; var _local6:b2Vec2 = _arg5[0]; var _local7:b2Vec2 = _arg5[1]; var _local8:b2Vec2 = _arg3[0]; _local9 = _arg3[1]; _local10 = _arg4[0]; _local11 = _arg4[1]; var _local12:Number = -(_local7.x); var _local13:Number = -(_local7.y); var _local14:Number = (_local6.x - _local7.x); var _local15:Number = (_local6.y - _local7.y); var _local16:Number = Math.sqrt(((_local14 * _local14) + (_local15 * _local15))); _local14 = (_local14 / _local16); _local15 = (_local15 / _local16); _local17 = ((_local12 * _local14) + (_local13 * _local15)); if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){ _arg1.SetV(_local9); _arg2.SetV(_local11); _local8.SetV(_local9); _local10.SetV(_local11); _local6.SetV(_local7); return (1); }; _local17 = (_local17 / _local16); _arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x))); _arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y))); _arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x))); _arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y))); return (2); } } }//package Box2D.Collision
Section 18
//b2Manifold (Box2D.Collision.b2Manifold) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Manifold { public var pointCount:int;// = 0 public var normal:b2Vec2; public var points:Array; public function b2Manifold(){ points = new Array(b2Settings.b2_maxManifoldPoints); var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ManifoldPoint(); _local1++; }; normal = new b2Vec2(); } public function Set(_arg1:b2Manifold):void{ pointCount = _arg1.pointCount; var _local2:int; while (_local2 < b2Settings.b2_maxManifoldPoints) { (points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]); _local2++; }; normal.SetV(_arg1.normal); } public function Reset():void{ var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { (points[_local1] as b2ManifoldPoint).Reset(); _local1++; }; normal.SetZero(); pointCount = 0; } } }//package Box2D.Collision
Section 19
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint) package Box2D.Collision { import Box2D.Common.Math.*; public class b2ManifoldPoint { public var separation:Number; public var localPoint2:b2Vec2; public var normalImpulse:Number; public var tangentImpulse:Number; public var localPoint1:b2Vec2; public var id:b2ContactID; public function b2ManifoldPoint(){ localPoint1 = new b2Vec2(); localPoint2 = new b2Vec2(); id = new b2ContactID(); super(); } public function Set(_arg1:b2ManifoldPoint):void{ localPoint1.SetV(_arg1.localPoint1); localPoint2.SetV(_arg1.localPoint2); separation = _arg1.separation; normalImpulse = _arg1.normalImpulse; tangentImpulse = _arg1.tangentImpulse; id.key = _arg1.id.key; } public function Reset():void{ localPoint1.SetZero(); localPoint2.SetZero(); separation = 0; normalImpulse = 0; tangentImpulse = 0; id.key = 0; } } }//package Box2D.Collision
Section 20
//b2OBB (Box2D.Collision.b2OBB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2OBB { public var R:b2Mat22; public var center:b2Vec2; public var extents:b2Vec2; public function b2OBB(){ R = new b2Mat22(); center = new b2Vec2(); extents = new b2Vec2(); super(); } } }//package Box2D.Collision
Section 21
//b2Pair (Box2D.Collision.b2Pair) package Box2D.Collision { import Box2D.Common.*; public class b2Pair { public var proxyId1:uint; public var userData;// = null public var proxyId2:uint; public var status:uint; public var next:uint; public static var e_pairFinal:uint = 4; public static var b2_tableMask:int = (b2_tableCapacity - 1); public static var e_pairRemoved:uint = 2; public static var b2_nullPair:uint = b2Settings.USHRT_MAX; public static var e_pairBuffered:uint = 1; public static var b2_nullProxy:uint = b2Settings.USHRT_MAX; public static var b2_tableCapacity:int = b2Settings.b2_maxPairs; public function SetBuffered():void{ status = (status | e_pairBuffered); } public function IsBuffered():Boolean{ return (((status & e_pairBuffered) == e_pairBuffered)); } public function IsFinal():Boolean{ return (((status & e_pairFinal) == e_pairFinal)); } public function ClearRemoved():void{ status = (status & ~(e_pairRemoved)); } public function SetFinal():void{ status = (status | e_pairFinal); } public function IsRemoved():Boolean{ return (((status & e_pairRemoved) == e_pairRemoved)); } public function ClearBuffered():void{ status = (status & ~(e_pairBuffered)); } public function SetRemoved():void{ status = (status | e_pairRemoved); } } }//package Box2D.Collision
Section 22
//b2PairCallback (Box2D.Collision.b2PairCallback) package Box2D.Collision { public class b2PairCallback { public function PairRemoved(_arg1, _arg2, _arg3):void{ } public function PairAdded(_arg1, _arg2){ return (null); } } }//package Box2D.Collision
Section 23
//b2PairManager (Box2D.Collision.b2PairManager) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PairManager { public var m_pairCount:int; public var m_pairBuffer:Array; public var m_hashTable:Array; public var m_callback:b2PairCallback; public var m_pairs:Array; public var m_pairBufferCount:int; public var m_broadPhase:b2BroadPhase; public var m_freePair:uint; public function b2PairManager(){ var _local1:uint; super(); m_hashTable = new Array(b2Pair.b2_tableCapacity); _local1 = 0; while (_local1 < b2Pair.b2_tableCapacity) { m_hashTable[_local1] = b2Pair.b2_nullPair; _local1++; }; m_pairs = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1] = new b2Pair(); _local1++; }; m_pairBuffer = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairBuffer[_local1] = new b2BufferedPair(); _local1++; }; _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy; m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy; m_pairs[_local1].userData = null; m_pairs[_local1].status = 0; m_pairs[_local1].next = (_local1 + 1); _local1++; }; m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair; m_pairCount = 0; m_pairBufferCount = 0; } private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{ var _local4:b2Pair; var _local5:uint = m_hashTable[_arg3]; _local4 = m_pairs[_local5]; while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) { _local5 = _local4.next; _local4 = m_pairs[_local5]; }; if (_local5 == b2Pair.b2_nullPair){ return (null); }; return (_local4); } private function Find(_arg1:uint, _arg2:uint):b2Pair{ var _local4:uint; if (_arg1 > _arg2){ _local4 = _arg1; _arg1 = _arg2; _arg2 = _local4; }; var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); return (FindHash(_arg1, _arg2, _local3)); } private function ValidateBuffer():void{ } public function Commit():void{ var _local1:b2BufferedPair; var _local2:int; var _local5:b2Pair; var _local6:b2Proxy; var _local7:b2Proxy; var _local3:int; var _local4:Array = m_broadPhase.m_proxyPool; _local2 = 0; while (_local2 < m_pairBufferCount) { _local1 = m_pairBuffer[_local2]; _local5 = Find(_local1.proxyId1, _local1.proxyId2); _local5.ClearBuffered(); _local6 = _local4[_local5.proxyId1]; _local7 = _local4[_local5.proxyId2]; if (_local5.IsRemoved()){ if (_local5.IsFinal() == true){ m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData); }; _local1 = m_pairBuffer[_local3]; _local1.proxyId1 = _local5.proxyId1; _local1.proxyId2 = _local5.proxyId2; _local3++; } else { if (_local5.IsFinal() == false){ _local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData); _local5.SetFinal(); }; }; _local2++; }; _local2 = 0; while (_local2 < _local3) { _local1 = m_pairBuffer[_local2]; RemovePair(_local1.proxyId1, _local1.proxyId2); _local2++; }; m_pairBufferCount = 0; if (b2BroadPhase.s_validate){ ValidateTable(); }; } public function RemoveBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2BufferedPair; var _local4:b2Pair = Find(_arg1, _arg2); if (_local4 == null){ return; }; if (_local4.IsBuffered() == false){ _local4.SetBuffered(); _local3 = m_pairBuffer[m_pairBufferCount]; _local3.proxyId1 = _local4.proxyId1; _local3.proxyId2 = _local4.proxyId2; m_pairBufferCount++; }; _local4.SetRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function RemovePair(_arg1:uint, _arg2:uint){ var _local3:b2Pair; var _local7:uint; var _local8:uint; var _local9:*; if (_arg1 > _arg2){ _local7 = _arg1; _arg1 = _arg2; _arg2 = _local7; }; var _local4:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); var _local5:uint = m_hashTable[_local4]; var _local6:b2Pair; while (_local5 != b2Pair.b2_nullPair) { if (Equals(m_pairs[_local5], _arg1, _arg2)){ _local8 = _local5; _local3 = m_pairs[_local5]; if (_local6){ _local6.next = _local3.next; } else { m_hashTable[_local4] = _local3.next; }; _local3 = m_pairs[_local8]; _local9 = _local3.userData; _local3.next = m_freePair; _local3.proxyId1 = b2Pair.b2_nullProxy; _local3.proxyId2 = b2Pair.b2_nullProxy; _local3.userData = null; _local3.status = 0; m_freePair = _local8; m_pairCount--; return (_local9); } else { _local6 = m_pairs[_local5]; _local5 = _local6.next; }; }; return (null); } public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{ m_broadPhase = _arg1; m_callback = _arg2; } public function AddBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2BufferedPair; var _local4:b2Pair = AddPair(_arg1, _arg2); if (_local4.IsBuffered() == false){ _local4.SetBuffered(); _local3 = m_pairBuffer[m_pairBufferCount]; _local3.proxyId1 = _local4.proxyId1; _local3.proxyId2 = _local4.proxyId2; m_pairBufferCount++; }; _local4.ClearRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function AddPair(_arg1:uint, _arg2:uint):b2Pair{ var _local6:uint; if (_arg1 > _arg2){ _local6 = _arg1; _arg1 = _arg2; _arg2 = _local6; }; var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); var _local4 = FindHash(_arg1, _arg2, _local3); if (_local4 != null){ return (_local4); }; var _local5:uint = m_freePair; _local4 = m_pairs[_local5]; m_freePair = _local4.next; _local4.proxyId1 = _arg1; _local4.proxyId2 = _arg2; _local4.status = 0; _local4.userData = null; _local4.next = m_hashTable[_local3]; m_hashTable[_local3] = _local5; m_pairCount++; return (_local4); } private function ValidateTable():void{ } public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{ return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2)))); } public static function Hash(_arg1:uint, _arg2:uint):uint{ var _local3:uint = (((_arg2 << 16) & 4294901760) | _arg1); _local3 = (~(_local3) + ((_local3 << 15) & 4294934528)); _local3 = (_local3 ^ ((_local3 >> 12) & 1048575)); _local3 = (_local3 + ((_local3 << 2) & 4294967292)); _local3 = (_local3 ^ ((_local3 >> 4) & 268435455)); _local3 = (_local3 * 2057); _local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF)); return (_local3); } public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{ return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3)))); } } }//package Box2D.Collision
Section 24
//b2Point (Box2D.Collision.b2Point) package Box2D.Collision { import Box2D.Common.Math.*; public class b2Point { public var p:b2Vec2; public function b2Point(){ p = new b2Vec2(); super(); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (p); } public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{ return (p); } } }//package Box2D.Collision
Section 25
//b2Proxy (Box2D.Collision.b2Proxy) package Box2D.Collision { public class b2Proxy { public var overlapCount:uint; public var userData;// = null public var lowerBounds:Array; public var upperBounds:Array; public var timeStamp:uint; public function b2Proxy(){ lowerBounds = [uint(0), uint(0)]; upperBounds = [uint(0), uint(0)]; super(); } public function GetNext():uint{ return (lowerBounds[0]); } public function IsValid():Boolean{ return (!((overlapCount == b2BroadPhase.b2_invalid))); } public function SetNext(_arg1:uint):void{ lowerBounds[0] = (_arg1 & 0xFFFF); } } }//package Box2D.Collision
Section 26
//b2Segment (Box2D.Collision.b2Segment) package Box2D.Collision { import Box2D.Common.Math.*; public class b2Segment { public var p1:b2Vec2; public var p2:b2Vec2; public function b2Segment(){ p1 = new b2Vec2(); p2 = new b2Vec2(); super(); } public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{ var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local5:b2Vec2 = _arg3.p1; var _local6:Number = (_arg3.p2.x - _local5.x); var _local7:Number = (_arg3.p2.y - _local5.y); var _local8:Number = (p2.x - p1.x); var _local9:Number = (p2.y - p1.y); var _local10:Number = _local9; var _local11:Number = -(_local8); var _local12:Number = (100 * Number.MIN_VALUE); var _local13:Number = -(((_local6 * _local10) + (_local7 * _local11))); if (_local13 > _local12){ _local14 = (_local5.x - p1.x); _local15 = (_local5.y - p1.y); _local16 = ((_local14 * _local10) + (_local15 * _local11)); if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){ _local17 = ((-(_local7) * _local15) + (_local7 * _local14)); if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){ _local16 = (_local16 / _local13); _local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11))); _local10 = (_local10 / _local18); _local11 = (_local11 / _local18); _arg1[0] = _local16; _arg2.Set(_local10, _local11); return (true); }; }; }; return (false); } } }//package Box2D.Collision
Section 27
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2TimeOfImpact { public static var s_xf1:b2XForm = new b2XForm(); public static var s_xf2:b2XForm = new b2XForm(); public static var s_p1:b2Vec2 = new b2Vec2(); public static var s_p2:b2Vec2 = new b2Vec2(); public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{ var _local5:Number; var _local6:Number; var _local25:Number; var _local26:b2XForm; var _local27:b2XForm; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local7:Number = _arg1.m_sweepRadius; var _local8:Number = _arg3.m_sweepRadius; var _local9:Number = _arg2.t0; var _local10:Number = (_arg2.c.x - _arg2.c0.x); var _local11:Number = (_arg2.c.y - _arg2.c0.y); var _local12:Number = (_arg4.c.x - _arg4.c0.x); var _local13:Number = (_arg4.c.y - _arg4.c0.y); var _local14:Number = (_arg2.a - _arg2.a0); var _local15:Number = (_arg4.a - _arg4.a0); var _local16:Number = 0; var _local17:b2Vec2 = s_p1; var _local18:b2Vec2 = s_p2; var _local19 = 20; var _local20:int; var _local21:Number = 0; var _local22:Number = 0; var _local23:Number = 0; var _local24:Number = 0; while (true) { _local25 = (((1 - _local16) * _local9) + _local16); _local26 = s_xf1; _local27 = s_xf2; _arg2.GetXForm(_local26, _local25); _arg4.GetXForm(_local27, _local25); _local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27); if (_local20 == 0){ if (_local23 > (2 * b2Settings.b2_toiSlop)){ _local24 = (1.5 * b2Settings.b2_toiSlop); } else { _local5 = (0.05 * b2Settings.b2_toiSlop); _local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop)); _local24 = ((_local5 > _local6)) ? _local5 : _local6; }; }; if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){ break; }; _local21 = (_local18.x - _local17.x); _local22 = (_local18.y - _local17.y); _local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22))); _local21 = (_local21 / _local28); _local22 = (_local22 / _local28); _local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8)); if (_local29 == 0){ _local16 = 1; break; }; _local30 = ((_local23 - _local24) / _local29); _local31 = (_local16 + _local30); if ((((_local31 < 0)) || ((1 < _local31)))){ _local16 = 1; break; }; if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){ break; }; _local16 = _local31; _local20++; }; return (_local16); } } }//package Box2D.Collision
Section 28
//ClipVertex (Box2D.Collision.ClipVertex) package Box2D.Collision { import Box2D.Common.Math.*; public class ClipVertex { public var id:b2ContactID; public var v:b2Vec2; public function ClipVertex(){ v = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features) package Box2D.Collision { public class Features { public var _referenceEdge:int; public var _incidentEdge:int; public var _flip:int; public var _incidentVertex:int; public var _m_id:b2ContactID; public function get referenceEdge():int{ return (_referenceEdge); } public function set incidentVertex(_arg1:int):void{ _incidentVertex = _arg1; _m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000)); } public function get flip():int{ return (_flip); } public function get incidentEdge():int{ return (_incidentEdge); } public function set referenceEdge(_arg1:int):void{ _referenceEdge = _arg1; _m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF)); } public function get incidentVertex():int{ return (_incidentVertex); } public function set flip(_arg1:int):void{ _flip = _arg1; _m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080)); } public function set incidentEdge(_arg1:int):void{ _incidentEdge = _arg1; _m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00)); } } }//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22) package Box2D.Common.Math { public class b2Mat22 { public var col1:b2Vec2; public var col2:b2Vec2; public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){ var _local4:Number; var _local5:Number; col1 = new b2Vec2(); col2 = new b2Vec2(); super(); if (((!((_arg2 == null))) && (!((_arg3 == null))))){ col1.SetV(_arg2); col2.SetV(_arg3); } else { _local4 = Math.cos(_arg1); _local5 = Math.sin(_arg1); col1.x = _local4; col2.x = -(_local5); col1.y = _local5; col2.y = _local4; }; } public function SetIdentity():void{ col1.x = 1; col2.x = 0; col1.y = 0; col2.y = 1; } public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{ col1.SetV(_arg1); col2.SetV(_arg2); } public function Set(_arg1:Number):void{ var _local2:Number; _local2 = Math.cos(_arg1); var _local3:Number = Math.sin(_arg1); col1.x = _local2; col2.x = -(_local3); col1.y = _local3; col2.y = _local2; } public function SetZero():void{ col1.x = 0; col2.x = 0; col1.y = 0; col2.y = 0; } public function SetM(_arg1:b2Mat22):void{ col1.SetV(_arg1.col1); col2.SetV(_arg1.col2); } public function AddM(_arg1:b2Mat22):void{ col1.x = (col1.x + _arg1.col1.x); col1.y = (col1.y + _arg1.col1.y); col2.x = (col2.x + _arg1.col2.x); col2.y = (col2.y + _arg1.col2.y); } public function Abs():void{ col1.Abs(); col2.Abs(); } public function Copy():b2Mat22{ return (new b2Mat22(0, col1, col2)); } public function Invert(_arg1:b2Mat22):b2Mat22{ var _local2:Number; var _local4:Number; var _local6:Number; _local2 = col1.x; var _local3:Number = col2.x; _local4 = col1.y; var _local5:Number = col2.y; _local6 = ((_local2 * _local5) - (_local3 * _local4)); _local6 = (1 / _local6); _arg1.col1.x = (_local6 * _local5); _arg1.col2.x = (-(_local6) * _local3); _arg1.col1.y = (-(_local6) * _local4); _arg1.col2.y = (_local6 * _local2); return (_arg1); } public function GetAngle():Number{ return (Math.atan2(col1.y, col1.x)); } public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:Number = col1.x; var _local5:Number = col2.x; var _local6:Number = col1.y; var _local7:Number = col2.y; var _local8:Number = ((_local4 * _local7) - (_local5 * _local6)); _local8 = (1 / _local8); _arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3))); _arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2))); return (_arg1); } } }//package Box2D.Common.Math
Section 31
//b2Math (Box2D.Common.Math.b2Math) package Box2D.Common.Math { public class b2Math { public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1)); public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity); public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0); public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x)); return (_local3); } public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y)); return (_local3); } public static function b2IsValid(_arg1:Number):Boolean{ return (isFinite(_arg1)); } public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y)); return (_local3); } public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = b2MulMV(_arg1.R, _arg2); _local3.x = (_local3.x + _arg1.position.x); _local3.y = (_local3.y + _arg1.position.y); return (_local3); } public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{ var _local3:Number = (_arg1.x - _arg2.x); var _local4:Number = (_arg1.y - _arg2.y); return (((_local3 * _local3) + (_local4 * _local4))); } public static function b2Swap(_arg1:Array, _arg2:Array):void{ var _local3:* = _arg1[0]; _arg1[0] = _arg2[0]; _arg2[0] = _local3; } public static function b2AbsM(_arg1:b2Mat22):b2Mat22{ var _local2:b2Mat22 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2)); return (_local2); } public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y)); return (_local3); } public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; var _local4:Number; _local3 = SubtractVV(_arg2, _arg1.position); _local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y)); _local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y)); _local3.x = _local4; return (_local3); } public static function b2Abs(_arg1:Number):Number{ return (((_arg1 > 0)) ? _arg1 : -(_arg1)); } public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{ return (b2Max(_arg2, b2Min(_arg1, _arg3))); } public static function b2AbsV(_arg1:b2Vec2):b2Vec2{ var _local2:b2Vec2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y)); return (_local2); } public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y)); return (_local3); } public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x))); } public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y))); } public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x)); return (_local3); } public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Mat22 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2)); return (_local3); } public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{ var _local3:Number = (_arg1.x - _arg2.x); var _local4:Number = (_arg1.y - _arg2.y); return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4)))); } public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1)); var _local4:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2)); var _local5:b2Mat22 = new b2Mat22(0, _local3, _local4); return (_local5); } public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y)); return (_local3); } public static function b2IsPowerOfTwo(_arg1:uint):Boolean{ var _local2:Boolean = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0))); return (_local2); } public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{ return (b2MaxV(_arg2, b2MinV(_arg1, _arg3))); } public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{ var _local3:Number = Math.random(); _local3 = (((_arg2 - _arg1) * _local3) + _arg1); return (_local3); } public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2)); return (_local3); } public static function b2Min(_arg1:Number, _arg2:Number):Number{ return (((_arg1 < _arg2)) ? _arg1 : _arg2); } public static function b2Random():Number{ return (((Math.random() * 2) - 1)); } public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Mat22 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2)); return (_local3); } public static function b2NextPowerOfTwo(_arg1:uint):uint{ _arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647)); _arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823)); _arg1 = (_arg1 | ((_arg1 >> 4) & 268435455)); _arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF)); _arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF)); return ((_arg1 + 1)); } public static function b2Max(_arg1:Number, _arg2:Number):Number{ return (((_arg1 > _arg2)) ? _arg1 : _arg2); } public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y))); return (_local3); } } }//package Box2D.Common.Math
Section 32
//b2Sweep (Box2D.Common.Math.b2Sweep) package Box2D.Common.Math { public class b2Sweep { public var localCenter:b2Vec2; public var a:Number; public var c:b2Vec2; public var a0:Number; public var c0:b2Vec2; public var t0:Number; public function b2Sweep(){ localCenter = new b2Vec2(); c0 = new b2Vec2(); c = new b2Vec2(); super(); } public function Advance(_arg1:Number):void{ var _local2:Number; if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){ _local2 = ((_arg1 - t0) / (1 - t0)); c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x)); c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y)); a0 = (((1 - _local2) * a0) + (_local2 * a)); t0 = _arg1; }; } public function GetXForm(_arg1:b2XForm, _arg2:Number):void{ var _local4:Number; var _local5:Number; if ((1 - t0) > Number.MIN_VALUE){ _local4 = ((_arg2 - t0) / (1 - t0)); _arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x)); _arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y)); _local5 = (((1 - _local4) * a0) + (_local4 * a)); _arg1.R.Set(_local5); } else { _arg1.position.SetV(c); _arg1.R.Set(a); }; var _local3:b2Mat22 = _arg1.R; _arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y))); _arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y))); } } }//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2) package Box2D.Common.Math { public class b2Vec2 { public var y:Number; public var x:Number; public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function Add(_arg1:b2Vec2):void{ x = (x + _arg1.x); y = (y + _arg1.y); } public function Set(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function Multiply(_arg1:Number):void{ x = (x * _arg1); y = (y * _arg1); } public function Length():Number{ return (Math.sqrt(((x * x) + (y * y)))); } public function LengthSquared():Number{ return (((x * x) + (y * y))); } public function MulM(_arg1:b2Mat22):void{ var _local2:Number = x; x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y)); y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y)); } public function SetZero():void{ x = 0; y = 0; } public function MinV(_arg1:b2Vec2):void{ x = ((x < _arg1.x)) ? x : _arg1.x; y = ((y < _arg1.y)) ? y : _arg1.y; } public function Normalize():Number{ var _local1:Number = Math.sqrt(((x * x) + (y * y))); if (_local1 < Number.MIN_VALUE){ return (0); }; var _local2:Number = (1 / _local1); x = (x * _local2); y = (y * _local2); return (_local1); } public function CrossVF(_arg1:Number):void{ var _local2:Number = x; x = (_arg1 * y); y = (-(_arg1) * _local2); } public function MaxV(_arg1:b2Vec2):void{ x = ((x > _arg1.x)) ? x : _arg1.x; y = ((y > _arg1.y)) ? y : _arg1.y; } public function SetV(_arg1:b2Vec2):void{ x = _arg1.x; y = _arg1.y; } public function Negative():b2Vec2{ return (new b2Vec2(-(x), -(y))); } public function CrossFV(_arg1:Number):void{ var _local2:Number = x; x = (-(_arg1) * y); y = (_arg1 * _local2); } public function Abs():void{ if (x < 0){ x = -(x); }; if (y < 0){ y = -(y); }; } public function Subtract(_arg1:b2Vec2):void{ x = (x - _arg1.x); y = (y - _arg1.y); } public function Copy():b2Vec2{ return (new b2Vec2(x, y)); } public function MulTM(_arg1:b2Mat22):void{ var _local2:Number = b2Math.b2Dot(this, _arg1.col1); y = b2Math.b2Dot(this, _arg1.col2); x = _local2; } public function IsValid():Boolean{ return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y)))); } public static function Make(_arg1:Number, _arg2:Number):b2Vec2{ return (new b2Vec2(_arg1, _arg2)); } } }//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm) package Box2D.Common.Math { public class b2XForm { public var position:b2Vec2; public var R:b2Mat22; public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{ position = new b2Vec2(); R = new b2Mat22(); super(); if (_arg1){ position.SetV(_arg1); R.SetM(_arg2); }; } public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{ position.SetV(_arg1); R.SetM(_arg2); } public function Set(_arg1:b2XForm):void{ position.SetV(_arg1.position); R.SetM(_arg1.R); } public function SetIdentity():void{ position.SetZero(); R.SetIdentity(); } } }//package Box2D.Common.Math
Section 35
//b2Color (Box2D.Common.b2Color) package Box2D.Common { import Box2D.Common.Math.*; public class b2Color { private var _r:uint;// = 0 private var _g:uint;// = 0 private var _b:uint;// = 0 public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function set b(_arg1:Number):void{ _b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function get color():uint{ return (((_r | (_g << 8)) | (_b << 16))); } public function set r(_arg1:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function set g(_arg1:Number):void{ _g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } } }//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings) package Box2D.Common { import Box2D.Common.Math.*; public class b2Settings { public static const b2_angularSleepTolerance:Number = 0.0111111111111111; public static const b2_linearSleepTolerance:Number = 0.01; public static const b2_angularSlop:Number = 0.0349065850398866; public static const b2_linearSlop:Number = 0.005; public static const b2_pi:Number = 3.14159265358979; public static const b2_maxProxies:int = 0x0200; public static const b2_maxAngularVelocitySquared:Number = 62500; public static const b2_maxPolygonVertices:int = 8; public static const b2_velocityThreshold:Number = 1; public static const b2_contactBaumgarte:Number = 0.2; public static const b2_maxPairs:int = 4096; public static const b2_maxTOIContactsPerIsland:int = 32; public static const b2_timeToSleep:Number = 0.5; public static const b2_maxManifoldPoints:int = 2; public static const b2_maxAngularVelocity:Number = 250; public static const b2_maxAngularCorrection:Number = 0.139626340159546; public static const USHRT_MAX:int = 0xFFFF; public static const b2_maxLinearVelocity:Number = 200; public static const b2_maxLinearCorrection:Number = 0.2; public static const b2_toiSlop:Number = 0.04; public static const b2_maxLinearVelocitySquared:Number = 40000; public static function b2Assert(_arg1:Boolean):void{ var _local2:b2Vec2; if (!_arg1){ _local2.x++; }; } } }//package Box2D.Common
Section 37
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; public class b2CircleContact extends b2Contact { private var m_manifolds:Array; public var m_manifold:b2Manifold; private var m0:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){ m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(_arg1, _arg2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; var _local3:b2ManifoldPoint = m_manifold.points[0]; _local3.normalImpulse = 0; _local3.tangentImpulse = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2ManifoldPoint; var _local8:b2ManifoldPoint; var _local5:b2Body = m_shape1.m_body; var _local6:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf); var _local7:b2ContactPoint = s_evalCP; _local7.shape1 = m_shape1; _local7.shape2 = m_shape2; _local7.friction = m_friction; _local7.restitution = m_restitution; if (m_manifold.pointCount > 0){ m_manifoldCount = 1; _local8 = m_manifold.points[0]; if (m0.pointCount == 0){ _local8.normalImpulse = 0; _local8.tangentImpulse = 0; if (_arg1){ _local7.position = _local5.GetWorldPoint(_local8.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local8.separation; _local7.id.key = _local8.id._key; _arg1.Add(_local7); }; } else { _local4 = m0.points[0]; _local8.normalImpulse = _local4.normalImpulse; _local8.tangentImpulse = _local4.tangentImpulse; if (_arg1){ _local7.position = _local5.GetWorldPoint(_local8.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local8.separation; _local7.id.key = _local8.id._key; _arg1.Persist(_local7); }; }; } else { m_manifoldCount = 0; if ((((m0.pointCount > 0)) && (_arg1))){ _local4 = m0.points[0]; _local7.position = _local5.GetWorldPoint(_local4.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m0.normal); _local7.separation = _local4.separation; _local7.id.key = _local4.id._key; _arg1.Remove(_local7); }; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2CircleContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Contact { public var m_shape1:b2Shape; public var m_shape2:b2Shape; public var m_prev:b2Contact; public var m_toi:Number; public var m_next:b2Contact; public var m_friction:Number; public var m_manifoldCount:int; public var m_node1:b2ContactEdge; public var m_node2:b2ContactEdge; public var m_restitution:Number; public var m_flags:uint; public static var e_toiFlag:uint = 8; public static var e_nonSolidFlag:uint = 1; public static var e_slowFlag:uint = 2; public static var e_islandFlag:uint = 4; public static var s_registers:Array; public static var s_initialized:Boolean = false; public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){ m_node1 = new b2ContactEdge(); m_node2 = new b2ContactEdge(); super(); m_flags = 0; if (((!(_arg1)) || (!(_arg2)))){ m_shape1 = null; m_shape2 = null; return; }; if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){ m_flags = (m_flags | e_nonSolidFlag); }; m_shape1 = _arg1; m_shape2 = _arg2; m_manifoldCount = 0; m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction)); m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution); m_prev = null; m_next = null; m_node1.contact = null; m_node1.prev = null; m_node1.next = null; m_node1.other = null; m_node2.contact = null; m_node2.prev = null; m_node2.next = null; m_node2.other = null; } public function IsSolid():Boolean{ return (((m_flags & e_nonSolidFlag) == 0)); } public function GetShape1():b2Shape{ return (m_shape1); } public function GetShape2():b2Shape{ return (m_shape2); } public function GetNext():b2Contact{ return (m_next); } public function GetManifoldCount():int{ return (m_manifoldCount); } public function GetManifolds():Array{ return (null); } public function Update(_arg1:b2ContactListener):void{ var _local2:int = m_manifoldCount; Evaluate(_arg1); var _local3:int = m_manifoldCount; var _local4:b2Body = m_shape1.m_body; var _local5:b2Body = m_shape2.m_body; if ((((_local3 == 0)) && ((_local2 > 0)))){ _local4.WakeUp(); _local5.WakeUp(); }; if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){ m_flags = (m_flags & ~(e_slowFlag)); } else { m_flags = (m_flags | e_slowFlag); }; } public function Evaluate(_arg1:b2ContactListener):void{ } public static function InitializeRegisters():void{ var _local2:int; s_registers = new Array(b2Shape.e_shapeTypeCount); var _local1:int; while (_local1 < b2Shape.e_shapeTypeCount) { s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount); _local2 = 0; while (_local2 < b2Shape.e_shapeTypeCount) { s_registers[_local1][_local2] = new b2ContactRegister(); _local2++; }; _local1++; }; AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape); AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape); AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape); } public static function Destroy(_arg1:b2Contact, _arg2):void{ if (_arg1.m_manifoldCount > 0){ _arg1.m_shape1.m_body.WakeUp(); _arg1.m_shape2.m_body.WakeUp(); }; var _local3:int = _arg1.m_shape1.m_type; var _local4:int = _arg1.m_shape2.m_type; var _local5:b2ContactRegister = s_registers[_local3][_local4]; var _local6:Function = _local5.destroyFcn; _local6(_arg1, _arg2); } public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{ s_registers[_arg3][_arg4].createFcn = _arg1; s_registers[_arg3][_arg4].destroyFcn = _arg2; s_registers[_arg3][_arg4].primary = true; if (_arg3 != _arg4){ s_registers[_arg4][_arg3].createFcn = _arg1; s_registers[_arg4][_arg3].destroyFcn = _arg2; s_registers[_arg4][_arg3].primary = false; }; } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ var _local8:b2Contact; var _local9:int; var _local10:b2Manifold; if (s_initialized == false){ InitializeRegisters(); s_initialized = true; }; var _local4:int = _arg1.m_type; var _local5:int = _arg2.m_type; var _local6:b2ContactRegister = s_registers[_local4][_local5]; var _local7:Function = _local6.createFcn; if (_local7 != null){ if (_local6.primary){ return (_local7(_arg1, _arg2, _arg3)); }; _local8 = _local7(_arg2, _arg1, _arg3); _local9 = 0; while (_local9 < _local8.m_manifoldCount) { _local10 = _local8.GetManifolds()[_local9]; _local8.GetManifolds()[_local9].normal = _local10.normal.Negative(); _local9++; }; return (_local8); //unresolved jump }; return (null); } } }//package Box2D.Dynamics.Contacts
Section 39
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2ContactConstraint { public var points:Array; public var normal:b2Vec2; public var restitution:Number; public var body1:b2Body; public var manifold:b2Manifold; public var body2:b2Body; public var friction:Number; public var pointCount:int; public function b2ContactConstraint(){ normal = new b2Vec2(); super(); points = new Array(b2Settings.b2_maxManifoldPoints); var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ContactConstraintPoint(); _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; public class b2ContactConstraintPoint { public var r2:b2Vec2; public var separation:Number; public var positionImpulse:Number; public var normalImpulse:Number; public var tangentMass:Number; public var equalizedMass:Number; public var tangentImpulse:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var normalMass:Number; public var velocityBias:Number; public var r1:b2Vec2; public function b2ContactConstraintPoint(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); r1 = new b2Vec2(); r2 = new b2Vec2(); super(); } } }//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2ContactEdge { public var other:b2Body; public var prev:b2ContactEdge; public var contact:b2Contact; public var next:b2ContactEdge; } }//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister) package Box2D.Dynamics.Contacts { public class b2ContactRegister { public var primary:Boolean; public var createFcn:Function; public var destroyFcn:Function; } }//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; public class b2ContactResult { public var position:b2Vec2; public var shape1:b2Shape; public var shape2:b2Shape; public var normalImpulse:Number; public var normal:b2Vec2; public var tangentImpulse:Number; public var id:b2ContactID; public function b2ContactResult(){ position = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2ContactSolver { public var m_constraintCount:int; public var m_constraints:Array; public var m_allocator; public var m_step:b2TimeStep; public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){ var _local5:b2Contact; var _local6:int; var _local7:b2Vec2; var _local8:b2Mat22; var _local10:b2Body; var _local11:b2Body; var _local12:int; var _local13:Array; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:int; var _local23:b2Manifold; var _local24:Number; var _local25:Number; var _local26:b2ContactConstraint; var _local27:uint; var _local28:b2ManifoldPoint; var _local29:b2ContactConstraintPoint; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; var _local39:Number; var _local40:Number; var _local41:Number; var _local42:Number; var _local43:Number; var _local44:Number; var _local45:Number; var _local46:Number; var _local47:Number; m_step = new b2TimeStep(); m_constraints = new Array(); super(); m_step.dt = _arg1.dt; m_step.inv_dt = _arg1.inv_dt; m_step.maxIterations = _arg1.maxIterations; m_allocator = _arg4; m_constraintCount = 0; _local6 = 0; while (_local6 < _arg3) { _local5 = _arg2[_local6]; m_constraintCount = (m_constraintCount + _local5.m_manifoldCount); _local6++; }; _local6 = 0; while (_local6 < m_constraintCount) { m_constraints[_local6] = new b2ContactConstraint(); _local6++; }; var _local9:int; _local6 = 0; while (_local6 < _arg3) { _local5 = _arg2[_local6]; _local10 = _local5.m_shape1.m_body; _local11 = _local5.m_shape2.m_body; _local12 = _local5.m_manifoldCount; _local13 = _local5.GetManifolds(); _local14 = _local5.m_friction; _local15 = _local5.m_restitution; _local16 = _local10.m_linearVelocity.x; _local17 = _local10.m_linearVelocity.y; _local18 = _local11.m_linearVelocity.x; _local19 = _local11.m_linearVelocity.y; _local20 = _local10.m_angularVelocity; _local21 = _local11.m_angularVelocity; _local22 = 0; while (_local22 < _local12) { _local23 = _local13[_local22]; _local24 = _local23.normal.x; _local25 = _local23.normal.y; _local26 = m_constraints[_local9]; _local26.body1 = _local10; _local26.body2 = _local11; _local26.manifold = _local23; _local26.normal.x = _local24; _local26.normal.y = _local25; _local26.pointCount = _local23.pointCount; _local26.friction = _local14; _local26.restitution = _local15; _local27 = 0; while (_local27 < _local26.pointCount) { _local28 = _local23.points[_local27]; _local29 = _local26.points[_local27]; _local29.normalImpulse = _local28.normalImpulse; _local29.tangentImpulse = _local28.tangentImpulse; _local29.separation = _local28.separation; _local29.positionImpulse = 0; _local29.localAnchor1.SetV(_local28.localPoint1); _local29.localAnchor2.SetV(_local28.localPoint2); _local8 = _local10.m_xf.R; _local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x); _local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y); _local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33)); _local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33)); _local32 = _local30; _local29.r1.Set(_local32, _local33); _local8 = _local11.m_xf.R; _local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x); _local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y); _local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35)); _local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35)); _local34 = _local30; _local29.r2.Set(_local34, _local35); _local36 = ((_local32 * _local32) + (_local33 * _local33)); _local37 = ((_local34 * _local34) + (_local35 * _local35)); _local38 = ((_local32 * _local24) + (_local33 * _local25)); _local39 = ((_local34 * _local24) + (_local35 * _local25)); _local40 = (_local10.m_invMass + _local11.m_invMass); _local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39))))); _local29.normalMass = (1 / _local40); _local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass)); _local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39))))); _local29.equalizedMass = (1 / _local41); _local42 = _local25; _local43 = -(_local24); _local44 = ((_local32 * _local42) + (_local33 * _local43)); _local45 = ((_local34 * _local42) + (_local35 * _local43)); _local46 = (_local10.m_invMass + _local11.m_invMass); _local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45))))); _local29.tangentMass = (1 / _local46); _local29.velocityBias = 0; if (_local29.separation > 0){ _local29.velocityBias = (-60 * _local29.separation); }; _local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33)); _local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32)); _local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31)); if (_local47 < -(b2Settings.b2_velocityThreshold)){ _local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47)); }; _local27++; }; _local9++; _local22++; }; _local6++; }; } public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2Mat22; var _local6:b2ContactConstraint; var _local7:b2Body; var _local8:b2Body; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:int; var _local19:int; var _local20:b2ContactConstraintPoint; var _local21:Number; var _local22:Number; var _local23:b2ContactConstraintPoint; var _local5:int; while (_local5 < m_constraintCount) { _local6 = m_constraints[_local5]; _local7 = _local6.body1; _local8 = _local6.body2; _local9 = _local7.m_invMass; _local10 = _local7.m_invI; _local11 = _local8.m_invMass; _local12 = _local8.m_invI; _local13 = _local6.normal.x; _local14 = _local6.normal.y; _local15 = _local14; _local16 = -(_local13); if (_arg1.warmStarting){ _local19 = _local6.pointCount; _local18 = 0; while (_local18 < _local19) { _local20 = _local6.points[_local18]; _local6.points[_local18].normalImpulse = (_local20.normalImpulse * _arg1.dtRatio); _local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio); _local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15)); _local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16)); _local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.r1.x * _local22) - (_local20.r1.y * _local21)))); _local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21)); _local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22)); _local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.r2.x * _local22) - (_local20.r2.y * _local21)))); _local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21)); _local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22)); _local18++; }; } else { _local19 = _local6.pointCount; _local18 = 0; while (_local18 < _local19) { _local23 = _local6.points[_local18]; _local23.normalImpulse = 0; _local23.tangentImpulse = 0; _local18++; }; }; _local5++; }; } public function SolvePositionConstraints(_arg1:Number):Boolean{ var _local3:b2Mat22; var _local4:b2Vec2; var _local6:b2ContactConstraint; var _local7:b2Body; var _local8:b2Body; var _local9:b2Vec2; var _local10:Number; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:int; var _local20:int; var _local21:b2ContactConstraintPoint; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; var _local2:Number = 0; var _local5:int; while (_local5 < m_constraintCount) { _local6 = m_constraints[_local5]; _local7 = _local6.body1; _local8 = _local6.body2; _local9 = _local7.m_sweep.c; _local10 = _local7.m_sweep.a; _local11 = _local8.m_sweep.c; _local12 = _local8.m_sweep.a; _local13 = (_local7.m_mass * _local7.m_invMass); _local14 = (_local7.m_mass * _local7.m_invI); _local15 = (_local8.m_mass * _local8.m_invMass); _local16 = (_local8.m_mass * _local8.m_invI); _local17 = _local6.normal.x; _local18 = _local6.normal.y; _local19 = _local6.pointCount; _local20 = 0; while (_local20 < _local19) { _local21 = _local6.points[_local20]; _local3 = _local7.m_xf.R; _local4 = _local7.m_sweep.localCenter; _local22 = (_local21.localAnchor1.x - _local4.x); _local23 = (_local21.localAnchor1.y - _local4.y); _local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23)); _local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23)); _local22 = _local26; _local3 = _local8.m_xf.R; _local4 = _local8.m_sweep.localCenter; _local24 = (_local21.localAnchor2.x - _local4.x); _local25 = (_local21.localAnchor2.y - _local4.y); _local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25)); _local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25)); _local24 = _local26; _local27 = (_local9.x + _local22); _local28 = (_local9.y + _local23); _local29 = (_local11.x + _local24); _local30 = (_local11.y + _local25); _local31 = (_local29 - _local27); _local32 = (_local30 - _local28); _local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation); _local2 = b2Math.b2Min(_local2, _local33); _local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0)); _local35 = (-(_local21.equalizedMass) * _local34); _local36 = _local21.positionImpulse; _local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0); _local35 = (_local21.positionImpulse - _local36); _local37 = (_local35 * _local17); _local38 = (_local35 * _local18); _local9.x = (_local9.x - (_local13 * _local37)); _local9.y = (_local9.y - (_local13 * _local38)); _local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37)))); _local7.m_sweep.a = _local10; _local7.SynchronizeTransform(); _local11.x = (_local11.x + (_local15 * _local37)); _local11.y = (_local11.y + (_local15 * _local38)); _local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37)))); _local8.m_sweep.a = _local12; _local8.SynchronizeTransform(); _local20++; }; _local5++; }; return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop))); } public function SolveVelocityConstraints():void{ var _local1:int; var _local2:b2ContactConstraintPoint; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:b2Mat22; var _local18:b2Vec2; var _local20:b2ContactConstraint; var _local21:b2Body; var _local22:b2Body; var _local23:Number; var _local24:Number; var _local25:b2Vec2; var _local26:b2Vec2; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:int; var _local38:Number; var _local19:int; while (_local19 < m_constraintCount) { _local20 = m_constraints[_local19]; _local21 = _local20.body1; _local22 = _local20.body2; _local23 = _local21.m_angularVelocity; _local24 = _local22.m_angularVelocity; _local25 = _local21.m_linearVelocity; _local26 = _local22.m_linearVelocity; _local27 = _local21.m_invMass; _local28 = _local21.m_invI; _local29 = _local22.m_invMass; _local30 = _local22.m_invI; _local31 = _local20.normal.x; _local32 = _local20.normal.y; _local33 = _local32; _local34 = -(_local31); _local35 = _local20.friction; _local37 = _local20.pointCount; _local1 = 0; while (_local1 < _local37) { _local2 = _local20.points[_local1]; _local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y)); _local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x)); _local9 = ((_local7 * _local31) + (_local8 * _local32)); _local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias)); _local10 = ((_local7 * _local33) + (_local8 * _local34)); _local12 = (_local2.tangentMass * -(_local10)); _local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0); _local11 = (_local13 - _local2.normalImpulse); _local38 = (_local35 * _local2.normalImpulse); _local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38); _local12 = (_local14 - _local2.tangentImpulse); _local15 = ((_local11 * _local31) + (_local12 * _local33)); _local16 = ((_local11 * _local32) + (_local12 * _local34)); _local25.x = (_local25.x - (_local27 * _local15)); _local25.y = (_local25.y - (_local27 * _local16)); _local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15)))); _local26.x = (_local26.x + (_local29 * _local15)); _local26.y = (_local26.y + (_local29 * _local16)); _local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15)))); _local2.normalImpulse = _local13; _local2.tangentImpulse = _local14; _local1++; }; _local21.m_angularVelocity = _local23; _local22.m_angularVelocity = _local24; _local19++; }; } public function FinalizeVelocityConstraints():void{ var _local2:b2ContactConstraint; var _local3:b2Manifold; var _local4:int; var _local5:b2ManifoldPoint; var _local6:b2ContactConstraintPoint; var _local1:int; while (_local1 < m_constraintCount) { _local2 = m_constraints[_local1]; _local3 = _local2.manifold; _local4 = 0; while (_local4 < _local2.pointCount) { _local5 = _local3.points[_local4]; _local6 = _local2.points[_local4]; _local5.normalImpulse = _local6.normalImpulse; _local5.tangentImpulse = _local6.tangentImpulse; _local4++; }; _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2NullContact extends b2Contact { override public function Evaluate(_arg1:b2ContactListener):void{ } override public function GetManifolds():Array{ return (null); } } }//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2PolyAndCircleContact extends b2Contact { private var m_manifolds:Array; public var m_manifold:b2Manifold; private var m0:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){ m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(_arg1, _arg2); m_manifold = m_manifolds[0]; b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape)); b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape)); m_manifold.pointCount = 0; var _local3:b2ManifoldPoint = m_manifold.points[0]; _local3.normalImpulse = 0; _local3.tangentImpulse = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:int; var _local3:b2Vec2; var _local4:b2Vec2; var _local5:b2ManifoldPoint; var _local10:b2ManifoldPoint; var _local11:Boolean; var _local12:uint; var _local13:int; var _local6:b2Body = m_shape1.m_body; var _local7:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf); var _local8:Array = [false, false]; var _local9:b2ContactPoint = s_evalCP; _local9.shape1 = m_shape1; _local9.shape2 = m_shape2; _local9.friction = m_friction; _local9.restitution = m_restitution; if (m_manifold.pointCount > 0){ _local2 = 0; while (_local2 < m_manifold.pointCount) { _local10 = m_manifold.points[_local2]; _local10.normalImpulse = 0; _local10.tangentImpulse = 0; _local11 = false; _local12 = _local10.id._key; _local13 = 0; while (_local13 < m0.pointCount) { if (_local8[_local13] == true){ } else { _local5 = m0.points[_local13]; if (_local5.id._key == _local12){ _local8[_local13] = true; _local10.normalImpulse = _local5.normalImpulse; _local10.tangentImpulse = _local5.tangentImpulse; _local11 = true; if (_arg1 != null){ _local9.position = _local6.GetWorldPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m_manifold.normal); _local9.separation = _local10.separation; _local9.id.key = _local12; _arg1.Persist(_local9); }; break; }; }; _local13++; }; if ((((_local11 == false)) && (!((_arg1 == null))))){ _local9.position = _local6.GetWorldPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m_manifold.normal); _local9.separation = _local10.separation; _local9.id.key = _local12; _arg1.Add(_local9); }; _local2++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (_arg1 == null){ return; }; _local2 = 0; while (_local2 < m0.pointCount) { if (_local8[_local2]){ } else { _local5 = m0.points[_local2]; _local9.position = _local6.GetWorldPoint(_local5.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m0.normal); _local9.separation = _local5.separation; _local9.id.key = _local5.id._key; _arg1.Remove(_local9); }; _local2++; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolyAndCircleContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; public class b2PolygonContact extends b2Contact { private var m_manifolds:Array; private var m0:b2Manifold; public var m_manifold:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{ m0 = new b2Manifold(); m_manifolds = [new b2Manifold()]; super(_arg1, _arg2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2ManifoldPoint; var _local7:b2ContactPoint; var _local8:int; var _local10:b2ManifoldPoint; var _local11:Boolean; var _local12:uint; var _local13:int; var _local5:b2Body = m_shape1.m_body; var _local6:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf); var _local9:Array = [false, false]; _local7 = s_evalCP; _local7.shape1 = m_shape1; _local7.shape2 = m_shape2; _local7.friction = m_friction; _local7.restitution = m_restitution; if (m_manifold.pointCount > 0){ _local8 = 0; while (_local8 < m_manifold.pointCount) { _local10 = m_manifold.points[_local8]; _local10.normalImpulse = 0; _local10.tangentImpulse = 0; _local11 = false; _local12 = _local10.id._key; _local13 = 0; while (_local13 < m0.pointCount) { if (_local9[_local13] == true){ } else { _local4 = m0.points[_local13]; if (_local4.id._key == _local12){ _local9[_local13] = true; _local10.normalImpulse = _local4.normalImpulse; _local10.tangentImpulse = _local4.tangentImpulse; _local11 = true; if (_arg1 != null){ _local7.position = _local5.GetWorldPoint(_local10.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local10.separation; _local7.id.key = _local12; _arg1.Persist(_local7); }; break; }; }; _local13++; }; if ((((_local11 == false)) && (!((_arg1 == null))))){ _local7.position = _local5.GetWorldPoint(_local10.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local10.separation; _local7.id.key = _local12; _arg1.Add(_local7); }; _local8++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (_arg1 == null){ return; }; _local8 = 0; while (_local8 < m0.pointCount) { if (_local9[_local8]){ } else { _local4 = m0.points[_local8]; _local7.position = _local5.GetWorldPoint(_local4.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m0.normal); _local7.separation = _local4.separation; _local7.id.key = _local4.id._key; _arg1.Remove(_local7); }; _local8++; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolygonContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2DistanceJoint extends b2Joint { public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_bias:Number; public var m_gamma:Number; public var m_u:b2Vec2; public var m_mass:Number; public var m_impulse:Number; public var m_dampingRatio:Number; public var m_frequencyHz:Number; public var m_length:Number; public function b2DistanceJoint(_arg1:b2DistanceJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u = new b2Vec2(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_length = _arg1.length; m_frequencyHz = _arg1.frequencyHz; m_dampingRatio = _arg1.dampingRatio; m_impulse = 0; m_gamma = 0; m_bias = 0; m_inv_dt = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Mat22; var _local3:Number; var _local4:b2Body; var _local5:b2Body; var _local6:Number; var _local8:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; m_inv_dt = _arg1.inv_dt; _local4 = m_body1; _local5 = m_body2; _local2 = _local4.m_xf.R; _local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor1.y - _local4.m_sweep.localCenter.y); _local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7)); _local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7)); _local6 = _local3; _local2 = _local5.m_xf.R; _local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local5.m_sweep.localCenter.y); _local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9)); _local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9)); _local8 = _local3; m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6); m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7); var _local10:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y))); if (_local10 > b2Settings.b2_linearSlop){ m_u.Multiply((1 / _local10)); } else { m_u.SetZero(); }; var _local11:Number = ((_local6 * m_u.y) - (_local7 * m_u.x)); var _local12:Number = ((_local8 * m_u.y) - (_local9 * m_u.x)); var _local13:Number = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12)); m_mass = (1 / _local13); if (m_frequencyHz > 0){ _local14 = (_local10 - m_length); _local15 = ((2 * Math.PI) * m_frequencyHz); _local16 = (((2 * m_mass) * m_dampingRatio) * _local15); _local17 = ((m_mass * _local15) * _local15); m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17)))); m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma); m_mass = (1 / (_local13 + m_gamma)); }; if (_arg1.warmStarting){ m_impulse = (m_impulse * _arg1.dtRatio); _local18 = (m_impulse * m_u.x); _local19 = (m_impulse * m_u.y); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19)); _local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18)))); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19)); _local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18)))); } else { m_impulse = 0; }; } override public function GetReactionTorque():Number{ return (0); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = new b2Vec2(); _local1.SetV(m_u); _local1.Multiply((m_inv_dt * m_impulse)); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local1:b2Mat22; if (m_frequencyHz > 0){ return (true); }; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local1 = _local2.m_xf.R; var _local4:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local5:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); var _local6:Number = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5)); _local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5)); _local4 = _local6; _local1 = _local3.m_xf.R; var _local7:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local8:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8)); _local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8)); _local7 = _local6; var _local9:Number = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4); var _local10:Number = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5); var _local11:Number = Math.sqrt(((_local9 * _local9) + (_local10 * _local10))); _local9 = (_local9 / _local11); _local10 = (_local10 / _local11); var _local12:Number = (_local11 - m_length); _local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); var _local13:Number = (-(m_mass) * _local12); m_u.Set(_local9, _local10); var _local14:Number = (_local13 * m_u.x); var _local15:Number = (_local13 * m_u.y); _local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14)))); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15)); _local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14)))); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop)); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Mat22; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; _local2 = _local3.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local6:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); var _local7:Number = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6)); _local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6)); _local5 = _local7; _local2 = _local4.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9)); _local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9)); _local8 = _local7; var _local10:Number = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6)); var _local11:Number = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5)); var _local12:Number = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9)); var _local13:Number = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8)); var _local14:Number = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11))); var _local15:Number = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse))); m_impulse = (m_impulse + _local15); var _local16:Number = (_local15 * m_u.x); var _local17:Number = (_local15 * m_u.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16)))); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17)); _local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); } } }//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2DistanceJointDef extends b2JointDef { public var localAnchor1:b2Vec2; public var length:Number; public var dampingRatio:Number; public var localAnchor2:b2Vec2; public var frequencyHz:Number; public function b2DistanceJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_distanceJoint; length = 1; frequencyHz = 0; dampingRatio = 0; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1.SetV(body1.GetLocalPoint(_arg3)); localAnchor2.SetV(body2.GetLocalPoint(_arg4)); var _local5:Number = (_arg4.x - _arg3.x); var _local6:Number = (_arg4.y - _arg3.y); length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6))); frequencyHz = 0; dampingRatio = 0; } } }//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2GearJoint extends b2Joint { public var m_ground2:b2Body; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_ratio:Number; public var m_revolute2:b2RevoluteJoint; public var m_force:Number; public var m_mass:Number; public var m_prismatic2:b2PrismaticJoint; public var m_ground1:b2Body; public var m_revolute1:b2RevoluteJoint; public var m_prismatic1:b2PrismaticJoint; public var m_constant:Number; public var m_J:b2Jacobian; public function b2GearJoint(_arg1:b2GearJointDef){ var _local4:Number; var _local5:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_J = new b2Jacobian(); super(_arg1); var _local2:int = _arg1.joint1.m_type; var _local3:int = _arg1.joint2.m_type; m_revolute1 = null; m_prismatic1 = null; m_revolute2 = null; m_prismatic2 = null; m_ground1 = _arg1.joint1.m_body1; m_body1 = _arg1.joint1.m_body2; if (_local2 == b2Joint.e_revoluteJoint){ m_revolute1 = (_arg1.joint1 as b2RevoluteJoint); m_groundAnchor1.SetV(m_revolute1.m_localAnchor1); m_localAnchor1.SetV(m_revolute1.m_localAnchor2); _local4 = m_revolute1.GetJointAngle(); } else { m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint); m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1); m_localAnchor1.SetV(m_prismatic1.m_localAnchor2); _local4 = m_prismatic1.GetJointTranslation(); }; m_ground2 = _arg1.joint2.m_body1; m_body2 = _arg1.joint2.m_body2; if (_local3 == b2Joint.e_revoluteJoint){ m_revolute2 = (_arg1.joint2 as b2RevoluteJoint); m_groundAnchor2.SetV(m_revolute2.m_localAnchor1); m_localAnchor2.SetV(m_revolute2.m_localAnchor2); _local5 = m_revolute2.GetJointAngle(); } else { m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint); m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1); m_localAnchor2.SetV(m_prismatic2.m_localAnchor2); _local5 = m_prismatic2.GetJointTranslation(); }; m_ratio = _arg1.ratio; m_constant = (_local4 + (m_ratio * _local5)); m_force = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:b2Mat22; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local15:Number; var _local2:b2Body = m_ground1; var _local3:b2Body = m_ground2; var _local4:b2Body = m_body1; var _local5:b2Body = m_body2; var _local14:Number = 0; m_J.SetZero(); if (m_revolute1){ m_J.angular1 = -1; _local14 = (_local14 + _local4.m_invI); } else { _local10 = _local2.m_xf.R; _local11 = m_prismatic1.m_localXAxis1; _local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); _local10 = _local4.m_xf.R; _local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y); _local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9)); _local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9)); _local8 = _local13; _local12 = ((_local8 * _local7) - (_local9 * _local6)); m_J.linear1.Set(-(_local6), -(_local7)); m_J.angular1 = -(_local12); _local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12))); }; if (m_revolute2){ m_J.angular2 = -(m_ratio); _local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI)); } else { _local10 = _local3.m_xf.R; _local11 = m_prismatic2.m_localXAxis1; _local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); _local10 = _local5.m_xf.R; _local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x); _local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y); _local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9)); _local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9)); _local8 = _local13; _local12 = ((_local8 * _local7) - (_local9 * _local6)); m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7)); m_J.angular2 = (-(m_ratio) * _local12); _local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12)))); }; m_mass = (1 / _local14); if (_arg1.warmStarting){ _local15 = (_arg1.dt * m_force); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y)); _local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1)); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y)); _local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2)); } else { m_force = 0; }; } override public function GetReactionTorque():Number{ var _local1:b2Mat22 = m_body2.m_xf.R; var _local2:Number = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x); var _local3:Number = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y); var _local4:Number = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3)); _local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3)); _local2 = _local4; _local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x)))); return (_local4); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y)); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local4:Number; var _local5:Number; var _local1:Number = 0; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; if (m_revolute1){ _local4 = m_revolute1.GetJointAngle(); } else { _local4 = m_prismatic1.GetJointTranslation(); }; if (m_revolute2){ _local5 = m_revolute2.GetJointAngle(); } else { _local5 = m_prismatic2.GetJointTranslation(); }; var _local6:Number = (m_constant - (_local4 + (m_ratio * _local5))); var _local7:Number = (-(m_mass) * _local6); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y)); _local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1)); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2)); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((_local1 < b2Settings.b2_linearSlop)); } public function GetRatio():Number{ return (m_ratio); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; var _local4:Number = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); var _local5:Number = ((-(_arg1.inv_dt) * m_mass) * _local4); m_force = (m_force + _local5); var _local6:Number = (_arg1.dt * _local5); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2)); } } }//package Box2D.Dynamics.Joints
Section 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef) package Box2D.Dynamics.Joints { public class b2GearJointDef extends b2JointDef { public var joint1:b2Joint; public var joint2:b2Joint; public var ratio:Number; public function b2GearJointDef(){ type = b2Joint.e_gearJoint; joint1 = null; joint2 = null; ratio = 1; } } }//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2Jacobian { public var linear1:b2Vec2; public var linear2:b2Vec2; public var angular1:Number; public var angular2:Number; public function b2Jacobian(){ linear1 = new b2Vec2(); linear2 = new b2Vec2(); super(); } public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{ linear1.SetV(_arg1); angular1 = _arg2; linear2.SetV(_arg3); angular2 = _arg4; } public function SetZero():void{ linear1.SetZero(); angular1 = 0; linear2.SetZero(); angular2 = 0; } public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{ return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4))); } } }//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2Joint { public var m_islandFlag:Boolean; public var m_body1:b2Body; public var m_prev:b2Joint; public var m_next:b2Joint; public var m_type:int; public var m_collideConnected:Boolean; public var m_node1:b2JointEdge; public var m_node2:b2JointEdge; public var m_inv_dt:Number; public var m_userData; public var m_body2:b2Body; public static const e_unknownJoint:int = 0; public static const e_inactiveLimit:int = 0; public static const e_atUpperLimit:int = 2; public static const e_atLowerLimit:int = 1; public static const e_gearJoint:int = 6; public static const e_revoluteJoint:int = 1; public static const e_equalLimits:int = 3; public static const e_distanceJoint:int = 3; public static const e_pulleyJoint:int = 4; public static const e_prismaticJoint:int = 2; public static const e_mouseJoint:int = 5; public function b2Joint(_arg1:b2JointDef){ m_node1 = new b2JointEdge(); m_node2 = new b2JointEdge(); super(); m_type = _arg1.type; m_prev = null; m_next = null; m_body1 = _arg1.body1; m_body2 = _arg1.body2; m_collideConnected = _arg1.collideConnected; m_islandFlag = false; m_userData = _arg1.userData; } public function GetBody2():b2Body{ return (m_body2); } public function GetAnchor1():b2Vec2{ return (null); } public function GetAnchor2():b2Vec2{ return (null); } public function GetNext():b2Joint{ return (m_next); } public function GetType():int{ return (m_type); } public function InitVelocityConstraints(_arg1:b2TimeStep):void{ } public function GetReactionTorque():Number{ return (0); } public function GetUserData(){ return (m_userData); } public function GetReactionForce():b2Vec2{ return (null); } public function SolvePositionConstraints():Boolean{ return (false); } public function SetUserData(_arg1):void{ m_userData = _arg1; } public function GetBody1():b2Body{ return (m_body1); } public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ } public function InitPositionConstraints():void{ } public static function Destroy(_arg1:b2Joint, _arg2):void{ } public static function Create(_arg1:b2JointDef, _arg2):b2Joint{ var _local3:b2Joint; switch (_arg1.type){ case e_distanceJoint: _local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef)); break; case e_mouseJoint: _local3 = new b2MouseJoint((_arg1 as b2MouseJointDef)); break; case e_prismaticJoint: _local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef)); break; case e_revoluteJoint: _local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef)); break; case e_pulleyJoint: _local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef)); break; case e_gearJoint: _local3 = new b2GearJoint((_arg1 as b2GearJointDef)); break; default: break; }; return (_local3); } } }//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointDef { public var body2:b2Body; public var type:int; public var userData; public var collideConnected:Boolean; public var body1:b2Body; public function b2JointDef(){ type = b2Joint.e_unknownJoint; userData = null; body1 = null; body2 = null; collideConnected = false; } } }//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointEdge { public var other:b2Body; public var next:b2JointEdge; public var prev:b2JointEdge; public var joint:b2Joint; } }//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2MouseJoint extends b2Joint { private var K1:b2Mat22; private var K:b2Mat22; public var m_beta:Number; public var m_mass:b2Mat22; private var K2:b2Mat22; public var m_target:b2Vec2; public var m_gamma:Number; public var m_impulse:b2Vec2; public var m_C:b2Vec2; public var m_localAnchor:b2Vec2; public var m_maxForce:Number; public function b2MouseJoint(_arg1:b2MouseJointDef){ var _local3:Number; K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); m_localAnchor = new b2Vec2(); m_target = new b2Vec2(); m_impulse = new b2Vec2(); m_mass = new b2Mat22(); m_C = new b2Vec2(); super(_arg1); m_target.SetV(_arg1.target); var _local2:Number = (m_target.x - m_body2.m_xf.position.x); _local3 = (m_target.y - m_body2.m_xf.position.y); var _local4:b2Mat22 = m_body2.m_xf.R; m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y)); m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y)); m_maxForce = _arg1.maxForce; m_impulse.SetZero(); var _local5:Number = m_body2.m_mass; var _local6:Number = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz); var _local7:Number = (((2 * _local5) * _arg1.dampingRatio) * _local6); var _local8:Number = ((_arg1.timeStep * _local5) * (_local6 * _local6)); m_gamma = (1 / (_local7 + _local8)); m_beta = (_local8 / (_local7 + _local8)); } public function SetTarget(_arg1:b2Vec2):void{ if (m_body2.IsSleeping()){ m_body2.WakeUp(); }; m_target = _arg1; } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local7:Number; var _local8:Number; _local2 = m_body2; _local3 = _local2.m_xf.R; _local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x); _local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y); var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local7 = _local2.m_invMass; _local8 = _local2.m_invI; K1.col1.x = _local7; K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = _local7; K2.col1.x = ((_local8 * _local5) * _local5); K2.col2.x = ((-(_local8) * _local4) * _local5); K2.col1.y = ((-(_local8) * _local4) * _local5); K2.col2.y = ((_local8 * _local4) * _local4); K.SetM(K1); K.AddM(K2); K.col1.x = (K.col1.x + m_gamma); K.col2.y = (K.col2.y + m_gamma); K.Invert(m_mass); m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x); m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y); _local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98); var _local9:Number = (_arg1.dt * m_impulse.x); var _local10:Number = (_arg1.dt * m_impulse.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9)))); } override public function GetAnchor1():b2Vec2{ return (m_target); } override public function GetReactionTorque():Number{ return (0); } override public function GetReactionForce():b2Vec2{ return (m_impulse); } override public function SolvePositionConstraints():Boolean{ return (true); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local2:b2Body = m_body2; _local3 = _local2.m_xf.R; var _local6:Number = (m_localAnchor.x - _local2.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor.y - _local2.m_sweep.localCenter.y); _local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7)); _local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7)); _local6 = _local4; var _local8:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7)); var _local9:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6)); _local3 = m_mass; _local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x)); _local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y)); var _local10:Number = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5))); var _local11:Number = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5))); var _local12:Number = m_impulse.x; var _local13:Number = m_impulse.y; m_impulse.x = (m_impulse.x + _local10); m_impulse.y = (m_impulse.y + _local11); var _local14:Number = m_impulse.Length(); if (_local14 > m_maxForce){ m_impulse.Multiply((m_maxForce / _local14)); }; _local10 = (m_impulse.x - _local12); _local11 = (m_impulse.y - _local13); var _local15:Number = (_arg1.dt * _local10); var _local16:Number = (_arg1.dt * _local11); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15)))); } } }//package Box2D.Dynamics.Joints
Section 57
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2MouseJointDef extends b2JointDef { public var timeStep:Number; public var target:b2Vec2; public var maxForce:Number; public var dampingRatio:Number; public var frequencyHz:Number; public function b2MouseJointDef(){ target = new b2Vec2(); super(); type = b2Joint.e_mouseJoint; maxForce = 0; frequencyHz = 5; dampingRatio = 0.7; timeStep = (1 / 60); } } }//package Box2D.Dynamics.Joints
Section 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2PrismaticJoint extends b2Joint { public var m_limitForce:Number; public var m_lowerTranslation:Number; public var m_localXAxis1:b2Vec2; public var m_refAngle:Number; public var m_torque:Number; public var m_motorForce:Number; public var m_enableLimit:Boolean; public var m_angularMass:Number; public var m_maxMotorForce:Number; public var m_localYAxis1:b2Vec2; public var m_force:Number; public var m_motorMass:Number; public var m_upperTranslation:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_limitState:int; public var m_linearMass:Number; public var m_motorJacobian:b2Jacobian; public var m_limitPositionImpulse:Number; public var m_motorSpeed:Number; public var m_enableMotor:Boolean; public var m_linearJacobian:b2Jacobian; public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_localXAxis1 = new b2Vec2(); m_localYAxis1 = new b2Vec2(); m_linearJacobian = new b2Jacobian(); m_motorJacobian = new b2Jacobian(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_localXAxis1.SetV(_arg1.localAxis1); m_localYAxis1.x = -(m_localXAxis1.y); m_localYAxis1.y = m_localXAxis1.x; m_refAngle = _arg1.referenceAngle; m_linearJacobian.SetZero(); m_linearMass = 0; m_force = 0; m_angularMass = 0; m_torque = 0; m_motorJacobian.SetZero(); m_motorMass = 0; m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerTranslation = _arg1.lowerTranslation; m_upperTranslation = _arg1.upperTranslation; m_maxMotorForce = _arg1.maxMotorForce; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local8:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; var _local4:Number = _local2.m_invMass; var _local5:Number = _local3.m_invMass; var _local6:Number = _local2.m_invI; var _local7:Number = _local3.m_invI; var _local9:Number = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); var _local10:Number = ((-(_arg1.inv_dt) * m_linearMass) * _local9); m_force = (m_force + _local10); var _local11:Number = (_arg1.dt * _local10); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2)); var _local12:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity); var _local13:Number = ((-(_arg1.inv_dt) * m_angularMass) * _local12); m_torque = (m_torque + _local13); var _local14:Number = (_arg1.dt * _local13); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14)); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed); _local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15); _local17 = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce); _local16 = (m_motorForce - _local17); _local11 = (_arg1.dt * _local16); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); _local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + _local19); } else { if (m_limitState == e_atLowerLimit){ _local8 = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0); _local19 = (m_limitForce - _local8); } else { if (m_limitState == e_atUpperLimit){ _local8 = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0); _local19 = (m_limitForce - _local8); }; }; }; _local11 = (_arg1.dt * _local19); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2)); }; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function GetUpperLimit():Number{ return (m_upperTranslation); } public function GetLowerLimit():Number{ return (m_lowerTranslation); } public function EnableMotor(_arg1:Boolean):void{ m_enableMotor = _arg1; } public function GetJointTranslation():Number{ var _local3:b2Mat22; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; var _local4:b2Vec2 = _local1.GetWorldPoint(m_localAnchor1); var _local5:b2Vec2 = _local2.GetWorldPoint(m_localAnchor2); var _local6:Number = (_local5.x - _local4.x); var _local7:Number = (_local5.y - _local4.y); var _local8:b2Vec2 = _local1.GetWorldVector(m_localXAxis1); var _local9:Number = ((_local8.x * _local6) + (_local8.y * _local7)); return (_local9); } public function GetMotorSpeed():Number{ return (m_motorSpeed); } override public function GetReactionForce():b2Vec2{ var _local1:b2Mat22 = m_body1.m_xf.R; var _local2:Number = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y))); var _local3:Number = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y))); var _local4:Number = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y))); var _local5:Number = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y))); return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5)))); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local9:b2Mat22; var _local10:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; var _local5:Number = _local3.m_invMass; var _local6:Number = _local4.m_invMass; var _local7:Number = _local3.m_invI; var _local8:Number = _local4.m_invI; _local9 = _local3.m_xf.R; var _local11:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local12:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12)); _local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12)); _local11 = _local10; _local9 = _local4.m_xf.R; var _local13:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local14:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14)); _local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14)); _local13 = _local10; var _local15:Number = (_local3.m_sweep.c.x + _local11); var _local16:Number = (_local3.m_sweep.c.y + _local12); var _local17:Number = (_local4.m_sweep.c.x + _local13); var _local18:Number = (_local4.m_sweep.c.y + _local14); var _local19:Number = (_local17 - _local15); var _local20:Number = (_local18 - _local16); _local9 = _local3.m_xf.R; var _local21:Number = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y)); var _local22:Number = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y)); var _local23:Number = ((_local21 * _local19) + (_local22 * _local20)); _local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); var _local24:Number = (-(m_linearMass) * _local23); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2)); var _local25:Number = b2Math.b2Abs(_local23); var _local26:Number = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle); _local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); var _local27:Number = (-(m_angularMass) * _local26); _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); var _local28:Number = b2Math.b2Abs(_local26); if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local9 = _local3.m_xf.R; _local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); _local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12)); _local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12)); _local11 = _local10; _local9 = _local4.m_xf.R; _local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); _local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14)); _local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14)); _local13 = _local10; _local15 = (_local3.m_sweep.c.x + _local11); _local16 = (_local3.m_sweep.c.y + _local12); _local17 = (_local4.m_sweep.c.x + _local13); _local18 = (_local4.m_sweep.c.y + _local14); _local19 = (_local17 - _local15); _local20 = (_local18 - _local16); _local9 = _local3.m_xf.R; _local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y)); _local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y)); _local31 = ((_local29 * _local19) + (_local30 * _local20)); _local32 = 0; if (m_limitState == e_equalLimits){ _local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local32 = (-(m_motorMass) * _local1); _local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26)); } else { if (m_limitState == e_atLowerLimit){ _local1 = (_local31 - m_lowerTranslation); _local25 = b2Math.b2Max(_local25, -(_local1)); _local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local32 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0); _local32 = (m_limitPositionImpulse - _local2); } else { if (m_limitState == e_atUpperLimit){ _local1 = (_local31 - m_upperTranslation); _local25 = b2Math.b2Max(_local25, _local1); _local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection); _local32 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0); _local32 = (m_limitPositionImpulse - _local2); }; }; }; _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop)))); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function GetJointSpeed():Number{ var _local3:b2Mat22; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; _local3 = _local1.m_xf.R; var _local4:Number = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); var _local5:Number = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local3 = _local2.m_xf.R; var _local7:Number = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); var _local8:Number = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8)); _local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8)); _local7 = _local6; var _local9:Number = (_local1.m_sweep.c.x + _local4); var _local10:Number = (_local1.m_sweep.c.y + _local5); var _local11:Number = (_local2.m_sweep.c.x + _local7); var _local12:Number = (_local2.m_sweep.c.y + _local8); var _local13:Number = (_local11 - _local9); var _local14:Number = (_local12 - _local10); var _local15:b2Vec2 = _local1.GetWorldVector(m_localXAxis1); var _local16:b2Vec2 = _local1.m_linearVelocity; var _local17:b2Vec2 = _local2.m_linearVelocity; var _local18:Number = _local1.m_angularVelocity; var _local19:Number = _local2.m_angularVelocity; var _local20:Number = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4))))); return (_local20); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local5:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local10:Number = _local2.m_invMass; var _local11:Number = _local3.m_invMass; var _local12:Number = _local2.m_invI; var _local13:Number = _local3.m_invI; _local4 = _local2.m_xf.R; var _local14:Number = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y)); var _local15:Number = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y)); var _local16:Number = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x); var _local17:Number = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y); m_linearJacobian.linear1.x = -(_local14); m_linearJacobian.linear1.y = -(_local15); m_linearJacobian.linear2.x = _local14; m_linearJacobian.linear2.y = _local15; m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14))); m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14)); m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2)); m_linearMass = (1 / m_linearMass); m_angularMass = (_local12 + _local13); if (m_angularMass > Number.MIN_VALUE){ m_angularMass = (1 / m_angularMass); }; if (((m_enableLimit) || (m_enableMotor))){ _local4 = _local2.m_xf.R; _local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y)); _local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y)); m_motorJacobian.linear1.x = -(_local18); m_motorJacobian.linear1.y = -(_local19); m_motorJacobian.linear2.x = _local18; m_motorJacobian.linear2.y = _local19; m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18))); m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18)); m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2)); m_motorMass = (1 / m_motorMass); if (m_enableLimit){ _local20 = (_local16 - _local6); _local21 = (_local17 - _local7); _local22 = ((_local18 * _local20) + (_local19 * _local21)); if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){ m_limitState = e_equalLimits; } else { if (_local22 <= m_lowerTranslation){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (_local22 >= m_upperTranslation){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; }; }; if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit == false){ m_limitForce = 0; }; if (_arg1.warmStarting){ _local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x))); _local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y))); _local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x))); _local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y))); _local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1))); _local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2))); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28)); } else { m_force = 0; m_torque = 0; m_limitForce = 0; m_motorForce = 0; }; m_limitPositionImpulse = 0; } public function GetMotorForce():Number{ return (m_motorForce); } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } public function SetMaxMotorForce(_arg1:Number):void{ m_maxMotorForce = _arg1; } override public function GetReactionTorque():Number{ return (m_torque); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerTranslation = _arg1; m_upperTranslation = _arg2; } } }//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2PrismaticJointDef extends b2JointDef { public var motorSpeed:Number; public var localAxis1:b2Vec2; public var referenceAngle:Number; public var upperTranslation:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var enableLimit:Boolean; public var enableMotor:Boolean; public var maxMotorForce:Number; public var lowerTranslation:Number; public function b2PrismaticJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); localAxis1 = new b2Vec2(); super(); type = b2Joint.e_prismaticJoint; localAxis1.Set(1, 0); referenceAngle = 0; enableLimit = false; lowerTranslation = 0; upperTranslation = 0; enableMotor = false; maxMotorForce = 0; motorSpeed = 0; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1 = body1.GetLocalPoint(_arg3); localAnchor2 = body2.GetLocalPoint(_arg3); localAxis1 = body1.GetLocalVector(_arg4); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2PulleyJoint extends b2Joint { public var m_limitState1:int; public var m_limitState2:int; public var m_ground:b2Body; public var m_maxLength2:Number; public var m_maxLength1:Number; public var m_limitPositionImpulse1:Number; public var m_limitPositionImpulse2:Number; public var m_force:Number; public var m_constant:Number; public var m_positionImpulse:Number; public var m_state:int; public var m_ratio:Number; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_limitMass1:Number; public var m_limitMass2:Number; public var m_pulleyMass:Number; public var m_u1:b2Vec2; public var m_limitForce1:Number; public var m_limitForce2:Number; public var m_u2:b2Vec2; public static const b2_minPulleyLength:Number = 2; public function b2PulleyJoint(_arg1:b2PulleyJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u1 = new b2Vec2(); m_u2 = new b2Vec2(); super(_arg1); m_ground = m_body1.m_world.m_groundBody; m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x); m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y); m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x); m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_ratio = _arg1.ratio; m_constant = (_arg1.length1 + (m_ratio * _arg1.length2)); m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength))); m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio)); m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; } public function GetGroundAnchor2():b2Vec2{ var _local1:b2Vec2 = m_ground.m_xf.position.Copy(); _local1.Add(m_groundAnchor2); return (_local1); } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = m_u2.Copy(); _local1.Multiply(m_force); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local3:b2Mat22; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; var _local4:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local5:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local6:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local7:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); var _local23:Number = 0; if (m_state == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9)); _local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9)); _local8 = _local22; _local3 = _local2.m_xf.R; _local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11)); _local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11)); _local10 = _local22; _local12 = (_local1.m_sweep.c.x + _local8); _local13 = (_local1.m_sweep.c.y + _local9); _local14 = (_local2.m_sweep.c.x + _local10); _local15 = (_local2.m_sweep.c.y + _local11); m_u1.Set((_local12 - _local4), (_local13 - _local5)); m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local16 = m_u1.Length(); _local17 = m_u2.Length(); if (_local16 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / _local16)); } else { m_u1.SetZero(); }; if (_local17 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / _local17)); } else { m_u2.SetZero(); }; _local18 = ((m_constant - _local16) - (m_ratio * _local17)); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_pulleyMass) * _local18); _local20 = m_positionImpulse; m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19)); _local19 = (m_positionImpulse - _local20); _local12 = (-(_local19) * m_u1.x); _local13 = (-(_local19) * m_u1.y); _local14 = ((-(m_ratio) * _local19) * m_u2.x); _local15 = ((-(m_ratio) * _local19) * m_u2.y); _local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12)); _local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13)); _local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12)))); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local1.SynchronizeTransform(); _local2.SynchronizeTransform(); }; if (m_limitState1 == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9)); _local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9)); _local8 = _local22; _local12 = (_local1.m_sweep.c.x + _local8); _local13 = (_local1.m_sweep.c.y + _local9); m_u1.Set((_local12 - _local4), (_local13 - _local5)); _local16 = m_u1.Length(); if (_local16 > b2Settings.b2_linearSlop){ m_u1.x = (m_u1.x * (1 / _local16)); m_u1.y = (m_u1.y * (1 / _local16)); } else { m_u1.SetZero(); }; _local18 = (m_maxLength1 - _local16); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass1) * _local18); _local21 = m_limitPositionImpulse1; m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19)); _local19 = (m_limitPositionImpulse1 - _local21); _local12 = (-(_local19) * m_u1.x); _local13 = (-(_local19) * m_u1.y); _local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12)); _local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13)); _local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12)))); _local1.SynchronizeTransform(); }; if (m_limitState2 == e_atUpperLimit){ _local3 = _local2.m_xf.R; _local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11)); _local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11)); _local10 = _local22; _local14 = (_local2.m_sweep.c.x + _local10); _local15 = (_local2.m_sweep.c.y + _local11); m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local17 = m_u2.Length(); if (_local17 > b2Settings.b2_linearSlop){ m_u2.x = (m_u2.x * (1 / _local17)); m_u2.y = (m_u2.y * (1 / _local17)); } else { m_u2.SetZero(); }; _local18 = (m_maxLength2 - _local17); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass2) * _local18); _local21 = m_limitPositionImpulse2; m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19)); _local19 = (m_limitPositionImpulse2 - _local21); _local14 = (-(_local19) * m_u2.x); _local15 = (-(_local19) * m_u2.y); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local2.SynchronizeTransform(); }; return ((_local23 < b2Settings.b2_linearSlop)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6)); _local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6)); _local5 = _local7; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local7; var _local10:Number = (_local2.m_sweep.c.x + _local5); var _local11:Number = (_local2.m_sweep.c.y + _local6); var _local12:Number = (_local3.m_sweep.c.x + _local8); var _local13:Number = (_local3.m_sweep.c.y + _local9); var _local14:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local15:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local16:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local17:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); m_u1.Set((_local10 - _local14), (_local11 - _local15)); m_u2.Set((_local12 - _local16), (_local13 - _local17)); var _local18:Number = m_u1.Length(); var _local19:Number = m_u2.Length(); if (_local18 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / _local18)); } else { m_u1.SetZero(); }; if (_local19 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / _local19)); } else { m_u2.SetZero(); }; var _local20:Number = ((m_constant - _local18) - (m_ratio * _local19)); if (_local20 > 0){ m_state = e_inactiveLimit; m_force = 0; } else { m_state = e_atUpperLimit; m_positionImpulse = 0; }; if (_local18 < m_maxLength1){ m_limitState1 = e_inactiveLimit; m_limitForce1 = 0; } else { m_limitState1 = e_atUpperLimit; m_limitPositionImpulse1 = 0; }; if (_local19 < m_maxLength2){ m_limitState2 = e_inactiveLimit; m_limitForce2 = 0; } else { m_limitState2 = e_atUpperLimit; m_limitPositionImpulse2 = 0; }; var _local21:Number = ((_local5 * m_u1.y) - (_local6 * m_u1.x)); var _local22:Number = ((_local8 * m_u2.y) - (_local9 * m_u2.x)); m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21)); m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22)); m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2)); m_limitMass1 = (1 / m_limitMass1); m_limitMass2 = (1 / m_limitMass2); m_pulleyMass = (1 / m_pulleyMass); if (_arg1.warmStarting){ _local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x); _local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y); _local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x); _local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25)))); } else { m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; }; } override public function GetReactionTorque():Number{ return (0); } public function GetRatio():Number{ return (m_ratio); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6)); _local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6)); _local5 = _local7; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local7; if (m_state == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13)))); _local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18); _local20 = m_force; m_force = b2Math.b2Max(0, (m_force + _local19)); _local19 = (m_force - _local20); _local14 = ((-(_arg1.dt) * _local19) * m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * m_u1.y); _local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x); _local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; if (m_limitState1 == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11))); _local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18); _local20 = m_limitForce1; m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19)); _local19 = (m_limitForce1 - _local20); _local14 = ((-(_arg1.dt) * _local19) * m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * m_u1.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14)))); }; if (m_limitState2 == e_atUpperLimit){ _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13))); _local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18); _local20 = m_limitForce2; m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19)); _local19 = (m_limitForce2 - _local20); _local16 = ((-(_arg1.dt) * _local19) * m_u2.x); _local17 = ((-(_arg1.dt) * _local19) * m_u2.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; } public function GetLength1():Number{ var _local1:b2Vec2 = m_body1.GetWorldPoint(m_localAnchor1); var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local4:Number = (_local1.x - _local2); var _local5:Number = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetLength2():Number{ var _local1:b2Vec2 = m_body2.GetWorldPoint(m_localAnchor2); var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); var _local4:Number = (_local1.x - _local2); var _local5:Number = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetGroundAnchor1():b2Vec2{ var _local1:b2Vec2 = m_ground.m_xf.position.Copy(); _local1.Add(m_groundAnchor1); return (_local1); } } }//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2PulleyJointDef extends b2JointDef { public var maxLength1:Number; public var maxLength2:Number; public var length1:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var groundAnchor1:b2Vec2; public var groundAnchor2:b2Vec2; public var ratio:Number; public var length2:Number; public function b2PulleyJointDef(){ groundAnchor1 = new b2Vec2(); groundAnchor2 = new b2Vec2(); localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_pulleyJoint; groundAnchor1.Set(-1, 1); groundAnchor2.Set(1, 1); localAnchor1.Set(-1, 0); localAnchor2.Set(1, 0); length1 = 0; maxLength1 = 0; length2 = 0; maxLength2 = 0; ratio = 1; collideConnected = true; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{ body1 = _arg1; body2 = _arg2; groundAnchor1.SetV(_arg3); groundAnchor2.SetV(_arg4); localAnchor1 = body1.GetLocalPoint(_arg5); localAnchor2 = body2.GetLocalPoint(_arg6); var _local8:Number = (_arg5.x - _arg3.x); var _local9:Number = (_arg5.y - _arg3.y); length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); var _local10:Number = (_arg6.x - _arg4.x); var _local11:Number = (_arg6.y - _arg4.y); length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11))); ratio = _arg7; var _local12:Number = (length1 + (ratio * length2)); maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength)); maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio); } } }//package Box2D.Dynamics.Joints
Section 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2RevoluteJoint extends b2Joint { public var m_limitForce:Number; public var m_pivotMass:b2Mat22; public var m_motorForce:Number; public var m_enableLimit:Boolean; public var m_limitState:int; public var m_motorMass:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; private var K1:b2Mat22; private var K2:b2Mat22; private var K3:b2Mat22; private var K:b2Mat22; public var m_pivotForce:b2Vec2; public var m_enableMotor:Boolean; public var m_referenceAngle:Number; public var m_limitPositionImpulse:Number; public var m_motorSpeed:Number; public var m_upperAngle:Number; public var m_lowerAngle:Number; public var m_maxMotorTorque:Number; public static var tImpulse:b2Vec2 = new b2Vec2(); public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){ K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); K3 = new b2Mat22(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_pivotForce = new b2Vec2(); m_pivotMass = new b2Mat22(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_referenceAngle = _arg1.referenceAngle; m_pivotForce.Set(0, 0); m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerAngle = _arg1.lowerAngle; m_upperAngle = _arg1.upperAngle; m_maxMotorTorque = _arg1.maxMotorTorque; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local5:Number; var _local10:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local11:Number = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7)); var _local12:Number = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6)); var _local13:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12))); var _local14:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12))); m_pivotForce.x = (m_pivotForce.x + _local13); m_pivotForce.y = (m_pivotForce.y + _local14); var _local15:Number = (_arg1.dt * _local13); _local16 = (_arg1.dt * _local14); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16)); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15)))); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed); _local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17); _local19 = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque); _local18 = (m_motorForce - _local19); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity); _local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + _local21); } else { if (m_limitState == e_atLowerLimit){ _local10 = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0); _local21 = (m_limitForce - _local10); } else { if (m_limitState == e_atUpperLimit){ _local10 = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0); _local21 = (m_limitForce - _local10); }; }; }; _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21)); }; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function GetUpperLimit():Number{ return (m_upperAngle); } public function GetLowerLimit():Number{ return (m_lowerAngle); } public function EnableMotor(_arg1:Boolean):void{ m_enableMotor = _arg1; } public function GetMotorSpeed():Number{ return (m_motorSpeed); } override public function GetReactionForce():b2Vec2{ return (m_pivotForce); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local6:b2Mat22; var _local25:Number; var _local26:Number; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; var _local5:Number = 0; _local6 = _local3.m_xf.R; var _local7:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local8:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); var _local9:Number = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8)); _local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8)); _local7 = _local9; _local6 = _local4.m_xf.R; var _local10:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local11:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11)); _local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11)); _local10 = _local9; var _local12:Number = (_local3.m_sweep.c.x + _local7); var _local13:Number = (_local3.m_sweep.c.y + _local8); var _local14:Number = (_local4.m_sweep.c.x + _local10); var _local15:Number = (_local4.m_sweep.c.y + _local11); var _local16:Number = (_local14 - _local12); var _local17:Number = (_local15 - _local13); _local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17))); var _local18:Number = _local3.m_invMass; var _local19:Number = _local4.m_invMass; var _local20:Number = _local3.m_invI; var _local21:Number = _local4.m_invI; K1.col1.x = (_local18 + _local19); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local18 + _local19); K2.col1.x = ((_local20 * _local8) * _local8); K2.col2.x = ((-(_local20) * _local7) * _local8); K2.col1.y = ((-(_local20) * _local7) * _local8); K2.col2.y = ((_local20 * _local7) * _local7); K3.col1.x = ((_local21 * _local11) * _local11); K3.col2.x = ((-(_local21) * _local10) * _local11); K3.col1.y = ((-(_local21) * _local10) * _local11); K3.col2.y = ((_local21 * _local10) * _local10); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Solve(tImpulse, -(_local16), -(_local17)); var _local22:Number = tImpulse.x; var _local23:Number = tImpulse.y; _local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23)); _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22)))); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22)))); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); var _local24:Number = 0; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle); _local26 = 0; if (m_limitState == e_equalLimits){ _local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); _local26 = (-(m_motorMass) * _local2); _local24 = b2Math.b2Abs(_local2); } else { if (m_limitState == e_atLowerLimit){ _local2 = (_local25 - m_lowerAngle); _local24 = b2Math.b2Max(0, -(_local2)); _local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0); _local26 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0); _local26 = (m_limitPositionImpulse - _local1); } else { if (m_limitState == e_atUpperLimit){ _local2 = (_local25 - m_upperAngle); _local24 = b2Math.b2Max(0, _local2); _local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection); _local26 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0); _local26 = (m_limitPositionImpulse - _local1); }; }; }; _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop)))); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function GetJointSpeed():Number{ return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity)); } public function SetMaxMotorTorque(_arg1:Number):void{ m_maxMotorTorque = _arg1; } public function GetJointAngle():Number{ return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle)); } public function GetMotorTorque():Number{ return (m_motorForce); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local7:Number; var _local14:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); _local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local10:Number = _local2.m_invMass; var _local11:Number = _local3.m_invMass; var _local12:Number = _local2.m_invI; var _local13:Number = _local3.m_invI; K1.col1.x = (_local10 + _local11); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local10 + _local11); K2.col1.x = ((_local12 * _local7) * _local7); K2.col2.x = ((-(_local12) * _local6) * _local7); K2.col1.y = ((-(_local12) * _local6) * _local7); K2.col2.y = ((_local12 * _local6) * _local6); K3.col1.x = ((_local13 * _local9) * _local9); K3.col2.x = ((-(_local13) * _local8) * _local9); K3.col1.y = ((-(_local13) * _local8) * _local9); K3.col2.y = ((_local13 * _local8) * _local8); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Invert(m_pivotMass); m_motorMass = (1 / (_local12 + _local13)); if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit){ _local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle); if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){ m_limitState = e_equalLimits; } else { if (_local14 <= m_lowerAngle){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (_local14 >= m_upperAngle){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; } else { m_limitForce = 0; }; if (_arg1.warmStarting){ _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce))); } else { m_pivotForce.SetZero(); m_motorForce = 0; m_limitForce = 0; }; m_limitPositionImpulse = 0; } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } override public function GetReactionTorque():Number{ return (m_limitForce); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerAngle = _arg1; m_upperAngle = _arg2; } } }//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2RevoluteJointDef extends b2JointDef { public var upperAngle:Number; public var enableMotor:Boolean; public var referenceAngle:Number; public var motorSpeed:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var enableLimit:Boolean; public var lowerAngle:Number; public var maxMotorTorque:Number; public function b2RevoluteJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_revoluteJoint; localAnchor1.Set(0, 0); localAnchor2.Set(0, 0); referenceAngle = 0; lowerAngle = 0; upperAngle = 0; maxMotorTorque = 0; motorSpeed = 0; enableLimit = false; enableMotor = false; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1 = body1.GetLocalPoint(_arg3); localAnchor2 = body2.GetLocalPoint(_arg3); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 64
//b2Body (Box2D.Dynamics.b2Body) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Contacts.*; public class b2Body { public var m_next:b2Body; public var m_xf:b2XForm; public var m_contactList:b2ContactEdge; public var m_angularVelocity:Number; public var m_shapeList:b2Shape; public var m_force:b2Vec2; public var m_mass:Number; public var m_sweep:b2Sweep; public var m_torque:Number; public var m_userData; public var m_flags:uint; public var m_world:b2World; public var m_prev:b2Body; public var m_invMass:Number; public var m_type:int; public var m_linearDamping:Number; public var m_shapeCount:int; public var m_angularDamping:Number; public var m_invI:Number; public var m_linearVelocity:b2Vec2; public var m_sleepTime:Number; public var m_jointList:b2JointEdge; public var m_I:Number; public static var e_fixedRotationFlag:uint = 64; public static var e_frozenFlag:uint = 2; public static var e_maxTypes:uint = 3; public static var e_sleepFlag:uint = 8; private static var s_massData:b2MassData = new b2MassData(); public static var e_bulletFlag:uint = 32; public static var e_staticType:uint = 1; public static var e_islandFlag:uint = 4; public static var e_allowSleepFlag:uint = 16; private static var s_xf1:b2XForm = new b2XForm(); public static var e_dynamicType:uint = 2; public function b2Body(_arg1:b2BodyDef, _arg2:b2World){ m_xf = new b2XForm(); m_sweep = new b2Sweep(); m_linearVelocity = new b2Vec2(); m_force = new b2Vec2(); super(); m_flags = 0; if (_arg1.isBullet){ m_flags = (m_flags | e_bulletFlag); }; if (_arg1.fixedRotation){ m_flags = (m_flags | e_fixedRotationFlag); }; if (_arg1.allowSleep){ m_flags = (m_flags | e_allowSleepFlag); }; if (_arg1.isSleeping){ m_flags = (m_flags | e_sleepFlag); }; m_world = _arg2; m_xf.position.SetV(_arg1.position); m_xf.R.Set(_arg1.angle); m_sweep.localCenter.SetV(_arg1.massData.center); m_sweep.t0 = 1; m_sweep.a0 = (m_sweep.a = _arg1.angle); var _local3:b2Mat22 = m_xf.R; var _local4:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_jointList = null; m_contactList = null; m_prev = null; m_next = null; m_linearDamping = _arg1.linearDamping; m_angularDamping = _arg1.angularDamping; m_force.Set(0, 0); m_torque = 0; m_linearVelocity.SetZero(); m_angularVelocity = 0; m_sleepTime = 0; m_invMass = 0; m_I = 0; m_invI = 0; m_mass = _arg1.massData.mass; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if ((m_flags & b2Body.e_fixedRotationFlag) == 0){ m_I = _arg1.massData.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; m_userData = _arg1.userData; m_shapeList = null; m_shapeCount = 0; } public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{ return (new b2Vec2((m_linearVelocity.x - (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.y + (m_angularVelocity * (_arg1.x - m_sweep.c.x))))); } public function SetLinearVelocity(_arg1:b2Vec2):void{ m_linearVelocity.SetV(_arg1); } public function WakeUp():void{ m_flags = (m_flags & ~(e_sleepFlag)); m_sleepTime = 0; } public function GetLocalCenter():b2Vec2{ return (m_sweep.localCenter); } public function ApplyTorque(_arg1:Number):void{ if (IsSleeping()){ WakeUp(); }; m_torque = (m_torque + _arg1); } public function IsFrozen():Boolean{ return (((m_flags & e_frozenFlag) == e_frozenFlag)); } public function IsDynamic():Boolean{ return ((m_type == e_dynamicType)); } public function GetLinearVelocity():b2Vec2{ return (m_linearVelocity); } public function SynchronizeTransform():void{ m_xf.R.Set(m_sweep.a); var _local1:b2Mat22 = m_xf.R; var _local2:b2Vec2 = m_sweep.localCenter; m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y))); m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y))); } public function GetInertia():Number{ return (m_I); } public function IsSleeping():Boolean{ return (((m_flags & e_sleepFlag) == e_sleepFlag)); } public function SetMassFromShapes():void{ var _local1:b2Shape; if (m_world.m_lock == true){ return; }; m_mass = 0; m_invMass = 0; m_I = 0; m_invI = 0; var _local2:Number = 0; var _local3:Number = 0; var _local4:b2MassData = s_massData; _local1 = m_shapeList; while (_local1) { _local1.ComputeMass(_local4); m_mass = (m_mass + _local4.mass); _local2 = (_local2 + (_local4.mass * _local4.center.x)); _local3 = (_local3 + (_local4.mass * _local4.center.y)); m_I = (m_I + _local4.I); _local1 = _local1.m_next; }; if (m_mass > 0){ m_invMass = (1 / m_mass); _local2 = (_local2 * m_invMass); _local3 = (_local3 * m_invMass); }; if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){ m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3)))); m_invI = (1 / m_I); } else { m_I = 0; m_invI = 0; }; m_sweep.localCenter.Set(_local2, _local3); var _local5:b2Mat22 = m_xf.R; var _local6:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)); m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); _local1 = m_shapeList; while (_local1) { _local1.UpdateSweepRadius(m_sweep.localCenter); _local1 = _local1.m_next; }; var _local7:int = m_type; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; if (_local7 != m_type){ _local1 = m_shapeList; while (_local1) { _local1.RefilterProxy(m_world.m_broadPhase, m_xf); _local1 = _local1.m_next; }; }; } public function PutToSleep():void{ m_flags = (m_flags | e_sleepFlag); m_sleepTime = 0; m_linearVelocity.SetZero(); m_angularVelocity = 0; m_force.SetZero(); m_torque = 0; } public function GetJointList():b2JointEdge{ return (m_jointList); } public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{ var _local3:b2Shape; var _local7:Boolean; if (m_world.m_lock == true){ return (true); }; if (IsFrozen()){ return (false); }; m_xf.R.Set(_arg2); m_xf.position.SetV(_arg1); var _local4:b2Mat22 = m_xf.R; var _local5:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y)); m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_sweep.a0 = (m_sweep.a = _arg2); var _local6:Boolean; _local3 = m_shapeList; while (_local3) { _local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf); if (_local7 == false){ _local6 = true; break; }; _local3 = _local3.m_next; }; if (_local6 == true){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local3 = m_shapeList; while (_local3) { _local3.DestroyProxy(m_world.m_broadPhase); _local3 = _local3.m_next; }; return (false); }; m_world.m_broadPhase.Commit(); return (true); } public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulXT(m_xf, _arg1)); } public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (IsSleeping()){ WakeUp(); }; m_force.x = (m_force.x + _arg1.x); m_force.y = (m_force.y + _arg1.y); m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))); } public function SynchronizeShapes():Boolean{ var _local4:b2Shape; var _local1:b2XForm = s_xf1; _local1.R.Set(m_sweep.a0); var _local2:b2Mat22 = _local1.R; var _local3:b2Vec2 = m_sweep.localCenter; _local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y))); _local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y))); var _local5:Boolean; _local4 = m_shapeList; while (_local4) { _local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf); if (_local5 == false){ break; }; _local4 = _local4.m_next; }; if (_local5 == false){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local4 = m_shapeList; while (_local4) { _local4.DestroyProxy(m_world.m_broadPhase); _local4 = _local4.m_next; }; return (false); }; return (true); } public function GetAngle():Number{ return (m_sweep.a); } public function GetXForm():b2XForm{ return (m_xf); } public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{ var _local2:b2Mat22 = m_xf.R; var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y))); _local3.x = (_local3.x + m_xf.position.x); _local3.y = (_local3.y + m_xf.position.y); return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x))))); } public function GetNext():b2Body{ return (m_next); } public function GetMass():Number{ return (m_mass); } public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (IsSleeping()){ WakeUp(); }; m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x)); m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y)); m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)))); } public function GetAngularVelocity():Number{ return (m_angularVelocity); } public function SetAngularVelocity(_arg1:Number):void{ m_angularVelocity = _arg1; } public function SetMass(_arg1:b2MassData):void{ var _local2:b2Shape; if (m_world.m_lock == true){ return; }; m_invMass = 0; m_I = 0; m_invI = 0; m_mass = _arg1.mass; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if ((m_flags & b2Body.e_fixedRotationFlag) == 0){ m_I = _arg1.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; m_sweep.localCenter.SetV(_arg1.center); var _local3:b2Mat22 = m_xf.R; var _local4:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); _local2 = m_shapeList; while (_local2) { _local2.UpdateSweepRadius(m_sweep.localCenter); _local2 = _local2.m_next; }; var _local5:int = m_type; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; if (_local5 != m_type){ _local2 = m_shapeList; while (_local2) { _local2.RefilterProxy(m_world.m_broadPhase, m_xf); _local2 = _local2.m_next; }; }; } public function IsStatic():Boolean{ return ((m_type == e_staticType)); } public function GetWorldVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulMV(m_xf.R, _arg1)); } public function GetShapeList():b2Shape{ return (m_shapeList); } public function Advance(_arg1:Number):void{ m_sweep.Advance(_arg1); m_sweep.c.SetV(m_sweep.c0); m_sweep.a = m_sweep.a0; SynchronizeTransform(); } public function SetBullet(_arg1:Boolean):void{ if (_arg1){ m_flags = (m_flags | e_bulletFlag); } else { m_flags = (m_flags & ~(e_bulletFlag)); }; } public function CreateShape(_arg1:b2ShapeDef):b2Shape{ if (m_world.m_lock == true){ return (null); }; var _local2:b2Shape = b2Shape.Create(_arg1, m_world.m_blockAllocator); _local2.m_next = m_shapeList; m_shapeList = _local2; m_shapeCount++; _local2.m_body = this; _local2.CreateProxy(m_world.m_broadPhase, m_xf); _local2.UpdateSweepRadius(m_sweep.localCenter); return (_local2); } public function IsConnected(_arg1:b2Body):Boolean{ var _local2:b2JointEdge = m_jointList; while (_local2) { if (_local2.other == _arg1){ return ((_local2.joint.m_collideConnected == false)); }; _local2 = _local2.next; }; return (false); } public function DestroyShape(_arg1:b2Shape):void{ if (m_world.m_lock == true){ return; }; _arg1.DestroyProxy(m_world.m_broadPhase); var _local2:b2Shape = m_shapeList; var _local3:b2Shape; var _local4:Boolean; while (_local2 != null) { if (_local2 == _arg1){ if (_local3){ _local3.m_next = _arg1.m_next; } else { m_shapeList = _arg1.m_next; }; _local4 = true; break; }; _local3 = _local2; _local2 = _local2.m_next; }; _arg1.m_body = null; _arg1.m_next = null; m_shapeCount--; b2Shape.Destroy(_arg1, m_world.m_blockAllocator); } public function GetUserData(){ return (m_userData); } public function IsBullet():Boolean{ return (((m_flags & e_bulletFlag) == e_bulletFlag)); } public function GetWorldCenter():b2Vec2{ return (m_sweep.c); } public function AllowSleeping(_arg1:Boolean):void{ if (_arg1){ m_flags = (m_flags | e_allowSleepFlag); } else { m_flags = (m_flags & ~(e_allowSleepFlag)); WakeUp(); }; } public function SetUserData(_arg1):void{ m_userData = _arg1; } public function GetLocalVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulTMV(m_xf.R, _arg1)); } public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{ var _local2:b2Mat22 = m_xf.R; var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y))); _local3.x = (_local3.x + m_xf.position.x); _local3.y = (_local3.y + m_xf.position.y); return (_local3); } public function GetWorld():b2World{ return (m_world); } public function GetPosition():b2Vec2{ return (m_xf.position); } } }//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; public class b2BodyDef { public var angularDamping:Number; public var angle:Number; public var isSleeping:Boolean; public var position:b2Vec2; public var isBullet:Boolean; public var allowSleep:Boolean; public var userData; public var fixedRotation:Boolean; public var linearDamping:Number; public var massData:b2MassData; public function b2BodyDef(){ massData = new b2MassData(); position = new b2Vec2(); super(); massData.center.SetZero(); massData.mass = 0; massData.I = 0; userData = null; position.Set(0, 0); angle = 0; linearDamping = 0; angularDamping = 0; allowSleep = true; isSleeping = false; fixedRotation = false; isBullet = false; } } }//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener) package Box2D.Dynamics { public class b2BoundaryListener { public function Violation(_arg1:b2Body):void{ } } }//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; public class b2ContactFilter { public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter); ; public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{ var _local3:b2FilterData = _arg1.GetFilterData(); var _local4:b2FilterData = _arg2.GetFilterData(); if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){ return ((_local3.groupIndex > 0)); }; var _local5:Boolean = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0)))); return (_local5); } public function RayCollide(_arg1, _arg2:b2Shape):Boolean{ if (!_arg1){ return (true); }; return (ShouldCollide((_arg1 as b2Shape), _arg2)); } } }//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener) package Box2D.Dynamics { import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; public class b2ContactListener { public function Add(_arg1:b2ContactPoint):void{ } public function Remove(_arg1:b2ContactPoint):void{ } public function Persist(_arg1:b2ContactPoint):void{ } public function Result(_arg1:b2ContactResult):void{ } } }//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Contacts.*; public class b2ContactManager extends b2PairCallback { public var m_world:b2World; public var m_destroyImmediate:Boolean; public var m_nullContact:b2NullContact; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2ContactManager(){ m_nullContact = new b2NullContact(); super(); m_world = null; m_destroyImmediate = false; } override public function PairRemoved(_arg1, _arg2, _arg3):void{ if (_arg3 == null){ return; }; var _local4:b2Contact = (_arg3 as b2Contact); if (_local4 == m_nullContact){ return; }; Destroy(_local4); } public function Destroy(_arg1:b2Contact):void{ var _local7:b2Body; var _local8:b2Body; var _local9:Array; var _local10:b2ContactPoint; var _local11:int; var _local12:b2Manifold; var _local13:int; var _local14:b2ManifoldPoint; var _local15:b2Vec2; var _local16:b2Vec2; var _local2:b2Shape = _arg1.m_shape1; var _local3:b2Shape = _arg1.m_shape2; var _local4:int = _arg1.m_manifoldCount; if ((((_local4 > 0)) && (m_world.m_contactListener))){ _local7 = _local2.m_body; _local8 = _local3.m_body; _local9 = _arg1.GetManifolds(); _local10 = s_evalCP; _local10.shape1 = _arg1.m_shape1; _local10.shape2 = _arg1.m_shape1; _local10.friction = _arg1.m_friction; _local10.restitution = _arg1.m_restitution; _local11 = 0; while (_local11 < _local4) { _local12 = _local9[_local11]; _local10.normal.SetV(_local12.normal); _local13 = 0; while (_local13 < _local12.pointCount) { _local14 = _local12.points[_local13]; _local10.position = _local7.GetWorldPoint(_local14.localPoint1); _local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1); _local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2); _local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y)); _local10.separation = _local14.separation; _local10.id.key = _local14.id._key; m_world.m_contactListener.Remove(_local10); _local13++; }; _local11++; }; }; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_world.m_contactList){ m_world.m_contactList = _arg1.m_next; }; var _local5:b2Body = _local2.m_body; var _local6:b2Body = _local3.m_body; if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local5.m_contactList){ _local5.m_contactList = _arg1.m_node1.next; }; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local6.m_contactList){ _local6.m_contactList = _arg1.m_node2.next; }; b2Contact.Destroy(_arg1, m_world.m_blockAllocator); m_world.m_contactCount--; } override public function PairAdded(_arg1, _arg2){ var _local5:b2Body; var _local3:b2Shape = (_arg1 as b2Shape); var _local4:b2Shape = (_arg2 as b2Shape); _local5 = _local3.m_body; var _local6:b2Body = _local4.m_body; if (((_local5.IsStatic()) && (_local6.IsStatic()))){ return (m_nullContact); }; if (_local3.m_body == _local4.m_body){ return (m_nullContact); }; if (_local6.IsConnected(_local5)){ return (m_nullContact); }; if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){ return (m_nullContact); }; var _local7:b2Contact = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator); if (_local7 == null){ return (m_nullContact); }; _local3 = _local7.m_shape1; _local4 = _local7.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; _local7.m_prev = null; _local7.m_next = m_world.m_contactList; if (m_world.m_contactList != null){ m_world.m_contactList.m_prev = _local7; }; m_world.m_contactList = _local7; _local7.m_node1.contact = _local7; _local7.m_node1.other = _local6; _local7.m_node1.prev = null; _local7.m_node1.next = _local5.m_contactList; if (_local5.m_contactList != null){ _local5.m_contactList.prev = _local7.m_node1; }; _local5.m_contactList = _local7.m_node1; _local7.m_node2.contact = _local7; _local7.m_node2.other = _local5; _local7.m_node2.prev = null; _local7.m_node2.next = _local6.m_contactList; if (_local6.m_contactList != null){ _local6.m_contactList.prev = _local7.m_node2; }; _local6.m_contactList = _local7.m_node2; m_world.m_contactCount++; return (_local7); } public function Collide():void{ var _local2:b2Body; var _local3:b2Body; var _local1:b2Contact = m_world.m_contactList; while (_local1) { _local2 = _local1.m_shape1.m_body; _local3 = _local1.m_shape2.m_body; if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){ } else { _local1.Update(m_world.m_contactListener); }; _local1 = _local1.m_next; }; } } }//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw) package Box2D.Dynamics { import flash.display.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2DebugDraw { public var m_xformScale:Number;// = 1 public var m_fillAlpha:Number;// = 1 public var m_alpha:Number;// = 1 public var m_drawFlags:uint; public var m_lineThickness:Number;// = 1 public var m_drawScale:Number;// = 1 public var m_sprite:Sprite; public static var e_coreShapeBit:uint = 4; public static var e_shapeBit:uint = 1; public static var e_centerOfMassBit:uint = 64; public static var e_aabbBit:uint = 8; public static var e_obbBit:uint = 16; public static var e_pairBit:uint = 32; public static var e_jointBit:uint = 2; public function b2DebugDraw(){ m_drawFlags = 0; } public function ClearFlags(_arg1:uint):void{ m_drawFlags = (m_drawFlags & ~(_arg1)); } public function SetFlags(_arg1:uint):void{ m_drawFlags = _arg1; } public function AppendFlags(_arg1:uint):void{ m_drawFlags = (m_drawFlags | _arg1); } public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale)); m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale)); } public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha); var _local4 = 1; while (_local4 < _arg2) { m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale)); _local4++; }; m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); m_sprite.graphics.endFill(); } public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale)); } public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); var _local4 = 1; while (_local4 < _arg2) { m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale)); _local4++; }; m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); } public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha); m_sprite.graphics.moveTo(0, 0); m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha); m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale)); m_sprite.graphics.endFill(); m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale)); } public function GetFlags():uint{ return (m_drawFlags); } public function DrawXForm(_arg1:b2XForm):void{ m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha); m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale)); m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha); m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale)); } } }//package Box2D.Dynamics
Section 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener) package Box2D.Dynamics { import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; public class b2DestructionListener { public function SayGoodbyeShape(_arg1:b2Shape):void{ } public function SayGoodbyeJoint(_arg1:b2Joint):void{ } } }//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.Joints.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2Island { public var m_listener:b2ContactListener; public var m_positionIterationCount:int; public var m_bodyCapacity:int; public var m_bodies:Array; public var m_joints:Array; public var m_jointCapacity:int; public var m_contactCount:int; public var m_contacts:Array; public var m_contactCapacity:int; public var m_jointCount:int; public var m_allocator; public var m_bodyCount:int; private static var s_reportCR:b2ContactResult = new b2ContactResult(); public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){ var _local6:int; super(); m_bodyCapacity = _arg1; m_contactCapacity = _arg2; m_jointCapacity = _arg3; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_allocator = _arg4; m_listener = _arg5; m_bodies = new Array(_arg1); _local6 = 0; while (_local6 < _arg1) { m_bodies[_local6] = null; _local6++; }; m_contacts = new Array(_arg2); _local6 = 0; while (_local6 < _arg2) { m_contacts[_local6] = null; _local6++; }; m_joints = new Array(_arg3); _local6 = 0; while (_local6 < _arg3) { m_joints[_local6] = null; _local6++; }; m_positionIterationCount = 0; } public function AddBody(_arg1:b2Body):void{ var _local2 = m_bodyCount++; m_bodies[_local2] = _arg1; } public function AddJoint(_arg1:b2Joint):void{ var _local2 = m_jointCount++; m_joints[_local2] = _arg1; } public function Report(_arg1:Array):void{ var _local2:b2Mat22; var _local3:b2Vec2; var _local5:b2Contact; var _local6:b2ContactConstraint; var _local7:b2ContactResult; var _local8:b2Body; var _local9:int; var _local10:Array; var _local11:int; var _local12:b2Manifold; var _local13:int; var _local14:b2ManifoldPoint; var _local15:b2ContactConstraintPoint; if (m_listener == null){ return; }; var _local4:int; while (_local4 < m_contactCount) { _local5 = m_contacts[_local4]; _local6 = _arg1[_local4]; _local7 = s_reportCR; _local7.shape1 = _local5.m_shape1; _local7.shape2 = _local5.m_shape2; _local8 = _local7.shape1.m_body; _local9 = _local5.m_manifoldCount; _local10 = _local5.GetManifolds(); _local11 = 0; while (_local11 < _local9) { _local12 = _local10[_local11]; _local7.normal.SetV(_local12.normal); _local13 = 0; while (_local13 < _local12.pointCount) { _local14 = _local12.points[_local13]; _local15 = _local6.points[_local13]; _local7.position = _local8.GetWorldPoint(_local14.localPoint1); _local7.normalImpulse = _local15.normalImpulse; _local7.tangentImpulse = _local15.tangentImpulse; _local7.id.key = _local14.id.key; m_listener.Result(_local7); _local13++; }; _local11++; }; _local4++; }; } public function AddContact(_arg1:b2Contact):void{ var _local2 = m_contactCount++; m_contacts[_local2] = _arg1; } public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{ var _local5:int; var _local6:b2Body; var _local7:b2Joint; var _local9:int; var _local10:Boolean; var _local11:Boolean; var _local12:Boolean; var _local13:Number; var _local14:Number; var _local15:Number; _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.IsStatic()){ } else { _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x)))); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y)))); _local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque)); _local6.m_force.SetZero(); _local6.m_torque = 0; _local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1)); _local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1)); if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){ _local6.m_linearVelocity.Normalize(); _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity); }; if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){ if (_local6.m_angularVelocity < 0){ _local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity); } else { _local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity; }; }; }; _local5++; }; var _local8:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator); _local8.InitVelocityConstraints(_arg1); _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local7.InitVelocityConstraints(_arg1); _local5++; }; _local5 = 0; while (_local5 < _arg1.maxIterations) { _local8.SolveVelocityConstraints(); _local9 = 0; while (_local9 < m_jointCount) { _local7 = m_joints[_local9]; _local7.SolveVelocityConstraints(_arg1); _local9++; }; _local5++; }; _local8.FinalizeVelocityConstraints(); _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.IsStatic()){ } else { _local6.m_sweep.c0.SetV(_local6.m_sweep.c); _local6.m_sweep.a0 = _local6.m_sweep.a; _local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x)); _local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y)); _local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity)); _local6.SynchronizeTransform(); }; _local5++; }; if (_arg3){ _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local7.InitPositionConstraints(); _local5++; }; m_positionIterationCount = 0; while (m_positionIterationCount < _arg1.maxIterations) { _local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte); _local11 = true; _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local12 = _local7.SolvePositionConstraints(); _local11 = ((_local11) && (_local12)); _local5++; }; if (((_local10) && (_local11))){ break; }; m_positionIterationCount++; }; }; Report(_local8.m_constraints); if (_arg4){ _local13 = Number.MAX_VALUE; _local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance); _local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance); _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.m_invMass == 0){ } else { if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){ _local6.m_sleepTime = 0; _local13 = 0; }; if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){ _local6.m_sleepTime = 0; _local13 = 0; } else { _local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt); _local13 = b2Math.b2Min(_local13, _local6.m_sleepTime); }; }; _local5++; }; if (_local13 >= b2Settings.b2_timeToSleep){ _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag); _local6.m_linearVelocity.SetZero(); _local6.m_angularVelocity = 0; _local5++; }; }; }; } public function Clear():void{ m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:int; var _local5:b2Body; var _local6:Boolean; var _local3:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator); _local2 = 0; while (_local2 < _arg1.maxIterations) { _local3.SolveVelocityConstraints(); _local2++; }; _local2 = 0; while (_local2 < m_bodyCount) { _local5 = m_bodies[_local2]; if (_local5.IsStatic()){ } else { _local5.m_sweep.c0.SetV(_local5.m_sweep.c); _local5.m_sweep.a0 = _local5.m_sweep.a; _local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x)); _local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y)); _local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity)); _local5.SynchronizeTransform(); }; _local2++; }; var _local4:Number = 0.75; _local2 = 0; while (_local2 < _arg1.maxIterations) { _local6 = _local3.SolvePositionConstraints(_local4); if (_local6){ break; }; _local2++; }; Report(_local3.m_constraints); } } }//package Box2D.Dynamics
Section 73
//b2TimeStep (Box2D.Dynamics.b2TimeStep) package Box2D.Dynamics { public class b2TimeStep { public var warmStarting:Boolean; public var positionCorrection:Boolean; public var dt:Number; public var maxIterations:int; public var dtRatio:Number; public var inv_dt:Number; } }//package Box2D.Dynamics
Section 74
//b2World (Box2D.Dynamics.b2World) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2World { public var m_inv_dt0:Number; public var m_boundaryListener:b2BoundaryListener; public var m_contactList:b2Contact; public var m_blockAllocator; public var m_contactListener:b2ContactListener; public var m_raycastSegment:b2Segment; public var m_broadPhase:b2BroadPhase; public var m_destructionListener:b2DestructionListener; public var m_jointCount:int; public var m_lock:Boolean; public var m_bodyCount:int; public var m_raycastUserData; public var m_allowSleep:Boolean; public var m_positionIterationCount:int; public var m_groundBody:b2Body; public var m_contactCount:int; public var m_raycastNormal:b2Vec2; public var m_contactFilter:b2ContactFilter; public var m_bodyList:b2Body; public var m_debugDraw:b2DebugDraw; public var m_stackAllocator; public var m_jointList:b2Joint; public var m_gravity:b2Vec2; public var m_contactManager:b2ContactManager; private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8); public static var m_continuousPhysics:Boolean; public static var m_warmStarting:Boolean; private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6); public static var m_positionCorrection:Boolean; private static var s_xf:b2XForm = new b2XForm(); public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){ m_raycastNormal = new b2Vec2(); m_contactManager = new b2ContactManager(); super(); m_destructionListener = null; m_boundaryListener = null; m_contactFilter = b2ContactFilter.b2_defaultFilter; m_contactListener = null; m_debugDraw = null; m_bodyList = null; m_contactList = null; m_jointList = null; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_positionCorrection = true; m_warmStarting = true; m_continuousPhysics = true; m_allowSleep = _arg3; m_gravity = _arg2; m_lock = false; m_inv_dt0 = 0; m_contactManager.m_world = this; m_broadPhase = new b2BroadPhase(_arg1, m_contactManager); var _local4:b2BodyDef = new b2BodyDef(); m_groundBody = CreateBody(_local4); } public function DrawJoint(_arg1:b2Joint):void{ var _local11:b2PulleyJoint; var _local12:b2Vec2; var _local13:b2Vec2; var _local2:b2Body = _arg1.m_body1; var _local3:b2Body = _arg1.m_body2; var _local4:b2XForm = _local2.m_xf; var _local5:b2XForm = _local3.m_xf; var _local6:b2Vec2 = _local4.position; var _local7:b2Vec2 = _local5.position; var _local8:b2Vec2 = _arg1.GetAnchor1(); var _local9:b2Vec2 = _arg1.GetAnchor2(); var _local10:b2Color = s_jointColor; switch (_arg1.m_type){ case b2Joint.e_distanceJoint: m_debugDraw.DrawSegment(_local8, _local9, _local10); break; case b2Joint.e_pulleyJoint: _local11 = (_arg1 as b2PulleyJoint); _local12 = _local11.GetGroundAnchor1(); _local13 = _local11.GetGroundAnchor2(); m_debugDraw.DrawSegment(_local12, _local8, _local10); m_debugDraw.DrawSegment(_local13, _local9, _local10); m_debugDraw.DrawSegment(_local12, _local13, _local10); break; case b2Joint.e_mouseJoint: m_debugDraw.DrawSegment(_local8, _local9, _local10); break; default: if (_local2 != m_groundBody){ m_debugDraw.DrawSegment(_local6, _local8, _local10); }; m_debugDraw.DrawSegment(_local8, _local9, _local10); if (_local3 != m_groundBody){ m_debugDraw.DrawSegment(_local7, _local9, _local10); }; }; } public function Refilter(_arg1:b2Shape):void{ _arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf); } public function SetDebugDraw(_arg1:b2DebugDraw):void{ m_debugDraw = _arg1; } public function SetContinuousPhysics(_arg1:Boolean):void{ m_continuousPhysics = _arg1; } public function GetProxyCount():int{ return (m_broadPhase.m_proxyCount); } public function DrawDebugData():void{ var _local2:int; var _local3:b2Body; var _local4:b2Shape; var _local5:b2Joint; var _local6:b2BroadPhase; var _local11:b2XForm; var _local15:Boolean; var _local16:uint; var _local17:b2Pair; var _local18:b2Proxy; var _local19:b2Proxy; var _local20:b2Vec2; var _local21:b2Vec2; var _local22:b2Proxy; var _local23:b2PolygonShape; var _local24:b2OBB; var _local25:b2Vec2; var _local26:b2Mat22; var _local27:b2Vec2; var _local28:Number; if (m_debugDraw == null){ return; }; m_debugDraw.m_sprite.graphics.clear(); var _local1:uint = m_debugDraw.GetFlags(); var _local7:b2Vec2 = new b2Vec2(); var _local8:b2Vec2 = new b2Vec2(); var _local9:b2Vec2 = new b2Vec2(); var _local10:b2Color = new b2Color(0, 0, 0); var _local12:b2AABB = new b2AABB(); var _local13:b2AABB = new b2AABB(); var _local14:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()]; if ((_local1 & b2DebugDraw.e_shapeBit)){ _local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit); _local3 = m_bodyList; while (_local3) { _local11 = _local3.m_xf; _local4 = _local3.GetShapeList(); while (_local4) { if (_local3.IsStatic()){ DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15); } else { if (_local3.IsSleeping()){ DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15); } else { DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15); }; }; _local4 = _local4.m_next; }; _local3 = _local3.m_next; }; }; if ((_local1 & b2DebugDraw.e_jointBit)){ _local5 = m_jointList; while (_local5) { DrawJoint(_local5); _local5 = _local5.m_next; }; }; if ((_local1 & b2DebugDraw.e_pairBit)){ _local6 = m_broadPhase; _local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y)); _local10.Set(0.9, 0.9, 0.3); _local2 = 0; while (_local2 < b2Pair.b2_tableCapacity) { _local16 = _local6.m_pairManager.m_hashTable[_local2]; while (_local16 != b2Pair.b2_nullPair) { _local17 = _local6.m_pairManager.m_pairs[_local16]; _local18 = _local6.m_proxyPool[_local17.proxyId1]; _local19 = _local6.m_proxyPool[_local17.proxyId2]; _local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value)); _local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value)); _local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value)); _local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value)); _local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value)); _local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value)); _local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value)); _local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value)); _local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x)); _local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y)); _local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x)); _local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y)); m_debugDraw.DrawSegment(_local8, _local9, _local10); _local16 = _local17.next; }; _local2++; }; }; if ((_local1 & b2DebugDraw.e_aabbBit)){ _local6 = m_broadPhase; _local20 = _local6.m_worldAABB.lowerBound; _local21 = _local6.m_worldAABB.upperBound; _local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y)); _local10.Set(0.9, 0.3, 0.9); _local2 = 0; while (_local2 < b2Settings.b2_maxProxies) { _local22 = _local6.m_proxyPool[_local2]; if (_local22.IsValid() == false){ } else { _local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value)); _local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value)); _local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value)); _local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value)); _local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y); _local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y); _local14[2].Set(_local12.upperBound.x, _local12.upperBound.y); _local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y); m_debugDraw.DrawPolygon(_local14, 4, _local10); }; _local2++; }; _local14[0].Set(_local20.x, _local20.y); _local14[1].Set(_local21.x, _local20.y); _local14[2].Set(_local21.x, _local21.y); _local14[3].Set(_local20.x, _local21.y); m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9)); }; if ((_local1 & b2DebugDraw.e_obbBit)){ _local10.Set(0.5, 0.3, 0.5); _local3 = m_bodyList; while (_local3) { _local11 = _local3.m_xf; _local4 = _local3.GetShapeList(); while (_local4) { if (_local4.m_type != b2Shape.e_polygonShape){ } else { _local23 = (_local4 as b2PolygonShape); _local24 = _local23.GetOBB(); _local25 = _local24.extents; _local14[0].Set(-(_local25.x), -(_local25.y)); _local14[1].Set(_local25.x, -(_local25.y)); _local14[2].Set(_local25.x, _local25.y); _local14[3].Set(-(_local25.x), _local25.y); _local2 = 0; while (_local2 < 4) { _local26 = _local24.R; _local27 = _local14[_local2]; _local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y))); _local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y))); _local14[_local2].x = _local28; _local26 = _local11.R; _local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y))); _local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y))); _local14[_local2].x = _local28; _local2++; }; m_debugDraw.DrawPolygon(_local14, 4, _local10); }; _local4 = _local4.m_next; }; _local3 = _local3.m_next; }; }; if ((_local1 & b2DebugDraw.e_centerOfMassBit)){ _local3 = m_bodyList; while (_local3) { _local11 = s_xf; _local11.R = _local3.m_xf.R; _local11.position = _local3.GetWorldCenter(); m_debugDraw.DrawXForm(_local11); _local3 = _local3.m_next; }; }; } public function DestroyBody(_arg1:b2Body):void{ var _local4:b2JointEdge; var _local5:b2Shape; if (m_lock == true){ return; }; var _local2:b2JointEdge = _arg1.m_jointList; while (_local2) { _local4 = _local2; _local2 = _local2.next; if (m_destructionListener){ m_destructionListener.SayGoodbyeJoint(_local4.joint); }; DestroyJoint(_local4.joint); }; var _local3:b2Shape = _arg1.m_shapeList; while (_local3) { _local5 = _local3; _local3 = _local3.m_next; if (m_destructionListener){ m_destructionListener.SayGoodbyeShape(_local5); }; _local5.DestroyProxy(m_broadPhase); b2Shape.Destroy(_local5, m_blockAllocator); }; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_bodyList){ m_bodyList = _arg1.m_next; }; m_bodyCount--; } public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{ var _local6:b2CircleShape; var _local7:b2Vec2; var _local8:Number; var _local9:b2Vec2; var _local10:int; var _local11:b2PolygonShape; var _local12:int; var _local13:Array; var _local14:Array; var _local15:Array; var _local5:b2Color = s_coreColor; switch (_arg1.m_type){ case b2Shape.e_circleShape: _local6 = (_arg1 as b2CircleShape); _local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition); _local8 = _local6.m_radius; _local9 = _arg2.R.col1; m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3); if (_arg4){ m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5); }; break; case b2Shape.e_polygonShape: _local11 = (_arg1 as b2PolygonShape); _local12 = _local11.GetVertexCount(); _local13 = _local11.GetVertices(); _local14 = new Array(b2Settings.b2_maxPolygonVertices); _local10 = 0; while (_local10 < _local12) { _local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]); _local10++; }; m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3); if (_arg4){ _local15 = _local11.GetCoreVertices(); _local10 = 0; while (_local10 < _local12) { _local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]); _local10++; }; m_debugDraw.DrawPolygon(_local14, _local12, _local5); }; break; }; } public function GetGroundBody():b2Body{ return (m_groundBody); } public function SetContactFilter(_arg1:b2ContactFilter):void{ m_contactFilter = _arg1; } public function Solve(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local9:int; var _local10:int; var _local11:b2Body; var _local12:b2ContactEdge; var _local13:b2JointEdge; var _local14:Boolean; m_positionIterationCount = 0; var _local3:b2Island = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener); _local2 = m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2 = _local2.m_next; }; var _local4:b2Contact = m_contactList; while (_local4) { _local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag)); _local4 = _local4.m_next; }; var _local5:b2Joint = m_jointList; while (_local5) { _local5.m_islandFlag = false; _local5 = _local5.m_next; }; var _local6:int = m_bodyCount; var _local7:Array = new Array(_local6); var _local8:b2Body = m_bodyList; while (_local8) { if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){ } else { if (_local8.IsStatic()){ } else { _local3.Clear(); _local9 = 0; var _temp1 = _local9; _local9 = (_local9 + 1); var _local15 = _temp1; _local7[_local15] = _local8; _local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag); while (_local9 > 0) { --_local9; _local2 = _local7[_local9]; _local3.AddBody(_local2); _local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag)); if (_local2.IsStatic()){ } else { _local12 = _local2.m_contactList; while (_local12) { if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){ } else { if (_local12.contact.m_manifoldCount == 0){ } else { _local3.AddContact(_local12.contact); _local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag); _local11 = _local12.other; if ((_local11.m_flags & b2Body.e_islandFlag)){ } else { var _temp2 = _local9; _local9 = (_local9 + 1); var _local16 = _temp2; _local7[_local16] = _local11; _local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag); }; }; }; _local12 = _local12.next; }; _local13 = _local2.m_jointList; while (_local13) { if (_local13.joint.m_islandFlag == true){ } else { _local3.AddJoint(_local13.joint); _local13.joint.m_islandFlag = true; _local11 = _local13.other; if ((_local11.m_flags & b2Body.e_islandFlag)){ } else { var _temp3 = _local9; _local9 = (_local9 + 1); _local16 = _temp3; _local7[_local16] = _local11; _local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag); }; }; _local13 = _local13.next; }; }; }; _local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep); if (_local3.m_positionIterationCount > m_positionIterationCount){ m_positionIterationCount = _local3.m_positionIterationCount; }; _local10 = 0; while (_local10 < _local3.m_bodyCount) { _local2 = _local3.m_bodies[_local10]; if (_local2.IsStatic()){ _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); }; _local10++; }; }; }; _local8 = _local8.m_next; }; _local2 = m_bodyList; while (_local2) { if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (_local2.IsStatic()){ } else { _local14 = _local2.SynchronizeShapes(); if ((((_local14 == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(_local2); }; }; }; _local2 = _local2.m_next; }; m_broadPhase.Commit(); } public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{ var _local4:Array = new Array(_arg3); var _local5:int = m_broadPhase.QueryAABB(_arg1, _local4, _arg3); var _local6:int; while (_local6 < _local5) { _arg2[_local6] = _local4[_local6]; _local6++; }; return (_local5); } public function GetContactCount():int{ return (m_contactCount); } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Shape; var _local4:b2Shape; var _local5:b2Body; var _local6:b2Body; var _local7:b2ContactEdge; var _local11:b2Contact; var _local12:b2Contact; var _local13:Number; var _local14:b2Body; var _local15:int; var _local16:b2TimeStep; var _local17:int; var _local18:Number; var _local19:Number; var _local20:b2Body; var _local21:Boolean; var _local8:b2Island = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener); var _local9:int = m_bodyCount; var _local10:Array = new Array(_local9); _local2 = m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2.m_sweep.t0 = 0; _local2 = _local2.m_next; }; _local11 = m_contactList; while (_local11) { _local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); _local11 = _local11.m_next; }; while (true) { _local12 = null; _local13 = 1; _local11 = m_contactList; for (;_local11;(_local11 = _local11.m_next)) { if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){ } else { _local18 = 1; if ((_local11.m_flags & b2Contact.e_toiFlag)){ _local18 = _local11.m_toi; } else { _local3 = _local11.m_shape1; _local4 = _local11.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){ continue; }; _local19 = _local5.m_sweep.t0; if (_local5.m_sweep.t0 < _local6.m_sweep.t0){ _local19 = _local6.m_sweep.t0; _local5.m_sweep.Advance(_local19); } else { if (_local6.m_sweep.t0 < _local5.m_sweep.t0){ _local19 = _local5.m_sweep.t0; _local6.m_sweep.Advance(_local19); }; }; _local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep); if ((((_local18 > 0)) && ((_local18 < 1)))){ _local18 = (((1 - _local18) * _local19) + _local18); if (_local18 > 1){ _local18 = 1; }; }; _local11.m_toi = _local18; _local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag); }; if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){ _local12 = _local11; _local13 = _local18; }; }; }; if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){ break; }; _local3 = _local12.m_shape1; _local4 = _local12.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; _local5.Advance(_local13); _local6.Advance(_local13); _local12.Update(m_contactListener); _local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag)); if (_local12.m_manifoldCount == 0){ } else { _local14 = _local5; if (_local14.IsStatic()){ _local14 = _local6; }; _local8.Clear(); _local15 = 0; var _temp1 = _local15; _local15 = (_local15 + 1); var _local22 = _temp1; _local10[_local22] = _local14; _local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag); while (_local15 > 0) { --_local15; _local2 = _local10[_local15]; _local8.AddBody(_local2); _local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag)); if (_local2.IsStatic()){ } else { _local7 = _local2.m_contactList; while (_local7) { if (_local8.m_contactCount == _local8.m_contactCapacity){ } else { if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){ } else { if (_local7.contact.m_manifoldCount == 0){ } else { _local8.AddContact(_local7.contact); _local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag); _local20 = _local7.other; if ((_local20.m_flags & b2Body.e_islandFlag)){ } else { if (_local20.IsStatic() == false){ _local20.Advance(_local13); _local20.WakeUp(); }; var _temp2 = _local15; _local15 = (_local15 + 1); var _local23 = _temp2; _local10[_local23] = _local20; _local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag); }; }; }; }; _local7 = _local7.next; }; }; }; _local16 = new b2TimeStep(); _local16.dt = ((1 - _local13) * _arg1.dt); _local16.inv_dt = (1 / _local16.dt); _local16.maxIterations = _arg1.maxIterations; _local8.SolveTOI(_local16); _local17 = 0; while (_local17 < _local8.m_bodyCount) { _local2 = _local8.m_bodies[_local17]; _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (_local2.IsStatic()){ } else { _local21 = _local2.SynchronizeShapes(); if ((((_local21 == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(_local2); }; _local7 = _local2.m_contactList; while (_local7) { _local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag)); _local7 = _local7.next; }; }; }; _local17++; }; _local17 = 0; while (_local17 < _local8.m_contactCount) { _local11 = _local8.m_contacts[_local17]; _local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); _local17++; }; m_broadPhase.Commit(); }; }; } public function GetJointList():b2Joint{ return (m_jointList); } public function Validate():void{ m_broadPhase.Validate(); } public function SetGravity(_arg1:b2Vec2):void{ m_gravity = _arg1; } public function GetGravity():b2Vec2{ return (m_gravity); } public function GetBodyList():b2Body{ return (m_bodyList); } public function GetPairCount():int{ return (m_broadPhase.m_pairManager.m_pairCount); } public function SetWarmStarting(_arg1:Boolean):void{ m_warmStarting = _arg1; } public function SetPositionCorrection(_arg1:Boolean):void{ m_positionCorrection = _arg1; } public function CreateJoint(_arg1:b2JointDef):b2Joint{ var _local3:b2Body; var _local4:b2Shape; var _local2:b2Joint = b2Joint.Create(_arg1, m_blockAllocator); _local2.m_prev = null; _local2.m_next = m_jointList; if (m_jointList){ m_jointList.m_prev = _local2; }; m_jointList = _local2; m_jointCount++; _local2.m_node1.joint = _local2; _local2.m_node1.other = _local2.m_body2; _local2.m_node1.prev = null; _local2.m_node1.next = _local2.m_body1.m_jointList; if (_local2.m_body1.m_jointList){ _local2.m_body1.m_jointList.prev = _local2.m_node1; }; _local2.m_body1.m_jointList = _local2.m_node1; _local2.m_node2.joint = _local2; _local2.m_node2.other = _local2.m_body1; _local2.m_node2.prev = null; _local2.m_node2.next = _local2.m_body2.m_jointList; if (_local2.m_body2.m_jointList){ _local2.m_body2.m_jointList.prev = _local2.m_node2; }; _local2.m_body2.m_jointList = _local2.m_node2; if (_arg1.collideConnected == false){ _local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2; _local4 = _local3.m_shapeList; while (_local4) { _local4.RefilterProxy(m_broadPhase, _local3.m_xf); _local4 = _local4.m_next; }; }; return (_local2); } public function DestroyJoint(_arg1:b2Joint):void{ var _local5:b2Body; var _local6:b2Shape; var _local2:Boolean = _arg1.m_collideConnected; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_jointList){ m_jointList = _arg1.m_next; }; var _local3:b2Body = _arg1.m_body1; var _local4:b2Body = _arg1.m_body2; _local3.WakeUp(); _local4.WakeUp(); if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local3.m_jointList){ _local3.m_jointList = _arg1.m_node1.next; }; _arg1.m_node1.prev = null; _arg1.m_node1.next = null; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local4.m_jointList){ _local4.m_jointList = _arg1.m_node2.next; }; _arg1.m_node2.prev = null; _arg1.m_node2.next = null; b2Joint.Destroy(_arg1, m_blockAllocator); m_jointCount--; if (_local2 == false){ _local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4; _local6 = _local5.m_shapeList; while (_local6) { _local6.RefilterProxy(m_broadPhase, _local5.m_xf); _local6 = _local6.m_next; }; }; } public function SetContactListener(_arg1:b2ContactListener):void{ m_contactListener = _arg1; } public function Raycast(_arg1:b2Segment, _arg2:Array, _arg3:int, _arg4:Boolean, _arg5):int{ var _local7:int; var _local6:Array = new Array(_arg3); m_raycastSegment = _arg1; m_raycastUserData = _arg5; if (_arg4){ _local7 = m_broadPhase.QuerySegment(_arg1, _local6, _arg3, RaycastSortKey); } else { _local7 = m_broadPhase.QuerySegment(_arg1, _local6, _arg3, RaycastSortKey2); }; var _local8:int; while (_local8 < _local7) { _arg2[_local8] = _local6[_local8]; _local8++; }; return (_local7); } public function RaycastSortKey2(_arg1:b2Shape){ if (((m_contactFilter) && (!(m_contactFilter.RayCollide(m_raycastUserData, _arg1))))){ return (-1); }; var _local2:b2Body = _arg1.GetBody(); var _local3:b2XForm = _local2.GetXForm(); var _local4:Array = [0]; if (_arg1.TestSegment(_local3, _local4, m_raycastNormal, m_raycastSegment, 1) != b2Shape.e_hitCollide){ return (-1); }; return (_local4[0]); } public function RaycastOne(_arg1:b2Segment, _arg2:Array, _arg3:b2Vec2, _arg4:Boolean, _arg5):b2Shape{ var _local6:Array = new Array(1); var _local7:Number = Raycast(_arg1, _local6, 1, _arg4, _arg5); if (_local7 == 0){ return (null); }; if (_local7 > 1){ trace(_local7); }; var _local8:b2Shape = _local6[0]; var _local9:b2XForm = _local8.GetBody().GetXForm(); _local8.TestSegment(_local9, _arg2, _arg3, _arg1, 1); return (_local8); } public function CreateBody(_arg1:b2BodyDef):b2Body{ if (m_lock == true){ return (null); }; var _local2:b2Body = new b2Body(_arg1, this); _local2.m_prev = null; _local2.m_next = m_bodyList; if (m_bodyList){ m_bodyList.m_prev = _local2; }; m_bodyList = _local2; m_bodyCount++; return (_local2); } public function RaycastSortKey(_arg1:b2Shape){ if (((m_contactFilter) && (!(m_contactFilter.RayCollide(m_raycastUserData, _arg1))))){ return (-1); }; var _local2:b2Body = _arg1.GetBody(); var _local3:b2XForm = _local2.GetXForm(); var _local4:Array = [0]; if (_arg1.TestSegment(_local3, _local4, m_raycastNormal, m_raycastSegment, 1) == b2Shape.e_missCollide){ return (-1); }; return (_local4[0]); } public function SetBoundaryListener(_arg1:b2BoundaryListener):void{ m_boundaryListener = _arg1; } public function SetDestructionListener(_arg1:b2DestructionListener):void{ m_destructionListener = _arg1; } public function Step(_arg1:Number, _arg2:int):void{ m_lock = true; var _local3:b2TimeStep = new b2TimeStep(); _local3.dt = _arg1; _local3.maxIterations = _arg2; if (_arg1 > 0){ _local3.inv_dt = (1 / _arg1); } else { _local3.inv_dt = 0; }; _local3.dtRatio = (m_inv_dt0 * _arg1); _local3.positionCorrection = m_positionCorrection; _local3.warmStarting = m_warmStarting; m_contactManager.Collide(); if (_local3.dt > 0){ Solve(_local3); }; if (((m_continuousPhysics) && ((_local3.dt > 0)))){ SolveTOI(_local3); }; DrawDebugData(); m_inv_dt0 = _local3.inv_dt; m_lock = false; } public function GetBodyCount():int{ return (m_bodyCount); } public function GetJointCount():int{ return (m_jointCount); } } }//package Box2D.Dynamics
Section 75
//FilterShortcuts (caurina.transitions.properties.FilterShortcuts) package caurina.transitions.properties { import flash.filters.*; import flash.display.*; import flash.geom.*; import caurina.transitions.*; public class FilterShortcuts { public function FilterShortcuts(){ trace("This is an static class and should not be instantiated."); } public static function init():void{ Tweener.registerSpecialPropertySplitter("_filter", _filter_splitter); Tweener.registerSpecialProperty("_Bevel_angle", _filter_property_get, _filter_property_set, [BevelFilter, "angle"]); Tweener.registerSpecialProperty("_Bevel_blurX", _filter_property_get, _filter_property_set, [BevelFilter, "blurX"]); Tweener.registerSpecialProperty("_Bevel_blurY", _filter_property_get, _filter_property_set, [BevelFilter, "blurY"]); Tweener.registerSpecialProperty("_Bevel_distance", _filter_property_get, _filter_property_set, [BevelFilter, "distance"]); Tweener.registerSpecialProperty("_Bevel_highlightAlpha", _filter_property_get, _filter_property_set, [BevelFilter, "highlightAlpha"]); Tweener.registerSpecialPropertySplitter("_Bevel_highlightColor", _generic_color_splitter, ["_Bevel_highlightColor_r", "_Bevel_highlightColor_g", "_Bevel_highlightColor_b"]); Tweener.registerSpecialProperty("_Bevel_highlightColor_r", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "r"]); Tweener.registerSpecialProperty("_Bevel_highlightColor_g", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "g"]); Tweener.registerSpecialProperty("_Bevel_highlightColor_b", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "b"]); Tweener.registerSpecialProperty("_Bevel_knockout", _filter_property_get, _filter_property_set, [BevelFilter, "knockout"]); Tweener.registerSpecialProperty("_Bevel_quality", _filter_property_get, _filter_property_set, [BevelFilter, "quality"]); Tweener.registerSpecialProperty("_Bevel_shadowAlpha", _filter_property_get, _filter_property_set, [BevelFilter, "shadowAlpha"]); Tweener.registerSpecialPropertySplitter("_Bevel_shadowColor", _generic_color_splitter, ["_Bevel_shadowColor_r", "_Bevel_shadowColor_g", "_Bevel_shadowColor_b"]); Tweener.registerSpecialProperty("_Bevel_shadowColor_r", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "r"]); Tweener.registerSpecialProperty("_Bevel_shadowColor_g", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "g"]); Tweener.registerSpecialProperty("_Bevel_shadowColor_b", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "b"]); Tweener.registerSpecialProperty("_Bevel_strength", _filter_property_get, _filter_property_set, [BevelFilter, "strength"]); Tweener.registerSpecialProperty("_Bevel_type", _filter_property_get, _filter_property_set, [BevelFilter, "type"]); Tweener.registerSpecialProperty("_Blur_blurX", _filter_property_get, _filter_property_set, [BlurFilter, "blurX"]); Tweener.registerSpecialProperty("_Blur_blurY", _filter_property_get, _filter_property_set, [BlurFilter, "blurY"]); Tweener.registerSpecialProperty("_Blur_quality", _filter_property_get, _filter_property_set, [BlurFilter, "quality"]); Tweener.registerSpecialPropertySplitter("_ColorMatrix_matrix", _generic_matrix_splitter, [[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], ["_ColorMatrix_matrix_rr", "_ColorMatrix_matrix_rg", "_ColorMatrix_matrix_rb", "_ColorMatrix_matrix_ra", "_ColorMatrix_matrix_ro", "_ColorMatrix_matrix_gr", "_ColorMatrix_matrix_gg", "_ColorMatrix_matrix_gb", "_ColorMatrix_matrix_ga", "_ColorMatrix_matrix_go", "_ColorMatrix_matrix_br", "_ColorMatrix_matrix_bg", "_ColorMatrix_matrix_bb", "_ColorMatrix_matrix_ba", "_ColorMatrix_matrix_bo", "_ColorMatrix_matrix_ar", "_ColorMatrix_matrix_ag", "_ColorMatrix_matrix_ab", "_ColorMatrix_matrix_aa", "_ColorMatrix_matrix_ao"]]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_rr", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 0]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_rg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 1]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_rb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 2]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_ra", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 3]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_ro", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 4]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_gr", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 5]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_gg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 6]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_gb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 7]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_ga", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 8]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_go", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 9]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_br", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 10]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_bg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 11]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_bb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 12]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_ba", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 13]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_bo", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 14]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_ar", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 15]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_ag", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 16]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_ab", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 17]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_aa", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 18]); Tweener.registerSpecialProperty("_ColorMatrix_matrix_ao", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 19]); Tweener.registerSpecialProperty("_Convolution_alpha", _filter_property_get, _filter_property_set, [ConvolutionFilter, "alpha"]); Tweener.registerSpecialProperty("_Convolution_bias", _filter_property_get, _filter_property_set, [ConvolutionFilter, "bias"]); Tweener.registerSpecialProperty("_Convolution_clamp", _filter_property_get, _filter_property_set, [ConvolutionFilter, "clamp"]); Tweener.registerSpecialPropertySplitter("_Convolution_color", _generic_color_splitter, ["_Convolution_color_r", "_Convolution_color_g", "_Convolution_color_b"]); Tweener.registerSpecialProperty("_Convolution_color_r", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "r"]); Tweener.registerSpecialProperty("_Convolution_color_g", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "g"]); Tweener.registerSpecialProperty("_Convolution_color_b", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "b"]); Tweener.registerSpecialProperty("_Convolution_divisor", _filter_property_get, _filter_property_set, [ConvolutionFilter, "divisor"]); Tweener.registerSpecialProperty("_Convolution_matrixX", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrixX"]); Tweener.registerSpecialProperty("_Convolution_matrixY", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrixY"]); Tweener.registerSpecialProperty("_Convolution_preserveAlpha", _filter_property_get, _filter_property_set, [ConvolutionFilter, "preserveAlpha"]); Tweener.registerSpecialProperty("_DisplacementMap_alpha", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "alpha"]); Tweener.registerSpecialPropertySplitter("_DisplacementMap_color", _generic_color_splitter, ["_DisplacementMap_color_r", "_DisplacementMap_color_r", "_DisplacementMap_color_r"]); Tweener.registerSpecialProperty("_DisplacementMap_color_r", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "r"]); Tweener.registerSpecialProperty("_DisplacementMap_color_g", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "g"]); Tweener.registerSpecialProperty("_DisplacementMap_color_b", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "b"]); Tweener.registerSpecialProperty("_DisplacementMap_componentX", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "componentX"]); Tweener.registerSpecialProperty("_DisplacementMap_componentY", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "componentY"]); Tweener.registerSpecialProperty("_DisplacementMap_mapBitmap", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapBitmap"]); Tweener.registerSpecialProperty("_DisplacementMap_mapPoint", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapPoint"]); Tweener.registerSpecialProperty("_DisplacementMap_mode", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mode"]); Tweener.registerSpecialProperty("_DisplacementMap_scaleX", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "scaleX"]); Tweener.registerSpecialProperty("_DisplacementMap_scaleY", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "scaleY"]); Tweener.registerSpecialProperty("_DropShadow_alpha", _filter_property_get, _filter_property_set, [DropShadowFilter, "alpha"]); Tweener.registerSpecialProperty("_DropShadow_angle", _filter_property_get, _filter_property_set, [DropShadowFilter, "angle"]); Tweener.registerSpecialProperty("_DropShadow_blurX", _filter_property_get, _filter_property_set, [DropShadowFilter, "blurX"]); Tweener.registerSpecialProperty("_DropShadow_blurY", _filter_property_get, _filter_property_set, [DropShadowFilter, "blurY"]); Tweener.registerSpecialPropertySplitter("_DropShadow_color", _generic_color_splitter, ["_DropShadow_color_r", "_DropShadow_color_g", "_DropShadow_color_b"]); Tweener.registerSpecialProperty("_DropShadow_color_r", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "r"]); Tweener.registerSpecialProperty("_DropShadow_color_g", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "g"]); Tweener.registerSpecialProperty("_DropShadow_color_b", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "b"]); Tweener.registerSpecialProperty("_DropShadow_distance", _filter_property_get, _filter_property_set, [DropShadowFilter, "distance"]); Tweener.registerSpecialProperty("_DropShadow_hideObject", _filter_property_get, _filter_property_set, [DropShadowFilter, "hideObject"]); Tweener.registerSpecialProperty("_DropShadow_inner", _filter_property_get, _filter_property_set, [DropShadowFilter, "inner"]); Tweener.registerSpecialProperty("_DropShadow_knockout", _filter_property_get, _filter_property_set, [DropShadowFilter, "knockout"]); Tweener.registerSpecialProperty("_DropShadow_quality", _filter_property_get, _filter_property_set, [DropShadowFilter, "quality"]); Tweener.registerSpecialProperty("_DropShadow_strength", _filter_property_get, _filter_property_set, [DropShadowFilter, "strength"]); Tweener.registerSpecialProperty("_Glow_alpha", _filter_property_get, _filter_property_set, [GlowFilter, "alpha"]); Tweener.registerSpecialProperty("_Glow_blurX", _filter_property_get, _filter_property_set, [GlowFilter, "blurX"]); Tweener.registerSpecialProperty("_Glow_blurY", _filter_property_get, _filter_property_set, [GlowFilter, "blurY"]); Tweener.registerSpecialPropertySplitter("_Glow_color", _generic_color_splitter, ["_Glow_color_r", "_Glow_color_g", "_Glow_color_b"]); Tweener.registerSpecialProperty("_Glow_color_r", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "r"]); Tweener.registerSpecialProperty("_Glow_color_g", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "g"]); Tweener.registerSpecialProperty("_Glow_color_b", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "b"]); Tweener.registerSpecialProperty("_Glow_inner", _filter_property_get, _filter_property_set, [GlowFilter, "inner"]); Tweener.registerSpecialProperty("_Glow_knockout", _filter_property_get, _filter_property_set, [GlowFilter, "knockout"]); Tweener.registerSpecialProperty("_Glow_quality", _filter_property_get, _filter_property_set, [GlowFilter, "quality"]); Tweener.registerSpecialProperty("_Glow_strength", _filter_property_get, _filter_property_set, [GlowFilter, "strength"]); Tweener.registerSpecialProperty("_GradientBevel_angle", _filter_property_get, _filter_property_set, [GradientBevelFilter, "angle"]); Tweener.registerSpecialProperty("_GradientBevel_blurX", _filter_property_get, _filter_property_set, [GradientBevelFilter, "blurX"]); Tweener.registerSpecialProperty("_GradientBevel_blurY", _filter_property_get, _filter_property_set, [GradientBevelFilter, "blurY"]); Tweener.registerSpecialProperty("_GradientBevel_distance", _filter_property_get, _filter_property_set, [GradientBevelFilter, "distance"]); Tweener.registerSpecialProperty("_GradientBevel_quality", _filter_property_get, _filter_property_set, [GradientBevelFilter, "quality"]); Tweener.registerSpecialProperty("_GradientBevel_strength", _filter_property_get, _filter_property_set, [GradientBevelFilter, "strength"]); Tweener.registerSpecialProperty("_GradientBevel_type", _filter_property_get, _filter_property_set, [GradientBevelFilter, "type"]); Tweener.registerSpecialProperty("_GradientGlow_angle", _filter_property_get, _filter_property_set, [GradientGlowFilter, "angle"]); Tweener.registerSpecialProperty("_GradientGlow_blurX", _filter_property_get, _filter_property_set, [GradientGlowFilter, "blurX"]); Tweener.registerSpecialProperty("_GradientGlow_blurY", _filter_property_get, _filter_property_set, [GradientGlowFilter, "blurY"]); Tweener.registerSpecialProperty("_GradientGlow_distance", _filter_property_get, _filter_property_set, [GradientGlowFilter, "distance"]); Tweener.registerSpecialProperty("_GradientGlow_knockout", _filter_property_get, _filter_property_set, [GradientGlowFilter, "knockout"]); Tweener.registerSpecialProperty("_GradientGlow_quality", _filter_property_get, _filter_property_set, [GradientGlowFilter, "quality"]); Tweener.registerSpecialProperty("_GradientGlow_strength", _filter_property_get, _filter_property_set, [GradientGlowFilter, "strength"]); Tweener.registerSpecialProperty("_GradientGlow_type", _filter_property_get, _filter_property_set, [GradientGlowFilter, "type"]); } public static function _filter_property_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{ var _local5:Number; var _local9:Object; var _local10:String; var _local4:Array = _arg1.filters; var _local6:Object = _arg2[0]; var _local7:String = _arg2[1]; var _local8:String = _arg2[2]; _local5 = 0; while (_local5 < _local4.length) { if ((_local4[_local5] is Class(_local6))){ if (_local8 == "color"){ _local10 = _arg2[3]; if (_local10 == "r"){ return (AuxFunctions.numberToR(_local4[_local5][_local7])); }; if (_local10 == "g"){ return (AuxFunctions.numberToG(_local4[_local5][_local7])); }; if (_local10 == "b"){ return (AuxFunctions.numberToB(_local4[_local5][_local7])); }; } else { if (_local8 == "matrix"){ return (_local4[_local5][_local7][_arg2[3]]); }; return (_local4[_local5][_local7]); }; }; _local5++; }; switch (_local6){ case BevelFilter: _local9 = {angle:NaN, blurX:0, blurY:0, distance:0, highlightAlpha:1, highlightColor:NaN, knockout:null, quality:NaN, shadowAlpha:1, shadowColor:NaN, strength:2, type:null}; break; case BlurFilter: _local9 = {blurX:0, blurY:0, quality:NaN}; break; case ColorMatrixFilter: _local9 = {matrix:[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]}; break; case ConvolutionFilter: _local9 = {alpha:0, bias:0, clamp:null, color:NaN, divisor:1, matrix:[1], matrixX:1, matrixY:1, preserveAlpha:null}; break; case DisplacementMapFilter: _local9 = {alpha:0, color:NaN, componentX:null, componentY:null, mapBitmap:null, mapPoint:null, mode:null, scaleX:0, scaleY:0}; break; case DropShadowFilter: _local9 = {distance:0, angle:NaN, color:NaN, alpha:1, blurX:0, blurY:0, strength:1, quality:NaN, inner:null, knockout:null, hideObject:null}; break; case GlowFilter: _local9 = {alpha:1, blurX:0, blurY:0, color:NaN, inner:null, knockout:null, quality:NaN, strength:2}; break; case GradientBevelFilter: _local9 = {alphas:null, angle:NaN, blurX:0, blurY:0, colors:null, distance:0, knockout:null, quality:NaN, ratios:NaN, strength:1, type:null}; break; case GradientGlowFilter: _local9 = {alphas:null, angle:NaN, blurX:0, blurY:0, colors:null, distance:0, knockout:null, quality:NaN, ratios:NaN, strength:1, type:null}; break; }; if (_local8 == "color"){ return (NaN); }; if (_local8 == "matrix"){ return (_local9[_local7][_arg2[3]]); }; return (_local9[_local7]); } public static function _filter_property_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{ var _local6:Number; var _local10:BitmapFilter; var _local11:String; var _local12:Array; var _local5:Array = _arg1.filters; var _local7:Object = _arg3[0]; var _local8:String = _arg3[1]; var _local9:String = _arg3[2]; _local6 = 0; while (_local6 < _local5.length) { if ((_local5[_local6] is Class(_local7))){ if (_local9 == "color"){ _local11 = _arg3[3]; if (_local11 == "r"){ _local5[_local6][_local8] = ((_local5[_local6][_local8] & 0xFFFF) | (_arg2 << 16)); }; if (_local11 == "g"){ _local5[_local6][_local8] = ((_local5[_local6][_local8] & 0xFF00FF) | (_arg2 << 8)); }; if (_local11 == "b"){ _local5[_local6][_local8] = ((_local5[_local6][_local8] & 0xFFFF00) | _arg2); }; } else { if (_local9 == "matrix"){ _local12 = _local5[_local6][_local8]; _local12[_arg3[3]] = _arg2; _local5[_local6][_local8] = _local12; } else { _local5[_local6][_local8] = _arg2; }; }; _arg1.filters = _local5; return; }; _local6++; }; if (_local5 == null){ _local5 = new Array(); }; switch (_local7){ case BevelFilter: _local10 = new BevelFilter(0, 45, 0xFFFFFF, 1, 0, 1, 0, 0); break; case BlurFilter: _local10 = new BlurFilter(0, 0); break; case ColorMatrixFilter: _local10 = new ColorMatrixFilter([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]); break; case ConvolutionFilter: _local10 = new ConvolutionFilter(1, 1, [1], 1, 0, true, true, 0, 0); break; case DisplacementMapFilter: _local10 = new DisplacementMapFilter(new BitmapData(10, 10), new Point(0, 0), 0, 1, 0, 0); break; case DropShadowFilter: _local10 = new DropShadowFilter(0, 45, 0, 1, 0, 0); break; case GlowFilter: _local10 = new GlowFilter(0xFF0000, 1, 0, 0); break; case GradientBevelFilter: _local10 = new GradientBevelFilter(0, 45, [0xFFFFFF, 0], [1, 1], [32, 223], 0, 0); break; case GradientGlowFilter: _local10 = new GradientGlowFilter(0, 45, [0xFFFFFF, 0], [1, 1], [32, 223], 0, 0); break; }; _local5.push(_local10); _arg1.filters = _local5; _filter_property_set(_arg1, _arg2, _arg3); } public static function _generic_color_splitter(_arg1:Number, _arg2:Array):Array{ var _local3:Array = new Array(); _local3.push({name:_arg2[0], value:AuxFunctions.numberToR(_arg1)}); _local3.push({name:_arg2[1], value:AuxFunctions.numberToG(_arg1)}); _local3.push({name:_arg2[2], value:AuxFunctions.numberToB(_arg1)}); return (_local3); } public static function _generic_matrix_splitter(_arg1:Array, _arg2:Array):Array{ if (_arg1 == null){ _arg1 = _arg2[0].concat(); }; var _local3:Array = new Array(); var _local4:Number = 0; while (_local4 < _arg1.length) { _local3.push({name:_arg2[1][_local4], value:_arg1[_local4]}); _local4++; }; return (_local3); } public static function _filter_splitter(_arg1:BitmapFilter, _arg2:Array, _arg3:Object=null):Array{ var _local4:Array = new Array(); if ((_arg1 is BevelFilter)){ _local4.push({name:"_Bevel_angle", value:BevelFilter(_arg1).angle}); _local4.push({name:"_Bevel_blurX", value:BevelFilter(_arg1).blurX}); _local4.push({name:"_Bevel_blurY", value:BevelFilter(_arg1).blurY}); _local4.push({name:"_Bevel_distance", value:BevelFilter(_arg1).distance}); _local4.push({name:"_Bevel_highlightAlpha", value:BevelFilter(_arg1).highlightAlpha}); _local4.push({name:"_Bevel_highlightColor", value:BevelFilter(_arg1).highlightColor}); _local4.push({name:"_Bevel_knockout", value:BevelFilter(_arg1).knockout}); _local4.push({name:"_Bevel_quality", value:BevelFilter(_arg1).quality}); _local4.push({name:"_Bevel_shadowAlpha", value:BevelFilter(_arg1).shadowAlpha}); _local4.push({name:"_Bevel_shadowColor", value:BevelFilter(_arg1).shadowColor}); _local4.push({name:"_Bevel_strength", value:BevelFilter(_arg1).strength}); _local4.push({name:"_Bevel_type", value:BevelFilter(_arg1).type}); } else { if ((_arg1 is BlurFilter)){ _local4.push({name:"_Blur_blurX", value:BlurFilter(_arg1).blurX}); _local4.push({name:"_Blur_blurY", value:BlurFilter(_arg1).blurY}); _local4.push({name:"_Blur_quality", value:BlurFilter(_arg1).quality}); } else { if ((_arg1 is ColorMatrixFilter)){ _local4.push({name:"_ColorMatrix_matrix", value:ColorMatrixFilter(_arg1).matrix}); } else { if ((_arg1 is ConvolutionFilter)){ _local4.push({name:"_Convolution_alpha", value:ConvolutionFilter(_arg1).alpha}); _local4.push({name:"_Convolution_bias", value:ConvolutionFilter(_arg1).bias}); _local4.push({name:"_Convolution_clamp", value:ConvolutionFilter(_arg1).clamp}); _local4.push({name:"_Convolution_color", value:ConvolutionFilter(_arg1).color}); _local4.push({name:"_Convolution_divisor", value:ConvolutionFilter(_arg1).divisor}); _local4.push({name:"_Convolution_matrixX", value:ConvolutionFilter(_arg1).matrixX}); _local4.push({name:"_Convolution_matrixY", value:ConvolutionFilter(_arg1).matrixY}); _local4.push({name:"_Convolution_preserveAlpha", value:ConvolutionFilter(_arg1).preserveAlpha}); } else { if ((_arg1 is DisplacementMapFilter)){ _local4.push({name:"_DisplacementMap_alpha", value:DisplacementMapFilter(_arg1).alpha}); _local4.push({name:"_DisplacementMap_color", value:DisplacementMapFilter(_arg1).color}); _local4.push({name:"_DisplacementMap_componentX", value:DisplacementMapFilter(_arg1).componentX}); _local4.push({name:"_DisplacementMap_componentY", value:DisplacementMapFilter(_arg1).componentY}); _local4.push({name:"_DisplacementMap_mapBitmap", value:DisplacementMapFilter(_arg1).mapBitmap}); _local4.push({name:"_DisplacementMap_mapPoint", value:DisplacementMapFilter(_arg1).mapPoint}); _local4.push({name:"_DisplacementMap_mode", value:DisplacementMapFilter(_arg1).mode}); _local4.push({name:"_DisplacementMap_scaleX", value:DisplacementMapFilter(_arg1).scaleX}); _local4.push({name:"_DisplacementMap_scaleY", value:DisplacementMapFilter(_arg1).scaleY}); } else { if ((_arg1 is DropShadowFilter)){ _local4.push({name:"_DropShadow_alpha", value:DropShadowFilter(_arg1).alpha}); _local4.push({name:"_DropShadow_angle", value:DropShadowFilter(_arg1).angle}); _local4.push({name:"_DropShadow_blurX", value:DropShadowFilter(_arg1).blurX}); _local4.push({name:"_DropShadow_blurY", value:DropShadowFilter(_arg1).blurY}); _local4.push({name:"_DropShadow_color", value:DropShadowFilter(_arg1).color}); _local4.push({name:"_DropShadow_distance", value:DropShadowFilter(_arg1).distance}); _local4.push({name:"_DropShadow_hideObject", value:DropShadowFilter(_arg1).hideObject}); _local4.push({name:"_DropShadow_inner", value:DropShadowFilter(_arg1).inner}); _local4.push({name:"_DropShadow_knockout", value:DropShadowFilter(_arg1).knockout}); _local4.push({name:"_DropShadow_quality", value:DropShadowFilter(_arg1).quality}); _local4.push({name:"_DropShadow_strength", value:DropShadowFilter(_arg1).strength}); } else { if ((_arg1 is GlowFilter)){ _local4.push({name:"_Glow_alpha", value:GlowFilter(_arg1).alpha}); _local4.push({name:"_Glow_blurX", value:GlowFilter(_arg1).blurX}); _local4.push({name:"_Glow_blurY", value:GlowFilter(_arg1).blurY}); _local4.push({name:"_Glow_color", value:GlowFilter(_arg1).color}); _local4.push({name:"_Glow_inner", value:GlowFilter(_arg1).inner}); _local4.push({name:"_Glow_knockout", value:GlowFilter(_arg1).knockout}); _local4.push({name:"_Glow_quality", value:GlowFilter(_arg1).quality}); _local4.push({name:"_Glow_strength", value:GlowFilter(_arg1).strength}); } else { if ((_arg1 is GradientBevelFilter)){ _local4.push({name:"_GradientBevel_angle", value:GradientBevelFilter(_arg1).strength}); _local4.push({name:"_GradientBevel_blurX", value:GradientBevelFilter(_arg1).blurX}); _local4.push({name:"_GradientBevel_blurY", value:GradientBevelFilter(_arg1).blurY}); _local4.push({name:"_GradientBevel_distance", value:GradientBevelFilter(_arg1).distance}); _local4.push({name:"_GradientBevel_quality", value:GradientBevelFilter(_arg1).quality}); _local4.push({name:"_GradientBevel_strength", value:GradientBevelFilter(_arg1).strength}); _local4.push({name:"_GradientBevel_type", value:GradientBevelFilter(_arg1).type}); } else { if ((_arg1 is GradientGlowFilter)){ _local4.push({name:"_GradientGlow_angle", value:GradientGlowFilter(_arg1).strength}); _local4.push({name:"_GradientGlow_blurX", value:GradientGlowFilter(_arg1).blurX}); _local4.push({name:"_GradientGlow_blurY", value:GradientGlowFilter(_arg1).blurY}); _local4.push({name:"_GradientGlow_distance", value:GradientGlowFilter(_arg1).distance}); _local4.push({name:"_GradientGlow_knockout", value:GradientGlowFilter(_arg1).knockout}); _local4.push({name:"_GradientGlow_quality", value:GradientGlowFilter(_arg1).quality}); _local4.push({name:"_GradientGlow_strength", value:GradientGlowFilter(_arg1).strength}); _local4.push({name:"_GradientGlow_type", value:GradientGlowFilter(_arg1).type}); } else { trace("Tweener FilterShortcuts Error :: Unknown filter class used"); }; }; }; }; }; }; }; }; }; return (_local4); } } }//package caurina.transitions.properties
Section 76
//AuxFunctions (caurina.transitions.AuxFunctions) package caurina.transitions { public class AuxFunctions { public static function concatObjects(... _args):Object{ var _local3:Object; var _local5:String; var _local2:Object = {}; var _local4:int; while (_local4 < _args.length) { _local3 = _args[_local4]; for (_local5 in _local3) { if (_local3[_local5] == null){ delete _local2[_local5]; } else { _local2[_local5] = _local3[_local5]; }; }; _local4++; }; return (_local2); } public static function numberToG(_arg1:Number):Number{ return (((_arg1 & 0xFF00) >> 8)); } public static function numberToR(_arg1:Number):Number{ return (((_arg1 & 0xFF0000) >> 16)); } public static function isInArray(_arg1:String, _arg2:Array):Boolean{ var _local3:uint = _arg2.length; var _local4:uint; while (_local4 < _local3) { if (_arg2[_local4] == _arg1){ return (true); }; _local4++; }; return (false); } public static function getObjectLength(_arg1:Object):uint{ var _local3:String; var _local2:uint; for (_local3 in _arg1) { _local2++; }; return (_local2); } public static function numberToB(_arg1:Number):Number{ return ((_arg1 & 0xFF)); } } }//package caurina.transitions
Section 77
//Equations (caurina.transitions.Equations) package caurina.transitions { public class Equations { public function Equations(){ trace("Equations is a static class and should not be instantiated."); } public static function easeOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = (_arg1 / _arg4); if (_arg1 < (1 / 2.75)){ return (((_arg3 * ((7.5625 * _arg1) * _arg1)) + _arg2)); }; if (_arg1 < (2 / 2.75)){ _arg1 = (_arg1 - (1.5 / 2.75)); return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.75)) + _arg2)); }; if (_arg1 < (2.5 / 2.75)){ _arg1 = (_arg1 - (2.25 / 2.75)); return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.9375)) + _arg2)); }; _arg1 = (_arg1 - (2.625 / 2.75)); return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.984375)) + _arg2)); } public static function easeInOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ var _local7:Number; if (_arg1 == 0){ return (_arg2); }; _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 == 2){ return ((_arg2 + _arg3)); }; var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * (0.3 * 1.5)) : _arg5.period; var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude; if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){ _local8 = _arg3; _local7 = (_local6 / 4); } else { _local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8))); }; if (_arg1 < 1){ --_arg1; return (((-0.5 * ((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2)); }; --_arg1; return ((((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) * 0.5) + _arg3) + _arg2)); } public static function easeInOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2)); }; --_arg1; return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2)); } public static function easeInOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ if (_arg1 < (_arg4 / 2)){ return (((easeInBounce((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2)); }; return ((((easeOutBounce(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2)); } public static function easeInOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot; _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ _local6 = (_local6 * 1.525); return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_local6 + 1) * _arg1) - _local6))) + _arg2)); }; _arg1 = (_arg1 - 2); _local6 = (_local6 * 1.525); return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 2)) + _arg2)); } public static function easeOutInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ if (_arg1 < (_arg4 / 2)){ return (easeOutCubic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); }; return (easeInCubic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); } public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ return ((((_arg3 * _arg1) / _arg4) + _arg2)); } public static function easeOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot; _arg1 = ((_arg1 / _arg4) - 1); return (((_arg3 * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 1)) + _arg2)); } public static function easeInOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2)); } public static function easeInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot; _arg1 = (_arg1 / _arg4); return (((((_arg3 * _arg1) * _arg1) * (((_local6 + 1) * _arg1) - _local6)) + _arg2)); } public static function easeInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = (_arg1 / _arg4); return ((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) + _arg2)); } public static function easeOutInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ if (_arg1 < (_arg4 / 2)){ return (easeOutQuint((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); }; return (easeInQuint(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); } public static function easeOutInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ if (_arg1 < (_arg4 / 2)){ return (easeOutBounce((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); }; return (easeInBounce(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); } public static function init():void{ Tweener.registerTransition("easenone", easeNone); Tweener.registerTransition("linear", easeNone); Tweener.registerTransition("easeinquad", easeInQuad); Tweener.registerTransition("easeoutquad", easeOutQuad); Tweener.registerTransition("easeinoutquad", easeInOutQuad); Tweener.registerTransition("easeoutinquad", easeOutInQuad); Tweener.registerTransition("easeincubic", easeInCubic); Tweener.registerTransition("easeoutcubic", easeOutCubic); Tweener.registerTransition("easeinoutcubic", easeInOutCubic); Tweener.registerTransition("easeoutincubic", easeOutInCubic); Tweener.registerTransition("easeinquart", easeInQuart); Tweener.registerTransition("easeoutquart", easeOutQuart); Tweener.registerTransition("easeinoutquart", easeInOutQuart); Tweener.registerTransition("easeoutinquart", easeOutInQuart); Tweener.registerTransition("easeinquint", easeInQuint); Tweener.registerTransition("easeoutquint", easeOutQuint); Tweener.registerTransition("easeinoutquint", easeInOutQuint); Tweener.registerTransition("easeoutinquint", easeOutInQuint); Tweener.registerTransition("easeinsine", easeInSine); Tweener.registerTransition("easeoutsine", easeOutSine); Tweener.registerTransition("easeinoutsine", easeInOutSine); Tweener.registerTransition("easeoutinsine", easeOutInSine); Tweener.registerTransition("easeincirc", easeInCirc); Tweener.registerTransition("easeoutcirc", easeOutCirc); Tweener.registerTransition("easeinoutcirc", easeInOutCirc); Tweener.registerTransition("easeoutincirc", easeOutInCirc); Tweener.registerTransition("easeinexpo", easeInExpo); Tweener.registerTransition("easeoutexpo", easeOutExpo); Tweener.registerTransition("easeinoutexpo", easeInOutExpo); Tweener.registerTransition("easeoutinexpo", easeOutInExpo); Tweener.registerTransition("easeinelastic", easeInElastic); Tweener.registerTransition("easeoutelastic", easeOutElastic); Tweener.registerTransition("easeinoutelastic", easeInOutElastic); Tweener.registerTransition("easeoutinelastic", easeOutInElastic); Tweener.registerTransition("easeinback", easeInBack); Tweener.registerTransition("easeoutback", easeOutBack); Tweener.registerTransition("easeinoutback", easeInOutBack); Tweener.registerTransition("easeoutinback", easeOutInBack); Tweener.registerTransition("easeinbounce", easeInBounce); Tweener.registerTransition("easeoutbounce", easeOutBounce); Tweener.registerTransition("easeinoutbounce", easeInOutBounce); Tweener.registerTransition("easeoutinbounce", easeOutInBounce); } public static function easeOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ return (((_arg1)==_arg4) ? (_arg2 + _arg3) : (((_arg3 * 1.001) * (-(Math.pow(2, ((-10 * _arg1) / _arg4))) + 1)) + _arg2)); } public static function easeOutInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ if (_arg1 < (_arg4 / 2)){ return (easeOutBack((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); }; return (easeInBack(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); } public static function easeInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ return (((_arg1)==0) ? _arg2 : (((_arg3 * Math.pow(2, (10 * ((_arg1 / _arg4) - 1)))) + _arg2) - (_arg3 * 0.001))); } public static function easeInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = (_arg1 / _arg4); return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2)); } public static function easeInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = (_arg1 / _arg4); return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2)); } public static function easeInOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2)); }; _arg1 = (_arg1 - 2); return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2)); } public static function easeInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = (_arg1 / _arg4); return ((((_arg3 * _arg1) * _arg1) + _arg2)); } public static function easeInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ return (((_arg3 - easeOutBounce((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2)); } public static function easeOutInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ if (_arg1 < (_arg4 / 2)){ return (easeOutExpo((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); }; return (easeInExpo(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); } public static function easeOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = ((_arg1 / _arg4) - 1); return (((-(_arg3) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 1)) + _arg2)); } public static function easeInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2)); } public static function easeInOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ return (((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2)); }; _arg1 = (_arg1 - 2); return ((((-(_arg3) / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 2)) + _arg2)); } public static function easeOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = (_arg1 / _arg4); return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2)); } public static function easeOutInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ if (_arg1 < (_arg4 / 2)){ return (easeOutElastic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); }; return (easeInElastic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); } public static function easeInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ var _local7:Number; if (_arg1 == 0){ return (_arg2); }; _arg1 = (_arg1 / _arg4); if (_arg1 == 1){ return ((_arg2 + _arg3)); }; var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period; var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude; if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){ _local8 = _arg3; _local7 = (_local6 / 4); } else { _local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8))); }; --_arg1; return ((-(((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2)); } public static function easeOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = ((_arg1 / _arg4) - 1); return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2)); } public static function easeOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = ((_arg1 / _arg4) - 1); return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2)); } public static function easeOutInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ if (_arg1 < (_arg4 / 2)){ return (easeOutQuad((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); }; return (easeInQuad(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); } public static function easeOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2)); } public static function easeInOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2)); }; _arg1 = (_arg1 - 2); return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2)); } public static function easeInOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2)); }; _arg1 = (_arg1 - 2); return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2)); } public static function easeInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = (_arg1 / _arg4); return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2)); } public static function easeOutInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ if (_arg1 < (_arg4 / 2)){ return (easeOutSine((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); }; return (easeInSine(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); } public static function easeInOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ if (_arg1 == 0){ return (_arg2); }; if (_arg1 == _arg4){ return ((_arg2 + _arg3)); }; _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ return (((((_arg3 / 2) * Math.pow(2, (10 * (_arg1 - 1)))) + _arg2) - (_arg3 * 0.0005))); }; --_arg1; return (((((_arg3 / 2) * 1.0005) * (-(Math.pow(2, (-10 * _arg1))) + 2)) + _arg2)); } public static function easeOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ var _local7:Number; if (_arg1 == 0){ return (_arg2); }; _arg1 = (_arg1 / _arg4); if (_arg1 == 1){ return ((_arg2 + _arg3)); }; var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period; var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude; if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){ _local8 = _arg3; _local7 = (_local6 / 4); } else { _local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8))); }; return (((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) + _arg3) + _arg2)); } public static function easeOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ _arg1 = ((_arg1 / _arg4) - 1); return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2)); } public static function easeOutInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ if (_arg1 < (_arg4 / 2)){ return (easeOutQuart((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); }; return (easeInQuart(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); } public static function easeOutInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{ if (_arg1 < (_arg4 / 2)){ return (easeOutCirc((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5)); }; return (easeInCirc(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5)); } } }//package caurina.transitions
Section 78
//PropertyInfoObj (caurina.transitions.PropertyInfoObj) package caurina.transitions { public class PropertyInfoObj { public var modifierParameters:Array; public var isSpecialProperty:Boolean; public var valueComplete:Number; public var modifierFunction:Function; public var extra:Object; public var valueStart:Number; public var hasModifier:Boolean; public var arrayIndex:Number; public var originalValueComplete:Object; public function PropertyInfoObj(_arg1:Number, _arg2:Number, _arg3:Object, _arg4:Number, _arg5:Object, _arg6:Boolean, _arg7:Function, _arg8:Array){ valueStart = _arg1; valueComplete = _arg2; originalValueComplete = _arg3; arrayIndex = _arg4; extra = _arg5; isSpecialProperty = _arg6; hasModifier = Boolean(_arg7); modifierFunction = _arg7; modifierParameters = _arg8; } public function toString():String{ var _local1 = "\n[PropertyInfoObj "; _local1 = (_local1 + ("valueStart:" + String(valueStart))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("valueComplete:" + String(valueComplete))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("originalValueComplete:" + String(originalValueComplete))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("arrayIndex:" + String(arrayIndex))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("extra:" + String(extra))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("isSpecialProperty:" + String(isSpecialProperty))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("hasModifier:" + String(hasModifier))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("modifierFunction:" + String(modifierFunction))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("modifierParameters:" + String(modifierParameters))); _local1 = (_local1 + "]\n"); return (_local1); } public function clone():PropertyInfoObj{ var _local1:PropertyInfoObj = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters); return (_local1); } } }//package caurina.transitions
Section 79
//SpecialProperty (caurina.transitions.SpecialProperty) package caurina.transitions { public class SpecialProperty { public var parameters:Array; public var getValue:Function; public var preProcess:Function; public var setValue:Function; public function SpecialProperty(_arg1:Function, _arg2:Function, _arg3:Array=null, _arg4:Function=null){ getValue = _arg1; setValue = _arg2; parameters = _arg3; preProcess = _arg4; } public function toString():String{ var _local1 = ""; _local1 = (_local1 + "[SpecialProperty "); _local1 = (_local1 + ("getValue:" + String(getValue))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("setValue:" + String(setValue))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("parameters:" + String(parameters))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("preProcess:" + String(preProcess))); _local1 = (_local1 + "]"); return (_local1); } } }//package caurina.transitions
Section 80
//SpecialPropertyModifier (caurina.transitions.SpecialPropertyModifier) package caurina.transitions { public class SpecialPropertyModifier { public var getValue:Function; public var modifyValues:Function; public function SpecialPropertyModifier(_arg1:Function, _arg2:Function){ modifyValues = _arg1; getValue = _arg2; } public function toString():String{ var _local1 = ""; _local1 = (_local1 + "[SpecialPropertyModifier "); _local1 = (_local1 + ("modifyValues:" + String(modifyValues))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("getValue:" + String(getValue))); _local1 = (_local1 + "]"); return (_local1); } } }//package caurina.transitions
Section 81
//SpecialPropertySplitter (caurina.transitions.SpecialPropertySplitter) package caurina.transitions { public class SpecialPropertySplitter { public var parameters:Array; public var splitValues:Function; public function SpecialPropertySplitter(_arg1:Function, _arg2:Array){ splitValues = _arg1; parameters = _arg2; } public function toString():String{ var _local1 = ""; _local1 = (_local1 + "[SpecialPropertySplitter "); _local1 = (_local1 + ("splitValues:" + String(splitValues))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("parameters:" + String(parameters))); _local1 = (_local1 + "]"); return (_local1); } } }//package caurina.transitions
Section 82
//Tweener (caurina.transitions.Tweener) package caurina.transitions { import flash.events.*; import flash.display.*; import flash.utils.*; public class Tweener { private static var _timeScale:Number = 1; private static var _currentTimeFrame:Number; private static var _specialPropertySplitterList:Object; private static var _engineExists:Boolean = false; private static var _specialPropertyModifierList:Object; private static var _currentTime:Number; private static var _tweenList:Array; private static var _specialPropertyList:Object; private static var _transitionList:Object; private static var _inited:Boolean = false; private static var __tweener_controller__:MovieClip; public function Tweener(){ trace("Tweener is a static class and should not be instantiated."); } public static function registerSpecialPropertyModifier(_arg1:String, _arg2:Function, _arg3:Function):void{ if (!_inited){ init(); }; var _local4:SpecialPropertyModifier = new SpecialPropertyModifier(_arg2, _arg3); _specialPropertyModifierList[_arg1] = _local4; } public static function registerSpecialProperty(_arg1:String, _arg2:Function, _arg3:Function, _arg4:Array=null, _arg5:Function=null):void{ if (!_inited){ init(); }; var _local6:SpecialProperty = new SpecialProperty(_arg2, _arg3, _arg4, _arg5); _specialPropertyList[_arg1] = _local6; } public static function init(... _args):void{ _inited = true; _transitionList = new Object(); Equations.init(); _specialPropertyList = new Object(); _specialPropertyModifierList = new Object(); _specialPropertySplitterList = new Object(); } private static function updateTweens():Boolean{ var _local1:int; if (_tweenList.length == 0){ return (false); }; _local1 = 0; while (_local1 < _tweenList.length) { if ((((_tweenList[_local1] == undefined)) || (!(_tweenList[_local1].isPaused)))){ if (!updateTweenByIndex(_local1)){ removeTweenByIndex(_local1); }; if (_tweenList[_local1] == null){ removeTweenByIndex(_local1, true); _local1--; }; }; _local1++; }; return (true); } public static function addCaller(_arg1:Object=null, _arg2:Object=null):Boolean{ var _local3:Number; var _local4:Array; var _local8:Function; var _local9:TweenListObj; var _local10:Number; var _local11:String; if (!Boolean(_arg1)){ return (false); }; if ((_arg1 is Array)){ _local4 = _arg1.concat(); } else { _local4 = [_arg1]; }; var _local5:Object = _arg2; if (!_inited){ init(); }; if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){ startEngine(); }; var _local6:Number = (isNaN(_local5.time)) ? 0 : _local5.time; var _local7:Number = (isNaN(_local5.delay)) ? 0 : _local5.delay; if (typeof(_local5.transition) == "string"){ _local11 = _local5.transition.toLowerCase(); _local8 = _transitionList[_local11]; } else { _local8 = _local5.transition; }; if (!Boolean(_local8)){ _local8 = _transitionList["easeoutexpo"]; }; _local3 = 0; while (_local3 < _local4.length) { if (_local5.useFrames == true){ _local9 = new TweenListObj(_local4[_local3], (_currentTimeFrame + (_local7 / _timeScale)), (_currentTimeFrame + ((_local7 + _local6) / _timeScale)), true, _local8, _local5.transitionParams); } else { _local9 = new TweenListObj(_local4[_local3], (_currentTime + ((_local7 * 1000) / _timeScale)), (_currentTime + (((_local7 * 1000) + (_local6 * 1000)) / _timeScale)), false, _local8, _local5.transitionParams); }; _local9.properties = null; _local9.onStart = _local5.onStart; _local9.onUpdate = _local5.onUpdate; _local9.onComplete = _local5.onComplete; _local9.onOverwrite = _local5.onOverwrite; _local9.onStartParams = _local5.onStartParams; _local9.onUpdateParams = _local5.onUpdateParams; _local9.onCompleteParams = _local5.onCompleteParams; _local9.onOverwriteParams = _local5.onOverwriteParams; _local9.onStartScope = _local5.onStartScope; _local9.onUpdateScope = _local5.onUpdateScope; _local9.onCompleteScope = _local5.onCompleteScope; _local9.onOverwriteScope = _local5.onOverwriteScope; _local9.onErrorScope = _local5.onErrorScope; _local9.isCaller = true; _local9.count = _local5.count; _local9.waitFrames = _local5.waitFrames; _tweenList.push(_local9); if ((((_local6 == 0)) && ((_local7 == 0)))){ _local10 = (_tweenList.length - 1); updateTweenByIndex(_local10); removeTweenByIndex(_local10); }; _local3++; }; return (true); } public static function pauseAllTweens():Boolean{ var _local2:uint; if (!Boolean(_tweenList)){ return (false); }; var _local1:Boolean; _local2 = 0; while (_local2 < _tweenList.length) { pauseTweenByIndex(_local2); _local1 = true; _local2++; }; return (_local1); } public static function removeTweens(_arg1:Object, ... _args):Boolean{ var _local4:uint; var _local3:Array = new Array(); _local4 = 0; while (_local4 < _args.length) { if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){ _local3.push(_args[_local4]); }; _local4++; }; return (affectTweens(removeTweenByIndex, _arg1, _local3)); } public static function splitTweens(_arg1:Number, _arg2:Array):uint{ var _local5:uint; var _local6:String; var _local7:Boolean; var _local3:TweenListObj = _tweenList[_arg1]; var _local4:TweenListObj = _local3.clone(false); _local5 = 0; while (_local5 < _arg2.length) { _local6 = _arg2[_local5]; if (Boolean(_local3.properties[_local6])){ _local3.properties[_local6] = undefined; delete _local3.properties[_local6]; }; _local5++; }; for (_local6 in _local4.properties) { _local7 = false; _local5 = 0; while (_local5 < _arg2.length) { if (_arg2[_local5] == _local6){ _local7 = true; break; }; _local5++; }; if (!_local7){ _local4.properties[_local6] = undefined; delete _local4.properties[_local6]; }; }; _tweenList.push(_local4); return ((_tweenList.length - 1)); } public static function updateFrame():void{ _currentTimeFrame++; } public static function resumeTweenByIndex(_arg1:Number):Boolean{ var _local2:TweenListObj = _tweenList[_arg1]; if ((((_local2 == null)) || (!(_local2.isPaused)))){ return (false); }; var _local3:Number = getCurrentTweeningTime(_local2); _local2.timeStart = (_local2.timeStart + (_local3 - _local2.timePaused)); _local2.timeComplete = (_local2.timeComplete + (_local3 - _local2.timePaused)); _local2.timePaused = undefined; _local2.isPaused = false; return (true); } public static function getVersion():String{ return ("AS3 1.31.71"); } public static function onEnterFrame(_arg1:Event):void{ updateTime(); updateFrame(); var _local2:Boolean; _local2 = updateTweens(); if (!_local2){ stopEngine(); }; } public static function updateTime():void{ _currentTime = getTimer(); } private static function updateTweenByIndex(_arg1:Number):Boolean{ var tTweening:TweenListObj; var mustUpdate:Boolean; var nv:Number; var t:Number; var b:Number; var c:Number; var d:Number; var pName:String; var eventScope:Object; var tScope:Object; var tProperty:Object; var pv:Number; var i = _arg1; tTweening = _tweenList[i]; if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){ return (false); }; var isOver:Boolean; var cTime:Number = getCurrentTweeningTime(tTweening); if (cTime >= tTweening.timeStart){ tScope = tTweening.scope; if (tTweening.isCaller){ do { t = (((tTweening.timeComplete - tTweening.timeStart) / tTweening.count) * (tTweening.timesCalled + 1)); b = tTweening.timeStart; c = (tTweening.timeComplete - tTweening.timeStart); d = (tTweening.timeComplete - tTweening.timeStart); nv = tTweening.transition(t, b, c, d); } while (!(cTime >= nv)); } else { mustUpdate = (((((tTweening.skipUpdates < 1)) || (!(tTweening.skipUpdates)))) || ((tTweening.updatesSkipped >= tTweening.skipUpdates))); if (cTime >= tTweening.timeComplete){ isOver = true; mustUpdate = true; }; if (!tTweening.hasStarted){ if (Boolean(tTweening.onStart)){ eventScope = (Boolean(tTweening.onStartScope)) ? tTweening.onStartScope : tScope; try { tTweening.onStart.apply(eventScope, tTweening.onStartParams); } catch(e:Error) { handleError(tTweening, e, "onStart"); }; }; for (pName in tTweening.properties) { if (tTweening.properties[pName].isSpecialProperty){ if (Boolean(_specialPropertyList[pName].preProcess)){ tTweening.properties[pName].valueComplete = _specialPropertyList[pName].preProcess(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].originalValueComplete, tTweening.properties[pName].extra); }; pv = _specialPropertyList[pName].getValue(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra); } else { pv = tScope[pName]; }; tTweening.properties[pName].valueStart = (isNaN(pv)) ? tTweening.properties[pName].valueComplete : pv; }; mustUpdate = true; tTweening.hasStarted = true; }; if (mustUpdate){ for (pName in tTweening.properties) { tProperty = tTweening.properties[pName]; if (isOver){ nv = tProperty.valueComplete; } else { if (tProperty.hasModifier){ t = (cTime - tTweening.timeStart); d = (tTweening.timeComplete - tTweening.timeStart); nv = tTweening.transition(t, 0, 1, d, tTweening.transitionParams); nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters); } else { t = (cTime - tTweening.timeStart); b = tProperty.valueStart; c = (tProperty.valueComplete - tProperty.valueStart); d = (tTweening.timeComplete - tTweening.timeStart); nv = tTweening.transition(t, b, c, d, tTweening.transitionParams); }; }; if (tTweening.rounded){ nv = Math.round(nv); }; if (tProperty.isSpecialProperty){ _specialPropertyList[pName].setValue(tScope, nv, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra); } else { tScope[pName] = nv; }; }; tTweening.updatesSkipped = 0; if (Boolean(tTweening.onUpdate)){ eventScope = (Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope; try { tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams); } catch(e:Error) { handleError(tTweening, e, "onUpdate"); }; }; } else { tTweening.updatesSkipped++; }; }; if (((isOver) && (Boolean(tTweening.onComplete)))){ eventScope = (Boolean(tTweening.onCompleteScope)) ? tTweening.onCompleteScope : tScope; try { tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams); } catch(e:Error) { handleError(tTweening, e, "onComplete"); }; }; return (!(isOver)); }; return (true); } public static function setTimeScale(_arg1:Number):void{ var _local2:Number; var _local3:Number; if (isNaN(_arg1)){ _arg1 = 1; }; if (_arg1 < 1E-5){ _arg1 = 1E-5; }; if (_arg1 != _timeScale){ if (_tweenList != null){ _local2 = 0; while (_local2 < _tweenList.length) { _local3 = getCurrentTweeningTime(_tweenList[_local2]); _tweenList[_local2].timeStart = (_local3 - (((_local3 - _tweenList[_local2].timeStart) * _timeScale) / _arg1)); _tweenList[_local2].timeComplete = (_local3 - (((_local3 - _tweenList[_local2].timeComplete) * _timeScale) / _arg1)); if (_tweenList[_local2].timePaused != undefined){ _tweenList[_local2].timePaused = (_local3 - (((_local3 - _tweenList[_local2].timePaused) * _timeScale) / _arg1)); }; _local2++; }; }; _timeScale = _arg1; }; } public static function resumeAllTweens():Boolean{ var _local2:uint; if (!Boolean(_tweenList)){ return (false); }; var _local1:Boolean; _local2 = 0; while (_local2 < _tweenList.length) { resumeTweenByIndex(_local2); _local1 = true; _local2++; }; return (_local1); } private static function handleError(_arg1:TweenListObj, _arg2:Error, _arg3:String):void{ var eventScope:Object; var pTweening = _arg1; var pError = _arg2; var pCallBackName = _arg3; if (((Boolean(pTweening.onError)) && ((pTweening.onError is Function)))){ eventScope = (Boolean(pTweening.onErrorScope)) ? pTweening.onErrorScope : pTweening.scope; try { pTweening.onError.apply(eventScope, [pTweening.scope, pError]); } catch(metaError:Error) { printError(((((String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n ") + pError.getStackTrace()) + "\nonError error: ") + metaError.getStackTrace())); }; } else { if (!Boolean(pTweening.onError)){ printError(((((String(pTweening.scope) + " raised an error while executing the '") + pCallBackName) + "'handler. \n") + pError.getStackTrace())); }; }; } private static function startEngine():void{ _engineExists = true; _tweenList = new Array(); __tweener_controller__ = new MovieClip(); __tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame); _currentTimeFrame = 0; updateTime(); } public static function removeAllTweens():Boolean{ var _local2:uint; if (!Boolean(_tweenList)){ return (false); }; var _local1:Boolean; _local2 = 0; while (_local2 < _tweenList.length) { removeTweenByIndex(_local2); _local1 = true; _local2++; }; return (_local1); } public static function addTween(_arg1:Object=null, _arg2:Object=null):Boolean{ var _local3:Number; var _local4:Number; var _local5:String; var _local6:Array; var _local13:Function; var _local14:Object; var _local15:TweenListObj; var _local16:Number; var _local17:Array; var _local18:Array; var _local19:Array; var _local20:String; if (!Boolean(_arg1)){ return (false); }; if ((_arg1 is Array)){ _local6 = _arg1.concat(); } else { _local6 = [_arg1]; }; var _local7:Object = TweenListObj.makePropertiesChain(_arg2); if (!_inited){ init(); }; if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){ startEngine(); }; var _local8:Number = (isNaN(_local7.time)) ? 0 : _local7.time; var _local9:Number = (isNaN(_local7.delay)) ? 0 : _local7.delay; var _local10:Array = new Array(); var _local11:Object = {time:true, delay:true, useFrames:true, skipUpdates:true, transition:true, transitionParams:true, onStart:true, onUpdate:true, onComplete:true, onOverwrite:true, onError:true, rounded:true, onStartParams:true, onUpdateParams:true, onCompleteParams:true, onOverwriteParams:true, onStartScope:true, onUpdateScope:true, onCompleteScope:true, onOverwriteScope:true, onErrorScope:true}; var _local12:Object = new Object(); for (_local5 in _local7) { if (!_local11[_local5]){ if (_specialPropertySplitterList[_local5]){ _local17 = _specialPropertySplitterList[_local5].splitValues(_local7[_local5], _specialPropertySplitterList[_local5].parameters); _local3 = 0; while (_local3 < _local17.length) { if (_specialPropertySplitterList[_local17[_local3].name]){ _local18 = _specialPropertySplitterList[_local17[_local3].name].splitValues(_local17[_local3].value, _specialPropertySplitterList[_local17[_local3].name].parameters); _local4 = 0; while (_local4 < _local18.length) { _local10[_local18[_local4].name] = {valueStart:undefined, valueComplete:_local18[_local4].value, arrayIndex:_local18[_local4].arrayIndex, isSpecialProperty:false}; _local4++; }; } else { _local10[_local17[_local3].name] = {valueStart:undefined, valueComplete:_local17[_local3].value, arrayIndex:_local17[_local3].arrayIndex, isSpecialProperty:false}; }; _local3++; }; } else { if (_specialPropertyModifierList[_local5] != undefined){ _local19 = _specialPropertyModifierList[_local5].modifyValues(_local7[_local5]); _local3 = 0; while (_local3 < _local19.length) { _local12[_local19[_local3].name] = {modifierParameters:_local19[_local3].parameters, modifierFunction:_specialPropertyModifierList[_local5].getValue}; _local3++; }; } else { _local10[_local5] = {valueStart:undefined, valueComplete:_local7[_local5]}; }; }; }; }; for (_local5 in _local10) { if (_specialPropertyList[_local5] != undefined){ _local10[_local5].isSpecialProperty = true; } else { if (_local6[0][_local5] == undefined){ printError((((("The property '" + _local5) + "' doesn't seem to be a normal object property of ") + String(_local6[0])) + " or a registered special property.")); }; }; }; for (_local5 in _local12) { if (_local10[_local5] != undefined){ _local10[_local5].modifierParameters = _local12[_local5].modifierParameters; _local10[_local5].modifierFunction = _local12[_local5].modifierFunction; }; }; if (typeof(_local7.transition) == "string"){ _local20 = _local7.transition.toLowerCase(); _local13 = _transitionList[_local20]; } else { _local13 = _local7.transition; }; if (!Boolean(_local13)){ _local13 = _transitionList["easeoutexpo"]; }; _local3 = 0; while (_local3 < _local6.length) { _local14 = new Object(); for (_local5 in _local10) { _local14[_local5] = new PropertyInfoObj(_local10[_local5].valueStart, _local10[_local5].valueComplete, _local10[_local5].valueComplete, _local10[_local5].arrayIndex, {}, _local10[_local5].isSpecialProperty, _local10[_local5].modifierFunction, _local10[_local5].modifierParameters); }; if (_local7.useFrames == true){ _local15 = new TweenListObj(_local6[_local3], (_currentTimeFrame + (_local9 / _timeScale)), (_currentTimeFrame + ((_local9 + _local8) / _timeScale)), true, _local13, _local7.transitionParams); } else { _local15 = new TweenListObj(_local6[_local3], (_currentTime + ((_local9 * 1000) / _timeScale)), (_currentTime + (((_local9 * 1000) + (_local8 * 1000)) / _timeScale)), false, _local13, _local7.transitionParams); }; _local15.properties = _local14; _local15.onStart = _local7.onStart; _local15.onUpdate = _local7.onUpdate; _local15.onComplete = _local7.onComplete; _local15.onOverwrite = _local7.onOverwrite; _local15.onError = _local7.onError; _local15.onStartParams = _local7.onStartParams; _local15.onUpdateParams = _local7.onUpdateParams; _local15.onCompleteParams = _local7.onCompleteParams; _local15.onOverwriteParams = _local7.onOverwriteParams; _local15.onStartScope = _local7.onStartScope; _local15.onUpdateScope = _local7.onUpdateScope; _local15.onCompleteScope = _local7.onCompleteScope; _local15.onOverwriteScope = _local7.onOverwriteScope; _local15.onErrorScope = _local7.onErrorScope; _local15.rounded = _local7.rounded; _local15.skipUpdates = _local7.skipUpdates; removeTweensByTime(_local15.scope, _local15.properties, _local15.timeStart, _local15.timeComplete); _tweenList.push(_local15); if ((((_local8 == 0)) && ((_local9 == 0)))){ _local16 = (_tweenList.length - 1); updateTweenByIndex(_local16); removeTweenByIndex(_local16); }; _local3++; }; return (true); } public static function registerTransition(_arg1:String, _arg2:Function):void{ if (!_inited){ init(); }; _transitionList[_arg1] = _arg2; } public static function printError(_arg1:String):void{ trace(("## [Tweener] Error: " + _arg1)); } private static function affectTweens(_arg1:Function, _arg2:Object, _arg3:Array):Boolean{ var _local5:uint; var _local6:Array; var _local7:uint; var _local8:uint; var _local9:uint; var _local4:Boolean; if (!Boolean(_tweenList)){ return (false); }; _local5 = 0; while (_local5 < _tweenList.length) { if (((_tweenList[_local5]) && ((_tweenList[_local5].scope == _arg2)))){ if (_arg3.length == 0){ _arg1(_local5); _local4 = true; } else { _local6 = new Array(); _local7 = 0; while (_local7 < _arg3.length) { if (Boolean(_tweenList[_local5].properties[_arg3[_local7]])){ _local6.push(_arg3[_local7]); }; _local7++; }; if (_local6.length > 0){ _local8 = AuxFunctions.getObjectLength(_tweenList[_local5].properties); if (_local8 == _local6.length){ _arg1(_local5); _local4 = true; } else { _local9 = splitTweens(_local5, _local6); _arg1(_local9); _local4 = true; }; }; }; }; _local5++; }; return (_local4); } public static function getTweens(_arg1:Object):Array{ var _local2:uint; var _local3:String; if (!Boolean(_tweenList)){ return ([]); }; var _local4:Array = new Array(); _local2 = 0; while (_local2 < _tweenList.length) { if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){ for (_local3 in _tweenList[_local2].properties) { _local4.push(_local3); }; }; _local2++; }; return (_local4); } public static function isTweening(_arg1:Object):Boolean{ var _local2:uint; if (!Boolean(_tweenList)){ return (false); }; _local2 = 0; while (_local2 < _tweenList.length) { if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){ return (true); }; _local2++; }; return (false); } public static function pauseTweenByIndex(_arg1:Number):Boolean{ var _local2:TweenListObj = _tweenList[_arg1]; if ((((_local2 == null)) || (_local2.isPaused))){ return (false); }; _local2.timePaused = getCurrentTweeningTime(_local2); _local2.isPaused = true; return (true); } public static function getCurrentTweeningTime(_arg1:Object):Number{ return ((_arg1.useFrames) ? _currentTimeFrame : _currentTime); } public static function getTweenCount(_arg1:Object):Number{ var _local2:uint; if (!Boolean(_tweenList)){ return (0); }; var _local3:Number = 0; _local2 = 0; while (_local2 < _tweenList.length) { if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){ _local3 = (_local3 + AuxFunctions.getObjectLength(_tweenList[_local2].properties)); }; _local2++; }; return (_local3); } private static function stopEngine():void{ _engineExists = false; _tweenList = null; _currentTime = 0; _currentTimeFrame = 0; __tweener_controller__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame); __tweener_controller__ = null; } public static function removeTweensByTime(_arg1:Object, _arg2:Object, _arg3:Number, _arg4:Number):Boolean{ var removedLocally:Boolean; var i:uint; var pName:String; var eventScope:Object; var p_scope = _arg1; var p_properties = _arg2; var p_timeStart = _arg3; var p_timeComplete = _arg4; var removed:Boolean; var tl:uint = _tweenList.length; i = 0; while (i < tl) { if (((Boolean(_tweenList[i])) && ((p_scope == _tweenList[i].scope)))){ if ((((p_timeComplete > _tweenList[i].timeStart)) && ((p_timeStart < _tweenList[i].timeComplete)))){ removedLocally = false; for (pName in _tweenList[i].properties) { if (Boolean(p_properties[pName])){ if (Boolean(_tweenList[i].onOverwrite)){ eventScope = (Boolean(_tweenList[i].onOverwriteScope)) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope; try { _tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams); } catch(e:Error) { handleError(_tweenList[i], e, "onOverwrite"); }; }; _tweenList[i].properties[pName] = undefined; delete _tweenList[i].properties[pName]; removedLocally = true; removed = true; }; }; if (removedLocally){ if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0){ removeTweenByIndex(i); }; }; }; }; i = (i + 1); }; return (removed); } public static function registerSpecialPropertySplitter(_arg1:String, _arg2:Function, _arg3:Array=null):void{ if (!_inited){ init(); }; var _local4:SpecialPropertySplitter = new SpecialPropertySplitter(_arg2, _arg3); _specialPropertySplitterList[_arg1] = _local4; } public static function removeTweenByIndex(_arg1:Number, _arg2:Boolean=false):Boolean{ _tweenList[_arg1] = null; if (_arg2){ _tweenList.splice(_arg1, 1); }; return (true); } public static function resumeTweens(_arg1:Object, ... _args):Boolean{ var _local4:uint; var _local3:Array = new Array(); _local4 = 0; while (_local4 < _args.length) { if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){ _local3.push(_args[_local4]); }; _local4++; }; return (affectTweens(resumeTweenByIndex, _arg1, _local3)); } public static function pauseTweens(_arg1:Object, ... _args):Boolean{ var _local4:uint; var _local3:Array = new Array(); _local4 = 0; while (_local4 < _args.length) { if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){ _local3.push(_args[_local4]); }; _local4++; }; return (affectTweens(pauseTweenByIndex, _arg1, _local3)); } } }//package caurina.transitions
Section 83
//TweenListObj (caurina.transitions.TweenListObj) package caurina.transitions { public class TweenListObj { public var hasStarted:Boolean; public var onUpdate:Function; public var useFrames:Boolean; public var count:Number; public var onOverwriteParams:Array; public var timeStart:Number; public var timeComplete:Number; public var onStartParams:Array; public var onUpdateScope:Object; public var rounded:Boolean; public var onUpdateParams:Array; public var properties:Object; public var onComplete:Function; public var transitionParams:Object; public var updatesSkipped:Number; public var onStart:Function; public var onOverwriteScope:Object; public var skipUpdates:Number; public var onStartScope:Object; public var scope:Object; public var isCaller:Boolean; public var timePaused:Number; public var transition:Function; public var onCompleteParams:Array; public var onError:Function; public var timesCalled:Number; public var onErrorScope:Object; public var onOverwrite:Function; public var isPaused:Boolean; public var waitFrames:Boolean; public var onCompleteScope:Object; public function TweenListObj(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:Function, _arg6:Object){ scope = _arg1; timeStart = _arg2; timeComplete = _arg3; useFrames = _arg4; transition = _arg5; transitionParams = _arg6; properties = new Object(); isPaused = false; timePaused = undefined; isCaller = false; updatesSkipped = 0; timesCalled = 0; skipUpdates = 0; hasStarted = false; } public function clone(_arg1:Boolean):TweenListObj{ var _local3:String; var _local2:TweenListObj = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams); _local2.properties = new Array(); for (_local3 in properties) { _local2.properties[_local3] = properties[_local3].clone(); }; _local2.skipUpdates = skipUpdates; _local2.updatesSkipped = updatesSkipped; if (!_arg1){ _local2.onStart = onStart; _local2.onUpdate = onUpdate; _local2.onComplete = onComplete; _local2.onOverwrite = onOverwrite; _local2.onError = onError; _local2.onStartParams = onStartParams; _local2.onUpdateParams = onUpdateParams; _local2.onCompleteParams = onCompleteParams; _local2.onOverwriteParams = onOverwriteParams; _local2.onStartScope = onStartScope; _local2.onUpdateScope = onUpdateScope; _local2.onCompleteScope = onCompleteScope; _local2.onOverwriteScope = onOverwriteScope; _local2.onErrorScope = onErrorScope; }; _local2.rounded = rounded; _local2.isPaused = isPaused; _local2.timePaused = timePaused; _local2.isCaller = isCaller; _local2.count = count; _local2.timesCalled = timesCalled; _local2.waitFrames = waitFrames; _local2.hasStarted = hasStarted; return (_local2); } public function toString():String{ var _local3:String; var _local1 = "\n[TweenListObj "; _local1 = (_local1 + ("scope:" + String(scope))); _local1 = (_local1 + ", properties:"); var _local2:Boolean; for (_local3 in properties) { if (!_local2){ _local1 = (_local1 + ","); }; _local1 = (_local1 + ("[name:" + properties[_local3].name)); _local1 = (_local1 + (",valueStart:" + properties[_local3].valueStart)); _local1 = (_local1 + (",valueComplete:" + properties[_local3].valueComplete)); _local1 = (_local1 + "]"); _local2 = false; }; _local1 = (_local1 + (", timeStart:" + String(timeStart))); _local1 = (_local1 + (", timeComplete:" + String(timeComplete))); _local1 = (_local1 + (", useFrames:" + String(useFrames))); _local1 = (_local1 + (", transition:" + String(transition))); _local1 = (_local1 + (", transitionParams:" + String(transitionParams))); if (skipUpdates){ _local1 = (_local1 + (", skipUpdates:" + String(skipUpdates))); }; if (updatesSkipped){ _local1 = (_local1 + (", updatesSkipped:" + String(updatesSkipped))); }; if (Boolean(onStart)){ _local1 = (_local1 + (", onStart:" + String(onStart))); }; if (Boolean(onUpdate)){ _local1 = (_local1 + (", onUpdate:" + String(onUpdate))); }; if (Boolean(onComplete)){ _local1 = (_local1 + (", onComplete:" + String(onComplete))); }; if (Boolean(onOverwrite)){ _local1 = (_local1 + (", onOverwrite:" + String(onOverwrite))); }; if (Boolean(onError)){ _local1 = (_local1 + (", onError:" + String(onError))); }; if (onStartParams){ _local1 = (_local1 + (", onStartParams:" + String(onStartParams))); }; if (onUpdateParams){ _local1 = (_local1 + (", onUpdateParams:" + String(onUpdateParams))); }; if (onCompleteParams){ _local1 = (_local1 + (", onCompleteParams:" + String(onCompleteParams))); }; if (onOverwriteParams){ _local1 = (_local1 + (", onOverwriteParams:" + String(onOverwriteParams))); }; if (onStartScope){ _local1 = (_local1 + (", onStartScope:" + String(onStartScope))); }; if (onUpdateScope){ _local1 = (_local1 + (", onUpdateScope:" + String(onUpdateScope))); }; if (onCompleteScope){ _local1 = (_local1 + (", onCompleteScope:" + String(onCompleteScope))); }; if (onOverwriteScope){ _local1 = (_local1 + (", onOverwriteScope:" + String(onOverwriteScope))); }; if (onErrorScope){ _local1 = (_local1 + (", onErrorScope:" + String(onErrorScope))); }; if (rounded){ _local1 = (_local1 + (", rounded:" + String(rounded))); }; if (isPaused){ _local1 = (_local1 + (", isPaused:" + String(isPaused))); }; if (timePaused){ _local1 = (_local1 + (", timePaused:" + String(timePaused))); }; if (isCaller){ _local1 = (_local1 + (", isCaller:" + String(isCaller))); }; if (count){ _local1 = (_local1 + (", count:" + String(count))); }; if (timesCalled){ _local1 = (_local1 + (", timesCalled:" + String(timesCalled))); }; if (waitFrames){ _local1 = (_local1 + (", waitFrames:" + String(waitFrames))); }; if (hasStarted){ _local1 = (_local1 + (", hasStarted:" + String(hasStarted))); }; _local1 = (_local1 + "]\n"); return (_local1); } public static function makePropertiesChain(_arg1:Object):Object{ var _local3:Object; var _local4:Object; var _local5:Object; var _local6:Number; var _local7:Number; var _local8:Number; var _local2:Object = _arg1.base; if (_local2){ _local3 = {}; if ((_local2 is Array)){ _local4 = []; _local8 = 0; while (_local8 < _local2.length) { _local4.push(_local2[_local8]); _local8++; }; } else { _local4 = [_local2]; }; _local4.push(_arg1); _local6 = _local4.length; _local7 = 0; while (_local7 < _local6) { if (_local4[_local7]["base"]){ _local5 = AuxFunctions.concatObjects(makePropertiesChain(_local4[_local7]["base"]), _local4[_local7]); } else { _local5 = _local4[_local7]; }; _local3 = AuxFunctions.concatObjects(_local3, _local5); _local7++; }; if (_local3["base"]){ delete _local3["base"]; }; return (_local3); //unresolved jump }; return (_arg1); } } }//package caurina.transitions
Section 84
//BaseObject (core.objects.BaseObject) package core.objects { import flash.events.*; import core.*; import flash.display.*; public class BaseObject extends EventDispatcher { protected var engine:CoreEngine; protected var baseDef:BaseObjectDef; public var skin:Sprite; public function BaseObject(_arg1:BaseObjectDef):void{ baseDef = _arg1; init(); } protected function init():void{ engine = CoreEngine.getInstance(); } public function destroy():void{ } } }//package core.objects
Section 85
//BaseObjectDef (core.objects.BaseObjectDef) package core.objects { import flash.geom.*; public class BaseObjectDef { public var x:Number; public var y:Number; public static const TYPE_METAL:String = "TypeMetal"; public static const TYPE_HURT:String = "TypeHurt"; public static const TYPE_BRICK:String = "TypeBrick"; public function BaseObjectDef(_arg1:Number=0, _arg2:Number=0):void{ this.x = _arg1; this.y = _arg2; } public function getBoundingBox():Rectangle{ return (new Rectangle((x - 10), (y - 10), 20, 20)); } public function translate(_arg1:Number, _arg2:Number):void{ x = (x + _arg1); y = (y + _arg2); } public function isPointInside(_arg1:Point):Boolean{ return (false); } public function isRectInside(_arg1:Rectangle):Boolean{ return (false); } public function getStringDef():String{ return (""); } } }//package core.objects
Section 86
//BaseWall (core.objects.BaseWall) package core.objects { import flash.display.*; import flash.geom.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import core.utils.*; public class BaseWall extends BaseObject { protected var roomies:Array; protected var skinRoomies:Sprite; protected var skinInner:Sprite; public var body:b2Body; protected var skinInnerMask:Sprite; protected var skinRoomiesMask:Sprite; private var tempSkin:Sprite; protected var skinRoomiesHolder:Sprite; public function BaseWall():void{ super(new BaseObjectDef(0, 0)); } override public function destroy():void{ super.destroy(); destroyRoomies(); skin.parent.removeChild(skin); engine.world.DestroyBody(body); } protected function destroyRoomies():void{ var _local2:BaseWallRoomer; if (!roomies){ return; }; var _local1:uint; while (_local1 < roomies.length) { _local2 = roomies[_local1]; _local2.destroy(); _local1++; }; } public function addPoly(_arg1:PolyDef):void{ var _local6:int; var _local10:Point; var _local11:Polygon; var _local12:uint; var _local2:b2PolygonDef = new b2PolygonDef(); var _local3:Number = ((_arg1.type == BaseObjectDef.TYPE_METAL)) ? 1 : 0; _local2.density = _local3; _local2.userData = this; _local2.filter.categoryBits = 2; var _local4:Array = []; var _local5:Array = []; _local6 = (_arg1.vertices.length - 1); while (_local6 >= 0) { _local10 = _arg1.vertices[_local6]; _local4.push((_arg1.x + _local10.x)); _local5.push((_arg1.y + _local10.y)); _local6--; }; var _local7:Polygon = new Polygon(_local4, _local5); _local7.mergeParallelEdges(b2Settings.b2_angularSlop); var _local8:Array = Polygon.triangulatePolygon(_local7.x, _local7.y, _local7.x.length); var _local9:Array = Polygon.polygonizeTriangles(_local8); _local6 = 0; while (_local6 < _local9.length) { _local11 = _local9[_local6]; _local2.vertexCount = _local11.nVertices; _local12 = 0; while (_local12 < _local11.x.length) { _local2.vertices[_local12] = new b2Vec2((_local11.x[_local12] / engine.physScale), (_local11.y[_local12] / engine.physScale)); _local12++; }; body.CreateShape(_local2); _local6++; }; if (_local3 > 0){ body.SetMassFromShapes(); }; addPolySkin(_arg1); } override protected function init():void{ super.init(); createPhys(); createSkin(); } public function settleRoomies():void{ var _local7:uint; var _local8:Number; var _local9:Number; roomies = []; var _local1:Number = 40; var _local2:Number = 40; var _local3:int = (640 / _local1); var _local4:int = (480 / _local2); var _local5:int; var _local6:uint; while (_local6 < _local4) { _local7 = 0; while (_local7 < _local3) { _local8 = (((_local1 * _local7) - 10) + Math.floor((Math.random() * 20))); _local9 = (((_local2 * _local6) - 10) + Math.floor((Math.random() * 20))); if (skinInnerMask.hitTestPoint(_local8, _local9, true)){ createRoomie(_local8, _local9); }; _local7++; }; _local6++; }; } protected function createRoomie(_arg1:Number, _arg2:Number):void{ } public function addCircle(_arg1:CircleDef):void{ var _local2:Number; _local2 = ((_arg1.type == BaseObjectDef.TYPE_METAL)) ? 1 : 0; var _local3:b2CircleDef = new b2CircleDef(); _local3.density = _local2; _local3.radius = (_arg1.r / engine.physScale); _local3.userData = this; _local3.filter.categoryBits = 2; _local3.localPosition = new b2Vec2((_arg1.x / engine.physScale), (_arg1.y / engine.physScale)); body.CreateShape(_local3); if (_local2 > 0){ body.SetMassFromShapes(); }; addCircleSkin(_arg1); } protected function createSkin():void{ } protected function addPolySkin(_arg1:PolyDef):void{ var _local2:Sprite = _arg1.getSkin(); _local2.x = _arg1.x; _local2.y = _arg1.y; skinInnerMask.addChild(_local2); skin.visible = true; } protected function createPhys():void{ var _local1:b2BodyDef = new b2BodyDef(); _local1.position.Set(0, 0); body = engine.world.CreateBody(_local1); } protected function addCircleSkin(_arg1:CircleDef):void{ var _local2:Sprite = new Sprite(); _local2.graphics.beginFill(0, 1); _local2.graphics.drawCircle(_arg1.x, _arg1.y, _arg1.r); _local2.graphics.endFill(); skinInnerMask.addChild(_local2); skin.visible = true; } } }//package core.objects
Section 87
//BaseWallRoomer (core.objects.BaseWallRoomer) package core.objects { import core.*; import flash.display.*; public class BaseWallRoomer extends BaseObject { protected var vx:Number; protected var vy:Number; protected var skinParent:Sprite; protected var skinInner:MovieClip; protected var limit:Number;// = 0.2 public function BaseWallRoomer(_arg1:BaseObjectDef, _arg2:Sprite):void{ this.skinParent = _arg2; super(_arg1); } protected function createSkin():void{ var _local1:Class = engine.assets.getAssetClass(getSkinName()); skin = new (_local1); skinInner = (skin.getChildByName("inner") as MovieClip); var _local2:int = (1 + Math.floor((Math.random() * skinInner.totalFrames))); skinInner.gotoAndStop(_local2); skin.x = baseDef.x; skin.y = baseDef.y; skin.width = (10 + Math.floor((Math.random() * 5))); skin.height = (10 + Math.floor((Math.random() * 5))); skin.rotation = Math.floor((Math.random() * 360)); skinParent.addChild(skin); } protected function updateHandler(_arg1:CoreEvent):void{ vx = (vx + (-0.05 + (Math.random() * 0.1))); vy = (vy + (-0.05 + (Math.random() * 0.1))); vx = (vx + ((baseDef.x - skin.x) * 0.002)); vy = (vy + ((baseDef.y - skin.y) * 0.002)); if (vx > limit){ vx = limit; }; if (vx < -(limit)){ vx = -(limit); }; if (vy > limit){ vy = limit; }; if (vy < -(limit)){ vy = -(limit); }; skin.x = (skin.x + vx); skin.y = (skin.y + vy); } override protected function init():void{ super.init(); createSkin(); vx = (-0.02 + (Math.random() * 0.04)); vy = (-0.02 + (Math.random() * 0.04)); engine.addEventListener(CoreEvent.UPDATE, updateHandler); } override public function destroy():void{ super.destroy(); skin.parent.removeChild(skin); engine.removeEventListener(CoreEvent.UPDATE, updateHandler); } protected function getSkinName():String{ return ("RLY?"); } } }//package core.objects
Section 88
//Bubble (core.objects.Bubble) package core.objects { import core.*; import flash.display.*; import caurina.transitions.*; public class Bubble extends BaseObject { private var speed:Number; private var tweenTime:Number; private var skinInner:MovieClip; public function Bubble(_arg1:BaseObjectDef):void{ super(_arg1); } protected function createSkin():void{ var _local1:Class = engine.assets.getAssetClass("BubbleAsset"); skin = new (_local1); skinInner = (skin.getChildByName("inner") as MovieClip); engine.canvas.top.addChild(skin); skin.x = baseDef.x; skin.y = baseDef.y; var _local2:int = (1 + Math.floor((Math.random() * skinInner.totalFrames))); skinInner.gotoAndStop(_local2); } protected function updateHandler(_arg1:CoreEvent):void{ var _local2:int; skin.y = (skin.y - speed); if (skin.y < -(skin.height)){ _local2 = (1 + Math.floor((Math.random() * skinInner.totalFrames))); skinInner.gotoAndStop(_local2); skin.x = (20 + Math.floor((Math.random() * 600))); skin.y = (480 + 25); speed = (0.5 + (Math.random() * 1)); tweenTime = (2 - speed); }; } private function tweenScaleX():void{ Tweener.addTween(skin, {scaleX:0.7, scaleY:1, time:tweenTime, transition:"linear"}); Tweener.addTween(skin, {scaleX:1, scaleY:0.7, time:tweenTime, delay:tweenTime, transition:"linear", onComplete:tweenScaleX}); } override public function destroy():void{ super.destroy(); engine.removeEventListener(CoreEvent.UPDATE, updateHandler); } override protected function init():void{ super.init(); speed = (0.5 + (Math.random() * 1)); createSkin(); tweenTime = (2 - speed); skin.scaleY = 0.7; tweenScaleX(); engine.addEventListener(CoreEvent.UPDATE, updateHandler); } } }//package core.objects
Section 89
//Circle (core.objects.Circle) package core.objects { import core.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; public class Circle extends BaseObject { public var body:b2Body; private var circleDef:CircleDef; public function Circle(_arg1:CircleDef):void{ circleDef = _arg1; super(_arg1); } override protected function init():void{ super.init(); createPhys(); createSkin(); if (circleDef.type == BaseObjectDef.TYPE_METAL){ engine.addEventListener(CoreEvent.UPDATE, updateHandler); }; } protected function updateHandler(_arg1:CoreEvent):void{ updateSkin(); } protected function updateSkin():void{ var _local2:Number; var _local1:b2Vec2 = body.GetPosition(); _local2 = body.GetAngle(); skin.x = (_local1.x * engine.physScale); skin.y = (_local1.y * engine.physScale); skin.rotation = ((_local2 * 180) / Math.PI); } protected function createSkin():void{ skin = circleDef.getSkin(); engine.canvas.objects.addChild(skin); updateSkin(); } override public function destroy():void{ super.destroy(); skin.parent.removeChild(skin); engine.world.DestroyBody(body); engine.removeEventListener(CoreEvent.UPDATE, updateHandler); } protected function createPhys():void{ var _local2:b2CircleDef; var _local1:Number = ((circleDef.type == BaseObjectDef.TYPE_METAL)) ? 1 : 0; _local2 = new b2CircleDef(); _local2.density = _local1; _local2.radius = (circleDef.r / engine.physScale); _local2.userData = this; _local2.filter.categoryBits = 2; var _local3:b2BodyDef = new b2BodyDef(); _local3.position.Set((circleDef.x / engine.physScale), (circleDef.y / engine.physScale)); body = engine.world.CreateBody(_local3); body.CreateShape(_local2); if (circleDef.type == BaseObjectDef.TYPE_METAL){ body.SetMassFromShapes(); }; } } }//package core.objects
Section 90
//CircleDef (core.objects.CircleDef) package core.objects { import core.*; import flash.display.*; import flash.geom.*; public class CircleDef extends BaseObjectDef { public var r:Number; public var type:String; public static const NAME:String = "Circle"; public function CircleDef(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:String):void{ this.r = _arg3; this.type = _arg4; super(_arg1, _arg2); } override public function getBoundingBox():Rectangle{ return (new Rectangle((x - r), (y - r), (r * 2), (r * 2))); } public function getSkin():Sprite{ var _local1:Class; if (type == BaseObjectDef.TYPE_BRICK){ _local1 = CoreAssets.getInstance().getAssetClass("BrickMaterial"); } else { _local1 = CoreAssets.getInstance().getAssetClass("MetallMaterial"); }; var _local2:BitmapData = (new _local1(0, 0) as BitmapData); var _local3:Sprite = new Sprite(); _local3.graphics.beginBitmapFill(_local2, null, true, true); _local3.graphics.lineStyle(0, 0, 1); _local3.graphics.drawCircle(0, 0, r); _local3.graphics.endFill(); return (_local3); } override public function isPointInside(_arg1:Point):Boolean{ var _local2:Number = Math.sqrt((((_arg1.x - x) * (_arg1.x - x)) + ((_arg1.y - y) * (_arg1.y - y)))); return (((_local2 < r)) ? true : false); } override public function isRectInside(_arg1:Rectangle):Boolean{ return ((((((((x > _arg1.x)) && ((x < (_arg1.x + _arg1.width))))) && ((y > _arg1.y)))) && ((y < (_arg1.y + _arg1.height))))); } override public function getStringDef():String{ var _local1 = (NAME + "_"); _local1 = (_local1 + (Math.round(x) + "_")); _local1 = (_local1 + (Math.round(y) + "_")); _local1 = (_local1 + (Math.round(r) + "_")); _local1 = (_local1 + type); return (_local1); } public static function parseStringDef(_arg1:String):CircleDef{ var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:Number = _local2[3]; var _local6:String = _local2[4]; var _local7:CircleDef = new CircleDef(_local3, _local4, _local5, _local6); return (_local7); } } }//package core.objects
Section 91
//DistJoint (core.objects.DistJoint) package core.objects { import core.*; import flash.display.*; import flash.geom.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; public class DistJoint extends BaseObject { private var skinAnchor2:Sprite; private var circle1:b2Body; private var circle2:b2Body; private var joint:b2DistanceJoint; private var jointDef:DistJointDef; private var skinAnchor1:Sprite; public function DistJoint(_arg1:DistJointDef):void{ jointDef = _arg1; super(_arg1); } private function updateSkin():void{ var _local1:b2Vec2 = joint.GetAnchor1().Copy(); _local1.Multiply(engine.physScale); var _local2:b2Vec2 = joint.GetAnchor2().Copy(); _local2.Multiply(engine.physScale); skin.graphics.clear(); skin.graphics.lineStyle(0, 15988918); skin.graphics.moveTo(_local1.x, _local1.y); skin.graphics.lineTo(_local2.x, _local2.y); } private function updateHandler(_arg1:CoreEvent):void{ updateSkin(); } private function createJoint():void{ var _local3:b2Body; var _local4:b2Body; var _local1:BaseObject = engine.getObjUnderPoint(new Point(jointDef.x1, jointDef.y1)); var _local2:BaseObject = engine.getObjUnderPoint(new Point(jointDef.x2, jointDef.y2)); if (_local1){ if ((_local1 is Circle)){ _local3 = (_local1 as Circle).body; } else { if ((_local1 is Poly)){ _local3 = (_local1 as Poly).body; } else { if ((_local1 is BaseWall)){ _local3 = (_local1 as BaseWall).body; } else { return; }; }; }; }; if (_local2){ if ((_local2 is Circle)){ _local4 = (_local2 as Circle).body; } else { if ((_local2 is Poly)){ _local4 = (_local2 as Poly).body; } else { if ((_local2 is BaseWall)){ _local4 = (_local2 as BaseWall).body; } else { return; }; }; }; }; var _local5:b2BodyDef = new b2BodyDef(); var _local6:b2CircleDef = new b2CircleDef(); _local6.radius = (2 / engine.physScale); _local6.density = 1; _local6.filter.maskBits = (0xFFFF & ~(2)); if (!_local3){ _local5.position.Set((jointDef.x1 / engine.physScale), (jointDef.y1 / engine.physScale)); _local3 = engine.world.CreateBody(_local5); _local3.CreateShape(_local6); _local3.SetMassFromShapes(); circle1 = _local3; }; if (!_local4){ _local5.position.Set((jointDef.x2 / engine.physScale), (jointDef.y2 / engine.physScale)); _local4 = engine.world.CreateBody(_local5); _local4.CreateShape(_local6); _local4.SetMassFromShapes(); circle2 = _local4; }; var _local7:b2DistanceJointDef = new b2DistanceJointDef(); var _local8:b2Vec2 = new b2Vec2((jointDef.x1 / engine.physScale), (jointDef.y1 / engine.physScale)); var _local9:b2Vec2 = new b2Vec2((jointDef.x2 / engine.physScale), (jointDef.y2 / engine.physScale)); _local7.Initialize(_local3, _local4, _local8, _local9); _local7.collideConnected = true; _local7.userData = this; joint = (engine.world.CreateJoint(_local7) as b2DistanceJoint); } override protected function init():void{ super.init(); createJoint(); createSkin(); engine.addEventListener(CoreEvent.UPDATE, updateHandler); } private function createSkin():void{ skin = jointDef.getSkin(); skinAnchor1 = (skin.getChildAt(0) as Sprite); skinAnchor2 = (skin.getChildAt(1) as Sprite); skinAnchor1.visible = false; skinAnchor2.visible = false; engine.canvas.objects.addChild(skin); updateSkin(); } override public function destroy():void{ super.destroy(); skin.parent.removeChild(skin); engine.world.DestroyJoint(joint); if (circle1){ engine.world.DestroyBody(circle1); }; if (circle2){ engine.world.DestroyBody(circle2); }; engine.removeEventListener(CoreEvent.UPDATE, updateHandler); } } }//package core.objects
Section 92
//DistJointDef (core.objects.DistJointDef) package core.objects { import core.*; import flash.display.*; import flash.geom.*; public class DistJointDef extends BaseObjectDef { public var x1:Number; public var y1:Number; public var y2:Number; public var x2:Number; public static const NAME:String = "DistJointDef"; public function DistJointDef(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{ this.x1 = _arg3; this.y1 = _arg4; this.x2 = _arg5; this.y2 = _arg6; super(_arg1, _arg2); } override public function isPointInside(_arg1:Point):Boolean{ var _local2:Number = Math.sqrt((((_arg1.x - x) * (_arg1.x - x)) + ((_arg1.y - y) * (_arg1.y - y)))); return (((_local2 < 5)) ? true : false); } override public function isRectInside(_arg1:Rectangle):Boolean{ return ((((((((x > _arg1.x)) && ((x < (_arg1.x + _arg1.width))))) && ((y > _arg1.y)))) && ((y < (_arg1.y + _arg1.height))))); } public function getSkin():Sprite{ var _local1:Sprite = new Sprite(); var _local2:Class = CoreAssets.getInstance().getAssetClass("DistJointAnchorAsset"); var _local3:Sprite = new (_local2); var _local4:Sprite = new (_local2); _local1.addChild(_local3); _local1.addChild(_local4); return (_local1); } override public function translate(_arg1:Number, _arg2:Number):void{ x = (x + _arg1); y = (y + _arg2); x1 = (x1 + _arg1); y1 = (y1 + _arg2); x2 = (x2 + _arg1); y2 = (y2 + _arg2); } override public function getStringDef():String{ var _local1 = (NAME + "_"); _local1 = (_local1 + (Math.round(x) + "_")); _local1 = (_local1 + (Math.round(y) + "_")); _local1 = (_local1 + (Math.round(x1) + "_")); _local1 = (_local1 + (Math.round(y1) + "_")); _local1 = (_local1 + (Math.round(x2) + "_")); _local1 = (_local1 + Math.round(y2)); return (_local1); } public static function parseStringDef(_arg1:String):DistJointDef{ var _local2:Array = _arg1.split("_"); var _local3:uint = _local2[1]; var _local4:uint = _local2[2]; var _local5:Number = _local2[3]; var _local6:Number = _local2[4]; var _local7:Number = _local2[5]; var _local8:Number = _local2[6]; var _local9:DistJointDef = new DistJointDef(_local3, _local4, _local5, _local6, _local7, _local8); return (_local9); } } }//package core.objects
Section 93
//Exit (core.objects.Exit) package core.objects { import core.*; import flash.filters.*; import flash.display.*; import Box2D.Common.Math.*; import caurina.transitions.*; public class Exit extends BaseObject { private var myFilter:GlowFilter; protected var def:ExitDef; private var skinParticles:Sprite; private var roomies:Array; public function Exit(_arg1:ExitDef):void{ this.def = _arg1; super(_arg1); } protected function updateHandler(_arg1:CoreEvent):void{ var _local3:Particle; var _local4:b2Vec2; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local2:uint; while (_local2 < engine.particles.length) { _local3 = engine.particles[_local2]; _local4 = _local3.body.GetPosition(); _local5 = (_local4.x * engine.physScale); _local6 = (_local4.y * engine.physScale); _local7 = (def.x - _local5); _local8 = (def.y - _local6); _local9 = ((_local7 * _local7) + (_local8 * _local8)); if (_local9 < (def.r * def.r)){ collectParticle(_local3); }; _local2++; }; } private function destroyRoomies():void{ var _local2:ExitRoomer; var _local1:uint; while (_local1 < roomies.length) { _local2 = roomies[_local1]; _local2.destroy(); _local1++; }; } protected function updateSkin():void{ skin.x = def.x; skin.y = def.y; } private function startTween():void{ Tweener.addTween(myFilter, {blurX:40, blurY:40, time:2, transition:"linear", onUpdate:tweenUpdate}); Tweener.addTween(myFilter, {blurX:5, blurY:5, time:2, delay:2, transition:"linear", onUpdate:tweenUpdate, onComplete:startTween}); } protected function createPhys():void{ } override protected function init():void{ super.init(); createPhys(); createSkin(); roomies = []; engine.addEventListener(CoreEvent.UPDATE, updateHandler); } private function tweenUpdate():void{ skin.filters = [myFilter]; } protected function createSkin():void{ skin = def.getSkin(); engine.canvas.bottom.addChild(skin); myFilter = new GlowFilter(65483, 0.7, 5, 5, 2.5, 2, false, false); skin.filters = [myFilter]; startTween(); skinParticles = (skin.getChildByName("particles") as Sprite); var _local1:GlowFilter = new GlowFilter(687640, 0.5, 6, 6, 2, 1, true); var _local2:GlowFilter = new GlowFilter(3650969, 1, 6, 6, 3, 2); skinParticles.filters = [_local1, _local2]; updateSkin(); } override public function destroy():void{ super.destroy(); destroyRoomies(); engine.removeEventListener(CoreEvent.UPDATE, updateHandler); } private function collectParticle(_arg1:Particle):void{ var _local2:ExitRoomer = new ExitRoomer(skinParticles, _arg1); roomies.push(_local2); var _local3:SoundsManager = SoundsManager.getInstance(); _local3.playSound(_local3.particleCollect); engine.collectParticle(_arg1); } } }//package core.objects
Section 94
//ExitDef (core.objects.ExitDef) package core.objects { import core.*; import flash.display.*; public class ExitDef extends CircleDef { public static const NAME:String = "ExitDef"; public function ExitDef(_arg1:Number, _arg2:Number):void{ super(_arg1, _arg2, 40, BaseObjectDef.TYPE_BRICK); } override public function getSkin():Sprite{ var _local1:Class = CoreEngine.getInstance().assets.getAssetClass("ExitAsset"); var _local2:Sprite = new (_local1); return (_local2); } override public function getStringDef():String{ var _local1 = (NAME + "_"); _local1 = (_local1 + (Math.round(x) + "_")); _local1 = (_local1 + Math.round(y)); return (_local1); } public static function parseStringDef(_arg1:String):ExitDef{ var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:ExitDef = new ExitDef(_local3, _local4); return (_local5); } } }//package core.objects
Section 95
//ExitRoomer (core.objects.ExitRoomer) package core.objects { import core.*; import flash.display.*; import flash.geom.*; import Box2D.Common.Math.*; public class ExitRoomer extends BaseObject { protected var vx:Number; protected var vy:Number; protected var particle:Particle; protected var skinParent:Sprite; protected var limit:Number;// = 0.2 public function ExitRoomer(_arg1:Sprite, _arg2:Particle):void{ this.skinParent = _arg1; this.particle = _arg2; super(new BaseObjectDef(0, 0)); } protected function updateHandler(_arg1:CoreEvent):void{ vx = (vx + (-0.05 + (Math.random() * 0.1))); vy = (vy + (-0.05 + (Math.random() * 0.1))); vx = (vx + ((baseDef.x - skin.x) * 0.002)); vy = (vy + ((baseDef.y - skin.y) * 0.002)); if (vx > limit){ vx = limit; }; if (vx < -(limit)){ vx = -(limit); }; if (vy > limit){ vy = limit; }; if (vy < -(limit)){ vy = -(limit); }; skin.x = (skin.x + vx); skin.y = (skin.y + vy); } override protected function init():void{ super.init(); baseDef.x = (-25 + Math.floor((Math.random() * 50))); baseDef.y = (-25 + Math.floor((Math.random() * 50))); vx = (-0.02 + (Math.random() * 0.04)); vy = (-0.02 + (Math.random() * 0.04)); createSkin(); engine.addEventListener(CoreEvent.UPDATE, updateHandler); } protected function createSkin():void{ var _local1:Class = engine.assets.getAssetClass("Particle2Asset"); skin = new (_local1); skin.width = (skin.height = (particle.def.r * 2)); var _local2:b2Vec2 = particle.body.GetPosition(); var _local3:Point = skinParent.globalToLocal(new Point((_local2.x * engine.physScale), (_local2.y * engine.physScale))); skin.x = _local3.x; skin.y = _local3.y; skinParent.addChild(skin); } override public function destroy():void{ super.destroy(); engine.removeEventListener(CoreEvent.UPDATE, updateHandler); } } }//package core.objects
Section 96
//HurtWall (core.objects.HurtWall) package core.objects { import core.*; import flash.display.*; import Box2D.Common.Math.*; public class HurtWall extends BaseWall { private var souls:Array; private var particles:Array; protected function updateHandler(_arg1:CoreEvent):void{ var _local2:SoundsManager; var _local3:uint; var _local4:Particle; if (particles.length > 0){ _local2 = SoundsManager.getInstance(); _local2.playSound(_local2.particleDead); _local3 = 0; while (_local3 < particles.length) { _local4 = particles[_local3]; blowParticle(_local4); engine.destroyParticle(_local4); _local3++; }; }; particles = []; } override protected function createRoomie(_arg1:Number, _arg2:Number):void{ var _local3:HurtWallRoomer = new HurtWallRoomer(new BaseObjectDef(_arg1, _arg2), skinRoomies); roomies.push(_local3); } private function destroySouls():void{ var _local2:ParticleSoul; var _local1:uint; while (_local1 < souls.length) { _local2 = souls[_local1]; _local2.destroy(); _local1++; }; } private function destroyParticle(_arg1:CoreEvent):void{ particles = []; engine.removeEventListener(CoreEvent.UPDATE, destroyParticle); } private function blowParticleComplete(_arg1:Sprite):void{ _arg1.parent.removeChild(_arg1); } override protected function addPolySkin(_arg1:PolyDef):void{ var _local2:Sprite; super.addPolySkin(_arg1); _local2 = _arg1.getSkin(); _local2.x = _arg1.x; _local2.y = _arg1.y; skinRoomiesMask.addChild(_local2); } override protected function addCircleSkin(_arg1:CircleDef):void{ super.addCircleSkin(_arg1); var _local2:Sprite = new Sprite(); _local2.graphics.beginFill(0, 1); _local2.graphics.drawCircle(_arg1.x, _arg1.y, _arg1.r); _local2.graphics.endFill(); skinRoomiesMask.addChild(_local2); } override protected function init():void{ super.init(); particles = []; souls = []; engine.addEventListener(CoreEvent.UPDATE, updateHandler); } public function collideWithParticle(_arg1:Particle):void{ if (particles.indexOf(_arg1) == -1){ particles.push(_arg1); }; } override public function destroy():void{ super.destroy(); destroySouls(); engine.removeEventListener(CoreEvent.UPDATE, updateHandler); } public function destroySoul(_arg1:ParticleSoul):void{ souls.splice(souls.indexOf(_arg1), 1); _arg1.destroy(); } private function blowParticle(_arg1:Particle):void{ var _local2:b2Vec2 = _arg1.body.GetPosition(); var _local3:Number = (_local2.x * engine.physScale); var _local4:Number = (_local2.y * engine.physScale); var _local5:b2Vec2 = _arg1.body.m_linearVelocity.Copy(); _local5.Normalize(); var _local6:ParticleSoul = new ParticleSoul(new BaseObjectDef(_local3, _local4), this, _local5); souls.push(_local6); } override protected function createSkin():void{ var _local1:Class = engine.assets.getAssetClass("HurtWallAsset"); skin = new (_local1); skinInner = (skin.getChildByName("inner") as Sprite); skinInnerMask = (skinInner.getChildByName("_mask") as Sprite); skinRoomiesHolder = (skin.getChildByName("roomiesHolder") as Sprite); skinRoomiesMask = (skinRoomiesHolder.getChildByName("_mask") as Sprite); skinRoomies = (skinRoomiesHolder.getChildByName("roomies") as Sprite); engine.canvas.objects.addChild(skin); skin.visible = false; } } }//package core.objects
Section 97
//HurtWallRoomer (core.objects.HurtWallRoomer) package core.objects { import flash.display.*; public class HurtWallRoomer extends BaseWallRoomer { public function HurtWallRoomer(_arg1:BaseObjectDef, _arg2:Sprite):void{ super(_arg1, _arg2); } override protected function getSkinName():String{ return ("HurtWallRoomerAsset"); } } }//package core.objects
Section 98
//Magnet (core.objects.Magnet) package core.objects { import core.*; import flash.display.*; import Box2D.Common.Math.*; public class Magnet extends BaseObject { protected var def:MagnetDef; protected var skinInner:Sprite; public function Magnet(_arg1:MagnetDef):void{ this.def = _arg1; super(_arg1); } override protected function init():void{ super.init(); createPhys(); createSkin(); engine.addEventListener(CoreEvent.UPDATE, updateHandler); } protected function updateHandler(_arg1:CoreEvent):void{ var _local3:Particle; var _local4:b2Vec2; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; skin.graphics.clear(); var _local2:uint; while (_local2 < engine.particles.length) { _local3 = engine.particles[_local2]; _local4 = _local3.body.GetPosition(); _local5 = (_local4.x * engine.physScale); _local6 = (_local4.y * engine.physScale); _local7 = (def.x - _local5); _local8 = (def.y - _local6); _local9 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8))); if (_local9 < 100){ _local10 = Math.atan2(_local8, _local7); _local11 = (((_local9 - 100) * Math.cos(_local10)) * 0.02); _local12 = (((_local9 - 100) * Math.sin(_local10)) * 0.02); _local3.body.ApplyForce(new b2Vec2(_local11, _local12), _local3.body.GetWorldCenter()); skin.graphics.lineStyle(2, 14412326, ((100 - _local9) / 100)); skin.graphics.moveTo(def.x, def.y); skin.graphics.lineTo(_local5, _local6); }; _local2++; }; } protected function updateSkin():void{ skinInner.x = def.x; skinInner.y = def.y; } protected function createSkin():void{ var _local1:Class = engine.assets.getAssetClass("MagnetAsset"); skin = new Sprite(); skinInner = new (_local1); skin.addChild(skinInner); engine.canvas.tools.addChild(skin); updateSkin(); } override public function destroy():void{ engine.removeEventListener(CoreEvent.UPDATE, updateHandler); } protected function createPhys():void{ } } }//package core.objects
Section 99
//MagnetDef (core.objects.MagnetDef) package core.objects { import flash.geom.*; public class MagnetDef extends BaseObjectDef { private var r:Number;// = 20 public static const NAME:String = "MagnetDef"; public function MagnetDef(_arg1:Number, _arg2:Number):void{ super(_arg1, _arg2); } override public function getBoundingBox():Rectangle{ return (new Rectangle((x - r), (y - r), (r * 2), (r * 2))); } override public function isPointInside(_arg1:Point):Boolean{ var _local2:Number = Math.sqrt((((_arg1.x - x) * (_arg1.x - x)) + ((_arg1.y - y) * (_arg1.y - y)))); return (((_local2 < r)) ? true : false); } override public function isRectInside(_arg1:Rectangle):Boolean{ return ((((((((x > _arg1.x)) && ((x < (_arg1.x + _arg1.width))))) && ((y > _arg1.y)))) && ((y < (_arg1.y + _arg1.height))))); } override public function getStringDef():String{ var _local1 = (NAME + "_"); _local1 = (_local1 + (Math.round(x) + "_")); _local1 = (_local1 + Math.round(y)); return (_local1); } public static function parseStringDef(_arg1:String):MagnetDef{ var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:MagnetDef = new MagnetDef(_local3, _local4); return (_local5); } } }//package core.objects
Section 100
//MoveWall (core.objects.MoveWall) package core.objects { import core.*; import flash.filters.*; import flash.display.*; import flash.geom.*; import Box2D.Common.Math.*; public class MoveWall extends BaseWall { public function MoveWall():void{ } override protected function init():void{ super.init(); engine.addEventListener(CoreEvent.UPDATE, updateHandler); } protected function updateHandler(_arg1:CoreEvent):void{ updateSkin(); } override public function destroy():void{ super.destroy(); engine.removeEventListener(CoreEvent.UPDATE, updateHandler); } public function drawCircle(_arg1:CircleDef):void{ var _local2:Class; _local2 = engine.assets.getAssetClass("MetallMaterial"); var _local3:BitmapData = (new _local2(0, 0) as BitmapData); skinInner.graphics.beginBitmapFill(_local3, null, true, true); skinInner.graphics.drawCircle(_arg1.x, _arg1.y, _arg1.r); skinInner.graphics.endFill(); } protected function updateSkin():void{ var _local1:b2Vec2; var _local2:Number; _local1 = body.GetWorldCenter(); _local2 = body.GetAngle(); skin.x = (_local1.x * engine.physScale); skin.y = (_local1.y * engine.physScale); skin.rotation = ((_local2 * 180) / Math.PI); } public function drawPoly(_arg1:PolyDef):void{ var _local2:Class; var _local7:Point; _local2 = engine.assets.getAssetClass("MetallMaterial"); var _local3:BitmapData = (new _local2(0, 0) as BitmapData); var _local4:Matrix = new Matrix(); _local4.rotate(((_arg1.skinRotation * Math.PI) / 180)); skinInner.graphics.beginBitmapFill(_local3, _local4, true, true); var _local5:Point = _arg1.vertices[0]; skinInner.graphics.moveTo((_local5.x + _arg1.x), (_local5.y + _arg1.y)); var _local6:uint = 1; while (_local6 < _arg1.vertices.length) { _local7 = _arg1.vertices[_local6]; skinInner.graphics.lineTo((_local7.x + _arg1.x), (_local7.y + _arg1.y)); _local6++; }; skinInner.graphics.lineTo((_local5.x + _arg1.x), (_local5.y + _arg1.y)); skinInner.graphics.endFill(); } override protected function createSkin():void{ skin = new Sprite(); skinInner = new Sprite(); skin.addChild(skinInner); var _local1:GlowFilter = new GlowFilter(0, 0.6, 12, 12, 0.8, 2, true); var _local2:GlowFilter = new GlowFilter(2940607, 0.75, 12, 12, 3, 2); var _local3:GlowFilter = new GlowFilter(2464645, 0.75, 15, 15, 4, 2, true); skin.filters = [_local3, _local2]; engine.canvas.objects.addChild(skin); } override protected function addPolySkin(_arg1:PolyDef):void{ drawPoly(_arg1); } override protected function addCircleSkin(_arg1:CircleDef):void{ drawCircle(_arg1); } public function finishCreate():void{ var _local1:b2Vec2; _local1 = body.GetWorldCenter(); skinInner.x = -(Math.round((_local1.x * engine.physScale))); skinInner.y = -(Math.round((_local1.y * engine.physScale))); } } }//package core.objects
Section 101
//Particle (core.objects.Particle) package core.objects { import flash.display.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; public class Particle extends Circle { public var def:ParticleDef; public var skinInner:MovieClip; public function Particle(_arg1:ParticleDef):void{ this.def = _arg1; super(_arg1); } override protected function createSkin():void{ skin = def.getSkin(); engine.canvas.particles.addChild(skin); skinInner = (skin.getChildByName("inner") as MovieClip); skinInner.stop(); updateSkin(); } override public function destroy():void{ var _local4:b2Joint; var _local5:BaseObject; var _local1:Array = []; var _local2:b2JointEdge = body.m_jointList; while (_local2) { _local4 = _local2.joint; _local5 = (_local4.m_userData as BaseObject); if (_local1.indexOf(_local5) == -1){ _local1.push(_local5); }; _local2 = _local2.next; }; var _local3:uint; while (_local3 < _local1.length) { engine.destroyObj(_local1[_local3]); _local3++; }; super.destroy(); } override protected function updateSkin():void{ var _local1:b2Vec2 = body.GetPosition(); skin.x = (_local1.x * engine.physScale); skin.y = (_local1.y * engine.physScale); } override protected function createPhys():void{ super.createPhys(); body.m_shapeList.m_userData = this; } } }//package core.objects
Section 102
//ParticleDef (core.objects.ParticleDef) package core.objects { import core.*; import flash.display.*; public class ParticleDef extends CircleDef { public static const NAME:String = "ParticleDef"; public function ParticleDef(_arg1:Number, _arg2:Number):void{ var _local3:Number = (6 + Math.floor((Math.random() * 2))); super(_arg1, _arg2, _local3, BaseObjectDef.TYPE_METAL); } override public function getSkin():Sprite{ var _local1:Class = CoreEngine.getInstance().assets.getAssetClass("ParticleAsset"); var _local2:Sprite = new (_local1); _local2.width = (_local2.height = (r * 4)); return (_local2); } override public function getStringDef():String{ var _local1 = (NAME + "_"); _local1 = (_local1 + (Math.round(x) + "_")); _local1 = (_local1 + Math.round(y)); return (_local1); } public static function parseStringDef(_arg1:String):ParticleDef{ var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:ParticleDef = new ParticleDef(_local3, _local4); return (_local5); } } }//package core.objects
Section 103
//ParticleSoul (core.objects.ParticleSoul) package core.objects { import core.*; import flash.display.*; import Box2D.Common.Math.*; public class ParticleSoul extends BaseObject { private var skinInner:MovieClip; private var vx:Number; private var vy:Number; private var lifeTime:int; private var dir:b2Vec2; private var dangle:Number; private var totalLifeTime:int; private var hurtWall:HurtWall; public function ParticleSoul(_arg1:BaseObjectDef, _arg2:HurtWall, _arg3:b2Vec2):void{ this.hurtWall = _arg2; this.dir = _arg3; super(_arg1); } override public function destroy():void{ super.destroy(); skin.parent.removeChild(skin); engine.removeEventListener(CoreEvent.UPDATE, updateHandler); } protected function createSkin():void{ var _local1:Class = engine.assets.getAssetClass("ParticleSoulAsset"); skin = new (_local1); skinInner = (skin.getChildByName("inner") as MovieClip); var _local2:int = (1 + Math.floor((Math.random() * skinInner.totalFrames))); skinInner.gotoAndStop(_local2); skin.x = baseDef.x; skin.y = baseDef.y; skin.scaleX = (0.3 + (Math.random() * 0.3)); skin.scaleY = (0.3 + (Math.random() * 0.3)); skin.rotation = Math.floor((Math.random() * 360)); engine.canvas.objects.addChild(skin); } protected function updateHandler(_arg1:CoreEvent):void{ var _local2:int; lifeTime++; if (lifeTime == totalLifeTime){ hurtWall.destroySoul(this); } else { vx = (vx + (-0.1 + (Math.random() * 0.2))); vy = (vy + (-0.1 + (Math.random() * 0.2))); skin.x = (skin.x + vx); skin.y = (skin.y + vy); skin.rotation = (skin.rotation + dangle); _local2 = (totalLifeTime - 20); if (lifeTime > _local2){ skin.alpha = (1 - ((lifeTime - _local2) / 20)); }; }; } override protected function init():void{ super.init(); lifeTime = 0; totalLifeTime = (40 * 2); createSkin(); vx = (-3 + (Math.random() * 6)); vy = (-3 + (Math.random() * 6)); dangle = (-20 + (Math.random() * 40)); engine.addEventListener(CoreEvent.UPDATE, updateHandler); } } }//package core.objects
Section 104
//Poly (core.objects.Poly) package core.objects { import core.*; import flash.geom.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import core.utils.*; public class Poly extends BaseObject { private var polyDef:PolyDef; public var body:b2Body; private var particles:Array; public function Poly(_arg1:PolyDef):void{ polyDef = _arg1; super(_arg1); } private function updateHandler(_arg1:CoreEvent):void{ updateSkin(); var _local2:uint; while (_local2 < particles.length) { engine.destroyParticle(particles[_local2]); _local2++; }; particles = []; } private function updateSkin():void{ var _local1:b2Vec2 = body.GetPosition(); var _local2:Number = body.GetAngle(); skin.x = (_local1.x * engine.physScale); skin.y = (_local1.y * engine.physScale); skin.rotation = ((_local2 * 180) / Math.PI); } private function destroyParticle(_arg1:CoreEvent):void{ particles = []; engine.removeEventListener(CoreEvent.UPDATE, destroyParticle); } override public function destroy():void{ super.destroy(); engine.world.DestroyBody(body); skin.parent.removeChild(skin); engine.removeEventListener(CoreEvent.UPDATE, updateHandler); } public function collideWithParticle(_arg1:Particle):void{ if (polyDef.type == BaseObjectDef.TYPE_HURT){ if (particles.indexOf(_arg1) == -1){ particles.push(_arg1); }; }; } protected function createPhys():void{ var _local6:int; var _local10:Point; var _local11:Polygon; var _local12:uint; var _local1:b2BodyDef = new b2BodyDef(); _local1.position.Set((polyDef.x / engine.physScale), (polyDef.y / engine.physScale)); _local1.userData = this; body = engine.world.CreateBody(_local1); var _local2:b2PolygonDef = new b2PolygonDef(); var _local3:Number = ((polyDef.type == BaseObjectDef.TYPE_METAL)) ? 1 : 0; _local2.density = _local3; _local2.userData = this; _local2.filter.categoryBits = 2; var _local4:Array = []; var _local5:Array = []; _local6 = (polyDef.vertices.length - 1); while (_local6 >= 0) { _local10 = polyDef.vertices[_local6]; _local4.push((polyDef.x + _local10.x)); _local5.push((polyDef.y + _local10.y)); _local6--; }; var _local7:Polygon = new Polygon(_local4, _local5); _local7.mergeParallelEdges(b2Settings.b2_angularSlop); var _local8:Array = Polygon.triangulatePolygon(_local7.x, _local7.y, _local7.x.length); var _local9:Array = Polygon.polygonizeTriangles(_local8); _local6 = 0; while (_local6 < _local9.length) { _local11 = _local9[_local6]; _local2.vertexCount = _local11.nVertices; _local12 = 0; while (_local12 < _local11.x.length) { _local2.vertices[_local12] = new b2Vec2(((_local11.x[_local12] - polyDef.x) / engine.physScale), ((_local11.y[_local12] - polyDef.y) / engine.physScale)); _local12++; }; body.CreateShape(_local2); _local6++; }; if (_local3 > 0){ body.SetMassFromShapes(); }; } override protected function init():void{ super.init(); createPhys(); createSkin(); particles = []; engine.addEventListener(CoreEvent.UPDATE, updateHandler); } private function createSkin():void{ skin = polyDef.getSkin(); engine.canvas.objects.addChild(skin); updateSkin(); } } }//package core.objects
Section 105
//PolyDef (core.objects.PolyDef) package core.objects { import core.*; import flash.display.*; import flash.geom.*; import geom.*; import core.utils.*; public class PolyDef extends BaseObjectDef { public var vertices:Array; public var startPos:Point; public var type:String; public var skinRotation:Number; public static const NAME:String = "PolyDef"; public function PolyDef(_arg1:Number, _arg2:Number, _arg3:Array, _arg4:String, _arg5:Number=0, _arg6:Point=null):void{ this.vertices = _arg3; this.type = _arg4; this.skinRotation = _arg5; this.type = _arg4; this.startPos = (_arg6) ? _arg6 : new Point(_arg1, _arg2); super(_arg1, _arg2); } override public function isPointInside(_arg1:Point):Boolean{ return (getGeomPoly().isPointInside(_arg1)); } private function getGeomPoly():GeomPoly{ var _local3:Vector; var _local1:Array = []; var _local2:uint; while (_local2 < vertices.length) { _local3 = new Vector((x + vertices[_local2].x), (y + vertices[_local2].y)); _local1.push(_local3); _local2++; }; return (new GeomPoly(_local1)); } override public function isRectInside(_arg1:Rectangle):Boolean{ if (!(((((((x > _arg1.x)) && ((x < (_arg1.x + _arg1.width))))) && ((y > _arg1.y)))) && ((y < (_arg1.y + _arg1.height))))){ return (getGeomPoly().isRectInside(_arg1)); }; return (true); } public function getSkin():Sprite{ var _local1:Class; var _local7:Point; if (type == BaseObjectDef.TYPE_BRICK){ _local1 = CoreAssets.getInstance().getAssetClass("BrickMaterial"); } else { if (type == BaseObjectDef.TYPE_METAL){ _local1 = CoreAssets.getInstance().getAssetClass("MetallMaterial"); } else { if (type == BaseObjectDef.TYPE_HURT){ _local1 = CoreAssets.getInstance().getAssetClass("HurtMaterial"); }; }; }; var _local2:BitmapData = (new _local1(0, 0) as BitmapData); var _local3:Sprite = new Sprite(); var _local4:Matrix = new Matrix(); _local4.rotate(((skinRotation * Math.PI) / 180)); _local3.graphics.beginBitmapFill(_local2, _local4, true, true); _local3.graphics.lineStyle(0, 0, 1); var _local5:Point = vertices[0]; _local3.graphics.moveTo(_local5.x, _local5.y); var _local6:uint = 1; while (_local6 < vertices.length) { _local7 = vertices[_local6]; _local3.graphics.lineTo(_local7.x, _local7.y); _local6++; }; _local3.graphics.lineTo(_local5.x, _local5.y); _local3.graphics.endFill(); return (_local3); } override public function translate(_arg1:Number, _arg2:Number):void{ super.translate(_arg1, _arg2); startPos.x = (startPos.x + _arg1); startPos.y = (startPos.y + _arg2); } override public function getBoundingBox():Rectangle{ var _local6:Point; var _local1:Number = 1000; var _local2:Number = 1000; var _local3:Number = -1000; var _local4:Number = -1000; var _local5:uint; while (_local5 < vertices.length) { _local6 = vertices[_local5]; if (_local6.x < _local1){ _local1 = _local6.x; }; if (_local6.x > _local3){ _local3 = _local6.x; }; if (_local6.y < _local2){ _local2 = _local6.y; }; if (_local6.y > _local4){ _local4 = _local6.y; }; _local5++; }; return (new Rectangle((x + _local1), (y + _local2), (_local3 - _local1), (_local4 - _local2))); } public function isSimple():Boolean{ var _local5:Point; var _local1:Array = []; var _local2:Array = []; var _local3:uint; while (_local3 < vertices.length) { _local5 = vertices[_local3]; _local1.push(_local5.x); _local2.push(_local5.y); _local3++; }; var _local4:Polygon = new Polygon(_local1, _local2); return (_local4.isSimple()); } override public function getStringDef():String{ var _local1 = (NAME + "_"); _local1 = (_local1 + (Math.round(x) + "_")); _local1 = (_local1 + (Math.round(y) + "_")); _local1 = (_local1 + (type + "_")); var _local2:uint; while (_local2 < vertices.length) { _local1 = (_local1 + ((vertices[_local2].x + "|") + vertices[_local2].y)); if (_local2 < (vertices.length - 1)){ _local1 = (_local1 + "_"); }; _local2++; }; return (_local1); } public static function parseStringDef(_arg1:String):PolyDef{ var _local9:Array; var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:String = _local2[3]; var _local6:Array = []; var _local7:uint = 4; while (_local7 < _local2.length) { _local9 = _local2[_local7].split("|"); _local6.push(new Point(_local9[0], _local9[1])); _local7++; }; var _local8:PolyDef = new PolyDef(_local3, _local4, _local6, _local5); return (_local8); } } }//package core.objects
Section 106
//Rect (core.objects.Rect) package core.objects { public class Rect extends Poly { private var rectDef:RectDef; public function Rect(_arg1:RectDef):void{ rectDef = _arg1; super(_arg1); } } }//package core.objects
Section 107
//RectDef (core.objects.RectDef) package core.objects { import flash.geom.*; import Box2D.Common.Math.*; public class RectDef extends PolyDef { public var width:Number; public var height:Number; public var rotation:Number; public static const NAME:String = "RectDef"; public function RectDef(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Number=0):void{ setDimensions(_arg3, _arg4); setRotation(_arg6); super(_arg1, _arg2, vertices, _arg5); } public function setRotation(_arg1:Number):void{ this.rotation = _arg1; updateVertices(); } private function updateVertices():void{ var _local6:b2Vec2; var _local1:Number = Math.sin(((rotation * Math.PI) / 180)); var _local2:Number = Math.cos(((rotation * Math.PI) / 180)); var _local3:Array = [new b2Vec2(0, 0), new b2Vec2(width, 0), new b2Vec2(width, height), new b2Vec2(0, height)]; var _local4:b2Mat22 = new b2Mat22(((rotation * Math.PI) / 180)); var _local5:uint; while (_local5 < _local3.length) { _local6 = _local3[_local5]; _local6 = b2Math.b2MulMV(_local4, _local6); vertices[_local5] = new Point(_local6.x, _local6.y); _local5++; }; } override public function getStringDef():String{ var _local1 = (NAME + "_"); _local1 = (_local1 + (Math.round(x) + "_")); _local1 = (_local1 + (Math.round(y) + "_")); _local1 = (_local1 + (Math.round(width) + "_")); _local1 = (_local1 + (Math.round(height) + "_")); _local1 = (_local1 + (type + "_")); _local1 = (_local1 + Math.round(rotation)); return (_local1); } public function setDimensions(_arg1:Number, _arg2:Number):void{ this.width = _arg1; this.height = _arg2; vertices = []; updateVertices(); } public static function parseStringDef(_arg1:String):RectDef{ var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:Number = _local2[3]; var _local6:Number = _local2[4]; var _local7:String = _local2[5]; var _local8:Number = _local2[6]; var _local9:RectDef = new RectDef(_local3, _local4, _local5, _local6, _local7, _local8); return (_local9); } } }//package core.objects
Section 108
//RevJoint (core.objects.RevJoint) package core.objects { import core.*; import flash.display.*; import flash.geom.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; public class RevJoint extends BaseObject { private var thisBody:b2Body; private var skinInner:MovieClip; private var joint:b2RevoluteJoint; private var jointDef:RevJointDef; public function RevJoint(_arg1:RevJointDef):void{ jointDef = _arg1; super(_arg1); } private function updateHandler(_arg1:CoreEvent):void{ var _local2:Number = joint.m_body1.GetAngle(); skin.rotation = ((_local2 * 180) / Math.PI); } private function createJoint():void{ var _local2:b2Body; var _local3:b2CircleDef; var _local4:b2BodyDef; var _local5:b2RevoluteJointDef; var _local6:b2Vec2; var _local1:BaseObject = engine.getObjUnderPoint(new Point(jointDef.x, jointDef.y)); if (_local1){ if ((_local1 is Circle)){ _local2 = (_local1 as Circle).body; } else { if ((_local1 is Poly)){ _local2 = (_local1 as Poly).body; } else { if ((_local1 is MoveWall)){ _local2 = (_local1 as MoveWall).body; } else { return; }; }; }; _local3 = new b2CircleDef(); _local3.radius = (2 / engine.physScale); _local3.density = 0; _local4 = new b2BodyDef(); _local4.position.Set(jointDef.x, jointDef.y); thisBody = engine.world.CreateBody(_local4); thisBody.CreateShape(_local3); _local5 = new b2RevoluteJointDef(); _local6 = new b2Vec2((jointDef.x / engine.physScale), (jointDef.y / engine.physScale)); _local5.Initialize(_local2, thisBody, _local6); _local5.userData = this; if (jointDef.torque != 0){ _local5.enableMotor = true; _local5.motorSpeed = (-(jointDef.torque) * 2); _local5.maxMotorTorque = 1000; }; joint = (engine.world.CreateJoint(_local5) as b2RevoluteJoint); }; } override protected function init():void{ super.init(); createJoint(); createSkin(); if (joint){ engine.addEventListener(CoreEvent.UPDATE, updateHandler); }; } private function createSkin():void{ skin = jointDef.getSkin(); skin.x = jointDef.x; skin.y = jointDef.y; if (!joint){ skin.alpha = 0.3; }; engine.canvas.objects.addChild(skin); } override public function destroy():void{ super.destroy(); if (joint){ engine.world.DestroyJoint(joint); engine.world.DestroyBody(thisBody); }; engine.removeEventListener(CoreEvent.UPDATE, updateHandler); } } }//package core.objects
Section 109
//RevJointDef (core.objects.RevJointDef) package core.objects { import core.*; import flash.display.*; import flash.geom.*; public class RevJointDef extends BaseObjectDef { public var torque:Number; public static const NAME:String = "RevJoint"; public function RevJointDef(_arg1:Number, _arg2:Number, _arg3:Number=0):void{ this.torque = _arg3; if (isNaN(this.torque)){ this.torque = 0; }; super(_arg1, _arg2); } override public function isRectInside(_arg1:Rectangle):Boolean{ return ((((((((x > _arg1.x)) && ((x < (_arg1.x + _arg1.width))))) && ((y > _arg1.y)))) && ((y < (_arg1.y + _arg1.height))))); } override public function isPointInside(_arg1:Point):Boolean{ var _local2:Number = Math.sqrt((((_arg1.x - x) * (_arg1.x - x)) + ((_arg1.y - y) * (_arg1.y - y)))); return (((_local2 < 5)) ? true : false); } public function getSkin():Sprite{ var _local1:Class = CoreAssets.getInstance().getAssetClass("RevJointAsset"); var _local2:Sprite = new (_local1); var _local3:MovieClip = (_local2.getChildByName("inner") as MovieClip); if (torque == 0){ _local3.gotoAndStop(1); } else { _local3.gotoAndStop(2); }; return (_local2); } override public function getStringDef():String{ var _local1 = (NAME + "_"); _local1 = (_local1 + (Math.round(x) + "_")); _local1 = (_local1 + (Math.round(y) + "_")); _local1 = (_local1 + torque); return (_local1); } public static function parseStringDef(_arg1:String):RevJointDef{ var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:Number = _local2[3]; var _local6:RevJointDef = new RevJointDef(_local3, _local4, _local5); return (_local6); } } }//package core.objects
Section 110
//StaticWall (core.objects.StaticWall) package core.objects { import flash.display.*; public class StaticWall extends BaseWall { public function StaticWall():void{ } override protected function init():void{ super.init(); } override protected function createSkin():void{ var _local1:Class = engine.assets.getAssetClass("StaticWallAsset"); skin = new (_local1); skinInner = (skin.getChildByName("inner") as Sprite); skinInnerMask = (skinInner.getChildByName("_mask") as Sprite); skinRoomiesHolder = (skin.getChildByName("roomiesHolder") as Sprite); skinRoomiesMask = (skinRoomiesHolder.getChildByName("_mask") as Sprite); skinRoomies = (skinRoomiesHolder.getChildByName("roomies") as Sprite); engine.canvas.objects.addChild(skin); skin.visible = false; } override protected function addPolySkin(_arg1:PolyDef):void{ var _local2:Sprite; super.addPolySkin(_arg1); _local2 = _arg1.getSkin(); _local2.x = _arg1.x; _local2.y = _arg1.y; skinRoomiesMask.addChild(_local2); } override protected function createRoomie(_arg1:Number, _arg2:Number):void{ var _local3:StaticWallRoomer = new StaticWallRoomer(new BaseObjectDef(_arg1, _arg2), skinRoomies); roomies.push(_local3); } override protected function addCircleSkin(_arg1:CircleDef):void{ super.addCircleSkin(_arg1); var _local2:Sprite = new Sprite(); _local2.graphics.beginFill(0, 1); _local2.graphics.drawCircle(_arg1.x, _arg1.y, _arg1.r); _local2.graphics.endFill(); skinRoomiesMask.addChild(_local2); } } }//package core.objects
Section 111
//StaticWallRoomer (core.objects.StaticWallRoomer) package core.objects { import flash.display.*; public class StaticWallRoomer extends BaseWallRoomer { public function StaticWallRoomer(_arg1:BaseObjectDef, _arg2:Sprite):void{ super(_arg1, _arg2); } override protected function getSkinName():String{ return ("StaticWallRoomerAsset"); } } }//package core.objects
Section 112
//AttractorTool (core.tools.AttractorTool) package core.tools { import flash.events.*; import core.*; import flash.filters.*; import flash.display.*; import core.objects.*; import Box2D.Common.Math.*; public class AttractorTool { protected var isActive:Boolean; protected var engine:CoreEngine; protected var skin:Sprite; public function AttractorTool():void{ init(); } protected function updateHandler(_arg1:CoreEvent):void{ var _local5:Particle; var _local6:b2Vec2; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:b2Vec2; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; if (!isActive){ return; }; skin.graphics.clear(); var _local2:Number = engine.canvas.level.mouseX; var _local3:Number = engine.canvas.level.mouseY; var _local4:uint; while (_local4 < engine.particles.length) { _local5 = engine.particles[_local4]; _local6 = _local5.body.GetPosition(); _local7 = (_local6.x * engine.physScale); _local8 = (_local6.y * engine.physScale); _local9 = (_local2 - _local7); _local10 = (_local3 - _local8); _local11 = Math.sqrt(((_local9 * _local9) + (_local10 * _local10))); if (_local11 < 200){ _local12 = _local5.body.GetLinearVelocity(); _local13 = (-50 + (Math.random() * 100)); _local14 = (-50 + (Math.random() * 100)); _local15 = (_local5.body.m_mass * 3); _local16 = ((((_local9 + _local13) * 0.01) - (_local12.x * 0.2)) * _local15); _local17 = ((((_local10 + _local14) * 0.01) - (_local12.y * 0.2)) * _local15); _local5.body.ApplyForce(new b2Vec2(_local16, _local17), _local5.body.GetWorldCenter()); _local5.skinInner.gotoAndStop(2); skin.graphics.lineStyle(0, 15988918, ((200 - _local11) / 200)); skin.graphics.moveTo(_local2, _local3); skin.graphics.lineTo(_local7, _local8); } else { _local5.skinInner.gotoAndStop(1); }; _local4++; }; } protected function createSkin():void{ skin = new Sprite(); var _local1:GlowFilter = new GlowFilter(16777026, 0.37, 5, 5, 5, 2); skin.filters = [_local1]; engine.canvas.tools.addChild(skin); } protected function mouseDownHandler(_arg1:MouseEvent):void{ var _local2:uint; var _local3:Particle; if (isActive){ skin.graphics.clear(); _local2 = 0; while (_local2 < engine.particles.length) { _local3 = engine.particles[_local2]; _local3.skinInner.gotoAndStop(1); _local2++; }; }; isActive = !(isActive); engine.dispatchEvent(new CoreEvent(CoreEvent.ATTRACTOR_CHANGED, isActive)); } public function destroy():void{ skin.parent.removeChild(skin); engine.removeEventListener(CoreEvent.UPDATE, updateHandler); engine.canvas.level.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } protected function init():void{ engine = CoreEngine.getInstance(); createSkin(); isActive = false; engine.addEventListener(CoreEvent.UPDATE, updateHandler); engine.canvas.level.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } } }//package core.tools
Section 113
//Polygon (core.utils.Polygon) package core.utils { import Box2D.Common.Math.*; import Box2D.Common.*; public class Polygon { public var nVertices:int; public var x:Array; public var y:Array; public function Polygon(_arg1, _arg2=null):void{ if (!_arg2){ _arg2 = _arg1.y; _arg1 = _arg1.x; }; nVertices = _arg1.length; x = []; y = []; var _local3:uint; while (_local3 < nVertices) { x[_local3] = _arg1[_local3]; y[_local3] = _arg2[_local3]; _local3++; }; } public function isConvex():Boolean{ 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:Boolean; var _local1:Boolean; var _local2:uint; while (_local2 < nVertices) { _local3 = ((_local2 == 0)) ? (nVertices - 1) : (_local2 - 1); _local4 = _local2; _local5 = ((_local2 == (nVertices - 1))) ? 0 : (_local2 + 1); _local6 = (x[_local4] - x[_local3]); _local7 = (y[_local4] - y[_local3]); _local8 = (x[_local5] - x[_local4]); _local9 = (y[_local5] - y[_local4]); _local10 = ((_local6 * _local9) - (_local8 * _local7)); _local11 = ((_local10 > 0)) ? true : false; if (_local2 == 0){ _local1 = _local11; } else { if (_local1 != _local11){ return (false); }; }; _local2++; }; return (true); } public function mergeParallelEdges(_arg1:Number):void{ var _local4:uint; var _local8:int; var _local9:int; var _local10:int; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; if (nVertices <= 3){ return; }; var _local2:Array = []; var _local3:Number = nVertices; _local4 = 0; while (_local4 < nVertices) { _local8 = ((_local4 == 0)) ? (nVertices - 1) : (_local4 - 1); _local9 = _local4; _local10 = ((_local4 == (nVertices - 1))) ? 0 : (_local4 + 1); _local11 = (x[_local9] - x[_local8]); _local12 = (y[_local9] - y[_local8]); _local13 = (x[_local10] - x[_local9]); _local14 = (y[_local10] - y[_local9]); _local15 = Math.sqrt(((_local11 * _local11) + (_local12 * _local12))); _local16 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14))); if (((!((((_local15 > 0)) && ((_local16 > 0))))) && ((_local3 > 3)))){ _local2[_local4] = true; _local3--; }; _local11 = (_local11 / _local15); _local12 = (_local12 / _local15); _local13 = (_local13 / _local16); _local14 = (_local14 / _local16); _local17 = ((_local11 * _local14) - (_local13 * _local12)); _local18 = ((_local11 * _local13) + (_local12 * _local14)); if ((((((Math.abs(_local17) < _arg1)) && ((_local18 > 0)))) && ((_local3 > 3)))){ _local2[_local4] = true; _local3--; } else { _local2[_local4] = false; }; _local4++; }; if ((((_local3 == nVertices)) || ((_local3 == 0)))){ return; }; var _local5:Array = []; var _local6:Array = []; var _local7:int; _local4 = 0; while (_local4 < nVertices) { if (((((_local2[_local4]) || ((_local3 == 0)))) || ((_local7 == _local3)))){ } else { b2Settings.b2Assert((_local7 < _local3)); _local5[_local7] = x[_local4]; _local6[_local7] = y[_local4]; _local7++; }; _local4++; }; x = _local5; y = _local6; nVertices = _local3; } public function add(_arg1:Triangle):Polygon{ var _local6:uint; var _local2 = -1; var _local3 = -1; var _local4 = -1; var _local5 = -1; _local6 = 0; while (_local6 < nVertices) { if ((((_arg1.x[0] == x[_local6])) && ((_arg1.y[0] == y[_local6])))){ if (_local2 == -1){ _local2 = _local6; _local3 = 0; } else { _local4 = _local6; _local5 = 0; }; } else { if ((((_arg1.x[1] == x[_local6])) && ((_arg1.y[1] == y[_local6])))){ if (_local2 == -1){ _local2 = _local6; _local3 = 1; } else { _local4 = _local6; _local5 = 1; }; } else { if ((((_arg1.x[2] == x[_local6])) && ((_arg1.y[2] == y[_local6])))){ if (_local2 == -1){ _local2 = _local6; _local3 = 2; } else { _local4 = _local6; _local5 = 2; }; }; }; }; _local6++; }; if ((((_local2 == 0)) && ((_local4 == (nVertices - 1))))){ _local2 = (nVertices - 1); _local4 = 0; }; if (_local4 == -1){ return (null); }; var _local7:int; if ((((_local7 == _local3)) || ((_local7 == _local5)))){ _local7 = 1; }; if ((((_local7 == _local3)) || ((_local7 == _local5)))){ _local7 = 2; }; var _local8:Array = []; var _local9:Array = []; var _local10:int; _local6 = 0; while (_local6 < nVertices) { _local8[_local10] = x[_local6]; _local9[_local10] = y[_local6]; if (_local6 == _local2){ _local10++; _local8[_local10] = _arg1.x[_local7]; _local9[_local10] = _arg1.y[_local7]; }; _local10++; _local6++; }; return (new Polygon(_local8, _local9)); } public function isSimple():Boolean{ var _local2:int; var _local3:b2Vec2; var _local4:b2Vec2; var _local5:uint; var _local6:int; var _local7:b2Vec2; var _local8:b2Vec2; var _local1:uint; while (_local1 < nVertices) { _local2 = (((_local1 + 1))>(nVertices - 1)) ? 0 : (_local1 + 1); _local3 = new b2Vec2(x[_local1], y[_local1]); _local4 = new b2Vec2(x[_local2], y[_local2]); _local5 = (_local1 + 1); while (_local5 < nVertices) { _local6 = (((_local5 + 1))>(nVertices - 1)) ? 0 : (_local5 + 1); _local7 = new b2Vec2(x[_local5], y[_local5]); _local8 = new b2Vec2(x[_local6], y[_local6]); if (intersect(_local3, _local4, _local7, _local8)){ return (false); }; _local5++; }; _local1++; }; return (true); } public static function polygonizeTriangles(_arg1:Array):Array{ var _local2:Array; var _local4:uint; var _local6:Array; var _local7:Boolean; var _local8:int; var _local9:Polygon; var _local10:Polygon; var _local3:int; if (_arg1 == null){ return (null); }; _local2 = []; _local6 = []; _local4 = 0; while (_local4 < _arg1.length) { _local6[_local4] = false; _local4++; }; _local7 = true; while (_local7) { _local8 = -1; _local4 = 0; while (_local4 < _arg1.length) { if (_local6[_local4]){ } else { _local8 = _local4; break; }; _local4++; }; if (_local8 == -1){ _local7 = false; } else { _local9 = new Polygon(_arg1[_local8]); _local6[_local8] = true; _local4 = 0; while (_local4 < _arg1.length) { if (_local6[_local4]){ } else { _local10 = _local9.add(_arg1[_local4]); if (_local10 == null){ } else { if (_local10.isConvex()){ _local9 = _local10; _local6[_local4] = true; }; }; }; _local4++; }; _local2[_local3] = _local9; _local3++; }; }; var _local5:Array = []; _local4 = 0; while (_local4 < _local3) { _local5[_local4] = _local2[_local4]; _local4++; }; return (_local5); } private static function remainder(_arg1:Number, _arg2:Number):int{ var _local3:Number = (_arg1 % _arg2); while (_local3 < 0) { _local3 = (_local3 + _arg2); }; return (_local3); } public static function pseudoPolygonize(_arg1:Array):Array{ var _local4:Triangle; var _local2:Array = []; var _local3:uint; while (_local3 < _arg1.length) { _local4 = _arg1[_local3]; _local2.push(new Polygon(_local4.x, _local4.y)); _local3++; }; return (_local2); } private static function isEar(_arg1:int, _arg2:Array, _arg3:Array):Boolean{ var _local4:Number = 0; var _local5:Number = 0; var _local6:Number = 0; var _local7:Number = 0; if ((((((_arg1 >= _arg2.length)) || ((_arg1 < 0)))) || ((_arg2.length < 3)))){ return (false); }; var _local8:int = (_arg1 + 1); var _local9:int = (_arg1 - 1); if (_arg1 == 0){ _local4 = (_arg2[0] - _arg2[(_arg2.length - 1)]); _local5 = (_arg3[0] - _arg3[(_arg3.length - 1)]); _local6 = (_arg2[1] - _arg2[0]); _local7 = (_arg3[1] - _arg3[0]); _local9 = (_arg2.length - 1); } else { if (_arg1 == (_arg2.length - 1)){ _local4 = (_arg2[_arg1] - _arg2[(_arg1 - 1)]); _local5 = (_arg3[_arg1] - _arg3[(_arg1 - 1)]); _local6 = (_arg2[0] - _arg2[_arg1]); _local7 = (_arg3[0] - _arg3[_arg1]); } else { _local4 = (_arg2[_arg1] - _arg2[(_arg1 - 1)]); _local5 = (_arg3[_arg1] - _arg3[(_arg1 - 1)]); _local6 = (_arg2[(_arg1 + 1)] - _arg2[_arg1]); _local7 = (_arg3[(_arg1 + 1)] - _arg3[_arg1]); }; }; var _local10:Number = ((_local4 * _local7) - (_local6 * _local5)); if (_local10 > 0){ return (false); }; var _local11:Triangle = new Triangle(_arg2[_arg1], _arg3[_arg1], _arg2[_local8], _arg3[_local8], _arg2[_local9], _arg3[_local9]); var _local12:uint; while (_local12 < _arg2.length) { if (!(((((_local12 == _arg1)) || ((_local12 == _local9)))) || ((_local12 == _local8)))){ if (_local11.isInside2(_arg2[_local12], _arg3[_local12])){ return (false); }; }; _local12++; }; return (true); } public static function triangulatePolygon(_arg1:Array, _arg2:Array, _arg3:int):Array{ var _local8:uint; var _local9:Triangle; var _local11:int; var _local12:Number; var _local13:Array; var _local14:Array; var _local15:int; var _local16:int; var _local17:int; var _local18:Triangle; if (_arg3 < 3){ return (null); }; var _local4:Array = []; var _local5:uint; var _local6:Array = []; var _local7:Array = []; _local8 = 0; while (_local8 < _arg3) { _local6[_local8] = _arg1[_local8]; _local7[_local8] = _arg2[_local8]; _local8++; }; while (_arg3 > 3) { _local11 = -1; _local12 = -10; _local8 = 0; while (_local8 < _arg3) { if (isEar(_local8, _local6, _local7)){ _local11 = _local8; break; }; _local8++; }; if (_local11 == -1){ trace("NO EAR FOUND"); return (null); }; _arg3--; _local13 = []; _local14 = []; _local15 = 0; _local8 = 0; while (_local8 < _arg3) { if (_local15 == _local11){ _local15++; }; _local13[_local8] = _local6[_local15]; _local14[_local8] = _local7[_local15]; _local15++; _local8++; }; _local16 = ((_local11 == 0)) ? (_local6.length - 1) : (_local11 - 1); _local17 = ((_local11 == (_local6.length - 1))) ? 0 : (_local11 + 1); _local9 = new Triangle(_local6[_local11], _local7[_local11], _local6[_local17], _local7[_local17], _local6[_local16], _local7[_local16]); _local4[_local5] = _local9; _local5++; _local6 = _local13; _local7 = _local14; }; _local9 = new Triangle(_local6[1], _local7[1], _local6[2], _local7[2], _local6[0], _local7[0]); _local4[_local5] = _local9; _local5++; var _local10:Array = []; _local8 = 0; while (_local8 < _local5) { _local18 = _local4[_local8]; if (_local18.getMinAngle() > 0.1){ _local10.push(_local4[_local8]); }; _local8++; }; return (_local10); } public static function intersect(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2, _arg4:b2Vec2):b2Vec2{ if ((((((((_arg1 == _arg3)) || ((_arg1 == _arg4)))) || ((_arg2 == _arg3)))) || ((_arg2 == _arg4)))){ return (null); }; var _local5:Number = _arg1.x; var _local6:Number = _arg1.y; var _local7:Number = _arg2.x; var _local8:Number = _arg2.y; var _local9:Number = _arg3.x; var _local10:Number = _arg3.y; var _local11:Number = _arg4.x; var _local12:Number = _arg4.y; if ((((Math.max(_local5, _local7) < Math.min(_local9, _local11))) || ((Math.max(_local9, _local11) < Math.min(_local5, _local7))))){ return (null); }; if ((((Math.max(_local6, _local8) < Math.min(_local10, _local12))) || ((Math.max(_local10, _local12) < Math.min(_local6, _local8))))){ return (null); }; var _local13:Number = (((_local11 - _local9) * (_local6 - _local10)) - ((_local12 - _local10) * (_local5 - _local9))); var _local14:Number = (((_local7 - _local5) * (_local6 - _local10)) - ((_local8 - _local6) * (_local5 - _local9))); var _local15:Number = (((_local12 - _local10) * (_local7 - _local5)) - ((_local11 - _local9) * (_local8 - _local6))); if (Math.abs(_local15) < 1E-6){ return (null); }; _local13 = (_local13 / _local15); _local14 = (_local14 / _local15); if ((((((((0 < _local13)) && ((_local13 < 1)))) && ((0 < _local14)))) && ((_local14 < 1)))){ return (new b2Vec2((_local5 + (_local13 * (_local7 - _local5))), (_local6 + (_local13 * (_local8 - _local6))))); }; return (null); } } }//package core.utils
Section 114
//Triangle (core.utils.Triangle) package core.utils { import flash.geom.*; import Box2D.Common.Math.*; public class Triangle { public var x:Array; public var y:Array; public function Triangle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{ x = []; y = []; var _local7:Number = (_arg3 - _arg1); var _local8:Number = (_arg5 - _arg1); var _local9:Number = (_arg4 - _arg2); var _local10:Number = (_arg6 - _arg2); var _local11:Number = ((_local7 * _local10) - (_local8 * _local9)); var _local12 = (_local11 > 0); if (_local12){ x[0] = _arg1; x[1] = _arg3; x[2] = _arg5; y[0] = _arg2; y[1] = _arg4; y[2] = _arg6; } else { x[0] = _arg1; x[1] = _arg5; x[2] = _arg3; y[0] = _arg2; y[1] = _arg6; y[2] = _arg4; }; } public function isInside(_arg1:Number, _arg2:Number):Boolean{ if ((((((_arg1 < x[0])) && ((_arg1 < x[1])))) && ((_arg1 < x[2])))){ return (false); }; if ((((((_arg1 > x[0])) && ((_arg1 > x[1])))) && ((_arg1 > x[2])))){ return (false); }; if ((((((_arg2 < y[0])) && ((_arg2 < y[1])))) && ((_arg2 < y[2])))){ return (false); }; if ((((((_arg2 > y[0])) && ((_arg2 > y[1])))) && ((_arg2 > y[2])))){ return (false); }; var _local3:Number = (_arg1 - x[0]); var _local4:Number = (_arg2 - y[0]); var _local5:Number = (x[1] - x[0]); var _local6:Number = (y[1] - y[0]); var _local7:Number = (x[2] - x[0]); var _local8:Number = (y[2] - y[0]); var _local9:Number = ((_local7 * _local7) + (_local8 * _local8)); var _local10:Number = ((_local7 * _local5) + (_local8 * _local6)); var _local11:Number = ((_local7 * _local3) + (_local8 * _local4)); var _local12:Number = ((_local5 * _local5) + (_local6 * _local6)); var _local13:Number = ((_local5 * _local3) + (_local6 * _local4)); var _local14:Number = (1 / ((_local9 * _local12) - (_local10 * _local10))); var _local15:Number = (((_local12 * _local11) - (_local10 * _local13)) * _local14); var _local16:Number = (((_local9 * _local13) - (_local10 * _local11)) * _local14); return ((((((_local15 > 0)) && ((_local16 > 0)))) && (((_local15 + _local16) < 1)))); } public function getMinAngle():Number{ var _local1:b2Vec2 = new b2Vec2((x[1] - x[0]), (y[1] - y[0])); var _local2:b2Vec2 = new b2Vec2((x[0] - x[2]), (y[0] - y[2])); var _local3:b2Vec2 = new b2Vec2((x[2] - x[1]), (y[2] - y[1])); _local1.Normalize(); _local2.Normalize(); _local3.Normalize(); var _local4:Number = Math.abs(b2Math.b2CrossVV(_local1, _local2)); var _local5:Number = Math.abs(b2Math.b2CrossVV(_local2, _local3)); var _local6:Number = Math.abs(b2Math.b2CrossVV(_local3, _local1)); var _local7:Number = Math.min(_local4, _local5, _local6); return (((Math.asin(_local7) * 180) / Math.PI)); } private function getArea(_arg1:Point, _arg2:Point, _arg3:Point):Number{ return ((0.5 * ((((((_arg1.x * _arg2.y) + (_arg1.y * _arg3.x)) + (_arg3.y * _arg2.x)) - (_arg3.x * _arg2.y)) - (_arg3.y * _arg1.x)) - (_arg2.x * _arg1.y)))); } public function isInside2(_arg1:Number, _arg2:Number):Boolean{ var _local3:Point = new Point(_arg1, _arg2); var _local4:Point = new Point(x[0], y[0]); var _local5:Point = new Point(x[1], y[1]); var _local6:Point = new Point(x[2], y[2]); var _local7:Number = getArea(_local4, _local5, _local6); var _local8:Number = ((Math.abs(getArea(_local3, _local4, _local5)) + Math.abs(getArea(_local3, _local4, _local6))) + Math.abs(getArea(_local3, _local5, _local6))); return (((Math.abs((_local7 - _local8)) < 1E-5)) ? true : false); } } }//package core.utils
Section 115
//BContactListener (core.BContactListener) package core { import flash.events.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Dynamics.Contacts.*; public class BContactListener extends b2ContactListener { public var dispatcher:EventDispatcher; public static const COLLIDE_ADD:String = "CollideAdd"; public static const COLLIDE_PERSIST:String = "CollidePersist"; public static const COLLIDE_REMOVE:String = "CollideRemove"; public static const COLLIDE_RESULT:String = "CollideResult"; public function BContactListener():void{ dispatcher = new EventDispatcher(); } override public function Add(_arg1:b2ContactPoint):void{ dispatcher.dispatchEvent(new CoreEvent(COLLIDE_ADD, _arg1)); } override public function Persist(_arg1:b2ContactPoint):void{ dispatcher.dispatchEvent(new CoreEvent(COLLIDE_PERSIST, _arg1)); } public function collideExist(_arg1:b2Body, _arg2:b2Body):Boolean{ var _local3:b2ContactEdge = _arg1.m_contactList; while (_local3) { if (_local3.other == _arg2){ return (true); }; _local3 = _local3.next; }; return (false); } override public function Remove(_arg1:b2ContactPoint):void{ dispatcher.dispatchEvent(new CoreEvent(COLLIDE_REMOVE, _arg1)); } override public function Result(_arg1:b2ContactResult):void{ dispatcher.dispatchEvent(new CoreEvent(COLLIDE_RESULT, _arg1)); } } }//package core
Section 116
//ContactsManager (core.ContactsManager) package core { import core.objects.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; public class ContactsManager { private var engine:CoreEngine; private var contactListener:BContactListener; public function ContactsManager():void{ init(); } private function init():void{ engine = CoreEngine.getInstance(); contactListener = new BContactListener(); engine.world.SetContactListener(contactListener); contactListener.dispatcher.addEventListener(BContactListener.COLLIDE_ADD, collideAddHandler); } private function collideAddHandler(_arg1:CoreEvent):void{ var _local2:b2ContactPoint = (_arg1.data as b2ContactPoint); checkCollides(_local2.shape1, _local2.shape2, _local2); checkCollides(_local2.shape2, _local2.shape1, _local2); } private function checkCollides(_arg1:b2Shape, _arg2:b2Shape, _arg3:b2ContactPoint):void{ var _local4:BaseObject = _arg1.m_userData; var _local5:BaseObject = _arg2.m_userData; if ((_arg1.m_userData is Particle)){ if ((_arg2.m_userData is HurtWall)){ (_arg2.m_userData as HurtWall).collideWithParticle((_arg1.m_userData as Particle)); }; }; } } }//package core
Section 117
//CoreAssets (core.CoreAssets) package core { import flash.events.*; import flash.display.*; import flash.system.*; public class CoreAssets extends EventDispatcher { private var Assets:Class; private var appDomain:ApplicationDomain; public var inited:Boolean; private static var instance:CoreAssets; public function CoreAssets():void{ Assets = CoreAssets_Assets; super(); inited = false; } public function init():void{ var _local1:Loader = new Loader(); _local1.contentLoaderInfo.addEventListener(Event.INIT, assetsInitHandler); _local1.loadBytes(new Assets()); } private function assetsInitHandler(_arg1:Event):void{ appDomain = _arg1.target.content.loaderInfo.applicationDomain; inited = true; dispatchEvent(new Event(Event.INIT)); } public function getAssetClass(_arg1:String):Class{ if (!appDomain.hasDefinition(_arg1)){ trace((("*Error*: There is no definition of class '" + _arg1) + "'")); return (null); }; return ((appDomain.getDefinition(_arg1) as Class)); } public static function getInstance():CoreAssets{ if (!instance){ instance = new (CoreAssets); }; return (instance); } } }//package core
Section 118
//CoreAssets_Assets (core.CoreAssets_Assets) package core { import mx.core.*; public class CoreAssets_Assets extends ByteArrayAsset { } }//package core
Section 119
//CoreCanvas (core.CoreCanvas) package core { import flash.display.*; public class CoreCanvas { public var level:Sprite; public var bottom:Sprite; public var particles:Sprite; public var debug:Sprite; public var objects:Sprite; public var top:Sprite; public var tools:Sprite; public function CoreCanvas(_arg1:Sprite, _arg2:Sprite, _arg3:Sprite, _arg4:Sprite, _arg5:Sprite, _arg6:Sprite, _arg7:Sprite):void{ this.level = _arg1; this.bottom = _arg2; this.objects = _arg3; this.particles = _arg4; this.tools = _arg5; this.top = _arg6; this.debug = _arg7; } } }//package core
Section 120
//CoreEngine (core.CoreEngine) package core { import flash.events.*; import flash.filters.*; import flash.display.*; import core.objects.*; import flash.geom.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import core.tools.*; import caurina.transitions.*; public class CoreEngine extends EventDispatcher { public var assets:CoreAssets; private var currentLevel:Level; public var world:b2World; private var objects:Array; public var attractor:AttractorTool; public var particles:Array; private var iterations:int;// = 10 private var moveWall:MoveWall; public var timeStep:Number;// = 0.0333333333333333 private var isLevelComplete:Boolean; private var staticWall:StaticWall; public var physScale:Number;// = 30 private var contactsManager:ContactsManager; public var canvas:CoreCanvas; public var elapsedTime:int; public var isPaused:Boolean; private var hurtWall:HurtWall; private static var instance:CoreEngine; public function CoreEngine():void{ } private function createRect(_arg1:RectDef):void{ var _local2:Rect; if (_arg1.type == BaseObjectDef.TYPE_BRICK){ staticWall.addPoly(_arg1); } else { if (_arg1.type == BaseObjectDef.TYPE_HURT){ hurtWall.addPoly(_arg1); } else { if (_arg1.type == BaseObjectDef.TYPE_METAL){ moveWall.addPoly(_arg1); } else { _local2 = new Rect(_arg1); objects.push(_local2); }; }; }; } private function createMagnet(_arg1:MagnetDef):void{ var _local2:Magnet = new Magnet(_arg1); objects.push(_local2); } public function gameStart():void{ } public function pauseOff():void{ Tweener.resumeAllTweens(); canvas.level.addEventListener(Event.ENTER_FRAME, efHandler); isPaused = false; } public function destroyObj(_arg1:BaseObject):void{ objects.splice(objects.indexOf(_arg1), 1); _arg1.destroy(); } public function destroyParticle(_arg1:Particle):void{ _arg1.destroy(); particles.splice(particles.indexOf(_arg1), 1); } private function createParticle(_arg1:ParticleDef):void{ var _local2:Particle = new Particle(_arg1); particles.push(_local2); } private function createBubble():void{ var _local1:Number = Math.floor((Math.random() * 600)); var _local2:Number = Math.floor((Math.random() * 480)); var _local3:Bubble = new Bubble(new BaseObjectDef(_local1, _local2)); objects.push(_local3); } public function getObjUnderPoint(_arg1:Point):BaseObject{ var _local3:BaseObject; var _local2:b2Body = world.m_bodyList; while (_local2) { if (!_local2.m_shapeList){ } else { _local3 = _local2.m_shapeList.m_userData; if (_local3){ if (_local3.skin.hitTestPoint(_arg1.x, _arg1.y, true)){ return (_local3); }; }; }; _local2 = _local2.m_next; }; return (null); } private function createExit(_arg1:ExitDef):void{ var _local2:Exit = new Exit(_arg1); objects.push(_local2); } private function loadLevel():void{ var _local1:uint; var _local2:BaseObjectDef; particles = []; objects = []; staticWall = new StaticWall(); objects.push(staticWall); hurtWall = new HurtWall(); objects.push(hurtWall); moveWall = new MoveWall(); objects.push(moveWall); objects = []; _local1 = 0; while (_local1 < currentLevel.objects.length) { _local2 = currentLevel.objects[_local1]; if ((_local2 is ExitDef)){ createExit((_local2 as ExitDef)); } else { if ((_local2 is ParticleDef)){ createParticle((_local2 as ParticleDef)); } else { if ((_local2 is CircleDef)){ createCircle((_local2 as CircleDef)); } else { if ((_local2 is RectDef)){ createRect((_local2 as RectDef)); } else { if ((_local2 is PolyDef)){ createPoly((_local2 as PolyDef)); } else { if ((_local2 is MagnetDef)){ createMagnet((_local2 as MagnetDef)); }; }; }; }; }; }; _local1++; }; _local1 = 0; while (_local1 < currentLevel.objects.length) { _local2 = currentLevel.objects[_local1]; if ((_local2 is DistJointDef)){ createDistJoint((_local2 as DistJointDef)); } else { if ((_local2 is RevJointDef)){ createRevJoint((_local2 as RevJointDef)); }; }; _local1++; }; staticWall.settleRoomies(); hurtWall.settleRoomies(); moveWall.finishCreate(); _local1 = 0; while (_local1 < 3) { createBubble(); _local1++; }; } private function createRevJoint(_arg1:RevJointDef):void{ var _local2:RevJoint = new RevJoint(_arg1); objects.push(_local2); } private function initStuff():void{ var _local3:b2Body; var _local1:b2PolygonDef = new b2PolygonDef(); var _local2:b2BodyDef = new b2BodyDef(); _local1.friction = 0; _local2.position.Set((-40 / physScale), ((480 / physScale) / 2)); _local1.SetAsBox((40 / physScale), ((480 / physScale) / 2)); _local3 = world.CreateBody(_local2); _local3.CreateShape(_local1); _local3.SetMassFromShapes(); _local2.position.Set(((640 + 40) / physScale), ((480 / physScale) / 2)); _local3 = world.CreateBody(_local2); _local3.CreateShape(_local1); _local3.SetMassFromShapes(); _local2.position.Set((320 / physScale), ((-40 / physScale) / 2)); _local1.SetAsBox((640 / physScale), ((40 / physScale) / 2)); _local3 = world.CreateBody(_local2); _local3.CreateShape(_local1); _local3.SetMassFromShapes(); _local2.position.Set((320 / physScale), ((480 + 20) / physScale)); _local3 = world.CreateBody(_local2); _local3.CreateShape(_local1); _local3.SetMassFromShapes(); } public function levelStart(_arg1:Level, _arg2:CoreCanvas):void{ currentLevel = _arg1; this.canvas = _arg2; var _local3:GlowFilter = new GlowFilter(687640, 0.5, 6, 6, 2, 1, true); var _local4:GlowFilter = new GlowFilter(11070977, 1, 6, 6, 3, 2); assets = CoreAssets.getInstance(); SoundsManager.getInstance(); isPaused = false; initBox2d(); initStuff(); loadLevel(); attractor = new AttractorTool(); elapsedTime = 0; isLevelComplete = false; _arg2.level.addEventListener(Event.ENTER_FRAME, efHandler); } public function gameComplete():void{ } private function initBox2d():void{ var _local4:b2DebugDraw; var _local1:b2AABB = new b2AABB(); _local1.lowerBound.Set(-1000, -1000); _local1.upperBound.Set(1000, 1000); var _local2:b2Vec2 = new b2Vec2(0, 0); var _local3:Boolean; world = new b2World(_local1, _local2, _local3); _local4 = new b2DebugDraw(); var _local5:Sprite = canvas.debug; _local5.mouseEnabled = false; _local5.mouseChildren = false; _local4.m_sprite = _local5; _local4.m_drawScale = physScale; _local4.m_fillAlpha = 0.7; _local4.m_lineThickness = 1; _local4.m_drawFlags = (b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit); contactsManager = new ContactsManager(); } public function collectParticle(_arg1:Particle):void{ if (isLevelComplete){ return; }; destroyParticle(_arg1); currentLevel.collectedParticles++; dispatchEvent(new CoreEvent(CoreEvent.PARTICLE_COLLECTED)); if (currentLevel.collectedParticles >= currentLevel.needParticles){ isLevelComplete = true; dispatchEvent(new CoreEvent(CoreEvent.LEVEL_COMPLETE)); }; } private function createPoly(_arg1:PolyDef, _arg2:b2Vec2=null, _arg3:Number=0):void{ var _local4:Poly; if (!_arg1.isSimple()){ return; }; if (_arg1.type == BaseObjectDef.TYPE_BRICK){ staticWall.addPoly(_arg1); } else { if (_arg1.type == BaseObjectDef.TYPE_HURT){ hurtWall.addPoly(_arg1); } else { if (_arg1.type == BaseObjectDef.TYPE_METAL){ moveWall.addPoly(_arg1); } else { _local4 = new Poly(_arg1); objects.push(_local4); }; }; }; } private function efHandler(_arg1:Event):void{ world.Step(timeStep, iterations); dispatchEvent(new CoreEvent(CoreEvent.UPDATE, elapsedTime)); elapsedTime++; } private function createCircle(_arg1:CircleDef):void{ var _local2:Circle; if (_arg1.type == BaseObjectDef.TYPE_BRICK){ staticWall.addCircle(_arg1); } else { if (_arg1.type == BaseObjectDef.TYPE_HURT){ hurtWall.addCircle(_arg1); } else { if (_arg1.type == BaseObjectDef.TYPE_METAL){ moveWall.addCircle(_arg1); } else { _local2 = new Circle(_arg1); objects.push(_local2); }; }; }; } private function createDistJoint(_arg1:DistJointDef):void{ var _local2:DistJoint = new DistJoint(_arg1); objects.push(_local2); } public function pauseOn():void{ Tweener.pauseAllTweens(); canvas.level.removeEventListener(Event.ENTER_FRAME, efHandler); isPaused = true; } public function destroy():void{ var _local1:uint; var _local2:Particle; var _local3:BaseObject; Tweener.removeAllTweens(); if (canvas){ canvas.level.removeEventListener(Event.ENTER_FRAME, efHandler); }; if (particles){ _local1 = 0; while (_local1 < particles.length) { _local2 = particles[_local1]; destroyParticle(_local2); _local1++; }; }; if (objects){ _local1 = 0; while (_local1 < objects.length) { _local3 = objects[_local1]; _local3.destroy(); _local1++; }; }; objects = []; if (attractor){ attractor.destroy(); }; attractor = null; } public static function getInstance():CoreEngine{ if (instance == null){ instance = new (CoreEngine); }; return (instance); } } }//package core
Section 121
//CoreEvent (core.CoreEvent) package core { import flash.events.*; public class CoreEvent extends Event { public var data:Object; public static const UPDATE:String = "Update"; public static const PARTICLE_DESTROYED:String = "ParticleDestroyed"; public static const PARTICLE_COLLECTED:String = "ParticleCollected"; public static const ATTRACTOR_CHANGED:String = "AttractorChanged"; public static const DESTROY:String = "Destroy"; public static const LEVEL_COMPLETE:String = "LevelComplete"; public function CoreEvent(_arg1:String, _arg2:Object=null, _arg3:Boolean=false, _arg4:Boolean=false):void{ super(_arg1, _arg3, _arg4); this.data = _arg2; } } }//package core
Section 122
//Level (core.Level) package core { import core.objects.*; public class Level { public var objects:Array; public var needParticles:int; public var totalParticles:int; public var collectedParticles:int; public function Level(_arg1:int, _arg2:String):void{ objects = parseDef(_arg2); countParticles(); this.needParticles = _arg1; collectedParticles = 0; } private function countParticles():void{ var _local2:BaseObjectDef; var _local1:uint; while (_local1 < objects.length) { _local2 = objects[_local1]; if ((_local2 is ParticleDef)){ totalParticles++; }; _local1++; }; } public static function createDef(_arg1:Array):String{ var _local4:BaseObjectDef; var _local5:String; var _local2 = ""; var _local3:uint; while (_local3 < _arg1.length) { _local4 = _arg1[_local3]; _local5 = _local4.getStringDef(); _local2 = (_local2 + (_local5 + " ")); _local3++; }; return (_local2); } public static function parseDef(_arg1:String):Array{ var _local5:String; var _local6:Array; var _local7:String; var _local2:Array = _arg1.split(" "); var _local3:Array = []; var _local4:uint; while (_local4 < _local2.length) { _local5 = _local2[_local4]; _local6 = _local5.split("_"); _local7 = _local6[0]; switch (_local7){ case CircleDef.NAME: _local3.push(CircleDef.parseStringDef(_local5)); break; case RectDef.NAME: _local3.push(RectDef.parseStringDef(_local5)); break; case DistJointDef.NAME: _local3.push(DistJointDef.parseStringDef(_local5)); break; case ExitDef.NAME: _local3.push(ExitDef.parseStringDef(_local5)); break; case PolyDef.NAME: _local3.push(PolyDef.parseStringDef(_local5)); break; case RevJointDef.NAME: _local3.push(RevJointDef.parseStringDef(_local5)); break; case ParticleDef.NAME: _local3.push(ParticleDef.parseStringDef(_local5)); break; case MagnetDef.NAME: _local3.push(MagnetDef.parseStringDef(_local5)); break; }; _local4++; }; return (_local3); } } }//package core
Section 123
//SoundsManager (core.SoundsManager) package core { import game.model.*; import flash.media.*; public class SoundsManager { private var engine:CoreEngine; public var particleCollect:Sound; public var particleDead:Sound; private var sndChannel:SoundChannel; public var attractorEnabled:Sound; private static var instance:SoundsManager; public function SoundsManager(){ init(); } public function playSound(_arg1:Sound, _arg2:int=0):void{ sndChannel = _arg1.play(0, _arg2, SaveData.getInstance().sndTransform); } private function init():void{ engine = CoreEngine.getInstance(); var _local1:Class = engine.assets.getAssetClass("SndAttractorEnabled"); attractorEnabled = new (_local1); var _local2:Class = engine.assets.getAssetClass("SndParticleCollect"); particleCollect = new (_local2); var _local3:Class = engine.assets.getAssetClass("SndParticleDead"); particleDead = new (_local3); } public static function getInstance():SoundsManager{ if (instance == null){ instance = new (SoundsManager); }; return (instance); } } }//package core
Section 124
//compareStringCaseInSensitive (de.polygonal.ds.sort.compare.compareStringCaseInSensitive) package de.polygonal.ds.sort.compare { public function compareStringCaseInSensitive(_arg1:String, _arg2:String):int{ var _local3:int; var _local4:int; var _local5:int; _arg1 = _arg1.toLowerCase(); _arg2 = _arg2.toLowerCase(); if ((_arg1.length + _arg2.length) > 2){ _local3 = 0; _local4 = ((_arg1.length > _arg2.length)) ? _arg1.length : _arg2.length; _local5 = 0; while (_local5 < _local4) { _local3 = (_arg1.charCodeAt(_local5) - _arg2.charCodeAt(_local5)); if (_local3 != 0){ break; }; _local5++; }; return (_local3); //unresolved jump }; return ((_arg1.charCodeAt(0) - _arg2.charCodeAt(0))); } }//package de.polygonal.ds.sort.compare
Section 125
//compareStringCaseInSensitiveDesc (de.polygonal.ds.sort.compare.compareStringCaseInSensitiveDesc) package de.polygonal.ds.sort.compare { public function compareStringCaseInSensitiveDesc(_arg1:String, _arg2:String):int{ var _local3:int; var _local4:int; var _local5:int; _arg1 = _arg1.toLowerCase(); _arg2 = _arg2.toLowerCase(); if ((_arg1.length + _arg2.length) > 2){ _local3 = 0; _local4 = ((_arg1.length > _arg2.length)) ? _arg1.length : _arg2.length; _local5 = 0; while (_local5 < _local4) { _local3 = (_arg2.charCodeAt(_local5) - _arg1.charCodeAt(_local5)); if (_local3 != 0){ break; }; _local5++; }; return (_local3); //unresolved jump }; return ((_arg2.charCodeAt(0) - _arg1.charCodeAt(0))); } }//package de.polygonal.ds.sort.compare
Section 126
//compareStringCaseSensitive (de.polygonal.ds.sort.compare.compareStringCaseSensitive) package de.polygonal.ds.sort.compare { public function compareStringCaseSensitive(_arg1:String, _arg2:String):int{ var _local3:int; var _local4:int; var _local5:int; if ((_arg1.length + _arg2.length) > 2){ _local3 = 0; _local4 = ((_arg1.length > _arg2.length)) ? _arg1.length : _arg2.length; _local5 = 0; while (_local5 < _local4) { _local3 = (_arg1.charCodeAt(_local5) - _arg2.charCodeAt(_local5)); if (_local3 != 0){ break; }; _local5++; }; return (_local3); //unresolved jump }; return ((_arg1.charCodeAt(0) - _arg2.charCodeAt(0))); } }//package de.polygonal.ds.sort.compare
Section 127
//compareStringCaseSensitiveDesc (de.polygonal.ds.sort.compare.compareStringCaseSensitiveDesc) package de.polygonal.ds.sort.compare { public function compareStringCaseSensitiveDesc(_arg1:String, _arg2:String):int{ var _local3:int; var _local4:int; var _local5:int; if ((_arg1.length + _arg2.length) > 2){ _local3 = 0; _local4 = ((_arg1.length > _arg2.length)) ? _arg1.length : _arg2.length; _local5 = 0; while (_local5 < _local4) { _local3 = (_arg2.charCodeAt(_local5) - _arg1.charCodeAt(_local5)); if (_local3 != 0){ break; }; _local5++; }; return (_local3); //unresolved jump }; return ((_arg2.charCodeAt(0) - _arg1.charCodeAt(0))); } }//package de.polygonal.ds.sort.compare
Section 128
//dLinkedInsertionSort (de.polygonal.ds.sort.dLinkedInsertionSort) package de.polygonal.ds.sort { import de.polygonal.ds.*; public function dLinkedInsertionSort(_arg1:DListNode, _arg2:Boolean=false):DListNode{ var _local4:DListNode; var _local5:DListNode; var _local6:DListNode; var _local7:DListNode; var _local8:*; if (!_arg1){ return (null); }; var _local3:DListNode = _arg1; if (_arg2){ _local5 = _local3.next; while (_local5) { _local6 = _local5.next; _local4 = _local5.prev; if (_local4.data < _local5.data){ _local7 = _local4; while (_local7.prev) { if (_local7.prev.data < _local5.data){ _local7 = _local7.prev; } else { break; }; }; if (_local6){ _local4.next = _local6; _local6.prev = _local4; } else { _local4.next = null; }; if (_local7 == _local3){ _local5.prev = null; _local5.next = _local7; _local7.prev = _local5; _local3 = _local5; } else { _local5.prev = _local7.prev; _local7.prev.next = _local5; _local5.next = _local7; _local7.prev = _local5; }; }; _local5 = _local6; }; return (_local3); //unresolved jump }; _local5 = _local3.next; while (_local5) { _local6 = _local5.next; _local4 = _local5.prev; if (_local4.data > _local5.data){ _local7 = _local4; while (_local7.prev) { if (_local7.prev.data > _local5.data){ _local7 = _local7.prev; } else { break; }; }; if (_local6){ _local4.next = _local6; _local6.prev = _local4; } else { _local4.next = null; }; if (_local7 == _local3){ _local5.prev = null; _local5.next = _local7; _local7.prev = _local5; _local3 = _local5; } else { _local5.prev = _local7.prev; _local7.prev.next = _local5; _local5.next = _local7; _local7.prev = _local5; }; }; _local5 = _local6; }; return (_local3); } }//package de.polygonal.ds.sort
Section 129
//dLinkedInsertionSortCmp (de.polygonal.ds.sort.dLinkedInsertionSortCmp) package de.polygonal.ds.sort { import de.polygonal.ds.*; public function dLinkedInsertionSortCmp(_arg1:DListNode, _arg2:Function, _arg3:Boolean=false):DListNode{ var _local5:DListNode; var _local6:DListNode; var _local7:DListNode; var _local8:DListNode; var _local9:*; if (((!(_arg1)) || ((_arg2 == null)))){ return (null); }; var _local4:DListNode = _arg1; if (_arg3){ _local6 = _local4.next; while (_local6) { _local7 = _local6.next; _local5 = _local6.prev; if (_arg2(_local5.data, _local6.data) < 0){ _local8 = _local5; while (_local8.prev) { if (_arg2(_local8.prev.data, _local6.data) < 0){ _local8 = _local8.prev; } else { break; }; }; if (_local7){ _local5.next = _local7; _local7.prev = _local5; } else { _local5.next = null; }; if (_local8 == _local4){ _local6.prev = null; _local6.next = _local8; _local8.prev = _local6; _local4 = _local6; } else { _local6.prev = _local8.prev; _local8.prev.next = _local6; _local6.next = _local8; _local8.prev = _local6; }; }; _local6 = _local7; }; } else { _local6 = _local4.next; while (_local6) { _local7 = _local6.next; _local5 = _local6.prev; if (_arg2(_local5.data, _local6.data) > 0){ _local8 = _local5; while (_local8.prev) { if (_arg2(_local8.prev.data, _local6.data) > 0){ _local8 = _local8.prev; } else { break; }; }; if (_local7){ _local5.next = _local7; _local7.prev = _local5; } else { _local5.next = null; }; if (_local8 == _local4){ _local6.prev = null; _local6.next = _local8; _local8.prev = _local6; _local4 = _local6; } else { _local6.prev = _local8.prev; _local8.prev.next = _local6; _local6.next = _local8; _local8.prev = _local6; }; }; _local6 = _local7; }; }; return (_local4); } }//package de.polygonal.ds.sort
Section 130
//dLinkedMergeSort (de.polygonal.ds.sort.dLinkedMergeSort) package de.polygonal.ds.sort { import de.polygonal.ds.*; public function dLinkedMergeSort(_arg1:DListNode, _arg2:Boolean=false):DListNode{ var _local4:DListNode; var _local5:DListNode; var _local6:DListNode; var _local7:DListNode; var _local9:int; var _local10:int; var _local11:int; var _local12:int; if (!_arg1){ return (null); }; var _local3:DListNode = _arg1; var _local8 = 1; if (_arg2){ while (true) { _local4 = _local3; _local7 = null; _local3 = _local7; _local9 = 0; while (_local4) { _local9++; _local12 = 0; _local10 = 0; _local5 = _local4; while (_local12 < _local8) { _local10++; _local5 = _local5.next; if (!_local5){ break; }; _local12++; }; _local11 = _local8; while ((((_local10 > 0)) || ((((_local11 > 0)) && (_local5))))) { if (_local10 == 0){ _local6 = _local5; _local5 = _local5.next; _local11--; } else { if ((((_local11 == 0)) || (!(_local5)))){ _local6 = _local4; _local4 = _local4.next; _local10--; } else { if ((_local4.data - _local5.data) >= 0){ _local6 = _local4; _local4 = _local4.next; _local10--; } else { _local6 = _local5; _local5 = _local5.next; _local11--; }; }; }; if (_local7){ _local7.next = _local6; } else { _local3 = _local6; }; _local6.prev = _local7; _local7 = _local6; }; _local4 = _local5; }; _local7.next = null; if (_local9 <= 1){ return (_local3); }; _local8 = (_local8 << 1); }; } else { while (true) { _local4 = _local3; _local7 = null; _local3 = _local7; _local9 = 0; while (_local4) { _local9++; _local12 = 0; _local10 = 0; _local5 = _local4; while (_local12 < _local8) { _local10++; _local5 = _local5.next; if (!_local5){ break; }; _local12++; }; _local11 = _local8; while ((((_local10 > 0)) || ((((_local11 > 0)) && (_local5))))) { if (_local10 == 0){ _local6 = _local5; _local5 = _local5.next; _local11--; } else { if ((((_local11 == 0)) || (!(_local5)))){ _local6 = _local4; _local4 = _local4.next; _local10--; } else { if ((_local4.data - _local5.data) <= 0){ _local6 = _local4; _local4 = _local4.next; _local10--; } else { _local6 = _local5; _local5 = _local5.next; _local11--; }; }; }; if (_local7){ _local7.next = _local6; } else { _local3 = _local6; }; _local6.prev = _local7; _local7 = _local6; }; _local4 = _local5; }; _local7.next = null; if (_local9 <= 1){ return (_local3); }; _local8 = (_local8 << 1); }; }; return (null); } }//package de.polygonal.ds.sort
Section 131
//dLinkedMergeSortCmp (de.polygonal.ds.sort.dLinkedMergeSortCmp) package de.polygonal.ds.sort { import de.polygonal.ds.*; public function dLinkedMergeSortCmp(_arg1:DListNode, _arg2:Function, _arg3:Boolean=false):DListNode{ var _local5:DListNode; var _local6:DListNode; var _local7:DListNode; var _local8:DListNode; var _local10:int; var _local11:int; var _local12:int; var _local13:int; if (((!(_arg1)) || ((_arg2 == null)))){ return (null); }; var _local4:DListNode = _arg1; var _local9 = 1; if (_arg3){ while (true) { _local5 = _local4; _local8 = null; _local4 = _local8; _local10 = 0; while (_local5) { _local10++; _local13 = 0; _local11 = 0; _local6 = _local5; while (_local13 < _local9) { _local11++; _local6 = _local6.next; if (!_local6){ break; }; _local13++; }; _local12 = _local9; while ((((_local11 > 0)) || ((((_local12 > 0)) && (_local6))))) { if (_local11 == 0){ _local7 = _local6; _local6 = _local6.next; _local12--; } else { if ((((_local12 == 0)) || (!(_local6)))){ _local7 = _local5; _local5 = _local5.next; _local11--; } else { if (_arg2(_local5.data, _local6.data) >= 0){ _local7 = _local5; _local5 = _local5.next; _local11--; } else { _local7 = _local6; _local6 = _local6.next; _local12--; }; }; }; if (_local8){ _local8.next = _local7; } else { _local4 = _local7; }; _local7.prev = _local8; _local8 = _local7; }; _local5 = _local6; }; _arg1.prev = _local8; _local8.next = null; if (_local10 <= 1){ return (_local4); }; _local9 = (_local9 << 1); }; } else { while (true) { _local5 = _local4; _local8 = null; _local4 = _local8; _local10 = 0; while (_local5) { _local10++; _local13 = 0; _local11 = 0; _local6 = _local5; while (_local13 < _local9) { _local11++; _local6 = _local6.next; if (!_local6){ break; }; _local13++; }; _local12 = _local9; while ((((_local11 > 0)) || ((((_local12 > 0)) && (_local6))))) { if (_local11 == 0){ _local7 = _local6; _local6 = _local6.next; _local12--; } else { if ((((_local12 == 0)) || (!(_local6)))){ _local7 = _local5; _local5 = _local5.next; _local11--; } else { if (_arg2(_local5.data, _local6.data) <= 0){ _local7 = _local5; _local5 = _local5.next; _local11--; } else { _local7 = _local6; _local6 = _local6.next; _local12--; }; }; }; if (_local8){ _local8.next = _local7; } else { _local4 = _local7; }; _local7.prev = _local8; _local8 = _local7; }; _local5 = _local6; }; _arg1.prev = _local8; _local8.next = null; if (_local10 <= 1){ return (_local4); }; _local9 = (_local9 << 1); }; }; return (null); } }//package de.polygonal.ds.sort
Section 132
//Collection (de.polygonal.ds.Collection) package de.polygonal.ds { public interface Collection { function get size():int; function isEmpty():Boolean; function getIterator():Iterator; function clear():void; function toArray():Array; function contains(_arg1):Boolean; } }//package de.polygonal.ds
Section 133
//DLinkedList (de.polygonal.ds.DLinkedList) package de.polygonal.ds { import de.polygonal.ds.sort.compare.*; import de.polygonal.ds.sort.*; public class DLinkedList implements Collection { private var _count:int; public var tail:DListNode; public var head:DListNode; public function DLinkedList(... _args){ head = (tail = null); _count = 0; if (_args.length > 0){ append.apply(this, _args); }; } public function get size():int{ return (_count); } public function isEmpty():Boolean{ return ((_count == 0)); } public function remove(_arg1:DListIterator):Boolean{ if (((!((_arg1.list == this))) || (!(_arg1.node)))){ return (false); }; var _local2:DListNode = _arg1.node; if (_local2 == head){ head = head.next; } else { if (_local2 == tail){ tail = tail.prev; }; }; if (_arg1.node){ _arg1.node = _arg1.node.next; }; if (_local2.prev){ _local2.prev.next = _local2.next; }; if (_local2.next){ _local2.next.prev = _local2.prev; }; _local2.next = (_local2.prev = null); if (head == null){ tail = null; }; _count--; return (true); } public function removeHead(){ var _local1:*; if (head){ _local1 = head.data; head = head.next; if (head){ head.prev = null; } else { tail = null; }; _count--; return (_local1); }; return (null); } public function clear():void{ var _local2:DListNode; var _local1:DListNode = head; head = null; while (_local1) { _local2 = _local1.next; _local1.next = (_local1.prev = null); _local1 = _local2; }; _count = 0; } public function prepend(... _args):DListNode{ var _local4:DListNode; var _local5:int; var _local2:int = _args.length; var _local3:DListNode = new DListNode(_args[int((_local2 - 1))]); if (head){ head.insertBefore(_local3); head = head.prev; } else { head = (tail = _local3); }; if (_local2 > 1){ _local4 = _local3; _local5 = (_local2 - 2); while (_local5 >= 0) { _local3 = new DListNode(_args[_local5]); head.insertBefore(_local3); head = head.prev; _local5--; }; _count = (_count + _local2); return (_local4); }; _count++; return (_local3); } public function popDown():void{ var _local1:DListNode = tail; if (tail.prev == head){ tail = head; tail.next = null; head = _local1; head.prev = null; head.next = tail; tail.prev = head; } else { tail = tail.prev; tail.next = null; head.prev = _local1; _local1.prev = null; _local1.next = head; head = _local1; }; } public function concat(... _args):DLinkedList{ var _local3:DLinkedList; var _local4:DListNode; var _local2:DLinkedList = new DLinkedList(); _local4 = head; while (_local4) { _local2.append(_local4.data); _local4 = _local4.next; }; var _local5:int = _args.length; var _local6:int; while (_local6 < _local5) { _local3 = _args[_local6]; _local4 = _local3.head; while (_local4) { _local2.append(_local4.data); _local4 = _local4.next; }; _local6++; }; return (_local2); } public function insertBefore(_arg1:DListIterator, _arg2):DListNode{ var _local3:DListNode; if (_arg1.list != this){ return (null); }; if (_arg1.node){ _local3 = new DListNode(_arg2); _arg1.node.insertBefore(_local3); if (_arg1.node == head){ head = head.prev; }; _count++; return (_local3); //unresolved jump }; return (prepend(_arg2)); } public function append(... _args):DListNode{ var _local4:DListNode; var _local5:int; var _local2:int = _args.length; var _local3:DListNode = new DListNode(_args[0]); if (head){ tail.insertAfter(_local3); tail = tail.next; } else { head = (tail = _local3); }; if (_local2 > 1){ _local4 = _local3; _local5 = 1; while (_local5 < _local2) { _local3 = new DListNode(_args[_local5]); tail.insertAfter(_local3); tail = tail.next; _local5++; }; _count = (_count + _local2); return (_local4); }; _count++; return (_local3); } public function sort(... _args):void{ var _local2:int; var _local3:Function; var _local4:*; if (_count <= 1){ return; }; if (_args.length > 0){ _local2 = 0; _local3 = null; _local4 = _args[0]; if ((_local4 is Function)){ _local3 = _local4; if (_args.length > 1){ _local4 = _args[1]; if ((_local4 is int)){ _local2 = _local4; }; }; } else { if ((_local4 is int)){ _local2 = _local4; }; }; if (Boolean(_local3)){ if ((_local2 & 2)){ head = dLinkedInsertionSortCmp(head, _local3, (_local2 == 18)); } else { head = dLinkedMergeSortCmp(head, _local3, (_local2 == 16)); }; } else { if ((_local2 & 2)){ if ((_local2 & 4)){ if (_local2 == 22){ head = dLinkedInsertionSortCmp(head, compareStringCaseSensitiveDesc); } else { if (_local2 == 14){ head = dLinkedInsertionSortCmp(head, compareStringCaseInSensitive); } else { if (_local2 == 30){ head = dLinkedInsertionSortCmp(head, compareStringCaseInSensitiveDesc); } else { head = dLinkedInsertionSortCmp(head, compareStringCaseSensitive); }; }; }; } else { head = dLinkedInsertionSort(head, (_local2 == 18)); }; } else { if ((_local2 & 4)){ if (_local2 == 20){ head = dLinkedMergeSortCmp(head, compareStringCaseSensitiveDesc); } else { if (_local2 == 12){ head = dLinkedMergeSortCmp(head, compareStringCaseInSensitive); } else { if (_local2 == 28){ head = dLinkedMergeSortCmp(head, compareStringCaseInSensitiveDesc); } else { head = dLinkedMergeSortCmp(head, compareStringCaseSensitive); }; }; }; } else { if ((_local2 & 16)){ head = dLinkedMergeSort(head, true); }; }; }; }; } else { head = dLinkedMergeSort(head); }; } public function contains(_arg1):Boolean{ var _local2:DListNode = head; while (_local2) { if (_local2.data == _arg1){ return (true); }; _local2 = _local2.next; }; return (false); } public function reverse():void{ var _local1:DListNode; var _local3:DListNode; if (_count == 0){ return; }; var _local2:DListNode = tail; while (_local2) { _local1 = _local2.prev; if (!_local2.next){ _local2.next = _local2.prev; _local2.prev = null; head = _local2; } else { if (!_local2.prev){ _local2.prev = _local2.next; _local2.next = null; tail = _local2; } else { _local3 = _local2.next; _local2.next = _local2.prev; _local2.prev = _local3; }; }; _local2 = _local1; }; } public function insertAfter(_arg1:DListIterator, _arg2):DListNode{ var _local3:DListNode; if (_arg1.list != this){ return (null); }; if (_arg1.node){ _local3 = new DListNode(_arg2); _arg1.node.insertAfter(_local3); if (_arg1.node == tail){ tail = _arg1.node.next; }; _count++; return (_local3); //unresolved jump }; return (append(_arg2)); } public function getIterator():Iterator{ return (new DListIterator(this, head)); } public function toArray():Array{ var _local1:Array = []; var _local2:DListNode = head; while (_local2) { _local1.push(_local2.data); _local2 = _local2.next; }; return (_local1); } public function getListIterator():DListIterator{ return (new DListIterator(this, head)); } public function join(_arg1):String{ if (_count == 0){ return (""); }; var _local2 = ""; var _local3:DListNode = head; while (_local3.next) { _local2 = (_local2 + (_local3.data + _arg1)); _local3 = _local3.next; }; _local2 = (_local2 + _local3.data); return (_local2); } public function toString():String{ return ((("[DLinkedList > has " + size) + " nodes]")); } public function removeTail(){ var _local1:*; if (tail){ _local1 = tail.data; tail = tail.prev; if (tail){ tail.next = null; } else { head = null; }; _count--; return (_local1); }; return (null); } public function lastNodeOf(_arg1, _arg2:DListIterator=null):DListIterator{ if (_arg2 != null){ if (_arg2.list != this){ return (null); }; }; var _local3:DListNode = ((_arg2)==null) ? tail : _arg2.node; while (_local3) { if (_local3.data === _arg1){ return (new DListIterator(this, _local3)); }; _local3 = _local3.prev; }; return (null); } public function merge(... _args):void{ var _local2:DLinkedList; _local2 = _args[0]; if (head){ tail.next = _local2.head; _local2.head.prev = tail; tail = _local2.tail; } else { head = _local2.head; tail = _local2.tail; }; _count = (_count + _local2.size); var _local3:int = _args.length; var _local4 = 1; while (_local4 < _local3) { _local2 = _args[_local4]; tail.next = _local2.head; _local2.head.prev = tail; tail = _local2.tail; _count = (_count + _local2.size); _local4++; }; } public function nodeOf(_arg1, _arg2:DListIterator=null):DListIterator{ if (_arg2 != null){ if (_arg2.list != this){ return (null); }; }; var _local3:DListNode = ((_arg2)==null) ? head : _arg2.node; while (_local3) { if (_local3.data === _arg1){ return (new DListIterator(this, _local3)); }; _local3 = _local3.next; }; return (null); } public function dump():String{ if (head == null){ return ("DLinkedList, empty"); }; var _local1 = (((("DLinkedList, has " + _count) + " node") + ((_count == 1)) ? "" : "s") + "\n|< Head\n"); var _local2:DListIterator = getListIterator(); while (_local2.valid()) { _local1 = (_local1 + (("\t" + _local2.data) + "\n")); _local2.forth(); }; _local1 = (_local1 + "Tail >|"); return (_local1); } public function splice(_arg1:DListIterator, _arg2:uint=4294967295, ... _args):DLinkedList{ var _local4:DListNode; var _local5:DListNode; var _local6:DLinkedList; var _local7:int; var _local8:int; var _local9:DListNode; if (_arg1){ if (_arg1.list != this){ return (null); }; }; if (_arg1.node){ _local4 = _arg1.node; _local5 = _arg1.node.prev; _local6 = new DLinkedList(); if (_arg2 == 4294967295){ if (_arg1.node == tail){ return (_local6); }; while (_arg1.node) { _local6.append(_arg1.node.data); _arg1.remove(); }; _arg1.list = _local6; _arg1.node = _local4; return (_local6); } else { _local7 = 0; while (_local7 < _arg2) { if (_arg1.node){ _local6.append(_arg1.node.data); _arg1.remove(); } else { break; }; _local7++; }; }; _local8 = _args.length; if (_local8 > 0){ if (_count == 0){ _local7 = 0; while (_local7 < _local8) { append(_args[_local7]); _local7++; }; } else { if (_local5 == null){ _local9 = prepend(_args[0]); _local7 = 1; while (_local7 < _local8) { _local9.insertAfter(new DListNode(_args[_local7])); if (_local9 == tail){ tail = _local9.next; }; _local9 = _local9.next; _count++; _local7++; }; } else { _local9 = _local5; _local7 = 0; while (_local7 < _local8) { _local9.insertAfter(new DListNode(_args[_local7])); if (_local9 == tail){ tail = _local9.next; }; _local9 = _local9.next; _count++; _local7++; }; }; }; _arg1.node = _local9; } else { _arg1.node = _local4; }; _arg1.list = _local6; return (_local6); }; return (null); } public function shiftUp():void{ var _local1:DListNode = head; if (head.next == tail){ head = tail; head.prev = null; tail = _local1; tail.next = null; head.next = tail; tail.prev = head; } else { head = head.next; head.prev = null; tail.next = _local1; _local1.next = null; _local1.prev = tail; tail = _local1; }; } } }//package de.polygonal.ds
Section 134
//DListIterator (de.polygonal.ds.DListIterator) package de.polygonal.ds { public class DListIterator implements Iterator { public var node:DListNode; public var list:DLinkedList; public function DListIterator(_arg1:DLinkedList, _arg2:DListNode=null){ this.list = _arg1; this.node = _arg2; } public function remove():Boolean{ return (list.remove(this)); } public function back():void{ if (node){ node = node.prev; }; } public function start():void{ node = list.head; } public function get data(){ if (node){ return (node.data); }; return (null); } public function forth():void{ if (node){ node = node.next; }; } public function toString():String{ return ((("{DListIterator, data=" + (node) ? node.data : "null") + "}")); } public function hasNext():Boolean{ return (Boolean(node)); } public function valid():Boolean{ return (Boolean(node)); } public function next(){ var _local1:*; if (hasNext()){ _local1 = node.data; node = node.next; return (_local1); }; return (null); } public function set data(_arg1):void{ node.data = _arg1; } public function end():void{ node = list.tail; } } }//package de.polygonal.ds
Section 135
//DListNode (de.polygonal.ds.DListNode) package de.polygonal.ds { public class DListNode implements LinkedListNode { public var prev:DListNode; public var next:DListNode; public var data; public function DListNode(_arg1){ next = (prev = null); data = _arg1; } public function unlink():void{ if (prev){ prev.next = next; }; if (next){ next.prev = prev; }; next = (prev = null); } public function insertAfter(_arg1:DListNode):void{ _arg1.next = next; _arg1.prev = this; if (next){ next.prev = _arg1; }; next = _arg1; } public function insertBefore(_arg1:DListNode):void{ _arg1.next = this; _arg1.prev = prev; if (prev){ prev.next = _arg1; }; prev = _arg1; } public function toString():String{ return ((("[DListNode, data=" + data) + "]")); } } }//package de.polygonal.ds
Section 136
//Iterator (de.polygonal.ds.Iterator) package de.polygonal.ds { public interface Iterator { function start():void; function set data(_arg1):void; function get data(); function next(); function hasNext():Boolean; } }//package de.polygonal.ds
Section 137
//LinkedListNode (de.polygonal.ds.LinkedListNode) package de.polygonal.ds { public interface LinkedListNode { } }//package de.polygonal.ds
Section 138
//EditorCloseCommand (editor.controller.EditorCloseCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.model.*; import org.puremvc.as3.patterns.command.*; import editor.view.*; public class EditorCloseCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:EditorMediator = (facade.retrieveMediator(EditorMediator.NAME) as EditorMediator); _local2.destroy(); facade.removeProxy(EditorProxy.NAME); facade.removeProxy(GridProxy.NAME); facade.removeProxy(LevelProxy.NAME); } } }//package editor.controller
Section 139
//EditorStartCommand (editor.controller.EditorStartCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.model.*; import editor.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; import editor.view.*; public class EditorStartCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:EditorProxy = new EditorProxy(); facade.registerProxy(_local2); var _local3:GridProxy = new GridProxy(); facade.registerProxy(_local3); var _local4:LevelProxy = new LevelProxy(); facade.registerProxy(_local4); var _local5:EditorView = new EditorView(); var _local6:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); _local6.getViewContainer().addChild(_local5); var _local7:EditorMediator = new EditorMediator(_local5); facade.registerMediator(_local7); } } }//package editor.controller
Section 140
//ELevelCompleteCommand (editor.controller.ELevelCompleteCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; import editor.view.*; public class ELevelCompleteCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local3:ELevelCompleteView = new ELevelCompleteView(); _local2.getViewContainer().addChild(_local3); var _local4:ELevelCompleteMediator = new ELevelCompleteMediator(_local3); facade.registerMediator(_local4); } } }//package editor.controller
Section 141
//ELevelRestartEndCommand (editor.controller.ELevelRestartEndCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.command.*; import editor.view.*; public class ELevelRestartEndCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:LevelTestMediator = (facade.retrieveMediator(LevelTestMediator.NAME) as LevelTestMediator); _local2.destroy(); } } }//package editor.controller
Section 142
//ELevelRestartStartCommand (editor.controller.ELevelRestartStartCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.command.*; public class ELevelRestartStartCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ } } }//package editor.controller
Section 143
//LevelQuitCommand (editor.controller.LevelQuitCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.model.*; import org.puremvc.as3.patterns.command.*; import editor.view.*; public class LevelQuitCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:LevelProxy = (facade.retrieveProxy(LevelProxy.NAME) as LevelProxy); _local2.levelQuit(); var _local3:LevelTestMediator = (facade.retrieveMediator(LevelTestMediator.NAME) as LevelTestMediator); _local3.destroy(); } } }//package editor.controller
Section 144
//LevelTestCommand (editor.controller.LevelTestCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.model.*; import editor.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; import editor.view.*; public class LevelTestCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:LevelTestView = new LevelTestView(); var _local3:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); _local3.getViewContainer().addChild(_local2); var _local4:LevelTestMediator = new LevelTestMediator(_local2); facade.registerMediator(_local4); var _local5:LevelProxy = (facade.retrieveProxy(LevelProxy.NAME) as LevelProxy); _local5.levelStart(); _local4.updateStat(); } } }//package editor.controller
Section 145
//ObjectAddCommand (editor.controller.ObjectAddCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.model.*; import core.objects.*; import org.puremvc.as3.patterns.command.*; public class ObjectAddCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:EditorProxy = (facade.retrieveProxy(EditorProxy.NAME) as EditorProxy); _local2.objectAdd((_arg1.getBody() as BaseObjectDef)); } } }//package editor.controller
Section 146
//ObjectRemoveCommand (editor.controller.ObjectRemoveCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.model.*; import core.objects.*; import org.puremvc.as3.patterns.command.*; public class ObjectRemoveCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:EditorProxy = (facade.retrieveProxy(EditorProxy.NAME) as EditorProxy); _local2.objectRemove((_arg1.getBody() as BaseObjectDef)); } } }//package editor.controller
Section 147
//ObjectsSelectCommand (editor.controller.ObjectsSelectCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.model.*; import org.puremvc.as3.patterns.command.*; public class ObjectsSelectCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:EditorProxy = (facade.retrieveProxy(EditorProxy.NAME) as EditorProxy); _local2.objectsSelect((_arg1.getBody() as Array)); } } }//package editor.controller
Section 148
//ToolSelectCommand (editor.controller.ToolSelectCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.model.*; import org.puremvc.as3.patterns.command.*; public class ToolSelectCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:EditorProxy = (facade.retrieveProxy(EditorProxy.NAME) as EditorProxy); _local2.selectedTool = (_arg1.getBody() as Tool); } } }//package editor.controller
Section 149
//EditorAssets (editor.model.EditorAssets) package editor.model { import flash.events.*; import flash.display.*; import flash.system.*; public class EditorAssets extends EventDispatcher { private var Assets:Class; private var appDomain:ApplicationDomain; private static var instance:EditorAssets; public function EditorAssets(){ Assets = EditorAssets_Assets; super(); } public function init():void{ var _local1:Loader = new Loader(); _local1.contentLoaderInfo.addEventListener(Event.INIT, assetsInitHandler); _local1.loadBytes(new Assets()); } public function GameAssets():void{ } private function assetsInitHandler(_arg1:Event):void{ appDomain = _arg1.target.content.loaderInfo.applicationDomain; dispatchEvent(new Event(Event.INIT)); } public function getAssetClass(_arg1:String):Class{ if (!appDomain.hasDefinition(_arg1)){ trace((("*Error*: There is no definition of class '" + _arg1) + "'")); return (null); }; return ((appDomain.getDefinition(_arg1) as Class)); } public static function getInstance():EditorAssets{ if (!instance){ instance = new (EditorAssets); }; return (instance); } } }//package editor.model
Section 150
//EditorAssets_Assets (editor.model.EditorAssets_Assets) package editor.model { import mx.core.*; public class EditorAssets_Assets extends ByteArrayAsset { } }//package editor.model
Section 151
//EditorProxy (editor.model.EditorProxy) package editor.model { import game.model.*; import core.objects.*; import flash.geom.*; import org.puremvc.as3.patterns.proxy.*; import editor.controller.*; public class EditorProxy extends Proxy { private var notesProxy:NotesProxy; private var objects:Array; private var selectedObjs:Array; public var selectedTool:Tool; private var tools:Array; public static const OBJECT_ADD:String = "ObjectAdd"; public static const ELEVEL_RESTART_END:String = "ELevelRestartEnd"; public static const OBJECT_REMOVE:String = "ObjectRemove"; public static const EDITOR_CLOSE:String = "EditorClose"; public static const OBJECTS_SELECT:String = "ObjectsSelect"; public static const OBJECT_UPDATE:String = "ObjectUpdate"; public static const LEVEL_QUIT:String = "LevelQuit"; public static const NAME:String = "EditorProxy"; public static const LEVEL_TEST:String = "LevelTest"; public static const ELEVEL_RESTART_START:String = "ELevelRestartStart"; public static const ELEVEL_COMPLETE:String = "EditorLevelComplete"; public static const TOOL_SELECT:String = "ToolSelect"; public function EditorProxy():void{ super(NAME); init(); } public function objectAdd(_arg1:BaseObjectDef):void{ objects.push(_arg1); } public function objectRemove(_arg1:BaseObjectDef):void{ var _local2:int = objects.indexOf(_arg1); if (_local2 != -1){ objects.splice(_local2, 1); }; var _local3:int = selectedObjs.indexOf(_arg1); if (_local3 != -1){ selectedObjs.splice(_local3, 1); }; } private function checkRectPoint(_arg1:Rectangle, _arg2:Point):Boolean{ if ((((((((_arg2.x > _arg1.x)) && ((_arg2.x < (_arg1.x + _arg1.width))))) && ((_arg2.y > _arg1.y)))) && ((_arg2.y < (_arg1.y + _arg1.height))))){ return (true); }; return (false); } public function getTools():Array{ return (tools); } public function getSelectedObjects():Array{ return (selectedObjs); } private function initTools():void{ tools = []; var _local1:Tool = new Tool(0, Tool.TYPE_SELECTION); tools.push(_local1); var _local2:Tool = new Tool(1, Tool.TYPE_CIRCLE); tools.push(_local2); var _local3:Tool = new Tool(2, Tool.TYPE_RECT); tools.push(_local3); var _local4:Tool = new Tool(3, Tool.TYPE_DIST_JOINT); tools.push(_local4); var _local5:Tool = new Tool(4, Tool.TYPE_BONUS); tools.push(_local5); var _local6:Tool = new Tool(5, Tool.TYPE_REV_JOINT); tools.push(_local6); var _local7:Tool = new Tool(6, Tool.TYPE_POLY); tools.push(_local7); var _local8:Tool = new Tool(7, Tool.TYPE_PARTICLE); tools.push(_local8); var _local9:Tool = new Tool(8, Tool.TYPE_MAGNET); tools.push(_local9); } private function init():void{ if (!facade.hasCommand(OBJECT_ADD)){ facade.registerCommand(OBJECT_ADD, ObjectAddCommand); }; if (!facade.hasCommand(OBJECTS_SELECT)){ facade.registerCommand(OBJECTS_SELECT, ObjectsSelectCommand); }; if (!facade.hasCommand(LEVEL_TEST)){ facade.registerCommand(LEVEL_TEST, LevelTestCommand); }; if (!facade.hasCommand(LEVEL_QUIT)){ facade.registerCommand(LEVEL_QUIT, LevelQuitCommand); }; if (!facade.hasCommand(ELEVEL_COMPLETE)){ facade.registerCommand(ELEVEL_COMPLETE, ELevelCompleteCommand); }; if (!facade.hasCommand(OBJECT_REMOVE)){ facade.registerCommand(OBJECT_REMOVE, ObjectRemoveCommand); }; if (!facade.hasCommand(ELEVEL_RESTART_START)){ facade.registerCommand(ELEVEL_RESTART_START, ELevelRestartStartCommand); }; if (!facade.hasCommand(ELEVEL_RESTART_END)){ facade.registerCommand(ELEVEL_RESTART_END, ELevelRestartEndCommand); }; if (!facade.hasCommand(EDITOR_CLOSE)){ facade.registerCommand(EDITOR_CLOSE, EditorCloseCommand); }; if (!facade.hasCommand(TOOL_SELECT)){ facade.registerCommand(TOOL_SELECT, ToolSelectCommand); }; notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); initTools(); objects = []; selectedObjs = []; var _local1:ExitDef = new ExitDef(200, 100); notesProxy.push(OBJECT_ADD, _local1); } public function getObjsUnderRect(_arg1:Rectangle):Array{ var _local4:BaseObjectDef; var _local2:Array = []; var _local3:uint; while (_local3 < objects.length) { _local4 = objects[_local3]; if (_local4.isRectInside(_arg1)){ _local2.push(_local4); }; _local3++; }; return (_local2); } private function checkRectRect(_arg1:Rectangle, _arg2:Rectangle):Boolean{ var _local3:Boolean; var _local4:Boolean; if ((((((_arg1.x < _arg2.x)) && (((_arg1.x + _arg1.width) > _arg2.x)))) || ((((_arg1.x > _arg2.x)) && ((_arg1.x < (_arg2.x + _arg2.width))))))){ _local3 = true; }; if ((((((_arg1.y < _arg2.y)) && (((_arg1.y + _arg1.height) > _arg2.y)))) || ((((_arg1.y > _arg2.y)) && ((_arg1.y < (_arg2.y + _arg2.height))))))){ _local4 = true; }; return ((((_local3) && (_local4))) ? true : false); } public function getObjUnderPoint(_arg1:Point):BaseObjectDef{ var _local2:int; var _local3:BaseObjectDef; _local2 = (objects.length - 1); while (_local2 >= 0) { _local3 = objects[_local2]; if (_local3.isPointInside(_arg1)){ return (_local3); }; _local2--; }; return (null); } public function getObjects():Array{ return (objects); } public function objectsSelect(_arg1:Array):void{ selectedObjs = _arg1; } } }//package editor.model
Section 152
//GridProxy (editor.model.GridProxy) package editor.model { import flash.geom.*; import org.puremvc.as3.patterns.proxy.*; public class GridProxy extends Proxy { public var showGrid:Boolean; public var cellWidth:Number; public var cellHeight:Number; public var snap:Boolean; public static const NAME:String = "GridProxy"; public function GridProxy():void{ super(NAME); init(); } private function init():void{ showGrid = false; snap = false; cellWidth = 20; cellHeight = 20; } public function getSnapPoint(_arg1:Point):Point{ var _local2:Number; var _local3:Number; if (snap){ _local2 = (Math.round((_arg1.x / cellWidth)) * cellWidth); _local3 = (Math.round((_arg1.y / cellHeight)) * cellHeight); return (new Point(_local2, _local3)); }; return (_arg1); } } }//package editor.model
Section 153
//LevelProxy (editor.model.LevelProxy) package editor.model { import core.*; import game.model.*; import editor.view.components.*; import org.puremvc.as3.patterns.proxy.*; import editor.view.*; public class LevelProxy extends Proxy { private var engine:CoreEngine; public var currentLevel:Level; private var notesProxy:NotesProxy; public var needParticles:int; public static const PARTICLE_COLLECTED:String = "ParticleCollected"; public static const PARTILCE_DESTROYED:String = "ParticleDestroyed"; public static const NAME:String = "LevelProxy"; public function LevelProxy():void{ super(NAME); init(); } private function destroy():void{ engine.removeEventListener(CoreEvent.LEVEL_COMPLETE, levelCompleteHandler); engine.removeEventListener(CoreEvent.PARTICLE_COLLECTED, particleCollectedHandler); engine.destroy(); } private function particleCollectedHandler(_arg1:CoreEvent):void{ notesProxy.push(PARTICLE_COLLECTED); } private function levelCompleteHandler(_arg1:CoreEvent):void{ destroy(); notesProxy.push(EditorProxy.ELEVEL_COMPLETE); } private function init():void{ engine = CoreEngine.getInstance(); notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); } public function levelQuit():void{ destroy(); } private function levelRestartEndCommand(_arg1:CoreEvent):void{ notesProxy.push(EditorProxy.ELEVEL_RESTART_END); notesProxy.push(EditorProxy.LEVEL_TEST); } public function levelStart():void{ var _local1:LevelTestMediator = (facade.retrieveMediator(LevelTestMediator.NAME) as LevelTestMediator); var _local2:LevelTestView = (_local1.getViewComponent() as LevelTestView); var _local3:CoreCanvas = new CoreCanvas(_local2.levelContainer, _local2.bottom, _local2.objects, _local2.objects, _local2.tools, _local2.top, _local2.debug); var _local4:EditorProxy = (facade.retrieveProxy(EditorProxy.NAME) as EditorProxy); currentLevel = new Level(needParticles, Level.createDef(_local4.getObjects())); engine.levelStart(currentLevel, _local3); engine.addEventListener(CoreEvent.LEVEL_COMPLETE, levelCompleteHandler); engine.addEventListener(CoreEvent.PARTICLE_COLLECTED, particleCollectedHandler); } } }//package editor.model
Section 154
//Tool (editor.model.Tool) package editor.model { public class Tool { public var type:String; public var id:uint; public static const TYPE_EXIT:String = "TypeExit"; public static const TYPE_SELECTION:String = "TypeSelection"; public static const TYPE_RECT:String = "TypeRect"; public static const TYPE_PARTICLE:String = "TypeParticle"; public static const TYPE_MAGNET:String = "TypeMagnet"; public static const TYPE_REV_JOINT:String = "TypeRevJoint"; public static const TYPE_POLY:String = "TypePoly"; public static const TYPE_HAND:String = "TypeHand"; public static const TYPE_CIRCLE:String = "TypeCircle"; public static const TYPE_DIST_JOINT:String = "TypeDistJoint"; public static const TYPE_BONUS:String = "TypeBonus"; public function Tool(_arg1:uint, _arg2:String):void{ this.id = _arg1; this.type = _arg2; } } }//package editor.model
Section 155
//CircleView (editor.view.components.obj.CircleView) package editor.view.components.obj { import editor.model.*; import flash.display.*; import core.objects.*; import editor.view.components.support.*; public class CircleView extends ObjView { private var circleObj:CircleDef; private var scale:CircleScaleSup; private var moveId:MoveWallIdSup; private var type:CircleTypeSup; public function CircleView(_arg1:CircleDef):void{ circleObj = _arg1; super(_arg1); } override protected function createSupportStuff():void{ type = new CircleTypeSup(circleObj); scale = new CircleScaleSup(circleObj); moveId = new MoveWallIdSup(circleObj); } override protected function updateSkin():void{ var _local1:Class; if (circleObj.type == BaseObjectDef.TYPE_BRICK){ _local1 = EditorAssets.getInstance().getAssetClass("BrickMaterial"); } else { if (circleObj.type == BaseObjectDef.TYPE_METAL){ _local1 = EditorAssets.getInstance().getAssetClass("MetallMaterial"); } else { _local1 = EditorAssets.getInstance().getAssetClass("HurtMaterial"); }; }; var _local2:BitmapData = (new _local1(0, 0) as BitmapData); skin.graphics.clear(); skin.graphics.beginBitmapFill(_local2, null, true, true); skin.graphics.lineStyle(0, 0, 1); skin.graphics.drawCircle(0, 0, circleObj.r); skin.graphics.endFill(); } override public function update():void{ super.update(); type.update(); scale.update(); moveId.update(); } override public function select():void{ super.select(); if (editorProxy.getSelectedObjects().length > 1){ return; }; type.select(); scale.select(); moveId.select(); } override public function deselect():void{ super.deselect(); type.deselect(); scale.deselect(); moveId.deselect(); } override protected function destroySupportStuff():void{ type.destroy(); scale.destroy(); moveId.destroy(); } } }//package editor.view.components.obj
Section 156
//DistJointView (editor.view.components.obj.DistJointView) package editor.view.components.obj { import core.objects.*; import editor.view.components.support.*; public class DistJointView extends ObjView { private var anchor1:DistJointTargetSup; public var jointObj:DistJointDef; private var anchor2:DistJointTargetSup; public function DistJointView(_arg1:DistJointDef):void{ this.jointObj = _arg1; super(_arg1); } override protected function createSupportStuff():void{ anchor1 = new DistJointTargetSup(jointObj, DistJointTargetSup.POS_FIRST); anchor2 = new DistJointTargetSup(jointObj, DistJointTargetSup.POS_SECOND); anchor1.visible = false; anchor2.visible = false; } override public function deselect():void{ super.deselect(); anchor1.deselect(); anchor2.deselect(); } override protected function updateSkin():void{ skin.graphics.clear(); skin.graphics.lineStyle(2, 0xFFFF00); skin.graphics.moveTo(jointObj.x1, jointObj.y1); skin.graphics.lineTo(jointObj.x2, jointObj.y2); super.updateSkin(); } override public function update():void{ anchor1.update(); anchor2.update(); updateSkin(); updateFrame(); } override public function select():void{ super.select(); if (editorProxy.getSelectedObjects().length > 1){ return; }; anchor1.select(); anchor2.select(); } override protected function destroySupportStuff():void{ anchor1.destroy(); anchor2.destroy(); } } }//package editor.view.components.obj
Section 157
//ObjView (editor.view.components.obj.ObjView) package editor.view.components.obj { import flash.events.*; import editor.model.*; import game.model.*; import flash.display.*; import core.objects.*; import flash.geom.*; import editor.view.components.*; import editor.view.*; public class ObjView extends Sprite { protected var editorProxy:EditorProxy; protected var skin:Sprite; protected var support:Sprite; protected var canvas:Sprite; protected var frame:Sprite; protected var notesProxy:NotesProxy; public var obj:BaseObjectDef; public function ObjView(_arg1:BaseObjectDef):void{ this.obj = _arg1; init(); } protected function createSupportStuff():void{ } public function update():void{ x = obj.x; y = obj.y; updateSkin(); updateFrame(); } protected function mouseUpHandler(_arg1:MouseEvent):void{ obj.x = parent.mouseX; obj.y = parent.mouseY; stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); notesProxy.push(EditorProxy.OBJECT_UPDATE, obj); } protected function init():void{ var _local1:ApplicationFacade = ApplicationFacade.getInstance(); notesProxy = (_local1.retrieveProxy(NotesProxy.NAME) as NotesProxy); var _local2:EditorMediator = (_local1.retrieveMediator(EditorMediator.NAME) as EditorMediator); canvas = (_local2.getViewComponent() as EditorView).canvas; support = (_local2.getViewComponent() as EditorView).support; editorProxy = (_local1.retrieveProxy(EditorProxy.NAME) as EditorProxy); createSkin(); frame = new Sprite(); addChild(frame); createSupportStuff(); frame.visible = false; update(); } public function destroy():void{ parent.removeChild(this); destroySupportStuff(); } protected function mouseMoveHandler(_arg1:MouseEvent):void{ } protected function createSkin():void{ skin = new Sprite(); addChild(skin); } protected function mouseDownHandler(_arg1:MouseEvent):void{ notesProxy.push(EditorProxy.OBJECTS_SELECT, [obj]); stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } protected function updateFrame():void{ var _local1:Rectangle = obj.getBoundingBox(); var _local2:Point = frame.globalToLocal(new Point(_local1.x, _local1.y)); frame.graphics.clear(); frame.graphics.lineStyle(0, 6710937); frame.graphics.drawRect(_local2.x, _local2.y, _local1.width, _local1.height); frame.graphics.lineStyle(0, 0); frame.graphics.moveTo(-3, 0); frame.graphics.lineTo(3, 0); frame.graphics.moveTo(0, -3); frame.graphics.lineTo(0, 3); } protected function updateSkin():void{ } public function select():void{ frame.visible = true; } public function deselect():void{ frame.visible = false; } protected function destroySupportStuff():void{ } } }//package editor.view.components.obj
Section 158
//PolyView (editor.view.components.obj.PolyView) package editor.view.components.obj { import editor.model.*; import flash.display.*; import core.objects.*; import flash.geom.*; import editor.view.components.support.*; public class PolyView extends ObjView { private var tri:PolyTriSup; private var polyObj:PolyDef; private var pointSups:Array; private var type:PolyTypeSup; public function PolyView(_arg1:PolyDef):void{ polyObj = _arg1; super(_arg1); } override protected function createSupportStuff():void{ var _local2:Point; var _local3:PolyPointSup; tri = new PolyTriSup(polyObj); pointSups = []; var _local1:uint; while (_local1 < polyObj.vertices.length) { _local2 = polyObj.vertices[_local1]; _local3 = new PolyPointSup(polyObj, _local2); pointSups.push(_local3); _local1++; }; type = new PolyTypeSup(polyObj); } override public function deselect():void{ var _local2:PolyPointSup; super.deselect(); tri.deselect(); var _local1:uint; while (_local1 < pointSups.length) { _local2 = pointSups[_local1]; _local2.deselect(); _local1++; }; type.deselect(); } override protected function updateSkin():void{ var _local1:Class; var _local5:Point; if (polyObj.type == BaseObjectDef.TYPE_BRICK){ _local1 = EditorAssets.getInstance().getAssetClass("BrickMaterial"); } else { if (polyObj.type == BaseObjectDef.TYPE_METAL){ _local1 = EditorAssets.getInstance().getAssetClass("MetallMaterial"); } else { _local1 = EditorAssets.getInstance().getAssetClass("HurtMaterial"); }; }; var _local2:BitmapData = (new _local1(0, 0) as BitmapData); skin.graphics.clear(); skin.graphics.beginBitmapFill(_local2, null, true, true); skin.graphics.lineStyle(0, 0, 1); var _local3:Point = polyObj.vertices[0]; skin.graphics.moveTo(_local3.x, _local3.y); var _local4:uint = 1; while (_local4 < polyObj.vertices.length) { _local5 = polyObj.vertices[_local4]; skin.graphics.lineTo(_local5.x, _local5.y); _local4++; }; skin.graphics.lineTo(_local3.x, _local3.y); skin.graphics.endFill(); alpha = (polyObj.isSimple()) ? 1 : 0.5; } override public function update():void{ var _local2:PolyPointSup; super.update(); tri.update(); var _local1:uint; while (_local1 < pointSups.length) { _local2 = pointSups[_local1]; _local2.update(); _local1++; }; type.update(); } override public function select():void{ var _local2:PolyPointSup; super.select(); if (editorProxy.getSelectedObjects().length > 1){ return; }; tri.select(); var _local1:uint; while (_local1 < pointSups.length) { _local2 = pointSups[_local1]; _local2.select(); _local1++; }; type.select(); } override protected function destroySupportStuff():void{ var _local2:PolyPointSup; tri.destroy(); var _local1:uint; while (_local1 < pointSups.length) { _local2 = pointSups[_local1]; _local2.destroy(); _local1++; }; type.destroy(); } } }//package editor.view.components.obj
Section 159
//RectView (editor.view.components.obj.RectView) package editor.view.components.obj { import editor.model.*; import flash.display.*; import core.objects.*; import flash.geom.*; import editor.view.components.support.*; public class RectView extends ObjView { private var scale:RectScaleSup; private var rectObj:RectDef; private var type:PolyTypeSup; private var rotate:RectRotateSup; public function RectView(_arg1:RectDef):void{ rectObj = _arg1; super(_arg1); } override protected function createSupportStuff():void{ type = new PolyTypeSup(rectObj); scale = new RectScaleSup(rectObj); rotate = new RectRotateSup(rectObj); } override public function update():void{ super.update(); type.update(); scale.update(); rotate.update(); } override protected function updateSkin():void{ var _local1:Class; var _local5:Point; if (rectObj.type == BaseObjectDef.TYPE_BRICK){ _local1 = EditorAssets.getInstance().getAssetClass("BrickMaterial"); } else { if (rectObj.type == BaseObjectDef.TYPE_METAL){ _local1 = EditorAssets.getInstance().getAssetClass("MetallMaterial"); } else { _local1 = EditorAssets.getInstance().getAssetClass("HurtMaterial"); }; }; var _local2:BitmapData = (new _local1(0, 0) as BitmapData); skin.graphics.clear(); skin.graphics.beginBitmapFill(_local2, null, true, true); skin.graphics.lineStyle(0, 0, 1); var _local3:Point = rectObj.vertices[0]; skin.graphics.moveTo(_local3.x, _local3.y); var _local4:uint = 1; while (_local4 < rectObj.vertices.length) { _local5 = rectObj.vertices[_local4]; skin.graphics.lineTo(_local5.x, _local5.y); _local4++; }; skin.graphics.lineTo(_local3.x, _local3.y); skin.graphics.endFill(); } override protected function init():void{ super.init(); } override public function select():void{ super.select(); if (editorProxy.getSelectedObjects().length > 1){ return; }; type.select(); scale.select(); rotate.select(); } override public function deselect():void{ super.deselect(); type.deselect(); scale.deselect(); rotate.deselect(); } override protected function destroySupportStuff():void{ type.destroy(); scale.destroy(); rotate.destroy(); } } }//package editor.view.components.obj
Section 160
//RevJointView (editor.view.components.obj.RevJointView) package editor.view.components.obj { import editor.model.*; import flash.display.*; import core.objects.*; import editor.view.components.support.*; public class RevJointView extends ObjView { private var skinTorque:MovieClip; private var torque:RevJointTorqueSup; private var revJointObj:RevJointDef; public function RevJointView(_arg1:RevJointDef):void{ revJointObj = _arg1; super(_arg1); } override protected function createSupportStuff():void{ torque = new RevJointTorqueSup(revJointObj, skinTorque); } override public function update():void{ super.update(); torque.update(); } override protected function createSkin():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("RevJointAsset"); skin = new (_local1); addChild(skin); skinTorque = (skin.getChildByName("torque") as MovieClip); } override public function select():void{ super.select(); if (editorProxy.getSelectedObjects().length > 1){ return; }; torque.select(); } override public function deselect():void{ super.deselect(); torque.deselect(); } override protected function destroySupportStuff():void{ torque.destroy(); } } }//package editor.view.components.obj
Section 161
//SimpleView (editor.view.components.obj.SimpleView) package editor.view.components.obj { import editor.model.*; import flash.display.*; import core.objects.*; public class SimpleView extends ObjView { public function SimpleView(_arg1:BaseObjectDef):void{ super(_arg1); } override protected function createSkin():void{ var _local2:Class; super.createSkin(); var _local1:EditorAssets = EditorAssets.getInstance(); if ((obj is ExitDef)){ _local2 = _local1.getAssetClass("ExitAsset"); } else { if ((obj is ParticleDef)){ _local2 = _local1.getAssetClass("ParticleAsset"); } else { if ((obj is RevJointDef)){ _local2 = _local1.getAssetClass("RevJointAsset"); } else { if ((obj is MagnetDef)){ _local2 = _local1.getAssetClass("MagnetAsset"); } else { return; }; }; }; }; var _local3:Sprite = new (_local2); skin.addChild(_local3); } } }//package editor.view.components.obj
Section 162
//CircleScaleSup (editor.view.components.support.CircleScaleSup) package editor.view.components.support { import flash.events.*; import editor.model.*; import core.objects.*; public class CircleScaleSup extends ObjSup { private var radius:Number; private var circleObj:CircleDef; public function CircleScaleSup(_arg1:CircleDef):void{ circleObj = _arg1; super(_arg1); } override public function update():void{ x = (circleObj.x + circleObj.r); y = circleObj.y; } private function mouseUpHandler(_arg1:MouseEvent):void{ circleObj.r = radius; notesProxy.push(EditorProxy.OBJECT_UPDATE, circleObj); support.graphics.clear(); stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } override protected function createSkin():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("ScaleAsset"); skin = new (_local1); addChild(skin); support.addChild(this); } private function mouseDownHandler(_arg1:MouseEvent):void{ stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } private function mouseMoveHandler(_arg1:MouseEvent):void{ support.graphics.clear(); support.graphics.lineStyle(0, 1); radius = (support.mouseX - circleObj.x); if (radius < 1){ radius = 1; }; support.graphics.drawCircle(circleObj.x, circleObj.y, radius); } override public function destroy():void{ super.destroy(); removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } override protected function initListeners():void{ addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } } }//package editor.view.components.support
Section 163
//CircleTypeSup (editor.view.components.support.CircleTypeSup) package editor.view.components.support { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; public class CircleTypeSup extends ObjSup { private var circleObj:CircleDef; public function CircleTypeSup(_arg1:CircleDef){ circleObj = _arg1; super(_arg1); } override public function update():void{ x = (circleObj.x + circleObj.r); y = (circleObj.y - circleObj.r); } override public function destroy():void{ super.destroy(); removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } private function mouseDownHandler(_arg1:MouseEvent):void{ if (circleObj.type == BaseObjectDef.TYPE_HURT){ circleObj.type = BaseObjectDef.TYPE_METAL; } else { if (circleObj.type == BaseObjectDef.TYPE_METAL){ circleObj.type = BaseObjectDef.TYPE_BRICK; } else { circleObj.type = BaseObjectDef.TYPE_HURT; }; }; notesProxy.push(EditorProxy.OBJECT_UPDATE, circleObj); } override protected function createSkin():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("CircleTypeAsset"); var _local2:Sprite = new (_local1); addChild(_local2); support.addChild(this); buttonMode = true; } override protected function initListeners():void{ addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } } }//package editor.view.components.support
Section 164
//DistJointTargetSup (editor.view.components.support.DistJointTargetSup) package editor.view.components.support { import flash.events.*; import editor.model.*; import core.objects.*; public class DistJointTargetSup extends ObjSup { private var pos:String; private var jointObj:DistJointDef; public static const POS_FIRST:String = "PosFirst"; public static const POS_SECOND:String = "PosSecond"; public function DistJointTargetSup(_arg1:DistJointDef, _arg2:String):void{ jointObj = _arg1; this.pos = _arg2; super(_arg1); } override public function update():void{ if (pos == POS_FIRST){ x = jointObj.x1; y = jointObj.y1; } else { x = jointObj.x2; y = jointObj.y2; }; } private function mouseUpHandler(_arg1:MouseEvent):void{ var _local2:Number = support.mouseX; var _local3:Number = support.mouseY; if (pos == POS_FIRST){ jointObj.x1 = _local2; jointObj.y1 = _local3; } else { jointObj.x2 = _local2; jointObj.y2 = _local3; }; jointObj.x = (jointObj.x1 + ((jointObj.x2 - jointObj.x1) / 2)); jointObj.y = (jointObj.y1 + ((jointObj.y2 - jointObj.y1) / 2)); notesProxy.push(EditorProxy.OBJECT_UPDATE, jointObj); stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } private function mouseDownHandler(_arg1:MouseEvent):void{ stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } override protected function createSkin():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("JointAnchorAsset"); skin = new (_local1); addChild(skin); support.addChild(this); buttonMode = true; } private function mouseMoveHandler(_arg1:MouseEvent):void{ x = support.mouseX; y = support.mouseY; } override public function destroy():void{ super.destroy(); removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } override protected function initListeners():void{ addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } } }//package editor.view.components.support
Section 165
//MoveWallIdSup (editor.view.components.support.MoveWallIdSup) package editor.view.components.support { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; import flash.text.*; public class MoveWallIdSup extends ObjSup { private var id_tf:TextField; public function MoveWallIdSup(_arg1:BaseObjectDef):void{ super(_arg1); } override public function update():void{ x = (obj.x - 30); y = (obj.y - 30); } private function idKeyDownHandler(_arg1:KeyboardEvent):void{ } override protected function createSkin():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("MoveWallIdAsset"); var _local2:Sprite = new (_local1); addChild(_local2); support.addChild(this); id_tf = (_local2.getChildByName("id_tf") as TextField); buttonMode = true; } override public function destroy():void{ super.destroy(); } override protected function initListeners():void{ id_tf.text = "0"; } } }//package editor.view.components.support
Section 166
//ObjSup (editor.view.components.support.ObjSup) package editor.view.components.support { import editor.model.*; import game.model.*; import flash.display.*; import core.objects.*; import editor.view.components.*; import editor.view.*; public class ObjSup extends Sprite { protected var gridProxy:GridProxy; protected var notesProxy:NotesProxy; protected var support:Sprite; protected var skin:Sprite; public var obj:BaseObjectDef; public function ObjSup(_arg1:BaseObjectDef):void{ this.obj = _arg1; init(); } public function deselect():void{ visible = false; } public function update():void{ } public function destroy():void{ parent.removeChild(this); } protected function initListeners():void{ } protected function init():void{ var _local1:ApplicationFacade = ApplicationFacade.getInstance(); var _local2:EditorMediator = (_local1.retrieveMediator(EditorMediator.NAME) as EditorMediator); support = (_local2.getViewComponent() as EditorView).support; notesProxy = (_local1.retrieveProxy(NotesProxy.NAME) as NotesProxy); gridProxy = (_local1.retrieveProxy(GridProxy.NAME) as GridProxy); createSkin(); initListeners(); deselect(); } protected function createSkin():void{ } public function select():void{ visible = true; } } }//package editor.view.components.support
Section 167
//PolyPointSup (editor.view.components.support.PolyPointSup) package editor.view.components.support { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; import flash.geom.*; public class PolyPointSup extends ObjSup { private var vertex:Point; private var polyObj:PolyDef; private var skinSquare:Sprite; public function PolyPointSup(_arg1:PolyDef, _arg2:Point):void{ polyObj = _arg1; this.vertex = _arg2; super(_arg1); } private function squareMouseDownHandler(_arg1:MouseEvent):void{ stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } override public function destroy():void{ super.destroy(); skinSquare.removeEventListener(MouseEvent.MOUSE_DOWN, squareMouseDownHandler); } override public function update():void{ x = (vertex.x + polyObj.x); y = (vertex.y + polyObj.y); } private function mouseUpHandler(_arg1:MouseEvent):void{ vertex.x = (x - polyObj.x); vertex.y = (y - polyObj.y); notesProxy.push(EditorProxy.OBJECT_UPDATE, polyObj); stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } override protected function initListeners():void{ skinSquare.addEventListener(MouseEvent.MOUSE_DOWN, squareMouseDownHandler); } override protected function createSkin():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("PolyPointAsset"); skin = new (_local1); skinSquare = (skin.getChildByName("square") as Sprite); addChild(skin); support.addChild(this); skinSquare.buttonMode = true; } private function mouseMoveHandler(_arg1:MouseEvent):void{ var _local2:Point; _local2 = gridProxy.getSnapPoint(new Point(support.mouseX, support.mouseY)); x = _local2.x; y = _local2.y; } } }//package editor.view.components.support
Section 168
//PolyTriSup (editor.view.components.support.PolyTriSup) package editor.view.components.support { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; import flash.geom.*; import core.utils.*; public class PolyTriSup extends ObjSup { private var holst:Sprite; private var polyObj:PolyDef; public function PolyTriSup(_arg1:PolyDef):void{ polyObj = _arg1; super(_arg1); } private function clickHandler(_arg1:MouseEvent):void{ var _local7:Point; var _local2:Array = []; var _local3:Array = []; var _local4:int = (polyObj.vertices.length - 1); while (_local4 >= 0) { _local7 = polyObj.vertices[_local4]; _local2.push((polyObj.x + _local7.x)); _local3.push((polyObj.y + _local7.y)); _local4--; }; var _local5:Array = Polygon.triangulatePolygon(_local2, _local3, _local2.length); var _local6:Array = Polygon.polygonizeTriangles(_local5); drawPolygons(_local6); } private function drawTriangles(_arg1:Array):void{ var _local3:Triangle; holst.graphics.clear(); holst.graphics.lineStyle(0, 0xFF0000); var _local2:uint; while (_local2 < _arg1.length) { _local3 = _arg1[_local2]; holst.graphics.moveTo(_local3.x[0], _local3.y[0]); holst.graphics.lineTo(_local3.x[1], _local3.y[1]); holst.graphics.lineTo(_local3.x[2], _local3.y[2]); holst.graphics.lineTo(_local3.x[0], _local3.y[0]); _local2++; }; } override public function update():void{ var _local1:Rectangle = polyObj.getBoundingBox(); x = (_local1.x + _local1.width); y = _local1.y; holst.graphics.clear(); } private function tempPolygonize(_arg1:Array):Array{ var _local4:Triangle; var _local2:Array = []; var _local3:uint; while (_local3 < _arg1.length) { _local4 = _arg1[_local3]; _local2.push(new Polygon(_local4.x, _local4.y)); _local3++; }; return (_local2); } override protected function initListeners():void{ addEventListener(MouseEvent.CLICK, clickHandler); } override protected function createSkin():void{ holst = new Sprite(); support.addChild(holst); var _local1:Class = EditorAssets.getInstance().getAssetClass("ScaleAsset"); skin = new (_local1); addChild(skin); support.addChild(this); } override public function destroy():void{ super.destroy(); removeEventListener(MouseEvent.CLICK, clickHandler); } private function drawPolygons(_arg1:Array):void{ var _local3:Polygon; var _local4:uint; holst.graphics.clear(); holst.graphics.lineStyle(0, 0xFF0000); var _local2:uint; while (_local2 < _arg1.length) { _local3 = _arg1[_local2]; holst.graphics.moveTo(_local3.x[0], _local3.y[0]); trace("p", _local2, _local3.x[0], _local3.y[0]); _local4 = 1; while (_local4 < _local3.nVertices) { holst.graphics.lineTo(_local3.x[_local4], _local3.y[_local4]); trace("p", _local2, _local3.x[_local4], _local3.y[_local4]); _local4++; }; holst.graphics.lineTo(_local3.x[0], _local3.y[0]); _local2++; }; } } }//package editor.view.components.support
Section 169
//PolyTypeSup (editor.view.components.support.PolyTypeSup) package editor.view.components.support { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; import flash.geom.*; public class PolyTypeSup extends ObjSup { private var polyObj:PolyDef; public function PolyTypeSup(_arg1:PolyDef):void{ polyObj = _arg1; super(_arg1); } override public function update():void{ var _local1:Rectangle; _local1 = polyObj.getBoundingBox(); x = _local1.x; y = _local1.y; } override public function destroy():void{ super.destroy(); removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } override protected function createSkin():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("CircleTypeAsset"); var _local2:Sprite = new (_local1); addChild(_local2); support.addChild(this); buttonMode = true; } private function mouseDownHandler(_arg1:MouseEvent):void{ if (polyObj.type == BaseObjectDef.TYPE_HURT){ polyObj.type = BaseObjectDef.TYPE_METAL; } else { if (polyObj.type == BaseObjectDef.TYPE_METAL){ polyObj.type = BaseObjectDef.TYPE_BRICK; } else { polyObj.type = BaseObjectDef.TYPE_HURT; }; }; notesProxy.push(EditorProxy.OBJECT_UPDATE, polyObj); } override protected function initListeners():void{ addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } } }//package editor.view.components.support
Section 170
//RectRotateSup (editor.view.components.support.RectRotateSup) package editor.view.components.support { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; import flash.geom.*; public class RectRotateSup extends ObjSup { private var holst:Sprite; private var rectObj:RectDef; public function RectRotateSup(_arg1:RectDef):void{ rectObj = _arg1; super(_arg1); } override public function update():void{ var _local1:Point; _local1 = rectObj.vertices[1]; x = (rectObj.x + _local1.x); y = (rectObj.y + _local1.y); } private function mouseUpHandler(_arg1:MouseEvent):void{ holst.parent.removeChild(holst); rectObj.setRotation(holst.rotation); notesProxy.push(EditorProxy.OBJECT_UPDATE, rectObj); stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } private function mouseDownHandler(_arg1:MouseEvent):void{ holst = new Sprite(); holst.x = rectObj.x; holst.y = rectObj.y; support.addChild(holst); stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } private function mouseMoveHandler(_arg1:MouseEvent):void{ var _local2:Number = Math.atan2((support.mouseY - rectObj.y), (support.mouseX - rectObj.x)); holst.rotation = ((_local2 * 180) / Math.PI); holst.graphics.clear(); holst.graphics.lineStyle(0, 1); holst.graphics.drawRect(0, 0, rectObj.width, rectObj.height); } override public function destroy():void{ super.destroy(); removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } override protected function createSkin():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("RotateAsset"); skin = new (_local1); addChild(skin); support.addChild(this); } override protected function initListeners():void{ addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } } }//package editor.view.components.support
Section 171
//RectScaleSup (editor.view.components.support.RectScaleSup) package editor.view.components.support { import flash.events.*; import editor.model.*; import core.objects.*; import flash.geom.*; import Box2D.Common.Math.*; public class RectScaleSup extends ObjSup { private var h:Number; private var rectObj:RectDef; private var w:Number; public function RectScaleSup(_arg1:RectDef):void{ rectObj = _arg1; super(_arg1); } override public function destroy():void{ super.destroy(); removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } private function mouseDownHandler(_arg1:MouseEvent):void{ stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } override public function update():void{ var _local1:Point = rectObj.vertices[2]; x = (rectObj.x + _local1.x); y = (rectObj.y + _local1.y); } private function mouseUpHandler(_arg1:MouseEvent):void{ rectObj.setDimensions(w, h); notesProxy.push(EditorProxy.OBJECT_UPDATE, rectObj); support.graphics.clear(); stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } override protected function initListeners():void{ addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } private function mouseMoveHandler(_arg1:MouseEvent):void{ var _local2:Number = support.mouseX; var _local3:Number = support.mouseY; support.graphics.clear(); support.graphics.lineStyle(0, 1); var _local4:b2Vec2 = new b2Vec2(1, 0); var _local5:b2Mat22 = new b2Mat22(((rectObj.rotation * Math.PI) / 180)); _local4 = b2Math.b2MulMV(_local5, _local4); var _local6:b2Vec2 = new b2Vec2((_local2 - rectObj.x), (_local3 - rectObj.y)); var _local7:Number = b2Math.b2Dot(_local6, _local4); _local4.Multiply(_local7); w = _local4.Length(); support.graphics.moveTo(rectObj.x, rectObj.y); support.graphics.lineTo((rectObj.x + _local4.x), (rectObj.y + _local4.y)); support.graphics.lineTo(_local2, _local3); _local4 = new b2Vec2(1, 0); _local5 = new b2Mat22((((rectObj.rotation + 90) * Math.PI) / 180)); _local4 = b2Math.b2MulMV(_local5, _local4); _local7 = b2Math.b2Dot(_local6, _local4); _local4.Multiply(_local7); support.graphics.lineTo((rectObj.x + _local4.x), (rectObj.y + _local4.y)); support.graphics.lineTo(rectObj.x, rectObj.y); h = _local4.Length(); } override protected function createSkin():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("ScaleAsset"); skin = new (_local1); addChild(skin); support.addChild(this); } } }//package editor.view.components.support
Section 172
//RevJointTorqueSup (editor.view.components.support.RevJointTorqueSup) package editor.view.components.support { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; public class RevJointTorqueSup extends ObjSup { private var skinTorque:MovieClip; private var revJointObj:RevJointDef; private var skinBar:Sprite; public function RevJointTorqueSup(_arg1:RevJointDef, _arg2:MovieClip):void{ revJointObj = _arg1; this.skinTorque = _arg2; super(_arg1); } private function mouseDownHandler(_arg1:MouseEvent):void{ stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } override public function update():void{ x = revJointObj.x; y = (revJointObj.y - 20); skinBar.scaleX = revJointObj.torque; } private function mouseUpHandler(_arg1:MouseEvent):void{ stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); revJointObj.torque = skinBar.scaleX; notesProxy.push(EditorProxy.OBJECT_UPDATE, revJointObj); } override protected function initListeners():void{ addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } private function mouseMoveHandler(_arg1:MouseEvent):void{ var _local2:Number = skin.mouseX; if (_local2 > 50){ _local2 = 50; }; if (_local2 < -50){ _local2 = -50; }; _local2 = (Math.round((_local2 / 5)) * 5); skinBar.scaleX = (_local2 / 50); } override protected function createSkin():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("RevJointTorqueAsset"); skin = new (_local1); addChild(skin); support.addChild(this); skinBar = (skin.getChildByName("bar") as Sprite); buttonMode = true; } override public function destroy():void{ super.destroy(); removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } } }//package editor.view.components.support
Section 173
//CircleTool (editor.view.components.tools.CircleTool) package editor.view.components.tools { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; public class CircleTool extends ToolView { private var circle:Sprite; public function CircleTool(_arg1:Sprite, _arg2:Tool):void{ super(_arg1, _arg2); } override protected function mouseMoveHandler(_arg1:MouseEvent):void{ circle.graphics.clear(); circle.graphics.lineStyle(0, 0); circle.graphics.drawCircle(0, 0, Math.round(circle.mouseX)); } override protected function init():void{ super.init(); } override protected function mouseUpHandler(_arg1:MouseEvent):void{ var _local3:CircleDef; super.mouseUpHandler(_arg1); circle.parent.removeChild(circle); var _local2:Number = Math.round((circle.width / 2)); if (_local2 > 0){ _local3 = new CircleDef(circle.x, circle.y, _local2, BaseObjectDef.TYPE_BRICK); notesProxy.push(EditorProxy.OBJECT_ADD, _local3); }; } override protected function canvasMouseDownHandler(_arg1:MouseEvent):void{ super.canvasMouseDownHandler(_arg1); circle = new Sprite(); circle.x = Math.round(canvas.mouseX); circle.y = Math.round(canvas.mouseY); bodies.addChild(circle); } } }//package editor.view.components.tools
Section 174
//DistJointTool (editor.view.components.tools.DistJointTool) package editor.view.components.tools { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; import flash.geom.*; public class DistJointTool extends ToolView { private var y1:Number; private var x1:Number; public function DistJointTool(_arg1:Sprite, _arg2:Tool):void{ super(_arg1, _arg2); } override protected function mouseMoveHandler(_arg1:MouseEvent):void{ canvasTop.graphics.clear(); canvasTop.graphics.lineStyle(2, 0xFFFF00); canvasTop.graphics.moveTo(x1, y1); var _local2:Point = new Point(canvas.mouseX, canvas.mouseY); canvasTop.graphics.lineTo(_local2.x, _local2.y); } override protected function mouseUpHandler(_arg1:MouseEvent):void{ var _local3:Number; var _local4:Number; super.mouseUpHandler(_arg1); canvasTop.graphics.clear(); var _local2:Point = new Point(canvas.mouseX, canvas.mouseY); _local3 = _local2.x; _local4 = _local2.y; var _local5:ParticleDef = getParticle(x1, y1); if (_local5){ x1 = _local5.x; y1 = _local5.y; }; var _local6:ParticleDef = getParticle(_local3, _local4); if (_local6){ _local3 = _local6.x; _local4 = _local6.y; }; var _local7:Number = (x1 + ((_local3 - x1) / 2)); var _local8:Number = (y1 + ((_local4 - y1) / 2)); var _local9:DistJointDef = new DistJointDef(_local7, _local8, x1, y1, _local3, _local4); notesProxy.push(EditorProxy.OBJECT_ADD, _local9); } override protected function canvasMouseDownHandler(_arg1:MouseEvent):void{ super.canvasMouseDownHandler(_arg1); x1 = canvas.mouseX; y1 = canvas.mouseY; } private function getParticle(_arg1:Number, _arg2:Number):ParticleDef{ var _local5:BaseObjectDef; var _local3:Array = editorProxy.getObjects(); var _local4:uint; while (_local4 < _local3.length) { _local5 = _local3[_local4]; if ((_local5 is ParticleDef)){ if (_local5.isPointInside(new Point(_arg1, _arg2))){ return ((_local5 as ParticleDef)); }; }; _local4++; }; return (null); } } }//package editor.view.components.tools
Section 175
//PolyTool (editor.view.components.tools.PolyTool) package editor.view.components.tools { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; import flash.geom.*; import geom.*; public class PolyTool extends ToolView { private var mx:Number; private var my:Number; private var vertices:Array; private var poly:Sprite; public function PolyTool(_arg1:Sprite, _arg2:Tool):void{ super(_arg1, _arg2); } private function closePoly():void{ var _local2:uint; var _local6:Point; poly.parent.removeChild(poly); canvas.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); canvas.removeEventListener(MouseEvent.MOUSE_DOWN, canvasMousDownHandler); var _local1:Array = []; _local2 = 0; while (_local2 < vertices.length) { _local1.push(new Vector(vertices[_local2].x, vertices[_local2].y)); _local2++; }; var _local3:GeomPoly = new GeomPoly(_local1); if (_local3.isReversed){ vertices.reverse(); }; var _local4:Point = (vertices[0] as Point).clone(); _local2 = 0; while (_local2 < vertices.length) { _local6 = vertices[_local2]; vertices[_local2].x = (_local6.x - _local4.x); _local6.y = (_local6.y - _local4.y); _local2++; }; var _local5:PolyDef = new PolyDef(_local4.x, _local4.y, vertices, BaseObjectDef.TYPE_BRICK); notesProxy.push(EditorProxy.OBJECT_ADD, _local5); } override protected function init():void{ super.init(); } override protected function mouseMoveHandler(_arg1:MouseEvent):void{ var _local3:Point; var _local4:uint; var _local5:Number; var _local2:Point = gridProxy.getSnapPoint(new Point(canvas.mouseX, canvas.mouseY)); mx = _local2.x; my = _local2.y; if (vertices.length > 0){ poly.graphics.clear(); poly.graphics.lineStyle(0, 0); _local3 = vertices[0]; poly.graphics.moveTo(_local3.x, _local3.y); _local4 = 1; while (_local4 < vertices.length) { _local3 = vertices[_local4]; poly.graphics.lineTo(_local3.x, _local3.y); _local4++; }; _local5 = Math.sqrt((((vertices[0].x - mx) * (vertices[0].x - mx)) + ((vertices[0].y - my) * (vertices[0].y - my)))); if (_local5 < 5){ mx = vertices[0].x; my = vertices[0].y; }; poly.graphics.lineTo(mx, my); }; } private function canvasMousDownHandler(_arg1:MouseEvent):void{ var _local2:Point = gridProxy.getSnapPoint(new Point(mx, my)); if (vertices.length > 0){ if ((((_local2.x == vertices[0].x)) && ((_local2.y == vertices[0].y)))){ closePoly(); select(); } else { vertices.push(_local2); }; } else { vertices.push(_local2); }; } override public function select():void{ windowBack.gotoAndStop(2); vertices = []; poly = new Sprite(); bodies.addChild(poly); canvas.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); canvas.addEventListener(MouseEvent.MOUSE_DOWN, canvasMousDownHandler); } override public function deselect():void{ windowBack.gotoAndStop(1); poly.parent.removeChild(poly); canvas.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); canvas.removeEventListener(MouseEvent.MOUSE_DOWN, canvasMousDownHandler); } } }//package editor.view.components.tools
Section 176
//RectTool (editor.view.components.tools.RectTool) package editor.view.components.tools { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; public class RectTool extends ToolView { private var rect:Sprite; public function RectTool(_arg1:Sprite, _arg2:Tool):void{ super(_arg1, _arg2); } override protected function init():void{ super.init(); } override protected function mouseUpHandler(_arg1:MouseEvent):void{ var _local6:RectDef; super.mouseUpHandler(_arg1); rect.parent.removeChild(rect); var _local2:Number = ((rect.x < canvas.mouseX)) ? rect.x : canvas.mouseX; var _local3:Number = ((rect.y < canvas.mouseY)) ? rect.y : canvas.mouseY; var _local4:Number = rect.width; var _local5:Number = rect.height; if ((((_local4 > 0)) && ((_local5 > 0)))){ _local6 = new RectDef(_local2, _local3, _local4, _local5, BaseObjectDef.TYPE_BRICK, 0); notesProxy.push(EditorProxy.OBJECT_ADD, _local6); }; } override protected function canvasMouseDownHandler(_arg1:MouseEvent):void{ super.canvasMouseDownHandler(_arg1); rect = new Sprite(); rect.x = canvas.mouseX; rect.y = canvas.mouseY; bodies.addChild(rect); } override protected function mouseMoveHandler(_arg1:MouseEvent):void{ rect.graphics.clear(); rect.graphics.lineStyle(0, 0); var _local2:Number = rect.mouseX; var _local3:Number = rect.mouseY; rect.graphics.drawRect(0, 0, _local2, _local3); } } }//package editor.view.components.tools
Section 177
//SelectionTool (editor.view.components.tools.SelectionTool) package editor.view.components.tools { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; import flash.geom.*; import flash.ui.*; public class SelectionTool extends ToolView { private var startPoint:Point; public function SelectionTool(_arg1:Sprite, _arg2:Tool):void{ super(_arg1, _arg2); } private function translateMouseMoveHandler(_arg1:MouseEvent):void{ var _local7:BaseObjectDef; var _local8:Rectangle; var _local2:Array = editorProxy.getSelectedObjects(); canvasTop.graphics.clear(); canvasTop.graphics.lineStyle(0, 0, 0.5); var _local3:Point = new Point(Math.round(canvas.mouseX), Math.round(canvas.mouseY)); var _local4:Number = (_local3.x - startPoint.x); var _local5:Number = (_local3.y - startPoint.y); var _local6:uint; while (_local6 < _local2.length) { _local7 = _local2[_local6]; _local8 = _local7.getBoundingBox(); canvasTop.graphics.drawRect((_local8.x + _local4), (_local8.y + _local5), _local8.width, _local8.height); _local6++; }; } private function translateObjects(_arg1:Number, _arg2:Number):void{ var _local4:uint; var _local5:BaseObjectDef; var _local3:Array = editorProxy.getSelectedObjects(); if (_local3.length != 0){ _local4 = 0; while (_local4 < _local3.length) { _local5 = _local3[_local4]; _local5.translate(_arg1, _arg2); notesProxy.push(EditorProxy.OBJECT_UPDATE, _local5); _local4++; }; }; } private function keyDownHandler(_arg1:KeyboardEvent):void{ var _local2:Point = new Point(0, 0); if (_arg1.keyCode == Keyboard.LEFT){ translateObjects(-1, 0); } else { if (_arg1.keyCode == Keyboard.RIGHT){ translateObjects(1, 0); } else { if (_arg1.keyCode == Keyboard.UP){ translateObjects(0, -1); } else { if (_arg1.keyCode == Keyboard.DOWN){ translateObjects(0, 1); } else { if (_arg1.keyCode == Keyboard.DELETE){ removeObjects(); } else { return; }; }; }; }; }; } override protected function mouseUpHandler(_arg1:MouseEvent):void{ var _local4:uint; var _local5:BaseObjectDef; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Rectangle; var _local11:Array; super.mouseUpHandler(_arg1); canvasTop.graphics.clear(); var _local2:Point = new Point(canvas.mouseX, canvas.mouseY); var _local3:Array = editorProxy.getSelectedObjects(); if (_local3.length != 0){ _local4 = 0; while (_local4 < _local3.length) { _local5 = _local3[_local4]; _local5.translate((_local2.x - startPoint.x), (_local2.y - startPoint.y)); notesProxy.push(EditorProxy.OBJECT_UPDATE, _local5); _local4++; }; canvas.stage.removeEventListener(MouseEvent.MOUSE_MOVE, translateMouseMoveHandler); } else { canvas.stage.removeEventListener(MouseEvent.MOUSE_MOVE, selectMouseMoveHandler); _local6 = ((_local2.x > startPoint.x)) ? startPoint.x : _local2.x; _local7 = ((_local2.y > startPoint.y)) ? startPoint.y : _local2.y; _local8 = Math.abs((_local2.x - startPoint.x)); _local9 = Math.abs((_local2.y - startPoint.y)); _local10 = new Rectangle(_local6, _local7, _local8, _local9); _local11 = editorProxy.getObjsUnderRect(_local10); notesProxy.push(EditorProxy.OBJECTS_SELECT, _local11); }; } override protected function init():void{ super.init(); } private function selectMouseMoveHandler(_arg1:MouseEvent):void{ var _local2:Number = (canvas.mouseX - startPoint.x); var _local3:Number = (canvas.mouseY - startPoint.y); canvasTop.graphics.clear(); canvasTop.graphics.lineStyle(0, 0); canvasTop.graphics.beginFill(6710937, 0.3); canvasTop.graphics.drawRect(startPoint.x, startPoint.y, _local2, _local3); canvasTop.graphics.endFill(); } override protected function canvasMouseDownHandler(_arg1:MouseEvent):void{ var _local3:Array; super.canvasMouseDownHandler(_arg1); startPoint = new Point(canvas.mouseX, canvas.mouseY); var _local2:BaseObjectDef = editorProxy.getObjUnderPoint(new Point(canvas.mouseX, canvas.mouseY)); if (_local2){ _local3 = editorProxy.getSelectedObjects(); if (_local3.indexOf(_local2) == -1){ notesProxy.push(EditorProxy.OBJECTS_SELECT, [_local2]); }; canvas.stage.addEventListener(MouseEvent.MOUSE_MOVE, translateMouseMoveHandler); } else { notesProxy.push(EditorProxy.OBJECTS_SELECT, []); canvas.stage.addEventListener(MouseEvent.MOUSE_MOVE, selectMouseMoveHandler); }; } override public function select():void{ super.select(); window.stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); } override public function deselect():void{ super.deselect(); window.stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); } private function removeObjects():void{ var _local4:BaseObjectDef; var _local5:BaseObjectDef; var _local1:Array = editorProxy.getSelectedObjects(); var _local2:Array = []; var _local3:uint; while (_local3 < _local1.length) { _local4 = _local1[_local3]; if ((_local4 is ExitDef)){ } else { _local2.push(_local4); }; _local3++; }; while (_local2.length > 0) { _local5 = _local2.pop(); notesProxy.push(EditorProxy.OBJECT_REMOVE, _local5); }; } } }//package editor.view.components.tools
Section 178
//SimpleTool (editor.view.components.tools.SimpleTool) package editor.view.components.tools { import flash.events.*; import editor.model.*; import flash.display.*; import core.objects.*; public class SimpleTool extends ToolView { public function SimpleTool(_arg1:Sprite, _arg2:Tool):void{ super(_arg1, _arg2); } override protected function mouseUpHandler(_arg1:MouseEvent):void{ var _local2:BaseObjectDef; super.mouseUpHandler(_arg1); var _local3:Number = canvas.mouseX; var _local4:Number = canvas.mouseY; if (tool.type == Tool.TYPE_EXIT){ _local2 = new ExitDef(_local3, _local4); } else { if (tool.type == Tool.TYPE_REV_JOINT){ _local2 = new RevJointDef(_local3, _local4); } else { if (tool.type == Tool.TYPE_PARTICLE){ _local2 = new ParticleDef(_local3, _local4); } else { if (tool.type == Tool.TYPE_MAGNET){ _local2 = new MagnetDef(_local3, _local4); } else { return; }; }; }; }; notesProxy.push(EditorProxy.OBJECT_ADD, _local2); } } }//package editor.view.components.tools
Section 179
//ToolView (editor.view.components.tools.ToolView) package editor.view.components.tools { import flash.events.*; import editor.model.*; import game.model.*; import flash.display.*; import editor.view.components.*; import editor.view.*; public class ToolView extends EventDispatcher { protected var bodies:Sprite; protected var editorProxy:EditorProxy; protected var windowBack:MovieClip; protected var gridProxy:GridProxy; public var tool:Tool; protected var canvasTop:Sprite; protected var canvasBack:Sprite; protected var facade:ApplicationFacade; protected var canvas:Sprite; protected var notesProxy:NotesProxy; protected var window:Sprite; public static const SELECT:String = "Select"; public function ToolView(_arg1:Sprite, _arg2:Tool):void{ this.window = _arg1; this.tool = _arg2; init(); } protected function mouseUpHandler(_arg1:MouseEvent):void{ canvas.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); canvas.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } protected function init():void{ windowBack = (window.getChildByName("back") as MovieClip); windowBack.stop(); window.addEventListener(MouseEvent.CLICK, windowClickHandler); facade = ApplicationFacade.getInstance(); var _local1:EditorMediator = (facade.retrieveMediator(EditorMediator.NAME) as EditorMediator); var _local2:EditorView = (_local1.getViewComponent() as EditorView); var _local3:ObjectsMediator = (facade.retrieveMediator(ObjectsMediator.NAME) as ObjectsMediator); var _local4:ObjectsView = (_local3.getViewComponent() as ObjectsView); canvas = _local2.canvas; canvasBack = _local2.canvasBack; canvasTop = _local2.canvasTop; bodies = _local4.bodies; notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); editorProxy = (facade.retrieveProxy(EditorProxy.NAME) as EditorProxy); gridProxy = (facade.retrieveProxy(GridProxy.NAME) as GridProxy); } protected function mouseMoveHandler(_arg1:MouseEvent):void{ } protected function canvasMouseDownHandler(_arg1:MouseEvent):void{ canvas.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); canvas.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } protected function windowClickHandler(_arg1:MouseEvent):void{ dispatchEvent(new Event(SELECT)); } public function select():void{ windowBack.gotoAndStop(2); canvas.addEventListener(MouseEvent.MOUSE_DOWN, canvasMouseDownHandler); } public function deselect():void{ windowBack.gotoAndStop(1); canvas.removeEventListener(MouseEvent.MOUSE_DOWN, canvasMouseDownHandler); } } }//package editor.view.components.tools
Section 180
//EditorView (editor.view.components.EditorView) package editor.view.components { import editor.model.*; import flash.display.*; import flash.text.*; public class EditorView extends Sprite { public var grid:Sprite; public var needParticles_tf:TextField; public var load_bt:SimpleButton; public var support:Sprite; public var gridHolder:Sprite; public var save_bt:SimpleButton; public var canvas:Sprite; public var tools:Sprite; public var canvasTop:Sprite; public var canvasBack:Sprite; public var zoom_tf:TextField; public var totalParticles_tf:TextField; private var window:Sprite; public var menu_bt:SimpleButton; public var play_bt:SimpleButton; public var props:Sprite; public function EditorView():void{ init(); } private function init():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("EditorWindow"); window = new (_local1); addChild(window); canvas = (window.getChildByName("canvas") as Sprite); canvasBack = (canvas.getChildByName("back") as Sprite); canvasTop = (canvas.getChildByName("canvasTop") as Sprite); tools = (window.getChildByName("tools") as Sprite); props = (window.getChildByName("props") as Sprite); support = (window.getChildByName("support") as Sprite); grid = (canvas.getChildByName("grid") as Sprite); play_bt = (window.getChildByName("play_bt") as SimpleButton); save_bt = (window.getChildByName("save_bt") as SimpleButton); load_bt = (window.getChildByName("load_bt") as SimpleButton); menu_bt = (window.getChildByName("menu_bt") as SimpleButton); zoom_tf = (window.getChildByName("zoom_tf") as TextField); gridHolder = (window.getChildByName("gridHolder") as Sprite); totalParticles_tf = (window.getChildByName("totalParticles_tf") as TextField); needParticles_tf = (window.getChildByName("needParticles_tf") as TextField); } } }//package editor.view.components
Section 181
//ELevelCompleteView (editor.view.components.ELevelCompleteView) package editor.view.components { import editor.model.*; import flash.display.*; public class ELevelCompleteView extends Sprite { private var window:Sprite; public var restart_bt:SimpleButton; public var contentMask:Sprite; public var editor_bt:SimpleButton; public function ELevelCompleteView():void{ init(); } private function init():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("LevelCompleteWindow"); window = (new (_local1) as Sprite); addChild(window); contentMask = (window.getChildByName("_mask") as Sprite); restart_bt = (window.getChildByName("restart_bt") as SimpleButton); editor_bt = (window.getChildByName("editor_bt") as SimpleButton); tabChildren = false; } } }//package editor.view.components
Section 182
//GridView (editor.view.components.GridView) package editor.view.components { import flash.display.*; public class GridView { public var window:Sprite; public var snapToGrid:MovieClip; public var grid:MovieClip; public function GridView(_arg1:Sprite):void{ this.window = _arg1; init(); } private function init():void{ grid = (window.getChildByName("grid") as MovieClip); snapToGrid = (window.getChildByName("snapToGrid") as MovieClip); } } }//package editor.view.components
Section 183
//LevelLoadView (editor.view.components.LevelLoadView) package editor.view.components { import editor.model.*; import flash.display.*; import flash.text.*; public class LevelLoadView extends Sprite { private var window:Sprite; public var levelDef_tf:TextField; public var load_bt:SimpleButton; public var cancel_bt:SimpleButton; public function LevelLoadView():void{ init(); } private function init():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("LevelLoadWindow"); window = new (_local1); addChild(window); levelDef_tf = (window.getChildByName("levelDef_tf") as TextField); load_bt = (window.getChildByName("load_bt") as SimpleButton); cancel_bt = (window.getChildByName("cancel_bt") as SimpleButton); } } }//package editor.view.components
Section 184
//LevelSaveView (editor.view.components.LevelSaveView) package editor.view.components { import editor.model.*; import flash.display.*; import flash.text.*; public class LevelSaveView extends Sprite { private var window:Sprite; public var levelDef_tf:TextField; public var close_bt:SimpleButton; public function LevelSaveView():void{ init(); } private function init():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("LevelSaveWindow"); window = new (_local1); addChild(window); levelDef_tf = (window.getChildByName("levelDef_tf") as TextField); close_bt = (window.getChildByName("close_bt") as SimpleButton); } } }//package editor.view.components
Section 185
//LevelTestView (editor.view.components.LevelTestView) package editor.view.components { import editor.model.*; import flash.display.*; import flash.text.*; public class LevelTestView extends Sprite { public var need_tf:TextField; public var restart_bt:SimpleButton; public var levelContainer:Sprite; public var bottom:Sprite; public var collected_tf:TextField; private var window:Sprite; public var back_bt:SimpleButton; public var debug:Sprite; public var objects:Sprite; public var top:Sprite; public var tools:Sprite; public function LevelTestView():void{ init(); } private function init():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("LevelTestWindow"); window = new (_local1); addChild(window); levelContainer = (window.getChildByName("levelContainer") as Sprite); bottom = (levelContainer.getChildByName("bottom") as Sprite); objects = (levelContainer.getChildByName("objects") as Sprite); tools = (levelContainer.getChildByName("tools") as Sprite); top = (levelContainer.getChildByName("top") as Sprite); debug = (levelContainer.getChildByName("debug") as Sprite); back_bt = (window.getChildByName("back_bt") as SimpleButton); restart_bt = (window.getChildByName("restart_bt") as SimpleButton); collected_tf = (window.getChildByName("collected_tf") as TextField); need_tf = (window.getChildByName("need_tf") as TextField); } } }//package editor.view.components
Section 186
//ObjectsView (editor.view.components.ObjectsView) package editor.view.components { import flash.display.*; public class ObjectsView { public var window:Sprite; public var player:Sprite; public var bodies:Sprite; public var joints:Sprite; public var bottom:Sprite; public function ObjectsView(_arg1:Sprite):void{ this.window = _arg1; init(); } private function init():void{ bottom = (window.getChildByName("bottom") as Sprite); bodies = (window.getChildByName("bodies") as Sprite); player = (window.getChildByName("player") as Sprite); joints = (window.getChildByName("joints") as Sprite); } } }//package editor.view.components
Section 187
//ToolsView (editor.view.components.ToolsView) package editor.view.components { import flash.display.*; public class ToolsView { public var magnetTool:Sprite; public var rectTool:Sprite; public var selectionTool:Sprite; public var revJointTool:Sprite; public var polyTool:Sprite; public var particleTool:Sprite; public var circleTool:Sprite; public var window:Sprite; public var distJointTool:Sprite; public var bonusTool:Sprite; public function ToolsView(_arg1:Sprite):void{ this.window = _arg1; init(); } private function init():void{ selectionTool = (window.getChildByName("selection") as Sprite); circleTool = (window.getChildByName("circle") as Sprite); rectTool = (window.getChildByName("rect") as Sprite); distJointTool = (window.getChildByName("distJoint") as Sprite); bonusTool = (window.getChildByName("bonus") as Sprite); revJointTool = (window.getChildByName("revJoint") as Sprite); polyTool = (window.getChildByName("poly") as Sprite); particleTool = (window.getChildByName("particle") as Sprite); magnetTool = (window.getChildByName("magnet") as Sprite); } } }//package editor.view.components
Section 188
//EditorMediator (editor.view.EditorMediator) package editor.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import editor.model.*; import game.model.*; import core.objects.*; import editor.view.components.*; import game.view.*; import org.puremvc.as3.patterns.mediator.*; public class EditorMediator extends Mediator implements IMediator { private var _view:EditorView; private var particlesNum:int; public static const NAME:String = "EditorMediator"; public function EditorMediator(_arg1:EditorView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([EditorProxy.OBJECT_ADD, EditorProxy.OBJECT_REMOVE]); } private function menuClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(EditorProxy.EDITOR_CLOSE); } override public function onRegister():void{ var _local1:GridView = new GridView(_view.gridHolder); var _local2:GridMediator = new GridMediator(_local1); facade.registerMediator(_local2); var _local3:ObjectsView = new ObjectsView(_view.canvas); var _local4:ObjectsMediator = new ObjectsMediator(_local3); facade.registerMediator(_local4); var _local5:ToolsView = new ToolsView(_view.tools); var _local6:ToolsMediator = new ToolsMediator(_local5); facade.registerMediator(_local6); _view.props.visible = false; _view.play_bt.addEventListener(MouseEvent.CLICK, playClickHandler); _view.save_bt.addEventListener(MouseEvent.CLICK, saveClickHandler); _view.load_bt.addEventListener(MouseEvent.CLICK, loadClickHandler); _view.menu_bt.addEventListener(MouseEvent.CLICK, menuClickHandler); } private function objectRemove(_arg1:BaseObjectDef):void{ if ((_arg1 is ParticleDef)){ particlesNum--; _view.totalParticles_tf.text = particlesNum.toString(); }; } private function loadClickHandler(_arg1:MouseEvent):void{ var _local2:LevelLoadView = new LevelLoadView(); var _local3:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); _local3.getViewContainer().addChild(_local2); var _local4:LevelLoadMediator = new LevelLoadMediator(_local2); facade.registerMediator(_local4); } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case EditorProxy.OBJECT_ADD: objectAdd((_arg1.getBody() as BaseObjectDef)); break; case EditorProxy.OBJECT_REMOVE: objectRemove((_arg1.getBody() as BaseObjectDef)); break; }; } private function init():void{ _view = (getViewComponent() as EditorView); particlesNum = 0; } private function objectAdd(_arg1:BaseObjectDef):void{ if ((_arg1 is ParticleDef)){ particlesNum++; _view.totalParticles_tf.text = particlesNum.toString(); }; } private function playClickHandler(_arg1:MouseEvent):void{ var _local2:LevelProxy = (facade.retrieveProxy(LevelProxy.NAME) as LevelProxy); _local2.needParticles = int(_view.needParticles_tf.text); var _local3:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local3.push(EditorProxy.LEVEL_TEST); } public function destroy():void{ var _local1:GridMediator = (facade.retrieveMediator(GridMediator.NAME) as GridMediator); _local1.destroy(); var _local2:ObjectsMediator = (facade.retrieveMediator(ObjectsMediator.NAME) as ObjectsMediator); _local2.destroy(); var _local3:ToolsMediator = (facade.retrieveMediator(ToolsMediator.NAME) as ToolsMediator); _local3.destroy(); _view.play_bt.removeEventListener(MouseEvent.CLICK, playClickHandler); _view.save_bt.removeEventListener(MouseEvent.CLICK, saveClickHandler); _view.load_bt.removeEventListener(MouseEvent.CLICK, loadClickHandler); _view.menu_bt.removeEventListener(MouseEvent.CLICK, menuClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function zoomKeyDownHandler(_arg1:KeyboardEvent):void{ var _local2:Number; if (_arg1.keyCode == 13){ _local2 = Number(_view.zoom_tf.text); _view.canvas.scaleX = (_view.canvas.scaleY = (_local2 / 100)); }; } private function saveClickHandler(_arg1:MouseEvent):void{ var _local2:LevelSaveView = new LevelSaveView(); var _local3:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); _local3.getViewContainer().addChild(_local2); var _local4:LevelSaveMediator = new LevelSaveMediator(_local2); facade.registerMediator(_local4); } } }//package editor.view
Section 189
//ELevelCompleteMediator (editor.view.ELevelCompleteMediator) package editor.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import editor.model.*; import game.model.*; import editor.view.components.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; public class ELevelCompleteMediator extends Mediator implements IMediator { private var _view:ELevelCompleteView; public static const NAME:String = "ELevelCompleetMediator"; public function ELevelCompleteMediator(_arg1:ELevelCompleteView):void{ super(NAME, _arg1); init(); } private function init():void{ _view = (getViewComponent() as ELevelCompleteView); _view.contentMask.scaleY = 0; Tweener.addTween(_view.contentMask, {scaleY:1, time:0.5, transition:"easeoutquad"}); _view.restart_bt.addEventListener(MouseEvent.CLICK, restartClickHandler); _view.editor_bt.addEventListener(MouseEvent.CLICK, editorClickHandler); } private function restartClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(EditorProxy.LEVEL_QUIT); _local2.push(EditorProxy.LEVEL_TEST); destroy(); } override public function listNotificationInterests():Array{ return ([]); } private function destroy():void{ _view.parent.removeChild(_view); facade.removeMediator(NAME); } override public function handleNotification(_arg1:INotification):void{ } private function editorClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(EditorProxy.LEVEL_QUIT); destroy(); } } }//package editor.view
Section 190
//GridMediator (editor.view.GridMediator) package editor.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import editor.model.*; import flash.display.*; import editor.view.components.*; import org.puremvc.as3.patterns.mediator.*; public class GridMediator extends Mediator implements IMediator { private var gridProxy:GridProxy; private var _view:GridView; private var holst:Sprite; public static const NAME:String = "GridMediator"; public function GridMediator(_arg1:GridView):void{ super(NAME, _arg1); init(); } override public function onRegister():void{ } override public function listNotificationInterests():Array{ return ([]); } private function drawGrid():void{ var _local4:uint; var _local1:uint = Math.round((640 / gridProxy.cellWidth)); var _local2:uint = Math.round((480 / gridProxy.cellHeight)); var _local3:Graphics = holst.graphics; _local3.clear(); _local3.lineStyle(0, 0, 0.4); _local4 = 0; while (_local4 < _local1) { _local3.moveTo((_local4 * gridProxy.cellWidth), 0); _local3.lineTo((_local4 * gridProxy.cellWidth), 480); _local4++; }; _local4 = 0; while (_local4 < _local2) { _local3.moveTo(0, (_local4 * gridProxy.cellHeight)); _local3.lineTo(640, (_local4 * gridProxy.cellHeight)); _local4++; }; } override public function handleNotification(_arg1:INotification):void{ } private function snapClickHandler(_arg1:MouseEvent):void{ gridProxy.snap = !(gridProxy.snap); update(); } private function gridClickHandler(_arg1:MouseEvent):void{ gridProxy.showGrid = !(gridProxy.showGrid); update(); } private function init():void{ _view = (getViewComponent() as GridView); gridProxy = (facade.retrieveProxy(GridProxy.NAME) as GridProxy); var _local1:EditorMediator = (facade.retrieveMediator(EditorMediator.NAME) as EditorMediator); var _local2:EditorView = (_local1.getViewComponent() as EditorView); holst = _local2.grid; _view.grid.addEventListener(MouseEvent.CLICK, gridClickHandler); _view.snapToGrid.addEventListener(MouseEvent.CLICK, snapClickHandler); update(); } private function update():void{ drawGrid(); if (gridProxy.showGrid){ holst.visible = true; _view.grid.gotoAndStop(2); } else { holst.visible = false; _view.grid.gotoAndStop(1); }; if (gridProxy.snap){ _view.snapToGrid.gotoAndStop(2); } else { _view.snapToGrid.gotoAndStop(1); }; } public function destroy():void{ _view.grid.removeEventListener(MouseEvent.CLICK, gridClickHandler); _view.snapToGrid.removeEventListener(MouseEvent.CLICK, snapClickHandler); facade.removeMediator(NAME); } } }//package editor.view
Section 191
//LevelLoadMediator (editor.view.LevelLoadMediator) package editor.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import editor.model.*; import core.*; import game.model.*; import core.objects.*; import editor.view.components.*; import org.puremvc.as3.patterns.mediator.*; public class LevelLoadMediator extends Mediator implements IMediator { private var _view:LevelLoadView; private var notesProxy:NotesProxy; public static const NAME:String = "LevelLoadMediator"; public function LevelLoadMediator(_arg1:LevelLoadView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([]); } override public function handleNotification(_arg1:INotification):void{ } private function deleteObjects():void{ var _local3:BaseObjectDef; var _local1:EditorProxy = (facade.retrieveProxy(EditorProxy.NAME) as EditorProxy); var _local2:Array = _local1.getObjects(); while (_local2.length > 0) { _local3 = _local2[0]; notesProxy.push(EditorProxy.OBJECT_REMOVE, _local3); }; } private function loadClickHandler(_arg1:MouseEvent):void{ deleteObjects(); var _local2:String = _view.levelDef_tf.text; var _local3:Array = Level.parseDef(_local2); var _local4:uint; while (_local4 < _local3.length) { createObj(_local3[_local4]); _local4++; }; destroy(); } private function init():void{ _view = (getViewComponent() as LevelLoadView); notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _view.levelDef_tf.text = ""; _view.load_bt.addEventListener(MouseEvent.CLICK, loadClickHandler); _view.cancel_bt.addEventListener(MouseEvent.CLICK, cancelClickHandler); } private function destroy():void{ _view.load_bt.removeEventListener(MouseEvent.CLICK, loadClickHandler); _view.cancel_bt.removeEventListener(MouseEvent.CLICK, cancelClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function createObj(_arg1:BaseObjectDef):void{ notesProxy.push(EditorProxy.OBJECT_ADD, _arg1); } private function cancelClickHandler(_arg1:MouseEvent):void{ destroy(); } } }//package editor.view
Section 192
//LevelSaveMediator (editor.view.LevelSaveMediator) package editor.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import editor.model.*; import core.*; import editor.view.components.*; import org.puremvc.as3.patterns.mediator.*; public class LevelSaveMediator extends Mediator implements IMediator { private var _view:LevelSaveView; public static const NAME:String = "LevelSaveMediator"; public function LevelSaveMediator(_arg1:LevelSaveView):void{ super(NAME, _arg1); init(); } private function init():void{ _view = (getViewComponent() as LevelSaveView); levelSave(); _view.close_bt.addEventListener(MouseEvent.CLICK, closeClickHandler); } private function levelSave():void{ var _local1:EditorProxy = (facade.retrieveProxy(EditorProxy.NAME) as EditorProxy); var _local2:String = Level.createDef(_local1.getObjects()); _view.levelDef_tf.text = _local2; } override public function handleNotification(_arg1:INotification):void{ } override public function listNotificationInterests():Array{ return ([]); } private function destroy():void{ _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function closeClickHandler(_arg1:MouseEvent):void{ destroy(); } } }//package editor.view
Section 193
//LevelTestMediator (editor.view.LevelTestMediator) package editor.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import editor.model.*; import game.model.*; import editor.view.components.*; import org.puremvc.as3.patterns.mediator.*; public class LevelTestMediator extends Mediator implements IMediator { private var _view:LevelTestView; private var levelProxy:LevelProxy; public static const NAME:String = "LevelTestMediator"; public function LevelTestMediator(_arg1:LevelTestView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([EditorProxy.ELEVEL_COMPLETE, LevelProxy.PARTICLE_COLLECTED]); } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case EditorProxy.ELEVEL_COMPLETE: levelComplete(); break; case LevelProxy.PARTICLE_COLLECTED: particleCollected(); break; }; } private function particleCollected():void{ updateStat(); } private function backClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(EditorProxy.LEVEL_QUIT); } private function levelComplete():void{ } private function init():void{ _view = (getViewComponent() as LevelTestView); levelProxy = (facade.retrieveProxy(LevelProxy.NAME) as LevelProxy); _view.back_bt.addEventListener(MouseEvent.CLICK, backClickHandler); _view.restart_bt.addEventListener(MouseEvent.CLICK, restartClickHandler); } private function restartClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(EditorProxy.LEVEL_QUIT); _local2.push(EditorProxy.LEVEL_TEST); } public function destroy():void{ _view.parent.removeChild(_view); facade.removeMediator(NAME); } public function updateStat():void{ _view.need_tf.text = levelProxy.currentLevel.needParticles.toString(); _view.collected_tf.text = ((levelProxy.currentLevel.collectedParticles.toString() + "/") + levelProxy.currentLevel.totalParticles.toString()); } } }//package editor.view
Section 194
//ObjectsMediator (editor.view.ObjectsMediator) package editor.view { import org.puremvc.as3.interfaces.*; import editor.model.*; import core.objects.*; import editor.view.components.*; import org.puremvc.as3.patterns.mediator.*; import editor.view.components.obj.*; public class ObjectsMediator extends Mediator implements IMediator { private var _view:ObjectsView; private var objViews:Array; public static const NAME:String = "ObjectsMediator"; public function ObjectsMediator(_arg1:ObjectsView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([EditorProxy.OBJECT_ADD, EditorProxy.OBJECTS_SELECT, EditorProxy.OBJECT_UPDATE, EditorProxy.OBJECT_REMOVE]); } private function objectAdd(_arg1:BaseObjectDef):void{ var _local2:ObjView; if ((_arg1 is ExitDef)){ _local2 = new SimpleView(_arg1); } else { if ((_arg1 is ParticleDef)){ _local2 = new SimpleView(_arg1); } else { if ((_arg1 is CircleDef)){ _local2 = new CircleView((_arg1 as CircleDef)); } else { if ((_arg1 is RectDef)){ _local2 = new RectView((_arg1 as RectDef)); } else { if ((_arg1 is DistJointDef)){ _local2 = new DistJointView((_arg1 as DistJointDef)); } else { if ((_arg1 is RevJointDef)){ _local2 = new RevJointView((_arg1 as RevJointDef)); } else { if ((_arg1 is PolyDef)){ _local2 = new PolyView((_arg1 as PolyDef)); } else { if ((_arg1 is MagnetDef)){ _local2 = new SimpleView(_arg1); } else { return; }; }; }; }; }; }; }; }; if ((_arg1 is ExitDef)){ _view.bottom.addChild(_local2); } else { if ((_arg1 is ParticleDef)){ _view.player.addChild(_local2); } else { if ((((((((_arg1 is CircleDef)) || ((_arg1 is RectDef)))) || ((_arg1 is PolyDef)))) || ((_arg1 is MagnetDef)))){ _view.bodies.addChild(_local2); } else { if ((((_arg1 is DistJointDef)) || ((_arg1 is RevJointDef)))){ _view.joints.addChild(_local2); }; }; }; }; objViews.push(_local2); } private function objectRemove(_arg1:BaseObjectDef):void{ var _local3:ObjView; var _local2:uint; while (_local2 < objViews.length) { _local3 = objViews[_local2]; if (_local3.obj == _arg1){ _local3.destroy(); }; _local2++; }; } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case EditorProxy.OBJECT_ADD: objectAdd((_arg1.getBody() as BaseObjectDef)); break; case EditorProxy.OBJECTS_SELECT: objectsSelect((_arg1.getBody() as Array)); break; case EditorProxy.OBJECT_UPDATE: objectUpdate((_arg1.getBody() as BaseObjectDef)); break; case EditorProxy.OBJECT_REMOVE: objectRemove((_arg1.getBody() as BaseObjectDef)); break; }; } private function objectUpdate(_arg1:BaseObjectDef):void{ var _local3:ObjView; var _local2:uint; while (_local2 < objViews.length) { _local3 = objViews[_local2]; if (_local3.obj == _arg1){ _local3.update(); }; _local2++; }; } private function init():void{ _view = (getViewComponent() as ObjectsView); objViews = []; } public function destroy():void{ facade.removeMediator(NAME); } private function objectsSelect(_arg1:Array):void{ var _local3:ObjView; var _local4:uint; var _local5:BaseObjectDef; var _local2:uint; while (_local2 < objViews.length) { _local3 = objViews[_local2]; _local3.deselect(); _local4 = 0; while (_local4 < _arg1.length) { _local5 = _arg1[_local4]; if (_local3.obj == _local5){ _local3.select(); }; _local4++; }; _local2++; }; } } }//package editor.view
Section 195
//ToolsMediator (editor.view.ToolsMediator) package editor.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import editor.model.*; import game.model.*; import editor.view.components.*; import editor.view.components.tools.*; import org.puremvc.as3.patterns.mediator.*; public class ToolsMediator extends Mediator implements IMediator { private var editorProxy:EditorProxy; private var _view:ToolsView; private var notesProxy:NotesProxy; private var selectedTool:ToolView; private var toolViews:Array; public static const NAME:String = "ToolsMediator"; public function ToolsMediator(_arg1:ToolsView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([EditorProxy.TOOL_SELECT]); } override public function onRegister():void{ editorProxy = (facade.retrieveProxy(EditorProxy.NAME) as EditorProxy); initTools(); notesProxy.push(EditorProxy.TOOL_SELECT, editorProxy.getTools()[0]); } private function init():void{ _view = (getViewComponent() as ToolsView); notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); } private function initTools():void{ var _local3:Tool; var _local4:ToolView; var _local1:Array = editorProxy.getTools(); toolViews = []; var _local2:uint; for (;_local2 < _local1.length;_local2++) { _local3 = _local1[_local2]; switch (_local3.type){ case Tool.TYPE_SELECTION: _local4 = new SelectionTool(_view.selectionTool, _local3); break; case Tool.TYPE_CIRCLE: _local4 = new CircleTool(_view.circleTool, _local3); break; case Tool.TYPE_RECT: _local4 = new RectTool(_view.rectTool, _local3); break; case Tool.TYPE_DIST_JOINT: _local4 = new DistJointTool(_view.distJointTool, _local3); break; case Tool.TYPE_BONUS: _local4 = new SimpleTool(_view.bonusTool, _local3); break; case Tool.TYPE_REV_JOINT: _local4 = new SimpleTool(_view.revJointTool, _local3); break; case Tool.TYPE_POLY: _local4 = new PolyTool(_view.polyTool, _local3); break; case Tool.TYPE_PARTICLE: _local4 = new SimpleTool(_view.particleTool, _local3); break; case Tool.TYPE_MAGNET: _local4 = new SimpleTool(_view.magnetTool, _local3); break; default: continue; }; toolViews.push(_local4); _local4.addEventListener(ToolView.SELECT, toolSelectHandler); }; } private function toolSelect(_arg1:Tool):void{ if (selectedTool){ selectedTool.deselect(); }; selectedTool = getToolView(_arg1); selectedTool.select(); editorProxy.selectedTool = selectedTool.tool; } private function getToolView(_arg1:Tool):ToolView{ var _local3:ToolView; var _local2:uint; while (_local2 < toolViews.length) { _local3 = toolViews[_local2]; if (_local3.tool == _arg1){ return (_local3); }; _local2++; }; return (null); } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case EditorProxy.TOOL_SELECT: toolSelect((_arg1.getBody() as Tool)); break; }; } public function destroy():void{ facade.removeMediator(NAME); } private function toolSelectHandler(_arg1:Event):void{ var _local2:ToolView = (_arg1.target as ToolView); toolSelect(_local2.tool); } } }//package editor.view
Section 196
//GameAbortCommand (game.controller.GameAbortCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; import caurina.transitions.*; public class GameAbortCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local2.gameAbort(); Tweener.removeAllTweens(); var _local3:LevelSelectMediator = (facade.retrieveMediator(LevelSelectMediator.NAME) as LevelSelectMediator); if (_local3){ _local3.destroy(); }; var _local4:LevelMediator = (facade.retrieveMediator(LevelMediator.NAME) as LevelMediator); if (_local4){ _local4.destroy(); }; var _local5:GameCompleteMediator = (facade.retrieveMediator(GameCompleteMediator.NAME) as GameCompleteMediator); if (_local5){ _local5.destroy(); }; var _local6:LevelPauseMediator = (facade.retrieveMediator(LevelPauseMediator.NAME) as LevelPauseMediator); if (_local6){ _local6.destroy(); }; var _local7:LevelCompleteMediator = (facade.retrieveMediator(LevelCompleteMediator.NAME) as LevelCompleteMediator); if (_local7){ _local7.destroy(); }; var _local8:GameOverMediator = (facade.retrieveMediator(GameOverMediator.NAME) as GameOverMediator); if (_local8){ _local8.destroy(); }; var _local9:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local10:MainMenuView = new MainMenuView(); _local9.getViewContainer().addChild(_local10); var _local11:MainMenuMediator = new MainMenuMediator(_local10); facade.registerMediator(_local11); } } }//package game.controller
Section 197
//GameCompleteCommand (game.controller.GameCompleteCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class GameCompleteCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local3:GameCompleteView = new GameCompleteView(); _local2.getViewContainer().addChild(_local3); var _local4:GameCompleteMediator = new GameCompleteMediator(_local3); facade.registerMediator(_local4); var _local5:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local5.gameComplete(); var _local6:LevelPauseMediator = (facade.retrieveMediator(LevelPauseMediator.NAME) as LevelPauseMediator); _local6.destroy(); } } }//package game.controller
Section 198
//GameOverCommand (game.controller.GameOverCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class GameOverCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local3:GameOverView = new GameOverView(); _local2.getViewContainer().addChild(_local3); var _local4:GameOverMediator = new GameOverMediator(_local3); facade.registerMediator(_local4); var _local5:LevelPauseMediator = (facade.retrieveMediator(LevelPauseMediator.NAME) as LevelPauseMediator); _local5.destroy(); } } }//package game.controller
Section 199
//GameStartCommand (game.controller.GameStartCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class GameStartCommand extends SimpleCommand implements ICommand { private var appMed:AppMediator; override public function execute(_arg1:INotification):void{ var _local2:MainMenuMediator = (facade.retrieveMediator(MainMenuMediator.NAME) as MainMenuMediator); _local2.destroy(); var _local3:GameProxy = new GameProxy(); facade.registerProxy(_local3); _local3.gameStart(); appMed = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local4:LevelSelectView = new LevelSelectView(); appMed.getViewContainer().addChild(_local4); var _local5:LevelSelectMediator = new LevelSelectMediator(_local4); facade.registerMediator(_local5); } } }//package game.controller
Section 200
//InitializeCommand (game.controller.InitializeCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class InitializeCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:AppView = new AppView(); ApplicationFacade.getInstance().viewContainer.addChild(_local2); var _local3:AppMediator = new AppMediator(_local2); facade.registerMediator(_local3); var _local4:MainMenuView = new MainMenuView(); _local3.getViewContainer().addChild(_local4); var _local5:MainMenuMediator = new MainMenuMediator(_local4); facade.registerMediator(_local5); var _local6:CustomCursorView = new CustomCursorView(); _local3.getCursorContainer().addChild(_local6); var _local7:CustomCursorMediator = new CustomCursorMediator(_local6); facade.registerMediator(_local7); var _local8:LogoView = new LogoView(); _local3.getViewContainer().addChild(_local8); } } }//package game.controller
Section 201
//LevelAbortCommand (game.controller.LevelAbortCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; import caurina.transitions.*; public class LevelAbortCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local2.levelAbort(); Tweener.removeAllTweens(); var _local3:LevelMediator = (facade.retrieveMediator(LevelMediator.NAME) as LevelMediator); if (_local3){ _local3.destroy(); }; var _local4:LevelPauseMediator = (facade.retrieveMediator(LevelPauseMediator.NAME) as LevelPauseMediator); if (_local4){ _local4.destroy(); }; var _local5:LevelCompleteMediator = (facade.retrieveMediator(LevelCompleteMediator.NAME) as LevelCompleteMediator); if (_local5){ _local5.destroy(); }; var _local6:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local7:LevelSelectView = new LevelSelectView(); _local6.getViewContainer().addChild(_local7); var _local8:LevelSelectMediator = new LevelSelectMediator(_local7); facade.registerMediator(_local8); } } }//package game.controller
Section 202
//LevelCompleteCommand (game.controller.LevelCompleteCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class LevelCompleteCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:LevelPauseMediator = (facade.retrieveMediator(LevelPauseMediator.NAME) as LevelPauseMediator); _local2.destroy(); var _local3:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local3.levelComplete(); } } }//package game.controller
Section 203
//LevelStartCommand (game.controller.LevelStartCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; import flash.net.*; public class LevelStartCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:LevelSelectMediator = (facade.retrieveMediator(LevelSelectMediator.NAME) as LevelSelectMediator); if (_local2){ _local2.destroy(); }; var _local3:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local4:LevelView = new LevelView(); _local3.getViewContainer().addChild(_local4); var _local5:LevelMediator = new LevelMediator(_local4); facade.registerMediator(_local5); var _local6:LevelPauseView = new LevelPauseView(); _local3.getPopupContainer().addChild(_local6); var _local7:LevelPauseMediator = new LevelPauseMediator(_local6); facade.registerMediator(_local7); var _local8:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local8.levelStart((_arg1.getBody() as int)); } private function gcHack():void{ var lc1:LocalConnection; var lc2:LocalConnection; try { lc1 = new LocalConnection(); lc2 = new LocalConnection(); lc1.connect("name"); lc2.connect("name"); } catch(e:Error) { }; } } }//package game.controller
Section 204
//StartupCommand (game.controller.StartupCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import flash.display.*; import org.puremvc.as3.patterns.command.*; public class StartupCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:Sprite = _arg1.getBody().container; var _local3:AppProxy = new AppProxy(); facade.registerProxy(_local3); _local3.startApp(); } } }//package game.controller
Section 205
//AppProxy (game.model.AppProxy) package game.model { import flash.events.*; import editor.model.*; import core.*; import flash.media.*; import game.controller.*; import org.puremvc.as3.patterns.proxy.*; import caurina.transitions.properties.*; import editor.controller.*; public class AppProxy extends Proxy { private var music:Sound; private var notesProxy:NotesProxy; public var musicChannel:SoundChannel; public static const GAME_ABORT:String = "GameAbort"; public static const GAME_COMPLETE:String = "GameComplete"; public static const NAME:String = "AppProxy"; public static const INITIALIZE:String = "Initialize"; public static const GAME_START:String = "GameStart"; public static const EDITOR_START:String = "EditorStartup"; public function AppProxy():void{ super(NAME); init(); } private function init():void{ facade.registerCommand(INITIALIZE, InitializeCommand); facade.registerCommand(GAME_START, GameStartCommand); facade.registerCommand(GAME_ABORT, GameAbortCommand); facade.registerCommand(EDITOR_START, EditorStartCommand); notesProxy = new NotesProxy(); facade.registerProxy(notesProxy); FilterShortcuts.init(); } private function assetsInitHandler(_arg1:Event=null):void{ SaveData.getInstance().initialize(); var _local2:Class = GameAssets.getInstance().getAssetClass("SndMusic"); music = new (_local2); musicChannel = music.play(0, 100000, SaveData.getInstance().musicTransform); notesProxy.push(INITIALIZE); } private function coreAssetsInitHandler(_arg1:Event):void{ var _local2:EditorAssets = EditorAssets.getInstance(); _local2.addEventListener(Event.INIT, editorAssetsInitHandler); _local2.init(); } private function editorAssetsInitHandler(_arg1:Event):void{ var _local2:GameAssets = GameAssets.getInstance(); _local2.addEventListener(Event.INIT, assetsInitHandler); _local2.init(); } public function startApp():void{ var _local1:CoreAssets = CoreAssets.getInstance(); _local1.addEventListener(Event.INIT, coreAssetsInitHandler); _local1.init(); } } }//package game.model
Section 206
//GameAssets (game.model.GameAssets) package game.model { import flash.events.*; import flash.display.*; import flash.system.*; public class GameAssets extends EventDispatcher { private var Assets:Class; private var appDomain:ApplicationDomain; private static var instance:GameAssets; public function GameAssets():void{ Assets = GameAssets_Assets; super(); } public function init():void{ var _local1:Loader = new Loader(); _local1.contentLoaderInfo.addEventListener(Event.INIT, assetsInitHandler); _local1.loadBytes(new Assets()); } private function assetsInitHandler(_arg1:Event):void{ appDomain = _arg1.target.content.loaderInfo.applicationDomain; dispatchEvent(new Event(Event.INIT)); } public function getAssetClass(_arg1:String):Class{ if (!appDomain.hasDefinition(_arg1)){ trace((("*Error*: There is no definition of class '" + _arg1) + "'")); return (null); }; return ((appDomain.getDefinition(_arg1) as Class)); } public static function getInstance():GameAssets{ if (!instance){ instance = new (GameAssets); }; return (instance); } } }//package game.model
Section 207
//GameAssets_Assets (game.model.GameAssets_Assets) package game.model { import mx.core.*; public class GameAssets_Assets extends ByteArrayAsset { } }//package game.model
Section 208
//GameLevel (game.model.GameLevel) package game.model { import core.*; public class GameLevel extends Level { public var isCompleted:Boolean; public var completeTime:int; public var name:String; public var timeBonus:int; public var isOpen:Boolean; public var score:int; public var id:int; public static var ID:uint; public function GameLevel(_arg1:String, _arg2:int, _arg3:String):void{ this.id = ID++; this.name = _arg1; isCompleted = false; isOpen = false; score = -1; super(_arg2, _arg3); } public function complete(_arg1:int):void{ isCompleted = true; completeTime = _arg1; timeBonus = ((60 * 40) - completeTime); if (timeBonus < 0){ timeBonus = 0; }; var _local2:int = timeBonus; if (_local2 > score){ score = _local2; }; } } }//package game.model
Section 209
//GameProxy (game.model.GameProxy) package game.model { import core.*; import game.view.components.*; import game.controller.*; import org.puremvc.as3.patterns.proxy.*; import game.view.*; public class GameProxy extends Proxy { private var engine:CoreEngine; public var currentLevel:GameLevel; public var score:int; private var canvas:CoreCanvas; private var notesProxy:NotesProxy; private var levels:Array; public static const GAME_OVER:String = "GameOver"; public static const LEVEL_UPDATE:String = "LevelUpdate"; public static const GAME_COMPLETE:String = "GameComplete"; public static const LEVEL_START:String = "LevelStart"; public static const NAME:String = "GameProxy"; public static const PAUSE_OFF:String = "PauseOff"; public static const LEVEL_COMPLETE:String = "LevelComplete"; public static const LEVEL_ABORT:String = "LevelAbort"; public static const PAUSE_ON:String = "PauseOn"; public static const ATTRACTOR_CHANGED:String = "AttractorChanged"; public static const PARTICLE_COLLECTED:String = "ParticleCollected"; public function GameProxy():void{ super(NAME); init(); } private function updateHandler(_arg1:CoreEvent):void{ notesProxy.push(LEVEL_UPDATE); } public function destroy():void{ engine.removeEventListener(CoreEvent.UPDATE, updateHandler); engine.removeEventListener(CoreEvent.LEVEL_COMPLETE, levelCompleteHandler); engine.removeEventListener(CoreEvent.PARTICLE_COLLECTED, particleCollectedHandler); engine.removeEventListener(CoreEvent.ATTRACTOR_CHANGED, attractorChangedHandler); engine.destroy(); } public function levelAbort():void{ destroy(); } public function getLevel(_arg1:uint):GameLevel{ return (levels[_arg1]); } private function init():void{ var _local1:uint; var _local2:Array; var _local5:GameLevel; notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); engine = CoreEngine.getInstance(); if (!facade.hasCommand(LEVEL_START)){ facade.registerCommand(LEVEL_START, LevelStartCommand); }; if (!facade.hasCommand(LEVEL_COMPLETE)){ facade.registerCommand(LEVEL_COMPLETE, LevelCompleteCommand); }; if (!facade.hasCommand(LEVEL_ABORT)){ facade.registerCommand(LEVEL_ABORT, LevelAbortCommand); }; if (!facade.hasCommand(GAME_COMPLETE)){ facade.registerCommand(GAME_COMPLETE, GameCompleteCommand); }; if (!facade.hasCommand(GAME_OVER)){ facade.registerCommand(GAME_OVER, GameOverCommand); }; levels = []; GameLevel.ID = 0; levels.push(new GameLevel("journey begins", 38, "ExitDef_557_402 ParticleDef_36_262 ParticleDef_87_267 ParticleDef_138_265 ParticleDef_162_254 ParticleDef_185_266 ParticleDef_216_266 ParticleDef_268_263 ParticleDef_294_251 ParticleDef_296_231 ParticleDef_286_214 ParticleDef_301_201 ParticleDef_323_190 ParticleDef_337_142 ParticleDef_324_94 ParticleDef_285_53 ParticleDef_256_44 ParticleDef_226_31 ParticleDef_195_20 ParticleDef_177_33 ParticleDef_174_57 ParticleDef_176_75 ParticleDef_151_68 ParticleDef_126_74 ParticleDef_123_99 ParticleDef_129_125 ParticleDef_109_126 ParticleDef_94_140 ParticleDef_93_165 ParticleDef_100_190 ParticleDef_84_206 ParticleDef_59_219 ParticleDef_35_234 ParticleDef_60_268 ParticleDef_113_266 ParticleDef_331_166 ParticleDef_331_115 ParticleDef_308_71 ParticleDef_242_265 Circle_546_256_41_TypeHurt Circle_517_219_16_TypeHurt Circle_506_203_8_TypeHurt Circle_572_221_17_TypeHurt Circle_578_202_7_TypeHurt Circle_212_163_55_TypeBrick Circle_367_461_44_TypeBrick Circle_418_427_34_TypeBrick Circle_299_488_37_TypeBrick ")); levels.push(new GameLevel("turnstile", 11, "ExitDef_531_262 PolyDef_252_253_TypeMetal_3|0_4|-91_14|-92_20|1_99|2_100|16_19|18_20|97_3|97_3|18_-81|16_-82|1 RevJoint_262_261_0 PolyDef_1_132_TypeHurt_0|0_0|-64_173|-23_347|-38_500|8_536|-7_539|49_490|61_385|27_302|7_218|18_69|4 PolyDef_5_444_TypeHurt_0|0_135|-57_159|-51_463|-102_487|-116_538|-70_523|-39_450|-45_130|9_29|14_7|22 ParticleDef_46_169 ParticleDef_36_262 ParticleDef_2_255 ParticleDef_15_213 ParticleDef_37_231 ParticleDef_24_296 ParticleDef_85_210 ParticleDef_69_188 ParticleDef_47_227 ParticleDef_65_249 ParticleDef_17_232 Circle_171_261_8_TypeMetal Circle_262_167_8_TypeMetal Circle_349_262_8_TypeMetal Circle_264_347_9_TypeMetal Circle_262_262_18_TypeMetal Circle_176_123_56_TypeHurt Circle_339_119_44_TypeHurt Circle_398_141_31_TypeHurt Circle_517_151_52_TypeHurt Circle_503_377_55_TypeHurt Circle_135_417_38_TypeHurt Circle_5_464_33_TypeHurt Circle_453_394_26_TypeHurt ")); levels.push(new GameLevel("victim", 6, "ExitDef_331_123 ParticleDef_89_384 ParticleDef_107_345 ParticleDef_79_309 ParticleDef_62_264 ParticleDef_83_218 ParticleDef_57_176 ParticleDef_39_136 Circle_29_471_71_TypeBrick Circle_115_476_31_TypeHurt DistJointDef_85_408_81_432_89_383 DistJointDef_98_364_89_383_107_344 DistJointDef_93_327_107_344_78_309 DistJointDef_70_286_78_309_61_263 DistJointDef_72_240_61_263_83_217 DistJointDef_70_197_83_217_57_176 DistJointDef_48_156_57_176_39_136 Circle_459_275_75_TypeHurt Circle_381_345_41_TypeHurt ")); levels.push(new GameLevel("help me guys!", 10, "ExitDef_299_150 Circle_218_410_25_TypeMetal Circle_253_378_28_TypeMetal Circle_306_375_29_TypeMetal Circle_342_405_24_TypeMetal Circle_337_433_10_TypeMetal Circle_227_437_10_TypeMetal ParticleDef_279_418 DistJointDef_268_409_279_418_256_400 DistJointDef_288_408_278_418_297_398 ParticleDef_219_67 ParticleDef_156_33 ParticleDef_382_70 ParticleDef_471_93 ParticleDef_493_129 ParticleDef_167_147 ParticleDef_115_96 ParticleDef_449_33 ParticleDef_395_121 ")); levels.push(new GameLevel("attraction", 14, "ExitDef_308_398 Circle_304_228_44_TypeMetal ParticleDef_149_228 ParticleDef_172_148 ParticleDef_212_104 ParticleDef_259_80 ParticleDef_319_76 ParticleDef_370_90 ParticleDef_412_119 ParticleDef_445_165 ParticleDef_457_238 ParticleDef_427_322 ParticleDef_381_362 ParticleDef_306_383 ParticleDef_226_362 ParticleDef_170_306 RevJoint_304_228_1 DistJointDef_276_137_259_80_292_193 DistJointDef_313_134_307_192_319_76 DistJointDef_345_142_370_90_320_194 DistJointDef_371_161_330_202_412_119 DistJointDef_392_189_445_165_339_213 DistJointDef_399_235_457_238_341_232 DistJointDef_379_287_427_322_331_251 DistJointDef_350_311_381_362_319_260 DistJointDef_304_324_306_383_302_264 DistJointDef_256_310_226_362_286_258 DistJointDef_222_276_170_306_274_246 DistJointDef_210_229_149_228_270_229 DistJointDef_222_179_172_148_271_210 DistJointDef_247_152_212_104_281_200 ")); levels.push(new GameLevel("get them all!", 40, "ExitDef_46_45 Circle_162_306_114_TypeBrick Circle_264_230_60_TypeBrick Circle_332_243_21_TypeBrick Circle_107_184_33_TypeBrick Circle_264_306_39_TypeBrick ParticleDef_346_377 ParticleDef_31_328 ParticleDef_316_170 ParticleDef_386_142 ParticleDef_417_182 ParticleDef_416_240 ParticleDef_438_323 ParticleDef_490_457 ParticleDef_387_391 ParticleDef_506_419 ParticleDef_544_376 ParticleDef_590_247 ParticleDef_621_209 ParticleDef_512_298 ParticleDef_57_228 ParticleDef_59_180 ParticleDef_82_423 ParticleDef_219_167 ParticleDef_345_206 ParticleDef_606_360 ParticleDef_149_443 ParticleDef_396_278 ParticleDef_285_362 ParticleDef_212_426 ParticleDef_325_292 ParticleDef_354_284 ParticleDef_323_333 ParticleDef_267_398 ParticleDef_375_29 ParticleDef_371_245 ParticleDef_268_151 ParticleDef_42_383 ParticleDef_432_361 ParticleDef_375_88 ParticleDef_450_282 ParticleDef_567_284 ParticleDef_89_136 ParticleDef_138_139 ParticleDef_168_175 ParticleDef_34_275 Circle_530_69_142_TypeBrick Circle_505_210_71_TypeBrick Circle_602_454_72_TypeBrick Circle_382_333_40_TypeBrick ")); levels.push(new GameLevel("antimagnets", 10, "ExitDef_517_111 MagnetDef_206_331 MagnetDef_222_186 Circle_57_352_64_TypeBrick Circle_134_355_50_TypeBrick RectDef_-24_-51_266_26_TypeBrick_37 Circle_181_117_28_TypeBrick ParticleDef_20_91 ParticleDef_48_90 ParticleDef_29_164 ParticleDef_24_215 ParticleDef_27_132 ParticleDef_61_131 ParticleDef_69_145 ParticleDef_79_100 ParticleDef_57_200 ParticleDef_59_171 Circle_417_197_51_TypeHurt Circle_355_49_34_TypeBrick Circle_384_67_23_TypeBrick Circle_319_74_17_TypeBrick Circle_553_448_117_TypeHurt Circle_420_416_42_TypeHurt ")); levels.push(new GameLevel("where is the exit?", 10, "ExitDef_312_202 Circle_309_217_91_TypeMetal ParticleDef_241_86 ParticleDef_170_243 ParticleDef_414_121 ParticleDef_384_326 ParticleDef_210_308 ParticleDef_166_152 ParticleDef_438_269 ParticleDef_437_182 ParticleDef_337_81 RevJoint_313_287_0 ParticleDef_298_349 ")); levels.push(new GameLevel("turn and slide", 4, "ExitDef_271_421 Circle_321_242_23_TypeMetal RectDef_321_235_190_12_TypeMetal_0 Circle_513_241_13_TypeMetal ParticleDef_512_158 ParticleDef_565_193 ParticleDef_573_269 ParticleDef_518_323 DistJointDef_513_200_512_158_513_241 DistJointDef_540_217_513_241_566_192 DistJointDef_544_256_573_270_514_241 DistJointDef_516_282_518_322_513_241 RevJoint_317_242_0 Circle_304_-16_49_TypeHurt Circle_221_374_17_TypeHurt Circle_99_408_60_TypeHurt Circle_427_406_91_TypeHurt Circle_550_483_75_TypeHurt Circle_24_475_89_TypeHurt Circle_69_74_40_TypeBrick Circle_50_57_7_TypeHurt Circle_82_56_9_TypeHurt ")); levels.push(new GameLevel("team work", 12, "ExitDef_585_122 RectDef_135_182_321_14_TypeMetal_16 Circle_378_257_26_TypeMetal RevJoint_377_257_0 Circle_134_189_7_TypeMetal RectDef_91_156_425_25_TypeHurt_0 RectDef_72_284_285_61_TypeHurt_0 ParticleDef_28_169 ParticleDef_61_176 ParticleDef_26_214 ParticleDef_62_216 ParticleDef_49_196 ParticleDef_470_239 ParticleDef_435_252 ParticleDef_490_242 RectDef_-44_-14_693_87_TypeHurt_0 MagnetDef_425_136 ParticleDef_466_266 ParticleDef_448_234 Circle_109_365_49_TypeHurt Circle_169_404_29_TypeHurt Circle_193_438_17_TypeHurt Circle_200_462_10_TypeHurt Circle_81_311_31_TypeHurt Circle_357_315_31_TypeHurt Circle_188_71_18_TypeHurt Circle_209_72_8_TypeHurt ParticleDef_480_217 ParticleDef_509_261 Circle_580_392_35_TypeBrick Circle_560_433_18_TypeBrick Circle_600_355_16_TypeBrick Circle_91_168_13_TypeHurt Circle_516_169_13_TypeHurt Circle_441_277_7_TypeMetal ")); levels.push(new GameLevel("dangerous place", 13, "ExitDef_114_417 RectDef_-28_102_365_20_TypeHurt_0 RectDef_391_202_277_18_TypeHurt_0 RectDef_24_261_180_23_TypeHurt_0 RectDef_371_359_167_30_TypeHurt_0 ParticleDef_439_159 ParticleDef_232_25 ParticleDef_303_24 ParticleDef_213_66 ParticleDef_280_76 ParticleDef_345_61 ParticleDef_426_336 ParticleDef_118_302 ParticleDef_198_169 ParticleDef_223_397 ParticleDef_308_428 ParticleDef_390_47 Circle_296_269_51_TypeHurt ParticleDef_455_229 Circle_517_81_32_TypeBrick Circle_484_94_8_TypeBrick Circle_487_60_8_TypeBrick Circle_516_48_8_TypeBrick Circle_545_67_9_TypeBrick Circle_543_97_8_TypeBrick Circle_516_112_9_TypeBrick Circle_391_211_9_TypeHurt Circle_337_112_10_TypeHurt Circle_24_273_11_TypeHurt Circle_204_273_11_TypeHurt Circle_372_374_15_TypeHurt Circle_538_374_15_TypeHurt Circle_603_474_56_TypeHurt Circle_266_714_264_TypeBrick ")); levels.push(new GameLevel("who is the brave?", 5, "ExitDef_339_433 PolyDef_251_142_TypeHurt_0|0_77|214_-34|3 PolyDef_348_357_TypeHurt_0|0_51|-222_100|-219 ParticleDef_262_84 ParticleDef_368_74 ParticleDef_440_44 ParticleDef_460_31 ParticleDef_391_65 ParticleDef_209_65 ParticleDef_136_23 ParticleDef_184_53 ParticleDef_159_38 ParticleDef_234_79 ParticleDef_290_86 ParticleDef_415_55 ParticleDef_481_20 ParticleDef_317_86 ParticleDef_343_81 Circle_233_156_23_TypeHurt Circle_423_144_25_TypeHurt Circle_28_162_112_TypeBrick Circle_613_157_104_TypeBrick MagnetDef_500_215 MagnetDef_152_215 Circle_128_109_28_TypeBrick Circle_526_93_28_TypeBrick MagnetDef_486_248 MagnetDef_175_249 ")); levels.push(new GameLevel("magnexit", 8, "ExitDef_321_240 MagnetDef_317_235 ParticleDef_202_133 ParticleDef_429_333 ParticleDef_319_95 ParticleDef_430_139 ParticleDef_472_228 MagnetDef_327_243 ParticleDef_173_248 ParticleDef_210_334 ParticleDef_315_374 ")); levels.push(new GameLevel("squares", 15, "ExitDef_598_223 ParticleDef_20_462 ParticleDef_20_442 ParticleDef_20_422 ParticleDef_20_402 ParticleDef_40_401 ParticleDef_40_421 ParticleDef_40_441 ParticleDef_40_461 ParticleDef_60_461 ParticleDef_60_441 ParticleDef_60_421 ParticleDef_60_401 ParticleDef_79_401 ParticleDef_80_421 ParticleDef_80_441 ParticleDef_80_461 DistJointDef_30_462_20_462_40_461 DistJointDef_50_461_40_461_60_461 DistJointDef_70_461_60_461_80_461 DistJointDef_80_451_80_461_80_441 DistJointDef_80_431_80_441_80_421 DistJointDef_80_411_80_421_79_401 DistJointDef_70_401_79_401_60_401 DistJointDef_50_401_60_401_40_401 DistJointDef_30_402_40_401_20_402 DistJointDef_20_412_20_402_20_422 DistJointDef_20_432_20_422_20_442 DistJointDef_20_452_20_442_20_462 DistJointDef_40_451_40_461_40_441 DistJointDef_40_431_40_441_40_421 DistJointDef_40_411_40_421_40_401 DistJointDef_60_411_60_401_60_421 DistJointDef_60_431_60_421_60_441 DistJointDef_60_451_60_441_60_461 DistJointDef_30_442_20_442_40_441 DistJointDef_50_441_40_441_60_441 DistJointDef_70_441_60_441_80_441 DistJointDef_70_421_80_421_60_421 DistJointDef_50_421_60_421_40_421 DistJointDef_30_422_40_421_20_422 RectDef_109_138_535_22_TypeHurt_0 RectDef_107_289_540_22_TypeHurt_0 DistJointDef_30_412_20_402_40_421 DistJointDef_50_431_40_421_60_441 DistJointDef_70_451_60_441_80_461 DistJointDef_70_431_80_441_60_421 DistJointDef_50_411_60_421_40_401 DistJointDef_70_411_60_401_80_421 DistJointDef_30_432_20_422_40_441 DistJointDef_50_451_40_441_60_461 DistJointDef_30_452_40_461_20_442 MagnetDef_515_196 ParticleDef_20_20 ParticleDef_40_20 ParticleDef_60_20 ParticleDef_60_40 ParticleDef_40_40 ParticleDef_20_40 ParticleDef_20_59 ParticleDef_40_59 ParticleDef_60_59 DistJointDef_30_20_20_20_40_20 DistJointDef_50_20_40_20_60_20 DistJointDef_60_30_60_20_60_40 DistJointDef_60_50_60_40_60_59 DistJointDef_50_59_60_59_40_59 DistJointDef_30_59_40_59_20_59 DistJointDef_20_50_20_59_20_40 DistJointDef_20_30_20_40_20_20 DistJointDef_30_40_20_40_40_40 DistJointDef_40_30_40_40_40_20 DistJointDef_50_40_40_40_60_40 DistJointDef_40_50_40_40_40_59 DistJointDef_50_30_40_20_60_40 DistJointDef_30_30_20_20_40_40 DistJointDef_50_50_40_40_60_59 DistJointDef_30_50_20_40_40_59 MagnetDef_321_249 Circle_107_300_11_TypeHurt Circle_110_149_11_TypeHurt Circle_357_417_37_TypeBrick Circle_404_436_20_TypeBrick Circle_427_429_16_TypeBrick Circle_445_408_19_TypeBrick Circle_452_371_23_TypeBrick Circle_273_49_21_TypeBrick Circle_247_64_15_TypeBrick Circle_299_40_13_TypeBrick Circle_320_28_14_TypeBrick Circle_428_112_14_TypeBrick Circle_413_98_12_TypeBrick Circle_446_113_11_TypeBrick Circle_470_113_19_TypeBrick ")); levels.push(new GameLevel("neighbours", 16, "ExitDef_552_426 ParticleDef_27_27 ParticleDef_46_27 ParticleDef_27_47 ParticleDef_47_47 ParticleDef_367_27 ParticleDef_388_27 ParticleDef_388_48 ParticleDef_367_48 ParticleDef_27_287 ParticleDef_47_287 ParticleDef_47_307 ParticleDef_27_308 ParticleDef_367_287 ParticleDef_387_287 ParticleDef_367_307 ParticleDef_387_307 DistJointDef_37_27_27_27_46_27 DistJointDef_47_37_46_27_47_47 DistJointDef_37_47_47_47_27_47 DistJointDef_27_37_27_47_27_27 DistJointDef_37_37_27_27_47_47 DistJointDef_378_27_367_27_388_27 DistJointDef_388_38_388_27_388_48 DistJointDef_378_48_388_48_367_48 DistJointDef_367_38_367_48_367_27 DistJointDef_378_38_367_27_388_48 DistJointDef_377_287_367_287_387_287 DistJointDef_387_297_387_287_387_307 DistJointDef_377_307_387_307_367_307 DistJointDef_367_297_367_307_367_287 DistJointDef_377_297_367_287_387_307 DistJointDef_37_287_27_287_47_287 DistJointDef_47_297_47_287_47_307 DistJointDef_37_308_47_307_27_308 DistJointDef_27_298_27_308_27_287 DistJointDef_47_167_47_47_47_287 DistJointDef_207_287_47_287_367_287 DistJointDef_367_168_367_287_367_48 DistJointDef_207_48_367_48_47_47 DistJointDef_207_167_47_47_367_287 DistJointDef_37_297_27_287_47_307 RectDef_439_310_207_24_TypeHurt_0 RectDef_429_410_36_73_TypeHurt_0 RectDef_170_129_109_69_TypeBrick_0 Circle_442_322_12_TypeHurt Circle_447_410_18_TypeHurt Circle_171_131_12_TypeBrick Circle_172_197_12_TypeBrick Circle_277_198_12_TypeBrick Circle_278_131_11_TypeBrick RectDef_437_199_211_21_TypeHurt_0 Circle_436_210_11_TypeHurt Circle_513_297_20_TypeHurt Circle_536_265_21_TypeHurt Circle_522_233_19_TypeHurt ")); levels.push(new GameLevel("mine field", 14, "ExitDef_339_266 ParticleDef_50_352 ParticleDef_93_276 ParticleDef_217_451 ParticleDef_261_357 ParticleDef_438_442 ParticleDef_515_324 ParticleDef_439_251 ParticleDef_311_172 ParticleDef_164_74 ParticleDef_55_28 ParticleDef_434_46 ParticleDef_545_37 ParticleDef_517_200 ParticleDef_151_192 Circle_120_119_16_TypeHurt Circle_283_79_13_TypeHurt Circle_440_144_21_TypeHurt Circle_450_374_17_TypeHurt Circle_303_425_19_TypeHurt Circle_121_395_15_TypeHurt Circle_235_237_13_TypeHurt ")); levels.push(new GameLevel("time to think", 26, "ExitDef_599_240 PolyDef_105_187_TypeBrick_0|0_364|-2_439|20_533|-22_533|-7_443|33_364|12_3|16 PolyDef_636_316_TypeBrick_0|-7_-81|-30_-130|-11_-525|-14_-525|-32_-129|-27_-81|-46_-1|-24 Circle_545_213_9_TypeBrick RectDef_111_301_395_37_TypeHurt_0 RectDef_83_145_391_44_TypeHurt_0 Circle_455_149_48_TypeHurt Circle_89_160_32_TypeHurt Circle_227_132_49_TypeHurt Circle_278_102_20_TypeHurt Circle_113_320_18_TypeHurt Circle_506_334_33_TypeHurt Circle_321_378_56_TypeHurt ParticleDef_566_330 ParticleDef_610_335 ParticleDef_577_361 ParticleDef_399_368 ParticleDef_445_354 ParticleDef_382_414 ParticleDef_244_355 ParticleDef_149_353 ParticleDef_153_409 ParticleDef_199_363 ParticleDef_311_452 ParticleDef_82_111 ParticleDef_136_136 ParticleDef_173_94 ParticleDef_248_62 ParticleDef_300_129 ParticleDef_387_130 ParticleDef_463_82 ParticleDef_516_169 ParticleDef_23_226 ParticleDef_59_201 ParticleDef_85_241 ParticleDef_28_296 ParticleDef_84_281 Circle_23_464_67_TypeHurt Circle_18_18_67_TypeHurt Circle_579_21_72_TypeBrick Circle_539_88_28_TypeBrick Circle_107_197_8_TypeBrick Circle_112_293_9_TypeBrick Circle_636_168_15_TypeBrick Circle_556_280_10_TypeBrick Circle_516_293_9_TypeBrick Circle_634_301_10_TypeBrick Circle_543_427_20_TypeBrick ParticleDef_49_257 ParticleDef_10_202 ")); levels.push(new GameLevel("elevator", 9, "ExitDef_146_241 PolyDef_359_417_TypeMetal_41|11_50|14_48|-22_96|-26_107|44_103|57_64|61_44|56_44|47_54|50_70|51_100|44_93|-17_55|-17_55|22_40|19 ParticleDef_154_448 ParticleDef_179_399 ParticleDef_217_409 ParticleDef_231_434 ParticleDef_117_428 ParticleDef_24_406 ParticleDef_318_432 ParticleDef_56_458 ParticleDef_288_456 RectDef_271_103_38_271_TypeHurt_0 RectDef_466_-8_43_488_TypeHurt_0 MagnetDef_406_107 MagnetDef_344_259 RectDef_0_319_311_54_TypeHurt_0 Circle_36_15_92_TypeBrick Circle_128_14_31_TypeBrick Circle_25_119_37_TypeBrick Circle_561_109_40_TypeHurt Circle_562_374_45_TypeBrick Circle_290_104_20_TypeHurt Circle_288_345_37_TypeHurt ")); levels.push(new GameLevel("really hard!", 9, "ExitDef_541_416 RectDef_-3_0_34_482_TypeHurt_0 MagnetDef_139_199 MagnetDef_145_412 ParticleDef_91_37 ParticleDef_111_55 ParticleDef_128_26 ParticleDef_147_54 ParticleDef_124_80 ParticleDef_79_64 ParticleDef_77_88 Circle_41_306_45_TypeHurt Circle_302_475_43_TypeHurt RectDef_484_238_298_17_TypeHurt_132 RectDef_182_-3_17_429_TypeHurt_0 RectDef_664_51_199_17_TypeHurt_134 Circle_554_265_41_TypeBrick MagnetDef_357_233 ParticleDef_375_376 ParticleDef_372_405 Circle_426_52_75_TypeBrick Circle_344_92_31_TypeBrick Circle_191_-1_21_TypeHurt Circle_28_5_32_TypeHurt Circle_476_235_9_TypeHurt Circle_521_186_9_TypeHurt Circle_191_425_9_TypeHurt ")); levels.push(new GameLevel("the end! congratulations! awesome!", 10, "ExitDef_324_245 PolyDef_198_101_TypeBrick_0|0_0|-16_62|-16_62|1_50|1_50|-4_37|-4_37|76_25|76_24|-4_12|-4_12|2 PolyDef_289_89_TypeBrick_0|0_12|0_12|38_50|38_50|-1_61|-1_61|88_50|88_50|51_12|51_12|86_0|86 PolyDef_380_85_TypeBrick_0|0_58|0_58|11_12|12_12|43_32|43_32|55_12|55_12|85_55|85_55|97_0|97 PolyDef_201_318_TypeBrick_0|0_57|0_56|11_11|13_11|42_32|42_32|54_12|54_12|85_53|85_53|97_0|97 PolyDef_291_409_TypeBrick_0|0_0|-91_16|-91_50|-16_50|-85_62|-85_62|5_47|5_12|-70_12|-2 PolyDef_394_402_TypeBrick_0|0_0|-72_-7|-72_-7|-84_21|-84_32|-76_49|-42_49|-29_32|5_20|13_12|13_12|0_20|0_37|-31_37|-40_20|-71_11|-71_11|13_-3|13 Circle_204_101_6_TypeBrick Circle_254_101_6_TypeBrick Circle_295_91_6_TypeBrick Circle_345_91_6_TypeBrick Circle_295_177_6_TypeBrick Circle_345_176_6_TypeBrick Circle_435_91_6_TypeBrick Circle_410_134_6_TypeBrick Circle_434_176_6_TypeBrick Circle_390_409_6_TypeBrick Circle_388_324_6_TypeBrick Circle_297_408_6_TypeBrick Circle_347_324_6_TypeBrick Circle_254_409_6_TypeBrick Circle_256_324_6_TypeBrick ParticleDef_213_120 ParticleDef_242_146 ParticleDef_317_106 ParticleDef_320_162 ParticleDef_406_112 ParticleDef_425_154 ParticleDef_226_387 ParticleDef_239_341 ParticleDef_417_363 ParticleDef_313_390 ParticleDef_334_353 ")); var _local3:Array = SaveData.getInstance().completedLevels; _local1 = 0; while (_local1 < _local3.length) { _local5 = getLevel(_local1); _local5.isOpen = true; _local5.isCompleted = true; _local5.score = _local3[_local1]; _local1++; }; var _local4:GameLevel = getLevel(_local3.length); if (_local4){ _local4.isOpen = true; }; } public function levelNext():void{ var _local1:int = levels.indexOf(currentLevel); notesProxy.push(LEVEL_START, (_local1 + 1)); } public function pauseOff():void{ engine.pauseOff(); } public function levelComplete():void{ var _local1:uint; var _local4:GameLevel; currentLevel.complete(engine.elapsedTime); var _local2:uint; while (_local2 < levels.length) { _local4 = levels[_local2]; if (_local4.isCompleted){ _local1++; }; _local2++; }; SaveData.getInstance().saveLevels(levels); var _local3:GameLevel = getLevel((currentLevel.id + 1)); if (_local3){ _local3.isOpen = true; }; if (Factory.KONG_VERSION){ Factory.kongregate.scores.submit(getTotalScore()); Factory.kongregate.stats.submit("LevelsCompleted", _local1); }; if (_local1 == levels.length){ processGameComplete(); } else { processLevelComplete(); }; } public function gameStart():void{ engine.gameStart(); } private function processGameComplete():void{ var _local1:GameCompleteView = new GameCompleteView(); var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); _local2.getViewContainer().addChild(_local1); var _local3:GameCompleteMediator = new GameCompleteMediator(_local1); facade.registerMediator(_local3); } public function gameComplete():void{ engine.gameComplete(); } public function getLevels():Array{ return (levels); } private function particleCollectedHandler(_arg1:CoreEvent):void{ notesProxy.push(PARTICLE_COLLECTED); } public function getTotalScore():int{ var _local3:GameLevel; var _local1:int; var _local2:uint; while (_local2 < levels.length) { _local3 = levels[_local2]; if (_local3.isCompleted){ _local1 = (_local1 + _local3.score); }; _local2++; }; return (_local1); } private function processLevelComplete():void{ var _local1:LevelCompleteView = new LevelCompleteView(); var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); _local2.getViewContainer().addChild(_local1); var _local3:LevelCompleteMediator = new LevelCompleteMediator(_local1); facade.registerMediator(_local3); } private function levelCompleteHandler(_arg1:CoreEvent):void{ notesProxy.push(LEVEL_COMPLETE); } public function pauseOn():void{ engine.pauseOn(); } public function gameAbort():void{ destroy(); facade.removeProxy(NAME); } public function isPaused():Boolean{ return (engine.isPaused); } private function attractorChangedHandler(_arg1:CoreEvent):void{ notesProxy.push(ATTRACTOR_CHANGED, _arg1.data); } public function levelStart(_arg1:int):void{ var _local2:LevelMediator = (facade.retrieveMediator(LevelMediator.NAME) as LevelMediator); var _local3:LevelView = (_local2.getViewComponent() as LevelView); canvas = new CoreCanvas(_local3.levelContainer, _local3.bottom, _local3.objects, _local3.particles, _local3.tools, _local3.top, _local3.debug); engine.addEventListener(CoreEvent.UPDATE, updateHandler); engine.addEventListener(CoreEvent.LEVEL_COMPLETE, levelCompleteHandler); engine.addEventListener(CoreEvent.PARTICLE_COLLECTED, particleCollectedHandler); engine.addEventListener(CoreEvent.ATTRACTOR_CHANGED, attractorChangedHandler); score = 0; currentLevel = levels[_arg1]; currentLevel.collectedParticles = 0; engine.levelStart(currentLevel, canvas); } } }//package game.model
Section 210
//NotesProxy (game.model.NotesProxy) package game.model { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.proxy.*; public class NotesProxy extends Proxy implements IProxy { private var notes:Array; public static const NAME:String = "NotesProxy"; public function NotesProxy():void{ super(NAME); init(); } private function init():void{ notes = []; } private function sendNote():void{ var _local1:Object = notes[0]; if (_local1.name != GameProxy.LEVEL_UPDATE){ trace("note!", _local1.name); }; sendNotification(_local1.name, _local1.body); sendNoteComplete(); } public function push(_arg1:String, _arg2:Object=null):void{ var _local3:Object = {name:_arg1, body:_arg2}; notes.push(_local3); if (notes.length == 1){ sendNote(); }; } private function sendNoteComplete():void{ notes.splice(0, 1); if (notes.length > 0){ sendNote(); }; } } }//package game.model
Section 211
//SaveData (game.model.SaveData) package game.model { import flash.display.*; import flash.media.*; import flash.net.*; public class SaveData { public var sndTransform:SoundTransform; private var sharedObject:SharedObject; public var musicTransform:SoundTransform; public var isNewGame:Boolean; public var soundEnabled:Boolean; public var completedLevels:Array; public var graphicsQuality:uint; public var musicEnabled:Boolean; private static var instance:SaveData; public function SaveData():void{ } public function clearProgress():void{ isNewGame = true; completedLevels = []; sharedObject.data.isNewGame = isNewGame; sharedObject.data.completedLevels = completedLevels; sharedObject.flush(); } public function saveLevels(_arg1:Array):void{ var _local3:GameLevel; completedLevels = []; var _local2:uint; while (_local2 < _arg1.length) { _local3 = _arg1[_local2]; if (_local3.isCompleted){ completedLevels.push(_local3.score); }; _local2++; }; sharedObject.data.completedLevels = completedLevels; isNewGame = false; sharedObject.data.isNewGame = isNewGame; sharedObject.flush(); } public function toggleSoundEnabled():void{ soundEnabled = !(soundEnabled); sndTransform.volume = (soundEnabled) ? 1 : 0; sharedObject.data.soundEnabled = soundEnabled; sharedObject.flush(); } public function setGraphicsQuality(_arg1:uint):void{ var _local2:String; graphicsQuality = _arg1; switch (_arg1){ case 0: _local2 = StageQuality.LOW; break; case 1: _local2 = StageQuality.MEDIUM; break; case 2: _local2 = StageQuality.HIGH; break; }; ApplicationFacade.getInstance().viewContainer.stage.quality = _local2; sharedObject.data.graphicsQuality = graphicsQuality; sharedObject.flush(); } public function toggleMusicEnabled():void{ musicEnabled = !(musicEnabled); musicTransform.volume = (musicEnabled) ? 1 : 0; var _local1:ApplicationFacade = ApplicationFacade.getInstance(); var _local2:AppProxy = (_local1.retrieveProxy(AppProxy.NAME) as AppProxy); _local2.musicChannel.soundTransform = musicTransform; sharedObject.data.musicEnabled = musicEnabled; sharedObject.flush(); } public function initialize():void{ var _local1:uint; sharedObject = SharedObject.getLocal("gameData"); if (sharedObject.data.isNewGame == null){ isNewGame = true; } else { isNewGame = sharedObject.data.isNewGame; }; graphicsQuality = 2; soundEnabled = true; musicEnabled = true; sndTransform = new SoundTransform(); musicTransform = new SoundTransform(); if (sharedObject.data.soundEnabled != undefined){ soundEnabled = sharedObject.data.soundEnabled; }; if (sharedObject.data.musicEnabled != undefined){ musicEnabled = sharedObject.data.musicEnabled; }; if (sharedObject.data.graphicsQuality != undefined){ graphicsQuality = sharedObject.data.graphicsQuality; }; sndTransform.volume = (soundEnabled) ? 1 : 0; musicTransform.volume = (musicEnabled) ? 1 : 0; setGraphicsQuality(graphicsQuality); if (sharedObject.data.completedLevels == null){ completedLevels = []; } else { completedLevels = []; _local1 = 0; while (_local1 < sharedObject.data.completedLevels.length) { completedLevels.push(sharedObject.data.completedLevels[_local1]); _local1++; }; }; } public static function getInstance():SaveData{ if (instance == null){ instance = new (SaveData); }; return (instance); } } }//package game.model
Section 212
//AppView (game.view.components.AppView) package game.view.components { import game.model.*; import flash.display.*; public class AppView extends Sprite { private var window:Sprite; public var container:Sprite; public var popupContainer:Sprite; public var cursorContainer:Sprite; public function AppView(){ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("AppWindow"); window = new (_local1); addChild(window); container = (window.getChildByName("container") as Sprite); popupContainer = (window.getChildByName("popupContainer") as Sprite); cursorContainer = (window.getChildByName("cursorContainer") as Sprite); } } }//package game.view.components
Section 213
//CreditsView (game.view.components.CreditsView) package game.view.components { import game.model.*; import flash.display.*; public class CreditsView extends Sprite { public var egoshin_bt:SimpleButton; private var window:Sprite; public var karataev_bt:SimpleButton; public var inner:Sprite; public var sponsor_bt:SimpleButton; public var close_bt:SimpleButton; public var box2d_bt:SimpleButton; public function CreditsView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("CreditsWindow"); window = new (_local1); addChild(window); inner = (window.getChildByName("inner") as Sprite); close_bt = (inner.getChildByName("close_bt") as SimpleButton); sponsor_bt = (inner.getChildByName("sponsor_bt") as SimpleButton); egoshin_bt = (inner.getChildByName("egoshin_bt") as SimpleButton); karataev_bt = (inner.getChildByName("karataev_bt") as SimpleButton); box2d_bt = (inner.getChildByName("box2d_bt") as SimpleButton); } } }//package game.view.components
Section 214
//CustomCursorView (game.view.components.CustomCursorView) package game.view.components { import game.model.*; import flash.display.*; public class CustomCursorView extends Sprite { public var window:MovieClip; public function CustomCursorView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("CursorAsset"); window = new (_local1); addChild(window); } } }//package game.view.components
Section 215
//GameCompleteView (game.view.components.GameCompleteView) package game.view.components { import game.model.*; import flash.display.*; import flash.text.*; public class GameCompleteView extends Sprite { public var bbscore; public var totalScore_tf:TextField; public var submit_bt:SimpleButton; private var window:Sprite; public var mainMenu_bt:SimpleButton; public var totalScoreHolder:Sprite; public function GameCompleteView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("GameCompleteWindow"); window = new (_local1); addChild(window); mainMenu_bt = (window.getChildByName("mainMenu_bt") as SimpleButton); totalScoreHolder = (window.getChildByName("totalScoreHolder") as Sprite); totalScore_tf = (totalScoreHolder.getChildByName("totalScore_tf") as TextField); submit_bt = (window.getChildByName("submit_bt") as SimpleButton); bbscore = window.getChildByName("bbscore"); } } }//package game.view.components
Section 216
//GameOverView (game.view.components.GameOverView) package game.view.components { import game.model.*; import flash.display.*; public class GameOverView extends Sprite { private var window:Sprite; public var inner:Sprite; public var mainMenu_bt:SimpleButton; public var replay_bt:SimpleButton; public function GameOverView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("GameOverWindow"); window = new (_local1); addChild(window); inner = (window.getChildByName("inner") as Sprite); mainMenu_bt = (inner.getChildByName("mainMenu_bt") as SimpleButton); replay_bt = (inner.getChildByName("replay_bt") as SimpleButton); } } }//package game.view.components
Section 217
//LevelCompleteView (game.view.components.LevelCompleteView) package game.view.components { import game.model.*; import flash.display.*; import flash.text.*; public class LevelCompleteView extends Sprite { public var levelScoreHolder:Sprite; public var moreGames_bt:SimpleButton; public var levelNext_bt:SimpleButton; public var levelScore_tf:TextField; public var bbscore; private var window:Sprite; public var levelSelect_bt:SimpleButton; public var totalScore_tf:TextField; public var inner:Sprite; public var submit_bt:SimpleButton; public var totalScoreHolder:Sprite; public function LevelCompleteView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("LevelCompleteWindow"); window = new (_local1); addChild(window); inner = (window.getChildByName("inner") as Sprite); levelSelect_bt = (inner.getChildByName("levelSelect_bt") as SimpleButton); levelNext_bt = (inner.getChildByName("levelNext_bt") as SimpleButton); levelScoreHolder = (inner.getChildByName("levelScoreHolder") as Sprite); totalScoreHolder = (inner.getChildByName("totalScoreHolder") as Sprite); levelScore_tf = (levelScoreHolder.getChildByName("levelScore_tf") as TextField); totalScore_tf = (totalScoreHolder.getChildByName("totalScore_tf") as TextField); submit_bt = (inner.getChildByName("submit_bt") as SimpleButton); bbscore = inner.getChildByName("bbscore"); moreGames_bt = (inner.getChildByName("moreGames_bt") as SimpleButton); } } }//package game.view.components
Section 218
//LevelItem (game.view.components.LevelItem) package game.view.components { import flash.events.*; import game.model.*; import flash.display.*; import flash.text.*; public class LevelItem extends Sprite { public var level:GameLevel; private var back:MovieClip; private var num_tf:TextField; private var frame:Sprite; private var window:Sprite; public static const SELECT:String = "Select"; public static const ROLL_OVER:String = "RollOver"; public function LevelItem():void{ init(); } public function destroy():void{ removeEventListener(MouseEvent.CLICK, clickHandler); removeEventListener(MouseEvent.ROLL_OVER, rollOverHandler); } private function clickHandler(_arg1:MouseEvent):void{ if (level.isOpen){ dispatchEvent(new Event(SELECT)); }; } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("LevelItemWindow"); window = new (_local1); addChild(window); back = (window.getChildByName("back") as MovieClip); num_tf = (window.getChildByName("num_tf") as TextField); frame = (window.getChildByName("frame") as Sprite); back.stop(); frame.visible = false; addEventListener(MouseEvent.CLICK, clickHandler); addEventListener(MouseEvent.ROLL_OVER, rollOverHandler); } public function rollOver():void{ frame.visible = true; } public function rollOut():void{ frame.visible = false; } private function rollOverHandler(_arg1:MouseEvent):void{ dispatchEvent(new Event(ROLL_OVER)); } private function rollOutHandler(_arg1:MouseEvent):void{ back.gotoAndStop(1); } public function initialize(_arg1:GameLevel):void{ this.level = _arg1; num_tf.text = (_arg1.id + 1).toString(); if (_arg1.isOpen){ if (_arg1.isCompleted){ back.gotoAndStop(3); } else { back.gotoAndStop(1); }; } else { back.gotoAndStop(2); }; } } }//package game.view.components
Section 219
//LevelItem2 (game.view.components.LevelItem2) package game.view.components { import flash.events.*; import game.model.*; import flash.display.*; public class LevelItem2 extends EventDispatcher { public var level:GameLevel; private var back:MovieClip; private var frame:Sprite; private var over:Sprite; private var window:MovieClip; public static const SELECT:String = "Select"; public static const ROLL_OVER:String = "RollOver"; public function LevelItem2(_arg1:MovieClip):void{ this.window = _arg1; init(); } public function destroy():void{ over.removeEventListener(MouseEvent.CLICK, clickHandler); over.removeEventListener(MouseEvent.ROLL_OVER, rollOverHandler); } private function clickHandler(_arg1:MouseEvent):void{ if (level.isOpen){ dispatchEvent(new Event(SELECT)); }; } private function init():void{ back = (window.getChildByName("back") as MovieClip); frame = (window.getChildByName("frame") as Sprite); over = (window.getChildByName("over") as Sprite); window.stop(); frame.visible = false; frame.mouseEnabled = false; frame.mouseChildren = false; } public function rollOver():void{ frame.visible = true; } public function rollOut():void{ frame.visible = false; } private function rollOverHandler(_arg1:MouseEvent):void{ dispatchEvent(new Event(ROLL_OVER)); } private function rollOutHandler(_arg1:MouseEvent):void{ rollOut(); } public function initialize(_arg1:GameLevel):void{ this.level = _arg1; if (_arg1.isOpen){ over.buttonMode = true; over.addEventListener(MouseEvent.CLICK, clickHandler); over.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler); if (_arg1.isCompleted){ window.gotoAndStop(2); } else { window.gotoAndStop(1); }; } else { window.alpha = 0.6; }; } } }//package game.view.components
Section 220
//LevelPauseView (game.view.components.LevelPauseView) package game.view.components { import game.model.*; import flash.display.*; public class LevelPauseView extends Sprite { public var restart_bt:SimpleButton; public var resume_bt:SimpleButton; private var window:Sprite; public var levelSelect_bt:SimpleButton; public var inner:Sprite; public var mainMenu_bt:SimpleButton; public function LevelPauseView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("LevelPauseWindow"); window = new (_local1); addChild(window); inner = (window.getChildByName("inner") as Sprite); resume_bt = (inner.getChildByName("resume_bt") as SimpleButton); restart_bt = (inner.getChildByName("restart_bt") as SimpleButton); levelSelect_bt = (inner.getChildByName("levelSelect_bt") as SimpleButton); mainMenu_bt = (inner.getChildByName("mainMenu_bt") as SimpleButton); } } }//package game.view.components
Section 221
//LevelSelectView (game.view.components.LevelSelectView) package game.view.components { import game.model.*; import flash.display.*; public class LevelSelectView extends Sprite { private var window:Sprite; public var itemsContainer:Sprite; public var menu_bt:SimpleButton; public var items2:Array; public var items2Container:Sprite; public function LevelSelectView():void{ init(); } private function init():void{ var _local3:Sprite; var _local1:Class = GameAssets.getInstance().getAssetClass("LevelSelectWindow"); window = new (_local1); addChild(window); itemsContainer = (window.getChildByName("itemsContainer") as Sprite); menu_bt = (window.getChildByName("menu_bt") as SimpleButton); items2Container = (window.getChildByName("items2Container") as Sprite); items2 = []; var _local2:uint = 1; while (_local2 <= 20) { _local3 = (items2Container.getChildByName(("item" + _local2)) as Sprite); items2.push(_local3); _local2++; }; } } }//package game.view.components
Section 222
//LevelView (game.view.components.LevelView) package game.view.components { import game.model.*; import flash.display.*; import flash.text.*; public class LevelView extends Sprite { public var needParticles_tf:TextField; public var levelName_tf:TextField; public var restart_bt:SimpleButton; public var pause_bt:SimpleButton; public var fps_tf:TextField; public var debug:Sprite; public var objects:Sprite; public var top:Sprite; public var tools:Sprite; public var levelContainer:Sprite; public var levelContainerBack:Sprite; public var bottom:Sprite; public var sponsorLogo_bt:SimpleButton; public var particles:Sprite; public var totalParticles_tf:TextField; private var window:Sprite; public var collectedParticles_tf:TextField; public var textfields:Sprite; public var fpsHolder:Sprite; public function LevelView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("LevelWindow"); window = new (_local1); addChild(window); levelContainer = (window.getChildByName("levelContainer") as Sprite); levelContainerBack = (levelContainer.getChildByName("back") as Sprite); bottom = (levelContainer.getChildByName("bottom") as Sprite); objects = (levelContainer.getChildByName("objects") as Sprite); particles = (levelContainer.getChildByName("particles") as Sprite); tools = (levelContainer.getChildByName("tools") as Sprite); top = (levelContainer.getChildByName("top") as Sprite); debug = (levelContainer.getChildByName("debug") as Sprite); levelName_tf = (window.getChildByName("levelName_tf") as TextField); textfields = (window.getChildByName("textfields") as Sprite); totalParticles_tf = (textfields.getChildByName("total_tf") as TextField); collectedParticles_tf = (textfields.getChildByName("collected_tf") as TextField); needParticles_tf = (textfields.getChildByName("need_tf") as TextField); pause_bt = (window.getChildByName("pause_bt") as SimpleButton); fpsHolder = (window.getChildByName("fpsHolder") as Sprite); fps_tf = (fpsHolder.getChildByName("fps_tf") as TextField); sponsorLogo_bt = (window.getChildByName("sponsorLogo_bt") as SimpleButton); restart_bt = (window.getChildByName("restart_bt") as SimpleButton); levelName_tf.mouseEnabled = false; textfields.mouseEnabled = false; textfields.mouseChildren = false; } } }//package game.view.components
Section 223
//LogoView (game.view.components.LogoView) package game.view.components { import flash.events.*; import game.model.*; import flash.display.*; import flash.net.*; import caurina.transitions.*; public class LogoView extends Sprite { private var window:Sprite; public var inner:Sprite; public var splash:MovieClip; public function LogoView():void{ init(); } private function splashEfHandler(_arg1:Event):void{ if (splash.currentFrame == 137){ splash.stop(); splash.removeEventListener(Event.ENTER_FRAME, splashEfHandler); if (!Factory.DEBUG){ Tweener.addTween(splash, {alpha:0, time:0.5, transition:"linear"}); Tweener.addTween(inner, {alpha:1, time:0.7, delay:0.3, transition:"linear"}); Tweener.addTween(window, {alpha:0, time:0.7, transition:"linear", delay:2, onComplete:dissapearComplete}); } else { dissapearComplete(); }; }; } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("IslandGamesWindow"); window = new (_local1); addChild(window); splash = (window.getChildByName("splash") as MovieClip); inner = (window.getChildByName("inner") as Sprite); splash.buttonMode = true; splash.addEventListener(Event.ENTER_FRAME, splashEfHandler); splash.addEventListener(MouseEvent.CLICK, splashClickHandler); inner.alpha = 0; if (Factory.DEBUG){ splash.gotoAndPlay(136); }; } private function splashClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1290&subid=splash"), "_blank"); } private function dissapearComplete():void{ splash.removeEventListener(MouseEvent.CLICK, splashClickHandler); window.parent.removeChild(window); } } }//package game.view.components
Section 224
//MainMenuView (game.view.components.MainMenuView) package game.view.components { import game.model.*; import flash.display.*; public class MainMenuView extends Sprite { public var moreGames_bt:SimpleButton; public var highscores_bt:SimpleButton; public var sureYes:SimpleButton; public var options_bt:SimpleButton; public var credits_bt:SimpleButton; public var sureHolder:Sprite; public var editor_bt:SimpleButton; public var continue_bt:SimpleButton; private var window:Sprite; public var sureNo:SimpleButton; public var sponsorLogo_bt:SimpleButton; public var startGame_bt:SimpleButton; public function MainMenuView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("MainMenuWindow"); window = new (_local1); addChild(window); startGame_bt = (window.getChildByName("startGame_bt") as SimpleButton); options_bt = (window.getChildByName("options_bt") as SimpleButton); credits_bt = (window.getChildByName("credits_bt") as SimpleButton); editor_bt = (window.getChildByName("editor_bt") as SimpleButton); continue_bt = (window.getChildByName("continue_bt") as SimpleButton); sureHolder = (window.getChildByName("sureHolder") as Sprite); sureYes = (sureHolder.getChildByName("sureYes") as SimpleButton); sureNo = (sureHolder.getChildByName("sureNo") as SimpleButton); sponsorLogo_bt = (window.getChildByName("sponsorLogo_bt") as SimpleButton); highscores_bt = (window.getChildByName("highscores_bt") as SimpleButton); moreGames_bt = (window.getChildByName("moreGames_bt") as SimpleButton); } } }//package game.view.components
Section 225
//OptionsView (game.view.components.OptionsView) package game.view.components { import game.model.*; import flash.display.*; public class OptionsView extends Sprite { public var qualityHigh:MovieClip; public var musicOn:MovieClip; public var soundOff:MovieClip; public var qualityMed:MovieClip; public var soundOn:MovieClip; private var window:Sprite; public var musicOff:MovieClip; public var qualityLow:MovieClip; public var inner:Sprite; public var close_bt:SimpleButton; public function OptionsView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("OptionsWindow"); window = new (_local1); addChild(window); inner = (window.getChildByName("inner") as Sprite); close_bt = (inner.getChildByName("close_bt") as SimpleButton); qualityLow = (inner.getChildByName("qualityLow") as MovieClip); qualityMed = (inner.getChildByName("qualityMed") as MovieClip); qualityHigh = (inner.getChildByName("qualityHigh") as MovieClip); soundOn = (inner.getChildByName("soundOn") as MovieClip); soundOff = (inner.getChildByName("soundOff") as MovieClip); musicOn = (inner.getChildByName("musicOn") as MovieClip); musicOff = (inner.getChildByName("musicOff") as MovieClip); } } }//package game.view.components
Section 226
//AppMediator (game.view.AppMediator) package game.view { import org.puremvc.as3.interfaces.*; import game.view.components.*; import flash.display.*; import flash.media.*; import org.puremvc.as3.patterns.mediator.*; public class AppMediator extends Mediator implements IMediator { private var _view:AppView; private var sndChannel:SoundChannel; public static const NAME:String = "AppMediator"; public function AppMediator(_arg1:AppView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([]); } override public function handleNotification(_arg1:INotification):void{ } public function getViewContainer():Sprite{ return (_view.container); } public function getPopupContainer():Sprite{ return (_view.popupContainer); } private function init():void{ _view = (getViewComponent() as AppView); _view.tabChildren = false; _view.cursorContainer.mouseEnabled = false; _view.cursorContainer.mouseChildren = false; } public function getCursorContainer():Sprite{ return (_view.cursorContainer); } } }//package game.view
Section 227
//CreditsMediator (game.view.CreditsMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.view.components.*; import flash.net.*; import org.puremvc.as3.patterns.mediator.*; public class CreditsMediator extends Mediator implements IMediator { private var _view:CreditsView; public static const NAME:String = "CreditsMediator"; public function CreditsMediator(_arg1:CreditsView):void{ super(NAME, _arg1); init(); } private function closeClickHandler(_arg1:MouseEvent):void{ destroy(); } override public function handleNotification(_arg1:INotification):void{ } private function karataevClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("mailto:eugene.karataev@gmail.com"), "_blank"); } override public function listNotificationInterests():Array{ return ([]); } private function egoshinClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("mailto:muaddib999@rambler.ru"), "_blank"); } private function init():void{ _view = (getViewComponent() as CreditsView); _view.close_bt.addEventListener(MouseEvent.CLICK, closeClickHandler); _view.sponsor_bt.addEventListener(MouseEvent.CLICK, sponsorClickHandler); _view.egoshin_bt.addEventListener(MouseEvent.CLICK, egoshinClickHandler); _view.karataev_bt.addEventListener(MouseEvent.CLICK, karataevClickHandler); _view.box2d_bt.addEventListener(MouseEvent.CLICK, box2dClickHandler); } private function destroy():void{ _view.close_bt.removeEventListener(MouseEvent.CLICK, closeClickHandler); _view.egoshin_bt.removeEventListener(MouseEvent.CLICK, egoshinClickHandler); _view.karataev_bt.removeEventListener(MouseEvent.CLICK, karataevClickHandler); _view.box2d_bt.removeEventListener(MouseEvent.CLICK, box2dClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function sponsorClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1290&subid=credits"), "_blank"); } private function box2dClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://www.box2d.org"), "_blank"); } } }//package game.view
Section 228
//CustomCursorMediator (game.view.CustomCursorMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.mediator.*; import flash.ui.*; public class CustomCursorMediator extends Mediator implements IMediator { private var _view:CustomCursorView; private var isPlayingLevel:Boolean; public static const NAME:String = "CustomCursorMediator"; public function CustomCursorMediator(_arg1:CustomCursorView):void{ super(NAME, _arg1); init(); } private function mouseDownHandler(_arg1:MouseEvent):void{ if (isPlayingLevel){ Mouse.hide(); }; } private function mouseUpHandler(_arg1:MouseEvent):void{ } override public function listNotificationInterests():Array{ return ([GameProxy.GAME_COMPLETE, GameProxy.GAME_OVER, GameProxy.PAUSE_ON, GameProxy.PAUSE_OFF, GameProxy.LEVEL_START, GameProxy.LEVEL_COMPLETE, GameProxy.LEVEL_ABORT, GameProxy.ATTRACTOR_CHANGED]); } private function attractorChanged(_arg1:Boolean):void{ if (_arg1){ _view.window.gotoAndStop(2); } else { _view.window.gotoAndStop(1); }; } private function mouseMoveHandler(_arg1:MouseEvent):void{ _view.x = _view.stage.mouseX; _view.y = _view.stage.mouseY; } private function init():void{ _view = (getViewComponent() as CustomCursorView); _view.window.stop(); _view.window.visible = false; isPlayingLevel = false; _view.x = -100; _view.y = -100; _view.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); _view.stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); _view.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); mouseMoveHandler(null); } private function hideLevelCursor():void{ Mouse.show(); _view.window.visible = false; isPlayingLevel = false; } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case GameProxy.LEVEL_START: case GameProxy.PAUSE_OFF: showLevelCursor(); break; case GameProxy.LEVEL_COMPLETE: case GameProxy.LEVEL_ABORT: case GameProxy.GAME_COMPLETE: case GameProxy.GAME_OVER: case GameProxy.PAUSE_ON: hideLevelCursor(); break; case GameProxy.ATTRACTOR_CHANGED: attractorChanged((_arg1.getBody() as Boolean)); break; }; } private function showLevelCursor():void{ Mouse.hide(); _view.window.visible = true; isPlayingLevel = true; } } }//package game.view
Section 229
//GameCompleteMediator (game.view.GameCompleteMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; public class GameCompleteMediator extends Mediator implements IMediator { private var _view:GameCompleteView; private var notesProxy:NotesProxy; public static const NAME:String = "GameCompleteMediator"; public function GameCompleteMediator(_arg1:GameCompleteView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([]); } private function submitClickHandler(_arg1:MouseEvent):void{ trace("submit"); } override public function handleNotification(_arg1:INotification):void{ } private function replayClickHandler(_arg1:MouseEvent):void{ notesProxy.push(AppProxy.GAME_ABORT); notesProxy.push(AppProxy.GAME_START); } private function init():void{ _view = (getViewComponent() as GameCompleteView); notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _view.alpha = 0; Tweener.addTween(_view, {alpha:1, time:0.5, transition:"linear"}); var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _view.totalScore_tf.text = _local1.getTotalScore().toString(); _view.bbscore.setScore(_local1.getTotalScore(), 1290); _view.submit_bt.visible = false; _view.mainMenu_bt.addEventListener(MouseEvent.CLICK, mainMenuClickHandler); _view.submit_bt.addEventListener(MouseEvent.CLICK, submitClickHandler); } private function mainMenuClickHandler(_arg1:MouseEvent):void{ notesProxy.push(AppProxy.GAME_ABORT); } public function destroy():void{ _view.mainMenu_bt.removeEventListener(MouseEvent.CLICK, mainMenuClickHandler); _view.submit_bt.removeEventListener(MouseEvent.CLICK, submitClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } } }//package game.view
Section 230
//GameOverMediator (game.view.GameOverMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import flash.display.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; public class GameOverMediator extends Mediator implements IMediator { private var _view:GameOverView; private var notesProxy:NotesProxy; private var levelContainer:Sprite; public static const NAME:String = "GameOverMediator"; public function GameOverMediator(_arg1:GameOverView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([]); } public function destroy():void{ _view.mainMenu_bt.removeEventListener(MouseEvent.CLICK, mainMenuClickHandler); _view.replay_bt.removeEventListener(MouseEvent.CLICK, replayClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } override public function handleNotification(_arg1:INotification):void{ } private function mainMenuClickHandler(_arg1:MouseEvent):void{ notesProxy.push(AppProxy.GAME_ABORT); } private function init():void{ _view = (getViewComponent() as GameOverView); notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); var _local1:LevelMediator = (facade.retrieveMediator(LevelMediator.NAME) as LevelMediator); var _local2:LevelView = (_local1.getViewComponent() as LevelView); levelContainer = _local2.levelContainer; _view.inner.y = -480; Tweener.addTween(_view.inner, {y:0, time:1, transition:"easeinoutquad", onComplete:showComplete}); Tweener.addTween(levelContainer, {y:480, time:1, transition:"easeinoutquad"}); } private function showComplete():void{ _view.mainMenu_bt.addEventListener(MouseEvent.CLICK, mainMenuClickHandler); _view.replay_bt.addEventListener(MouseEvent.CLICK, replayClickHandler); } private function replayClickHandler(_arg1:MouseEvent):void{ notesProxy.push(AppProxy.GAME_ABORT); notesProxy.push(AppProxy.GAME_START); } } }//package game.view
Section 231
//LevelCompleteMediator (game.view.LevelCompleteMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import flash.net.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; public class LevelCompleteMediator extends Mediator implements IMediator { private var _view:LevelCompleteView; private var notesProxy:NotesProxy; private var gameProxy:GameProxy; public static const NAME:String = "LevelCompleteMediator"; public function LevelCompleteMediator(_arg1:LevelCompleteView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([]); } private function levelSelectClickHandler(_arg1:MouseEvent):void{ levelCompleteEnd(); notesProxy.push(GameProxy.LEVEL_ABORT); } public function destroy():void{ _view.levelSelect_bt.removeEventListener(MouseEvent.CLICK, levelSelectClickHandler); _view.levelNext_bt.removeEventListener(MouseEvent.CLICK, levelNextClickHandler); _view.submit_bt.removeEventListener(MouseEvent.CLICK, submitClickHandler); _view.moreGames_bt.removeEventListener(MouseEvent.CLICK, moreGamesClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } override public function handleNotification(_arg1:INotification):void{ } private function appearComplete():void{ _view.levelSelect_bt.addEventListener(MouseEvent.CLICK, levelSelectClickHandler); _view.levelNext_bt.addEventListener(MouseEvent.CLICK, levelNextClickHandler); _view.submit_bt.addEventListener(MouseEvent.CLICK, submitClickHandler); } private function init():void{ _view = (getViewComponent() as LevelCompleteView); notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); gameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _view.levelScore_tf.text = gameProxy.currentLevel.score.toString(); _view.totalScore_tf.text = gameProxy.getTotalScore().toString(); _view.bbscore.setScore(gameProxy.getTotalScore(), 1290); _view.submit_bt.visible = false; _view.moreGames_bt.addEventListener(MouseEvent.CLICK, moreGamesClickHandler); _view.inner.alpha = 0; Tweener.addTween(_view.inner, {alpha:1, time:0.5, transition:"linear", onComplete:appearComplete}); } private function moreGamesClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1290&subid=levelcomplete"), "_blank"); } private function levelNextClickHandler(_arg1:MouseEvent):void{ levelCompleteEnd(); var _local2:GameLevel = gameProxy.getLevel((gameProxy.currentLevel.id + 1)); if (_local2){ notesProxy.push(GameProxy.LEVEL_ABORT); notesProxy.push(GameProxy.LEVEL_START, (gameProxy.currentLevel.id + 1)); } else { notesProxy.push(GameProxy.LEVEL_ABORT); }; } private function submitClickHandler(_arg1:MouseEvent):void{ trace("submit"); } private function levelCompleteEnd():void{ var _local1:LevelMediator = (facade.retrieveMediator(LevelMediator.NAME) as LevelMediator); _local1.destroy(); gameProxy.destroy(); } } }//package game.view
Section 232
//LevelMediator (game.view.LevelMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import flash.display.*; import flash.net.*; import org.puremvc.as3.patterns.mediator.*; import flash.utils.*; import caurina.transitions.*; public class LevelMediator extends Mediator implements IMediator { private var _view:LevelView; private var frames:int; private var time:int; public static const NAME:String = "LevelMediator"; public function LevelMediator(_arg1:LevelView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([GameProxy.LEVEL_UPDATE, GameProxy.GAME_OVER, GameProxy.LEVEL_START, GameProxy.PARTICLE_COLLECTED]); } public function destroy():void{ _view.sponsorLogo_bt.removeEventListener(MouseEvent.CLICK, sponsorClickHandler); _view.pause_bt.removeEventListener(MouseEvent.CLICK, pauseClickHandler); _view.restart_bt.removeEventListener(MouseEvent.CLICK, restartClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case GameProxy.LEVEL_UPDATE: levelUpdate(); break; case GameProxy.GAME_OVER: gameOver(); break; case GameProxy.LEVEL_START: levelStart(); break; case GameProxy.PARTICLE_COLLECTED: particleCollected(); break; }; } private function particleCollected():void{ var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _view.collectedParticles_tf.text = _local1.currentLevel.collectedParticles.toString(); } private function levelUpdate():void{ if ((getTimer() - 1000) >= time){ _view.fps_tf.text = frames.toString(); frames = 0; time = getTimer(); } else { frames++; }; } private function appearComplete():void{ _view.pause_bt.addEventListener(MouseEvent.CLICK, pauseClickHandler); _view.restart_bt.addEventListener(MouseEvent.CLICK, restartClickHandler); } private function init():void{ _view = (getViewComponent() as LevelView); _view.fpsHolder.visible = false; _view.sponsorLogo_bt.addEventListener(MouseEvent.CLICK, sponsorClickHandler); _view.alpha = 0; Tweener.addTween(_view, {alpha:1, time:0.3, transition:"linear", onComplete:appearComplete}); } private function restartClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); var _local3:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local2.push(GameProxy.LEVEL_ABORT); _local2.push(GameProxy.LEVEL_START, _local3.currentLevel.id); } private function gameOver():void{ } private function pauseClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(GameProxy.PAUSE_ON); } private function sponsorClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1290&subid=ingame"), "_blank"); } private function levelStart():void{ var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); var _local2:int = _local1.getLevels().indexOf(_local1.currentLevel); _view.levelName_tf.text = _local1.currentLevel.name; _view.totalParticles_tf.text = _local1.currentLevel.totalParticles.toString(); _view.collectedParticles_tf.text = _local1.currentLevel.collectedParticles.toString(); _view.needParticles_tf.text = _local1.currentLevel.needParticles.toString(); if (_local2 == 0){ addTutorial(); }; } private function addTutorial():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("TutorialAsset"); var _local2:Sprite = new (_local1); _view.levelContainerBack.addChild(_local2); } } }//package game.view
Section 233
//LevelPauseMediator (game.view.LevelPauseMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import flash.display.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; import flash.ui.*; public class LevelPauseMediator extends Mediator implements IMediator { private var isTweened:Boolean; private var _view:LevelPauseView; private var gameProxy:GameProxy; private var levelContainer:Sprite; private var notesProxy:NotesProxy; public static const NAME:String = "LevelPauseMediator"; public function LevelPauseMediator(_arg1:LevelPauseView):void{ super(NAME, _arg1); init(); } private function togglePause():void{ if (isTweened){ return; }; if (gameProxy.isPaused()){ isTweened = true; Tweener.addTween(_view.inner, {alpha:0, time:0.5, transition:"easeinoutquad", onComplete:hideComplete}); } else { notesProxy.push(GameProxy.PAUSE_ON); }; } public function destroy():void{ _view.stage.removeEventListener(KeyboardEvent.KEY_UP, keyUpHandler); _view.resume_bt.removeEventListener(MouseEvent.CLICK, resumeClickHandler); _view.restart_bt.removeEventListener(MouseEvent.CLICK, restartClickHandler); _view.levelSelect_bt.removeEventListener(MouseEvent.CLICK, levelSelectClickHandler); _view.mainMenu_bt.removeEventListener(MouseEvent.CLICK, mainMenuClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case GameProxy.PAUSE_ON: pauseOn(); break; }; } private function init():void{ _view = (getViewComponent() as LevelPauseView); gameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); var _local1:LevelMediator = (facade.retrieveMediator(LevelMediator.NAME) as LevelMediator); var _local2:LevelView = (_local1.getViewComponent() as LevelView); levelContainer = _local2.levelContainer; _view.stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler); _view.resume_bt.addEventListener(MouseEvent.CLICK, resumeClickHandler); _view.restart_bt.addEventListener(MouseEvent.CLICK, restartClickHandler); _view.levelSelect_bt.addEventListener(MouseEvent.CLICK, levelSelectClickHandler); _view.mainMenu_bt.addEventListener(MouseEvent.CLICK, mainMenuClickHandler); _view.visible = false; isTweened = false; } private function restartClickHandler(_arg1:MouseEvent):void{ restartLevel(); } private function showComplete():void{ isTweened = false; } private function keyUpHandler(_arg1:KeyboardEvent):void{ if ((((_arg1.keyCode == 27)) || ((_arg1.keyCode == Keyboard.SPACE)))){ togglePause(); } else { if (_arg1.keyCode == 82){ restartLevel(); } else { if (_arg1.keyCode == 70){ }; }; }; } private function hideComplete():void{ isTweened = false; _view.visible = false; gameProxy.pauseOff(); notesProxy.push(GameProxy.PAUSE_OFF); } private function levelSelectClickHandler(_arg1:MouseEvent):void{ notesProxy.push(GameProxy.LEVEL_ABORT); } override public function listNotificationInterests():Array{ return ([GameProxy.PAUSE_ON]); } private function resumeClickHandler(_arg1:MouseEvent):void{ togglePause(); } private function restartLevel():void{ notesProxy.push(GameProxy.LEVEL_ABORT); notesProxy.push(GameProxy.LEVEL_START, gameProxy.currentLevel.id); } private function mainMenuClickHandler(_arg1:MouseEvent):void{ notesProxy.push(AppProxy.GAME_ABORT); } private function pauseOn():void{ if (isTweened){ return; }; gameProxy.pauseOn(); _view.visible = true; isTweened = true; _view.inner.alpha = 0; Tweener.addTween(_view.inner, {alpha:1, time:0.5, transition:"linear", onComplete:showComplete}); } } }//package game.view
Section 234
//LevelSelectMediator (game.view.LevelSelectMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.mediator.*; public class LevelSelectMediator extends Mediator implements IMediator { private var items:Array; private var _view:LevelSelectView; private var rollOverItem:LevelItem2; private var currentItem:LevelItem2; private var notesProxy:NotesProxy; public static const NAME:String = "LevelSelectMediator"; public function LevelSelectMediator(_arg1:LevelSelectView){ super(NAME, _arg1); init(); } private function getLevelItem(_arg1:GameLevel):LevelItem2{ var _local3:LevelItem2; var _local2:uint; while (_local2 < items.length) { _local3 = items[_local2]; if (_local3.level == _arg1){ return (_local3); }; _local2++; }; return (null); } override public function listNotificationInterests():Array{ return ([]); } private function itemRollOverHandler(_arg1:Event):void{ var _local2:LevelItem2 = (_arg1.target as LevelItem2); itemRollOver(_local2); } public function destroy():void{ destroyItems(); _view.menu_bt.removeEventListener(MouseEvent.CLICK, menuClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function createItems2():void{ var _local4:LevelItem2; var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); var _local2:Array = _local1.getLevels(); items = []; var _local3:uint; while (_local3 < 20) { _local4 = new LevelItem2(_view.items2[_local3]); _local4.initialize(_local2[_local3]); _local4.addEventListener(LevelItem.SELECT, itemSelectHandler); _local4.addEventListener(LevelItem.ROLL_OVER, itemRollOverHandler); items.push(_local4); _local3++; }; } private function init():void{ _view = (getViewComponent() as LevelSelectView); notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); createItems2(); _view.menu_bt.addEventListener(MouseEvent.CLICK, menuClickHandler); } private function itemRollOver(_arg1:LevelItem2):void{ var _local2:GameProxy; var _local3:GameLevel; if (_arg1 != rollOverItem){ if (rollOverItem){ rollOverItem.rollOut(); }; rollOverItem = _arg1; rollOverItem.rollOver(); _local2 = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local3 = _local2.getLevels()[_arg1.level.id]; }; } private function destroyItems():void{ var _local2:LevelItem2; var _local1:uint; while (_local1 < items.length) { _local2 = items[_local1]; _local2.destroy(); _local2.removeEventListener(LevelItem.SELECT, itemSelectHandler); _local2.removeEventListener(LevelItem.ROLL_OVER, itemRollOverHandler); _local1++; }; } override public function handleNotification(_arg1:INotification):void{ } private function menuClickHandler(_arg1:MouseEvent):void{ notesProxy.push(AppProxy.GAME_ABORT); } private function itemSelectHandler(_arg1:Event):void{ var _local2:LevelItem2 = (_arg1.target as LevelItem2); currentItem = _local2; notesProxy.push(GameProxy.LEVEL_START, currentItem.level.id); } private function createItems():void{ var _local4:LevelItem; var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); var _local2:Array = _local1.getLevels(); items = []; var _local3:uint; while (_local3 < _local2.length) { _local4 = new LevelItem(); _local4.initialize(_local2[_local3]); _local4.x = ((_local3 % 10) * 50); _local4.y = (Math.floor((_local3 / 10)) * 50); _local4.addEventListener(LevelItem.SELECT, itemSelectHandler); _local4.addEventListener(LevelItem.ROLL_OVER, itemRollOverHandler); _view.itemsContainer.addChild(_local4); items.push(_local4); _local3++; }; if (_local1.currentLevel){ itemRollOver(getLevelItem(_local1.currentLevel)); } else { itemRollOver(items[0]); }; } } }//package game.view
Section 235
//MainMenuMediator (game.view.MainMenuMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import flash.net.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; public class MainMenuMediator extends Mediator implements IMediator { private var _view:MainMenuView; private var notesProxy:NotesProxy; public static const NAME:String = "MainMenuMediator"; public function MainMenuMediator(_arg1:MainMenuView){ super(NAME, _arg1); init(); } private function optionsClickHandler(_arg1:MouseEvent):void{ var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local3:OptionsView = new OptionsView(); _local2.getViewContainer().addChild(_local3); var _local4:OptionsMediator = new OptionsMediator(_local3); facade.registerMediator(_local4); } public function destroy():void{ _view.startGame_bt.removeEventListener(MouseEvent.CLICK, startGameClickHandler); _view.options_bt.removeEventListener(MouseEvent.CLICK, optionsClickHandler); _view.credits_bt.removeEventListener(MouseEvent.CLICK, creditsClickHandler); _view.editor_bt.removeEventListener(MouseEvent.CLICK, editorClickHandler); _view.continue_bt.removeEventListener(MouseEvent.CLICK, continueClickHandler); _view.sureYes.removeEventListener(MouseEvent.CLICK, sureYesClickHandler); _view.sureNo.removeEventListener(MouseEvent.CLICK, sureNoClickHandler); _view.sponsorLogo_bt.removeEventListener(MouseEvent.CLICK, sponsorClickHandler); _view.highscores_bt.removeEventListener(MouseEvent.CLICK, highscoresClickHandler); _view.moreGames_bt.removeEventListener(MouseEvent.CLICK, moreGamesClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function creditsClickHandler(_arg1:MouseEvent):void{ var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local3:CreditsView = new CreditsView(); _local2.getViewContainer().addChild(_local3); var _local4:CreditsMediator = new CreditsMediator(_local3); facade.registerMediator(_local4); } private function highscoresClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1290&subid=scores&action=viewscores"), "_blank"); } override public function listNotificationInterests():Array{ return ([]); } private function continueClickHandler(_arg1:MouseEvent):void{ notesProxy.push(AppProxy.GAME_START); } override public function handleNotification(_arg1:INotification):void{ } private function moreGamesClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1290&subid=moregames"), "_blank"); } private function editorClickHandler(_arg1:MouseEvent):void{ notesProxy.push(AppProxy.EDITOR_START); } private function init():void{ _view = (getViewComponent() as MainMenuView); notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _view.startGame_bt.addEventListener(MouseEvent.CLICK, startGameClickHandler); _view.options_bt.addEventListener(MouseEvent.CLICK, optionsClickHandler); _view.credits_bt.addEventListener(MouseEvent.CLICK, creditsClickHandler); _view.editor_bt.addEventListener(MouseEvent.CLICK, editorClickHandler); _view.sponsorLogo_bt.addEventListener(MouseEvent.CLICK, sponsorClickHandler); _view.highscores_bt.addEventListener(MouseEvent.CLICK, highscoresClickHandler); _view.moreGames_bt.addEventListener(MouseEvent.CLICK, moreGamesClickHandler); _view.editor_bt.visible = false; if (!SaveData.getInstance().isNewGame){ _view.continue_bt.addEventListener(MouseEvent.CLICK, continueClickHandler); } else { _view.continue_bt.alpha = 0.5; _view.continue_bt.mouseEnabled = false; }; _view.sureHolder.visible = false; _view.alpha = 0; Tweener.addTween(_view, {alpha:1, time:0.3, transition:"linear"}); } private function sureYesClickHandler(_arg1:MouseEvent):void{ startNewGame(); } private function startGameClickHandler(_arg1:MouseEvent):void{ var _local2:SaveData = SaveData.getInstance(); if (!_local2.isNewGame){ _view.sureHolder.visible = true; _view.sureYes.addEventListener(MouseEvent.CLICK, sureYesClickHandler); _view.sureNo.addEventListener(MouseEvent.CLICK, sureNoClickHandler); } else { startNewGame(); }; } private function startNewGame():void{ SaveData.getInstance().clearProgress(); notesProxy.push(AppProxy.GAME_START); } private function sureNoClickHandler(_arg1:MouseEvent):void{ _view.sureHolder.visible = false; } private function sponsorClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1290&subid=mainmenu"), "_blank"); } } }//package game.view
Section 236
//OptionsMediator (game.view.OptionsMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.mediator.*; public class OptionsMediator extends Mediator implements IMediator { private var _view:OptionsView; private var saveData:SaveData; private var appProxy:AppProxy; public static const NAME:String = "OptionsMediator"; public function OptionsMediator(_arg1:OptionsView):void{ super(NAME, _arg1); init(); } private function closeClickHandler(_arg1:MouseEvent):void{ destroy(); } private function qualityHighClickHandler(_arg1:MouseEvent):void{ setQuality(2); } private function updateSound():void{ if (saveData.soundEnabled){ _view.soundOn.gotoAndStop(1); _view.soundOff.gotoAndStop(2); } else { _view.soundOn.gotoAndStop(2); _view.soundOff.gotoAndStop(1); }; } private function musicOffClickHandler(_arg1:MouseEvent):void{ if (saveData.musicEnabled){ saveData.toggleMusicEnabled(); updateMusic(); }; } private function qualityMedClickHandler(_arg1:MouseEvent):void{ setQuality(1); } private function init():void{ _view = (getViewComponent() as OptionsView); appProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy); saveData = SaveData.getInstance(); _view.close_bt.addEventListener(MouseEvent.CLICK, closeClickHandler); _view.qualityLow.buttonMode = true; _view.qualityMed.buttonMode = true; _view.qualityHigh.buttonMode = true; _view.soundOn.buttonMode = true; _view.soundOff.buttonMode = true; _view.musicOn.buttonMode = true; _view.musicOff.buttonMode = true; _view.close_bt.addEventListener(MouseEvent.CLICK, closeClickHandler); _view.qualityLow.addEventListener(MouseEvent.CLICK, qualityLowClickHandler); _view.qualityMed.addEventListener(MouseEvent.CLICK, qualityMedClickHandler); _view.qualityHigh.addEventListener(MouseEvent.CLICK, qualityHighClickHandler); _view.soundOn.addEventListener(MouseEvent.CLICK, soundOnClickHandler); _view.soundOff.addEventListener(MouseEvent.CLICK, soundOffClickHandler); _view.musicOn.addEventListener(MouseEvent.CLICK, musicOnClickHandler); _view.musicOff.addEventListener(MouseEvent.CLICK, musicOffClickHandler); updateOptions(); } private function updateOptions():void{ updateSound(); updateMusic(); updateQuality(); } private function qualityLowClickHandler(_arg1:MouseEvent):void{ setQuality(0); } private function updateMusic():void{ if (saveData.musicEnabled){ _view.musicOn.gotoAndStop(1); _view.musicOff.gotoAndStop(2); } else { _view.musicOn.gotoAndStop(2); _view.musicOff.gotoAndStop(1); }; } private function soundOnClickHandler(_arg1:MouseEvent):void{ if (!saveData.soundEnabled){ saveData.toggleSoundEnabled(); updateSound(); }; } override public function listNotificationInterests():Array{ return ([]); } private function soundOffClickHandler(_arg1:MouseEvent):void{ if (saveData.soundEnabled){ saveData.toggleSoundEnabled(); updateSound(); }; } private function musicOnClickHandler(_arg1:MouseEvent):void{ if (!saveData.musicEnabled){ saveData.toggleMusicEnabled(); updateMusic(); }; } override public function handleNotification(_arg1:INotification):void{ } private function updateQuality():void{ _view.qualityLow.gotoAndStop(2); _view.qualityMed.gotoAndStop(2); _view.qualityHigh.gotoAndStop(2); if (saveData.graphicsQuality == 0){ _view.qualityLow.gotoAndStop(1); } else { if (saveData.graphicsQuality == 1){ _view.qualityMed.gotoAndStop(1); } else { if (saveData.graphicsQuality == 2){ _view.qualityHigh.gotoAndStop(1); }; }; }; } public function destroy():void{ _view.close_bt.removeEventListener(MouseEvent.CLICK, closeClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function setQuality(_arg1:uint):void{ saveData.setGraphicsQuality(_arg1); updateQuality(); } } }//package game.view
Section 237
//GeomLine (geom.GeomLine) package geom { import flash.geom.*; public class GeomLine extends GeomObj { public var p1:Vector; public var p2:Vector; public function GeomLine(_arg1:Vector, _arg2:Vector):void{ this.p1 = _arg1; this.p2 = _arg2; } override public function getBoundingBox():Rectangle{ var _local1:Number = (p1.x + ((p2.x - p1.x) / 2)); var _local2:Number = (p1.y + ((p2.y - p1.y) / 2)); return (new Rectangle((_local1 - 10), (_local2 - 10), 20, 20)); } override public function translate(_arg1:Number, _arg2:Number):void{ p1.x = (p1.x + _arg1); p2.x = (p2.x + _arg1); p1.y = (p1.y + _arg2); p2.y = (p2.y + _arg2); } } }//package geom
Section 238
//GeomObj (geom.GeomObj) package geom { import flash.geom.*; public class GeomObj { public function GeomObj():void{ } public function getBoundingBox():Rectangle{ return (null); } public function isPointInside(_arg1:Point):Boolean{ return (false); } public function isRectInside(_arg1:Rectangle):Boolean{ return (false); } public function translate(_arg1:Number, _arg2:Number):void{ } public static function lineLineInts(_arg1:GeomLine, _arg2:GeomLine):Vector{ var _local14:Vector; var _local3:Number = _arg1.p1.x; var _local4:Number = _arg1.p2.x; var _local5:Number = _arg2.p1.x; var _local6:Number = _arg2.p2.x; var _local7:Number = _arg1.p1.y; var _local8:Number = _arg1.p2.y; var _local9:Number = _arg2.p1.y; var _local10:Number = _arg2.p2.y; if ((((Math.max(_local3, _local4) < Math.min(_local5, _local6))) || ((Math.max(_local5, _local6) < Math.min(_local3, _local4))))){ return (null); }; if ((((Math.max(_local7, _local8) < Math.min(_local9, _local10))) || ((Math.max(_local9, _local10) < Math.min(_local7, _local8))))){ return (null); }; var _local11:Number = (((_local6 - _local5) * (_local7 - _local9)) - ((_local10 - _local9) * (_local3 - _local5))); var _local12:Number = (((_local4 - _local3) * (_local7 - _local9)) - ((_local8 - _local7) * (_local3 - _local5))); var _local13:Number = (((_local10 - _local9) * (_local4 - _local3)) - ((_local6 - _local5) * (_local8 - _local7))); if (Math.abs(_local13) < 0.001){ return (null); }; _local11 = (_local11 / _local13); _local12 = (_local12 / _local13); if ((((((((0 < _local11)) && ((_local11 < 1)))) && ((0 < _local12)))) && ((_local12 < 1)))){ _local14 = new Vector((_local3 + (_local11 * (_local4 - _local3))), (_local7 + (_local11 * (_local8 - _local7)))); return (_local14); }; return (null); } public static function checkInts(_arg1:GeomObj, _arg2:GeomObj):Array{ var _local4:Vector; var _local3:Array = []; if ((_arg1 is GeomLine)){ if ((_arg2 is GeomLine)){ _local4 = GeomObj.lineLineInts((_arg1 as GeomLine), (_arg2 as GeomLine)); if (_local4){ _local3.push(_local4); }; } else { if ((_arg2 is GeomPoly)){ _local3 = GeomObj.linePolyInts((_arg1 as GeomLine), (_arg2 as GeomPoly)); }; }; } else { if ((_arg1 is GeomPoly)){ if ((_arg2 is GeomLine)){ _local3 = GeomObj.linePolyInts((_arg2 as GeomLine), (_arg1 as GeomPoly)); }; }; }; return (_local3); } public static function linePolyInts(_arg1:GeomLine, _arg2:GeomPoly):Array{ var _local4:GeomLine; var _local5:Vector; var _local3:Array = []; var _local6:uint = 1; while (_local6 < _arg2.vertices.length) { _local4 = new GeomLine(_arg2.vertices[(_local6 - 1)], _arg2.vertices[_local6]); _local5 = lineLineInts(_arg1, _local4); if (_local5){ _local3.push(_local5); }; _local6++; }; _local4 = new GeomLine(_arg2.vertices[0], _arg2.vertices[(_arg2.vertices.length - 1)]); _local5 = lineLineInts(_arg1, _local4); if (_local5){ _local3.push(_local5); }; return (_local3); } } }//package geom
Section 239
//GeomPoly (geom.GeomPoly) package geom { import flash.geom.*; public class GeomPoly extends GeomObj { public var isReversed:Boolean; public var vertices:Array; public function GeomPoly(_arg1:Array):void{ this.vertices = _arg1; isReversed = false; if (!isCW()){ _arg1.reverse(); isReversed = true; }; } override public function isPointInside(_arg1:Point):Boolean{ var _local6:GeomLine; var _local7:Vector; var _local2:GeomLine = new GeomLine(new Vector(_arg1.x, _arg1.y), new Vector((_arg1.x + 1000), _arg1.y)); var _local3:uint; var _local4:uint; var _local5:uint = 1; while (_local5 <= vertices.length) { _local4 = _local5; if (_local4 == vertices.length){ _local4 = 0; }; _local6 = new GeomLine(vertices[_local4], vertices[(_local5 - 1)]); _local7 = GeomObj.lineLineInts(_local2, _local6); if (_local7){ _local3 = (_local3 + 1); }; _local5++; }; return ((((_local3 > 0)) && (!(((_local3 % 2) == 0))))); } public function getArea():Number{ var _local4:Vector; var _local5:Vector; var _local1:Number = 0; var _local2:Vector = vertices[0]; var _local3:uint = 2; while (_local3 < vertices.length) { _local4 = vertices[(_local3 - 1)].subtract(_local2); _local5 = vertices[_local3].subtract(_local2); _local1 = (_local1 + _local4.cross(_local5)); _local3++; }; return (_local1); } override public function isRectInside(_arg1:Rectangle):Boolean{ var _local4:GeomLine; var _local5:uint; var _local2:Array = [new GeomLine(new Vector(_arg1.x, _arg1.y), new Vector((_arg1.x + _arg1.width), _arg1.y)), new GeomLine(new Vector((_arg1.x + _arg1.width), _arg1.y), new Vector((_arg1.x + _arg1.width), (_arg1.y + _arg1.height))), new GeomLine(new Vector((_arg1.x + _arg1.width), (_arg1.y + _arg1.height)), new Vector(_arg1.x, (_arg1.y + _arg1.height))), new GeomLine(new Vector(_arg1.x, (_arg1.y + _arg1.height)), new Vector(_arg1.x, _arg1.y))]; var _local3:uint = 1; while (_local3 < vertices.length) { _local4 = new GeomLine(vertices[_local3], vertices[(_local3 - 1)]); _local5 = 0; while (_local5 < _local2.length) { if (GeomObj.lineLineInts(_local4, _local2[_local5])){ return (true); }; _local5++; }; _local3++; }; return (false); } override public function translate(_arg1:Number, _arg2:Number):void{ var _local4:Vector; var _local3:uint; while (_local3 < vertices.length) { _local4 = vertices[_local3]; vertices[_local3].x = (_local4.x + _arg1); _local4.y = (_local4.y + _arg2); _local3++; }; } override public function getBoundingBox():Rectangle{ var _local6:Vector; var _local1:Number = 1000; var _local2:Number = 1000; var _local3:Number = -1000; var _local4:Number = -1000; var _local5:uint; while (_local5 < vertices.length) { _local6 = vertices[_local5]; if (_local6.x < _local1){ _local1 = _local6.x; }; if (_local6.x > _local3){ _local3 = _local6.x; }; if (_local6.y < _local2){ _local2 = _local6.y; }; if (_local6.y > _local4){ _local4 = _local6.y; }; _local5++; }; return (new Rectangle(_local1, _local2, (_local3 - _local1), (_local4 - _local2))); } public function split(_arg1:GeomLine):Array{ var _local2:SplittablePoly = new SplittablePoly(vertices); return (_local2.split(_arg1)); } public function isSimple():Boolean{ var _local2:uint; var _local3:GeomLine; var _local4:uint; var _local5:uint; var _local6:GeomLine; var _local7:Vector; var _local1:uint = 1; while (_local1 <= vertices.length) { _local2 = _local1; if (_local2 == vertices.length){ _local2 = 0; }; _local3 = new GeomLine(vertices[_local2], vertices[(_local1 - 1)]); _local4 = (_local1 + 1); while (_local4 <= vertices.length) { _local5 = _local4; if (_local5 == vertices.length){ _local5 = 0; }; _local6 = new GeomLine(vertices[_local5], vertices[(_local4 - 1)]); _local7 = GeomObj.lineLineInts(_local3, _local6); if (_local7){ return (false); }; _local4++; }; _local1++; }; return (true); } public function isCW():Boolean{ return ((getArea() > 0)); } public static function parseStringDef(_arg1:String):GeomPoly{ var _local5:Array; var _local6:Vector; var _local2:Array = []; var _local3:Array = _arg1.split(","); var _local4:uint; while (_local4 < _local3.length) { _local5 = _local3[_local4].split(" "); _local6 = new Vector(Number(_local5[0]), Number(_local5[1])); _local2.push(_local6); _local4++; }; return (new GeomPoly(_local2)); } } }//package geom import de.polygonal.ds.*; class SplittablePoly { private var lineDll:DLinkedList; private var polyDll:DLinkedList; private var vertices:Array; private var inboundDll:DLinkedList; private function SplittablePoly(_arg1:Array):void{ this.vertices = _arg1; } private function createPieces():Array{ var _local4:PolyNode; var _local5:DListIterator; var _local6:PolyNode; var _local7:DListIterator; var _local8:PolyNode; var _local9:PolyNode; var _local10:DListIterator; var _local1:Array = []; polyDll.tail.next = polyDll.head; var _local2:Array = []; var _local3:DListIterator = inboundDll.getListIterator(); for (;_local3.valid();_local3.forth()) { _local4 = (_local3.data as PolyNode); if (!_local4.isLineVisited){ _local5 = lineDll.nodeOf(_local4); _local5.back(); _local6 = (_local5.data as PolyNode); if (_local6 != lineDll.head.data){ _local2.push(_local4); } else { continue; }; _local7 = polyDll.nodeOf(_local6); while (true) { _local8 = (_local7.data as PolyNode); if (_local8 == _local2[0]){ break; }; _local2.push(_local8); if (_local8.isInbound){ _local8.isLineVisited = true; _local5 = lineDll.nodeOf(_local8); _local5.back(); _local9 = (_local5.data as PolyNode); if (_local9 == _local2[0]){ break; }; if (_local9 == lineDll.head.data){ _local8.isPolyVisited = true; _local7.forth(); } else { _local7 = polyDll.nodeOf(_local9); }; } else { _local7.forth(); }; }; if (_local2.length > 0){ _local1.push(createPiece(_local2)); }; _local2 = []; }; if (!_local4.isPolyVisited){ _local10 = polyDll.nodeOf(_local4); _local2.push(_local4); while (true) { _local10.forth(); _local8 = (_local10.data as PolyNode); if (_local8 == _local2[0]){ break; } else { _local2.push(_local8); if (_local8.isOutbound){ _local5 = lineDll.nodeOf(_local8); _local5.forth(); _local9 = (_local5.data as PolyNode); if (_local9 == _local2[0]){ break; }; if (_local9 == lineDll.tail.data){ _local9.isLineVisited = true; } else { _local10 = polyDll.nodeOf(_local9); _local2.push(_local9); _local9.isPolyVisited = true; }; } else { if (_local8.isInbound){ _local8.isPolyVisited = true; }; }; }; }; _local1.push(createPiece(_local2)); _local2 = []; }; }; return (_local1); } private function createPiece(_arg1:Array):GeomPoly{ var _local5:PolyNode; var _local2:Array = []; var _local3:uint; while (_local3 < _arg1.length) { _local5 = _arg1[_local3]; _local2.push(_local5.vec.copy()); _local3++; }; var _local4:GeomPoly = new GeomPoly(_local2); return (_local4); } public function split(_arg1:GeomLine):Array{ var _local5:DListIterator; var _local6:GeomLine; var _local7:uint; var _local8:uint; var _local10:Vector; var _local11:Array; var _local12:PolyNode; var _local13:Number; var _local14:Vector; var _local15:Number; var _local2:Vector = _arg1.p2.subtract(_arg1.p1); var _local3:Array = []; var _local4:Array = [_arg1.p1, _arg1.p2]; var _local9:Vector = vertices[0]; polyDll = new DLinkedList(); lineDll = new DLinkedList(); inboundDll = new DLinkedList(); lineDll.append(new PolyNode(_arg1.p1)); lineDll.append(new PolyNode(_arg1.p2)); _local7 = 1; while (_local7 <= vertices.length) { _local8 = _local7; if (_local8 == vertices.length){ _local8 = 0; }; _local10 = vertices[_local8]; polyDll.append(new PolyNode(_local9)); _local6 = new GeomLine(_local10, _local9); _local11 = GeomObj.checkInts(_local6, _arg1); if (_local11.length > 0){ _local12 = new PolyNode(_local11[0]); _local12.checkBound(_local2, _local9); polyDll.append(_local12); if (_local12.isInbound){ inboundDll.append(_local12); }; _local13 = (((_local12.vec.x - _arg1.p1.x) * (_local12.vec.x - _arg1.p1.x)) + ((_local12.vec.y - _arg1.p1.y) * (_local12.vec.y - _arg1.p1.y))); _local5 = lineDll.getListIterator(); while (_local5.valid()) { _local14 = (_local5.data.vec as Vector); _local15 = (((_local14.x - _arg1.p1.x) * (_local14.x - _arg1.p1.x)) + ((_local14.y - _arg1.p1.y) * (_local14.y - _arg1.p1.y))); if (_local13 < _local15){ lineDll.insertBefore(_local5, _local12); break; }; _local5.forth(); }; }; _local9 = _local10; _local7++; }; return (createPieces()); } } class PolyNode { public var isInbound:Boolean;// = false public var vec:Vector; public var isLineVisited:Boolean;// = false public var isPolyVisited:Boolean;// = false public var isOutbound:Boolean;// = false public var id:uint; public static var ID:uint; private function PolyNode(_arg1:Vector):void{ id = ID++; this.vec = _arg1; } public function toString():String{ return (("n " + id)); } public function checkBound(_arg1:Vector, _arg2:Vector):void{ var _local3:Vector = vec.subtract(_arg2); if (_arg1.cross(_local3) > 0){ isInbound = true; } else { isOutbound = true; }; } }
Section 240
//Vector (geom.Vector) package geom { public class Vector { public var x:Number; public var y:Number; public function Vector(_arg1:Number, _arg2:Number):void{ this.x = _arg1; this.y = _arg2; } public function dot(_arg1:Vector):Number{ return (((x * _arg1.x) + (y * _arg1.y))); } public function subtract(_arg1:Vector):Vector{ return (new Vector((x - _arg1.x), (y - _arg1.y))); } public function copy():Vector{ return (new Vector(x, y)); } public function toString():String{ return (((x + " ") + y)); } public function cross(_arg1:Vector):Number{ return (((x * _arg1.y) - (y * _arg1.x))); } } }//package geom
Section 241
//MochiAd (mochi.as3.MochiAd) package mochi.as3 { import flash.events.*; import flash.display.*; import flash.net.*; import flash.utils.*; import flash.system.*; public class MochiAd { public static function getVersion():String{ return ("3.0 as3"); } public static function showClickAwayAd(_arg1:Object):void{ var clip:Object; var mc:MovieClip; var chk:MovieClip; var options = _arg1; var DEFAULTS:Object = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{ }, ad_finished:function ():void{ }, ad_loaded:function (_arg1:Number, _arg2:Number):void{ }, ad_failed:function ():void{ trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software"); }, ad_skipped:function ():void{ }}; options = MochiAd._parseOptions(options, DEFAULTS); clip = options.clip; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; if (!MochiAd.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); options.ad_finished(); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; mc.unloadAd = function ():void{ MochiAd.unload(clip); }; mc.adLoaded = options.ad_loaded; mc.adSkipped = options.ad_skipped; mc.rpc = function (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; var sendHostProgress:Boolean; mc.regContLC = function (_arg1:String):void{ mc._containerLCName = _arg1; }; chk["onEnterFrame"] = function ():void{ var _local4:Number; if (!this.parent){ delete this.onEnterFrame; return; }; var _local1:Object = this.parent._mochiad_ctr; var _local2:Number = (getTimer() - this.started); var _local3:Boolean; if (!chk.showing){ _local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal; if (_local4 > 0){ chk.showing = true; _local3 = true; chk.started = getTimer(); } else { if (_local2 > chk.ad_timeout){ options.ad_failed(); _local3 = true; }; }; }; if (this.root == null){ _local3 = true; }; if (_local3){ delete this.onEnterFrame; }; }; doOnEnterFrame(chk); } public static function _isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } public static function _allowDomains(_arg1:String):String{ var _local2:String = _arg1.split("/")[2].split(":")[0]; if (Security.sandboxType == "application"){ return (_local2); }; Security.allowDomain("*"); Security.allowDomain(_local2); Security.allowInsecureDomain("*"); Security.allowInsecureDomain(_local2); return (_local2); } public static function unload(_arg1:Object):Boolean{ if (((_arg1.clip) && (_arg1.clip._mochiad))){ _arg1 = _arg1.clip; }; if (_arg1.origFrameRate != undefined){ _arg1.stage.frameRate = _arg1.origFrameRate; }; if (!_arg1._mochiad){ return (false); }; if (_arg1._mochiad._containerLCName != undefined){ _arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"}); }; if (_arg1._mochiad.onUnload){ _arg1._mochiad.onUnload(); }; delete _arg1._mochiad_loaded; delete _arg1._mochiad; return (true); } public static function showInterLevelAd(_arg1:Object):void{ var clip:Object; var mc:MovieClip; var chk:MovieClip; var options = _arg1; var DEFAULTS:Object = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{ if ((this.clip is MovieClip)){ this.clip.stop(); } else { throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_finished:function ():void{ if ((this.clip is MovieClip)){ this.clip.play(); } else { throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_loaded:function (_arg1:Number, _arg2:Number):void{ }, ad_failed:function ():void{ trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software"); }, ad_skipped:function ():void{ }}; options = MochiAd._parseOptions(options, DEFAULTS); clip = options.clip; var ad_msec:Number = 11000; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; var fadeout_time:Number = options.fadeout_time; delete options.fadeout_time; if (!MochiAd.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); options.ad_finished(); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.ad_msec = ad_msec; chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; chk.fadeout_time = fadeout_time; chk.fadeFunction = function ():void{ if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time))); if (_local1 > 0){ this.parent.alpha = (_local1 * 0.01); } else { MochiAd.unload(clip); delete this["onEnterFrame"]; }; }; mc.unloadAd = function ():void{ MochiAd.unload(clip); }; mc.adLoaded = options.ad_loaded; mc.adSkipped = options.ad_skipped; mc.adjustProgress = function (_arg1:Number):void{ var _local2:Object = mc._mochiad_wait; _local2.server_control = true; _local2.showing = true; _local2.started = getTimer(); _local2.ad_msec = (_arg1 - 250); }; mc.rpc = function (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; chk["onEnterFrame"] = function ():void{ var _local4:Number; if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; var _local1:Object = this.parent._mochiad_ctr; var _local2:Number = (getTimer() - this.started); var _local3:Boolean; if (!chk.showing){ _local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal; if (_local4 > 0){ chk.showing = true; chk.started = getTimer(); MochiAd.adShowing(clip); } else { if (_local2 > chk.ad_timeout){ options.ad_failed(); _local3 = true; }; }; }; if (_local2 > chk.ad_msec){ _local3 = true; }; if (_local3){ if (this.server_control){ delete this.onEnterFrame; } else { this.fadeout_start = getTimer(); this.onEnterFrame = this.fadeFunction; }; }; }; doOnEnterFrame(chk); } public static function _parseOptions(_arg1:Object, _arg2:Object):Object{ var _local4:String; var _local5:Array; var _local6:Number; var _local7:Array; var _local3:Object = {}; for (_local4 in _arg2) { _local3[_local4] = _arg2[_local4]; }; if (_arg1){ for (_local4 in _arg1) { _local3[_local4] = _arg1[_local4]; }; }; if (_local3.clip == undefined){ throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite.")); }; _arg1 = _local3.clip.loaderInfo.parameters.mochiad_options; if (_arg1){ _local5 = _arg1.split("&"); _local6 = 0; while (_local6 < _local5.length) { _local7 = _local5[_local6].split("="); _local3[unescape(_local7[0])] = unescape(_local7[1]); _local6++; }; }; if (_local3.id == "test"){ trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!"); }; return (_local3); } public static function _cleanup(_arg1:Object):void{ var k:String; var lc:LocalConnection; var f:Function; var mc = _arg1; if (("lc" in mc)){ lc = mc.lc; f = function ():void{ try { lc.client = null; lc.close(); } catch(e:Error) { }; }; setTimeout(f, 0); }; var idx:Number = DisplayObjectContainer(mc).numChildren; while (idx > 0) { idx = (idx - 1); DisplayObjectContainer(mc).removeChildAt(idx); }; for (k in mc) { delete mc[k]; }; } public static function load(_arg1:Object):MovieClip{ var clip:Object; var k:String; var server:String; var hostname:String; var lc:LocalConnection; var name:String; var loader:Loader; var g:Function; var req:URLRequest; var v:Object; var options = _arg1; var DEFAULTS:Object = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"}; options = MochiAd._parseOptions(options, DEFAULTS); options.swfv = 9; options.mav = MochiAd.getVersion(); clip = options.clip; if (!MochiAd._isNetworkAvailable()){ return (null); }; try { if (clip._mochiad_loaded){ return (null); }; } catch(e:Error) { throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic.")); }; var depth:Number = options.depth; delete options.depth; var mc:MovieClip = createEmptyMovieClip(clip, "_mochiad", depth); var wh:Array = MochiAd._getRes(options, clip); options.res = ((wh[0] + "x") + wh[1]); options.server = (options.server + options.id); delete options.id; clip._mochiad_loaded = true; if (clip.loaderInfo.loaderURL.indexOf("http") == 0){ options.as3_swf = clip.loaderInfo.loaderURL; } else { trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal"); }; var lv:URLVariables = new URLVariables(); for (k in options) { v = options[k]; if (!(v is Function)){ lv[k] = v; }; }; server = lv.server; delete lv.server; hostname = _allowDomains(server); lc = new LocalConnection(); lc.client = mc; name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_"); lc.allowDomain("*", "localhost"); lc.allowInsecureDomain("*", "localhost"); lc.connect(name); mc.lc = lc; mc.lcName = name; lv.lc = name; lv.st = getTimer(); loader = new Loader(); g = function (_arg1:Object):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); MochiAd.unload(clip); }; loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g); req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime())); req.contentType = "application/x-www-form-urlencoded"; req.method = URLRequestMethod.POST; req.data = lv; loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{ trace("[MochiAds] Blocked URL"); }); loader.load(req); mc.addChild(loader); mc._mochiad_ctr = loader; return (mc); } public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{ var _local4:Array = _arg2.split("."); var _local5:Number = 0; while (_local5 < (_local4.length - 1)) { if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){ return (undefined); }; _arg1 = _arg1[_local4[_local5]]; _local5++; }; if (typeof(_arg1[_local4[_local5]]) == "function"){ return (_arg1[_local4[_local5]].apply(_arg1, _arg3)); }; return (undefined); } public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{ var _local4:MovieClip = new MovieClip(); if (((false) && (_arg3))){ _arg1.addChildAt(_local4, _arg3); } else { _arg1.addChild(_local4); }; _arg1[_arg2] = _local4; _local4["_name"] = _arg2; return (_local4); } public static function _getRes(_arg1:Object, _arg2:Object):Array{ var _local6:Array; var _local3:Object = _arg2.getBounds(_arg2.root); var _local4:Number = 0; var _local5:Number = 0; if (typeof(_arg1.res) != "undefined"){ _local6 = _arg1.res.split("x"); _local4 = parseFloat(_local6[0]); _local5 = parseFloat(_local6[1]); } else { _local4 = (_local3.xMax - _local3.xMin); _local5 = (_local3.yMax - _local3.yMin); }; if ((((_local4 == 0)) || ((_local5 == 0)))){ _local4 = _arg2.stage.stageWidth; _local5 = _arg2.stage.stageHeight; }; return ([_local4, _local5]); } public static function adShowing(_arg1:Object):void{ _arg1.origFrameRate = _arg1.stage.frameRate; _arg1.stage.frameRate = 30; } public static function getValue(_arg1:Object, _arg2:String):Object{ var _local3:Array = _arg2.split("."); var _local4:Number = 0; while (_local4 < (_local3.length - 1)) { if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){ return (undefined); }; _arg1 = _arg1[_local3[_local4]]; _local4++; }; return (_arg1[_local3[_local4]]); } public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{ var _local4:Object; var _local5:Object; switch (_arg3.id){ case "setValue": MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value); break; case "getValue": _local4 = MochiAd.getValue(_arg1, _arg3.objectName); _arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4); break; case "runMethod": _local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args); _arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5); break; default: trace(("[mochiads rpc] unknown rpc id: " + _arg3.id)); }; } public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{ var _local4:Array = _arg2.split("."); var _local5:Number = 0; while (_local5 < (_local4.length - 1)) { if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){ return; }; _arg1 = _arg1[_local4[_local5]]; _local5++; }; _arg1[_local4[_local5]] = _arg3; } public static function showPreGameAd(_arg1:Object):void{ var clip:Object; var mc:MovieClip; var w:Number; var h:Number; var chk:MovieClip; var complete:Boolean; var unloaded:Boolean; var sendHostProgress:Boolean; var fn:Function; var r:MovieClip; var options = _arg1; var DEFAULTS:Object = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{ if ((this.clip is MovieClip)){ this.clip.stop(); } else { throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_finished:function ():void{ if ((this.clip is MovieClip)){ this.clip.play(); } else { throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_loaded:function (_arg1:Number, _arg2:Number):void{ }, ad_failed:function ():void{ trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software"); }, ad_skipped:function ():void{ }, ad_progress:function (_arg1:Number):void{ }}; options = MochiAd._parseOptions(options, DEFAULTS); if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){ options.ad_started(); fn = function ():void{ options.ad_finished(); }; setTimeout(fn, 100); return; }; clip = options.clip; var ad_msec:Number = 11000; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; var fadeout_time:Number = options.fadeout_time; delete options.fadeout_time; if (!MochiAd.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); var fn:Function = function ():void{ options.ad_finished(); }; setTimeout(fn, 100); }; var wh:Array = MochiAd._getRes(options, clip); w = wh[0]; h = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.x = (w * -0.5); chk.y = (h * -0.5); var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4); if (options.no_progress_bar){ bar.visible = false; delete options.no_progress_bar; } else { bar.x = 10; bar.y = (h - 20); }; var bar_color:Number = options.color; delete options.color; var bar_background:Number = options.background; delete options.background; var bar_outline:Number = options.outline; delete options.outline; var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1); var backing:Object = backing_mc.graphics; backing.beginFill(bar_background); backing.moveTo(0, 0); backing.lineTo((w - 20), 0); backing.lineTo((w - 20), 10); backing.lineTo(0, 10); backing.lineTo(0, 0); backing.endFill(); var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2); var inside:Object = inside_mc.graphics; inside.beginFill(bar_color); inside.moveTo(0, 0); inside.lineTo((w - 20), 0); inside.lineTo((w - 20), 10); inside.lineTo(0, 10); inside.lineTo(0, 0); inside.endFill(); inside_mc.scaleX = 0; var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3); var outline:Object = outline_mc.graphics; outline.lineStyle(0, bar_outline, 100); outline.moveTo(0, 0); outline.lineTo((w - 20), 0); outline.lineTo((w - 20), 10); outline.lineTo(0, 10); outline.lineTo(0, 0); chk.ad_msec = ad_msec; chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; chk.last_pcnt = 0; chk.fadeout_time = fadeout_time; chk.fadeFunction = function ():void{ var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time))); if (_local1 > 0){ this.parent.alpha = (_local1 * 0.01); } else { MochiAd.unload(clip); delete this["onEnterFrame"]; }; }; complete = false; unloaded = false; var f:Function = function (_arg1:Event):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); complete = true; if (unloaded){ MochiAd.unload(clip); }; }; clip.loaderInfo.addEventListener(Event.COMPLETE, f); if ((clip.root is MovieClip)){ r = (clip.root as MovieClip); if (r.framesLoaded >= r.totalFrames){ complete = true; }; }; mc.unloadAd = function ():void{ unloaded = true; if (complete){ MochiAd.unload(clip); }; }; mc.adLoaded = options.ad_loaded; mc.adSkipped = options.ad_skipped; mc.adjustProgress = function (_arg1:Number):void{ var _local2:Object = mc._mochiad_wait; _local2.server_control = true; _local2.showing = true; _local2.started = getTimer(); _local2.ad_msec = _arg1; }; mc.rpc = function (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; mc.rpcTestFn = function (_arg1:String):Object{ trace(("[MOCHIAD rpcTestFn] " + _arg1)); return (_arg1); }; mc.regContLC = function (_arg1:String):void{ mc._containerLCName = _arg1; }; sendHostProgress = false; mc.sendHostLoadProgress = function (_arg1:String):void{ sendHostProgress = true; }; chk["onEnterFrame"] = function ():void{ var _local11:Number; if (((!(this.parent)) || (!(this.parent.parent)))){ delete this["onEnterFrame"]; return; }; var _local1:Object = this.parent.parent.root; var _local2:Object = this.parent._mochiad_ctr; var _local3:Number = (getTimer() - this.started); var _local4:Boolean; var _local5:Number = _local1.loaderInfo.bytesTotal; var _local6:Number = _local1.loaderInfo.bytesLoaded; if (complete){ _local6 = Math.max(1, _local6); _local5 = _local6; }; var _local7:Number = ((100 * _local6) / _local5); var _local8:Number = ((100 * _local3) / chk.ad_msec); var _local9:Object = this._mochiad_bar._inside; var _local10:Number = Math.min(100, Math.min(((_local7) || (0)), _local8)); _local10 = Math.max(this.last_pcnt, _local10); this.last_pcnt = _local10; _local9.scaleX = (_local10 * 0.01); options.ad_progress(_local10); if (sendHostProgress){ clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7}); if (_local7 == 100){ sendHostProgress = false; }; }; if (!chk.showing){ _local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal; if (_local11 > 0){ chk.showing = true; chk.started = getTimer(); MochiAd.adShowing(clip); } else { if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){ options.ad_failed(); _local4 = true; }; }; }; if (_local3 > chk.ad_msec){ _local4 = true; }; if (((complete) && (_local4))){ if (this.server_control){ delete this.onEnterFrame; } else { this.fadeout_start = getTimer(); this.onEnterFrame = chk.fadeFunction; }; }; }; doOnEnterFrame(chk); } public static function showPreloaderAd(_arg1:Object):void{ trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0"); MochiAd.showPreGameAd(_arg1); } public static function showTimedAd(_arg1:Object):void{ trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0"); MochiAd.showInterLevelAd(_arg1); } public static function doOnEnterFrame(_arg1:MovieClip):void{ var mc = _arg1; var f:Function = function (_arg1:Object):void{ if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){ mc.onEnterFrame(); } else { _arg1.target.removeEventListener(_arg1.type, arguments.callee); }; }; mc.addEventListener(Event.ENTER_FRAME, f); } } }//package mochi.as3
Section 242
//ByteArrayAsset (mx.core.ByteArrayAsset) package mx.core { import flash.utils.*; public class ByteArrayAsset extends ByteArray implements IFlexAsset { mx_internal static const VERSION:String = "3.0.0.0"; } }//package mx.core
Section 243
//EdgeMetrics (mx.core.EdgeMetrics) package mx.core { public class EdgeMetrics { public var top:Number; public var left:Number; public var bottom:Number; public var right:Number; mx_internal static const VERSION:String = "3.0.0.0"; public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0); ; public function EdgeMetrics(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){ this.left = _arg1; this.top = _arg2; this.right = _arg3; this.bottom = _arg4; } public function clone():EdgeMetrics{ return (new EdgeMetrics(left, top, right, bottom)); } } }//package mx.core
Section 244
//FlexSprite (mx.core.FlexSprite) package mx.core { import flash.display.*; import mx.utils.*; public class FlexSprite extends Sprite { mx_internal static const VERSION:String = "3.0.0.0"; public function FlexSprite(){ super(); try { name = NameUtil.createUniqueName(this); } catch(e:Error) { }; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 245
//IBorder (mx.core.IBorder) package mx.core { public interface IBorder { function get borderMetrics():EdgeMetrics; } }//package mx.core
Section 246
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 247
//IFlexDisplayObject (mx.core.IFlexDisplayObject) package mx.core { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.accessibility.*; public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher { function get visible():Boolean; function get rotation():Number; function localToGlobal(_arg1:Point):Point; function get name():String; function set width(_arg1:Number):void; function get measuredHeight():Number; function get blendMode():String; function get scale9Grid():Rectangle; function set name(_arg1:String):void; function set scaleX(_arg1:Number):void; function set scaleY(_arg1:Number):void; function get measuredWidth():Number; function get accessibilityProperties():AccessibilityProperties; function set scrollRect(_arg1:Rectangle):void; function get cacheAsBitmap():Boolean; function globalToLocal(_arg1:Point):Point; function get height():Number; function set blendMode(_arg1:String):void; function get parent():DisplayObjectContainer; function getBounds(_arg1:DisplayObject):Rectangle; function get opaqueBackground():Object; function set scale9Grid(_arg1:Rectangle):void; function setActualSize(_arg1:Number, _arg2:Number):void; function set alpha(_arg1:Number):void; function set accessibilityProperties(_arg1:AccessibilityProperties):void; function get width():Number; function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean; function set cacheAsBitmap(_arg1:Boolean):void; function get scaleX():Number; function get scaleY():Number; function get scrollRect():Rectangle; function get mouseX():Number; function get mouseY():Number; function set height(_arg1:Number):void; function set mask(_arg1:DisplayObject):void; function getRect(_arg1:DisplayObject):Rectangle; function get alpha():Number; function set transform(_arg1:Transform):void; function move(_arg1:Number, _arg2:Number):void; function get loaderInfo():LoaderInfo; function get root():DisplayObject; function hitTestObject(_arg1:DisplayObject):Boolean; function set opaqueBackground(_arg1:Object):void; function set visible(_arg1:Boolean):void; function get mask():DisplayObject; function set x(_arg1:Number):void; function set y(_arg1:Number):void; function get transform():Transform; function set filters(_arg1:Array):void; function get x():Number; function get y():Number; function get filters():Array; function set rotation(_arg1:Number):void; function get stage():Stage; } }//package mx.core
Section 248
//IRepeaterClient (mx.core.IRepeaterClient) package mx.core { public interface IRepeaterClient { function get instanceIndices():Array; function set instanceIndices(_arg1:Array):void; function get isDocument():Boolean; function set repeaters(_arg1:Array):void; function initializeRepeaterArrays(_arg1:IRepeaterClient):void; function get repeaters():Array; function set repeaterIndices(_arg1:Array):void; function get repeaterIndices():Array; } }//package mx.core
Section 249
//mx_internal (mx.core.mx_internal) package mx.core { public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal"; }//package mx.core
Section 250
//SpriteAsset (mx.core.SpriteAsset) package mx.core { public class SpriteAsset extends FlexSprite implements IFlexAsset, IFlexDisplayObject, IBorder { private var _measuredHeight:Number; private var _measuredWidth:Number; mx_internal static const VERSION:String = "3.0.0.0"; public function SpriteAsset(){ _measuredWidth = width; _measuredHeight = height; } public function get measuredWidth():Number{ return (_measuredWidth); } public function get measuredHeight():Number{ return (_measuredHeight); } public function setActualSize(_arg1:Number, _arg2:Number):void{ width = _arg1; height = _arg2; } public function move(_arg1:Number, _arg2:Number):void{ this.x = _arg1; this.y = _arg2; } public function get borderMetrics():EdgeMetrics{ if (scale9Grid == null){ return (EdgeMetrics.EMPTY); }; return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom)))); } } }//package mx.core
Section 251
//NameUtil (mx.utils.NameUtil) package mx.utils { import flash.display.*; import mx.core.*; import flash.utils.*; public class NameUtil { mx_internal static const VERSION:String = "3.0.0.0"; private static var counter:int = 0; public static function displayObjectToString(_arg1:DisplayObject):String{ var _local2:String; var _local4:String; var _local5:Array; var _local3:DisplayObject = _arg1; while (_local3 != null) { if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){ break; }; _local4 = _local3.name; if ((_local3 is IRepeaterClient)){ _local5 = IRepeaterClient(_local3).instanceIndices; if (_local5){ _local4 = (_local4 + (("[" + _local5.join("][")) + "]")); }; }; _local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2); _local3 = _local3.parent; }; return (_local2); } public static function createUniqueName(_arg1:Object):String{ if (!_arg1){ return (null); }; var _local2:String = getQualifiedClassName(_arg1); var _local3:int = _local2.indexOf("::"); if (_local3 != -1){ _local2 = _local2.substr((_local3 + 2)); }; var _local4:int = _local2.charCodeAt((_local2.length - 1)); if ((((_local4 >= 48)) && ((_local4 <= 57)))){ _local2 = (_local2 + "_"); }; return ((_local2 + counter++)); } } }//package mx.utils
Section 252
//Controller (org.puremvc.as3.core.controller.Controller) package org.puremvc.as3.core.controller { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.core.view.*; import org.puremvc.as3.patterns.observer.*; public class Controller implements IController { protected const SINGLETON_MSG:String = "Controller Singleton already constructed!"; protected var commandMap:Array; protected var view:IView; protected static var instance:IController; public function Controller(){ if (instance != null){ throw (Error(SINGLETON_MSG)); }; instance = this; commandMap = new Array(); initializeController(); } public function removeCommand(_arg1:String):void{ commandMap[_arg1] = null; } public function registerCommand(_arg1:String, _arg2:Class):void{ if (commandMap[_arg1] == null){ view.registerObserver(_arg1, new Observer(executeCommand, this)); }; commandMap[_arg1] = _arg2; } protected function initializeController():void{ view = View.getInstance(); } public function hasCommand(_arg1:String):Boolean{ return (!((commandMap[_arg1] == null))); } public function executeCommand(_arg1:INotification):void{ var _local2:Class = commandMap[_arg1.getName()]; if (_local2 == null){ return; }; var _local3:ICommand = new (_local2); _local3.execute(_arg1); } public static function getInstance():IController{ if (instance == null){ instance = new (Controller); }; return (instance); } } }//package org.puremvc.as3.core.controller
Section 253
//Model (org.puremvc.as3.core.model.Model) package org.puremvc.as3.core.model { import org.puremvc.as3.interfaces.*; public class Model implements IModel { protected const SINGLETON_MSG:String = "Model Singleton already constructed!"; protected var proxyMap:Array; protected static var instance:IModel; public function Model(){ if (instance != null){ throw (Error(SINGLETON_MSG)); }; instance = this; proxyMap = new Array(); initializeModel(); } protected function initializeModel():void{ } public function removeProxy(_arg1:String):IProxy{ var _local2:IProxy = (proxyMap[_arg1] as IProxy); proxyMap[_arg1] = null; return (_local2); } public function hasProxy(_arg1:String):Boolean{ return (!((proxyMap[_arg1] == null))); } public function retrieveProxy(_arg1:String):IProxy{ return (proxyMap[_arg1]); } public function registerProxy(_arg1:IProxy):void{ proxyMap[_arg1.getProxyName()] = _arg1; } public static function getInstance():IModel{ if (instance == null){ instance = new (Model); }; return (instance); } } }//package org.puremvc.as3.core.model
Section 254
//View (org.puremvc.as3.core.view.View) package org.puremvc.as3.core.view { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.observer.*; public class View implements IView { protected const SINGLETON_MSG:String = "View Singleton already constructed!"; protected var observerMap:Array; protected var mediatorMap:Array; protected static var instance:IView; public function View(){ if (instance != null){ throw (Error(SINGLETON_MSG)); }; instance = this; mediatorMap = new Array(); observerMap = new Array(); initializeView(); } public function retrieveMediator(_arg1:String):IMediator{ return (mediatorMap[_arg1]); } public function hasMediator(_arg1:String):Boolean{ return (!((mediatorMap[_arg1] == null))); } public function notifyObservers(_arg1:INotification):void{ var _local2:Array; var _local3:Number; var _local4:IObserver; if (observerMap[_arg1.getName()] != null){ _local2 = (observerMap[_arg1.getName()] as Array); _local3 = 0; while (_local3 < _local2.length) { _local4 = (_local2[_local3] as IObserver); _local4.notifyObserver(_arg1); _local3++; }; }; } protected function initializeView():void{ } public function registerMediator(_arg1:IMediator):void{ var _local3:Observer; var _local4:Number; mediatorMap[_arg1.getMediatorName()] = _arg1; var _local2:Array = _arg1.listNotificationInterests(); if (_local2.length > 0){ _local3 = new Observer(_arg1.handleNotification, _arg1); _local4 = 0; while (_local4 < _local2.length) { registerObserver(_local2[_local4], _local3); _local4++; }; }; _arg1.onRegister(); } public function removeMediator(_arg1:String):IMediator{ var _local2:String; var _local3:IMediator; var _local4:Array; var _local5:Array; var _local6:int; var _local7:int; for (_local2 in observerMap) { _local4 = observerMap[_local2]; _local5 = new Array(); _local6 = 0; while (_local6 < _local4.length) { if (Observer(_local4[_local6]).compareNotifyContext(retrieveMediator(_arg1)) == true){ _local5.push(_local6); }; _local6++; }; while (_local5.length > 0) { _local7 = _local5.pop(); _local4.splice(_local7, 1); }; if (_local4.length == 0){ delete observerMap[_local2]; }; }; _local3 = (mediatorMap[_arg1] as IMediator); delete mediatorMap[_arg1]; if (_local3){ _local3.onRemove(); }; return (_local3); } public function registerObserver(_arg1:String, _arg2:IObserver):void{ if (observerMap[_arg1] != null){ observerMap[_arg1].push(_arg2); } else { observerMap[_arg1] = [_arg2]; }; } public static function getInstance():IView{ if (instance == null){ instance = new (View); }; return (instance); } } }//package org.puremvc.as3.core.view
Section 255
//ICommand (org.puremvc.as3.interfaces.ICommand) package org.puremvc.as3.interfaces { public interface ICommand { function execute(_arg1:INotification):void; } }//package org.puremvc.as3.interfaces
Section 256
//IController (org.puremvc.as3.interfaces.IController) package org.puremvc.as3.interfaces { public interface IController { function registerCommand(_arg1:String, _arg2:Class):void; function hasCommand(_arg1:String):Boolean; function executeCommand(_arg1:INotification):void; function removeCommand(_arg1:String):void; } }//package org.puremvc.as3.interfaces
Section 257
//IFacade (org.puremvc.as3.interfaces.IFacade) package org.puremvc.as3.interfaces { public interface IFacade extends INotifier { function removeCommand(_arg1:String):void; function registerCommand(_arg1:String, _arg2:Class):void; function removeProxy(_arg1:String):IProxy; function registerProxy(_arg1:IProxy):void; function hasMediator(_arg1:String):Boolean; function retrieveMediator(_arg1:String):IMediator; function hasCommand(_arg1:String):Boolean; function retrieveProxy(_arg1:String):IProxy; function hasProxy(_arg1:String):Boolean; function registerMediator(_arg1:IMediator):void; function removeMediator(_arg1:String):IMediator; } }//package org.puremvc.as3.interfaces
Section 258
//IMediator (org.puremvc.as3.interfaces.IMediator) package org.puremvc.as3.interfaces { public interface IMediator { function listNotificationInterests():Array; function onRegister():void; function handleNotification(_arg1:INotification):void; function getMediatorName():String; function setViewComponent(_arg1:Object):void; function getViewComponent():Object; function onRemove():void; } }//package org.puremvc.as3.interfaces
Section 259
//IModel (org.puremvc.as3.interfaces.IModel) package org.puremvc.as3.interfaces { public interface IModel { function removeProxy(_arg1:String):IProxy; function retrieveProxy(_arg1:String):IProxy; function registerProxy(_arg1:IProxy):void; function hasProxy(_arg1:String):Boolean; } }//package org.puremvc.as3.interfaces
Section 260
//INotification (org.puremvc.as3.interfaces.INotification) package org.puremvc.as3.interfaces { public interface INotification { function getType():String; function getName():String; function toString():String; function setBody(_arg1:Object):void; function getBody():Object; function setType(_arg1:String):void; } }//package org.puremvc.as3.interfaces
Section 261
//INotifier (org.puremvc.as3.interfaces.INotifier) package org.puremvc.as3.interfaces { public interface INotifier { function sendNotification(_arg1:String, _arg2:Object=null, _arg3:String=null):void; } }//package org.puremvc.as3.interfaces
Section 262
//IObserver (org.puremvc.as3.interfaces.IObserver) package org.puremvc.as3.interfaces { public interface IObserver { function compareNotifyContext(_arg1:Object):Boolean; function setNotifyContext(_arg1:Object):void; function setNotifyMethod(_arg1:Function):void; function notifyObserver(_arg1:INotification):void; } }//package org.puremvc.as3.interfaces
Section 263
//IProxy (org.puremvc.as3.interfaces.IProxy) package org.puremvc.as3.interfaces { public interface IProxy { function getData():Object; function getProxyName():String; function setData(_arg1:Object):void; } }//package org.puremvc.as3.interfaces
Section 264
//IView (org.puremvc.as3.interfaces.IView) package org.puremvc.as3.interfaces { public interface IView { function notifyObservers(_arg1:INotification):void; function registerMediator(_arg1:IMediator):void; function removeMediator(_arg1:String):IMediator; function registerObserver(_arg1:String, _arg2:IObserver):void; function hasMediator(_arg1:String):Boolean; function retrieveMediator(_arg1:String):IMediator; } }//package org.puremvc.as3.interfaces
Section 265
//SimpleCommand (org.puremvc.as3.patterns.command.SimpleCommand) package org.puremvc.as3.patterns.command { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.observer.*; public class SimpleCommand extends Notifier implements ICommand, INotifier { public function execute(_arg1:INotification):void{ } } }//package org.puremvc.as3.patterns.command
Section 266
//Facade (org.puremvc.as3.patterns.facade.Facade) package org.puremvc.as3.patterns.facade { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.core.view.*; import org.puremvc.as3.core.controller.*; import org.puremvc.as3.core.model.*; import org.puremvc.as3.patterns.observer.*; public class Facade implements IFacade { protected const SINGLETON_MSG:String = "Facade Singleton already constructed!"; protected var controller:IController; protected var view:IView; protected var model:IModel; protected static var instance:IFacade; public function Facade(){ if (instance != null){ throw (Error(SINGLETON_MSG)); }; instance = this; initializeFacade(); } public function removeProxy(_arg1:String):IProxy{ var _local2:IProxy; if (model != null){ _local2 = model.removeProxy(_arg1); }; return (_local2); } public function registerProxy(_arg1:IProxy):void{ model.registerProxy(_arg1); } protected function initializeController():void{ if (controller != null){ return; }; controller = Controller.getInstance(); } protected function initializeFacade():void{ initializeModel(); initializeController(); initializeView(); } public function retrieveProxy(_arg1:String):IProxy{ return (model.retrieveProxy(_arg1)); } public function sendNotification(_arg1:String, _arg2:Object=null, _arg3:String=null):void{ notifyObservers(new Notification(_arg1, _arg2, _arg3)); } public function notifyObservers(_arg1:INotification):void{ if (view != null){ view.notifyObservers(_arg1); }; } protected function initializeView():void{ if (view != null){ return; }; view = View.getInstance(); } public function retrieveMediator(_arg1:String):IMediator{ return ((view.retrieveMediator(_arg1) as IMediator)); } public function removeMediator(_arg1:String):IMediator{ var _local2:IMediator; if (view != null){ _local2 = view.removeMediator(_arg1); }; return (_local2); } public function hasCommand(_arg1:String):Boolean{ return (controller.hasCommand(_arg1)); } public function removeCommand(_arg1:String):void{ controller.removeCommand(_arg1); } public function registerCommand(_arg1:String, _arg2:Class):void{ controller.registerCommand(_arg1, _arg2); } public function hasMediator(_arg1:String):Boolean{ return (view.hasMediator(_arg1)); } public function registerMediator(_arg1:IMediator):void{ if (view != null){ view.registerMediator(_arg1); }; } protected function initializeModel():void{ if (model != null){ return; }; model = Model.getInstance(); } public function hasProxy(_arg1:String):Boolean{ return (model.hasProxy(_arg1)); } public static function getInstance():IFacade{ if (instance == null){ instance = new (Facade); }; return (instance); } } }//package org.puremvc.as3.patterns.facade
Section 267
//Mediator (org.puremvc.as3.patterns.mediator.Mediator) package org.puremvc.as3.patterns.mediator { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.observer.*; public class Mediator extends Notifier implements IMediator, INotifier { protected var viewComponent:Object; protected var mediatorName:String; public static const NAME:String = "Mediator"; public function Mediator(_arg1:String=null, _arg2:Object=null){ this.mediatorName = ((_arg1)!=null) ? _arg1 : NAME; this.viewComponent = _arg2; } public function listNotificationInterests():Array{ return ([]); } public function onRegister():void{ } public function onRemove():void{ } public function getViewComponent():Object{ return (viewComponent); } public function handleNotification(_arg1:INotification):void{ } public function getMediatorName():String{ return (mediatorName); } public function setViewComponent(_arg1:Object):void{ this.viewComponent = _arg1; } } }//package org.puremvc.as3.patterns.mediator
Section 268
//Notification (org.puremvc.as3.patterns.observer.Notification) package org.puremvc.as3.patterns.observer { import org.puremvc.as3.interfaces.*; public class Notification implements INotification { private var body:Object; private var name:String; private var type:String; public function Notification(_arg1:String, _arg2:Object=null, _arg3:String=null){ this.name = _arg1; this.body = _arg2; this.type = _arg3; } public function setBody(_arg1:Object):void{ this.body = _arg1; } public function getName():String{ return (name); } public function toString():String{ var _local1:String = ("Notification Name: " + getName()); _local1 = (_local1 + ("\nBody:" + ((body)==null) ? "null" : body.toString())); _local1 = (_local1 + ("\nType:" + ((type)==null) ? "null" : type)); return (_local1); } public function getType():String{ return (type); } public function setType(_arg1:String):void{ this.type = _arg1; } public function getBody():Object{ return (body); } } }//package org.puremvc.as3.patterns.observer
Section 269
//Notifier (org.puremvc.as3.patterns.observer.Notifier) package org.puremvc.as3.patterns.observer { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.facade.*; public class Notifier implements INotifier { protected var facade:IFacade; public function Notifier(){ facade = Facade.getInstance(); super(); } public function sendNotification(_arg1:String, _arg2:Object=null, _arg3:String=null):void{ facade.sendNotification(_arg1, _arg2, _arg3); } } }//package org.puremvc.as3.patterns.observer
Section 270
//Observer (org.puremvc.as3.patterns.observer.Observer) package org.puremvc.as3.patterns.observer { import org.puremvc.as3.interfaces.*; public class Observer implements IObserver { private var notify:Function; private var context:Object; public function Observer(_arg1:Function, _arg2:Object){ setNotifyMethod(_arg1); setNotifyContext(_arg2); } private function getNotifyMethod():Function{ return (notify); } public function compareNotifyContext(_arg1:Object):Boolean{ return ((_arg1 === this.context)); } public function setNotifyContext(_arg1:Object):void{ context = _arg1; } private function getNotifyContext():Object{ return (context); } public function setNotifyMethod(_arg1:Function):void{ notify = _arg1; } public function notifyObserver(_arg1:INotification):void{ this.getNotifyMethod().apply(this.getNotifyContext(), [_arg1]); } } }//package org.puremvc.as3.patterns.observer
Section 271
//Proxy (org.puremvc.as3.patterns.proxy.Proxy) package org.puremvc.as3.patterns.proxy { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.observer.*; public class Proxy extends Notifier implements IProxy, INotifier { protected var proxyName:String; protected var data:Object; public static var NAME:String = "Proxy"; public function Proxy(_arg1:String=null, _arg2:Object=null){ this.proxyName = ((_arg1)!=null) ? _arg1 : NAME; if (_arg2 != null){ setData(_arg2); }; } public function getData():Object{ return (data); } public function getProxyName():String{ return (proxyName); } public function setData(_arg1:Object):void{ this.data = _arg1; } } }//package org.puremvc.as3.patterns.proxy
Section 272
//ApplicationFacade (ApplicationFacade) package { import org.puremvc.as3.interfaces.*; import flash.display.*; import org.puremvc.as3.patterns.facade.*; import org.puremvc.as3.patterns.observer.*; import game.controller.*; public class ApplicationFacade extends Facade implements IFacade { public var viewContainer:Sprite; public static const STARTUP:String = "Startup"; override protected function initializeController():void{ super.initializeController(); registerCommand(STARTUP, StartupCommand); } public function startup(_arg1:Object):void{ var _local2:Sprite = _arg1.container; viewContainer = new Sprite(); _local2.addChild(viewContainer); notifyObservers(new Notification(STARTUP, _arg1)); } public static function getInstance():ApplicationFacade{ if (instance == null){ instance = new (ApplicationFacade); }; return ((instance as ApplicationFacade)); } } }//package
Section 273
//Factory (Factory) package { import flash.events.*; import flash.display.*; import flash.net.*; import flash.utils.*; public class Factory extends MovieClip { private var preloader:Preloader; public static const DEBUG:Boolean = false; public static var KONG_VERSION:Boolean; public static var kongregate; public function Factory():void{ init(); } private function init():void{ stop(); MochiBot.track(this, "f7785368"); preloader = new Preloader(this); addChild(preloader); KONG_VERSION = (preloader.domain == "kongregate.com"); if (KONG_VERSION){ initKongAPI(); }; preloader.addEventListener(Event.COMPLETE, preloaderCompleteHandler); } private function initApp():void{ var _local2:Object; var _local1:Class = (getDefinitionByName("Particler") as Class); if (_local1){ _local2 = new (_local1); addChild((_local2 as DisplayObject)); }; } private function kongAPILoadComplete(_arg1:Event):void{ kongregate = _arg1.target.content; kongregate.services.connect(); trace(("\n" + kongregate.services)); trace(("\n" + kongregate.user)); trace(("\n" + kongregate.scores)); trace(("\n" + kongregate.stats)); } private function preloaderCompleteHandler(_arg1:Event):void{ preloader.removeEventListener(Event.COMPLETE, preloaderCompleteHandler); nextFrame(); initApp(); } private function initKongAPI():void{ var _local1:Object = LoaderInfo(root.loaderInfo).parameters; var _local2:String = ((_local1.api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf")); trace(("API path: " + _local2)); var _local3:URLRequest = new URLRequest(_local2); var _local4:Loader = new Loader(); _local4.contentLoaderInfo.addEventListener(Event.COMPLETE, kongAPILoadComplete); _local4.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, kongAPIErrorHandler); _local4.load(_local3); this.addChild(_local4); } private function kongAPIErrorHandler(_arg1:IOErrorEvent):void{ trace("ZZ", _arg1.text); } } }//package
Section 274
//MochiBot (MochiBot) package { import flash.display.*; import flash.net.*; import flash.system.*; public dynamic class MochiBot extends Sprite { public static function track(_arg1:Sprite, _arg2:String):MochiBot{ if (Security.sandboxType == "localWithFile"){ return (null); }; var _local3:MochiBot = new (MochiBot); _arg1.addChild(_local3); Security.allowDomain("*"); Security.allowInsecureDomain("*"); var _local4 = "http://core.mochibot.com/my/core.swf"; var _local5:URLVariables = new URLVariables(); _local5["sb"] = Security.sandboxType; _local5["v"] = Capabilities.version; _local5["swfid"] = _arg2; _local5["mv"] = "8"; _local5["fv"] = "9"; var _local6:String = _local3.root.loaderInfo.loaderURL; if (_local6.indexOf("http") == 0){ _local5["url"] = _local6; } else { _local5["url"] = "local"; }; var _local7:URLRequest = new URLRequest(_local4); _local7.contentType = "application/x-www-form-urlencoded"; _local7.method = URLRequestMethod.POST; _local7.data = _local5; var _local8:Loader = new Loader(); _local3.addChild(_local8); _local8.load(_local7); return (_local3); } } }//package
Section 275
//Particler (Particler) package { import flash.events.*; import flash.display.*; public class Particler extends Sprite { public function Particler():void{ addEventListener(Event.ADDED_TO_STAGE, addedHandler); } private function addedHandler(_arg1:Event):void{ ApplicationFacade.getInstance().startup({container:this}); } } }//package
Section 276
//Preloader (Preloader) package { import flash.events.*; import flash.display.*; import caurina.transitions.*; import mochi.as3.*; import flash.net.*; import flash.ui.*; import flash.text.*; public dynamic class Preloader extends MovieClip { public var domain:String; private var WindowClass:Class; private var factory:Factory; private var barHead:Sprite; private var bar:Sprite; private var mochiComplete:Boolean; private var barHolder:Sprite; private var sponsorLogo_bt:SimpleButton; private var progress:Sprite; private var window:Sprite; private var loadComplete:Boolean; public function Preloader(_arg1:Factory):void{ WindowClass = Preloader_WindowClass; super(); this.factory = _arg1; init(); } private function getDomain():String{ var _local1:String = stage.loaderInfo.url; var _local2:Number = (_local1.indexOf("://") + 3); var _local3:Number = _local1.indexOf("/", _local2); var _local4:String = _local1.substring(_local2, _local3); var _local5:Number = (_local4.lastIndexOf(".") - 1); var _local6:Number = (_local4.lastIndexOf(".", _local5) + 1); _local4 = _local4.substring(_local6, _local4.length); return (_local4); } private function init():void{ var _local1:ContextMenu = new ContextMenu(); _local1.hideBuiltInItems(); factory.contextMenu = _local1; addEventListener(Event.ADDED_TO_STAGE, addedHandler); } private function sponsorClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1290&subid=preloader"), "_blank"); } private function hideComplete():void{ sponsorLogo_bt.removeEventListener(MouseEvent.CLICK, sponsorClickHandler); parent.removeChild(this); dispatchEvent(new Event(Event.COMPLETE)); } private function shallWeContinue():void{ if (((mochiComplete) && (loadComplete))){ Tweener.addTween(window, {alpha:0, time:0.5, transition:"linear", onComplete:hideComplete}); }; } private function domainNotAvailable():void{ var _local1:TextField = new TextField(); _local1.width = 600; _local1.wordWrap = true; _local1.multiline = true; _local1.text = ("Sorry, this game is not available on domain " + stage.loaderInfo.url); addChild(_local1); } private function addedHandler(_arg1:Event):void{ removeEventListener(Event.ADDED_TO_STAGE, addedHandler); domain = getDomain(); window = new WindowClass(); addChild(window); barHolder = (window.getChildByName("barHolder") as Sprite); bar = (barHolder.getChildByName("bar") as Sprite); sponsorLogo_bt = (window.getChildByName("sponsorLogo_bt") as SimpleButton); barHead = (barHolder.getChildByName("head") as Sprite); bar.scaleX = 0; barHead.visible = false; sponsorLogo_bt.addEventListener(MouseEvent.CLICK, sponsorClickHandler); mochiComplete = true; addEventListener(Event.ENTER_FRAME, efHandler); if (domain == "bubblebox.com"){ } else { showAds(); }; } private function mochiCompleteHandler():void{ mochiComplete = true; shallWeContinue(); } private function efHandler(_arg1:Event):void{ var _local2:Number; if (factory.framesLoaded == factory.totalFrames){ loadComplete = true; shallWeContinue(); bar.scaleX = 1; barHead.x = (bar.x + bar.width); removeEventListener(Event.ENTER_FRAME, efHandler); } else { _local2 = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal); bar.scaleX = _local2; barHead.x = (bar.x + bar.width); }; } private function showAds():void{ mochiComplete = false; MochiAd.showPreGameAd({clip:this, id:"94ebb732abdc314d", res:"640x480", no_bg:true, ad_finished:mochiCompleteHandler}); } } }//package
Section 277
//Preloader_WindowClass (Preloader_WindowClass) package { import flash.display.*; import mx.core.*; public class Preloader_WindowClass extends SpriteAsset { public var head:DisplayObject; public var bar:DisplayObject; public var sponsorLogo_bt:DisplayObject; public var barHolder:DisplayObject; } }//package

Library Items

Symbol 1 BitmapUsed by:2
Symbol 2 GraphicUses:1Used by:21
Symbol 3 BitmapUsed by:4
Symbol 4 GraphicUses:3Used by:11
Symbol 5 GraphicUsed by:11
Symbol 6 BitmapUsed by:7
Symbol 7 GraphicUses:6Used by:8
Symbol 8 MovieClipUses:7Used by:11
Symbol 9 GraphicUsed by:10
Symbol 10 MovieClipUses:9Used by:11
Symbol 11 MovieClipUses:4 5 8 10Used by:21
Symbol 12 GraphicUsed by:16
Symbol 13 BitmapUsed by:14 15
Symbol 14 GraphicUses:13Used by:16
Symbol 15 GraphicUses:13Used by:16
Symbol 16 ButtonUses:12 14 15Used by:17
Symbol 17 ButtonUses:16Used by:21
Symbol 18 BitmapUsed by:20
Symbol 19 BitmapUsed by:20
Symbol 20 GraphicUses:18 19Used by:21
Symbol 21 MovieClip {Preloader_WindowClass} [PreloaderWindow]Uses:2 11 17 20
Symbol 22 BinaryData {game.model.GameAssets_Assets}
Symbol 23 BinaryData {core.CoreAssets_Assets}
Symbol 24 BinaryData {editor.model.EditorAssets_Assets}

Instance Names

"head"Symbol 11 MovieClip Frame 1Symbol 8 MovieClip
"bar"Symbol 11 MovieClip Frame 1Symbol 10 MovieClip
"barHolder"Symbol 21 MovieClip {Preloader_WindowClass} [PreloaderWindow] Frame 1Symbol 11 MovieClip
"sponsorLogo_bt"Symbol 21 MovieClip {Preloader_WindowClass} [PreloaderWindow] Frame 1Symbol 17 Button

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1457 bytes "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns ..."
ScriptLimits (65)Timeline Frame 1MaxRecursionDepth: 1000, ScriptTimeout: 60 seconds
ExportAssets (56)Timeline Frame 1Symbol 21 as "PreloaderWindow"
SerialNumber (41)Timeline Frame 1

Labels

"Factory"Frame 1
"Particler"Frame 2




http://swfchan.com/20/99613/info.shtml
Created: 21/3 -2019 19:47:52 Last modified: 21/3 -2019 19:47:52 Server time: 14/11 -2024 06:32:04